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

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