claude-mux 0.7.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 (636) hide show
  1. package/.beads/README.md +81 -0
  2. package/.beads/config.yaml +62 -0
  3. package/.beads/interactions.jsonl +0 -0
  4. package/.beads/issues.jsonl +5 -0
  5. package/.beads/metadata.json +4 -0
  6. package/.eslintrc.json +25 -0
  7. package/.gitattributes +3 -0
  8. package/.prettierrc +7 -0
  9. package/CLAUDE.md +123 -0
  10. package/LICENSE +21 -0
  11. package/PLAN-beads-integration.md +250 -0
  12. package/README.md +366 -0
  13. package/dist/app.d.ts +2 -0
  14. package/dist/app.d.ts.map +1 -0
  15. package/dist/app.js +147 -0
  16. package/dist/app.js.map +1 -0
  17. package/dist/cli.d.ts +3 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +65 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/commands/index.d.ts +5 -0
  22. package/dist/commands/index.d.ts.map +1 -0
  23. package/dist/commands/index.js +5 -0
  24. package/dist/commands/index.js.map +1 -0
  25. package/dist/commands/serve.d.ts +8 -0
  26. package/dist/commands/serve.d.ts.map +1 -0
  27. package/dist/commands/serve.js +59 -0
  28. package/dist/commands/serve.js.map +1 -0
  29. package/dist/commands/setup.d.ts +4 -0
  30. package/dist/commands/setup.d.ts.map +1 -0
  31. package/dist/commands/setup.js +12 -0
  32. package/dist/commands/setup.js.map +1 -0
  33. package/dist/commands/tui.d.ts +9 -0
  34. package/dist/commands/tui.d.ts.map +1 -0
  35. package/dist/commands/tui.js +234 -0
  36. package/dist/commands/tui.js.map +1 -0
  37. package/dist/commands/uninstall.d.ts +4 -0
  38. package/dist/commands/uninstall.d.ts.map +1 -0
  39. package/dist/commands/uninstall.js +12 -0
  40. package/dist/commands/uninstall.js.map +1 -0
  41. package/dist/components/Header.d.ts +7 -0
  42. package/dist/components/Header.d.ts.map +1 -0
  43. package/dist/components/Header.js +14 -0
  44. package/dist/components/Header.js.map +1 -0
  45. package/dist/components/HelpDialog.d.ts +6 -0
  46. package/dist/components/HelpDialog.d.ts.map +1 -0
  47. package/dist/components/HelpDialog.js +14 -0
  48. package/dist/components/HelpDialog.js.map +1 -0
  49. package/dist/components/SessionEntry.d.ts +17 -0
  50. package/dist/components/SessionEntry.d.ts.map +1 -0
  51. package/dist/components/SessionEntry.js +102 -0
  52. package/dist/components/SessionEntry.js.map +1 -0
  53. package/dist/components/SessionList.d.ts +14 -0
  54. package/dist/components/SessionList.d.ts.map +1 -0
  55. package/dist/components/SessionList.js +57 -0
  56. package/dist/components/SessionList.js.map +1 -0
  57. package/dist/components/StatusBar.d.ts +6 -0
  58. package/dist/components/StatusBar.d.ts.map +1 -0
  59. package/dist/components/StatusBar.js +7 -0
  60. package/dist/components/StatusBar.js.map +1 -0
  61. package/dist/components/index.d.ts +6 -0
  62. package/dist/components/index.d.ts.map +1 -0
  63. package/dist/components/index.js +6 -0
  64. package/dist/components/index.js.map +1 -0
  65. package/dist/db/index.d.ts +2 -0
  66. package/dist/db/index.d.ts.map +1 -0
  67. package/dist/db/index.js +3 -0
  68. package/dist/db/index.js.map +1 -0
  69. package/dist/db/schema.d.ts +4 -0
  70. package/dist/db/schema.d.ts.map +1 -0
  71. package/dist/db/schema.js +23 -0
  72. package/dist/db/schema.js.map +1 -0
  73. package/dist/db/sessions-json.d.ts +85 -0
  74. package/dist/db/sessions-json.d.ts.map +1 -0
  75. package/dist/db/sessions-json.js +242 -0
  76. package/dist/db/sessions-json.js.map +1 -0
  77. package/dist/db/sessions.d.ts +38 -0
  78. package/dist/db/sessions.d.ts.map +1 -0
  79. package/dist/db/sessions.js +87 -0
  80. package/dist/db/sessions.js.map +1 -0
  81. package/dist/hooks/claude-mux-hook.d.ts +15 -0
  82. package/dist/hooks/claude-mux-hook.d.ts.map +1 -0
  83. package/dist/hooks/claude-mux-hook.js +396 -0
  84. package/dist/hooks/claude-mux-hook.js.map +1 -0
  85. package/dist/hooks/claude-watch-hook.d.ts +15 -0
  86. package/dist/hooks/claude-watch-hook.d.ts.map +1 -0
  87. package/dist/hooks/claude-watch-hook.js +396 -0
  88. package/dist/hooks/claude-watch-hook.js.map +1 -0
  89. package/dist/server/custom-server.d.ts +13 -0
  90. package/dist/server/custom-server.d.ts.map +1 -0
  91. package/dist/server/custom-server.js +63 -0
  92. package/dist/server/custom-server.js.map +1 -0
  93. package/dist/server/index.d.ts +9 -0
  94. package/dist/server/index.d.ts.map +1 -0
  95. package/dist/server/index.js +1143 -0
  96. package/dist/server/index.js.map +1 -0
  97. package/dist/server/middleware/cors.d.ts +2 -0
  98. package/dist/server/middleware/cors.d.ts.map +1 -0
  99. package/dist/server/middleware/cors.js +11 -0
  100. package/dist/server/middleware/cors.js.map +1 -0
  101. package/dist/server/routes/sessions.d.ts +3 -0
  102. package/dist/server/routes/sessions.d.ts.map +1 -0
  103. package/dist/server/routes/sessions.js +78 -0
  104. package/dist/server/routes/sessions.js.map +1 -0
  105. package/dist/server/routes/stream.d.ts +3 -0
  106. package/dist/server/routes/stream.d.ts.map +1 -0
  107. package/dist/server/routes/stream.js +45 -0
  108. package/dist/server/routes/stream.js.map +1 -0
  109. package/dist/server/types.d.ts +28 -0
  110. package/dist/server/types.d.ts.map +1 -0
  111. package/dist/server/types.js +2 -0
  112. package/dist/server/types.js.map +1 -0
  113. package/dist/server/watcher.d.ts +22 -0
  114. package/dist/server/watcher.d.ts.map +1 -0
  115. package/dist/server/watcher.js +119 -0
  116. package/dist/server/watcher.js.map +1 -0
  117. package/dist/server/websocket.d.ts +51 -0
  118. package/dist/server/websocket.d.ts.map +1 -0
  119. package/dist/server/websocket.js +156 -0
  120. package/dist/server/websocket.js.map +1 -0
  121. package/dist/server/ws-handlers.d.ts +174 -0
  122. package/dist/server/ws-handlers.d.ts.map +1 -0
  123. package/dist/server/ws-handlers.js +695 -0
  124. package/dist/server/ws-handlers.js.map +1 -0
  125. package/dist/setup/hooks.d.ts +44 -0
  126. package/dist/setup/hooks.d.ts.map +1 -0
  127. package/dist/setup/hooks.js +267 -0
  128. package/dist/setup/hooks.js.map +1 -0
  129. package/dist/setup/index.d.ts +3 -0
  130. package/dist/setup/index.d.ts.map +1 -0
  131. package/dist/setup/index.js +3 -0
  132. package/dist/setup/index.js.map +1 -0
  133. package/dist/setup/wizard.d.ts +4 -0
  134. package/dist/setup/wizard.d.ts.map +1 -0
  135. package/dist/setup/wizard.js +72 -0
  136. package/dist/setup/wizard.js.map +1 -0
  137. package/dist/tmux/detect.d.ts +25 -0
  138. package/dist/tmux/detect.d.ts.map +1 -0
  139. package/dist/tmux/detect.js +71 -0
  140. package/dist/tmux/detect.js.map +1 -0
  141. package/dist/tmux/navigate.d.ts +13 -0
  142. package/dist/tmux/navigate.d.ts.map +1 -0
  143. package/dist/tmux/navigate.js +41 -0
  144. package/dist/tmux/navigate.js.map +1 -0
  145. package/dist/tmux/pane.d.ts +57 -0
  146. package/dist/tmux/pane.d.ts.map +1 -0
  147. package/dist/tmux/pane.js +156 -0
  148. package/dist/tmux/pane.js.map +1 -0
  149. package/dist/tmux/resize.d.ts +10 -0
  150. package/dist/tmux/resize.d.ts.map +1 -0
  151. package/dist/tmux/resize.js +25 -0
  152. package/dist/tmux/resize.js.map +1 -0
  153. package/dist/utils/paths.d.ts +7 -0
  154. package/dist/utils/paths.d.ts.map +1 -0
  155. package/dist/utils/paths.js +9 -0
  156. package/dist/utils/paths.js.map +1 -0
  157. package/dist/utils/pid.d.ts +5 -0
  158. package/dist/utils/pid.d.ts.map +1 -0
  159. package/dist/utils/pid.js +14 -0
  160. package/dist/utils/pid.js.map +1 -0
  161. package/dist/utils/version.d.ts +6 -0
  162. package/dist/utils/version.d.ts.map +1 -0
  163. package/dist/utils/version.js +6 -0
  164. package/dist/utils/version.js.map +1 -0
  165. package/dist/web/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
  166. package/dist/web/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
  167. package/dist/web/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
  168. package/dist/web/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
  169. package/dist/web/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
  170. package/dist/web/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
  171. package/dist/web/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
  172. package/dist/web/client/_app/immutable/chunks/C9P-coqM.js +1 -0
  173. package/dist/web/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
  174. package/dist/web/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
  175. package/dist/web/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
  176. package/dist/web/client/_app/immutable/chunks/HKNo9LID.js +5 -0
  177. package/dist/web/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
  178. package/dist/web/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
  179. package/dist/web/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
  180. package/dist/web/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
  181. package/dist/web/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
  182. package/dist/web/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
  183. package/dist/web/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
  184. package/dist/web/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
  185. package/dist/web/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
  186. package/dist/web/client/_app/version.json +1 -0
  187. package/dist/web/client/robots.txt +3 -0
  188. package/dist/web/env.js +32 -0
  189. package/dist/web/handler.js +744 -0
  190. package/dist/web/index.js +49 -0
  191. package/dist/web/server/chunks/0-BHWsmCJv.js +23 -0
  192. package/dist/web/server/chunks/0-BHWsmCJv.js.map +1 -0
  193. package/dist/web/server/chunks/1-YRx6A8Tm.js +17 -0
  194. package/dist/web/server/chunks/1-YRx6A8Tm.js.map +1 -0
  195. package/dist/web/server/chunks/2-eC6JuGAo.js +22 -0
  196. package/dist/web/server/chunks/2-eC6JuGAo.js.map +1 -0
  197. package/dist/web/server/chunks/3-Bk-wV20p.js +32 -0
  198. package/dist/web/server/chunks/3-Bk-wV20p.js.map +1 -0
  199. package/dist/web/server/chunks/4-nteBgDrW.js +21 -0
  200. package/dist/web/server/chunks/4-nteBgDrW.js.map +1 -0
  201. package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js +35 -0
  202. package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js.map +1 -0
  203. package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js +453 -0
  204. package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js.map +1 -0
  205. package/dist/web/server/chunks/_page.svelte-Be6iabRn.js +34 -0
  206. package/dist/web/server/chunks/_page.svelte-Be6iabRn.js.map +1 -0
  207. package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js +576 -0
  208. package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js.map +1 -0
  209. package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js +2722 -0
  210. package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js.map +1 -0
  211. package/dist/web/server/chunks/_server.ts-3WAmKvn2.js +34 -0
  212. package/dist/web/server/chunks/_server.ts-3WAmKvn2.js.map +1 -0
  213. package/dist/web/server/chunks/_server.ts-BAWJCSFb.js +29 -0
  214. package/dist/web/server/chunks/_server.ts-BAWJCSFb.js.map +1 -0
  215. package/dist/web/server/chunks/_server.ts-BPpMOZCm.js +24 -0
  216. package/dist/web/server/chunks/_server.ts-BPpMOZCm.js.map +1 -0
  217. package/dist/web/server/chunks/_server.ts-BUKgRb6U.js +13 -0
  218. package/dist/web/server/chunks/_server.ts-BUKgRb6U.js.map +1 -0
  219. package/dist/web/server/chunks/_server.ts-BVHUS8fm.js +41 -0
  220. package/dist/web/server/chunks/_server.ts-BVHUS8fm.js.map +1 -0
  221. package/dist/web/server/chunks/_server.ts-BrF3od0O.js +45 -0
  222. package/dist/web/server/chunks/_server.ts-BrF3od0O.js.map +1 -0
  223. package/dist/web/server/chunks/_server.ts-C4oPmOJR.js +38 -0
  224. package/dist/web/server/chunks/_server.ts-C4oPmOJR.js.map +1 -0
  225. package/dist/web/server/chunks/_server.ts-CDAUUmG_.js +21 -0
  226. package/dist/web/server/chunks/_server.ts-CDAUUmG_.js.map +1 -0
  227. package/dist/web/server/chunks/_server.ts-CR0uWvpz.js +24 -0
  228. package/dist/web/server/chunks/_server.ts-CR0uWvpz.js.map +1 -0
  229. package/dist/web/server/chunks/_server.ts-CSqdCNGi.js +21 -0
  230. package/dist/web/server/chunks/_server.ts-CSqdCNGi.js.map +1 -0
  231. package/dist/web/server/chunks/_server.ts-DI9fzUo9.js +52 -0
  232. package/dist/web/server/chunks/_server.ts-DI9fzUo9.js.map +1 -0
  233. package/dist/web/server/chunks/_server.ts-DNjJTClI.js +46 -0
  234. package/dist/web/server/chunks/_server.ts-DNjJTClI.js.map +1 -0
  235. package/dist/web/server/chunks/_server.ts-DdbOAkOj.js +22 -0
  236. package/dist/web/server/chunks/_server.ts-DdbOAkOj.js.map +1 -0
  237. package/dist/web/server/chunks/_server.ts-Df2isGQc.js +41 -0
  238. package/dist/web/server/chunks/_server.ts-Df2isGQc.js.map +1 -0
  239. package/dist/web/server/chunks/_server.ts-Vpw25_-3.js +12 -0
  240. package/dist/web/server/chunks/_server.ts-Vpw25_-3.js.map +1 -0
  241. package/dist/web/server/chunks/_server.ts-WldRpSRi.js +26 -0
  242. package/dist/web/server/chunks/_server.ts-WldRpSRi.js.map +1 -0
  243. package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js +2890 -0
  244. package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js.map +1 -0
  245. package/dist/web/server/chunks/auth-DrUf-v4J.js +51 -0
  246. package/dist/web/server/chunks/auth-DrUf-v4J.js.map +1 -0
  247. package/dist/web/server/chunks/button-D6xS9rHt.js +2335 -0
  248. package/dist/web/server/chunks/button-D6xS9rHt.js.map +1 -0
  249. package/dist/web/server/chunks/chunk-EKzHsMy_.js +42 -0
  250. package/dist/web/server/chunks/chunks-DmdqVYC7.js +58 -0
  251. package/dist/web/server/chunks/chunks-DmdqVYC7.js.map +1 -0
  252. package/dist/web/server/chunks/client-CUrSQijh.js +18 -0
  253. package/dist/web/server/chunks/client-CUrSQijh.js.map +1 -0
  254. package/dist/web/server/chunks/clsx-FzI4_gi0.js +332 -0
  255. package/dist/web/server/chunks/clsx-FzI4_gi0.js.map +1 -0
  256. package/dist/web/server/chunks/error.svelte-D-c-9pTE.js +27 -0
  257. package/dist/web/server/chunks/error.svelte-D-c-9pTE.js.map +1 -0
  258. package/dist/web/server/chunks/events-BDBlYddw.js +89 -0
  259. package/dist/web/server/chunks/events-BDBlYddw.js.map +1 -0
  260. package/dist/web/server/chunks/exports-CCurQ-Tl.js +131 -0
  261. package/dist/web/server/chunks/exports-CCurQ-Tl.js.map +1 -0
  262. package/dist/web/server/chunks/hooks.server-BK1bopsh.js +86 -0
  263. package/dist/web/server/chunks/hooks.server-BK1bopsh.js.map +1 -0
  264. package/dist/web/server/chunks/index2-BQnysSj-.js +2588 -0
  265. package/dist/web/server/chunks/index2-BQnysSj-.js.map +1 -0
  266. package/dist/web/server/chunks/internal-DLENj6YI.js +61 -0
  267. package/dist/web/server/chunks/internal-DLENj6YI.js.map +1 -0
  268. package/dist/web/server/chunks/pane-Dg3pKvsm.js +94 -0
  269. package/dist/web/server/chunks/pane-Dg3pKvsm.js.map +1 -0
  270. package/dist/web/server/chunks/sessions-json-DgfkCLO7.js +107 -0
  271. package/dist/web/server/chunks/sessions-json-DgfkCLO7.js.map +1 -0
  272. package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js +178 -0
  273. package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js.map +1 -0
  274. package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js +7 -0
  275. package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js.map +1 -0
  276. package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js +733 -0
  277. package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js.map +1 -0
  278. package/dist/web/server/index.js +4907 -0
  279. package/dist/web/server/index.js.map +1 -0
  280. package/dist/web/server/manifest.js +233 -0
  281. package/dist/web/server/manifest.js.map +1 -0
  282. package/docs/images/desktop-dashboard.png +0 -0
  283. package/docs/images/desktop-session.png +0 -0
  284. package/docs/images/mobile-dashboard.png +0 -0
  285. package/docs/images/mobile-session.png +0 -0
  286. package/docs/release-checklist.md +228 -0
  287. package/docs/removing-hooks.md +135 -0
  288. package/docs/state-transitions.md +109 -0
  289. package/package.json +71 -0
  290. package/src/app.tsx +188 -0
  291. package/src/cli.ts +83 -0
  292. package/src/commands/index.ts +4 -0
  293. package/src/commands/serve.ts +75 -0
  294. package/src/commands/setup.ts +13 -0
  295. package/src/commands/tui.ts +255 -0
  296. package/src/commands/uninstall.ts +13 -0
  297. package/src/components/Header.tsx +32 -0
  298. package/src/components/HelpDialog.tsx +45 -0
  299. package/src/components/SessionEntry.tsx +202 -0
  300. package/src/components/SessionList.tsx +98 -0
  301. package/src/components/StatusBar.tsx +26 -0
  302. package/src/components/index.ts +5 -0
  303. package/src/db/index.ts +20 -0
  304. package/src/db/sessions-json.ts +314 -0
  305. package/src/hooks/claude-mux-hook.ts +498 -0
  306. package/src/server/watcher.ts +128 -0
  307. package/src/server/ws-handlers.ts +922 -0
  308. package/src/setup/hooks.ts +333 -0
  309. package/src/setup/index.ts +2 -0
  310. package/src/setup/wizard.ts +81 -0
  311. package/src/tmux/detect.ts +87 -0
  312. package/src/tmux/navigate.ts +42 -0
  313. package/src/tmux/pane.ts +167 -0
  314. package/src/tmux/resize.ts +28 -0
  315. package/src/utils/paths.ts +11 -0
  316. package/src/utils/pid.ts +12 -0
  317. package/src/utils/version.ts +5 -0
  318. package/tests/components/Header.test.tsx +42 -0
  319. package/tests/components/SessionEntry-extended.test.tsx +165 -0
  320. package/tests/components/SessionEntry.test.tsx +138 -0
  321. package/tests/components/SessionList.test.tsx +110 -0
  322. package/tests/components/StatusBar.test.tsx +31 -0
  323. package/tests/db/index.test.ts +78 -0
  324. package/tests/db/sessions.test.ts +230 -0
  325. package/tests/server/integration.test.ts +319 -0
  326. package/tests/server/sessions.test.ts +114 -0
  327. package/tests/setup/hooks-integration.test.ts +148 -0
  328. package/tests/setup/hooks.test.ts +123 -0
  329. package/tests/tmux/detect.test.ts +54 -0
  330. package/tests/tmux/navigate.test.ts +30 -0
  331. package/tests/utils/pid.test.ts +17 -0
  332. package/tsconfig.cli.json +9 -0
  333. package/tsconfig.json +22 -0
  334. package/vitest.config.ts +29 -0
  335. package/web/.svelte-kit/adapter-bun/.vite/manifest.json +408 -0
  336. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
  337. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
  338. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DldLgTc-.css +1 -0
  339. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
  340. package/web/.svelte-kit/adapter-bun/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
  341. package/web/.svelte-kit/adapter-bun/chunks/alert-dialog-description.js +2670 -0
  342. package/web/.svelte-kit/adapter-bun/chunks/auth.js +59 -0
  343. package/web/.svelte-kit/adapter-bun/chunks/button.js +82 -0
  344. package/web/.svelte-kit/adapter-bun/chunks/client.js +29 -0
  345. package/web/.svelte-kit/adapter-bun/chunks/context.js +133 -0
  346. package/web/.svelte-kit/adapter-bun/chunks/environment.js +34 -0
  347. package/web/.svelte-kit/adapter-bun/chunks/events.js +121 -0
  348. package/web/.svelte-kit/adapter-bun/chunks/exports.js +174 -0
  349. package/web/.svelte-kit/adapter-bun/chunks/false.js +4 -0
  350. package/web/.svelte-kit/adapter-bun/chunks/index.js +59 -0
  351. package/web/.svelte-kit/adapter-bun/chunks/index2.js +2828 -0
  352. package/web/.svelte-kit/adapter-bun/chunks/internal.js +920 -0
  353. package/web/.svelte-kit/adapter-bun/chunks/pane.js +82 -0
  354. package/web/.svelte-kit/adapter-bun/chunks/sessions-json.js +124 -0
  355. package/web/.svelte-kit/adapter-bun/chunks/sessions.svelte.js +229 -0
  356. package/web/.svelte-kit/adapter-bun/chunks/shared.js +542 -0
  357. package/web/.svelte-kit/adapter-bun/chunks/state.svelte.js +16 -0
  358. package/web/.svelte-kit/adapter-bun/chunks/utils.js +43 -0
  359. package/web/.svelte-kit/adapter-bun/chunks/ws-handlers.js +782 -0
  360. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/login/_server.ts.js +22 -0
  361. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
  362. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/beads/_server.ts.js +22 -0
  363. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/browse/_server.ts.js +50 -0
  364. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/chrome/_server.ts.js +30 -0
  365. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/files/image/_server.ts.js +53 -0
  366. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/health/_server.ts.js +7 -0
  367. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  368. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  369. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
  370. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
  371. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
  372. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
  373. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_server.ts.js +49 -0
  374. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  375. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
  376. package/web/.svelte-kit/adapter-bun/entries/fallbacks/error.svelte.js +27 -0
  377. package/web/.svelte-kit/adapter-bun/entries/hooks.server.js +105 -0
  378. package/web/.svelte-kit/adapter-bun/entries/pages/_layout.svelte.js +499 -0
  379. package/web/.svelte-kit/adapter-bun/entries/pages/_page.svelte.js +3057 -0
  380. package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.server.ts.js +15 -0
  381. package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.svelte.js +37 -0
  382. package/web/.svelte-kit/adapter-bun/entries/pages/session/_target_/_page.svelte.js +653 -0
  383. package/web/.svelte-kit/adapter-bun/index.js +3864 -0
  384. package/web/.svelte-kit/adapter-bun/internal.js +13 -0
  385. package/web/.svelte-kit/adapter-bun/manifest-full.js +167 -0
  386. package/web/.svelte-kit/adapter-bun/manifest.js +171 -0
  387. package/web/.svelte-kit/adapter-bun/nodes/0.js +8 -0
  388. package/web/.svelte-kit/adapter-bun/nodes/1.js +8 -0
  389. package/web/.svelte-kit/adapter-bun/nodes/2.js +8 -0
  390. package/web/.svelte-kit/adapter-bun/nodes/3.js +10 -0
  391. package/web/.svelte-kit/adapter-bun/nodes/4.js +8 -0
  392. package/web/.svelte-kit/adapter-bun/remote-entry.js +541 -0
  393. package/web/.svelte-kit/adapter-node/.vite/manifest.json +223 -0
  394. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.4NiX29PU.css +1 -0
  395. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.BEMzYUGV.css +1 -0
  396. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOJn7TG7.css +1 -0
  397. package/web/.svelte-kit/adapter-node/chunks/context.js +121 -0
  398. package/web/.svelte-kit/adapter-node/chunks/environment.js +34 -0
  399. package/web/.svelte-kit/adapter-node/chunks/exports.js +174 -0
  400. package/web/.svelte-kit/adapter-node/chunks/false.js +4 -0
  401. package/web/.svelte-kit/adapter-node/chunks/index.js +59 -0
  402. package/web/.svelte-kit/adapter-node/chunks/index2.js +2710 -0
  403. package/web/.svelte-kit/adapter-node/chunks/internal.js +1005 -0
  404. package/web/.svelte-kit/adapter-node/chunks/sessions-json.js +109 -0
  405. package/web/.svelte-kit/adapter-node/chunks/sessions.svelte.js +67 -0
  406. package/web/.svelte-kit/adapter-node/chunks/shared.js +542 -0
  407. package/web/.svelte-kit/adapter-node/chunks/state.svelte.js +16 -0
  408. package/web/.svelte-kit/adapter-node/chunks/utils.js +43 -0
  409. package/web/.svelte-kit/adapter-node/entries/endpoints/api/browse/_server.ts.js +50 -0
  410. package/web/.svelte-kit/adapter-node/entries/endpoints/api/health/_server.ts.js +7 -0
  411. package/web/.svelte-kit/adapter-node/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  412. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  413. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +30 -0
  414. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/send/_server.ts.js +22 -0
  415. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_server.ts.js +126 -0
  416. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  417. package/web/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +44 -0
  418. package/web/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +12 -0
  419. package/web/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +87 -0
  420. package/web/.svelte-kit/adapter-node/entries/pages/session/_target_/_page.svelte.js +76 -0
  421. package/web/.svelte-kit/adapter-node/index.js +3864 -0
  422. package/web/.svelte-kit/adapter-node/internal.js +13 -0
  423. package/web/.svelte-kit/adapter-node/manifest-full.js +103 -0
  424. package/web/.svelte-kit/adapter-node/manifest.js +107 -0
  425. package/web/.svelte-kit/adapter-node/nodes/0.js +8 -0
  426. package/web/.svelte-kit/adapter-node/nodes/1.js +8 -0
  427. package/web/.svelte-kit/adapter-node/nodes/2.js +8 -0
  428. package/web/.svelte-kit/adapter-node/nodes/3.js +8 -0
  429. package/web/.svelte-kit/adapter-node/remote-entry.js +541 -0
  430. package/web/.svelte-kit/ambient.d.ts +187 -0
  431. package/web/.svelte-kit/generated/client/app.js +33 -0
  432. package/web/.svelte-kit/generated/client/matchers.js +1 -0
  433. package/web/.svelte-kit/generated/client/nodes/0.js +1 -0
  434. package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
  435. package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
  436. package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
  437. package/web/.svelte-kit/generated/client/nodes/4.js +1 -0
  438. package/web/.svelte-kit/generated/client-optimized/app.js +33 -0
  439. package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
  440. package/web/.svelte-kit/generated/client-optimized/nodes/0.js +1 -0
  441. package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
  442. package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
  443. package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
  444. package/web/.svelte-kit/generated/client-optimized/nodes/4.js +1 -0
  445. package/web/.svelte-kit/generated/root.js +3 -0
  446. package/web/.svelte-kit/generated/root.svelte +68 -0
  447. package/web/.svelte-kit/generated/server/internal.js +53 -0
  448. package/web/.svelte-kit/non-ambient.d.ts +73 -0
  449. package/web/.svelte-kit/output/client/.vite/manifest.json +203 -0
  450. package/web/.svelte-kit/output/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
  451. package/web/.svelte-kit/output/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
  452. package/web/.svelte-kit/output/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
  453. package/web/.svelte-kit/output/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
  454. package/web/.svelte-kit/output/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
  455. package/web/.svelte-kit/output/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
  456. package/web/.svelte-kit/output/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
  457. package/web/.svelte-kit/output/client/_app/immutable/chunks/C9P-coqM.js +1 -0
  458. package/web/.svelte-kit/output/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
  459. package/web/.svelte-kit/output/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
  460. package/web/.svelte-kit/output/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
  461. package/web/.svelte-kit/output/client/_app/immutable/chunks/HKNo9LID.js +5 -0
  462. package/web/.svelte-kit/output/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
  463. package/web/.svelte-kit/output/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
  464. package/web/.svelte-kit/output/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
  465. package/web/.svelte-kit/output/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
  466. package/web/.svelte-kit/output/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
  467. package/web/.svelte-kit/output/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
  468. package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
  469. package/web/.svelte-kit/output/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
  470. package/web/.svelte-kit/output/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
  471. package/web/.svelte-kit/output/client/_app/version.json +1 -0
  472. package/web/.svelte-kit/output/client/robots.txt +3 -0
  473. package/web/.svelte-kit/output/server/.vite/manifest.json +408 -0
  474. package/web/.svelte-kit/output/server/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
  475. package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
  476. package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DldLgTc-.css +1 -0
  477. package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
  478. package/web/.svelte-kit/output/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
  479. package/web/.svelte-kit/output/server/chunks/alert-dialog-description.js +2670 -0
  480. package/web/.svelte-kit/output/server/chunks/auth.js +59 -0
  481. package/web/.svelte-kit/output/server/chunks/button.js +82 -0
  482. package/web/.svelte-kit/output/server/chunks/client.js +29 -0
  483. package/web/.svelte-kit/output/server/chunks/context.js +133 -0
  484. package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
  485. package/web/.svelte-kit/output/server/chunks/events.js +121 -0
  486. package/web/.svelte-kit/output/server/chunks/exports.js +174 -0
  487. package/web/.svelte-kit/output/server/chunks/false.js +4 -0
  488. package/web/.svelte-kit/output/server/chunks/index.js +59 -0
  489. package/web/.svelte-kit/output/server/chunks/index2.js +2828 -0
  490. package/web/.svelte-kit/output/server/chunks/internal.js +920 -0
  491. package/web/.svelte-kit/output/server/chunks/pane.js +82 -0
  492. package/web/.svelte-kit/output/server/chunks/sessions-json.js +124 -0
  493. package/web/.svelte-kit/output/server/chunks/sessions.svelte.js +229 -0
  494. package/web/.svelte-kit/output/server/chunks/shared.js +542 -0
  495. package/web/.svelte-kit/output/server/chunks/state.svelte.js +16 -0
  496. package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
  497. package/web/.svelte-kit/output/server/chunks/ws-handlers.js +782 -0
  498. package/web/.svelte-kit/output/server/entries/endpoints/api/auth/login/_server.ts.js +22 -0
  499. package/web/.svelte-kit/output/server/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
  500. package/web/.svelte-kit/output/server/entries/endpoints/api/beads/_server.ts.js +22 -0
  501. package/web/.svelte-kit/output/server/entries/endpoints/api/browse/_server.ts.js +50 -0
  502. package/web/.svelte-kit/output/server/entries/endpoints/api/chrome/_server.ts.js +30 -0
  503. package/web/.svelte-kit/output/server/entries/endpoints/api/files/image/_server.ts.js +53 -0
  504. package/web/.svelte-kit/output/server/entries/endpoints/api/health/_server.ts.js +7 -0
  505. package/web/.svelte-kit/output/server/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  506. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  507. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
  508. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
  509. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
  510. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
  511. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_server.ts.js +49 -0
  512. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  513. package/web/.svelte-kit/output/server/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
  514. package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +27 -0
  515. package/web/.svelte-kit/output/server/entries/hooks.server.js +105 -0
  516. package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +499 -0
  517. package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +3057 -0
  518. package/web/.svelte-kit/output/server/entries/pages/login/_page.server.ts.js +15 -0
  519. package/web/.svelte-kit/output/server/entries/pages/login/_page.svelte.js +37 -0
  520. package/web/.svelte-kit/output/server/entries/pages/session/_target_/_page.svelte.js +653 -0
  521. package/web/.svelte-kit/output/server/index.js +3864 -0
  522. package/web/.svelte-kit/output/server/internal.js +13 -0
  523. package/web/.svelte-kit/output/server/manifest-full.js +167 -0
  524. package/web/.svelte-kit/output/server/manifest.js +167 -0
  525. package/web/.svelte-kit/output/server/nodes/0.js +8 -0
  526. package/web/.svelte-kit/output/server/nodes/1.js +8 -0
  527. package/web/.svelte-kit/output/server/nodes/2.js +8 -0
  528. package/web/.svelte-kit/output/server/nodes/3.js +10 -0
  529. package/web/.svelte-kit/output/server/nodes/4.js +8 -0
  530. package/web/.svelte-kit/output/server/remote-entry.js +541 -0
  531. package/web/.svelte-kit/tsconfig.json +58 -0
  532. package/web/.svelte-kit/types/route_meta_data.json +55 -0
  533. package/web/.svelte-kit/types/src/routes/$types.d.ts +24 -0
  534. package/web/.svelte-kit/types/src/routes/api/auth/login/$types.d.ts +10 -0
  535. package/web/.svelte-kit/types/src/routes/api/auth/logout/$types.d.ts +10 -0
  536. package/web/.svelte-kit/types/src/routes/api/beads/$types.d.ts +10 -0
  537. package/web/.svelte-kit/types/src/routes/api/browse/$types.d.ts +10 -0
  538. package/web/.svelte-kit/types/src/routes/api/chrome/$types.d.ts +10 -0
  539. package/web/.svelte-kit/types/src/routes/api/files/image/$types.d.ts +10 -0
  540. package/web/.svelte-kit/types/src/routes/api/health/$types.d.ts +10 -0
  541. package/web/.svelte-kit/types/src/routes/api/projects/new-session/$types.d.ts +10 -0
  542. package/web/.svelte-kit/types/src/routes/api/sessions/$types.d.ts +10 -0
  543. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/$types.d.ts +11 -0
  544. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/kill/$types.d.ts +11 -0
  545. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/restart/$types.d.ts +11 -0
  546. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/screenshots/$types.d.ts +11 -0
  547. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/send/$types.d.ts +11 -0
  548. package/web/.svelte-kit/types/src/routes/api/sessions/[target]/output/$types.d.ts +11 -0
  549. package/web/.svelte-kit/types/src/routes/api/tmux/panes/$types.d.ts +10 -0
  550. package/web/.svelte-kit/types/src/routes/login/$types.d.ts +25 -0
  551. package/web/.svelte-kit/types/src/routes/login/proxy+page.server.ts +19 -0
  552. package/web/.svelte-kit/types/src/routes/session/[target]/$types.d.ts +19 -0
  553. package/web/README.md +42 -0
  554. package/web/components.json +16 -0
  555. package/web/package.json +35 -0
  556. package/web/src/app.css +128 -0
  557. package/web/src/app.d.ts +13 -0
  558. package/web/src/app.html +11 -0
  559. package/web/src/hooks.server.ts +156 -0
  560. package/web/src/lib/assets/favicon.svg +1 -0
  561. package/web/src/lib/components/AllSessionsPanel.svelte +789 -0
  562. package/web/src/lib/components/BeadsPanel.svelte +146 -0
  563. package/web/src/lib/components/IssueItem.svelte +287 -0
  564. package/web/src/lib/components/ScreenshotsPanel.svelte +336 -0
  565. package/web/src/lib/components/SessionsSidebar.svelte +312 -0
  566. package/web/src/lib/components/TerminalRenderer.svelte +189 -0
  567. package/web/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +18 -0
  568. package/web/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +18 -0
  569. package/web/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +29 -0
  570. package/web/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
  571. package/web/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
  572. package/web/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
  573. package/web/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
  574. package/web/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
  575. package/web/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
  576. package/web/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
  577. package/web/src/lib/components/ui/alert-dialog/alert-dialog.svelte +7 -0
  578. package/web/src/lib/components/ui/alert-dialog/index.ts +37 -0
  579. package/web/src/lib/components/ui/badge/badge.svelte +50 -0
  580. package/web/src/lib/components/ui/badge/index.ts +2 -0
  581. package/web/src/lib/components/ui/button/button.svelte +86 -0
  582. package/web/src/lib/components/ui/button/index.ts +17 -0
  583. package/web/src/lib/components/ui/checkbox/checkbox.svelte +36 -0
  584. package/web/src/lib/components/ui/checkbox/index.ts +6 -0
  585. package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
  586. package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
  587. package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
  588. package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
  589. package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
  590. package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
  591. package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
  592. package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
  593. package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
  594. package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
  595. package/web/src/lib/components/ui/dialog/index.ts +34 -0
  596. package/web/src/lib/components/ui/scroll-area/index.ts +10 -0
  597. package/web/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
  598. package/web/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
  599. package/web/src/lib/components/ui/textarea/index.ts +7 -0
  600. package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
  601. package/web/src/lib/index.ts +1 -0
  602. package/web/src/lib/server/auth.ts +90 -0
  603. package/web/src/lib/stores/beads.svelte.ts +163 -0
  604. package/web/src/lib/stores/input-injection.svelte.ts +39 -0
  605. package/web/src/lib/stores/preferences.svelte.ts +55 -0
  606. package/web/src/lib/stores/sessions.svelte.ts +108 -0
  607. package/web/src/lib/stores/terminal.svelte.ts +96 -0
  608. package/web/src/lib/stores/websocket-base.svelte.ts +209 -0
  609. package/web/src/lib/types/terminal.ts +31 -0
  610. package/web/src/lib/utils/terminal-parser.ts +239 -0
  611. package/web/src/lib/utils.ts +13 -0
  612. package/web/src/routes/+layout.svelte +450 -0
  613. package/web/src/routes/+page.svelte +19 -0
  614. package/web/src/routes/api/auth/login/+server.ts +34 -0
  615. package/web/src/routes/api/auth/logout/+server.ts +10 -0
  616. package/web/src/routes/api/beads/+server.ts +28 -0
  617. package/web/src/routes/api/browse/+server.ts +59 -0
  618. package/web/src/routes/api/chrome/+server.ts +35 -0
  619. package/web/src/routes/api/files/image/+server.ts +64 -0
  620. package/web/src/routes/api/health/+server.ts +6 -0
  621. package/web/src/routes/api/projects/new-session/+server.ts +50 -0
  622. package/web/src/routes/api/sessions/+server.ts +62 -0
  623. package/web/src/routes/api/sessions/[id]/+server.ts +19 -0
  624. package/web/src/routes/api/sessions/[id]/kill/+server.ts +46 -0
  625. package/web/src/routes/api/sessions/[id]/restart/+server.ts +59 -0
  626. package/web/src/routes/api/sessions/[id]/screenshots/+server.ts +32 -0
  627. package/web/src/routes/api/sessions/[id]/send/+server.ts +31 -0
  628. package/web/src/routes/api/sessions/[target]/output/+server.ts +13 -0
  629. package/web/src/routes/api/tmux/panes/+server.ts +32 -0
  630. package/web/src/routes/login/+page.server.ts +18 -0
  631. package/web/src/routes/login/+page.svelte +69 -0
  632. package/web/src/routes/session/[target]/+page.svelte +450 -0
  633. package/web/static/robots.txt +3 -0
  634. package/web/svelte.config.js +20 -0
  635. package/web/tsconfig.json +20 -0
  636. package/web/vite.config.ts +154 -0
@@ -0,0 +1,2828 @@
1
+ import { k as run_all, l as deferred, m as includes, p as safe_equals, q as equals, o as object_prototype, t as array_prototype, u as get_descriptor, b as get_prototype_of, i as is_array, v as is_extensible, w as index_of, e as escape_html, n as noop, x as set_ssr_context, f as ssr_context, y as push$1, z as pop$1 } from "./context.js";
2
+ import { clsx as clsx$1 } from "clsx";
3
+ import { B as BROWSER } from "./false.js";
4
+ import * as devalue from "devalue";
5
+ const DERIVED = 1 << 1;
6
+ const EFFECT = 1 << 2;
7
+ const RENDER_EFFECT = 1 << 3;
8
+ const MANAGED_EFFECT = 1 << 24;
9
+ const BLOCK_EFFECT = 1 << 4;
10
+ const BRANCH_EFFECT = 1 << 5;
11
+ const ROOT_EFFECT = 1 << 6;
12
+ const BOUNDARY_EFFECT = 1 << 7;
13
+ const CONNECTED = 1 << 9;
14
+ const CLEAN = 1 << 10;
15
+ const DIRTY = 1 << 11;
16
+ const MAYBE_DIRTY = 1 << 12;
17
+ const INERT = 1 << 13;
18
+ const DESTROYED = 1 << 14;
19
+ const EFFECT_RAN = 1 << 15;
20
+ const EFFECT_TRANSPARENT = 1 << 16;
21
+ const EAGER_EFFECT = 1 << 17;
22
+ const HEAD_EFFECT = 1 << 18;
23
+ const EFFECT_PRESERVED = 1 << 19;
24
+ const USER_EFFECT = 1 << 20;
25
+ const WAS_MARKED = 1 << 15;
26
+ const REACTION_IS_UPDATING = 1 << 21;
27
+ const ASYNC = 1 << 22;
28
+ const ERROR_VALUE = 1 << 23;
29
+ const STATE_SYMBOL = /* @__PURE__ */ Symbol("$state");
30
+ const LEGACY_PROPS = /* @__PURE__ */ Symbol("legacy props");
31
+ const STALE_REACTION = new class StaleReactionError extends Error {
32
+ name = "StaleReactionError";
33
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
34
+ }();
35
+ const COMMENT_NODE = 8;
36
+ function effect_update_depth_exceeded() {
37
+ {
38
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
39
+ }
40
+ }
41
+ function hydration_failed() {
42
+ {
43
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
44
+ }
45
+ }
46
+ function state_descriptors_fixed() {
47
+ {
48
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
49
+ }
50
+ }
51
+ function state_prototype_fixed() {
52
+ {
53
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
54
+ }
55
+ }
56
+ function state_unsafe_mutation() {
57
+ {
58
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
59
+ }
60
+ }
61
+ function svelte_boundary_reset_onerror() {
62
+ {
63
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
64
+ }
65
+ }
66
+ const HYDRATION_START = "[";
67
+ const HYDRATION_START_ELSE = "[!";
68
+ const HYDRATION_END = "]";
69
+ const HYDRATION_ERROR = {};
70
+ const ELEMENT_IS_NAMESPACED = 1;
71
+ const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
72
+ const ELEMENT_IS_INPUT = 1 << 2;
73
+ const UNINITIALIZED = /* @__PURE__ */ Symbol();
74
+ const ATTACHMENT_KEY = "@attach";
75
+ let tracing_mode_flag = false;
76
+ let component_context = null;
77
+ function set_component_context(context) {
78
+ component_context = context;
79
+ }
80
+ function push(props, runes = false, fn) {
81
+ component_context = {
82
+ p: component_context,
83
+ i: false,
84
+ c: null,
85
+ e: null,
86
+ s: props,
87
+ x: null,
88
+ l: null
89
+ };
90
+ }
91
+ function pop(component) {
92
+ var context = (
93
+ /** @type {ComponentContext} */
94
+ component_context
95
+ );
96
+ var effects = context.e;
97
+ if (effects !== null) {
98
+ context.e = null;
99
+ for (var fn of effects) {
100
+ create_user_effect(fn);
101
+ }
102
+ }
103
+ context.i = true;
104
+ component_context = context.p;
105
+ return (
106
+ /** @type {T} */
107
+ {}
108
+ );
109
+ }
110
+ function is_runes() {
111
+ return true;
112
+ }
113
+ let micro_tasks = [];
114
+ function run_micro_tasks() {
115
+ var tasks = micro_tasks;
116
+ micro_tasks = [];
117
+ run_all(tasks);
118
+ }
119
+ function queue_micro_task(fn) {
120
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
121
+ var tasks = micro_tasks;
122
+ queueMicrotask(() => {
123
+ if (tasks === micro_tasks) run_micro_tasks();
124
+ });
125
+ }
126
+ micro_tasks.push(fn);
127
+ }
128
+ function flush_tasks() {
129
+ while (micro_tasks.length > 0) {
130
+ run_micro_tasks();
131
+ }
132
+ }
133
+ function handle_error(error) {
134
+ var effect = active_effect;
135
+ if (effect === null) {
136
+ active_reaction.f |= ERROR_VALUE;
137
+ return error;
138
+ }
139
+ if ((effect.f & EFFECT_RAN) === 0) {
140
+ if ((effect.f & BOUNDARY_EFFECT) === 0) {
141
+ throw error;
142
+ }
143
+ effect.b.error(error);
144
+ } else {
145
+ invoke_error_boundary(error, effect);
146
+ }
147
+ }
148
+ function invoke_error_boundary(error, effect) {
149
+ while (effect !== null) {
150
+ if ((effect.f & BOUNDARY_EFFECT) !== 0) {
151
+ try {
152
+ effect.b.error(error);
153
+ return;
154
+ } catch (e) {
155
+ error = e;
156
+ }
157
+ }
158
+ effect = effect.parent;
159
+ }
160
+ throw error;
161
+ }
162
+ const STATUS_MASK = -7169;
163
+ function set_signal_status(signal, status) {
164
+ signal.f = signal.f & STATUS_MASK | status;
165
+ }
166
+ function update_derived_status(derived2) {
167
+ if ((derived2.f & CONNECTED) !== 0 || derived2.deps === null) {
168
+ set_signal_status(derived2, CLEAN);
169
+ } else {
170
+ set_signal_status(derived2, MAYBE_DIRTY);
171
+ }
172
+ }
173
+ function clear_marked(deps) {
174
+ if (deps === null) return;
175
+ for (const dep of deps) {
176
+ if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
177
+ continue;
178
+ }
179
+ dep.f ^= WAS_MARKED;
180
+ clear_marked(
181
+ /** @type {Derived} */
182
+ dep.deps
183
+ );
184
+ }
185
+ }
186
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
187
+ if ((effect.f & DIRTY) !== 0) {
188
+ dirty_effects.add(effect);
189
+ } else if ((effect.f & MAYBE_DIRTY) !== 0) {
190
+ maybe_dirty_effects.add(effect);
191
+ }
192
+ clear_marked(effect.deps);
193
+ set_signal_status(effect, CLEAN);
194
+ }
195
+ const batches = /* @__PURE__ */ new Set();
196
+ let current_batch = null;
197
+ let batch_values = null;
198
+ let queued_root_effects = [];
199
+ let last_scheduled_effect = null;
200
+ let is_flushing = false;
201
+ let is_flushing_sync = false;
202
+ class Batch {
203
+ committed = false;
204
+ /**
205
+ * The current values of any sources that are updated in this batch
206
+ * They keys of this map are identical to `this.#previous`
207
+ * @type {Map<Source, any>}
208
+ */
209
+ current = /* @__PURE__ */ new Map();
210
+ /**
211
+ * The values of any sources that are updated in this batch _before_ those updates took place.
212
+ * They keys of this map are identical to `this.#current`
213
+ * @type {Map<Source, any>}
214
+ */
215
+ previous = /* @__PURE__ */ new Map();
216
+ /**
217
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
218
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
219
+ * @type {Set<() => void>}
220
+ */
221
+ #commit_callbacks = /* @__PURE__ */ new Set();
222
+ /**
223
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
224
+ * @type {Set<(batch: Batch) => void>}
225
+ */
226
+ #discard_callbacks = /* @__PURE__ */ new Set();
227
+ /**
228
+ * The number of async effects that are currently in flight
229
+ */
230
+ #pending = 0;
231
+ /**
232
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
233
+ */
234
+ #blocking_pending = 0;
235
+ /**
236
+ * A deferred that resolves when the batch is committed, used with `settled()`
237
+ * TODO replace with Promise.withResolvers once supported widely enough
238
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
239
+ */
240
+ #deferred = null;
241
+ /**
242
+ * Deferred effects (which run after async work has completed) that are DIRTY
243
+ * @type {Set<Effect>}
244
+ */
245
+ #dirty_effects = /* @__PURE__ */ new Set();
246
+ /**
247
+ * Deferred effects that are MAYBE_DIRTY
248
+ * @type {Set<Effect>}
249
+ */
250
+ #maybe_dirty_effects = /* @__PURE__ */ new Set();
251
+ /**
252
+ * A set of branches that still exist, but will be destroyed when this batch
253
+ * is committed — we skip over these during `process`
254
+ * @type {Set<Effect>}
255
+ */
256
+ skipped_effects = /* @__PURE__ */ new Set();
257
+ is_fork = false;
258
+ #decrement_queued = false;
259
+ is_deferred() {
260
+ return this.is_fork || this.#blocking_pending > 0;
261
+ }
262
+ /**
263
+ *
264
+ * @param {Effect[]} root_effects
265
+ */
266
+ process(root_effects) {
267
+ queued_root_effects = [];
268
+ this.apply();
269
+ var effects = [];
270
+ var render_effects = [];
271
+ for (const root of root_effects) {
272
+ this.#traverse_effect_tree(root, effects, render_effects);
273
+ }
274
+ if (this.is_deferred()) {
275
+ this.#defer_effects(render_effects);
276
+ this.#defer_effects(effects);
277
+ } else {
278
+ for (const fn of this.#commit_callbacks) fn();
279
+ this.#commit_callbacks.clear();
280
+ if (this.#pending === 0) {
281
+ this.#commit();
282
+ }
283
+ current_batch = null;
284
+ flush_queued_effects(render_effects);
285
+ flush_queued_effects(effects);
286
+ this.#deferred?.resolve();
287
+ }
288
+ batch_values = null;
289
+ }
290
+ /**
291
+ * Traverse the effect tree, executing effects or stashing
292
+ * them for later execution as appropriate
293
+ * @param {Effect} root
294
+ * @param {Effect[]} effects
295
+ * @param {Effect[]} render_effects
296
+ */
297
+ #traverse_effect_tree(root, effects, render_effects) {
298
+ root.f ^= CLEAN;
299
+ var effect = root.first;
300
+ var pending_boundary = null;
301
+ while (effect !== null) {
302
+ var flags = effect.f;
303
+ var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
304
+ var is_skippable_branch = is_branch && (flags & CLEAN) !== 0;
305
+ var skip = is_skippable_branch || (flags & INERT) !== 0 || this.skipped_effects.has(effect);
306
+ if (!skip && effect.fn !== null) {
307
+ if (is_branch) {
308
+ effect.f ^= CLEAN;
309
+ } else if (pending_boundary !== null && (flags & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {
310
+ pending_boundary.b.defer_effect(effect);
311
+ } else if ((flags & EFFECT) !== 0) {
312
+ effects.push(effect);
313
+ } else if (is_dirty(effect)) {
314
+ if ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);
315
+ update_effect(effect);
316
+ }
317
+ var child = effect.first;
318
+ if (child !== null) {
319
+ effect = child;
320
+ continue;
321
+ }
322
+ }
323
+ var parent = effect.parent;
324
+ effect = effect.next;
325
+ while (effect === null && parent !== null) {
326
+ if (parent === pending_boundary) {
327
+ pending_boundary = null;
328
+ }
329
+ effect = parent.next;
330
+ parent = parent.parent;
331
+ }
332
+ }
333
+ }
334
+ /**
335
+ * @param {Effect[]} effects
336
+ */
337
+ #defer_effects(effects) {
338
+ for (var i = 0; i < effects.length; i += 1) {
339
+ defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
340
+ }
341
+ }
342
+ /**
343
+ * Associate a change to a given source with the current
344
+ * batch, noting its previous and current values
345
+ * @param {Source} source
346
+ * @param {any} value
347
+ */
348
+ capture(source2, value) {
349
+ if (value !== UNINITIALIZED && !this.previous.has(source2)) {
350
+ this.previous.set(source2, value);
351
+ }
352
+ if ((source2.f & ERROR_VALUE) === 0) {
353
+ this.current.set(source2, source2.v);
354
+ batch_values?.set(source2, source2.v);
355
+ }
356
+ }
357
+ activate() {
358
+ current_batch = this;
359
+ this.apply();
360
+ }
361
+ deactivate() {
362
+ if (current_batch !== this) return;
363
+ current_batch = null;
364
+ batch_values = null;
365
+ }
366
+ flush() {
367
+ this.activate();
368
+ if (queued_root_effects.length > 0) {
369
+ flush_effects();
370
+ if (current_batch !== null && current_batch !== this) {
371
+ return;
372
+ }
373
+ } else if (this.#pending === 0) {
374
+ this.process([]);
375
+ }
376
+ this.deactivate();
377
+ }
378
+ discard() {
379
+ for (const fn of this.#discard_callbacks) fn(this);
380
+ this.#discard_callbacks.clear();
381
+ }
382
+ #commit() {
383
+ if (batches.size > 1) {
384
+ this.previous.clear();
385
+ var previous_batch_values = batch_values;
386
+ var is_earlier = true;
387
+ for (const batch of batches) {
388
+ if (batch === this) {
389
+ is_earlier = false;
390
+ continue;
391
+ }
392
+ const sources = [];
393
+ for (const [source2, value] of this.current) {
394
+ if (batch.current.has(source2)) {
395
+ if (is_earlier && value !== batch.current.get(source2)) {
396
+ batch.current.set(source2, value);
397
+ } else {
398
+ continue;
399
+ }
400
+ }
401
+ sources.push(source2);
402
+ }
403
+ if (sources.length === 0) {
404
+ continue;
405
+ }
406
+ const others = [...batch.current.keys()].filter((s) => !this.current.has(s));
407
+ if (others.length > 0) {
408
+ var prev_queued_root_effects = queued_root_effects;
409
+ queued_root_effects = [];
410
+ const marked = /* @__PURE__ */ new Set();
411
+ const checked = /* @__PURE__ */ new Map();
412
+ for (const source2 of sources) {
413
+ mark_effects(source2, others, marked, checked);
414
+ }
415
+ if (queued_root_effects.length > 0) {
416
+ current_batch = batch;
417
+ batch.apply();
418
+ for (const root of queued_root_effects) {
419
+ batch.#traverse_effect_tree(root, [], []);
420
+ }
421
+ batch.deactivate();
422
+ }
423
+ queued_root_effects = prev_queued_root_effects;
424
+ }
425
+ }
426
+ current_batch = null;
427
+ batch_values = previous_batch_values;
428
+ }
429
+ this.committed = true;
430
+ batches.delete(this);
431
+ }
432
+ /**
433
+ *
434
+ * @param {boolean} blocking
435
+ */
436
+ increment(blocking) {
437
+ this.#pending += 1;
438
+ if (blocking) this.#blocking_pending += 1;
439
+ }
440
+ /**
441
+ *
442
+ * @param {boolean} blocking
443
+ */
444
+ decrement(blocking) {
445
+ this.#pending -= 1;
446
+ if (blocking) this.#blocking_pending -= 1;
447
+ if (this.#decrement_queued) return;
448
+ this.#decrement_queued = true;
449
+ queue_micro_task(() => {
450
+ this.#decrement_queued = false;
451
+ if (!this.is_deferred()) {
452
+ this.revive();
453
+ } else if (queued_root_effects.length > 0) {
454
+ this.flush();
455
+ }
456
+ });
457
+ }
458
+ revive() {
459
+ for (const e of this.#dirty_effects) {
460
+ this.#maybe_dirty_effects.delete(e);
461
+ set_signal_status(e, DIRTY);
462
+ schedule_effect(e);
463
+ }
464
+ for (const e of this.#maybe_dirty_effects) {
465
+ set_signal_status(e, MAYBE_DIRTY);
466
+ schedule_effect(e);
467
+ }
468
+ this.flush();
469
+ }
470
+ /** @param {() => void} fn */
471
+ oncommit(fn) {
472
+ this.#commit_callbacks.add(fn);
473
+ }
474
+ /** @param {(batch: Batch) => void} fn */
475
+ ondiscard(fn) {
476
+ this.#discard_callbacks.add(fn);
477
+ }
478
+ settled() {
479
+ return (this.#deferred ??= deferred()).promise;
480
+ }
481
+ static ensure() {
482
+ if (current_batch === null) {
483
+ const batch = current_batch = new Batch();
484
+ batches.add(current_batch);
485
+ if (!is_flushing_sync) {
486
+ queue_micro_task(() => {
487
+ if (current_batch !== batch) {
488
+ return;
489
+ }
490
+ batch.flush();
491
+ });
492
+ }
493
+ }
494
+ return current_batch;
495
+ }
496
+ apply() {
497
+ return;
498
+ }
499
+ }
500
+ function flushSync(fn) {
501
+ var was_flushing_sync = is_flushing_sync;
502
+ is_flushing_sync = true;
503
+ try {
504
+ var result;
505
+ if (fn) ;
506
+ while (true) {
507
+ flush_tasks();
508
+ if (queued_root_effects.length === 0) {
509
+ current_batch?.flush();
510
+ if (queued_root_effects.length === 0) {
511
+ last_scheduled_effect = null;
512
+ return (
513
+ /** @type {T} */
514
+ result
515
+ );
516
+ }
517
+ }
518
+ flush_effects();
519
+ }
520
+ } finally {
521
+ is_flushing_sync = was_flushing_sync;
522
+ }
523
+ }
524
+ function flush_effects() {
525
+ is_flushing = true;
526
+ var source_stacks = null;
527
+ try {
528
+ var flush_count = 0;
529
+ while (queued_root_effects.length > 0) {
530
+ var batch = Batch.ensure();
531
+ if (flush_count++ > 1e3) {
532
+ var updates, entry;
533
+ if (BROWSER) ;
534
+ infinite_loop_guard();
535
+ }
536
+ batch.process(queued_root_effects);
537
+ old_values.clear();
538
+ if (BROWSER) ;
539
+ }
540
+ } finally {
541
+ is_flushing = false;
542
+ last_scheduled_effect = null;
543
+ }
544
+ }
545
+ function infinite_loop_guard() {
546
+ try {
547
+ effect_update_depth_exceeded();
548
+ } catch (error) {
549
+ invoke_error_boundary(error, last_scheduled_effect);
550
+ }
551
+ }
552
+ let eager_block_effects = null;
553
+ function flush_queued_effects(effects) {
554
+ var length = effects.length;
555
+ if (length === 0) return;
556
+ var i = 0;
557
+ while (i < length) {
558
+ var effect = effects[i++];
559
+ if ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {
560
+ eager_block_effects = /* @__PURE__ */ new Set();
561
+ update_effect(effect);
562
+ if (effect.deps === null && effect.first === null && effect.nodes === null) {
563
+ if (effect.teardown === null && effect.ac === null) {
564
+ unlink_effect(effect);
565
+ } else {
566
+ effect.fn = null;
567
+ }
568
+ }
569
+ if (eager_block_effects?.size > 0) {
570
+ old_values.clear();
571
+ for (const e of eager_block_effects) {
572
+ if ((e.f & (DESTROYED | INERT)) !== 0) continue;
573
+ const ordered_effects = [e];
574
+ let ancestor = e.parent;
575
+ while (ancestor !== null) {
576
+ if (eager_block_effects.has(ancestor)) {
577
+ eager_block_effects.delete(ancestor);
578
+ ordered_effects.push(ancestor);
579
+ }
580
+ ancestor = ancestor.parent;
581
+ }
582
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
583
+ const e2 = ordered_effects[j];
584
+ if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
585
+ update_effect(e2);
586
+ }
587
+ }
588
+ eager_block_effects.clear();
589
+ }
590
+ }
591
+ }
592
+ eager_block_effects = null;
593
+ }
594
+ function mark_effects(value, sources, marked, checked) {
595
+ if (marked.has(value)) return;
596
+ marked.add(value);
597
+ if (value.reactions !== null) {
598
+ for (const reaction of value.reactions) {
599
+ const flags = reaction.f;
600
+ if ((flags & DERIVED) !== 0) {
601
+ mark_effects(
602
+ /** @type {Derived} */
603
+ reaction,
604
+ sources,
605
+ marked,
606
+ checked
607
+ );
608
+ } else if ((flags & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
609
+ set_signal_status(reaction, DIRTY);
610
+ schedule_effect(
611
+ /** @type {Effect} */
612
+ reaction
613
+ );
614
+ }
615
+ }
616
+ }
617
+ }
618
+ function depends_on(reaction, sources, checked) {
619
+ const depends = checked.get(reaction);
620
+ if (depends !== void 0) return depends;
621
+ if (reaction.deps !== null) {
622
+ for (const dep of reaction.deps) {
623
+ if (includes.call(sources, dep)) {
624
+ return true;
625
+ }
626
+ if ((dep.f & DERIVED) !== 0 && depends_on(
627
+ /** @type {Derived} */
628
+ dep,
629
+ sources,
630
+ checked
631
+ )) {
632
+ checked.set(
633
+ /** @type {Derived} */
634
+ dep,
635
+ true
636
+ );
637
+ return true;
638
+ }
639
+ }
640
+ }
641
+ checked.set(reaction, false);
642
+ return false;
643
+ }
644
+ function schedule_effect(signal) {
645
+ var effect = last_scheduled_effect = signal;
646
+ while (effect.parent !== null) {
647
+ effect = effect.parent;
648
+ var flags = effect.f;
649
+ if (is_flushing && effect === active_effect && (flags & BLOCK_EFFECT) !== 0 && (flags & HEAD_EFFECT) === 0) {
650
+ return;
651
+ }
652
+ if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
653
+ if ((flags & CLEAN) === 0) return;
654
+ effect.f ^= CLEAN;
655
+ }
656
+ }
657
+ queued_root_effects.push(effect);
658
+ }
659
+ function destroy_derived_effects(derived2) {
660
+ var effects = derived2.effects;
661
+ if (effects !== null) {
662
+ derived2.effects = null;
663
+ for (var i = 0; i < effects.length; i += 1) {
664
+ destroy_effect(
665
+ /** @type {Effect} */
666
+ effects[i]
667
+ );
668
+ }
669
+ }
670
+ }
671
+ function get_derived_parent_effect(derived2) {
672
+ var parent = derived2.parent;
673
+ while (parent !== null) {
674
+ if ((parent.f & DERIVED) === 0) {
675
+ return (parent.f & DESTROYED) === 0 ? (
676
+ /** @type {Effect} */
677
+ parent
678
+ ) : null;
679
+ }
680
+ parent = parent.parent;
681
+ }
682
+ return null;
683
+ }
684
+ function execute_derived(derived2) {
685
+ var value;
686
+ var prev_active_effect = active_effect;
687
+ set_active_effect(get_derived_parent_effect(derived2));
688
+ {
689
+ try {
690
+ derived2.f &= ~WAS_MARKED;
691
+ destroy_derived_effects(derived2);
692
+ value = update_reaction(derived2);
693
+ } finally {
694
+ set_active_effect(prev_active_effect);
695
+ }
696
+ }
697
+ return value;
698
+ }
699
+ function update_derived(derived2) {
700
+ var value = execute_derived(derived2);
701
+ if (!derived2.equals(value)) {
702
+ derived2.wv = increment_write_version();
703
+ if (!current_batch?.is_fork || derived2.deps === null) {
704
+ derived2.v = value;
705
+ if (derived2.deps === null) {
706
+ set_signal_status(derived2, CLEAN);
707
+ return;
708
+ }
709
+ }
710
+ }
711
+ if (is_destroying_effect) {
712
+ return;
713
+ }
714
+ if (batch_values !== null) {
715
+ if (effect_tracking() || current_batch?.is_fork) {
716
+ batch_values.set(derived2, value);
717
+ }
718
+ } else {
719
+ update_derived_status(derived2);
720
+ }
721
+ }
722
+ let eager_effects = /* @__PURE__ */ new Set();
723
+ const old_values = /* @__PURE__ */ new Map();
724
+ let eager_effects_deferred = false;
725
+ function source(v, stack) {
726
+ var signal = {
727
+ f: 0,
728
+ // TODO ideally we could skip this altogether, but it causes type errors
729
+ v,
730
+ reactions: null,
731
+ equals,
732
+ rv: 0,
733
+ wv: 0
734
+ };
735
+ return signal;
736
+ }
737
+ // @__NO_SIDE_EFFECTS__
738
+ function state(v, stack) {
739
+ const s = source(v);
740
+ push_reaction_value(s);
741
+ return s;
742
+ }
743
+ // @__NO_SIDE_EFFECTS__
744
+ function mutable_source(initial_value, immutable = false, trackable = true) {
745
+ const s = source(initial_value);
746
+ if (!immutable) {
747
+ s.equals = safe_equals;
748
+ }
749
+ return s;
750
+ }
751
+ function set(source2, value, should_proxy = false) {
752
+ if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
753
+ // to ensure we error if state is set inside an inspect effect
754
+ (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
755
+ state_unsafe_mutation();
756
+ }
757
+ let new_value = should_proxy ? proxy(value) : value;
758
+ return internal_set(source2, new_value);
759
+ }
760
+ function internal_set(source2, value) {
761
+ if (!source2.equals(value)) {
762
+ var old_value = source2.v;
763
+ if (is_destroying_effect) {
764
+ old_values.set(source2, value);
765
+ } else {
766
+ old_values.set(source2, old_value);
767
+ }
768
+ source2.v = value;
769
+ var batch = Batch.ensure();
770
+ batch.capture(source2, old_value);
771
+ if ((source2.f & DERIVED) !== 0) {
772
+ const derived2 = (
773
+ /** @type {Derived} */
774
+ source2
775
+ );
776
+ if ((source2.f & DIRTY) !== 0) {
777
+ execute_derived(derived2);
778
+ }
779
+ update_derived_status(derived2);
780
+ }
781
+ source2.wv = increment_write_version();
782
+ mark_reactions(source2, DIRTY);
783
+ if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
784
+ if (untracked_writes === null) {
785
+ set_untracked_writes([source2]);
786
+ } else {
787
+ untracked_writes.push(source2);
788
+ }
789
+ }
790
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {
791
+ flush_eager_effects();
792
+ }
793
+ }
794
+ return value;
795
+ }
796
+ function flush_eager_effects() {
797
+ eager_effects_deferred = false;
798
+ for (const effect of eager_effects) {
799
+ if ((effect.f & CLEAN) !== 0) {
800
+ set_signal_status(effect, MAYBE_DIRTY);
801
+ }
802
+ if (is_dirty(effect)) {
803
+ update_effect(effect);
804
+ }
805
+ }
806
+ eager_effects.clear();
807
+ }
808
+ function increment(source2) {
809
+ set(source2, source2.v + 1);
810
+ }
811
+ function mark_reactions(signal, status) {
812
+ var reactions = signal.reactions;
813
+ if (reactions === null) return;
814
+ var length = reactions.length;
815
+ for (var i = 0; i < length; i++) {
816
+ var reaction = reactions[i];
817
+ var flags = reaction.f;
818
+ var not_dirty = (flags & DIRTY) === 0;
819
+ if (not_dirty) {
820
+ set_signal_status(reaction, status);
821
+ }
822
+ if ((flags & DERIVED) !== 0) {
823
+ var derived2 = (
824
+ /** @type {Derived} */
825
+ reaction
826
+ );
827
+ batch_values?.delete(derived2);
828
+ if ((flags & WAS_MARKED) === 0) {
829
+ if (flags & CONNECTED) {
830
+ reaction.f |= WAS_MARKED;
831
+ }
832
+ mark_reactions(derived2, MAYBE_DIRTY);
833
+ }
834
+ } else if (not_dirty) {
835
+ if ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
836
+ eager_block_effects.add(
837
+ /** @type {Effect} */
838
+ reaction
839
+ );
840
+ }
841
+ schedule_effect(
842
+ /** @type {Effect} */
843
+ reaction
844
+ );
845
+ }
846
+ }
847
+ }
848
+ function proxy(value) {
849
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
850
+ return value;
851
+ }
852
+ const prototype = get_prototype_of(value);
853
+ if (prototype !== object_prototype && prototype !== array_prototype) {
854
+ return value;
855
+ }
856
+ var sources = /* @__PURE__ */ new Map();
857
+ var is_proxied_array = is_array(value);
858
+ var version = /* @__PURE__ */ state(0);
859
+ var parent_version = update_version;
860
+ var with_parent = (fn) => {
861
+ if (update_version === parent_version) {
862
+ return fn();
863
+ }
864
+ var reaction = active_reaction;
865
+ var version2 = update_version;
866
+ set_active_reaction(null);
867
+ set_update_version(parent_version);
868
+ var result = fn();
869
+ set_active_reaction(reaction);
870
+ set_update_version(version2);
871
+ return result;
872
+ };
873
+ if (is_proxied_array) {
874
+ sources.set("length", /* @__PURE__ */ state(
875
+ /** @type {any[]} */
876
+ value.length
877
+ ));
878
+ }
879
+ return new Proxy(
880
+ /** @type {any} */
881
+ value,
882
+ {
883
+ defineProperty(_, prop, descriptor) {
884
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
885
+ state_descriptors_fixed();
886
+ }
887
+ var s = sources.get(prop);
888
+ if (s === void 0) {
889
+ s = with_parent(() => {
890
+ var s2 = /* @__PURE__ */ state(descriptor.value);
891
+ sources.set(prop, s2);
892
+ return s2;
893
+ });
894
+ } else {
895
+ set(s, descriptor.value, true);
896
+ }
897
+ return true;
898
+ },
899
+ deleteProperty(target, prop) {
900
+ var s = sources.get(prop);
901
+ if (s === void 0) {
902
+ if (prop in target) {
903
+ const s2 = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
904
+ sources.set(prop, s2);
905
+ increment(version);
906
+ }
907
+ } else {
908
+ set(s, UNINITIALIZED);
909
+ increment(version);
910
+ }
911
+ return true;
912
+ },
913
+ get(target, prop, receiver) {
914
+ if (prop === STATE_SYMBOL) {
915
+ return value;
916
+ }
917
+ var s = sources.get(prop);
918
+ var exists = prop in target;
919
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
920
+ s = with_parent(() => {
921
+ var p = proxy(exists ? target[prop] : UNINITIALIZED);
922
+ var s2 = /* @__PURE__ */ state(p);
923
+ return s2;
924
+ });
925
+ sources.set(prop, s);
926
+ }
927
+ if (s !== void 0) {
928
+ var v = get(s);
929
+ return v === UNINITIALIZED ? void 0 : v;
930
+ }
931
+ return Reflect.get(target, prop, receiver);
932
+ },
933
+ getOwnPropertyDescriptor(target, prop) {
934
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
935
+ if (descriptor && "value" in descriptor) {
936
+ var s = sources.get(prop);
937
+ if (s) descriptor.value = get(s);
938
+ } else if (descriptor === void 0) {
939
+ var source2 = sources.get(prop);
940
+ var value2 = source2?.v;
941
+ if (source2 !== void 0 && value2 !== UNINITIALIZED) {
942
+ return {
943
+ enumerable: true,
944
+ configurable: true,
945
+ value: value2,
946
+ writable: true
947
+ };
948
+ }
949
+ }
950
+ return descriptor;
951
+ },
952
+ has(target, prop) {
953
+ if (prop === STATE_SYMBOL) {
954
+ return true;
955
+ }
956
+ var s = sources.get(prop);
957
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
958
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
959
+ if (s === void 0) {
960
+ s = with_parent(() => {
961
+ var p = has ? proxy(target[prop]) : UNINITIALIZED;
962
+ var s2 = /* @__PURE__ */ state(p);
963
+ return s2;
964
+ });
965
+ sources.set(prop, s);
966
+ }
967
+ var value2 = get(s);
968
+ if (value2 === UNINITIALIZED) {
969
+ return false;
970
+ }
971
+ }
972
+ return has;
973
+ },
974
+ set(target, prop, value2, receiver) {
975
+ var s = sources.get(prop);
976
+ var has = prop in target;
977
+ if (is_proxied_array && prop === "length") {
978
+ for (var i = value2; i < /** @type {Source<number>} */
979
+ s.v; i += 1) {
980
+ var other_s = sources.get(i + "");
981
+ if (other_s !== void 0) {
982
+ set(other_s, UNINITIALIZED);
983
+ } else if (i in target) {
984
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
985
+ sources.set(i + "", other_s);
986
+ }
987
+ }
988
+ }
989
+ if (s === void 0) {
990
+ if (!has || get_descriptor(target, prop)?.writable) {
991
+ s = with_parent(() => /* @__PURE__ */ state(void 0));
992
+ set(s, proxy(value2));
993
+ sources.set(prop, s);
994
+ }
995
+ } else {
996
+ has = s.v !== UNINITIALIZED;
997
+ var p = with_parent(() => proxy(value2));
998
+ set(s, p);
999
+ }
1000
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1001
+ if (descriptor?.set) {
1002
+ descriptor.set.call(receiver, value2);
1003
+ }
1004
+ if (!has) {
1005
+ if (is_proxied_array && typeof prop === "string") {
1006
+ var ls = (
1007
+ /** @type {Source<number>} */
1008
+ sources.get("length")
1009
+ );
1010
+ var n = Number(prop);
1011
+ if (Number.isInteger(n) && n >= ls.v) {
1012
+ set(ls, n + 1);
1013
+ }
1014
+ }
1015
+ increment(version);
1016
+ }
1017
+ return true;
1018
+ },
1019
+ ownKeys(target) {
1020
+ get(version);
1021
+ var own_keys = Reflect.ownKeys(target).filter((key2) => {
1022
+ var source3 = sources.get(key2);
1023
+ return source3 === void 0 || source3.v !== UNINITIALIZED;
1024
+ });
1025
+ for (var [key, source2] of sources) {
1026
+ if (source2.v !== UNINITIALIZED && !(key in target)) {
1027
+ own_keys.push(key);
1028
+ }
1029
+ }
1030
+ return own_keys;
1031
+ },
1032
+ setPrototypeOf() {
1033
+ state_prototype_fixed();
1034
+ }
1035
+ }
1036
+ );
1037
+ }
1038
+ var $window;
1039
+ var first_child_getter;
1040
+ var next_sibling_getter;
1041
+ function init_operations() {
1042
+ if ($window !== void 0) {
1043
+ return;
1044
+ }
1045
+ $window = window;
1046
+ var element_prototype = Element.prototype;
1047
+ var node_prototype = Node.prototype;
1048
+ var text_prototype = Text.prototype;
1049
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1050
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1051
+ if (is_extensible(element_prototype)) {
1052
+ element_prototype.__click = void 0;
1053
+ element_prototype.__className = void 0;
1054
+ element_prototype.__attributes = null;
1055
+ element_prototype.__style = void 0;
1056
+ element_prototype.__e = void 0;
1057
+ }
1058
+ if (is_extensible(text_prototype)) {
1059
+ text_prototype.__t = void 0;
1060
+ }
1061
+ }
1062
+ function create_text(value = "") {
1063
+ return document.createTextNode(value);
1064
+ }
1065
+ // @__NO_SIDE_EFFECTS__
1066
+ function get_first_child(node) {
1067
+ return (
1068
+ /** @type {TemplateNode | null} */
1069
+ first_child_getter.call(node)
1070
+ );
1071
+ }
1072
+ // @__NO_SIDE_EFFECTS__
1073
+ function get_next_sibling(node) {
1074
+ return (
1075
+ /** @type {TemplateNode | null} */
1076
+ next_sibling_getter.call(node)
1077
+ );
1078
+ }
1079
+ function clear_text_content(node) {
1080
+ node.textContent = "";
1081
+ }
1082
+ function without_reactive_context(fn) {
1083
+ var previous_reaction = active_reaction;
1084
+ var previous_effect = active_effect;
1085
+ set_active_reaction(null);
1086
+ set_active_effect(null);
1087
+ try {
1088
+ return fn();
1089
+ } finally {
1090
+ set_active_reaction(previous_reaction);
1091
+ set_active_effect(previous_effect);
1092
+ }
1093
+ }
1094
+ function push_effect(effect, parent_effect) {
1095
+ var parent_last = parent_effect.last;
1096
+ if (parent_last === null) {
1097
+ parent_effect.last = parent_effect.first = effect;
1098
+ } else {
1099
+ parent_last.next = effect;
1100
+ effect.prev = parent_last;
1101
+ parent_effect.last = effect;
1102
+ }
1103
+ }
1104
+ function create_effect(type, fn, sync) {
1105
+ var parent = active_effect;
1106
+ if (parent !== null && (parent.f & INERT) !== 0) {
1107
+ type |= INERT;
1108
+ }
1109
+ var effect = {
1110
+ ctx: component_context,
1111
+ deps: null,
1112
+ nodes: null,
1113
+ f: type | DIRTY | CONNECTED,
1114
+ first: null,
1115
+ fn,
1116
+ last: null,
1117
+ next: null,
1118
+ parent,
1119
+ b: parent && parent.b,
1120
+ prev: null,
1121
+ teardown: null,
1122
+ wv: 0,
1123
+ ac: null
1124
+ };
1125
+ if (sync) {
1126
+ try {
1127
+ update_effect(effect);
1128
+ effect.f |= EFFECT_RAN;
1129
+ } catch (e2) {
1130
+ destroy_effect(effect);
1131
+ throw e2;
1132
+ }
1133
+ } else if (fn !== null) {
1134
+ schedule_effect(effect);
1135
+ }
1136
+ var e = effect;
1137
+ if (sync && e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && // either `null`, or a singular child
1138
+ (e.f & EFFECT_PRESERVED) === 0) {
1139
+ e = e.first;
1140
+ if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
1141
+ e.f |= EFFECT_TRANSPARENT;
1142
+ }
1143
+ }
1144
+ if (e !== null) {
1145
+ e.parent = parent;
1146
+ if (parent !== null) {
1147
+ push_effect(e, parent);
1148
+ }
1149
+ if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
1150
+ var derived2 = (
1151
+ /** @type {Derived} */
1152
+ active_reaction
1153
+ );
1154
+ (derived2.effects ??= []).push(e);
1155
+ }
1156
+ }
1157
+ return effect;
1158
+ }
1159
+ function effect_tracking() {
1160
+ return active_reaction !== null && !untracking;
1161
+ }
1162
+ function create_user_effect(fn) {
1163
+ return create_effect(EFFECT | USER_EFFECT, fn, false);
1164
+ }
1165
+ function component_root(fn) {
1166
+ Batch.ensure();
1167
+ const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
1168
+ return (options = {}) => {
1169
+ return new Promise((fulfil) => {
1170
+ if (options.outro) {
1171
+ pause_effect(effect, () => {
1172
+ destroy_effect(effect);
1173
+ fulfil(void 0);
1174
+ });
1175
+ } else {
1176
+ destroy_effect(effect);
1177
+ fulfil(void 0);
1178
+ }
1179
+ });
1180
+ };
1181
+ }
1182
+ function render_effect(fn, flags = 0) {
1183
+ return create_effect(RENDER_EFFECT | flags, fn, true);
1184
+ }
1185
+ function block(fn, flags = 0) {
1186
+ var effect = create_effect(BLOCK_EFFECT | flags, fn, true);
1187
+ return effect;
1188
+ }
1189
+ function branch(fn) {
1190
+ return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true);
1191
+ }
1192
+ function execute_effect_teardown(effect) {
1193
+ var teardown = effect.teardown;
1194
+ if (teardown !== null) {
1195
+ const previously_destroying_effect = is_destroying_effect;
1196
+ const previous_reaction = active_reaction;
1197
+ set_is_destroying_effect(true);
1198
+ set_active_reaction(null);
1199
+ try {
1200
+ teardown.call(null);
1201
+ } finally {
1202
+ set_is_destroying_effect(previously_destroying_effect);
1203
+ set_active_reaction(previous_reaction);
1204
+ }
1205
+ }
1206
+ }
1207
+ function destroy_effect_children(signal, remove_dom = false) {
1208
+ var effect = signal.first;
1209
+ signal.first = signal.last = null;
1210
+ while (effect !== null) {
1211
+ const controller2 = effect.ac;
1212
+ if (controller2 !== null) {
1213
+ without_reactive_context(() => {
1214
+ controller2.abort(STALE_REACTION);
1215
+ });
1216
+ }
1217
+ var next = effect.next;
1218
+ if ((effect.f & ROOT_EFFECT) !== 0) {
1219
+ effect.parent = null;
1220
+ } else {
1221
+ destroy_effect(effect, remove_dom);
1222
+ }
1223
+ effect = next;
1224
+ }
1225
+ }
1226
+ function destroy_block_effect_children(signal) {
1227
+ var effect = signal.first;
1228
+ while (effect !== null) {
1229
+ var next = effect.next;
1230
+ if ((effect.f & BRANCH_EFFECT) === 0) {
1231
+ destroy_effect(effect);
1232
+ }
1233
+ effect = next;
1234
+ }
1235
+ }
1236
+ function destroy_effect(effect, remove_dom = true) {
1237
+ var removed = false;
1238
+ if ((remove_dom || (effect.f & HEAD_EFFECT) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
1239
+ remove_effect_dom(
1240
+ effect.nodes.start,
1241
+ /** @type {TemplateNode} */
1242
+ effect.nodes.end
1243
+ );
1244
+ removed = true;
1245
+ }
1246
+ destroy_effect_children(effect, remove_dom && !removed);
1247
+ remove_reactions(effect, 0);
1248
+ set_signal_status(effect, DESTROYED);
1249
+ var transitions = effect.nodes && effect.nodes.t;
1250
+ if (transitions !== null) {
1251
+ for (const transition of transitions) {
1252
+ transition.stop();
1253
+ }
1254
+ }
1255
+ execute_effect_teardown(effect);
1256
+ var parent = effect.parent;
1257
+ if (parent !== null && parent.first !== null) {
1258
+ unlink_effect(effect);
1259
+ }
1260
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = null;
1261
+ }
1262
+ function remove_effect_dom(node, end) {
1263
+ while (node !== null) {
1264
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1265
+ node.remove();
1266
+ node = next;
1267
+ }
1268
+ }
1269
+ function unlink_effect(effect) {
1270
+ var parent = effect.parent;
1271
+ var prev = effect.prev;
1272
+ var next = effect.next;
1273
+ if (prev !== null) prev.next = next;
1274
+ if (next !== null) next.prev = prev;
1275
+ if (parent !== null) {
1276
+ if (parent.first === effect) parent.first = next;
1277
+ if (parent.last === effect) parent.last = prev;
1278
+ }
1279
+ }
1280
+ function pause_effect(effect, callback, destroy = true) {
1281
+ var transitions = [];
1282
+ pause_children(effect, transitions, true);
1283
+ var fn = () => {
1284
+ if (destroy) destroy_effect(effect);
1285
+ if (callback) callback();
1286
+ };
1287
+ var remaining = transitions.length;
1288
+ if (remaining > 0) {
1289
+ var check = () => --remaining || fn();
1290
+ for (var transition of transitions) {
1291
+ transition.out(check);
1292
+ }
1293
+ } else {
1294
+ fn();
1295
+ }
1296
+ }
1297
+ function pause_children(effect, transitions, local) {
1298
+ if ((effect.f & INERT) !== 0) return;
1299
+ effect.f ^= INERT;
1300
+ var t = effect.nodes && effect.nodes.t;
1301
+ if (t !== null) {
1302
+ for (const transition of t) {
1303
+ if (transition.is_global || local) {
1304
+ transitions.push(transition);
1305
+ }
1306
+ }
1307
+ }
1308
+ var child = effect.first;
1309
+ while (child !== null) {
1310
+ var sibling = child.next;
1311
+ var transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
1312
+ // it means the parent block effect was pruned. In that case,
1313
+ // transparency information was transferred to the branch effect.
1314
+ (child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0;
1315
+ pause_children(child, transitions, transparent ? local : false);
1316
+ child = sibling;
1317
+ }
1318
+ }
1319
+ function move_effect(effect, fragment) {
1320
+ if (!effect.nodes) return;
1321
+ var node = effect.nodes.start;
1322
+ var end = effect.nodes.end;
1323
+ while (node !== null) {
1324
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1325
+ fragment.append(node);
1326
+ node = next;
1327
+ }
1328
+ }
1329
+ let is_updating_effect = false;
1330
+ let is_destroying_effect = false;
1331
+ function set_is_destroying_effect(value) {
1332
+ is_destroying_effect = value;
1333
+ }
1334
+ let active_reaction = null;
1335
+ let untracking = false;
1336
+ function set_active_reaction(reaction) {
1337
+ active_reaction = reaction;
1338
+ }
1339
+ let active_effect = null;
1340
+ function set_active_effect(effect) {
1341
+ active_effect = effect;
1342
+ }
1343
+ let current_sources = null;
1344
+ function push_reaction_value(value) {
1345
+ if (active_reaction !== null && true) {
1346
+ if (current_sources === null) {
1347
+ current_sources = [value];
1348
+ } else {
1349
+ current_sources.push(value);
1350
+ }
1351
+ }
1352
+ }
1353
+ let new_deps = null;
1354
+ let skipped_deps = 0;
1355
+ let untracked_writes = null;
1356
+ function set_untracked_writes(value) {
1357
+ untracked_writes = value;
1358
+ }
1359
+ let write_version = 1;
1360
+ let read_version = 0;
1361
+ let update_version = read_version;
1362
+ function set_update_version(value) {
1363
+ update_version = value;
1364
+ }
1365
+ function increment_write_version() {
1366
+ return ++write_version;
1367
+ }
1368
+ function is_dirty(reaction) {
1369
+ var flags = reaction.f;
1370
+ if ((flags & DIRTY) !== 0) {
1371
+ return true;
1372
+ }
1373
+ if (flags & DERIVED) {
1374
+ reaction.f &= ~WAS_MARKED;
1375
+ }
1376
+ if ((flags & MAYBE_DIRTY) !== 0) {
1377
+ var dependencies = (
1378
+ /** @type {Value[]} */
1379
+ reaction.deps
1380
+ );
1381
+ var length = dependencies.length;
1382
+ for (var i = 0; i < length; i++) {
1383
+ var dependency = dependencies[i];
1384
+ if (is_dirty(
1385
+ /** @type {Derived} */
1386
+ dependency
1387
+ )) {
1388
+ update_derived(
1389
+ /** @type {Derived} */
1390
+ dependency
1391
+ );
1392
+ }
1393
+ if (dependency.wv > reaction.wv) {
1394
+ return true;
1395
+ }
1396
+ }
1397
+ if ((flags & CONNECTED) !== 0 && // During time traveling we don't want to reset the status so that
1398
+ // traversal of the graph in the other batches still happens
1399
+ batch_values === null) {
1400
+ set_signal_status(reaction, CLEAN);
1401
+ }
1402
+ }
1403
+ return false;
1404
+ }
1405
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
1406
+ var reactions = signal.reactions;
1407
+ if (reactions === null) return;
1408
+ if (current_sources !== null && includes.call(current_sources, signal)) {
1409
+ return;
1410
+ }
1411
+ for (var i = 0; i < reactions.length; i++) {
1412
+ var reaction = reactions[i];
1413
+ if ((reaction.f & DERIVED) !== 0) {
1414
+ schedule_possible_effect_self_invalidation(
1415
+ /** @type {Derived} */
1416
+ reaction,
1417
+ effect,
1418
+ false
1419
+ );
1420
+ } else if (effect === reaction) {
1421
+ if (root) {
1422
+ set_signal_status(reaction, DIRTY);
1423
+ } else if ((reaction.f & CLEAN) !== 0) {
1424
+ set_signal_status(reaction, MAYBE_DIRTY);
1425
+ }
1426
+ schedule_effect(
1427
+ /** @type {Effect} */
1428
+ reaction
1429
+ );
1430
+ }
1431
+ }
1432
+ }
1433
+ function update_reaction(reaction) {
1434
+ var previous_deps = new_deps;
1435
+ var previous_skipped_deps = skipped_deps;
1436
+ var previous_untracked_writes = untracked_writes;
1437
+ var previous_reaction = active_reaction;
1438
+ var previous_sources = current_sources;
1439
+ var previous_component_context = component_context;
1440
+ var previous_untracking = untracking;
1441
+ var previous_update_version = update_version;
1442
+ var flags = reaction.f;
1443
+ new_deps = /** @type {null | Value[]} */
1444
+ null;
1445
+ skipped_deps = 0;
1446
+ untracked_writes = null;
1447
+ active_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
1448
+ current_sources = null;
1449
+ set_component_context(reaction.ctx);
1450
+ untracking = false;
1451
+ update_version = ++read_version;
1452
+ if (reaction.ac !== null) {
1453
+ without_reactive_context(() => {
1454
+ reaction.ac.abort(STALE_REACTION);
1455
+ });
1456
+ reaction.ac = null;
1457
+ }
1458
+ try {
1459
+ reaction.f |= REACTION_IS_UPDATING;
1460
+ var fn = (
1461
+ /** @type {Function} */
1462
+ reaction.fn
1463
+ );
1464
+ var result = fn();
1465
+ var deps = reaction.deps;
1466
+ if (new_deps !== null) {
1467
+ var i;
1468
+ remove_reactions(reaction, skipped_deps);
1469
+ if (deps !== null && skipped_deps > 0) {
1470
+ deps.length = skipped_deps + new_deps.length;
1471
+ for (i = 0; i < new_deps.length; i++) {
1472
+ deps[skipped_deps + i] = new_deps[i];
1473
+ }
1474
+ } else {
1475
+ reaction.deps = deps = new_deps;
1476
+ }
1477
+ if (effect_tracking() && (reaction.f & CONNECTED) !== 0) {
1478
+ for (i = skipped_deps; i < deps.length; i++) {
1479
+ (deps[i].reactions ??= []).push(reaction);
1480
+ }
1481
+ }
1482
+ } else if (deps !== null && skipped_deps < deps.length) {
1483
+ remove_reactions(reaction, skipped_deps);
1484
+ deps.length = skipped_deps;
1485
+ }
1486
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
1487
+ for (i = 0; i < /** @type {Source[]} */
1488
+ untracked_writes.length; i++) {
1489
+ schedule_possible_effect_self_invalidation(
1490
+ untracked_writes[i],
1491
+ /** @type {Effect} */
1492
+ reaction
1493
+ );
1494
+ }
1495
+ }
1496
+ if (previous_reaction !== null && previous_reaction !== reaction) {
1497
+ read_version++;
1498
+ if (previous_reaction.deps !== null) {
1499
+ for (let i2 = 0; i2 < previous_skipped_deps; i2 += 1) {
1500
+ previous_reaction.deps[i2].rv = read_version;
1501
+ }
1502
+ }
1503
+ if (previous_deps !== null) {
1504
+ for (const dep of previous_deps) {
1505
+ dep.rv = read_version;
1506
+ }
1507
+ }
1508
+ if (untracked_writes !== null) {
1509
+ if (previous_untracked_writes === null) {
1510
+ previous_untracked_writes = untracked_writes;
1511
+ } else {
1512
+ previous_untracked_writes.push(.../** @type {Source[]} */
1513
+ untracked_writes);
1514
+ }
1515
+ }
1516
+ }
1517
+ if ((reaction.f & ERROR_VALUE) !== 0) {
1518
+ reaction.f ^= ERROR_VALUE;
1519
+ }
1520
+ return result;
1521
+ } catch (error) {
1522
+ return handle_error(error);
1523
+ } finally {
1524
+ reaction.f ^= REACTION_IS_UPDATING;
1525
+ new_deps = previous_deps;
1526
+ skipped_deps = previous_skipped_deps;
1527
+ untracked_writes = previous_untracked_writes;
1528
+ active_reaction = previous_reaction;
1529
+ current_sources = previous_sources;
1530
+ set_component_context(previous_component_context);
1531
+ untracking = previous_untracking;
1532
+ update_version = previous_update_version;
1533
+ }
1534
+ }
1535
+ function remove_reaction(signal, dependency) {
1536
+ let reactions = dependency.reactions;
1537
+ if (reactions !== null) {
1538
+ var index = index_of.call(reactions, signal);
1539
+ if (index !== -1) {
1540
+ var new_length = reactions.length - 1;
1541
+ if (new_length === 0) {
1542
+ reactions = dependency.reactions = null;
1543
+ } else {
1544
+ reactions[index] = reactions[new_length];
1545
+ reactions.pop();
1546
+ }
1547
+ }
1548
+ }
1549
+ if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1550
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1551
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1552
+ (new_deps === null || !includes.call(new_deps, dependency))) {
1553
+ var derived2 = (
1554
+ /** @type {Derived} */
1555
+ dependency
1556
+ );
1557
+ if ((derived2.f & CONNECTED) !== 0) {
1558
+ derived2.f ^= CONNECTED;
1559
+ derived2.f &= ~WAS_MARKED;
1560
+ }
1561
+ update_derived_status(derived2);
1562
+ destroy_derived_effects(derived2);
1563
+ remove_reactions(derived2, 0);
1564
+ }
1565
+ }
1566
+ function remove_reactions(signal, start_index) {
1567
+ var dependencies = signal.deps;
1568
+ if (dependencies === null) return;
1569
+ for (var i = start_index; i < dependencies.length; i++) {
1570
+ remove_reaction(signal, dependencies[i]);
1571
+ }
1572
+ }
1573
+ function update_effect(effect) {
1574
+ var flags = effect.f;
1575
+ if ((flags & DESTROYED) !== 0) {
1576
+ return;
1577
+ }
1578
+ set_signal_status(effect, CLEAN);
1579
+ var previous_effect = active_effect;
1580
+ var was_updating_effect = is_updating_effect;
1581
+ active_effect = effect;
1582
+ is_updating_effect = true;
1583
+ try {
1584
+ if ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
1585
+ destroy_block_effect_children(effect);
1586
+ } else {
1587
+ destroy_effect_children(effect);
1588
+ }
1589
+ execute_effect_teardown(effect);
1590
+ var teardown = update_reaction(effect);
1591
+ effect.teardown = typeof teardown === "function" ? teardown : null;
1592
+ effect.wv = write_version;
1593
+ var dep;
1594
+ if (BROWSER && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) ;
1595
+ } finally {
1596
+ is_updating_effect = was_updating_effect;
1597
+ active_effect = previous_effect;
1598
+ }
1599
+ }
1600
+ function get(signal) {
1601
+ var flags = signal.f;
1602
+ var is_derived = (flags & DERIVED) !== 0;
1603
+ if (active_reaction !== null && !untracking) {
1604
+ var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
1605
+ if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
1606
+ var deps = active_reaction.deps;
1607
+ if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
1608
+ if (signal.rv < read_version) {
1609
+ signal.rv = read_version;
1610
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
1611
+ skipped_deps++;
1612
+ } else if (new_deps === null) {
1613
+ new_deps = [signal];
1614
+ } else {
1615
+ new_deps.push(signal);
1616
+ }
1617
+ }
1618
+ } else {
1619
+ (active_reaction.deps ??= []).push(signal);
1620
+ var reactions = signal.reactions;
1621
+ if (reactions === null) {
1622
+ signal.reactions = [active_reaction];
1623
+ } else if (!includes.call(reactions, active_reaction)) {
1624
+ reactions.push(active_reaction);
1625
+ }
1626
+ }
1627
+ }
1628
+ }
1629
+ if (is_destroying_effect && old_values.has(signal)) {
1630
+ return old_values.get(signal);
1631
+ }
1632
+ if (is_derived) {
1633
+ var derived2 = (
1634
+ /** @type {Derived} */
1635
+ signal
1636
+ );
1637
+ if (is_destroying_effect) {
1638
+ var value = derived2.v;
1639
+ if ((derived2.f & CLEAN) === 0 && derived2.reactions !== null || depends_on_old_values(derived2)) {
1640
+ value = execute_derived(derived2);
1641
+ }
1642
+ old_values.set(derived2, value);
1643
+ return value;
1644
+ }
1645
+ var should_connect = (derived2.f & CONNECTED) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & CONNECTED) !== 0);
1646
+ var is_new = derived2.deps === null;
1647
+ if (is_dirty(derived2)) {
1648
+ if (should_connect) {
1649
+ derived2.f |= CONNECTED;
1650
+ }
1651
+ update_derived(derived2);
1652
+ }
1653
+ if (should_connect && !is_new) {
1654
+ reconnect(derived2);
1655
+ }
1656
+ }
1657
+ if (batch_values?.has(signal)) {
1658
+ return batch_values.get(signal);
1659
+ }
1660
+ if ((signal.f & ERROR_VALUE) !== 0) {
1661
+ throw signal.v;
1662
+ }
1663
+ return signal.v;
1664
+ }
1665
+ function reconnect(derived2) {
1666
+ if (derived2.deps === null) return;
1667
+ derived2.f |= CONNECTED;
1668
+ for (const dep of derived2.deps) {
1669
+ (dep.reactions ??= []).push(derived2);
1670
+ if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
1671
+ reconnect(
1672
+ /** @type {Derived} */
1673
+ dep
1674
+ );
1675
+ }
1676
+ }
1677
+ }
1678
+ function depends_on_old_values(derived2) {
1679
+ if (derived2.v === UNINITIALIZED) return true;
1680
+ if (derived2.deps === null) return false;
1681
+ for (const dep of derived2.deps) {
1682
+ if (old_values.has(dep)) {
1683
+ return true;
1684
+ }
1685
+ if ((dep.f & DERIVED) !== 0 && depends_on_old_values(
1686
+ /** @type {Derived} */
1687
+ dep
1688
+ )) {
1689
+ return true;
1690
+ }
1691
+ }
1692
+ return false;
1693
+ }
1694
+ function untrack(fn) {
1695
+ var previous_untracking = untracking;
1696
+ try {
1697
+ untracking = true;
1698
+ return fn();
1699
+ } finally {
1700
+ untracking = previous_untracking;
1701
+ }
1702
+ }
1703
+ const VOID_ELEMENT_NAMES = [
1704
+ "area",
1705
+ "base",
1706
+ "br",
1707
+ "col",
1708
+ "command",
1709
+ "embed",
1710
+ "hr",
1711
+ "img",
1712
+ "input",
1713
+ "keygen",
1714
+ "link",
1715
+ "meta",
1716
+ "param",
1717
+ "source",
1718
+ "track",
1719
+ "wbr"
1720
+ ];
1721
+ function is_void(name) {
1722
+ return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === "!doctype";
1723
+ }
1724
+ const DOM_BOOLEAN_ATTRIBUTES = [
1725
+ "allowfullscreen",
1726
+ "async",
1727
+ "autofocus",
1728
+ "autoplay",
1729
+ "checked",
1730
+ "controls",
1731
+ "default",
1732
+ "disabled",
1733
+ "formnovalidate",
1734
+ "indeterminate",
1735
+ "inert",
1736
+ "ismap",
1737
+ "loop",
1738
+ "multiple",
1739
+ "muted",
1740
+ "nomodule",
1741
+ "novalidate",
1742
+ "open",
1743
+ "playsinline",
1744
+ "readonly",
1745
+ "required",
1746
+ "reversed",
1747
+ "seamless",
1748
+ "selected",
1749
+ "webkitdirectory",
1750
+ "defer",
1751
+ "disablepictureinpicture",
1752
+ "disableremoteplayback"
1753
+ ];
1754
+ function is_boolean_attribute(name) {
1755
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
1756
+ }
1757
+ const PASSIVE_EVENTS = ["touchstart", "touchmove"];
1758
+ function is_passive_event(name) {
1759
+ return PASSIVE_EVENTS.includes(name);
1760
+ }
1761
+ const RAW_TEXT_ELEMENTS = (
1762
+ /** @type {const} */
1763
+ ["textarea", "script", "style", "title"]
1764
+ );
1765
+ function is_raw_text_element(name) {
1766
+ return RAW_TEXT_ELEMENTS.includes(
1767
+ /** @type {typeof RAW_TEXT_ELEMENTS[number]} */
1768
+ name
1769
+ );
1770
+ }
1771
+ const replacements = {
1772
+ translate: /* @__PURE__ */ new Map([
1773
+ [true, "yes"],
1774
+ [false, "no"]
1775
+ ])
1776
+ };
1777
+ function attr(name, value, is_boolean = false) {
1778
+ if (name === "hidden" && value !== "until-found") {
1779
+ is_boolean = true;
1780
+ }
1781
+ if (value == null || !value && is_boolean) return "";
1782
+ const normalized = name in replacements && replacements[name].get(value) || value;
1783
+ const assignment = is_boolean ? "" : `="${escape_html(normalized, true)}"`;
1784
+ return ` ${name}${assignment}`;
1785
+ }
1786
+ function clsx(value) {
1787
+ if (typeof value === "object") {
1788
+ return clsx$1(value);
1789
+ } else {
1790
+ return value ?? "";
1791
+ }
1792
+ }
1793
+ const whitespace = [..." \n\r\f \v\uFEFF"];
1794
+ function to_class(value, hash, directives) {
1795
+ var classname = value == null ? "" : "" + value;
1796
+ if (hash) {
1797
+ classname = classname ? classname + " " + hash : hash;
1798
+ }
1799
+ if (directives) {
1800
+ for (var key in directives) {
1801
+ if (directives[key]) {
1802
+ classname = classname ? classname + " " + key : key;
1803
+ } else if (classname.length) {
1804
+ var len = key.length;
1805
+ var a = 0;
1806
+ while ((a = classname.indexOf(key, a)) >= 0) {
1807
+ var b = a + len;
1808
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
1809
+ classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
1810
+ } else {
1811
+ a = b;
1812
+ }
1813
+ }
1814
+ }
1815
+ }
1816
+ }
1817
+ return classname === "" ? null : classname;
1818
+ }
1819
+ function append_styles(styles, important = false) {
1820
+ var separator = important ? " !important;" : ";";
1821
+ var css = "";
1822
+ for (var key in styles) {
1823
+ var value = styles[key];
1824
+ if (value != null && value !== "") {
1825
+ css += " " + key + ": " + value + separator;
1826
+ }
1827
+ }
1828
+ return css;
1829
+ }
1830
+ function to_css_name(name) {
1831
+ if (name[0] !== "-" || name[1] !== "-") {
1832
+ return name.toLowerCase();
1833
+ }
1834
+ return name;
1835
+ }
1836
+ function to_style(value, styles) {
1837
+ if (styles) {
1838
+ var new_style = "";
1839
+ var normal_styles;
1840
+ var important_styles;
1841
+ if (Array.isArray(styles)) {
1842
+ normal_styles = styles[0];
1843
+ important_styles = styles[1];
1844
+ } else {
1845
+ normal_styles = styles;
1846
+ }
1847
+ if (value) {
1848
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
1849
+ var in_str = false;
1850
+ var in_apo = 0;
1851
+ var in_comment = false;
1852
+ var reserved_names = [];
1853
+ if (normal_styles) {
1854
+ reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
1855
+ }
1856
+ if (important_styles) {
1857
+ reserved_names.push(...Object.keys(important_styles).map(to_css_name));
1858
+ }
1859
+ var start_index = 0;
1860
+ var name_index = -1;
1861
+ const len = value.length;
1862
+ for (var i = 0; i < len; i++) {
1863
+ var c = value[i];
1864
+ if (in_comment) {
1865
+ if (c === "/" && value[i - 1] === "*") {
1866
+ in_comment = false;
1867
+ }
1868
+ } else if (in_str) {
1869
+ if (in_str === c) {
1870
+ in_str = false;
1871
+ }
1872
+ } else if (c === "/" && value[i + 1] === "*") {
1873
+ in_comment = true;
1874
+ } else if (c === '"' || c === "'") {
1875
+ in_str = c;
1876
+ } else if (c === "(") {
1877
+ in_apo++;
1878
+ } else if (c === ")") {
1879
+ in_apo--;
1880
+ }
1881
+ if (!in_comment && in_str === false && in_apo === 0) {
1882
+ if (c === ":" && name_index === -1) {
1883
+ name_index = i;
1884
+ } else if (c === ";" || i === len - 1) {
1885
+ if (name_index !== -1) {
1886
+ var name = to_css_name(value.substring(start_index, name_index).trim());
1887
+ if (!reserved_names.includes(name)) {
1888
+ if (c !== ";") {
1889
+ i++;
1890
+ }
1891
+ var property = value.substring(start_index, i).trim();
1892
+ new_style += " " + property + ";";
1893
+ }
1894
+ }
1895
+ start_index = i + 1;
1896
+ name_index = -1;
1897
+ }
1898
+ }
1899
+ }
1900
+ }
1901
+ if (normal_styles) {
1902
+ new_style += append_styles(normal_styles);
1903
+ }
1904
+ if (important_styles) {
1905
+ new_style += append_styles(important_styles, true);
1906
+ }
1907
+ new_style = new_style.trim();
1908
+ return new_style === "" ? null : new_style;
1909
+ }
1910
+ return value == null ? null : String(value);
1911
+ }
1912
+ function subscribe_to_store(store, run, invalidate) {
1913
+ if (store == null) {
1914
+ run(void 0);
1915
+ return noop;
1916
+ }
1917
+ const unsub = untrack(
1918
+ () => store.subscribe(
1919
+ run,
1920
+ // @ts-expect-error
1921
+ invalidate
1922
+ )
1923
+ );
1924
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
1925
+ }
1926
+ const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
1927
+ const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
1928
+ const EMPTY_COMMENT = `<!---->`;
1929
+ let controller = null;
1930
+ function abort() {
1931
+ controller?.abort(STALE_REACTION);
1932
+ controller = null;
1933
+ }
1934
+ function await_invalid() {
1935
+ const error = new Error(`await_invalid
1936
+ Encountered asynchronous work while rendering synchronously.
1937
+ https://svelte.dev/e/await_invalid`);
1938
+ error.name = "Svelte error";
1939
+ throw error;
1940
+ }
1941
+ function invalid_csp() {
1942
+ const error = new Error(`invalid_csp
1943
+ \`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
1944
+ https://svelte.dev/e/invalid_csp`);
1945
+ error.name = "Svelte error";
1946
+ throw error;
1947
+ }
1948
+ function lifecycle_function_unavailable(name) {
1949
+ const error = new Error(`lifecycle_function_unavailable
1950
+ \`${name}(...)\` is not available on the server
1951
+ https://svelte.dev/e/lifecycle_function_unavailable`);
1952
+ error.name = "Svelte error";
1953
+ throw error;
1954
+ }
1955
+ function server_context_required() {
1956
+ const error = new Error(`server_context_required
1957
+ Could not resolve \`render\` context.
1958
+ https://svelte.dev/e/server_context_required`);
1959
+ error.name = "Svelte error";
1960
+ throw error;
1961
+ }
1962
+ function unresolved_hydratable(key, stack) {
1963
+ {
1964
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
1965
+ }
1966
+ }
1967
+ function get_render_context() {
1968
+ const store = als?.getStore();
1969
+ {
1970
+ server_context_required();
1971
+ }
1972
+ return store;
1973
+ }
1974
+ let als = null;
1975
+ let text_encoder;
1976
+ let crypto;
1977
+ async function sha256(data) {
1978
+ text_encoder ??= new TextEncoder();
1979
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (
1980
+ // @ts-ignore - we don't install node types in the prod build
1981
+ (await import("node:crypto")).webcrypto
1982
+ );
1983
+ const hash_buffer = await crypto.subtle.digest("SHA-256", text_encoder.encode(data));
1984
+ return base64_encode(hash_buffer);
1985
+ }
1986
+ function base64_encode(bytes) {
1987
+ if (globalThis.Buffer) {
1988
+ return globalThis.Buffer.from(bytes).toString("base64");
1989
+ }
1990
+ let binary = "";
1991
+ for (let i = 0; i < bytes.length; i++) {
1992
+ binary += String.fromCharCode(bytes[i]);
1993
+ }
1994
+ return btoa(binary);
1995
+ }
1996
+ class Renderer {
1997
+ /**
1998
+ * The contents of the renderer.
1999
+ * @type {RendererItem[]}
2000
+ */
2001
+ #out = [];
2002
+ /**
2003
+ * Any `onDestroy` callbacks registered during execution of this renderer.
2004
+ * @type {(() => void)[] | undefined}
2005
+ */
2006
+ #on_destroy = void 0;
2007
+ /**
2008
+ * Whether this renderer is a component body.
2009
+ * @type {boolean}
2010
+ */
2011
+ #is_component_body = false;
2012
+ /**
2013
+ * The type of string content that this renderer is accumulating.
2014
+ * @type {RendererType}
2015
+ */
2016
+ type;
2017
+ /** @type {Renderer | undefined} */
2018
+ #parent;
2019
+ /**
2020
+ * Asynchronous work associated with this renderer
2021
+ * @type {Promise<void> | undefined}
2022
+ */
2023
+ promise = void 0;
2024
+ /**
2025
+ * State which is associated with the content tree as a whole.
2026
+ * It will be re-exposed, uncopied, on all children.
2027
+ * @type {SSRState}
2028
+ * @readonly
2029
+ */
2030
+ global;
2031
+ /**
2032
+ * State that is local to the branch it is declared in.
2033
+ * It will be shallow-copied to all children.
2034
+ *
2035
+ * @type {{ select_value: string | undefined }}
2036
+ */
2037
+ local;
2038
+ /**
2039
+ * @param {SSRState} global
2040
+ * @param {Renderer | undefined} [parent]
2041
+ */
2042
+ constructor(global, parent) {
2043
+ this.#parent = parent;
2044
+ this.global = global;
2045
+ this.local = parent ? { ...parent.local } : { select_value: void 0 };
2046
+ this.type = parent ? parent.type : "body";
2047
+ }
2048
+ /**
2049
+ * @param {(renderer: Renderer) => void} fn
2050
+ */
2051
+ head(fn) {
2052
+ const head2 = new Renderer(this.global, this);
2053
+ head2.type = "head";
2054
+ this.#out.push(head2);
2055
+ head2.child(fn);
2056
+ }
2057
+ /**
2058
+ * @param {Array<Promise<void>>} blockers
2059
+ * @param {(renderer: Renderer) => void} fn
2060
+ */
2061
+ async_block(blockers, fn) {
2062
+ this.#out.push(BLOCK_OPEN);
2063
+ this.async(blockers, fn);
2064
+ this.#out.push(BLOCK_CLOSE);
2065
+ }
2066
+ /**
2067
+ * @param {Array<Promise<void>>} blockers
2068
+ * @param {(renderer: Renderer) => void} fn
2069
+ */
2070
+ async(blockers, fn) {
2071
+ let callback = fn;
2072
+ if (blockers.length > 0) {
2073
+ const context = ssr_context;
2074
+ callback = (renderer) => {
2075
+ return Promise.all(blockers).then(() => {
2076
+ const previous_context = ssr_context;
2077
+ try {
2078
+ set_ssr_context(context);
2079
+ return fn(renderer);
2080
+ } finally {
2081
+ set_ssr_context(previous_context);
2082
+ }
2083
+ });
2084
+ };
2085
+ }
2086
+ this.child(callback);
2087
+ }
2088
+ /**
2089
+ * @param {Array<() => void>} thunks
2090
+ */
2091
+ run(thunks) {
2092
+ const context = ssr_context;
2093
+ let promise = Promise.resolve(thunks[0]());
2094
+ const promises = [promise];
2095
+ for (const fn of thunks.slice(1)) {
2096
+ promise = promise.then(() => {
2097
+ const previous_context = ssr_context;
2098
+ set_ssr_context(context);
2099
+ try {
2100
+ return fn();
2101
+ } finally {
2102
+ set_ssr_context(previous_context);
2103
+ }
2104
+ });
2105
+ promises.push(promise);
2106
+ }
2107
+ return promises;
2108
+ }
2109
+ /**
2110
+ * Create a child renderer. The child renderer inherits the state from the parent,
2111
+ * but has its own content.
2112
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2113
+ */
2114
+ child(fn) {
2115
+ const child = new Renderer(this.global, this);
2116
+ this.#out.push(child);
2117
+ const parent = ssr_context;
2118
+ set_ssr_context({
2119
+ ...ssr_context,
2120
+ p: parent,
2121
+ c: null,
2122
+ r: child
2123
+ });
2124
+ const result = fn(child);
2125
+ set_ssr_context(parent);
2126
+ if (result instanceof Promise) {
2127
+ if (child.global.mode === "sync") {
2128
+ await_invalid();
2129
+ }
2130
+ result.catch(() => {
2131
+ });
2132
+ child.promise = result;
2133
+ }
2134
+ return child;
2135
+ }
2136
+ /**
2137
+ * Create a component renderer. The component renderer inherits the state from the parent,
2138
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
2139
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2140
+ * @param {Function} [component_fn]
2141
+ * @returns {void}
2142
+ */
2143
+ component(fn, component_fn) {
2144
+ push$1();
2145
+ const child = this.child(fn);
2146
+ child.#is_component_body = true;
2147
+ pop$1();
2148
+ }
2149
+ /**
2150
+ * @param {Record<string, any>} attrs
2151
+ * @param {(renderer: Renderer) => void} fn
2152
+ * @param {string | undefined} [css_hash]
2153
+ * @param {Record<string, boolean> | undefined} [classes]
2154
+ * @param {Record<string, string> | undefined} [styles]
2155
+ * @param {number | undefined} [flags]
2156
+ * @param {boolean | undefined} [is_rich]
2157
+ * @returns {void}
2158
+ */
2159
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
2160
+ const { value, ...select_attrs } = attrs;
2161
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
2162
+ this.child((renderer) => {
2163
+ renderer.local.select_value = value;
2164
+ fn(renderer);
2165
+ });
2166
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
2167
+ }
2168
+ /**
2169
+ * @param {Record<string, any>} attrs
2170
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
2171
+ * @param {string | undefined} [css_hash]
2172
+ * @param {Record<string, boolean> | undefined} [classes]
2173
+ * @param {Record<string, string> | undefined} [styles]
2174
+ * @param {number | undefined} [flags]
2175
+ * @param {boolean | undefined} [is_rich]
2176
+ */
2177
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
2178
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
2179
+ const close = (renderer, value, { head: head2, body: body2 }) => {
2180
+ if ("value" in attrs) {
2181
+ value = attrs.value;
2182
+ }
2183
+ if (value === this.local.select_value) {
2184
+ renderer.#out.push(" selected");
2185
+ }
2186
+ renderer.#out.push(`>${body2}${is_rich ? "<!>" : ""}</option>`);
2187
+ if (head2) {
2188
+ renderer.head((child) => child.push(head2));
2189
+ }
2190
+ };
2191
+ if (typeof body === "function") {
2192
+ this.child((renderer) => {
2193
+ const r = new Renderer(this.global, this);
2194
+ body(r);
2195
+ if (this.global.mode === "async") {
2196
+ return r.#collect_content_async().then((content) => {
2197
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
2198
+ });
2199
+ } else {
2200
+ const content = r.#collect_content();
2201
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
2202
+ }
2203
+ });
2204
+ } else {
2205
+ close(this, body, { body });
2206
+ }
2207
+ }
2208
+ /**
2209
+ * @param {(renderer: Renderer) => void} fn
2210
+ */
2211
+ title(fn) {
2212
+ const path = this.get_path();
2213
+ const close = (head2) => {
2214
+ this.global.set_title(head2, path);
2215
+ };
2216
+ this.child((renderer) => {
2217
+ const r = new Renderer(renderer.global, renderer);
2218
+ fn(r);
2219
+ if (renderer.global.mode === "async") {
2220
+ return r.#collect_content_async().then((content) => {
2221
+ close(content.head);
2222
+ });
2223
+ } else {
2224
+ const content = r.#collect_content();
2225
+ close(content.head);
2226
+ }
2227
+ });
2228
+ }
2229
+ /**
2230
+ * @param {string | (() => Promise<string>)} content
2231
+ */
2232
+ push(content) {
2233
+ if (typeof content === "function") {
2234
+ this.child(async (renderer) => renderer.push(await content()));
2235
+ } else {
2236
+ this.#out.push(content);
2237
+ }
2238
+ }
2239
+ /**
2240
+ * @param {() => void} fn
2241
+ */
2242
+ on_destroy(fn) {
2243
+ (this.#on_destroy ??= []).push(fn);
2244
+ }
2245
+ /**
2246
+ * @returns {number[]}
2247
+ */
2248
+ get_path() {
2249
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
2250
+ }
2251
+ /**
2252
+ * @deprecated this is needed for legacy component bindings
2253
+ */
2254
+ copy() {
2255
+ const copy = new Renderer(this.global, this.#parent);
2256
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
2257
+ copy.promise = this.promise;
2258
+ return copy;
2259
+ }
2260
+ /**
2261
+ * @param {Renderer} other
2262
+ * @deprecated this is needed for legacy component bindings
2263
+ */
2264
+ subsume(other) {
2265
+ if (this.global.mode !== other.global.mode) {
2266
+ throw new Error(
2267
+ "invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
2268
+ );
2269
+ }
2270
+ this.local = other.local;
2271
+ this.#out = other.#out.map((item) => {
2272
+ if (item instanceof Renderer) {
2273
+ item.subsume(item);
2274
+ }
2275
+ return item;
2276
+ });
2277
+ this.promise = other.promise;
2278
+ this.type = other.type;
2279
+ }
2280
+ get length() {
2281
+ return this.#out.length;
2282
+ }
2283
+ /**
2284
+ * Only available on the server and when compiling with the `server` option.
2285
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
2286
+ * @template {Record<string, any>} Props
2287
+ * @param {Component<Props>} component
2288
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
2289
+ * @returns {RenderOutput}
2290
+ */
2291
+ static render(component, options = {}) {
2292
+ let sync;
2293
+ const result = (
2294
+ /** @type {RenderOutput} */
2295
+ {}
2296
+ );
2297
+ Object.defineProperties(result, {
2298
+ html: {
2299
+ get: () => {
2300
+ return (sync ??= Renderer.#render(component, options)).body;
2301
+ }
2302
+ },
2303
+ head: {
2304
+ get: () => {
2305
+ return (sync ??= Renderer.#render(component, options)).head;
2306
+ }
2307
+ },
2308
+ body: {
2309
+ get: () => {
2310
+ return (sync ??= Renderer.#render(component, options)).body;
2311
+ }
2312
+ },
2313
+ hashes: {
2314
+ value: {
2315
+ script: ""
2316
+ }
2317
+ },
2318
+ then: {
2319
+ value: (
2320
+ /**
2321
+ * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
2322
+ *
2323
+ * @template TResult1
2324
+ * @template [TResult2=never]
2325
+ * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
2326
+ * @param { (reason: unknown) => TResult2 } onrejected
2327
+ */
2328
+ (onfulfilled, onrejected) => {
2329
+ {
2330
+ const result2 = sync ??= Renderer.#render(component, options);
2331
+ const user_result = onfulfilled({
2332
+ head: result2.head,
2333
+ body: result2.body,
2334
+ html: result2.body,
2335
+ hashes: { script: [] }
2336
+ });
2337
+ return Promise.resolve(user_result);
2338
+ }
2339
+ }
2340
+ )
2341
+ }
2342
+ });
2343
+ return result;
2344
+ }
2345
+ /**
2346
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
2347
+ * after awaiting `collect_async`.
2348
+ *
2349
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
2350
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
2351
+ * @returns {Iterable<() => void>}
2352
+ */
2353
+ *#collect_on_destroy() {
2354
+ for (const component of this.#traverse_components()) {
2355
+ yield* component.#collect_ondestroy();
2356
+ }
2357
+ }
2358
+ /**
2359
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
2360
+ * @returns {Iterable<Renderer>}
2361
+ */
2362
+ *#traverse_components() {
2363
+ for (const child of this.#out) {
2364
+ if (typeof child !== "string") {
2365
+ yield* child.#traverse_components();
2366
+ }
2367
+ }
2368
+ if (this.#is_component_body) {
2369
+ yield this;
2370
+ }
2371
+ }
2372
+ /**
2373
+ * @returns {Iterable<() => void>}
2374
+ */
2375
+ *#collect_ondestroy() {
2376
+ if (this.#on_destroy) {
2377
+ for (const fn of this.#on_destroy) {
2378
+ yield fn;
2379
+ }
2380
+ }
2381
+ for (const child of this.#out) {
2382
+ if (child instanceof Renderer && !child.#is_component_body) {
2383
+ yield* child.#collect_ondestroy();
2384
+ }
2385
+ }
2386
+ }
2387
+ /**
2388
+ * Render a component. Throws if any of the children are performing asynchronous work.
2389
+ *
2390
+ * @template {Record<string, any>} Props
2391
+ * @param {Component<Props>} component
2392
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
2393
+ * @returns {AccumulatedContent}
2394
+ */
2395
+ static #render(component, options) {
2396
+ var previous_context = ssr_context;
2397
+ try {
2398
+ const renderer = Renderer.#open_render("sync", component, options);
2399
+ const content = renderer.#collect_content();
2400
+ return Renderer.#close_render(content, renderer);
2401
+ } finally {
2402
+ abort();
2403
+ set_ssr_context(previous_context);
2404
+ }
2405
+ }
2406
+ /**
2407
+ * Render a component.
2408
+ *
2409
+ * @template {Record<string, any>} Props
2410
+ * @param {Component<Props>} component
2411
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
2412
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
2413
+ */
2414
+ static async #render_async(component, options) {
2415
+ const previous_context = ssr_context;
2416
+ try {
2417
+ const renderer = Renderer.#open_render("async", component, options);
2418
+ const content = await renderer.#collect_content_async();
2419
+ const hydratables = await renderer.#collect_hydratables();
2420
+ if (hydratables !== null) {
2421
+ content.head = hydratables + content.head;
2422
+ }
2423
+ return Renderer.#close_render(content, renderer);
2424
+ } finally {
2425
+ set_ssr_context(previous_context);
2426
+ abort();
2427
+ }
2428
+ }
2429
+ /**
2430
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
2431
+ * @param {AccumulatedContent} content
2432
+ * @returns {AccumulatedContent}
2433
+ */
2434
+ #collect_content(content = { head: "", body: "" }) {
2435
+ for (const item of this.#out) {
2436
+ if (typeof item === "string") {
2437
+ content[this.type] += item;
2438
+ } else if (item instanceof Renderer) {
2439
+ item.#collect_content(content);
2440
+ }
2441
+ }
2442
+ return content;
2443
+ }
2444
+ /**
2445
+ * Collect all of the code from the `out` array and return it as a string.
2446
+ * @param {AccumulatedContent} content
2447
+ * @returns {Promise<AccumulatedContent>}
2448
+ */
2449
+ async #collect_content_async(content = { head: "", body: "" }) {
2450
+ await this.promise;
2451
+ for (const item of this.#out) {
2452
+ if (typeof item === "string") {
2453
+ content[this.type] += item;
2454
+ } else if (item instanceof Renderer) {
2455
+ await item.#collect_content_async(content);
2456
+ }
2457
+ }
2458
+ return content;
2459
+ }
2460
+ async #collect_hydratables() {
2461
+ const ctx = get_render_context().hydratable;
2462
+ for (const [_, key] of ctx.unresolved_promises) {
2463
+ unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
2464
+ }
2465
+ for (const comparison of ctx.comparisons) {
2466
+ await comparison;
2467
+ }
2468
+ return await this.#hydratable_block(ctx);
2469
+ }
2470
+ /**
2471
+ * @template {Record<string, any>} Props
2472
+ * @param {'sync' | 'async'} mode
2473
+ * @param {import('svelte').Component<Props>} component
2474
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
2475
+ * @returns {Renderer}
2476
+ */
2477
+ static #open_render(mode, component, options) {
2478
+ const renderer = new Renderer(
2479
+ new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp)
2480
+ );
2481
+ renderer.push(BLOCK_OPEN);
2482
+ if (options.context) {
2483
+ push$1();
2484
+ ssr_context.c = options.context;
2485
+ ssr_context.r = renderer;
2486
+ }
2487
+ component(renderer, options.props ?? {});
2488
+ if (options.context) {
2489
+ pop$1();
2490
+ }
2491
+ renderer.push(BLOCK_CLOSE);
2492
+ return renderer;
2493
+ }
2494
+ /**
2495
+ * @param {AccumulatedContent} content
2496
+ * @param {Renderer} renderer
2497
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
2498
+ */
2499
+ static #close_render(content, renderer) {
2500
+ for (const cleanup of renderer.#collect_on_destroy()) {
2501
+ cleanup();
2502
+ }
2503
+ let head2 = content.head + renderer.global.get_title();
2504
+ let body = content.body;
2505
+ for (const { hash, code } of renderer.global.css) {
2506
+ head2 += `<style id="${hash}">${code}</style>`;
2507
+ }
2508
+ return {
2509
+ head: head2,
2510
+ body,
2511
+ hashes: {
2512
+ script: renderer.global.csp.script_hashes
2513
+ }
2514
+ };
2515
+ }
2516
+ /**
2517
+ * @param {HydratableContext} ctx
2518
+ */
2519
+ async #hydratable_block(ctx) {
2520
+ if (ctx.lookup.size === 0) {
2521
+ return null;
2522
+ }
2523
+ let entries = [];
2524
+ let has_promises = false;
2525
+ for (const [k, v] of ctx.lookup) {
2526
+ if (v.promises) {
2527
+ has_promises = true;
2528
+ for (const p of v.promises) await p;
2529
+ }
2530
+ entries.push(`[${devalue.uneval(k)},${v.serialized}]`);
2531
+ }
2532
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
2533
+ if (has_promises) {
2534
+ prelude = `const r = (v) => Promise.resolve(v);
2535
+ ${prelude}`;
2536
+ }
2537
+ const body = `
2538
+ {
2539
+ ${prelude}
2540
+
2541
+ for (const [k, v] of [
2542
+ ${entries.join(",\n ")}
2543
+ ]) {
2544
+ h.set(k, v);
2545
+ }
2546
+ }
2547
+ `;
2548
+ let csp_attr = "";
2549
+ if (this.global.csp.nonce) {
2550
+ csp_attr = ` nonce="${this.global.csp.nonce}"`;
2551
+ } else if (this.global.csp.hash) {
2552
+ const hash = await sha256(body);
2553
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
2554
+ }
2555
+ return `
2556
+ <script${csp_attr}>${body}<\/script>`;
2557
+ }
2558
+ }
2559
+ class SSRState {
2560
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
2561
+ csp;
2562
+ /** @readonly @type {'sync' | 'async'} */
2563
+ mode;
2564
+ /** @readonly @type {() => string} */
2565
+ uid;
2566
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
2567
+ css = /* @__PURE__ */ new Set();
2568
+ /** @type {{ path: number[], value: string }} */
2569
+ #title = { path: [], value: "" };
2570
+ /**
2571
+ * @param {'sync' | 'async'} mode
2572
+ * @param {string} id_prefix
2573
+ * @param {Csp} csp
2574
+ */
2575
+ constructor(mode, id_prefix = "", csp = { hash: false }) {
2576
+ this.mode = mode;
2577
+ this.csp = { ...csp, script_hashes: [] };
2578
+ let uid = 1;
2579
+ this.uid = () => `${id_prefix}s${uid++}`;
2580
+ }
2581
+ get_title() {
2582
+ return this.#title.value;
2583
+ }
2584
+ /**
2585
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
2586
+ * from earlier than or equal to the current value.
2587
+ * @param {string} value
2588
+ * @param {number[]} path
2589
+ */
2590
+ set_title(value, path) {
2591
+ const current = this.#title.path;
2592
+ let i = 0;
2593
+ let l = Math.min(path.length, current.length);
2594
+ while (i < l && path[i] === current[i]) i += 1;
2595
+ if (path[i] === void 0) return;
2596
+ if (current[i] === void 0 || path[i] > current[i]) {
2597
+ this.#title.path = path;
2598
+ this.#title.value = value;
2599
+ }
2600
+ }
2601
+ }
2602
+ const INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
2603
+ function element(renderer, tag, attributes_fn = noop, children_fn = noop) {
2604
+ renderer.push("<!---->");
2605
+ if (tag) {
2606
+ renderer.push(`<${tag}`);
2607
+ attributes_fn();
2608
+ renderer.push(`>`);
2609
+ if (!is_void(tag)) {
2610
+ children_fn();
2611
+ if (!is_raw_text_element(tag)) {
2612
+ renderer.push(EMPTY_COMMENT);
2613
+ }
2614
+ renderer.push(`</${tag}>`);
2615
+ }
2616
+ }
2617
+ renderer.push("<!---->");
2618
+ }
2619
+ function render(component, options = {}) {
2620
+ if (options.csp?.hash && options.csp.nonce) {
2621
+ invalid_csp();
2622
+ }
2623
+ return Renderer.render(
2624
+ /** @type {Component<Props>} */
2625
+ component,
2626
+ options
2627
+ );
2628
+ }
2629
+ function head(hash, renderer, fn) {
2630
+ renderer.head((renderer2) => {
2631
+ renderer2.push(`<!--${hash}-->`);
2632
+ renderer2.child(fn);
2633
+ renderer2.push(EMPTY_COMMENT);
2634
+ });
2635
+ }
2636
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
2637
+ if (styles) {
2638
+ attrs.style = to_style(attrs.style, styles);
2639
+ }
2640
+ if (attrs.class) {
2641
+ attrs.class = clsx(attrs.class);
2642
+ }
2643
+ if (css_hash || classes) {
2644
+ attrs.class = to_class(attrs.class, css_hash, classes);
2645
+ }
2646
+ let attr_str = "";
2647
+ let name;
2648
+ const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
2649
+ const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
2650
+ const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
2651
+ for (name in attrs) {
2652
+ if (typeof attrs[name] === "function") continue;
2653
+ if (name[0] === "$" && name[1] === "$") continue;
2654
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
2655
+ var value = attrs[name];
2656
+ if (lowercase) {
2657
+ name = name.toLowerCase();
2658
+ }
2659
+ if (is_input) {
2660
+ if (name === "defaultvalue" || name === "defaultchecked") {
2661
+ name = name === "defaultvalue" ? "value" : "checked";
2662
+ if (attrs[name]) continue;
2663
+ }
2664
+ }
2665
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
2666
+ }
2667
+ return attr_str;
2668
+ }
2669
+ function spread_props(props) {
2670
+ const merged_props = {};
2671
+ let key;
2672
+ for (let i = 0; i < props.length; i++) {
2673
+ const obj = props[i];
2674
+ for (key in obj) {
2675
+ const desc = Object.getOwnPropertyDescriptor(obj, key);
2676
+ if (desc) {
2677
+ Object.defineProperty(merged_props, key, desc);
2678
+ } else {
2679
+ merged_props[key] = obj[key];
2680
+ }
2681
+ }
2682
+ }
2683
+ return merged_props;
2684
+ }
2685
+ function stringify(value) {
2686
+ return typeof value === "string" ? value : value == null ? "" : value + "";
2687
+ }
2688
+ function attr_class(value, hash, directives) {
2689
+ var result = to_class(value, hash, directives);
2690
+ return result ? ` class="${escape_html(result, true)}"` : "";
2691
+ }
2692
+ function attr_style(value, directives) {
2693
+ var result = to_style(value, directives);
2694
+ return result ? ` style="${escape_html(result, true)}"` : "";
2695
+ }
2696
+ function store_get(store_values, store_name, store) {
2697
+ if (store_name in store_values && store_values[store_name][0] === store) {
2698
+ return store_values[store_name][2];
2699
+ }
2700
+ store_values[store_name]?.[1]();
2701
+ store_values[store_name] = [store, null, void 0];
2702
+ const unsub = subscribe_to_store(
2703
+ store,
2704
+ /** @param {any} v */
2705
+ (v) => store_values[store_name][2] = v
2706
+ );
2707
+ store_values[store_name][1] = unsub;
2708
+ return store_values[store_name][2];
2709
+ }
2710
+ function unsubscribe_stores(store_values) {
2711
+ for (const store_name in store_values) {
2712
+ store_values[store_name][1]();
2713
+ }
2714
+ }
2715
+ function bind_props(props_parent, props_now) {
2716
+ for (const key in props_now) {
2717
+ const initial_value = props_parent[key];
2718
+ const value = props_now[key];
2719
+ if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) {
2720
+ props_parent[key] = value;
2721
+ }
2722
+ }
2723
+ }
2724
+ function ensure_array_like(array_like_or_iterator) {
2725
+ if (array_like_or_iterator) {
2726
+ return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
2727
+ }
2728
+ return [];
2729
+ }
2730
+ function once(get_value) {
2731
+ let value = (
2732
+ /** @type {V} */
2733
+ UNINITIALIZED
2734
+ );
2735
+ return () => {
2736
+ if (value === UNINITIALIZED) {
2737
+ value = get_value();
2738
+ }
2739
+ return value;
2740
+ };
2741
+ }
2742
+ function props_id(renderer) {
2743
+ const uid = renderer.global.uid();
2744
+ renderer.push("<!--$" + uid + "-->");
2745
+ return uid;
2746
+ }
2747
+ function derived(fn) {
2748
+ const get_value = once(fn);
2749
+ let updated_value;
2750
+ return function(new_value) {
2751
+ if (arguments.length === 0) {
2752
+ return updated_value ?? get_value();
2753
+ }
2754
+ updated_value = new_value;
2755
+ return updated_value;
2756
+ };
2757
+ }
2758
+ export {
2759
+ stringify as $,
2760
+ internal_set as A,
2761
+ Batch as B,
2762
+ COMMENT_NODE as C,
2763
+ DIRTY as D,
2764
+ destroy_effect as E,
2765
+ invoke_error_boundary as F,
2766
+ svelte_boundary_reset_onerror as G,
2767
+ HYDRATION_ERROR as H,
2768
+ EFFECT_TRANSPARENT as I,
2769
+ EFFECT_PRESERVED as J,
2770
+ BOUNDARY_EFFECT as K,
2771
+ init_operations as L,
2772
+ MAYBE_DIRTY as M,
2773
+ get_first_child as N,
2774
+ hydration_failed as O,
2775
+ clear_text_content as P,
2776
+ component_root as Q,
2777
+ is_passive_event as R,
2778
+ push as S,
2779
+ pop as T,
2780
+ set as U,
2781
+ LEGACY_PROPS as V,
2782
+ flushSync as W,
2783
+ mutable_source as X,
2784
+ render as Y,
2785
+ attr_class as Z,
2786
+ attr_style as _,
2787
+ HYDRATION_END as a,
2788
+ attr as a0,
2789
+ ensure_array_like as a1,
2790
+ store_get as a2,
2791
+ unsubscribe_stores as a3,
2792
+ head as a4,
2793
+ derived as a5,
2794
+ attributes as a6,
2795
+ bind_props as a7,
2796
+ spread_props as a8,
2797
+ props_id as a9,
2798
+ clsx as aa,
2799
+ element as ab,
2800
+ ATTACHMENT_KEY as ac,
2801
+ without_reactive_context as ad,
2802
+ lifecycle_function_unavailable as ae,
2803
+ HYDRATION_START as b,
2804
+ HYDRATION_START_ELSE as c,
2805
+ get as d,
2806
+ effect_tracking as e,
2807
+ active_effect as f,
2808
+ get_next_sibling as g,
2809
+ block as h,
2810
+ increment as i,
2811
+ branch as j,
2812
+ create_text as k,
2813
+ defer_effect as l,
2814
+ set_active_effect as m,
2815
+ set_active_reaction as n,
2816
+ set_component_context as o,
2817
+ pause_effect as p,
2818
+ queue_micro_task as q,
2819
+ render_effect as r,
2820
+ source as s,
2821
+ handle_error as t,
2822
+ untrack as u,
2823
+ active_reaction as v,
2824
+ component_context as w,
2825
+ move_effect as x,
2826
+ set_signal_status as y,
2827
+ schedule_effect as z
2828
+ };