@manyducks.co/dolla 2.0.0-alpha.34 → 2.0.0-alpha.35

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