clawmini 0.0.7 → 0.0.9

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 (367) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +14 -0
  3. package/.github/workflows/release.yml +49 -0
  4. package/CHANGELOG.md +36 -0
  5. package/README.md +5 -4
  6. package/dist/adapter-discord/index.d.mts.map +1 -1
  7. package/dist/adapter-discord/index.mjs +465 -282
  8. package/dist/adapter-discord/index.mjs.map +1 -1
  9. package/dist/adapter-google-chat/index.mjs +367 -243
  10. package/dist/adapter-google-chat/index.mjs.map +1 -1
  11. package/dist/cli/index.mjs +684 -24
  12. package/dist/cli/index.mjs.map +1 -1
  13. package/dist/cli/lite.mjs +43 -13
  14. package/dist/cli/lite.mjs.map +1 -1
  15. package/dist/cli/{propose-policy.mjs → manage-policies.mjs} +270 -47
  16. package/dist/cli/manage-policies.mjs.map +1 -0
  17. package/dist/cli/run-host.d.mts +1 -0
  18. package/dist/cli/run-host.mjs +3090 -0
  19. package/dist/cli/run-host.mjs.map +1 -0
  20. package/dist/config-CPFQIGdG.mjs +57 -0
  21. package/dist/config-CPFQIGdG.mjs.map +1 -0
  22. package/dist/config-Dvl-Pov4.mjs +76 -0
  23. package/dist/config-Dvl-Pov4.mjs.map +1 -0
  24. package/dist/daemon/index.d.mts.map +1 -1
  25. package/dist/daemon/index.mjs +970 -332
  26. package/dist/daemon/index.mjs.map +1 -1
  27. package/dist/supervisor-actions-CiW56eLi.mjs +843 -0
  28. package/dist/supervisor-actions-CiW56eLi.mjs.map +1 -0
  29. package/dist/turn-log-buffer-DRgW53gl.mjs +767 -0
  30. package/dist/turn-log-buffer-DRgW53gl.mjs.map +1 -0
  31. package/dist/web/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
  32. package/dist/web/_app/immutable/chunks/BhRSsUCh.js +2 -0
  33. package/dist/web/_app/immutable/chunks/BiLeM2i1.js +1 -0
  34. package/{web/.svelte-kit/output/client/_app/immutable/chunks/CME08kGM.js → dist/web/_app/immutable/chunks/BmBj85Ll.js} +1 -1
  35. package/dist/web/_app/immutable/chunks/BrERcKAH.js +1 -0
  36. package/dist/web/_app/immutable/chunks/Bv9252RM.js +1 -0
  37. package/dist/web/_app/immutable/chunks/CIXNBPKi.js +1 -0
  38. package/dist/web/_app/immutable/chunks/DISKL3GN.js +2 -0
  39. package/dist/web/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
  40. package/dist/web/_app/immutable/chunks/DnQ3vS13.js +1 -0
  41. package/dist/web/_app/immutable/chunks/KsloHTKS.js +1 -0
  42. package/{web/.svelte-kit/output/client/_app/immutable/chunks/Ck-be5J2.js → dist/web/_app/immutable/chunks/RsHsUj-8.js} +2 -2
  43. package/dist/web/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
  44. package/dist/web/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
  45. package/dist/web/_app/immutable/entry/start.Di0-Jhte.js +1 -0
  46. package/dist/web/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
  47. package/dist/web/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
  48. package/dist/web/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
  49. package/{web/.svelte-kit/output/client/_app/immutable/nodes/3.Dr0ot9sV.js → dist/web/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
  50. package/dist/web/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
  51. package/dist/web/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
  52. package/dist/web/_app/version.json +1 -1
  53. package/dist/web/index.html +12 -12
  54. package/dist/workspace-oWmVh5mi.mjs +1001 -0
  55. package/dist/workspace-oWmVh5mi.mjs.map +1 -0
  56. package/docs/23_adapter_slash_autocomplete/development_log.md +19 -0
  57. package/docs/23_adapter_slash_autocomplete/notes.md +18 -0
  58. package/docs/23_adapter_slash_autocomplete/prd.md +46 -0
  59. package/docs/23_adapter_slash_autocomplete/questions.md +6 -0
  60. package/docs/23_adapter_slash_autocomplete/tickets.md +21 -0
  61. package/docs/24_subagent_job_policy_fixes/development_log.md +22 -0
  62. package/docs/24_subagent_job_policy_fixes/notes.md +28 -0
  63. package/docs/24_subagent_job_policy_fixes/prd.md +59 -0
  64. package/docs/24_subagent_job_policy_fixes/questions.md +3 -0
  65. package/docs/24_subagent_job_policy_fixes/tickets.md +49 -0
  66. package/docs/25_e2e_test_improvements/development_log.md +30 -0
  67. package/docs/25_e2e_test_improvements/notes.md +29 -0
  68. package/docs/25_e2e_test_improvements/prd.md +43 -0
  69. package/docs/25_e2e_test_improvements/questions.md +12 -0
  70. package/docs/25_e2e_test_improvements/tickets-2.md +22 -0
  71. package/docs/25_e2e_test_improvements/tickets.md +22 -0
  72. package/docs/25_policy_cwd/development_log.md +30 -0
  73. package/docs/25_policy_cwd/notes.md +28 -0
  74. package/docs/25_policy_cwd/prd.md +77 -0
  75. package/docs/25_policy_cwd/questions.md +6 -0
  76. package/docs/25_policy_cwd/tickets.md +77 -0
  77. package/docs/CLI_REFERENCE.md +3 -1
  78. package/docs/PHILOSOPHY.md +35 -0
  79. package/docs/adapter-visibility/SPEC.md +461 -0
  80. package/docs/adapter-visibility/SPEC_v2.md +202 -0
  81. package/docs/auto-update/SPEC.md +344 -0
  82. package/docs/backups/SPEC.md +296 -0
  83. package/docs/backups/clawmini.gitignore +69 -0
  84. package/docs/guides/assets/clawmini-avatar.png +0 -0
  85. package/docs/guides/backups.md +332 -0
  86. package/docs/guides/discord_adapter_setup.md +1 -1
  87. package/docs/guides/google_chat_adapter_setup.md +81 -0
  88. package/docs/unified-startup/SPEC.md +203 -0
  89. package/e2e/_helpers/test-environment.test.ts +49 -0
  90. package/e2e/_helpers/test-environment.ts +548 -0
  91. package/e2e/adapters/_google-chat-fixtures.ts +340 -0
  92. package/{src/cli/e2e → e2e/adapters}/adapter-discord.test.ts +22 -23
  93. package/e2e/adapters/adapter-google-chat-downtime.test.ts +157 -0
  94. package/e2e/adapters/adapter-google-chat-inbound.test.ts +697 -0
  95. package/e2e/adapters/adapter-google-chat-outbound.test.ts +297 -0
  96. package/e2e/adapters/adapter-google-chat-roundtrip.test.ts +56 -0
  97. package/e2e/adapters/adapter-google-chat-threads.test.ts +1078 -0
  98. package/e2e/agents/custom-api-env.test.ts +80 -0
  99. package/e2e/agents/export-lite-func.test.ts +104 -0
  100. package/e2e/agents/fallbacks.test.ts +124 -0
  101. package/e2e/agents/interrupt.test.ts +50 -0
  102. package/e2e/agents/no-reply-necessary.test.ts +57 -0
  103. package/e2e/agents/session-timeout-subagents.test.ts +76 -0
  104. package/e2e/agents/subagent-authorization.test.ts +246 -0
  105. package/e2e/agents/subagent-env.test.ts +49 -0
  106. package/e2e/agents/subagent-lifecycle.test.ts +782 -0
  107. package/e2e/agents/subagents-depth.test.ts +47 -0
  108. package/e2e/cli/agents.test.ts +176 -0
  109. package/e2e/cli/auto-update.test.ts +741 -0
  110. package/e2e/cli/basic.test.ts +44 -0
  111. package/{src/cli/e2e → e2e/cli}/export-lite.test.ts +16 -12
  112. package/e2e/cli/init-gitignore.test.ts +86 -0
  113. package/e2e/cli/init.test.ts +76 -0
  114. package/e2e/cli/messages.test.ts +363 -0
  115. package/e2e/cli/serve.test.ts +76 -0
  116. package/{src/cli/e2e → e2e/cli}/skills.test.ts +11 -10
  117. package/{src/cli/e2e → e2e/daemon}/daemon.test.ts +57 -195
  118. package/e2e/jobs/agent-jobs.test.ts +216 -0
  119. package/e2e/jobs/cron.test.ts +64 -0
  120. package/e2e/jobs/restart.test.ts +108 -0
  121. package/e2e/policies/approval-session.test.ts +69 -0
  122. package/e2e/policies/auto-create-policies-file.test.ts +35 -0
  123. package/e2e/policies/builtin-manage-policies.test.ts +184 -0
  124. package/e2e/policies/builtin-run-host.test.ts +180 -0
  125. package/e2e/policies/environment-policies.test.ts +177 -0
  126. package/e2e/policies/manage-policies.test.ts +566 -0
  127. package/e2e/policies/output-size.test.ts +98 -0
  128. package/e2e/policies/policies-context-cwd.test.ts +160 -0
  129. package/e2e/policies/relative-script-path.test.ts +60 -0
  130. package/e2e/policies/requests-show.test.ts +135 -0
  131. package/e2e/policies/requests.test.ts +208 -0
  132. package/e2e/policies/slash-policies.test.ts +308 -0
  133. package/e2e/policies/startup-cleanup.test.ts +48 -0
  134. package/e2e/routers/session-timeout.test.ts +106 -0
  135. package/e2e/routers/slash-model.test.ts +152 -0
  136. package/e2e/routers/slash-new.test.ts +50 -0
  137. package/e2e/routers/slash-restart-adapter.test.ts +96 -0
  138. package/e2e/routers/slash-restart.test.ts +114 -0
  139. package/e2e/routers/slash-shutdown.test.ts +55 -0
  140. package/e2e/routers/slash-stop.test.ts +232 -0
  141. package/e2e/routers/slash-upgrade.test.ts +88 -0
  142. package/{src/cli/e2e → e2e/sandbox}/environments.test.ts +14 -13
  143. package/eslint.config.js +6 -0
  144. package/napkin.md +1 -1
  145. package/package.json +8 -3
  146. package/src/adapter-discord/commands.test.ts +42 -0
  147. package/src/adapter-discord/commands.ts +33 -0
  148. package/src/adapter-discord/config.ts +12 -0
  149. package/src/adapter-discord/forwarder.test.ts +499 -21
  150. package/src/adapter-discord/forwarder.ts +343 -124
  151. package/src/adapter-discord/inbound-cache.test.ts +47 -0
  152. package/src/adapter-discord/inbound-cache.ts +37 -0
  153. package/src/adapter-discord/index.test.ts +67 -2
  154. package/src/adapter-discord/index.ts +84 -216
  155. package/src/adapter-discord/interactions.test.ts +54 -3
  156. package/src/adapter-discord/interactions.ts +97 -53
  157. package/src/adapter-discord/processMessage.ts +239 -0
  158. package/src/adapter-discord/state.ts +1 -0
  159. package/src/adapter-google-chat/auth.test.ts +9 -5
  160. package/src/adapter-google-chat/auth.ts +29 -23
  161. package/src/adapter-google-chat/cards.ts +7 -2
  162. package/src/adapter-google-chat/client.test.ts +37 -2
  163. package/src/adapter-google-chat/client.ts +138 -38
  164. package/src/adapter-google-chat/config.ts +19 -0
  165. package/src/adapter-google-chat/forwarder.test.ts +81 -56
  166. package/src/adapter-google-chat/forwarder.ts +394 -185
  167. package/src/adapter-google-chat/inbound-cache.test.ts +61 -0
  168. package/src/adapter-google-chat/inbound-cache.ts +36 -0
  169. package/src/adapter-google-chat/state.test.ts +1 -0
  170. package/src/adapter-google-chat/state.ts +9 -1
  171. package/src/adapter-google-chat/subscriptions.ts +8 -6
  172. package/src/cli/builtin-policies.ts +44 -0
  173. package/src/cli/commands/agents.ts +59 -5
  174. package/src/cli/commands/down.ts +54 -2
  175. package/src/cli/commands/environments.ts +8 -2
  176. package/src/cli/commands/init.ts +31 -0
  177. package/src/cli/commands/logs.ts +116 -0
  178. package/src/cli/commands/policies.ts +6 -4
  179. package/src/cli/commands/serve.test.ts +67 -0
  180. package/src/cli/commands/serve.ts +284 -0
  181. package/src/cli/commands/up.ts +122 -2
  182. package/src/cli/commands/web-api/agents.ts +3 -2
  183. package/src/cli/index.ts +4 -0
  184. package/src/cli/install-detection.test.ts +72 -0
  185. package/src/cli/install-detection.ts +48 -0
  186. package/src/cli/lite.ts +54 -22
  187. package/src/cli/manage-policies-utils.ts +104 -0
  188. package/src/cli/manage-policies.ts +291 -0
  189. package/src/cli/run-host.ts +45 -0
  190. package/src/cli/supervisor-actions.ts +267 -0
  191. package/src/cli/supervisor-control.test.ts +129 -0
  192. package/src/cli/supervisor-control.ts +155 -0
  193. package/src/cli/supervisor-pid.ts +68 -0
  194. package/src/cli/supervisor.ts +277 -0
  195. package/src/daemon/agent/agent-context.ts +11 -11
  196. package/src/daemon/agent/agent-session.ts +8 -1
  197. package/src/daemon/agent/chat-logger.test.ts +78 -9
  198. package/src/daemon/agent/chat-logger.ts +25 -5
  199. package/src/daemon/agent/turn-registry.test.ts +89 -0
  200. package/src/daemon/agent/turn-registry.ts +94 -0
  201. package/src/daemon/agent/types.ts +2 -0
  202. package/src/daemon/api/agent-policy-endpoints.ts +263 -0
  203. package/src/daemon/api/agent-router.ts +47 -126
  204. package/src/daemon/api/index.test.ts +1 -0
  205. package/src/daemon/api/policy-request.test.ts +7 -5
  206. package/src/daemon/api/router-utils.ts +6 -5
  207. package/src/daemon/api/subagent-router.ts +110 -74
  208. package/src/daemon/api/subagent-utils.test.ts +60 -0
  209. package/src/daemon/api/subagent-utils.ts +113 -87
  210. package/src/daemon/api/user-router.ts +34 -8
  211. package/src/daemon/auth.ts +1 -0
  212. package/src/daemon/cron.test.ts +62 -4
  213. package/src/daemon/cron.ts +42 -16
  214. package/src/daemon/events.ts +65 -0
  215. package/src/daemon/index.ts +24 -1
  216. package/src/daemon/message-interruption.test.ts +1 -0
  217. package/src/daemon/message-jobs.test.ts +1 -0
  218. package/src/daemon/message.ts +78 -14
  219. package/src/daemon/observation.test.ts +26 -18
  220. package/src/daemon/pending-replies.test.ts +112 -0
  221. package/src/daemon/pending-replies.ts +162 -0
  222. package/src/daemon/policy-request-service.ts +3 -1
  223. package/src/daemon/policy-utils.test.ts +66 -1
  224. package/src/daemon/policy-utils.ts +126 -1
  225. package/src/daemon/request-store.ts +31 -0
  226. package/src/daemon/routers/session-timeout.ts +4 -0
  227. package/src/daemon/routers/slash-model.test.ts +344 -0
  228. package/src/daemon/routers/slash-model.ts +207 -0
  229. package/src/daemon/routers/slash-policies.test.ts +38 -32
  230. package/src/daemon/routers/slash-policies.ts +84 -33
  231. package/src/daemon/routers/slash-restart.test.ts +69 -0
  232. package/src/daemon/routers/slash-restart.ts +36 -0
  233. package/src/daemon/routers/slash-shutdown.test.ts +50 -0
  234. package/src/daemon/routers/slash-shutdown.ts +28 -0
  235. package/src/daemon/routers/slash-upgrade.test.ts +116 -0
  236. package/src/daemon/routers/slash-upgrade.ts +76 -0
  237. package/src/daemon/routers/types.ts +7 -0
  238. package/src/daemon/routers.ts +16 -0
  239. package/src/shared/adapters/blockquote.test.ts +28 -0
  240. package/src/shared/adapters/blockquote.ts +20 -0
  241. package/src/shared/adapters/filtering.test.ts +224 -10
  242. package/src/shared/adapters/filtering.ts +95 -7
  243. package/src/shared/adapters/inbound-cache.test.ts +48 -0
  244. package/src/shared/adapters/inbound-cache.ts +54 -0
  245. package/src/shared/adapters/turn-log-buffer.ts +266 -0
  246. package/src/shared/adapters/turn-log.test.ts +389 -0
  247. package/src/shared/adapters/turn-log.ts +357 -0
  248. package/src/shared/agent-utils.ts +12 -5
  249. package/src/shared/chats.test.ts +4 -0
  250. package/src/shared/chats.ts +9 -0
  251. package/src/shared/config.ts +16 -1
  252. package/src/shared/lite.ts +76 -2
  253. package/src/shared/policies.ts +26 -0
  254. package/src/shared/template-manifest.ts +267 -0
  255. package/src/shared/utils/shell.ts +61 -0
  256. package/src/shared/version.ts +34 -0
  257. package/src/shared/workspace.test.ts +217 -0
  258. package/src/shared/workspace.ts +626 -48
  259. package/templates/environments/cladding/allowlist-domain.mjs +125 -0
  260. package/templates/environments/cladding/env.json +21 -1
  261. package/templates/environments/cladding/run-with-network.mjs +54 -0
  262. package/templates/environments/macos-proxy/allowlist-domain.mjs +95 -0
  263. package/templates/environments/macos-proxy/env.json +8 -1
  264. package/templates/environments/macos-proxy/proxy.mjs +42 -13
  265. package/templates/gemini/template.json +5 -0
  266. package/templates/gemini-claw/template.json +13 -0
  267. package/templates/skills/clawmini-requests/SKILL.md +69 -10
  268. package/templates/skills/run-host/SKILL.md +51 -0
  269. package/templates/skills/skill-creator/SKILL.md +4 -3
  270. package/templates/skills/skill-creator/scripts/validate.sh +52 -0
  271. package/tsdown.config.ts +10 -1
  272. package/vitest.config.ts +2 -2
  273. package/web/.svelte-kit/ambient.d.ts +292 -176
  274. package/web/.svelte-kit/generated/server/internal.js +1 -1
  275. package/web/.svelte-kit/output/client/.vite/manifest.json +127 -137
  276. package/web/.svelte-kit/output/client/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
  277. package/web/.svelte-kit/output/client/_app/immutable/chunks/BhRSsUCh.js +2 -0
  278. package/web/.svelte-kit/output/client/_app/immutable/chunks/BiLeM2i1.js +1 -0
  279. package/{dist/web/_app/immutable/chunks/CME08kGM.js → web/.svelte-kit/output/client/_app/immutable/chunks/BmBj85Ll.js} +1 -1
  280. package/web/.svelte-kit/output/client/_app/immutable/chunks/BrERcKAH.js +1 -0
  281. package/web/.svelte-kit/output/client/_app/immutable/chunks/Bv9252RM.js +1 -0
  282. package/web/.svelte-kit/output/client/_app/immutable/chunks/CIXNBPKi.js +1 -0
  283. package/web/.svelte-kit/output/client/_app/immutable/chunks/DISKL3GN.js +2 -0
  284. package/web/.svelte-kit/output/client/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
  285. package/web/.svelte-kit/output/client/_app/immutable/chunks/DnQ3vS13.js +1 -0
  286. package/web/.svelte-kit/output/client/_app/immutable/chunks/KsloHTKS.js +1 -0
  287. package/{dist/web/_app/immutable/chunks/Ck-be5J2.js → web/.svelte-kit/output/client/_app/immutable/chunks/RsHsUj-8.js} +2 -2
  288. package/web/.svelte-kit/output/client/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
  289. package/web/.svelte-kit/output/client/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
  290. package/web/.svelte-kit/output/client/_app/immutable/entry/start.Di0-Jhte.js +1 -0
  291. package/web/.svelte-kit/output/client/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
  292. package/web/.svelte-kit/output/client/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
  293. package/web/.svelte-kit/output/client/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
  294. package/{dist/web/_app/immutable/nodes/3.Dr0ot9sV.js → web/.svelte-kit/output/client/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
  295. package/web/.svelte-kit/output/client/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
  296. package/web/.svelte-kit/output/client/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
  297. package/web/.svelte-kit/output/client/_app/version.json +1 -1
  298. package/web/.svelte-kit/output/server/.vite/manifest.json +12 -10
  299. package/web/.svelte-kit/output/server/chunks/Icon.js +1 -1
  300. package/web/.svelte-kit/output/server/chunks/client.js +1 -1
  301. package/web/.svelte-kit/output/server/chunks/exports.js +1 -1
  302. package/web/.svelte-kit/output/server/chunks/index-server.js +2 -1
  303. package/web/.svelte-kit/output/server/chunks/internal.js +1 -1
  304. package/web/.svelte-kit/output/server/chunks/render-context.js +77 -0
  305. package/web/.svelte-kit/output/server/chunks/root.js +739 -788
  306. package/web/.svelte-kit/output/server/chunks/shared.js +234 -21
  307. package/web/.svelte-kit/output/server/index.js +126 -90
  308. package/web/.svelte-kit/output/server/manifest-full.js +1 -1
  309. package/web/.svelte-kit/output/server/manifest.js +1 -1
  310. package/web/.svelte-kit/output/server/nodes/0.js +1 -1
  311. package/web/.svelte-kit/output/server/nodes/1.js +1 -1
  312. package/web/.svelte-kit/output/server/nodes/2.js +1 -1
  313. package/web/.svelte-kit/output/server/nodes/3.js +1 -1
  314. package/web/.svelte-kit/output/server/nodes/4.js +1 -1
  315. package/web/.svelte-kit/output/server/nodes/5.js +1 -1
  316. package/web/.svelte-kit/output/server/remote-entry.js +245 -81
  317. package/web/.svelte-kit/tsconfig.json +4 -1
  318. package/dist/cli/propose-policy.mjs.map +0 -1
  319. package/dist/lite-CBxOT1y5.mjs +0 -241
  320. package/dist/lite-CBxOT1y5.mjs.map +0 -1
  321. package/dist/routing-D8rTxtaV.mjs +0 -245
  322. package/dist/routing-D8rTxtaV.mjs.map +0 -1
  323. package/dist/web/_app/immutable/chunks/B6YN0Nuq.js +0 -1
  324. package/dist/web/_app/immutable/chunks/BmRlVmv6.js +0 -1
  325. package/dist/web/_app/immutable/chunks/CK9JZLaG.js +0 -2
  326. package/dist/web/_app/immutable/chunks/Ck3rYNON.js +0 -1
  327. package/dist/web/_app/immutable/chunks/DMtIqaiV.js +0 -2
  328. package/dist/web/_app/immutable/chunks/DhD271EB.js +0 -1
  329. package/dist/web/_app/immutable/chunks/DpuLqk8d.js +0 -1
  330. package/dist/web/_app/immutable/chunks/DsIToJCP.js +0 -1
  331. package/dist/web/_app/immutable/chunks/bBmtyQMj.js +0 -1
  332. package/dist/web/_app/immutable/entry/app.CJmSwntr.js +0 -2
  333. package/dist/web/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
  334. package/dist/web/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
  335. package/dist/web/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
  336. package/dist/workspace-BJmJBfKi.mjs +0 -456
  337. package/dist/workspace-BJmJBfKi.mjs.map +0 -1
  338. package/src/cli/e2e/agents.test.ts +0 -140
  339. package/src/cli/e2e/basic.test.ts +0 -43
  340. package/src/cli/e2e/cron.test.ts +0 -132
  341. package/src/cli/e2e/export-lite-func.test.ts +0 -206
  342. package/src/cli/e2e/fallbacks.test.ts +0 -175
  343. package/src/cli/e2e/init.test.ts +0 -77
  344. package/src/cli/e2e/messages.test.ts +0 -332
  345. package/src/cli/e2e/propose-policy.test.ts +0 -203
  346. package/src/cli/e2e/requests.test.ts +0 -180
  347. package/src/cli/e2e/session-timeout.test.ts +0 -192
  348. package/src/cli/e2e/slash-new.test.ts +0 -93
  349. package/src/cli/e2e/subagents.test.ts +0 -106
  350. package/src/cli/e2e/utils.ts +0 -66
  351. package/src/cli/propose-policy.ts +0 -91
  352. package/web/.svelte-kit/output/client/_app/immutable/chunks/B6YN0Nuq.js +0 -1
  353. package/web/.svelte-kit/output/client/_app/immutable/chunks/BmRlVmv6.js +0 -1
  354. package/web/.svelte-kit/output/client/_app/immutable/chunks/CK9JZLaG.js +0 -2
  355. package/web/.svelte-kit/output/client/_app/immutable/chunks/Ck3rYNON.js +0 -1
  356. package/web/.svelte-kit/output/client/_app/immutable/chunks/DMtIqaiV.js +0 -2
  357. package/web/.svelte-kit/output/client/_app/immutable/chunks/DhD271EB.js +0 -1
  358. package/web/.svelte-kit/output/client/_app/immutable/chunks/DpuLqk8d.js +0 -1
  359. package/web/.svelte-kit/output/client/_app/immutable/chunks/DsIToJCP.js +0 -1
  360. package/web/.svelte-kit/output/client/_app/immutable/chunks/bBmtyQMj.js +0 -1
  361. package/web/.svelte-kit/output/client/_app/immutable/entry/app.CJmSwntr.js +0 -2
  362. package/web/.svelte-kit/output/client/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
  363. package/web/.svelte-kit/output/client/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
  364. package/web/.svelte-kit/output/client/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
  365. package/web/.svelte-kit/output/server/chunks/false.js +0 -4
  366. /package/dist/cli/{propose-policy.d.mts → manage-policies.d.mts} +0 -0
  367. /package/{src/cli/e2e → e2e/_helpers}/global-setup.ts +0 -0
@@ -1,6 +1,52 @@
1
- import { B as BROWSER } from "./false.js";
1
+ import { a as lifecycle_outside_component, B as BROWSER, d as dynamic_element_invalid_tag, i as invalid_csp, b as await_invalid, g as get_render_context } from "./render-context.js";
2
2
  import { clsx as clsx$1 } from "clsx";
3
3
  import * as devalue from "devalue";
4
+ var ssr_context = null;
5
+ function set_ssr_context(v) {
6
+ ssr_context = v;
7
+ }
8
+ function getContext(key) {
9
+ const context_map = get_or_init_context_map();
10
+ const result = (
11
+ /** @type {T} */
12
+ context_map.get(key)
13
+ );
14
+ return result;
15
+ }
16
+ function setContext(key, context) {
17
+ get_or_init_context_map().set(key, context);
18
+ return context;
19
+ }
20
+ function hasContext(key) {
21
+ return get_or_init_context_map().has(key);
22
+ }
23
+ function getAllContexts() {
24
+ return get_or_init_context_map();
25
+ }
26
+ function get_or_init_context_map(name) {
27
+ if (ssr_context === null) {
28
+ lifecycle_outside_component();
29
+ }
30
+ return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0);
31
+ }
32
+ function push$1(fn) {
33
+ ssr_context = { p: ssr_context, c: null, r: null };
34
+ }
35
+ function pop$1() {
36
+ ssr_context = /** @type {SSRContext} */
37
+ ssr_context.p;
38
+ }
39
+ function get_parent_context(ssr_context2) {
40
+ let parent = ssr_context2.p;
41
+ while (parent !== null) {
42
+ const context_map = parent.c;
43
+ if (context_map !== null) {
44
+ return context_map;
45
+ }
46
+ parent = parent.p;
47
+ }
48
+ return null;
49
+ }
4
50
  var is_array = Array.isArray;
5
51
  var index_of = Array.prototype.indexOf;
6
52
  var includes = Array.prototype.includes;
@@ -40,15 +86,6 @@ function fallback(value, fallback2, lazy = false) {
40
86
  fallback2
41
87
  ) : value;
42
88
  }
43
- function equals(value) {
44
- return value === this.v;
45
- }
46
- function safe_not_equal(a, b) {
47
- return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
48
- }
49
- function safe_equals(value) {
50
- return !safe_not_equal(value, this.v);
51
- }
52
89
  const DERIVED = 1 << 1;
53
90
  const EFFECT = 1 << 2;
54
91
  const RENDER_EFFECT = 1 << 3;
@@ -81,10 +118,186 @@ const STALE_REACTION = new class StaleReactionError extends Error {
81
118
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
82
119
  }();
83
120
  const COMMENT_NODE = 8;
84
- function lifecycle_outside_component(name) {
121
+ let controller = null;
122
+ function abort() {
123
+ controller?.abort(STALE_REACTION);
124
+ controller = null;
125
+ }
126
+ let tracing_mode_flag = false;
127
+ const HYDRATION_START = "[";
128
+ const HYDRATION_START_ELSE = "[!";
129
+ const HYDRATION_START_FAILED = "[?";
130
+ const HYDRATION_END = "]";
131
+ const HYDRATION_ERROR = {};
132
+ const ELEMENT_IS_NAMESPACED = 1;
133
+ const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
134
+ const ELEMENT_IS_INPUT = 1 << 2;
135
+ const UNINITIALIZED = /* @__PURE__ */ Symbol();
136
+ const ATTACHMENT_KEY = "@attach";
137
+ function unresolved_hydratable(key, stack) {
85
138
  {
86
- throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
139
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
140
+ }
141
+ }
142
+ const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
143
+ const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
144
+ const EMPTY_COMMENT = `<!---->`;
145
+ const ATTR_REGEX = /[&"<]/g;
146
+ const CONTENT_REGEX = /[&<]/g;
147
+ function escape_html(value, is_attr) {
148
+ const str = String(value ?? "");
149
+ const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
150
+ pattern.lastIndex = 0;
151
+ let escaped = "";
152
+ let last = 0;
153
+ while (pattern.test(str)) {
154
+ const i = pattern.lastIndex - 1;
155
+ const ch = str[i];
156
+ escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === '"' ? "&quot;" : "&lt;");
157
+ last = i + 1;
158
+ }
159
+ return escaped + str.substring(last);
160
+ }
161
+ const replacements = {
162
+ translate: /* @__PURE__ */ new Map([
163
+ [true, "yes"],
164
+ [false, "no"]
165
+ ])
166
+ };
167
+ function attr(name, value, is_boolean = false) {
168
+ if (name === "hidden" && value !== "until-found") {
169
+ is_boolean = true;
170
+ }
171
+ if (value == null || !value && is_boolean) return "";
172
+ const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
173
+ const assignment = is_boolean ? `=""` : `="${escape_html(normalized, true)}"`;
174
+ return ` ${name}${assignment}`;
175
+ }
176
+ function clsx(value) {
177
+ if (typeof value === "object") {
178
+ return clsx$1(value);
179
+ } else {
180
+ return value ?? "";
181
+ }
182
+ }
183
+ const whitespace = [..." \n\r\f \v\uFEFF"];
184
+ function to_class(value, hash, directives) {
185
+ var classname = value == null ? "" : "" + value;
186
+ if (hash) {
187
+ classname = classname ? classname + " " + hash : hash;
188
+ }
189
+ if (directives) {
190
+ for (var key of Object.keys(directives)) {
191
+ if (directives[key]) {
192
+ classname = classname ? classname + " " + key : key;
193
+ } else if (classname.length) {
194
+ var len = key.length;
195
+ var a = 0;
196
+ while ((a = classname.indexOf(key, a)) >= 0) {
197
+ var b = a + len;
198
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
199
+ classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
200
+ } else {
201
+ a = b;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ return classname === "" ? null : classname;
208
+ }
209
+ function append_styles(styles, important = false) {
210
+ var separator = important ? " !important;" : ";";
211
+ var css = "";
212
+ for (var key of Object.keys(styles)) {
213
+ var value = styles[key];
214
+ if (value != null && value !== "") {
215
+ css += " " + key + ": " + value + separator;
216
+ }
217
+ }
218
+ return css;
219
+ }
220
+ function to_css_name(name) {
221
+ if (name[0] !== "-" || name[1] !== "-") {
222
+ return name.toLowerCase();
223
+ }
224
+ return name;
225
+ }
226
+ function to_style(value, styles) {
227
+ if (styles) {
228
+ var new_style = "";
229
+ var normal_styles;
230
+ var important_styles;
231
+ if (Array.isArray(styles)) {
232
+ normal_styles = styles[0];
233
+ important_styles = styles[1];
234
+ } else {
235
+ normal_styles = styles;
236
+ }
237
+ if (value) {
238
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
239
+ var in_str = false;
240
+ var in_apo = 0;
241
+ var in_comment = false;
242
+ var reserved_names = [];
243
+ if (normal_styles) {
244
+ reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
245
+ }
246
+ if (important_styles) {
247
+ reserved_names.push(...Object.keys(important_styles).map(to_css_name));
248
+ }
249
+ var start_index = 0;
250
+ var name_index = -1;
251
+ const len = value.length;
252
+ for (var i = 0; i < len; i++) {
253
+ var c = value[i];
254
+ if (in_comment) {
255
+ if (c === "/" && value[i - 1] === "*") {
256
+ in_comment = false;
257
+ }
258
+ } else if (in_str) {
259
+ if (in_str === c) {
260
+ in_str = false;
261
+ }
262
+ } else if (c === "/" && value[i + 1] === "*") {
263
+ in_comment = true;
264
+ } else if (c === '"' || c === "'") {
265
+ in_str = c;
266
+ } else if (c === "(") {
267
+ in_apo++;
268
+ } else if (c === ")") {
269
+ in_apo--;
270
+ }
271
+ if (!in_comment && in_str === false && in_apo === 0) {
272
+ if (c === ":" && name_index === -1) {
273
+ name_index = i;
274
+ } else if (c === ";" || i === len - 1) {
275
+ if (name_index !== -1) {
276
+ var name = to_css_name(value.substring(start_index, name_index).trim());
277
+ if (!reserved_names.includes(name)) {
278
+ if (c !== ";") {
279
+ i++;
280
+ }
281
+ var property = value.substring(start_index, i).trim();
282
+ new_style += " " + property + ";";
283
+ }
284
+ }
285
+ start_index = i + 1;
286
+ name_index = -1;
287
+ }
288
+ }
289
+ }
290
+ }
291
+ if (normal_styles) {
292
+ new_style += append_styles(normal_styles);
293
+ }
294
+ if (important_styles) {
295
+ new_style += append_styles(important_styles, true);
296
+ }
297
+ new_style = new_style.trim();
298
+ return new_style === "" ? null : new_style;
87
299
  }
300
+ return value == null ? null : String(value);
88
301
  }
89
302
  function effect_update_depth_exceeded() {
90
303
  {
@@ -116,16 +329,6 @@ function svelte_boundary_reset_onerror() {
116
329
  throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
117
330
  }
118
331
  }
119
- const HYDRATION_START = "[";
120
- const HYDRATION_START_ELSE = "[!";
121
- const HYDRATION_START_FAILED = "[?";
122
- const HYDRATION_END = "]";
123
- const HYDRATION_ERROR = {};
124
- const ELEMENT_IS_NAMESPACED = 1;
125
- const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
126
- const ELEMENT_IS_INPUT = 1 << 2;
127
- const UNINITIALIZED = /* @__PURE__ */ Symbol();
128
- const ATTACHMENT_KEY = "@attach";
129
332
  function hydration_mismatch(location) {
130
333
  {
131
334
  console.warn(`https://svelte.dev/e/hydration_mismatch`);
@@ -187,12 +390,20 @@ function skip_nodes(remove = true) {
187
390
  node = next2;
188
391
  }
189
392
  }
190
- let tracing_mode_flag = false;
393
+ function equals(value) {
394
+ return value === this.v;
395
+ }
396
+ function safe_not_equal(a, b) {
397
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
398
+ }
399
+ function safe_equals(value) {
400
+ return !safe_not_equal(value, this.v);
401
+ }
191
402
  let component_context = null;
192
403
  function set_component_context(context) {
193
404
  component_context = context;
194
405
  }
195
- function push$1(props, runes = false, fn) {
406
+ function push(props, runes = false, fn) {
196
407
  component_context = {
197
408
  p: component_context,
198
409
  i: false,
@@ -207,7 +418,7 @@ function push$1(props, runes = false, fn) {
207
418
  l: null
208
419
  };
209
420
  }
210
- function pop$1(component) {
421
+ function pop(component) {
211
422
  var context = (
212
423
  /** @type {ComponentContext} */
213
424
  component_context
@@ -2403,129 +2614,6 @@ function untrack(fn) {
2403
2614
  untracking = previous_untracking;
2404
2615
  }
2405
2616
  }
2406
- const event_symbol = /* @__PURE__ */ Symbol("events");
2407
- const all_registered_events = /* @__PURE__ */ new Set();
2408
- const root_event_handles = /* @__PURE__ */ new Set();
2409
- function create_event(event_name, dom, handler, options = {}) {
2410
- function target_handler(event) {
2411
- if (!options.capture) {
2412
- handle_event_propagation.call(dom, event);
2413
- }
2414
- if (!event.cancelBubble) {
2415
- return without_reactive_context(() => {
2416
- return handler?.call(this, event);
2417
- });
2418
- }
2419
- }
2420
- if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") {
2421
- queue_micro_task(() => {
2422
- dom.addEventListener(event_name, target_handler, options);
2423
- });
2424
- } else {
2425
- dom.addEventListener(event_name, target_handler, options);
2426
- }
2427
- return target_handler;
2428
- }
2429
- function on(element2, type, handler, options = {}) {
2430
- var target_handler = create_event(type, element2, handler, options);
2431
- return () => {
2432
- element2.removeEventListener(type, target_handler, options);
2433
- };
2434
- }
2435
- let last_propagated_event = null;
2436
- function handle_event_propagation(event) {
2437
- var handler_element = this;
2438
- var owner_document = (
2439
- /** @type {Node} */
2440
- handler_element.ownerDocument
2441
- );
2442
- var event_name = event.type;
2443
- var path = event.composedPath?.() || [];
2444
- var current_target = (
2445
- /** @type {null | Element} */
2446
- path[0] || event.target
2447
- );
2448
- last_propagated_event = event;
2449
- var path_idx = 0;
2450
- var handled_at = last_propagated_event === event && event[event_symbol];
2451
- if (handled_at) {
2452
- var at_idx = path.indexOf(handled_at);
2453
- if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
2454
- window)) {
2455
- event[event_symbol] = handler_element;
2456
- return;
2457
- }
2458
- var handler_idx = path.indexOf(handler_element);
2459
- if (handler_idx === -1) {
2460
- return;
2461
- }
2462
- if (at_idx <= handler_idx) {
2463
- path_idx = at_idx;
2464
- }
2465
- }
2466
- current_target = /** @type {Element} */
2467
- path[path_idx] || event.target;
2468
- if (current_target === handler_element) return;
2469
- define_property(event, "currentTarget", {
2470
- configurable: true,
2471
- get() {
2472
- return current_target || owner_document;
2473
- }
2474
- });
2475
- var previous_reaction = active_reaction;
2476
- var previous_effect = active_effect;
2477
- set_active_reaction(null);
2478
- set_active_effect(null);
2479
- try {
2480
- var throw_error;
2481
- var other_errors = [];
2482
- while (current_target !== null) {
2483
- var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
2484
- current_target.host || null;
2485
- try {
2486
- var delegated = current_target[event_symbol]?.[event_name];
2487
- if (delegated != null && (!/** @type {any} */
2488
- current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
2489
- // -> the target could not have been disabled because it emits the event in the first place
2490
- event.target === current_target)) {
2491
- delegated.call(current_target, event);
2492
- }
2493
- } catch (error) {
2494
- if (throw_error) {
2495
- other_errors.push(error);
2496
- } else {
2497
- throw_error = error;
2498
- }
2499
- }
2500
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
2501
- break;
2502
- }
2503
- current_target = parent_element;
2504
- }
2505
- if (throw_error) {
2506
- for (let error of other_errors) {
2507
- queueMicrotask(() => {
2508
- throw error;
2509
- });
2510
- }
2511
- throw throw_error;
2512
- }
2513
- } finally {
2514
- event[event_symbol] = handler_element;
2515
- delete event.currentTarget;
2516
- set_active_reaction(previous_reaction);
2517
- set_active_effect(previous_effect);
2518
- }
2519
- }
2520
- function assign_nodes(start, end) {
2521
- var effect = (
2522
- /** @type {Effect} */
2523
- active_effect
2524
- );
2525
- if (effect.nodes === null) {
2526
- effect.nodes = { start, end, a: null, t: null };
2527
- }
2528
- }
2529
2617
  const VOID_ELEMENT_NAMES = [
2530
2618
  "area",
2531
2619
  "base",
@@ -2595,524 +2683,159 @@ function is_raw_text_element(name) {
2595
2683
  );
2596
2684
  }
2597
2685
  const REGEX_VALID_TAG_NAME = /^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]+)*$/u;
2598
- function mount(component, options) {
2599
- return _mount(component, options);
2600
- }
2601
- function hydrate(component, options) {
2602
- init_operations();
2603
- options.intro = options.intro ?? false;
2604
- const target = options.target;
2605
- const was_hydrating = hydrating;
2606
- const previous_hydrate_node = hydrate_node;
2607
- try {
2608
- var anchor = /* @__PURE__ */ get_first_child(target);
2609
- while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
2610
- anchor.data !== HYDRATION_START)) {
2611
- anchor = /* @__PURE__ */ get_next_sibling(anchor);
2612
- }
2613
- if (!anchor) {
2614
- throw HYDRATION_ERROR;
2686
+ 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;
2687
+ function element(renderer, tag, attributes_fn = noop, children_fn = noop) {
2688
+ renderer.push("<!---->");
2689
+ if (tag) {
2690
+ if (!REGEX_VALID_TAG_NAME.test(tag)) {
2691
+ dynamic_element_invalid_tag(tag);
2615
2692
  }
2616
- set_hydrating(true);
2617
- set_hydrate_node(
2618
- /** @type {Comment} */
2619
- anchor
2620
- );
2621
- const instance = _mount(component, { ...options, anchor });
2622
- set_hydrating(false);
2623
- return (
2624
- /** @type {Exports} */
2625
- instance
2626
- );
2627
- } catch (error) {
2628
- if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
2629
- throw error;
2693
+ renderer.push(`<${tag}`);
2694
+ attributes_fn();
2695
+ renderer.push(`>`);
2696
+ if (!is_void(tag)) {
2697
+ children_fn();
2698
+ if (!is_raw_text_element(tag)) {
2699
+ renderer.push(EMPTY_COMMENT);
2700
+ }
2701
+ renderer.push(`</${tag}>`);
2630
2702
  }
2631
- if (error !== HYDRATION_ERROR) {
2632
- console.warn("Failed to hydrate: ", error);
2703
+ }
2704
+ renderer.push("<!---->");
2705
+ }
2706
+ function render(component, options = {}) {
2707
+ if (options.csp?.hash && options.csp.nonce) {
2708
+ invalid_csp();
2709
+ }
2710
+ return Renderer.render(
2711
+ /** @type {Component<Props>} */
2712
+ component,
2713
+ options
2714
+ );
2715
+ }
2716
+ function attributes(attrs, css_hash, classes, styles, flags2 = 0) {
2717
+ if (styles) {
2718
+ attrs.style = to_style(attrs.style, styles);
2719
+ }
2720
+ if (attrs.class) {
2721
+ attrs.class = clsx(attrs.class);
2722
+ }
2723
+ if (css_hash || classes) {
2724
+ attrs.class = to_class(attrs.class, css_hash, classes);
2725
+ }
2726
+ let attr_str = "";
2727
+ let name;
2728
+ const is_html = (flags2 & ELEMENT_IS_NAMESPACED) === 0;
2729
+ const lowercase = (flags2 & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
2730
+ const is_input = (flags2 & ELEMENT_IS_INPUT) !== 0;
2731
+ for (name of Object.keys(attrs)) {
2732
+ if (typeof attrs[name] === "function") continue;
2733
+ if (name[0] === "$" && name[1] === "$") continue;
2734
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
2735
+ var value = attrs[name];
2736
+ var lower = name.toLowerCase();
2737
+ if (lowercase) name = lower;
2738
+ if (lower.length > 2 && lower.startsWith("on")) continue;
2739
+ if (is_input) {
2740
+ if (name === "defaultvalue" || name === "defaultchecked") {
2741
+ name = name === "defaultvalue" ? "value" : "checked";
2742
+ if (attrs[name]) continue;
2743
+ }
2633
2744
  }
2634
- if (options.recover === false) {
2635
- hydration_failed();
2745
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
2746
+ }
2747
+ return attr_str;
2748
+ }
2749
+ function spread_props(props) {
2750
+ const merged_props = {};
2751
+ let key;
2752
+ for (let i = 0; i < props.length; i++) {
2753
+ const obj = props[i];
2754
+ if (obj == null) continue;
2755
+ for (key of Object.keys(obj)) {
2756
+ const desc = Object.getOwnPropertyDescriptor(obj, key);
2757
+ if (desc) {
2758
+ Object.defineProperty(merged_props, key, desc);
2759
+ } else {
2760
+ merged_props[key] = obj[key];
2761
+ }
2636
2762
  }
2637
- init_operations();
2638
- clear_text_content(target);
2639
- set_hydrating(false);
2640
- return mount(component, options);
2641
- } finally {
2642
- set_hydrating(was_hydrating);
2643
- set_hydrate_node(previous_hydrate_node);
2644
2763
  }
2764
+ return merged_props;
2645
2765
  }
2646
- const listeners = /* @__PURE__ */ new Map();
2647
- function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
2648
- init_operations();
2649
- var component = void 0;
2650
- var unmount2 = component_root(() => {
2651
- var anchor_node = anchor ?? target.appendChild(create_text());
2652
- boundary(
2653
- /** @type {TemplateNode} */
2654
- anchor_node,
2655
- {
2656
- pending: () => {
2657
- }
2658
- },
2659
- (anchor_node2) => {
2660
- push$1({});
2661
- var ctx = (
2662
- /** @type {ComponentContext} */
2663
- component_context
2664
- );
2665
- if (context) ctx.c = context;
2666
- if (events) {
2667
- props.$$events = events;
2668
- }
2669
- if (hydrating) {
2670
- assign_nodes(
2671
- /** @type {TemplateNode} */
2672
- anchor_node2,
2673
- null
2674
- );
2675
- }
2676
- component = Component(anchor_node2, props) || {};
2677
- if (hydrating) {
2678
- active_effect.nodes.end = hydrate_node;
2679
- if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
2680
- hydrate_node.data !== HYDRATION_END) {
2681
- hydration_mismatch();
2682
- throw HYDRATION_ERROR;
2683
- }
2684
- }
2685
- pop$1();
2686
- },
2687
- transformError
2688
- );
2689
- var registered_events = /* @__PURE__ */ new Set();
2690
- var event_handle = (events2) => {
2691
- for (var i = 0; i < events2.length; i++) {
2692
- var event_name = events2[i];
2693
- if (registered_events.has(event_name)) continue;
2694
- registered_events.add(event_name);
2695
- var passive = is_passive_event(event_name);
2696
- for (const node of [target, document]) {
2697
- var counts = listeners.get(node);
2698
- if (counts === void 0) {
2699
- counts = /* @__PURE__ */ new Map();
2700
- listeners.set(node, counts);
2701
- }
2702
- var count = counts.get(event_name);
2703
- if (count === void 0) {
2704
- node.addEventListener(event_name, handle_event_propagation, { passive });
2705
- counts.set(event_name, 1);
2706
- } else {
2707
- counts.set(event_name, count + 1);
2708
- }
2709
- }
2710
- }
2711
- };
2712
- event_handle(array_from(all_registered_events));
2713
- root_event_handles.add(event_handle);
2714
- return () => {
2715
- for (var event_name of registered_events) {
2716
- for (const node of [target, document]) {
2717
- var counts = (
2718
- /** @type {Map<string, number>} */
2719
- listeners.get(node)
2720
- );
2721
- var count = (
2722
- /** @type {number} */
2723
- counts.get(event_name)
2724
- );
2725
- if (--count == 0) {
2726
- node.removeEventListener(event_name, handle_event_propagation);
2727
- counts.delete(event_name);
2728
- if (counts.size === 0) {
2729
- listeners.delete(node);
2730
- }
2731
- } else {
2732
- counts.set(event_name, count);
2733
- }
2734
- }
2735
- }
2736
- root_event_handles.delete(event_handle);
2737
- if (anchor_node !== anchor) {
2738
- anchor_node.parentNode?.removeChild(anchor_node);
2739
- }
2740
- };
2741
- });
2742
- mounted_components.set(component, unmount2);
2743
- return component;
2744
- }
2745
- let mounted_components = /* @__PURE__ */ new WeakMap();
2746
- function unmount(component, options) {
2747
- const fn = mounted_components.get(component);
2748
- if (fn) {
2749
- mounted_components.delete(component);
2750
- return fn(options);
2751
- }
2752
- return Promise.resolve();
2753
- }
2754
- function asClassComponent$1(component) {
2755
- return class extends Svelte4Component {
2756
- /** @param {any} options */
2757
- constructor(options) {
2758
- super({
2759
- component,
2760
- ...options
2761
- });
2762
- }
2763
- };
2764
- }
2765
- class Svelte4Component {
2766
- /** @type {any} */
2767
- #events;
2768
- /** @type {Record<string, any>} */
2769
- #instance;
2770
- /**
2771
- * @param {ComponentConstructorOptions & {
2772
- * component: any;
2773
- * }} options
2774
- */
2775
- constructor(options) {
2776
- var sources = /* @__PURE__ */ new Map();
2777
- var add_source = (key, value) => {
2778
- var s = /* @__PURE__ */ mutable_source(value, false, false);
2779
- sources.set(key, s);
2780
- return s;
2781
- };
2782
- const props = new Proxy(
2783
- { ...options.props || {}, $$events: {} },
2784
- {
2785
- get(target, prop) {
2786
- return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
2787
- },
2788
- has(target, prop) {
2789
- if (prop === LEGACY_PROPS) return true;
2790
- get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
2791
- return Reflect.has(target, prop);
2792
- },
2793
- set(target, prop, value) {
2794
- set(sources.get(prop) ?? add_source(prop, value), value);
2795
- return Reflect.set(target, prop, value);
2796
- }
2797
- }
2798
- );
2799
- this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
2800
- target: options.target,
2801
- anchor: options.anchor,
2802
- props,
2803
- context: options.context,
2804
- intro: options.intro ?? false,
2805
- recover: options.recover,
2806
- transformError: options.transformError
2807
- });
2808
- if (!options?.props?.$$host || options.sync === false) {
2809
- flushSync();
2810
- }
2811
- this.#events = props.$$events;
2812
- for (const key of Object.keys(this.#instance)) {
2813
- if (key === "$set" || key === "$destroy" || key === "$on") continue;
2814
- define_property(this, key, {
2815
- get() {
2816
- return this.#instance[key];
2817
- },
2818
- /** @param {any} value */
2819
- set(value) {
2820
- this.#instance[key] = value;
2821
- },
2822
- enumerable: true
2823
- });
2824
- }
2825
- this.#instance.$set = /** @param {Record<string, any>} next */
2826
- (next2) => {
2827
- Object.assign(props, next2);
2828
- };
2829
- this.#instance.$destroy = () => {
2830
- unmount(this.#instance);
2831
- };
2832
- }
2833
- /** @param {Record<string, any>} props */
2834
- $set(props) {
2835
- this.#instance.$set(props);
2836
- }
2837
- /**
2838
- * @param {string} event
2839
- * @param {(...args: any[]) => any} callback
2840
- * @returns {any}
2841
- */
2842
- $on(event, callback) {
2843
- this.#events[event] = this.#events[event] || [];
2844
- const cb = (...args) => callback.call(this, ...args);
2845
- this.#events[event].push(cb);
2846
- return () => {
2847
- this.#events[event] = this.#events[event].filter(
2848
- /** @param {any} fn */
2849
- (fn) => fn !== cb
2850
- );
2851
- };
2852
- }
2853
- $destroy() {
2854
- this.#instance.$destroy();
2855
- }
2856
- }
2857
- const ATTR_REGEX = /[&"<]/g;
2858
- const CONTENT_REGEX = /[&<]/g;
2859
- function escape_html(value, is_attr) {
2860
- const str = String(value ?? "");
2861
- const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
2862
- pattern.lastIndex = 0;
2863
- let escaped = "";
2864
- let last = 0;
2865
- while (pattern.test(str)) {
2866
- const i = pattern.lastIndex - 1;
2867
- const ch = str[i];
2868
- escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === '"' ? "&quot;" : "&lt;");
2869
- last = i + 1;
2870
- }
2871
- return escaped + str.substring(last);
2872
- }
2873
- const replacements = {
2874
- translate: /* @__PURE__ */ new Map([
2875
- [true, "yes"],
2876
- [false, "no"]
2877
- ])
2878
- };
2879
- function attr(name, value, is_boolean = false) {
2880
- if (name === "hidden" && value !== "until-found") {
2881
- is_boolean = true;
2882
- }
2883
- if (value == null || !value && is_boolean) return "";
2884
- const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
2885
- const assignment = is_boolean ? `=""` : `="${escape_html(normalized, true)}"`;
2886
- return ` ${name}${assignment}`;
2766
+ function stringify(value) {
2767
+ return typeof value === "string" ? value : value == null ? "" : value + "";
2887
2768
  }
2888
- function clsx(value) {
2889
- if (typeof value === "object") {
2890
- return clsx$1(value);
2891
- } else {
2892
- return value ?? "";
2893
- }
2769
+ function attr_class(value, hash, directives) {
2770
+ var result = to_class(value, hash, directives);
2771
+ return result ? ` class="${escape_html(result, true)}"` : "";
2894
2772
  }
2895
- const whitespace = [..." \n\r\f \v\uFEFF"];
2896
- function to_class(value, hash, directives) {
2897
- var classname = value == null ? "" : "" + value;
2898
- if (hash) {
2899
- classname = classname ? classname + " " + hash : hash;
2773
+ function slot(renderer, $$props, name, slot_props, fallback_fn) {
2774
+ var slot_fn = $$props.$$slots?.[name];
2775
+ if (slot_fn === true) {
2776
+ slot_fn = $$props["children"];
2900
2777
  }
2901
- if (directives) {
2902
- for (var key of Object.keys(directives)) {
2903
- if (directives[key]) {
2904
- classname = classname ? classname + " " + key : key;
2905
- } else if (classname.length) {
2906
- var len = key.length;
2907
- var a = 0;
2908
- while ((a = classname.indexOf(key, a)) >= 0) {
2909
- var b = a + len;
2910
- if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
2911
- classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
2912
- } else {
2913
- a = b;
2914
- }
2915
- }
2916
- }
2917
- }
2778
+ if (slot_fn !== void 0) {
2779
+ slot_fn(renderer, slot_props);
2918
2780
  }
2919
- return classname === "" ? null : classname;
2920
2781
  }
2921
- function append_styles(styles, important = false) {
2922
- var separator = important ? " !important;" : ";";
2923
- var css = "";
2924
- for (var key of Object.keys(styles)) {
2925
- var value = styles[key];
2926
- if (value != null && value !== "") {
2927
- css += " " + key + ": " + value + separator;
2782
+ function rest_props(props, rest) {
2783
+ const rest_props2 = {};
2784
+ let key;
2785
+ for (key of Object.keys(props)) {
2786
+ if (!rest.includes(key)) {
2787
+ rest_props2[key] = props[key];
2928
2788
  }
2929
2789
  }
2930
- return css;
2790
+ return rest_props2;
2931
2791
  }
2932
- function to_css_name(name) {
2933
- if (name[0] !== "-" || name[1] !== "-") {
2934
- return name.toLowerCase();
2935
- }
2936
- return name;
2792
+ function sanitize_props(props) {
2793
+ const { children, $$slots, ...sanitized } = props;
2794
+ return sanitized;
2937
2795
  }
2938
- function to_style(value, styles) {
2939
- if (styles) {
2940
- var new_style = "";
2941
- var normal_styles;
2942
- var important_styles;
2943
- if (Array.isArray(styles)) {
2944
- normal_styles = styles[0];
2945
- important_styles = styles[1];
2946
- } else {
2947
- normal_styles = styles;
2948
- }
2949
- if (value) {
2950
- value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
2951
- var in_str = false;
2952
- var in_apo = 0;
2953
- var in_comment = false;
2954
- var reserved_names = [];
2955
- if (normal_styles) {
2956
- reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
2957
- }
2958
- if (important_styles) {
2959
- reserved_names.push(...Object.keys(important_styles).map(to_css_name));
2960
- }
2961
- var start_index = 0;
2962
- var name_index = -1;
2963
- const len = value.length;
2964
- for (var i = 0; i < len; i++) {
2965
- var c = value[i];
2966
- if (in_comment) {
2967
- if (c === "/" && value[i - 1] === "*") {
2968
- in_comment = false;
2969
- }
2970
- } else if (in_str) {
2971
- if (in_str === c) {
2972
- in_str = false;
2973
- }
2974
- } else if (c === "/" && value[i + 1] === "*") {
2975
- in_comment = true;
2976
- } else if (c === '"' || c === "'") {
2977
- in_str = c;
2978
- } else if (c === "(") {
2979
- in_apo++;
2980
- } else if (c === ")") {
2981
- in_apo--;
2982
- }
2983
- if (!in_comment && in_str === false && in_apo === 0) {
2984
- if (c === ":" && name_index === -1) {
2985
- name_index = i;
2986
- } else if (c === ";" || i === len - 1) {
2987
- if (name_index !== -1) {
2988
- var name = to_css_name(value.substring(start_index, name_index).trim());
2989
- if (!reserved_names.includes(name)) {
2990
- if (c !== ";") {
2991
- i++;
2992
- }
2993
- var property = value.substring(start_index, i).trim();
2994
- new_style += " " + property + ";";
2995
- }
2996
- }
2997
- start_index = i + 1;
2998
- name_index = -1;
2999
- }
3000
- }
3001
- }
3002
- }
3003
- if (normal_styles) {
3004
- new_style += append_styles(normal_styles);
3005
- }
3006
- if (important_styles) {
3007
- new_style += append_styles(important_styles, true);
2796
+ function bind_props(props_parent, props_now) {
2797
+ for (const key of Object.keys(props_now)) {
2798
+ const initial_value = props_parent[key];
2799
+ const value = props_now[key];
2800
+ if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) {
2801
+ props_parent[key] = value;
3008
2802
  }
3009
- new_style = new_style.trim();
3010
- return new_style === "" ? null : new_style;
3011
2803
  }
3012
- return value == null ? null : String(value);
3013
- }
3014
- const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
3015
- const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
3016
- const EMPTY_COMMENT = `<!---->`;
3017
- let controller = null;
3018
- function abort() {
3019
- controller?.abort(STALE_REACTION);
3020
- controller = null;
3021
- }
3022
- function await_invalid() {
3023
- const error = new Error(`await_invalid
3024
- Encountered asynchronous work while rendering synchronously.
3025
- https://svelte.dev/e/await_invalid`);
3026
- error.name = "Svelte error";
3027
- throw error;
3028
- }
3029
- function dynamic_element_invalid_tag(tag) {
3030
- const error = new Error(`dynamic_element_invalid_tag
3031
- \`<svelte:element this="${tag}">\` is not a valid element name — the element will not be rendered
3032
- https://svelte.dev/e/dynamic_element_invalid_tag`);
3033
- error.name = "Svelte error";
3034
- throw error;
3035
- }
3036
- function invalid_csp() {
3037
- const error = new Error(`invalid_csp
3038
- \`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
3039
- https://svelte.dev/e/invalid_csp`);
3040
- error.name = "Svelte error";
3041
- throw error;
3042
- }
3043
- function lifecycle_function_unavailable(name) {
3044
- const error = new Error(`lifecycle_function_unavailable
3045
- \`${name}(...)\` is not available on the server
3046
- https://svelte.dev/e/lifecycle_function_unavailable`);
3047
- error.name = "Svelte error";
3048
- throw error;
3049
- }
3050
- function server_context_required() {
3051
- const error = new Error(`server_context_required
3052
- Could not resolve \`render\` context.
3053
- https://svelte.dev/e/server_context_required`);
3054
- error.name = "Svelte error";
3055
- throw error;
3056
- }
3057
- var ssr_context = null;
3058
- function set_ssr_context(v) {
3059
- ssr_context = v;
3060
- }
3061
- function getContext(key) {
3062
- const context_map = get_or_init_context_map();
3063
- const result = (
3064
- /** @type {T} */
3065
- context_map.get(key)
3066
- );
3067
- return result;
3068
2804
  }
3069
- function setContext(key, context) {
3070
- get_or_init_context_map().set(key, context);
3071
- return context;
3072
- }
3073
- function hasContext(key) {
3074
- return get_or_init_context_map().has(key);
3075
- }
3076
- function getAllContexts() {
3077
- return get_or_init_context_map();
3078
- }
3079
- function get_or_init_context_map(name) {
3080
- if (ssr_context === null) {
3081
- lifecycle_outside_component();
2805
+ function ensure_array_like(array_like_or_iterator) {
2806
+ if (array_like_or_iterator) {
2807
+ return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
3082
2808
  }
3083
- return ssr_context.c ??= new Map(get_parent_context(ssr_context) || void 0);
3084
- }
3085
- function push(fn) {
3086
- ssr_context = { p: ssr_context, c: null, r: null };
3087
- }
3088
- function pop() {
3089
- ssr_context = /** @type {SSRContext} */
3090
- ssr_context.p;
2809
+ return [];
3091
2810
  }
3092
- function get_parent_context(ssr_context2) {
3093
- let parent = ssr_context2.p;
3094
- while (parent !== null) {
3095
- const context_map = parent.c;
3096
- if (context_map !== null) {
3097
- return context_map;
2811
+ function once(get_value) {
2812
+ let value = (
2813
+ /** @type {V} */
2814
+ UNINITIALIZED
2815
+ );
2816
+ return () => {
2817
+ if (value === UNINITIALIZED) {
2818
+ value = get_value();
3098
2819
  }
3099
- parent = parent.p;
3100
- }
3101
- return null;
2820
+ return value;
2821
+ };
3102
2822
  }
3103
- function unresolved_hydratable(key, stack) {
3104
- {
3105
- console.warn(`https://svelte.dev/e/unresolved_hydratable`);
3106
- }
2823
+ function props_id(renderer) {
2824
+ const uid2 = renderer.global.uid();
2825
+ renderer.push("<!--$" + uid2 + "-->");
2826
+ return uid2;
3107
2827
  }
3108
- function get_render_context() {
3109
- const store = als?.getStore();
3110
- {
3111
- server_context_required();
3112
- }
3113
- return store;
2828
+ function derived(fn) {
2829
+ const get_value = ssr_context === null ? fn : once(fn);
2830
+ let updated_value;
2831
+ return function(new_value) {
2832
+ if (arguments.length === 0) {
2833
+ return updated_value ?? get_value();
2834
+ }
2835
+ updated_value = new_value;
2836
+ return updated_value;
2837
+ };
3114
2838
  }
3115
- let als = null;
3116
2839
  let text_encoder;
3117
2840
  let crypto;
3118
2841
  const obfuscated_import = (module_name) => import(
@@ -3368,10 +3091,10 @@ class Renderer {
3368
3091
  * @returns {void}
3369
3092
  */
3370
3093
  component(fn, component_fn) {
3371
- push();
3094
+ push$1();
3372
3095
  const child = this.child(fn);
3373
3096
  child.#is_component_body = true;
3374
- pop();
3097
+ pop$1();
3375
3098
  }
3376
3099
  /**
3377
3100
  * @param {Record<string, any>} attrs
@@ -3873,158 +3596,387 @@ class SSRState {
3873
3596
  }
3874
3597
  }
3875
3598
  }
3876
- 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;
3877
- function element(renderer, tag, attributes_fn = noop, children_fn = noop) {
3878
- renderer.push("<!---->");
3879
- if (tag) {
3880
- if (!REGEX_VALID_TAG_NAME.test(tag)) {
3881
- dynamic_element_invalid_tag(tag);
3599
+ const event_symbol = /* @__PURE__ */ Symbol("events");
3600
+ const all_registered_events = /* @__PURE__ */ new Set();
3601
+ const root_event_handles = /* @__PURE__ */ new Set();
3602
+ function create_event(event_name, dom, handler, options = {}) {
3603
+ function target_handler(event) {
3604
+ if (!options.capture) {
3605
+ handle_event_propagation.call(dom, event);
3882
3606
  }
3883
- renderer.push(`<${tag}`);
3884
- attributes_fn();
3885
- renderer.push(`>`);
3886
- if (!is_void(tag)) {
3887
- children_fn();
3888
- if (!is_raw_text_element(tag)) {
3889
- renderer.push(EMPTY_COMMENT);
3607
+ if (!event.cancelBubble) {
3608
+ return without_reactive_context(() => {
3609
+ return handler?.call(this, event);
3610
+ });
3611
+ }
3612
+ }
3613
+ if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") {
3614
+ queue_micro_task(() => {
3615
+ dom.addEventListener(event_name, target_handler, options);
3616
+ });
3617
+ } else {
3618
+ dom.addEventListener(event_name, target_handler, options);
3619
+ }
3620
+ return target_handler;
3621
+ }
3622
+ function on(element2, type, handler, options = {}) {
3623
+ var target_handler = create_event(type, element2, handler, options);
3624
+ return () => {
3625
+ element2.removeEventListener(type, target_handler, options);
3626
+ };
3627
+ }
3628
+ let last_propagated_event = null;
3629
+ function handle_event_propagation(event) {
3630
+ var handler_element = this;
3631
+ var owner_document = (
3632
+ /** @type {Node} */
3633
+ handler_element.ownerDocument
3634
+ );
3635
+ var event_name = event.type;
3636
+ var path = event.composedPath?.() || [];
3637
+ var current_target = (
3638
+ /** @type {null | Element} */
3639
+ path[0] || event.target
3640
+ );
3641
+ last_propagated_event = event;
3642
+ var path_idx = 0;
3643
+ var handled_at = last_propagated_event === event && event[event_symbol];
3644
+ if (handled_at) {
3645
+ var at_idx = path.indexOf(handled_at);
3646
+ if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
3647
+ window)) {
3648
+ event[event_symbol] = handler_element;
3649
+ return;
3650
+ }
3651
+ var handler_idx = path.indexOf(handler_element);
3652
+ if (handler_idx === -1) {
3653
+ return;
3654
+ }
3655
+ if (at_idx <= handler_idx) {
3656
+ path_idx = at_idx;
3657
+ }
3658
+ }
3659
+ current_target = /** @type {Element} */
3660
+ path[path_idx] || event.target;
3661
+ if (current_target === handler_element) return;
3662
+ define_property(event, "currentTarget", {
3663
+ configurable: true,
3664
+ get() {
3665
+ return current_target || owner_document;
3666
+ }
3667
+ });
3668
+ var previous_reaction = active_reaction;
3669
+ var previous_effect = active_effect;
3670
+ set_active_reaction(null);
3671
+ set_active_effect(null);
3672
+ try {
3673
+ var throw_error;
3674
+ var other_errors = [];
3675
+ while (current_target !== null) {
3676
+ var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
3677
+ current_target.host || null;
3678
+ try {
3679
+ var delegated = current_target[event_symbol]?.[event_name];
3680
+ if (delegated != null && (!/** @type {any} */
3681
+ current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
3682
+ // -> the target could not have been disabled because it emits the event in the first place
3683
+ event.target === current_target)) {
3684
+ delegated.call(current_target, event);
3685
+ }
3686
+ } catch (error) {
3687
+ if (throw_error) {
3688
+ other_errors.push(error);
3689
+ } else {
3690
+ throw_error = error;
3691
+ }
3692
+ }
3693
+ if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
3694
+ break;
3695
+ }
3696
+ current_target = parent_element;
3697
+ }
3698
+ if (throw_error) {
3699
+ for (let error of other_errors) {
3700
+ queueMicrotask(() => {
3701
+ throw error;
3702
+ });
3703
+ }
3704
+ throw throw_error;
3705
+ }
3706
+ } finally {
3707
+ event[event_symbol] = handler_element;
3708
+ delete event.currentTarget;
3709
+ set_active_reaction(previous_reaction);
3710
+ set_active_effect(previous_effect);
3711
+ }
3712
+ }
3713
+ function assign_nodes(start, end) {
3714
+ var effect = (
3715
+ /** @type {Effect} */
3716
+ active_effect
3717
+ );
3718
+ if (effect.nodes === null) {
3719
+ effect.nodes = { start, end, a: null, t: null };
3720
+ }
3721
+ }
3722
+ function mount(component, options) {
3723
+ return _mount(component, options);
3724
+ }
3725
+ function hydrate(component, options) {
3726
+ init_operations();
3727
+ options.intro = options.intro ?? false;
3728
+ const target = options.target;
3729
+ const was_hydrating = hydrating;
3730
+ const previous_hydrate_node = hydrate_node;
3731
+ try {
3732
+ var anchor = /* @__PURE__ */ get_first_child(target);
3733
+ while (anchor && (anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */
3734
+ anchor.data !== HYDRATION_START)) {
3735
+ anchor = /* @__PURE__ */ get_next_sibling(anchor);
3736
+ }
3737
+ if (!anchor) {
3738
+ throw HYDRATION_ERROR;
3739
+ }
3740
+ set_hydrating(true);
3741
+ set_hydrate_node(
3742
+ /** @type {Comment} */
3743
+ anchor
3744
+ );
3745
+ const instance = _mount(component, { ...options, anchor });
3746
+ set_hydrating(false);
3747
+ return (
3748
+ /** @type {Exports} */
3749
+ instance
3750
+ );
3751
+ } catch (error) {
3752
+ if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
3753
+ throw error;
3754
+ }
3755
+ if (error !== HYDRATION_ERROR) {
3756
+ console.warn("Failed to hydrate: ", error);
3757
+ }
3758
+ if (options.recover === false) {
3759
+ hydration_failed();
3760
+ }
3761
+ init_operations();
3762
+ clear_text_content(target);
3763
+ set_hydrating(false);
3764
+ return mount(component, options);
3765
+ } finally {
3766
+ set_hydrating(was_hydrating);
3767
+ set_hydrate_node(previous_hydrate_node);
3768
+ }
3769
+ }
3770
+ const listeners = /* @__PURE__ */ new Map();
3771
+ function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
3772
+ init_operations();
3773
+ var component = void 0;
3774
+ var unmount2 = component_root(() => {
3775
+ var anchor_node = anchor ?? target.appendChild(create_text());
3776
+ boundary(
3777
+ /** @type {TemplateNode} */
3778
+ anchor_node,
3779
+ {
3780
+ pending: () => {
3781
+ }
3782
+ },
3783
+ (anchor_node2) => {
3784
+ push({});
3785
+ var ctx = (
3786
+ /** @type {ComponentContext} */
3787
+ component_context
3788
+ );
3789
+ if (context) ctx.c = context;
3790
+ if (events) {
3791
+ props.$$events = events;
3792
+ }
3793
+ if (hydrating) {
3794
+ assign_nodes(
3795
+ /** @type {TemplateNode} */
3796
+ anchor_node2,
3797
+ null
3798
+ );
3799
+ }
3800
+ component = Component(anchor_node2, props) || {};
3801
+ if (hydrating) {
3802
+ active_effect.nodes.end = hydrate_node;
3803
+ if (hydrate_node === null || hydrate_node.nodeType !== COMMENT_NODE || /** @type {Comment} */
3804
+ hydrate_node.data !== HYDRATION_END) {
3805
+ hydration_mismatch();
3806
+ throw HYDRATION_ERROR;
3807
+ }
3808
+ }
3809
+ pop();
3810
+ },
3811
+ transformError
3812
+ );
3813
+ var registered_events = /* @__PURE__ */ new Set();
3814
+ var event_handle = (events2) => {
3815
+ for (var i = 0; i < events2.length; i++) {
3816
+ var event_name = events2[i];
3817
+ if (registered_events.has(event_name)) continue;
3818
+ registered_events.add(event_name);
3819
+ var passive = is_passive_event(event_name);
3820
+ for (const node of [target, document]) {
3821
+ var counts = listeners.get(node);
3822
+ if (counts === void 0) {
3823
+ counts = /* @__PURE__ */ new Map();
3824
+ listeners.set(node, counts);
3825
+ }
3826
+ var count = counts.get(event_name);
3827
+ if (count === void 0) {
3828
+ node.addEventListener(event_name, handle_event_propagation, { passive });
3829
+ counts.set(event_name, 1);
3830
+ } else {
3831
+ counts.set(event_name, count + 1);
3832
+ }
3833
+ }
3834
+ }
3835
+ };
3836
+ event_handle(array_from(all_registered_events));
3837
+ root_event_handles.add(event_handle);
3838
+ return () => {
3839
+ for (var event_name of registered_events) {
3840
+ for (const node of [target, document]) {
3841
+ var counts = (
3842
+ /** @type {Map<string, number>} */
3843
+ listeners.get(node)
3844
+ );
3845
+ var count = (
3846
+ /** @type {number} */
3847
+ counts.get(event_name)
3848
+ );
3849
+ if (--count == 0) {
3850
+ node.removeEventListener(event_name, handle_event_propagation);
3851
+ counts.delete(event_name);
3852
+ if (counts.size === 0) {
3853
+ listeners.delete(node);
3854
+ }
3855
+ } else {
3856
+ counts.set(event_name, count);
3857
+ }
3858
+ }
3890
3859
  }
3891
- renderer.push(`</${tag}>`);
3892
- }
3893
- }
3894
- renderer.push("<!---->");
3860
+ root_event_handles.delete(event_handle);
3861
+ if (anchor_node !== anchor) {
3862
+ anchor_node.parentNode?.removeChild(anchor_node);
3863
+ }
3864
+ };
3865
+ });
3866
+ mounted_components.set(component, unmount2);
3867
+ return component;
3895
3868
  }
3896
- function render(component, options = {}) {
3897
- if (options.csp?.hash && options.csp.nonce) {
3898
- invalid_csp();
3869
+ let mounted_components = /* @__PURE__ */ new WeakMap();
3870
+ function unmount(component, options) {
3871
+ const fn = mounted_components.get(component);
3872
+ if (fn) {
3873
+ mounted_components.delete(component);
3874
+ return fn(options);
3899
3875
  }
3900
- return Renderer.render(
3901
- /** @type {Component<Props>} */
3902
- component,
3903
- options
3904
- );
3876
+ return Promise.resolve();
3905
3877
  }
3906
- function attributes(attrs, css_hash, classes, styles, flags2 = 0) {
3907
- if (styles) {
3908
- attrs.style = to_style(attrs.style, styles);
3909
- }
3910
- if (attrs.class) {
3911
- attrs.class = clsx(attrs.class);
3912
- }
3913
- if (css_hash || classes) {
3914
- attrs.class = to_class(attrs.class, css_hash, classes);
3915
- }
3916
- let attr_str = "";
3917
- let name;
3918
- const is_html = (flags2 & ELEMENT_IS_NAMESPACED) === 0;
3919
- const lowercase = (flags2 & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
3920
- const is_input = (flags2 & ELEMENT_IS_INPUT) !== 0;
3921
- for (name of Object.keys(attrs)) {
3922
- if (typeof attrs[name] === "function") continue;
3923
- if (name[0] === "$" && name[1] === "$") continue;
3924
- if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
3925
- var value = attrs[name];
3926
- var lower = name.toLowerCase();
3927
- if (lowercase) name = lower;
3928
- if (lower.length > 2 && lower.startsWith("on")) continue;
3929
- if (is_input) {
3930
- if (name === "defaultvalue" || name === "defaultchecked") {
3931
- name = name === "defaultvalue" ? "value" : "checked";
3932
- if (attrs[name]) continue;
3933
- }
3878
+ function asClassComponent$1(component) {
3879
+ return class extends Svelte4Component {
3880
+ /** @param {any} options */
3881
+ constructor(options) {
3882
+ super({
3883
+ component,
3884
+ ...options
3885
+ });
3934
3886
  }
3935
- attr_str += attr(name, value, is_html && is_boolean_attribute(name));
3936
- }
3937
- return attr_str;
3887
+ };
3938
3888
  }
3939
- function spread_props(props) {
3940
- const merged_props = {};
3941
- let key;
3942
- for (let i = 0; i < props.length; i++) {
3943
- const obj = props[i];
3944
- if (obj == null) continue;
3945
- for (key of Object.keys(obj)) {
3946
- const desc = Object.getOwnPropertyDescriptor(obj, key);
3947
- if (desc) {
3948
- Object.defineProperty(merged_props, key, desc);
3949
- } else {
3950
- merged_props[key] = obj[key];
3889
+ class Svelte4Component {
3890
+ /** @type {any} */
3891
+ #events;
3892
+ /** @type {Record<string, any>} */
3893
+ #instance;
3894
+ /**
3895
+ * @param {ComponentConstructorOptions & {
3896
+ * component: any;
3897
+ * }} options
3898
+ */
3899
+ constructor(options) {
3900
+ var sources = /* @__PURE__ */ new Map();
3901
+ var add_source = (key, value) => {
3902
+ var s = /* @__PURE__ */ mutable_source(value, false, false);
3903
+ sources.set(key, s);
3904
+ return s;
3905
+ };
3906
+ const props = new Proxy(
3907
+ { ...options.props || {}, $$events: {} },
3908
+ {
3909
+ get(target, prop) {
3910
+ return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3911
+ },
3912
+ has(target, prop) {
3913
+ if (prop === LEGACY_PROPS) return true;
3914
+ get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3915
+ return Reflect.has(target, prop);
3916
+ },
3917
+ set(target, prop, value) {
3918
+ set(sources.get(prop) ?? add_source(prop, value), value);
3919
+ return Reflect.set(target, prop, value);
3920
+ }
3951
3921
  }
3922
+ );
3923
+ this.#instance = (options.hydrate ? hydrate : mount)(options.component, {
3924
+ target: options.target,
3925
+ anchor: options.anchor,
3926
+ props,
3927
+ context: options.context,
3928
+ intro: options.intro ?? false,
3929
+ recover: options.recover,
3930
+ transformError: options.transformError
3931
+ });
3932
+ if (!options?.props?.$$host || options.sync === false) {
3933
+ flushSync();
3952
3934
  }
3953
- }
3954
- return merged_props;
3955
- }
3956
- function stringify(value) {
3957
- return typeof value === "string" ? value : value == null ? "" : value + "";
3958
- }
3959
- function attr_class(value, hash, directives) {
3960
- var result = to_class(value, hash, directives);
3961
- return result ? ` class="${escape_html(result, true)}"` : "";
3962
- }
3963
- function slot(renderer, $$props, name, slot_props, fallback_fn) {
3964
- var slot_fn = $$props.$$slots?.[name];
3965
- if (slot_fn === true) {
3966
- slot_fn = $$props["children"];
3967
- }
3968
- if (slot_fn !== void 0) {
3969
- slot_fn(renderer, slot_props);
3970
- }
3971
- }
3972
- function rest_props(props, rest) {
3973
- const rest_props2 = {};
3974
- let key;
3975
- for (key of Object.keys(props)) {
3976
- if (!rest.includes(key)) {
3977
- rest_props2[key] = props[key];
3935
+ this.#events = props.$$events;
3936
+ for (const key of Object.keys(this.#instance)) {
3937
+ if (key === "$set" || key === "$destroy" || key === "$on") continue;
3938
+ define_property(this, key, {
3939
+ get() {
3940
+ return this.#instance[key];
3941
+ },
3942
+ /** @param {any} value */
3943
+ set(value) {
3944
+ this.#instance[key] = value;
3945
+ },
3946
+ enumerable: true
3947
+ });
3978
3948
  }
3949
+ this.#instance.$set = /** @param {Record<string, any>} next */
3950
+ (next2) => {
3951
+ Object.assign(props, next2);
3952
+ };
3953
+ this.#instance.$destroy = () => {
3954
+ unmount(this.#instance);
3955
+ };
3979
3956
  }
3980
- return rest_props2;
3981
- }
3982
- function sanitize_props(props) {
3983
- const { children, $$slots, ...sanitized } = props;
3984
- return sanitized;
3985
- }
3986
- function bind_props(props_parent, props_now) {
3987
- for (const key of Object.keys(props_now)) {
3988
- const initial_value = props_parent[key];
3989
- const value = props_now[key];
3990
- if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) {
3991
- props_parent[key] = value;
3992
- }
3957
+ /** @param {Record<string, any>} props */
3958
+ $set(props) {
3959
+ this.#instance.$set(props);
3993
3960
  }
3994
- }
3995
- function ensure_array_like(array_like_or_iterator) {
3996
- if (array_like_or_iterator) {
3997
- return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
3961
+ /**
3962
+ * @param {string} event
3963
+ * @param {(...args: any[]) => any} callback
3964
+ * @returns {any}
3965
+ */
3966
+ $on(event, callback) {
3967
+ this.#events[event] = this.#events[event] || [];
3968
+ const cb = (...args) => callback.call(this, ...args);
3969
+ this.#events[event].push(cb);
3970
+ return () => {
3971
+ this.#events[event] = this.#events[event].filter(
3972
+ /** @param {any} fn */
3973
+ (fn) => fn !== cb
3974
+ );
3975
+ };
3976
+ }
3977
+ $destroy() {
3978
+ this.#instance.$destroy();
3998
3979
  }
3999
- return [];
4000
- }
4001
- function once(get_value) {
4002
- let value = (
4003
- /** @type {V} */
4004
- UNINITIALIZED
4005
- );
4006
- return () => {
4007
- if (value === UNINITIALIZED) {
4008
- value = get_value();
4009
- }
4010
- return value;
4011
- };
4012
- }
4013
- function props_id(renderer) {
4014
- const uid2 = renderer.global.uid();
4015
- renderer.push("<!--$" + uid2 + "-->");
4016
- return uid2;
4017
- }
4018
- function derived(fn) {
4019
- const get_value = ssr_context === null ? fn : once(fn);
4020
- let updated_value;
4021
- return function(new_value) {
4022
- if (arguments.length === 0) {
4023
- return updated_value ?? get_value();
4024
- }
4025
- updated_value = new_value;
4026
- return updated_value;
4027
- };
4028
3980
  }
4029
3981
  function asClassComponent(component) {
4030
3982
  const component_constructor = asClassComponent$1(component);
@@ -4136,7 +4088,6 @@ function Root($$renderer, $$props) {
4136
4088
  const root = asClassComponent(Root);
4137
4089
  export {
4138
4090
  ATTACHMENT_KEY as A,
4139
- safe_not_equal as B,
4140
4091
  attributes as a,
4141
4092
  bind_props as b,
4142
4093
  clsx as c,
@@ -4159,8 +4110,8 @@ export {
4159
4110
  getAllContexts as t,
4160
4111
  element as u,
4161
4112
  ssr_context as v,
4162
- lifecycle_function_unavailable as w,
4163
- rest_props as x,
4164
- fallback as y,
4165
- noop as z
4113
+ rest_props as w,
4114
+ fallback as x,
4115
+ noop as y,
4116
+ safe_not_equal as z
4166
4117
  };