@manyducks.co/dolla 2.0.0-alpha.44 → 2.0.0-alpha.46

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.
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ var $t = (a) => {
3
3
  throw TypeError(a);
4
4
  };
5
5
  var Bt = (a, t, e) => t in a ? zt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
6
- var w = (a, t, e) => Bt(a, typeof t != "symbol" ? t + "" : t, e), pt = (a, t, e) => t.has(a) || $t("Cannot " + e);
7
- var i = (a, t, e) => (pt(a, t, "read from private field"), e ? e.call(a) : t.get(a)), u = (a, t, e) => t.has(a) ? $t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), d = (a, t, e, s) => (pt(a, t, "write to private field"), s ? s.call(a, e) : t.set(a, e), e), f = (a, t, e) => (pt(a, t, "access private method"), e);
8
- var Rt = (a, t, e, s) => ({
6
+ var w = (a, t, e) => Bt(a, typeof t != "symbol" ? t + "" : t, e), wt = (a, t, e) => t.has(a) || $t("Cannot " + e);
7
+ var i = (a, t, e) => (wt(a, t, "read from private field"), e ? e.call(a) : t.get(a)), u = (a, t, e) => t.has(a) ? $t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), d = (a, t, e, s) => (wt(a, t, "write to private field"), s ? s.call(a, e) : t.set(a, e), e), f = (a, t, e) => (wt(a, t, "access private method"), e);
8
+ var _t = (a, t, e, s) => ({
9
9
  set _(n) {
10
10
  d(a, t, n, e);
11
11
  },
@@ -13,9 +13,9 @@ var Rt = (a, t, e, s) => ({
13
13
  return i(a, t, s);
14
14
  }
15
15
  });
16
- import { a as Kt, b as Pt, i as A, I as Ft, c as Ot, d as O, s as _t, e as Qt, f as S, g as I, P as Ut, h as Jt, t as St, j as ct, k as Xt, l as Mt, m as xt, S as Yt, n as Tt, o as Lt, p as Zt, V as te, q as ee, r as se, u as re, v as ne } from "./markup-aCjkIk4X.js";
17
- import { w as Ce, A as De, D as Ie, y as Ve, C as qe, x as Ge, B as We, z as Ae } from "./markup-aCjkIk4X.js";
18
- function Le(a) {
16
+ import { a as Kt, b as Pt, i as H, I as Ft, c as Ot, d as U, s as St, e as Qt, f as M, g as V, h as Jt, t as Mt, j as ht, m as $, k as Xt, l as xt, S as Yt, n as Tt, o as Lt, V as Zt, p as te, q as ee, r as se, u as re } from "./markup-BJffA2Ls.js";
17
+ import { v as je, w as Ce, B as De, x as Ie, C as Ve, y as qe, A as Ge, D as We, z as Ae, E as He } from "./markup-BJffA2Ls.js";
18
+ function Te(a) {
19
19
  return function() {
20
20
  if (arguments.length === 1)
21
21
  a = arguments[0];
@@ -24,25 +24,28 @@ function Le(a) {
24
24
  return a;
25
25
  };
26
26
  }
27
- function B(a) {
27
+ function Ut(a, t) {
28
+ return t.outlet();
29
+ }
30
+ function K(a) {
28
31
  return Pt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((t) => t.trim()).filter((t) => t !== "");
29
32
  }
30
- function H(a) {
33
+ function z(a) {
31
34
  var e;
32
35
  Kt(
33
- (s) => A(s == null ? void 0 : s.toString),
36
+ (s) => H(s == null ? void 0 : s.toString),
34
37
  a,
35
38
  "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
36
39
  ), a = a.filter((s) => s).flatMap(String);
37
40
  let t = (e = a.shift()) == null ? void 0 : e.toString();
38
41
  if (t) {
39
42
  for (const s of a.map((n) => n.toString()))
40
- s.startsWith(".") ? t = ht(t, s) : t[t.length - 1] !== "/" ? s[0] !== "/" ? t += "/" + s : t += s : s[0] === "/" ? t += s.slice(1) : t += s;
43
+ s.startsWith(".") ? t = ut(t, s) : t[t.length - 1] !== "/" ? s[0] !== "/" ? t += "/" + s : t += s : s[0] === "/" ? t += s.slice(1) : t += s;
41
44
  t && t !== "/" && t.endsWith("/") && (t = t.slice(0, t.length - 1));
42
45
  }
43
46
  return t ?? "";
44
47
  }
45
- function ht(a, t) {
48
+ function ut(a, t) {
46
49
  if (Pt(a, "Expected `base` to be a string. Got type: %t, value: %v"), t == null && (t = a, a = ""), t.startsWith("/"))
47
50
  return t;
48
51
  let e = a;
@@ -57,9 +60,9 @@ function ht(a, t) {
57
60
  t = t.replace(/^\.\/?/, "");
58
61
  else
59
62
  break;
60
- return H([e, t]);
63
+ return z([e, t]);
61
64
  }
62
- function ae(a) {
65
+ function ne(a) {
63
66
  if (!a) return {};
64
67
  a.startsWith("?") && (a = a.slice(1));
65
68
  const t = a.split("&").filter((e) => e.trim() !== "").map((e) => {
@@ -70,36 +73,36 @@ function ae(a) {
70
73
  }
71
74
  function jt(a, t, e = {}) {
72
75
  var o;
73
- const [s, n] = t.split("?"), r = B(s);
76
+ const [s, n] = t.split("?"), r = K(s);
74
77
  t: for (const c of a) {
75
78
  const { fragments: l } = c;
76
79
  if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== r.length || e.willMatch && !e.willMatch(c))
77
80
  continue t;
78
81
  const b = [];
79
82
  e: for (let h = 0; h < l.length; h++) {
80
- const M = r[h], k = l[h];
81
- if (M == null && k.type !== 3)
83
+ const x = r[h], E = l[h];
84
+ if (x == null && E.type !== 3)
82
85
  continue t;
83
- switch (k.type) {
86
+ switch (E.type) {
84
87
  case 1:
85
- if (k.name.toLowerCase() === M.toLowerCase()) {
86
- b.push(k);
88
+ if (E.name.toLowerCase() === x.toLowerCase()) {
89
+ b.push(E);
87
90
  break;
88
91
  } else
89
92
  continue t;
90
93
  case 2:
91
- b.push({ ...k, value: M });
94
+ b.push({ ...E, value: x });
92
95
  break;
93
96
  case 3:
94
- b.push({ ...k, value: r.slice(h).join("/") });
97
+ b.push({ ...E, value: r.slice(h).join("/") });
95
98
  break e;
96
99
  case 4:
97
- if (isNaN(Number(M)))
100
+ if (isNaN(Number(x)))
98
101
  continue t;
99
- b.push({ ...k, value: Number(M) });
102
+ b.push({ ...E, value: Number(x) });
100
103
  break;
101
104
  default:
102
- throw new Error(`Unknown fragment type: ${k.type}`);
105
+ throw new Error(`Unknown fragment type: ${E.type}`);
103
106
  }
104
107
  }
105
108
  const v = {};
@@ -109,12 +112,12 @@ function jt(a, t, e = {}) {
109
112
  path: "/" + b.map((h) => h.value).join("/"),
110
113
  pattern: "/" + l.map((h) => h.type === 2 ? `{${h.name}}` : h.type === 4 ? `{#${h.name}}` : h.name).join("/"),
111
114
  params: v,
112
- query: ae(n),
115
+ query: ne(n),
113
116
  meta: c.meta
114
117
  };
115
118
  }
116
119
  }
117
- function ie(a) {
120
+ function ae(a) {
118
121
  const t = [], e = [], s = [], n = [];
119
122
  for (const o of a) {
120
123
  const { fragments: c } = o;
@@ -132,8 +135,8 @@ function ie(a) {
132
135
  const r = (o, c) => o.fragments.length > c.fragments.length ? -1 : 1;
133
136
  return t.sort(r), e.sort(r), s.sort(r), n.sort(r), [...t, ...e, ...s, ...n];
134
137
  }
135
- function oe(a) {
136
- const t = B(a), e = [];
138
+ function ie(a) {
139
+ const t = K(a), e = [];
137
140
  for (let s = 0; s < t.length; s++) {
138
141
  const n = t[s];
139
142
  if (n === "*") {
@@ -156,94 +159,116 @@ function oe(a) {
156
159
  }
157
160
  return e;
158
161
  }
159
- function Ne(a) {
160
- return new he(a);
162
+ const oe = /(noopener|noreferrer) (noopener|noreferrer)/, le = /^[\w-_]+:/;
163
+ function ce(a, t, e = window) {
164
+ function s(r) {
165
+ return !r || r === a ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
166
+ }
167
+ function n(r) {
168
+ if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
169
+ return;
170
+ const o = s(r.target);
171
+ o && (e.location.protocol !== o.protocol || e.location.hostname !== o.hostname || e.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && oe.test(o.getAttribute("rel")) || le.test(o.getAttribute("href")) || (r.preventDefault(), t(o)));
172
+ }
173
+ return a.addEventListener("click", n), function() {
174
+ a.removeEventListener("click", n);
175
+ };
176
+ }
177
+ function he(a, t) {
178
+ for (const e in t) {
179
+ const s = t[e].toString();
180
+ a = a.replace(`{${e}}`, s).replace(`{#${e}}`, s);
181
+ }
182
+ return a;
183
+ }
184
+ function Le(a) {
185
+ return new de(a);
161
186
  }
162
187
  const Ct = Symbol.for("DollaRouterMountMethod"), Dt = Symbol.for("DollaRouterUnmountMethod");
163
- function wt(a) {
188
+ function gt(a) {
164
189
  return (a == null ? void 0 : a[Ft]) === !0;
165
190
  }
166
- async function le(a, t) {
191
+ async function ue(a, t) {
167
192
  return a[Ct](t);
168
193
  }
169
- async function ce(a) {
194
+ async function fe(a) {
170
195
  return a[Dt]();
171
196
  }
172
- var Nt, Q, _, ut, x, q, J, U, j, T, m, It, Vt, qt, z, Gt, gt, yt;
173
- class he {
197
+ var Nt, J, S, ft, T, G, X, j, C, L, m, It, Vt, qt, B, Gt, yt, bt;
198
+ class de {
174
199
  constructor(t) {
175
200
  u(this, m);
176
201
  w(this, Nt, !0);
177
- u(this, Q);
178
- u(this, _);
179
- u(this, ut, 0);
180
- u(this, x, []);
181
- u(this, q, []);
182
- u(this, J, !1);
202
+ u(this, J);
203
+ u(this, S);
204
+ u(this, ft, 0);
205
+ u(this, T, []);
206
+ u(this, G, []);
207
+ u(this, X, !1);
183
208
  /**
184
209
  * Use hash routing when true. Configured in router options.
185
210
  */
186
- u(this, U, !1);
211
+ u(this, j, !1);
187
212
  // Callbacks that need to be called on unmount.
188
- u(this, j, []);
213
+ u(this, C, []);
189
214
  /**
190
215
  * The current match object.
191
216
  */
192
- u(this, T, Ot());
217
+ u(this, L, Ot());
193
218
  /**
194
219
  * The currently matched route pattern, if any.
195
220
  */
196
- w(this, "pattern", O(() => {
221
+ w(this, "pattern", U(() => {
197
222
  var t;
198
- return (t = i(this, T).get()) == null ? void 0 : t.pattern;
223
+ return (t = i(this, L).get()) == null ? void 0 : t.pattern;
199
224
  }));
200
225
  /**
201
226
  * The current URL path.
202
227
  */
203
- w(this, "path", O(() => {
228
+ w(this, "path", U(() => {
204
229
  var t;
205
- return ((t = i(this, T).get()) == null ? void 0 : t.path) ?? window.location.pathname;
230
+ return ((t = i(this, L).get()) == null ? void 0 : t.path) ?? window.location.pathname;
206
231
  }));
207
232
  /**
208
233
  * The current named path params.
209
234
  */
210
- w(this, "params", O(() => {
235
+ w(this, "params", U(() => {
211
236
  var t;
212
- return ((t = i(this, T).get()) == null ? void 0 : t.params) ?? {};
213
- }, { equals: _t }));
237
+ return ((t = i(this, L).get()) == null ? void 0 : t.params) ?? {};
238
+ }, { equals: St }));
214
239
  /**
215
240
  * The current query params. Changes to this object will be reflected in the URL.
216
241
  */
217
- w(this, "query", O(() => {
242
+ w(this, "query", U(() => {
218
243
  var t;
219
- return ((t = i(this, T).get()) == null ? void 0 : t.query) ?? {};
220
- }, { equals: _t }));
221
- Qt(t, "Options must be an object. Got: %t"), t.hash && d(this, U, !0), d(this, q, ie(
222
- t.routes.flatMap((e) => f(this, m, yt).call(this, e)).map((e) => ({
244
+ return ((t = i(this, L).get()) == null ? void 0 : t.query) ?? {};
245
+ }, { equals: St }));
246
+ Qt(t, "Options must be an object. Got: %t"), t.hash && d(this, j, !0), d(this, G, ae(
247
+ t.routes.flatMap((e) => f(this, m, bt).call(this, e)).map((e) => ({
223
248
  pattern: e.pattern,
224
249
  meta: e.meta,
225
- fragments: oe(e.pattern)
250
+ fragments: ie(e.pattern)
226
251
  }))
227
- )), pe(i(this, q));
252
+ )), me(i(this, G));
228
253
  }
229
254
  async [(Nt = Ft, Ct)](t) {
230
- d(this, Q, t), d(this, _, t.createLogger("Dolla.router"));
255
+ d(this, J, t), d(this, S, t.createLogger("Dolla.router"));
231
256
  const e = () => {
232
- f(this, m, z).call(this);
257
+ f(this, m, B).call(this);
233
258
  };
234
- window.addEventListener("popstate", e), i(this, j).push(() => window.removeEventListener("popstate", e));
259
+ window.addEventListener("popstate", e), i(this, C).push(() => window.removeEventListener("popstate", e));
235
260
  const s = t.getRootElement();
236
- i(this, j).push(
237
- de(s, (n) => {
261
+ i(this, C).push(
262
+ ce(s, (n) => {
238
263
  let r = n.getAttribute("href");
239
- i(this, _).info("intercepted click on <a> tag", n), this.go(r);
264
+ i(this, S).info("intercepted click on <a> tag", n), this.go(r);
240
265
  })
241
- ), i(this, _).info("will intercept clicks on <a> tags within root element", s), d(this, J, !0), await f(this, m, z).call(this);
266
+ ), i(this, S).info("will intercept clicks on <a> tags within root element", s), d(this, X, !0), await f(this, m, B).call(this);
242
267
  }
243
268
  async [Dt]() {
244
- for (const t of i(this, j))
269
+ for (const t of i(this, C))
245
270
  t();
246
- d(this, j, []);
271
+ d(this, C, []);
247
272
  }
248
273
  /**
249
274
  * Navigate backward. Pass a number of steps to hit the back button that many times.
@@ -266,20 +291,20 @@ class he {
266
291
  */
267
292
  go(t, e = {}) {
268
293
  let s;
269
- Array.isArray(t) ? s = H(t) : s = t.toString(), s = ht(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, m, Vt).call(this, s) : f(this, m, It).call(this, s);
294
+ Array.isArray(t) ? s = z(t) : s = t.toString(), s = ut(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, m, Vt).call(this, s) : f(this, m, It).call(this, s);
270
295
  }
271
296
  }
272
- Q = new WeakMap(), _ = new WeakMap(), ut = new WeakMap(), x = new WeakMap(), q = new WeakMap(), J = new WeakMap(), U = new WeakMap(), j = new WeakMap(), T = new WeakMap(), m = new WeakSet(), It = function(t, e) {
297
+ J = new WeakMap(), S = new WeakMap(), ft = new WeakMap(), T = new WeakMap(), G = new WeakMap(), X = new WeakMap(), j = new WeakMap(), C = new WeakMap(), L = new WeakMap(), m = new WeakSet(), It = function(t, e) {
273
298
  var s;
274
- (s = i(this, _)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, U) ? "/#" + t : t), f(this, m, z).call(this, t);
299
+ (s = i(this, S)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, j) ? "/#" + t : t), f(this, m, B).call(this, t);
275
300
  }, Vt = function(t, e) {
276
301
  var s;
277
- (s = i(this, _)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, U) ? "/#" + t : t), f(this, m, z).call(this, t);
302
+ (s = i(this, S)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, j) ? "/#" + t : t), f(this, m, B).call(this, t);
278
303
  }, qt = function() {
279
- return i(this, U) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
280
- }, z = async function(t) {
304
+ return i(this, j) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
305
+ }, B = async function(t) {
281
306
  var c;
282
- const e = i(this, _), s = (c = i(this, Q)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, m, qt).call(this), { match: r, journey: o } = await f(this, m, gt).call(this, n);
307
+ const e = i(this, S), s = (c = i(this, J)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, m, qt).call(this), { match: r, journey: o } = await f(this, m, yt).call(this, n);
283
308
  for (const l of o)
284
309
  switch (l.kind) {
285
310
  case "match":
@@ -294,9 +319,9 @@ Q = new WeakMap(), _ = new WeakMap(), ut = new WeakMap(), x = new WeakMap(), q =
294
319
  }
295
320
  if (r) {
296
321
  const l = this.pattern.peek();
297
- i(this, T).set(r), s && r.pattern !== l && f(this, m, Gt).call(this, s, r);
322
+ i(this, L).set(r), s && r.pattern !== l && f(this, m, Gt).call(this, s, r);
298
323
  } else
299
- i(this, J) && e.crash(new we(`Failed to match route '${n.pathname}'`));
324
+ i(this, X) && e.crash(new pe(`Failed to match route '${n.pathname}'`));
300
325
  return { match: r, journey: o };
301
326
  }, /**
302
327
  * Takes a matched route and mounts it.
@@ -304,15 +329,15 @@ Q = new WeakMap(), _ = new WeakMap(), ut = new WeakMap(), x = new WeakMap(), q =
304
329
  Gt = function(t, e) {
305
330
  const s = e.meta.layers;
306
331
  for (let n = 0; n < s.length; n++) {
307
- const r = s[n], o = i(this, x)[n];
332
+ const r = s[n], o = i(this, T)[n];
308
333
  if ((o == null ? void 0 : o.id) !== r.id) {
309
- d(this, x, i(this, x).slice(0, n)), o == null || o.view.unmount();
310
- const c = i(this, x).at(-1), p = ((c == null ? void 0 : c.view) ?? t).setChildView(r.view);
311
- i(this, x).push({ id: r.id, view: p });
334
+ d(this, T, i(this, T).slice(0, n)), o == null || o.view.unmount();
335
+ const c = i(this, T).at(-1), p = ((c == null ? void 0 : c.view) ?? t).setRouteView(r.view);
336
+ i(this, T).push({ id: r.id, view: p });
312
337
  }
313
338
  }
314
- }, gt = async function(t, e = []) {
315
- const s = jt(i(this, q), t.pathname);
339
+ }, yt = async function(t, e = []) {
340
+ const s = jt(i(this, G), t.pathname);
316
341
  if (!s)
317
342
  return {
318
343
  match: null,
@@ -326,21 +351,21 @@ Gt = function(t, e) {
326
351
  }
327
352
  }), n != null) {
328
353
  let r;
329
- if (S(n))
330
- r = me(n, s.params);
331
- else if (A(n)) {
354
+ if (M(n))
355
+ r = he(n, s.params);
356
+ else if (H(n)) {
332
357
  const o = {
333
358
  path: s.path,
334
359
  pattern: s.pattern,
335
360
  params: s.params,
336
361
  query: s.query
337
362
  };
338
- if (r = await n(o), !S(r))
363
+ if (r = await n(o), !M(r))
339
364
  throw new Error("Redirect function must return a path to redirect to.");
340
- r.startsWith("/") || (r = ht(s.path, r));
365
+ r.startsWith("/") || (r = ut(s.path, r));
341
366
  } else
342
367
  throw new TypeError("Redirect must either be a path string or a function.");
343
- return f(this, m, gt).call(this, new URL(r, window.location.origin), [
368
+ return f(this, m, yt).call(this, new URL(r, window.location.origin), [
344
369
  ...e,
345
370
  { kind: "redirect", message: `redirecting '${s.path}' -> '${r}'` }
346
371
  ]);
@@ -352,8 +377,8 @@ Gt = function(t, e) {
352
377
  * @param route - Route config object.
353
378
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
354
379
  */
355
- yt = function(t, e = [], s = []) {
356
- if (!I(t) || !S(t.path))
380
+ bt = function(t, e = [], s = []) {
381
+ if (!V(t) || !M(t.path))
357
382
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
358
383
  if (t.redirect && t.routes)
359
384
  throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
@@ -363,30 +388,30 @@ yt = function(t, e = [], s = []) {
363
388
  throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
364
389
  let n = [];
365
390
  for (const l of e)
366
- n.push(...B(l.path));
367
- n.push(...B(t.path)), n[n.length - 1] === "*" && n.pop();
391
+ n.push(...K(l.path));
392
+ n.push(...K(t.path)), n[n.length - 1] === "*" && n.pop();
368
393
  const r = [];
369
394
  if (t.redirect) {
370
395
  let l = t.redirect;
371
- return S(l) && (l = ht(H(n), l), l.startsWith("/") || (l = "/" + l)), r.push({
372
- pattern: "/" + H([...n, ...B(t.path)]),
396
+ return M(l) && (l = ut(z(n), l), l.startsWith("/") || (l = "/" + l)), r.push({
397
+ pattern: "/" + z([...n, ...K(t.path)]),
373
398
  meta: {
374
399
  redirect: l
375
400
  }
376
401
  }), r;
377
402
  }
378
403
  let o = Ut;
379
- if (A(t.view))
404
+ if (H(t.view))
380
405
  o = t.view;
381
406
  else if (t.view)
382
407
  throw new TypeError(`Route '${t.path}' expected a view function or undefined. Got: ${t.view}`);
383
- const c = { id: Rt(this, ut)._++, view: o };
408
+ const c = { id: _t(this, ft)._++, view: o };
384
409
  if (t.routes)
385
410
  for (const l of t.routes)
386
- r.push(...f(this, m, yt).call(this, l, [...e, t], [...s, c]));
411
+ r.push(...f(this, m, bt).call(this, l, [...e, t], [...s, c]));
387
412
  else
388
413
  r.push({
389
- pattern: parent ? H([...e.map((l) => l.path), t.path]) : t.path,
414
+ pattern: parent ? z([...e.map((l) => l.path), t.path]) : t.path,
390
415
  meta: {
391
416
  pattern: t.path,
392
417
  layers: [...s, c],
@@ -395,33 +420,11 @@ yt = function(t, e = [], s = []) {
395
420
  });
396
421
  return r;
397
422
  };
398
- const ue = /(noopener|noreferrer) (noopener|noreferrer)/, fe = /^[\w-_]+:/;
399
- function de(a, t, e = window) {
400
- function s(r) {
401
- return !r || r === a ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
402
- }
403
- function n(r) {
404
- if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
405
- return;
406
- const o = s(r.target);
407
- o && (e.location.protocol !== o.protocol || e.location.hostname !== o.hostname || e.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && ue.test(o.getAttribute("rel")) || fe.test(o.getAttribute("href")) || (r.preventDefault(), t(o)));
408
- }
409
- return a.addEventListener("click", n), function() {
410
- a.removeEventListener("click", n);
411
- };
412
- }
413
- function me(a, t) {
414
- for (const e in t) {
415
- const s = t[e].toString();
416
- a = a.replace(`{${e}}`, s).replace(`{#${e}}`, s);
417
- }
418
- return a;
419
- }
420
- function pe(a) {
423
+ function me(a) {
421
424
  for (const t of a)
422
425
  if (t.meta.redirect) {
423
426
  let e;
424
- if (!A(t.meta.redirect)) if (S(t.meta.redirect)) {
427
+ if (!H(t.meta.redirect)) if (M(t.meta.redirect)) {
425
428
  if (e = t.meta.redirect, !jt(a, e, {
426
429
  willMatch(n) {
427
430
  return n !== t;
@@ -432,14 +435,14 @@ function pe(a) {
432
435
  throw new TypeError(`Expected a string or redirect function. Got: ${t.meta.redirect}`);
433
436
  }
434
437
  }
435
- class we extends Error {
438
+ class pe extends Error {
436
439
  }
437
- var C, ft, E, R;
438
- class ge {
440
+ var D, dt, k, _;
441
+ class we {
439
442
  constructor() {
440
- u(this, E);
441
- u(this, C, []);
442
- u(this, ft, ye());
443
+ u(this, k);
444
+ u(this, D, []);
445
+ u(this, dt, ge());
443
446
  }
444
447
  /**
445
448
  * Adds a new middleware that will apply to subsequent requests.
@@ -448,52 +451,52 @@ class ge {
448
451
  * @param middleware - A middleware function that will intercept requests.
449
452
  */
450
453
  use(t) {
451
- return i(this, C).push(t), () => {
452
- i(this, C).splice(i(this, C).indexOf(t), 1);
454
+ return i(this, D).push(t), () => {
455
+ i(this, D).splice(i(this, D).indexOf(t), 1);
453
456
  };
454
457
  }
455
458
  async get(t, e) {
456
- return f(this, E, R).call(this, "get", t, e);
459
+ return f(this, k, _).call(this, "get", t, e);
457
460
  }
458
461
  async put(t, e) {
459
- return f(this, E, R).call(this, "put", t, e);
462
+ return f(this, k, _).call(this, "put", t, e);
460
463
  }
461
464
  async patch(t, e) {
462
- return f(this, E, R).call(this, "patch", t, e);
465
+ return f(this, k, _).call(this, "patch", t, e);
463
466
  }
464
467
  async post(t, e) {
465
- return f(this, E, R).call(this, "post", t, e);
468
+ return f(this, k, _).call(this, "post", t, e);
466
469
  }
467
470
  async delete(t, e) {
468
- return f(this, E, R).call(this, "delete", t, e);
471
+ return f(this, k, _).call(this, "delete", t, e);
469
472
  }
470
473
  async head(t, e) {
471
- return f(this, E, R).call(this, "head", t, e);
474
+ return f(this, k, _).call(this, "head", t, e);
472
475
  }
473
476
  async options(t, e) {
474
- return f(this, E, R).call(this, "options", t, e);
477
+ return f(this, k, _).call(this, "options", t, e);
475
478
  }
476
479
  async trace(t, e) {
477
- return f(this, E, R).call(this, "trace", t, e);
480
+ return f(this, k, _).call(this, "trace", t, e);
478
481
  }
479
482
  }
480
- C = new WeakMap(), ft = new WeakMap(), E = new WeakSet(), R = async function(t, e, s) {
481
- return new ke({
483
+ D = new WeakMap(), dt = new WeakMap(), k = new WeakSet(), _ = async function(t, e, s) {
484
+ return new ve({
482
485
  ...s,
483
486
  method: t,
484
487
  uri: e,
485
- middleware: i(this, C),
486
- fetch: i(this, ft)
488
+ middleware: i(this, D),
489
+ fetch: i(this, dt)
487
490
  }).fetch();
488
491
  };
489
- function ye() {
492
+ function ge() {
490
493
  if (typeof window < "u" && window.fetch)
491
494
  return window.fetch.bind(window);
492
495
  if (typeof global < "u" && global.fetch)
493
496
  return global.fetch.bind(global);
494
497
  throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
495
498
  }
496
- class be extends Error {
499
+ class ye extends Error {
497
500
  constructor(e) {
498
501
  const { status: s, statusText: n, method: r, url: o } = e, c = `${s} ${n}: Request failed (${r.toUpperCase()} ${o.toString()})`;
499
502
  super(c);
@@ -501,7 +504,7 @@ class be extends Error {
501
504
  this.response = e;
502
505
  }
503
506
  }
504
- class ve {
507
+ class be {
505
508
  constructor(t) {
506
509
  w(this, "method");
507
510
  w(this, "url");
@@ -518,7 +521,7 @@ class ve {
518
521
  t.forEach((e, s) => {
519
522
  this.headers.set(s, e);
520
523
  });
521
- else if (I(t))
524
+ else if (V(t))
522
525
  for (const e in t) {
523
526
  const s = t[e];
524
527
  s instanceof Date ? this.headers.set(e, s.toISOString()) : s != null && this.headers.set(e, String(s));
@@ -532,7 +535,7 @@ class ve {
532
535
  t.forEach((e, s) => {
533
536
  this.url.searchParams.set(s, e);
534
537
  });
535
- else if (I(t))
538
+ else if (V(t))
536
539
  for (const e in t) {
537
540
  const s = t[e];
538
541
  s instanceof Date ? this.url.searchParams.set(e, s.toISOString()) : s != null && this.url.searchParams.set(e, String(s));
@@ -541,13 +544,13 @@ class ve {
541
544
  throw new TypeError(`Unknown query params type. Got: ${t}`);
542
545
  }
543
546
  }
544
- class ke {
547
+ class ve {
545
548
  constructor(t) {
546
549
  w(this, "_middleware");
547
550
  w(this, "_fetch");
548
551
  w(this, "_request");
549
552
  w(this, "_response");
550
- this._middleware = t.middleware, this._fetch = t.fetch, this._request = new ve(t);
553
+ this._middleware = t.middleware, this._fetch = t.fetch, this._request = new be(t);
551
554
  }
552
555
  async fetch() {
553
556
  if (this._middleware.length > 0) {
@@ -559,14 +562,14 @@ class ke {
559
562
  } else
560
563
  await this._handler();
561
564
  if (this._response.status < 200 || this._response.status >= 400)
562
- throw new be(this._response);
565
+ throw new ye(this._response);
563
566
  return this._response;
564
567
  }
565
568
  // This is the function that performs the actual request after the final middleware.
566
569
  async _handler() {
567
570
  let t;
568
571
  const e = this._request;
569
- !e.headers.has("content-type") && I(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
572
+ !e.headers.has("content-type") && V(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
570
573
  const s = await this._fetch(e.url.toString(), {
571
574
  method: e.method,
572
575
  headers: e.headers,
@@ -583,29 +586,29 @@ class ke {
583
586
  };
584
587
  }
585
588
  }
586
- var dt, G, V, bt, Wt;
589
+ var mt, W, q, vt, Wt;
587
590
  class Ee {
588
591
  constructor(t, e) {
589
- u(this, V);
592
+ u(this, q);
590
593
  w(this, "dolla");
591
594
  w(this, "config");
592
- u(this, dt, !1);
593
- u(this, G, /* @__PURE__ */ new Map());
595
+ u(this, mt, !1);
596
+ u(this, W, /* @__PURE__ */ new Map());
594
597
  this.config = t, this.dolla = e;
595
598
  }
596
599
  async load() {
597
600
  let t;
598
- if (!i(this, dt)) {
599
- if (I(this.config.strings))
601
+ if (!i(this, mt)) {
602
+ if (V(this.config.strings))
600
603
  t = this.config.strings;
601
- else if (A(this.config.fetch)) {
602
- if (t = await this.config.fetch(), !I(t))
604
+ else if (H(this.config.fetch)) {
605
+ if (t = await this.config.fetch(), !V(t))
603
606
  throw new Error(`Fetch function did not return an object of language strings: ${t}`);
604
- } else if (S(this.config.path)) {
607
+ } else if (M(this.config.path)) {
605
608
  const e = await fetch(this.config.path);
606
609
  if (e.ok) {
607
610
  const s = await e.json();
608
- if (I(s))
611
+ if (V(s))
609
612
  t = s;
610
613
  else
611
614
  throw new Error(
@@ -616,34 +619,34 @@ class Ee {
616
619
  }
617
620
  }
618
621
  if (t) {
619
- const e = f(this, V, bt).call(this, t);
622
+ const e = f(this, q, vt).call(this, t);
620
623
  for (const s of e)
621
- i(this, G).set(s[0], s[1]);
624
+ i(this, W).set(s[0], s[1]);
622
625
  } else
623
626
  throw new Error("Language could not be loaded.");
624
627
  }
625
628
  getTemplate(t) {
626
- return i(this, G).get(t) ?? {
629
+ return i(this, W).get(t) ?? {
627
630
  segments: [{ type: 0, text: `[MISSING: ${t}]` }]
628
631
  };
629
632
  }
630
633
  hasTemplate(t) {
631
- return i(this, G).has(t);
634
+ return i(this, W).has(t);
632
635
  }
633
636
  }
634
- dt = new WeakMap(), G = new WeakMap(), V = new WeakSet(), bt = function(t, e = []) {
637
+ mt = new WeakMap(), W = new WeakMap(), q = new WeakSet(), vt = function(t, e = []) {
635
638
  const s = [];
636
639
  for (const n in t)
637
- switch (St(t[n])) {
640
+ switch (Mt(t[n])) {
638
641
  case "string":
639
- s.push([[...e, n].join("."), f(this, V, Wt).call(this, t[n])]);
642
+ s.push([[...e, n].join("."), f(this, q, Wt).call(this, t[n])]);
640
643
  break;
641
644
  case "object":
642
- s.push(...f(this, V, bt).call(this, t[n], [...e, n]));
645
+ s.push(...f(this, q, vt).call(this, t[n], [...e, n]));
643
646
  break;
644
647
  default:
645
648
  throw new Error(
646
- `Expected to find a string or object at ${[...e, n].join(".")}. Got: ${St(t[n])}`
649
+ `Expected to find a string or object at ${[...e, n].join(".")}. Got: ${Mt(t[n])}`
647
650
  );
648
651
  }
649
652
  return s;
@@ -696,36 +699,36 @@ dt = new WeakMap(), G = new WeakMap(), V = new WeakSet(), bt = function(t, e = [
696
699
  }
697
700
  return o === 0 && n.length > 0 && s.segments.push({ type: 0, text: n }), s;
698
701
  };
699
- var X, L, g, Y, Z, tt, $, y, At, vt, kt, Et, Ht;
700
- class $e {
702
+ var Y, N, g, Z, tt, et, R, y, At, Et, kt, Rt, Ht;
703
+ class ke {
701
704
  constructor(t) {
702
705
  u(this, y);
703
- u(this, X);
704
- u(this, L);
706
+ u(this, Y);
707
+ u(this, N);
705
708
  u(this, g, /* @__PURE__ */ new Map());
706
- u(this, Y, []);
707
- u(this, Z, /* @__PURE__ */ new Map());
708
- u(this, tt, "auto");
709
- u(this, $, Ot(""));
710
- d(this, X, t), d(this, L, t.createLogger("Dolla.i18n")), this.addFormat("number", (e, s, n) => f(this, y, vt).call(this, Number(s), n)), this.addFormat("datetime", (e, s, n) => f(this, y, kt).call(this, s, n)), this.addFormat("list", (e, s, n) => f(this, y, Et).call(this, s, n)), t.beforeMount(async () => {
711
- i(this, g).size > 0 && await this.setLocale(i(this, tt));
709
+ u(this, Z, []);
710
+ u(this, tt, /* @__PURE__ */ new Map());
711
+ u(this, et, "auto");
712
+ u(this, R, Ot(""));
713
+ d(this, Y, t), d(this, N, t.createLogger("Dolla.i18n")), this.addFormat("number", (e, s, n) => f(this, y, Et).call(this, Number(s), n)), this.addFormat("datetime", (e, s, n) => f(this, y, kt).call(this, s, n)), this.addFormat("list", (e, s, n) => f(this, y, Rt).call(this, s, n)), t.beforeMount(async () => {
714
+ i(this, g).size > 0 && await this.setLocale(i(this, et));
712
715
  });
713
716
  }
714
717
  get locale() {
715
- return i(this, $);
718
+ return i(this, R);
716
719
  }
717
720
  get locales() {
718
721
  return [...i(this, g).keys()];
719
722
  }
720
723
  setup(t) {
721
724
  if (t.translations.forEach((e) => {
722
- i(this, g).set(e.locale, new Ee(e, i(this, X)));
725
+ i(this, g).set(e.locale, new Ee(e, i(this, Y)));
723
726
  }), t.locale && t.locale !== "auto") {
724
727
  if (!t.translations.some((s) => s.locale === t.locale))
725
728
  throw new Error(`Initial locale '${t.locale}' is not registered in the locales array.`);
726
- d(this, tt, t.locale);
729
+ d(this, et, t.locale);
727
730
  }
728
- i(this, L).info(
731
+ i(this, N).info(
729
732
  `${i(this, g).size} language${i(this, g).size === 1 ? "" : "s"} supported: '${[...i(this, g).keys()].join("', '")}'`
730
733
  );
731
734
  }
@@ -750,9 +753,9 @@ class $e {
750
753
  throw new Error(`Locale '${t}' has no translation.`);
751
754
  const s = i(this, g).get(e);
752
755
  try {
753
- await s.load(), d(this, Y, []), i(this, $).set(e), i(this, L).info("set language to " + e);
756
+ await s.load(), d(this, Z, []), i(this, R).set(e), i(this, N).info("set language to " + e);
754
757
  } catch (r) {
755
- r instanceof Error && i(this, L).crash(r);
758
+ r instanceof Error && i(this, N).crash(r);
756
759
  }
757
760
  }
758
761
  /**
@@ -769,11 +772,11 @@ class $e {
769
772
  throw new Error(
770
773
  `The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
771
774
  );
772
- return O(() => {
775
+ return U(() => {
773
776
  const s = {};
774
777
  for (const n in e)
775
- s[n] = ct(e[n]);
776
- return f(this, y, At).call(this, i(this, $).get(), t, s);
778
+ s[n] = ht(e[n]);
779
+ return f(this, y, At).call(this, i(this, R).get(), t, s);
777
780
  });
778
781
  }
779
782
  /**
@@ -791,7 +794,7 @@ class $e {
791
794
  * t("greeting", {name: "world"}); // State<"Hello, WORLD!">
792
795
  */
793
796
  addFormat(t, e) {
794
- i(this, Z).set(t, e);
797
+ i(this, tt).set(t, e);
795
798
  }
796
799
  /**
797
800
  * Creates an `Intl.Collator` configured for the current locale.
@@ -800,7 +803,7 @@ class $e {
800
803
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
801
804
  */
802
805
  collator(t) {
803
- return new Intl.Collator(i(this, $).get(), t);
806
+ return new Intl.Collator(i(this, R).get(), t);
804
807
  }
805
808
  /**
806
809
  * Formats a number for the current locale. Uses `Intl.NumberFormat` under the hood.
@@ -808,7 +811,7 @@ class $e {
808
811
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
809
812
  */
810
813
  number(t, e) {
811
- return O(() => f(this, y, vt).call(this, ct(t), e));
814
+ return U(() => f(this, y, Et).call(this, ht(t), e));
812
815
  }
813
816
  /**
814
817
  * Formats a date for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -820,7 +823,7 @@ class $e {
820
823
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
821
824
  */
822
825
  dateTime(t, e) {
823
- return O(() => f(this, y, kt).call(this, ct(t), e));
826
+ return U(() => f(this, y, kt).call(this, ht(t), e));
824
827
  }
825
828
  /**
826
829
  * Formats a list for the current locale. Uses `Intl.ListFormat` under the hood.
@@ -832,10 +835,10 @@ class $e {
832
835
  * const $formatted = Dolla.i18n.list(list, { });
833
836
  */
834
837
  list(t, e) {
835
- return O(() => f(this, y, Et).call(this, ct(t), e));
838
+ return U(() => f(this, y, Rt).call(this, ht(t), e));
836
839
  }
837
840
  }
838
- X = new WeakMap(), L = new WeakMap(), g = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), $ = new WeakMap(), y = new WeakSet(), At = function(t, e, s) {
841
+ Y = new WeakMap(), N = new WeakMap(), g = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), R = new WeakMap(), y = new WeakSet(), At = function(t, e, s) {
839
842
  var l;
840
843
  const n = f(this, y, Ht).call(this, e, s);
841
844
  if (n) return n;
@@ -858,28 +861,28 @@ X = new WeakMap(), L = new WeakMap(), g = new WeakMap(), Y = new WeakMap(), Z =
858
861
  const v = ((l = s.formatOverrides) == null ? void 0 : l[p.name]) ?? [...p.formats];
859
862
  p.name === "count" && v.length === 0 && v.push({ name: "number", options: {} });
860
863
  for (const h of v) {
861
- const M = i(this, Z).get(h.name);
862
- if (M == null) {
863
- const k = new Error(
864
+ const x = i(this, tt).get(h.name);
865
+ if (x == null) {
866
+ const E = new Error(
864
867
  `Failed to load format '${h.name}' when processing '${e}', template: ${o}`
865
868
  );
866
- throw i(this, L).crash(k), k;
869
+ throw i(this, N).crash(E), E;
867
870
  }
868
- b = M(t, b, h.options);
871
+ b = x(t, b, h.options);
869
872
  }
870
873
  c += b;
871
874
  }
872
875
  return c;
873
- }, vt = function(t, e) {
874
- return new Intl.NumberFormat(i(this, $).get(), e).format(t);
875
- }, kt = function(t, e) {
876
- return new Intl.DateTimeFormat(i(this, $).get(), e).format(S(t) ? new Date(t) : t);
877
876
  }, Et = function(t, e) {
878
- return new Intl.ListFormat(i(this, $).get(), e).format(t);
877
+ return new Intl.NumberFormat(i(this, R).get(), e).format(t);
878
+ }, kt = function(t, e) {
879
+ return new Intl.DateTimeFormat(i(this, R).get(), e).format(M(t) ? new Date(t) : t);
880
+ }, Rt = function(t, e) {
881
+ return new Intl.ListFormat(i(this, R).get(), e).format(t);
879
882
  }, // relativeTime(): State<string> {
880
883
  // }
881
884
  Ht = function(t, e) {
882
- for (const s of i(this, Y))
885
+ for (const s of i(this, Z))
883
886
  if (s[0] === t && Jt(s[1], e))
884
887
  return s[2];
885
888
  };
@@ -892,128 +895,133 @@ function Re(a, t) {
892
895
  }
893
896
  return s;
894
897
  }
895
- function _e(a) {
896
- return Mt`
897
- <div
898
- style=${{
899
- backgroundColor: "#880000",
900
- color: "#fff",
901
- padding: "2rem",
902
- position: "fixed",
903
- inset: 0,
904
- fontSize: "20px"
905
- }}
906
- >
907
- <h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
908
- <p style=${{ marginBottom: "0.25rem" }}>
909
- <span style=${{ fontFamily: "monospace" }}>${a.loggerName}</span>
910
- ${Xt(a.uid, Mt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
911
- ${" "}says:
912
- </p>
913
- <blockquote
914
- style=${{
915
- backgroundColor: "#991111",
916
- padding: "0.25em",
917
- borderRadius: "6px",
918
- fontFamily: "monospace",
919
- marginBottom: "1rem"
920
- }}
921
- >
922
- <span
923
- style=${{
924
- display: "inline-block",
925
- backgroundColor: "red",
926
- padding: "0.1em 0.4em",
927
- marginRight: "0.5em",
928
- borderRadius: "4px",
929
- fontSize: "0.9em",
930
- fontWeight: "bold"
931
- }}
932
- >
933
- ${a.error.name}
934
- </span>
935
- ${a.error.message}
936
- </blockquote>
937
-
938
- <p>Please see the browser console for details.</p>
939
- </div>
940
- `;
898
+ function $e(a) {
899
+ return $(
900
+ "div",
901
+ {
902
+ style: {
903
+ backgroundColor: "#880000",
904
+ color: "#fff",
905
+ padding: "2rem",
906
+ position: "fixed",
907
+ inset: 0,
908
+ fontSize: "20px"
909
+ }
910
+ },
911
+ $("h1", { style: { marginBottom: "0.5rem" } }, "The app has crashed"),
912
+ $(
913
+ "p",
914
+ { style: { marginBottom: "0.25rem" } },
915
+ $("span", { style: { fontFamily: "monospace" } }, a.loggerName),
916
+ Xt(a.uid, $("span", { style: { fontFamily: "monospace", opacity: 0.5 } }, ` [uid: ${a.uid}]`)),
917
+ " says:"
918
+ ),
919
+ $(
920
+ "blockquote",
921
+ {
922
+ style: {
923
+ backgroundColor: "#991111",
924
+ padding: "0.25em",
925
+ borderRadius: "6px",
926
+ fontFamily: "monospace",
927
+ marginBottom: "1rem"
928
+ }
929
+ },
930
+ $(
931
+ "span",
932
+ {
933
+ style: {
934
+ display: "inline-block",
935
+ backgroundColor: "red",
936
+ padding: "0.1em 0.4em",
937
+ marginRight: "0.5em",
938
+ borderRadius: "4px",
939
+ fontSize: "0.9em",
940
+ fontWeight: "bold"
941
+ }
942
+ },
943
+ a.error.name
944
+ ),
945
+ a.error.message
946
+ ),
947
+ $("p", {}, "Please see the browser console for details.")
948
+ );
941
949
  }
942
- var N, et, P, D, st, W, rt, nt, at, it, F, ot, lt, mt;
943
- class Se {
950
+ var P, st, F, I, rt, A, nt, at, it, ot, O, lt, ct, pt;
951
+ class _e {
944
952
  constructor() {
945
953
  // TODO: Take these off the global Dolla object.
946
954
  w(this, "http");
947
955
  w(this, "i18n");
948
- u(this, N, !1);
949
- u(this, et, "production");
950
- u(this, P);
951
- u(this, D);
952
- u(this, st, _e);
953
- u(this, W);
954
- u(this, rt, []);
956
+ u(this, P, !1);
957
+ u(this, st, "production");
958
+ u(this, F);
959
+ u(this, I);
960
+ u(this, rt, $e);
961
+ u(this, A);
955
962
  u(this, nt, []);
956
963
  u(this, at, []);
957
964
  u(this, it, []);
958
- u(this, F, {
965
+ u(this, ot, []);
966
+ u(this, O, {
959
967
  root: this,
960
968
  stores: /* @__PURE__ */ new Map(),
961
969
  viewName: "Dolla"
962
970
  });
963
- u(this, ot, {
971
+ u(this, lt, {
964
972
  info: "development",
965
973
  log: "development",
966
974
  warn: "development",
967
975
  error: !0
968
976
  });
969
- u(this, lt, xt("*,-Dolla.*"));
977
+ u(this, ct, xt("*,-Dolla.*"));
970
978
  // Registration functions for modules.
971
979
  // All modules will be registered before mount.
972
- u(this, mt, []);
973
- this.http = new ge(), this.i18n = new $e(this);
980
+ u(this, pt, []);
981
+ this.http = new we(), this.i18n = new ke(this);
974
982
  }
975
983
  /**
976
984
  * True when the app is connected to a DOM node and displayed to the user.
977
985
  */
978
986
  get isMounted() {
979
- return i(this, N);
987
+ return i(this, P);
980
988
  }
981
989
  /**
982
990
  * Get the current environment that this app is running in.
983
991
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
984
992
  */
985
993
  getEnv() {
986
- return i(this, et);
994
+ return i(this, st);
987
995
  }
988
996
  /**
989
997
  * Sets the environment that this app is running in.
990
998
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
991
999
  */
992
1000
  setEnv(t) {
993
- d(this, et, t);
1001
+ d(this, st, t);
994
1002
  }
995
1003
  /**
996
1004
  * Sets the view that will be shown when the `crash` method is called on any logger.
997
1005
  * When a crash is reported the app will be unmounted and replaced with this crash page.
998
1006
  */
999
1007
  setCrashView(t) {
1000
- d(this, st, t);
1008
+ d(this, rt, t);
1001
1009
  }
1002
1010
  /**
1003
1011
  * Returns the HTMLElement Dolla is mounted to. This will return undefined until Dolla.mount() is called.
1004
1012
  */
1005
1013
  getRootElement() {
1006
- return i(this, P);
1014
+ return i(this, F);
1007
1015
  }
1008
1016
  /**
1009
1017
  * Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
1010
1018
  */
1011
1019
  getRootView() {
1012
- return i(this, D);
1020
+ return i(this, I);
1013
1021
  }
1014
1022
  provide(t, e) {
1015
1023
  const s = new Yt(t, e);
1016
- if (s.attach(i(this, F)))
1024
+ if (s.attach(i(this, O)))
1017
1025
  return s.value;
1018
1026
  {
1019
1027
  let r = t.name ? `'${t.name}'` : "this store";
@@ -1024,8 +1032,8 @@ class Se {
1024
1032
  * Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
1025
1033
  */
1026
1034
  get(t) {
1027
- if (A(t)) {
1028
- const e = i(this, F).stores.get(t);
1035
+ if (H(t)) {
1036
+ const e = i(this, O).stores.get(t);
1029
1037
  if (e == null)
1030
1038
  throw new Tt("Store not found on this context.");
1031
1039
  return e.value;
@@ -1033,26 +1041,26 @@ class Se {
1033
1041
  throw new Tt("Invalid store.");
1034
1042
  }
1035
1043
  async mount(t, e) {
1036
- if (i(this, N))
1044
+ if (i(this, P))
1037
1045
  throw new Error("Dolla is already mounted.");
1038
- if (S(t)) {
1046
+ if (M(t)) {
1039
1047
  const r = document.querySelector(t);
1040
- Lt(HTMLElement, r, `Selector '${t}' did not match any element.`), d(this, P, r);
1048
+ Lt(HTMLElement, r, `Selector '${t}' did not match any element.`), d(this, F, r);
1041
1049
  } else
1042
- Lt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), d(this, P, t);
1043
- wt(e) && d(this, W, e);
1044
- const s = wt(e) ? Ut : e, n = Zt(s);
1045
- d(this, D, this.constructView(n.type, n.props)), await Promise.all(i(this, mt).map((r) => r())), wt(e) && await le(e, this), await Promise.all(i(this, rt).map((r) => r())), i(this, D).mount(i(this, P)), d(this, N, !0);
1046
- for (const r of i(this, F).stores.values())
1050
+ Lt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), d(this, F, t);
1051
+ gt(e) && d(this, A, e);
1052
+ const s = gt(e) ? Ut : e, n = $(s);
1053
+ d(this, I, this.constructView(n.type, n.props)), await Promise.all(i(this, pt).map((r) => r())), gt(e) && await ue(e, this), await Promise.all(i(this, nt).map((r) => r())), i(this, I).mount(i(this, F)), d(this, P, !0);
1054
+ for (const r of i(this, O).stores.values())
1047
1055
  r.handleMount();
1048
- for (const r of i(this, nt))
1056
+ for (const r of i(this, at))
1049
1057
  r();
1050
1058
  }
1051
1059
  async unmount() {
1052
1060
  var t;
1053
- if (i(this, N)) {
1054
- await Promise.all(i(this, at).map((e) => e())), (t = i(this, D)) == null || t.unmount(!1), i(this, W) && await ce(i(this, W)), d(this, N, !1);
1055
- for (const e of i(this, it))
1061
+ if (i(this, P)) {
1062
+ await Promise.all(i(this, it).map((e) => e())), (t = i(this, I)) == null || t.unmount(!1), i(this, A) && await fe(i(this, A)), d(this, P, !1);
1063
+ for (const e of i(this, ot))
1056
1064
  e();
1057
1065
  }
1058
1066
  }
@@ -1061,26 +1069,26 @@ class Se {
1061
1069
  * it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
1062
1070
  */
1063
1071
  beforeMount(t) {
1064
- i(this, rt).push(t);
1072
+ i(this, nt).push(t);
1065
1073
  }
1066
1074
  /**
1067
1075
  * Registers a `callback` to run after the app is mounted.
1068
1076
  */
1069
1077
  onMount(t) {
1070
- i(this, nt).push(t);
1078
+ i(this, at).push(t);
1071
1079
  }
1072
1080
  /**
1073
1081
  * Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
1074
1082
  * it will be awaited before unmounting finishes. Use this to perform cleanup.
1075
1083
  */
1076
1084
  beforeUnmount(t) {
1077
- i(this, at).push(t);
1085
+ i(this, it).push(t);
1078
1086
  }
1079
1087
  /**
1080
1088
  * Registers a `callback` to run after the app is unmounted.
1081
1089
  */
1082
1090
  onUnmount(t) {
1083
- i(this, it).push(t);
1091
+ i(this, ot).push(t);
1084
1092
  }
1085
1093
  /**
1086
1094
  * Update log type toggles. Values that are not passed will remain unchanged.
@@ -1088,22 +1096,22 @@ class Se {
1088
1096
  setLoggles(t) {
1089
1097
  for (const e in t) {
1090
1098
  const s = t[e];
1091
- s && (i(this, ot)[e] = s);
1099
+ s && (i(this, lt)[e] = s);
1092
1100
  }
1093
1101
  }
1094
1102
  setLogFilter(t) {
1095
- d(this, lt, xt(t));
1103
+ d(this, ct, xt(t));
1096
1104
  }
1097
1105
  createLogger(t, e) {
1098
- const s = (e == null ? void 0 : e.console) ?? Me(), n = this, r = i(this, ot), o = (c) => {
1099
- if (r[c] === !1 || S(r[c]) && r[c] !== n.getEnv() || !i(this, lt).call(this, t))
1100
- return re;
1106
+ const s = (e == null ? void 0 : e.console) ?? Se(), n = this, r = i(this, lt), o = (c) => {
1107
+ if (r[c] === !1 || M(r[c]) && r[c] !== n.getEnv() || !i(this, ct).call(this, t))
1108
+ return se;
1101
1109
  {
1102
1110
  let l = `%c${t}`;
1103
1111
  return e != null && e.uid ? l += ` %c[uid: %c${e.uid}%c]` : l += "%c%c%c", s[c].bind(
1104
1112
  s,
1105
1113
  l,
1106
- `color:${ne(l)};font-weight:bold`,
1114
+ `color:${re(l)};font-weight:bold`,
1107
1115
  "color:#777",
1108
1116
  "color:#aaa",
1109
1117
  "color:#777"
@@ -1127,11 +1135,11 @@ class Se {
1127
1135
  return o("error");
1128
1136
  },
1129
1137
  crash(c) {
1130
- n.isMounted && (n.unmount(), n.constructView(i(n, st), {
1138
+ n.isMounted && (n.unmount(), n.constructView(i(n, rt), {
1131
1139
  error: c,
1132
1140
  loggerName: t,
1133
1141
  uid: e == null ? void 0 : e.uid
1134
- }).mount(i(n, P)));
1142
+ }).mount(i(n, F)));
1135
1143
  }
1136
1144
  };
1137
1145
  }
@@ -1139,45 +1147,46 @@ class Se {
1139
1147
  *
1140
1148
  */
1141
1149
  constructView(t, e, s = []) {
1142
- return new te(i(this, F), t, e, s);
1150
+ return new Zt(i(this, O), t, e, s);
1143
1151
  }
1144
1152
  /**
1145
1153
  *
1146
1154
  */
1147
1155
  constructMarkup(t) {
1148
- return ee(se(i(this, F), t));
1156
+ return te(ee(i(this, O), t));
1149
1157
  }
1150
1158
  }
1151
- N = new WeakMap(), et = new WeakMap(), P = new WeakMap(), D = new WeakMap(), st = new WeakMap(), W = new WeakMap(), rt = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), it = new WeakMap(), F = new WeakMap(), ot = new WeakMap(), lt = new WeakMap(), mt = new WeakMap();
1152
- function Me() {
1159
+ P = new WeakMap(), st = new WeakMap(), F = new WeakMap(), I = new WeakMap(), rt = new WeakMap(), A = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), O = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), pt = new WeakMap();
1160
+ function Se() {
1153
1161
  if (typeof window < "u" && window.console)
1154
1162
  return window.console;
1155
1163
  if (typeof global < "u" && global.console)
1156
1164
  return global.console;
1157
1165
  }
1158
- const K = new Se(), Pe = K.i18n.t.bind(K.i18n), Fe = K.http, Oe = K.createLogger.bind(K);
1166
+ const Q = new _e(), Ne = Q.i18n.t.bind(Q.i18n), Pe = Q.http, Fe = Q.createLogger.bind(Q);
1159
1167
  export {
1160
1168
  Ot as atom,
1161
- O as compose,
1169
+ U as compose,
1162
1170
  Xt as cond,
1163
- Oe as createLogger,
1164
- Zt as createMarkup,
1165
- Ne as createRouter,
1171
+ Fe as createLogger,
1172
+ Le as createRouter,
1166
1173
  Jt as deepEqual,
1167
- K as default,
1168
- Ce as effect,
1169
- ct as get,
1170
- De as getTracked,
1171
- Mt as html,
1172
- Fe as http,
1173
- Ie as list,
1174
- Ve as peek,
1175
- qe as portal,
1176
- Le as ref,
1177
- Ge as set,
1178
- _t as shallowEqual,
1179
- We as strictEqual,
1180
- Pe as t,
1181
- Ae as untrack
1174
+ Q as default,
1175
+ je as effect,
1176
+ ht as get,
1177
+ Ce as getTracked,
1178
+ Pe as http,
1179
+ De as list,
1180
+ $ as markup,
1181
+ Ie as peek,
1182
+ Ve as portal,
1183
+ Te as ref,
1184
+ qe as set,
1185
+ St as shallowEqual,
1186
+ Ge as strictEqual,
1187
+ Ne as t,
1188
+ We as unless,
1189
+ Ae as untrack,
1190
+ He as when
1182
1191
  };
1183
1192
  //# sourceMappingURL=index.js.map