@manyducks.co/dolla 2.0.0-alpha.10 → 2.0.0-alpha.11

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
@@ -1,22 +1,22 @@
1
- var gt = Object.defineProperty;
2
- var Ze = (a) => {
1
+ var wt = Object.defineProperty;
2
+ var tt = (a) => {
3
3
  throw TypeError(a);
4
4
  };
5
- var mt = (a, e, t) => e in a ? gt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
6
- var P = (a, e, t) => mt(a, typeof e != "symbol" ? e + "" : e, t), ze = (a, e, t) => e.has(a) || Ze("Cannot " + t);
7
- var n = (a, e, t) => (ze(a, e, "read from private field"), t ? t.call(a) : e.get(a)), h = (a, e, t) => e.has(a) ? Ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), g = (a, e, t, r) => (ze(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), S = (a, e, t) => (ze(a, e, "access private method"), t);
8
- var et = (a, e, t, r) => ({
5
+ var bt = (a, e, t) => e in a ? wt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
6
+ var k = (a, e, t) => bt(a, typeof e != "symbol" ? e + "" : e, t), Ge = (a, e, t) => e.has(a) || tt("Cannot " + t);
7
+ var n = (a, e, t) => (Ge(a, e, "read from private field"), t ? t.call(a) : e.get(a)), f = (a, e, t) => e.has(a) ? tt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), y = (a, e, t, r) => (Ge(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), P = (a, e, t) => (Ge(a, e, "access private method"), t);
8
+ var rt = (a, e, t, r) => ({
9
9
  set _(i) {
10
- g(a, e, i, t);
10
+ y(a, e, i, t);
11
11
  },
12
12
  get _() {
13
13
  return n(a, e, r);
14
14
  }
15
15
  });
16
- import { h as tt, c as wt, i as Ge, t as Be, a as yt, d as ae, b as bt, e as Xe, f as U, g as K, j as lt, k as vt, w as ut, P as ht, l as rt, m as $t, n as Et, v as kt, o as Pt, p as St, q as nt, r as at, s as Lt, u as Te, x as Ae, y as Rt, z as xt, A as Ot } from "./passthrough-9kwwjgWk.js";
17
- import { B as rr, C as nr, D as ar } from "./passthrough-9kwwjgWk.js";
18
- function Nt(a) {
19
- return tt`
16
+ import { h as nt, c as vt, i as Be, t as Ke, d as me, a as $t, b as et, e as U, f as Q, g as ct, j as Et, w as ut, P as ht, k as at, l as kt, m as Pt, v as St, n as Lt, o as Rt, p as st, q as it, r as xt, s as Ae, u as De, x as Mt, y as Nt, z as Ot } from "./passthrough-Bu7iYKPr.js";
17
+ import { A as ar, B as sr, C as ir } from "./passthrough-Bu7iYKPr.js";
18
+ function Tt(a) {
19
+ return nt`
20
20
  <div
21
21
  style=${{
22
22
  backgroundColor: "#880000",
@@ -30,7 +30,7 @@ function Nt(a) {
30
30
  <h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
31
31
  <p style=${{ marginBottom: "0.25rem" }}>
32
32
  <span style=${{ fontFamily: "monospace" }}>${a.loggerName}</span>
33
- ${wt(a.uid, tt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
33
+ ${vt(a.uid, nt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
34
34
  ${" "}says:
35
35
  </p>
36
36
  <blockquote
@@ -62,12 +62,12 @@ function Nt(a) {
62
62
  </div>
63
63
  `;
64
64
  }
65
- var J, Fe, M, C;
66
- class Mt {
65
+ var J, We, T, j;
66
+ class At {
67
67
  constructor() {
68
- h(this, M);
69
- h(this, J, []);
70
- h(this, Fe, Tt());
68
+ f(this, T);
69
+ f(this, J, []);
70
+ f(this, We, Dt());
71
71
  }
72
72
  /**
73
73
  * Adds a new middleware that will apply to subsequent requests.
@@ -81,51 +81,51 @@ class Mt {
81
81
  };
82
82
  }
83
83
  async get(e, t) {
84
- return S(this, M, C).call(this, "get", e, t);
84
+ return P(this, T, j).call(this, "get", e, t);
85
85
  }
86
86
  async put(e, t) {
87
- return S(this, M, C).call(this, "put", e, t);
87
+ return P(this, T, j).call(this, "put", e, t);
88
88
  }
89
89
  async patch(e, t) {
90
- return S(this, M, C).call(this, "patch", e, t);
90
+ return P(this, T, j).call(this, "patch", e, t);
91
91
  }
92
92
  async post(e, t) {
93
- return S(this, M, C).call(this, "post", e, t);
93
+ return P(this, T, j).call(this, "post", e, t);
94
94
  }
95
95
  async delete(e, t) {
96
- return S(this, M, C).call(this, "delete", e, t);
96
+ return P(this, T, j).call(this, "delete", e, t);
97
97
  }
98
98
  async head(e, t) {
99
- return S(this, M, C).call(this, "head", e, t);
99
+ return P(this, T, j).call(this, "head", e, t);
100
100
  }
101
101
  async options(e, t) {
102
- return S(this, M, C).call(this, "options", e, t);
102
+ return P(this, T, j).call(this, "options", e, t);
103
103
  }
104
104
  async trace(e, t) {
105
- return S(this, M, C).call(this, "trace", e, t);
105
+ return P(this, T, j).call(this, "trace", e, t);
106
106
  }
107
107
  }
108
- J = new WeakMap(), Fe = new WeakMap(), M = new WeakSet(), C = async function(e, t, r) {
108
+ J = new WeakMap(), We = new WeakMap(), T = new WeakSet(), j = async function(e, t, r) {
109
109
  return jt({
110
110
  ...r,
111
111
  method: e,
112
112
  uri: t,
113
113
  middleware: n(this, J),
114
- fetch: n(this, Fe)
114
+ fetch: n(this, We)
115
115
  });
116
116
  };
117
- function Tt() {
117
+ function Dt() {
118
118
  if (typeof window < "u" && window.fetch)
119
119
  return window.fetch.bind(window);
120
120
  if (typeof global < "u" && global.fetch)
121
121
  return global.fetch.bind(global);
122
122
  throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
123
123
  }
124
- class At extends Error {
124
+ class Ct extends Error {
125
125
  constructor(t) {
126
- const { status: r, statusText: i, method: s, uri: o } = t, f = `${r} ${i}: Request failed (${s.toUpperCase()} ${o})`;
127
- super(f);
128
- P(this, "response");
126
+ const { status: r, statusText: i, method: s, uri: o } = t, u = `${r} ${i}: Request failed (${s.toUpperCase()} ${o})`;
127
+ super(u);
128
+ k(this, "response");
129
129
  this.response = t;
130
130
  }
131
131
  }
@@ -142,79 +142,80 @@ async function jt(a) {
142
142
  };
143
143
  if (e)
144
144
  if (e instanceof Map || e instanceof Headers)
145
- e.forEach((c, w) => {
146
- s.headers.set(w, c);
145
+ e.forEach((l, w) => {
146
+ s.headers.set(w, l);
147
147
  });
148
148
  else if (e != null && typeof e == "object" && !Array.isArray(e))
149
- for (const c in e) {
150
- const w = e[c];
151
- w instanceof Date ? s.headers.set(c, w.toISOString()) : w != null && s.headers.set(c, String(w));
149
+ for (const l in e) {
150
+ const w = e[l];
151
+ w instanceof Date ? s.headers.set(l, w.toISOString()) : w != null && s.headers.set(l, String(w));
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((c, w) => {
158
- s.query.set(w, c);
157
+ t.forEach((l, w) => {
158
+ s.query.set(w, l);
159
159
  });
160
160
  else if (t != null && typeof t == "object" && !Array.isArray(t))
161
- for (const c in t) {
162
- const w = t[c];
163
- w instanceof Date ? s.query.set(c, w.toISOString()) : w != null && s.query.set(c, String(w));
161
+ for (const l in t) {
162
+ const w = t[l];
163
+ w instanceof Date ? s.query.set(l, w.toISOString()) : w != null && s.query.set(l, String(w));
164
164
  }
165
165
  else
166
166
  throw new TypeError(`Unknown query params type. Got: ${t}`);
167
167
  let o;
168
- const f = async () => {
169
- const c = s.query.toString(), w = c.length > 0 ? s.uri + "?" + c : s.uri;
170
- let y;
171
- !s.headers.has("content-type") && Ge(s.body) ? (s.headers.set("content-type", "application/json"), y = JSON.stringify(s.body)) : y = s.body;
172
- const m = await r(w, {
168
+ const u = async () => {
169
+ const l = s.query.toString(), w = l.length > 0 ? s.uri + "?" + l : s.uri;
170
+ let g;
171
+ !s.headers.has("content-type") && Be(s.body) ? (s.headers.set("content-type", "application/json"), g = JSON.stringify(s.body)) : g = s.body;
172
+ const b = await r(w, {
173
173
  method: s.method,
174
174
  headers: s.headers,
175
- body: y
176
- }), d = Object.fromEntries(m.headers.entries()), b = d["content-type"];
177
- let $;
178
- b != null && b.includes("application/json") ? $ = await m.json() : b != null && b.includes("application/x-www-form-urlencoded") ? $ = await m.formData() : $ = await m.text(), o = {
175
+ body: g
176
+ }), d = Object.fromEntries(b.headers.entries()), p = d["content-type"];
177
+ let S;
178
+ p != null && p.includes("application/json") ? S = await b.json() : p != null && p.includes("application/x-www-form-urlencoded") ? S = await b.formData() : S = await b.text(), o = {
179
179
  method: s.method,
180
180
  uri: s.uri,
181
- status: m.status,
182
- statusText: m.statusText,
181
+ status: b.status,
182
+ statusText: b.statusText,
183
183
  headers: d,
184
- body: $
184
+ body: S
185
185
  };
186
186
  };
187
187
  if (i.length > 0) {
188
- const c = (w = 0) => {
189
- const y = i[w], m = i[w + 1] ? c(w + 1) : f;
190
- return async () => y(s, async () => (await m(), o));
188
+ const l = (w = 0) => {
189
+ const g = i[w], b = i[w + 1] ? l(w + 1) : u;
190
+ return async () => g(s, async () => (await b(), o));
191
191
  };
192
- await c()();
192
+ await l()();
193
193
  } else
194
- await f();
194
+ await u();
195
195
  if (o.status < 200 || o.status >= 400)
196
- throw new At(o);
196
+ throw new Ct(o);
197
197
  return o;
198
198
  }
199
- class Dt {
199
+ const _t = Ke("[NO LANGUAGE SET]");
200
+ class qt {
200
201
  constructor(e, t) {
201
- P(this, "dolla");
202
- P(this, "config");
203
- P(this, "strings");
202
+ k(this, "dolla");
203
+ k(this, "config");
204
+ k(this, "strings");
204
205
  this.config = e, this.dolla = t;
205
206
  }
206
207
  async load() {
207
208
  if (this.strings == null) {
208
- if (Xe(this.config.fetch)) {
209
+ if (et(this.config.fetch)) {
209
210
  const e = await this.config.fetch();
210
- if (Ge(e))
211
+ if (Be(e))
211
212
  this.strings = e;
212
213
  else
213
214
  throw new Error(`Fetch function did not return an object of language strings: ${e}`);
214
215
  } else if (U(this.config.path)) {
215
216
  const e = await this.dolla.http.get(this.config.path);
216
217
  if (e.status >= 200 && e.status < 300)
217
- if (Ge(e.body))
218
+ if (Be(e.body))
218
219
  this.strings = e.body;
219
220
  else
220
221
  throw new Error(
@@ -229,22 +230,22 @@ class Dt {
229
230
  return this.strings;
230
231
  }
231
232
  }
232
- var ye, Y, x, ie, be, ve, oe, $e, Ie, ft;
233
- class Ct {
233
+ var we, Y, x, se, be, ve, $e, Ee, O, Qe, ft, dt, pt, gt;
234
+ class Ut {
234
235
  constructor(e) {
235
- h(this, Ie);
236
- h(this, ye);
237
- h(this, Y);
238
- h(this, x, /* @__PURE__ */ new Map());
239
- h(this, ie, []);
240
- h(this, be, "auto");
241
- P(this, "$locale");
242
- h(this, ve);
243
- h(this, oe);
244
- h(this, $e);
245
- g(this, ye, e), g(this, Y, e.createLogger("dolla/i18n"));
246
- const [t, r] = K(), [i, s] = K();
247
- this.$locale = t, g(this, ve, r), g(this, oe, i), g(this, $e, s), e.beforeMount(async () => {
236
+ f(this, O);
237
+ f(this, we);
238
+ f(this, Y);
239
+ f(this, x, /* @__PURE__ */ new Map());
240
+ f(this, se, []);
241
+ f(this, be, "auto");
242
+ k(this, "$locale");
243
+ f(this, ve);
244
+ f(this, $e);
245
+ f(this, Ee);
246
+ y(this, we, e), y(this, Y, e.createLogger("dolla/i18n"));
247
+ const [t, r] = Q(), [i, s] = Q();
248
+ this.$locale = t, y(this, ve, r), y(this, $e, i), y(this, Ee, s), e.beforeMount(async () => {
248
249
  n(this, x).size > 0 && await this.setLocale(n(this, be));
249
250
  });
250
251
  }
@@ -253,11 +254,11 @@ class Ct {
253
254
  }
254
255
  setup(e) {
255
256
  if (e.translations.forEach((t) => {
256
- n(this, x).set(t.locale, new Dt(t, n(this, ye)));
257
+ n(this, x).set(t.locale, new qt(t, n(this, we)));
257
258
  }), e.locale && e.locale !== "auto") {
258
259
  if (!e.translations.some((r) => r.locale === e.locale))
259
260
  throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
260
- g(this, be, e.locale);
261
+ y(this, be, e.locale);
261
262
  }
262
263
  n(this, Y).info(
263
264
  `${n(this, x).size} language${n(this, x).size === 1 ? "" : "s"} supported: '${[...n(this, x).keys()].join("', '")}'`
@@ -285,7 +286,7 @@ class Ct {
285
286
  const r = n(this, x).get(t);
286
287
  try {
287
288
  const s = await r.load();
288
- n(this, $e).call(this, s), n(this, ve).call(this, t), n(this, Y).info("set language to " + t);
289
+ y(this, se, []), n(this, Ee).call(this, s), n(this, ve).call(this, t), n(this, Y).info("set language to " + t);
289
290
  } catch (s) {
290
291
  s instanceof Error && n(this, Y).crash(s);
291
292
  }
@@ -294,7 +295,7 @@ class Ct {
294
295
  * Returns a State containing the value at `key`.
295
296
 
296
297
  * @param key - Key to the translated value.
297
- * @param values - A map of {{placeholder}} names and the values to replace them with.
298
+ * @param options - A map of {{placeholder}} names and the values to replace them with.
298
299
  *
299
300
  * @example
300
301
  * const $value = t("your.key.here");
@@ -305,39 +306,33 @@ class Ct {
305
306
  `The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
306
307
  );
307
308
  if (!this.$locale.get())
308
- return qt;
309
- const r = S(this, Ie, ft).call(this, e, t);
310
- if (r)
311
- return r;
312
- if (t) {
313
- const s = {};
314
- for (const [f, c] of Object.entries(t))
315
- yt(c) && (s[f] = c);
316
- const o = Object.entries(s);
317
- if (o.length > 0) {
318
- const f = o.map((w) => w[1]), c = ae([n(this, oe), ...f], (w, ...y) => {
319
- const m = y.map(($, j) => o[j]), d = {
320
- ...t
321
- };
322
- for (let $ = 0; $ < m.length; $++) {
323
- const j = m[$][0];
324
- d[j] = y[$];
325
- }
326
- const b = it(w, e) || `[NO TRANSLATION: ${e}]`;
327
- return st(b, d);
328
- });
329
- return n(this, ie).push([e, t, c]), c;
330
- }
331
- }
332
- const i = ae([n(this, oe)], (s) => {
333
- let o = it(s, e) || `[NO TRANSLATION: ${e}]`;
334
- return t && (o = st(o, t)), o;
309
+ return _t;
310
+ let r = [], i = [];
311
+ for (const s in t)
312
+ r.push(s), i.push(t[s]);
313
+ return me([this.$locale, ...i], (s, ...o) => {
314
+ const u = {};
315
+ for (let p = 0; p < o.length; p++)
316
+ u[r[p]] = o[p];
317
+ const l = P(this, O, pt).call(this, e, u);
318
+ if (l) return l;
319
+ const w = n(this, $e).get();
320
+ let g = e;
321
+ if (u.context != null && (g += "_" + u.context), u.count != null)
322
+ if (u.ordinal) {
323
+ const p = `${g}_ordinal_(=${u.count})`;
324
+ Ce(w, p) != null ? g = p : g += "_ordinal_" + new Intl.PluralRules(s, { type: "ordinal" }).select(u.count);
325
+ } else {
326
+ const p = `${g}_(=${u.count})`;
327
+ Ce(w, p) != null ? g = p : g += "_" + new Intl.PluralRules(s).select(u.count);
328
+ }
329
+ const b = Ce(w, g) || `[MISSING: ${g}]`, d = P(this, O, gt).call(this, b, u);
330
+ return n(this, se).push([e, u, d]), d;
335
331
  });
336
- return n(this, ie).push([e, t, i]), i;
337
332
  }
338
333
  /**
339
- * Creates a wrapped `Intl.Collator` configured for the current locale.
340
- * NOTE: The Collator remains bound to the locale it was created with.
334
+ * Creates an `Intl.Collator` configured for the current locale.
335
+ * NOTE: The Collator remains bound to the locale it was created with, even when the app's locale changes.
341
336
  *
342
337
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
343
338
  */
@@ -350,7 +345,7 @@ class Ct {
350
345
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
351
346
  */
352
347
  number(e, t) {
353
- return ae([this.$locale, e], (r, i) => new Intl.NumberFormat(this.$locale.get(), t).format(i));
348
+ return me([this.$locale, e], (r, i) => P(this, O, Qe).call(this, i, t));
354
349
  }
355
350
  /**
356
351
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -362,9 +357,7 @@ class Ct {
362
357
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
363
358
  */
364
359
  dateTime(e, t) {
365
- return ae([this.$locale, e], (r, i) => new Intl.DateTimeFormat(this.$locale.get(), t).format(
366
- typeof i == "string" ? new Date(i) : i
367
- ));
360
+ return me([this.$locale, e], (r, i) => P(this, O, ft).call(this, i, t));
368
361
  }
369
362
  /**
370
363
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -376,23 +369,32 @@ class Ct {
376
369
  * const $formatted = Dolla.i18n.list(list, { });
377
370
  */
378
371
  list(e, t) {
379
- return ae([this.$locale, e], (r, i) => new Intl.ListFormat(this.$locale.get(), t).format(i));
372
+ return me([this.$locale, e], (r, i) => P(this, O, dt).call(this, i, t));
380
373
  }
381
374
  }
382
- ye = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), ie = new WeakMap(), be = new WeakMap(), ve = new WeakMap(), oe = new WeakMap(), $e = new WeakMap(), Ie = new WeakSet(), // relativeTime(): State<string> {
375
+ we = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), se = new WeakMap(), be = new WeakMap(), ve = new WeakMap(), $e = new WeakMap(), Ee = new WeakMap(), O = new WeakSet(), Qe = function(e, t) {
376
+ return new Intl.NumberFormat(this.$locale.get(), t).format(e);
377
+ }, ft = function(e, t) {
378
+ return new Intl.DateTimeFormat(this.$locale.get(), t).format(
379
+ typeof e == "string" ? new Date(e) : e
380
+ );
381
+ }, dt = function(e, t) {
382
+ return new Intl.ListFormat(this.$locale.get(), t).format(e);
383
+ }, // relativeTime(): State<string> {
383
384
  // }
384
- ft = function(e, t) {
385
- for (const r of n(this, ie))
386
- if (r[0] === e && bt(r[1], t))
385
+ pt = function(e, t) {
386
+ for (const r of n(this, se))
387
+ if (r[0] === e && $t(r[1], t))
387
388
  return r[2];
389
+ }, /**
390
+ * Replaces {{placeholders}} with values in translated strings.
391
+ */
392
+ gt = function(e, t) {
393
+ for (const r in t)
394
+ r === "count" ? e = e.replace(`{{${r}}}`, P(this, O, Qe).call(this, Number(t[r]), t)) : e = e.replace(`{{${r}}}`, String(Ce(t, r)));
395
+ return e;
388
396
  };
389
- const qt = Be("[NO LANGUAGE SET]");
390
- function st(a, e) {
391
- for (const t in e)
392
- a = a.replace(`{{${t}}}`, String(e[t]));
393
- return a;
394
- }
395
- function it(a, e) {
397
+ function Ce(a, e) {
396
398
  const t = String(e).split(/[\.\[\]]/).filter((i) => i.trim() !== "");
397
399
  let r = a;
398
400
  for (; t.length > 0; ) {
@@ -401,21 +403,21 @@ function it(a, e) {
401
403
  }
402
404
  return r;
403
405
  }
404
- var X, Ee, _, H, ce, q, le, je;
406
+ var X, ke, V, H, ie, _, oe, je;
405
407
  class Vt {
406
408
  constructor(e) {
407
- h(this, le);
408
- h(this, X);
409
- h(this, Ee);
409
+ f(this, oe);
410
+ f(this, X);
411
+ f(this, ke);
410
412
  // Keyed updates ensure only the most recent callback queued with a certain key
411
413
  // will be called, keeping DOM operations to a minimum.
412
- h(this, _, /* @__PURE__ */ new Map());
414
+ f(this, V, /* @__PURE__ */ new Map());
413
415
  // All unkeyed updates are run on every batch.
414
- h(this, H, []);
416
+ f(this, H, []);
415
417
  // All read callbacks are run before updates on every batch.
416
- h(this, ce, []);
417
- h(this, q, !1);
418
- g(this, X, e), g(this, Ee, e.createLogger("dolla/render"));
418
+ f(this, ie, []);
419
+ f(this, _, !1);
420
+ y(this, X, e), y(this, ke, e.createLogger("dolla/render"));
419
421
  }
420
422
  /**
421
423
  * Queues a callback to run in the next render batch.
@@ -424,11 +426,11 @@ class Vt {
424
426
  */
425
427
  update(e, t) {
426
428
  return new Promise((r) => {
427
- t ? n(this, _).set(t, () => {
429
+ t ? n(this, V).set(t, () => {
428
430
  e(), r();
429
431
  }) : n(this, H).push(() => {
430
432
  e(), r();
431
- }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), S(this, le, je).call(this));
433
+ }), !n(this, _) && n(this, X).isMounted && (y(this, _, !0), P(this, oe, je).call(this));
432
434
  });
433
435
  }
434
436
  /**
@@ -438,49 +440,49 @@ class Vt {
438
440
  */
439
441
  read(e) {
440
442
  return new Promise((t) => {
441
- n(this, ce).push(() => {
443
+ n(this, ie).push(() => {
442
444
  e(), t();
443
- }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), S(this, le, je).call(this));
445
+ }), !n(this, _) && n(this, X).isMounted && (y(this, _, !0), P(this, oe, je).call(this));
444
446
  });
445
447
  }
446
448
  }
447
- X = new WeakMap(), Ee = new WeakMap(), _ = new WeakMap(), H = new WeakMap(), ce = new WeakMap(), q = new WeakMap(), le = new WeakSet(), je = function() {
448
- const e = n(this, _).size + n(this, H).length;
449
- if ((!n(this, X).isMounted || e === 0) && g(this, q, !1), !n(this, q)) {
450
- for (const t of n(this, ce))
449
+ X = new WeakMap(), ke = new WeakMap(), V = new WeakMap(), H = new WeakMap(), ie = new WeakMap(), _ = new WeakMap(), oe = new WeakSet(), je = function() {
450
+ const e = n(this, V).size + n(this, H).length;
451
+ if ((!n(this, X).isMounted || e === 0) && y(this, _, !1), !n(this, _)) {
452
+ for (const t of n(this, ie))
451
453
  t();
452
- g(this, ce, []);
454
+ y(this, ie, []);
453
455
  return;
454
456
  }
455
457
  requestAnimationFrame(() => {
456
- n(this, Ee).info(`Batching ${n(this, _).size + n(this, H).length} queued DOM update(s).`);
457
- for (const t of n(this, _).values())
458
+ n(this, ke).info(`Batching ${n(this, V).size + n(this, H).length} queued DOM update(s).`);
459
+ for (const t of n(this, V).values())
458
460
  t();
459
- n(this, _).clear();
461
+ n(this, V).clear();
460
462
  for (const t of n(this, H))
461
463
  t();
462
- g(this, H, []), S(this, le, je).call(this);
464
+ y(this, H, []), P(this, oe, je).call(this);
463
465
  });
464
466
  };
465
- function de() {
466
- return de = Object.assign ? Object.assign.bind() : function(a) {
467
+ function he() {
468
+ return he = Object.assign ? Object.assign.bind() : function(a) {
467
469
  for (var e = 1; e < arguments.length; e++) {
468
470
  var t = arguments[e];
469
471
  for (var r in t) ({}).hasOwnProperty.call(t, r) && (a[r] = t[r]);
470
472
  }
471
473
  return a;
472
- }, de.apply(null, arguments);
474
+ }, he.apply(null, arguments);
473
475
  }
474
- var A;
476
+ var D;
475
477
  (function(a) {
476
478
  a.Pop = "POP", a.Push = "PUSH", a.Replace = "REPLACE";
477
- })(A || (A = {}));
479
+ })(D || (D = {}));
478
480
  var Ve = process.env.NODE_ENV !== "production" ? function(a) {
479
481
  return Object.freeze(a);
480
482
  } : function(a) {
481
483
  return a;
482
484
  };
483
- function De(a, e) {
485
+ function _e(a, e) {
484
486
  if (!a) {
485
487
  typeof console < "u" && console.warn(e);
486
488
  try {
@@ -489,38 +491,38 @@ function De(a, e) {
489
491
  }
490
492
  }
491
493
  }
492
- var Ue = "beforeunload", Ut = "hashchange", dt = "popstate";
493
- function _t(a) {
494
+ var He = "beforeunload", Ht = "hashchange", mt = "popstate";
495
+ function It(a) {
494
496
  a === void 0 && (a = {});
495
497
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
496
498
  function s() {
497
- var p = r.location, l = p.pathname, u = p.search, v = p.hash, E = i.state || {};
498
- return [E.idx, Ve({
499
- pathname: l,
500
- search: u,
499
+ var m = r.location, c = m.pathname, h = m.search, v = m.hash, $ = i.state || {};
500
+ return [$.idx, Ve({
501
+ pathname: c,
502
+ search: h,
501
503
  hash: v,
502
- state: E.usr || null,
503
- key: E.key || "default"
504
+ state: $.usr || null,
505
+ key: $.key || "default"
504
506
  })];
505
507
  }
506
508
  var o = null;
507
- function f() {
509
+ function u() {
508
510
  if (o)
509
- b.call(o), o = null;
511
+ p.call(o), o = null;
510
512
  else {
511
- var p = A.Pop, l = s(), u = l[0], v = l[1];
512
- if (b.length)
513
- if (u != null) {
514
- var E = y - u;
515
- E && (o = {
516
- action: p,
513
+ var m = D.Pop, c = s(), h = c[0], v = c[1];
514
+ if (p.length)
515
+ if (h != null) {
516
+ var $ = g - h;
517
+ $ && (o = {
518
+ action: m,
517
519
  location: v,
518
520
  retry: function() {
519
- V(E * -1);
521
+ q($ * -1);
520
522
  }
521
- }, V(E));
523
+ }, q($));
522
524
  } else
523
- process.env.NODE_ENV !== "production" && De(
525
+ process.env.NODE_ENV !== "production" && _e(
524
526
  !1,
525
527
  // TODO: Write up a doc that explains our blocking strategy in
526
528
  // detail and link to it here so people can understand better what
@@ -528,137 +530,137 @@ function _t(a) {
528
530
  "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."
529
531
  );
530
532
  else
531
- re(p);
533
+ re(m);
532
534
  }
533
535
  }
534
- r.addEventListener(dt, f);
535
- var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
536
- y == null && (y = 0, i.replaceState(de({}, i.state, {
537
- idx: y
536
+ r.addEventListener(mt, u);
537
+ var l = D.Pop, w = s(), g = w[0], b = w[1], d = Fe(), p = Fe();
538
+ g == null && (g = 0, i.replaceState(he({}, i.state, {
539
+ idx: g
538
540
  }), ""));
539
- function $(p) {
540
- return typeof p == "string" ? p : Ce(p);
541
+ function S(m) {
542
+ return typeof m == "string" ? m : qe(m);
541
543
  }
542
- function j(p, l) {
543
- return l === void 0 && (l = null), Ve(de({
544
- pathname: m.pathname,
544
+ function fe(m, c) {
545
+ return c === void 0 && (c = null), Ve(he({
546
+ pathname: b.pathname,
545
547
  hash: "",
546
548
  search: ""
547
- }, typeof p == "string" ? Qe(p) : p, {
548
- state: l,
549
- key: pt()
549
+ }, typeof m == "string" ? Je(m) : m, {
550
+ state: c,
551
+ key: yt()
550
552
  }));
551
553
  }
552
- function pe(p, l) {
554
+ function de(m, c) {
553
555
  return [{
554
- usr: p.state,
555
- key: p.key,
556
- idx: l
557
- }, $(p)];
558
- }
559
- function ge(p, l, u) {
560
- return !b.length || (b.call({
561
- action: p,
562
- location: l,
563
- retry: u
556
+ usr: m.state,
557
+ key: m.key,
558
+ idx: c
559
+ }, S(m)];
560
+ }
561
+ function pe(m, c, h) {
562
+ return !p.length || (p.call({
563
+ action: m,
564
+ location: c,
565
+ retry: h
564
566
  }), !1);
565
567
  }
566
- function re(p) {
567
- c = p;
568
- var l = s();
569
- y = l[0], m = l[1], d.call({
570
- action: c,
571
- location: m
568
+ function re(m) {
569
+ l = m;
570
+ var c = s();
571
+ g = c[0], b = c[1], d.call({
572
+ action: l,
573
+ location: b
572
574
  });
573
575
  }
574
- function ne(p, l) {
575
- var u = A.Push, v = j(p, l);
576
- function E() {
577
- ne(p, l);
576
+ function ne(m, c) {
577
+ var h = D.Push, v = fe(m, c);
578
+ function $() {
579
+ ne(m, c);
578
580
  }
579
- if (ge(u, v, E)) {
580
- var L = pe(v, y + 1), O = L[0], T = L[1];
581
+ if (pe(h, v, $)) {
582
+ var L = de(v, g + 1), M = L[0], A = L[1];
581
583
  try {
582
- i.pushState(O, "", T);
584
+ i.pushState(M, "", A);
583
585
  } catch {
584
- r.location.assign(T);
586
+ r.location.assign(A);
585
587
  }
586
- re(u);
588
+ re(h);
587
589
  }
588
590
  }
589
- function me(p, l) {
590
- var u = A.Replace, v = j(p, l);
591
- function E() {
592
- me(p, l);
591
+ function ge(m, c) {
592
+ var h = D.Replace, v = fe(m, c);
593
+ function $() {
594
+ ge(m, c);
593
595
  }
594
- if (ge(u, v, E)) {
595
- var L = pe(v, y), O = L[0], T = L[1];
596
- i.replaceState(O, "", T), re(u);
596
+ if (pe(h, v, $)) {
597
+ var L = de(v, g), M = L[0], A = L[1];
598
+ i.replaceState(M, "", A), re(h);
597
599
  }
598
600
  }
599
- function V(p) {
600
- i.go(p);
601
+ function q(m) {
602
+ i.go(m);
601
603
  }
602
- var Q = {
604
+ var K = {
603
605
  get action() {
604
- return c;
606
+ return l;
605
607
  },
606
608
  get location() {
607
- return m;
609
+ return b;
608
610
  },
609
- createHref: $,
611
+ createHref: S,
610
612
  push: ne,
611
- replace: me,
612
- go: V,
613
+ replace: ge,
614
+ go: q,
613
615
  back: function() {
614
- V(-1);
616
+ q(-1);
615
617
  },
616
618
  forward: function() {
617
- V(1);
619
+ q(1);
618
620
  },
619
- listen: function(l) {
620
- return d.push(l);
621
+ listen: function(c) {
622
+ return d.push(c);
621
623
  },
622
- block: function(l) {
623
- var u = b.push(l);
624
- return b.length === 1 && r.addEventListener(Ue, _e), function() {
625
- u(), b.length || r.removeEventListener(Ue, _e);
624
+ block: function(c) {
625
+ var h = p.push(c);
626
+ return p.length === 1 && r.addEventListener(He, Ie), function() {
627
+ h(), p.length || r.removeEventListener(He, Ie);
626
628
  };
627
629
  }
628
630
  };
629
- return Q;
631
+ return K;
630
632
  }
631
- function Ht(a) {
633
+ function Ft(a) {
632
634
  a === void 0 && (a = {});
633
635
  var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
634
636
  function s() {
635
- var l = Qe(r.location.hash.substr(1)), u = l.pathname, v = u === void 0 ? "/" : u, E = l.search, L = E === void 0 ? "" : E, O = l.hash, T = O === void 0 ? "" : O, D = i.state || {};
636
- return [D.idx, Ve({
637
+ var c = Je(r.location.hash.substr(1)), h = c.pathname, v = h === void 0 ? "/" : h, $ = c.search, L = $ === void 0 ? "" : $, M = c.hash, A = M === void 0 ? "" : M, C = i.state || {};
638
+ return [C.idx, Ve({
637
639
  pathname: v,
638
640
  search: L,
639
- hash: T,
640
- state: D.usr || null,
641
- key: D.key || "default"
641
+ hash: A,
642
+ state: C.usr || null,
643
+ key: C.key || "default"
642
644
  })];
643
645
  }
644
646
  var o = null;
645
- function f() {
647
+ function u() {
646
648
  if (o)
647
- b.call(o), o = null;
649
+ p.call(o), o = null;
648
650
  else {
649
- var l = A.Pop, u = s(), v = u[0], E = u[1];
650
- if (b.length)
651
+ var c = D.Pop, h = s(), v = h[0], $ = h[1];
652
+ if (p.length)
651
653
  if (v != null) {
652
- var L = y - v;
654
+ var L = g - v;
653
655
  L && (o = {
654
- action: l,
655
- location: E,
656
+ action: c,
657
+ location: $,
656
658
  retry: function() {
657
- Q(L * -1);
659
+ K(L * -1);
658
660
  }
659
- }, Q(L));
661
+ }, K(L));
660
662
  } else
661
- process.env.NODE_ENV !== "production" && De(
663
+ process.env.NODE_ENV !== "production" && _e(
662
664
  !1,
663
665
  // TODO: Write up a doc that explains our blocking strategy in
664
666
  // detail and link to it here so people can understand better
@@ -666,121 +668,121 @@ function Ht(a) {
666
668
  "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."
667
669
  );
668
670
  else
669
- ne(l);
671
+ ne(c);
670
672
  }
671
673
  }
672
- r.addEventListener(dt, f), r.addEventListener(Ut, function() {
673
- var l = s(), u = l[1];
674
- Ce(u) !== Ce(m) && f();
674
+ r.addEventListener(mt, u), r.addEventListener(Ht, function() {
675
+ var c = s(), h = c[1];
676
+ qe(h) !== qe(b) && u();
675
677
  });
676
- var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
677
- y == null && (y = 0, i.replaceState(de({}, i.state, {
678
- idx: y
678
+ var l = D.Pop, w = s(), g = w[0], b = w[1], d = Fe(), p = Fe();
679
+ g == null && (g = 0, i.replaceState(he({}, i.state, {
680
+ idx: g
679
681
  }), ""));
680
- function $() {
681
- var l = document.querySelector("base"), u = "";
682
- if (l && l.getAttribute("href")) {
683
- var v = r.location.href, E = v.indexOf("#");
684
- u = E === -1 ? v : v.slice(0, E);
682
+ function S() {
683
+ var c = document.querySelector("base"), h = "";
684
+ if (c && c.getAttribute("href")) {
685
+ var v = r.location.href, $ = v.indexOf("#");
686
+ h = $ === -1 ? v : v.slice(0, $);
685
687
  }
686
- return u;
688
+ return h;
687
689
  }
688
- function j(l) {
689
- return $() + "#" + (typeof l == "string" ? l : Ce(l));
690
+ function fe(c) {
691
+ return S() + "#" + (typeof c == "string" ? c : qe(c));
690
692
  }
691
- function pe(l, u) {
692
- return u === void 0 && (u = null), Ve(de({
693
- pathname: m.pathname,
693
+ function de(c, h) {
694
+ return h === void 0 && (h = null), Ve(he({
695
+ pathname: b.pathname,
694
696
  hash: "",
695
697
  search: ""
696
- }, typeof l == "string" ? Qe(l) : l, {
697
- state: u,
698
- key: pt()
698
+ }, typeof c == "string" ? Je(c) : c, {
699
+ state: h,
700
+ key: yt()
699
701
  }));
700
702
  }
701
- function ge(l, u) {
703
+ function pe(c, h) {
702
704
  return [{
703
- usr: l.state,
704
- key: l.key,
705
- idx: u
706
- }, j(l)];
705
+ usr: c.state,
706
+ key: c.key,
707
+ idx: h
708
+ }, fe(c)];
707
709
  }
708
- function re(l, u, v) {
709
- return !b.length || (b.call({
710
- action: l,
711
- location: u,
710
+ function re(c, h, v) {
711
+ return !p.length || (p.call({
712
+ action: c,
713
+ location: h,
712
714
  retry: v
713
715
  }), !1);
714
716
  }
715
- function ne(l) {
716
- c = l;
717
- var u = s();
718
- y = u[0], m = u[1], d.call({
719
- action: c,
720
- location: m
717
+ function ne(c) {
718
+ l = c;
719
+ var h = s();
720
+ g = h[0], b = h[1], d.call({
721
+ action: l,
722
+ location: b
721
723
  });
722
724
  }
723
- function me(l, u) {
724
- var v = A.Push, E = pe(l, u);
725
+ function ge(c, h) {
726
+ var v = D.Push, $ = de(c, h);
725
727
  function L() {
726
- me(l, u);
728
+ ge(c, h);
727
729
  }
728
- if (process.env.NODE_ENV !== "production" && De(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), re(v, E, L)) {
729
- var O = ge(E, y + 1), T = O[0], D = O[1];
730
+ if (process.env.NODE_ENV !== "production" && _e($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), re(v, $, L)) {
731
+ var M = pe($, g + 1), A = M[0], C = M[1];
730
732
  try {
731
- i.pushState(T, "", D);
733
+ i.pushState(A, "", C);
732
734
  } catch {
733
- r.location.assign(D);
735
+ r.location.assign(C);
734
736
  }
735
737
  ne(v);
736
738
  }
737
739
  }
738
- function V(l, u) {
739
- var v = A.Replace, E = pe(l, u);
740
+ function q(c, h) {
741
+ var v = D.Replace, $ = de(c, h);
740
742
  function L() {
741
- V(l, u);
743
+ q(c, h);
742
744
  }
743
- if (process.env.NODE_ENV !== "production" && De(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), re(v, E, L)) {
744
- var O = ge(E, y), T = O[0], D = O[1];
745
- i.replaceState(T, "", D), ne(v);
745
+ if (process.env.NODE_ENV !== "production" && _e($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), re(v, $, L)) {
746
+ var M = pe($, g), A = M[0], C = M[1];
747
+ i.replaceState(A, "", C), ne(v);
746
748
  }
747
749
  }
748
- function Q(l) {
749
- i.go(l);
750
+ function K(c) {
751
+ i.go(c);
750
752
  }
751
- var p = {
753
+ var m = {
752
754
  get action() {
753
- return c;
755
+ return l;
754
756
  },
755
757
  get location() {
756
- return m;
758
+ return b;
757
759
  },
758
- createHref: j,
759
- push: me,
760
- replace: V,
761
- go: Q,
760
+ createHref: fe,
761
+ push: ge,
762
+ replace: q,
763
+ go: K,
762
764
  back: function() {
763
- Q(-1);
765
+ K(-1);
764
766
  },
765
767
  forward: function() {
766
- Q(1);
768
+ K(1);
767
769
  },
768
- listen: function(u) {
769
- return d.push(u);
770
+ listen: function(h) {
771
+ return d.push(h);
770
772
  },
771
- block: function(u) {
772
- var v = b.push(u);
773
- return b.length === 1 && r.addEventListener(Ue, _e), function() {
774
- v(), b.length || r.removeEventListener(Ue, _e);
773
+ block: function(h) {
774
+ var v = p.push(h);
775
+ return p.length === 1 && r.addEventListener(He, Ie), function() {
776
+ v(), p.length || r.removeEventListener(He, Ie);
775
777
  };
776
778
  }
777
779
  };
778
- return p;
780
+ return m;
779
781
  }
780
- function _e(a) {
782
+ function Ie(a) {
781
783
  a.preventDefault(), a.returnValue = "";
782
784
  }
783
- function He() {
785
+ function Fe() {
784
786
  var a = [];
785
787
  return {
786
788
  get length() {
@@ -800,14 +802,14 @@ function He() {
800
802
  }
801
803
  };
802
804
  }
803
- function pt() {
805
+ function yt() {
804
806
  return Math.random().toString(36).substr(2, 8);
805
807
  }
806
- function Ce(a) {
808
+ function qe(a) {
807
809
  var e = a.pathname, t = e === void 0 ? "/" : e, r = a.search, i = r === void 0 ? "" : r, s = a.hash, o = s === void 0 ? "" : s;
808
810
  return i && i !== "?" && (t += i.charAt(0) === "?" ? i : "?" + i), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
809
811
  }
810
- function Qe(a) {
812
+ function Je(a) {
811
813
  var e = {};
812
814
  if (a) {
813
815
  var t = a.indexOf("#");
@@ -817,26 +819,26 @@ function Qe(a) {
817
819
  }
818
820
  return e;
819
821
  }
820
- function we(a) {
821
- return lt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
822
+ function ye(a) {
823
+ return ct(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
822
824
  }
823
- function se(a) {
825
+ function ae(a) {
824
826
  var t;
825
- vt(
826
- (r) => Xe(r == null ? void 0 : r.toString),
827
+ Et(
828
+ (r) => et(r == null ? void 0 : r.toString),
827
829
  a,
828
830
  "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
829
831
  ), a = a.filter((r) => r).flatMap(String);
830
832
  let e = (t = a.shift()) == null ? void 0 : t.toString();
831
833
  if (e) {
832
834
  for (const r of a.map((i) => i.toString()))
833
- r.startsWith(".") ? e = qe(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
835
+ r.startsWith(".") ? e = Ue(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
834
836
  e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
835
837
  }
836
838
  return e ?? "";
837
839
  }
838
- function qe(a, e) {
839
- if (lt(a, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = a, a = ""), e.startsWith("/"))
840
+ function Ue(a, e) {
841
+ if (ct(a, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = a, a = ""), e.startsWith("/"))
840
842
  return e;
841
843
  let t = a;
842
844
  for (; ; )
@@ -850,9 +852,9 @@ function qe(a, e) {
850
852
  e = e.replace(/^\.\/?/, "");
851
853
  else
852
854
  break;
853
- return se([t, e]);
855
+ return ae([t, e]);
854
856
  }
855
- function Ke(a) {
857
+ function Ye(a) {
856
858
  if (!a) return {};
857
859
  a.startsWith("?") && (a = a.slice(1));
858
860
  const e = a.split("&").filter((t) => t.trim() !== "").map((t) => {
@@ -863,70 +865,70 @@ function Ke(a) {
863
865
  }
864
866
  function ot(a, e, t = {}) {
865
867
  var o;
866
- const [r, i] = e.split("?"), s = we(r);
867
- e: for (const f of a) {
868
- const { fragments: c } = f;
869
- if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !== s.length || t.willMatch && !t.willMatch(f))
868
+ const [r, i] = e.split("?"), s = ye(r);
869
+ e: for (const u of a) {
870
+ const { fragments: l } = u;
871
+ if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== s.length || t.willMatch && !t.willMatch(u))
870
872
  continue e;
871
- const y = [];
872
- t: for (let d = 0; d < c.length; d++) {
873
- const b = s[d], $ = c[d];
874
- if (b == null && $.type !== 3)
873
+ const g = [];
874
+ t: for (let d = 0; d < l.length; d++) {
875
+ const p = s[d], S = l[d];
876
+ if (p == null && S.type !== 3)
875
877
  continue e;
876
- switch ($.type) {
878
+ switch (S.type) {
877
879
  case 1:
878
- if ($.name.toLowerCase() === b.toLowerCase()) {
879
- y.push($);
880
+ if (S.name.toLowerCase() === p.toLowerCase()) {
881
+ g.push(S);
880
882
  break;
881
883
  } else
882
884
  continue e;
883
885
  case 2:
884
- y.push({ ...$, value: b });
886
+ g.push({ ...S, value: p });
885
887
  break;
886
888
  case 3:
887
- y.push({ ...$, value: s.slice(d).join("/") });
889
+ g.push({ ...S, value: s.slice(d).join("/") });
888
890
  break t;
889
891
  case 4:
890
- if (isNaN(Number(b)))
892
+ if (isNaN(Number(p)))
891
893
  continue e;
892
- y.push({ ...$, value: Number(b) });
894
+ g.push({ ...S, value: Number(p) });
893
895
  break;
894
896
  default:
895
- throw new Error(`Unknown fragment type: ${$.type}`);
897
+ throw new Error(`Unknown fragment type: ${S.type}`);
896
898
  }
897
899
  }
898
- const m = /* @__PURE__ */ Object.create(null);
899
- for (const d of y)
900
- d.type === 2 && (m[d.name] = decodeURIComponent(d.value)), d.type === 4 && (m[d.name] = d.value), d.type === 3 && (m.wildcard = "/" + decodeURIComponent(d.value));
900
+ const b = /* @__PURE__ */ Object.create(null);
901
+ for (const d of g)
902
+ d.type === 2 && (b[d.name] = decodeURIComponent(d.value)), d.type === 4 && (b[d.name] = d.value), d.type === 3 && (b.wildcard = "/" + decodeURIComponent(d.value));
901
903
  return {
902
- path: "/" + y.map((d) => d.value).join("/"),
903
- pattern: "/" + c.map((d) => d.type === 2 ? `{${d.name}}` : d.type === 4 ? `{#${d.name}}` : d.name).join("/"),
904
- params: m,
905
- query: Ke(i),
906
- meta: f.meta
904
+ path: "/" + g.map((d) => d.value).join("/"),
905
+ pattern: "/" + l.map((d) => d.type === 2 ? `{${d.name}}` : d.type === 4 ? `{#${d.name}}` : d.name).join("/"),
906
+ params: b,
907
+ query: Ye(i),
908
+ meta: u.meta
907
909
  };
908
910
  }
909
911
  }
910
- function Ft(a) {
912
+ function Wt(a) {
911
913
  const e = [], t = [], r = [], i = [];
912
914
  for (const o of a) {
913
- const { fragments: f } = o;
914
- f.some(
915
- (c) => c.type === 3
915
+ const { fragments: u } = o;
916
+ u.some(
917
+ (l) => l.type === 3
916
918
  /* Wildcard */
917
- ) ? i.push(o) : f.some(
918
- (c) => c.type === 4
919
+ ) ? i.push(o) : u.some(
920
+ (l) => l.type === 4
919
921
  /* NumericParam */
920
- ) ? t.push(o) : f.some(
921
- (c) => c.type === 2
922
+ ) ? t.push(o) : u.some(
923
+ (l) => l.type === 2
922
924
  /* Param */
923
925
  ) ? r.push(o) : e.push(o);
924
926
  }
925
- const s = (o, f) => o.fragments.length > f.fragments.length ? -1 : 1;
927
+ const s = (o, u) => o.fragments.length > u.fragments.length ? -1 : 1;
926
928
  return e.sort(s), t.sort(s), r.sort(s), i.sort(s), [...e, ...t, ...r, ...i];
927
929
  }
928
- function It(a) {
929
- const e = we(a), t = [];
930
+ function zt(a) {
931
+ const e = ye(a), t = [];
930
932
  for (let r = 0; r < e.length; r++) {
931
933
  const i = e[r];
932
934
  if (i === "*") {
@@ -949,85 +951,85 @@ function It(a) {
949
951
  }
950
952
  return t;
951
953
  }
952
- var ke, N, Z, k, We, F, Pe, ee, I, ue, he, fe, Se, B, Je, Ye;
953
- class Wt {
954
+ var Pe, N, Z, E, ze, I, Se, ee, F, le, ce, ue, Le, B, Xe, Ze;
955
+ class Gt {
954
956
  constructor(e, t) {
955
- h(this, B);
956
- h(this, ke);
957
- h(this, N);
958
- h(this, Z);
959
- h(this, k);
960
- h(this, We, 0);
961
- h(this, F, []);
962
- h(this, Pe);
963
- h(this, ee, []);
957
+ f(this, B);
958
+ f(this, Pe);
959
+ f(this, N);
960
+ f(this, Z);
961
+ f(this, E);
962
+ f(this, ze, 0);
963
+ f(this, I, []);
964
+ f(this, Se);
965
+ f(this, ee, []);
964
966
  // Callbacks that need to be called on unmount.
965
- h(this, I, []);
967
+ f(this, F, []);
966
968
  /**
967
969
  * The currently matched route pattern, if any.
968
970
  */
969
- P(this, "$pattern");
970
- h(this, ue);
971
+ k(this, "$pattern");
972
+ f(this, le);
971
973
  /**
972
974
  * The current URL path.
973
975
  */
974
- P(this, "$path");
975
- h(this, he);
976
+ k(this, "$path");
977
+ f(this, ce);
976
978
  /**
977
979
  * The current named path params.
978
980
  */
979
- P(this, "$params");
980
- h(this, fe);
981
+ k(this, "$params");
982
+ f(this, ue);
981
983
  /**
982
984
  * The current query params. Changes to this object will be reflected in the URL.
983
985
  */
984
- P(this, "$query");
985
- h(this, Se);
986
- g(this, ke, e), g(this, N, e.createLogger("dolla/router")), g(this, Z, t);
987
- const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [w, y] = K(
988
- Ke(typeof window > "u" ? "" : window.location.search ?? "")
986
+ k(this, "$query");
987
+ f(this, Le);
988
+ y(this, Pe, e), y(this, N, e.createLogger("dolla/router")), y(this, Z, t);
989
+ const [r, i] = Q(null), [s, o] = Q(""), [u, l] = Q({}), [w, g] = Q(
990
+ Ye(typeof window > "u" ? "" : window.location.search ?? "")
989
991
  );
990
- this.$pattern = r, g(this, ue, i), this.$path = s, g(this, he, o), this.$params = f, g(this, fe, c), this.$query = w, g(this, Se, y), e.beforeMount(() => {
991
- n(this, k) != null && (n(this, I).push(
992
- ut([w], (m) => {
992
+ this.$pattern = r, y(this, le, i), this.$path = s, y(this, ce, o), this.$params = u, y(this, ue, l), this.$query = w, y(this, Le, g), e.beforeMount(() => {
993
+ n(this, E) != null && (n(this, F).push(
994
+ ut([w], (b) => {
993
995
  const d = new URLSearchParams();
994
- for (const $ in m)
995
- d.set($, String(m[$]));
996
- const b = "?" + d.toString();
997
- b != n(this, k).location.search && n(this, k).replace({
998
- pathname: n(this, k).location.pathname,
999
- search: b
996
+ for (const S in b)
997
+ d.set(S, String(b[S]));
998
+ const p = "?" + d.toString();
999
+ p != n(this, E).location.search && n(this, E).replace({
1000
+ pathname: n(this, E).location.pathname,
1001
+ search: p
1000
1002
  });
1001
1003
  })
1002
- ), n(this, I).push(n(this, k).listen(S(this, B, Ye).bind(this))), S(this, B, Ye).call(this, n(this, k)), n(this, I).push(
1003
- Bt(n(this, Z).rootElement, (m) => {
1004
- let d = m.getAttribute("href");
1005
- n(this, N).info("Intercepted link click", m, d), /^https?:\/\/|^\//.test(d) || (d = se([n(this, k).location.pathname, d])), n(this, k).push(d);
1004
+ ), n(this, F).push(n(this, E).listen(P(this, B, Ze).bind(this))), P(this, B, Ze).call(this, n(this, E)), n(this, F).push(
1005
+ Qt(n(this, Z).rootElement, (b) => {
1006
+ let d = b.getAttribute("href");
1007
+ n(this, N).info("Intercepted link click", b, d), /^https?:\/\/|^\//.test(d) || (d = ae([n(this, E).location.pathname, d])), n(this, E).push(d);
1006
1008
  })
1007
1009
  ), n(this, N).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
1008
1010
  }), e.onUnmount(() => {
1009
- for (; n(this, I).length > 0; )
1010
- n(this, I).pop()();
1011
+ for (; n(this, F).length > 0; )
1012
+ n(this, F).pop()();
1011
1013
  });
1012
1014
  }
1013
1015
  setup(e) {
1014
- if (n(this, ke).isMounted) {
1016
+ if (n(this, Pe).isMounted) {
1015
1017
  n(this, N).crash(
1016
1018
  new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
1017
1019
  );
1018
1020
  return;
1019
1021
  }
1020
- e.style === "hash" ? g(this, k, Ht()) : g(this, k, _t()), g(this, ee, Ft(
1021
- e.routes.flatMap((t) => S(this, B, Je).call(this, t)).map((t) => ({
1022
+ e.style === "hash" ? y(this, E, Ft()) : y(this, E, It()), y(this, ee, Wt(
1023
+ e.routes.flatMap((t) => P(this, B, Xe).call(this, t)).map((t) => ({
1022
1024
  pattern: t.pattern,
1023
1025
  meta: t.meta,
1024
- fragments: It(t.pattern)
1026
+ fragments: zt(t.pattern)
1025
1027
  }))
1026
1028
  ));
1027
1029
  for (const t of n(this, ee))
1028
1030
  if (t.meta.redirect) {
1029
1031
  let r;
1030
- if (!Xe(t.meta.redirect)) if (U(t.meta.redirect)) {
1032
+ if (!et(t.meta.redirect)) if (U(t.meta.redirect)) {
1031
1033
  if (r = t.meta.redirect, !ot(n(this, ee), r, {
1032
1034
  willMatch(s) {
1033
1035
  return s !== t;
@@ -1048,7 +1050,7 @@ class Wt {
1048
1050
  * Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
1049
1051
  */
1050
1052
  go(e, t = {}) {
1051
- if (n(this, k) == null) {
1053
+ if (n(this, E) == null) {
1052
1054
  n(this, N).crash(
1053
1055
  new Error(
1054
1056
  "Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1057,13 +1059,13 @@ class Wt {
1057
1059
  return;
1058
1060
  }
1059
1061
  let r;
1060
- Array.isArray(e) ? r = se(e) : r = e.toString(), r = qe(n(this, k).location.pathname, r), t.preserveQuery && (r += n(this, k).location.search), t.replace ? n(this, k).replace(r) : n(this, k).push(r);
1062
+ Array.isArray(e) ? r = ae(e) : r = e.toString(), r = Ue(n(this, E).location.pathname, r), t.preserveQuery && (r += n(this, E).location.search), t.replace ? n(this, E).replace(r) : n(this, E).push(r);
1061
1063
  }
1062
1064
  /**
1063
1065
  * Navigate backward. Pass a number of steps to hit the back button that many times.
1064
1066
  */
1065
1067
  back(e = 1) {
1066
- if (n(this, k) == null) {
1068
+ if (n(this, E) == null) {
1067
1069
  n(this, N).crash(
1068
1070
  new Error(
1069
1071
  "Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1071,13 +1073,13 @@ class Wt {
1071
1073
  );
1072
1074
  return;
1073
1075
  }
1074
- n(this, k).go(-e);
1076
+ n(this, E).go(-e);
1075
1077
  }
1076
1078
  /**
1077
1079
  * Navigate forward. Pass a number of steps to hit the forward button that many times.
1078
1080
  */
1079
1081
  forward(e = 1) {
1080
- if (n(this, k) == null) {
1082
+ if (n(this, E) == null) {
1081
1083
  n(this, N).crash(
1082
1084
  new Error(
1083
1085
  "Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
@@ -1085,16 +1087,16 @@ class Wt {
1085
1087
  );
1086
1088
  return;
1087
1089
  }
1088
- n(this, k).go(e);
1090
+ n(this, E).go(e);
1089
1091
  }
1090
1092
  }
1091
- ke = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), k = new WeakMap(), We = new WeakMap(), F = new WeakMap(), Pe = new WeakMap(), ee = new WeakMap(), I = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Se = new WeakMap(), B = new WeakSet(), /**
1093
+ Pe = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), ze = new WeakMap(), I = new WeakMap(), Se = new WeakMap(), ee = new WeakMap(), F = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), ue = new WeakMap(), Le = new WeakMap(), B = new WeakSet(), /**
1092
1094
  * Parses a route definition object into a set of matchable routes.
1093
1095
  *
1094
1096
  * @param route - Route config object.
1095
1097
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
1096
1098
  */
1097
- Je = function(e, t = [], r = []) {
1099
+ Xe = function(e, t = [], r = []) {
1098
1100
  if (!(typeof e == "object" && !Array.isArray(e)) || typeof e.path != "string")
1099
1101
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
1100
1102
  if (e.redirect && e.routes)
@@ -1104,16 +1106,16 @@ Je = function(e, t = [], r = []) {
1104
1106
  if (!e.view && !e.routes && !e.redirect)
1105
1107
  throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
1106
1108
  let i = [];
1107
- for (const c of t)
1108
- i.push(...we(c.path));
1109
- i.push(...we(e.path)), i[i.length - 1] === "*" && i.pop();
1109
+ for (const l of t)
1110
+ i.push(...ye(l.path));
1111
+ i.push(...ye(e.path)), i[i.length - 1] === "*" && i.pop();
1110
1112
  const s = [];
1111
1113
  if (e.redirect) {
1112
- let c = e.redirect;
1113
- return U(c) && (c = qe(se(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
1114
- pattern: "/" + se([...i, ...we(e.path)]),
1114
+ let l = e.redirect;
1115
+ return U(l) && (l = Ue(ae(i), l), l.startsWith("/") || (l = "/" + l)), s.push({
1116
+ pattern: "/" + ae([...i, ...ye(e.path)]),
1115
1117
  meta: {
1116
- redirect: c
1118
+ redirect: l
1117
1119
  }
1118
1120
  }), s;
1119
1121
  }
@@ -1122,25 +1124,25 @@ Je = function(e, t = [], r = []) {
1122
1124
  o = e.view;
1123
1125
  else if (e.view)
1124
1126
  throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
1125
- const f = { id: et(this, We)._++, view: o };
1127
+ const u = { id: rt(this, ze)._++, view: o };
1126
1128
  if (e.routes)
1127
- for (const c of e.routes)
1128
- s.push(...S(this, B, Je).call(this, c, [...t, e], [...r, f]));
1129
+ for (const l of e.routes)
1130
+ s.push(...P(this, B, Xe).call(this, l, [...t, e], [...r, u]));
1129
1131
  else
1130
1132
  s.push({
1131
- pattern: parent ? se([...t.map((c) => c.path), e.path]) : e.path,
1133
+ pattern: parent ? ae([...t.map((l) => l.path), e.path]) : e.path,
1132
1134
  meta: {
1133
1135
  pattern: e.path,
1134
- layers: [...r, f],
1136
+ layers: [...r, u],
1135
1137
  beforeMatch: e.beforeMatch
1136
1138
  }
1137
1139
  });
1138
1140
  return s;
1139
- }, Ye = async function({ location: e }) {
1140
- e.search !== n(this, Pe) && (g(this, Pe, e.search), n(this, Se).call(this, Ke(e.search)));
1141
+ }, Ze = async function({ location: e }) {
1142
+ e.search !== n(this, Se) && (y(this, Se, e.search), n(this, Le).call(this, Ye(e.search)));
1141
1143
  const t = ot(n(this, ee), e.pathname);
1142
1144
  if (!t) {
1143
- n(this, ue).call(this, null), n(this, he).call(this, e.pathname), n(this, fe).call(this, {
1145
+ n(this, le).call(this, null), n(this, ce).call(this, e.pathname), n(this, ue).call(this, {
1144
1146
  wildcard: e.pathname
1145
1147
  });
1146
1148
  return;
@@ -1152,8 +1154,8 @@ Je = function(e, t = [], r = []) {
1152
1154
  }
1153
1155
  }), t.meta.redirect != null)
1154
1156
  if (typeof t.meta.redirect == "string") {
1155
- const r = Qt(t.meta.redirect, t.params);
1156
- n(this, N).info(`↩️ redirecting from '${t.path}' to '${r}'`), n(this, k).replace(r);
1157
+ const r = Jt(t.meta.redirect, t.params);
1158
+ n(this, N).info(`↩️ redirecting from '${t.path}' to '${r}'`), n(this, E).replace(r);
1157
1159
  } else if (typeof t.meta.redirect == "function") {
1158
1160
  const r = {
1159
1161
  path: t.path,
@@ -1164,26 +1166,26 @@ Je = function(e, t = [], r = []) {
1164
1166
  let i = await t.meta.redirect(r);
1165
1167
  if (typeof i != "string")
1166
1168
  throw new Error("Redirect function must return a path to redirect to.");
1167
- i.startsWith("/") || (i = qe(t.path, i)), n(this, N).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1169
+ i.startsWith("/") || (i = Ue(t.path, i)), n(this, N).info(`Redirecting to: '${i}'`), n(this, E).replace(i);
1168
1170
  } else
1169
1171
  throw new TypeError("Redirect must either be a path string or a function.");
1170
- else if (n(this, N).info(`📍 navigating to '${t.path}'`), n(this, he).call(this, t.path), n(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
1171
- n(this, ue).call(this, t.pattern);
1172
+ else if (n(this, N).info(`📍 navigating to '${t.path}'`), n(this, ce).call(this, t.path), n(this, ue).call(this, t.params), t.pattern !== this.$pattern.get()) {
1173
+ n(this, le).call(this, t.pattern);
1172
1174
  const r = t.meta.layers;
1173
1175
  for (let i = 0; i < r.length; i++) {
1174
- const s = r[i], o = n(this, F)[i];
1176
+ const s = r[i], o = n(this, I)[i];
1175
1177
  if ((o == null ? void 0 : o.id) !== s.id) {
1176
- g(this, F, n(this, F).slice(0, i));
1177
- const f = n(this, F).at(-1);
1178
+ y(this, I, n(this, I).slice(0, i));
1179
+ const u = n(this, I).at(-1);
1178
1180
  o && o.node.isMounted && o.node.unmount();
1179
- let c;
1180
- f ? c = f.node.setChildView(s.view) : c = n(this, Z).rootView.setChildView(s.view), n(this, F).push({ id: s.id, node: c });
1181
+ let l;
1182
+ u ? l = u.node.setChildView(s.view) : l = n(this, Z).rootView.setChildView(s.view), n(this, I).push({ id: s.id, node: l });
1181
1183
  }
1182
1184
  }
1183
1185
  }
1184
1186
  };
1185
- const zt = /(noopener|noreferrer) (noopener|noreferrer)/, Gt = /^[\w-_]+:/;
1186
- function Bt(a, e, t = window) {
1187
+ const Bt = /(noopener|noreferrer) (noopener|noreferrer)/, Kt = /^[\w-_]+:/;
1188
+ function Qt(a, e, t = window) {
1187
1189
  function r(s) {
1188
1190
  return !s || s === a ? null : s.localName !== "a" || s.href === void 0 ? r(s.parentNode) : s;
1189
1191
  }
@@ -1191,53 +1193,53 @@ function Bt(a, e, t = window) {
1191
1193
  if (s.button && s.button !== 0 || s.ctrlKey || s.metaKey || s.altKey || s.shiftKey || s.defaultPrevented)
1192
1194
  return;
1193
1195
  const o = r(s.target);
1194
- 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" && zt.test(o.getAttribute("rel")) || Gt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
1196
+ 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" && Bt.test(o.getAttribute("rel")) || Kt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
1195
1197
  }
1196
1198
  return a.addEventListener("click", i), function() {
1197
1199
  a.removeEventListener("click", i);
1198
1200
  };
1199
1201
  }
1200
- function Qt(a, e) {
1202
+ function Jt(a, e) {
1201
1203
  for (const t in e) {
1202
1204
  const r = e[t].toString();
1203
1205
  a = a.replace(`{${t}}`, r).replace(`{#${t}}`, r);
1204
1206
  }
1205
1207
  return a;
1206
1208
  }
1207
- var W, Le, z, te, Re, xe, Oe, Ne, Me, R, G;
1208
- class Kt {
1209
+ var W, Re, z, te, xe, Me, Ne, Oe, Te, R, G;
1210
+ class Yt {
1209
1211
  constructor() {
1210
- P(this, "http");
1211
- P(this, "i18n");
1212
- P(this, "render");
1213
- P(this, "router");
1214
- h(this, W, !1);
1215
- h(this, Le, "production");
1216
- h(this, z);
1217
- h(this, te);
1218
- h(this, Re, Nt);
1219
- h(this, xe, []);
1220
- h(this, Oe, []);
1221
- h(this, Ne, []);
1222
- h(this, Me, []);
1223
- h(this, R, {
1212
+ k(this, "http");
1213
+ k(this, "i18n");
1214
+ k(this, "render");
1215
+ k(this, "router");
1216
+ f(this, W, !1);
1217
+ f(this, Re, "production");
1218
+ f(this, z);
1219
+ f(this, te);
1220
+ f(this, xe, Tt);
1221
+ f(this, Me, []);
1222
+ f(this, Ne, []);
1223
+ f(this, Oe, []);
1224
+ f(this, Te, []);
1225
+ f(this, R, {
1224
1226
  info: "development",
1225
1227
  log: "development",
1226
1228
  warn: "development",
1227
1229
  error: !0
1228
1230
  });
1229
- h(this, G, rt("*,-dolla/*"));
1230
- P(this, "createState", K);
1231
- P(this, "createSettableState", $t);
1232
- P(this, "toSettableState", Et);
1233
- P(this, "toState", Be);
1234
- P(this, "valueOf", kt);
1235
- P(this, "derive", ae);
1236
- P(this, "watch", ut);
1237
- P(this, "createRef", Pt);
1238
- P(this, "isRef", St);
1231
+ f(this, G, at("*,-dolla/*"));
1232
+ k(this, "createState", Q);
1233
+ k(this, "createSettableState", kt);
1234
+ k(this, "toSettableState", Pt);
1235
+ k(this, "toState", Ke);
1236
+ k(this, "valueOf", St);
1237
+ k(this, "derive", me);
1238
+ k(this, "watch", ut);
1239
+ k(this, "createRef", Lt);
1240
+ k(this, "isRef", Rt);
1239
1241
  const e = this;
1240
- this.http = new Mt(), this.i18n = new Ct(this), this.render = new Vt(this), this.router = new Wt(this, {
1242
+ this.http = new At(), this.i18n = new Ut(this), this.render = new Vt(this), this.router = new Gt(this, {
1241
1243
  get rootElement() {
1242
1244
  return n(e, z);
1243
1245
  },
@@ -1257,40 +1259,40 @@ class Kt {
1257
1259
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1258
1260
  */
1259
1261
  getEnv() {
1260
- return n(this, Le);
1262
+ return n(this, Re);
1261
1263
  }
1262
1264
  /**
1263
1265
  * Sets the environment that this app is running in.
1264
1266
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1265
1267
  */
1266
1268
  setEnv(e) {
1267
- g(this, Le, e);
1269
+ y(this, Re, e);
1268
1270
  }
1269
1271
  /**
1270
1272
  * Sets the view that will be shown when the `crash` method is called on any logger.
1271
1273
  * When a crash is reported the app will be unmounted and replaced with this crash page.
1272
1274
  */
1273
1275
  setCrashView(e) {
1274
- g(this, Re, e);
1276
+ y(this, xe, e);
1275
1277
  }
1276
1278
  async mount(e, t) {
1277
1279
  if (n(this, W))
1278
1280
  throw new Error("Dolla is already mounted.");
1279
1281
  if (U(e)) {
1280
1282
  const i = document.querySelector(e);
1281
- nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, z, i);
1283
+ st(HTMLElement, i, `Selector '${e}' did not match any element.`), y(this, z, i);
1282
1284
  } else
1283
- nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), g(this, z, e);
1285
+ st(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), y(this, z, e);
1284
1286
  let r;
1285
- t ? r = at(t) : r = at(ht), g(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, xe).map((i) => i())), n(this, te).mount(n(this, z)), g(this, W, !0);
1286
- for (const i of n(this, Oe))
1287
+ t ? r = it(t) : r = it(ht), y(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, Me).map((i) => i())), n(this, te).mount(n(this, z)), y(this, W, !0);
1288
+ for (const i of n(this, Ne))
1287
1289
  i();
1288
1290
  }
1289
1291
  async unmount() {
1290
1292
  var e;
1291
1293
  if (n(this, W)) {
1292
- await Promise.all(n(this, Ne).map((t) => t())), (e = n(this, te)) == null || e.unmount(), g(this, W, !1);
1293
- for (const t of n(this, Me))
1294
+ await Promise.all(n(this, Oe).map((t) => t())), (e = n(this, te)) == null || e.unmount(), y(this, W, !1);
1295
+ for (const t of n(this, Te))
1294
1296
  t();
1295
1297
  }
1296
1298
  }
@@ -1299,26 +1301,26 @@ class Kt {
1299
1301
  * it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
1300
1302
  */
1301
1303
  beforeMount(e) {
1302
- n(this, xe).push(e);
1304
+ n(this, Me).push(e);
1303
1305
  }
1304
1306
  /**
1305
1307
  * Registers a `callback` to run after the app is mounted.
1306
1308
  */
1307
1309
  onMount(e) {
1308
- n(this, Oe).push(e);
1310
+ n(this, Ne).push(e);
1309
1311
  }
1310
1312
  /**
1311
1313
  * Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
1312
1314
  * it will be awaited before unmounting finishes. Use this to perform cleanup.
1313
1315
  */
1314
1316
  beforeUnmount(e) {
1315
- n(this, Ne).push(e);
1317
+ n(this, Oe).push(e);
1316
1318
  }
1317
1319
  /**
1318
1320
  * Registers a `callback` to run after the app is unmounted.
1319
1321
  */
1320
1322
  onUnmount(e) {
1321
- n(this, Me).push(e);
1323
+ n(this, Te).push(e);
1322
1324
  }
1323
1325
  /**
1324
1326
  * Update log type toggles. Values that are not passed will remain unchanged.
@@ -1330,22 +1332,22 @@ class Kt {
1330
1332
  }
1331
1333
  }
1332
1334
  setLogFilter(e) {
1333
- g(this, G, rt(e));
1335
+ y(this, G, at(e));
1334
1336
  }
1335
1337
  createLogger(e, t) {
1336
- const r = Be(e), i = (t == null ? void 0 : t.console) ?? Lt(), s = this;
1338
+ const r = Ke(e), i = (t == null ? void 0 : t.console) ?? xt(), s = this;
1337
1339
  return {
1338
1340
  get info() {
1339
- var f;
1341
+ var u;
1340
1342
  const o = r.get();
1341
- if (n(s, R).info === !1 || U(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(f = s, G).call(f, o))
1342
- return Te;
1343
+ if (n(s, R).info === !1 || U(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(u = s, G).call(u, o))
1344
+ return Ae;
1343
1345
  {
1344
- let c = `%c${o}`;
1345
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.info.bind(
1346
+ let l = `%c${o}`;
1347
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", i.info.bind(
1346
1348
  i,
1347
- c,
1348
- `color:${Ae(c)};font-weight:bold`,
1349
+ l,
1350
+ `color:${De(l)};font-weight:bold`,
1349
1351
  "color:#777",
1350
1352
  "color:#aaa",
1351
1353
  "color:#777"
@@ -1353,16 +1355,16 @@ class Kt {
1353
1355
  }
1354
1356
  },
1355
1357
  get log() {
1356
- var f;
1358
+ var u;
1357
1359
  const o = r.get();
1358
- if (n(s, R).log === !1 || U(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(f = s, G).call(f, o))
1359
- return Te;
1360
+ if (n(s, R).log === !1 || U(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(u = s, G).call(u, o))
1361
+ return Ae;
1360
1362
  {
1361
- let c = `%c${o}`;
1362
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.log.bind(
1363
+ let l = `%c${o}`;
1364
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", i.log.bind(
1363
1365
  i,
1364
- c,
1365
- `color:${Ae(c)};font-weight:bold`,
1366
+ l,
1367
+ `color:${De(l)};font-weight:bold`,
1366
1368
  "color:#777",
1367
1369
  "color:#aaa",
1368
1370
  "color:#777"
@@ -1370,16 +1372,16 @@ class Kt {
1370
1372
  }
1371
1373
  },
1372
1374
  get warn() {
1373
- var f;
1375
+ var u;
1374
1376
  const o = r.get();
1375
- if (n(s, R).warn === !1 || U(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(f = s, G).call(f, o))
1376
- return Te;
1377
+ if (n(s, R).warn === !1 || U(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(u = s, G).call(u, o))
1378
+ return Ae;
1377
1379
  {
1378
- let c = `%c${o}`;
1379
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.warn.bind(
1380
+ let l = `%c${o}`;
1381
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", i.warn.bind(
1380
1382
  i,
1381
- c,
1382
- `color:${Ae(c)};font-weight:bold`,
1383
+ l,
1384
+ `color:${De(l)};font-weight:bold`,
1383
1385
  "color:#777",
1384
1386
  "color:#aaa",
1385
1387
  "color:#777"
@@ -1387,16 +1389,16 @@ class Kt {
1387
1389
  }
1388
1390
  },
1389
1391
  get error() {
1390
- var f;
1392
+ var u;
1391
1393
  const o = r.get();
1392
- if (n(s, R).error === !1 || U(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(f = s, G).call(f, o))
1393
- return Te;
1394
+ if (n(s, R).error === !1 || U(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(u = s, G).call(u, o))
1395
+ return Ae;
1394
1396
  {
1395
- let c = `%c${o}`;
1396
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.error.bind(
1397
+ let l = `%c${o}`;
1398
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", i.error.bind(
1397
1399
  i,
1398
- c,
1399
- `color:${Ae(c)};font-weight:bold`,
1400
+ l,
1401
+ `color:${De(l)};font-weight:bold`,
1400
1402
  "color:#777",
1401
1403
  "color:#aaa",
1402
1404
  "color:#777"
@@ -1404,7 +1406,7 @@ class Kt {
1404
1406
  }
1405
1407
  },
1406
1408
  crash(o) {
1407
- throw s.isMounted && (s.unmount(), s.constructView(n(s, Re), {
1409
+ throw s.isMounted && (s.unmount(), s.constructView(n(s, xe), {
1408
1410
  error: o,
1409
1411
  loggerName: r.get(),
1410
1412
  uid: t == null ? void 0 : t.uid
@@ -1416,33 +1418,33 @@ class Kt {
1416
1418
  *
1417
1419
  */
1418
1420
  constructView(e, t, r = []) {
1419
- return Rt({ root: this, data: {} }, e, t, r);
1421
+ return Mt({ root: this, data: {} }, e, t, r);
1420
1422
  }
1421
1423
  /**
1422
1424
  *
1423
1425
  */
1424
1426
  constructMarkup(e) {
1425
- return xt(Ot({ root: this, data: {} }, e));
1427
+ return Nt(Ot({ root: this, data: {} }, e));
1426
1428
  }
1427
1429
  }
1428
- W = new WeakMap(), Le = new WeakMap(), z = new WeakMap(), te = new WeakMap(), Re = new WeakMap(), xe = new WeakMap(), Oe = new WeakMap(), Ne = new WeakMap(), Me = new WeakMap(), R = new WeakMap(), G = new WeakMap();
1429
- const ct = new Kt(), Zt = ct.i18n.t.bind(ct.i18n);
1430
+ W = new WeakMap(), Re = new WeakMap(), z = new WeakMap(), te = new WeakMap(), xe = new WeakMap(), Me = new WeakMap(), Ne = new WeakMap(), Oe = new WeakMap(), Te = new WeakMap(), R = new WeakMap(), G = new WeakMap();
1431
+ const lt = new Yt(), tr = lt.i18n.t.bind(lt.i18n);
1430
1432
  export {
1431
- wt as cond,
1432
- at as createMarkup,
1433
- Pt as createRef,
1434
- $t as createSettableState,
1435
- rr as createSetter,
1436
- K as createState,
1437
- ct as default,
1438
- ae as derive,
1439
- tt as html,
1440
- St as isRef,
1441
- nr as portal,
1442
- ar as repeat,
1443
- Zt as t,
1444
- Et as toSettableState,
1445
- Be as toState,
1446
- kt as valueOf
1433
+ vt as cond,
1434
+ it as createMarkup,
1435
+ Lt as createRef,
1436
+ kt as createSettableState,
1437
+ ar as createSetter,
1438
+ Q as createState,
1439
+ lt as default,
1440
+ me as derive,
1441
+ nt as html,
1442
+ Rt as isRef,
1443
+ sr as portal,
1444
+ ir as repeat,
1445
+ tr as t,
1446
+ Pt as toSettableState,
1447
+ Ke as toState,
1448
+ St as valueOf
1447
1449
  };
1448
1450
  //# sourceMappingURL=index.js.map