@manyducks.co/dolla 2.0.0-alpha.28 → 2.0.0-alpha.29

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