@manyducks.co/dolla 2.0.0-alpha.12 → 2.0.0-alpha.13

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,17 +3,17 @@ var st = (i) => {
3
3
  throw TypeError(i);
4
4
  };
5
5
  var Et = (i, e, t) => e in i ? kt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
- var S = (i, e, t) => Et(i, typeof e != "symbol" ? e + "" : e, t), Be = (i, e, t) => e.has(i) || st("Cannot " + t);
7
- var s = (i, e, t) => (Be(i, e, "read from private field"), t ? t.call(i) : e.get(i)), d = (i, e, t) => e.has(i) ? st("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, n) => (Be(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), k = (i, e, t) => (Be(i, e, "access private method"), t);
8
- var it = (i, e, t, n) => ({
6
+ var P = (i, e, t) => Et(i, typeof e != "symbol" ? e + "" : e, t), Be = (i, e, t) => e.has(i) || st("Cannot " + t);
7
+ var s = (i, e, t) => (Be(i, e, "read from private field"), t ? t.call(i) : e.get(i)), f = (i, e, t) => e.has(i) ? st("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, r) => (Be(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t), k = (i, e, t) => (Be(i, e, "access private method"), t);
8
+ var it = (i, e, t, r) => ({
9
9
  set _(a) {
10
10
  b(i, e, a, t);
11
11
  },
12
12
  get _() {
13
- return s(i, e, n);
13
+ return s(i, e, r);
14
14
  }
15
15
  });
16
- import { h as ot, c as Pt, i as Ke, t as Qe, d as ye, a as St, b as at, e as q, f as lt, g as oe, j as pt, k as Rt, w as gt, P as mt, l as ct, m as xt, n as Lt, v as Nt, o as Ot, p as Mt, q as ut, r as ht, s as Tt, u as Ae, x as De, y as jt, z as At, A as Dt } from "./passthrough-Bz5ZF4jn.js";
16
+ import { h as ot, c as Pt, i as Ke, t as Qe, d as ye, a as St, b as at, e as F, f as lt, g as ie, j as pt, k as Rt, w as gt, P as mt, l as ct, m as xt, n as Lt, v as Nt, o as Ot, p as Mt, q as ut, r as ht, s as Tt, u as Ae, x as De, y as jt, z as At, A as Dt } from "./passthrough-Bz5ZF4jn.js";
17
17
  import { B as cr, C as ur, D as hr } from "./passthrough-Bz5ZF4jn.js";
18
18
  function _t(i) {
19
19
  return ot`
@@ -62,12 +62,12 @@ function _t(i) {
62
62
  </div>
63
63
  `;
64
64
  }
65
- var X, Ge, T, _;
65
+ var Y, Ge, T, _;
66
66
  class Ct {
67
67
  constructor() {
68
- d(this, T);
69
- d(this, X, []);
70
- d(this, Ge, Vt());
68
+ f(this, T);
69
+ f(this, Y, []);
70
+ f(this, Ge, Vt());
71
71
  }
72
72
  /**
73
73
  * Adds a new middleware that will apply to subsequent requests.
@@ -76,8 +76,8 @@ class Ct {
76
76
  * @param middleware - A middleware function that will intercept requests.
77
77
  */
78
78
  use(e) {
79
- return s(this, X).push(e), () => {
80
- s(this, X).splice(s(this, X).indexOf(e), 1);
79
+ return s(this, Y).push(e), () => {
80
+ s(this, Y).splice(s(this, Y).indexOf(e), 1);
81
81
  };
82
82
  }
83
83
  async get(e, t) {
@@ -105,12 +105,12 @@ class Ct {
105
105
  return k(this, T, _).call(this, "trace", e, t);
106
106
  }
107
107
  }
108
- X = new WeakMap(), Ge = new WeakMap(), T = new WeakSet(), _ = async function(e, t, n) {
108
+ Y = new WeakMap(), Ge = new WeakMap(), T = new WeakSet(), _ = async function(e, t, r) {
109
109
  return qt({
110
- ...n,
110
+ ...r,
111
111
  method: e,
112
112
  uri: t,
113
- middleware: s(this, X),
113
+ middleware: s(this, Y),
114
114
  fetch: s(this, Ge)
115
115
  });
116
116
  };
@@ -123,18 +123,18 @@ function Vt() {
123
123
  }
124
124
  class Ft extends Error {
125
125
  constructor(t) {
126
- const { status: n, statusText: a, method: r, uri: o } = t, h = `${n} ${a}: Request failed (${r.toUpperCase()} ${o})`;
127
- super(h);
128
- S(this, "response");
126
+ const { status: r, statusText: a, method: n, uri: o } = t, u = `${r} ${a}: Request failed (${n.toUpperCase()} ${o})`;
127
+ super(u);
128
+ P(this, "response");
129
129
  this.response = t;
130
130
  }
131
131
  }
132
132
  async function qt(i) {
133
- const { headers: e, query: t, fetch: n, middleware: a } = i, r = {
133
+ const { headers: e, query: t, fetch: r, middleware: a } = i, n = {
134
134
  method: i.method,
135
135
  uri: i.uri,
136
136
  get sameOrigin() {
137
- return !r.uri.startsWith("http");
137
+ return !n.uri.startsWith("http");
138
138
  },
139
139
  query: new URLSearchParams(),
140
140
  headers: new Headers(),
@@ -142,69 +142,69 @@ async function qt(i) {
142
142
  };
143
143
  if (e)
144
144
  if (e instanceof Map || e instanceof Headers)
145
- e.forEach((l, m) => {
146
- r.headers.set(m, l);
145
+ e.forEach((l, g) => {
146
+ n.headers.set(g, l);
147
147
  });
148
148
  else if (e != null && typeof e == "object" && !Array.isArray(e))
149
149
  for (const l in e) {
150
- const m = e[l];
151
- m instanceof Date ? r.headers.set(l, m.toISOString()) : m != null && r.headers.set(l, String(m));
150
+ const g = e[l];
151
+ g instanceof Date ? n.headers.set(l, g.toISOString()) : g != null && n.headers.set(l, String(g));
152
152
  }
153
153
  else
154
154
  throw new TypeError(`Unknown headers type. Got: ${e}`);
155
155
  if (t)
156
156
  if (t instanceof Map || t instanceof URLSearchParams)
157
- t.forEach((l, m) => {
158
- r.query.set(m, l);
157
+ t.forEach((l, g) => {
158
+ n.query.set(g, l);
159
159
  });
160
160
  else if (t != null && typeof t == "object" && !Array.isArray(t))
161
161
  for (const l in t) {
162
- const m = t[l];
163
- m instanceof Date ? r.query.set(l, m.toISOString()) : m != null && r.query.set(l, String(m));
162
+ const g = t[l];
163
+ g instanceof Date ? n.query.set(l, g.toISOString()) : g != null && n.query.set(l, String(g));
164
164
  }
165
165
  else
166
166
  throw new TypeError(`Unknown query params type. Got: ${t}`);
167
167
  let o;
168
- const h = async () => {
169
- const l = r.query.toString(), m = l.length > 0 ? r.uri + "?" + l : r.uri;
170
- let f;
171
- !r.headers.has("content-type") && Ke(r.body) ? (r.headers.set("content-type", "application/json"), f = JSON.stringify(r.body)) : f = r.body;
172
- const g = await n(m, {
173
- method: r.method,
174
- headers: r.headers,
175
- body: f
176
- }), u = Object.fromEntries(g.headers.entries()), y = u["content-type"];
177
- let E;
178
- y != null && y.includes("application/json") ? E = await g.json() : y != null && y.includes("application/x-www-form-urlencoded") ? E = await g.formData() : E = await g.text(), o = {
179
- method: r.method,
180
- uri: r.uri,
181
- status: g.status,
182
- statusText: g.statusText,
183
- headers: u,
184
- body: E
168
+ const u = async () => {
169
+ const l = n.query.toString(), g = l.length > 0 ? n.uri + "?" + l : n.uri;
170
+ let m;
171
+ !n.headers.has("content-type") && Ke(n.body) ? (n.headers.set("content-type", "application/json"), m = JSON.stringify(n.body)) : m = n.body;
172
+ const p = await r(g, {
173
+ method: n.method,
174
+ headers: n.headers,
175
+ body: m
176
+ }), h = Object.fromEntries(p.headers.entries()), y = h["content-type"];
177
+ let S;
178
+ y != null && y.includes("application/json") ? S = await p.json() : y != null && y.includes("application/x-www-form-urlencoded") ? S = await p.formData() : S = await p.text(), o = {
179
+ method: n.method,
180
+ uri: n.uri,
181
+ status: p.status,
182
+ statusText: p.statusText,
183
+ headers: h,
184
+ body: S
185
185
  };
186
186
  };
187
187
  if (a.length > 0) {
188
- const l = (m = 0) => {
189
- const f = a[m], g = a[m + 1] ? l(m + 1) : h;
190
- return async () => f(r, async () => (await g(), o));
188
+ const l = (g = 0) => {
189
+ const m = a[g], p = a[g + 1] ? l(g + 1) : u;
190
+ return async () => m(n, async () => (await p(), o));
191
191
  };
192
192
  await l()();
193
193
  } else
194
- await h();
194
+ await u();
195
195
  if (o.status < 200 || o.status >= 400)
196
196
  throw new Ft(o);
197
197
  return o;
198
198
  }
199
199
  const Ut = Qe("[NO LANGUAGE SET]");
200
- var We, le, ne, Je, wt;
200
+ var We, oe, re, Je, wt;
201
201
  class Ht {
202
202
  constructor(e, t) {
203
- d(this, ne);
204
- S(this, "dolla");
205
- S(this, "config");
206
- d(this, We, !1);
207
- d(this, le, /* @__PURE__ */ new Map());
203
+ f(this, re);
204
+ P(this, "dolla");
205
+ P(this, "config");
206
+ f(this, We, !1);
207
+ f(this, oe, /* @__PURE__ */ new Map());
208
208
  this.config = e, this.dolla = t;
209
209
  }
210
210
  async load() {
@@ -213,7 +213,7 @@ class Ht {
213
213
  if (at(this.config.fetch)) {
214
214
  if (e = await this.config.fetch(), !Ke(e))
215
215
  throw new Error(`Fetch function did not return an object of language strings: ${e}`);
216
- } else if (q(this.config.path)) {
216
+ } else if (F(this.config.path)) {
217
217
  const t = await this.dolla.http.get(this.config.path);
218
218
  if (t.status >= 200 && t.status < 300)
219
219
  if (Ke(t.body))
@@ -229,99 +229,98 @@ class Ht {
229
229
  if (e == null)
230
230
  throw new Error("Language could not be loaded.");
231
231
  {
232
- const t = k(this, ne, Je).call(this, e);
233
- for (const n of t)
234
- s(this, le).set(n[0], n[1]);
235
- console.log(t);
232
+ const t = k(this, re, Je).call(this, e);
233
+ for (const r of t)
234
+ s(this, oe).set(r[0], r[1]);
236
235
  }
237
236
  }
238
237
  getTemplate(e) {
239
- return s(this, le).get(e) ?? null;
238
+ return s(this, oe).get(e) ?? null;
240
239
  }
241
240
  hasTemplate(e) {
242
- return s(this, le).has(e);
241
+ return s(this, oe).has(e);
243
242
  }
244
243
  }
245
- We = new WeakMap(), le = new WeakMap(), ne = new WeakSet(), Je = function(e, t = []) {
246
- const n = [];
244
+ We = new WeakMap(), oe = new WeakMap(), re = new WeakSet(), Je = function(e, t = []) {
245
+ const r = [];
247
246
  for (const a in e)
248
247
  switch (lt(e[a])) {
249
248
  case "string":
250
- n.push([[...t, a].join("."), k(this, ne, wt).call(this, e[a])]);
249
+ r.push([[...t, a].join("."), k(this, re, wt).call(this, e[a])]);
251
250
  break;
252
251
  case "object":
253
- n.push(...k(this, ne, Je).call(this, e[a], [...t, a]));
252
+ r.push(...k(this, re, Je).call(this, e[a], [...t, a]));
254
253
  break;
255
254
  default:
256
255
  throw new Error(
257
256
  `Expected to find a string or object at ${[...t, a].join(".")}. Got: ${lt(e[a])}`
258
257
  );
259
258
  }
260
- return n;
259
+ return r;
261
260
  }, wt = function(e) {
262
261
  let t;
263
- ((u) => {
264
- u[u.Static = 0] = "Static", u[u.ValueName = 1] = "ValueName", u[u.FormatName = 2] = "FormatName", u[u.FormatOptionName = 3] = "FormatOptionName", u[u.FormatOptionValue = 4] = "FormatOptionValue", u[u.FormatOptionEnd = 5] = "FormatOptionEnd";
262
+ ((h) => {
263
+ h[h.Static = 0] = "Static", h[h.ValueName = 1] = "ValueName", h[h.FormatName = 2] = "FormatName", h[h.FormatOptionName = 3] = "FormatOptionName", h[h.FormatOptionValue = 4] = "FormatOptionValue", h[h.FormatOptionEnd = 5] = "FormatOptionEnd";
265
264
  })(t || (t = {}));
266
- const n = {
265
+ const r = {
267
266
  segments: []
268
267
  };
269
- let a = "", r = 0, o = 0, h, l, m;
270
- const f = () => {
271
- h = {
268
+ let a = "", n = 0, o = 0, u, l, g;
269
+ const m = () => {
270
+ u = {
272
271
  type: 1,
273
272
  name: "",
274
273
  formats: []
275
274
  };
276
- }, g = () => {
275
+ }, p = () => {
277
276
  l = {
278
277
  name: "",
279
278
  options: {}
280
279
  };
281
280
  };
282
- for (; r < e.length; ) {
283
- if (o !== 0 && e[r] === " ") {
284
- r++;
281
+ for (; n < e.length; ) {
282
+ if (o !== 0 && e[n] === " ") {
283
+ n++;
285
284
  continue;
286
285
  }
287
286
  switch (o) {
288
287
  case 0:
289
- e[r] === "{" && e[r + 1] === "{" ? (o = 1, r += 2, a.length > 0 && (n.segments.push({ type: 0, text: a }), a = ""), f()) : (a += e[r], r++);
288
+ e[n] === "{" && e[n + 1] === "{" ? (o = 1, n += 2, a.length > 0 && (r.segments.push({ type: 0, text: a }), a = ""), m()) : (a += e[n], n++);
290
289
  break;
291
290
  case 1:
292
- e[r] === "|" ? (o = 2, r += 1, h.name = a, a = "", g()) : e[r] === "}" && e[r + 1] === "}" ? (o = 0, r += 2, h.name = a, a = "", n.segments.push(h)) : (a += e[r], r++);
291
+ e[n] === "|" ? (o = 2, n += 1, u.name = a, a = "", p()) : e[n] === "}" && e[n + 1] === "}" ? (o = 0, n += 2, u.name = a, a = "", r.segments.push(u)) : (a += e[n], n++);
293
292
  break;
294
293
  case 2:
295
- e[r] === "(" ? (o = 3, r += 1, l.name = a, a = "") : e[r] === "}" && e[r + 1] === "}" ? (o = 0, r += 2, h.formats.push(l), n.segments.push(h)) : (a += e[r], r++);
294
+ e[n] === "(" ? (o = 3, n += 1, l.name = a, a = "") : e[n] === "}" && e[n + 1] === "}" ? (o = 0, n += 2, u.formats.push(l), r.segments.push(u)) : (a += e[n], n++);
296
295
  break;
297
296
  case 3:
298
- e[r] === ")" || (e[r] === ":" ? (o = 4, r += 1, m = a, a = "") : e[r] === "}" && e[r + 1] === "}" || (a += e[r], r++));
297
+ e[n] === ")" || (e[n] === ":" ? (o = 4, n += 1, g = a, a = "") : e[n] === "}" && e[n + 1] === "}" || (a += e[n], n++));
299
298
  break;
300
299
  case 4:
301
- e[r] === ")" ? (o = 5, r += 1, l.options[m] = a, a = "", h.formats.push(l)) : e[r] === "," ? (o = 3, r += 1, l.options[m] = a, a = "") : e[r] === "}" && e[r + 1] === "}" || (a += e[r], r++);
300
+ e[n] === ")" ? (o = 5, n += 1, l.options[g] = a, a = "", u.formats.push(l)) : e[n] === "," ? (o = 3, n += 1, l.options[g] = a, a = "") : e[n] === "}" && e[n + 1] === "}" || (a += e[n], n++);
302
301
  break;
303
302
  case 5:
304
- e[r] === "|" ? (o = 2, r += 1, g()) : e[r] === "}" && e[r + 1] === "}" && (o = 0, r += 2, n.segments.push(h));
303
+ e[n] === "|" ? (o = 2, n += 1, p()) : e[n] === "}" && e[n + 1] === "}" && (o = 0, n += 2, r.segments.push(u));
305
304
  break;
306
305
  }
307
306
  }
308
- return o === 0 && a.length > 0 && n.segments.push({ type: 0, text: a }), n;
307
+ return o === 0 && a.length > 0 && r.segments.push({ type: 0, text: a }), r;
309
308
  };
310
- var ve, U, L, $e, H, ke, Ee, N, yt, Ye, Xe, Ze, bt;
309
+ var ve, q, L, $e, U, ke, Ee, N, yt, Ye, Xe, Ze, bt;
311
310
  class It {
312
311
  constructor(e) {
313
- d(this, N);
314
- d(this, ve);
315
- d(this, U);
316
- d(this, L, /* @__PURE__ */ new Map());
317
- d(this, $e, []);
318
- d(this, H, /* @__PURE__ */ new Map());
319
- d(this, ke, "auto");
320
- S(this, "$locale");
321
- d(this, Ee);
322
- b(this, ve, e), b(this, U, e.createLogger("dolla/i18n"));
323
- const [t, n] = oe();
324
- this.$locale = t, b(this, Ee, n), s(this, H).set("number", (a, r, o) => k(this, N, Ye).call(this, Number(r), o)), s(this, H).set("datetime", (a, r, o) => k(this, N, Xe).call(this, r, o)), s(this, H).set("list", (a, r, o) => k(this, N, Ze).call(this, r, o)), e.beforeMount(async () => {
312
+ f(this, N);
313
+ f(this, ve);
314
+ f(this, q);
315
+ f(this, L, /* @__PURE__ */ new Map());
316
+ f(this, $e, []);
317
+ f(this, U, /* @__PURE__ */ new Map());
318
+ f(this, ke, "auto");
319
+ P(this, "$locale");
320
+ f(this, Ee);
321
+ b(this, ve, e), b(this, q, e.createLogger("dolla/i18n"));
322
+ const [t, r] = ie();
323
+ this.$locale = t, b(this, Ee, r), s(this, U).set("number", (a, n, o) => k(this, N, Ye).call(this, Number(n), o)), s(this, U).set("datetime", (a, n, o) => k(this, N, Xe).call(this, n, o)), s(this, U).set("list", (a, n, o) => k(this, N, Ze).call(this, n, o)), e.beforeMount(async () => {
325
324
  s(this, L).size > 0 && await this.setLocale(s(this, ke));
326
325
  });
327
326
  }
@@ -332,11 +331,11 @@ class It {
332
331
  if (e.translations.forEach((t) => {
333
332
  s(this, L).set(t.locale, new Ht(t, s(this, ve)));
334
333
  }), e.locale && e.locale !== "auto") {
335
- if (!e.translations.some((n) => n.locale === e.locale))
334
+ if (!e.translations.some((r) => r.locale === e.locale))
336
335
  throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
337
336
  b(this, ke, e.locale);
338
337
  }
339
- s(this, U).info(
338
+ s(this, q).info(
340
339
  `${s(this, L).size} language${s(this, L).size === 1 ? "" : "s"} supported: '${[...s(this, L).keys()].join("', '")}'`
341
340
  );
342
341
  }
@@ -344,26 +343,26 @@ class It {
344
343
  var a;
345
344
  let t;
346
345
  if (e === "auto") {
347
- let r = [];
346
+ let n = [];
348
347
  if (typeof navigator == "object") {
349
348
  const o = navigator;
350
- ((a = o.languages) == null ? void 0 : a.length) > 0 ? r.push(...o.languages) : o.language ? r.push(o.language) : o.browserLanguage ? r.push(o.browserLanguage) : o.userLanguage && r.push(o.userLanguage);
349
+ ((a = o.languages) == null ? void 0 : a.length) > 0 ? n.push(...o.languages) : o.language ? n.push(o.language) : o.browserLanguage ? n.push(o.browserLanguage) : o.userLanguage && n.push(o.userLanguage);
351
350
  }
352
- for (const o of r)
351
+ for (const o of n)
353
352
  s(this, L).has(o) && (t = o);
354
353
  } else
355
354
  s(this, L).has(e) && (t = e);
356
355
  if (t == null) {
357
- const r = s(this, L).keys().next().value;
358
- r && (t = r);
356
+ const n = s(this, L).keys().next().value;
357
+ n && (t = n);
359
358
  }
360
359
  if (!t || !s(this, L).has(t))
361
360
  throw new Error(`Language '${e}' is not configured for this app.`);
362
- const n = s(this, L).get(t);
361
+ const r = s(this, L).get(t);
363
362
  try {
364
- await n.load(), b(this, $e, []), s(this, Ee).call(this, t), s(this, U).info("set language to " + t);
365
- } catch (r) {
366
- r instanceof Error && s(this, U).crash(r);
363
+ await r.load(), b(this, $e, []), s(this, Ee).call(this, t), s(this, q).info("set language to " + t);
364
+ } catch (n) {
365
+ n instanceof Error && s(this, q).crash(n);
367
366
  }
368
367
  }
369
368
  /**
@@ -382,30 +381,32 @@ class It {
382
381
  );
383
382
  if (!this.$locale.get())
384
383
  return Ut;
385
- let n = [], a = [];
386
- for (const r in t)
387
- n.push(r), a.push(t[r]);
388
- return ye(
389
- [this.$locale, ...a],
390
- (r, ...o) => k(this, N, yt).call(this, r, e, n, ...o)
391
- );
384
+ let r = [], a = [];
385
+ for (const n in t)
386
+ r.push(n), a.push(t[n]);
387
+ return ye([this.$locale, ...a], (n, ...o) => {
388
+ const u = {};
389
+ for (let l = 0; l < o.length; l++)
390
+ u[r[l]] = o[l];
391
+ return k(this, N, yt).call(this, n, e, u);
392
+ });
392
393
  }
393
394
  /**
394
395
  * Add a custom format callback.
395
396
  *
396
397
  * @example
397
- * Dolla.i18n.addFormat("myCurrency", (locale, value, options) => {
398
- * // ...
398
+ * Dolla.i18n.addFormat("uppercase", (locale, value, options) => {
399
+ * return value.toUpperCase();
399
400
  * });
400
401
  *
401
402
  * {
402
- * "exampleKey": "{{count | myCurrency}} dollars"
403
+ * "greeting": "Hello, {{name|uppercase}}!"
403
404
  * }
404
405
  *
405
- * t("exampleKey", {count: 5}); // State<"&5 dollars">
406
+ * t("greeting", {name: "world"}); // State<"Hello, WORLD!">
406
407
  */
407
408
  addFormat(e, t) {
408
- s(this, H).set(e, t);
409
+ s(this, U).set(e, t);
409
410
  }
410
411
  /**
411
412
  * Creates an `Intl.Collator` configured for the current locale.
@@ -422,7 +423,7 @@ class It {
422
423
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
423
424
  */
424
425
  number(e, t) {
425
- return ye([this.$locale, e], (n, a) => k(this, N, Ye).call(this, a, t));
426
+ return ye([this.$locale, e], (r, a) => k(this, N, Ye).call(this, a, t));
426
427
  }
427
428
  /**
428
429
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -434,7 +435,7 @@ class It {
434
435
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
435
436
  */
436
437
  dateTime(e, t) {
437
- return ye([this.$locale, e], (n, a) => k(this, N, Xe).call(this, a, t));
438
+ return ye([this.$locale, e], (r, a) => k(this, N, Xe).call(this, a, t));
438
439
  }
439
440
  /**
440
441
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -446,48 +447,45 @@ class It {
446
447
  * const $formatted = Dolla.i18n.list(list, { });
447
448
  */
448
449
  list(e, t) {
449
- return ye([this.$locale, e], (n, a) => k(this, N, Ze).call(this, a, t));
450
+ return ye([this.$locale, e], (r, a) => k(this, N, Ze).call(this, a, t));
450
451
  }
451
452
  }
452
- ve = new WeakMap(), U = new WeakMap(), L = new WeakMap(), $e = new WeakMap(), H = new WeakMap(), ke = new WeakMap(), Ee = new WeakMap(), N = new WeakSet(), yt = function(e, t, n, ...a) {
453
- const r = {};
454
- for (let f = 0; f < a.length; f++)
455
- r[n[f]] = a[f];
456
- const o = k(this, N, bt).call(this, t, r);
457
- if (o) return o;
458
- const h = s(this, L).get(e);
453
+ ve = new WeakMap(), q = new WeakMap(), L = new WeakMap(), $e = new WeakMap(), U = new WeakMap(), ke = new WeakMap(), Ee = new WeakMap(), N = new WeakSet(), yt = function(e, t, r) {
454
+ const a = k(this, N, bt).call(this, t, r);
455
+ if (a) return a;
456
+ const n = s(this, L).get(e);
459
457
  if (r.context != null && (t += "_" + r.context), r.count != null)
460
458
  if (r.ordinal) {
461
- const f = `${t}_ordinal_(=${r.count})`;
462
- h.hasTemplate(f) ? t = f : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(r.count);
459
+ const l = `${t}_ordinal_(=${r.count})`;
460
+ n.hasTemplate(l) ? t = l : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(r.count);
463
461
  } else {
464
- const f = `${t}_(=${r.count})`;
465
- h.hasTemplate(f) ? t = f : t += "_" + new Intl.PluralRules(e).select(r.count);
462
+ const l = `${t}_(=${r.count})`;
463
+ n.hasTemplate(l) ? t = l : t += "_" + new Intl.PluralRules(e).select(r.count);
466
464
  }
467
- const l = h.getTemplate(t) || {
465
+ const o = n.getTemplate(t) || {
468
466
  segments: [{ type: 0, text: `[MISSING: ${t}]` }]
469
467
  };
470
- let m = "";
471
- for (const f of l.segments)
472
- if (f.type === 0)
473
- m += f.text;
474
- else if (f.type === 1) {
475
- const g = [...f.formats];
476
- let u = Gt(r, f.name);
477
- f.name === "count" && g.length === 0 && g.push({ name: "number", options: {} });
478
- for (const y of g) {
479
- const E = s(this, H).get(y.name);
480
- if (E == null) {
481
- const V = new Error(
482
- `Failed to load format '${y.name}' when processing '${t}', template: ${l}`
468
+ let u = "";
469
+ for (const l of o.segments)
470
+ if (l.type === 0)
471
+ u += l.text;
472
+ else if (l.type === 1) {
473
+ const g = [...l.formats];
474
+ let m = Gt(r, l.name);
475
+ l.name === "count" && g.length === 0 && g.push({ name: "number", options: {} });
476
+ for (const p of g) {
477
+ const h = s(this, U).get(p.name);
478
+ if (h == null) {
479
+ const y = new Error(
480
+ `Failed to load format '${p.name}' when processing '${t}', template: ${o}`
483
481
  );
484
- throw s(this, U).crash(V), V;
482
+ throw s(this, q).crash(y), y;
485
483
  }
486
- u = E(e, u, y.options);
484
+ m = h(e, m, p.options);
487
485
  }
488
- m += u;
486
+ u += m;
489
487
  }
490
- return m;
488
+ return u;
491
489
  }, Ye = function(e, t) {
492
490
  return new Intl.NumberFormat(this.$locale.get(), t).format(e);
493
491
  }, Xe = function(e, t) {
@@ -499,34 +497,34 @@ ve = new WeakMap(), U = new WeakMap(), L = new WeakMap(), $e = new WeakMap(), H
499
497
  }, // relativeTime(): State<string> {
500
498
  // }
501
499
  bt = function(e, t) {
502
- for (const n of s(this, $e))
503
- if (n[0] === e && St(n[1], t))
504
- return n[2];
500
+ for (const r of s(this, $e))
501
+ if (r[0] === e && St(r[1], t))
502
+ return r[2];
505
503
  };
506
504
  function Gt(i, e) {
507
505
  const t = String(e).split(/[\.\[\]]/).filter((a) => a.trim() !== "");
508
- let n = i;
506
+ let r = i;
509
507
  for (; t.length > 0; ) {
510
508
  const a = t.shift();
511
- n != null ? n = n[a] : n = void 0;
509
+ r != null ? r = r[a] : r = void 0;
512
510
  }
513
- return n;
511
+ return r;
514
512
  }
515
- var Z, Pe, I, G, ce, C, ue, _e;
513
+ var X, Pe, H, I, le, C, ce, _e;
516
514
  class Wt {
517
515
  constructor(e) {
518
- d(this, ue);
519
- d(this, Z);
520
- d(this, Pe);
516
+ f(this, ce);
517
+ f(this, X);
518
+ f(this, Pe);
521
519
  // Keyed updates ensure only the most recent callback queued with a certain key
522
520
  // will be called, keeping DOM operations to a minimum.
523
- d(this, I, /* @__PURE__ */ new Map());
521
+ f(this, H, /* @__PURE__ */ new Map());
524
522
  // All unkeyed updates are run on every batch.
525
- d(this, G, []);
523
+ f(this, I, []);
526
524
  // All read callbacks are run before updates on every batch.
527
- d(this, ce, []);
528
- d(this, C, !1);
529
- b(this, Z, e), b(this, Pe, e.createLogger("dolla/render"));
525
+ f(this, le, []);
526
+ f(this, C, !1);
527
+ b(this, X, e), b(this, Pe, e.createLogger("dolla/render"));
530
528
  }
531
529
  /**
532
530
  * Queues a callback to run in the next render batch.
@@ -534,12 +532,12 @@ class Wt {
534
532
  * Returns a Promise that resolves once the callback has run.
535
533
  */
536
534
  update(e, t) {
537
- return new Promise((n) => {
538
- t ? s(this, I).set(t, () => {
539
- e(), n();
540
- }) : s(this, G).push(() => {
541
- e(), n();
542
- }), !s(this, C) && s(this, Z).isMounted && (b(this, C, !0), k(this, ue, _e).call(this));
535
+ return new Promise((r) => {
536
+ t ? s(this, H).set(t, () => {
537
+ e(), r();
538
+ }) : s(this, I).push(() => {
539
+ e(), r();
540
+ }), !s(this, C) && s(this, X).isMounted && (b(this, C, !0), k(this, ce, _e).call(this));
543
541
  });
544
542
  }
545
543
  /**
@@ -549,38 +547,38 @@ class Wt {
549
547
  */
550
548
  read(e) {
551
549
  return new Promise((t) => {
552
- s(this, ce).push(() => {
550
+ s(this, le).push(() => {
553
551
  e(), t();
554
- }), !s(this, C) && s(this, Z).isMounted && (b(this, C, !0), k(this, ue, _e).call(this));
552
+ }), !s(this, C) && s(this, X).isMounted && (b(this, C, !0), k(this, ce, _e).call(this));
555
553
  });
556
554
  }
557
555
  }
558
- Z = new WeakMap(), Pe = new WeakMap(), I = new WeakMap(), G = new WeakMap(), ce = new WeakMap(), C = new WeakMap(), ue = new WeakSet(), _e = function() {
559
- const e = s(this, I).size + s(this, G).length;
560
- if ((!s(this, Z).isMounted || e === 0) && b(this, C, !1), !s(this, C)) {
561
- for (const t of s(this, ce))
556
+ X = new WeakMap(), Pe = new WeakMap(), H = new WeakMap(), I = new WeakMap(), le = new WeakMap(), C = new WeakMap(), ce = new WeakSet(), _e = function() {
557
+ const e = s(this, H).size + s(this, I).length;
558
+ if ((!s(this, X).isMounted || e === 0) && b(this, C, !1), !s(this, C)) {
559
+ for (const t of s(this, le))
562
560
  t();
563
- b(this, ce, []);
561
+ b(this, le, []);
564
562
  return;
565
563
  }
566
564
  requestAnimationFrame(() => {
567
- s(this, Pe).info(`Batching ${s(this, I).size + s(this, G).length} queued DOM update(s).`);
568
- for (const t of s(this, I).values())
565
+ s(this, Pe).info(`Batching ${s(this, H).size + s(this, I).length} queued DOM update(s).`);
566
+ for (const t of s(this, H).values())
569
567
  t();
570
- s(this, I).clear();
571
- for (const t of s(this, G))
568
+ s(this, H).clear();
569
+ for (const t of s(this, I))
572
570
  t();
573
- b(this, G, []), k(this, ue, _e).call(this);
571
+ b(this, I, []), k(this, ce, _e).call(this);
574
572
  });
575
573
  };
576
- function pe() {
577
- return pe = Object.assign ? Object.assign.bind() : function(i) {
574
+ function de() {
575
+ return de = Object.assign ? Object.assign.bind() : function(i) {
578
576
  for (var e = 1; e < arguments.length; e++) {
579
577
  var t = arguments[e];
580
- for (var n in t) ({}).hasOwnProperty.call(t, n) && (i[n] = t[n]);
578
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (i[r] = t[r]);
581
579
  }
582
580
  return i;
583
- }, pe.apply(null, arguments);
581
+ }, de.apply(null, arguments);
584
582
  }
585
583
  var A;
586
584
  (function(i) {
@@ -603,33 +601,33 @@ function Ce(i, e) {
603
601
  var Ue = "beforeunload", zt = "hashchange", vt = "popstate";
604
602
  function Bt(i) {
605
603
  i === void 0 && (i = {});
606
- var e = i, t = e.window, n = t === void 0 ? document.defaultView : t, a = n.history;
607
- function r() {
608
- var w = n.location, c = w.pathname, p = w.search, v = w.hash, $ = a.state || {};
604
+ var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
605
+ function n() {
606
+ var w = r.location, c = w.pathname, d = w.search, v = w.hash, $ = a.state || {};
609
607
  return [$.idx, qe({
610
608
  pathname: c,
611
- search: p,
609
+ search: d,
612
610
  hash: v,
613
611
  state: $.usr || null,
614
612
  key: $.key || "default"
615
613
  })];
616
614
  }
617
615
  var o = null;
618
- function h() {
616
+ function u() {
619
617
  if (o)
620
618
  y.call(o), o = null;
621
619
  else {
622
- var w = A.Pop, c = r(), p = c[0], v = c[1];
620
+ var w = A.Pop, c = n(), d = c[0], v = c[1];
623
621
  if (y.length)
624
- if (p != null) {
625
- var $ = f - p;
622
+ if (d != null) {
623
+ var $ = m - d;
626
624
  $ && (o = {
627
625
  action: w,
628
626
  location: v,
629
627
  retry: function() {
630
- F($ * -1);
628
+ V($ * -1);
631
629
  }
632
- }, F($));
630
+ }, V($));
633
631
  } else
634
632
  process.env.NODE_ENV !== "production" && Ce(
635
633
  !1,
@@ -639,20 +637,20 @@ function Bt(i) {
639
637
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
640
638
  );
641
639
  else
642
- ae(w);
640
+ ne(w);
643
641
  }
644
642
  }
645
- n.addEventListener(vt, h);
646
- var l = A.Pop, m = r(), f = m[0], g = m[1], u = Ie(), y = Ie();
647
- f == null && (f = 0, a.replaceState(pe({}, a.state, {
648
- idx: f
643
+ r.addEventListener(vt, u);
644
+ var l = A.Pop, g = n(), m = g[0], p = g[1], h = Ie(), y = Ie();
645
+ m == null && (m = 0, a.replaceState(de({}, a.state, {
646
+ idx: m
649
647
  }), ""));
650
- function E(w) {
648
+ function S(w) {
651
649
  return typeof w == "string" ? w : Ve(w);
652
650
  }
653
- function V(w, c) {
654
- return c === void 0 && (c = null), qe(pe({
655
- pathname: g.pathname,
651
+ function pe(w, c) {
652
+ return c === void 0 && (c = null), qe(de({
653
+ pathname: p.pathname,
656
654
  hash: "",
657
655
  search: ""
658
656
  }, typeof w == "string" ? et(w) : w, {
@@ -665,85 +663,85 @@ function Bt(i) {
665
663
  usr: w.state,
666
664
  key: w.key,
667
665
  idx: c
668
- }, E(w)];
666
+ }, S(w)];
669
667
  }
670
- function me(w, c, p) {
668
+ function me(w, c, d) {
671
669
  return !y.length || (y.call({
672
670
  action: w,
673
671
  location: c,
674
- retry: p
672
+ retry: d
675
673
  }), !1);
676
674
  }
677
- function ae(w) {
675
+ function ne(w) {
678
676
  l = w;
679
- var c = r();
680
- f = c[0], g = c[1], u.call({
677
+ var c = n();
678
+ m = c[0], p = c[1], h.call({
681
679
  action: l,
682
- location: g
680
+ location: p
683
681
  });
684
682
  }
685
- function se(w, c) {
686
- var p = A.Push, v = V(w, c);
683
+ function ae(w, c) {
684
+ var d = A.Push, v = pe(w, c);
687
685
  function $() {
688
- se(w, c);
686
+ ae(w, c);
689
687
  }
690
- if (me(p, v, $)) {
691
- var R = ge(v, f + 1), O = R[0], j = R[1];
688
+ if (me(d, v, $)) {
689
+ var R = ge(v, m + 1), O = R[0], j = R[1];
692
690
  try {
693
691
  a.pushState(O, "", j);
694
692
  } catch {
695
- n.location.assign(j);
693
+ r.location.assign(j);
696
694
  }
697
- ae(p);
695
+ ne(d);
698
696
  }
699
697
  }
700
698
  function we(w, c) {
701
- var p = A.Replace, v = V(w, c);
699
+ var d = A.Replace, v = pe(w, c);
702
700
  function $() {
703
701
  we(w, c);
704
702
  }
705
- if (me(p, v, $)) {
706
- var R = ge(v, f), O = R[0], j = R[1];
707
- a.replaceState(O, "", j), ae(p);
703
+ if (me(d, v, $)) {
704
+ var R = ge(v, m), O = R[0], j = R[1];
705
+ a.replaceState(O, "", j), ne(d);
708
706
  }
709
707
  }
710
- function F(w) {
708
+ function V(w) {
711
709
  a.go(w);
712
710
  }
713
- var Y = {
711
+ var J = {
714
712
  get action() {
715
713
  return l;
716
714
  },
717
715
  get location() {
718
- return g;
716
+ return p;
719
717
  },
720
- createHref: E,
721
- push: se,
718
+ createHref: S,
719
+ push: ae,
722
720
  replace: we,
723
- go: F,
721
+ go: V,
724
722
  back: function() {
725
- F(-1);
723
+ V(-1);
726
724
  },
727
725
  forward: function() {
728
- F(1);
726
+ V(1);
729
727
  },
730
728
  listen: function(c) {
731
- return u.push(c);
729
+ return h.push(c);
732
730
  },
733
731
  block: function(c) {
734
- var p = y.push(c);
735
- return y.length === 1 && n.addEventListener(Ue, He), function() {
736
- p(), y.length || n.removeEventListener(Ue, He);
732
+ var d = y.push(c);
733
+ return y.length === 1 && r.addEventListener(Ue, He), function() {
734
+ d(), y.length || r.removeEventListener(Ue, He);
737
735
  };
738
736
  }
739
737
  };
740
- return Y;
738
+ return J;
741
739
  }
742
740
  function Kt(i) {
743
741
  i === void 0 && (i = {});
744
- var e = i, t = e.window, n = t === void 0 ? document.defaultView : t, a = n.history;
745
- function r() {
746
- var c = et(n.location.hash.substr(1)), p = c.pathname, v = p === void 0 ? "/" : p, $ = c.search, R = $ === void 0 ? "" : $, O = c.hash, j = O === void 0 ? "" : O, D = a.state || {};
742
+ var e = i, t = e.window, r = t === void 0 ? document.defaultView : t, a = r.history;
743
+ function n() {
744
+ var c = et(r.location.hash.substr(1)), d = c.pathname, v = d === void 0 ? "/" : d, $ = c.search, R = $ === void 0 ? "" : $, O = c.hash, j = O === void 0 ? "" : O, D = a.state || {};
747
745
  return [D.idx, qe({
748
746
  pathname: v,
749
747
  search: R,
@@ -753,21 +751,21 @@ function Kt(i) {
753
751
  })];
754
752
  }
755
753
  var o = null;
756
- function h() {
754
+ function u() {
757
755
  if (o)
758
756
  y.call(o), o = null;
759
757
  else {
760
- var c = A.Pop, p = r(), v = p[0], $ = p[1];
758
+ var c = A.Pop, d = n(), v = d[0], $ = d[1];
761
759
  if (y.length)
762
760
  if (v != null) {
763
- var R = f - v;
761
+ var R = m - v;
764
762
  R && (o = {
765
763
  action: c,
766
764
  location: $,
767
765
  retry: function() {
768
- Y(R * -1);
766
+ J(R * -1);
769
767
  }
770
- }, Y(R));
768
+ }, J(R));
771
769
  } else
772
770
  process.env.NODE_ENV !== "production" && Ce(
773
771
  !1,
@@ -777,86 +775,86 @@ function Kt(i) {
777
775
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
778
776
  );
779
777
  else
780
- se(c);
778
+ ae(c);
781
779
  }
782
780
  }
783
- n.addEventListener(vt, h), n.addEventListener(zt, function() {
784
- var c = r(), p = c[1];
785
- Ve(p) !== Ve(g) && h();
781
+ r.addEventListener(vt, u), r.addEventListener(zt, function() {
782
+ var c = n(), d = c[1];
783
+ Ve(d) !== Ve(p) && u();
786
784
  });
787
- var l = A.Pop, m = r(), f = m[0], g = m[1], u = Ie(), y = Ie();
788
- f == null && (f = 0, a.replaceState(pe({}, a.state, {
789
- idx: f
785
+ var l = A.Pop, g = n(), m = g[0], p = g[1], h = Ie(), y = Ie();
786
+ m == null && (m = 0, a.replaceState(de({}, a.state, {
787
+ idx: m
790
788
  }), ""));
791
- function E() {
792
- var c = document.querySelector("base"), p = "";
789
+ function S() {
790
+ var c = document.querySelector("base"), d = "";
793
791
  if (c && c.getAttribute("href")) {
794
- var v = n.location.href, $ = v.indexOf("#");
795
- p = $ === -1 ? v : v.slice(0, $);
792
+ var v = r.location.href, $ = v.indexOf("#");
793
+ d = $ === -1 ? v : v.slice(0, $);
796
794
  }
797
- return p;
795
+ return d;
798
796
  }
799
- function V(c) {
800
- return E() + "#" + (typeof c == "string" ? c : Ve(c));
797
+ function pe(c) {
798
+ return S() + "#" + (typeof c == "string" ? c : Ve(c));
801
799
  }
802
- function ge(c, p) {
803
- return p === void 0 && (p = null), qe(pe({
804
- pathname: g.pathname,
800
+ function ge(c, d) {
801
+ return d === void 0 && (d = null), qe(de({
802
+ pathname: p.pathname,
805
803
  hash: "",
806
804
  search: ""
807
805
  }, typeof c == "string" ? et(c) : c, {
808
- state: p,
806
+ state: d,
809
807
  key: $t()
810
808
  }));
811
809
  }
812
- function me(c, p) {
810
+ function me(c, d) {
813
811
  return [{
814
812
  usr: c.state,
815
813
  key: c.key,
816
- idx: p
817
- }, V(c)];
814
+ idx: d
815
+ }, pe(c)];
818
816
  }
819
- function ae(c, p, v) {
817
+ function ne(c, d, v) {
820
818
  return !y.length || (y.call({
821
819
  action: c,
822
- location: p,
820
+ location: d,
823
821
  retry: v
824
822
  }), !1);
825
823
  }
826
- function se(c) {
824
+ function ae(c) {
827
825
  l = c;
828
- var p = r();
829
- f = p[0], g = p[1], u.call({
826
+ var d = n();
827
+ m = d[0], p = d[1], h.call({
830
828
  action: l,
831
- location: g
829
+ location: p
832
830
  });
833
831
  }
834
- function we(c, p) {
835
- var v = A.Push, $ = ge(c, p);
832
+ function we(c, d) {
833
+ var v = A.Push, $ = ge(c, d);
836
834
  function R() {
837
- we(c, p);
835
+ we(c, d);
838
836
  }
839
- if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), ae(v, $, R)) {
840
- var O = me($, f + 1), j = O[0], D = O[1];
837
+ if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), ne(v, $, R)) {
838
+ var O = me($, m + 1), j = O[0], D = O[1];
841
839
  try {
842
840
  a.pushState(j, "", D);
843
841
  } catch {
844
- n.location.assign(D);
842
+ r.location.assign(D);
845
843
  }
846
- se(v);
844
+ ae(v);
847
845
  }
848
846
  }
849
- function F(c, p) {
850
- var v = A.Replace, $ = ge(c, p);
847
+ function V(c, d) {
848
+ var v = A.Replace, $ = ge(c, d);
851
849
  function R() {
852
- F(c, p);
850
+ V(c, d);
853
851
  }
854
- if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), ae(v, $, R)) {
855
- var O = me($, f), j = O[0], D = O[1];
856
- a.replaceState(j, "", D), se(v);
852
+ if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), ne(v, $, R)) {
853
+ var O = me($, m), j = O[0], D = O[1];
854
+ a.replaceState(j, "", D), ae(v);
857
855
  }
858
856
  }
859
- function Y(c) {
857
+ function J(c) {
860
858
  a.go(c);
861
859
  }
862
860
  var w = {
@@ -864,25 +862,25 @@ function Kt(i) {
864
862
  return l;
865
863
  },
866
864
  get location() {
867
- return g;
865
+ return p;
868
866
  },
869
- createHref: V,
867
+ createHref: pe,
870
868
  push: we,
871
- replace: F,
872
- go: Y,
869
+ replace: V,
870
+ go: J,
873
871
  back: function() {
874
- Y(-1);
872
+ J(-1);
875
873
  },
876
874
  forward: function() {
877
- Y(1);
875
+ J(1);
878
876
  },
879
- listen: function(p) {
880
- return u.push(p);
877
+ listen: function(d) {
878
+ return h.push(d);
881
879
  },
882
- block: function(p) {
883
- var v = y.push(p);
884
- return y.length === 1 && n.addEventListener(Ue, He), function() {
885
- v(), y.length || n.removeEventListener(Ue, He);
880
+ block: function(d) {
881
+ var v = y.push(d);
882
+ return y.length === 1 && r.addEventListener(Ue, He), function() {
883
+ v(), y.length || r.removeEventListener(Ue, He);
886
884
  };
887
885
  }
888
886
  };
@@ -899,14 +897,14 @@ function Ie() {
899
897
  },
900
898
  push: function(t) {
901
899
  return i.push(t), function() {
902
- i = i.filter(function(n) {
903
- return n !== t;
900
+ i = i.filter(function(r) {
901
+ return r !== t;
904
902
  });
905
903
  };
906
904
  },
907
905
  call: function(t) {
908
- i.forEach(function(n) {
909
- return n && n(t);
906
+ i.forEach(function(r) {
907
+ return r && r(t);
910
908
  });
911
909
  }
912
910
  };
@@ -915,7 +913,7 @@ function $t() {
915
913
  return Math.random().toString(36).substr(2, 8);
916
914
  }
917
915
  function Ve(i) {
918
- var e = i.pathname, t = e === void 0 ? "/" : e, n = i.search, a = n === void 0 ? "" : n, r = i.hash, o = r === void 0 ? "" : r;
916
+ var e = i.pathname, t = e === void 0 ? "/" : e, r = i.search, a = r === void 0 ? "" : r, n = i.hash, o = n === void 0 ? "" : n;
919
917
  return a && a !== "?" && (t += a.charAt(0) === "?" ? a : "?" + a), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
920
918
  }
921
919
  function et(i) {
@@ -923,25 +921,25 @@ function et(i) {
923
921
  if (i) {
924
922
  var t = i.indexOf("#");
925
923
  t >= 0 && (e.hash = i.substr(t), i = i.substr(0, t));
926
- var n = i.indexOf("?");
927
- n >= 0 && (e.search = i.substr(n), i = i.substr(0, n)), i && (e.pathname = i);
924
+ var r = i.indexOf("?");
925
+ r >= 0 && (e.search = i.substr(r), i = i.substr(0, r)), i && (e.pathname = i);
928
926
  }
929
927
  return e;
930
928
  }
931
929
  function be(i) {
932
930
  return pt(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((e) => e.trim()).filter((e) => e !== "");
933
931
  }
934
- function ie(i) {
932
+ function se(i) {
935
933
  var t;
936
934
  Rt(
937
- (n) => at(n == null ? void 0 : n.toString),
935
+ (r) => at(r == null ? void 0 : r.toString),
938
936
  i,
939
937
  "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
940
- ), i = i.filter((n) => n).flatMap(String);
938
+ ), i = i.filter((r) => r).flatMap(String);
941
939
  let e = (t = i.shift()) == null ? void 0 : t.toString();
942
940
  if (e) {
943
- for (const n of i.map((a) => a.toString()))
944
- n.startsWith(".") ? e = Fe(e, n) : e[e.length - 1] !== "/" ? n[0] !== "/" ? e += "/" + n : e += n : n[0] === "/" ? e += n.slice(1) : e += n;
941
+ for (const r of i.map((a) => a.toString()))
942
+ r.startsWith(".") ? e = Fe(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
945
943
  e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
946
944
  }
947
945
  return e ?? "";
@@ -952,96 +950,96 @@ function Fe(i, e) {
952
950
  let t = i;
953
951
  for (; ; )
954
952
  if (e.startsWith("..")) {
955
- for (let n = t.length; n > 0; --n)
956
- if (t[n] === "/" || n === 0) {
957
- t = t.slice(0, n), e = e.replace(/^\.\.\/?/, "");
953
+ for (let r = t.length; r > 0; --r)
954
+ if (t[r] === "/" || r === 0) {
955
+ t = t.slice(0, r), e = e.replace(/^\.\.\/?/, "");
958
956
  break;
959
957
  }
960
958
  } else if (e.startsWith("."))
961
959
  e = e.replace(/^\.\/?/, "");
962
960
  else
963
961
  break;
964
- return ie([t, e]);
962
+ return se([t, e]);
965
963
  }
966
964
  function tt(i) {
967
965
  if (!i) return {};
968
966
  i.startsWith("?") && (i = i.slice(1));
969
967
  const e = i.split("&").filter((t) => t.trim() !== "").map((t) => {
970
- const [n, a] = t.split("=").map((r) => r.trim());
971
- return a.toLowerCase() === "true" ? [n, !0] : a.toLowerCase() === "false" ? [n, !1] : isNaN(Number(a)) ? [n, a] : [n, Number(a)];
968
+ const [r, a] = t.split("=").map((n) => n.trim());
969
+ return a.toLowerCase() === "true" ? [r, !0] : a.toLowerCase() === "false" ? [r, !1] : isNaN(Number(a)) ? [r, a] : [r, Number(a)];
972
970
  });
973
971
  return Object.fromEntries(e);
974
972
  }
975
973
  function ft(i, e, t = {}) {
976
974
  var o;
977
- const [n, a] = e.split("?"), r = be(n);
978
- e: for (const h of i) {
979
- const { fragments: l } = h;
980
- if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== r.length || t.willMatch && !t.willMatch(h))
975
+ const [r, a] = e.split("?"), n = be(r);
976
+ e: for (const u of i) {
977
+ const { fragments: l } = u;
978
+ if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== n.length || t.willMatch && !t.willMatch(u))
981
979
  continue e;
982
- const f = [];
983
- t: for (let u = 0; u < l.length; u++) {
984
- const y = r[u], E = l[u];
985
- if (y == null && E.type !== 3)
980
+ const m = [];
981
+ t: for (let h = 0; h < l.length; h++) {
982
+ const y = n[h], S = l[h];
983
+ if (y == null && S.type !== 3)
986
984
  continue e;
987
- switch (E.type) {
985
+ switch (S.type) {
988
986
  case 1:
989
- if (E.name.toLowerCase() === y.toLowerCase()) {
990
- f.push(E);
987
+ if (S.name.toLowerCase() === y.toLowerCase()) {
988
+ m.push(S);
991
989
  break;
992
990
  } else
993
991
  continue e;
994
992
  case 2:
995
- f.push({ ...E, value: y });
993
+ m.push({ ...S, value: y });
996
994
  break;
997
995
  case 3:
998
- f.push({ ...E, value: r.slice(u).join("/") });
996
+ m.push({ ...S, value: n.slice(h).join("/") });
999
997
  break t;
1000
998
  case 4:
1001
999
  if (isNaN(Number(y)))
1002
1000
  continue e;
1003
- f.push({ ...E, value: Number(y) });
1001
+ m.push({ ...S, value: Number(y) });
1004
1002
  break;
1005
1003
  default:
1006
- throw new Error(`Unknown fragment type: ${E.type}`);
1004
+ throw new Error(`Unknown fragment type: ${S.type}`);
1007
1005
  }
1008
1006
  }
1009
- const g = /* @__PURE__ */ Object.create(null);
1010
- for (const u of f)
1011
- u.type === 2 && (g[u.name] = decodeURIComponent(u.value)), u.type === 4 && (g[u.name] = u.value), u.type === 3 && (g.wildcard = "/" + decodeURIComponent(u.value));
1007
+ const p = /* @__PURE__ */ Object.create(null);
1008
+ for (const h of m)
1009
+ h.type === 2 && (p[h.name] = decodeURIComponent(h.value)), h.type === 4 && (p[h.name] = h.value), h.type === 3 && (p.wildcard = "/" + decodeURIComponent(h.value));
1012
1010
  return {
1013
- path: "/" + f.map((u) => u.value).join("/"),
1014
- pattern: "/" + l.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
1015
- params: g,
1011
+ path: "/" + m.map((h) => h.value).join("/"),
1012
+ pattern: "/" + l.map((h) => h.type === 2 ? `{${h.name}}` : h.type === 4 ? `{#${h.name}}` : h.name).join("/"),
1013
+ params: p,
1016
1014
  query: tt(a),
1017
- meta: h.meta
1015
+ meta: u.meta
1018
1016
  };
1019
1017
  }
1020
1018
  }
1021
1019
  function Qt(i) {
1022
- const e = [], t = [], n = [], a = [];
1020
+ const e = [], t = [], r = [], a = [];
1023
1021
  for (const o of i) {
1024
- const { fragments: h } = o;
1025
- h.some(
1022
+ const { fragments: u } = o;
1023
+ u.some(
1026
1024
  (l) => l.type === 3
1027
1025
  /* Wildcard */
1028
- ) ? a.push(o) : h.some(
1026
+ ) ? a.push(o) : u.some(
1029
1027
  (l) => l.type === 4
1030
1028
  /* NumericParam */
1031
- ) ? t.push(o) : h.some(
1029
+ ) ? t.push(o) : u.some(
1032
1030
  (l) => l.type === 2
1033
1031
  /* Param */
1034
- ) ? n.push(o) : e.push(o);
1032
+ ) ? r.push(o) : e.push(o);
1035
1033
  }
1036
- const r = (o, h) => o.fragments.length > h.fragments.length ? -1 : 1;
1037
- return e.sort(r), t.sort(r), n.sort(r), a.sort(r), [...e, ...t, ...n, ...a];
1034
+ const n = (o, u) => o.fragments.length > u.fragments.length ? -1 : 1;
1035
+ return e.sort(n), t.sort(n), r.sort(n), a.sort(n), [...e, ...t, ...r, ...a];
1038
1036
  }
1039
1037
  function Jt(i) {
1040
1038
  const e = be(i), t = [];
1041
- for (let n = 0; n < e.length; n++) {
1042
- const a = e[n];
1039
+ for (let r = 0; r < e.length; r++) {
1040
+ const a = e[r];
1043
1041
  if (a === "*") {
1044
- if (n !== e.length - 1)
1042
+ if (r !== e.length - 1)
1045
1043
  throw new Error(`Wildcard must be at the end of a pattern. Received: ${i}`);
1046
1044
  t.push({
1047
1045
  type: 3,
@@ -1060,65 +1058,65 @@ function Jt(i) {
1060
1058
  }
1061
1059
  return t;
1062
1060
  }
1063
- var Se, M, ee, P, ze, W, Re, te, z, he, fe, de, xe, J, rt, nt;
1061
+ var Se, M, Z, E, ze, G, Re, ee, W, ue, he, fe, xe, Q, rt, nt;
1064
1062
  class Yt {
1065
1063
  constructor(e, t) {
1066
- d(this, J);
1067
- d(this, Se);
1068
- d(this, M);
1069
- d(this, ee);
1070
- d(this, P);
1071
- d(this, ze, 0);
1072
- d(this, W, []);
1073
- d(this, Re);
1074
- d(this, te, []);
1064
+ f(this, Q);
1065
+ f(this, Se);
1066
+ f(this, M);
1067
+ f(this, Z);
1068
+ f(this, E);
1069
+ f(this, ze, 0);
1070
+ f(this, G, []);
1071
+ f(this, Re);
1072
+ f(this, ee, []);
1075
1073
  // Callbacks that need to be called on unmount.
1076
- d(this, z, []);
1074
+ f(this, W, []);
1077
1075
  /**
1078
1076
  * The currently matched route pattern, if any.
1079
1077
  */
1080
- S(this, "$pattern");
1081
- d(this, he);
1078
+ P(this, "$pattern");
1079
+ f(this, ue);
1082
1080
  /**
1083
1081
  * The current URL path.
1084
1082
  */
1085
- S(this, "$path");
1086
- d(this, fe);
1083
+ P(this, "$path");
1084
+ f(this, he);
1087
1085
  /**
1088
1086
  * The current named path params.
1089
1087
  */
1090
- S(this, "$params");
1091
- d(this, de);
1088
+ P(this, "$params");
1089
+ f(this, fe);
1092
1090
  /**
1093
1091
  * The current query params. Changes to this object will be reflected in the URL.
1094
1092
  */
1095
- S(this, "$query");
1096
- d(this, xe);
1097
- b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this, ee, t);
1098
- const [n, a] = oe(null), [r, o] = oe(""), [h, l] = oe({}), [m, f] = oe(
1093
+ P(this, "$query");
1094
+ f(this, xe);
1095
+ b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this, Z, t);
1096
+ const [r, a] = ie(null), [n, o] = ie(""), [u, l] = ie({}), [g, m] = ie(
1099
1097
  tt(typeof window > "u" ? "" : window.location.search ?? "")
1100
1098
  );
1101
- this.$pattern = n, b(this, he, a), this.$path = r, b(this, fe, o), this.$params = h, b(this, de, l), this.$query = m, b(this, xe, f), e.beforeMount(() => {
1102
- s(this, P) != null && (s(this, z).push(
1103
- gt([m], (g) => {
1104
- const u = new URLSearchParams();
1105
- for (const E in g)
1106
- u.set(E, String(g[E]));
1107
- const y = "?" + u.toString();
1108
- y != s(this, P).location.search && s(this, P).replace({
1109
- pathname: s(this, P).location.pathname,
1099
+ this.$pattern = r, b(this, ue, a), this.$path = n, b(this, he, o), this.$params = u, b(this, fe, l), this.$query = g, b(this, xe, m), e.beforeMount(() => {
1100
+ s(this, E) != null && (s(this, W).push(
1101
+ gt([g], (p) => {
1102
+ const h = new URLSearchParams();
1103
+ for (const S in p)
1104
+ h.set(S, String(p[S]));
1105
+ const y = "?" + h.toString();
1106
+ y != s(this, E).location.search && s(this, E).replace({
1107
+ pathname: s(this, E).location.pathname,
1110
1108
  search: y
1111
1109
  });
1112
1110
  })
1113
- ), s(this, z).push(s(this, P).listen(k(this, J, nt).bind(this))), k(this, J, nt).call(this, s(this, P)), s(this, z).push(
1114
- er(s(this, ee).rootElement, (g) => {
1115
- let u = g.getAttribute("href");
1116
- s(this, M).info("Intercepted link click", g, u), /^https?:\/\/|^\//.test(u) || (u = ie([s(this, P).location.pathname, u])), s(this, P).push(u);
1111
+ ), s(this, W).push(s(this, E).listen(k(this, Q, nt).bind(this))), k(this, Q, nt).call(this, s(this, E)), s(this, W).push(
1112
+ er(s(this, Z).rootElement, (p) => {
1113
+ let h = p.getAttribute("href");
1114
+ s(this, M).info("Intercepted link click", p, h), /^https?:\/\/|^\//.test(h) || (h = se([s(this, E).location.pathname, h])), s(this, E).push(h);
1117
1115
  })
1118
- ), s(this, M).info("Intercepting <a> clicks within root element:", s(this, ee).rootElement));
1116
+ ), s(this, M).info("Intercepting <a> clicks within root element:", s(this, Z).rootElement));
1119
1117
  }), e.onUnmount(() => {
1120
- for (; s(this, z).length > 0; )
1121
- s(this, z).pop()();
1118
+ for (; s(this, W).length > 0; )
1119
+ s(this, W).pop()();
1122
1120
  });
1123
1121
  }
1124
1122
  setup(e) {
@@ -1128,20 +1126,20 @@ class Yt {
1128
1126
  );
1129
1127
  return;
1130
1128
  }
1131
- e.style === "hash" ? b(this, P, Kt()) : b(this, P, Bt()), b(this, te, Qt(
1132
- e.routes.flatMap((t) => k(this, J, rt).call(this, t)).map((t) => ({
1129
+ e.style === "hash" ? b(this, E, Kt()) : b(this, E, Bt()), b(this, ee, Qt(
1130
+ e.routes.flatMap((t) => k(this, Q, rt).call(this, t)).map((t) => ({
1133
1131
  pattern: t.pattern,
1134
1132
  meta: t.meta,
1135
1133
  fragments: Jt(t.pattern)
1136
1134
  }))
1137
1135
  ));
1138
- for (const t of s(this, te))
1136
+ for (const t of s(this, ee))
1139
1137
  if (t.meta.redirect) {
1140
- let n;
1141
- if (!at(t.meta.redirect)) if (q(t.meta.redirect)) {
1142
- if (n = t.meta.redirect, !ft(s(this, te), n, {
1143
- willMatch(r) {
1144
- return r !== t;
1138
+ let r;
1139
+ if (!at(t.meta.redirect)) if (F(t.meta.redirect)) {
1140
+ if (r = t.meta.redirect, !ft(s(this, ee), r, {
1141
+ willMatch(n) {
1142
+ return n !== t;
1145
1143
  }
1146
1144
  }))
1147
1145
  throw new Error(
@@ -1159,7 +1157,7 @@ class Yt {
1159
1157
  * Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
1160
1158
  */
1161
1159
  go(e, t = {}) {
1162
- if (s(this, P) == null) {
1160
+ if (s(this, E) == null) {
1163
1161
  s(this, M).crash(
1164
1162
  new Error(
1165
1163
  "Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1167,14 +1165,14 @@ class Yt {
1167
1165
  );
1168
1166
  return;
1169
1167
  }
1170
- let n;
1171
- Array.isArray(e) ? n = ie(e) : n = e.toString(), n = Fe(s(this, P).location.pathname, n), t.preserveQuery && (n += s(this, P).location.search), t.replace ? s(this, P).replace(n) : s(this, P).push(n);
1168
+ let r;
1169
+ Array.isArray(e) ? r = se(e) : r = e.toString(), r = Fe(s(this, E).location.pathname, r), t.preserveQuery && (r += s(this, E).location.search), t.replace ? s(this, E).replace(r) : s(this, E).push(r);
1172
1170
  }
1173
1171
  /**
1174
1172
  * Navigate backward. Pass a number of steps to hit the back button that many times.
1175
1173
  */
1176
1174
  back(e = 1) {
1177
- if (s(this, P) == null) {
1175
+ if (s(this, E) == null) {
1178
1176
  s(this, M).crash(
1179
1177
  new Error(
1180
1178
  "Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1182,13 +1180,13 @@ class Yt {
1182
1180
  );
1183
1181
  return;
1184
1182
  }
1185
- s(this, P).go(-e);
1183
+ s(this, E).go(-e);
1186
1184
  }
1187
1185
  /**
1188
1186
  * Navigate forward. Pass a number of steps to hit the forward button that many times.
1189
1187
  */
1190
1188
  forward(e = 1) {
1191
- if (s(this, P) == null) {
1189
+ if (s(this, E) == null) {
1192
1190
  s(this, M).crash(
1193
1191
  new Error(
1194
1192
  "Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1196,16 +1194,16 @@ class Yt {
1196
1194
  );
1197
1195
  return;
1198
1196
  }
1199
- s(this, P).go(e);
1197
+ s(this, E).go(e);
1200
1198
  }
1201
1199
  }
1202
- Se = new WeakMap(), M = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), ze = new WeakMap(), W = new WeakMap(), Re = new WeakMap(), te = new WeakMap(), z = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), de = new WeakMap(), xe = new WeakMap(), J = new WeakSet(), /**
1200
+ Se = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), ze = new WeakMap(), G = new WeakMap(), Re = new WeakMap(), ee = new WeakMap(), W = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), xe = new WeakMap(), Q = new WeakSet(), /**
1203
1201
  * Parses a route definition object into a set of matchable routes.
1204
1202
  *
1205
1203
  * @param route - Route config object.
1206
1204
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
1207
1205
  */
1208
- rt = function(e, t = [], n = []) {
1206
+ rt = function(e, t = [], r = []) {
1209
1207
  if (!(typeof e == "object" && !Array.isArray(e)) || typeof e.path != "string")
1210
1208
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
1211
1209
  if (e.redirect && e.routes)
@@ -1218,91 +1216,91 @@ rt = function(e, t = [], n = []) {
1218
1216
  for (const l of t)
1219
1217
  a.push(...be(l.path));
1220
1218
  a.push(...be(e.path)), a[a.length - 1] === "*" && a.pop();
1221
- const r = [];
1219
+ const n = [];
1222
1220
  if (e.redirect) {
1223
1221
  let l = e.redirect;
1224
- return q(l) && (l = Fe(ie(a), l), l.startsWith("/") || (l = "/" + l)), r.push({
1225
- pattern: "/" + ie([...a, ...be(e.path)]),
1222
+ return F(l) && (l = Fe(se(a), l), l.startsWith("/") || (l = "/" + l)), n.push({
1223
+ pattern: "/" + se([...a, ...be(e.path)]),
1226
1224
  meta: {
1227
1225
  redirect: l
1228
1226
  }
1229
- }), r;
1227
+ }), n;
1230
1228
  }
1231
1229
  let o = mt;
1232
1230
  if (typeof e.view == "function")
1233
1231
  o = e.view;
1234
1232
  else if (e.view)
1235
1233
  throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
1236
- const h = { id: it(this, ze)._++, view: o };
1234
+ const u = { id: it(this, ze)._++, view: o };
1237
1235
  if (e.routes)
1238
1236
  for (const l of e.routes)
1239
- r.push(...k(this, J, rt).call(this, l, [...t, e], [...n, h]));
1237
+ n.push(...k(this, Q, rt).call(this, l, [...t, e], [...r, u]));
1240
1238
  else
1241
- r.push({
1242
- pattern: parent ? ie([...t.map((l) => l.path), e.path]) : e.path,
1239
+ n.push({
1240
+ pattern: parent ? se([...t.map((l) => l.path), e.path]) : e.path,
1243
1241
  meta: {
1244
1242
  pattern: e.path,
1245
- layers: [...n, h],
1243
+ layers: [...r, u],
1246
1244
  beforeMatch: e.beforeMatch
1247
1245
  }
1248
1246
  });
1249
- return r;
1247
+ return n;
1250
1248
  }, nt = async function({ location: e }) {
1251
1249
  e.search !== s(this, Re) && (b(this, Re, e.search), s(this, xe).call(this, tt(e.search)));
1252
- const t = ft(s(this, te), e.pathname);
1250
+ const t = ft(s(this, ee), e.pathname);
1253
1251
  if (!t) {
1254
- s(this, he).call(this, null), s(this, fe).call(this, e.pathname), s(this, de).call(this, {
1252
+ s(this, ue).call(this, null), s(this, he).call(this, e.pathname), s(this, fe).call(this, {
1255
1253
  wildcard: e.pathname
1256
1254
  });
1257
1255
  return;
1258
1256
  }
1259
1257
  if (t.meta.beforeMatch && await t.meta.beforeMatch({
1260
1258
  // TODO: Allow setting context variables from here.
1261
- redirect: (n) => {
1259
+ redirect: (r) => {
1262
1260
  throw new Error("Redirect not yet implemented.");
1263
1261
  }
1264
1262
  }), t.meta.redirect != null)
1265
1263
  if (typeof t.meta.redirect == "string") {
1266
- const n = tr(t.meta.redirect, t.params);
1267
- s(this, M).info(`↩️ redirecting from '${t.path}' to '${n}'`), s(this, P).replace(n);
1264
+ const r = tr(t.meta.redirect, t.params);
1265
+ s(this, M).info(`↩️ redirecting from '${t.path}' to '${r}'`), s(this, E).replace(r);
1268
1266
  } else if (typeof t.meta.redirect == "function") {
1269
- const n = {
1267
+ const r = {
1270
1268
  path: t.path,
1271
1269
  pattern: t.pattern,
1272
1270
  params: t.params,
1273
1271
  query: t.query
1274
1272
  };
1275
- let a = await t.meta.redirect(n);
1273
+ let a = await t.meta.redirect(r);
1276
1274
  if (typeof a != "string")
1277
1275
  throw new Error("Redirect function must return a path to redirect to.");
1278
- a.startsWith("/") || (a = Fe(t.path, a)), s(this, M).info(`Redirecting to: '${a}'`), s(this, P).replace(a);
1276
+ a.startsWith("/") || (a = Fe(t.path, a)), s(this, M).info(`Redirecting to: '${a}'`), s(this, E).replace(a);
1279
1277
  } else
1280
1278
  throw new TypeError("Redirect must either be a path string or a function.");
1281
- else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this, fe).call(this, t.path), s(this, de).call(this, t.params), t.pattern !== this.$pattern.get()) {
1282
- s(this, he).call(this, t.pattern);
1283
- const n = t.meta.layers;
1284
- for (let a = 0; a < n.length; a++) {
1285
- const r = n[a], o = s(this, W)[a];
1286
- if ((o == null ? void 0 : o.id) !== r.id) {
1287
- b(this, W, s(this, W).slice(0, a));
1288
- const h = s(this, W).at(-1);
1279
+ else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this, he).call(this, t.path), s(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
1280
+ s(this, ue).call(this, t.pattern);
1281
+ const r = t.meta.layers;
1282
+ for (let a = 0; a < r.length; a++) {
1283
+ const n = r[a], o = s(this, G)[a];
1284
+ if ((o == null ? void 0 : o.id) !== n.id) {
1285
+ b(this, G, s(this, G).slice(0, a));
1286
+ const u = s(this, G).at(-1);
1289
1287
  o && o.node.isMounted && o.node.unmount();
1290
1288
  let l;
1291
- h ? l = h.node.setChildView(r.view) : l = s(this, ee).rootView.setChildView(r.view), s(this, W).push({ id: r.id, node: l });
1289
+ u ? l = u.node.setChildView(n.view) : l = s(this, Z).rootView.setChildView(n.view), s(this, G).push({ id: n.id, node: l });
1292
1290
  }
1293
1291
  }
1294
1292
  }
1295
1293
  };
1296
1294
  const Xt = /(noopener|noreferrer) (noopener|noreferrer)/, Zt = /^[\w-_]+:/;
1297
1295
  function er(i, e, t = window) {
1298
- function n(r) {
1299
- return !r || r === i ? null : r.localName !== "a" || r.href === void 0 ? n(r.parentNode) : r;
1296
+ function r(n) {
1297
+ return !n || n === i ? null : n.localName !== "a" || n.href === void 0 ? r(n.parentNode) : n;
1300
1298
  }
1301
- function a(r) {
1302
- if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
1299
+ function a(n) {
1300
+ if (n.button && n.button !== 0 || n.ctrlKey || n.metaKey || n.altKey || n.shiftKey || n.defaultPrevented)
1303
1301
  return;
1304
- const o = n(r.target);
1305
- o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && Xt.test(o.getAttribute("rel")) || Zt.test(o.getAttribute("href")) || (r.preventDefault(), e(o)));
1302
+ const o = r(n.target);
1303
+ o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && Xt.test(o.getAttribute("rel")) || Zt.test(o.getAttribute("href")) || (n.preventDefault(), e(o)));
1306
1304
  }
1307
1305
  return i.addEventListener("click", a), function() {
1308
1306
  i.removeEventListener("click", a);
@@ -1310,50 +1308,50 @@ function er(i, e, t = window) {
1310
1308
  }
1311
1309
  function tr(i, e) {
1312
1310
  for (const t in e) {
1313
- const n = e[t].toString();
1314
- i = i.replace(`{${t}}`, n).replace(`{#${t}}`, n);
1311
+ const r = e[t].toString();
1312
+ i = i.replace(`{${t}}`, r).replace(`{#${t}}`, r);
1315
1313
  }
1316
1314
  return i;
1317
1315
  }
1318
- var B, Le, K, re, Ne, Oe, Me, Te, je, x, Q;
1316
+ var z, Le, B, te, Ne, Oe, Me, Te, je, x, K;
1319
1317
  class rr {
1320
1318
  constructor() {
1321
- S(this, "http");
1322
- S(this, "i18n");
1323
- S(this, "render");
1324
- S(this, "router");
1325
- d(this, B, !1);
1326
- d(this, Le, "production");
1327
- d(this, K);
1328
- d(this, re);
1329
- d(this, Ne, _t);
1330
- d(this, Oe, []);
1331
- d(this, Me, []);
1332
- d(this, Te, []);
1333
- d(this, je, []);
1334
- d(this, x, {
1319
+ P(this, "http");
1320
+ P(this, "i18n");
1321
+ P(this, "render");
1322
+ P(this, "router");
1323
+ f(this, z, !1);
1324
+ f(this, Le, "production");
1325
+ f(this, B);
1326
+ f(this, te);
1327
+ f(this, Ne, _t);
1328
+ f(this, Oe, []);
1329
+ f(this, Me, []);
1330
+ f(this, Te, []);
1331
+ f(this, je, []);
1332
+ f(this, x, {
1335
1333
  info: "development",
1336
1334
  log: "development",
1337
1335
  warn: "development",
1338
1336
  error: !0
1339
1337
  });
1340
- d(this, Q, ct("*,-dolla/*"));
1341
- S(this, "createState", oe);
1342
- S(this, "createSettableState", xt);
1343
- S(this, "toSettableState", Lt);
1344
- S(this, "toState", Qe);
1345
- S(this, "valueOf", Nt);
1346
- S(this, "derive", ye);
1347
- S(this, "watch", gt);
1348
- S(this, "createRef", Ot);
1349
- S(this, "isRef", Mt);
1338
+ f(this, K, ct("*,-dolla/*"));
1339
+ P(this, "createState", ie);
1340
+ P(this, "createSettableState", xt);
1341
+ P(this, "toSettableState", Lt);
1342
+ P(this, "toState", Qe);
1343
+ P(this, "valueOf", Nt);
1344
+ P(this, "derive", ye);
1345
+ P(this, "watch", gt);
1346
+ P(this, "createRef", Ot);
1347
+ P(this, "isRef", Mt);
1350
1348
  const e = this;
1351
1349
  this.http = new Ct(), this.i18n = new It(this), this.render = new Wt(this), this.router = new Yt(this, {
1352
1350
  get rootElement() {
1353
- return s(e, K);
1351
+ return s(e, B);
1354
1352
  },
1355
1353
  get rootView() {
1356
- return s(e, re);
1354
+ return s(e, te);
1357
1355
  }
1358
1356
  });
1359
1357
  }
@@ -1361,7 +1359,7 @@ class rr {
1361
1359
  * True when the app is connected to a DOM node and displayed to the user.
1362
1360
  */
1363
1361
  get isMounted() {
1364
- return s(this, B);
1362
+ return s(this, z);
1365
1363
  }
1366
1364
  /**
1367
1365
  * Get the current environment that this app is running in.
@@ -1385,22 +1383,22 @@ class rr {
1385
1383
  b(this, Ne, e);
1386
1384
  }
1387
1385
  async mount(e, t) {
1388
- if (s(this, B))
1386
+ if (s(this, z))
1389
1387
  throw new Error("Dolla is already mounted.");
1390
- if (q(e)) {
1388
+ if (F(e)) {
1391
1389
  const a = document.querySelector(e);
1392
- ut(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, K, a);
1390
+ ut(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, B, a);
1393
1391
  } else
1394
- ut(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, K, e);
1395
- let n;
1396
- t ? n = ht(t) : n = ht(mt), b(this, re, this.constructView(n.type, n.props)), await Promise.all(s(this, Oe).map((a) => a())), s(this, re).mount(s(this, K)), b(this, B, !0);
1392
+ ut(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, B, e);
1393
+ let r;
1394
+ t ? r = ht(t) : r = ht(mt), b(this, te, this.constructView(r.type, r.props)), await Promise.all(s(this, Oe).map((a) => a())), s(this, te).mount(s(this, B)), b(this, z, !0);
1397
1395
  for (const a of s(this, Me))
1398
1396
  a();
1399
1397
  }
1400
1398
  async unmount() {
1401
1399
  var e;
1402
- if (s(this, B)) {
1403
- await Promise.all(s(this, Te).map((t) => t())), (e = s(this, re)) == null || e.unmount(), b(this, B, !1);
1400
+ if (s(this, z)) {
1401
+ await Promise.all(s(this, Te).map((t) => t())), (e = s(this, te)) == null || e.unmount(), b(this, z, !1);
1404
1402
  for (const t of s(this, je))
1405
1403
  t();
1406
1404
  }
@@ -1436,20 +1434,20 @@ class rr {
1436
1434
  */
1437
1435
  setLoggles(e) {
1438
1436
  for (const t in e) {
1439
- const n = e[t];
1440
- n && (s(this, x)[t] = n);
1437
+ const r = e[t];
1438
+ r && (s(this, x)[t] = r);
1441
1439
  }
1442
1440
  }
1443
1441
  setLogFilter(e) {
1444
- b(this, Q, ct(e));
1442
+ b(this, K, ct(e));
1445
1443
  }
1446
1444
  createLogger(e, t) {
1447
- const n = Qe(e), a = (t == null ? void 0 : t.console) ?? Tt(), r = this;
1445
+ const r = Qe(e), a = (t == null ? void 0 : t.console) ?? Tt(), n = this;
1448
1446
  return {
1449
1447
  get info() {
1450
- var h;
1451
- const o = n.get();
1452
- if (s(r, x).info === !1 || q(s(r, x).info) && s(r, x).info !== r.getEnv() || !s(h = r, Q).call(h, o))
1448
+ var u;
1449
+ const o = r.get();
1450
+ if (s(n, x).info === !1 || F(s(n, x).info) && s(n, x).info !== n.getEnv() || !s(u = n, K).call(u, o))
1453
1451
  return Ae;
1454
1452
  {
1455
1453
  let l = `%c${o}`;
@@ -1464,9 +1462,9 @@ class rr {
1464
1462
  }
1465
1463
  },
1466
1464
  get log() {
1467
- var h;
1468
- const o = n.get();
1469
- if (s(r, x).log === !1 || q(s(r, x).log) && s(r, x).log !== r.getEnv() || !s(h = r, Q).call(h, o))
1465
+ var u;
1466
+ const o = r.get();
1467
+ if (s(n, x).log === !1 || F(s(n, x).log) && s(n, x).log !== n.getEnv() || !s(u = n, K).call(u, o))
1470
1468
  return Ae;
1471
1469
  {
1472
1470
  let l = `%c${o}`;
@@ -1481,9 +1479,9 @@ class rr {
1481
1479
  }
1482
1480
  },
1483
1481
  get warn() {
1484
- var h;
1485
- const o = n.get();
1486
- if (s(r, x).warn === !1 || q(s(r, x).warn) && s(r, x).warn !== r.getEnv() || !s(h = r, Q).call(h, o))
1482
+ var u;
1483
+ const o = r.get();
1484
+ if (s(n, x).warn === !1 || F(s(n, x).warn) && s(n, x).warn !== n.getEnv() || !s(u = n, K).call(u, o))
1487
1485
  return Ae;
1488
1486
  {
1489
1487
  let l = `%c${o}`;
@@ -1498,9 +1496,9 @@ class rr {
1498
1496
  }
1499
1497
  },
1500
1498
  get error() {
1501
- var h;
1502
- const o = n.get();
1503
- if (s(r, x).error === !1 || q(s(r, x).error) && s(r, x).error !== r.getEnv() || !s(h = r, Q).call(h, o))
1499
+ var u;
1500
+ const o = r.get();
1501
+ if (s(n, x).error === !1 || F(s(n, x).error) && s(n, x).error !== n.getEnv() || !s(u = n, K).call(u, o))
1504
1502
  return Ae;
1505
1503
  {
1506
1504
  let l = `%c${o}`;
@@ -1515,19 +1513,19 @@ class rr {
1515
1513
  }
1516
1514
  },
1517
1515
  crash(o) {
1518
- throw r.isMounted && (r.unmount(), r.constructView(s(r, Ne), {
1516
+ throw n.isMounted && (n.unmount(), n.constructView(s(n, Ne), {
1519
1517
  error: o,
1520
- loggerName: n.get(),
1518
+ loggerName: r.get(),
1521
1519
  uid: t == null ? void 0 : t.uid
1522
- }).mount(s(r, K))), o;
1520
+ }).mount(s(n, B))), o;
1523
1521
  }
1524
1522
  };
1525
1523
  }
1526
1524
  /**
1527
1525
  *
1528
1526
  */
1529
- constructView(e, t, n = []) {
1530
- return jt({ root: this, data: {} }, e, t, n);
1527
+ constructView(e, t, r = []) {
1528
+ return jt({ root: this, data: {} }, e, t, r);
1531
1529
  }
1532
1530
  /**
1533
1531
  *
@@ -1536,7 +1534,7 @@ class rr {
1536
1534
  return At(Dt({ root: this, data: {} }, e));
1537
1535
  }
1538
1536
  }
1539
- B = new WeakMap(), Le = new WeakMap(), K = new WeakMap(), re = new WeakMap(), Ne = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), je = new WeakMap(), x = new WeakMap(), Q = new WeakMap();
1537
+ z = new WeakMap(), Le = new WeakMap(), B = new WeakMap(), te = new WeakMap(), Ne = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), je = new WeakMap(), x = new WeakMap(), K = new WeakMap();
1540
1538
  const dt = new rr(), ir = dt.i18n.t.bind(dt.i18n);
1541
1539
  export {
1542
1540
  Pt as cond,
@@ -1544,7 +1542,7 @@ export {
1544
1542
  Ot as createRef,
1545
1543
  xt as createSettableState,
1546
1544
  cr as createSetter,
1547
- oe as createState,
1545
+ ie as createState,
1548
1546
  dt as default,
1549
1547
  ye as derive,
1550
1548
  ot as html,