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