@askrjs/askr 0.0.51 → 0.0.53

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 (651) hide show
  1. package/README.md +5 -1
  2. package/dist/{runtime/scheduler.js → access-Bg4RJNC8.js} +190 -20
  3. package/dist/actions/index.d.ts +2 -0
  4. package/dist/actions/index.js +103 -0
  5. package/dist/{common/attr-names.js → attr-names-CjhzmHOn.js} +1 -3
  6. package/dist/benchmark.d.ts +7 -4
  7. package/dist/benchmark.js +63 -13
  8. package/dist/boot/index.d.ts +62 -4
  9. package/dist/boot/index.js +1 -194
  10. package/dist/boot-j2KoN6ss.js +647 -0
  11. package/dist/cleanup-COv77su2.js +487 -0
  12. package/dist/component-internal-B3z7GXlD.js +614 -0
  13. package/dist/component-lifecycle-CO4hXlP4.js +357 -0
  14. package/dist/{runtime/component-scope.js → component-scope-CC3cojX9.js} +35 -9
  15. package/dist/component-scope-CvPba6O6.d.ts +12 -0
  16. package/dist/components/index.d.ts +17 -2
  17. package/dist/components/index.js +39 -1
  18. package/dist/compose-ref-Cc_YkUpM.js +92 -0
  19. package/dist/{foundations/utilities/compose-ref.d.ts → compose-ref-Cizq72-x.d.ts} +1 -2
  20. package/dist/control/index.d.ts +1 -3
  21. package/dist/control/index.js +1 -3
  22. package/dist/control-BQvNVfAd.d.ts +436 -0
  23. package/dist/control-BYyLTFyw.js +165 -0
  24. package/dist/control-Bf4Wkdvv.d.ts +9 -0
  25. package/dist/{common/control.js → control-DhFRTIoE.js} +1 -3
  26. package/dist/data/index.d.ts +2 -6
  27. package/dist/data/index.js +4 -5
  28. package/dist/data-DnxnDxD-.js +559 -0
  29. package/dist/{data/data-runtime.js → data-runtime-SJ1BSUvk.js} +35 -36
  30. package/dist/deferred-lKE8uR0z.js +386 -0
  31. package/dist/effect-BwnIvLah.js +260 -0
  32. package/dist/fastlane-Dw8SOBr9.js +343 -0
  33. package/dist/for-internal-BKf_Tnv1.js +1563 -0
  34. package/dist/foundations/icon/index.d.ts +68 -2
  35. package/dist/foundations/icon/index.js +85 -1
  36. package/dist/foundations/index.d.ts +2 -5
  37. package/dist/foundations/index.js +2 -5
  38. package/dist/foundations/interactions/index.d.ts +264 -6
  39. package/dist/foundations/interactions/index.js +1 -6
  40. package/dist/foundations/state/index.d.ts +32 -1
  41. package/dist/foundations/state/index.js +78 -1
  42. package/dist/foundations/structures/index.d.ts +2 -7
  43. package/dist/foundations/structures/index.js +2 -7
  44. package/dist/foundations/utilities/index.d.ts +2 -6
  45. package/dist/foundations/utilities/index.js +2 -5
  46. package/dist/fx/index.d.ts +190 -3
  47. package/dist/fx/index.js +454 -4
  48. package/dist/index-31Uoz_NS.d.ts +239 -0
  49. package/dist/index-Bki2rqcr.d.ts +233 -0
  50. package/dist/index-BnU0NPwM.d.ts +101 -0
  51. package/dist/index-D73jgYx1.d.ts +48 -0
  52. package/dist/{runtime/runtime.d.ts → index-R2JJIbM-.d.ts} +31 -9
  53. package/dist/index-SJXJkssx.d.ts +44 -0
  54. package/dist/index.d.ts +8 -13
  55. package/dist/index.js +150 -17
  56. package/dist/interactions-w7gQN4ha.js +280 -0
  57. package/dist/{data/invalidation-listeners.js → invalidation-listeners-Des3AHYs.js} +1 -3
  58. package/dist/{common/props.d.ts → jsx-CP0gmYwJ.d.ts} +17 -6
  59. package/dist/{common/jsx.js → jsx-CUpRxrLH.js} +1 -3
  60. package/dist/jsx-dev-runtime.d.ts +17 -5
  61. package/dist/jsx-dev-runtime.js +3 -10
  62. package/dist/jsx-runtime-92bV2hSa.d.ts +34 -0
  63. package/dist/jsx-runtime-BVVgDSdq.d.ts +1 -0
  64. package/dist/jsx-runtime.d.ts +3 -22
  65. package/dist/jsx-runtime.js +17 -20
  66. package/dist/{runtime/lifecycle-operations.js → lifecycle-operations-D9va7GOU.js} +9 -11
  67. package/dist/navigate-BVDCzOuB.d.ts +34 -0
  68. package/dist/navigate-CmPLSXyw.js +1449 -0
  69. package/dist/{runtime/portal.js → portal-CyU3Ucf2.js} +124 -35
  70. package/dist/query-registry-CQIT4mXr.js +73 -0
  71. package/dist/{common/render-context.js → render-context-Clw3rFiO.js} +14 -8
  72. package/dist/renderer-DzPjeLby.js +6197 -0
  73. package/dist/resource-operation-CEzfpnDk.js +276 -0
  74. package/dist/resources/index.d.ts +42 -3
  75. package/dist/resources/index.js +3 -4
  76. package/dist/{common/route-activity.js → route-activity-CNJfpwx-.js} +1 -3
  77. package/dist/route-matching-vJpvLVbX.js +515 -0
  78. package/dist/router/index.d.ts +166 -14
  79. package/dist/router/index.js +150 -12
  80. package/dist/{common/router.d.ts → router-CeYvjj5_.d.ts} +72 -29
  81. package/dist/{common/router-internal.js → router-internal-BC0w1_xk.js} +1 -3
  82. package/dist/{runtime/scheduler.d.ts → scheduler-CmLO4Dfm.d.ts} +1 -4
  83. package/dist/{runtime/selector.js → selector-DafVYzV4.js} +35 -20
  84. package/dist/{runtime/snapshot-source.js → snapshot-source-BB42xgwb.js} +1 -3
  85. package/dist/ssg/index.d.ts +252 -4
  86. package/dist/ssg/index.js +857 -1
  87. package/dist/ssr/index.d.ts +225 -8
  88. package/dist/ssr/index.js +3 -6
  89. package/dist/{common/ssr.js → ssr-CbQO5xd3.js} +1 -3
  90. package/dist/ssr-D3t80Rc0.js +1413 -0
  91. package/dist/{runtime/state.js → state-DPl8lffD.js} +4 -8
  92. package/dist/structures-DUB3HchX.js +221 -0
  93. package/dist/testing/index.d.ts +4 -4
  94. package/dist/testing/index.js +2 -7
  95. package/dist/{jsx/types.d.ts → types-DnQVG4ZY.d.ts} +2 -6
  96. package/dist/{foundations/utilities/use-id.js → utilities-C_CGX4Dz.js} +1 -3
  97. package/dist/{ssr/verify-hydration.js → verify-hydration-io9ahUeq.js} +2 -4
  98. package/dist/{common/vnode.js → vnode-CGMJYPMB.js} +2 -4
  99. package/package.json +63 -45
  100. package/dist/bench/components/benchmark-row.d.ts +0 -20
  101. package/dist/bench/components/benchmark-row.d.ts.map +0 -1
  102. package/dist/bench/components/benchmark-row.js +0 -42
  103. package/dist/bench/components/benchmark-row.js.map +0 -1
  104. package/dist/bench/components/benchmark-table.js +0 -25
  105. package/dist/bench/components/benchmark-table.js.map +0 -1
  106. package/dist/benchmark.d.ts.map +0 -1
  107. package/dist/benchmark.js.map +0 -1
  108. package/dist/bin/askr-ssg.d.ts +0 -28
  109. package/dist/bin/askr-ssg.d.ts.map +0 -1
  110. package/dist/bin/askr-ssg.js +0 -171
  111. package/dist/bin/askr-ssg.js.map +0 -1
  112. package/dist/boot/hydration.js +0 -140
  113. package/dist/boot/hydration.js.map +0 -1
  114. package/dist/boot/index.d.ts.map +0 -1
  115. package/dist/boot/index.js.map +0 -1
  116. package/dist/boot/root-lifecycle.d.ts +0 -15
  117. package/dist/boot/root-lifecycle.d.ts.map +0 -1
  118. package/dist/boot/root-lifecycle.js +0 -205
  119. package/dist/boot/root-lifecycle.js.map +0 -1
  120. package/dist/boot/route-startup.js +0 -45
  121. package/dist/boot/route-startup.js.map +0 -1
  122. package/dist/boot/types.d.ts +0 -62
  123. package/dist/boot/types.d.ts.map +0 -1
  124. package/dist/common/attr-names.js.map +0 -1
  125. package/dist/common/component.d.ts +0 -19
  126. package/dist/common/component.d.ts.map +0 -1
  127. package/dist/common/control.d.ts +0 -13
  128. package/dist/common/control.d.ts.map +0 -1
  129. package/dist/common/control.js.map +0 -1
  130. package/dist/common/env.js +0 -47
  131. package/dist/common/env.js.map +0 -1
  132. package/dist/common/error-boundary.d.ts +0 -16
  133. package/dist/common/error-boundary.d.ts.map +0 -1
  134. package/dist/common/invariant.js +0 -17
  135. package/dist/common/invariant.js.map +0 -1
  136. package/dist/common/jsx.d.ts +0 -23
  137. package/dist/common/jsx.d.ts.map +0 -1
  138. package/dist/common/jsx.js.map +0 -1
  139. package/dist/common/logger.js +0 -36
  140. package/dist/common/logger.js.map +0 -1
  141. package/dist/common/promise.js +0 -8
  142. package/dist/common/promise.js.map +0 -1
  143. package/dist/common/props.d.ts.map +0 -1
  144. package/dist/common/render-context.js.map +0 -1
  145. package/dist/common/route-activity.js.map +0 -1
  146. package/dist/common/router-internal.js.map +0 -1
  147. package/dist/common/router.d.ts.map +0 -1
  148. package/dist/common/ssr-errors.d.ts +0 -11
  149. package/dist/common/ssr-errors.d.ts.map +0 -1
  150. package/dist/common/ssr-errors.js +0 -16
  151. package/dist/common/ssr-errors.js.map +0 -1
  152. package/dist/common/ssr.d.ts +0 -42
  153. package/dist/common/ssr.d.ts.map +0 -1
  154. package/dist/common/ssr.js.map +0 -1
  155. package/dist/common/vnode.d.ts +0 -22
  156. package/dist/common/vnode.d.ts.map +0 -1
  157. package/dist/common/vnode.js.map +0 -1
  158. package/dist/components/error-boundary.d.ts +0 -15
  159. package/dist/components/error-boundary.d.ts.map +0 -1
  160. package/dist/components/error-boundary.js +0 -43
  161. package/dist/components/error-boundary.js.map +0 -1
  162. package/dist/components/link.d.ts +0 -68
  163. package/dist/components/link.d.ts.map +0 -1
  164. package/dist/components/link.js +0 -76
  165. package/dist/components/link.js.map +0 -1
  166. package/dist/control/case.d.ts +0 -19
  167. package/dist/control/case.d.ts.map +0 -1
  168. package/dist/control/case.js +0 -70
  169. package/dist/control/case.js.map +0 -1
  170. package/dist/control/for.d.ts +0 -24
  171. package/dist/control/for.d.ts.map +0 -1
  172. package/dist/control/for.js +0 -63
  173. package/dist/control/for.js.map +0 -1
  174. package/dist/control/shared.d.ts +0 -9
  175. package/dist/control/shared.d.ts.map +0 -1
  176. package/dist/control/shared.js +0 -20
  177. package/dist/control/shared.js.map +0 -1
  178. package/dist/control/show.d.ts +0 -15
  179. package/dist/control/show.d.ts.map +0 -1
  180. package/dist/control/show.js +0 -34
  181. package/dist/control/show.js.map +0 -1
  182. package/dist/data/data-runtime.d.ts +0 -28
  183. package/dist/data/data-runtime.d.ts.map +0 -1
  184. package/dist/data/data-runtime.js.map +0 -1
  185. package/dist/data/invalidation-listeners.js.map +0 -1
  186. package/dist/data/invalidation.d.ts +0 -9
  187. package/dist/data/invalidation.d.ts.map +0 -1
  188. package/dist/data/invalidation.js +0 -27
  189. package/dist/data/invalidation.js.map +0 -1
  190. package/dist/data/mutation-cell.d.ts +0 -28
  191. package/dist/data/mutation-cell.d.ts.map +0 -1
  192. package/dist/data/mutation-cell.js +0 -132
  193. package/dist/data/mutation-cell.js.map +0 -1
  194. package/dist/data/query-cell.d.ts +0 -46
  195. package/dist/data/query-cell.d.ts.map +0 -1
  196. package/dist/data/query-cell.js +0 -290
  197. package/dist/data/query-cell.js.map +0 -1
  198. package/dist/data/query-key.js +0 -42
  199. package/dist/data/query-key.js.map +0 -1
  200. package/dist/data/shared.js +0 -21
  201. package/dist/data/shared.js.map +0 -1
  202. package/dist/data/testing.js +0 -2
  203. package/dist/data/types.d.ts +0 -161
  204. package/dist/data/types.d.ts.map +0 -1
  205. package/dist/foundations/icon/icon.d.ts +0 -53
  206. package/dist/foundations/icon/icon.d.ts.map +0 -1
  207. package/dist/foundations/icon/icon.js +0 -88
  208. package/dist/foundations/icon/icon.js.map +0 -1
  209. package/dist/foundations/icon/icon.types.d.ts +0 -22
  210. package/dist/foundations/icon/icon.types.d.ts.map +0 -1
  211. package/dist/foundations/interactions/dismissable.d.ts +0 -72
  212. package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
  213. package/dist/foundations/interactions/dismissable.js +0 -26
  214. package/dist/foundations/interactions/dismissable.js.map +0 -1
  215. package/dist/foundations/interactions/focusable.d.ts +0 -22
  216. package/dist/foundations/interactions/focusable.d.ts.map +0 -1
  217. package/dist/foundations/interactions/focusable.js +0 -18
  218. package/dist/foundations/interactions/focusable.js.map +0 -1
  219. package/dist/foundations/interactions/hoverable.d.ts +0 -26
  220. package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
  221. package/dist/foundations/interactions/hoverable.js +0 -15
  222. package/dist/foundations/interactions/hoverable.js.map +0 -1
  223. package/dist/foundations/interactions/interaction-policy.d.ts +0 -50
  224. package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
  225. package/dist/foundations/interactions/interaction-policy.js +0 -122
  226. package/dist/foundations/interactions/interaction-policy.js.map +0 -1
  227. package/dist/foundations/interactions/pressable.d.ts +0 -61
  228. package/dist/foundations/interactions/pressable.d.ts.map +0 -1
  229. package/dist/foundations/interactions/pressable.js +0 -51
  230. package/dist/foundations/interactions/pressable.js.map +0 -1
  231. package/dist/foundations/interactions/roving-focus.d.ts +0 -52
  232. package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
  233. package/dist/foundations/interactions/roving-focus.js +0 -71
  234. package/dist/foundations/interactions/roving-focus.js.map +0 -1
  235. package/dist/foundations/state/controllable.d.ts +0 -33
  236. package/dist/foundations/state/controllable.d.ts.map +0 -1
  237. package/dist/foundations/state/controllable.js +0 -82
  238. package/dist/foundations/state/controllable.js.map +0 -1
  239. package/dist/foundations/structures/collection.d.ts +0 -52
  240. package/dist/foundations/structures/collection.d.ts.map +0 -1
  241. package/dist/foundations/structures/collection.js +0 -51
  242. package/dist/foundations/structures/collection.js.map +0 -1
  243. package/dist/foundations/structures/layer.d.ts +0 -81
  244. package/dist/foundations/structures/layer.d.ts.map +0 -1
  245. package/dist/foundations/structures/layer.js +0 -81
  246. package/dist/foundations/structures/layer.js.map +0 -1
  247. package/dist/foundations/structures/layout.d.ts +0 -33
  248. package/dist/foundations/structures/layout.d.ts.map +0 -1
  249. package/dist/foundations/structures/layout.js +0 -13
  250. package/dist/foundations/structures/layout.js.map +0 -1
  251. package/dist/foundations/structures/portal.d.ts +0 -2
  252. package/dist/foundations/structures/portal.js +0 -3
  253. package/dist/foundations/structures/presence.d.ts +0 -37
  254. package/dist/foundations/structures/presence.d.ts.map +0 -1
  255. package/dist/foundations/structures/presence.js +0 -39
  256. package/dist/foundations/structures/presence.js.map +0 -1
  257. package/dist/foundations/structures/slot.d.ts +0 -35
  258. package/dist/foundations/structures/slot.d.ts.map +0 -1
  259. package/dist/foundations/structures/slot.js +0 -41
  260. package/dist/foundations/structures/slot.js.map +0 -1
  261. package/dist/foundations/utilities/aria.d.ts +0 -16
  262. package/dist/foundations/utilities/aria.d.ts.map +0 -1
  263. package/dist/foundations/utilities/aria.js +0 -17
  264. package/dist/foundations/utilities/aria.js.map +0 -1
  265. package/dist/foundations/utilities/compose-handlers.d.ts +0 -37
  266. package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
  267. package/dist/foundations/utilities/compose-handlers.js +0 -20
  268. package/dist/foundations/utilities/compose-handlers.js.map +0 -1
  269. package/dist/foundations/utilities/compose-ref.d.ts.map +0 -1
  270. package/dist/foundations/utilities/compose-ref.js +0 -18
  271. package/dist/foundations/utilities/compose-ref.js.map +0 -1
  272. package/dist/foundations/utilities/event-types.d.ts +0 -20
  273. package/dist/foundations/utilities/event-types.d.ts.map +0 -1
  274. package/dist/foundations/utilities/merge-props.d.ts +0 -5
  275. package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
  276. package/dist/foundations/utilities/merge-props.js +0 -49
  277. package/dist/foundations/utilities/merge-props.js.map +0 -1
  278. package/dist/foundations/utilities/use-id.d.ts +0 -32
  279. package/dist/foundations/utilities/use-id.d.ts.map +0 -1
  280. package/dist/foundations/utilities/use-id.js.map +0 -1
  281. package/dist/fx/fx.d.ts +0 -33
  282. package/dist/fx/fx.d.ts.map +0 -1
  283. package/dist/fx/fx.js +0 -213
  284. package/dist/fx/fx.js.map +0 -1
  285. package/dist/fx/noop.js +0 -9
  286. package/dist/fx/noop.js.map +0 -1
  287. package/dist/fx/timing.d.ts +0 -159
  288. package/dist/fx/timing.d.ts.map +0 -1
  289. package/dist/fx/timing.js +0 -243
  290. package/dist/fx/timing.js.map +0 -1
  291. package/dist/index.js.map +0 -1
  292. package/dist/jsx/index.d.ts +0 -2
  293. package/dist/jsx/index.js +0 -4
  294. package/dist/jsx/types.d.ts.map +0 -1
  295. package/dist/jsx/types.js +0 -2
  296. package/dist/jsx/utils.d.ts +0 -5
  297. package/dist/jsx/utils.d.ts.map +0 -1
  298. package/dist/jsx/utils.js +0 -19
  299. package/dist/jsx/utils.js.map +0 -1
  300. package/dist/jsx-dev-runtime.d.ts.map +0 -1
  301. package/dist/jsx-dev-runtime.js.map +0 -1
  302. package/dist/jsx-runtime.d.ts.map +0 -1
  303. package/dist/jsx-runtime.js.map +0 -1
  304. package/dist/jsx-runtime2.d.ts +0 -3
  305. package/dist/jsx-runtime2.js +0 -4
  306. package/dist/renderer/attributes.js +0 -232
  307. package/dist/renderer/attributes.js.map +0 -1
  308. package/dist/renderer/boundaries.js +0 -266
  309. package/dist/renderer/boundaries.js.map +0 -1
  310. package/dist/renderer/child-shape.js +0 -85
  311. package/dist/renderer/child-shape.js.map +0 -1
  312. package/dist/renderer/children-fastpath.js +0 -149
  313. package/dist/renderer/children-fastpath.js.map +0 -1
  314. package/dist/renderer/children.js +0 -160
  315. package/dist/renderer/children.js.map +0 -1
  316. package/dist/renderer/cleanup.js +0 -210
  317. package/dist/renderer/cleanup.js.map +0 -1
  318. package/dist/renderer/component-host-cleanup.js +0 -68
  319. package/dist/renderer/component-host-cleanup.js.map +0 -1
  320. package/dist/renderer/component-host-instances.js +0 -65
  321. package/dist/renderer/component-host-instances.js.map +0 -1
  322. package/dist/renderer/component-host.js +0 -247
  323. package/dist/renderer/component-host.js.map +0 -1
  324. package/dist/renderer/dom-host.js +0 -13
  325. package/dist/renderer/dom-host.js.map +0 -1
  326. package/dist/renderer/dom-internal.js +0 -186
  327. package/dist/renderer/dom-internal.js.map +0 -1
  328. package/dist/renderer/dom.js +0 -10
  329. package/dist/renderer/element-children.js +0 -279
  330. package/dist/renderer/element-children.js.map +0 -1
  331. package/dist/renderer/env.js +0 -2
  332. package/dist/renderer/error-boundary-dom.js +0 -78
  333. package/dist/renderer/error-boundary-dom.js.map +0 -1
  334. package/dist/renderer/evaluate-dom-range.js +0 -85
  335. package/dist/renderer/evaluate-dom-range.js.map +0 -1
  336. package/dist/renderer/evaluate-reconcile.js +0 -282
  337. package/dist/renderer/evaluate-reconcile.js.map +0 -1
  338. package/dist/renderer/evaluate.js +0 -84
  339. package/dist/renderer/evaluate.js.map +0 -1
  340. package/dist/renderer/fastpath.js +0 -150
  341. package/dist/renderer/fastpath.js.map +0 -1
  342. package/dist/renderer/for-commit-dom-map.js +0 -83
  343. package/dist/renderer/for-commit-dom-map.js.map +0 -1
  344. package/dist/renderer/for-commit-removal.js +0 -36
  345. package/dist/renderer/for-commit-removal.js.map +0 -1
  346. package/dist/renderer/for-commit-reorder.js +0 -89
  347. package/dist/renderer/for-commit-reorder.js.map +0 -1
  348. package/dist/renderer/for-commit.js +0 -314
  349. package/dist/renderer/for-commit.js.map +0 -1
  350. package/dist/renderer/index.js +0 -38
  351. package/dist/renderer/index.js.map +0 -1
  352. package/dist/renderer/keyed-children.js +0 -32
  353. package/dist/renderer/keyed-children.js.map +0 -1
  354. package/dist/renderer/keyed.js +0 -167
  355. package/dist/renderer/keyed.js.map +0 -1
  356. package/dist/renderer/namespaces.js +0 -23
  357. package/dist/renderer/namespaces.js.map +0 -1
  358. package/dist/renderer/prop-bindings.js +0 -280
  359. package/dist/renderer/prop-bindings.js.map +0 -1
  360. package/dist/renderer/reactive-child-dom.js +0 -133
  361. package/dist/renderer/reactive-child-dom.js.map +0 -1
  362. package/dist/renderer/reactive-child-sources.js +0 -184
  363. package/dist/renderer/reactive-child-sources.js.map +0 -1
  364. package/dist/renderer/reactive-children.js +0 -294
  365. package/dist/renderer/reactive-children.js.map +0 -1
  366. package/dist/renderer/reconcile-commit.js +0 -38
  367. package/dist/renderer/reconcile-commit.js.map +0 -1
  368. package/dist/renderer/reconcile-fastpaths.js +0 -107
  369. package/dist/renderer/reconcile-fastpaths.js.map +0 -1
  370. package/dist/renderer/reconcile-resolution.js +0 -187
  371. package/dist/renderer/reconcile-resolution.js.map +0 -1
  372. package/dist/renderer/reconcile.js +0 -39
  373. package/dist/renderer/reconcile.js.map +0 -1
  374. package/dist/renderer/retained-element-rollback.js +0 -277
  375. package/dist/renderer/retained-element-rollback.js.map +0 -1
  376. package/dist/renderer/stable-patch.js +0 -81
  377. package/dist/renderer/stable-patch.js.map +0 -1
  378. package/dist/renderer/static-reuse.js +0 -96
  379. package/dist/renderer/static-reuse.js.map +0 -1
  380. package/dist/renderer/types.js +0 -2
  381. package/dist/renderer/utils.js +0 -256
  382. package/dist/renderer/utils.js.map +0 -1
  383. package/dist/router/access.js +0 -36
  384. package/dist/router/access.js.map +0 -1
  385. package/dist/router/activity.d.ts +0 -10
  386. package/dist/router/activity.d.ts.map +0 -1
  387. package/dist/router/activity.js +0 -87
  388. package/dist/router/activity.js.map +0 -1
  389. package/dist/router/authoring.d.ts +0 -22
  390. package/dist/router/authoring.d.ts.map +0 -1
  391. package/dist/router/authoring.js +0 -198
  392. package/dist/router/authoring.js.map +0 -1
  393. package/dist/router/internal-types.d.ts +0 -31
  394. package/dist/router/internal-types.d.ts.map +0 -1
  395. package/dist/router/lazy.d.ts +0 -19
  396. package/dist/router/lazy.d.ts.map +0 -1
  397. package/dist/router/lazy.js +0 -52
  398. package/dist/router/lazy.js.map +0 -1
  399. package/dist/router/manifest.d.ts +0 -10
  400. package/dist/router/manifest.d.ts.map +0 -1
  401. package/dist/router/manifest.js +0 -49
  402. package/dist/router/manifest.js.map +0 -1
  403. package/dist/router/match.js +0 -122
  404. package/dist/router/match.js.map +0 -1
  405. package/dist/router/navigate.d.ts +0 -11
  406. package/dist/router/navigate.d.ts.map +0 -1
  407. package/dist/router/navigate.js +0 -76
  408. package/dist/router/navigate.js.map +0 -1
  409. package/dist/router/navigation-registry.d.ts +0 -32
  410. package/dist/router/navigation-registry.d.ts.map +0 -1
  411. package/dist/router/navigation-registry.js +0 -105
  412. package/dist/router/navigation-registry.js.map +0 -1
  413. package/dist/router/navigation-scroll.d.ts +0 -14
  414. package/dist/router/navigation-scroll.d.ts.map +0 -1
  415. package/dist/router/navigation-scroll.js +0 -93
  416. package/dist/router/navigation-scroll.js.map +0 -1
  417. package/dist/router/navigation-targets.d.ts +0 -31
  418. package/dist/router/navigation-targets.d.ts.map +0 -1
  419. package/dist/router/navigation-targets.js +0 -255
  420. package/dist/router/navigation-targets.js.map +0 -1
  421. package/dist/router/policy.d.ts +0 -28
  422. package/dist/router/policy.d.ts.map +0 -1
  423. package/dist/router/policy.js +0 -132
  424. package/dist/router/policy.js.map +0 -1
  425. package/dist/router/rendering.d.ts +0 -10
  426. package/dist/router/rendering.d.ts.map +0 -1
  427. package/dist/router/rendering.js +0 -46
  428. package/dist/router/rendering.js.map +0 -1
  429. package/dist/router/resolution.d.ts +0 -4
  430. package/dist/router/resolution.d.ts.map +0 -1
  431. package/dist/router/resolution.js +0 -86
  432. package/dist/router/resolution.js.map +0 -1
  433. package/dist/router/route-context.js +0 -79
  434. package/dist/router/route-context.js.map +0 -1
  435. package/dist/router/route-matching.d.ts +0 -20
  436. package/dist/router/route-matching.d.ts.map +0 -1
  437. package/dist/router/route-matching.js +0 -175
  438. package/dist/router/route-matching.js.map +0 -1
  439. package/dist/router/route-query.d.ts +0 -17
  440. package/dist/router/route-query.d.ts.map +0 -1
  441. package/dist/router/route-query.js +0 -47
  442. package/dist/router/route-query.js.map +0 -1
  443. package/dist/router/route.d.ts +0 -8
  444. package/dist/router/route.js +0 -10
  445. package/dist/router/store.d.ts +0 -50
  446. package/dist/router/store.d.ts.map +0 -1
  447. package/dist/router/store.js +0 -171
  448. package/dist/router/store.js.map +0 -1
  449. package/dist/router/testing.js +0 -4
  450. package/dist/runtime/access.d.ts +0 -20
  451. package/dist/runtime/access.d.ts.map +0 -1
  452. package/dist/runtime/access.js +0 -45
  453. package/dist/runtime/access.js.map +0 -1
  454. package/dist/runtime/child-scope.d.ts +0 -22
  455. package/dist/runtime/child-scope.d.ts.map +0 -1
  456. package/dist/runtime/child-scope.js +0 -87
  457. package/dist/runtime/child-scope.js.map +0 -1
  458. package/dist/runtime/component-cleanup.d.ts +0 -16
  459. package/dist/runtime/component-cleanup.d.ts.map +0 -1
  460. package/dist/runtime/component-cleanup.js +0 -70
  461. package/dist/runtime/component-cleanup.js.map +0 -1
  462. package/dist/runtime/component-commit.js +0 -165
  463. package/dist/runtime/component-commit.js.map +0 -1
  464. package/dist/runtime/component-facade.d.ts +0 -5
  465. package/dist/runtime/component-facade.js +0 -4
  466. package/dist/runtime/component-internal.d.ts +0 -100
  467. package/dist/runtime/component-internal.d.ts.map +0 -1
  468. package/dist/runtime/component-internal.js +0 -219
  469. package/dist/runtime/component-internal.js.map +0 -1
  470. package/dist/runtime/component-lifecycle.d.ts +0 -49
  471. package/dist/runtime/component-lifecycle.d.ts.map +0 -1
  472. package/dist/runtime/component-lifecycle.js +0 -176
  473. package/dist/runtime/component-lifecycle.js.map +0 -1
  474. package/dist/runtime/component-scope.d.ts +0 -55
  475. package/dist/runtime/component-scope.d.ts.map +0 -1
  476. package/dist/runtime/component-scope.js.map +0 -1
  477. package/dist/runtime/component.d.ts +0 -5
  478. package/dist/runtime/component.js +0 -5
  479. package/dist/runtime/context.d.ts +0 -69
  480. package/dist/runtime/context.d.ts.map +0 -1
  481. package/dist/runtime/context.js +0 -210
  482. package/dist/runtime/context.js.map +0 -1
  483. package/dist/runtime/control.d.ts +0 -43
  484. package/dist/runtime/control.d.ts.map +0 -1
  485. package/dist/runtime/control.js +0 -126
  486. package/dist/runtime/control.js.map +0 -1
  487. package/dist/runtime/derive.d.ts +0 -17
  488. package/dist/runtime/derive.d.ts.map +0 -1
  489. package/dist/runtime/derive.js +0 -142
  490. package/dist/runtime/derive.js.map +0 -1
  491. package/dist/runtime/dev-namespace.d.ts +0 -31
  492. package/dist/runtime/dev-namespace.d.ts.map +0 -1
  493. package/dist/runtime/dev-namespace.js +0 -57
  494. package/dist/runtime/dev-namespace.js.map +0 -1
  495. package/dist/runtime/effect.d.ts +0 -32
  496. package/dist/runtime/effect.d.ts.map +0 -1
  497. package/dist/runtime/effect.js +0 -177
  498. package/dist/runtime/effect.js.map +0 -1
  499. package/dist/runtime/error-boundary.d.ts +0 -5
  500. package/dist/runtime/error-boundary.d.ts.map +0 -1
  501. package/dist/runtime/error-boundary.js +0 -31
  502. package/dist/runtime/error-boundary.js.map +0 -1
  503. package/dist/runtime/events.d.ts +0 -58
  504. package/dist/runtime/events.d.ts.map +0 -1
  505. package/dist/runtime/events.js +0 -204
  506. package/dist/runtime/events.js.map +0 -1
  507. package/dist/runtime/execution-model.d.ts +0 -7
  508. package/dist/runtime/execution-model.d.ts.map +0 -1
  509. package/dist/runtime/execution-model.js +0 -15
  510. package/dist/runtime/execution-model.js.map +0 -1
  511. package/dist/runtime/fastlane.d.ts +0 -34
  512. package/dist/runtime/fastlane.d.ts.map +0 -1
  513. package/dist/runtime/fastlane.js +0 -175
  514. package/dist/runtime/fastlane.js.map +0 -1
  515. package/dist/runtime/for-bench.d.ts +0 -41
  516. package/dist/runtime/for-bench.d.ts.map +0 -1
  517. package/dist/runtime/for-bench.js +0 -171
  518. package/dist/runtime/for-bench.js.map +0 -1
  519. package/dist/runtime/for-internal.d.ts +0 -43
  520. package/dist/runtime/for-internal.d.ts.map +0 -1
  521. package/dist/runtime/for-internal.js +0 -98
  522. package/dist/runtime/for-internal.js.map +0 -1
  523. package/dist/runtime/for-reconcile.d.ts +0 -8
  524. package/dist/runtime/for-reconcile.d.ts.map +0 -1
  525. package/dist/runtime/for-reconcile.js +0 -389
  526. package/dist/runtime/for-reconcile.js.map +0 -1
  527. package/dist/runtime/for-scopes.d.ts +0 -26
  528. package/dist/runtime/for-scopes.d.ts.map +0 -1
  529. package/dist/runtime/for-scopes.js +0 -160
  530. package/dist/runtime/for-scopes.js.map +0 -1
  531. package/dist/runtime/for-signals.d.ts +0 -30
  532. package/dist/runtime/for-signals.d.ts.map +0 -1
  533. package/dist/runtime/for-signals.js +0 -139
  534. package/dist/runtime/for-signals.js.map +0 -1
  535. package/dist/runtime/for-types.d.ts +0 -9
  536. package/dist/runtime/for-types.d.ts.map +0 -1
  537. package/dist/runtime/for.d.ts +0 -4
  538. package/dist/runtime/for.js +0 -5
  539. package/dist/runtime/index.d.ts +0 -24
  540. package/dist/runtime/index.js +0 -31
  541. package/dist/runtime/lifecycle-operations.d.ts +0 -31
  542. package/dist/runtime/lifecycle-operations.d.ts.map +0 -1
  543. package/dist/runtime/lifecycle-operations.js.map +0 -1
  544. package/dist/runtime/operations.d.ts +0 -3
  545. package/dist/runtime/operations.js +0 -3
  546. package/dist/runtime/perf-metrics.d.ts +0 -26
  547. package/dist/runtime/perf-metrics.d.ts.map +0 -1
  548. package/dist/runtime/perf-metrics.js +0 -70
  549. package/dist/runtime/perf-metrics.js.map +0 -1
  550. package/dist/runtime/portal.d.ts +0 -22
  551. package/dist/runtime/portal.d.ts.map +0 -1
  552. package/dist/runtime/portal.js.map +0 -1
  553. package/dist/runtime/readable.d.ts +0 -29
  554. package/dist/runtime/readable.d.ts.map +0 -1
  555. package/dist/runtime/readable.js +0 -159
  556. package/dist/runtime/readable.js.map +0 -1
  557. package/dist/runtime/resource-cell.js +0 -114
  558. package/dist/runtime/resource-cell.js.map +0 -1
  559. package/dist/runtime/resource-operation.d.ts +0 -13
  560. package/dist/runtime/resource-operation.d.ts.map +0 -1
  561. package/dist/runtime/resource-operation.js +0 -170
  562. package/dist/runtime/resource-operation.js.map +0 -1
  563. package/dist/runtime/runtime.d.ts.map +0 -1
  564. package/dist/runtime/runtime.js +0 -59
  565. package/dist/runtime/runtime.js.map +0 -1
  566. package/dist/runtime/scheduler.d.ts.map +0 -1
  567. package/dist/runtime/scheduler.js.map +0 -1
  568. package/dist/runtime/selector-store.js +0 -24
  569. package/dist/runtime/selector-store.js.map +0 -1
  570. package/dist/runtime/selector.d.ts +0 -11
  571. package/dist/runtime/selector.d.ts.map +0 -1
  572. package/dist/runtime/selector.js.map +0 -1
  573. package/dist/runtime/snapshot-source.d.ts +0 -10
  574. package/dist/runtime/snapshot-source.d.ts.map +0 -1
  575. package/dist/runtime/snapshot-source.js.map +0 -1
  576. package/dist/runtime/state.d.ts +0 -55
  577. package/dist/runtime/state.d.ts.map +0 -1
  578. package/dist/runtime/state.js.map +0 -1
  579. package/dist/ssg/batch-render.js +0 -103
  580. package/dist/ssg/batch-render.js.map +0 -1
  581. package/dist/ssg/create-static-gen.d.ts +0 -64
  582. package/dist/ssg/create-static-gen.d.ts.map +0 -1
  583. package/dist/ssg/create-static-gen.js +0 -199
  584. package/dist/ssg/create-static-gen.js.map +0 -1
  585. package/dist/ssg/generate-metadata.js +0 -94
  586. package/dist/ssg/generate-metadata.js.map +0 -1
  587. package/dist/ssg/generation-plan.js +0 -70
  588. package/dist/ssg/generation-plan.js.map +0 -1
  589. package/dist/ssg/incremental-manifest.js +0 -56
  590. package/dist/ssg/incremental-manifest.js.map +0 -1
  591. package/dist/ssg/resolve-ssg-data.js +0 -105
  592. package/dist/ssg/resolve-ssg-data.js.map +0 -1
  593. package/dist/ssg/route-utils.js +0 -24
  594. package/dist/ssg/route-utils.js.map +0 -1
  595. package/dist/ssg/static-routes.js +0 -102
  596. package/dist/ssg/static-routes.js.map +0 -1
  597. package/dist/ssg/types.d.ts +0 -189
  598. package/dist/ssg/types.d.ts.map +0 -1
  599. package/dist/ssg/write-static-files.js +0 -73
  600. package/dist/ssg/write-static-files.js.map +0 -1
  601. package/dist/ssr/attrs.js +0 -94
  602. package/dist/ssr/attrs.js.map +0 -1
  603. package/dist/ssr/boundaries.js +0 -113
  604. package/dist/ssr/boundaries.js.map +0 -1
  605. package/dist/ssr/component-runtime.js +0 -111
  606. package/dist/ssr/component-runtime.js.map +0 -1
  607. package/dist/ssr/context.d.ts +0 -50
  608. package/dist/ssr/context.d.ts.map +0 -1
  609. package/dist/ssr/context.js +0 -91
  610. package/dist/ssr/context.js.map +0 -1
  611. package/dist/ssr/errors.d.ts +0 -10
  612. package/dist/ssr/errors.d.ts.map +0 -1
  613. package/dist/ssr/errors.js +0 -14
  614. package/dist/ssr/errors.js.map +0 -1
  615. package/dist/ssr/escape.js +0 -193
  616. package/dist/ssr/escape.js.map +0 -1
  617. package/dist/ssr/hydration-data.js +0 -10
  618. package/dist/ssr/hydration-data.js.map +0 -1
  619. package/dist/ssr/hydration-verify.d.ts +0 -12
  620. package/dist/ssr/hydration-verify.d.ts.map +0 -1
  621. package/dist/ssr/hydration-verify.js +0 -144
  622. package/dist/ssr/hydration-verify.js.map +0 -1
  623. package/dist/ssr/index-internal.d.ts +0 -15
  624. package/dist/ssr/index-internal.d.ts.map +0 -1
  625. package/dist/ssr/index-internal.js +0 -19
  626. package/dist/ssr/index-internal.js.map +0 -1
  627. package/dist/ssr/render-keys.js +0 -16
  628. package/dist/ssr/render-keys.js.map +0 -1
  629. package/dist/ssr/render-resolved.d.ts +0 -20
  630. package/dist/ssr/render-resolved.d.ts.map +0 -1
  631. package/dist/ssr/render-resolved.js +0 -35
  632. package/dist/ssr/render-resolved.js.map +0 -1
  633. package/dist/ssr/render-sync.d.ts +0 -21
  634. package/dist/ssr/render-sync.d.ts.map +0 -1
  635. package/dist/ssr/render-sync.js +0 -275
  636. package/dist/ssr/render-sync.js.map +0 -1
  637. package/dist/ssr/route-policy-resolution.js +0 -78
  638. package/dist/ssr/route-policy-resolution.js.map +0 -1
  639. package/dist/ssr/route-render.d.ts +0 -77
  640. package/dist/ssr/route-render.d.ts.map +0 -1
  641. package/dist/ssr/route-render.js +0 -120
  642. package/dist/ssr/route-render.js.map +0 -1
  643. package/dist/ssr/sink.d.ts +0 -26
  644. package/dist/ssr/sink.d.ts.map +0 -1
  645. package/dist/ssr/sink.js +0 -86
  646. package/dist/ssr/sink.js.map +0 -1
  647. package/dist/ssr/types.d.ts +0 -23
  648. package/dist/ssr/types.d.ts.map +0 -1
  649. package/dist/ssr/verify-hydration.js.map +0 -1
  650. package/dist/testing/index.d.ts.map +0 -1
  651. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1,1563 @@
1
+ import { r as _isDOMElement } from "./vnode-CGMJYPMB.js";
2
+ import { b as isDevelopmentEnvironment, o as getRuntimeRenderer, v as logger } from "./access-Bg4RJNC8.js";
3
+ import { f as notifyReadableReaders, l as markReactivePropsDirtySource, m as shouldCoalesceFineGrainedItemReads, p as recordReadableRead, u as markReadableDerivedSubscribersDirty } from "./fastlane-Dw8SOBr9.js";
4
+ import { n as createComponentInstance, s as renderScopedComponent } from "./component-internal-B3z7GXlD.js";
5
+ import { h as getCurrentStateIndex, i as claimHookIndex, o as clearRenderTracking, p as getCurrentInstance } from "./component-scope-CC3cojX9.js";
6
+ import { _ as registerOwnedChildScope, c as finalizeInlineReadSubscriptions, f as registerLifecycleTransaction, h as cleanupComponent, v as unregisterOwnedChildScope } from "./component-lifecycle-CO4hXlP4.js";
7
+ //#region src/runtime/child-scope.ts
8
+ const EMPTY_CHILD_SCOPE_PROPS = {};
9
+ const childScopesByInstance = /* @__PURE__ */ new WeakMap();
10
+ function executeChildScopeComponent() {
11
+ const instance = getCurrentInstance();
12
+ const scope = instance ? childScopesByInstance.get(instance) : void 0;
13
+ if (!scope?._renderFn) return null;
14
+ return scope._renderFn();
15
+ }
16
+ function ensureChildScopeFlushTask(scope) {
17
+ const instance = scope.componentInstance;
18
+ if (instance._pendingFlushTask) return;
19
+ instance._pendingFlushTask = () => {
20
+ instance.hasPendingUpdate = false;
21
+ if (instance.notifyUpdate === null || scope._disposed) return;
22
+ renderScope(scope);
23
+ scope._onDirty?.();
24
+ };
25
+ }
26
+ var ChildScopeImpl = class {
27
+ constructor(parent, key, onDirty, ownership) {
28
+ this.previousVnode = void 0;
29
+ this.vnode = void 0;
30
+ this.dom = void 0;
31
+ this.range = void 0;
32
+ this.needsDomUpdate = true;
33
+ this.hydrationPending = true;
34
+ this.blueprintOwner = void 0;
35
+ this._renderFn = void 0;
36
+ this._disposed = false;
37
+ this.key = key;
38
+ this._parent = parent;
39
+ this._onDirty = onDirty;
40
+ this._ownership = ownership;
41
+ this._startStateIndex = getCurrentStateIndex();
42
+ this.componentInstance = createComponentInstance("child-scope", executeChildScopeComponent, EMPTY_CHILD_SCOPE_PROPS, null);
43
+ childScopesByInstance.set(this.componentInstance, this);
44
+ if (parent) {
45
+ this.componentInstance.parentInstance = parent;
46
+ this.componentInstance.ownerFrame = parent.ownerFrame;
47
+ this.componentInstance.portalScope = parent.portalScope;
48
+ if (ownership) ownership.add(this);
49
+ else registerOwnedChildScope(parent, this);
50
+ }
51
+ }
52
+ markDirty() {
53
+ this.needsDomUpdate = true;
54
+ }
55
+ render(renderFn) {
56
+ this._renderFn = renderFn;
57
+ return renderScope(this);
58
+ }
59
+ dispose() {
60
+ if (this._disposed) return;
61
+ this._disposed = true;
62
+ if (this._parent) if (this._ownership) this._ownership.delete(this);
63
+ else unregisterOwnedChildScope(this._parent, this);
64
+ childScopesByInstance.delete(this.componentInstance);
65
+ cleanupComponent(this.componentInstance);
66
+ this._renderFn = void 0;
67
+ this.previousVnode = void 0;
68
+ this.vnode = void 0;
69
+ this.dom = void 0;
70
+ this.range = void 0;
71
+ this.needsDomUpdate = false;
72
+ this.hydrationPending = false;
73
+ this.blueprintOwner = void 0;
74
+ this.componentInstance.hasPendingUpdate = false;
75
+ }
76
+ };
77
+ function renderScope(scope) {
78
+ if (scope._disposed) {
79
+ if (isDevelopmentEnvironment()) throw new Error(`[askr] Attempted to render disposed child scope ${String(scope.key)}.`);
80
+ return scope.vnode;
81
+ }
82
+ if (!scope._renderFn) return scope.vnode;
83
+ const { componentInstance } = scope;
84
+ const previousVNode = scope.vnode;
85
+ try {
86
+ const nextVNode = renderScopedComponent(componentInstance, scope._startStateIndex, scope._renderFn);
87
+ if (previousVNode && nextVNode && _isDOMElement(previousVNode) && _isDOMElement(nextVNode) && typeof previousVNode.type === "function" && previousVNode.type === nextVNode.type && "__instance" in previousVNode && !("__instance" in nextVNode)) nextVNode.__instance = previousVNode.__instance;
88
+ scope.previousVnode = previousVNode;
89
+ scope.vnode = nextVNode;
90
+ scope.markDirty();
91
+ if ((componentInstance._pendingReadSources?.size ?? 0) > 0) ensureChildScopeFlushTask(scope);
92
+ finalizeInlineReadSubscriptions(componentInstance, componentInstance._currentRenderToken, componentInstance._pendingReadSources, componentInstance._pendingReadSourceVersions);
93
+ clearRenderTracking(componentInstance);
94
+ return scope.vnode;
95
+ } catch (error) {
96
+ componentInstance.hasPendingUpdate = false;
97
+ throw error;
98
+ }
99
+ }
100
+ function rerenderChildScope(scope) {
101
+ return renderScope(scope);
102
+ }
103
+ /** @internal */
104
+ function captureChildScopeTransactionSnapshot(scope) {
105
+ const mutableScope = scope;
106
+ return {
107
+ previousVnode: scope.previousVnode,
108
+ vnode: scope.vnode,
109
+ dom: scope.dom,
110
+ range: scope.range,
111
+ domTextData: scope.dom?.nodeType === 3 ? scope.dom.data : void 0,
112
+ needsDomUpdate: scope.needsDomUpdate,
113
+ hydrationPending: scope.hydrationPending,
114
+ renderFn: mutableScope._renderFn
115
+ };
116
+ }
117
+ /** @internal */
118
+ function restoreChildScopeTransactionSnapshot(scope, snapshot) {
119
+ const mutableScope = scope;
120
+ scope.previousVnode = snapshot.previousVnode;
121
+ scope.vnode = snapshot.vnode;
122
+ scope.dom = snapshot.dom;
123
+ scope.range = snapshot.range;
124
+ if (snapshot.domTextData !== void 0 && snapshot.dom?.nodeType === 3) snapshot.dom.data = snapshot.domTextData;
125
+ scope.needsDomUpdate = snapshot.needsDomUpdate;
126
+ scope.hydrationPending = snapshot.hydrationPending;
127
+ mutableScope._renderFn = snapshot.renderFn;
128
+ }
129
+ function disposeChildScope(scope) {
130
+ scope.dispose();
131
+ }
132
+ function createChildScope(parent, key, onDirty, ownership) {
133
+ return new ChildScopeImpl(parent, key, onDirty, ownership);
134
+ }
135
+ //#endregion
136
+ //#region src/runtime/control.ts
137
+ const SHOW_TRUTHY_KEY = "__show-truthy__";
138
+ const SHOW_FALLBACK_KEY = "__show-fallback__";
139
+ const CASE_FALLBACK_KEY = "__case-fallback__";
140
+ function getBranchScopes(state) {
141
+ const scopes = [];
142
+ if (state.activeScope) scopes.push(state.activeScope);
143
+ if (state instanceof Object && "fallbackScope" in state) {
144
+ if (state.fallbackScope) scopes.push(state.fallbackScope);
145
+ }
146
+ if (state instanceof Object && "truthyScope" in state) {
147
+ if (state.truthyScope) scopes.push(state.truthyScope);
148
+ }
149
+ return scopes;
150
+ }
151
+ function beginControlTransaction(state) {
152
+ if (state._transaction) return state._transaction;
153
+ const scopeSnapshots = /* @__PURE__ */ new Map();
154
+ for (const scope of getBranchScopes(state)) scopeSnapshots.set(scope, captureChildScopeTransactionSnapshot(scope));
155
+ const transaction = {
156
+ state,
157
+ snapshot: {
158
+ activeKey: state.activeKey,
159
+ activeScope: state.activeScope,
160
+ activeVNodes: state.activeVNodes.slice(),
161
+ lastRemovedNodes: state.lastRemovedNodes.slice(),
162
+ lastRemovedRanges: state.lastRemovedRanges.slice(),
163
+ scopeSnapshots,
164
+ fallbackScope: "fallbackScope" in state ? state.fallbackScope : void 0,
165
+ truthyScope: "truthyScope" in state ? state.truthyScope : void 0
166
+ },
167
+ removedScopes: [],
168
+ shouldClearDomUpdateState: false,
169
+ registered: false
170
+ };
171
+ state._transaction = transaction;
172
+ transaction.registered = registerLifecycleTransaction(transaction, () => commitControlTransaction(state, transaction), () => rollbackControlTransaction(state, transaction));
173
+ return transaction;
174
+ }
175
+ function stageBranchRemoval(state, scope) {
176
+ if (!scope) return;
177
+ const transaction = state._transaction;
178
+ if (transaction && !transaction.removedScopes.includes(scope)) transaction.removedScopes.push(scope);
179
+ else if (!transaction) disposeChildScope(scope);
180
+ const removedDom = scope.dom;
181
+ if (removedDom) state.lastRemovedNodes.push(removedDom);
182
+ if (scope.range) state.lastRemovedRanges.push(scope.range);
183
+ }
184
+ function commitControlTransaction(state, transaction) {
185
+ if (state._transaction !== transaction) return;
186
+ const errors = [];
187
+ for (const scope of transaction.removedScopes) try {
188
+ disposeChildScope(scope);
189
+ } catch (error) {
190
+ errors.push(error);
191
+ }
192
+ if (transaction.shouldClearDomUpdateState) {
193
+ if ("truthyScope" in state && state.truthyScope) state.truthyScope.needsDomUpdate = false;
194
+ if ("fallbackScope" in state && state.fallbackScope) state.fallbackScope.needsDomUpdate = false;
195
+ if (state.activeScope) state.activeScope.needsDomUpdate = false;
196
+ state.lastRemovedNodes = [];
197
+ state.lastRemovedRanges = [];
198
+ }
199
+ state._transaction = null;
200
+ if (errors.length > 0) throw new AggregateError(errors, "Control branch cleanup failed");
201
+ }
202
+ function rollbackControlTransaction(state, transaction) {
203
+ if (state._transaction !== transaction) return;
204
+ const committedScopes = new Set(transaction.snapshot.scopeSnapshots.keys());
205
+ const currentScopes = getBranchScopes(state);
206
+ const errors = [];
207
+ for (const scope of currentScopes) {
208
+ if (committedScopes.has(scope)) continue;
209
+ try {
210
+ disposeChildScope(scope);
211
+ } catch (error) {
212
+ errors.push(error);
213
+ }
214
+ }
215
+ state.activeKey = transaction.snapshot.activeKey;
216
+ state.activeScope = transaction.snapshot.activeScope;
217
+ state.activeVNodes = transaction.snapshot.activeVNodes;
218
+ state.lastRemovedNodes = transaction.snapshot.lastRemovedNodes;
219
+ state.lastRemovedRanges = transaction.snapshot.lastRemovedRanges;
220
+ if ("truthyScope" in state) state.truthyScope = transaction.snapshot.truthyScope ?? null;
221
+ if ("fallbackScope" in state) state.fallbackScope = transaction.snapshot.fallbackScope ?? null;
222
+ for (const [scope, snapshot] of transaction.snapshot.scopeSnapshots) restoreChildScopeTransactionSnapshot(scope, snapshot);
223
+ state._transaction = null;
224
+ if (errors.length > 0) throw new AggregateError(errors, "Control branch rollback cleanup failed");
225
+ }
226
+ function finishImmediateControlTransaction(state, transaction) {
227
+ if (state._transaction === transaction && !transaction.registered) commitControlTransaction(state, transaction);
228
+ }
229
+ function createBranchScope(state, key) {
230
+ return createChildScope(state.parentInstance, key, () => {
231
+ if (state._enqueueBoundaryCommit) {
232
+ state._enqueueBoundaryCommit();
233
+ return;
234
+ }
235
+ state.parentInstance?._enqueueRun?.();
236
+ });
237
+ }
238
+ function createShowState(value, renderTruthy, renderFallback) {
239
+ return {
240
+ kind: "show",
241
+ activeKey: null,
242
+ activeScope: null,
243
+ activeVNodes: [],
244
+ fallbackScope: null,
245
+ lastRemovedNodes: [],
246
+ lastRemovedRanges: [],
247
+ parentInstance: getCurrentInstance(),
248
+ _enqueueBoundaryCommit: null,
249
+ _hasPendingBoundaryCommit: false,
250
+ _transaction: null,
251
+ renderFallback,
252
+ renderTruthy,
253
+ selectedValue: value,
254
+ truthyScope: null
255
+ };
256
+ }
257
+ function evaluateShowState(state) {
258
+ const transaction = beginControlTransaction(state);
259
+ state.lastRemovedNodes = [];
260
+ state.lastRemovedRanges = [];
261
+ try {
262
+ if (state.selectedValue) {
263
+ if (state.fallbackScope) {
264
+ stageBranchRemoval(state, state.fallbackScope);
265
+ state.fallbackScope = null;
266
+ }
267
+ const truthyScope = state.truthyScope ?? createBranchScope(state, SHOW_TRUTHY_KEY);
268
+ state.truthyScope = truthyScope;
269
+ state.activeScope = truthyScope;
270
+ state.activeKey = SHOW_TRUTHY_KEY;
271
+ const vnode = truthyScope.render(() => state.renderTruthy(state.selectedValue));
272
+ state.activeVNodes = vnode == null || vnode === false ? [] : [vnode];
273
+ } else {
274
+ if (state.truthyScope) {
275
+ stageBranchRemoval(state, state.truthyScope);
276
+ state.truthyScope = null;
277
+ }
278
+ if (!state.renderFallback) {
279
+ if (state.fallbackScope) {
280
+ stageBranchRemoval(state, state.fallbackScope);
281
+ state.fallbackScope = null;
282
+ }
283
+ state.activeKey = null;
284
+ state.activeScope = null;
285
+ state.activeVNodes = [];
286
+ } else {
287
+ const fallbackScope = state.fallbackScope ?? createBranchScope(state, SHOW_FALLBACK_KEY);
288
+ state.fallbackScope = fallbackScope;
289
+ state.activeScope = fallbackScope;
290
+ state.activeKey = SHOW_FALLBACK_KEY;
291
+ const vnode = fallbackScope.render(state.renderFallback);
292
+ state.activeVNodes = vnode == null || vnode === false ? [] : [vnode];
293
+ }
294
+ }
295
+ finishImmediateControlTransaction(state, transaction);
296
+ return state.activeVNodes;
297
+ } catch (error) {
298
+ rollbackControlTransaction(state, transaction);
299
+ throw error;
300
+ }
301
+ }
302
+ function clearShowDomUpdateState(state) {
303
+ if (state.truthyScope) state.truthyScope.needsDomUpdate = false;
304
+ if (state.fallbackScope) state.fallbackScope.needsDomUpdate = false;
305
+ if (state._transaction) {
306
+ state._transaction.shouldClearDomUpdateState = true;
307
+ return;
308
+ }
309
+ state.lastRemovedNodes = [];
310
+ state.lastRemovedRanges = [];
311
+ }
312
+ function createCaseState(matches, fallback) {
313
+ return {
314
+ kind: "case",
315
+ activeKey: null,
316
+ activeScope: null,
317
+ activeVNodes: [],
318
+ fallback,
319
+ lastRemovedNodes: [],
320
+ lastRemovedRanges: [],
321
+ matches,
322
+ parentInstance: getCurrentInstance(),
323
+ _enqueueBoundaryCommit: null,
324
+ _hasPendingBoundaryCommit: false,
325
+ _transaction: null
326
+ };
327
+ }
328
+ function evaluateCaseState(state) {
329
+ const transaction = beginControlTransaction(state);
330
+ state.lastRemovedNodes = [];
331
+ state.lastRemovedRanges = [];
332
+ try {
333
+ const selectedMatch = state.matches.find((candidate) => Boolean(candidate.when)) ?? null;
334
+ const nextKey = selectedMatch?.key ?? (state.fallback ? CASE_FALLBACK_KEY : null);
335
+ if (nextKey === null) {
336
+ if (state.activeScope) stageBranchRemoval(state, state.activeScope);
337
+ state.activeKey = null;
338
+ state.activeScope = null;
339
+ state.activeVNodes = [];
340
+ } else {
341
+ if (state.activeScope && state.activeKey !== nextKey) {
342
+ stageBranchRemoval(state, state.activeScope);
343
+ state.activeScope = null;
344
+ }
345
+ const activeScope = state.activeScope ?? createBranchScope(state, nextKey);
346
+ state.activeKey = nextKey;
347
+ state.activeScope = activeScope;
348
+ const renderBranch = selectedMatch?.render ?? state.fallback;
349
+ const vnode = renderBranch ? activeScope.render(renderBranch) : null;
350
+ state.activeVNodes = vnode == null || vnode === false ? [] : [vnode];
351
+ }
352
+ finishImmediateControlTransaction(state, transaction);
353
+ return state.activeVNodes;
354
+ } catch (error) {
355
+ rollbackControlTransaction(state, transaction);
356
+ throw error;
357
+ }
358
+ }
359
+ function clearCaseDomUpdateState(state) {
360
+ if (state.activeScope) state.activeScope.needsDomUpdate = false;
361
+ if (state._transaction) {
362
+ state._transaction.shouldClearDomUpdateState = true;
363
+ return;
364
+ }
365
+ state.lastRemovedNodes = [];
366
+ state.lastRemovedRanges = [];
367
+ }
368
+ //#endregion
369
+ //#region src/runtime/for-signals.ts
370
+ function peekForSignal() {
371
+ return this._value;
372
+ }
373
+ function setForValueSignal(newValue, notifyReaders = true) {
374
+ if (Object.is(this._value, newValue)) return;
375
+ this._value = newValue;
376
+ if (notifyReaders) notifyForSignalReaders(this);
377
+ }
378
+ function setForIndexValue(newValue, notifyReaders = true) {
379
+ const nextValue = typeof newValue === "function" ? newValue(this._value) : newValue;
380
+ if (nextValue === this._value) return;
381
+ this._value = nextValue;
382
+ if (notifyReaders) notifyForSignalReaders(this);
383
+ }
384
+ function notifyForSignalReaders(source, skipInstance, skipOwnedBy) {
385
+ markReadableDerivedSubscribersDirty(source);
386
+ markReactivePropsDirtySource(source);
387
+ notifyReadableReaders(source, skipInstance, skipOwnedBy);
388
+ }
389
+ function createForIndexSignal(initialIndex) {
390
+ function readIndexSignal() {
391
+ const signal = readIndexSignal;
392
+ signal._hasBeenRead = true;
393
+ recordReadableRead(signal);
394
+ return signal._value;
395
+ }
396
+ const indexSignal = readIndexSignal;
397
+ indexSignal._value = initialIndex;
398
+ indexSignal.peek = peekForSignal;
399
+ indexSignal.set = setForIndexValue;
400
+ indexSignal._hasBeenRead = false;
401
+ return indexSignal;
402
+ }
403
+ function syncForIndexSignal(indexSignal, nextIndex) {
404
+ if (indexSignal.peek() === nextIndex) return false;
405
+ indexSignal.set(nextIndex, indexSignal._hasBeenRead);
406
+ return indexSignal._hasBeenRead === true;
407
+ }
408
+ function createForItemSignal(initialItem) {
409
+ function readItemSignal() {
410
+ const signal = readItemSignal;
411
+ signal._hasBeenRead = true;
412
+ recordReadableRead(signal);
413
+ return signal._value;
414
+ }
415
+ const itemSignal = readItemSignal;
416
+ itemSignal._value = initialItem;
417
+ itemSignal.peek = peekForSignal;
418
+ itemSignal.set = setForValueSignal;
419
+ itemSignal._hasBeenRead = false;
420
+ return itemSignal;
421
+ }
422
+ function createForItemPropertySignal(initialValue) {
423
+ function readPropertySignal() {
424
+ const signal = readPropertySignal;
425
+ signal._hasBeenRead = true;
426
+ recordReadableRead(signal);
427
+ return signal._value;
428
+ }
429
+ const propertySignal = readPropertySignal;
430
+ propertySignal._value = initialValue;
431
+ propertySignal.peek = peekForSignal;
432
+ propertySignal.set = setForValueSignal;
433
+ propertySignal._hasBeenRead = false;
434
+ return propertySignal;
435
+ }
436
+ function readForItemProperty(item, prop) {
437
+ return Reflect.get(Object(item), prop);
438
+ }
439
+ function haveSameOwnKeys(previousItem, nextItem) {
440
+ const previousKeys = Reflect.ownKeys(Object(previousItem));
441
+ const nextKeys = Reflect.ownKeys(Object(nextItem));
442
+ if (previousKeys.length !== nextKeys.length) return false;
443
+ for (let i = 0; i < previousKeys.length; i += 1) if (previousKeys[i] !== nextKeys[i]) return false;
444
+ return true;
445
+ }
446
+ function scopeReadsSource(scope, source) {
447
+ const readers = source._readers;
448
+ if (!readers || readers.size === 0) return false;
449
+ for (const reader of readers.keys()) {
450
+ let current = reader;
451
+ while (current) {
452
+ if (current === scope.componentInstance) return true;
453
+ current = current.parentInstance;
454
+ }
455
+ }
456
+ return false;
457
+ }
458
+ function scopeDirectlyReadsSource(scope, source) {
459
+ return source._readers?.has(scope.componentInstance) ?? false;
460
+ }
461
+ function isForParentReader(parentInstance, reader) {
462
+ let current = parentInstance;
463
+ while (current) {
464
+ if (current === reader) return true;
465
+ current = current.parentInstance;
466
+ }
467
+ return false;
468
+ }
469
+ function removeForParentReaders(parentInstance, source) {
470
+ const readers = source._readers;
471
+ if (!readers || readers.size === 0) return;
472
+ for (const reader of readers.keys()) if (isForParentReader(parentInstance, reader)) {
473
+ if (readers.delete(reader) && false);
474
+ }
475
+ }
476
+ function getOrCreateForItemPropertySignal(state, prop) {
477
+ const item = state.currentItem;
478
+ const propertySignals = state.propertySignals ?? (state.propertySignals = /* @__PURE__ */ new Map());
479
+ const existingSignal = propertySignals.get(prop);
480
+ if (existingSignal) return existingSignal;
481
+ const propertySignal = createForItemPropertySignal(readForItemProperty(item, prop));
482
+ propertySignals.set(prop, propertySignal);
483
+ return propertySignal;
484
+ }
485
+ function canProxyForItem(item) {
486
+ return typeof item === "function" || typeof item === "object" && item !== null && !Array.isArray(item);
487
+ }
488
+ function createReactiveForItem(item) {
489
+ const target = Object.create(null);
490
+ const state = {
491
+ currentItem: item,
492
+ itemSignal: null,
493
+ propertySignals: null,
494
+ coalescedProperties: null,
495
+ coalescedProperty2: null,
496
+ wholeItemRead: false,
497
+ proxy: void 0
498
+ };
499
+ target[REACTIVE_FOR_ITEM_STATE] = state;
500
+ state.proxy = new Proxy(target, REACTIVE_FOR_ITEM_PROXY_HANDLER);
501
+ return state;
502
+ }
503
+ const REACTIVE_FOR_ITEM_STATE = Symbol("askr.reactive-for-item-state");
504
+ function getReactiveForItemState(target) {
505
+ return target[REACTIVE_FOR_ITEM_STATE];
506
+ }
507
+ function getWholeItemSignal(state) {
508
+ let signal = state.itemSignal;
509
+ if (!signal) {
510
+ signal = createForItemSignal(state.currentItem);
511
+ state.itemSignal = signal;
512
+ }
513
+ return signal;
514
+ }
515
+ const REACTIVE_FOR_ITEM_PROXY_HANDLER = {
516
+ get(target, prop, receiver) {
517
+ if (prop !== REACTIVE_FOR_ITEM_STATE && prop in target) return Reflect.get(target, prop, receiver);
518
+ const metadata = getReactiveForItemState(target);
519
+ const currentItem = metadata.currentItem;
520
+ if (typeof prop !== "symbol") {
521
+ if (shouldCoalesceFineGrainedItemReads()) {
522
+ const properties = metadata.coalescedProperties;
523
+ if (properties === null) metadata.coalescedProperties = prop;
524
+ else if (Array.isArray(properties)) {
525
+ if (!properties.includes(prop)) properties.push(prop);
526
+ } else if (properties !== prop && metadata.coalescedProperty2 !== prop) if (metadata.coalescedProperty2 === null) metadata.coalescedProperty2 = prop;
527
+ else {
528
+ metadata.coalescedProperties = [
529
+ properties,
530
+ metadata.coalescedProperty2,
531
+ prop
532
+ ];
533
+ metadata.coalescedProperty2 = null;
534
+ }
535
+ let itemSignal = metadata.itemSignal;
536
+ if (!itemSignal) {
537
+ itemSignal = createForItemSignal(currentItem);
538
+ metadata.itemSignal = itemSignal;
539
+ }
540
+ itemSignal();
541
+ return readForItemProperty(currentItem, prop);
542
+ }
543
+ return getOrCreateForItemPropertySignal(metadata, prop)();
544
+ }
545
+ metadata.wholeItemRead = true;
546
+ recordReadableRead(getWholeItemSignal(metadata));
547
+ return Reflect.get(Object(currentItem), prop, receiver);
548
+ },
549
+ has(target, prop) {
550
+ if (prop === REACTIVE_FOR_ITEM_STATE) return false;
551
+ const metadata = getReactiveForItemState(target);
552
+ metadata.wholeItemRead = true;
553
+ recordReadableRead(getWholeItemSignal(metadata));
554
+ return prop in target || prop in Object(metadata.currentItem);
555
+ },
556
+ ownKeys(target) {
557
+ const metadata = getReactiveForItemState(target);
558
+ metadata.wholeItemRead = true;
559
+ recordReadableRead(getWholeItemSignal(metadata));
560
+ const keys = /* @__PURE__ */ new Set();
561
+ for (const key of Reflect.ownKeys(target)) if (key !== REACTIVE_FOR_ITEM_STATE) keys.add(key);
562
+ for (const key of Reflect.ownKeys(Object(metadata.currentItem))) keys.add(key);
563
+ return Array.from(keys);
564
+ },
565
+ getOwnPropertyDescriptor(target, prop) {
566
+ if (prop === REACTIVE_FOR_ITEM_STATE) return;
567
+ const metadata = getReactiveForItemState(target);
568
+ metadata.wholeItemRead = true;
569
+ recordReadableRead(getWholeItemSignal(metadata));
570
+ const ownDescriptor = Reflect.getOwnPropertyDescriptor(target, prop);
571
+ if (ownDescriptor) return ownDescriptor;
572
+ return Object.getOwnPropertyDescriptor(Object(metadata.currentItem), prop);
573
+ },
574
+ getPrototypeOf(target) {
575
+ const metadata = getReactiveForItemState(target);
576
+ metadata.wholeItemRead = true;
577
+ recordReadableRead(getWholeItemSignal(metadata));
578
+ return Object.getPrototypeOf(Object(metadata.currentItem));
579
+ }
580
+ };
581
+ const recordBenchEvent = (_event) => {};
582
+ //#endregion
583
+ //#region src/runtime/for-scopes.ts
584
+ function recordRemovedBoundary(forState, dom, range) {
585
+ if (range && !range.single) forState.lastRemovedRanges.push(range);
586
+ else if (dom) forState.lastRemovedNodes.push(dom);
587
+ }
588
+ function captureRemovedScopeNodes(forState, dom, range) {
589
+ const transaction = forState._transaction;
590
+ if (!transaction) return;
591
+ const nodes = transaction.removedScopeNodes ??= [];
592
+ if (range && !range.single) for (let node = range.start.nextSibling; node && node !== range.end; node = node.nextSibling) nodes.push(node);
593
+ else if (dom) nodes.push(dom);
594
+ }
595
+ function enqueueForScopeUpdate(parent) {
596
+ parent?._enqueueRun?.();
597
+ }
598
+ const forStatesByScope = /* @__PURE__ */ new WeakMap();
599
+ function enqueueForBoundaryScopeCommit() {
600
+ const forState = this.blueprintOwner ?? forStatesByScope.get(this);
601
+ if (!forState) return;
602
+ if (forState._enqueueBoundaryCommit) {
603
+ forState._enqueueBoundaryCommit();
604
+ return;
605
+ }
606
+ enqueueForScopeUpdate(forState.parentInstance);
607
+ }
608
+ function createForOwnedChildScope(forState, key) {
609
+ return createChildScope(forState.parentInstance, key, enqueueForBoundaryScopeCommit, forState._scopeOwnership);
610
+ }
611
+ function captureForItemTransactionSnapshot(forState, itemInstance) {
612
+ const transaction = forState._transaction;
613
+ if (!transaction || transaction.itemSnapshots?.has(itemInstance)) return;
614
+ if (transaction.collectionSnapshotMode === "reset-empty" || transaction.items.get(itemInstance.key) !== itemInstance) return;
615
+ const itemSnapshots = transaction.itemSnapshots ??= /* @__PURE__ */ new Map();
616
+ const propertySignals = itemInstance.reactiveItemState?.propertySignals ?? null;
617
+ const itemSignal = itemInstance.reactiveItemState?.itemSignal ?? null;
618
+ const propertySnapshots = propertySignals && propertySignals.size > 0 ? new Map(Array.from(propertySignals, ([property, signal]) => [property, {
619
+ signal,
620
+ value: signal.peek(),
621
+ hasBeenRead: signal._hasBeenRead === true
622
+ }])) : null;
623
+ itemSnapshots.set(itemInstance, {
624
+ item: itemInstance.item,
625
+ itemSignalExists: itemSignal !== null,
626
+ itemSignalValue: itemSignal?.peek(),
627
+ itemSignalHasBeenRead: itemSignal?._hasBeenRead === true,
628
+ indexValue: itemInstance.indexSignal.peek(),
629
+ indexHasBeenRead: itemInstance.indexSignal._hasBeenRead === true,
630
+ propertySignalStore: propertySignals,
631
+ propertySignals: propertySnapshots,
632
+ scope: captureChildScopeTransactionSnapshot(itemInstance.scope)
633
+ });
634
+ }
635
+ function captureForFallbackTransactionSnapshot(forState, fallbackScope = forState.fallbackScope) {
636
+ const transaction = forState._transaction;
637
+ if (!transaction || !fallbackScope || transaction.fallbackScope !== fallbackScope || transaction.fallbackScopeSnapshot) return;
638
+ transaction.fallbackScopeSnapshot = captureChildScopeTransactionSnapshot(fallbackScope);
639
+ }
640
+ function stageForSignalEffect(forState, source, notify, skipInstance = null, skipOwnedBy = null) {
641
+ const transaction = forState._transaction;
642
+ if (!transaction) return false;
643
+ const effects = transaction.signalEffects ??= /* @__PURE__ */ new Map();
644
+ const existing = effects.get(source);
645
+ if (existing) {
646
+ existing.notify ||= notify;
647
+ if (existing.skipInstance !== skipInstance) existing.skipInstance = null;
648
+ if (existing.skipOwnedBy !== skipOwnedBy) existing.skipOwnedBy = null;
649
+ } else effects.set(source, {
650
+ parentInstance: forState.parentInstance,
651
+ notify,
652
+ skipInstance,
653
+ skipOwnedBy
654
+ });
655
+ return true;
656
+ }
657
+ function syncForItemIndex(forState, itemInstance, nextIndex) {
658
+ const indexSignal = itemInstance.indexSignal;
659
+ const previousIndex = indexSignal.peek();
660
+ if (previousIndex === nextIndex) return false;
661
+ if (indexSignal._hasBeenRead !== true) {
662
+ const transaction = forState._transaction;
663
+ if (transaction) {
664
+ const snapshots = transaction.unreadIndexSnapshots ??= /* @__PURE__ */ new Map();
665
+ if (!snapshots.has(indexSignal)) snapshots.set(indexSignal, previousIndex);
666
+ }
667
+ indexSignal.set(nextIndex, false);
668
+ return false;
669
+ }
670
+ captureForItemTransactionSnapshot(forState, itemInstance);
671
+ const scopeReadsIndex = scopeReadsSource(itemInstance.scope, indexSignal);
672
+ const scopeDirectlyReadsIndex = scopeDirectlyReadsSource(itemInstance.scope, indexSignal);
673
+ if (forState._transaction) {
674
+ const shouldNotify = indexSignal._hasBeenRead === true;
675
+ indexSignal.set(nextIndex, false);
676
+ stageForSignalEffect(forState, indexSignal, shouldNotify, scopeReadsIndex ? itemInstance.scope.componentInstance : null);
677
+ if (!scopeReadsIndex) return false;
678
+ if (scopeDirectlyReadsIndex) rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
679
+ else itemInstance.scope.markDirty();
680
+ return true;
681
+ }
682
+ if (!scopeReadsIndex) {
683
+ syncForIndexSignal(indexSignal, nextIndex);
684
+ return false;
685
+ }
686
+ indexSignal.set(nextIndex, false);
687
+ notifyForSignalReaders(indexSignal, itemInstance.scope.componentInstance);
688
+ rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
689
+ return true;
690
+ }
691
+ function materializeItemVnode(forState, key, vnode) {
692
+ if (vnode && typeof vnode === "object" && "type" in vnode) {
693
+ const vn = vnode;
694
+ vn.key = key;
695
+ if (forState.parentInstance?.ssr && typeof vn.type === "string") {
696
+ if (!vn.props) vn.props = {};
697
+ if (vn.props["data-key"] === void 0) vn.props["data-key"] = String(key);
698
+ if (vn.props["data-askr-key-kind"] === void 0) vn.props["data-askr-key-kind"] = typeof key;
699
+ }
700
+ }
701
+ }
702
+ function renderItemScope(forState, scope, item, indexSignal, key) {
703
+ const vnode = scope.render(() => forState.renderFn(item, indexSignal));
704
+ materializeItemVnode(forState, key, vnode);
705
+ return vnode;
706
+ }
707
+ function disposeItemInstance(forState, itemInstance, domCleanup) {
708
+ const removedDom = itemInstance.scope.dom;
709
+ const removedRange = itemInstance.scope.range;
710
+ const transaction = forState._transaction;
711
+ if (transaction) {
712
+ (transaction.removedScopes ??= []).push(itemInstance.scope);
713
+ captureRemovedScopeNodes(forState, removedDom, removedRange);
714
+ recordRemovedBoundary(forState, removedDom, removedRange);
715
+ return;
716
+ }
717
+ try {
718
+ disposeChildScope(itemInstance.scope);
719
+ } catch (err) {
720
+ if (isDevelopmentEnvironment()) console.error("[For] Cleanup error:", err);
721
+ }
722
+ if (!removedDom) return;
723
+ if (removedDom instanceof Element) {
724
+ if (domCleanup === "teardown") getRuntimeRenderer().teardownNodeSubtree(removedDom);
725
+ }
726
+ recordRemovedBoundary(forState, removedDom, removedRange);
727
+ }
728
+ function createItemInstance(key, item, index, forState) {
729
+ const indexSignal = createForIndexSignal(index);
730
+ const reactiveItemState = canProxyForItem(item) ? createReactiveForItem(item) : null;
731
+ const reactiveItem = reactiveItemState?.proxy ?? item;
732
+ const scope = createForOwnedChildScope(forState, key);
733
+ scope.blueprintOwner = forState;
734
+ try {
735
+ renderItemScope(forState, scope, reactiveItem, indexSignal, key);
736
+ } catch (error) {
737
+ disposeChildScope(scope);
738
+ throw error;
739
+ }
740
+ return {
741
+ key,
742
+ item,
743
+ reactiveItem,
744
+ reactiveItemState,
745
+ indexSignal,
746
+ scope
747
+ };
748
+ }
749
+ function rerenderItemInstance(forState, itemInstance, item) {
750
+ renderItemScope(forState, itemInstance.scope, item, itemInstance.indexSignal, itemInstance.key);
751
+ }
752
+ function updateItemInstance(forState, itemInstance, item) {
753
+ if (itemInstance.item === item) return false;
754
+ captureForItemTransactionSnapshot(forState, itemInstance);
755
+ const previousItem = itemInstance.item;
756
+ itemInstance.item = item;
757
+ const scope = itemInstance.scope;
758
+ let scopeReadsChangedSignal = false;
759
+ const reactiveItemState = itemInstance.reactiveItemState;
760
+ if (!reactiveItemState) {
761
+ rerenderItemInstance(forState, itemInstance, item);
762
+ return true;
763
+ }
764
+ const itemSignal = reactiveItemState.itemSignal;
765
+ reactiveItemState.currentItem = item;
766
+ const propertySignals = reactiveItemState.propertySignals;
767
+ const changedPropertySignals = [];
768
+ if (propertySignals && propertySignals.size > 0) for (const [prop, propertySignal] of propertySignals) {
769
+ const previousValue = readForItemProperty(previousItem, prop);
770
+ const nextValue = readForItemProperty(item, prop);
771
+ if (Object.is(previousValue, nextValue)) continue;
772
+ if (scopeReadsSource(scope, propertySignal)) scopeReadsChangedSignal = true;
773
+ changedPropertySignals.push([propertySignal, nextValue]);
774
+ }
775
+ if (itemSignal && scopeReadsSource(scope, itemSignal)) scopeReadsChangedSignal = true;
776
+ let coalescedPropertyChanged = false;
777
+ const coalescedProperties = reactiveItemState.coalescedProperties;
778
+ if (coalescedProperties !== null) if (Array.isArray(coalescedProperties)) {
779
+ for (const property of coalescedProperties) if (!Object.is(readForItemProperty(previousItem, property), readForItemProperty(item, property))) {
780
+ coalescedPropertyChanged = true;
781
+ break;
782
+ }
783
+ } else {
784
+ coalescedPropertyChanged = !Object.is(readForItemProperty(previousItem, coalescedProperties), readForItemProperty(item, coalescedProperties));
785
+ const secondProperty = reactiveItemState.coalescedProperty2;
786
+ if (secondProperty !== null && !coalescedPropertyChanged) coalescedPropertyChanged = !Object.is(readForItemProperty(previousItem, secondProperty), readForItemProperty(item, secondProperty));
787
+ }
788
+ const wholeItemChanged = itemSignal?._hasBeenRead === true && (reactiveItemState.wholeItemRead || coalescedPropertyChanged);
789
+ const itemShapeChanged = !wholeItemChanged && changedPropertySignals.length === 0 && !haveSameOwnKeys(previousItem, item);
790
+ const notifyReaders = !scopeReadsChangedSignal && (changedPropertySignals.length > 0 || itemShapeChanged || wholeItemChanged);
791
+ const visibleChange = scopeReadsChangedSignal || changedPropertySignals.length > 0 || itemShapeChanged || wholeItemChanged;
792
+ for (const [propertySignal, nextValue] of changedPropertySignals) if (stageForSignalEffect(forState, propertySignal, notifyReaders, null, itemInstance.scope.componentInstance)) propertySignal.set(nextValue, false);
793
+ else {
794
+ removeForParentReaders(forState.parentInstance, propertySignal);
795
+ propertySignal.set(nextValue, notifyReaders);
796
+ }
797
+ if (itemSignal && stageForSignalEffect(forState, itemSignal, notifyReaders, null, itemInstance.scope.componentInstance)) itemSignal.set(item, false);
798
+ else if (itemSignal) {
799
+ removeForParentReaders(forState.parentInstance, itemSignal);
800
+ itemSignal.set(item, notifyReaders);
801
+ }
802
+ if (scopeReadsChangedSignal) if (itemSignal !== null && scopeDirectlyReadsSource(scope, itemSignal) || changedPropertySignals.some(([propertySignal]) => scopeDirectlyReadsSource(scope, propertySignal))) rerenderItemInstance(forState, itemInstance, itemInstance.reactiveItem);
803
+ else scope.markDirty();
804
+ return visibleChange;
805
+ }
806
+ const FOR_FALLBACK_SCOPE_KEY = "__for-fallback__";
807
+ function disposeFallbackScope(forState, domCleanup) {
808
+ const fallbackScope = forState.fallbackScope;
809
+ if (!fallbackScope) return;
810
+ const removedDom = fallbackScope.dom;
811
+ const removedRange = fallbackScope.range;
812
+ const transaction = forState._transaction;
813
+ if (transaction) {
814
+ (transaction.removedScopes ??= []).push(fallbackScope);
815
+ captureRemovedScopeNodes(forState, removedDom, removedRange);
816
+ } else disposeChildScope(fallbackScope);
817
+ forState.fallbackScope = null;
818
+ if (!removedDom) return;
819
+ if (removedDom instanceof Element) {
820
+ if (domCleanup === "teardown") getRuntimeRenderer().teardownNodeSubtree(removedDom);
821
+ }
822
+ recordRemovedBoundary(forState, removedDom, removedRange);
823
+ }
824
+ function renderFallbackScope(forState) {
825
+ if (forState.fallback == null || forState.fallback === false) {
826
+ if (forState.fallbackScope) disposeFallbackScope(forState, "none");
827
+ forState.orderedVNodes = [];
828
+ forState.orderedItems = [];
829
+ return [];
830
+ }
831
+ const fallbackScope = forState.fallbackScope ?? createForOwnedChildScope(forState, FOR_FALLBACK_SCOPE_KEY);
832
+ if (!forState.fallbackScope) forStatesByScope.set(fallbackScope, forState);
833
+ forState.fallbackScope = fallbackScope;
834
+ captureForFallbackTransactionSnapshot(forState, fallbackScope);
835
+ const fallbackVNode = forState.fallback;
836
+ const vnode = fallbackScope.render(() => fallbackVNode);
837
+ forState.orderedVNodes = vnode == null || vnode === false ? [] : [vnode];
838
+ forState.orderedItems = [];
839
+ return forState.orderedVNodes;
840
+ }
841
+ function disposeAllItems(forState, domCleanup) {
842
+ const { items, orderedKeys } = forState;
843
+ if (forState._transaction?.collectionSnapshotMode === "preserve-clear") {
844
+ const transaction = forState._transaction;
845
+ transaction.removeAllItems = true;
846
+ for (let index = 0; index < forState.orderedItems.length; index++) {
847
+ const scope = forState.orderedItems[index]?.scope;
848
+ const removedDom = scope?.dom;
849
+ const range = scope?.range;
850
+ if (scope) captureRemovedScopeNodes(forState, removedDom, range);
851
+ recordRemovedBoundary(forState, removedDom, range);
852
+ }
853
+ forState.items = /* @__PURE__ */ new Map();
854
+ forState.orderedKeys = [];
855
+ return;
856
+ }
857
+ for (let index = 0; index < orderedKeys.length; index += 1) {
858
+ const key = orderedKeys[index];
859
+ const itemInstance = items.get(key);
860
+ if (!itemInstance) continue;
861
+ disposeItemInstance(forState, itemInstance, domCleanup);
862
+ items.delete(key);
863
+ }
864
+ orderedKeys.length = 0;
865
+ forState.orderedKeys = orderedKeys;
866
+ }
867
+ //#endregion
868
+ //#region src/runtime/for-reconcile.ts
869
+ function failForValidation(message) {
870
+ throw new Error(message);
871
+ }
872
+ function validateForKeys(forState, newArray) {
873
+ if (!isDevelopmentEnvironment()) return;
874
+ const seen = /* @__PURE__ */ new Set();
875
+ const keyKinds = /* @__PURE__ */ new Map();
876
+ for (let i = 0; i < newArray.length; i++) {
877
+ const key = forState.byFn(newArray[i], i);
878
+ if (key === null || key === void 0) failForValidation("[askr] Invalid For key detected. Keys should be stable, non-null, and unique within a For list.");
879
+ if (seen.has(key)) failForValidation(`[askr] Duplicate For key detected: ${String(key)}. Keys should be stable, non-null, and unique within a For list.`);
880
+ seen.add(key);
881
+ const keyKind = typeof key;
882
+ const previousKeyKind = forState.devKeyKinds?.get(key);
883
+ if (previousKeyKind && previousKeyKind !== keyKind) failForValidation(`[askr] For key type changed for ${String(key)}. Keys must remain consistently typed across renders.`);
884
+ keyKinds.set(key, keyKind);
885
+ }
886
+ forState.devKeyKinds = keyKinds;
887
+ }
888
+ function reconcileForItems(forState, newArray) {
889
+ forState.currentItems = newArray;
890
+ validateForKeys(forState, newArray);
891
+ const { items, orderedKeys, byFn } = forState;
892
+ const oldLen = orderedKeys.length;
893
+ const newLen = newArray.length;
894
+ forState.lastRemovedNodes = [];
895
+ forState.lastRemovedRanges = [];
896
+ forState.pendingRemovedKey = null;
897
+ if (newLen === 0) {
898
+ if (oldLen > 0) disposeAllItems(forState, forState.fallback ? "teardown" : "none");
899
+ forState.lastCommitStrategy = "TRUNCATE";
900
+ forState.pendingDirtyIndices = null;
901
+ forState.pendingSwapIndices = null;
902
+ forState.pendingMoveOnly = false;
903
+ return renderFallbackScope(forState);
904
+ }
905
+ if (forState.fallbackScope) disposeFallbackScope(forState, "none");
906
+ if (newLen === oldLen + 1) {
907
+ let oldIndex = 0;
908
+ let insertedIndex = -1;
909
+ let insertedKey = null;
910
+ for (let newIndex = 0; newIndex < newLen; newIndex++) {
911
+ const item = newArray[newIndex];
912
+ const key = byFn(item, newIndex);
913
+ const expectedKey = orderedKeys[oldIndex];
914
+ if (oldIndex < oldLen && key === expectedKey) {
915
+ const existing = items.get(key);
916
+ if (!existing || existing.item !== item || existing.scope.needsDomUpdate || oldIndex !== newIndex && existing.indexSignal._hasBeenRead) {
917
+ insertedIndex = -2;
918
+ break;
919
+ }
920
+ oldIndex++;
921
+ } else if (insertedIndex === -1 && !items.has(key)) {
922
+ insertedIndex = newIndex;
923
+ insertedKey = key;
924
+ } else {
925
+ insertedIndex = -2;
926
+ break;
927
+ }
928
+ }
929
+ if (insertedIndex >= 0 && oldIndex === oldLen && insertedKey !== null) {
930
+ const insertedItem = createItemInstance(insertedKey, newArray[insertedIndex], insertedIndex, forState);
931
+ const resultVNodes = forState.orderedVNodes.slice();
932
+ const resultItems = forState.orderedItems.slice();
933
+ const resultKeys = orderedKeys.slice();
934
+ resultVNodes.splice(insertedIndex, 0, insertedItem.scope.vnode);
935
+ resultItems.splice(insertedIndex, 0, insertedItem);
936
+ resultKeys.splice(insertedIndex, 0, insertedKey);
937
+ items.set(insertedKey, insertedItem);
938
+ forState.lastCommitStrategy = "INSERT_ONE";
939
+ forState.orderedKeys = resultKeys;
940
+ forState.orderedItems = resultItems;
941
+ forState.orderedVNodes = resultVNodes;
942
+ forState.pendingDirtyIndices = null;
943
+ forState.pendingSwapIndices = null;
944
+ forState.pendingMoveOnly = false;
945
+ forState.pendingInsertedIndex = insertedIndex;
946
+ return resultVNodes;
947
+ }
948
+ }
949
+ if (oldLen < newLen) {
950
+ let canUseAppendPath = true;
951
+ let canSkipCommittedPrefix = true;
952
+ for (let i = 0; i < oldLen; i++) {
953
+ const key = byFn(newArray[i], i);
954
+ if (key !== orderedKeys[i]) {
955
+ canUseAppendPath = false;
956
+ break;
957
+ }
958
+ const existing = forState.orderedItems[i] ?? items.get(key);
959
+ if (!existing || existing.item !== newArray[i] || existing.scope.needsDomUpdate || existing.scope.hydrationPending) canSkipCommittedPrefix = false;
960
+ }
961
+ if (canUseAppendPath) {
962
+ forState.lastCommitStrategy = "APPEND";
963
+ const resultVNodes = forState.orderedVNodes;
964
+ const resultItems = forState.orderedItems;
965
+ resultVNodes.length = newLen;
966
+ resultItems.length = newLen;
967
+ if (!canSkipCommittedPrefix) for (let i = 0; i < oldLen; i++) {
968
+ const item = newArray[i];
969
+ const key = orderedKeys[i];
970
+ const existing = resultItems[i] ?? items.get(key);
971
+ updateItemInstance(forState, existing, item);
972
+ resultItems[i] = existing;
973
+ resultVNodes[i] = existing.scope.vnode;
974
+ }
975
+ for (let i = oldLen; i < newLen; i++) {
976
+ const item = newArray[i];
977
+ const key = byFn(item, i);
978
+ const itemInstance = createItemInstance(key, item, i, forState);
979
+ items.set(key, itemInstance);
980
+ resultItems[i] = itemInstance;
981
+ resultVNodes[i] = itemInstance.scope.vnode;
982
+ orderedKeys[i] = key;
983
+ }
984
+ forState.orderedVNodes = resultVNodes;
985
+ forState.pendingDirtyIndices = null;
986
+ forState.pendingSwapIndices = null;
987
+ forState.pendingMoveOnly = false;
988
+ forState.pendingAppendStart = canSkipCommittedPrefix ? oldLen : 0;
989
+ return resultVNodes;
990
+ }
991
+ }
992
+ if (newLen < oldLen) {
993
+ if (oldLen === newLen + 1) {
994
+ let removedIndex = -1;
995
+ for (let i = 0; i < newLen; i++) if (byFn(newArray[i], i) !== orderedKeys[i]) {
996
+ removedIndex = i;
997
+ break;
998
+ }
999
+ if (removedIndex !== -1) {
1000
+ let canUseRemoveOnePath = true;
1001
+ for (let i = removedIndex; i < newLen; i++) if (byFn(newArray[i], i) !== orderedKeys[i + 1]) {
1002
+ canUseRemoveOnePath = false;
1003
+ break;
1004
+ }
1005
+ if (canUseRemoveOnePath) {
1006
+ forState.lastCommitStrategy = "REMOVE_ONE";
1007
+ const resultVNodes = forState.orderedVNodes;
1008
+ const resultItems = forState.orderedItems;
1009
+ const removedKey = orderedKeys[removedIndex];
1010
+ const removedItem = resultItems[removedIndex] ?? items.get(removedKey);
1011
+ orderedKeys.copyWithin(removedIndex, removedIndex + 1);
1012
+ resultItems.copyWithin(removedIndex, removedIndex + 1);
1013
+ resultVNodes.copyWithin(removedIndex, removedIndex + 1);
1014
+ orderedKeys.length = newLen;
1015
+ resultItems.length = newLen;
1016
+ resultVNodes.length = newLen;
1017
+ const dirtyIndices = [];
1018
+ for (let i = 0; i < newLen; i++) {
1019
+ const item = newArray[i];
1020
+ const existing = resultItems[i];
1021
+ const scopeNeedsDomUpdate = existing.scope.needsDomUpdate;
1022
+ const itemChanged = existing.item !== item;
1023
+ const indexSignal = existing.indexSignal;
1024
+ const indexChanged = i >= removedIndex && indexSignal.peek() !== i;
1025
+ if (itemChanged) updateItemInstance(forState, existing, item);
1026
+ const indexVisibleChange = indexChanged ? syncForItemIndex(forState, existing, i) : false;
1027
+ if (itemChanged || indexVisibleChange || scopeNeedsDomUpdate) dirtyIndices.push(i);
1028
+ resultVNodes[i] = existing.scope.vnode;
1029
+ }
1030
+ if (removedItem) {
1031
+ disposeItemInstance(forState, removedItem, "teardown");
1032
+ items.delete(removedKey);
1033
+ }
1034
+ forState.pendingRemovedKey = removedKey;
1035
+ forState.pendingDirtyIndices = dirtyIndices;
1036
+ forState.pendingSwapIndices = null;
1037
+ forState.pendingMoveOnly = false;
1038
+ return resultVNodes;
1039
+ }
1040
+ }
1041
+ }
1042
+ let canUseTruncatePath = true;
1043
+ for (let i = 0; i < newLen; i++) if (byFn(newArray[i], i) !== orderedKeys[i]) {
1044
+ canUseTruncatePath = false;
1045
+ break;
1046
+ }
1047
+ if (canUseTruncatePath) {
1048
+ forState.lastCommitStrategy = "TRUNCATE";
1049
+ const resultVNodes = forState.orderedVNodes;
1050
+ const resultItems = forState.orderedItems;
1051
+ resultVNodes.length = newLen;
1052
+ resultItems.length = newLen;
1053
+ const isFullClear = newLen === 0;
1054
+ for (let i = 0; i < newLen; i++) {
1055
+ const item = newArray[i];
1056
+ const key = orderedKeys[i];
1057
+ const existing = items.get(key);
1058
+ updateItemInstance(forState, existing, item);
1059
+ resultItems[i] = existing;
1060
+ resultVNodes[i] = existing.scope.vnode;
1061
+ }
1062
+ for (let i = newLen; i < oldLen; i++) {
1063
+ const key = orderedKeys[i];
1064
+ const itemInstance = items.get(key);
1065
+ if (itemInstance) {
1066
+ disposeItemInstance(forState, itemInstance, isFullClear ? "full-clear" : "teardown");
1067
+ items.delete(key);
1068
+ }
1069
+ }
1070
+ orderedKeys.length = newLen;
1071
+ forState.orderedKeys = orderedKeys;
1072
+ forState.orderedItems.length = newLen;
1073
+ forState.orderedVNodes = resultVNodes;
1074
+ forState.pendingDirtyIndices = null;
1075
+ forState.pendingSwapIndices = null;
1076
+ forState.pendingMoveOnly = false;
1077
+ return resultVNodes;
1078
+ }
1079
+ }
1080
+ if (oldLen === newLen) {
1081
+ let canUseNoReorderPath = true;
1082
+ for (let i = 0; i < oldLen; i++) if (byFn(newArray[i], i) !== orderedKeys[i]) {
1083
+ canUseNoReorderPath = false;
1084
+ break;
1085
+ }
1086
+ if (canUseNoReorderPath) {
1087
+ forState.lastCommitStrategy = "NO_REORDER";
1088
+ const resultVNodes = forState.orderedVNodes;
1089
+ const resultItems = forState.orderedItems;
1090
+ resultVNodes.length = oldLen;
1091
+ resultItems.length = oldLen;
1092
+ const dirtyIndices = [];
1093
+ for (let i = 0; i < oldLen; i++) {
1094
+ const item = newArray[i];
1095
+ const key = orderedKeys[i];
1096
+ const existing = items.get(key);
1097
+ if (existing.item !== item) updateItemInstance(forState, existing, item);
1098
+ if (existing.scope.needsDomUpdate) dirtyIndices.push(i);
1099
+ resultItems[i] = existing;
1100
+ resultVNodes[i] = existing.scope.vnode;
1101
+ }
1102
+ forState.pendingDirtyIndices = dirtyIndices;
1103
+ forState.pendingSwapIndices = null;
1104
+ forState.pendingMoveOnly = false;
1105
+ return resultVNodes;
1106
+ }
1107
+ let firstMismatch = -1;
1108
+ let secondMismatch = -1;
1109
+ let firstMismatchKey = null;
1110
+ let secondMismatchKey = null;
1111
+ let mismatchCount = 0;
1112
+ let canUseSwapPath = true;
1113
+ for (let i = 0; i < oldLen; i++) {
1114
+ const item = newArray[i];
1115
+ const key = byFn(newArray[i], i);
1116
+ if (key === orderedKeys[i]) {
1117
+ const existing = items.get(key);
1118
+ if (existing && existing.item !== item) {
1119
+ canUseSwapPath = false;
1120
+ break;
1121
+ }
1122
+ continue;
1123
+ }
1124
+ mismatchCount++;
1125
+ if (firstMismatch === -1) {
1126
+ firstMismatch = i;
1127
+ firstMismatchKey = key;
1128
+ continue;
1129
+ }
1130
+ if (secondMismatch === -1) {
1131
+ secondMismatch = i;
1132
+ secondMismatchKey = key;
1133
+ continue;
1134
+ }
1135
+ mismatchCount = 3;
1136
+ break;
1137
+ }
1138
+ if (canUseSwapPath && mismatchCount === 2 && firstMismatch !== -1 && secondMismatch !== -1 && firstMismatchKey === orderedKeys[secondMismatch] && secondMismatchKey === orderedKeys[firstMismatch]) {
1139
+ forState.lastCommitStrategy = "SWAP";
1140
+ const nextOrderedKeys = orderedKeys.slice();
1141
+ nextOrderedKeys[firstMismatch] = firstMismatchKey;
1142
+ nextOrderedKeys[secondMismatch] = secondMismatchKey;
1143
+ const resultVNodes = forState.orderedVNodes;
1144
+ const firstExisting = items.get(firstMismatchKey);
1145
+ const secondExisting = items.get(secondMismatchKey);
1146
+ const firstItem = newArray[firstMismatch];
1147
+ const secondItem = newArray[secondMismatch];
1148
+ const nextOrderedItems = forState.orderedItems.slice();
1149
+ nextOrderedItems[firstMismatch] = secondExisting;
1150
+ nextOrderedItems[secondMismatch] = firstExisting;
1151
+ if (firstExisting.item !== firstItem) updateItemInstance(forState, firstExisting, firstItem);
1152
+ if (secondExisting.item !== secondItem) updateItemInstance(forState, secondExisting, secondItem);
1153
+ syncForItemIndex(forState, firstExisting, firstMismatch);
1154
+ syncForItemIndex(forState, secondExisting, secondMismatch);
1155
+ resultVNodes[firstMismatch] = firstExisting.scope.vnode;
1156
+ resultVNodes[secondMismatch] = secondExisting.scope.vnode;
1157
+ forState.orderedKeys = nextOrderedKeys;
1158
+ forState.orderedItems = nextOrderedItems;
1159
+ forState.pendingDirtyIndices = null;
1160
+ forState.pendingSwapIndices = [firstMismatch, secondMismatch];
1161
+ forState.pendingMoveOnly = true;
1162
+ return resultVNodes;
1163
+ }
1164
+ let canUseMoveOnlyPath = true;
1165
+ const moveOnlyKeys = [];
1166
+ const moveOnlyItems = [];
1167
+ const moveOnlyVNodes = [];
1168
+ for (let i = 0; i < oldLen; i++) {
1169
+ const item = newArray[i];
1170
+ const key = byFn(item, i);
1171
+ const existing = items.get(key);
1172
+ if (!existing || existing.item !== item || existing.indexSignal._hasBeenRead && existing.indexSignal.peek() !== i) {
1173
+ canUseMoveOnlyPath = false;
1174
+ break;
1175
+ }
1176
+ moveOnlyKeys[i] = key;
1177
+ moveOnlyItems[i] = existing;
1178
+ moveOnlyVNodes[i] = existing.scope.vnode;
1179
+ }
1180
+ if (canUseMoveOnlyPath) {
1181
+ forState.lastCommitStrategy = "FULL_KEYED";
1182
+ for (let i = 0; i < moveOnlyItems.length; i++) {
1183
+ syncForItemIndex(forState, moveOnlyItems[i], i);
1184
+ moveOnlyVNodes[i] = moveOnlyItems[i].scope.vnode;
1185
+ }
1186
+ forState.orderedKeys = moveOnlyKeys;
1187
+ forState.orderedItems = moveOnlyItems;
1188
+ forState.orderedVNodes = moveOnlyVNodes;
1189
+ forState.pendingDirtyIndices = null;
1190
+ forState.pendingSwapIndices = null;
1191
+ forState.pendingMoveOnly = true;
1192
+ return moveOnlyVNodes;
1193
+ }
1194
+ }
1195
+ forState.lastCommitStrategy = "FULL_KEYED";
1196
+ const toRemove = new Set(orderedKeys);
1197
+ const newOrderedKeys = [];
1198
+ const newOrderedItems = [];
1199
+ const resultVNodes = [];
1200
+ let moveOnly = toRemove.size === newArray.length;
1201
+ for (let i = 0; i < newArray.length; i++) {
1202
+ const item = newArray[i];
1203
+ const key = byFn(item, i);
1204
+ toRemove.delete(key);
1205
+ newOrderedKeys.push(key);
1206
+ const existing = items.get(key);
1207
+ if (!existing) {
1208
+ const itemInstance = createItemInstance(key, item, i, forState);
1209
+ items.set(key, itemInstance);
1210
+ newOrderedItems.push(itemInstance);
1211
+ resultVNodes.push(itemInstance.scope.vnode);
1212
+ } else {
1213
+ const itemChanged = existing.item !== item;
1214
+ const indexChanged = existing.indexSignal.peek() !== i;
1215
+ if (itemChanged) {
1216
+ moveOnly = false;
1217
+ updateItemInstance(forState, existing, item);
1218
+ }
1219
+ if (indexChanged) syncForItemIndex(forState, existing, i);
1220
+ newOrderedItems.push(existing);
1221
+ resultVNodes.push(existing.scope.vnode);
1222
+ }
1223
+ }
1224
+ for (const key of toRemove) {
1225
+ moveOnly = false;
1226
+ const itemInstance = items.get(key);
1227
+ if (itemInstance) {
1228
+ disposeItemInstance(forState, itemInstance, "none");
1229
+ items.delete(key);
1230
+ }
1231
+ }
1232
+ forState.orderedKeys = newOrderedKeys;
1233
+ forState.orderedItems = newOrderedItems;
1234
+ forState.orderedVNodes = resultVNodes;
1235
+ forState.pendingDirtyIndices = null;
1236
+ forState.pendingSwapIndices = null;
1237
+ forState.pendingMoveOnly = moveOnly;
1238
+ return resultVNodes;
1239
+ }
1240
+ //#endregion
1241
+ //#region src/runtime/for-internal.ts
1242
+ /**
1243
+ * For primitive runtime
1244
+ *
1245
+ * Manages For state storage, hook binding, source evaluation,
1246
+ * and DOM update state cleanup.
1247
+ */
1248
+ const forStates = /* @__PURE__ */ new WeakMap();
1249
+ function getForStore(instance) {
1250
+ const generation = instance._ownershipGeneration;
1251
+ let store = forStates.get(generation);
1252
+ if (!store) {
1253
+ store = /* @__PURE__ */ new Map();
1254
+ forStates.set(generation, store);
1255
+ }
1256
+ return store;
1257
+ }
1258
+ function createForState(eachSource, byFn, renderFn, fallback) {
1259
+ const parentInstance = getCurrentInstance();
1260
+ const ownedScopes = /* @__PURE__ */ new Set();
1261
+ let bulkDisposing = false;
1262
+ const scopeOwnership = {
1263
+ add: (scope) => ownedScopes.add(scope),
1264
+ delete: (scope) => bulkDisposing ? false : ownedScopes.delete(scope),
1265
+ bulkDispose(run) {
1266
+ bulkDisposing = true;
1267
+ try {
1268
+ run();
1269
+ } finally {
1270
+ bulkDisposing = false;
1271
+ ownedScopes.clear();
1272
+ }
1273
+ }
1274
+ };
1275
+ if (parentInstance) registerOwnedChildScope(parentInstance, {
1276
+ key: "for-boundary",
1277
+ dispose() {
1278
+ scopeOwnership.bulkDispose(() => {
1279
+ const errors = [];
1280
+ for (const scope of ownedScopes) try {
1281
+ scope.dispose();
1282
+ } catch (error) {
1283
+ errors.push(error);
1284
+ }
1285
+ if (errors.length > 0) throw new AggregateError(errors, "For scope cleanup failed");
1286
+ });
1287
+ }
1288
+ });
1289
+ return {
1290
+ kind: "for",
1291
+ currentItems: [],
1292
+ _committedItems: [],
1293
+ eachSource,
1294
+ fallback,
1295
+ fallbackScope: null,
1296
+ items: /* @__PURE__ */ new Map(),
1297
+ orderedKeys: [],
1298
+ orderedItems: [],
1299
+ orderedVNodes: [],
1300
+ byFn,
1301
+ renderFn,
1302
+ parentInstance,
1303
+ lastCommitStrategy: "NO_REORDER",
1304
+ lastRemovedNodes: [],
1305
+ lastRemovedRanges: [],
1306
+ pendingDirtyIndices: null,
1307
+ pendingSwapIndices: null,
1308
+ pendingMoveOnly: false,
1309
+ pendingInsertedIndex: null,
1310
+ pendingRemovedKey: null,
1311
+ pendingAppendStart: null,
1312
+ _hasResolvedItemDom: false,
1313
+ _needsSourceReconcile: false,
1314
+ _sourceEffect: null,
1315
+ _suspendSourceCommit: false,
1316
+ _enqueueBoundaryCommit: null,
1317
+ _scopeOwnership: scopeOwnership,
1318
+ _hasPendingBoundaryCommit: false,
1319
+ _transaction: null
1320
+ };
1321
+ }
1322
+ function useForState(eachSource, byFn, renderFn, fallback) {
1323
+ const instance = getCurrentInstance();
1324
+ if (!instance) throw new Error("For can only be created during component render execution.");
1325
+ const hookIndex = claimHookIndex(instance, "For");
1326
+ const generation = instance._ownershipGeneration;
1327
+ const store = getForStore(instance);
1328
+ const existing = store.get(hookIndex);
1329
+ if (existing) {
1330
+ existing.eachSource = eachSource;
1331
+ existing.byFn = byFn;
1332
+ existing.renderFn = renderFn;
1333
+ existing.fallback = fallback;
1334
+ return existing;
1335
+ }
1336
+ const created = createForState(eachSource, byFn, renderFn, fallback);
1337
+ store.set(hookIndex, created);
1338
+ (instance.cleanupFns ??= []).push(() => {
1339
+ created._sourceEffect?.cleanup();
1340
+ created._sourceEffect = null;
1341
+ store.delete(hookIndex);
1342
+ if (store.size === 0 && forStates.get(generation) === store) forStates.delete(generation);
1343
+ });
1344
+ return created;
1345
+ }
1346
+ function evaluateForState(forState) {
1347
+ if (!Array.isArray(forState.currentItems)) throw new Error("For source must evaluate to an array");
1348
+ beginForStateTransaction(forState);
1349
+ forState._needsSourceReconcile = false;
1350
+ try {
1351
+ return reconcileForItems(forState, forState.currentItems);
1352
+ } catch (error) {
1353
+ rollbackForStateTransaction(forState);
1354
+ throw error;
1355
+ }
1356
+ }
1357
+ /**
1358
+ * Reconciliation changes ownership before DOM work can fail. Keep a private
1359
+ * structural snapshot until the boundary has committed so failed work cannot
1360
+ * leave provisional child scopes in the parent owner graph.
1361
+ */
1362
+ function beginForStateTransaction(forState, collectionMode = "auto") {
1363
+ if (forState._transaction) return;
1364
+ const hasEmptyCollections = forState.items.size === 0 && forState.orderedKeys.length === 0 && forState.orderedItems.length === 0 && forState.orderedVNodes.length === 0;
1365
+ const isFullClear = forState.currentItems.length === 0 && forState.orderedKeys.length > 0;
1366
+ const collectionSnapshotMode = collectionMode === "reuse" ? "reuse" : hasEmptyCollections ? "reset-empty" : isFullClear ? "preserve-clear" : "copy";
1367
+ const transaction = {
1368
+ collectionSnapshotMode,
1369
+ currentItems: forState._committedItems,
1370
+ items: collectionSnapshotMode === "copy" ? new Map(forState.items) : forState.items,
1371
+ orderedKeys: collectionSnapshotMode === "copy" ? forState.orderedKeys.slice() : forState.orderedKeys,
1372
+ orderedItems: collectionSnapshotMode === "copy" ? forState.orderedItems.slice() : forState.orderedItems,
1373
+ orderedVNodes: collectionSnapshotMode === "copy" ? forState.orderedVNodes.slice() : forState.orderedVNodes,
1374
+ fallbackScope: forState.fallbackScope,
1375
+ lastCommitStrategy: forState.lastCommitStrategy,
1376
+ lastRemovedNodes: forState.lastRemovedNodes,
1377
+ lastRemovedRanges: forState.lastRemovedRanges,
1378
+ pendingDirtyIndices: forState.pendingDirtyIndices,
1379
+ pendingSwapIndices: forState.pendingSwapIndices,
1380
+ pendingMoveOnly: forState.pendingMoveOnly,
1381
+ pendingInsertedIndex: forState.pendingInsertedIndex,
1382
+ pendingRemovedKey: forState.pendingRemovedKey,
1383
+ pendingAppendStart: forState.pendingAppendStart,
1384
+ hasResolvedItemDom: forState._hasResolvedItemDom,
1385
+ needsSourceReconcile: forState._needsSourceReconcile,
1386
+ devKeyKinds: forState.devKeyKinds,
1387
+ itemSnapshots: null,
1388
+ unreadIndexSnapshots: null,
1389
+ fallbackScopeSnapshot: null,
1390
+ removedScopes: null,
1391
+ removedScopeNodes: null,
1392
+ removeAllItems: false,
1393
+ signalEffects: null,
1394
+ shouldClearDomUpdateState: false
1395
+ };
1396
+ forState._transaction = transaction;
1397
+ registerForStateTransaction(forState, transaction);
1398
+ }
1399
+ function registerForStateTransaction(forState, transaction = forState._transaction) {
1400
+ if (!transaction || forState._transaction !== transaction) return false;
1401
+ return registerLifecycleTransaction(transaction, () => commitForStateTransaction(forState, transaction), () => rollbackForStateTransaction(forState, transaction));
1402
+ }
1403
+ function finalizeForStateRemovals(forState, transaction) {
1404
+ const removedScopes = transaction.removedScopes;
1405
+ if (!transaction.removeAllItems && !removedScopes) return;
1406
+ const cleanupErrors = [];
1407
+ const finalizeScope = (scope) => {
1408
+ const removedDom = scope.dom;
1409
+ const removedRange = scope.range;
1410
+ try {
1411
+ disposeChildScope(scope);
1412
+ } catch (error) {
1413
+ cleanupErrors.push(error);
1414
+ }
1415
+ if (transaction.removedScopeNodes) return;
1416
+ if (typeof Element !== "undefined" && removedDom instanceof Element) try {
1417
+ getRuntimeRenderer().teardownNodeSubtree(removedDom);
1418
+ } catch (error) {
1419
+ cleanupErrors.push(error);
1420
+ }
1421
+ if (removedRange && !removedRange.single) for (let node = removedRange.start.nextSibling; node && node !== removedRange.end;) {
1422
+ const next = node.nextSibling;
1423
+ try {
1424
+ getRuntimeRenderer().teardownNodeSubtree(node);
1425
+ } catch (error) {
1426
+ cleanupErrors.push(error);
1427
+ }
1428
+ node = next;
1429
+ }
1430
+ };
1431
+ if (transaction.removeAllItems) forState._scopeOwnership.bulkDispose(() => {
1432
+ for (let index = 0; index < transaction.orderedItems.length; index++) {
1433
+ const item = transaction.orderedItems[index];
1434
+ if (item) finalizeScope(item.scope);
1435
+ }
1436
+ });
1437
+ for (const scope of removedScopes ?? []) finalizeScope(scope);
1438
+ const removedScopeNodes = transaction.removedScopeNodes;
1439
+ if (removedScopeNodes) for (const node of removedScopeNodes) try {
1440
+ getRuntimeRenderer().teardownNodeSubtree(node);
1441
+ } catch (error) {
1442
+ cleanupErrors.push(error);
1443
+ }
1444
+ if (removedScopes) removedScopes.length = 0;
1445
+ if (removedScopeNodes) removedScopeNodes.length = 0;
1446
+ transaction.removeAllItems = false;
1447
+ if (cleanupErrors.length > 0) logger.error("[Askr] For removal cleanup failed:", new AggregateError(cleanupErrors, "For removal cleanup failed"));
1448
+ }
1449
+ function finalizeForSignalEffects(transaction) {
1450
+ if (!transaction.signalEffects) return;
1451
+ for (const [source, effect] of transaction.signalEffects) {
1452
+ removeForParentReaders(effect.parentInstance, source);
1453
+ if (effect.notify) notifyForSignalReaders(source, effect.skipInstance, effect.skipOwnedBy);
1454
+ }
1455
+ transaction.signalEffects.clear();
1456
+ }
1457
+ function finalizeForDomUpdateFlags(forState) {
1458
+ for (let index = 0; index < forState.orderedItems.length; index++) {
1459
+ const item = forState.orderedItems[index];
1460
+ if (item) item.scope.needsDomUpdate = false;
1461
+ }
1462
+ if (forState.fallbackScope) forState.fallbackScope.needsDomUpdate = false;
1463
+ }
1464
+ function commitForStateTransaction(forState, transaction = forState._transaction) {
1465
+ if (!transaction || forState._transaction !== transaction) return;
1466
+ try {
1467
+ finalizeForStateRemovals(forState, transaction);
1468
+ finalizeForSignalEffects(transaction);
1469
+ if (transaction.shouldClearDomUpdateState) finalizeForDomUpdateFlags(forState);
1470
+ } finally {
1471
+ transaction.itemSnapshots?.clear();
1472
+ transaction.unreadIndexSnapshots?.clear();
1473
+ transaction.fallbackScopeSnapshot = null;
1474
+ forState._committedItems = forState.currentItems;
1475
+ forState._transaction = null;
1476
+ }
1477
+ }
1478
+ function rollbackForStateTransaction(forState, transaction = forState._transaction) {
1479
+ if (!transaction || forState._transaction !== transaction) return;
1480
+ const rollbackCleanupErrors = [];
1481
+ const scopesToDispose = /* @__PURE__ */ new Set();
1482
+ const committedScopes = transaction.collectionSnapshotMode === "reset-empty" ? null : new Set(transaction.orderedItems.map((item) => item.scope));
1483
+ if (transaction.fallbackScope) committedScopes?.add(transaction.fallbackScope);
1484
+ if (transaction.collectionSnapshotMode === "reset-empty") for (const item of forState.items.values()) scopesToDispose.add(item.scope);
1485
+ else for (const [key, item] of forState.items) if (transaction.items.get(key) !== item) scopesToDispose.add(item.scope);
1486
+ for (const scope of transaction.removedScopes ?? []) if (scope !== transaction.fallbackScope && !committedScopes?.has(scope)) scopesToDispose.add(scope);
1487
+ if (forState.fallbackScope && forState.fallbackScope !== transaction.fallbackScope) scopesToDispose.add(forState.fallbackScope);
1488
+ for (const scope of scopesToDispose) try {
1489
+ disposeChildScope(scope);
1490
+ } catch (error) {
1491
+ rollbackCleanupErrors.push(error);
1492
+ }
1493
+ if (transaction.collectionSnapshotMode === "reset-empty") {
1494
+ forState.items.clear();
1495
+ forState.orderedKeys.length = 0;
1496
+ forState.orderedItems.length = 0;
1497
+ forState.orderedVNodes.length = 0;
1498
+ }
1499
+ for (const [itemInstance, snapshot] of transaction.itemSnapshots ?? []) {
1500
+ itemInstance.item = snapshot.item;
1501
+ const reactiveItemState = itemInstance.reactiveItemState;
1502
+ if (reactiveItemState) reactiveItemState.currentItem = snapshot.item;
1503
+ const itemSignal = reactiveItemState?.itemSignal;
1504
+ if (itemSignal && snapshot.itemSignalExists) {
1505
+ itemSignal.set(snapshot.itemSignalValue, false);
1506
+ itemSignal._hasBeenRead = snapshot.itemSignalHasBeenRead;
1507
+ }
1508
+ itemInstance.indexSignal.set(snapshot.indexValue, false);
1509
+ itemInstance.indexSignal._hasBeenRead = snapshot.indexHasBeenRead;
1510
+ const propertySignals = snapshot.propertySignalStore;
1511
+ if (reactiveItemState) reactiveItemState.propertySignals = propertySignals;
1512
+ if (propertySignals) {
1513
+ propertySignals.clear();
1514
+ for (const [property, propertySnapshot] of snapshot.propertySignals ?? []) {
1515
+ propertySnapshot.signal.set(propertySnapshot.value, false);
1516
+ propertySnapshot.signal._hasBeenRead = propertySnapshot.hasBeenRead;
1517
+ propertySignals.set(property, propertySnapshot.signal);
1518
+ }
1519
+ }
1520
+ restoreChildScopeTransactionSnapshot(itemInstance.scope, snapshot.scope);
1521
+ }
1522
+ for (const [indexSignal, index] of transaction.unreadIndexSnapshots ?? []) indexSignal.set(index, false);
1523
+ if (transaction.fallbackScope && transaction.fallbackScopeSnapshot) restoreChildScopeTransactionSnapshot(transaction.fallbackScope, transaction.fallbackScopeSnapshot);
1524
+ forState.currentItems = transaction.currentItems;
1525
+ forState._committedItems = transaction.currentItems;
1526
+ forState.items = transaction.items;
1527
+ forState.orderedKeys = transaction.orderedKeys;
1528
+ forState.orderedItems = transaction.orderedItems;
1529
+ forState.orderedVNodes = transaction.orderedVNodes;
1530
+ forState.fallbackScope = transaction.fallbackScope;
1531
+ forState.lastCommitStrategy = transaction.lastCommitStrategy;
1532
+ forState.lastRemovedNodes = transaction.lastRemovedNodes;
1533
+ forState.lastRemovedRanges = transaction.lastRemovedRanges;
1534
+ forState.pendingDirtyIndices = transaction.pendingDirtyIndices;
1535
+ forState.pendingSwapIndices = transaction.pendingSwapIndices;
1536
+ forState.pendingMoveOnly = transaction.pendingMoveOnly;
1537
+ forState.pendingInsertedIndex = transaction.pendingInsertedIndex;
1538
+ forState.pendingRemovedKey = transaction.pendingRemovedKey;
1539
+ forState.pendingAppendStart = transaction.pendingAppendStart;
1540
+ forState._hasResolvedItemDom = transaction.hasResolvedItemDom;
1541
+ forState._needsSourceReconcile = transaction.needsSourceReconcile;
1542
+ forState.devKeyKinds = transaction.devKeyKinds;
1543
+ forState._transaction = null;
1544
+ if (rollbackCleanupErrors.length > 0) logger.error("[Askr] transaction rollback cleanup failed:", new AggregateError(rollbackCleanupErrors, "Transaction rollback cleanup failed"));
1545
+ }
1546
+ function clearForDomUpdateState(forState) {
1547
+ const transaction = forState._transaction;
1548
+ if (transaction) transaction.shouldClearDomUpdateState = true;
1549
+ if (transaction && !registerForStateTransaction(forState, transaction)) commitForStateTransaction(forState, transaction);
1550
+ if (!transaction) finalizeForDomUpdateFlags(forState);
1551
+ forState.lastRemovedNodes = [];
1552
+ forState.lastRemovedRanges = [];
1553
+ forState.pendingDirtyIndices = null;
1554
+ forState.pendingSwapIndices = null;
1555
+ forState.pendingMoveOnly = false;
1556
+ forState.pendingInsertedIndex = null;
1557
+ forState.pendingRemovedKey = null;
1558
+ forState.pendingAppendStart = null;
1559
+ forState._needsSourceReconcile = false;
1560
+ forState._hasResolvedItemDom = forState.orderedKeys.length > 0;
1561
+ }
1562
+ //#endregion
1563
+ export { createChildScope as _, registerForStateTransaction as a, captureForFallbackTransactionSnapshot as c, clearCaseDomUpdateState as d, clearShowDomUpdateState as f, evaluateShowState as g, evaluateCaseState as h, evaluateForState as i, captureForItemTransactionSnapshot as l, createShowState as m, clearForDomUpdateState as n, rollbackForStateTransaction as o, createCaseState as p, commitForStateTransaction as r, useForState as s, beginForStateTransaction as t, recordBenchEvent as u, disposeChildScope as v, rerenderChildScope as y };