@manyducks.co/dolla 2.0.0-alpha.30 → 2.0.0-alpha.32

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.
@@ -1,16 +1,16 @@
1
- var jt = Object.defineProperty;
2
- var ot = (r) => {
3
- throw TypeError(r);
1
+ var It = Object.defineProperty;
2
+ var it = (s) => {
3
+ throw TypeError(s);
4
4
  };
5
- var Ut = (r, t, e) => t in r ? jt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
- var o = (r, t, e) => Ut(r, typeof t != "symbol" ? t + "" : t, e), ut = (r, t, e) => t.has(r) || ot("Cannot " + e);
7
- var O = (r, t, e) => (ut(r, t, "read from private field"), e ? e.call(r) : t.get(r)), W = (r, t, e) => t.has(r) ? ot("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), F = (r, t, e, n) => (ut(r, t, "write to private field"), n ? n.call(r, e) : t.set(r, e), e);
8
- function Mt(r) {
9
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
10
- }
11
- var P = { exports: {} }, ct;
12
- function Rt() {
13
- return ct || (ct = 1, function(r, t) {
5
+ var jt = (s, t, e) => t in s ? It(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
6
+ var o = (s, t, e) => jt(s, typeof t != "symbol" ? t + "" : t, e), ot = (s, t, e) => t.has(s) || it("Cannot " + e);
7
+ var O = (s, t, e) => (ot(s, t, "read from private field"), e ? e.call(s) : t.get(s)), P = (s, t, e) => t.has(s) ? it("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), T = (s, t, e, n) => (ot(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e);
8
+ function Mt(s) {
9
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
10
+ }
11
+ var q = { exports: {} }, ut;
12
+ function Ut() {
13
+ return ut || (ut = 1, function(s, t) {
14
14
  Object.defineProperty(t, "__esModule", { value: !0 });
15
15
  var e = /* @__PURE__ */ function() {
16
16
  function h(a, f) {
@@ -37,15 +37,15 @@ function Rt() {
37
37
  return h.reduce(function(a, f) {
38
38
  return 16 > f ? a + "0" + f.toString(16) : a + f.toString(16);
39
39
  }, "#");
40
- }, s = function(h, a, f) {
41
- var l = 0.5 > f ? f * (1 + a) : f + a - f * a, d = 2 * f - l, p = function(w, C, S) {
42
- var z = Math.round, g = 0 > S ? S + 1 : 1 < S ? S - 1 : S;
40
+ }, r = function(h, a, f) {
41
+ var l = 0.5 > f ? f * (1 + a) : f + a - f * a, d = 2 * f - l, p = function(w, C, v) {
42
+ var z = Math.round, g = 0 > v ? v + 1 : 1 < v ? v - 1 : v;
43
43
  return g = g < 1 / 6 ? w + 6 * (C - w) * g : g < 1 / 2 ? C : g < 2 / 3 ? w + 6 * (C - w) * (2 / 3 - g) : w, z(255 * g);
44
44
  }, _ = p(d, l, h + 1 / 3), x = p(d, l, h), y = p(d, l, h - 1 / 3);
45
45
  return [_, x, y];
46
46
  }, i = function(h, a, f, l) {
47
- var d = h % 1007 / 1007, p = function(w, C, S) {
48
- return w * (S - C) + C;
47
+ var d = h % 1007 / 1007, p = function(w, C, v) {
48
+ return w * (v - C) + C;
49
49
  }, _ = p(d, a.min, a.max), x = p(d, f.min, f.max), y = p(d, l.max, l.min);
50
50
  return [_, x, y];
51
51
  }, u = function(h) {
@@ -53,230 +53,229 @@ function Rt() {
53
53
  return a * f.charCodeAt(0) * l + 1;
54
54
  }, 1);
55
55
  }, c = function(h) {
56
- var a = h.str, f = h.hue, l = f === void 0 ? { min: 0, max: 360 } : f, d = h.sat, p = d === void 0 ? { min: 0.35, max: 0.65 } : d, _ = h.light, x = _ === void 0 ? { min: 0.3, max: 0.7 } : _, y = h.hashFunction, w = y === void 0 ? u : y, C = h.scheme, S = C === void 0 ? "hex" : C, z = i(w(a), l, p, x), g = e(z, 3), nt = g[0], rt = g[1], st = g[2], it = s(nt / 360, rt, st), qt = n(it);
57
- return S === "hsl" ? [nt, rt, st] : S === "rgb" ? it : qt;
56
+ var a = h.str, f = h.hue, l = f === void 0 ? { min: 0, max: 360 } : f, d = h.sat, p = d === void 0 ? { min: 0.35, max: 0.65 } : d, _ = h.light, x = _ === void 0 ? { min: 0.3, max: 0.7 } : _, y = h.hashFunction, w = y === void 0 ? u : y, C = h.scheme, v = C === void 0 ? "hex" : C, z = i(w(a), l, p, x), g = e(z, 3), et = g[0], nt = g[1], st = g[2], rt = r(et / 360, nt, st), Ft = n(rt);
57
+ return v === "hsl" ? [et, nt, st] : v === "rgb" ? rt : Ft;
58
58
  };
59
- t.default = c, r.exports = t.default;
60
- }(P, P.exports)), P.exports;
59
+ t.default = c, s.exports = t.default;
60
+ }(q, q.exports)), q.exports;
61
61
  }
62
- var Dt = Rt();
63
- const zt = /* @__PURE__ */ Mt(Dt);
64
- function V(r) {
65
- const t = typeof r;
62
+ var Rt = Ut();
63
+ const Dt = /* @__PURE__ */ Mt(Rt);
64
+ function $(s) {
65
+ const t = typeof s;
66
66
  switch (t) {
67
67
  case "undefined":
68
68
  return t;
69
69
  case "number":
70
- return isNaN(r) ? "NaN" : t;
70
+ return isNaN(s) ? "NaN" : t;
71
71
  case "function":
72
- return /^\s*class\s+/.test(r.toString()) ? "class" : t;
72
+ return /^\s*class\s+/.test(s.toString()) ? "class" : t;
73
73
  case "object":
74
- return r === null ? "null" : r instanceof Promise ? "promise" : r instanceof Map ? "map" : r instanceof Set ? "set" : Array.isArray(r) ? "array" : t;
74
+ return s === null ? "null" : s instanceof Promise ? "promise" : s instanceof Map ? "map" : s instanceof Set ? "set" : Array.isArray(s) ? "array" : t;
75
75
  default:
76
76
  return t;
77
77
  }
78
78
  }
79
- function xe(r, t) {
80
- if (!r)
81
- throw new TypeError(
82
- R(r, t || "Failed assertion. Value is not truthy. Got type: %t, value: %v")
83
- );
79
+ function A(s) {
80
+ return Array.isArray(s);
84
81
  }
85
- function A(r) {
86
- return Array.isArray(r);
82
+ function bt(...s) {
83
+ const t = s[0], e = (n) => A(n) && n.every((r) => t(r));
84
+ return s.length < 2 ? e : e(s[1]);
87
85
  }
88
- function kt(...r) {
89
- const t = r[0], e = (n) => A(n) && n.every((s) => t(s));
90
- return r.length < 2 ? e : e(r[1]);
91
- }
92
- function Me(...r) {
93
- const t = r[0], e = b(r[2]) ? r[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (s) => {
94
- if (A(s) && s.every((i) => t(i)))
86
+ function ye(...s) {
87
+ const t = s[0], e = k(s[2]) ? s[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (r) => {
88
+ if (A(r) && r.every((i) => t(i)))
95
89
  return !0;
96
- throw new TypeError(R(s, e));
90
+ throw new TypeError(R(r, e));
97
91
  };
98
- return r.length < 2 ? n : n(r[1]);
92
+ return s.length < 2 ? n : n(s[1]);
99
93
  }
100
- function b(r) {
101
- return typeof r == "string";
94
+ function k(s) {
95
+ return typeof s == "string";
102
96
  }
103
- function ke(r, t) {
104
- if (b(r))
97
+ function ve(s, t) {
98
+ if (k(s))
105
99
  return !0;
106
- throw new TypeError(R(r, t ?? "Expected a string. Got type: %t, value: %v"));
100
+ throw new TypeError(R(s, t ?? "Expected a string. Got type: %t, value: %v"));
107
101
  }
108
- function I(r) {
109
- return typeof r == "function" && !Kt(r);
102
+ function V(s) {
103
+ return typeof s == "function" && !Gt(s);
110
104
  }
111
- function Gt(r) {
112
- return typeof r == "number" && !isNaN(r);
105
+ function zt(s) {
106
+ return typeof s == "number" && !isNaN(s);
113
107
  }
114
- function Kt(r) {
115
- return typeof r == "function" && /^\s*class\s+/.test(r.toString());
108
+ function Gt(s) {
109
+ return typeof s == "function" && /^\s*class\s+/.test(s.toString());
116
110
  }
117
- function be(...r) {
118
- const t = r[0], e = b(r[2]) ? r[2] : `Expected instance of ${t.name}. Got type: %t, value: %v`, n = (s) => {
119
- if (s instanceof t)
111
+ function Se(...s) {
112
+ const t = s[0], e = k(s[2]) ? s[2] : `Expected instance of ${t.name}. Got type: %t, value: %v`, n = (r) => {
113
+ if (r instanceof t)
120
114
  return !0;
121
- throw new TypeError(R(s, e));
115
+ throw new TypeError(R(r, e));
122
116
  };
123
- return r.length < 2 ? n : n(r[1]);
117
+ return s.length < 2 ? n : n(s[1]);
118
+ }
119
+ function Z(s) {
120
+ return s != null && typeof s == "object" && !A(s);
124
121
  }
125
- function bt(r) {
126
- return r != null && typeof r == "object" && !A(r);
122
+ function Ce(s, t) {
123
+ if (Z(s))
124
+ return !0;
125
+ throw new TypeError(R(s, t));
127
126
  }
128
- function R(r, t) {
129
- var s;
130
- const e = V(r), n = ((s = r == null ? void 0 : r.toString) == null ? void 0 : s.call(r)) || String(r);
127
+ function R(s, t) {
128
+ var r;
129
+ const e = $(s), n = ((r = s == null ? void 0 : s.toString) == null ? void 0 : r.call(s)) || String(s);
131
130
  return t.replaceAll("%t", e).replaceAll("%v", n);
132
131
  }
133
- var G, at;
134
- function Bt() {
135
- return at || (at = 1, G = function r(t, e) {
132
+ var G, ct;
133
+ function Kt() {
134
+ return ct || (ct = 1, G = function s(t, e) {
136
135
  if (t === e) return !0;
137
136
  if (t && e && typeof t == "object" && typeof e == "object") {
138
137
  if (t.constructor !== e.constructor) return !1;
139
- var n, s, i;
138
+ var n, r, i;
140
139
  if (Array.isArray(t)) {
141
140
  if (n = t.length, n != e.length) return !1;
142
- for (s = n; s-- !== 0; )
143
- if (!r(t[s], e[s])) return !1;
141
+ for (r = n; r-- !== 0; )
142
+ if (!s(t[r], e[r])) return !1;
144
143
  return !0;
145
144
  }
146
145
  if (t instanceof Map && e instanceof Map) {
147
146
  if (t.size !== e.size) return !1;
148
- for (s of t.entries())
149
- if (!e.has(s[0])) return !1;
150
- for (s of t.entries())
151
- if (!r(s[1], e.get(s[0]))) return !1;
147
+ for (r of t.entries())
148
+ if (!e.has(r[0])) return !1;
149
+ for (r of t.entries())
150
+ if (!s(r[1], e.get(r[0]))) return !1;
152
151
  return !0;
153
152
  }
154
153
  if (t instanceof Set && e instanceof Set) {
155
154
  if (t.size !== e.size) return !1;
156
- for (s of t.entries())
157
- if (!e.has(s[0])) return !1;
155
+ for (r of t.entries())
156
+ if (!e.has(r[0])) return !1;
158
157
  return !0;
159
158
  }
160
159
  if (ArrayBuffer.isView(t) && ArrayBuffer.isView(e)) {
161
160
  if (n = t.length, n != e.length) return !1;
162
- for (s = n; s-- !== 0; )
163
- if (t[s] !== e[s]) return !1;
161
+ for (r = n; r-- !== 0; )
162
+ if (t[r] !== e[r]) return !1;
164
163
  return !0;
165
164
  }
166
165
  if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
167
166
  if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
168
167
  if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
169
168
  if (i = Object.keys(t), n = i.length, n !== Object.keys(e).length) return !1;
170
- for (s = n; s-- !== 0; )
171
- if (!Object.prototype.hasOwnProperty.call(e, i[s])) return !1;
172
- for (s = n; s-- !== 0; ) {
173
- var u = i[s];
174
- if (!r(t[u], e[u])) return !1;
169
+ for (r = n; r-- !== 0; )
170
+ if (!Object.prototype.hasOwnProperty.call(e, i[r])) return !1;
171
+ for (r = n; r-- !== 0; ) {
172
+ var u = i[r];
173
+ if (!s(t[u], e[u])) return !1;
175
174
  }
176
175
  return !0;
177
176
  }
178
177
  return t !== t && e !== e;
179
178
  }), G;
180
179
  }
181
- var Ht = Bt();
182
- const Yt = /* @__PURE__ */ Mt(Ht), Zt = () => {
180
+ var Bt = Kt();
181
+ const Ht = /* @__PURE__ */ Mt(Bt), Zt = () => {
183
182
  };
184
183
  let K = 1;
185
- function Z() {
184
+ function kt() {
186
185
  return K = K % Number.MAX_SAFE_INTEGER + 1, K.toString(36) + Date.now().toString(36);
187
186
  }
188
- function Et(r, t) {
189
- return Object.is(r, t);
187
+ function Et(s, t) {
188
+ return Object.is(s, t);
190
189
  }
191
- function Ee(r, t) {
192
- if (Object.is(r, t)) return !0;
193
- const e = V(r);
194
- if (e !== V(t))
190
+ function xe(s, t) {
191
+ if (Object.is(s, t)) return !0;
192
+ const e = $(s);
193
+ if (e !== $(t))
195
194
  return !1;
196
195
  switch (e) {
197
196
  case "object":
198
197
  let n = 0;
199
- for (const s in r) {
200
- if (r[s] !== t[s]) return !1;
198
+ for (const r in s) {
199
+ if (s[r] !== t[r]) return !1;
201
200
  n++;
202
201
  }
203
202
  return Object.keys(t).length === n;
204
203
  case "array":
205
- if (r.length !== t.length) return !1;
206
- for (let s = 0; s < r.length; s++)
207
- if (r[s] !== t[s]) return !1;
204
+ if (s.length !== t.length) return !1;
205
+ for (let r = 0; r < s.length; r++)
206
+ if (s[r] !== t[r]) return !1;
208
207
  return !0;
209
208
  case "map":
210
- if (r.size !== t.size) return !1;
211
- for (const s of r.keys())
212
- if (r[s] !== t[s]) return !1;
209
+ if (s.size !== t.size) return !1;
210
+ for (const r of s.keys())
211
+ if (s[r] !== t[r]) return !1;
213
212
  return !0;
214
213
  case "set":
215
- if (I(r.symmetricDifference))
216
- return r.symmetricDifference(t).size === 0;
217
- for (const s of r.keys())
218
- if (r[s] !== t.get(s)) return !1;
214
+ if (V(s.symmetricDifference))
215
+ return s.symmetricDifference(t).size === 0;
216
+ for (const r of s.keys())
217
+ if (s[r] !== t.get(r)) return !1;
219
218
  return !0;
220
219
  }
221
220
  return !1;
222
221
  }
223
- const Ae = Yt;
224
- function Jt(r, t) {
222
+ const Me = Ht;
223
+ function Yt(s, t) {
225
224
  const e = (n) => {
226
- const s = {};
225
+ const r = {};
227
226
  for (const i in n)
228
- r.includes(i) || (s[i] = n[i]);
229
- return s;
227
+ s.includes(i) || (r[i] = n[i]);
228
+ return r;
230
229
  };
231
230
  return t == null ? e : e(t);
232
231
  }
233
- function Oe(r) {
234
- return zt({
235
- str: r,
232
+ function be(s) {
233
+ return Dt({
234
+ str: s,
236
235
  sat: { min: 0.35, max: 0.55 },
237
236
  light: { min: 0.6, max: 0.6 }
238
237
  });
239
238
  }
240
- function Ve(r) {
241
- if (r instanceof RegExp)
242
- return (n) => r.test(n);
239
+ function ke(s) {
240
+ if (s instanceof RegExp)
241
+ return (n) => s.test(n);
243
242
  const t = {
244
243
  positive: [],
245
244
  negative: []
246
- }, e = r.split(",").map((n) => n.trim()).filter((n) => n !== "");
245
+ }, e = s.split(",").map((n) => n.trim()).filter((n) => n !== "");
247
246
  for (let n of e) {
248
- let s = "positive";
249
- n.startsWith("-") && (s = "negative", n = n.slice(1)), n === "*" ? t[s].push(function() {
247
+ let r = "positive";
248
+ n.startsWith("-") && (r = "negative", n = n.slice(1)), n === "*" ? t[r].push(function() {
250
249
  return !0;
251
- }) : n.endsWith("*") ? t[s].push(function(i) {
250
+ }) : n.endsWith("*") ? t[r].push(function(i) {
252
251
  return i.startsWith(n.slice(0, n.length - 1));
253
- }) : t[s].push(function(i) {
252
+ }) : t[r].push(function(i) {
254
253
  return i === n;
255
254
  });
256
255
  }
257
256
  return function(n) {
258
- const { positive: s, negative: i } = t;
259
- return !(i.some((u) => u(n)) || s.length > 0 && !s.some((u) => u(n)));
257
+ const { positive: r, negative: i } = t;
258
+ return !(i.some((u) => u(n)) || r.length > 0 && !r.some((u) => u(n)));
260
259
  };
261
260
  }
262
- var Xt = Object.defineProperty, Qt = (r, t, e) => t in r ? Xt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, ht = (r, t, e) => Qt(r, typeof t != "symbol" ? t + "" : t, e);
263
- class q {
261
+ var Xt = Object.defineProperty, Jt = (s, t, e) => t in s ? Xt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, at = (s, t, e) => Jt(s, typeof t != "symbol" ? t + "" : t, e);
262
+ class I {
264
263
  constructor() {
265
- ht(this, "_l", /* @__PURE__ */ new Map()), ht(this, "_a", (t) => {
264
+ at(this, "_l", /* @__PURE__ */ new Map()), at(this, "_a", (t) => {
266
265
  if (typeof t != "string" && !(t instanceof Symbol))
267
266
  throw new TypeError("Emitter: eventName should be a string or symbol");
268
267
  });
269
268
  }
270
269
  emit(t, ...e) {
271
270
  let n = this.listeners(t);
272
- for (const s of n)
271
+ for (const r of n)
273
272
  try {
274
- s(...e);
273
+ r(...e);
275
274
  } catch (i) {
276
275
  let u = this._l.get("error");
277
276
  if (u != null && u.length)
278
277
  for (const c of u)
279
- c(i, t, s, ...e);
278
+ c(i, t, r, ...e);
280
279
  else throw i;
281
280
  }
282
281
  return t != "*" && this.emit("*", t, ...e) || n.length > 0;
@@ -303,67 +302,67 @@ class q {
303
302
  return [...this._l.entries()].filter(([, t]) => t.length).map(([t]) => t);
304
303
  }
305
304
  }
306
- var $, E;
307
- class $e {
305
+ var L, E;
306
+ class Ee {
308
307
  constructor(t) {
309
308
  // #dolla;
310
- W(this, $);
311
- W(this, E);
312
- F(this, $, t.createLogger("Dolla.stats")), F(this, E, N());
309
+ P(this, L);
310
+ P(this, E);
311
+ T(this, L, t.createLogger("Dolla.stats")), T(this, E, W());
313
312
  let e;
314
313
  O(this, E).emitter.on("statsChanged", () => {
315
314
  e && clearTimeout(e), e = setTimeout(() => {
316
- O(this, $).info(O(this, E).stats);
315
+ O(this, L).info(O(this, E).stats);
317
316
  }, 200);
318
317
  });
319
318
  }
320
319
  }
321
- $ = new WeakMap(), E = new WeakMap();
320
+ L = new WeakMap(), E = new WeakMap();
322
321
  const B = Symbol.for("DollaStatsStore");
323
- function lt() {
324
- const r = new q(), t = {
322
+ function ht() {
323
+ const s = new I(), t = {
325
324
  watcherCount: 0,
326
325
  viewCount: 0
327
326
  };
328
- return r.on("_incrementViewCount", (e) => {
329
- t.viewCount += e, r.emit("statsChanged");
330
- }), r.on("_incrementWatcherCount", (e) => {
331
- t.watcherCount += e, r.emit("statsChanged");
332
- }), { emitter: r, stats: t };
327
+ return s.on("_incrementViewCount", (e) => {
328
+ t.viewCount += e, s.emit("statsChanged");
329
+ }), s.on("_incrementWatcherCount", (e) => {
330
+ t.watcherCount += e, s.emit("statsChanged");
331
+ }), { emitter: s, stats: t };
333
332
  }
334
- function N() {
335
- return typeof window < "u" ? (window[B] || (window[B] = lt()), window[B]) : lt();
333
+ function W() {
334
+ return typeof window < "u" ? (window[B] || (window[B] = ht()), window[B]) : ht();
336
335
  }
337
336
  function At() {
338
- N().emitter.emit("_incrementWatcherCount", 1);
337
+ W().emitter.emit("_incrementWatcherCount", 1);
339
338
  }
340
339
  function Ot() {
341
- N().emitter.emit("_incrementWatcherCount", -1);
340
+ W().emitter.emit("_incrementWatcherCount", -1);
342
341
  }
343
- function te() {
344
- N().emitter.emit("_incrementViewCount", 1);
342
+ function Qt() {
343
+ W().emitter.emit("_incrementViewCount", 1);
345
344
  }
346
- function ee() {
347
- N().emitter.emit("_incrementViewCount", -1);
345
+ function te() {
346
+ W().emitter.emit("_incrementViewCount", -1);
348
347
  }
349
- const Vt = Symbol.for("DollaState"), $t = Symbol.for("DollaRef"), Lt = Symbol.for("DollaMarkup"), M = Symbol.for("DollaMarkupElement"), ne = Symbol.for("DollaStore"), Nt = Symbol.for("DollaStoreFactory");
350
- function m(r) {
351
- return (r == null ? void 0 : r[Vt]) === !0;
348
+ const $t = Symbol.for("DollaState"), Vt = Symbol.for("DollaRef"), Lt = Symbol.for("DollaMarkup"), M = Symbol.for("DollaMarkupElement"), Ae = Symbol.for("DollaRouter");
349
+ function m(s) {
350
+ return (s == null ? void 0 : s[$t]) === !0;
352
351
  }
353
- function re(r) {
354
- return m(r) ? r.get() : r;
352
+ function ee(s) {
353
+ return m(s) ? s.get() : s;
355
354
  }
356
- function J(r) {
357
- return m(r) ? r : new X({
355
+ function Y(s) {
356
+ return m(s) ? s : new X({
358
357
  get() {
359
- return r;
358
+ return s;
360
359
  },
361
360
  watch(t, e = {}) {
362
- return e != null && e.lazy || t(r), Zt;
361
+ return e != null && e.lazy || t(s), Zt;
363
362
  }
364
363
  });
365
364
  }
366
- class se {
365
+ class ne {
367
366
  constructor(t, e) {
368
367
  o(this, "value");
369
368
  o(this, "watchers", []);
@@ -392,7 +391,7 @@ class se {
392
391
  }
393
392
  }
394
393
  var mt;
395
- mt = Vt;
394
+ mt = $t;
396
395
  class X {
397
396
  constructor(t) {
398
397
  o(this, mt, !0);
@@ -406,12 +405,12 @@ class X {
406
405
  return this.__value.watch(t, e);
407
406
  }
408
407
  }
409
- function Y(r, t) {
410
- const e = new se(r, t);
411
- return [new X(e), (s) => e.set(s)];
408
+ function H(s, t) {
409
+ const e = new ne(s, t);
410
+ return [new X(e), (r) => e.set(r)];
412
411
  }
413
- const ft = Symbol("EMPTY");
414
- class ie {
412
+ const lt = Symbol("EMPTY");
413
+ class se {
415
414
  constructor(t, e, n) {
416
415
  o(this, "equals", Et);
417
416
  /**
@@ -441,7 +440,7 @@ class ie {
441
440
  /**
442
441
  * The current value as returned from `fn` (may be a State)
443
442
  */
444
- o(this, "value", ft);
443
+ o(this, "value", lt);
445
444
  /**
446
445
  * The current unwrapped value.
447
446
  */
@@ -450,7 +449,7 @@ class ie {
450
449
  * When value is a State, this function will stop watching its value.
451
450
  */
452
451
  o(this, "stopWatchingCurrentValue");
453
- this.sources = t.map(J), this.fn = e, n != null && n.equals && (this.equals = n.equals), this.previousSourceValues = new Array(t.length).fill(ft, 0, t.length);
452
+ this.sources = t.map(Y), this.fn = e, n != null && n.equals && (this.equals = n.equals), this.previousSourceValues = new Array(t.length).fill(lt, 0, t.length);
454
453
  }
455
454
  /*==========================*\
456
455
  || "Public" methods ||
@@ -474,24 +473,24 @@ class ie {
474
473
  }
475
474
  update() {
476
475
  const t = this.sources, e = this.previousSourceValues;
477
- let n = !1, s;
476
+ let n = !1, r;
478
477
  for (let i = 0; i < t.length; i++)
479
- s = t[i].get(), !n && !this.equals(s, e[i]) && (n = !0), e[i] = s;
478
+ r = t[i].get(), !n && !this.equals(r, e[i]) && (n = !0), e[i] = r;
480
479
  n && this.setValue(this.fn(...e));
481
480
  }
482
481
  getValue() {
483
482
  return this.isWatchingSources || this.update(), this.rawValue;
484
483
  }
485
484
  setValue(t) {
486
- this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.value = t, this.rawValue = re(t), this.isWatchingSources && m(t) ? this.stopWatchingCurrentValue = t.watch((e) => {
485
+ this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.value = t, this.rawValue = ee(t), this.isWatchingSources && m(t) ? this.stopWatchingCurrentValue = t.watch((e) => {
487
486
  this.rawValue = e, this.notify(e);
488
487
  }) : this.notify(this.rawValue);
489
488
  }
490
489
  startWatchingSources() {
491
490
  const t = this.previousSourceValues;
492
491
  for (let n = 0; n < this.sources.length; n++)
493
- this.sourceWatcher.watch([this.sources[n]], (s) => {
494
- if (t[n] = s, this.isWatchingSources) {
492
+ this.sourceWatcher.watch([this.sources[n]], (r) => {
493
+ if (t[n] = r, this.isWatchingSources) {
495
494
  const i = this.fn(...t);
496
495
  this.equals(i, this.value) || this.setValue(i);
497
496
  }
@@ -504,221 +503,58 @@ class ie {
504
503
  this.sourceWatcher.stopAll(), this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.isWatchingSources = !1;
505
504
  }
506
505
  }
507
- function oe(r, t, e) {
508
- const n = new ie(r, t, e);
506
+ function re(s, t, e) {
507
+ const n = new se(s, t, e);
509
508
  return new X(n);
510
509
  }
511
510
  function D() {
512
- const r = [];
511
+ const s = [];
513
512
  return {
514
513
  watch(t, e) {
515
514
  if (t.length === 0)
516
515
  throw new TypeError("Expected at least one state to watch.");
517
- t = t.map(J);
516
+ t = t.map(Y);
518
517
  let n;
519
- return t.length > 1 ? n = oe(t, e).watch(() => null) : n = t[0].watch(e), r.push(n), () => {
520
- let s = r.indexOf(n);
521
- s > -1 && r.splice(s, 1), n();
518
+ return t.length > 1 ? n = re(t, e).watch(() => null) : n = t[0].watch(e), s.push(n), () => {
519
+ let r = s.indexOf(n);
520
+ r > -1 && s.splice(r, 1), n();
522
521
  };
523
522
  },
524
523
  stopAll() {
525
- for (; r.length > 0; )
526
- r.pop()();
524
+ for (; s.length > 0; )
525
+ s.pop()();
527
526
  }
528
527
  };
529
528
  }
530
- function Le(r) {
529
+ function Oe(s) {
531
530
  function t() {
532
531
  if (arguments.length === 1)
533
- r = arguments[0];
532
+ s = arguments[0];
534
533
  else if (arguments.length > 1)
535
534
  throw new Error(`Too many arguments. Expected 0 or 1. Got: ${arguments.length}`);
536
- return r;
537
- }
538
- return t[$t] = !0, t;
539
- }
540
- function ue(r) {
541
- return (r == null ? void 0 : r[$t]) === !0;
542
- }
543
- var L;
544
- class Q {
545
- constructor(t, e) {
546
- o(this, "type");
547
- o(this, "detail");
548
- W(this, L, !1);
549
- this.type = t, this.detail = e;
550
- }
551
- get propagationStopped() {
552
- return O(this, L);
553
- }
554
- stopPropagation() {
555
- F(this, L, !0);
556
- }
557
- get [Symbol.toStringTag]() {
558
- return "ContextEvent";
559
- }
560
- // stopImmediatePropagation() {}
561
- }
562
- L = new WeakMap();
563
- let ce = class {
564
- constructor(t) {
565
- o(this, "__store");
566
- this.__store = t;
567
- const e = Object.getOwnPropertyDescriptors(this.__store._logger);
568
- for (const n in e)
569
- n !== "setName" && Object.defineProperty(this, n, e[n]);
570
- }
571
- get isMounted() {
572
- return this.__store.isMounted;
573
- }
574
- setName(t) {
575
- return this.__store._logger.setName(t), this;
576
- }
577
- set(t, e) {
578
- return this.__store._elementContext.data[t] = e, e;
579
- }
580
- get(t) {
581
- let e = this.__store._elementContext;
582
- for (; ; ) {
583
- if (t in e.data)
584
- return e.data[t];
585
- if (e.parent)
586
- e = e.parent;
587
- else
588
- break;
589
- }
590
- return null;
591
- }
592
- // on<T = unknown>(eventName: string, listener: (...args: any) => void): void {
593
- // this.__store._elementContext.emitter.on(eventName, listener);
594
- // }
595
- // off<T = unknown>(eventName: string, listener: (...args: any) => void): void {
596
- // this.__store._elementContext.emitter.off(eventName, listener);
597
- // }
598
- // once<T = unknown>(eventName: string, listener: (...args: any) => void): void {
599
- // this.__store._elementContext.emitter.once(eventName, listener);
600
- // }
601
- on(t, e) {
602
- if (t === "*") {
603
- const n = (s, i) => {
604
- e(i);
605
- };
606
- this.__store._elementContext.emitter.on(t, n), this.__store._wildcardListeners.set(e, n);
607
- } else
608
- this.__store._elementContext.emitter.on(t, e);
609
- }
610
- off(t, e) {
611
- if (t === "*") {
612
- const n = this.__store._wildcardListeners.get(e);
613
- n && (this.__store._elementContext.emitter.off(t, n), this.__store._wildcardListeners.delete(e));
614
- } else
615
- this.__store._elementContext.emitter.off(t, e);
616
- }
617
- once(t, e) {
618
- if (t === "*") {
619
- const n = (s, i) => {
620
- this.__store._wildcardListeners.delete(e), e(i);
621
- };
622
- this.__store._elementContext.emitter.once(t, n), this.__store._wildcardListeners.set(e, n);
623
- } else
624
- this.__store._elementContext.emitter.once(t, e);
625
- }
626
- emit(t, e) {
627
- return this.__store._elementContext.emitter.emit(t, new Q(t, e));
628
- }
629
- onMount(t) {
630
- this.__store._emitter.on("mounted", t);
631
- }
632
- onUnmount(t) {
633
- this.__store._emitter.on("unmounted", t);
634
- }
635
- watch(t, e) {
636
- const n = this.__store;
637
- if (n.isMounted)
638
- return n._watcher.watch(t, e);
639
- {
640
- let s, i = !1;
641
- return n._emitter.on("mounted", () => {
642
- i || (s = n._watcher.watch(t, e));
643
- }), () => {
644
- s != null && (i = !0, s());
645
- };
646
- }
647
- }
648
- };
649
- class ae {
650
- constructor(t, e, n) {
651
- o(this, "key");
652
- o(this, "_fn");
653
- o(this, "_options");
654
- /**
655
- * Value is guaranteed to be set after `attach` is called.
656
- */
657
- o(this, "value");
658
- o(this, "isMounted", !1);
659
- o(this, "_elementContext");
660
- o(this, "_emitter", new q());
661
- o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
662
- o(this, "_logger");
663
- o(this, "_watcher", D());
664
- this.key = t, this._fn = e, this._options = n;
665
- }
666
- get name() {
667
- return this._fn.name;
668
- }
669
- /**
670
- * Attaches this Store to the elementContext.
671
- * Returns false if there was already an instance attached, and true otherwise.
672
- */
673
- attach(t) {
674
- if (t.stores.has(this.key))
675
- return !1;
676
- this._elementContext = t, this._logger = t.root.createLogger(this._fn.name), this._emitter.on("error", (n, s, ...i) => {
677
- console.log({ error: n, eventName: s, args: i }), this._logger.crash(n);
678
- });
679
- const e = new ce(this);
680
- try {
681
- this.value = this._fn.call(e, this._options, e);
682
- } catch (n) {
683
- this._logger.crash(n);
684
- }
685
- return t.stores.set(this.key, this), !0;
686
- }
687
- handleMount() {
688
- this.isMounted = !0, this._emitter.emit("mounted");
689
- }
690
- handleUnmount() {
691
- this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
535
+ return s;
692
536
  }
537
+ return t[Vt] = !0, t;
693
538
  }
694
- function he(r) {
695
- return (r == null ? void 0 : r[Nt]) === !0;
696
- }
697
- function le(r) {
698
- return (r == null ? void 0 : r[ne]) === !0;
699
- }
700
- function We(r) {
701
- const t = Z();
702
- function e(n) {
703
- return new ae(t, r, n);
704
- }
705
- return e[Nt] = !0, e.key = t, e;
539
+ function ie(s) {
540
+ return (s == null ? void 0 : s[Vt]) === !0;
706
541
  }
707
- class H extends Error {
542
+ function $e(s, t) {
543
+ return t.outlet();
708
544
  }
709
- function fe(r) {
710
- for (var t, e, n = arguments, s = 1, i = "", u = "", c = [0], h = function(l) {
711
- s === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? c.push(l ? n[l] : i) : s === 3 && (l || i) ? (c[1] = l ? n[l] : i, s = 2) : s === 2 && i === "..." && l ? c[2] = Object.assign(c[2] || {}, n[l]) : s === 2 && i && !l ? (c[2] = c[2] || {})[i] = !0 : s >= 5 && (s === 5 ? ((c[2] = c[2] || {})[e] = l ? i ? i + n[l] : n[l] : i, s = 6) : (l || i) && (c[2][e] += l ? i + n[l] : i)), i = "";
712
- }, a = 0; a < r.length; a++) {
713
- a && (s === 1 && h(), h(a));
714
- for (var f = 0; f < r[a].length; f++) t = r[a][f], s === 1 ? t === "<" ? (h(), c = [c, "", null], s = 3) : i += t : s === 4 ? i === "--" && t === ">" ? (s = 1, i = "") : i = t + i[0] : u ? t === u ? u = "" : i += t : t === '"' || t === "'" ? u = t : t === ">" ? (h(), s = 1) : s && (t === "=" ? (s = 5, e = i, i = "") : t === "/" && (s < 5 || r[a][f + 1] === ">") ? (h(), s === 3 && (c = c[0]), s = c, (c = c[0]).push(this.apply(null, s.slice(1))), s = 0) : t === " " || t === " " || t === `
715
- ` || t === "\r" ? (h(), s = 2) : i += t), s === 3 && i === "!--" && (s = 4, c = c[0]);
545
+ function oe(s) {
546
+ for (var t, e, n = arguments, r = 1, i = "", u = "", c = [0], h = function(l) {
547
+ r === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? c.push(l ? n[l] : i) : r === 3 && (l || i) ? (c[1] = l ? n[l] : i, r = 2) : r === 2 && i === "..." && l ? c[2] = Object.assign(c[2] || {}, n[l]) : r === 2 && i && !l ? (c[2] = c[2] || {})[i] = !0 : r >= 5 && (r === 5 ? ((c[2] = c[2] || {})[e] = l ? i ? i + n[l] : n[l] : i, r = 6) : (l || i) && (c[2][e] += l ? i + n[l] : i)), i = "";
548
+ }, a = 0; a < s.length; a++) {
549
+ a && (r === 1 && h(), h(a));
550
+ for (var f = 0; f < s[a].length; f++) t = s[a][f], r === 1 ? t === "<" ? (h(), c = [c, "", null], r = 3) : i += t : r === 4 ? i === "--" && t === ">" ? (r = 1, i = "") : i = t + i[0] : u ? t === u ? u = "" : i += t : t === '"' || t === "'" ? u = t : t === ">" ? (h(), r = 1) : r && (t === "=" ? (r = 5, e = i, i = "") : t === "/" && (r < 5 || s[a][f + 1] === ">") ? (h(), r === 3 && (c = c[0]), r = c, (c = c[0]).push(this.apply(null, r.slice(1))), r = 0) : t === " " || t === " " || t === `
551
+ ` || t === "\r" ? (h(), r = 2) : i += t), r === 3 && i === "!--" && (r = 4, c = c[0]);
716
552
  }
717
553
  return h(), c.length > 2 ? c.slice(1) : c[1];
718
554
  }
719
555
  var _t;
720
556
  _t = M;
721
- class dt {
557
+ class ft {
722
558
  constructor(t) {
723
559
  o(this, _t, !0);
724
560
  o(this, "node");
@@ -734,11 +570,11 @@ class dt {
734
570
  this.node.parentNode && !t && this.node.parentNode.removeChild(this.node);
735
571
  }
736
572
  }
737
- const de = (r) => /^on[A-Z]/.test(r);
573
+ const ue = (s) => /^on[A-Z]/.test(s);
738
574
  var wt;
739
575
  wt = M;
740
- class pe {
741
- constructor({ tag: t, props: e, children: n, elementContext: s }) {
576
+ class ce {
577
+ constructor({ tag: t, props: e, children: n, elementContext: r }) {
742
578
  o(this, wt, !0);
743
579
  o(this, "node");
744
580
  o(this, "props");
@@ -746,21 +582,21 @@ class pe {
746
582
  o(this, "children", []);
747
583
  o(this, "stopCallbacks", []);
748
584
  o(this, "elementContext");
749
- o(this, "uniqueId", Z());
585
+ o(this, "uniqueId", kt());
750
586
  o(this, "_batchWrite");
751
587
  // Track the ref so we can nullify it on unmount.
752
588
  o(this, "ref");
753
589
  // Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
754
590
  o(this, "canClickAway", !1);
755
- if (s = { ...s }, this._batchWrite = s.root.batch.write.bind(s.root.batch), t.toLowerCase() === "svg" && (s.isSVG = !0), s.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", t) : this.node = document.createElement(t), e.ref)
756
- if (ue(e.ref))
591
+ if (r = { ...r }, this._batchWrite = r.root.batch.write.bind(r.root.batch), t.toLowerCase() === "svg" && (r.isSVG = !0), r.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", t) : this.node = document.createElement(t), e.ref)
592
+ if (ie(e.ref))
757
593
  this.ref = e.ref, this.ref(this.node);
758
594
  else
759
595
  throw new Error("Expected ref to be a function. Got: " + e.ref);
760
596
  this.props = {
761
- ...Jt(["ref", "class", "className"], e),
597
+ ...Yt(["ref", "class", "className"], e),
762
598
  class: e.className ?? e.class
763
- }, n && (this.childMarkup = n), this.elementContext = s, this.children = k(this.elementContext, this.childMarkup);
599
+ }, n && (this.childMarkup = n), this.elementContext = r, this.children = b(this.elementContext, this.childMarkup);
764
600
  }
765
601
  get isMounted() {
766
602
  return this.node.parentNode != null;
@@ -770,8 +606,8 @@ class pe {
770
606
  throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${t}`);
771
607
  if (!this.isMounted) {
772
608
  for (let n = 0; n < this.children.length; n++) {
773
- const s = this.children[n], i = n > 0 ? this.children[n - 1].node : void 0;
774
- s.mount(this.node, i);
609
+ const r = this.children[n], i = n > 0 ? this.children[n - 1].node : void 0;
610
+ r.mount(this.node, i);
775
611
  }
776
612
  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);
777
613
  }
@@ -798,16 +634,16 @@ class pe {
798
634
  }
799
635
  attachProp(t, e, n) {
800
636
  m(t) ? this.stopCallbacks.push(
801
- t.watch((s) => {
802
- this._mutate(() => e(s), n);
637
+ t.watch((r) => {
638
+ this._mutate(() => e(r), n);
803
639
  })
804
640
  ) : this._mutate(() => e(t), n);
805
641
  }
806
642
  applyProps(t, e) {
807
643
  for (const n in e) {
808
- const s = e[n];
644
+ const r = e[n];
809
645
  if (n === "attributes") {
810
- const i = s;
646
+ const i = r;
811
647
  for (const u in i)
812
648
  this.attachProp(
813
649
  i[u],
@@ -817,37 +653,37 @@ class pe {
817
653
  this.getUpdateKey("attr", u)
818
654
  );
819
655
  } else if (n === "eventListeners") {
820
- const i = s;
656
+ const i = r;
821
657
  for (const u in i) {
822
- const c = m(s) ? (h) => s.get()(h) : s;
658
+ const c = m(r) ? (h) => r.get()(h) : r;
823
659
  t.addEventListener(u, c), this.stopCallbacks.push(() => {
824
660
  t.removeEventListener(u, c);
825
661
  });
826
662
  }
827
663
  } else if (n === "onClickOutside" || n === "onclickoutside") {
828
664
  const i = (c) => {
829
- this.canClickAway && !t.contains(c.target) && (m(s) ? s.get()(c) : s(c));
665
+ this.canClickAway && !t.contains(c.target) && (m(r) ? r.get()(c) : r(c));
830
666
  }, u = { capture: !0 };
831
667
  window.addEventListener("click", i, u), this.stopCallbacks.push(() => {
832
668
  window.removeEventListener("click", i, u);
833
669
  });
834
- } else if (de(n)) {
835
- const i = n.slice(2).toLowerCase(), u = m(s) ? (c) => s.get()(c) : s;
670
+ } else if (ue(n)) {
671
+ const i = n.slice(2).toLowerCase(), u = m(r) ? (c) => r.get()(c) : r;
836
672
  t.addEventListener(i, u), this.stopCallbacks.push(() => {
837
673
  t.removeEventListener(i, u);
838
674
  });
839
675
  } else if (n.includes("-"))
840
676
  this.attachProp(
841
- s,
677
+ r,
842
678
  (i) => {
843
679
  i == null ? t.removeAttribute(n) : t.setAttribute(n, String(i));
844
680
  },
845
681
  this.getUpdateKey("attr", n)
846
682
  );
847
- else if (!me.includes(n))
683
+ else if (!ae.includes(n))
848
684
  if (this.elementContext.isSVG)
849
685
  this.attachProp(
850
- s,
686
+ r,
851
687
  (i) => {
852
688
  i != null ? t.setAttribute(n, String(e[n])) : t.removeAttribute(n);
853
689
  },
@@ -858,7 +694,7 @@ class pe {
858
694
  case "contentEditable":
859
695
  case "value":
860
696
  this.attachProp(
861
- s,
697
+ r,
862
698
  (i) => {
863
699
  t[n] = String(i);
864
700
  },
@@ -867,7 +703,7 @@ class pe {
867
703
  break;
868
704
  case "for":
869
705
  this.attachProp(
870
- s,
706
+ r,
871
707
  (i) => {
872
708
  t.htmlFor = i;
873
709
  },
@@ -876,7 +712,7 @@ class pe {
876
712
  break;
877
713
  case "checked":
878
714
  this.attachProp(
879
- s,
715
+ r,
880
716
  (i) => {
881
717
  t.checked = i, i ? t.setAttribute("checked", "") : t.removeAttribute("checked");
882
718
  },
@@ -891,7 +727,7 @@ class pe {
891
727
  case "title": {
892
728
  const i = n.toLowerCase();
893
729
  this.attachProp(
894
- s,
730
+ r,
895
731
  (u) => {
896
732
  u == null ? t.removeAttribute(i) : t.setAttribute(i, String(u));
897
733
  },
@@ -902,7 +738,7 @@ class pe {
902
738
  case "autocomplete":
903
739
  case "autocapitalize":
904
740
  this.attachProp(
905
- s,
741
+ r,
906
742
  (i) => {
907
743
  typeof i == "string" ? t.autocomplete = i : i ? t.autocomplete = "on" : t.autocomplete = "off";
908
744
  },
@@ -911,7 +747,7 @@ class pe {
911
747
  break;
912
748
  default: {
913
749
  this.attachProp(
914
- s,
750
+ r,
915
751
  (i) => {
916
752
  t[n] = i;
917
753
  },
@@ -923,20 +759,20 @@ class pe {
923
759
  }
924
760
  }
925
761
  applyStyles(t, e, n) {
926
- const s = [];
762
+ const r = [];
927
763
  if (m(e)) {
928
764
  let i;
929
765
  const u = e.watch((c) => {
930
766
  this._mutate(
931
767
  () => {
932
- I(i) && i(), t.style.cssText = "", i = this.applyStyles(t, c, n);
768
+ V(i) && i(), t.style.cssText = "", i = this.applyStyles(t, c, n);
933
769
  },
934
770
  this.getUpdateKey("styles", "*")
935
771
  );
936
772
  });
937
- n.push(u), s.push(u);
773
+ n.push(u), r.push(u);
938
774
  } else {
939
- const i = Ft(e);
775
+ const i = Wt(e);
940
776
  for (const u in i) {
941
777
  const { value: c, priority: h } = i[u];
942
778
  if (m(c)) {
@@ -945,30 +781,30 @@ class pe {
945
781
  f ? t.style.setProperty(u, String(f), h) : t.style.removeProperty(u);
946
782
  });
947
783
  });
948
- n.push(a), s.push(a);
784
+ n.push(a), r.push(a);
949
785
  } else c != null && t.style.setProperty(u, String(c));
950
786
  }
951
787
  }
952
788
  return function() {
953
- for (const u of s)
789
+ for (const u of r)
954
790
  u(), n.splice(n.indexOf(u), 1);
955
791
  };
956
792
  }
957
793
  applyClasses(t, e, n) {
958
- const s = [];
794
+ const r = [];
959
795
  if (m(e)) {
960
796
  let i;
961
797
  const u = e.watch((c) => {
962
798
  this._mutate(
963
799
  () => {
964
- I(i) && i(), t.removeAttribute("class"), i = this.applyClasses(t, c, n);
800
+ V(i) && i(), t.removeAttribute("class"), i = this.applyClasses(t, c, n);
965
801
  },
966
802
  this.getUpdateKey("attr", "class")
967
803
  );
968
804
  });
969
- n.push(u), s.push(u);
805
+ n.push(u), r.push(u);
970
806
  } else {
971
- const i = Wt(e);
807
+ const i = Nt(e);
972
808
  for (const u in i) {
973
809
  const c = i[u];
974
810
  if (m(c)) {
@@ -977,53 +813,53 @@ class pe {
977
813
  a ? t.classList.add(u) : t.classList.remove(u);
978
814
  });
979
815
  });
980
- n.push(h), s.push(h);
816
+ n.push(h), r.push(h);
981
817
  } else c && t.classList.add(u);
982
818
  }
983
819
  }
984
820
  return function() {
985
- for (const u of s)
821
+ for (const u of r)
986
822
  u(), n.splice(n.indexOf(u), 1);
987
823
  };
988
824
  }
989
825
  }
990
- function Wt(r) {
826
+ function Nt(s) {
991
827
  let t = {};
992
- if (b(r)) {
993
- const e = r.split(" ");
828
+ if (k(s)) {
829
+ const e = s.split(" ");
994
830
  for (const n of e)
995
831
  t[n] = !0;
996
- } else bt(r) ? Object.assign(t, r) : Array.isArray(r) && Array.from(r).filter(Boolean).forEach((e) => {
997
- Object.assign(t, Wt(e));
832
+ } else Z(s) ? Object.assign(t, s) : Array.isArray(s) && Array.from(s).filter(Boolean).forEach((e) => {
833
+ Object.assign(t, Nt(e));
998
834
  });
999
835
  return delete t.undefined, t;
1000
836
  }
1001
- function Ft(r) {
837
+ function Wt(s) {
1002
838
  let t = {};
1003
- if (b(r)) {
1004
- const e = r.split(";").filter((n) => n.trim() !== "");
839
+ if (k(s)) {
840
+ const e = s.split(";").filter((n) => n.trim() !== "");
1005
841
  for (const n of e) {
1006
- const [s, i] = n.split(":"), u = {
842
+ const [r, i] = n.split(":"), u = {
1007
843
  value: i
1008
844
  };
1009
- i.includes("!important") ? (u.priority = "important", u.value = i.replace("!important", "").trim()) : u.value = i.trim(), t[pt(s.trim())] = u;
845
+ i.includes("!important") ? (u.priority = "important", u.value = i.replace("!important", "").trim()) : u.value = i.trim(), t[dt(r.trim())] = u;
1010
846
  }
1011
847
  }
1012
- if (bt(r))
1013
- for (const e in r)
1014
- e.startsWith("--") ? t[e] = { value: r[e] } : t[pt(e)] = { value: r[e] };
1015
- else Array.isArray(r) && Array.from(r).filter((e) => e != null).forEach((e) => {
1016
- Object.assign(t, Ft(e));
848
+ if (Z(s))
849
+ for (const e in s)
850
+ e.startsWith("--") ? t[e] = { value: s[e] } : t[dt(e)] = { value: s[e] };
851
+ else Array.isArray(s) && Array.from(s).filter((e) => e != null).forEach((e) => {
852
+ Object.assign(t, Wt(e));
1017
853
  });
1018
854
  return t;
1019
855
  }
1020
- function pt(r) {
1021
- return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
856
+ function dt(s) {
857
+ return s.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
1022
858
  }
1023
- const me = ["ref", "children", "class", "style", "data"];
859
+ const ae = ["ref", "children", "class", "style", "data"];
1024
860
  var gt;
1025
861
  gt = M;
1026
- class _e {
862
+ class he {
1027
863
  constructor({ sources: t, renderFn: e, elementContext: n }) {
1028
864
  o(this, gt, !0);
1029
865
  o(this, "node", document.createTextNode(""));
@@ -1039,12 +875,12 @@ class _e {
1039
875
  }
1040
876
  mount(t, e) {
1041
877
  this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.watcher.watch(this.sources, (...n) => {
1042
- const s = this.renderFn(...n);
1043
- if (!It(s))
1044
- throw console.error(s, n), new TypeError(
1045
- `Observer received invalid value to render. Got type: ${V(s)}, value: ${s}`
878
+ const r = this.renderFn(...n);
879
+ if (!qt(r))
880
+ throw console.error(r, n), new TypeError(
881
+ `Observer received invalid value to render. Got type: ${$(r)}, value: ${r}`
1046
882
  );
1047
- this.update(A(s) ? s : [s]);
883
+ this.update(A(r) ? r : [r]);
1048
884
  }));
1049
885
  }
1050
886
  unmount(t = !1) {
@@ -1060,13 +896,13 @@ class _e {
1060
896
  var i, u, c;
1061
897
  if (this.cleanup(!1), t == null || t.length === 0 || !this.isMounted)
1062
898
  return;
1063
- const e = t.flatMap((h) => Tt(h) ? h : k(this.elementContext, tt(h)));
899
+ const e = t.flatMap((h) => Tt(h) ? h : b(this.elementContext, Q(h)));
1064
900
  for (const h of e) {
1065
901
  const a = ((i = this.children.at(-1)) == null ? void 0 : i.node) || this.node;
1066
902
  h.mount(this.node.parentNode, a), this.children.push(h);
1067
903
  }
1068
- const n = this.node.parentNode, s = ((c = (u = this.children.at(-1)) == null ? void 0 : u.node) == null ? void 0 : c.nextSibling) ?? null;
1069
- n.insertBefore(this.node, s);
904
+ const n = this.node.parentNode, r = ((c = (u = this.children.at(-1)) == null ? void 0 : u.node) == null ? void 0 : c.nextSibling) ?? null;
905
+ n.insertBefore(this.node, r);
1070
906
  }
1071
907
  }
1072
908
  var yt;
@@ -1097,19 +933,19 @@ class Pt {
1097
933
  update(t) {
1098
934
  var e, n;
1099
935
  if (this.cleanup(!1), t.length > 0) {
1100
- for (let s = 0; s < t.length; s++) {
1101
- const i = t[s], u = s > 0 ? this.elements[s - 1] : void 0;
936
+ for (let r = 0; r < t.length; r++) {
937
+ const i = t[r], u = r > 0 ? this.elements[r - 1] : void 0;
1102
938
  i.mount(this.node.parentElement, u == null ? void 0 : u.node), this.elements.push(i);
1103
939
  }
1104
940
  (n = this.node.parentNode) == null || n.insertBefore(this.node, ((e = this.elements.at(-1)) == null ? void 0 : e.node) ?? null);
1105
941
  }
1106
942
  }
1107
943
  }
1108
- var St;
1109
- St = M;
1110
- class we {
944
+ var vt;
945
+ vt = M;
946
+ class le {
1111
947
  constructor(t) {
1112
- o(this, St, !0);
948
+ o(this, vt, !0);
1113
949
  o(this, "config");
1114
950
  o(this, "element");
1115
951
  this.config = t;
@@ -1118,18 +954,158 @@ class we {
1118
954
  return this.element ? this.element.isMounted : !1;
1119
955
  }
1120
956
  mount(t, e) {
1121
- const { content: n, parent: s } = this.config;
1122
- Tt(n) ? this.element = n : this.element = T(k(this.config.elementContext, tt(n))), this.element.mount(s);
957
+ const { content: n, parent: r } = this.config;
958
+ Tt(n) ? this.element = n : this.element = F(b(this.config.elementContext, Q(n))), this.element.mount(r);
1123
959
  }
1124
960
  unmount(t = !1) {
1125
961
  var e;
1126
962
  (e = this.element) != null && e.isMounted && this.element.unmount(t);
1127
963
  }
1128
964
  }
1129
- function Fe(r) {
1130
- return r;
965
+ var N;
966
+ class J {
967
+ constructor(t, e) {
968
+ o(this, "type");
969
+ o(this, "detail");
970
+ P(this, N, !1);
971
+ this.type = t, this.detail = e;
972
+ }
973
+ get propagationStopped() {
974
+ return O(this, N);
975
+ }
976
+ stopPropagation() {
977
+ T(this, N, !0);
978
+ }
979
+ get [Symbol.toStringTag]() {
980
+ return "ContextEvent";
981
+ }
982
+ // stopImmediatePropagation() {}
983
+ }
984
+ N = new WeakMap();
985
+ let fe = class {
986
+ constructor(t) {
987
+ o(this, "__store");
988
+ this.__store = t;
989
+ const e = Object.getOwnPropertyDescriptors(this.__store._logger);
990
+ for (const n in e)
991
+ n !== "setName" && Object.defineProperty(this, n, e[n]);
992
+ }
993
+ get isMounted() {
994
+ return this.__store.isMounted;
995
+ }
996
+ setName(t) {
997
+ return this.__store._logger.setName(t), this;
998
+ }
999
+ set(t, e) {
1000
+ return this.__store._elementContext.data[t] = e, e;
1001
+ }
1002
+ get(t) {
1003
+ let e = this.__store._elementContext;
1004
+ for (; ; ) {
1005
+ if (t in e.data)
1006
+ return e.data[t];
1007
+ if (e.parent)
1008
+ e = e.parent;
1009
+ else
1010
+ break;
1011
+ }
1012
+ return null;
1013
+ }
1014
+ on(t, e) {
1015
+ if (t === "*") {
1016
+ const n = (r, i) => {
1017
+ e(i);
1018
+ };
1019
+ this.__store._elementContext.emitter.on(t, n), this.__store._wildcardListeners.set(e, n);
1020
+ } else
1021
+ this.__store._elementContext.emitter.on(t, e);
1022
+ }
1023
+ off(t, e) {
1024
+ if (t === "*") {
1025
+ const n = this.__store._wildcardListeners.get(e);
1026
+ n && (this.__store._elementContext.emitter.off(t, n), this.__store._wildcardListeners.delete(e));
1027
+ } else
1028
+ this.__store._elementContext.emitter.off(t, e);
1029
+ }
1030
+ once(t, e) {
1031
+ if (t === "*") {
1032
+ const n = (r, i) => {
1033
+ this.__store._wildcardListeners.delete(e), e(i);
1034
+ };
1035
+ this.__store._elementContext.emitter.once(t, n), this.__store._wildcardListeners.set(e, n);
1036
+ } else
1037
+ this.__store._elementContext.emitter.once(t, e);
1038
+ }
1039
+ emit(t, e) {
1040
+ return this.__store._elementContext.emitter.emit(t, new J(t, e));
1041
+ }
1042
+ onMount(t) {
1043
+ this.__store._emitter.on("mounted", t);
1044
+ }
1045
+ onUnmount(t) {
1046
+ this.__store._emitter.on("unmounted", t);
1047
+ }
1048
+ watch(t, e) {
1049
+ const n = this.__store;
1050
+ if (n.isMounted)
1051
+ return n._watcher.watch(t, e);
1052
+ {
1053
+ let r, i = !1;
1054
+ return n._emitter.on("mounted", () => {
1055
+ i || (r = n._watcher.watch(t, e));
1056
+ }), () => {
1057
+ r != null && (i = !0, r());
1058
+ };
1059
+ }
1060
+ }
1061
+ };
1062
+ class de {
1063
+ constructor(t, e) {
1064
+ o(this, "fn");
1065
+ o(this, "_options");
1066
+ /**
1067
+ * Value is guaranteed to be set after `attach` is called.
1068
+ */
1069
+ o(this, "value");
1070
+ o(this, "isMounted", !1);
1071
+ o(this, "_elementContext");
1072
+ o(this, "_emitter", new I());
1073
+ o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
1074
+ o(this, "_logger");
1075
+ o(this, "_watcher", D());
1076
+ this.fn = t, this._options = e;
1077
+ }
1078
+ get name() {
1079
+ return this.fn.name;
1080
+ }
1081
+ /**
1082
+ * Attaches this Store to the elementContext.
1083
+ * Returns false if there was already an instance attached, and true otherwise.
1084
+ */
1085
+ attach(t) {
1086
+ if (t.stores.has(this.fn))
1087
+ return !1;
1088
+ this._elementContext = t, this._logger = t.root.createLogger(this.fn.name), this._emitter.on("error", (n, r, ...i) => {
1089
+ console.log({ error: n, eventName: r, args: i }), this._logger.crash(n);
1090
+ });
1091
+ const e = new fe(this);
1092
+ try {
1093
+ this.value = this.fn.call(e, this._options, e);
1094
+ } catch (n) {
1095
+ this._logger.crash(n);
1096
+ }
1097
+ return t.stores.set(this.fn, this), !0;
1098
+ }
1099
+ handleMount() {
1100
+ this.isMounted = !0, this._emitter.emit("mounted");
1101
+ }
1102
+ handleUnmount() {
1103
+ this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1104
+ }
1105
+ }
1106
+ class pt extends Error {
1131
1107
  }
1132
- class ge {
1108
+ class pe {
1133
1109
  constructor(t) {
1134
1110
  o(this, "__view");
1135
1111
  this.__view = t;
@@ -1172,7 +1148,7 @@ class ge {
1172
1148
  // }
1173
1149
  on(t, e) {
1174
1150
  if (t === "*") {
1175
- const n = (s, i) => {
1151
+ const n = (r, i) => {
1176
1152
  e(i);
1177
1153
  };
1178
1154
  this.__view._elementContext.emitter.on(t, n), this.__view._wildcardListeners.set(e, n);
@@ -1188,7 +1164,7 @@ class ge {
1188
1164
  }
1189
1165
  once(t, e) {
1190
1166
  if (t === "*") {
1191
- const n = (s, i) => {
1167
+ const n = (r, i) => {
1192
1168
  this.__view._wildcardListeners.delete(e), e(i);
1193
1169
  };
1194
1170
  this.__view._elementContext.emitter.once(t, n), this.__view._wildcardListeners.set(e, n);
@@ -1196,32 +1172,31 @@ class ge {
1196
1172
  this.__view._elementContext.emitter.once(t, e);
1197
1173
  }
1198
1174
  emit(t, e) {
1199
- return this.__view._elementContext.emitter.emit(t, new Q(t, e));
1175
+ return this.__view._elementContext.emitter.emit(t, new J(t, e));
1200
1176
  }
1201
- attachStore(t) {
1202
- if (t.attach(this.__view._elementContext))
1177
+ attachStore(t, e) {
1178
+ const n = new de(t, e);
1179
+ if (n.attach(this.__view._elementContext))
1203
1180
  this.__view._emitter.on("mounted", () => {
1204
- t.handleMount();
1181
+ n.handleMount();
1205
1182
  }), this.__view._emitter.on("unmounted", () => {
1206
- t.handleUnmount();
1183
+ n.handleUnmount();
1207
1184
  });
1208
1185
  else {
1209
- let n = t.name ? `'${t.name}'` : "this store";
1210
- this.__view._logger.warn(`An instance of ${n} was already attached to this context.`);
1186
+ let i = t.name ? `'${t.name}'` : "this store";
1187
+ this.__view._logger.warn(`An instance of ${i} was already attached to this context.`);
1211
1188
  }
1212
1189
  }
1213
1190
  useStore(t) {
1214
- if (he(t)) {
1215
- const e = t.key;
1216
- let n = this.__view._elementContext, s;
1217
- for (; s = n.stores.get(e), s == null && n.parent != null; )
1218
- n = n.parent;
1219
- if (s == null)
1220
- throw new H("Store not found on this context.");
1221
- return s.value;
1222
- } else throw le(t) ? new H(
1223
- "Received a Store instance. Please pass the Store factory function to useStore without calling it."
1224
- ) : new H("Invalid store.");
1191
+ if (V(t)) {
1192
+ let e = this.__view._elementContext, n;
1193
+ for (; n = e.stores.get(t), n == null && e.parent != null; )
1194
+ e = e.parent;
1195
+ if (n == null)
1196
+ throw new pt("Store not found on this context.");
1197
+ return n.value;
1198
+ } else
1199
+ throw new pt("Invalid store.");
1225
1200
  }
1226
1201
  beforeMount(t) {
1227
1202
  this.__view._emitter.on("beforeMount", t);
@@ -1240,24 +1215,24 @@ class ge {
1240
1215
  if (n.isMounted)
1241
1216
  return n._watcher.watch(t, e);
1242
1217
  {
1243
- let s, i = !1;
1218
+ let r, i = !1;
1244
1219
  return n._emitter.on("mounted", () => {
1245
- i || (s = n._watcher.watch(t, e));
1220
+ i || (r = n._watcher.watch(t, e));
1246
1221
  }), () => {
1247
- s != null && (i = !0, s());
1222
+ r != null && (i = !0, r());
1248
1223
  };
1249
1224
  }
1250
1225
  }
1251
1226
  outlet() {
1252
- return v("$outlet", { $children: this.__view._$children });
1227
+ return S("$outlet", { $children: this.__view._$children });
1253
1228
  }
1254
1229
  }
1255
- var vt;
1256
- vt = M;
1257
- const et = class et {
1258
- constructor(t, e, n, s = []) {
1259
- o(this, vt, !0);
1260
- o(this, "uniqueId", Z());
1230
+ var St;
1231
+ St = M;
1232
+ const tt = class tt {
1233
+ constructor(t, e, n, r = []) {
1234
+ o(this, St, !0);
1235
+ o(this, "uniqueId", kt());
1261
1236
  o(this, "_elementContext");
1262
1237
  o(this, "_logger");
1263
1238
  o(this, "_view");
@@ -1267,7 +1242,7 @@ const et = class et {
1267
1242
  o(this, "_$children");
1268
1243
  o(this, "_setChildren");
1269
1244
  o(this, "_watcher", D());
1270
- o(this, "_emitter", new q());
1245
+ o(this, "_emitter", new I());
1271
1246
  o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
1272
1247
  o(this, "isMounted", !1);
1273
1248
  this._elementContext = {
@@ -1275,13 +1250,13 @@ const et = class et {
1275
1250
  data: {},
1276
1251
  parent: t,
1277
1252
  viewName: e.name,
1278
- emitter: new q(),
1253
+ emitter: new I(),
1279
1254
  stores: /* @__PURE__ */ new Map()
1280
- }, this._logger = t.root.createLogger(e.name || "🌇 anonymous view", { uid: this.uniqueId }), this._view = e, this._props = n, this._childMarkup = s, [this._$children, this._setChildren] = Y([]), this._emitter.on("error", (i, u, ...c) => {
1255
+ }, this._logger = t.root.createLogger(e.name || "🌇 anonymous view", { uid: this.uniqueId }), this._view = e, this._props = n, this._childMarkup = r, [this._$children, this._setChildren] = H([]), this._emitter.on("error", (i, u, ...c) => {
1281
1256
  this._logger.error({ error: i, eventName: u, args: c }), this._logger.crash(i);
1282
1257
  }), this._elementContext.emitter.on("*", (i, u) => {
1283
1258
  var c;
1284
- u instanceof Q && (u.propagationStopped || (c = this._elementContext.parent) == null || c.emitter.emit(i, u));
1259
+ u instanceof J && (u.propagationStopped || (c = this._elementContext.parent) == null || c.emitter.emit(i, u));
1285
1260
  });
1286
1261
  }
1287
1262
  /*===============================*\
@@ -1293,50 +1268,50 @@ const et = class et {
1293
1268
  }
1294
1269
  mount(t, e) {
1295
1270
  const n = this.isMounted;
1296
- n || (this._initialize(), this._emitter.emit("beforeMount")), this._element && this._element.mount(t, e), n || (this.isMounted = !0, te(), requestAnimationFrame(() => {
1271
+ n || (this._initialize(), this._emitter.emit("beforeMount")), this._element && this._element.mount(t, e), n || (this.isMounted = !0, Qt(), requestAnimationFrame(() => {
1297
1272
  this._emitter.emit("mounted");
1298
1273
  }));
1299
1274
  }
1300
1275
  unmount(t = !1) {
1301
- this._emitter.emit("beforeUnmount"), this._element && this._element.unmount(t), this.isMounted && ee(), this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1276
+ this._emitter.emit("beforeUnmount"), this._element && this._element.unmount(t), this.isMounted && te(), this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1302
1277
  }
1303
1278
  setChildView(t) {
1304
1279
  this._childMarkup = [];
1305
- const e = new et(this._elementContext, t, {});
1280
+ const e = new tt(this._elementContext, t, {});
1306
1281
  return this._setChildren([e]), e;
1307
1282
  }
1308
1283
  /*===============================*\
1309
1284
  || Internal ||
1310
1285
  \*===============================*/
1311
1286
  _initialize() {
1312
- const t = new ge(this);
1287
+ const t = new pe(this);
1313
1288
  let e;
1314
1289
  try {
1315
- e = this._view.call(t, this._props, t), this._childMarkup.length && this._setChildren(k(this._elementContext, this._childMarkup));
1290
+ e = this._view.call(t, this._props, t), this._childMarkup.length && this._setChildren(b(this._elementContext, this._childMarkup));
1316
1291
  } catch (n) {
1317
1292
  throw n instanceof Error && this._logger.crash(n), n;
1318
1293
  }
1319
1294
  if (e !== null) if (e instanceof Node)
1320
- this._element = T(k(this._elementContext, v("$node", { value: e })));
1321
- else if (U(e) || kt(U, e))
1322
- this._element = T(k(this._elementContext, e));
1295
+ this._element = F(b(this._elementContext, S("$node", { value: e })));
1296
+ else if (U(e) || bt(U, e))
1297
+ this._element = F(b(this._elementContext, e));
1323
1298
  else if (m(e))
1324
- this._element = T(
1325
- k(this._elementContext, v("$observer", { sources: [e], renderFn: (n) => n }))
1299
+ this._element = F(
1300
+ b(this._elementContext, S("$observer", { sources: [e], renderFn: (n) => n }))
1326
1301
  );
1327
1302
  else {
1328
1303
  const n = new TypeError(
1329
- `Expected '${this._view.name}' function to return a DOM node, Markup element, Readable or null. Got: ${V(e)}`
1304
+ `Expected '${this._view.name}' function to return a DOM node, Markup element, Readable or null. Got: ${$(e)}`
1330
1305
  );
1331
1306
  this._logger.crash(n);
1332
1307
  }
1333
1308
  }
1334
1309
  };
1335
- let j = et;
1310
+ let j = tt;
1336
1311
  var Ct;
1337
1312
  Ct = M;
1338
- class ye {
1339
- constructor({ elementContext: t, $items: e, renderFn: n, keyFn: s }) {
1313
+ class me {
1314
+ constructor({ elementContext: t, $items: e, renderFn: n, keyFn: r }) {
1340
1315
  o(this, Ct, !0);
1341
1316
  o(this, "node", document.createTextNode(""));
1342
1317
  o(this, "$items");
@@ -1345,7 +1320,7 @@ class ye {
1345
1320
  o(this, "elementContext");
1346
1321
  o(this, "renderFn");
1347
1322
  o(this, "keyFn");
1348
- this.elementContext = t, this.$items = e, this.renderFn = n, this.keyFn = s;
1323
+ this.elementContext = t, this.$items = e, this.renderFn = n, this.keyFn = r;
1349
1324
  }
1350
1325
  get isMounted() {
1351
1326
  return this.node.parentNode != null;
@@ -1378,22 +1353,22 @@ class ye {
1378
1353
  value: a,
1379
1354
  index: n++
1380
1355
  });
1381
- const s = [];
1356
+ const r = [];
1382
1357
  for (const a of this.connectedItems)
1383
1358
  e.find((l) => l.key === a.key) || a.element.unmount(!1);
1384
1359
  for (const a of e) {
1385
1360
  const f = this.connectedItems.find((l) => l.key === a.key);
1386
1361
  if (f)
1387
- f.setValue(a.value), f.setIndex(a.index), s[a.index] = f;
1362
+ f.setValue(a.value), f.setIndex(a.index), r[a.index] = f;
1388
1363
  else {
1389
- const [l, d] = Y(a.value), [p, _] = Y(a.index);
1390
- s[a.index] = {
1364
+ const [l, d] = H(a.value), [p, _] = H(a.index);
1365
+ r[a.index] = {
1391
1366
  key: a.key,
1392
1367
  $value: l,
1393
1368
  setValue: d,
1394
1369
  $index: p,
1395
1370
  setIndex: _,
1396
- element: new j(this.elementContext, Se, {
1371
+ element: new j(this.elementContext, _e, {
1397
1372
  $value: l,
1398
1373
  $index: p,
1399
1374
  renderFn: this.renderFn
@@ -1401,163 +1376,158 @@ class ye {
1401
1376
  };
1402
1377
  }
1403
1378
  }
1404
- for (let a = 0; a < s.length; a++) {
1405
- const f = s[a], l = ((u = s[a - 1]) == null ? void 0 : u.element.node) ?? this.node;
1379
+ for (let a = 0; a < r.length; a++) {
1380
+ const f = r[a], l = ((u = r[a - 1]) == null ? void 0 : u.element.node) ?? this.node;
1406
1381
  f.element.mount(this.node.parentNode, l);
1407
1382
  }
1408
- this.connectedItems = s;
1409
- const i = ((c = s.at(-1)) == null ? void 0 : c.element.node) ?? this.node;
1383
+ this.connectedItems = r;
1384
+ const i = ((c = r.at(-1)) == null ? void 0 : c.element.node) ?? this.node;
1410
1385
  (h = this.node.parentNode) == null || h.insertBefore(this.node, i.nextSibling);
1411
1386
  }
1412
1387
  }
1413
- function Se({ $value: r, $index: t, renderFn: e }, n) {
1414
- return n.setName("@RepeatItem"), e.call(n, r, t, n);
1388
+ function _e({ $value: s, $index: t, renderFn: e }, n) {
1389
+ return n.setName("@RepeatItem"), e.call(n, s, t, n);
1415
1390
  }
1416
- function U(r) {
1417
- return (r == null ? void 0 : r[Lt]) === !0;
1391
+ function U(s) {
1392
+ return (s == null ? void 0 : s[Lt]) === !0;
1418
1393
  }
1419
- function Tt(r) {
1420
- return (r == null ? void 0 : r[M]) === !0;
1394
+ function Tt(s) {
1395
+ return (s == null ? void 0 : s[M]) === !0;
1421
1396
  }
1422
- function tt(r) {
1423
- return A(r) || (r = [r]), r.flat(1 / 0).filter((t) => t != null && t !== !1).map((t) => U(t) ? t : t instanceof Node ? v("$node", { value: t }) : m(t) ? v("$observer", {
1397
+ function Q(s) {
1398
+ return A(s) || (s = [s]), s.flat(1 / 0).filter((t) => t != null && t !== !1).map((t) => U(t) ? t : t instanceof Node ? S("$node", { value: t }) : m(t) ? S("$observer", {
1424
1399
  sources: [t],
1425
1400
  renderFn: (e) => e
1426
- }) : v("$text", { value: t }));
1401
+ }) : S("$text", { value: t }));
1427
1402
  }
1428
- function v(r, t, ...e) {
1429
- return new ve(r, t, ...e);
1403
+ function S(s, t, ...e) {
1404
+ return new we(s, t, ...e);
1430
1405
  }
1431
1406
  var xt;
1432
1407
  xt = Lt;
1433
- class ve {
1408
+ class we {
1434
1409
  constructor(t, e, ...n) {
1435
1410
  o(this, xt, !0);
1436
1411
  o(this, "type");
1437
1412
  o(this, "props");
1438
1413
  o(this, "children");
1439
- this.type = t, this.props = e, this.children = tt(n);
1414
+ this.type = t, this.props = e, this.children = Q(n);
1440
1415
  }
1441
1416
  }
1442
- const Pe = fe.bind(v);
1443
- function Te(r, t, e) {
1444
- return v("$observer", {
1445
- sources: [r],
1417
+ const Le = oe.bind(S);
1418
+ function Ne(s, t, e) {
1419
+ return S("$observer", {
1420
+ sources: [s],
1446
1421
  renderFn: (n) => n && t ? t : !n && e ? e : null
1447
1422
  });
1448
1423
  }
1449
- function Ie(r, t, e) {
1450
- const n = J(r);
1451
- return v("$repeat", { $items: n, keyFn: t, renderFn: e });
1424
+ function We(s, t, e) {
1425
+ const n = Y(s);
1426
+ return S("$repeat", { $items: n, keyFn: t, renderFn: e });
1452
1427
  }
1453
- function qe(r, t) {
1454
- return v("$portal", { parent: r, content: t });
1428
+ function Pe(s, t) {
1429
+ return S("$portal", { parent: s, content: t });
1455
1430
  }
1456
- function k(r, t) {
1431
+ function b(s, t) {
1457
1432
  return (A(t) ? t : [t]).map((n) => {
1458
- if (I(n.type))
1459
- return new j(r, n.type, n.props, n.children);
1460
- if (b(n.type))
1433
+ if (V(n.type))
1434
+ return new j(s, n.type, n.props, n.children);
1435
+ if (k(n.type))
1461
1436
  switch (n.type) {
1462
1437
  case "$node": {
1463
- const s = n.props;
1464
- return new dt(s.value);
1438
+ const r = n.props;
1439
+ return new ft(r.value);
1465
1440
  }
1466
1441
  case "$text": {
1467
- const s = n.props;
1468
- return new dt(document.createTextNode(String(s.value)));
1442
+ const r = n.props;
1443
+ return new ft(document.createTextNode(String(r.value)));
1469
1444
  }
1470
1445
  case "$repeat": {
1471
- const s = n.props;
1472
- return new ye({
1473
- $items: s.$items,
1474
- keyFn: s.keyFn,
1475
- renderFn: s.renderFn,
1476
- elementContext: r
1446
+ const r = n.props;
1447
+ return new me({
1448
+ $items: r.$items,
1449
+ keyFn: r.keyFn,
1450
+ renderFn: r.renderFn,
1451
+ elementContext: s
1477
1452
  });
1478
1453
  }
1479
1454
  case "$observer": {
1480
- const s = n.props;
1481
- return new _e({
1482
- sources: s.sources,
1483
- renderFn: s.renderFn,
1484
- elementContext: r
1455
+ const r = n.props;
1456
+ return new he({
1457
+ sources: r.sources,
1458
+ renderFn: r.renderFn,
1459
+ elementContext: s
1485
1460
  });
1486
1461
  }
1487
1462
  case "$outlet": {
1488
- const s = n.props;
1489
- return new Pt(s.$children);
1463
+ const r = n.props;
1464
+ return new Pt(r.$children);
1490
1465
  }
1491
1466
  case "$portal": {
1492
- const s = n.props;
1493
- return new we({
1494
- content: s.content,
1495
- parent: s.parent,
1496
- elementContext: r
1467
+ const r = n.props;
1468
+ return new le({
1469
+ content: r.content,
1470
+ parent: r.parent,
1471
+ elementContext: s
1497
1472
  });
1498
1473
  }
1499
1474
  default:
1500
1475
  if (n.type.startsWith("$"))
1501
1476
  throw new Error(`Unknown markup type: ${n.type}`);
1502
- return new pe({
1477
+ return new ce({
1503
1478
  tag: n.type,
1504
1479
  props: n.props ?? {},
1505
1480
  children: n.children,
1506
- elementContext: r
1481
+ elementContext: s
1507
1482
  });
1508
1483
  }
1509
1484
  else
1510
1485
  throw new TypeError(`Expected a string or view function. Got: ${n.type}`);
1511
1486
  });
1512
1487
  }
1513
- function T(r) {
1514
- return r.length === 1 ? r[0] : new Pt(r);
1488
+ function F(s) {
1489
+ return s.length === 1 ? s[0] : new Pt(s);
1515
1490
  }
1516
- function It(r) {
1517
- return r == null || r === !1 || b(r) || Gt(r) || U(r) || m(r) || kt(It, r);
1518
- }
1519
- function je(r, t) {
1520
- return t.outlet();
1491
+ function qt(s) {
1492
+ return s == null || s === !1 || k(s) || zt(s) || U(s) || m(s) || bt(qt, s);
1521
1493
  }
1522
1494
  export {
1523
- Zt as A,
1524
- Oe as B,
1525
- Q as C,
1526
- T as D,
1527
- k as E,
1528
- We as F,
1529
- Et as G,
1530
- qe as H,
1531
- Ie as I,
1532
- Fe as J,
1533
- je as P,
1534
- $e as S,
1495
+ F as A,
1496
+ b as B,
1497
+ J as C,
1498
+ de as D,
1499
+ Et as E,
1500
+ Pe as F,
1501
+ We as G,
1502
+ Ae as I,
1503
+ $e as P,
1504
+ Ee as S,
1535
1505
  j as V,
1536
- b as a,
1537
- Ae as b,
1538
- Y as c,
1539
- oe as d,
1540
- I as e,
1541
- ke as f,
1542
- Me as g,
1543
- xe as h,
1544
- bt as i,
1545
- Pe as j,
1546
- Te as k,
1506
+ ve as a,
1507
+ ye as b,
1508
+ Ce as c,
1509
+ H as d,
1510
+ re as e,
1511
+ k as f,
1512
+ Z as g,
1513
+ Me as h,
1514
+ V as i,
1515
+ Le as j,
1516
+ Ne as k,
1547
1517
  D as l,
1548
- Ve as m,
1549
- J as n,
1550
- re as o,
1551
- q as p,
1518
+ ke as m,
1519
+ Y as n,
1520
+ ee as o,
1521
+ I as p,
1552
1522
  m as q,
1553
- Le as r,
1554
- Ee as s,
1555
- V as t,
1556
- ue as u,
1557
- he as v,
1558
- H as w,
1559
- le as x,
1560
- be as y,
1561
- v as z
1523
+ Oe as r,
1524
+ xe as s,
1525
+ $ as t,
1526
+ ie as u,
1527
+ pt as v,
1528
+ Se as w,
1529
+ S as x,
1530
+ Zt as y,
1531
+ be as z
1562
1532
  };
1563
- //# sourceMappingURL=passthrough-d2lcM0cd.js.map
1533
+ //# sourceMappingURL=markup-C-1VlVZi.js.map