marko 5.37.6 → 6.0.0-3.11

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 (648) hide show
  1. package/dist/common/attr-tag.d.ts +8 -0
  2. package/dist/common/compat-meta.d.ts +2 -0
  3. package/dist/common/for.d.ts +5 -0
  4. package/dist/common/helpers.d.ts +7 -0
  5. package/dist/common/meta.d.ts +2 -0
  6. package/dist/common/types.d.ts +105 -0
  7. package/dist/debug/dom.js +2111 -0
  8. package/dist/debug/dom.mjs +2088 -0
  9. package/dist/debug/html.js +2740 -0
  10. package/dist/debug/html.mjs +2663 -0
  11. package/dist/dom/abort-signal.d.ts +3 -0
  12. package/dist/dom/compat.d.ts +20 -0
  13. package/dist/dom/control-flow.d.ts +14 -0
  14. package/dist/dom/controllable.d.ts +12 -0
  15. package/dist/dom/dom.d.ts +19 -0
  16. package/dist/dom/event.d.ts +4 -0
  17. package/dist/dom/parse-html.d.ts +5 -0
  18. package/dist/dom/queue.d.ts +10 -0
  19. package/dist/dom/reconcile.d.ts +2 -0
  20. package/dist/dom/renderer.d.ts +21 -0
  21. package/dist/dom/resolve-cursor-position.d.ts +1 -0
  22. package/dist/dom/resume.d.ts +9 -0
  23. package/dist/dom/schedule.d.ts +2 -0
  24. package/dist/dom/scope.d.ts +7 -0
  25. package/dist/dom/signals.d.ts +39 -0
  26. package/dist/dom/template.d.ts +3 -0
  27. package/dist/dom/walker.d.ts +4 -0
  28. package/dist/dom.d.ts +15 -0
  29. package/dist/dom.js +1370 -0
  30. package/dist/dom.mjs +1350 -0
  31. package/dist/html/attrs.d.ts +14 -0
  32. package/dist/html/compat.d.ts +14 -0
  33. package/dist/html/content.d.ts +5 -0
  34. package/dist/html/dynamic-tag.d.ts +12 -0
  35. package/dist/html/for.d.ts +4 -0
  36. package/dist/html/inlined-runtimes.d.ts +2 -0
  37. package/dist/html/serializer.d.ts +14 -0
  38. package/dist/html/template.d.ts +3 -0
  39. package/dist/html/writer.d.ts +114 -0
  40. package/dist/html.d.ts +9 -0
  41. package/dist/html.js +1818 -0
  42. package/dist/html.mjs +1744 -0
  43. package/dist/translator/core/attrs.d.ts +3 -0
  44. package/dist/translator/core/client.d.ts +14 -0
  45. package/dist/translator/core/const.d.ts +3 -0
  46. package/dist/translator/core/debug.d.ts +3 -0
  47. package/dist/translator/core/define.d.ts +3 -0
  48. package/dist/translator/core/effect.d.ts +3 -0
  49. package/dist/translator/core/export.d.ts +3 -0
  50. package/dist/translator/core/for.d.ts +67 -0
  51. package/dist/translator/core/html-comment.d.ts +12 -0
  52. package/dist/translator/core/html-script.d.ts +9 -0
  53. package/dist/translator/core/html-style.d.ts +9 -0
  54. package/dist/translator/core/id.d.ts +3 -0
  55. package/dist/translator/core/if.d.ts +53 -0
  56. package/dist/translator/core/import.d.ts +3 -0
  57. package/dist/translator/core/index.d.ts +152 -0
  58. package/dist/translator/core/let.d.ts +8 -0
  59. package/dist/translator/core/lifecycle.d.ts +10 -0
  60. package/dist/translator/core/log.d.ts +3 -0
  61. package/dist/translator/core/return.d.ts +6 -0
  62. package/dist/translator/core/script.d.ts +3 -0
  63. package/dist/translator/core/server.d.ts +14 -0
  64. package/dist/translator/core/static.d.ts +14 -0
  65. package/dist/translator/core/style.d.ts +3 -0
  66. package/dist/translator/index.d.ts +201 -0
  67. package/dist/translator/index.js +9134 -490
  68. package/dist/translator/util/assert.d.ts +3 -0
  69. package/dist/translator/util/binding-has-downstream-expressions.d.ts +2 -0
  70. package/dist/translator/util/entry-builder.d.ts +19 -0
  71. package/dist/translator/util/evaluate.d.ts +11 -0
  72. package/dist/translator/util/for-each-identifier.d.ts +2 -0
  73. package/dist/translator/util/get-defined-binding-expression.d.ts +3 -0
  74. package/dist/translator/util/get-known-attr-values.d.ts +2 -0
  75. package/dist/translator/util/get-parent-tag.d.ts +2 -0
  76. package/dist/translator/util/get-root.d.ts +7 -0
  77. package/dist/translator/util/get-tag-name.d.ts +2 -0
  78. package/dist/translator/util/is-core-tag.d.ts +10 -0
  79. package/dist/translator/util/is-stateful.d.ts +3 -0
  80. package/dist/translator/util/is-static.d.ts +2 -0
  81. package/dist/translator/util/marko-config.d.ts +4 -0
  82. package/dist/translator/util/nested-attribute-tags.d.ts +17 -0
  83. package/dist/translator/util/normalize-string-expression.d.ts +3 -0
  84. package/dist/translator/util/optional.d.ts +20 -0
  85. package/dist/translator/util/plugin-hooks.d.ts +4 -0
  86. package/dist/translator/util/references.d.ts +84 -0
  87. package/dist/translator/util/runtime-info.d.ts +5 -0
  88. package/dist/translator/util/runtime.d.ts +15 -0
  89. package/dist/translator/util/scope-read.d.ts +6 -0
  90. package/dist/translator/util/sections.d.ts +51 -0
  91. package/dist/translator/util/signals.d.ts +61 -0
  92. package/dist/translator/util/simplify-fn.d.ts +5 -0
  93. package/dist/translator/util/state.d.ts +3 -0
  94. package/dist/translator/util/tag-name-type.d.ts +16 -0
  95. package/dist/translator/util/to-first-expression-or-block.d.ts +3 -0
  96. package/dist/translator/util/to-first-statement-or-block.d.ts +2 -0
  97. package/dist/translator/util/to-property-name.d.ts +7 -0
  98. package/dist/translator/util/translate-attrs.d.ts +12 -0
  99. package/dist/translator/util/translate-var.d.ts +2 -0
  100. package/dist/translator/util/traverse.d.ts +9 -0
  101. package/dist/translator/util/visitors.d.ts +11 -0
  102. package/dist/translator/util/walks.d.ts +15 -0
  103. package/dist/translator/util/with-previous-location.d.ts +2 -0
  104. package/dist/translator/util/writer.d.ts +13 -0
  105. package/dist/translator/visitors/cdata.d.ts +7 -0
  106. package/dist/translator/visitors/comment.d.ts +7 -0
  107. package/dist/translator/visitors/declaration.d.ts +7 -0
  108. package/dist/translator/visitors/document-type.d.ts +7 -0
  109. package/dist/translator/visitors/function.d.ts +19 -0
  110. package/dist/translator/visitors/import-declaration.d.ts +8 -0
  111. package/dist/translator/visitors/placeholder.d.ts +22 -0
  112. package/dist/translator/visitors/program/dom.d.ts +7 -0
  113. package/dist/translator/visitors/program/html.d.ts +8 -0
  114. package/dist/translator/visitors/program/index.d.ts +39 -0
  115. package/dist/translator/visitors/referenced-identifier.d.ts +7 -0
  116. package/dist/translator/visitors/scriptlet.d.ts +8 -0
  117. package/dist/translator/visitors/tag/attribute-tag.d.ts +11 -0
  118. package/dist/translator/visitors/tag/custom-tag.d.ts +19 -0
  119. package/dist/translator/visitors/tag/dynamic-tag.d.ts +18 -0
  120. package/dist/translator/visitors/tag/index.d.ts +15 -0
  121. package/dist/translator/visitors/tag/native-tag.d.ts +25 -0
  122. package/dist/translator/visitors/text.d.ts +7 -0
  123. package/package.json +34 -70
  124. package/tag-types/const.d.marko +7 -0
  125. package/tag-types/debug.d.marko +5 -0
  126. package/tag-types/define.d.marko +5 -0
  127. package/tag-types/do.d.marko +5 -0
  128. package/tag-types/effect.d.marko +5 -0
  129. package/tag-types/id.d.marko +3 -0
  130. package/tag-types/let.d.marko +8 -0
  131. package/tag-types/lifecycle.d.marko +7 -0
  132. package/tag-types/log.d.marko +5 -0
  133. package/tag-types/script.d.marko +5 -0
  134. package/README.md +0 -161
  135. package/bin/markoc +0 -2
  136. package/bin/markoc.js +0 -441
  137. package/browser-refresh.js +0 -5
  138. package/compiler-browser.marko +0 -15
  139. package/compiler.js +0 -7
  140. package/components-browser.marko +0 -15
  141. package/components.js +0 -7
  142. package/dist/build.json +0 -3
  143. package/dist/compiler/config.js +0 -45
  144. package/dist/compiler/index.js +0 -164
  145. package/dist/compiler/modules.js +0 -5
  146. package/dist/core-tags/components/init-components-tag.js +0 -54
  147. package/dist/core-tags/components/preferred-script-location-tag.js +0 -25
  148. package/dist/core-tags/components/preserve-tag.js +0 -1
  149. package/dist/core-tags/core/__flush_here_and_after__.js +0 -44
  150. package/dist/core-tags/core/await/AsyncValue.js +0 -121
  151. package/dist/core-tags/core/await/client-reorder-runtime.js +0 -51
  152. package/dist/core-tags/core/await/index.d.marko +0 -10
  153. package/dist/core-tags/core/await/renderer.js +0 -249
  154. package/dist/core-tags/core/await/reorderer-renderer.js +0 -156
  155. package/dist/index.js +0 -4
  156. package/dist/node-require/browser-refresh.js +0 -1
  157. package/dist/node-require/hot-reload.js +0 -45
  158. package/dist/node-require/index.js +0 -103
  159. package/dist/node_modules/@internal/components-beginComponent/index-browser.js +0 -23
  160. package/dist/node_modules/@internal/components-beginComponent/index.js +0 -84
  161. package/dist/node_modules/@internal/components-beginComponent/package.json +0 -11
  162. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -335
  163. package/dist/node_modules/@internal/components-define-widget-legacy/index.js +0 -18
  164. package/dist/node_modules/@internal/components-define-widget-legacy/package.json +0 -11
  165. package/dist/node_modules/@internal/components-endComponent/index-browser.js +0 -5
  166. package/dist/node_modules/@internal/components-endComponent/index.js +0 -11
  167. package/dist/node_modules/@internal/components-endComponent/package.json +0 -11
  168. package/dist/node_modules/@internal/components-entry/index-browser.js +0 -11
  169. package/dist/node_modules/@internal/components-entry/index.js +0 -301
  170. package/dist/node_modules/@internal/components-entry/package.json +0 -11
  171. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -76
  172. package/dist/node_modules/@internal/components-entry-legacy/index.js +0 -16
  173. package/dist/node_modules/@internal/components-entry-legacy/package.json +0 -11
  174. package/dist/node_modules/@internal/components-registry/index-browser.js +0 -586
  175. package/dist/node_modules/@internal/components-registry/index.js +0 -44
  176. package/dist/node_modules/@internal/components-registry/package.json +0 -11
  177. package/dist/node_modules/@internal/components-util/index-browser.js +0 -152
  178. package/dist/node_modules/@internal/components-util/index.js +0 -71
  179. package/dist/node_modules/@internal/components-util/package.json +0 -11
  180. package/dist/node_modules/@internal/create-readable/index-browser.js +0 -30
  181. package/dist/node_modules/@internal/create-readable/index.js +0 -57
  182. package/dist/node_modules/@internal/create-readable/package.json +0 -11
  183. package/dist/node_modules/@internal/loader/fallback-node.js +0 -89
  184. package/dist/node_modules/@internal/loader/index-browser.js +0 -2
  185. package/dist/node_modules/@internal/loader/index.js +0 -23
  186. package/dist/node_modules/@internal/loader/package.json +0 -10
  187. package/dist/node_modules/@internal/preserve-tag/index-browser.js +0 -46
  188. package/dist/node_modules/@internal/preserve-tag/index.js +0 -34
  189. package/dist/node_modules/@internal/preserve-tag/package.json +0 -11
  190. package/dist/node_modules/@internal/require/index-browser.js +0 -15
  191. package/dist/node_modules/@internal/require/index-legacy-browser.js +0 -20
  192. package/dist/node_modules/@internal/require/index-webpack.js +0 -16
  193. package/dist/node_modules/@internal/require/index.js +0 -15
  194. package/dist/node_modules/@internal/require/package.json +0 -11
  195. package/dist/node_modules/@internal/set-immediate/index-browser.js +0 -19
  196. package/dist/node_modules/@internal/set-immediate/index-worker.js +0 -31
  197. package/dist/node_modules/@internal/set-immediate/index.js +0 -3
  198. package/dist/node_modules/@internal/set-immediate/package.json +0 -11
  199. package/dist/node_modules/@internal/set-immediate/queueMicrotask.js +0 -8
  200. package/dist/runtime/RenderResult.js +0 -112
  201. package/dist/runtime/components/Component.js +0 -663
  202. package/dist/runtime/components/ComponentDef.js +0 -169
  203. package/dist/runtime/components/ComponentsContext.js +0 -59
  204. package/dist/runtime/components/GlobalComponentsContext.js +0 -10
  205. package/dist/runtime/components/KeySequence.js +0 -16
  206. package/dist/runtime/components/ServerComponent.js +0 -73
  207. package/dist/runtime/components/State.js +0 -101
  208. package/dist/runtime/components/attach-detach.js +0 -60
  209. package/dist/runtime/components/defineComponent.js +0 -60
  210. package/dist/runtime/components/dom-data.js +0 -8
  211. package/dist/runtime/components/event-delegation.js +0 -144
  212. package/dist/runtime/components/index.js +0 -1
  213. package/dist/runtime/components/legacy/browser.json +0 -9
  214. package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -27
  215. package/dist/runtime/components/legacy/defineRenderer-legacy.js +0 -171
  216. package/dist/runtime/components/legacy/defineWidget-legacy.js +0 -1
  217. package/dist/runtime/components/legacy/dependencies/html.js +0 -3
  218. package/dist/runtime/components/legacy/dependencies/index.js +0 -177
  219. package/dist/runtime/components/legacy/dependencies/vdom.js +0 -3
  220. package/dist/runtime/components/legacy/index.js +0 -1
  221. package/dist/runtime/components/legacy/jquery.js +0 -52
  222. package/dist/runtime/components/legacy/ready.js +0 -152
  223. package/dist/runtime/components/legacy/renderer-legacy.js +0 -231
  224. package/dist/runtime/components/registry.js +0 -1
  225. package/dist/runtime/components/renderer.js +0 -236
  226. package/dist/runtime/components/update-manager.js +0 -94
  227. package/dist/runtime/createOut.js +0 -13
  228. package/dist/runtime/dom-insert.js +0 -77
  229. package/dist/runtime/events.js +0 -2
  230. package/dist/runtime/helpers/_change-case.js +0 -45
  231. package/dist/runtime/helpers/assign.js +0 -21
  232. package/dist/runtime/helpers/attr-tag.js +0 -43
  233. package/dist/runtime/helpers/class-value.js +0 -30
  234. package/dist/runtime/helpers/dynamic-tag.js +0 -181
  235. package/dist/runtime/helpers/empty-component.js +0 -1
  236. package/dist/runtime/helpers/merge.js +0 -13
  237. package/dist/runtime/helpers/of-fallback.js +0 -4
  238. package/dist/runtime/helpers/render-tag.js +0 -20
  239. package/dist/runtime/helpers/serialize-noop.js +0 -5
  240. package/dist/runtime/helpers/style-value.js +0 -45
  241. package/dist/runtime/helpers/tags-compat/dom-debug.js +0 -1
  242. package/dist/runtime/helpers/tags-compat/dom-debug.mjs +0 -4
  243. package/dist/runtime/helpers/tags-compat/dom.js +0 -1
  244. package/dist/runtime/helpers/tags-compat/dom.mjs +0 -4
  245. package/dist/runtime/helpers/tags-compat/html-debug.js +0 -3
  246. package/dist/runtime/helpers/tags-compat/html-debug.mjs +0 -4
  247. package/dist/runtime/helpers/tags-compat/html.js +0 -3
  248. package/dist/runtime/helpers/tags-compat/html.mjs +0 -4
  249. package/dist/runtime/helpers/tags-compat/runtime-dom.js +0 -239
  250. package/dist/runtime/helpers/tags-compat/runtime-html.js +0 -136
  251. package/dist/runtime/helpers/to-string.js +0 -5
  252. package/dist/runtime/html/AsyncStream.js +0 -805
  253. package/dist/runtime/html/BufferedWriter.js +0 -52
  254. package/dist/runtime/html/StringWriter.js +0 -73
  255. package/dist/runtime/html/helpers/_dynamic-attr.js +0 -35
  256. package/dist/runtime/html/helpers/attr.js +0 -80
  257. package/dist/runtime/html/helpers/attrs.js +0 -26
  258. package/dist/runtime/html/helpers/class-attr.js +0 -8
  259. package/dist/runtime/html/helpers/data-marko.js +0 -36
  260. package/dist/runtime/html/helpers/escape-quotes.js +0 -35
  261. package/dist/runtime/html/helpers/escape-script-placeholder.js +0 -24
  262. package/dist/runtime/html/helpers/escape-style-placeholder.js +0 -22
  263. package/dist/runtime/html/helpers/escape-xml.js +0 -21
  264. package/dist/runtime/html/helpers/merge-attrs.js +0 -55
  265. package/dist/runtime/html/helpers/props-script.js +0 -32
  266. package/dist/runtime/html/helpers/style-attr.js +0 -8
  267. package/dist/runtime/html/hot-reload.js +0 -26
  268. package/dist/runtime/html/index.js +0 -33
  269. package/dist/runtime/html/marko-namespace.js +0 -3
  270. package/dist/runtime/renderable.js +0 -194
  271. package/dist/runtime/vdom/AsyncVDOMBuilder.js +0 -456
  272. package/dist/runtime/vdom/VComment.js +0 -24
  273. package/dist/runtime/vdom/VComponent.js +0 -17
  274. package/dist/runtime/vdom/VDocumentFragment.js +0 -34
  275. package/dist/runtime/vdom/VElement.js +0 -375
  276. package/dist/runtime/vdom/VFragment.js +0 -26
  277. package/dist/runtime/vdom/VNode.js +0 -100
  278. package/dist/runtime/vdom/VText.js +0 -25
  279. package/dist/runtime/vdom/helpers/attrs.js +0 -62
  280. package/dist/runtime/vdom/helpers/const-element.js +0 -25
  281. package/dist/runtime/vdom/helpers/merge-attrs.js +0 -16
  282. package/dist/runtime/vdom/hot-reload.js +0 -115
  283. package/dist/runtime/vdom/index.js +0 -30
  284. package/dist/runtime/vdom/is-text-only.js +0 -10
  285. package/dist/runtime/vdom/marko-namespace.js +0 -3
  286. package/dist/runtime/vdom/morphdom/fragment.js +0 -95
  287. package/dist/runtime/vdom/morphdom/helpers.js +0 -42
  288. package/dist/runtime/vdom/morphdom/index.js +0 -741
  289. package/dist/runtime/vdom/parse-html.js +0 -18
  290. package/dist/runtime/vdom/vdom.js +0 -88
  291. package/dist/taglib/index.js +0 -51
  292. package/dist/translator/cdata/index.js +0 -15
  293. package/dist/translator/cdata/index[html].js +0 -15
  294. package/dist/translator/cdata/index[vdom].js +0 -12
  295. package/dist/translator/class.js +0 -65
  296. package/dist/translator/comment/index.js +0 -15
  297. package/dist/translator/comment/index[html].js +0 -17
  298. package/dist/translator/comment/index[vdom].js +0 -3
  299. package/dist/translator/declaration/index.js +0 -15
  300. package/dist/translator/declaration/index[html].js +0 -12
  301. package/dist/translator/declaration/index[vdom].js +0 -3
  302. package/dist/translator/document-type/index.js +0 -15
  303. package/dist/translator/document-type/index[html].js +0 -12
  304. package/dist/translator/document-type/index[vdom].js +0 -3
  305. package/dist/translator/placeholder/index.js +0 -15
  306. package/dist/translator/placeholder/index[html].js +0 -93
  307. package/dist/translator/placeholder/index[vdom].js +0 -22
  308. package/dist/translator/scriptlet.js +0 -4
  309. package/dist/translator/tag/attribute/directives/class.js +0 -42
  310. package/dist/translator/tag/attribute/directives/index.js +0 -15
  311. package/dist/translator/tag/attribute/directives/no-update-body-if.js +0 -15
  312. package/dist/translator/tag/attribute/directives/no-update-body.js +0 -10
  313. package/dist/translator/tag/attribute/directives/no-update-if.js +0 -12
  314. package/dist/translator/tag/attribute/directives/no-update.js +0 -48
  315. package/dist/translator/tag/attribute/directives/style.js +0 -42
  316. package/dist/translator/tag/attribute/index.js +0 -150
  317. package/dist/translator/tag/attribute/modifiers/index.js +0 -7
  318. package/dist/translator/tag/attribute/modifiers/no-update.js +0 -14
  319. package/dist/translator/tag/attribute/modifiers/scoped.js +0 -23
  320. package/dist/translator/tag/attribute-tag.js +0 -149
  321. package/dist/translator/tag/custom-tag.js +0 -146
  322. package/dist/translator/tag/dynamic-tag.js +0 -74
  323. package/dist/translator/tag/index.js +0 -287
  324. package/dist/translator/tag/macro-tag.js +0 -7
  325. package/dist/translator/tag/native-tag.js +0 -27
  326. package/dist/translator/tag/native-tag[html]/attributes.js +0 -151
  327. package/dist/translator/tag/native-tag[html]/index.js +0 -221
  328. package/dist/translator/tag/native-tag[vdom]/attributes.js +0 -105
  329. package/dist/translator/tag/native-tag[vdom]/index.js +0 -189
  330. package/dist/translator/tag/util.js +0 -246
  331. package/dist/translator/taglib/core/conditional/translate-else-if.js +0 -20
  332. package/dist/translator/taglib/core/conditional/translate-else.js +0 -20
  333. package/dist/translator/taglib/core/conditional/translate-if.js +0 -8
  334. package/dist/translator/taglib/core/conditional/util.js +0 -41
  335. package/dist/translator/taglib/core/index.js +0 -474
  336. package/dist/translator/taglib/core/macro/parse.js +0 -17
  337. package/dist/translator/taglib/core/macro/translate.js +0 -48
  338. package/dist/translator/taglib/core/parse-class.js +0 -79
  339. package/dist/translator/taglib/core/parse-export.js +0 -14
  340. package/dist/translator/taglib/core/parse-import.js +0 -14
  341. package/dist/translator/taglib/core/parse-module-code.js +0 -18
  342. package/dist/translator/taglib/core/parse-static.js +0 -18
  343. package/dist/translator/taglib/core/transform-style.js +0 -66
  344. package/dist/translator/taglib/core/translate-await.js +0 -41
  345. package/dist/translator/taglib/core/translate-body.js +0 -17
  346. package/dist/translator/taglib/core/translate-for.js +0 -156
  347. package/dist/translator/taglib/core/translate-html-comment.js +0 -52
  348. package/dist/translator/taglib/core/translate-include-content.js +0 -53
  349. package/dist/translator/taglib/core/translate-server-only.js +0 -5
  350. package/dist/translator/taglib/core/translate-while.js +0 -32
  351. package/dist/translator/taglib/index.js +0 -6
  352. package/dist/translator/taglib/migrate/all-templates.js +0 -46
  353. package/dist/translator/taglib/migrate/index.js +0 -5
  354. package/dist/translator/text/index.js +0 -10
  355. package/dist/translator/text/index[html].js +0 -12
  356. package/dist/translator/text/index[vdom].js +0 -20
  357. package/dist/translator/util/add-dependencies.js +0 -329
  358. package/dist/translator/util/escape-regexp.js +0 -4
  359. package/dist/translator/util/get-component-files.js +0 -86
  360. package/dist/translator/util/html-out-write.js +0 -15
  361. package/dist/translator/util/key-manager.js +0 -176
  362. package/dist/translator/util/optimize-html-writes.js +0 -52
  363. package/dist/translator/util/optimize-vdom-create.js +0 -164
  364. package/dist/translator/util/plugin-hooks.js +0 -22
  365. package/dist/translator/util/runtime-flags.js +0 -3
  366. package/dist/translator/util/vdom-out-write.js +0 -10
  367. package/dist/translator/util/with-previous-location.js +0 -6
  368. package/docs/10-awesome-marko-features.md +0 -291
  369. package/docs/body-content.md +0 -355
  370. package/docs/class-components.md +0 -1001
  371. package/docs/cloudflare-workers.md +0 -32
  372. package/docs/compiler-hooks.png +0 -0
  373. package/docs/compiler.md +0 -473
  374. package/docs/component-diagram.afdesign +0 -0
  375. package/docs/component-diagram.svg +0 -87
  376. package/docs/concise.md +0 -141
  377. package/docs/conditionals-and-lists.md +0 -72
  378. package/docs/core-tags.md +0 -325
  379. package/docs/custom-tags.md +0 -201
  380. package/docs/editor-plugins.md +0 -45
  381. package/docs/events.md +0 -131
  382. package/docs/express.md +0 -66
  383. package/docs/fastify.md +0 -65
  384. package/docs/getting-started.md +0 -95
  385. package/docs/http.md +0 -34
  386. package/docs/icons/js.svg +0 -4
  387. package/docs/icons/marko.svg +0 -1
  388. package/docs/icons/ts.svg +0 -1
  389. package/docs/installing.md +0 -51
  390. package/docs/koa.md +0 -35
  391. package/docs/lasso.md +0 -196
  392. package/docs/marko-5-upgrade.md +0 -59
  393. package/docs/marko-json.md +0 -248
  394. package/docs/marko-vs-react.md +0 -854
  395. package/docs/redux.md +0 -61
  396. package/docs/rendering.md +0 -268
  397. package/docs/rollup.md +0 -352
  398. package/docs/state.md +0 -105
  399. package/docs/structure.json +0 -49
  400. package/docs/styles.md +0 -29
  401. package/docs/syntax.md +0 -601
  402. package/docs/troubleshooting-streaming.md +0 -68
  403. package/docs/typescript.md +0 -406
  404. package/docs/vite.md +0 -86
  405. package/docs/webpack.md +0 -205
  406. package/docs/why-is-marko-fast.md +0 -239
  407. package/env.js +0 -7
  408. package/helpers/README.md +0 -3
  409. package/helpers/empty.js +0 -4
  410. package/helpers/notEmpty.js +0 -11
  411. package/index-browser.marko +0 -15
  412. package/index.d.ts +0 -375
  413. package/index.js +0 -7
  414. package/legacy-components-browser.marko +0 -15
  415. package/legacy-components.js +0 -7
  416. package/node-require.js +0 -8
  417. package/src/build.json +0 -3
  418. package/src/compiler/config.js +0 -45
  419. package/src/compiler/index.js +0 -164
  420. package/src/compiler/modules.js +0 -5
  421. package/src/core-tags/.eslintrc +0 -5
  422. package/src/core-tags/components/init-components-tag.js +0 -54
  423. package/src/core-tags/components/preferred-script-location-tag.js +0 -25
  424. package/src/core-tags/components/preserve-tag.js +0 -1
  425. package/src/core-tags/core/__flush_here_and_after__.js +0 -44
  426. package/src/core-tags/core/await/AsyncValue.js +0 -121
  427. package/src/core-tags/core/await/client-reorder-runtime.js +0 -51
  428. package/src/core-tags/core/await/index.d.marko +0 -10
  429. package/src/core-tags/core/await/renderer.js +0 -249
  430. package/src/core-tags/core/await/reorderer-renderer.js +0 -156
  431. package/src/index.js +0 -4
  432. package/src/node-require/browser-refresh.js +0 -18
  433. package/src/node-require/hot-reload.js +0 -45
  434. package/src/node-require/index.js +0 -103
  435. package/src/node_modules/@internal/components-beginComponent/index-browser.js +0 -23
  436. package/src/node_modules/@internal/components-beginComponent/index.js +0 -84
  437. package/src/node_modules/@internal/components-beginComponent/package.json +0 -11
  438. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -335
  439. package/src/node_modules/@internal/components-define-widget-legacy/index.js +0 -18
  440. package/src/node_modules/@internal/components-define-widget-legacy/package.json +0 -11
  441. package/src/node_modules/@internal/components-endComponent/index-browser.js +0 -5
  442. package/src/node_modules/@internal/components-endComponent/index.js +0 -11
  443. package/src/node_modules/@internal/components-endComponent/package.json +0 -11
  444. package/src/node_modules/@internal/components-entry/index-browser.js +0 -11
  445. package/src/node_modules/@internal/components-entry/index.js +0 -301
  446. package/src/node_modules/@internal/components-entry/package.json +0 -11
  447. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -76
  448. package/src/node_modules/@internal/components-entry-legacy/index.js +0 -16
  449. package/src/node_modules/@internal/components-entry-legacy/package.json +0 -11
  450. package/src/node_modules/@internal/components-registry/index-browser.js +0 -586
  451. package/src/node_modules/@internal/components-registry/index.js +0 -44
  452. package/src/node_modules/@internal/components-registry/package.json +0 -11
  453. package/src/node_modules/@internal/components-util/index-browser.js +0 -152
  454. package/src/node_modules/@internal/components-util/index.js +0 -75
  455. package/src/node_modules/@internal/components-util/package.json +0 -11
  456. package/src/node_modules/@internal/create-readable/index-browser.js +0 -30
  457. package/src/node_modules/@internal/create-readable/index.js +0 -57
  458. package/src/node_modules/@internal/create-readable/package.json +0 -11
  459. package/src/node_modules/@internal/loader/fallback-node.js +0 -89
  460. package/src/node_modules/@internal/loader/index-browser.js +0 -2
  461. package/src/node_modules/@internal/loader/index.js +0 -23
  462. package/src/node_modules/@internal/loader/package.json +0 -10
  463. package/src/node_modules/@internal/preserve-tag/index-browser.js +0 -46
  464. package/src/node_modules/@internal/preserve-tag/index.js +0 -34
  465. package/src/node_modules/@internal/preserve-tag/package.json +0 -11
  466. package/src/node_modules/@internal/require/index-browser.js +0 -15
  467. package/src/node_modules/@internal/require/index-legacy-browser.js +0 -20
  468. package/src/node_modules/@internal/require/index-webpack.js +0 -16
  469. package/src/node_modules/@internal/require/index.js +0 -15
  470. package/src/node_modules/@internal/require/package.json +0 -11
  471. package/src/node_modules/@internal/set-immediate/index-browser.js +0 -19
  472. package/src/node_modules/@internal/set-immediate/index-worker.js +0 -31
  473. package/src/node_modules/@internal/set-immediate/index.js +0 -3
  474. package/src/node_modules/@internal/set-immediate/package.json +0 -11
  475. package/src/node_modules/@internal/set-immediate/queueMicrotask.js +0 -8
  476. package/src/runtime/.eslintrc +0 -5
  477. package/src/runtime/RenderResult.js +0 -112
  478. package/src/runtime/components/Component.js +0 -663
  479. package/src/runtime/components/ComponentDef.js +0 -169
  480. package/src/runtime/components/ComponentsContext.js +0 -59
  481. package/src/runtime/components/GlobalComponentsContext.js +0 -10
  482. package/src/runtime/components/KeySequence.js +0 -16
  483. package/src/runtime/components/ServerComponent.js +0 -73
  484. package/src/runtime/components/State.js +0 -101
  485. package/src/runtime/components/attach-detach.js +0 -60
  486. package/src/runtime/components/defineComponent.js +0 -60
  487. package/src/runtime/components/dom-data.js +0 -8
  488. package/src/runtime/components/event-delegation.js +0 -144
  489. package/src/runtime/components/index.js +0 -1
  490. package/src/runtime/components/legacy/browser.json +0 -9
  491. package/src/runtime/components/legacy/defineComponent-legacy.js +0 -27
  492. package/src/runtime/components/legacy/defineRenderer-legacy.js +0 -171
  493. package/src/runtime/components/legacy/defineWidget-legacy.js +0 -1
  494. package/src/runtime/components/legacy/dependencies/html.js +0 -3
  495. package/src/runtime/components/legacy/dependencies/index.js +0 -177
  496. package/src/runtime/components/legacy/dependencies/vdom.js +0 -3
  497. package/src/runtime/components/legacy/index.js +0 -1
  498. package/src/runtime/components/legacy/jquery.js +0 -52
  499. package/src/runtime/components/legacy/ready.js +0 -152
  500. package/src/runtime/components/legacy/renderer-legacy.js +0 -231
  501. package/src/runtime/components/registry.js +0 -1
  502. package/src/runtime/components/renderer.js +0 -236
  503. package/src/runtime/components/update-manager.js +0 -94
  504. package/src/runtime/createOut.js +0 -13
  505. package/src/runtime/dom-insert.js +0 -77
  506. package/src/runtime/events.js +0 -2
  507. package/src/runtime/helpers/_change-case.js +0 -45
  508. package/src/runtime/helpers/assign.js +0 -21
  509. package/src/runtime/helpers/attr-tag.js +0 -43
  510. package/src/runtime/helpers/class-value.js +0 -30
  511. package/src/runtime/helpers/dynamic-tag.js +0 -181
  512. package/src/runtime/helpers/empty-component.js +0 -1
  513. package/src/runtime/helpers/merge.js +0 -13
  514. package/src/runtime/helpers/of-fallback.js +0 -4
  515. package/src/runtime/helpers/render-tag.js +0 -20
  516. package/src/runtime/helpers/serialize-noop.js +0 -5
  517. package/src/runtime/helpers/style-value.js +0 -45
  518. package/src/runtime/helpers/tags-compat/dom-debug.js +0 -1
  519. package/src/runtime/helpers/tags-compat/dom-debug.mjs +0 -4
  520. package/src/runtime/helpers/tags-compat/dom.js +0 -1
  521. package/src/runtime/helpers/tags-compat/dom.mjs +0 -4
  522. package/src/runtime/helpers/tags-compat/html-debug.js +0 -3
  523. package/src/runtime/helpers/tags-compat/html-debug.mjs +0 -4
  524. package/src/runtime/helpers/tags-compat/html.js +0 -3
  525. package/src/runtime/helpers/tags-compat/html.mjs +0 -4
  526. package/src/runtime/helpers/tags-compat/runtime-dom.js +0 -239
  527. package/src/runtime/helpers/tags-compat/runtime-html.js +0 -136
  528. package/src/runtime/helpers/to-string.js +0 -5
  529. package/src/runtime/html/AsyncStream.js +0 -805
  530. package/src/runtime/html/BufferedWriter.js +0 -52
  531. package/src/runtime/html/StringWriter.js +0 -73
  532. package/src/runtime/html/helpers/_dynamic-attr.js +0 -35
  533. package/src/runtime/html/helpers/attr.js +0 -80
  534. package/src/runtime/html/helpers/attrs.js +0 -26
  535. package/src/runtime/html/helpers/class-attr.js +0 -8
  536. package/src/runtime/html/helpers/data-marko.js +0 -36
  537. package/src/runtime/html/helpers/escape-quotes.js +0 -35
  538. package/src/runtime/html/helpers/escape-script-placeholder.js +0 -24
  539. package/src/runtime/html/helpers/escape-style-placeholder.js +0 -22
  540. package/src/runtime/html/helpers/escape-xml.js +0 -21
  541. package/src/runtime/html/helpers/merge-attrs.js +0 -55
  542. package/src/runtime/html/helpers/props-script.js +0 -32
  543. package/src/runtime/html/helpers/style-attr.js +0 -8
  544. package/src/runtime/html/hot-reload.js +0 -26
  545. package/src/runtime/html/index.js +0 -33
  546. package/src/runtime/html/marko-namespace.js +0 -3
  547. package/src/runtime/renderable.js +0 -194
  548. package/src/runtime/vdom/AsyncVDOMBuilder.js +0 -456
  549. package/src/runtime/vdom/VComment.js +0 -24
  550. package/src/runtime/vdom/VComponent.js +0 -17
  551. package/src/runtime/vdom/VDocumentFragment.js +0 -34
  552. package/src/runtime/vdom/VElement.js +0 -375
  553. package/src/runtime/vdom/VFragment.js +0 -26
  554. package/src/runtime/vdom/VNode.js +0 -100
  555. package/src/runtime/vdom/VText.js +0 -25
  556. package/src/runtime/vdom/helpers/attrs.js +0 -62
  557. package/src/runtime/vdom/helpers/const-element.js +0 -25
  558. package/src/runtime/vdom/helpers/merge-attrs.js +0 -16
  559. package/src/runtime/vdom/hot-reload.js +0 -115
  560. package/src/runtime/vdom/index.js +0 -30
  561. package/src/runtime/vdom/is-text-only.js +0 -10
  562. package/src/runtime/vdom/marko-namespace.js +0 -3
  563. package/src/runtime/vdom/morphdom/fragment.js +0 -95
  564. package/src/runtime/vdom/morphdom/helpers.js +0 -42
  565. package/src/runtime/vdom/morphdom/index.js +0 -741
  566. package/src/runtime/vdom/parse-html.js +0 -18
  567. package/src/runtime/vdom/vdom.js +0 -88
  568. package/src/taglib/index.js +0 -51
  569. package/src/translator/cdata/index.js +0 -15
  570. package/src/translator/cdata/index[html].js +0 -15
  571. package/src/translator/cdata/index[vdom].js +0 -12
  572. package/src/translator/class.js +0 -65
  573. package/src/translator/comment/index.js +0 -15
  574. package/src/translator/comment/index[html].js +0 -17
  575. package/src/translator/comment/index[vdom].js +0 -3
  576. package/src/translator/declaration/index.js +0 -15
  577. package/src/translator/declaration/index[html].js +0 -12
  578. package/src/translator/declaration/index[vdom].js +0 -3
  579. package/src/translator/document-type/index.js +0 -15
  580. package/src/translator/document-type/index[html].js +0 -12
  581. package/src/translator/document-type/index[vdom].js +0 -3
  582. package/src/translator/index.js +0 -552
  583. package/src/translator/placeholder/index.js +0 -15
  584. package/src/translator/placeholder/index[html].js +0 -93
  585. package/src/translator/placeholder/index[vdom].js +0 -22
  586. package/src/translator/scriptlet.js +0 -4
  587. package/src/translator/tag/attribute/directives/class.js +0 -42
  588. package/src/translator/tag/attribute/directives/index.js +0 -15
  589. package/src/translator/tag/attribute/directives/no-update-body-if.js +0 -15
  590. package/src/translator/tag/attribute/directives/no-update-body.js +0 -10
  591. package/src/translator/tag/attribute/directives/no-update-if.js +0 -12
  592. package/src/translator/tag/attribute/directives/no-update.js +0 -48
  593. package/src/translator/tag/attribute/directives/style.js +0 -42
  594. package/src/translator/tag/attribute/index.js +0 -150
  595. package/src/translator/tag/attribute/modifiers/index.js +0 -7
  596. package/src/translator/tag/attribute/modifiers/no-update.js +0 -14
  597. package/src/translator/tag/attribute/modifiers/scoped.js +0 -23
  598. package/src/translator/tag/attribute-tag.js +0 -149
  599. package/src/translator/tag/custom-tag.js +0 -146
  600. package/src/translator/tag/dynamic-tag.js +0 -74
  601. package/src/translator/tag/index.js +0 -287
  602. package/src/translator/tag/macro-tag.js +0 -7
  603. package/src/translator/tag/native-tag.js +0 -27
  604. package/src/translator/tag/native-tag[html]/attributes.js +0 -151
  605. package/src/translator/tag/native-tag[html]/index.js +0 -221
  606. package/src/translator/tag/native-tag[vdom]/attributes.js +0 -105
  607. package/src/translator/tag/native-tag[vdom]/index.js +0 -189
  608. package/src/translator/tag/util.js +0 -246
  609. package/src/translator/taglib/core/conditional/translate-else-if.js +0 -20
  610. package/src/translator/taglib/core/conditional/translate-else.js +0 -20
  611. package/src/translator/taglib/core/conditional/translate-if.js +0 -8
  612. package/src/translator/taglib/core/conditional/util.js +0 -41
  613. package/src/translator/taglib/core/index.js +0 -474
  614. package/src/translator/taglib/core/macro/parse.js +0 -17
  615. package/src/translator/taglib/core/macro/translate.js +0 -48
  616. package/src/translator/taglib/core/parse-class.js +0 -79
  617. package/src/translator/taglib/core/parse-export.js +0 -14
  618. package/src/translator/taglib/core/parse-import.js +0 -14
  619. package/src/translator/taglib/core/parse-module-code.js +0 -18
  620. package/src/translator/taglib/core/parse-static.js +0 -18
  621. package/src/translator/taglib/core/transform-style.js +0 -66
  622. package/src/translator/taglib/core/translate-await.js +0 -41
  623. package/src/translator/taglib/core/translate-body.js +0 -17
  624. package/src/translator/taglib/core/translate-for.js +0 -156
  625. package/src/translator/taglib/core/translate-html-comment.js +0 -52
  626. package/src/translator/taglib/core/translate-include-content.js +0 -53
  627. package/src/translator/taglib/core/translate-server-only.js +0 -5
  628. package/src/translator/taglib/core/translate-while.js +0 -32
  629. package/src/translator/taglib/index.js +0 -7
  630. package/src/translator/taglib/migrate/all-templates.js +0 -46
  631. package/src/translator/taglib/migrate/index.js +0 -5
  632. package/src/translator/text/index.js +0 -10
  633. package/src/translator/text/index[html].js +0 -12
  634. package/src/translator/text/index[vdom].js +0 -20
  635. package/src/translator/util/add-dependencies.js +0 -329
  636. package/src/translator/util/escape-regexp.js +0 -4
  637. package/src/translator/util/get-component-files.js +0 -86
  638. package/src/translator/util/html-out-write.js +0 -15
  639. package/src/translator/util/key-manager.js +0 -176
  640. package/src/translator/util/optimize-html-writes.js +0 -52
  641. package/src/translator/util/optimize-vdom-create.js +0 -164
  642. package/src/translator/util/plugin-hooks.js +0 -22
  643. package/src/translator/util/runtime-flags.js +0 -3
  644. package/src/translator/util/vdom-out-write.js +0 -10
  645. package/src/translator/util/with-previous-location.js +0 -6
  646. package/tags-html.d.ts +0 -3855
  647. package/translator/index.d.ts +0 -7
  648. package/translator/package.json +0 -5
@@ -0,0 +1,2088 @@
1
+ // src/common/attr-tag.ts
2
+ var empty = [];
3
+ var rest = true ? Symbol("Attribute Tag") : Symbol();
4
+ function attrTag(attrs2) {
5
+ attrs2[Symbol.iterator] = attrTagIterator;
6
+ attrs2[rest] = empty;
7
+ return attrs2;
8
+ }
9
+ function attrTags(first, attrs2) {
10
+ if (first) {
11
+ if (first[rest] === empty) {
12
+ first[rest] = [attrs2];
13
+ } else {
14
+ first[rest].push(attrs2);
15
+ }
16
+ return first;
17
+ }
18
+ return attrTag(attrs2);
19
+ }
20
+ function* attrTagIterator() {
21
+ yield this;
22
+ yield* this[rest];
23
+ }
24
+
25
+ // src/common/for.ts
26
+ function forIn(obj, cb) {
27
+ for (const key in obj) {
28
+ cb(key, obj[key]);
29
+ }
30
+ }
31
+ function forOf(list, cb) {
32
+ if (list) {
33
+ let i = 0;
34
+ for (const item of list) {
35
+ cb(item, i++);
36
+ }
37
+ }
38
+ }
39
+ function forTo(to, from, step, cb) {
40
+ const start = from || 0;
41
+ const delta = step || 1;
42
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
43
+ cb(start + i * delta);
44
+ }
45
+ }
46
+
47
+ // src/dom/schedule.ts
48
+ var runTask;
49
+ var port2 = /* @__PURE__ */ (() => {
50
+ const { port1, port2: port22 } = new MessageChannel();
51
+ port1.onmessage = () => {
52
+ isScheduled = false;
53
+ if (true) {
54
+ const run2 = runTask;
55
+ runTask = void 0;
56
+ run2();
57
+ } else {
58
+ run();
59
+ }
60
+ };
61
+ return port22;
62
+ })();
63
+ var isScheduled;
64
+ function schedule() {
65
+ if (!isScheduled) {
66
+ if (true) {
67
+ if (console.createTask) {
68
+ const task = console.createTask("queue");
69
+ runTask = () => task.run(run);
70
+ } else {
71
+ runTask = run;
72
+ }
73
+ }
74
+ isScheduled = true;
75
+ queueMicrotask(flushAndWaitFrame);
76
+ }
77
+ }
78
+ function flushAndWaitFrame() {
79
+ if (true) {
80
+ runTask();
81
+ } else {
82
+ run();
83
+ }
84
+ requestAnimationFrame(triggerMacroTask);
85
+ }
86
+ function triggerMacroTask() {
87
+ port2.postMessage(0);
88
+ }
89
+
90
+ // src/common/meta.ts
91
+ var DEFAULT_RUNTIME_ID = "M";
92
+ var DEFAULT_RENDER_ID = "_";
93
+
94
+ // src/dom/scope.ts
95
+ var debugID = 0;
96
+ function createScope($global) {
97
+ const scope = {
98
+ ___client: 1,
99
+ $global
100
+ };
101
+ if (true) {
102
+ scope.___debugId = debugID++;
103
+ }
104
+ return scope;
105
+ }
106
+ var emptyScope = createScope({});
107
+ function getEmptyScope(marker) {
108
+ emptyScope.___startNode = emptyScope.___endNode = marker;
109
+ return emptyScope;
110
+ }
111
+ function destroyScope(scope) {
112
+ _destroyScope(scope);
113
+ scope.___cleanupOwner?.___cleanup?.delete(scope);
114
+ const closureSignals = scope.___renderer?.___closureSignals;
115
+ if (closureSignals) {
116
+ for (const signal of closureSignals) {
117
+ signal.___unsubscribe?.(scope);
118
+ }
119
+ }
120
+ return scope;
121
+ }
122
+ function _destroyScope(scope) {
123
+ scope.___cleanup?.forEach(_destroyScope);
124
+ const controllers = scope.___abortControllers;
125
+ if (controllers) {
126
+ for (const ctrl of controllers.values()) {
127
+ ctrl.abort();
128
+ }
129
+ }
130
+ }
131
+ function onDestroy(scope) {
132
+ let parentScope = scope.___cleanupOwner;
133
+ while (parentScope && !parentScope.___cleanup?.has(scope)) {
134
+ (parentScope.___cleanup ||= /* @__PURE__ */ new Set()).add(scope);
135
+ scope = parentScope;
136
+ parentScope = scope.___cleanupOwner;
137
+ }
138
+ }
139
+ function removeAndDestroyScope(scope) {
140
+ destroyScope(scope);
141
+ let current = scope.___startNode;
142
+ const stop = scope.___endNode.nextSibling;
143
+ while (current !== stop) {
144
+ const next = current.nextSibling;
145
+ current.remove();
146
+ current = next;
147
+ }
148
+ }
149
+ function insertBefore(scope, parent, nextSibling) {
150
+ let current = scope.___startNode;
151
+ const stop = scope.___endNode.nextSibling;
152
+ while (current !== stop) {
153
+ const next = current.nextSibling;
154
+ parent.insertBefore(current, nextSibling);
155
+ current = next;
156
+ }
157
+ }
158
+
159
+ // src/dom/resume.ts
160
+ var registeredValues = {};
161
+ var Render = class {
162
+ ___scopeStack = [];
163
+ ___scopeLookup = {};
164
+ ___serializeContext = {
165
+ _: registeredValues
166
+ };
167
+ constructor(renders, runtimeId, renderId) {
168
+ this.___renders = renders;
169
+ this.___runtimeId = runtimeId;
170
+ this.___renderId = renderId;
171
+ this.___data = renders[renderId];
172
+ this.___resume();
173
+ }
174
+ w() {
175
+ this.___data.w();
176
+ this.___resume();
177
+ }
178
+ ___resume() {
179
+ const data2 = this.___data;
180
+ const serializeContext = this.___serializeContext;
181
+ const scopeLookup = this.___scopeLookup;
182
+ const visits = data2.v;
183
+ const cleanupOwners = /* @__PURE__ */ new Map();
184
+ if (visits.length) {
185
+ const commentPrefix = data2.i;
186
+ const commentPrefixLen = commentPrefix.length;
187
+ const cleanupMarkers = /* @__PURE__ */ new Map();
188
+ data2.v = [];
189
+ const sectionEnd = (visit, scopeId = this.___currentScopeId, curNode = visit) => {
190
+ const scope = scopeLookup[scopeId] ||= {};
191
+ let endNode = curNode;
192
+ while ((endNode = endNode.previousSibling).nodeType === 8) ;
193
+ scope.___endNode = endNode;
194
+ const startNode = scope.___startNode ||= endNode;
195
+ let len = cleanupMarkers.size;
196
+ for (const [markerScopeId, markerNode] of cleanupMarkers) {
197
+ if (!len--) break;
198
+ if (markerScopeId !== scopeId && startNode.compareDocumentPosition(markerNode) & 4 && curNode.compareDocumentPosition(markerNode) & 2) {
199
+ cleanupOwners.set("" + markerScopeId, scopeId);
200
+ cleanupMarkers.delete(markerScopeId);
201
+ }
202
+ }
203
+ cleanupMarkers.set(scopeId, visit);
204
+ return scope;
205
+ };
206
+ for (const visit of visits) {
207
+ const commentText = visit.data;
208
+ const token = commentText[commentPrefixLen];
209
+ const scopeId = parseInt(commentText.slice(commentPrefixLen + 1));
210
+ const scope = scopeLookup[scopeId] ||= {};
211
+ const dataIndex = commentText.indexOf(" ") + 1;
212
+ const data3 = dataIndex ? commentText.slice(dataIndex) : "";
213
+ if (token === "*" /* Node */) {
214
+ scope[data3] = visit.previousSibling;
215
+ } else if (token === "$" /* Cleanup */) {
216
+ cleanupMarkers.set(scopeId, visit);
217
+ } else if (token === "[" /* SectionStart */) {
218
+ if (this.___currentScopeId) {
219
+ if (data3) {
220
+ sectionEnd(visit);
221
+ }
222
+ this.___scopeStack.push(this.___currentScopeId);
223
+ }
224
+ this.___currentScopeId = scopeId;
225
+ scope.___startNode = visit;
226
+ } else if (token === "]" /* SectionEnd */) {
227
+ scope[data3] = visit;
228
+ if (scopeId < this.___currentScopeId) {
229
+ const currParent = visit.parentNode;
230
+ const startNode = sectionEnd(visit).___startNode;
231
+ if (currParent && currParent !== startNode.parentNode) {
232
+ currParent.prepend(startNode);
233
+ }
234
+ this.___currentScopeId = this.___scopeStack.pop();
235
+ }
236
+ } else if (token === "|" /* SectionSingleNodesEnd */) {
237
+ scope[true ? data3.slice(0, data3.indexOf(" ")) : parseInt(data3)] = visit;
238
+ const childScopeIds = JSON.parse(
239
+ "[" + data3.slice(data3.indexOf(" ") + 1) + "]"
240
+ );
241
+ let curNode = visit;
242
+ for (let i = childScopeIds.length - 1; i >= 0; i--) {
243
+ curNode = sectionEnd(visit, childScopeIds[i], curNode).___endNode;
244
+ }
245
+ }
246
+ }
247
+ }
248
+ const resumes = data2.r;
249
+ if (resumes) {
250
+ data2.r = [];
251
+ const len = resumes.length;
252
+ let i = 0;
253
+ try {
254
+ isResuming = true;
255
+ while (i < len) {
256
+ const resumeData = resumes[i++];
257
+ if (typeof resumeData === "function") {
258
+ const scopes = resumeData(serializeContext);
259
+ let { $global } = scopeLookup;
260
+ if (!$global) {
261
+ scopeLookup.$global = $global = scopes.$ || {};
262
+ $global.runtimeId = this.___runtimeId;
263
+ $global.renderId = this.___renderId;
264
+ }
265
+ for (const scopeId in scopes) {
266
+ if (scopeId !== "$") {
267
+ const scope = scopes[scopeId];
268
+ const prevScope = scopeLookup[scopeId];
269
+ scope.$global = $global;
270
+ if (prevScope !== scope) {
271
+ scopeLookup[scopeId] = Object.assign(
272
+ scope,
273
+ prevScope
274
+ );
275
+ }
276
+ const cleanupOwnerId = cleanupOwners.get(scopeId);
277
+ if (cleanupOwnerId) {
278
+ scope.___cleanupOwner = scopes[cleanupOwnerId];
279
+ onDestroy(scope);
280
+ }
281
+ }
282
+ }
283
+ } else if (i === len || typeof resumes[i] !== "string") {
284
+ delete this.___renders[this.___renderId];
285
+ } else {
286
+ registeredValues[resumes[i++]](
287
+ scopeLookup[resumeData],
288
+ scopeLookup[resumeData]
289
+ );
290
+ }
291
+ }
292
+ } finally {
293
+ isResuming = false;
294
+ }
295
+ }
296
+ }
297
+ };
298
+ var isResuming = false;
299
+ function register(id, obj) {
300
+ registeredValues[id] = obj;
301
+ return obj;
302
+ }
303
+ function registerBoundSignal(id, signal) {
304
+ registeredValues[id] = (scope) => (valueOrOp) => signal(scope, valueOrOp);
305
+ return signal;
306
+ }
307
+ function getRegisteredWithScope(id, scope) {
308
+ const val = registeredValues[id];
309
+ return scope ? val(scope) : val;
310
+ }
311
+ function init(runtimeId = DEFAULT_RUNTIME_ID) {
312
+ if (true) {
313
+ if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
314
+ throw new Error(
315
+ `Invalid runtimeId: "${runtimeId}". The runtimeId must be a valid JavaScript identifier.`
316
+ );
317
+ }
318
+ }
319
+ const resumeRender = (renderId) => resumeRender[renderId] = renders[renderId] = new Render(renders, runtimeId, renderId);
320
+ let renders;
321
+ if (window[runtimeId]) {
322
+ setRenders(window[runtimeId]);
323
+ } else {
324
+ Object.defineProperty(window, runtimeId, {
325
+ configurable: true,
326
+ set: setRenders
327
+ });
328
+ }
329
+ function setRenders(v) {
330
+ if (true) {
331
+ if (renders) {
332
+ throw new Error(
333
+ "Marko tried to initialize multiple times. It could be that there are multiple instances of Marko running on the page."
334
+ );
335
+ }
336
+ }
337
+ renders = v;
338
+ for (const renderId in v) {
339
+ resumeRender(renderId);
340
+ }
341
+ Object.defineProperty(window, runtimeId, {
342
+ configurable: true,
343
+ value: resumeRender
344
+ });
345
+ }
346
+ }
347
+ function registerSubscriber(id, signal) {
348
+ register(id, signal.___subscribe);
349
+ return signal;
350
+ }
351
+ function nodeRef(id, key) {
352
+ return register(id, (scope) => () => scope[key]);
353
+ }
354
+
355
+ // src/dom/signals.ts
356
+ var MARK = true ? Symbol("mark") : {};
357
+ var CLEAN = true ? Symbol("clean") : {};
358
+ var DIRTY = true ? Symbol("dirty") : {};
359
+ function state(valueAccessor, fn, getIntersection) {
360
+ const valueSignal = value(valueAccessor, fn, getIntersection);
361
+ const markAccessor = valueAccessor + "#" /* Mark */;
362
+ const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
363
+ return (scope, valueOrOp, valueChange) => {
364
+ if (rendering) {
365
+ const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
366
+ valueSignal(
367
+ scope,
368
+ valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
369
+ );
370
+ } else if (scope[valueChangeAccessor]) {
371
+ scope[valueChangeAccessor](valueOrOp);
372
+ } else {
373
+ queueSource(scope, valueSignal, valueOrOp);
374
+ }
375
+ return valueOrOp;
376
+ };
377
+ }
378
+ function value(valueAccessor, fn, getIntersection) {
379
+ const markAccessor = valueAccessor + "#" /* Mark */;
380
+ let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
381
+ return (scope, valueOrOp) => {
382
+ if (valueOrOp === MARK) {
383
+ if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
384
+ intersection2?.(scope, MARK);
385
+ }
386
+ } else if (valueOrOp !== DIRTY) {
387
+ const existing = scope[markAccessor] !== void 0;
388
+ if ((scope[markAccessor] ||= 1) === 1) {
389
+ if (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp) {
390
+ intersection2?.(scope, CLEAN);
391
+ } else {
392
+ scope[valueAccessor] = valueOrOp;
393
+ fn && fn(scope, valueOrOp);
394
+ intersection2?.(scope, DIRTY);
395
+ }
396
+ }
397
+ scope[markAccessor]--;
398
+ }
399
+ };
400
+ }
401
+ var accessorId = 0;
402
+ function intersection(count, fn, getIntersection) {
403
+ const dirtyAccessor = "?" /* Dynamic */ + accessorId++;
404
+ const markAccessor = dirtyAccessor + "#" /* Mark */;
405
+ let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
406
+ return (scope, op) => {
407
+ if (op === MARK) {
408
+ if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
409
+ intersection2?.(scope, MARK);
410
+ }
411
+ } else if (scope[markAccessor] === void 0) {
412
+ scope[markAccessor] = count - 1;
413
+ scope[dirtyAccessor] = true;
414
+ } else if (--scope[markAccessor] === 0) {
415
+ if (op === DIRTY || scope[dirtyAccessor]) {
416
+ scope[dirtyAccessor] = false;
417
+ fn(scope, 0);
418
+ intersection2?.(scope, DIRTY);
419
+ } else {
420
+ intersection2?.(scope, CLEAN);
421
+ }
422
+ } else {
423
+ scope[dirtyAccessor] ||= op === DIRTY;
424
+ }
425
+ };
426
+ }
427
+ var defaultGetOwnerScope = (scope) => scope._;
428
+ function closure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerScope, getIntersection) {
429
+ const dirtyAccessor = "?" /* Dynamic */ + accessorId++;
430
+ const markAccessor = dirtyAccessor + 1;
431
+ const getOwnerValueAccessor = typeof ownerValueAccessor === "function" ? ownerValueAccessor : () => ownerValueAccessor;
432
+ let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
433
+ return (scope, op) => {
434
+ if (op === MARK) {
435
+ if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
436
+ intersection2?.(scope, MARK);
437
+ }
438
+ } else {
439
+ let ownerScope, ownerValueAccessor2;
440
+ if (scope[markAccessor] === void 0) {
441
+ ownerScope = getOwnerScope(scope);
442
+ ownerValueAccessor2 = getOwnerValueAccessor(scope);
443
+ const ownerMark = ownerScope[ownerValueAccessor2 + "#" /* Mark */];
444
+ const ownerHasRun = ownerMark === void 0 ? !ownerScope.___client : ownerMark === 0;
445
+ scope[markAccessor] = ownerHasRun ? 1 : 2;
446
+ op = DIRTY;
447
+ }
448
+ if (--scope[markAccessor] === 0) {
449
+ if (op === DIRTY || scope[dirtyAccessor]) {
450
+ scope[dirtyAccessor] = false;
451
+ ownerScope ||= getOwnerScope(scope);
452
+ ownerValueAccessor2 ||= getOwnerValueAccessor(scope);
453
+ fn && fn(scope, ownerScope[ownerValueAccessor2]);
454
+ intersection2?.(scope, DIRTY);
455
+ } else {
456
+ intersection2?.(scope, CLEAN);
457
+ }
458
+ } else {
459
+ scope[dirtyAccessor] ||= op === DIRTY;
460
+ }
461
+ }
462
+ };
463
+ }
464
+ function dynamicClosure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerScope, getIntersection) {
465
+ const getOwnerValueAccessor = typeof ownerValueAccessor === "function" ? ownerValueAccessor : () => ownerValueAccessor;
466
+ const signalFn = closure(
467
+ getOwnerValueAccessor,
468
+ fn,
469
+ getOwnerScope,
470
+ getIntersection
471
+ );
472
+ const subscribeFns = /* @__PURE__ */ new WeakMap();
473
+ signalFn.___subscribe = (scope) => {
474
+ const subscribeFn = (value2) => signalFn(scope, value2);
475
+ const ownerScope = getOwnerScope(scope);
476
+ const providerSubscriptionsAccessor = getOwnerValueAccessor(scope) + "*" /* Subscribers */;
477
+ subscribeFns.set(scope, subscribeFn);
478
+ (ownerScope[providerSubscriptionsAccessor] ||= /* @__PURE__ */ new Set()).add(subscribeFn);
479
+ };
480
+ signalFn.___unsubscribe = (scope) => {
481
+ const ownerScope = getOwnerScope(scope);
482
+ const providerSubscriptionsAccessor = getOwnerValueAccessor(scope) + "*" /* Subscribers */;
483
+ ownerScope[providerSubscriptionsAccessor]?.delete(subscribeFns.get(scope));
484
+ subscribeFns.delete(scope);
485
+ };
486
+ return signalFn;
487
+ }
488
+ function childClosures(closureSignals, childAccessor) {
489
+ const signal = (scope, op) => {
490
+ const childScope = scope[childAccessor];
491
+ for (const closureSignal of closureSignals) {
492
+ closureSignal(childScope, op);
493
+ }
494
+ };
495
+ signal.___subscribe = (scope) => {
496
+ const childScope = scope[childAccessor];
497
+ for (const closureSignal of closureSignals) {
498
+ closureSignal.___subscribe?.(childScope);
499
+ }
500
+ };
501
+ signal.___unsubscribe = (scope) => {
502
+ const childScope = scope[childAccessor];
503
+ for (const closureSignal of closureSignals) {
504
+ closureSignal.___unsubscribe?.(childScope);
505
+ }
506
+ };
507
+ return signal;
508
+ }
509
+ function dynamicSubscribers(valueAccessor) {
510
+ const subscribersAccessor = valueAccessor + "*" /* Subscribers */;
511
+ return (scope, op) => {
512
+ const subscribers = scope[subscribersAccessor];
513
+ if (subscribers) {
514
+ for (const subscriber of subscribers) {
515
+ subscriber(op);
516
+ }
517
+ }
518
+ };
519
+ }
520
+ function setTagVar(scope, childAccessor, tagVarSignal2) {
521
+ scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
522
+ }
523
+ var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
524
+ function setTagVarChange(scope, changeHandler) {
525
+ scope["@" /* TagVariableChange */] = changeHandler;
526
+ }
527
+ var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
528
+ var renderBodyClosures = (renderBody, childScope, op) => {
529
+ const signals = renderBody?.___closureSignals;
530
+ if (signals) {
531
+ for (const signal of signals) {
532
+ signal(childScope, op);
533
+ }
534
+ }
535
+ };
536
+ var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
537
+ function nextTagId({ $global }) {
538
+ const id = tagIdsByGlobal.get($global) || 0;
539
+ tagIdsByGlobal.set($global, id + 1);
540
+ return "c" + $global.runtimeId + $global.renderId + id.toString(36);
541
+ }
542
+ function inChild(childAccessor, signal) {
543
+ return (scope, valueOrOp) => {
544
+ signal(scope[childAccessor], valueOrOp);
545
+ };
546
+ }
547
+ function intersections(signals) {
548
+ return (scope, op) => {
549
+ for (const signal of signals) {
550
+ signal(scope, op);
551
+ }
552
+ };
553
+ }
554
+ function effect(id, fn) {
555
+ register(id, fn);
556
+ return (scope) => {
557
+ queueEffect(scope, fn);
558
+ };
559
+ }
560
+
561
+ // src/dom/queue.ts
562
+ var pendingSignals = [];
563
+ var pendingEffects = [];
564
+ var rendering = false;
565
+ function queueSource(scope, signal, value2) {
566
+ schedule();
567
+ rendering = true;
568
+ signal(scope, MARK);
569
+ rendering = false;
570
+ pendingSignals.push(scope, signal, value2);
571
+ return value2;
572
+ }
573
+ function queueEffect(scope, fn) {
574
+ pendingEffects.push(scope, fn);
575
+ }
576
+ function run() {
577
+ const signals = pendingSignals;
578
+ const effects = pendingEffects;
579
+ try {
580
+ rendering = true;
581
+ pendingSignals = [];
582
+ runSignals(signals);
583
+ } finally {
584
+ rendering = false;
585
+ }
586
+ pendingEffects = [];
587
+ runEffects(effects);
588
+ }
589
+ function prepareEffects(fn) {
590
+ const prevSignals = pendingSignals;
591
+ const prevEffects = pendingEffects;
592
+ const preparedEffects = pendingEffects = [];
593
+ const preparedSignals = pendingSignals = [];
594
+ try {
595
+ rendering = true;
596
+ fn();
597
+ pendingSignals = prevSignals;
598
+ runSignals(preparedSignals);
599
+ } finally {
600
+ rendering = false;
601
+ pendingSignals = prevSignals;
602
+ pendingEffects = prevEffects;
603
+ }
604
+ return preparedEffects;
605
+ }
606
+ function runEffects(effects = pendingEffects) {
607
+ for (let i = 0; i < effects.length; i += 2 /* Total */) {
608
+ const scope = effects[i];
609
+ const fn = effects[i + 1];
610
+ fn(scope, scope);
611
+ }
612
+ }
613
+ function runSignals(signals) {
614
+ for (let i = 0; i < signals.length; i += 3 /* Total */) {
615
+ const scope = signals[i + 0 /* Scope */];
616
+ const signal = signals[i + 1 /* Signal */];
617
+ const value2 = signals[i + 2 /* Value */];
618
+ signal(scope, value2);
619
+ }
620
+ }
621
+
622
+ // src/dom/abort-signal.ts
623
+ function resetAbortSignal(scope, id) {
624
+ const controllers = scope.___abortControllers;
625
+ if (controllers) {
626
+ const ctrl = controllers.get(id);
627
+ if (ctrl) {
628
+ queueEffect(null, () => ctrl.abort());
629
+ controllers.delete(id);
630
+ }
631
+ }
632
+ }
633
+ function getAbortSignal(scope, id) {
634
+ const controllers = scope.___abortControllers ||= /* @__PURE__ */ new Map();
635
+ let controller = controllers.get(id);
636
+ if (!controller) {
637
+ onDestroy(scope);
638
+ controllers.set(id, controller = new AbortController());
639
+ }
640
+ return controller.signal;
641
+ }
642
+
643
+ // src/common/compat-meta.ts
644
+ var prefix = true ? "$compat_" : "$C_";
645
+ var RENDERER_REGISTER_ID = prefix + (true ? "renderer" : "r");
646
+ var SET_SCOPE_REGISTER_ID = prefix + (true ? "setScope" : "s");
647
+
648
+ // src/common/helpers.ts
649
+ function classValue(value2) {
650
+ return toDelimitedString(value2, " ", stringifyClassObject);
651
+ }
652
+ function stringifyClassObject(name, value2) {
653
+ return value2 ? name : "";
654
+ }
655
+ function styleValue(value2) {
656
+ return toDelimitedString(value2, ";", stringifyStyleObject);
657
+ }
658
+ var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
659
+ function stringifyStyleObject(name, value2) {
660
+ return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 && !NON_DIMENSIONAL.test(name) ? value2 + "px" : value2}` : "";
661
+ }
662
+ function toDelimitedString(val, delimiter, stringify) {
663
+ switch (typeof val) {
664
+ case "string":
665
+ return val;
666
+ case "object":
667
+ if (val !== null) {
668
+ let result = "";
669
+ let curDelimiter = "";
670
+ if (Array.isArray(val)) {
671
+ for (const v of val) {
672
+ const part = toDelimitedString(v, delimiter, stringify);
673
+ if (part !== "") {
674
+ result += curDelimiter + part;
675
+ curDelimiter = delimiter;
676
+ }
677
+ }
678
+ } else {
679
+ for (const name in val) {
680
+ const v = val[name];
681
+ const part = stringify(name, v);
682
+ if (part !== "") {
683
+ result += curDelimiter + part;
684
+ curDelimiter = delimiter;
685
+ }
686
+ }
687
+ }
688
+ return result;
689
+ }
690
+ }
691
+ return "";
692
+ }
693
+ function isEventHandler(name) {
694
+ return /^on[A-Z-]/.test(name);
695
+ }
696
+ function getEventHandlerName(name) {
697
+ return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
698
+ }
699
+ function normalizeDynamicRenderer(value2) {
700
+ if (value2) return value2.renderBody || value2.default || value2;
701
+ }
702
+
703
+ // src/dom/reconcile.ts
704
+ var WRONG_POS = 2147483647;
705
+ function reconcile(parent, oldScopes, newScopes, afterReference) {
706
+ let oldStart = 0;
707
+ let newStart = 0;
708
+ let oldEnd = oldScopes.length - 1;
709
+ let newEnd = newScopes.length - 1;
710
+ let oldStartScope = oldScopes[oldStart];
711
+ let newStartScope = newScopes[newStart];
712
+ let oldEndScope = oldScopes[oldEnd];
713
+ let newEndScope = newScopes[newEnd];
714
+ let i;
715
+ let j;
716
+ let k;
717
+ let nextSibling;
718
+ let oldScope;
719
+ let newScope;
720
+ outer: {
721
+ while (oldStartScope === newStartScope) {
722
+ ++oldStart;
723
+ ++newStart;
724
+ if (oldStart > oldEnd || newStart > newEnd) {
725
+ break outer;
726
+ }
727
+ oldStartScope = oldScopes[oldStart];
728
+ newStartScope = newScopes[newStart];
729
+ }
730
+ while (oldEndScope === newEndScope) {
731
+ --oldEnd;
732
+ --newEnd;
733
+ if (oldStart > oldEnd || newStart > newEnd) {
734
+ break outer;
735
+ }
736
+ oldEndScope = oldScopes[oldEnd];
737
+ newEndScope = newScopes[newEnd];
738
+ }
739
+ }
740
+ if (oldStart > oldEnd) {
741
+ if (newStart <= newEnd) {
742
+ k = newEnd + 1;
743
+ nextSibling = k < newScopes.length ? newScopes[k].___startNode : afterReference;
744
+ do {
745
+ insertBefore(newScopes[newStart++], parent, nextSibling);
746
+ } while (newStart <= newEnd);
747
+ }
748
+ } else if (newStart > newEnd) {
749
+ do {
750
+ removeAndDestroyScope(oldScopes[oldStart++]);
751
+ } while (oldStart <= oldEnd);
752
+ } else {
753
+ const oldLength = oldEnd - oldStart + 1;
754
+ const newLength = newEnd - newStart + 1;
755
+ const aNullable = oldScopes;
756
+ const sources = new Array(newLength);
757
+ for (i = 0; i < newLength; ++i) {
758
+ sources[i] = -1;
759
+ }
760
+ let pos = 0;
761
+ let synced = 0;
762
+ const keyIndex = /* @__PURE__ */ new Map();
763
+ for (j = newStart; j <= newEnd; ++j) {
764
+ keyIndex.set(newScopes[j], j);
765
+ }
766
+ for (i = oldStart; i <= oldEnd && synced < newLength; ++i) {
767
+ oldScope = oldScopes[i];
768
+ j = keyIndex.get(oldScope);
769
+ if (j !== void 0) {
770
+ pos = pos > j ? WRONG_POS : j;
771
+ ++synced;
772
+ newScope = newScopes[j];
773
+ sources[j - newStart] = i;
774
+ aNullable[i] = null;
775
+ }
776
+ }
777
+ if (oldLength === oldScopes.length && synced === 0) {
778
+ for (; newStart < newLength; ++newStart) {
779
+ insertBefore(newScopes[newStart], parent, afterReference);
780
+ }
781
+ for (; oldStart < oldLength; ++oldStart) {
782
+ removeAndDestroyScope(oldScopes[oldStart]);
783
+ }
784
+ } else {
785
+ i = oldLength - synced;
786
+ while (i > 0) {
787
+ oldScope = aNullable[oldStart++];
788
+ if (oldScope !== null) {
789
+ removeAndDestroyScope(oldScope);
790
+ i--;
791
+ }
792
+ }
793
+ if (pos === WRONG_POS) {
794
+ const seq = longestIncreasingSubsequence(sources);
795
+ j = seq.length - 1;
796
+ k = newScopes.length;
797
+ for (i = newLength - 1; i >= 0; --i) {
798
+ if (sources[i] === -1) {
799
+ pos = i + newStart;
800
+ newScope = newScopes[pos++];
801
+ nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
802
+ insertBefore(newScope, parent, nextSibling);
803
+ } else {
804
+ if (j < 0 || i !== seq[j]) {
805
+ pos = i + newStart;
806
+ newScope = newScopes[pos++];
807
+ nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
808
+ insertBefore(newScope, parent, nextSibling);
809
+ } else {
810
+ --j;
811
+ }
812
+ }
813
+ }
814
+ } else if (synced !== newLength) {
815
+ k = newScopes.length;
816
+ for (i = newLength - 1; i >= 0; --i) {
817
+ if (sources[i] === -1) {
818
+ pos = i + newStart;
819
+ newScope = newScopes[pos++];
820
+ nextSibling = pos < k ? newScopes[pos].___startNode : afterReference;
821
+ insertBefore(newScope, parent, nextSibling);
822
+ }
823
+ }
824
+ }
825
+ }
826
+ }
827
+ }
828
+ function longestIncreasingSubsequence(a) {
829
+ const p = a.slice();
830
+ const result = [];
831
+ result.push(0);
832
+ let u;
833
+ let v;
834
+ for (let i = 0, il = a.length; i < il; ++i) {
835
+ if (a[i] === -1) {
836
+ continue;
837
+ }
838
+ const j = result[result.length - 1];
839
+ if (a[j] < a[i]) {
840
+ p[i] = j;
841
+ result.push(i);
842
+ continue;
843
+ }
844
+ u = 0;
845
+ v = result.length - 1;
846
+ while (u < v) {
847
+ const c = (u + v) / 2 | 0;
848
+ if (a[result[c]] < a[i]) {
849
+ u = c + 1;
850
+ } else {
851
+ v = c;
852
+ }
853
+ }
854
+ if (a[i] < a[result[u]]) {
855
+ if (u > 0) {
856
+ p[i] = result[u - 1];
857
+ }
858
+ result[u] = i;
859
+ }
860
+ }
861
+ u = result.length;
862
+ v = result[u - 1];
863
+ while (u-- > 0) {
864
+ result[u] = v;
865
+ v = p[v];
866
+ }
867
+ return result;
868
+ }
869
+
870
+ // src/dom/event.ts
871
+ var elementHandlersByEvent = /* @__PURE__ */ new Map();
872
+ var defaultDelegator = createDelegator();
873
+ function on(element, type, handler) {
874
+ let handlersByElement = elementHandlersByEvent.get(type);
875
+ if (!handlersByElement) {
876
+ elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap());
877
+ }
878
+ if (!handlersByElement.has(element)) {
879
+ defaultDelegator(element, type, handleDelegated);
880
+ }
881
+ handlersByElement.set(element, handler || void 0);
882
+ }
883
+ function createDelegator() {
884
+ const delegatedEventsByRoot = /* @__PURE__ */ new WeakMap();
885
+ return function ensureDelegated(node, type, handler) {
886
+ const root = node.getRootNode();
887
+ let delegatedEvents = delegatedEventsByRoot.get(root);
888
+ if (!delegatedEvents) {
889
+ delegatedEventsByRoot.set(root, delegatedEvents = /* @__PURE__ */ new Set());
890
+ }
891
+ if (!delegatedEvents.has(type)) {
892
+ delegatedEvents.add(type);
893
+ root.addEventListener(type, handler, true);
894
+ }
895
+ };
896
+ }
897
+ function handleDelegated(ev) {
898
+ let target = ev.target;
899
+ if (target) {
900
+ const handlersByElement = elementHandlersByEvent.get(ev.type);
901
+ handlersByElement.get(target)?.(ev, target);
902
+ if (ev.bubbles) {
903
+ while ((target = target.parentElement) && !ev.cancelBubble) {
904
+ handlersByElement.get(target)?.(ev, target);
905
+ }
906
+ }
907
+ }
908
+ }
909
+
910
+ // src/dom/resolve-cursor-position.ts
911
+ function resolveCursorPosition(updatedValue, initialValue, initialPosition, inputType2) {
912
+ if (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
913
+ /kw/.test(inputType2)) {
914
+ const before = initialValue.slice(0, initialPosition);
915
+ const after = initialValue.slice(initialPosition);
916
+ if (updatedValue.startsWith(before)) {
917
+ return initialPosition;
918
+ } else if (updatedValue.endsWith(after)) {
919
+ return updatedValue.length - after.length;
920
+ } else {
921
+ const relevantChars = stripSpacesAndPunctuation(before).length;
922
+ let pos = 0;
923
+ let relevantIndex = 0;
924
+ while (relevantIndex < relevantChars) {
925
+ if (stripSpacesAndPunctuation(updatedValue[pos])) relevantIndex++;
926
+ pos++;
927
+ }
928
+ return pos;
929
+ }
930
+ }
931
+ return -1;
932
+ }
933
+ function stripSpacesAndPunctuation(str) {
934
+ return str.replace(/[^\p{L}\p{N}]/gu, "");
935
+ }
936
+
937
+ // src/dom/controllable.ts
938
+ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange) {
939
+ setCheckboxValue(
940
+ scope,
941
+ nodeAccessor,
942
+ 0 /* InputChecked */,
943
+ normalizeBoolProp(checked),
944
+ checkedChange
945
+ );
946
+ }
947
+ function controllable_input_checked_effect(scope, nodeAccessor) {
948
+ const el = scope[nodeAccessor];
949
+ syncControllable(el, "input", hasCheckboxChanged, () => {
950
+ const checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
951
+ if (checkedChange) {
952
+ scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
953
+ checkedChange(el.checked);
954
+ run();
955
+ if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
956
+ el.checked = !el.checked;
957
+ }
958
+ }
959
+ });
960
+ }
961
+ function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
962
+ scope[nodeAccessor + ":" /* ControlledValue */] = checkedValue;
963
+ attr(scope[nodeAccessor], "value", value2);
964
+ setCheckboxValue(
965
+ scope,
966
+ nodeAccessor,
967
+ 1 /* InputCheckedValue */,
968
+ Array.isArray(checkedValue) ? checkedValue.includes(value2) : checkedValue === value2,
969
+ checkedValueChange
970
+ );
971
+ }
972
+ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
973
+ const el = scope[nodeAccessor];
974
+ syncControllable(el, "input", hasCheckboxChanged, () => {
975
+ const checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
976
+ if (checkedValueChange) {
977
+ const oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
978
+ scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
979
+ checkedValueChange(
980
+ Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0
981
+ );
982
+ run();
983
+ if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
984
+ el.checked = !el.checked;
985
+ }
986
+ }
987
+ });
988
+ }
989
+ function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
990
+ const el = scope[nodeAccessor];
991
+ const normalizedValue = normalizeStrProp(value2);
992
+ scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
993
+ if (valueChange) {
994
+ scope[nodeAccessor + "=" /* ControlledType */] = 0 /* InputChecked */;
995
+ scope[nodeAccessor + ":" /* ControlledValue */] = value2;
996
+ if (el.isConnected) {
997
+ setValueAndUpdateSelection(el, normalizedValue);
998
+ } else {
999
+ el.defaultValue = normalizedValue;
1000
+ }
1001
+ } else {
1002
+ scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
1003
+ el.defaultValue = normalizedValue;
1004
+ }
1005
+ }
1006
+ function controllable_input_value_effect(scope, nodeAccessor) {
1007
+ const el = scope[nodeAccessor];
1008
+ if (isResuming) {
1009
+ scope[nodeAccessor + ":" /* ControlledValue */] = el.defaultValue;
1010
+ }
1011
+ syncControllable(el, "input", hasValueChanged, (ev) => {
1012
+ const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
1013
+ if (valueChange) {
1014
+ scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
1015
+ if (ev) inputType = ev.inputType;
1016
+ valueChange(el.value);
1017
+ run();
1018
+ if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
1019
+ setValueAndUpdateSelection(
1020
+ el,
1021
+ scope[nodeAccessor + ":" /* ControlledValue */]
1022
+ );
1023
+ }
1024
+ inputType = "";
1025
+ }
1026
+ });
1027
+ }
1028
+ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
1029
+ scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
1030
+ if (valueChange) {
1031
+ scope[nodeAccessor + "=" /* ControlledType */] = 3 /* SelectValue */;
1032
+ scope[nodeAccessor + ":" /* ControlledValue */] = value2;
1033
+ } else {
1034
+ scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
1035
+ }
1036
+ setSelectOptions(
1037
+ scope[nodeAccessor],
1038
+ value2,
1039
+ valueChange
1040
+ );
1041
+ }
1042
+ function controllable_select_value_effect(scope, nodeAccessor) {
1043
+ const el = scope[nodeAccessor];
1044
+ syncControllable(el, "input", hasSelectChanged, () => {
1045
+ const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
1046
+ if (valueChange) {
1047
+ scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
1048
+ valueChange(
1049
+ Array.isArray(scope[nodeAccessor + ":" /* ControlledValue */]) ? Array.from(el.selectedOptions, toValueProp) : el.value
1050
+ );
1051
+ run();
1052
+ if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
1053
+ setSelectOptions(
1054
+ el,
1055
+ scope[nodeAccessor + ":" /* ControlledValue */],
1056
+ valueChange
1057
+ );
1058
+ }
1059
+ }
1060
+ });
1061
+ }
1062
+ function setSelectOptions(el, value2, valueChange) {
1063
+ if (Array.isArray(value2)) {
1064
+ for (const opt of el.options) {
1065
+ const selected = value2.includes(opt.value);
1066
+ if (valueChange) {
1067
+ opt.selected = selected;
1068
+ } else {
1069
+ opt.defaultSelected = selected;
1070
+ }
1071
+ }
1072
+ } else {
1073
+ const normalizedValue = normalizeStrProp(value2);
1074
+ if (valueChange) {
1075
+ el.value = normalizedValue;
1076
+ } else {
1077
+ for (const opt of el.options) {
1078
+ opt.defaultSelected = opt.value === normalizedValue;
1079
+ }
1080
+ }
1081
+ }
1082
+ }
1083
+ function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange) {
1084
+ scope[nodeAccessor + ";" /* ControlledHandler */] = openChange;
1085
+ if (openChange) {
1086
+ scope[nodeAccessor + "=" /* ControlledType */] = 4 /* DetailsOrDialogOpen */;
1087
+ } else {
1088
+ scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
1089
+ }
1090
+ scope[nodeAccessor].open = normalizeBoolProp(open);
1091
+ }
1092
+ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
1093
+ const el = scope[nodeAccessor];
1094
+ const hasChanged = () => el.open !== scope[nodeAccessor + ":" /* ControlledValue */];
1095
+ syncControllable(
1096
+ el,
1097
+ el.tagName === "DIALOG" ? "close" : "toggle",
1098
+ hasChanged,
1099
+ () => {
1100
+ const openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
1101
+ if (openChange && hasChanged()) {
1102
+ scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
1103
+ openChange(el.open);
1104
+ run();
1105
+ if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
1106
+ el.open = !el.open;
1107
+ }
1108
+ }
1109
+ }
1110
+ );
1111
+ }
1112
+ var inputType = "";
1113
+ function setValueAndUpdateSelection(el, value2) {
1114
+ const initialValue = el.value;
1115
+ if (initialValue !== value2) {
1116
+ if (el.getRootNode().activeElement === el) {
1117
+ const initialPosition = el.selectionStart;
1118
+ el.value = value2;
1119
+ const updatedPosition = resolveCursorPosition(
1120
+ el.value,
1121
+ initialValue,
1122
+ initialPosition,
1123
+ inputType
1124
+ );
1125
+ if (~updatedPosition) {
1126
+ el.setSelectionRange(updatedPosition, updatedPosition);
1127
+ }
1128
+ } else {
1129
+ el.value = value2;
1130
+ }
1131
+ }
1132
+ }
1133
+ function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
1134
+ scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange;
1135
+ if (checkedChange) {
1136
+ scope[nodeAccessor + "=" /* ControlledType */] = type;
1137
+ scope[nodeAccessor].checked = checked;
1138
+ } else {
1139
+ scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */;
1140
+ scope[nodeAccessor].defaultChecked = checked;
1141
+ }
1142
+ }
1143
+ var delegateFormControl = createDelegator();
1144
+ var formChangeHandlers = /* @__PURE__ */ new WeakMap();
1145
+ function syncControllable(el, event, hasChanged, onChange) {
1146
+ formChangeHandlers.set(el, onChange);
1147
+ delegateFormControl(el, event, onFormChange);
1148
+ if (el.form) {
1149
+ delegateFormControl(el.form, "reset", onFormReset);
1150
+ }
1151
+ if (isResuming && hasChanged(el)) {
1152
+ queueMicrotask(onChange);
1153
+ }
1154
+ }
1155
+ function onFormChange(ev) {
1156
+ formChangeHandlers.get(ev.target)?.(ev);
1157
+ }
1158
+ function onFormReset(ev) {
1159
+ const handlers = [];
1160
+ for (const el of ev.target.elements) {
1161
+ const handler = formChangeHandlers.get(el);
1162
+ if (handler && hasFormElementChanged(el)) {
1163
+ handlers.push(handler);
1164
+ }
1165
+ }
1166
+ requestAnimationFrame(() => {
1167
+ if (!ev.defaultPrevented) {
1168
+ for (const change of handlers) {
1169
+ change();
1170
+ }
1171
+ }
1172
+ });
1173
+ }
1174
+ function hasValueChanged(el) {
1175
+ return el.value !== el.defaultValue;
1176
+ }
1177
+ function hasCheckboxChanged(el) {
1178
+ return el.checked !== el.defaultChecked;
1179
+ }
1180
+ function hasSelectChanged(el) {
1181
+ for (const opt of el.options) {
1182
+ if (opt.selected !== opt.defaultSelected) {
1183
+ return true;
1184
+ }
1185
+ }
1186
+ }
1187
+ function hasFormElementChanged(el) {
1188
+ return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
1189
+ }
1190
+ function normalizeStrProp(value2) {
1191
+ return normalizeAttrValue(value2) || "";
1192
+ }
1193
+ function normalizeBoolProp(value2) {
1194
+ return value2 != null && value2 !== false;
1195
+ }
1196
+ function updateList(arr, val, push) {
1197
+ const index = arr.indexOf(val);
1198
+ return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
1199
+ }
1200
+ function toValueProp(it) {
1201
+ return it.value;
1202
+ }
1203
+
1204
+ // src/dom/parse-html.ts
1205
+ var fallback = document.createTextNode("");
1206
+ var parser = /* @__PURE__ */ new Range();
1207
+ function parseHTML(html2) {
1208
+ return parser.createContextualFragment(html2);
1209
+ }
1210
+ function parseHTMLOrSingleNode(html2) {
1211
+ const content = parseHTML(html2);
1212
+ if (!content.firstChild) return fallback;
1213
+ return content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
1214
+ // a single replaced node, in which case the walker can't replace
1215
+ // the node itself.
1216
+ content.firstChild.nodeType !== 8 ? content.firstChild : content;
1217
+ }
1218
+
1219
+ // src/dom/dom.ts
1220
+ function attr(element, name, value2) {
1221
+ setAttribute(element, name, normalizeAttrValue(value2));
1222
+ }
1223
+ function setAttribute(element, name, value2) {
1224
+ if (element.getAttribute(name) != value2) {
1225
+ if (value2 === void 0) {
1226
+ element.removeAttribute(name);
1227
+ } else {
1228
+ element.setAttribute(name, value2);
1229
+ }
1230
+ }
1231
+ }
1232
+ function classAttr(element, value2) {
1233
+ setAttribute(element, "class", classValue(value2) || void 0);
1234
+ }
1235
+ function styleAttr(element, value2) {
1236
+ setAttribute(element, "style", styleValue(value2) || void 0);
1237
+ }
1238
+ function data(node, value2) {
1239
+ const normalizedValue = normalizeString(value2);
1240
+ if (node.data !== normalizedValue) {
1241
+ node.data = normalizedValue;
1242
+ }
1243
+ }
1244
+ function textContent(node, value2) {
1245
+ const normalizedValue = normalizeString(value2);
1246
+ if (node.textContent !== normalizedValue) {
1247
+ node.textContent = normalizedValue;
1248
+ }
1249
+ }
1250
+ function attrs(scope, nodeAccessor, nextAttrs) {
1251
+ const el = scope[nodeAccessor];
1252
+ for (const { name } of el.attributes) {
1253
+ if (!(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) {
1254
+ el.removeAttribute(name);
1255
+ }
1256
+ }
1257
+ attrsInternal(scope, nodeAccessor, nextAttrs);
1258
+ }
1259
+ function hasAttrAlias(element, attr2, nextAttrs) {
1260
+ return attr2 === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
1261
+ }
1262
+ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
1263
+ const el = scope[nodeAccessor];
1264
+ const partial = {};
1265
+ for (const { name } of el.attributes) {
1266
+ if (!skip[name] && !(nextAttrs && name in nextAttrs)) {
1267
+ el.removeAttribute(name);
1268
+ }
1269
+ }
1270
+ for (const key in nextAttrs) {
1271
+ if (!skip[key]) partial[key] = nextAttrs[key];
1272
+ }
1273
+ attrsInternal(scope, nodeAccessor, partial);
1274
+ }
1275
+ function attrsInternal(scope, nodeAccessor, nextAttrs) {
1276
+ const el = scope[nodeAccessor];
1277
+ let events;
1278
+ let skip;
1279
+ switch (el.tagName) {
1280
+ case "INPUT":
1281
+ if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
1282
+ controllable_input_checked(
1283
+ scope,
1284
+ nodeAccessor,
1285
+ nextAttrs.checked,
1286
+ nextAttrs.checkedChange
1287
+ );
1288
+ } else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
1289
+ controllable_input_checkedValue(
1290
+ scope,
1291
+ nodeAccessor,
1292
+ nextAttrs.checkedValue,
1293
+ nextAttrs.checkedValueChange,
1294
+ nextAttrs.value
1295
+ );
1296
+ } else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
1297
+ controllable_input_value(
1298
+ scope,
1299
+ nodeAccessor,
1300
+ nextAttrs.value,
1301
+ nextAttrs.valueChange
1302
+ );
1303
+ } else {
1304
+ break;
1305
+ }
1306
+ skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
1307
+ break;
1308
+ case "SELECT":
1309
+ if ("value" in nextAttrs || "valueChange" in nextAttrs) {
1310
+ controllable_select_value(
1311
+ scope,
1312
+ nodeAccessor,
1313
+ nextAttrs.value,
1314
+ nextAttrs.valueChange
1315
+ );
1316
+ skip = /^value(?:Change)?$/;
1317
+ }
1318
+ break;
1319
+ case "TEXTAREA":
1320
+ if ("value" in nextAttrs || "valueChange" in nextAttrs) {
1321
+ controllable_input_value(
1322
+ scope,
1323
+ nodeAccessor,
1324
+ nextAttrs.value,
1325
+ nextAttrs.valueChange
1326
+ );
1327
+ skip = /^value(?:Change)?$/;
1328
+ }
1329
+ break;
1330
+ case "DETAILS":
1331
+ case "DIALOG":
1332
+ if ("open" in nextAttrs || "openChange" in nextAttrs) {
1333
+ controllable_detailsOrDialog_open(
1334
+ scope,
1335
+ nodeAccessor,
1336
+ nextAttrs.open,
1337
+ nextAttrs.openChange
1338
+ );
1339
+ skip = /^open(?:Change)?$/;
1340
+ }
1341
+ break;
1342
+ }
1343
+ for (const name in nextAttrs) {
1344
+ const value2 = nextAttrs[name];
1345
+ switch (name) {
1346
+ case "class":
1347
+ classAttr(el, value2);
1348
+ break;
1349
+ case "style":
1350
+ styleAttr(el, value2);
1351
+ break;
1352
+ case "renderBody":
1353
+ break;
1354
+ default: {
1355
+ if (isEventHandler(name)) {
1356
+ (events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2;
1357
+ } else if (!skip?.test(name)) {
1358
+ attr(el, name, value2);
1359
+ }
1360
+ }
1361
+ }
1362
+ }
1363
+ }
1364
+ function attrsEvents(scope, nodeAccessor) {
1365
+ const el = scope[nodeAccessor];
1366
+ const events = scope[nodeAccessor + "~" /* EventAttributes */];
1367
+ switch (scope[nodeAccessor + "=" /* ControlledType */]) {
1368
+ case 0 /* InputChecked */:
1369
+ controllable_input_checked_effect(scope, nodeAccessor);
1370
+ break;
1371
+ case 1 /* InputCheckedValue */:
1372
+ controllable_input_checkedValue_effect(scope, nodeAccessor);
1373
+ break;
1374
+ case 2 /* InputValue */:
1375
+ controllable_input_value_effect(scope, nodeAccessor);
1376
+ break;
1377
+ case 3 /* SelectValue */:
1378
+ controllable_select_value_effect(scope, nodeAccessor);
1379
+ break;
1380
+ case 4 /* DetailsOrDialogOpen */:
1381
+ controllable_detailsOrDialog_open_effect(scope, nodeAccessor);
1382
+ break;
1383
+ }
1384
+ for (const name in events) {
1385
+ on(el, name, events[name]);
1386
+ }
1387
+ }
1388
+ function html(scope, value2, index) {
1389
+ const firstChild = scope[index];
1390
+ const lastChild = scope[index + "-"] || firstChild;
1391
+ const parentNode = firstChild.parentNode;
1392
+ const afterReference = lastChild.nextSibling;
1393
+ const newContent = parseHTML(value2 || value2 === 0 ? value2 + "" : "<!>");
1394
+ scope[index] = newContent.firstChild;
1395
+ scope[index + "-" /* DynamicPlaceholderLastChild */] = newContent.lastChild;
1396
+ parentNode.insertBefore(newContent, firstChild);
1397
+ let current = firstChild;
1398
+ while (current !== afterReference) {
1399
+ const next = current.nextSibling;
1400
+ current.remove();
1401
+ current = next;
1402
+ }
1403
+ }
1404
+ function props(scope, nodeIndex, index) {
1405
+ const nextProps = scope[index];
1406
+ const prevProps = scope[index + "-"];
1407
+ const node = scope[nodeIndex];
1408
+ if (prevProps) {
1409
+ for (const name in prevProps) {
1410
+ if (!(name in nextProps)) {
1411
+ node[name] = void 0;
1412
+ }
1413
+ }
1414
+ }
1415
+ for (const name in nextProps) {
1416
+ node[name] = nextProps[name];
1417
+ }
1418
+ scope[index + "-"] = nextProps;
1419
+ }
1420
+ function normalizeAttrValue(value2) {
1421
+ if (value2 || value2 === 0) {
1422
+ return value2 === true ? "" : value2 + "";
1423
+ }
1424
+ }
1425
+ function normalizeString(value2) {
1426
+ return value2 || value2 === 0 ? value2 + "" : "\u200D";
1427
+ }
1428
+ function lifecycle(scope, index, thisObj) {
1429
+ const instance = scope[index];
1430
+ if (instance) {
1431
+ Object.assign(instance, thisObj);
1432
+ instance.onUpdate?.();
1433
+ } else {
1434
+ scope[index] = thisObj;
1435
+ thisObj.onMount?.();
1436
+ getAbortSignal(
1437
+ scope,
1438
+ "-" /* LifecycleAbortController */ + index
1439
+ ).onabort = () => thisObj.onDestroy?.();
1440
+ }
1441
+ }
1442
+
1443
+ // src/dom/walker.ts
1444
+ var walker = /* @__PURE__ */ document.createTreeWalker(document);
1445
+ function trimWalkString(walkString) {
1446
+ let end = walkString.length;
1447
+ while (walkString.charCodeAt(--end) > 47 /* BeginChild */) ;
1448
+ return walkString.slice(0, end + 1);
1449
+ }
1450
+ function walk(startNode, walkCodes, scope) {
1451
+ walker.currentNode = startNode;
1452
+ walkInternal(walkCodes, scope, scope, 0);
1453
+ walker.currentNode = document.documentElement;
1454
+ }
1455
+ function walkInternal(walkCodes, scope, cleanupOwnerScope, currentWalkIndex) {
1456
+ let value2;
1457
+ let storedMultiplier = 0;
1458
+ let currentMultiplier = 0;
1459
+ let currentScopeIndex = 0;
1460
+ if (cleanupOwnerScope !== scope) {
1461
+ scope.___cleanupOwner = cleanupOwnerScope;
1462
+ }
1463
+ while (value2 = walkCodes.charCodeAt(currentWalkIndex++)) {
1464
+ currentMultiplier = storedMultiplier;
1465
+ storedMultiplier = 0;
1466
+ if (value2 >= 117 /* Multiplier */) {
1467
+ storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
1468
+ } else if (value2 >= 107 /* Out */) {
1469
+ value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */;
1470
+ while (value2--) {
1471
+ walker.parentNode();
1472
+ }
1473
+ walker.nextSibling();
1474
+ } else if (value2 >= 97 /* Over */) {
1475
+ value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */;
1476
+ while (value2--) {
1477
+ walker.nextSibling();
1478
+ }
1479
+ } else if (value2 >= 67 /* Next */) {
1480
+ value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */;
1481
+ while (value2--) {
1482
+ walker.nextNode();
1483
+ }
1484
+ } else if (value2 === 47 /* BeginChild */) {
1485
+ currentWalkIndex = walkInternal(
1486
+ walkCodes,
1487
+ scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global),
1488
+ cleanupOwnerScope,
1489
+ currentWalkIndex
1490
+ );
1491
+ } else if (value2 === 38 /* EndChild */) {
1492
+ return currentWalkIndex;
1493
+ } else if (value2 === 32 /* Get */) {
1494
+ scope[true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++] = walker.currentNode;
1495
+ } else {
1496
+ const newNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = document.createTextNode("");
1497
+ const current = walker.currentNode;
1498
+ const parentNode = current.parentNode;
1499
+ if (value2 !== 37 /* Replace */) {
1500
+ throw new Error(`Unknown walk code: ${value2}`);
1501
+ }
1502
+ parentNode.replaceChild(newNode, current);
1503
+ walker.currentNode = newNode;
1504
+ }
1505
+ }
1506
+ return currentWalkIndex;
1507
+ }
1508
+ function getDebugKey(index, node) {
1509
+ if (typeof node === "string") {
1510
+ return `${node}/${index}`;
1511
+ } else if (node.nodeType === 3 /* Text */) {
1512
+ return `#text/${index}`;
1513
+ } else if (node.nodeType === 8 /* Comment */) {
1514
+ return `#comment/${index}`;
1515
+ } else if (node.nodeType === 1 /* Element */) {
1516
+ return `#${node.tagName.toLowerCase()}/${index}`;
1517
+ }
1518
+ return index;
1519
+ }
1520
+
1521
+ // src/dom/renderer.ts
1522
+ function createScopeWithRenderer(renderer, $global, ownerScope) {
1523
+ const newScope = createScope($global);
1524
+ newScope._ = newScope.___cleanupOwner = renderer.___owner || ownerScope;
1525
+ newScope.___renderer = renderer;
1526
+ initRenderer(renderer, newScope);
1527
+ if (renderer.___closureSignals) {
1528
+ for (const signal of renderer.___closureSignals) {
1529
+ signal.___subscribe?.(newScope);
1530
+ }
1531
+ }
1532
+ return newScope;
1533
+ }
1534
+ function createScopeWithTagNameOrRenderer(tagNameOrRenderer, $global, ownerScope) {
1535
+ if (typeof tagNameOrRenderer !== "string") {
1536
+ return createScopeWithRenderer(tagNameOrRenderer, $global, ownerScope);
1537
+ }
1538
+ const newScope = createScope($global);
1539
+ newScope._ = newScope.___cleanupOwner = ownerScope;
1540
+ newScope[true ? `#${tagNameOrRenderer}/0` : 0] = newScope.___startNode = newScope.___endNode = document.createElement(tagNameOrRenderer);
1541
+ return newScope;
1542
+ }
1543
+ function initRenderer(renderer, scope) {
1544
+ const dom = renderer.___clone();
1545
+ walk(
1546
+ dom.nodeType === 11 /* DocumentFragment */ ? dom.firstChild : dom,
1547
+ renderer.___walks,
1548
+ scope
1549
+ );
1550
+ scope.___startNode = dom.nodeType === 11 /* DocumentFragment */ ? dom.firstChild : dom;
1551
+ scope.___endNode = dom.nodeType === 11 /* DocumentFragment */ ? dom.lastChild : dom;
1552
+ if (renderer.___setup) {
1553
+ renderer.___setup(scope);
1554
+ }
1555
+ return dom;
1556
+ }
1557
+ function dynamicTagAttrs(nodeAccessor, getRenderBody, inputIsArgs) {
1558
+ return (scope, attrsOrOp) => {
1559
+ const renderer = scope[nodeAccessor + "(" /* ConditionalRenderer */];
1560
+ if (!renderer || attrsOrOp === DIRTY) {
1561
+ return;
1562
+ }
1563
+ const childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
1564
+ if (attrsOrOp === MARK || attrsOrOp === CLEAN) {
1565
+ return renderer.___args?.(childScope, attrsOrOp);
1566
+ }
1567
+ const renderBody = getRenderBody?.(scope);
1568
+ if (typeof renderer === "string") {
1569
+ const nodeAccessor2 = true ? `#${renderer}/0` : 0;
1570
+ if (renderer === "textarea" && renderBody) {
1571
+ throw new Error(
1572
+ "A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
1573
+ );
1574
+ }
1575
+ setConditionalRendererOnlyChild(childScope, nodeAccessor2, renderBody);
1576
+ attrs(childScope, nodeAccessor2, attrsOrOp());
1577
+ } else if (renderer.___args) {
1578
+ const attributes = attrsOrOp();
1579
+ renderer.___args(
1580
+ childScope,
1581
+ inputIsArgs ? attributes : [
1582
+ renderBody ? {
1583
+ ...attributes,
1584
+ renderBody
1585
+ } : attributes
1586
+ ]
1587
+ );
1588
+ }
1589
+ };
1590
+ }
1591
+ function createRendererWithOwner(template, rawWalks, setup, getClosureSignals, getArgs) {
1592
+ let args;
1593
+ let closureSignals;
1594
+ const id = true ? Symbol("Marko Renderer") : {};
1595
+ const walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
1596
+ return (owner) => {
1597
+ return {
1598
+ ___id: id,
1599
+ ___template: template,
1600
+ ___walks: walks,
1601
+ ___setup: setup,
1602
+ ___clone: _clone,
1603
+ ___owner: owner,
1604
+ ___sourceNode: void 0,
1605
+ get ___args() {
1606
+ return args ||= getArgs?.();
1607
+ },
1608
+ get ___closureSignals() {
1609
+ return closureSignals ||= new Set(getClosureSignals?.());
1610
+ }
1611
+ };
1612
+ };
1613
+ }
1614
+ function createRenderer(template, walks, setup, getClosureSignals, getArgs) {
1615
+ return createRendererWithOwner(
1616
+ template,
1617
+ walks,
1618
+ setup,
1619
+ getClosureSignals,
1620
+ getArgs
1621
+ )();
1622
+ }
1623
+ function _clone() {
1624
+ return (this.___sourceNode ||= parseHTMLOrSingleNode(
1625
+ this.___template
1626
+ )).cloneNode(true);
1627
+ }
1628
+
1629
+ // src/dom/control-flow.ts
1630
+ function patchConditionals(fn) {
1631
+ conditional = fn(conditional);
1632
+ conditionalOnlyChild = fn(conditionalOnlyChild);
1633
+ }
1634
+ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1635
+ const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1636
+ const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
1637
+ let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1638
+ return (scope, newRendererOrOp) => {
1639
+ if (newRendererOrOp === DIRTY) return;
1640
+ let currentRenderer = scope[rendererAccessor];
1641
+ let op = newRendererOrOp;
1642
+ if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1643
+ const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1644
+ if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1645
+ currentRenderer = scope[rendererAccessor] = normalizedRenderer;
1646
+ setConditionalRenderer(scope, nodeAccessor, normalizedRenderer);
1647
+ fn && fn(scope);
1648
+ op = DIRTY;
1649
+ } else {
1650
+ op = CLEAN;
1651
+ }
1652
+ }
1653
+ intersection2?.(scope, op);
1654
+ renderBodyClosures(currentRenderer, scope[childScopeAccessor], op);
1655
+ };
1656
+ };
1657
+ function inConditionalScope(signal, nodeAccessor) {
1658
+ const scopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
1659
+ const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1660
+ return (scope, op) => {
1661
+ const conditionalScope = scope[scopeAccessor];
1662
+ if (conditionalScope) {
1663
+ const conditionalRenderer = scope[rendererAccessor];
1664
+ if (!conditionalRenderer?.___closureSignals || conditionalRenderer.___closureSignals.has(signal)) {
1665
+ signal(conditionalScope, op);
1666
+ }
1667
+ }
1668
+ };
1669
+ }
1670
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
1671
+ let newScope;
1672
+ let prevScope = scope[nodeAccessor + "!" /* ConditionalScope */];
1673
+ if (newRenderer) {
1674
+ newScope = scope[nodeAccessor + "!" /* ConditionalScope */] = createScopeWithTagNameOrRenderer(
1675
+ newRenderer,
1676
+ scope.$global,
1677
+ scope
1678
+ );
1679
+ prevScope = prevScope || getEmptyScope(scope[nodeAccessor]);
1680
+ } else {
1681
+ newScope = getEmptyScope(scope[nodeAccessor]);
1682
+ scope[nodeAccessor + "!" /* ConditionalScope */] = void 0;
1683
+ }
1684
+ insertBefore(
1685
+ newScope,
1686
+ prevScope.___startNode.parentNode,
1687
+ prevScope.___startNode
1688
+ );
1689
+ removeAndDestroyScope(prevScope);
1690
+ }
1691
+ var conditionalOnlyChild = function conditional3(nodeAccessor, fn, getIntersection) {
1692
+ const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1693
+ const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
1694
+ let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1695
+ return (scope, newRendererOrOp) => {
1696
+ if (newRendererOrOp === DIRTY) return;
1697
+ let currentRenderer = scope[rendererAccessor];
1698
+ let op = newRendererOrOp;
1699
+ if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1700
+ const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1701
+ if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1702
+ currentRenderer = scope[rendererAccessor] = normalizedRenderer;
1703
+ setConditionalRendererOnlyChild(
1704
+ scope,
1705
+ nodeAccessor,
1706
+ normalizedRenderer
1707
+ );
1708
+ fn && fn(scope);
1709
+ op = DIRTY;
1710
+ } else {
1711
+ op = CLEAN;
1712
+ }
1713
+ }
1714
+ intersection2?.(scope, op);
1715
+ renderBodyClosures(currentRenderer, scope[childScopeAccessor], op);
1716
+ };
1717
+ };
1718
+ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1719
+ const prevScope = scope[nodeAccessor + "!" /* ConditionalScope */];
1720
+ const referenceNode = scope[nodeAccessor];
1721
+ referenceNode.textContent = "";
1722
+ if (newRenderer) {
1723
+ const newScope = scope[nodeAccessor + "!" /* ConditionalScope */] = createScopeWithTagNameOrRenderer(newRenderer, scope.$global, scope);
1724
+ insertBefore(newScope, referenceNode, null);
1725
+ }
1726
+ prevScope && destroyScope(prevScope);
1727
+ }
1728
+ var emptyMarkerMap = /* @__PURE__ */ new Map([[Symbol(), getEmptyScope(void 0)]]);
1729
+ var emptyMarkerArray = [
1730
+ /* @__PURE__ */ getEmptyScope(void 0)
1731
+ ];
1732
+ var emptyMap = /* @__PURE__ */ new Map();
1733
+ var emptyArray = [];
1734
+ function loopOf(nodeAccessor, renderer) {
1735
+ return loop(
1736
+ nodeAccessor,
1737
+ renderer,
1738
+ ([all, by = bySecondArg], cb) => {
1739
+ if (typeof by === "string") {
1740
+ forOf(
1741
+ all,
1742
+ (item, i) => cb(item[by], [item, i])
1743
+ );
1744
+ } else {
1745
+ forOf(all, (item, i) => cb(by(item, i), [item, i]));
1746
+ }
1747
+ }
1748
+ );
1749
+ }
1750
+ function loopIn(nodeAccessor, renderer) {
1751
+ return loop(
1752
+ nodeAccessor,
1753
+ renderer,
1754
+ ([obj, by = byFirstArg], cb) => forIn(obj, (key, value2) => cb(by(key, value2), [key, value2]))
1755
+ );
1756
+ }
1757
+ function loopTo(nodeAccessor, renderer) {
1758
+ return loop(
1759
+ nodeAccessor,
1760
+ renderer,
1761
+ ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
1762
+ );
1763
+ }
1764
+ function loop(nodeAccessor, renderer, forEach) {
1765
+ const loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */;
1766
+ const closureSignals = renderer.___closureSignals;
1767
+ const params = renderer.___args;
1768
+ return (scope, valueOrOp) => {
1769
+ if (valueOrOp === DIRTY) return;
1770
+ if (valueOrOp === MARK || valueOrOp === CLEAN) {
1771
+ const loopScopes = scope[loopScopeAccessor] ?? scope[nodeAccessor + "(" /* LoopScopeMap */]?.values() ?? [];
1772
+ if (loopScopes !== emptyMarkerArray) {
1773
+ for (const childScope of loopScopes) {
1774
+ params?.(childScope, valueOrOp);
1775
+ for (const signal of closureSignals) {
1776
+ signal(childScope, valueOrOp);
1777
+ }
1778
+ }
1779
+ }
1780
+ return;
1781
+ }
1782
+ const referenceNode = scope[nodeAccessor];
1783
+ const referenceIsMarker = referenceNode.nodeType === 8 || referenceNode.nodeType === 3;
1784
+ const oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */] || (referenceIsMarker ? emptyMarkerMap : emptyMap);
1785
+ const oldArray = scope[nodeAccessor + "!" /* LoopScopeArray */] || Array.from(oldMap.values());
1786
+ let newMap;
1787
+ let newArray;
1788
+ let afterReference;
1789
+ let parentNode;
1790
+ let needsReconciliation = true;
1791
+ forEach(valueOrOp, (key, args) => {
1792
+ let childScope = oldMap.get(key);
1793
+ let closureOp = CLEAN;
1794
+ if (!childScope) {
1795
+ childScope = createScopeWithRenderer(renderer, scope.$global, scope);
1796
+ closureOp = DIRTY;
1797
+ } else {
1798
+ }
1799
+ if (params) {
1800
+ params(childScope, args);
1801
+ }
1802
+ if (closureSignals) {
1803
+ for (const signal of closureSignals) {
1804
+ signal(childScope, closureOp);
1805
+ }
1806
+ }
1807
+ if (newMap) {
1808
+ newMap.set(key, childScope);
1809
+ newArray.push(childScope);
1810
+ } else {
1811
+ newMap = /* @__PURE__ */ new Map([[key, childScope]]);
1812
+ newArray = [childScope];
1813
+ }
1814
+ });
1815
+ if (!newMap) {
1816
+ if (referenceIsMarker) {
1817
+ newMap = emptyMarkerMap;
1818
+ newArray = emptyMarkerArray;
1819
+ getEmptyScope(referenceNode);
1820
+ } else {
1821
+ oldArray.forEach(destroyScope);
1822
+ referenceNode.textContent = "";
1823
+ newMap = emptyMap;
1824
+ newArray = emptyArray;
1825
+ needsReconciliation = false;
1826
+ }
1827
+ }
1828
+ if (needsReconciliation) {
1829
+ if (referenceIsMarker) {
1830
+ if (oldMap === emptyMarkerMap) {
1831
+ getEmptyScope(referenceNode);
1832
+ }
1833
+ const oldLastChild = oldArray[oldArray.length - 1];
1834
+ afterReference = oldLastChild.___endNode.nextSibling;
1835
+ parentNode = oldLastChild.___startNode.parentNode;
1836
+ } else {
1837
+ afterReference = null;
1838
+ parentNode = referenceNode;
1839
+ }
1840
+ reconcile(parentNode, oldArray, newArray, afterReference);
1841
+ }
1842
+ scope[nodeAccessor + "(" /* LoopScopeMap */] = newMap;
1843
+ scope[nodeAccessor + "!" /* LoopScopeArray */] = newArray;
1844
+ };
1845
+ }
1846
+ function inLoopScope(signal, loopNodeAccessor) {
1847
+ const loopScopeAccessor = loopNodeAccessor + "!" /* LoopScopeArray */;
1848
+ return (scope, op) => {
1849
+ const loopScopes = scope[loopScopeAccessor] ?? scope[loopNodeAccessor + "(" /* LoopScopeMap */]?.values() ?? [];
1850
+ if (loopScopes !== emptyMarkerArray) {
1851
+ for (const scope2 of loopScopes) {
1852
+ signal(scope2, op);
1853
+ }
1854
+ }
1855
+ };
1856
+ }
1857
+ function bySecondArg(_item, index) {
1858
+ return index;
1859
+ }
1860
+ function byFirstArg(name) {
1861
+ return name;
1862
+ }
1863
+ function isDifferentRenderer(a, b) {
1864
+ return a !== b && (a?.___id || 0) !== b?.___id;
1865
+ }
1866
+
1867
+ // src/dom/compat.ts
1868
+ var classIdToScope = /* @__PURE__ */ new Map();
1869
+ var compat = {
1870
+ patchConditionals,
1871
+ queueEffect,
1872
+ init() {
1873
+ register(SET_SCOPE_REGISTER_ID, (scope) => {
1874
+ classIdToScope.set(scope.m5c, scope);
1875
+ });
1876
+ },
1877
+ registerRenderer(fn) {
1878
+ register(RENDERER_REGISTER_ID, fn);
1879
+ },
1880
+ isOp(value2) {
1881
+ return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
1882
+ },
1883
+ isRenderer(renderer) {
1884
+ return renderer.___clone !== void 0;
1885
+ },
1886
+ getStartNode(scope) {
1887
+ return scope.___startNode;
1888
+ },
1889
+ setScopeNodes(scope, startNode, endNode) {
1890
+ scope.___startNode = startNode;
1891
+ scope.___endNode = endNode;
1892
+ },
1893
+ runComponentEffects() {
1894
+ runEffects(this.effects);
1895
+ },
1896
+ resolveRegistered(value2, {
1897
+ runtimeId,
1898
+ componentIdPrefix
1899
+ }) {
1900
+ if (Array.isArray(value2) && typeof value2[0] === "string") {
1901
+ return getRegisteredWithScope(
1902
+ value2[0],
1903
+ value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.___scopeLookup[value2[1]]
1904
+ );
1905
+ }
1906
+ return value2;
1907
+ },
1908
+ createRenderer(setup, clone, args) {
1909
+ const renderer = createRenderer(
1910
+ "",
1911
+ void 0,
1912
+ setup,
1913
+ void 0,
1914
+ args && (() => args)
1915
+ );
1916
+ renderer.___clone = clone;
1917
+ return renderer;
1918
+ },
1919
+ render(out, component, renderer, input) {
1920
+ let scope = component.scope;
1921
+ if (!scope) {
1922
+ scope = classIdToScope.get(component.id);
1923
+ if (scope) {
1924
+ component.scope = scope;
1925
+ classIdToScope.delete(component.id);
1926
+ }
1927
+ }
1928
+ const args = renderer.___args || noop;
1929
+ let existing = false;
1930
+ component.effects = prepareEffects(() => {
1931
+ if (!scope) {
1932
+ scope = component.scope = createScopeWithRenderer(renderer, out.global);
1933
+ const closures = renderer.___closureSignals;
1934
+ if (closures) {
1935
+ for (const signal of closures) {
1936
+ signal(component.scope, CLEAN);
1937
+ }
1938
+ }
1939
+ } else {
1940
+ args(scope, MARK);
1941
+ existing = true;
1942
+ }
1943
+ args(scope, input);
1944
+ });
1945
+ if (!existing) {
1946
+ return scope.___startNode === scope.___endNode ? scope.___startNode : scope.___startNode.parentNode;
1947
+ }
1948
+ }
1949
+ };
1950
+ function noop() {
1951
+ }
1952
+
1953
+ // src/dom/template.ts
1954
+ var createTemplate = (templateId, ...rendererArgs) => {
1955
+ const renderer = createRenderer(...rendererArgs);
1956
+ renderer.mount = mount;
1957
+ renderer._ = renderer;
1958
+ if (true) {
1959
+ renderer.render = () => {
1960
+ throw new Error(
1961
+ `render() is not implemented for the DOM compilation of a Marko template`
1962
+ );
1963
+ };
1964
+ }
1965
+ return register(templateId, renderer);
1966
+ };
1967
+ function mount(input = {}, reference, position) {
1968
+ let scope, dom;
1969
+ let { $global } = input;
1970
+ if ($global) {
1971
+ ({ $global, ...input } = input);
1972
+ $global = {
1973
+ runtimeId: DEFAULT_RUNTIME_ID,
1974
+ renderId: DEFAULT_RENDER_ID,
1975
+ ...$global
1976
+ };
1977
+ } else {
1978
+ $global = {
1979
+ runtimeId: DEFAULT_RUNTIME_ID,
1980
+ renderId: DEFAULT_RENDER_ID
1981
+ };
1982
+ }
1983
+ const args = this.___args;
1984
+ const effects = prepareEffects(() => {
1985
+ scope = createScope($global);
1986
+ dom = initRenderer(this, scope);
1987
+ if (args) {
1988
+ args(scope, [input]);
1989
+ }
1990
+ });
1991
+ switch (position) {
1992
+ case "afterbegin":
1993
+ reference.insertBefore(dom, reference.firstChild);
1994
+ break;
1995
+ case "afterend":
1996
+ reference.parentElement.insertBefore(dom, reference.nextSibling);
1997
+ break;
1998
+ case "beforebegin":
1999
+ reference.parentElement.insertBefore(dom, reference);
2000
+ break;
2001
+ default:
2002
+ reference.appendChild(dom);
2003
+ break;
2004
+ }
2005
+ runEffects(effects);
2006
+ return {
2007
+ update: (newInput) => {
2008
+ if (args) {
2009
+ runEffects(
2010
+ prepareEffects(() => {
2011
+ args(scope, MARK);
2012
+ args(scope, [newInput]);
2013
+ })
2014
+ );
2015
+ }
2016
+ },
2017
+ destroy: () => {
2018
+ removeAndDestroyScope(scope);
2019
+ }
2020
+ };
2021
+ }
2022
+ export {
2023
+ attr,
2024
+ attrTag,
2025
+ attrTags,
2026
+ attrs,
2027
+ attrsEvents,
2028
+ childClosures,
2029
+ classAttr,
2030
+ closure,
2031
+ compat,
2032
+ conditional,
2033
+ conditionalOnlyChild,
2034
+ controllable_detailsOrDialog_open,
2035
+ controllable_detailsOrDialog_open_effect,
2036
+ controllable_input_checked,
2037
+ controllable_input_checkedValue,
2038
+ controllable_input_checkedValue_effect,
2039
+ controllable_input_checked_effect,
2040
+ controllable_input_value,
2041
+ controllable_input_value_effect,
2042
+ controllable_select_value,
2043
+ controllable_select_value_effect,
2044
+ controllable_input_value as controllable_textarea_value,
2045
+ controllable_input_value_effect as controllable_textarea_value_effect,
2046
+ createRenderer,
2047
+ createRendererWithOwner,
2048
+ createScope,
2049
+ createTemplate,
2050
+ data,
2051
+ dynamicClosure,
2052
+ dynamicSubscribers,
2053
+ dynamicTagAttrs,
2054
+ effect,
2055
+ forIn,
2056
+ forOf,
2057
+ forTo,
2058
+ getAbortSignal,
2059
+ html,
2060
+ inChild,
2061
+ inConditionalScope,
2062
+ inLoopScope,
2063
+ init,
2064
+ intersection,
2065
+ intersections,
2066
+ lifecycle,
2067
+ loopIn,
2068
+ loopOf,
2069
+ loopTo,
2070
+ nextTagId,
2071
+ nodeRef,
2072
+ on,
2073
+ partialAttrs,
2074
+ props,
2075
+ register,
2076
+ registerBoundSignal,
2077
+ registerSubscriber,
2078
+ resetAbortSignal,
2079
+ run,
2080
+ setTagVar,
2081
+ setTagVarChange,
2082
+ state,
2083
+ styleAttr,
2084
+ tagVarSignal,
2085
+ tagVarSignalChange,
2086
+ textContent,
2087
+ value
2088
+ };