mongoku 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +78 -32
  2. package/build/client/_app/immutable/assets/0.BHsXFfsc.css +1 -0
  3. package/build/client/_app/immutable/assets/0.BHsXFfsc.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.BHsXFfsc.css.gz +0 -0
  5. package/build/client/_app/immutable/assets/3.CRKE8WvY.css +1 -0
  6. package/build/client/_app/immutable/assets/3.CRKE8WvY.css.br +2 -0
  7. package/build/client/_app/immutable/assets/3.CRKE8WvY.css.gz +0 -0
  8. package/build/client/_app/immutable/assets/6.DawdmtJd.css +1 -0
  9. package/build/client/_app/immutable/assets/6.DawdmtJd.css.br +2 -0
  10. package/build/client/_app/immutable/assets/6.DawdmtJd.css.gz +0 -0
  11. package/build/client/_app/immutable/assets/Panel.BDHMtO-3.css +1 -0
  12. package/build/client/_app/immutable/assets/Panel.BDHMtO-3.css.br +0 -0
  13. package/build/client/_app/immutable/assets/Panel.BDHMtO-3.css.gz +0 -0
  14. package/build/client/_app/immutable/assets/PrettyJson.CtngcfyW.css +1 -0
  15. package/build/client/_app/immutable/assets/PrettyJson.CtngcfyW.css.br +0 -0
  16. package/build/client/_app/immutable/assets/PrettyJson.CtngcfyW.css.gz +0 -0
  17. package/build/client/_app/immutable/assets/cuprum-cyrillic-400-normal.Cnibl3-L.woff2 +0 -0
  18. package/build/client/_app/immutable/assets/cuprum-cyrillic-400-normal.RKIjpA76.woff +0 -0
  19. package/build/client/_app/immutable/assets/cuprum-cyrillic-ext-400-normal.CT5q4ZVh.woff2 +0 -0
  20. package/build/client/_app/immutable/assets/cuprum-cyrillic-ext-400-normal.iCCFJ4Gn.woff +0 -0
  21. package/build/client/_app/immutable/assets/cuprum-latin-400-normal.Cbwtr8a4.woff +0 -0
  22. package/build/client/_app/immutable/assets/cuprum-latin-400-normal.CjFvNwMJ.woff2 +0 -0
  23. package/build/client/_app/immutable/assets/cuprum-latin-ext-400-normal.BWTJtpjo.woff2 +0 -0
  24. package/build/client/_app/immutable/assets/cuprum-latin-ext-400-normal.BZXayy47.woff +0 -0
  25. package/build/client/_app/immutable/assets/cuprum-vietnamese-400-normal.uXRi1gw5.woff +0 -0
  26. package/build/client/_app/immutable/assets/rajdhani-devanagari-400-normal.BdIzgbsr.woff +0 -0
  27. package/build/client/_app/immutable/assets/rajdhani-devanagari-400-normal.CTuj2HZW.woff2 +0 -0
  28. package/build/client/_app/immutable/assets/rajdhani-latin-400-normal.C6_q4usG.woff +0 -0
  29. package/build/client/_app/immutable/assets/rajdhani-latin-400-normal.CurJOxDW.woff2 +0 -0
  30. package/build/client/_app/immutable/assets/rajdhani-latin-ext-400-normal.DACPYgMx.woff2 +0 -0
  31. package/build/client/_app/immutable/assets/rajdhani-latin-ext-400-normal.Der7ynDE.woff +0 -0
  32. package/build/client/_app/immutable/chunks/B-Z1NsR7.js +1 -0
  33. package/build/client/_app/immutable/chunks/B-Z1NsR7.js.br +0 -0
  34. package/build/client/_app/immutable/chunks/B-Z1NsR7.js.gz +0 -0
  35. package/build/client/_app/immutable/chunks/BEuO9qGi.js +1 -0
  36. package/build/client/_app/immutable/chunks/BEuO9qGi.js.br +0 -0
  37. package/build/client/_app/immutable/chunks/BEuO9qGi.js.gz +0 -0
  38. package/build/client/_app/immutable/chunks/BN_N9-2s.js +1 -0
  39. package/build/client/_app/immutable/chunks/BN_N9-2s.js.br +0 -0
  40. package/build/client/_app/immutable/chunks/BN_N9-2s.js.gz +0 -0
  41. package/build/client/_app/immutable/chunks/BuIrCFA_.js +1 -0
  42. package/build/client/_app/immutable/chunks/BuIrCFA_.js.br +0 -0
  43. package/build/client/_app/immutable/chunks/BuIrCFA_.js.gz +0 -0
  44. package/build/client/_app/immutable/chunks/C9b4uNov.js +1 -0
  45. package/build/client/_app/immutable/chunks/C9b4uNov.js.br +0 -0
  46. package/build/client/_app/immutable/chunks/C9b4uNov.js.gz +0 -0
  47. package/build/client/_app/immutable/chunks/CIYBIyvN.js +1 -0
  48. package/build/client/_app/immutable/chunks/CIYBIyvN.js.br +0 -0
  49. package/build/client/_app/immutable/chunks/CIYBIyvN.js.gz +0 -0
  50. package/build/client/_app/immutable/chunks/CWUhQKKC.js +1 -0
  51. package/build/client/_app/immutable/chunks/CWUhQKKC.js.br +0 -0
  52. package/build/client/_app/immutable/chunks/CWUhQKKC.js.gz +0 -0
  53. package/build/client/_app/immutable/chunks/CrJSDly5.js +2 -0
  54. package/build/client/_app/immutable/chunks/CrJSDly5.js.br +0 -0
  55. package/build/client/_app/immutable/chunks/CrJSDly5.js.gz +0 -0
  56. package/build/client/_app/immutable/chunks/DRy_44ib.js +1 -0
  57. package/build/client/_app/immutable/chunks/DRy_44ib.js.br +0 -0
  58. package/build/client/_app/immutable/chunks/DRy_44ib.js.gz +0 -0
  59. package/build/client/_app/immutable/chunks/DS5yzhLt.js +1 -0
  60. package/build/client/_app/immutable/chunks/DS5yzhLt.js.br +0 -0
  61. package/build/client/_app/immutable/chunks/DS5yzhLt.js.gz +0 -0
  62. package/build/client/_app/immutable/chunks/DZSJW-Zm.js +1 -0
  63. package/build/client/_app/immutable/chunks/DZSJW-Zm.js.br +0 -0
  64. package/build/client/_app/immutable/chunks/DZSJW-Zm.js.gz +0 -0
  65. package/build/client/_app/immutable/chunks/Dbyirw23.js +14 -0
  66. package/build/client/_app/immutable/chunks/Dbyirw23.js.br +0 -0
  67. package/build/client/_app/immutable/chunks/Dbyirw23.js.gz +0 -0
  68. package/build/client/_app/immutable/chunks/DsnmJJEf.js +1 -0
  69. package/build/client/_app/immutable/chunks/DsnmJJEf.js.br +2 -0
  70. package/build/client/_app/immutable/chunks/DsnmJJEf.js.gz +0 -0
  71. package/build/client/_app/immutable/chunks/DzSHMQR7.js +1 -0
  72. package/build/client/_app/immutable/chunks/DzSHMQR7.js.br +0 -0
  73. package/build/client/_app/immutable/chunks/DzSHMQR7.js.gz +0 -0
  74. package/build/client/_app/immutable/chunks/W-qL5_8w.js +1 -0
  75. package/build/client/_app/immutable/chunks/W-qL5_8w.js.br +0 -0
  76. package/build/client/_app/immutable/chunks/W-qL5_8w.js.gz +0 -0
  77. package/build/client/_app/immutable/chunks/aB6hH3ax.js +3 -0
  78. package/build/client/_app/immutable/chunks/aB6hH3ax.js.br +0 -0
  79. package/build/client/_app/immutable/chunks/aB6hH3ax.js.gz +0 -0
  80. package/build/client/_app/immutable/chunks/nJ6DKbk8.js +1 -0
  81. package/build/client/_app/immutable/chunks/nJ6DKbk8.js.br +0 -0
  82. package/build/client/_app/immutable/chunks/nJ6DKbk8.js.gz +0 -0
  83. package/build/client/_app/immutable/chunks/zeTqHWB5.js +2 -0
  84. package/build/client/_app/immutable/chunks/zeTqHWB5.js.br +0 -0
  85. package/build/client/_app/immutable/chunks/zeTqHWB5.js.gz +0 -0
  86. package/build/client/_app/immutable/entry/app.CW91YXu8.js +2 -0
  87. package/build/client/_app/immutable/entry/app.CW91YXu8.js.br +0 -0
  88. package/build/client/_app/immutable/entry/app.CW91YXu8.js.gz +0 -0
  89. package/build/client/_app/immutable/entry/start.CidwPVgO.js +1 -0
  90. package/build/client/_app/immutable/entry/start.CidwPVgO.js.br +2 -0
  91. package/build/client/_app/immutable/entry/start.CidwPVgO.js.gz +0 -0
  92. package/build/client/_app/immutable/nodes/0.B2lBDs71.js +1 -0
  93. package/build/client/_app/immutable/nodes/0.B2lBDs71.js.br +0 -0
  94. package/build/client/_app/immutable/nodes/0.B2lBDs71.js.gz +0 -0
  95. package/build/client/_app/immutable/nodes/1.CueZCvtl.js +1 -0
  96. package/build/client/_app/immutable/nodes/1.CueZCvtl.js.br +0 -0
  97. package/build/client/_app/immutable/nodes/1.CueZCvtl.js.gz +0 -0
  98. package/build/client/_app/immutable/nodes/3.alYAlI3j.js +1 -0
  99. package/build/client/_app/immutable/nodes/3.alYAlI3j.js.br +0 -0
  100. package/build/client/_app/immutable/nodes/3.alYAlI3j.js.gz +0 -0
  101. package/build/client/_app/immutable/nodes/4.BqBphmVX.js +1 -0
  102. package/build/client/_app/immutable/nodes/4.BqBphmVX.js.br +0 -0
  103. package/build/client/_app/immutable/nodes/4.BqBphmVX.js.gz +0 -0
  104. package/build/client/_app/immutable/nodes/5.BkAWRgl4.js +1 -0
  105. package/build/client/_app/immutable/nodes/5.BkAWRgl4.js.br +0 -0
  106. package/build/client/_app/immutable/nodes/5.BkAWRgl4.js.gz +0 -0
  107. package/build/client/_app/immutable/nodes/6.KI4mq5ln.js +1 -0
  108. package/build/client/_app/immutable/nodes/6.KI4mq5ln.js.br +0 -0
  109. package/build/client/_app/immutable/nodes/6.KI4mq5ln.js.gz +0 -0
  110. package/build/client/_app/immutable/nodes/7.Brjrw0K8.js +1 -0
  111. package/build/client/_app/immutable/nodes/7.Brjrw0K8.js.br +0 -0
  112. package/build/client/_app/immutable/nodes/7.Brjrw0K8.js.gz +0 -0
  113. package/build/client/_app/version.json +1 -0
  114. package/build/client/_app/version.json.br +0 -0
  115. package/build/client/_app/version.json.gz +0 -0
  116. package/build/client/robots.txt +3 -0
  117. package/build/env.js +45 -0
  118. package/build/handler.js +1376 -0
  119. package/build/index.js +334 -0
  120. package/build/server/chunks/0-BGoFMRn2.js +21 -0
  121. package/build/server/chunks/0-BGoFMRn2.js.map +1 -0
  122. package/build/server/chunks/1-Ch0AY58K.js +9 -0
  123. package/build/server/chunks/1-Ch0AY58K.js.map +1 -0
  124. package/build/server/chunks/2-B39zPvzn.js +19 -0
  125. package/build/server/chunks/2-B39zPvzn.js.map +1 -0
  126. package/build/server/chunks/3-Bmk9Qof9.js +69 -0
  127. package/build/server/chunks/3-Bmk9Qof9.js.map +1 -0
  128. package/build/server/chunks/4-DnpScx2e.js +57 -0
  129. package/build/server/chunks/4-DnpScx2e.js.map +1 -0
  130. package/build/server/chunks/5-Bw8bTTBj.js +39 -0
  131. package/build/server/chunks/5-Bw8bTTBj.js.map +1 -0
  132. package/build/server/chunks/6-D8zNoyW_.js +197 -0
  133. package/build/server/chunks/6-D8zNoyW_.js.map +1 -0
  134. package/build/server/chunks/7-Cim4qVL3.js +42 -0
  135. package/build/server/chunks/7-Cim4qVL3.js.map +1 -0
  136. package/build/server/chunks/JsonEncoder-jJ2OBaud.js +62 -0
  137. package/build/server/chunks/JsonEncoder-jJ2OBaud.js.map +1 -0
  138. package/build/server/chunks/Panel-DTdYk-gk.js +37 -0
  139. package/build/server/chunks/Panel-DTdYk-gk.js.map +1 -0
  140. package/build/server/chunks/PrettyJson-wIuHvehp.js +290 -0
  141. package/build/server/chunks/PrettyJson-wIuHvehp.js.map +1 -0
  142. package/build/server/chunks/TooltipTable-J278e1CA.js +15 -0
  143. package/build/server/chunks/TooltipTable-J278e1CA.js.map +1 -0
  144. package/build/server/chunks/_layout.svelte-D7RD9tLN.js +108 -0
  145. package/build/server/chunks/_layout.svelte-D7RD9tLN.js.map +1 -0
  146. package/build/server/chunks/_page.svelte-4PYYtPii.js +119 -0
  147. package/build/server/chunks/_page.svelte-4PYYtPii.js.map +1 -0
  148. package/build/server/chunks/_page.svelte-Be5VTn1e.js +82 -0
  149. package/build/server/chunks/_page.svelte-Be5VTn1e.js.map +1 -0
  150. package/build/server/chunks/_page.svelte-DIPUjSjm.js +118 -0
  151. package/build/server/chunks/_page.svelte-DIPUjSjm.js.map +1 -0
  152. package/build/server/chunks/_page.svelte-DZ59Sr3N.js +192 -0
  153. package/build/server/chunks/_page.svelte-DZ59Sr3N.js.map +1 -0
  154. package/build/server/chunks/_page.svelte-sdKGQrEF.js +91 -0
  155. package/build/server/chunks/_page.svelte-sdKGQrEF.js.map +1 -0
  156. package/build/server/chunks/_server.ts-BIRebnb3.js +20 -0
  157. package/build/server/chunks/_server.ts-BIRebnb3.js.map +1 -0
  158. package/build/server/chunks/_server.ts-MnKJDybo.js +19 -0
  159. package/build/server/chunks/_server.ts-MnKJDybo.js.map +1 -0
  160. package/build/server/chunks/_server.ts-Tog8k3Mh.js +52 -0
  161. package/build/server/chunks/_server.ts-Tog8k3Mh.js.map +1 -0
  162. package/build/server/chunks/client-BZtxOgbR.js +7 -0
  163. package/build/server/chunks/client-BZtxOgbR.js.map +1 -0
  164. package/build/server/chunks/client2-LilSGYJA.js +26 -0
  165. package/build/server/chunks/client2-LilSGYJA.js.map +1 -0
  166. package/build/server/chunks/context-BU6gUbSI.js +137 -0
  167. package/build/server/chunks/context-BU6gUbSI.js.map +1 -0
  168. package/build/server/chunks/error.svelte-BfneeC-d.js +16 -0
  169. package/build/server/chunks/error.svelte-BfneeC-d.js.map +1 -0
  170. package/build/server/chunks/exports-DiyTWREe.js +198 -0
  171. package/build/server/chunks/exports-DiyTWREe.js.map +1 -0
  172. package/build/server/chunks/filters-CbFjTNFI.js +25 -0
  173. package/build/server/chunks/filters-CbFjTNFI.js.map +1 -0
  174. package/build/server/chunks/hooks.server-DNhdbQNi.js +7 -0
  175. package/build/server/chunks/hooks.server-DNhdbQNi.js.map +1 -0
  176. package/build/server/chunks/index-Djsj11qr.js +214 -0
  177. package/build/server/chunks/index-Djsj11qr.js.map +1 -0
  178. package/build/server/chunks/index-XFKuhGxM.js +68 -0
  179. package/build/server/chunks/index-XFKuhGxM.js.map +1 -0
  180. package/build/server/chunks/index3-CUhdJ7wv.js +24 -0
  181. package/build/server/chunks/index3-CUhdJ7wv.js.map +1 -0
  182. package/build/server/chunks/mongo-dLmCShL_.js +234 -0
  183. package/build/server/chunks/mongo-dLmCShL_.js.map +1 -0
  184. package/build/server/chunks/notifications.svelte-CrTIrfvL.js +38 -0
  185. package/build/server/chunks/notifications.svelte-CrTIrfvL.js.map +1 -0
  186. package/build/server/chunks/routing-zIlQn_LN.js +899 -0
  187. package/build/server/chunks/routing-zIlQn_LN.js.map +1 -0
  188. package/build/server/chunks/server2-DfQrrcsk.js +23 -0
  189. package/build/server/chunks/server2-DfQrrcsk.js.map +1 -0
  190. package/build/server/chunks/state.svelte-s-CFCWQX.js +9 -0
  191. package/build/server/chunks/state.svelte-s-CFCWQX.js.map +1 -0
  192. package/build/server/index.js +7451 -0
  193. package/build/server/index.js.map +1 -0
  194. package/build/server/manifest.js +107 -0
  195. package/build/server/manifest.js.map +1 -0
  196. package/build/shims.js +32 -0
  197. package/dist/cli.js +118 -47
  198. package/package.json +80 -38
  199. package/dist/app/3rdpartylicenses.txt +0 -403
  200. package/dist/app/index.html +0 -14
  201. package/dist/app/main.b6ca51a4b392e286bb41.js +0 -1
  202. package/dist/app/polyfills.9d6088873d2a3c33ec93.js +0 -1
  203. package/dist/app/runtime.26209474bfa8dc87a77c.js +0 -1
  204. package/dist/app/styles.9e36674febaa92f30d0e.css +0 -6
  205. package/dist/lib/Collection.js +0 -74
  206. package/dist/lib/Database.js +0 -55
  207. package/dist/lib/Factory.js +0 -31
  208. package/dist/lib/HostsManager.js +0 -79
  209. package/dist/lib/JsonEncoder.js +0 -59
  210. package/dist/lib/MongoManager.js +0 -119
  211. package/dist/lib/Server.js +0 -45
  212. package/dist/lib/Utils.js +0 -20
  213. package/dist/routes/api.js +0 -191
  214. package/dist/server.js +0 -56
@@ -0,0 +1,899 @@
1
+ import { l as set_ssr_context, m as ssr_context, p as push, q as pop, j as escape_html, u as is_promise, n as noop } from './context-BU6gUbSI.js';
2
+
3
+ let base = "";
4
+ let assets = base;
5
+ const app_dir = "_app";
6
+ const relative = true;
7
+ const initial = { base, assets };
8
+ const initial_base = initial.base;
9
+ function override(paths) {
10
+ base = paths.base;
11
+ assets = paths.assets;
12
+ }
13
+ function reset() {
14
+ base = initial.base;
15
+ assets = initial.assets;
16
+ }
17
+
18
+ const DERIVED = 1 << 1;
19
+ const EFFECT = 1 << 2;
20
+ const RENDER_EFFECT = 1 << 3;
21
+ const BLOCK_EFFECT = 1 << 4;
22
+ const BRANCH_EFFECT = 1 << 5;
23
+ const ROOT_EFFECT = 1 << 6;
24
+ const BOUNDARY_EFFECT = 1 << 7;
25
+ const UNOWNED = 1 << 8;
26
+ const DISCONNECTED = 1 << 9;
27
+ const CLEAN = 1 << 10;
28
+ const DIRTY = 1 << 11;
29
+ const MAYBE_DIRTY = 1 << 12;
30
+ const INERT = 1 << 13;
31
+ const DESTROYED = 1 << 14;
32
+ const EFFECT_RAN = 1 << 15;
33
+ const EFFECT_TRANSPARENT = 1 << 16;
34
+ const INSPECT_EFFECT = 1 << 17;
35
+ const HEAD_EFFECT = 1 << 18;
36
+ const EFFECT_PRESERVED = 1 << 19;
37
+ const USER_EFFECT = 1 << 20;
38
+ const REACTION_IS_UPDATING = 1 << 21;
39
+ const ASYNC = 1 << 22;
40
+ const ERROR_VALUE = 1 << 23;
41
+ const STATE_SYMBOL = Symbol("$state");
42
+ const LEGACY_PROPS = Symbol("legacy props");
43
+ const STALE_REACTION = new class StaleReactionError extends Error {
44
+ name = "StaleReactionError";
45
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
46
+ }();
47
+ const COMMENT_NODE = 8;
48
+ const HYDRATION_START = "[";
49
+ const HYDRATION_START_ELSE = "[!";
50
+ const HYDRATION_END = "]";
51
+ const HYDRATION_ERROR = {};
52
+ const ELEMENT_IS_NAMESPACED = 1;
53
+ const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
54
+ const ELEMENT_IS_INPUT = 1 << 2;
55
+ const UNINITIALIZED = Symbol();
56
+ const DOM_BOOLEAN_ATTRIBUTES = [
57
+ "allowfullscreen",
58
+ "async",
59
+ "autofocus",
60
+ "autoplay",
61
+ "checked",
62
+ "controls",
63
+ "default",
64
+ "disabled",
65
+ "formnovalidate",
66
+ "indeterminate",
67
+ "inert",
68
+ "ismap",
69
+ "loop",
70
+ "multiple",
71
+ "muted",
72
+ "nomodule",
73
+ "novalidate",
74
+ "open",
75
+ "playsinline",
76
+ "readonly",
77
+ "required",
78
+ "reversed",
79
+ "seamless",
80
+ "selected",
81
+ "webkitdirectory",
82
+ "defer",
83
+ "disablepictureinpicture",
84
+ "disableremoteplayback"
85
+ ];
86
+ function is_boolean_attribute(name) {
87
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
88
+ }
89
+ const PASSIVE_EVENTS = ["touchstart", "touchmove"];
90
+ function is_passive_event(name) {
91
+ return PASSIVE_EVENTS.includes(name);
92
+ }
93
+ function r(e) {
94
+ var t, f, n = "";
95
+ if ("string" == typeof e || "number" == typeof e) n += e;
96
+ else if ("object" == typeof e) if (Array.isArray(e)) {
97
+ var o = e.length;
98
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
99
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
100
+ return n;
101
+ }
102
+ function clsx$1() {
103
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
104
+ return n;
105
+ }
106
+ const replacements = {
107
+ translate: /* @__PURE__ */ new Map([
108
+ [true, "yes"],
109
+ [false, "no"]
110
+ ])
111
+ };
112
+ function attr(name, value, is_boolean = false) {
113
+ if (name === "hidden" && value !== "until-found") {
114
+ is_boolean = true;
115
+ }
116
+ if (value == null || !value && is_boolean) return "";
117
+ const normalized = name in replacements && replacements[name].get(value) || value;
118
+ const assignment = is_boolean ? "" : `="${escape_html(normalized, true)}"`;
119
+ return ` ${name}${assignment}`;
120
+ }
121
+ function clsx(value) {
122
+ if (typeof value === "object") {
123
+ return clsx$1(value);
124
+ } else {
125
+ return value ?? "";
126
+ }
127
+ }
128
+ const whitespace = [..." \n\r\f \v\uFEFF"];
129
+ function to_class(value, hash, directives) {
130
+ var classname = value == null ? "" : "" + value;
131
+ if (hash) {
132
+ classname = classname ? classname + " " + hash : hash;
133
+ }
134
+ if (directives) {
135
+ for (var key in directives) {
136
+ if (directives[key]) {
137
+ classname = classname ? classname + " " + key : key;
138
+ } else if (classname.length) {
139
+ var len = key.length;
140
+ var a = 0;
141
+ while ((a = classname.indexOf(key, a)) >= 0) {
142
+ var b = a + len;
143
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
144
+ classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
145
+ } else {
146
+ a = b;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ return classname === "" ? null : classname;
153
+ }
154
+ function append_styles(styles, important = false) {
155
+ var separator = important ? " !important;" : ";";
156
+ var css = "";
157
+ for (var key in styles) {
158
+ var value = styles[key];
159
+ if (value != null && value !== "") {
160
+ css += " " + key + ": " + value + separator;
161
+ }
162
+ }
163
+ return css;
164
+ }
165
+ function to_css_name(name) {
166
+ if (name[0] !== "-" || name[1] !== "-") {
167
+ return name.toLowerCase();
168
+ }
169
+ return name;
170
+ }
171
+ function to_style(value, styles) {
172
+ if (styles) {
173
+ var new_style = "";
174
+ var normal_styles;
175
+ var important_styles;
176
+ if (Array.isArray(styles)) {
177
+ normal_styles = styles[0];
178
+ important_styles = styles[1];
179
+ } else {
180
+ normal_styles = styles;
181
+ }
182
+ if (value) {
183
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
184
+ var in_str = false;
185
+ var in_apo = 0;
186
+ var in_comment = false;
187
+ var reserved_names = [];
188
+ if (normal_styles) {
189
+ reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
190
+ }
191
+ if (important_styles) {
192
+ reserved_names.push(...Object.keys(important_styles).map(to_css_name));
193
+ }
194
+ var start_index = 0;
195
+ var name_index = -1;
196
+ const len = value.length;
197
+ for (var i = 0; i < len; i++) {
198
+ var c = value[i];
199
+ if (in_comment) {
200
+ if (c === "/" && value[i - 1] === "*") {
201
+ in_comment = false;
202
+ }
203
+ } else if (in_str) {
204
+ if (in_str === c) {
205
+ in_str = false;
206
+ }
207
+ } else if (c === "/" && value[i + 1] === "*") {
208
+ in_comment = true;
209
+ } else if (c === '"' || c === "'") {
210
+ in_str = c;
211
+ } else if (c === "(") {
212
+ in_apo++;
213
+ } else if (c === ")") {
214
+ in_apo--;
215
+ }
216
+ if (!in_comment && in_str === false && in_apo === 0) {
217
+ if (c === ":" && name_index === -1) {
218
+ name_index = i;
219
+ } else if (c === ";" || i === len - 1) {
220
+ if (name_index !== -1) {
221
+ var name = to_css_name(value.substring(start_index, name_index).trim());
222
+ if (!reserved_names.includes(name)) {
223
+ if (c !== ";") {
224
+ i++;
225
+ }
226
+ var property = value.substring(start_index, i).trim();
227
+ new_style += " " + property + ";";
228
+ }
229
+ }
230
+ start_index = i + 1;
231
+ name_index = -1;
232
+ }
233
+ }
234
+ }
235
+ }
236
+ if (normal_styles) {
237
+ new_style += append_styles(normal_styles);
238
+ }
239
+ if (important_styles) {
240
+ new_style += append_styles(important_styles, true);
241
+ }
242
+ new_style = new_style.trim();
243
+ return new_style === "" ? null : new_style;
244
+ }
245
+ return value == null ? null : String(value);
246
+ }
247
+ const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
248
+ const BLOCK_OPEN_ELSE = `<!--${HYDRATION_START_ELSE}-->`;
249
+ const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
250
+ let controller = null;
251
+ function abort() {
252
+ controller?.abort(STALE_REACTION);
253
+ controller = null;
254
+ }
255
+ function await_invalid() {
256
+ const error = new Error(`await_invalid
257
+ Encountered asynchronous work while rendering synchronously.
258
+ https://svelte.dev/e/await_invalid`);
259
+ error.name = "Svelte error";
260
+ throw error;
261
+ }
262
+ function experimental_async_ssr() {
263
+ {
264
+ console.warn(`https://svelte.dev/e/experimental_async_ssr`);
265
+ }
266
+ }
267
+ class Renderer {
268
+ /**
269
+ * The contents of the renderer.
270
+ * @type {RendererItem[]}
271
+ */
272
+ #out = [];
273
+ /**
274
+ * Any `onDestroy` callbacks registered during execution of this renderer.
275
+ * @type {(() => void)[] | undefined}
276
+ */
277
+ #on_destroy = void 0;
278
+ /**
279
+ * Whether this renderer is a component body.
280
+ * @type {boolean}
281
+ */
282
+ #is_component_body = false;
283
+ /**
284
+ * The type of string content that this renderer is accumulating.
285
+ * @type {RendererType}
286
+ */
287
+ type;
288
+ /** @type {Renderer | undefined} */
289
+ #parent;
290
+ /**
291
+ * Asynchronous work associated with this renderer
292
+ * @type {Promise<void> | undefined}
293
+ */
294
+ promise = void 0;
295
+ /**
296
+ * State which is associated with the content tree as a whole.
297
+ * It will be re-exposed, uncopied, on all children.
298
+ * @type {SSRState}
299
+ * @readonly
300
+ */
301
+ global;
302
+ /**
303
+ * State that is local to the branch it is declared in.
304
+ * It will be shallow-copied to all children.
305
+ *
306
+ * @type {{ select_value: string | undefined }}
307
+ */
308
+ local;
309
+ /**
310
+ * @param {SSRState} global
311
+ * @param {Renderer | undefined} [parent]
312
+ */
313
+ constructor(global, parent) {
314
+ this.#parent = parent;
315
+ this.global = global;
316
+ this.local = parent ? { ...parent.local } : { select_value: void 0 };
317
+ this.type = parent ? parent.type : "body";
318
+ }
319
+ /**
320
+ * @param {(renderer: Renderer) => void} fn
321
+ */
322
+ head(fn) {
323
+ const head = new Renderer(this.global, this);
324
+ head.type = "head";
325
+ this.#out.push(head);
326
+ head.child(fn);
327
+ }
328
+ /**
329
+ * @param {(renderer: Renderer) => void} fn
330
+ */
331
+ async(fn) {
332
+ this.#out.push(BLOCK_OPEN);
333
+ this.child(fn);
334
+ this.#out.push(BLOCK_CLOSE);
335
+ }
336
+ /**
337
+ * Create a child renderer. The child renderer inherits the state from the parent,
338
+ * but has its own content.
339
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
340
+ */
341
+ child(fn) {
342
+ const child = new Renderer(this.global, this);
343
+ this.#out.push(child);
344
+ const parent = ssr_context;
345
+ set_ssr_context({
346
+ ...ssr_context,
347
+ p: parent,
348
+ c: null,
349
+ r: child
350
+ });
351
+ const result = fn(child);
352
+ set_ssr_context(parent);
353
+ if (result instanceof Promise) {
354
+ if (child.global.mode === "sync") {
355
+ await_invalid();
356
+ }
357
+ result.catch(() => {
358
+ });
359
+ child.promise = result;
360
+ }
361
+ return child;
362
+ }
363
+ /**
364
+ * Create a component renderer. The component renderer inherits the state from the parent,
365
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
366
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
367
+ * @param {Function} [component_fn]
368
+ * @returns {void}
369
+ */
370
+ component(fn, component_fn) {
371
+ push();
372
+ const child = this.child(fn);
373
+ child.#is_component_body = true;
374
+ pop();
375
+ }
376
+ /**
377
+ * @param {Record<string, any>} attrs
378
+ * @param {(renderer: Renderer) => void} fn
379
+ * @param {string | undefined} [css_hash]
380
+ * @param {Record<string, boolean> | undefined} [classes]
381
+ * @param {Record<string, string> | undefined} [styles]
382
+ * @param {number | undefined} [flags]
383
+ * @returns {void}
384
+ */
385
+ select(attrs, fn, css_hash, classes, styles, flags) {
386
+ const { value, ...select_attrs } = attrs;
387
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
388
+ this.child((renderer) => {
389
+ renderer.local.select_value = value;
390
+ fn(renderer);
391
+ });
392
+ this.push("</select>");
393
+ }
394
+ /**
395
+ * @param {Record<string, any>} attrs
396
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
397
+ * @param {string | undefined} [css_hash]
398
+ * @param {Record<string, boolean> | undefined} [classes]
399
+ * @param {Record<string, string> | undefined} [styles]
400
+ * @param {number | undefined} [flags]
401
+ */
402
+ option(attrs, body, css_hash, classes, styles, flags) {
403
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
404
+ const close = (renderer, value, { head, body: body2 }) => {
405
+ if ("value" in attrs) {
406
+ value = attrs.value;
407
+ }
408
+ if (value === this.local.select_value) {
409
+ renderer.#out.push(" selected");
410
+ }
411
+ renderer.#out.push(`>${body2}</option>`);
412
+ if (head) {
413
+ renderer.head((child) => child.push(head));
414
+ }
415
+ };
416
+ if (typeof body === "function") {
417
+ this.child((renderer) => {
418
+ const r2 = new Renderer(this.global, this);
419
+ body(r2);
420
+ if (this.global.mode === "async") {
421
+ return r2.#collect_content_async().then((content) => {
422
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
423
+ });
424
+ } else {
425
+ const content = r2.#collect_content();
426
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
427
+ }
428
+ });
429
+ } else {
430
+ close(this, body, { body });
431
+ }
432
+ }
433
+ /**
434
+ * @param {(renderer: Renderer) => void} fn
435
+ */
436
+ title(fn) {
437
+ const path = this.get_path();
438
+ const close = (head) => {
439
+ this.global.set_title(head, path);
440
+ };
441
+ this.child((renderer) => {
442
+ const r2 = new Renderer(renderer.global, renderer);
443
+ fn(r2);
444
+ if (renderer.global.mode === "async") {
445
+ return r2.#collect_content_async().then((content) => {
446
+ close(content.head);
447
+ });
448
+ } else {
449
+ const content = r2.#collect_content();
450
+ close(content.head);
451
+ }
452
+ });
453
+ }
454
+ /**
455
+ * @param {string | (() => Promise<string>)} content
456
+ */
457
+ push(content) {
458
+ if (typeof content === "function") {
459
+ this.child(async (renderer) => renderer.push(await content()));
460
+ } else {
461
+ this.#out.push(content);
462
+ }
463
+ }
464
+ /**
465
+ * @param {() => void} fn
466
+ */
467
+ on_destroy(fn) {
468
+ (this.#on_destroy ??= []).push(fn);
469
+ }
470
+ /**
471
+ * @returns {number[]}
472
+ */
473
+ get_path() {
474
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
475
+ }
476
+ /**
477
+ * @deprecated this is needed for legacy component bindings
478
+ */
479
+ copy() {
480
+ const copy = new Renderer(this.global, this.#parent);
481
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
482
+ copy.promise = this.promise;
483
+ return copy;
484
+ }
485
+ /**
486
+ * @param {Renderer} other
487
+ * @deprecated this is needed for legacy component bindings
488
+ */
489
+ subsume(other) {
490
+ if (this.global.mode !== other.global.mode) {
491
+ throw new Error(
492
+ "invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
493
+ );
494
+ }
495
+ this.local = other.local;
496
+ this.#out = other.#out.map((item) => {
497
+ if (item instanceof Renderer) {
498
+ item.subsume(item);
499
+ }
500
+ return item;
501
+ });
502
+ this.promise = other.promise;
503
+ this.type = other.type;
504
+ }
505
+ get length() {
506
+ return this.#out.length;
507
+ }
508
+ /**
509
+ * Only available on the server and when compiling with the `server` option.
510
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
511
+ * @template {Record<string, any>} Props
512
+ * @param {Component<Props>} component
513
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} [options]
514
+ * @returns {RenderOutput}
515
+ */
516
+ static render(component, options = {}) {
517
+ let sync;
518
+ const result = (
519
+ /** @type {RenderOutput} */
520
+ {}
521
+ );
522
+ Object.defineProperties(result, {
523
+ html: {
524
+ get: () => {
525
+ return (sync ??= Renderer.#render(component, options)).body;
526
+ }
527
+ },
528
+ head: {
529
+ get: () => {
530
+ return (sync ??= Renderer.#render(component, options)).head;
531
+ }
532
+ },
533
+ body: {
534
+ get: () => {
535
+ return (sync ??= Renderer.#render(component, options)).body;
536
+ }
537
+ },
538
+ then: {
539
+ value: (
540
+ /**
541
+ * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
542
+ *
543
+ * @template TResult1
544
+ * @template [TResult2=never]
545
+ * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
546
+ * @param { (reason: unknown) => TResult2 } onrejected
547
+ */
548
+ (onfulfilled, onrejected) => {
549
+ {
550
+ experimental_async_ssr();
551
+ const result2 = sync ??= Renderer.#render(component, options);
552
+ const user_result = onfulfilled({
553
+ head: result2.head,
554
+ body: result2.body,
555
+ html: result2.body
556
+ });
557
+ return Promise.resolve(user_result);
558
+ }
559
+ }
560
+ )
561
+ }
562
+ });
563
+ return result;
564
+ }
565
+ /**
566
+ * Collect all of the `onDestroy` callbacks regsitered during rendering. In an async context, this is only safe to call
567
+ * after awaiting `collect_async`.
568
+ *
569
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
570
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
571
+ * @returns {Iterable<() => void>}
572
+ */
573
+ *#collect_on_destroy() {
574
+ for (const component of this.#traverse_components()) {
575
+ yield* component.#collect_ondestroy();
576
+ }
577
+ }
578
+ /**
579
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
580
+ * @returns {Iterable<Renderer>}
581
+ */
582
+ *#traverse_components() {
583
+ for (const child of this.#out) {
584
+ if (typeof child !== "string") {
585
+ yield* child.#traverse_components();
586
+ }
587
+ }
588
+ if (this.#is_component_body) {
589
+ yield this;
590
+ }
591
+ }
592
+ /**
593
+ * @returns {Iterable<() => void>}
594
+ */
595
+ *#collect_ondestroy() {
596
+ if (this.#on_destroy) {
597
+ for (const fn of this.#on_destroy) {
598
+ yield fn;
599
+ }
600
+ }
601
+ for (const child of this.#out) {
602
+ if (child instanceof Renderer && !child.#is_component_body) {
603
+ yield* child.#collect_ondestroy();
604
+ }
605
+ }
606
+ }
607
+ /**
608
+ * Render a component. Throws if any of the children are performing asynchronous work.
609
+ *
610
+ * @template {Record<string, any>} Props
611
+ * @param {Component<Props>} component
612
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
613
+ * @returns {AccumulatedContent}
614
+ */
615
+ static #render(component, options) {
616
+ var previous_context = ssr_context;
617
+ try {
618
+ const renderer = Renderer.#open_render("sync", component, options);
619
+ const content = renderer.#collect_content();
620
+ return Renderer.#close_render(content, renderer);
621
+ } finally {
622
+ abort();
623
+ set_ssr_context(previous_context);
624
+ }
625
+ }
626
+ /**
627
+ * Render a component.
628
+ *
629
+ * @template {Record<string, any>} Props
630
+ * @param {Component<Props>} component
631
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
632
+ * @returns {Promise<AccumulatedContent>}
633
+ */
634
+ static async #render_async(component, options) {
635
+ var previous_context = ssr_context;
636
+ try {
637
+ const renderer = Renderer.#open_render("async", component, options);
638
+ const content = await renderer.#collect_content_async();
639
+ return Renderer.#close_render(content, renderer);
640
+ } finally {
641
+ abort();
642
+ set_ssr_context(previous_context);
643
+ }
644
+ }
645
+ /**
646
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
647
+ * @param {AccumulatedContent} content
648
+ * @returns {AccumulatedContent}
649
+ */
650
+ #collect_content(content = { head: "", body: "" }) {
651
+ for (const item of this.#out) {
652
+ if (typeof item === "string") {
653
+ content[this.type] += item;
654
+ } else if (item instanceof Renderer) {
655
+ item.#collect_content(content);
656
+ }
657
+ }
658
+ return content;
659
+ }
660
+ /**
661
+ * Collect all of the code from the `out` array and return it as a string.
662
+ * @param {AccumulatedContent} content
663
+ * @returns {Promise<AccumulatedContent>}
664
+ */
665
+ async #collect_content_async(content = { head: "", body: "" }) {
666
+ await this.promise;
667
+ for (const item of this.#out) {
668
+ if (typeof item === "string") {
669
+ content[this.type] += item;
670
+ } else if (item instanceof Renderer) {
671
+ await item.#collect_content_async(content);
672
+ }
673
+ }
674
+ return content;
675
+ }
676
+ /**
677
+ * @template {Record<string, any>} Props
678
+ * @param {'sync' | 'async'} mode
679
+ * @param {import('svelte').Component<Props>} component
680
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
681
+ * @returns {Renderer}
682
+ */
683
+ static #open_render(mode, component, options) {
684
+ const renderer = new Renderer(
685
+ new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "")
686
+ );
687
+ renderer.push(BLOCK_OPEN);
688
+ if (options.context) {
689
+ push();
690
+ ssr_context.c = options.context;
691
+ ssr_context.r = renderer;
692
+ }
693
+ component(renderer, options.props ?? {});
694
+ if (options.context) {
695
+ pop();
696
+ }
697
+ renderer.push(BLOCK_CLOSE);
698
+ return renderer;
699
+ }
700
+ /**
701
+ * @param {AccumulatedContent} content
702
+ * @param {Renderer} renderer
703
+ */
704
+ static #close_render(content, renderer) {
705
+ for (const cleanup of renderer.#collect_on_destroy()) {
706
+ cleanup();
707
+ }
708
+ let head = content.head + renderer.global.get_title();
709
+ let body = content.body;
710
+ for (const { hash, code } of renderer.global.css) {
711
+ head += `<style id="${hash}">${code}</style>`;
712
+ }
713
+ return {
714
+ head,
715
+ body
716
+ };
717
+ }
718
+ }
719
+ class SSRState {
720
+ /** @readonly @type {'sync' | 'async'} */
721
+ mode;
722
+ /** @readonly @type {() => string} */
723
+ uid;
724
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
725
+ css = /* @__PURE__ */ new Set();
726
+ /** @type {{ path: number[], value: string }} */
727
+ #title = { path: [], value: "" };
728
+ /**
729
+ * @param {'sync' | 'async'} mode
730
+ * @param {string} [id_prefix]
731
+ */
732
+ constructor(mode, id_prefix = "") {
733
+ this.mode = mode;
734
+ let uid = 1;
735
+ this.uid = () => `${id_prefix}s${uid++}`;
736
+ }
737
+ get_title() {
738
+ return this.#title.value;
739
+ }
740
+ /**
741
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
742
+ * from earlier than or equal to the current value.
743
+ * @param {string} value
744
+ * @param {number[]} path
745
+ */
746
+ set_title(value, path) {
747
+ const current = this.#title.path;
748
+ let i = 0;
749
+ let l = Math.min(path.length, current.length);
750
+ while (i < l && path[i] === current[i]) i += 1;
751
+ if (path[i] === void 0) return;
752
+ if (current[i] === void 0 || path[i] > current[i]) {
753
+ this.#title.path = path;
754
+ this.#title.value = value;
755
+ }
756
+ }
757
+ }
758
+ const INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
759
+ function render(component, options = {}) {
760
+ return Renderer.render(
761
+ /** @type {Component<Props>} */
762
+ component,
763
+ options
764
+ );
765
+ }
766
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
767
+ if (styles) {
768
+ attrs.style = to_style(attrs.style, styles);
769
+ }
770
+ if (attrs.class) {
771
+ attrs.class = clsx(attrs.class);
772
+ }
773
+ if (css_hash || classes) {
774
+ attrs.class = to_class(attrs.class, css_hash, classes);
775
+ }
776
+ let attr_str = "";
777
+ let name;
778
+ const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
779
+ const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
780
+ const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
781
+ for (name in attrs) {
782
+ if (typeof attrs[name] === "function") continue;
783
+ if (name[0] === "$" && name[1] === "$") continue;
784
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
785
+ var value = attrs[name];
786
+ if (lowercase) {
787
+ name = name.toLowerCase();
788
+ }
789
+ if (is_input) {
790
+ if (name === "defaultvalue" || name === "defaultchecked") {
791
+ name = name === "defaultvalue" ? "value" : "checked";
792
+ if (attrs[name]) continue;
793
+ }
794
+ }
795
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
796
+ }
797
+ return attr_str;
798
+ }
799
+ function stringify(value) {
800
+ return typeof value === "string" ? value : value == null ? "" : value + "";
801
+ }
802
+ function attr_class(value, hash, directives) {
803
+ var result = to_class(value, hash, directives);
804
+ return result ? ` class="${escape_html(result, true)}"` : "";
805
+ }
806
+ function bind_props(props_parent, props_now) {
807
+ for (const key in props_now) {
808
+ const initial_value = props_parent[key];
809
+ const value = props_now[key];
810
+ if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) {
811
+ props_parent[key] = value;
812
+ }
813
+ }
814
+ }
815
+ function await_block(renderer, promise, pending_fn, then_fn) {
816
+ if (is_promise(promise)) {
817
+ renderer.push(BLOCK_OPEN);
818
+ promise.then(null, noop);
819
+ if (pending_fn !== null) {
820
+ pending_fn();
821
+ }
822
+ } else if (then_fn !== null) {
823
+ renderer.push(BLOCK_OPEN_ELSE);
824
+ then_fn(promise);
825
+ }
826
+ }
827
+ function ensure_array_like(array_like_or_iterator) {
828
+ if (array_like_or_iterator) {
829
+ return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
830
+ }
831
+ return [];
832
+ }
833
+
834
+ function affects_path(segment) {
835
+ return segment !== "" && !/^\([^)]+\)$/.test(segment);
836
+ }
837
+ function get_route_segments(route) {
838
+ return route.slice(1).split("/").filter(affects_path);
839
+ }
840
+ function exec(match, params, matchers) {
841
+ const result = {};
842
+ const values = match.slice(1);
843
+ const values_needing_match = values.filter((value) => value !== void 0);
844
+ let buffered = 0;
845
+ for (let i = 0; i < params.length; i += 1) {
846
+ const param = params[i];
847
+ let value = values[i - buffered];
848
+ if (param.chained && param.rest && buffered) {
849
+ value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
850
+ buffered = 0;
851
+ }
852
+ if (value === void 0) {
853
+ if (param.rest) result[param.name] = "";
854
+ continue;
855
+ }
856
+ if (!param.matcher || matchers[param.matcher](value)) {
857
+ result[param.name] = value;
858
+ const next_param = params[i + 1];
859
+ const next_value = values[i + 1];
860
+ if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {
861
+ buffered = 0;
862
+ }
863
+ if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) {
864
+ buffered = 0;
865
+ }
866
+ continue;
867
+ }
868
+ if (param.optional && param.chained) {
869
+ buffered++;
870
+ continue;
871
+ }
872
+ return;
873
+ }
874
+ if (buffered) return;
875
+ return result;
876
+ }
877
+ const basic_param_pattern = /\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
878
+ function resolve_route(id, params) {
879
+ const segments = get_route_segments(id);
880
+ const has_id_trailing_slash = id != "/" && id.endsWith("/");
881
+ return "/" + segments.map(
882
+ (segment) => segment.replace(basic_param_pattern, (_, optional, rest, name) => {
883
+ const param_value = params[name];
884
+ if (!param_value) {
885
+ if (optional) return "";
886
+ if (rest && param_value !== void 0) return "";
887
+ throw new Error(`Missing parameter '${name}' in route ${id}`);
888
+ }
889
+ if (param_value.startsWith("/") || param_value.endsWith("/"))
890
+ throw new Error(
891
+ `Parameter '${name}' in route ${id} cannot start or end with a slash -- this would cause an invalid route like foo//bar`
892
+ );
893
+ return param_value;
894
+ })
895
+ ).filter(Boolean).join("/") + (has_id_trailing_slash ? "/" : "");
896
+ }
897
+
898
+ export { ASYNC as A, BLOCK_EFFECT as B, COMMENT_NODE as C, DERIVED as D, ERROR_VALUE as E, assets as F, relative as G, HYDRATION_START as H, INERT as I, override as J, reset as K, LEGACY_PROPS as L, MAYBE_DIRTY as M, attr as N, ensure_array_like as O, attr_class as P, stringify as Q, ROOT_EFFECT as R, STATE_SYMBOL as S, await_block as T, UNOWNED as U, bind_props as V, resolve_route as W, initial_base as X, HYDRATION_ERROR as a, UNINITIALIZED as b, DIRTY as c, CLEAN as d, experimental_async_ssr as e, DISCONNECTED as f, EFFECT as g, BRANCH_EFFECT as h, is_passive_event as i, DESTROYED as j, REACTION_IS_UPDATING as k, EFFECT_RAN as l, EFFECT_PRESERVED as m, HEAD_EFFECT as n, BOUNDARY_EFFECT as o, EFFECT_TRANSPARENT as p, INSPECT_EFFECT as q, render as r, STALE_REACTION as s, HYDRATION_END as t, RENDER_EFFECT as u, HYDRATION_START_ELSE as v, USER_EFFECT as w, base as x, app_dir as y, exec as z };
899
+ //# sourceMappingURL=routing-zIlQn_LN.js.map