@kyoofus/kyoflow 0.0.1

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 (152) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.env.example +4 -0
  3. package/dist/backend/pyproject.toml +19 -0
  4. package/dist/backend/requirements.txt +2 -0
  5. package/dist/backend/src/kyoflow/__init__.py +12 -0
  6. package/dist/backend/src/kyoflow/__main__.py +88 -0
  7. package/dist/backend/src/kyoflow/__pycache__/__init__.cpython-314.pyc +0 -0
  8. package/dist/backend/src/kyoflow/__pycache__/__main__.cpython-314.pyc +0 -0
  9. package/dist/backend/src/kyoflow/__pycache__/main.cpython-314.pyc +0 -0
  10. package/dist/backend/src/kyoflow/main.py +63 -0
  11. package/dist/cli.js +178 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/postinstall.js +18 -0
  14. package/dist/postinstall.js.map +1 -0
  15. package/dist/server.js +31 -0
  16. package/dist/server.js.map +1 -0
  17. package/dist/web/client/_app/immutable/assets/0.BrmKgNLm.css +1 -0
  18. package/dist/web/client/_app/immutable/assets/0.BrmKgNLm.css.br +0 -0
  19. package/dist/web/client/_app/immutable/assets/0.BrmKgNLm.css.gz +0 -0
  20. package/dist/web/client/_app/immutable/assets/3.DVH1XF8v.css +1 -0
  21. package/dist/web/client/_app/immutable/assets/3.DVH1XF8v.css.br +0 -0
  22. package/dist/web/client/_app/immutable/assets/3.DVH1XF8v.css.gz +0 -0
  23. package/dist/web/client/_app/immutable/assets/4.zbKoyNjI.css +1 -0
  24. package/dist/web/client/_app/immutable/assets/4.zbKoyNjI.css.br +0 -0
  25. package/dist/web/client/_app/immutable/assets/4.zbKoyNjI.css.gz +0 -0
  26. package/dist/web/client/_app/immutable/assets/5.CHnq1Bst.css +1 -0
  27. package/dist/web/client/_app/immutable/assets/5.CHnq1Bst.css.br +0 -0
  28. package/dist/web/client/_app/immutable/assets/5.CHnq1Bst.css.gz +0 -0
  29. package/dist/web/client/_app/immutable/chunks/44EpIQ4d.js +1 -0
  30. package/dist/web/client/_app/immutable/chunks/44EpIQ4d.js.br +0 -0
  31. package/dist/web/client/_app/immutable/chunks/44EpIQ4d.js.gz +0 -0
  32. package/dist/web/client/_app/immutable/chunks/B09fC2bi.js +1 -0
  33. package/dist/web/client/_app/immutable/chunks/B09fC2bi.js.br +0 -0
  34. package/dist/web/client/_app/immutable/chunks/B09fC2bi.js.gz +0 -0
  35. package/dist/web/client/_app/immutable/chunks/BJ-VzAMM.js +1 -0
  36. package/dist/web/client/_app/immutable/chunks/BJ-VzAMM.js.br +0 -0
  37. package/dist/web/client/_app/immutable/chunks/BJ-VzAMM.js.gz +0 -0
  38. package/dist/web/client/_app/immutable/chunks/B_AmmRQN.js +1 -0
  39. package/dist/web/client/_app/immutable/chunks/B_AmmRQN.js.br +2 -0
  40. package/dist/web/client/_app/immutable/chunks/B_AmmRQN.js.gz +0 -0
  41. package/dist/web/client/_app/immutable/chunks/C63Z97y6.js +1 -0
  42. package/dist/web/client/_app/immutable/chunks/C63Z97y6.js.br +0 -0
  43. package/dist/web/client/_app/immutable/chunks/C63Z97y6.js.gz +0 -0
  44. package/dist/web/client/_app/immutable/chunks/C_EPgsy6.js +1 -0
  45. package/dist/web/client/_app/immutable/chunks/C_EPgsy6.js.br +0 -0
  46. package/dist/web/client/_app/immutable/chunks/C_EPgsy6.js.gz +0 -0
  47. package/dist/web/client/_app/immutable/chunks/Ck1fWG4n.js +1 -0
  48. package/dist/web/client/_app/immutable/chunks/Ck1fWG4n.js.br +0 -0
  49. package/dist/web/client/_app/immutable/chunks/Ck1fWG4n.js.gz +0 -0
  50. package/dist/web/client/_app/immutable/chunks/D8fmz15L.js +1 -0
  51. package/dist/web/client/_app/immutable/chunks/D8fmz15L.js.br +0 -0
  52. package/dist/web/client/_app/immutable/chunks/D8fmz15L.js.gz +0 -0
  53. package/dist/web/client/_app/immutable/chunks/DDNuMsfB.js +1 -0
  54. package/dist/web/client/_app/immutable/chunks/DDNuMsfB.js.br +0 -0
  55. package/dist/web/client/_app/immutable/chunks/DDNuMsfB.js.gz +0 -0
  56. package/dist/web/client/_app/immutable/chunks/Da9oKyxb.js +1 -0
  57. package/dist/web/client/_app/immutable/chunks/Da9oKyxb.js.br +0 -0
  58. package/dist/web/client/_app/immutable/chunks/Da9oKyxb.js.gz +0 -0
  59. package/dist/web/client/_app/immutable/chunks/DtmuEK64.js +1 -0
  60. package/dist/web/client/_app/immutable/chunks/DtmuEK64.js.br +0 -0
  61. package/dist/web/client/_app/immutable/chunks/DtmuEK64.js.gz +0 -0
  62. package/dist/web/client/_app/immutable/chunks/EmrU7Abi.js +298 -0
  63. package/dist/web/client/_app/immutable/chunks/EmrU7Abi.js.br +0 -0
  64. package/dist/web/client/_app/immutable/chunks/EmrU7Abi.js.gz +0 -0
  65. package/dist/web/client/_app/immutable/chunks/PPVm8Dsz.js +1 -0
  66. package/dist/web/client/_app/immutable/chunks/PPVm8Dsz.js.br +0 -0
  67. package/dist/web/client/_app/immutable/chunks/PPVm8Dsz.js.gz +0 -0
  68. package/dist/web/client/_app/immutable/chunks/ZW9ZwxRj.js +2 -0
  69. package/dist/web/client/_app/immutable/chunks/ZW9ZwxRj.js.br +0 -0
  70. package/dist/web/client/_app/immutable/chunks/ZW9ZwxRj.js.gz +0 -0
  71. package/dist/web/client/_app/immutable/chunks/b2dyOoG8.js +1 -0
  72. package/dist/web/client/_app/immutable/chunks/b2dyOoG8.js.br +0 -0
  73. package/dist/web/client/_app/immutable/chunks/b2dyOoG8.js.gz +0 -0
  74. package/dist/web/client/_app/immutable/chunks/dKdRdI5_.js +2 -0
  75. package/dist/web/client/_app/immutable/chunks/dKdRdI5_.js.br +0 -0
  76. package/dist/web/client/_app/immutable/chunks/dKdRdI5_.js.gz +0 -0
  77. package/dist/web/client/_app/immutable/chunks/z6vZsXi_.js +1 -0
  78. package/dist/web/client/_app/immutable/chunks/z6vZsXi_.js.br +0 -0
  79. package/dist/web/client/_app/immutable/chunks/z6vZsXi_.js.gz +0 -0
  80. package/dist/web/client/_app/immutable/entry/app.CY5BI3xj.js +2 -0
  81. package/dist/web/client/_app/immutable/entry/app.CY5BI3xj.js.br +0 -0
  82. package/dist/web/client/_app/immutable/entry/app.CY5BI3xj.js.gz +0 -0
  83. package/dist/web/client/_app/immutable/entry/start.DtRSN8RT.js +1 -0
  84. package/dist/web/client/_app/immutable/entry/start.DtRSN8RT.js.br +2 -0
  85. package/dist/web/client/_app/immutable/entry/start.DtRSN8RT.js.gz +0 -0
  86. package/dist/web/client/_app/immutable/nodes/0.D-FNblRd.js +1 -0
  87. package/dist/web/client/_app/immutable/nodes/0.D-FNblRd.js.br +0 -0
  88. package/dist/web/client/_app/immutable/nodes/0.D-FNblRd.js.gz +0 -0
  89. package/dist/web/client/_app/immutable/nodes/1.D4Y_4dgV.js +1 -0
  90. package/dist/web/client/_app/immutable/nodes/1.D4Y_4dgV.js.br +0 -0
  91. package/dist/web/client/_app/immutable/nodes/1.D4Y_4dgV.js.gz +0 -0
  92. package/dist/web/client/_app/immutable/nodes/2.B5eVU3OO.js +1 -0
  93. package/dist/web/client/_app/immutable/nodes/2.B5eVU3OO.js.br +0 -0
  94. package/dist/web/client/_app/immutable/nodes/2.B5eVU3OO.js.gz +0 -0
  95. package/dist/web/client/_app/immutable/nodes/3.CLx1_dgI.js +1 -0
  96. package/dist/web/client/_app/immutable/nodes/3.CLx1_dgI.js.br +0 -0
  97. package/dist/web/client/_app/immutable/nodes/3.CLx1_dgI.js.gz +0 -0
  98. package/dist/web/client/_app/immutable/nodes/4.B2lLNz3B.js +61 -0
  99. package/dist/web/client/_app/immutable/nodes/4.B2lLNz3B.js.br +0 -0
  100. package/dist/web/client/_app/immutable/nodes/4.B2lLNz3B.js.gz +0 -0
  101. package/dist/web/client/_app/immutable/nodes/5.DVjHkNQz.js +1 -0
  102. package/dist/web/client/_app/immutable/nodes/5.DVjHkNQz.js.br +0 -0
  103. package/dist/web/client/_app/immutable/nodes/5.DVjHkNQz.js.gz +0 -0
  104. package/dist/web/client/_app/version.json +1 -0
  105. package/dist/web/client/_app/version.json.br +0 -0
  106. package/dist/web/client/_app/version.json.gz +0 -0
  107. package/dist/web/client/robots.txt +3 -0
  108. package/dist/web/env.js +94 -0
  109. package/dist/web/handler.js +1435 -0
  110. package/dist/web/index.js +345 -0
  111. package/dist/web/kyoflow.mjs +21 -0
  112. package/dist/web/scripts/ecosystem.config.cjs +54 -0
  113. package/dist/web/scripts/run-node.mjs +158 -0
  114. package/dist/web/scripts/startDev.mjs +64 -0
  115. package/dist/web/server/chunks/0-CyAFthPc.js +9 -0
  116. package/dist/web/server/chunks/0-CyAFthPc.js.map +1 -0
  117. package/dist/web/server/chunks/1-DYCRQF-y.js +9 -0
  118. package/dist/web/server/chunks/1-DYCRQF-y.js.map +1 -0
  119. package/dist/web/server/chunks/2-BMUiKlN4.js +9 -0
  120. package/dist/web/server/chunks/2-BMUiKlN4.js.map +1 -0
  121. package/dist/web/server/chunks/3-BHJbC3kl.js +9 -0
  122. package/dist/web/server/chunks/3-BHJbC3kl.js.map +1 -0
  123. package/dist/web/server/chunks/4-kguK6pdz.js +9 -0
  124. package/dist/web/server/chunks/4-kguK6pdz.js.map +1 -0
  125. package/dist/web/server/chunks/5-Cg1lR31m.js +9 -0
  126. package/dist/web/server/chunks/5-Cg1lR31m.js.map +1 -0
  127. package/dist/web/server/chunks/_layout.svelte-Dk-_4d6Q.js +15 -0
  128. package/dist/web/server/chunks/_layout.svelte-Dk-_4d6Q.js.map +1 -0
  129. package/dist/web/server/chunks/_page.svelte-Clor3HA3.js +19 -0
  130. package/dist/web/server/chunks/_page.svelte-Clor3HA3.js.map +1 -0
  131. package/dist/web/server/chunks/_page.svelte-D5WvBH3m.js +6 -0
  132. package/dist/web/server/chunks/_page.svelte-D5WvBH3m.js.map +1 -0
  133. package/dist/web/server/chunks/_page.svelte-D7hhqLhW.js +90 -0
  134. package/dist/web/server/chunks/_page.svelte-D7hhqLhW.js.map +1 -0
  135. package/dist/web/server/chunks/_page.svelte-DDxnQ3X4.js +71 -0
  136. package/dist/web/server/chunks/_page.svelte-DDxnQ3X4.js.map +1 -0
  137. package/dist/web/server/chunks/context-CKR25gbz.js +90 -0
  138. package/dist/web/server/chunks/context-CKR25gbz.js.map +1 -0
  139. package/dist/web/server/chunks/error.svelte-BLEcYUzd.js +12 -0
  140. package/dist/web/server/chunks/error.svelte-BLEcYUzd.js.map +1 -0
  141. package/dist/web/server/chunks/exports-k9UzK37u.js +303 -0
  142. package/dist/web/server/chunks/exports-k9UzK37u.js.map +1 -0
  143. package/dist/web/server/chunks/index-DjKos2HY.js +1362 -0
  144. package/dist/web/server/chunks/index-DjKos2HY.js.map +1 -0
  145. package/dist/web/server/chunks/index2-CxBujh0K.js +43 -0
  146. package/dist/web/server/chunks/index2-CxBujh0K.js.map +1 -0
  147. package/dist/web/server/index.js +7832 -0
  148. package/dist/web/server/index.js.map +1 -0
  149. package/dist/web/server/manifest.js +70 -0
  150. package/dist/web/server/manifest.js.map +1 -0
  151. package/dist/web/shims.js +32 -0
  152. package/package.json +37 -0
@@ -0,0 +1,1362 @@
1
+ import { n as noop, m as set_ssr_context, p as ssr_context, q as push, t as pop, k as escape_html } from './context-CKR25gbz.js';
2
+
3
+ const escaped = {
4
+ "<": "\\u003C",
5
+ "\\": "\\\\",
6
+ "\b": "\\b",
7
+ "\f": "\\f",
8
+ "\n": "\\n",
9
+ "\r": "\\r",
10
+ " ": "\\t",
11
+ "\u2028": "\\u2028",
12
+ "\u2029": "\\u2029"
13
+ };
14
+ class DevalueError extends Error {
15
+ /**
16
+ * @param {string} message
17
+ * @param {string[]} keys
18
+ * @param {any} [value] - The value that failed to be serialized
19
+ * @param {any} [root] - The root value being serialized
20
+ */
21
+ constructor(message, keys, value, root) {
22
+ super(message);
23
+ this.name = "DevalueError";
24
+ this.path = keys.join("");
25
+ this.value = value;
26
+ this.root = root;
27
+ }
28
+ }
29
+ function is_primitive(thing) {
30
+ return Object(thing) !== thing;
31
+ }
32
+ const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(
33
+ Object.prototype
34
+ ).sort().join("\0");
35
+ function is_plain_object(thing) {
36
+ const proto = Object.getPrototypeOf(thing);
37
+ return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
38
+ }
39
+ function get_type(thing) {
40
+ return Object.prototype.toString.call(thing).slice(8, -1);
41
+ }
42
+ function get_escaped_char(char) {
43
+ switch (char) {
44
+ case '"':
45
+ return '\\"';
46
+ case "<":
47
+ return "\\u003C";
48
+ case "\\":
49
+ return "\\\\";
50
+ case "\n":
51
+ return "\\n";
52
+ case "\r":
53
+ return "\\r";
54
+ case " ":
55
+ return "\\t";
56
+ case "\b":
57
+ return "\\b";
58
+ case "\f":
59
+ return "\\f";
60
+ case "\u2028":
61
+ return "\\u2028";
62
+ case "\u2029":
63
+ return "\\u2029";
64
+ default:
65
+ return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
66
+ }
67
+ }
68
+ function stringify_string(str) {
69
+ let result = "";
70
+ let last_pos = 0;
71
+ const len = str.length;
72
+ for (let i = 0; i < len; i += 1) {
73
+ const char = str[i];
74
+ const replacement = get_escaped_char(char);
75
+ if (replacement) {
76
+ result += str.slice(last_pos, i) + replacement;
77
+ last_pos = i + 1;
78
+ }
79
+ }
80
+ return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
81
+ }
82
+ function enumerable_symbols(object) {
83
+ return Object.getOwnPropertySymbols(object).filter(
84
+ (symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
85
+ );
86
+ }
87
+ const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
88
+ function stringify_key(key) {
89
+ return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
90
+ }
91
+
92
+ const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
93
+ const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
94
+ const reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
95
+ function uneval(value, replacer) {
96
+ const counts = /* @__PURE__ */ new Map();
97
+ const keys = [];
98
+ const custom = /* @__PURE__ */ new Map();
99
+ function walk(thing) {
100
+ if (!is_primitive(thing)) {
101
+ if (counts.has(thing)) {
102
+ counts.set(thing, counts.get(thing) + 1);
103
+ return;
104
+ }
105
+ counts.set(thing, 1);
106
+ if (replacer) {
107
+ const str2 = replacer(thing, (value2) => uneval(value2, replacer));
108
+ if (typeof str2 === "string") {
109
+ custom.set(thing, str2);
110
+ return;
111
+ }
112
+ }
113
+ if (typeof thing === "function") {
114
+ throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
115
+ }
116
+ const type = get_type(thing);
117
+ switch (type) {
118
+ case "Number":
119
+ case "BigInt":
120
+ case "String":
121
+ case "Boolean":
122
+ case "Date":
123
+ case "RegExp":
124
+ case "URL":
125
+ case "URLSearchParams":
126
+ return;
127
+ case "Array":
128
+ thing.forEach((value2, i) => {
129
+ keys.push(`[${i}]`);
130
+ walk(value2);
131
+ keys.pop();
132
+ });
133
+ break;
134
+ case "Set":
135
+ Array.from(thing).forEach(walk);
136
+ break;
137
+ case "Map":
138
+ for (const [key, value2] of thing) {
139
+ keys.push(
140
+ `.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`
141
+ );
142
+ walk(value2);
143
+ keys.pop();
144
+ }
145
+ break;
146
+ case "Int8Array":
147
+ case "Uint8Array":
148
+ case "Uint8ClampedArray":
149
+ case "Int16Array":
150
+ case "Uint16Array":
151
+ case "Int32Array":
152
+ case "Uint32Array":
153
+ case "Float32Array":
154
+ case "Float64Array":
155
+ case "BigInt64Array":
156
+ case "BigUint64Array":
157
+ walk(thing.buffer);
158
+ return;
159
+ case "ArrayBuffer":
160
+ return;
161
+ case "Temporal.Duration":
162
+ case "Temporal.Instant":
163
+ case "Temporal.PlainDate":
164
+ case "Temporal.PlainTime":
165
+ case "Temporal.PlainDateTime":
166
+ case "Temporal.PlainMonthDay":
167
+ case "Temporal.PlainYearMonth":
168
+ case "Temporal.ZonedDateTime":
169
+ return;
170
+ default:
171
+ if (!is_plain_object(thing)) {
172
+ throw new DevalueError(
173
+ `Cannot stringify arbitrary non-POJOs`,
174
+ keys,
175
+ thing,
176
+ value
177
+ );
178
+ }
179
+ if (enumerable_symbols(thing).length > 0) {
180
+ throw new DevalueError(
181
+ `Cannot stringify POJOs with symbolic keys`,
182
+ keys,
183
+ thing,
184
+ value
185
+ );
186
+ }
187
+ for (const key in thing) {
188
+ keys.push(stringify_key(key));
189
+ walk(thing[key]);
190
+ keys.pop();
191
+ }
192
+ }
193
+ }
194
+ }
195
+ walk(value);
196
+ const names = /* @__PURE__ */ new Map();
197
+ Array.from(counts).filter((entry) => entry[1] > 1).sort((a, b) => b[1] - a[1]).forEach((entry, i) => {
198
+ names.set(entry[0], get_name(i));
199
+ });
200
+ function stringify2(thing) {
201
+ if (names.has(thing)) {
202
+ return names.get(thing);
203
+ }
204
+ if (is_primitive(thing)) {
205
+ return stringify_primitive(thing);
206
+ }
207
+ if (custom.has(thing)) {
208
+ return custom.get(thing);
209
+ }
210
+ const type = get_type(thing);
211
+ switch (type) {
212
+ case "Number":
213
+ case "String":
214
+ case "Boolean":
215
+ return `Object(${stringify2(thing.valueOf())})`;
216
+ case "RegExp":
217
+ return `new RegExp(${stringify_string(thing.source)}, "${thing.flags}")`;
218
+ case "Date":
219
+ return `new Date(${thing.getTime()})`;
220
+ case "URL":
221
+ return `new URL(${stringify_string(thing.toString())})`;
222
+ case "URLSearchParams":
223
+ return `new URLSearchParams(${stringify_string(thing.toString())})`;
224
+ case "Array":
225
+ const members = (
226
+ /** @type {any[]} */
227
+ thing.map(
228
+ (v, i) => i in thing ? stringify2(v) : ""
229
+ )
230
+ );
231
+ const tail = thing.length === 0 || thing.length - 1 in thing ? "" : ",";
232
+ return `[${members.join(",")}${tail}]`;
233
+ case "Set":
234
+ case "Map":
235
+ return `new ${type}([${Array.from(thing).map(stringify2).join(",")}])`;
236
+ case "Int8Array":
237
+ case "Uint8Array":
238
+ case "Uint8ClampedArray":
239
+ case "Int16Array":
240
+ case "Uint16Array":
241
+ case "Int32Array":
242
+ case "Uint32Array":
243
+ case "Float32Array":
244
+ case "Float64Array":
245
+ case "BigInt64Array":
246
+ case "BigUint64Array": {
247
+ let str2 = `new ${type}`;
248
+ if (counts.get(thing.buffer) === 1) {
249
+ const array = new thing.constructor(thing.buffer);
250
+ str2 += `([${array}])`;
251
+ } else {
252
+ str2 += `([${stringify2(thing.buffer)}])`;
253
+ }
254
+ const a = thing.byteOffset;
255
+ const b = a + thing.byteLength;
256
+ if (a > 0 || b !== thing.buffer.byteLength) {
257
+ const m = +/(\d+)/.exec(type)[1] / 8;
258
+ str2 += `.subarray(${a / m},${b / m})`;
259
+ }
260
+ return str2;
261
+ }
262
+ case "ArrayBuffer": {
263
+ const ui8 = new Uint8Array(thing);
264
+ return `new Uint8Array([${ui8.toString()}]).buffer`;
265
+ }
266
+ case "Temporal.Duration":
267
+ case "Temporal.Instant":
268
+ case "Temporal.PlainDate":
269
+ case "Temporal.PlainTime":
270
+ case "Temporal.PlainDateTime":
271
+ case "Temporal.PlainMonthDay":
272
+ case "Temporal.PlainYearMonth":
273
+ case "Temporal.ZonedDateTime":
274
+ return `${type}.from(${stringify_string(thing.toString())})`;
275
+ default:
276
+ const keys2 = Object.keys(thing);
277
+ const obj = keys2.map((key) => `${safe_key(key)}:${stringify2(thing[key])}`).join(",");
278
+ const proto = Object.getPrototypeOf(thing);
279
+ if (proto === null) {
280
+ return keys2.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
281
+ }
282
+ return `{${obj}}`;
283
+ }
284
+ }
285
+ const str = stringify2(value);
286
+ if (names.size) {
287
+ const params = [];
288
+ const statements = [];
289
+ const values = [];
290
+ names.forEach((name, thing) => {
291
+ params.push(name);
292
+ if (custom.has(thing)) {
293
+ values.push(
294
+ /** @type {string} */
295
+ custom.get(thing)
296
+ );
297
+ return;
298
+ }
299
+ if (is_primitive(thing)) {
300
+ values.push(stringify_primitive(thing));
301
+ return;
302
+ }
303
+ const type = get_type(thing);
304
+ switch (type) {
305
+ case "Number":
306
+ case "String":
307
+ case "Boolean":
308
+ values.push(`Object(${stringify2(thing.valueOf())})`);
309
+ break;
310
+ case "RegExp":
311
+ values.push(thing.toString());
312
+ break;
313
+ case "Date":
314
+ values.push(`new Date(${thing.getTime()})`);
315
+ break;
316
+ case "Array":
317
+ values.push(`Array(${thing.length})`);
318
+ thing.forEach((v, i) => {
319
+ statements.push(`${name}[${i}]=${stringify2(v)}`);
320
+ });
321
+ break;
322
+ case "Set":
323
+ values.push(`new Set`);
324
+ statements.push(
325
+ `${name}.${Array.from(thing).map((v) => `add(${stringify2(v)})`).join(".")}`
326
+ );
327
+ break;
328
+ case "Map":
329
+ values.push(`new Map`);
330
+ statements.push(
331
+ `${name}.${Array.from(thing).map(([k, v]) => `set(${stringify2(k)}, ${stringify2(v)})`).join(".")}`
332
+ );
333
+ break;
334
+ case "ArrayBuffer":
335
+ values.push(
336
+ `new Uint8Array([${new Uint8Array(thing).join(",")}]).buffer`
337
+ );
338
+ break;
339
+ default:
340
+ values.push(
341
+ Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}"
342
+ );
343
+ Object.keys(thing).forEach((key) => {
344
+ statements.push(
345
+ `${name}${safe_prop(key)}=${stringify2(thing[key])}`
346
+ );
347
+ });
348
+ }
349
+ });
350
+ statements.push(`return ${str}`);
351
+ return `(function(${params.join(",")}){${statements.join(
352
+ ";"
353
+ )}}(${values.join(",")}))`;
354
+ } else {
355
+ return str;
356
+ }
357
+ }
358
+ function get_name(num) {
359
+ let name = "";
360
+ do {
361
+ name = chars[num % chars.length] + name;
362
+ num = ~~(num / chars.length) - 1;
363
+ } while (num >= 0);
364
+ return reserved.test(name) ? `${name}0` : name;
365
+ }
366
+ function escape_unsafe_char(c) {
367
+ return escaped[c] || c;
368
+ }
369
+ function escape_unsafe_chars(str) {
370
+ return str.replace(unsafe_chars, escape_unsafe_char);
371
+ }
372
+ function safe_key(key) {
373
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
374
+ }
375
+ function safe_prop(key) {
376
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`;
377
+ }
378
+ function stringify_primitive(thing) {
379
+ if (typeof thing === "string") return stringify_string(thing);
380
+ if (thing === void 0) return "void 0";
381
+ if (thing === 0 && 1 / thing < 0) return "-0";
382
+ const str = String(thing);
383
+ if (typeof thing === "number") return str.replace(/^(-)?0\./, "$1.");
384
+ if (typeof thing === "bigint") return thing + "n";
385
+ return str;
386
+ }
387
+ const DERIVED = 1 << 1;
388
+ const EFFECT = 1 << 2;
389
+ const RENDER_EFFECT = 1 << 3;
390
+ const MANAGED_EFFECT = 1 << 24;
391
+ const BLOCK_EFFECT = 1 << 4;
392
+ const BRANCH_EFFECT = 1 << 5;
393
+ const ROOT_EFFECT = 1 << 6;
394
+ const BOUNDARY_EFFECT = 1 << 7;
395
+ const CONNECTED = 1 << 9;
396
+ const CLEAN = 1 << 10;
397
+ const DIRTY = 1 << 11;
398
+ const MAYBE_DIRTY = 1 << 12;
399
+ const INERT = 1 << 13;
400
+ const DESTROYED = 1 << 14;
401
+ const EFFECT_RAN = 1 << 15;
402
+ const EFFECT_TRANSPARENT = 1 << 16;
403
+ const EAGER_EFFECT = 1 << 17;
404
+ const HEAD_EFFECT = 1 << 18;
405
+ const EFFECT_PRESERVED = 1 << 19;
406
+ const USER_EFFECT = 1 << 20;
407
+ const WAS_MARKED = 1 << 15;
408
+ const REACTION_IS_UPDATING = 1 << 21;
409
+ const ASYNC = 1 << 22;
410
+ const ERROR_VALUE = 1 << 23;
411
+ const STATE_SYMBOL = /* @__PURE__ */ Symbol("$state");
412
+ const LEGACY_PROPS = /* @__PURE__ */ Symbol("legacy props");
413
+ const STALE_REACTION = new class StaleReactionError extends Error {
414
+ name = "StaleReactionError";
415
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
416
+ }();
417
+ const COMMENT_NODE = 8;
418
+ const HYDRATION_START = "[";
419
+ const HYDRATION_START_ELSE = "[!";
420
+ const HYDRATION_END = "]";
421
+ const HYDRATION_ERROR = {};
422
+ const ELEMENT_IS_NAMESPACED = 1;
423
+ const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
424
+ const ELEMENT_IS_INPUT = 1 << 2;
425
+ const UNINITIALIZED = /* @__PURE__ */ Symbol();
426
+ const DOM_BOOLEAN_ATTRIBUTES = [
427
+ "allowfullscreen",
428
+ "async",
429
+ "autofocus",
430
+ "autoplay",
431
+ "checked",
432
+ "controls",
433
+ "default",
434
+ "disabled",
435
+ "formnovalidate",
436
+ "indeterminate",
437
+ "inert",
438
+ "ismap",
439
+ "loop",
440
+ "multiple",
441
+ "muted",
442
+ "nomodule",
443
+ "novalidate",
444
+ "open",
445
+ "playsinline",
446
+ "readonly",
447
+ "required",
448
+ "reversed",
449
+ "seamless",
450
+ "selected",
451
+ "webkitdirectory",
452
+ "defer",
453
+ "disablepictureinpicture",
454
+ "disableremoteplayback"
455
+ ];
456
+ function is_boolean_attribute(name) {
457
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
458
+ }
459
+ const PASSIVE_EVENTS = ["touchstart", "touchmove"];
460
+ function is_passive_event(name) {
461
+ return PASSIVE_EVENTS.includes(name);
462
+ }
463
+ function r(e) {
464
+ var t, f, n = "";
465
+ if ("string" == typeof e || "number" == typeof e) n += e;
466
+ else if ("object" == typeof e) if (Array.isArray(e)) {
467
+ var o = e.length;
468
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
469
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
470
+ return n;
471
+ }
472
+ function clsx$1() {
473
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
474
+ return n;
475
+ }
476
+ const replacements = {
477
+ translate: /* @__PURE__ */ new Map([
478
+ [true, "yes"],
479
+ [false, "no"]
480
+ ])
481
+ };
482
+ function attr(name, value, is_boolean = false) {
483
+ if (name === "hidden" && value !== "until-found") {
484
+ is_boolean = true;
485
+ }
486
+ if (value == null || !value && is_boolean) return "";
487
+ const normalized = name in replacements && replacements[name].get(value) || value;
488
+ const assignment = is_boolean ? "" : `="${escape_html(normalized, true)}"`;
489
+ return ` ${name}${assignment}`;
490
+ }
491
+ function clsx(value) {
492
+ if (typeof value === "object") {
493
+ return clsx$1(value);
494
+ } else {
495
+ return value ?? "";
496
+ }
497
+ }
498
+ const whitespace = [..." \n\r\f \v\uFEFF"];
499
+ function to_class(value, hash, directives) {
500
+ var classname = value == null ? "" : "" + value;
501
+ if (hash) {
502
+ classname = classname ? classname + " " + hash : hash;
503
+ }
504
+ if (directives) {
505
+ for (var key in directives) {
506
+ if (directives[key]) {
507
+ classname = classname ? classname + " " + key : key;
508
+ } else if (classname.length) {
509
+ var len = key.length;
510
+ var a = 0;
511
+ while ((a = classname.indexOf(key, a)) >= 0) {
512
+ var b = a + len;
513
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
514
+ classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
515
+ } else {
516
+ a = b;
517
+ }
518
+ }
519
+ }
520
+ }
521
+ }
522
+ return classname === "" ? null : classname;
523
+ }
524
+ function append_styles(styles, important = false) {
525
+ var separator = important ? " !important;" : ";";
526
+ var css = "";
527
+ for (var key in styles) {
528
+ var value = styles[key];
529
+ if (value != null && value !== "") {
530
+ css += " " + key + ": " + value + separator;
531
+ }
532
+ }
533
+ return css;
534
+ }
535
+ function to_css_name(name) {
536
+ if (name[0] !== "-" || name[1] !== "-") {
537
+ return name.toLowerCase();
538
+ }
539
+ return name;
540
+ }
541
+ function to_style(value, styles) {
542
+ if (styles) {
543
+ var new_style = "";
544
+ var normal_styles;
545
+ var important_styles;
546
+ if (Array.isArray(styles)) {
547
+ normal_styles = styles[0];
548
+ important_styles = styles[1];
549
+ } else {
550
+ normal_styles = styles;
551
+ }
552
+ if (value) {
553
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
554
+ var in_str = false;
555
+ var in_apo = 0;
556
+ var in_comment = false;
557
+ var reserved_names = [];
558
+ if (normal_styles) {
559
+ reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
560
+ }
561
+ if (important_styles) {
562
+ reserved_names.push(...Object.keys(important_styles).map(to_css_name));
563
+ }
564
+ var start_index = 0;
565
+ var name_index = -1;
566
+ const len = value.length;
567
+ for (var i = 0; i < len; i++) {
568
+ var c = value[i];
569
+ if (in_comment) {
570
+ if (c === "/" && value[i - 1] === "*") {
571
+ in_comment = false;
572
+ }
573
+ } else if (in_str) {
574
+ if (in_str === c) {
575
+ in_str = false;
576
+ }
577
+ } else if (c === "/" && value[i + 1] === "*") {
578
+ in_comment = true;
579
+ } else if (c === '"' || c === "'") {
580
+ in_str = c;
581
+ } else if (c === "(") {
582
+ in_apo++;
583
+ } else if (c === ")") {
584
+ in_apo--;
585
+ }
586
+ if (!in_comment && in_str === false && in_apo === 0) {
587
+ if (c === ":" && name_index === -1) {
588
+ name_index = i;
589
+ } else if (c === ";" || i === len - 1) {
590
+ if (name_index !== -1) {
591
+ var name = to_css_name(value.substring(start_index, name_index).trim());
592
+ if (!reserved_names.includes(name)) {
593
+ if (c !== ";") {
594
+ i++;
595
+ }
596
+ var property = value.substring(start_index, i).trim();
597
+ new_style += " " + property + ";";
598
+ }
599
+ }
600
+ start_index = i + 1;
601
+ name_index = -1;
602
+ }
603
+ }
604
+ }
605
+ }
606
+ if (normal_styles) {
607
+ new_style += append_styles(normal_styles);
608
+ }
609
+ if (important_styles) {
610
+ new_style += append_styles(important_styles, true);
611
+ }
612
+ new_style = new_style.trim();
613
+ return new_style === "" ? null : new_style;
614
+ }
615
+ return value == null ? null : String(value);
616
+ }
617
+ const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
618
+ const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
619
+ const EMPTY_COMMENT = `<!---->`;
620
+ let controller = null;
621
+ function abort() {
622
+ controller?.abort(STALE_REACTION);
623
+ controller = null;
624
+ }
625
+ function await_invalid() {
626
+ const error = new Error(`await_invalid
627
+ Encountered asynchronous work while rendering synchronously.
628
+ https://svelte.dev/e/await_invalid`);
629
+ error.name = "Svelte error";
630
+ throw error;
631
+ }
632
+ function invalid_csp() {
633
+ const error = new Error(`invalid_csp
634
+ \`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
635
+ https://svelte.dev/e/invalid_csp`);
636
+ error.name = "Svelte error";
637
+ throw error;
638
+ }
639
+ function server_context_required() {
640
+ const error = new Error(`server_context_required
641
+ Could not resolve \`render\` context.
642
+ https://svelte.dev/e/server_context_required`);
643
+ error.name = "Svelte error";
644
+ throw error;
645
+ }
646
+ function unresolved_hydratable(key, stack) {
647
+ {
648
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
649
+ }
650
+ }
651
+ function get_render_context() {
652
+ const store = als?.getStore();
653
+ {
654
+ server_context_required();
655
+ }
656
+ return store;
657
+ }
658
+ let als = null;
659
+ let text_encoder;
660
+ let crypto;
661
+ async function sha256(data) {
662
+ text_encoder ??= new TextEncoder();
663
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (
664
+ // @ts-ignore - we don't install node types in the prod build
665
+ // don't use 'node:crypto' because static analysers will think we rely on node when we don't
666
+ (await import(
667
+ /* @vite-ignore */
668
+ 'node:crypto'
669
+ )).webcrypto
670
+ );
671
+ const hash_buffer = await crypto.subtle.digest("SHA-256", text_encoder.encode(data));
672
+ return base64_encode(hash_buffer);
673
+ }
674
+ function base64_encode(bytes) {
675
+ if (globalThis.Buffer) {
676
+ return globalThis.Buffer.from(bytes).toString("base64");
677
+ }
678
+ let binary = "";
679
+ for (let i = 0; i < bytes.length; i++) {
680
+ binary += String.fromCharCode(bytes[i]);
681
+ }
682
+ return btoa(binary);
683
+ }
684
+ class Renderer {
685
+ /**
686
+ * The contents of the renderer.
687
+ * @type {RendererItem[]}
688
+ */
689
+ #out = [];
690
+ /**
691
+ * Any `onDestroy` callbacks registered during execution of this renderer.
692
+ * @type {(() => void)[] | undefined}
693
+ */
694
+ #on_destroy = void 0;
695
+ /**
696
+ * Whether this renderer is a component body.
697
+ * @type {boolean}
698
+ */
699
+ #is_component_body = false;
700
+ /**
701
+ * The type of string content that this renderer is accumulating.
702
+ * @type {RendererType}
703
+ */
704
+ type;
705
+ /** @type {Renderer | undefined} */
706
+ #parent;
707
+ /**
708
+ * Asynchronous work associated with this renderer
709
+ * @type {Promise<void> | undefined}
710
+ */
711
+ promise = void 0;
712
+ /**
713
+ * State which is associated with the content tree as a whole.
714
+ * It will be re-exposed, uncopied, on all children.
715
+ * @type {SSRState}
716
+ * @readonly
717
+ */
718
+ global;
719
+ /**
720
+ * State that is local to the branch it is declared in.
721
+ * It will be shallow-copied to all children.
722
+ *
723
+ * @type {{ select_value: string | undefined }}
724
+ */
725
+ local;
726
+ /**
727
+ * @param {SSRState} global
728
+ * @param {Renderer | undefined} [parent]
729
+ */
730
+ constructor(global, parent) {
731
+ this.#parent = parent;
732
+ this.global = global;
733
+ this.local = parent ? { ...parent.local } : { select_value: void 0 };
734
+ this.type = parent ? parent.type : "body";
735
+ }
736
+ /**
737
+ * @param {(renderer: Renderer) => void} fn
738
+ */
739
+ head(fn) {
740
+ const head2 = new Renderer(this.global, this);
741
+ head2.type = "head";
742
+ this.#out.push(head2);
743
+ head2.child(fn);
744
+ }
745
+ /**
746
+ * @param {Array<Promise<void>>} blockers
747
+ * @param {(renderer: Renderer) => void} fn
748
+ */
749
+ async_block(blockers, fn) {
750
+ this.#out.push(BLOCK_OPEN);
751
+ this.async(blockers, fn);
752
+ this.#out.push(BLOCK_CLOSE);
753
+ }
754
+ /**
755
+ * @param {Array<Promise<void>>} blockers
756
+ * @param {(renderer: Renderer) => void} fn
757
+ */
758
+ async(blockers, fn) {
759
+ let callback = fn;
760
+ if (blockers.length > 0) {
761
+ const context = ssr_context;
762
+ callback = (renderer) => {
763
+ return Promise.all(blockers).then(() => {
764
+ const previous_context = ssr_context;
765
+ try {
766
+ set_ssr_context(context);
767
+ return fn(renderer);
768
+ } finally {
769
+ set_ssr_context(previous_context);
770
+ }
771
+ });
772
+ };
773
+ }
774
+ this.child(callback);
775
+ }
776
+ /**
777
+ * @param {Array<() => void>} thunks
778
+ */
779
+ run(thunks) {
780
+ const context = ssr_context;
781
+ let promise = Promise.resolve(thunks[0]());
782
+ const promises = [promise];
783
+ for (const fn of thunks.slice(1)) {
784
+ promise = promise.then(() => {
785
+ const previous_context = ssr_context;
786
+ set_ssr_context(context);
787
+ try {
788
+ return fn();
789
+ } finally {
790
+ set_ssr_context(previous_context);
791
+ }
792
+ });
793
+ promises.push(promise);
794
+ }
795
+ promise.catch(noop);
796
+ this.promise = promise;
797
+ return promises;
798
+ }
799
+ /**
800
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
801
+ */
802
+ child_block(fn) {
803
+ this.#out.push(BLOCK_OPEN);
804
+ this.child(fn);
805
+ this.#out.push(BLOCK_CLOSE);
806
+ }
807
+ /**
808
+ * Create a child renderer. The child renderer inherits the state from the parent,
809
+ * but has its own content.
810
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
811
+ */
812
+ child(fn) {
813
+ const child = new Renderer(this.global, this);
814
+ this.#out.push(child);
815
+ const parent = ssr_context;
816
+ set_ssr_context({
817
+ ...ssr_context,
818
+ p: parent,
819
+ c: null,
820
+ r: child
821
+ });
822
+ const result = fn(child);
823
+ set_ssr_context(parent);
824
+ if (result instanceof Promise) {
825
+ if (child.global.mode === "sync") {
826
+ await_invalid();
827
+ }
828
+ result.catch(() => {
829
+ });
830
+ child.promise = result;
831
+ }
832
+ return child;
833
+ }
834
+ /**
835
+ * Create a component renderer. The component renderer inherits the state from the parent,
836
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
837
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
838
+ * @param {Function} [component_fn]
839
+ * @returns {void}
840
+ */
841
+ component(fn, component_fn) {
842
+ push();
843
+ const child = this.child(fn);
844
+ child.#is_component_body = true;
845
+ pop();
846
+ }
847
+ /**
848
+ * @param {Record<string, any>} attrs
849
+ * @param {(renderer: Renderer) => void} fn
850
+ * @param {string | undefined} [css_hash]
851
+ * @param {Record<string, boolean> | undefined} [classes]
852
+ * @param {Record<string, string> | undefined} [styles]
853
+ * @param {number | undefined} [flags]
854
+ * @param {boolean | undefined} [is_rich]
855
+ * @returns {void}
856
+ */
857
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
858
+ const { value, ...select_attrs } = attrs;
859
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
860
+ this.child((renderer) => {
861
+ renderer.local.select_value = value;
862
+ fn(renderer);
863
+ });
864
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
865
+ }
866
+ /**
867
+ * @param {Record<string, any>} attrs
868
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
869
+ * @param {string | undefined} [css_hash]
870
+ * @param {Record<string, boolean> | undefined} [classes]
871
+ * @param {Record<string, string> | undefined} [styles]
872
+ * @param {number | undefined} [flags]
873
+ * @param {boolean | undefined} [is_rich]
874
+ */
875
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
876
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
877
+ const close = (renderer, value, { head: head2, body: body2 }) => {
878
+ if ("value" in attrs) {
879
+ value = attrs.value;
880
+ }
881
+ if (value === this.local.select_value) {
882
+ renderer.#out.push(" selected");
883
+ }
884
+ renderer.#out.push(`>${body2}${is_rich ? "<!>" : ""}</option>`);
885
+ if (head2) {
886
+ renderer.head((child) => child.push(head2));
887
+ }
888
+ };
889
+ if (typeof body === "function") {
890
+ this.child((renderer) => {
891
+ const r2 = new Renderer(this.global, this);
892
+ body(r2);
893
+ if (this.global.mode === "async") {
894
+ return r2.#collect_content_async().then((content) => {
895
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
896
+ });
897
+ } else {
898
+ const content = r2.#collect_content();
899
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
900
+ }
901
+ });
902
+ } else {
903
+ close(this, body, { body });
904
+ }
905
+ }
906
+ /**
907
+ * @param {(renderer: Renderer) => void} fn
908
+ */
909
+ title(fn) {
910
+ const path = this.get_path();
911
+ const close = (head2) => {
912
+ this.global.set_title(head2, path);
913
+ };
914
+ this.child((renderer) => {
915
+ const r2 = new Renderer(renderer.global, renderer);
916
+ fn(r2);
917
+ if (renderer.global.mode === "async") {
918
+ return r2.#collect_content_async().then((content) => {
919
+ close(content.head);
920
+ });
921
+ } else {
922
+ const content = r2.#collect_content();
923
+ close(content.head);
924
+ }
925
+ });
926
+ }
927
+ /**
928
+ * @param {string | (() => Promise<string>)} content
929
+ */
930
+ push(content) {
931
+ if (typeof content === "function") {
932
+ this.child(async (renderer) => renderer.push(await content()));
933
+ } else {
934
+ this.#out.push(content);
935
+ }
936
+ }
937
+ /**
938
+ * @param {() => void} fn
939
+ */
940
+ on_destroy(fn) {
941
+ (this.#on_destroy ??= []).push(fn);
942
+ }
943
+ /**
944
+ * @returns {number[]}
945
+ */
946
+ get_path() {
947
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
948
+ }
949
+ /**
950
+ * @deprecated this is needed for legacy component bindings
951
+ */
952
+ copy() {
953
+ const copy = new Renderer(this.global, this.#parent);
954
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
955
+ copy.promise = this.promise;
956
+ return copy;
957
+ }
958
+ /**
959
+ * @param {Renderer} other
960
+ * @deprecated this is needed for legacy component bindings
961
+ */
962
+ subsume(other) {
963
+ if (this.global.mode !== other.global.mode) {
964
+ throw new Error(
965
+ "invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
966
+ );
967
+ }
968
+ this.local = other.local;
969
+ this.#out = other.#out.map((item) => {
970
+ if (item instanceof Renderer) {
971
+ item.subsume(item);
972
+ }
973
+ return item;
974
+ });
975
+ this.promise = other.promise;
976
+ this.type = other.type;
977
+ }
978
+ get length() {
979
+ return this.#out.length;
980
+ }
981
+ /**
982
+ * Only available on the server and when compiling with the `server` option.
983
+ * 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.
984
+ * @template {Record<string, any>} Props
985
+ * @param {Component<Props>} component
986
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
987
+ * @returns {RenderOutput}
988
+ */
989
+ static render(component, options = {}) {
990
+ let sync;
991
+ const result = (
992
+ /** @type {RenderOutput} */
993
+ {}
994
+ );
995
+ Object.defineProperties(result, {
996
+ html: {
997
+ get: () => {
998
+ return (sync ??= Renderer.#render(component, options)).body;
999
+ }
1000
+ },
1001
+ head: {
1002
+ get: () => {
1003
+ return (sync ??= Renderer.#render(component, options)).head;
1004
+ }
1005
+ },
1006
+ body: {
1007
+ get: () => {
1008
+ return (sync ??= Renderer.#render(component, options)).body;
1009
+ }
1010
+ },
1011
+ hashes: {
1012
+ value: {
1013
+ script: ""
1014
+ }
1015
+ },
1016
+ then: {
1017
+ value: (
1018
+ /**
1019
+ * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
1020
+ *
1021
+ * @template TResult1
1022
+ * @template [TResult2=never]
1023
+ * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
1024
+ * @param { (reason: unknown) => TResult2 } onrejected
1025
+ */
1026
+ (onfulfilled, onrejected) => {
1027
+ {
1028
+ const result2 = sync ??= Renderer.#render(component, options);
1029
+ const user_result = onfulfilled({
1030
+ head: result2.head,
1031
+ body: result2.body,
1032
+ html: result2.body,
1033
+ hashes: { script: [] }
1034
+ });
1035
+ return Promise.resolve(user_result);
1036
+ }
1037
+ }
1038
+ )
1039
+ }
1040
+ });
1041
+ return result;
1042
+ }
1043
+ /**
1044
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
1045
+ * after awaiting `collect_async`.
1046
+ *
1047
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
1048
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
1049
+ * @returns {Iterable<() => void>}
1050
+ */
1051
+ *#collect_on_destroy() {
1052
+ for (const component of this.#traverse_components()) {
1053
+ yield* component.#collect_ondestroy();
1054
+ }
1055
+ }
1056
+ /**
1057
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
1058
+ * @returns {Iterable<Renderer>}
1059
+ */
1060
+ *#traverse_components() {
1061
+ for (const child of this.#out) {
1062
+ if (typeof child !== "string") {
1063
+ yield* child.#traverse_components();
1064
+ }
1065
+ }
1066
+ if (this.#is_component_body) {
1067
+ yield this;
1068
+ }
1069
+ }
1070
+ /**
1071
+ * @returns {Iterable<() => void>}
1072
+ */
1073
+ *#collect_ondestroy() {
1074
+ if (this.#on_destroy) {
1075
+ for (const fn of this.#on_destroy) {
1076
+ yield fn;
1077
+ }
1078
+ }
1079
+ for (const child of this.#out) {
1080
+ if (child instanceof Renderer && !child.#is_component_body) {
1081
+ yield* child.#collect_ondestroy();
1082
+ }
1083
+ }
1084
+ }
1085
+ /**
1086
+ * Render a component. Throws if any of the children are performing asynchronous work.
1087
+ *
1088
+ * @template {Record<string, any>} Props
1089
+ * @param {Component<Props>} component
1090
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
1091
+ * @returns {AccumulatedContent}
1092
+ */
1093
+ static #render(component, options) {
1094
+ var previous_context = ssr_context;
1095
+ try {
1096
+ const renderer = Renderer.#open_render("sync", component, options);
1097
+ const content = renderer.#collect_content();
1098
+ return Renderer.#close_render(content, renderer);
1099
+ } finally {
1100
+ abort();
1101
+ set_ssr_context(previous_context);
1102
+ }
1103
+ }
1104
+ /**
1105
+ * Render a component.
1106
+ *
1107
+ * @template {Record<string, any>} Props
1108
+ * @param {Component<Props>} component
1109
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
1110
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
1111
+ */
1112
+ static async #render_async(component, options) {
1113
+ const previous_context = ssr_context;
1114
+ try {
1115
+ const renderer = Renderer.#open_render("async", component, options);
1116
+ const content = await renderer.#collect_content_async();
1117
+ const hydratables = await renderer.#collect_hydratables();
1118
+ if (hydratables !== null) {
1119
+ content.head = hydratables + content.head;
1120
+ }
1121
+ return Renderer.#close_render(content, renderer);
1122
+ } finally {
1123
+ set_ssr_context(previous_context);
1124
+ abort();
1125
+ }
1126
+ }
1127
+ /**
1128
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
1129
+ * @param {AccumulatedContent} content
1130
+ * @returns {AccumulatedContent}
1131
+ */
1132
+ #collect_content(content = { head: "", body: "" }) {
1133
+ for (const item of this.#out) {
1134
+ if (typeof item === "string") {
1135
+ content[this.type] += item;
1136
+ } else if (item instanceof Renderer) {
1137
+ item.#collect_content(content);
1138
+ }
1139
+ }
1140
+ return content;
1141
+ }
1142
+ /**
1143
+ * Collect all of the code from the `out` array and return it as a string.
1144
+ * @param {AccumulatedContent} content
1145
+ * @returns {Promise<AccumulatedContent>}
1146
+ */
1147
+ async #collect_content_async(content = { head: "", body: "" }) {
1148
+ await this.promise;
1149
+ for (const item of this.#out) {
1150
+ if (typeof item === "string") {
1151
+ content[this.type] += item;
1152
+ } else if (item instanceof Renderer) {
1153
+ await item.#collect_content_async(content);
1154
+ }
1155
+ }
1156
+ return content;
1157
+ }
1158
+ async #collect_hydratables() {
1159
+ const ctx = get_render_context().hydratable;
1160
+ for (const [_, key] of ctx.unresolved_promises) {
1161
+ unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
1162
+ }
1163
+ for (const comparison of ctx.comparisons) {
1164
+ await comparison;
1165
+ }
1166
+ return await this.#hydratable_block(ctx);
1167
+ }
1168
+ /**
1169
+ * @template {Record<string, any>} Props
1170
+ * @param {'sync' | 'async'} mode
1171
+ * @param {import('svelte').Component<Props>} component
1172
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
1173
+ * @returns {Renderer}
1174
+ */
1175
+ static #open_render(mode, component, options) {
1176
+ const renderer = new Renderer(
1177
+ new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp)
1178
+ );
1179
+ renderer.push(BLOCK_OPEN);
1180
+ push();
1181
+ if (options.context) ssr_context.c = options.context;
1182
+ ssr_context.r = renderer;
1183
+ component(renderer, options.props ?? {});
1184
+ pop();
1185
+ renderer.push(BLOCK_CLOSE);
1186
+ return renderer;
1187
+ }
1188
+ /**
1189
+ * @param {AccumulatedContent} content
1190
+ * @param {Renderer} renderer
1191
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
1192
+ */
1193
+ static #close_render(content, renderer) {
1194
+ for (const cleanup of renderer.#collect_on_destroy()) {
1195
+ cleanup();
1196
+ }
1197
+ let head2 = content.head + renderer.global.get_title();
1198
+ let body = content.body;
1199
+ for (const { hash, code } of renderer.global.css) {
1200
+ head2 += `<style id="${hash}">${code}</style>`;
1201
+ }
1202
+ return {
1203
+ head: head2,
1204
+ body,
1205
+ hashes: {
1206
+ script: renderer.global.csp.script_hashes
1207
+ }
1208
+ };
1209
+ }
1210
+ /**
1211
+ * @param {HydratableContext} ctx
1212
+ */
1213
+ async #hydratable_block(ctx) {
1214
+ if (ctx.lookup.size === 0) {
1215
+ return null;
1216
+ }
1217
+ let entries = [];
1218
+ let has_promises = false;
1219
+ for (const [k, v] of ctx.lookup) {
1220
+ if (v.promises) {
1221
+ has_promises = true;
1222
+ for (const p of v.promises) await p;
1223
+ }
1224
+ entries.push(`[${uneval(k)},${v.serialized}]`);
1225
+ }
1226
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
1227
+ if (has_promises) {
1228
+ prelude = `const r = (v) => Promise.resolve(v);
1229
+ ${prelude}`;
1230
+ }
1231
+ const body = `
1232
+ {
1233
+ ${prelude}
1234
+
1235
+ for (const [k, v] of [
1236
+ ${entries.join(",\n ")}
1237
+ ]) {
1238
+ h.set(k, v);
1239
+ }
1240
+ }
1241
+ `;
1242
+ let csp_attr = "";
1243
+ if (this.global.csp.nonce) {
1244
+ csp_attr = ` nonce="${this.global.csp.nonce}"`;
1245
+ } else if (this.global.csp.hash) {
1246
+ const hash = await sha256(body);
1247
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
1248
+ }
1249
+ return `
1250
+ <script${csp_attr}>${body}<\/script>`;
1251
+ }
1252
+ }
1253
+ class SSRState {
1254
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
1255
+ csp;
1256
+ /** @readonly @type {'sync' | 'async'} */
1257
+ mode;
1258
+ /** @readonly @type {() => string} */
1259
+ uid;
1260
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
1261
+ css = /* @__PURE__ */ new Set();
1262
+ /** @type {{ path: number[], value: string }} */
1263
+ #title = { path: [], value: "" };
1264
+ /**
1265
+ * @param {'sync' | 'async'} mode
1266
+ * @param {string} id_prefix
1267
+ * @param {Csp} csp
1268
+ */
1269
+ constructor(mode, id_prefix = "", csp = { hash: false }) {
1270
+ this.mode = mode;
1271
+ this.csp = { ...csp, script_hashes: [] };
1272
+ let uid = 1;
1273
+ this.uid = () => `${id_prefix}s${uid++}`;
1274
+ }
1275
+ get_title() {
1276
+ return this.#title.value;
1277
+ }
1278
+ /**
1279
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
1280
+ * from earlier than or equal to the current value.
1281
+ * @param {string} value
1282
+ * @param {number[]} path
1283
+ */
1284
+ set_title(value, path) {
1285
+ const current = this.#title.path;
1286
+ let i = 0;
1287
+ let l = Math.min(path.length, current.length);
1288
+ while (i < l && path[i] === current[i]) i += 1;
1289
+ if (path[i] === void 0) return;
1290
+ if (current[i] === void 0 || path[i] > current[i]) {
1291
+ this.#title.path = path;
1292
+ this.#title.value = value;
1293
+ }
1294
+ }
1295
+ }
1296
+ 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;
1297
+ function render(component, options = {}) {
1298
+ if (options.csp?.hash && options.csp.nonce) {
1299
+ invalid_csp();
1300
+ }
1301
+ return Renderer.render(
1302
+ /** @type {Component<Props>} */
1303
+ component,
1304
+ options
1305
+ );
1306
+ }
1307
+ function head(hash, renderer, fn) {
1308
+ renderer.head((renderer2) => {
1309
+ renderer2.push(`<!--${hash}-->`);
1310
+ renderer2.child(fn);
1311
+ renderer2.push(EMPTY_COMMENT);
1312
+ });
1313
+ }
1314
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
1315
+ if (styles) {
1316
+ attrs.style = to_style(attrs.style, styles);
1317
+ }
1318
+ if (attrs.class) {
1319
+ attrs.class = clsx(attrs.class);
1320
+ }
1321
+ if (css_hash || classes) {
1322
+ attrs.class = to_class(attrs.class, css_hash, classes);
1323
+ }
1324
+ let attr_str = "";
1325
+ let name;
1326
+ const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
1327
+ const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
1328
+ const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
1329
+ for (name in attrs) {
1330
+ if (typeof attrs[name] === "function") continue;
1331
+ if (name[0] === "$" && name[1] === "$") continue;
1332
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
1333
+ var value = attrs[name];
1334
+ if (lowercase) {
1335
+ name = name.toLowerCase();
1336
+ }
1337
+ if (is_input) {
1338
+ if (name === "defaultvalue" || name === "defaultchecked") {
1339
+ name = name === "defaultvalue" ? "value" : "checked";
1340
+ if (attrs[name]) continue;
1341
+ }
1342
+ }
1343
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
1344
+ }
1345
+ return attr_str;
1346
+ }
1347
+ function stringify(value) {
1348
+ return typeof value === "string" ? value : value == null ? "" : value + "";
1349
+ }
1350
+ function attr_class(value, hash, directives) {
1351
+ var result = to_class(value, hash, directives);
1352
+ return result ? ` class="${escape_html(result, true)}"` : "";
1353
+ }
1354
+ function ensure_array_like(array_like_or_iterator) {
1355
+ if (array_like_or_iterator) {
1356
+ return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
1357
+ }
1358
+ return [];
1359
+ }
1360
+
1361
+ export { ASYNC as A, BLOCK_EFFECT as B, CONNECTED as C, DevalueError as D, ERROR_VALUE as E, HYDRATION_END as F, HYDRATION_START_ELSE as G, HYDRATION_START as H, INERT as I, USER_EFFECT as J, uneval as K, LEGACY_PROPS as L, MAYBE_DIRTY as M, head as N, attr as O, attr_class as P, ensure_array_like as Q, ROOT_EFFECT as R, STATE_SYMBOL as S, stringify as T, UNINITIALIZED as U, WAS_MARKED as W, is_plain_object as a, stringify_string as b, COMMENT_NODE as c, HYDRATION_ERROR as d, enumerable_symbols as e, DERIVED as f, get_type as g, DIRTY as h, is_primitive as i, CLEAN as j, EFFECT as k, BRANCH_EFFECT as l, RENDER_EFFECT as m, MANAGED_EFFECT as n, HEAD_EFFECT as o, DESTROYED as p, REACTION_IS_UPDATING as q, render as r, stringify_key as s, EFFECT_RAN as t, EFFECT_PRESERVED as u, EFFECT_TRANSPARENT as v, BOUNDARY_EFFECT as w, EAGER_EFFECT as x, STALE_REACTION as y, is_passive_event as z };
1362
+ //# sourceMappingURL=index-DjKos2HY.js.map