@manyducks.co/dolla 1.0.1 → 2.0.0-alpha.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 (78) hide show
  1. package/README.md +47 -23
  2. package/build.js +5 -5
  3. package/dist/fragment-s33qZBzz.js +1241 -0
  4. package/dist/fragment-s33qZBzz.js.map +1 -0
  5. package/dist/index.d.ts +42 -0
  6. package/dist/index.js +1308 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/jsx-dev-runtime.d.ts +2 -0
  9. package/dist/jsx-dev-runtime.js +17 -0
  10. package/dist/jsx-dev-runtime.js.map +1 -0
  11. package/{lib/jsx → dist}/jsx-runtime.d.ts +3 -4
  12. package/dist/jsx-runtime.js +20 -0
  13. package/dist/jsx-runtime.js.map +1 -0
  14. package/{lib → dist}/markup.d.ts +12 -13
  15. package/dist/modules/dolla.d.ts +87 -0
  16. package/dist/modules/http.d.ts +57 -0
  17. package/dist/modules/language.d.ts +41 -0
  18. package/{lib/stores → dist/modules}/render.d.ts +5 -6
  19. package/{lib/stores → dist/modules}/router.d.ts +37 -39
  20. package/{lib → dist}/nodes/cond.d.ts +1 -4
  21. package/{lib → dist}/nodes/html.d.ts +2 -5
  22. package/{lib → dist}/nodes/observer.d.ts +2 -5
  23. package/{lib → dist}/nodes/outlet.d.ts +1 -4
  24. package/{lib → dist}/nodes/portal.d.ts +1 -3
  25. package/{lib → dist}/nodes/repeat.d.ts +2 -5
  26. package/{lib → dist}/nodes/text.d.ts +1 -1
  27. package/{lib → dist}/signals.d.ts +37 -54
  28. package/{lib → dist}/types.d.ts +0 -8
  29. package/{lib → dist}/utils.d.ts +10 -0
  30. package/dist/view.d.ts +44 -0
  31. package/dist/views/default-crash-page.d.ts +8 -0
  32. package/notes/scratch.md +120 -0
  33. package/package.json +11 -12
  34. package/vite.config.js +27 -0
  35. package/lib/app.d.ts +0 -83
  36. package/lib/classes/CrashCollector.d.ts +0 -30
  37. package/lib/classes/DebugHub.d.ts +0 -61
  38. package/lib/classes/EventEmitter.d.ts +0 -44
  39. package/lib/index.d.ts +0 -21
  40. package/lib/index.js +0 -4176
  41. package/lib/index.js.map +0 -7
  42. package/lib/jsx/jsx-dev-runtime.d.ts +0 -3
  43. package/lib/jsx/jsx-dev-runtime.js +0 -20
  44. package/lib/jsx/jsx-dev-runtime.js.map +0 -7
  45. package/lib/jsx/jsx-runtime.js +0 -22
  46. package/lib/jsx/jsx-runtime.js.map +0 -7
  47. package/lib/signals.test.d.ts +0 -1
  48. package/lib/spring.d.ts +0 -0
  49. package/lib/state.d.ts +0 -103
  50. package/lib/store.d.ts +0 -59
  51. package/lib/stores/dialog.d.ts +0 -32
  52. package/lib/stores/document.d.ts +0 -11
  53. package/lib/stores/http.d.ts +0 -60
  54. package/lib/stores/language.d.ts +0 -36
  55. package/lib/testing/classes/MockHTTP.d.ts +0 -10
  56. package/lib/testing/index.d.ts +0 -4
  57. package/lib/testing/makeMockDOMNode.d.ts +0 -10
  58. package/lib/testing/makeMockFetch._test.d.ts +0 -1
  59. package/lib/testing/makeMockFetch.d.ts +0 -36
  60. package/lib/testing/makeMockFetch.test.d.ts +0 -1
  61. package/lib/testing/makeMockFetch.test_skip.d.ts +0 -1
  62. package/lib/testing/stores/dialog.d.ts +0 -6
  63. package/lib/testing/stores/http.d.ts +0 -13
  64. package/lib/testing/stores/page.d.ts +0 -7
  65. package/lib/testing/stores/router.d.ts +0 -12
  66. package/lib/testing/wrapStore._test.d.ts +0 -1
  67. package/lib/testing/wrapStore.d.ts +0 -8
  68. package/lib/testing/wrapStore.test.d.ts +0 -1
  69. package/lib/testing/wrapStore.test_skip.d.ts +0 -1
  70. package/lib/testing/wrapView.d.ts +0 -0
  71. package/lib/view.d.ts +0 -88
  72. package/lib/views/default-crash-page.d.ts +0 -7
  73. package/lib/views/store-scope.d.ts +0 -13
  74. /package/{lib → dist}/routing.d.ts +0 -0
  75. /package/{lib → dist}/routing.test.d.ts +0 -0
  76. /package/{lib → dist}/typeChecking.d.ts +0 -0
  77. /package/{lib → dist}/views/default-view.d.ts +0 -0
  78. /package/{lib → dist}/views/fragment.d.ts +0 -0
@@ -0,0 +1,1241 @@
1
+ var ie = Object.defineProperty;
2
+ var ce = (t, e, n) => e in t ? ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var d = (t, e, n) => ce(t, typeof e != "symbol" ? e + "" : e, n);
4
+ function le(t) {
5
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
6
+ }
7
+ var I = { exports: {} }, K;
8
+ function ae() {
9
+ return K || (K = 1, function(t, e) {
10
+ Object.defineProperty(e, "__esModule", { value: !0 });
11
+ var n = /* @__PURE__ */ function() {
12
+ function c(a, h) {
13
+ var g = [], C = !0, b = !1, k = void 0;
14
+ try {
15
+ for (var v, $ = a[Symbol.iterator](); !(C = (v = $.next()).done) && (g.push(v.value), !(h && g.length === h)); C = !0) ;
16
+ } catch (m) {
17
+ b = !0, k = m;
18
+ } finally {
19
+ try {
20
+ !C && $.return && $.return();
21
+ } finally {
22
+ if (b) throw k;
23
+ }
24
+ }
25
+ return g;
26
+ }
27
+ return function(a, h) {
28
+ if (Array.isArray(a)) return a;
29
+ if (Symbol.iterator in Object(a)) return c(a, h);
30
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
31
+ };
32
+ }(), o = function(c) {
33
+ return c.reduce(function(a, h) {
34
+ return 16 > h ? a + "0" + h.toString(16) : a + h.toString(16);
35
+ }, "#");
36
+ }, r = function(c, a, h) {
37
+ var g = 0.5 > h ? h * (1 + a) : h + a - h * a, C = 2 * h - g, b = function(m, p, f) {
38
+ var u = Math.round, y = 0 > f ? f + 1 : 1 < f ? f - 1 : f;
39
+ return y = y < 1 / 6 ? m + 6 * (p - m) * y : y < 1 / 2 ? p : y < 2 / 3 ? m + 6 * (p - m) * (2 / 3 - y) : m, u(255 * y);
40
+ }, k = b(C, g, c + 1 / 3), v = b(C, g, c), $ = b(C, g, c - 1 / 3);
41
+ return [k, v, $];
42
+ }, s = function(c, a, h, g) {
43
+ var C = c % 1007 / 1007, b = function(m, p, f) {
44
+ return m * (f - p) + p;
45
+ }, k = b(C, a.min, a.max), v = b(C, h.min, h.max), $ = b(C, g.max, g.min);
46
+ return [k, v, $];
47
+ }, i = function(c) {
48
+ return c.split("").reduce(function(a, h, g) {
49
+ return a * h.charCodeAt(0) * g + 1;
50
+ }, 1);
51
+ }, l = function(c) {
52
+ var a = c.str, h = c.hue, g = h === void 0 ? { min: 0, max: 360 } : h, C = c.sat, b = C === void 0 ? { min: 0.35, max: 0.65 } : C, k = c.light, v = k === void 0 ? { min: 0.3, max: 0.7 } : k, $ = c.hashFunction, m = $ === void 0 ? i : $, p = c.scheme, f = p === void 0 ? "hex" : p, u = s(m(a), g, b, v), y = n(u, 3), N = y[0], A = y[1], U = y[2], H = r(N / 360, A, U), se = o(H);
53
+ return f === "hsl" ? [N, A, U] : f === "rgb" ? H : se;
54
+ };
55
+ e.default = l, t.exports = e.default;
56
+ }(I, I.exports)), I.exports;
57
+ }
58
+ var de = ae();
59
+ const ue = /* @__PURE__ */ le(de);
60
+ function R(t) {
61
+ if (t === void 0)
62
+ return "undefined";
63
+ if (t === null)
64
+ return "null";
65
+ const e = typeof t;
66
+ switch (e) {
67
+ case "number":
68
+ return isNaN(t) ? "NaN" : "number";
69
+ case "function":
70
+ return Y(t) ? "class" : e;
71
+ case "object":
72
+ return j(t) ? "array" : he(t) ? "promise" : e;
73
+ default:
74
+ return e;
75
+ }
76
+ }
77
+ function j(t) {
78
+ return Array.isArray(t);
79
+ }
80
+ function D(...t) {
81
+ const e = t[0], n = (o) => j(o) && o.every((r) => e(r));
82
+ return t.length < 2 ? n : n(t[1]);
83
+ }
84
+ function Ve(...t) {
85
+ const e = t[0], n = O(t[2]) ? t[2] : "Expected an array of valid items. Got type: %t, value: %v", o = (r) => {
86
+ if (j(r) && r.every((s) => e(s)))
87
+ return !0;
88
+ throw new TypeError(_(r, n));
89
+ };
90
+ return t.length < 2 ? o : o(t[1]);
91
+ }
92
+ function O(t) {
93
+ return typeof t == "string";
94
+ }
95
+ function Fe(t, e) {
96
+ if (O(t))
97
+ return !0;
98
+ throw new TypeError(_(t, e ?? "Expected a string. Got type: %t, value: %v"));
99
+ }
100
+ function E(t) {
101
+ return typeof t == "function" && !Y(t);
102
+ }
103
+ function z(t) {
104
+ return typeof t == "number" && !isNaN(t);
105
+ }
106
+ function he(t) {
107
+ if (t == null) return !1;
108
+ const e = t;
109
+ return e instanceof Promise || E(e.then) && E(e.catch) && E(e.finally);
110
+ }
111
+ function Y(t) {
112
+ return typeof t == "function" && /^\s*class\s+/.test(t.toString());
113
+ }
114
+ function Pe(...t) {
115
+ const e = t[0], n = O(t[2]) ? t[2] : `Expected instance of ${e.name}. Got type: %t, value: %v`, o = (r) => {
116
+ if (r instanceof e)
117
+ return !0;
118
+ throw new TypeError(_(r, n));
119
+ };
120
+ return t.length < 2 ? o : o(t[1]);
121
+ }
122
+ function G(t) {
123
+ return t != null && typeof t == "object" && !j(t);
124
+ }
125
+ function _(t, e) {
126
+ var r;
127
+ const n = R(t), o = ((r = t == null ? void 0 : t.toString) == null ? void 0 : r.call(t)) || String(t);
128
+ return e.replaceAll("%t", n).replaceAll("%v", o);
129
+ }
130
+ const je = () => {
131
+ };
132
+ function W(t) {
133
+ return t != null && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) === Object.getPrototypeOf({});
134
+ }
135
+ function L(t, e) {
136
+ if (t === e)
137
+ return !0;
138
+ if (w(t) || w(e))
139
+ return !1;
140
+ if (W(t) && W(e)) {
141
+ const n = Object.keys(t), o = Object.keys(e);
142
+ if (n.length !== o.length)
143
+ return !1;
144
+ for (const r in t)
145
+ if (!L(t[r], e[r]))
146
+ return !1;
147
+ return !0;
148
+ }
149
+ if (Array.isArray(t) && Array.isArray(e)) {
150
+ if (t.length !== e.length)
151
+ return !1;
152
+ for (const n in t)
153
+ if (!L(t[n], e[n]))
154
+ return !1;
155
+ return !0;
156
+ }
157
+ return t === e;
158
+ }
159
+ function fe(t, e) {
160
+ const n = (o) => {
161
+ const r = {};
162
+ for (const s in o)
163
+ t.includes(s) || (r[s] = o[s]);
164
+ return r;
165
+ };
166
+ return e == null ? n : n(e);
167
+ }
168
+ function Ue() {
169
+ if (typeof window < "u" && window.console)
170
+ return window.console;
171
+ if (typeof global < "u" && global.console)
172
+ return global.console;
173
+ }
174
+ function Me(t) {
175
+ return ue({
176
+ str: t,
177
+ sat: { min: 0.35, max: 0.55 },
178
+ light: { min: 0.6, max: 0.6 }
179
+ });
180
+ }
181
+ function Ie(t) {
182
+ if (t instanceof RegExp)
183
+ return (o) => t.test(o);
184
+ const e = {
185
+ positive: [],
186
+ negative: []
187
+ }, n = t.split(",").map((o) => o.trim()).filter((o) => o !== "");
188
+ for (let o of n) {
189
+ let r = "positive";
190
+ o.startsWith("-") && (r = "negative", o = o.slice(1)), o === "*" ? e[r].push(function() {
191
+ return !0;
192
+ }) : o.endsWith("*") ? e[r].push(function(s) {
193
+ return s.startsWith(o.slice(0, o.length - 1));
194
+ }) : e[r].push(function(s) {
195
+ return s === o;
196
+ });
197
+ }
198
+ return function(o) {
199
+ const { positive: r, negative: s } = e;
200
+ return !(s.some((i) => i(o)) || r.length > 0 && !r.some((i) => i(o)));
201
+ };
202
+ }
203
+ function w(t) {
204
+ return !(t == null || typeof t != "object" || typeof t.get != "function" || typeof t.watch != "function");
205
+ }
206
+ function Z(t) {
207
+ return !(t == null || typeof t != "object" || typeof t.set != "function" || typeof t.get != "function" || typeof t.watch != "function");
208
+ }
209
+ function V(t) {
210
+ return w(t) ? t.get() : t;
211
+ }
212
+ function J(t) {
213
+ return w(t) ? t : B(t);
214
+ }
215
+ function Le(t, e) {
216
+ const [n, o] = F(t, e);
217
+ return {
218
+ get: n.get,
219
+ watch: n.watch,
220
+ set: o
221
+ };
222
+ }
223
+ function Ge(t, e) {
224
+ return {
225
+ get: t.get,
226
+ watch: t.watch,
227
+ set: e
228
+ };
229
+ }
230
+ function pe(t, e) {
231
+ return function(o) {
232
+ const r = t.get();
233
+ let s;
234
+ typeof o == "function" ? s = o(r) : s = o, e(s, r);
235
+ };
236
+ }
237
+ function B(t) {
238
+ return {
239
+ get() {
240
+ return t;
241
+ },
242
+ watch(e, n = {}) {
243
+ return n.lazy || e(t), function() {
244
+ };
245
+ }
246
+ };
247
+ }
248
+ function F(t, e) {
249
+ let n = t, o = [];
250
+ function r() {
251
+ for (const c of o)
252
+ c(n);
253
+ }
254
+ function s(c, a) {
255
+ return e != null && e.equality ? e.equality(c, a) : L(c, a);
256
+ }
257
+ const i = {
258
+ get() {
259
+ return V(n);
260
+ },
261
+ watch(c, a) {
262
+ return o.push(c), a != null && a.lazy || c(i.get()), function() {
263
+ o.splice(o.indexOf(c), 1);
264
+ };
265
+ }
266
+ }, l = pe(i, (c, a) => {
267
+ s(c, a) || (n = c, r());
268
+ });
269
+ return [i, l];
270
+ }
271
+ const ye = Symbol("EMPTY");
272
+ function ge(t, e, n) {
273
+ t = t.map((p) => w(p) ? p : B(p));
274
+ let o = new Array(t.length).fill(ye, 0, t.length), r, s = [], i = !1, l = [], c, a;
275
+ function h(p = b()) {
276
+ for (const f of s)
277
+ f(p);
278
+ }
279
+ function g(p, f) {
280
+ return n != null && n.equality ? n.equality(p, f) : L(p, f);
281
+ }
282
+ function C() {
283
+ const p = t.map((f) => f.get());
284
+ for (let f = 0; f < t.length; f++)
285
+ if (!g(p[f], o[f])) {
286
+ k(e(...p)), o = p;
287
+ break;
288
+ }
289
+ }
290
+ function b() {
291
+ return i || C(), a = V(r), a;
292
+ }
293
+ function k(p) {
294
+ p !== r && (c && (c(), c = void 0), r = p, a = V(p), w(p) && i && (c = p.watch((f) => {
295
+ const u = V(f);
296
+ g(u, a) || (a = u, h(u));
297
+ })));
298
+ }
299
+ function v() {
300
+ let p = [...o];
301
+ for (let f = 0; f < t.length; f++) {
302
+ const u = t[f];
303
+ l.push(
304
+ u.watch((y) => {
305
+ const N = o[f];
306
+ o[f] = y, i && !g(y, N) && (k(e(...o)), h(V(r)));
307
+ })
308
+ );
309
+ }
310
+ i = !0;
311
+ for (let f = 0; f < t.length; f++)
312
+ if (!g(o[f], p[f])) {
313
+ k(e(...o)), h(V(r));
314
+ break;
315
+ }
316
+ }
317
+ function $() {
318
+ for (const p of l)
319
+ p();
320
+ l = [], c && (c(), c = void 0), i = !1;
321
+ }
322
+ return {
323
+ get() {
324
+ return b();
325
+ },
326
+ watch(p, f) {
327
+ return i || v(), s.push(p), f != null && f.lazy || p(b()), function() {
328
+ s.splice(s.indexOf(p), 1), i && s.length === 0 && $();
329
+ };
330
+ }
331
+ };
332
+ }
333
+ function q(t, e) {
334
+ if (t.length === 0)
335
+ throw new TypeError("Expected at least one signal.");
336
+ if (t.some((n) => !w(n)))
337
+ throw new TypeError("All values must be signals");
338
+ return t = t.map((n) => w(n) ? n : B(n)), t.length > 1 ? ge(t, e).watch(() => null) : t[0].watch(e);
339
+ }
340
+ class me {
341
+ constructor(e) {
342
+ d(this, "node");
343
+ d(this, "endNode");
344
+ d(this, "$predicate");
345
+ d(this, "stopCallback");
346
+ d(this, "thenContent");
347
+ d(this, "elseContent");
348
+ d(this, "connectedContent", []);
349
+ d(this, "elementContext");
350
+ d(this, "initialUpdateHappened", !1);
351
+ d(this, "previousValue");
352
+ this.$predicate = e.$predicate, this.thenContent = e.thenContent ? M(e.thenContent) : void 0, this.elseContent = e.elseContent ? M(e.elseContent) : void 0, this.elementContext = e.elementContext, this.elementContext.dolla.env === "development" ? (this.node = document.createComment("Conditional"), this.endNode = document.createComment("/Conditional")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
353
+ }
354
+ get connected() {
355
+ return this.node.parentNode != null;
356
+ }
357
+ connect(e, n) {
358
+ this.connected || (e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null), this.elementContext.dolla.env === "development" && e.insertBefore(this.endNode, this.node.nextSibling), this.stopCallback = this.$predicate.watch((o) => {
359
+ (!this.initialUpdateHappened || o && !this.previousValue || !o && this.previousValue) && (this.update(o), this.initialUpdateHappened = !0, this.previousValue = o);
360
+ }));
361
+ }
362
+ disconnect() {
363
+ var e, n;
364
+ this.stopCallback && (this.stopCallback(), this.stopCallback = void 0);
365
+ for (const o of this.connectedContent)
366
+ o.disconnect();
367
+ this.connectedContent = [], this.connected && ((e = this.node.parentNode) == null || e.removeChild(this.node), (n = this.endNode.parentNode) == null || n.removeChild(this.endNode));
368
+ }
369
+ update(e) {
370
+ var n;
371
+ for (const o of this.connectedContent)
372
+ o.disconnect();
373
+ if (this.connectedContent = [], this.node.parentNode != null) {
374
+ e && this.thenContent ? this.connectedContent = S(this.thenContent, this.elementContext) : !e && this.elseContent && (this.connectedContent = S(this.elseContent, this.elementContext));
375
+ for (let o = 0; o < this.connectedContent.length; o++) {
376
+ const r = this.connectedContent[o], s = ((n = this.connectedContent[o - 1]) == null ? void 0 : n.node) ?? this.node;
377
+ r.connect(this.node.parentNode, s);
378
+ }
379
+ this.elementContext.dolla.env === "development" && (this.node.textContent = `Conditional (${e ? "truthy" : "falsy"})`);
380
+ }
381
+ }
382
+ async setChildren(e) {
383
+ }
384
+ }
385
+ let Q = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
386
+ const Ce = (t) => /^on[A-Z]/.test(t);
387
+ class we {
388
+ constructor({ tag: e, props: n, children: o, elementContext: r }) {
389
+ d(this, "node");
390
+ d(this, "props");
391
+ d(this, "children");
392
+ d(this, "stopCallbacks", []);
393
+ d(this, "elementContext");
394
+ d(this, "uniqueId", Q());
395
+ // Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
396
+ d(this, "canClickAway", !1);
397
+ if (r = { ...r }, e.toLowerCase() === "svg" && (r.isSVG = !0), r.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", e) : this.node = document.createElement(e), r.dolla.env === "development" && (this.node.dataset.uniqueId = this.uniqueId), n.ref)
398
+ if (oe(n.ref))
399
+ n.ref.node = this.node;
400
+ else
401
+ throw new Error("Expected ref to be a Ref object. Got: " + n.ref);
402
+ this.props = {
403
+ ...fe(["ref", "class", "className"], n),
404
+ class: n.className ?? n.class
405
+ }, this.children = o ? S(o, r) : [], this.elementContext = r;
406
+ }
407
+ get connected() {
408
+ return this.node.parentNode != null;
409
+ }
410
+ connect(e, n) {
411
+ if (e == null)
412
+ throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${e}`);
413
+ if (!this.connected) {
414
+ for (const o of this.children)
415
+ o.connect(this.node);
416
+ this.applyProps(this.node, this.props), this.props.style && this.applyStyles(this.node, this.props.style, this.stopCallbacks), this.props.class && this.applyClasses(this.node, this.props.class, this.stopCallbacks);
417
+ }
418
+ e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null), setTimeout(() => {
419
+ this.canClickAway = !0;
420
+ }, 0);
421
+ }
422
+ disconnect() {
423
+ var e;
424
+ if (this.connected) {
425
+ for (const n of this.children)
426
+ n.disconnect();
427
+ (e = this.node.parentNode) == null || e.removeChild(this.node), this.canClickAway = !1;
428
+ for (const n of this.stopCallbacks)
429
+ n();
430
+ this.stopCallbacks = [];
431
+ }
432
+ }
433
+ setChildren(e) {
434
+ var s, i;
435
+ const n = this.children, o = [], r = Math.max(n.length, e.length);
436
+ for (let l = 0; l < r; l++)
437
+ !n[l] && e[l] ? (o[l] = e[l], o[l].connect(this.node, (s = o[l - 1]) == null ? void 0 : s.node)) : n[l] && !e[l] ? n[l].disconnect() : n[l] != e[l] && (o[l] = e[l], n[l].disconnect(), o[l].connect(this.node, (i = o[l - 1]) == null ? void 0 : i.node));
438
+ this.children = o;
439
+ }
440
+ getUpdateKey(e, n) {
441
+ return `${this.uniqueId}:${e}:${n}`;
442
+ }
443
+ applyProps(e, n) {
444
+ const o = (r, s, i) => {
445
+ w(r) ? this.stopCallbacks.push(
446
+ r.watch((l) => {
447
+ this.elementContext.dolla.render.update(() => {
448
+ s(l);
449
+ }, i);
450
+ })
451
+ ) : this.elementContext.dolla.render.update(() => {
452
+ s(r);
453
+ }, i);
454
+ };
455
+ for (const r in n) {
456
+ const s = n[r];
457
+ if (r === "attributes") {
458
+ const i = s;
459
+ for (const l in i)
460
+ o(
461
+ i[l],
462
+ (c) => {
463
+ c == null ? e.removeAttribute(l) : e.setAttribute(l, String(c));
464
+ },
465
+ this.getUpdateKey("attr", l)
466
+ );
467
+ } else if (r === "eventListeners") {
468
+ const i = s;
469
+ for (const l in i) {
470
+ const c = w(s) ? (a) => s.get()(a) : s;
471
+ e.addEventListener(l, c), this.stopCallbacks.push(() => {
472
+ e.removeEventListener(l, c);
473
+ });
474
+ }
475
+ } else if (r === "onClickOutside" || r === "onclickoutside") {
476
+ const i = (c) => {
477
+ this.canClickAway && !e.contains(c.target) && (w(s) ? s.get()(c) : s(c));
478
+ }, l = { capture: !0 };
479
+ window.addEventListener("click", i, l), this.stopCallbacks.push(() => {
480
+ window.removeEventListener("click", i, l);
481
+ });
482
+ } else if (r === "$$value") {
483
+ if (!Z(s))
484
+ throw new TypeError(`$$value attribute must be a settable signal. Got: ${s}`);
485
+ o(
486
+ s,
487
+ (l) => {
488
+ e.value = String(l);
489
+ },
490
+ this.getUpdateKey("attr", "value")
491
+ );
492
+ const i = (l) => {
493
+ const c = be(s.get(), l.currentTarget.value);
494
+ s.set(c);
495
+ };
496
+ e.addEventListener("input", i), this.stopCallbacks.push(() => {
497
+ e.removeEventListener("input", i);
498
+ });
499
+ } else if (Ce(r)) {
500
+ const i = r.slice(2).toLowerCase(), l = w(s) ? (c) => s.get()(c) : s;
501
+ e.addEventListener(i, l), this.stopCallbacks.push(() => {
502
+ e.removeEventListener(i, l);
503
+ });
504
+ } else if (r.includes("-"))
505
+ o(
506
+ s,
507
+ (i) => {
508
+ i == null ? e.removeAttribute(r) : e.setAttribute(r, String(i));
509
+ },
510
+ this.getUpdateKey("attr", r)
511
+ );
512
+ else if (!ke.includes(r))
513
+ if (this.elementContext.isSVG)
514
+ o(
515
+ s,
516
+ (i) => {
517
+ i != null ? e.setAttribute(r, String(n[r])) : e.removeAttribute(r);
518
+ },
519
+ this.getUpdateKey("attr", r)
520
+ );
521
+ else
522
+ switch (r) {
523
+ case "contentEditable":
524
+ case "value":
525
+ o(
526
+ s,
527
+ (i) => {
528
+ e[r] = String(i);
529
+ },
530
+ this.getUpdateKey("prop", r)
531
+ );
532
+ break;
533
+ case "for":
534
+ o(
535
+ s,
536
+ (i) => {
537
+ e.htmlFor = i;
538
+ },
539
+ this.getUpdateKey("prop", "htmlFor")
540
+ );
541
+ break;
542
+ case "checked":
543
+ o(
544
+ s,
545
+ (i) => {
546
+ e.checked = i, i ? e.setAttribute("checked", "") : e.removeAttribute("checked");
547
+ },
548
+ this.getUpdateKey("prop", "checked")
549
+ );
550
+ break;
551
+ // Attribute-aliased props
552
+ case "exportParts":
553
+ case "part":
554
+ case "translate":
555
+ case "title": {
556
+ const i = r.toLowerCase();
557
+ o(
558
+ s,
559
+ (l) => {
560
+ l == null ? e.removeAttribute(i) : e.setAttribute(i, String(l));
561
+ },
562
+ this.getUpdateKey("attr", i)
563
+ );
564
+ break;
565
+ }
566
+ case "autocomplete":
567
+ case "autocapitalize":
568
+ o(
569
+ s,
570
+ (i) => {
571
+ typeof i == "string" ? e.autocomplete = i : i ? e.autocomplete = "on" : e.autocomplete = "off";
572
+ },
573
+ this.getUpdateKey("prop", r)
574
+ );
575
+ break;
576
+ default: {
577
+ o(
578
+ s,
579
+ (i) => {
580
+ e[r] = i;
581
+ },
582
+ this.getUpdateKey("prop", r)
583
+ );
584
+ break;
585
+ }
586
+ }
587
+ }
588
+ }
589
+ applyStyles(e, n, o) {
590
+ const r = [];
591
+ if (n == null)
592
+ e.style.cssText = "";
593
+ else if (typeof n == "string")
594
+ e.style.cssText = n;
595
+ else if (w(n)) {
596
+ let s;
597
+ const i = n.watch((l) => {
598
+ this.elementContext.dolla.render.update(
599
+ () => {
600
+ E(s) && s(), e.style.cssText = "", s = this.applyStyles(e, l, o);
601
+ },
602
+ this.getUpdateKey("styles", "*")
603
+ );
604
+ });
605
+ o.push(i), r.push(i);
606
+ } else if (G(n)) {
607
+ n = n;
608
+ for (const s in n) {
609
+ const i = n[s], l = s.startsWith("--") ? (c, a) => a == null ? e.style.removeProperty(c) : e.style.setProperty(c, a) : (c, a) => e.style[c] = a ?? "";
610
+ if (w(i)) {
611
+ const c = i.watch((a) => {
612
+ this.elementContext.dolla.render.update(
613
+ () => {
614
+ a != null ? l(s, a) : e.style.removeProperty(s);
615
+ },
616
+ this.getUpdateKey("style", s)
617
+ );
618
+ });
619
+ o.push(c), r.push(c);
620
+ } else if (O(i))
621
+ l(s, i);
622
+ else if (z(i))
623
+ l(s, String(i));
624
+ else
625
+ throw new TypeError(`Style properties should be strings, $states or numbers. Got (${s}: ${i})`);
626
+ }
627
+ } else
628
+ throw new TypeError(`Expected style property to be a string, $state, or object. Got: ${n}`);
629
+ return function() {
630
+ for (const i of r)
631
+ i(), o.splice(o.indexOf(i), 1);
632
+ };
633
+ }
634
+ applyClasses(e, n, o) {
635
+ const r = [];
636
+ if (w(n)) {
637
+ let s;
638
+ const i = n.watch((l) => {
639
+ this.elementContext.dolla.render.update(
640
+ () => {
641
+ E(s) && s(), e.removeAttribute("class"), s = this.applyClasses(e, l, o);
642
+ },
643
+ this.getUpdateKey("attr", "class")
644
+ );
645
+ });
646
+ o.push(i), r.push(i);
647
+ } else {
648
+ const s = X(n);
649
+ for (const i in s) {
650
+ const l = s[i];
651
+ if (w(l)) {
652
+ const c = l.watch((a) => {
653
+ this.elementContext.dolla.render.update(() => {
654
+ a ? e.classList.add(i) : e.classList.remove(i);
655
+ });
656
+ });
657
+ o.push(c), r.push(c);
658
+ } else l && e.classList.add(i);
659
+ }
660
+ }
661
+ return function() {
662
+ for (const i of r)
663
+ i(), o.splice(o.indexOf(i), 1);
664
+ };
665
+ }
666
+ }
667
+ function X(t) {
668
+ let e = {};
669
+ if (O(t)) {
670
+ const n = t.split(" ");
671
+ for (const o of n)
672
+ e[o] = !0;
673
+ } else G(t) ? Object.assign(e, t) : Array.isArray(t) && Array.from(t).filter((n) => n != null).forEach((n) => {
674
+ Object.assign(e, X(n));
675
+ });
676
+ return e;
677
+ }
678
+ function be(t, e) {
679
+ const n = typeof t;
680
+ return n === "string" ? String(e) : n === "number" ? Number(e) : n === "boolean" ? !!e : e;
681
+ }
682
+ const ke = ["ref", "children", "class", "style", "data"];
683
+ class $e {
684
+ constructor({ signals: e, renderFn: n, elementContext: o }) {
685
+ d(this, "node");
686
+ d(this, "endNode");
687
+ d(this, "connectedViews", []);
688
+ d(this, "renderFn");
689
+ d(this, "elementContext");
690
+ d(this, "observerControls");
691
+ this.elementContext = o, this.renderFn = n, this.node = document.createComment("Observer"), this.endNode = document.createComment("/Observer");
692
+ let r;
693
+ this.observerControls = {
694
+ start: () => {
695
+ r == null && (r = q(e, (...s) => {
696
+ const i = this.renderFn(...s);
697
+ if (!re(i))
698
+ throw console.error(i), new TypeError(
699
+ `Observer received invalid value to render. Got type: ${R(i)}, value: ${i}`
700
+ );
701
+ Array.isArray(i) ? this.update(...i) : this.update(i);
702
+ }));
703
+ },
704
+ stop: () => {
705
+ r != null && (r(), r = void 0);
706
+ }
707
+ };
708
+ }
709
+ get connected() {
710
+ return this.node.parentNode != null;
711
+ }
712
+ connect(e, n) {
713
+ this.connected || (e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null), this.observerControls.start());
714
+ }
715
+ disconnect() {
716
+ var e;
717
+ this.observerControls.stop(), this.connected && (this.cleanup(), (e = this.node.parentNode) == null || e.removeChild(this.node));
718
+ }
719
+ async setChildren() {
720
+ console.warn("setChildren is not implemented for Dynamic");
721
+ }
722
+ cleanup() {
723
+ var e;
724
+ for (; this.connectedViews.length > 0; )
725
+ (e = this.connectedViews.pop()) == null || e.disconnect();
726
+ }
727
+ update(...e) {
728
+ var o, r;
729
+ if (this.cleanup(), e == null || !this.connected)
730
+ return;
731
+ const n = e.map((s) => ne(s) ? s : P(s) ? T(S(s, this.elementContext)) : T(S(M(s), this.elementContext)));
732
+ for (const s of n) {
733
+ const i = ((o = this.connectedViews.at(-1)) == null ? void 0 : o.node) || this.node;
734
+ s.connect(this.node.parentNode, i), this.connectedViews.push(s);
735
+ }
736
+ if (this.elementContext.dolla.env === "development") {
737
+ const s = (r = this.connectedViews.at(-1)) == null ? void 0 : r.node;
738
+ this.endNode.previousSibling !== s && this.node.parentNode.insertBefore(this.endNode, (s == null ? void 0 : s.nextSibling) ?? null);
739
+ }
740
+ }
741
+ }
742
+ class ve {
743
+ constructor(e) {
744
+ d(this, "node");
745
+ d(this, "endNode");
746
+ d(this, "$children");
747
+ d(this, "stopCallback");
748
+ d(this, "connectedChildren", []);
749
+ d(this, "elementContext");
750
+ this.$children = e.$children, this.elementContext = e.elementContext, this.elementContext.dolla.env === "development" ? (this.node = document.createComment("Outlet"), this.endNode = document.createComment("/Outlet")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
751
+ }
752
+ get connected() {
753
+ var e;
754
+ return ((e = this.node) == null ? void 0 : e.parentNode) != null;
755
+ }
756
+ connect(e, n) {
757
+ this.connected || (e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null), this.stopCallback = this.$children.watch((o) => {
758
+ this.update(o);
759
+ }));
760
+ }
761
+ disconnect() {
762
+ var e;
763
+ if (this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.connected) {
764
+ for (const n of this.connectedChildren)
765
+ n.disconnect();
766
+ this.connectedChildren = [], (e = this.endNode.parentNode) == null || e.removeChild(this.endNode);
767
+ }
768
+ }
769
+ update(e) {
770
+ var n, o, r;
771
+ for (const s of this.connectedChildren)
772
+ s.disconnect();
773
+ for (let s = 0; s < e.length; s++) {
774
+ const i = e[s], l = s > 0 ? e[s] : void 0;
775
+ i.connect(this.node.parentElement, l == null ? void 0 : l.node);
776
+ }
777
+ this.connectedChildren = e, this.elementContext.dolla.env === "development" && (this.node.textContent = `Outlet (${e.length} ${e.length === 1 ? "child" : "children"})`, (r = this.node.parentElement) == null || r.insertBefore(
778
+ this.endNode,
779
+ ((o = (n = this.connectedChildren[this.connectedChildren.length - 1]) == null ? void 0 : n.node) == null ? void 0 : o.nextSibling) ?? null
780
+ ));
781
+ }
782
+ setChildren(e) {
783
+ throw new Error("setChildren is not supported on Outlet");
784
+ }
785
+ }
786
+ class Ne {
787
+ constructor(e) {
788
+ d(this, "config");
789
+ d(this, "handle");
790
+ this.config = e;
791
+ }
792
+ get connected() {
793
+ return this.handle ? this.handle.connected : !1;
794
+ }
795
+ connect(e, n) {
796
+ const { content: o, parent: r } = this.config;
797
+ ne(o) ? this.handle = o : P(o) ? this.handle = T(S(o, this.config.elementContext)) : this.handle = T(S(M(o), this.config.elementContext)), this.handle.connect(r);
798
+ }
799
+ disconnect() {
800
+ var e;
801
+ (e = this.handle) != null && e.connected && this.handle.disconnect();
802
+ }
803
+ setChildren(e) {
804
+ var n;
805
+ (n = this.handle) == null || n.setChildren(e);
806
+ }
807
+ }
808
+ function ee(t, e, n, o = []) {
809
+ t = { ...t };
810
+ const [r, s] = F(S(o, t));
811
+ let i = !1;
812
+ const l = [], c = [], a = [], h = [], g = [], C = Q(), [b, k] = F(e.name), v = t.dolla.createLogger(b, { uid: C }), $ = {
813
+ get uid() {
814
+ return C;
815
+ },
816
+ setName(u) {
817
+ k(u);
818
+ },
819
+ beforeMount(u) {
820
+ h.push(u);
821
+ },
822
+ onMount(u) {
823
+ c.push(u);
824
+ },
825
+ beforeUnmount(u) {
826
+ g.push(u);
827
+ },
828
+ onUnmount(u) {
829
+ a.push(u);
830
+ },
831
+ watch(u, y) {
832
+ if (i) {
833
+ const N = q(u, y);
834
+ return l.push(N), N;
835
+ } else {
836
+ let N, A = !1;
837
+ return c.push(() => {
838
+ A || (N = q(u, y), l.push(N));
839
+ }), function U() {
840
+ U != null && (A = !0, U());
841
+ };
842
+ }
843
+ },
844
+ outlet() {
845
+ return x("$outlet", { $children: r });
846
+ }
847
+ };
848
+ Object.assign($, v);
849
+ let m;
850
+ function p() {
851
+ let u;
852
+ try {
853
+ u = e(n, $);
854
+ } catch (y) {
855
+ throw y instanceof Error && v.crash(y), y;
856
+ }
857
+ if (u instanceof Promise)
858
+ throw new TypeError("View function cannot return a Promise.");
859
+ if (u !== null) if (u instanceof Node)
860
+ m = T(S(x("$node", { value: u }), t));
861
+ else if (P(u) || D(P, u))
862
+ m = T(S(u, t));
863
+ else if (w(u))
864
+ m = T(
865
+ S(x("$observer", { signals: [u], renderFn: (y) => y }), t)
866
+ );
867
+ else {
868
+ const y = new TypeError(
869
+ `Expected '${e.name}' function to return a DOM node, Markup element, Readable or null. Got: ${R(u)}`
870
+ );
871
+ v.crash(y);
872
+ }
873
+ }
874
+ return {
875
+ get node() {
876
+ return m == null ? void 0 : m.node;
877
+ },
878
+ get connected() {
879
+ return i;
880
+ },
881
+ connect(u, y) {
882
+ const N = i;
883
+ if (!N)
884
+ for (p(); h.length > 0; )
885
+ h.shift()();
886
+ m && m.connect(u, y), N || (i = !0, requestAnimationFrame(() => {
887
+ for (; c.length > 0; )
888
+ c.shift()();
889
+ }));
890
+ },
891
+ disconnect() {
892
+ for (; g.length > 0; )
893
+ g.shift()();
894
+ for (m && m.disconnect(), i = !1; a.length > 0; )
895
+ a.shift()();
896
+ for (; l.length > 0; )
897
+ l.shift()();
898
+ },
899
+ async setChildren(u) {
900
+ s(u);
901
+ }
902
+ };
903
+ }
904
+ class Se {
905
+ constructor({ elementContext: e, $items: n, renderFn: o, keyFn: r }) {
906
+ d(this, "node");
907
+ d(this, "endNode");
908
+ d(this, "$items");
909
+ d(this, "stopCallback");
910
+ d(this, "connectedItems", []);
911
+ d(this, "elementContext");
912
+ d(this, "renderFn");
913
+ d(this, "keyFn");
914
+ this.elementContext = e, this.$items = n, this.renderFn = o, this.keyFn = r, this.elementContext.dolla.env === "development" ? (this.node = document.createComment("Repeat"), this.endNode = document.createComment("/Repeat")) : (this.node = document.createTextNode(""), this.endNode = document.createTextNode(""));
915
+ }
916
+ get connected() {
917
+ return this.node.parentNode != null;
918
+ }
919
+ connect(e, n) {
920
+ this.connected || (e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null), this.stopCallback = this.$items.watch((o) => {
921
+ this._update(Array.from(o));
922
+ }));
923
+ }
924
+ disconnect() {
925
+ var e, n;
926
+ this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.connected && ((e = this.node.parentNode) == null || e.removeChild(this.node), (n = this.endNode.parentNode) == null || n.removeChild(this.endNode)), this._cleanup();
927
+ }
928
+ setChildren() {
929
+ console.warn("setChildren is not implemented for repeat()");
930
+ }
931
+ _cleanup() {
932
+ for (const e of this.connectedItems)
933
+ e.handle.disconnect();
934
+ this.connectedItems = [];
935
+ }
936
+ _update(e) {
937
+ var s, i, l;
938
+ if (e.length === 0 || !this.connected)
939
+ return this._cleanup();
940
+ const n = [];
941
+ let o = 0;
942
+ for (const c of e)
943
+ n.push({
944
+ key: this.keyFn(c, o),
945
+ value: c,
946
+ index: o++
947
+ });
948
+ const r = [];
949
+ for (const c of this.connectedItems)
950
+ n.find((h) => h.key === c.key) || c.handle.disconnect();
951
+ for (const c of n) {
952
+ const a = this.connectedItems.find((h) => h.key === c.key);
953
+ if (a)
954
+ a.setValue(c.value), a.setIndex(c.index), r[c.index] = a;
955
+ else {
956
+ const [h, g] = F(c.value), [C, b] = F(c.index);
957
+ r[c.index] = {
958
+ key: c.key,
959
+ $value: h,
960
+ setValue: g,
961
+ $index: C,
962
+ setIndex: b,
963
+ handle: ee(this.elementContext, xe, {
964
+ $value: h,
965
+ $index: C,
966
+ renderFn: this.renderFn
967
+ })
968
+ };
969
+ }
970
+ }
971
+ for (let c = 0; c < r.length; c++) {
972
+ const a = r[c], h = ((s = r[c - 1]) == null ? void 0 : s.handle.node) ?? this.node;
973
+ a.handle.connect(this.node.parentNode, h);
974
+ }
975
+ if (this.connectedItems = r, this.elementContext.dolla.env === "development") {
976
+ this.node.textContent = `Repeat (${r.length} item${r.length === 1 ? "" : "s"})`;
977
+ const c = ((i = r.at(-1)) == null ? void 0 : i.handle.node) ?? this.node;
978
+ (l = this.node.parentNode) == null || l.insertBefore(this.endNode, c.nextSibling);
979
+ }
980
+ }
981
+ }
982
+ function xe({ $value: t, $index: e, renderFn: n }, o) {
983
+ return n(t, e, o);
984
+ }
985
+ class Ee {
986
+ constructor({ value: e }) {
987
+ d(this, "node", document.createTextNode(""));
988
+ d(this, "value", "");
989
+ d(this, "stopCallback");
990
+ this.value = e;
991
+ }
992
+ get connected() {
993
+ return this.node.parentNode != null;
994
+ }
995
+ async connect(e, n = null) {
996
+ this.connected || (w(this.value) ? this.stopCallback = this.value.watch((o) => {
997
+ this.update(o);
998
+ }) : this.update(this.value)), e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null);
999
+ }
1000
+ async disconnect() {
1001
+ this.connected && (this.stopCallback && (this.stopCallback(), this.stopCallback = void 0), this.node.parentNode.removeChild(this.node));
1002
+ }
1003
+ update(e) {
1004
+ e != null ? this.node.textContent = e.toString() : this.node.textContent = "";
1005
+ }
1006
+ async setChildren() {
1007
+ }
1008
+ }
1009
+ const te = Symbol("Markup");
1010
+ function P(t) {
1011
+ return G(t) && t[te] === !0;
1012
+ }
1013
+ function ne(t) {
1014
+ return G(t) && E(t.connect) && E(t.disconnect);
1015
+ }
1016
+ function M(t) {
1017
+ return j(t) || (t = [t]), t.flat(1 / 0).filter((e) => e != null && e !== !1).map((e) => {
1018
+ if (e instanceof Node)
1019
+ return x("$node", { value: e });
1020
+ if (P(e))
1021
+ return e;
1022
+ if (O(e) || z(e))
1023
+ return x("$text", { value: e });
1024
+ if (w(e))
1025
+ return x("$observer", {
1026
+ signals: [e],
1027
+ renderFn: (n) => n
1028
+ });
1029
+ throw console.error(e), new TypeError(`Unexpected child type. Got: ${e}`);
1030
+ });
1031
+ }
1032
+ function x(t, e, ...n) {
1033
+ return e != null && Ae(e), {
1034
+ [te]: !0,
1035
+ type: t,
1036
+ props: e,
1037
+ children: M(n)
1038
+ };
1039
+ }
1040
+ function Ae(t) {
1041
+ if (t.ref && !oe(t.ref))
1042
+ throw console.warn(t.ref), new TypeError(`Prop 'ref' must be a Ref object. Got: ${t.ref}`);
1043
+ for (const e in t)
1044
+ if (e.startsWith("$$") && t[e] !== void 0) {
1045
+ if (!Z(t[e]))
1046
+ throw new TypeError(`Prop '${e}' is named as a SettableSignal but value is not. Got: ${t[e]}`);
1047
+ } else if (e.startsWith("$") && t[e] !== void 0 && !w(t[e]))
1048
+ throw new TypeError(`Prop '${e}' is named as a Signal but value is not. Got: ${t[e]}`);
1049
+ }
1050
+ function qe(t, e, n) {
1051
+ const o = J(t);
1052
+ return x("$cond", {
1053
+ $predicate: o,
1054
+ thenContent: e,
1055
+ elseContent: n
1056
+ });
1057
+ }
1058
+ function Re(t, e, n) {
1059
+ const o = J(t);
1060
+ return x("$repeat", { $items: o, keyFn: e, renderFn: n });
1061
+ }
1062
+ function _e(t, e) {
1063
+ return x("$portal", { content: t, parent: e });
1064
+ }
1065
+ function Be() {
1066
+ const [t, e] = F();
1067
+ return {
1068
+ get: t.get,
1069
+ watch: t.watch,
1070
+ get node() {
1071
+ return t.get();
1072
+ },
1073
+ set node(n) {
1074
+ e(n);
1075
+ }
1076
+ };
1077
+ }
1078
+ function oe(t) {
1079
+ return !(t == null || typeof t != "object" || !t.hasOwnProperty("node"));
1080
+ }
1081
+ class Te {
1082
+ constructor(e) {
1083
+ d(this, "node");
1084
+ this.node = e;
1085
+ }
1086
+ get connected() {
1087
+ return this.node.parentNode != null;
1088
+ }
1089
+ async connect(e, n) {
1090
+ e.insertBefore(this.node, (n == null ? void 0 : n.nextSibling) ?? null);
1091
+ }
1092
+ async disconnect() {
1093
+ this.node.parentNode && this.node.parentNode.removeChild(this.node);
1094
+ }
1095
+ async setChildren(e) {
1096
+ }
1097
+ }
1098
+ function S(t, e) {
1099
+ return (j(t) ? t : [t]).map((o) => {
1100
+ if (E(o.type))
1101
+ return ee(e, o.type, o.props, o.children);
1102
+ if (O(o.type))
1103
+ switch (o.type) {
1104
+ case "$node": {
1105
+ const r = o.props;
1106
+ return new Te(r.value);
1107
+ }
1108
+ case "$text": {
1109
+ const r = o.props;
1110
+ return new Ee({
1111
+ value: r.value
1112
+ });
1113
+ }
1114
+ case "$cond": {
1115
+ const r = o.props;
1116
+ return new me({
1117
+ $predicate: r.$predicate,
1118
+ thenContent: r.thenContent,
1119
+ elseContent: r.elseContent,
1120
+ elementContext: e
1121
+ });
1122
+ }
1123
+ case "$repeat": {
1124
+ const r = o.props;
1125
+ return new Se({
1126
+ $items: r.$items,
1127
+ keyFn: r.keyFn,
1128
+ renderFn: r.renderFn,
1129
+ elementContext: e
1130
+ });
1131
+ }
1132
+ case "$observer": {
1133
+ const r = o.props;
1134
+ return new $e({
1135
+ signals: r.signals,
1136
+ renderFn: r.renderFn,
1137
+ elementContext: e
1138
+ });
1139
+ }
1140
+ case "$outlet": {
1141
+ const r = o.props;
1142
+ return new ve({
1143
+ $children: r.$children,
1144
+ elementContext: e
1145
+ });
1146
+ }
1147
+ case "$portal": {
1148
+ const r = o.props;
1149
+ return new Ne({
1150
+ content: r.content,
1151
+ parent: r.parent,
1152
+ elementContext: e
1153
+ });
1154
+ }
1155
+ default:
1156
+ if (o.type.startsWith("$"))
1157
+ throw new Error(`Unknown markup type: ${o.type}`);
1158
+ return new we({
1159
+ tag: o.type,
1160
+ props: o.props,
1161
+ children: o.children,
1162
+ elementContext: e
1163
+ });
1164
+ }
1165
+ else
1166
+ throw new TypeError(`Expected a string or view function. Got: ${o.type}`);
1167
+ });
1168
+ }
1169
+ function T(t) {
1170
+ if (t.length === 1)
1171
+ return t[0];
1172
+ const e = document.createComment("renderHandle");
1173
+ let n = !1;
1174
+ return {
1175
+ get node() {
1176
+ return e;
1177
+ },
1178
+ get connected() {
1179
+ return n;
1180
+ },
1181
+ connect(o, r) {
1182
+ var s;
1183
+ o.insertBefore(e, r || null);
1184
+ for (const i of t) {
1185
+ const l = ((s = t[t.length - 1]) == null ? void 0 : s.node) ?? e;
1186
+ i.connect(o, l);
1187
+ }
1188
+ n = !0;
1189
+ },
1190
+ disconnect() {
1191
+ if (n) {
1192
+ for (const o of t)
1193
+ o.disconnect();
1194
+ e.remove();
1195
+ }
1196
+ n = !1;
1197
+ },
1198
+ setChildren() {
1199
+ throw new Error("setChildren not supported on renderHandle");
1200
+ }
1201
+ };
1202
+ }
1203
+ function re(t) {
1204
+ return t == null || t === !1 || typeof t == "string" || typeof t == "number" || P(t) || w(t) || D(re, t);
1205
+ }
1206
+ function He(t, e) {
1207
+ return e.outlet();
1208
+ }
1209
+ export {
1210
+ qe as A,
1211
+ Re as B,
1212
+ _e as C,
1213
+ He as F,
1214
+ w as a,
1215
+ L as b,
1216
+ E as c,
1217
+ ge as d,
1218
+ O as e,
1219
+ F as f,
1220
+ Fe as g,
1221
+ Ve as h,
1222
+ G as i,
1223
+ x as j,
1224
+ T as k,
1225
+ Ie as l,
1226
+ Le as m,
1227
+ V as n,
1228
+ Be as o,
1229
+ oe as p,
1230
+ Pe as q,
1231
+ S as r,
1232
+ J as s,
1233
+ Ge as t,
1234
+ ee as u,
1235
+ Ue as v,
1236
+ q as w,
1237
+ je as x,
1238
+ Me as y,
1239
+ pe as z
1240
+ };
1241
+ //# sourceMappingURL=fragment-s33qZBzz.js.map