@manyducks.co/dolla 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{fragment-s33qZBzz.js → fragment-DHJiX0-a.js} +19 -19
- package/dist/fragment-DHJiX0-a.js.map +1 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.js +586 -563
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/markup.d.ts +7 -1
- package/dist/modules/dolla.d.ts +3 -3
- package/dist/utils.d.ts +3 -3
- package/package.json +2 -1
- package/dist/fragment-s33qZBzz.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var et = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var bt = Object.defineProperty;
|
|
2
|
+
var et = (a) => {
|
|
3
|
+
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var k = (
|
|
7
|
-
var
|
|
8
|
-
var tt = (
|
|
9
|
-
set _(
|
|
10
|
-
w(
|
|
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);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return
|
|
13
|
+
return i(a, e, n);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { i as
|
|
17
|
-
import { F as
|
|
18
|
-
function ht(
|
|
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
19
|
return e.outlet();
|
|
20
20
|
}
|
|
21
|
-
var K,
|
|
22
|
-
class
|
|
21
|
+
var K, Fe, T, C;
|
|
22
|
+
class Tt {
|
|
23
23
|
constructor() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
g(this, T);
|
|
25
|
+
g(this, K, []);
|
|
26
|
+
g(this, Fe, At());
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Adds a new middleware that will apply to subsequent requests.
|
|
@@ -32,127 +32,127 @@ class Ot {
|
|
|
32
32
|
* @param middleware - A middleware function that will intercept requests.
|
|
33
33
|
*/
|
|
34
34
|
use(e) {
|
|
35
|
-
return
|
|
36
|
-
|
|
35
|
+
return i(this, K).push(e), () => {
|
|
36
|
+
i(this, K).splice(i(this, K).indexOf(e), 1);
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
async get(e, t) {
|
|
40
|
-
return P(this, T,
|
|
40
|
+
return P(this, T, C).call(this, "get", e, t);
|
|
41
41
|
}
|
|
42
42
|
async put(e, t) {
|
|
43
|
-
return P(this, T,
|
|
43
|
+
return P(this, T, C).call(this, "put", e, t);
|
|
44
44
|
}
|
|
45
45
|
async patch(e, t) {
|
|
46
|
-
return P(this, T,
|
|
46
|
+
return P(this, T, C).call(this, "patch", e, t);
|
|
47
47
|
}
|
|
48
48
|
async post(e, t) {
|
|
49
|
-
return P(this, T,
|
|
49
|
+
return P(this, T, C).call(this, "post", e, t);
|
|
50
50
|
}
|
|
51
51
|
async delete(e, t) {
|
|
52
|
-
return P(this, T,
|
|
52
|
+
return P(this, T, C).call(this, "delete", e, t);
|
|
53
53
|
}
|
|
54
54
|
async head(e, t) {
|
|
55
|
-
return P(this, T,
|
|
55
|
+
return P(this, T, C).call(this, "head", e, t);
|
|
56
56
|
}
|
|
57
57
|
async options(e, t) {
|
|
58
|
-
return P(this, T,
|
|
58
|
+
return P(this, T, C).call(this, "options", e, t);
|
|
59
59
|
}
|
|
60
60
|
async trace(e, t) {
|
|
61
|
-
return P(this, T,
|
|
61
|
+
return P(this, T, C).call(this, "trace", e, t);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
K = new WeakMap(),
|
|
65
|
-
return
|
|
64
|
+
K = new WeakMap(), Fe = new WeakMap(), T = new WeakSet(), C = async function(e, t, n) {
|
|
65
|
+
return Ut({
|
|
66
66
|
...n,
|
|
67
67
|
method: e,
|
|
68
68
|
uri: t,
|
|
69
|
-
middleware:
|
|
70
|
-
fetch:
|
|
69
|
+
middleware: i(this, K),
|
|
70
|
+
fetch: i(this, Fe)
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
-
function
|
|
73
|
+
function At() {
|
|
74
74
|
if (typeof window < "u" && window.fetch)
|
|
75
75
|
return window.fetch.bind(window);
|
|
76
76
|
if (typeof global < "u" && global.fetch)
|
|
77
77
|
return global.fetch.bind(global);
|
|
78
78
|
throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
|
|
79
79
|
}
|
|
80
|
-
class
|
|
80
|
+
class jt extends Error {
|
|
81
81
|
constructor(t) {
|
|
82
|
-
const { status: n, statusText:
|
|
83
|
-
super(
|
|
82
|
+
const { status: n, statusText: o, method: r, uri: s } = t, h = `${n} ${o}: Request failed (${r.toUpperCase()} ${s})`;
|
|
83
|
+
super(h);
|
|
84
84
|
k(this, "response");
|
|
85
85
|
this.response = t;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
async function
|
|
89
|
-
const { headers: e, query: t, fetch: n, middleware:
|
|
90
|
-
method:
|
|
91
|
-
uri:
|
|
88
|
+
async function Ut(a) {
|
|
89
|
+
const { headers: e, query: t, fetch: n, middleware: o } = a, r = {
|
|
90
|
+
method: a.method,
|
|
91
|
+
uri: a.uri,
|
|
92
92
|
get sameOrigin() {
|
|
93
|
-
return !
|
|
93
|
+
return !r.uri.startsWith("http");
|
|
94
94
|
},
|
|
95
95
|
query: new URLSearchParams(),
|
|
96
96
|
headers: new Headers(),
|
|
97
|
-
body:
|
|
97
|
+
body: a.body
|
|
98
98
|
};
|
|
99
99
|
if (e)
|
|
100
100
|
if (e instanceof Map || e instanceof Headers)
|
|
101
|
-
e.forEach((c,
|
|
102
|
-
|
|
101
|
+
e.forEach((c, u) => {
|
|
102
|
+
r.headers.set(u, c);
|
|
103
103
|
});
|
|
104
104
|
else if (e != null && typeof e == "object" && !Array.isArray(e))
|
|
105
105
|
for (const c in e) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const u = e[c];
|
|
107
|
+
u instanceof Date ? r.headers.set(c, u.toISOString()) : u != null && r.headers.set(c, String(u));
|
|
108
108
|
}
|
|
109
109
|
else
|
|
110
110
|
throw new TypeError(`Unknown headers type. Got: ${e}`);
|
|
111
111
|
if (t)
|
|
112
112
|
if (t instanceof Map || t instanceof URLSearchParams)
|
|
113
|
-
t.forEach((c,
|
|
114
|
-
|
|
113
|
+
t.forEach((c, u) => {
|
|
114
|
+
r.query.set(u, c);
|
|
115
115
|
});
|
|
116
116
|
else if (t != null && typeof t == "object" && !Array.isArray(t))
|
|
117
117
|
for (const c in t) {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const u = t[c];
|
|
119
|
+
u instanceof Date ? r.query.set(c, u.toISOString()) : u != null && r.query.set(c, String(u));
|
|
120
120
|
}
|
|
121
121
|
else
|
|
122
122
|
throw new TypeError(`Unknown query params type. Got: ${t}`);
|
|
123
|
-
let
|
|
124
|
-
const
|
|
125
|
-
const c =
|
|
126
|
-
let
|
|
127
|
-
!
|
|
128
|
-
const b = await n(
|
|
129
|
-
method:
|
|
130
|
-
headers:
|
|
131
|
-
body:
|
|
132
|
-
}),
|
|
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
133
|
let $;
|
|
134
|
-
|
|
135
|
-
method:
|
|
136
|
-
uri:
|
|
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,
|
|
137
137
|
status: b.status,
|
|
138
138
|
statusText: b.statusText,
|
|
139
|
-
headers:
|
|
139
|
+
headers: f,
|
|
140
140
|
body: $
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
|
-
if (
|
|
144
|
-
const c = (
|
|
145
|
-
const
|
|
146
|
-
return async () =>
|
|
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));
|
|
147
147
|
};
|
|
148
148
|
await c()();
|
|
149
149
|
} else
|
|
150
|
-
await
|
|
151
|
-
if (
|
|
152
|
-
throw new
|
|
153
|
-
return
|
|
150
|
+
await h();
|
|
151
|
+
if (s.status < 200 || s.status >= 400)
|
|
152
|
+
throw new jt(s);
|
|
153
|
+
return s;
|
|
154
154
|
}
|
|
155
|
-
class
|
|
155
|
+
class qt {
|
|
156
156
|
constructor(e, t) {
|
|
157
157
|
k(this, "dolla");
|
|
158
158
|
k(this, "config");
|
|
@@ -163,14 +163,14 @@ class jt {
|
|
|
163
163
|
if (this.strings == null) {
|
|
164
164
|
if (Ze(this.config.fetch)) {
|
|
165
165
|
const e = await this.config.fetch();
|
|
166
|
-
if (
|
|
166
|
+
if (Ge(e))
|
|
167
167
|
this.strings = e;
|
|
168
168
|
else
|
|
169
169
|
throw new Error(`Fetch function did not return an object of language strings: ${e}`);
|
|
170
170
|
} else if (H(this.config.path)) {
|
|
171
171
|
const e = await this.dolla.http.get(this.config.path);
|
|
172
172
|
if (e.status >= 200 && e.status < 300)
|
|
173
|
-
if (
|
|
173
|
+
if (Ge(e.body))
|
|
174
174
|
this.strings = e.body;
|
|
175
175
|
else
|
|
176
176
|
throw new Error(
|
|
@@ -185,65 +185,65 @@ class jt {
|
|
|
185
185
|
return this.strings;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
var we, J,
|
|
188
|
+
var we, J, O, se, be, ve, oe, $e, We, ft;
|
|
189
189
|
class Ct {
|
|
190
190
|
constructor(e) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
197
|
k(this, "$current");
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
g(this, ve);
|
|
199
|
+
g(this, oe);
|
|
200
|
+
g(this, $e);
|
|
201
201
|
w(this, we, e), w(this, J, e.createLogger("dolla/language"));
|
|
202
|
-
const [t, n] = Q(), [
|
|
203
|
-
this.$current = t, w(this, ve, n), w(this, oe,
|
|
204
|
-
|
|
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));
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
get supportedLanguages() {
|
|
208
|
-
return [...
|
|
208
|
+
return [...i(this, O).keys()];
|
|
209
209
|
}
|
|
210
210
|
setup(e) {
|
|
211
211
|
if (e.languages.forEach((t) => {
|
|
212
|
-
|
|
212
|
+
i(this, O).set(t.name, new qt(t, i(this, we)));
|
|
213
213
|
}), e.initialLanguage && e.initialLanguage !== "auto") {
|
|
214
214
|
if (!e.languages.some((n) => n.name === e.initialLanguage))
|
|
215
215
|
throw new Error(`Initial language '${e.initialLanguage}' has no registered translation.`);
|
|
216
216
|
w(this, be, e.initialLanguage);
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
`${
|
|
218
|
+
i(this, J).info(
|
|
219
|
+
`${i(this, O).size} language${i(this, O).size === 1 ? "" : "s"} supported: '${[...i(this, O).keys()].join("', '")}'`
|
|
220
220
|
);
|
|
221
221
|
}
|
|
222
222
|
async setLanguage(e) {
|
|
223
|
-
var
|
|
223
|
+
var o;
|
|
224
224
|
let t;
|
|
225
225
|
if (e === "auto") {
|
|
226
|
-
let
|
|
226
|
+
let r = [];
|
|
227
227
|
if (typeof navigator == "object") {
|
|
228
|
-
const
|
|
229
|
-
((
|
|
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);
|
|
230
230
|
}
|
|
231
|
-
for (const
|
|
232
|
-
|
|
231
|
+
for (const s of r)
|
|
232
|
+
i(this, O).has(s) && (t = s);
|
|
233
233
|
} else
|
|
234
|
-
|
|
234
|
+
i(this, O).has(e) && (t = e);
|
|
235
235
|
if (t == null) {
|
|
236
|
-
const
|
|
237
|
-
|
|
236
|
+
const r = i(this, O).keys().next().value;
|
|
237
|
+
r && (t = r);
|
|
238
238
|
}
|
|
239
|
-
if (!t || !
|
|
239
|
+
if (!t || !i(this, O).has(t))
|
|
240
240
|
throw new Error(`Language '${e}' is not configured for this app.`);
|
|
241
|
-
const n =
|
|
241
|
+
const n = i(this, O).get(t);
|
|
242
242
|
try {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
} catch (
|
|
246
|
-
|
|
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);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
@@ -255,73 +255,73 @@ class Ct {
|
|
|
255
255
|
t(e, t) {
|
|
256
256
|
if (this === void 0)
|
|
257
257
|
throw new Error(
|
|
258
|
-
`The 't' function cannot be destructured. If you need a standalone version you can import it
|
|
258
|
+
`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
259
|
);
|
|
260
260
|
if (!this.$current.get())
|
|
261
|
-
return
|
|
262
|
-
const n = P(this,
|
|
261
|
+
return _t;
|
|
262
|
+
const n = P(this, We, ft).call(this, e, t);
|
|
263
263
|
if (n)
|
|
264
264
|
return n;
|
|
265
265
|
if (t) {
|
|
266
|
-
const
|
|
267
|
-
for (const [
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
const b =
|
|
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
273
|
...t
|
|
274
274
|
};
|
|
275
275
|
for (let $ = 0; $ < b.length; $++) {
|
|
276
276
|
const N = b[$][0];
|
|
277
|
-
|
|
277
|
+
f[N] = p[$];
|
|
278
278
|
}
|
|
279
|
-
const
|
|
280
|
-
return
|
|
279
|
+
const m = st(u, e) || `[NO TRANSLATION: ${e}]`;
|
|
280
|
+
return it(m, f);
|
|
281
281
|
});
|
|
282
|
-
return
|
|
282
|
+
return i(this, se).push([e, t, c]), c;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
const
|
|
286
|
-
let
|
|
287
|
-
return t && (
|
|
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;
|
|
288
288
|
});
|
|
289
|
-
return
|
|
289
|
+
return i(this, se).push([e, t, o]), o;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
we = new WeakMap(), J = new WeakMap(),
|
|
293
|
-
for (const n of
|
|
294
|
-
if (n[0] === e &&
|
|
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
295
|
return n[2];
|
|
296
296
|
};
|
|
297
|
-
const
|
|
298
|
-
function
|
|
297
|
+
const _t = Be("[NO LANGUAGE SET]");
|
|
298
|
+
function it(a, e) {
|
|
299
299
|
for (const t in e)
|
|
300
|
-
|
|
301
|
-
return
|
|
300
|
+
a = a.replace(`{{${t}}}`, String(e[t]));
|
|
301
|
+
return a;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
const t = String(e).split(/[\.\[\]]/).filter((
|
|
305
|
-
let n =
|
|
303
|
+
function st(a, e) {
|
|
304
|
+
const t = String(e).split(/[\.\[\]]/).filter((o) => o.trim() !== "");
|
|
305
|
+
let n = a;
|
|
306
306
|
for (; t.length > 0; ) {
|
|
307
|
-
const
|
|
308
|
-
n != null ? n = n[
|
|
307
|
+
const o = t.shift();
|
|
308
|
+
n != null ? n = n[o] : n = void 0;
|
|
309
309
|
}
|
|
310
310
|
return n;
|
|
311
311
|
}
|
|
312
312
|
var Y, Ee, V, F, ce, _, le, Ae;
|
|
313
|
-
class
|
|
313
|
+
class Dt {
|
|
314
314
|
constructor(e) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
g(this, le);
|
|
316
|
+
g(this, Y);
|
|
317
|
+
g(this, Ee);
|
|
318
318
|
// Keyed updates ensure only the most recent callback queued with a certain key
|
|
319
319
|
// will be called, keeping DOM operations to a minimum.
|
|
320
|
-
|
|
320
|
+
g(this, V, /* @__PURE__ */ new Map());
|
|
321
321
|
// All unkeyed updates are run on every batch.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
g(this, F, []);
|
|
323
|
+
g(this, ce, []);
|
|
324
|
+
g(this, _, !1);
|
|
325
325
|
w(this, Y, e), w(this, Ee, e.createLogger("dolla/render"));
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
@@ -331,11 +331,11 @@ class qt {
|
|
|
331
331
|
*/
|
|
332
332
|
update(e, t) {
|
|
333
333
|
return new Promise((n) => {
|
|
334
|
-
t ?
|
|
334
|
+
t ? i(this, V).set(t, () => {
|
|
335
335
|
e(), n();
|
|
336
|
-
}) :
|
|
336
|
+
}) : i(this, F).push(() => {
|
|
337
337
|
e(), n();
|
|
338
|
-
}), !
|
|
338
|
+
}), !i(this, _) && i(this, Y).isMounted && (w(this, _, !0), P(this, le, Ae).call(this));
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
@@ -345,51 +345,51 @@ class qt {
|
|
|
345
345
|
*/
|
|
346
346
|
async read(e) {
|
|
347
347
|
return new Promise((t) => {
|
|
348
|
-
|
|
348
|
+
i(this, ce).push(() => {
|
|
349
349
|
e(), t();
|
|
350
|
-
}), !
|
|
350
|
+
}), !i(this, _) && i(this, Y).isMounted && (w(this, _, !0), P(this, le, Ae).call(this));
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
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 =
|
|
356
|
-
if ((!
|
|
357
|
-
for (const t of
|
|
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))
|
|
358
358
|
t();
|
|
359
359
|
w(this, ce, []);
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
362
|
requestAnimationFrame(() => {
|
|
363
|
-
|
|
364
|
-
for (const t of
|
|
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())
|
|
365
365
|
t();
|
|
366
|
-
|
|
367
|
-
for (const t of
|
|
366
|
+
i(this, V).clear();
|
|
367
|
+
for (const t of i(this, F))
|
|
368
368
|
t();
|
|
369
369
|
w(this, F, []), P(this, le, Ae).call(this);
|
|
370
370
|
});
|
|
371
371
|
};
|
|
372
372
|
function de() {
|
|
373
|
-
return de = Object.assign || function(
|
|
373
|
+
return de = Object.assign || function(a) {
|
|
374
374
|
for (var e = 1; e < arguments.length; e++) {
|
|
375
375
|
var t = arguments[e];
|
|
376
376
|
for (var n in t)
|
|
377
|
-
Object.prototype.hasOwnProperty.call(t, n) && (
|
|
377
|
+
Object.prototype.hasOwnProperty.call(t, n) && (a[n] = t[n]);
|
|
378
378
|
}
|
|
379
|
-
return
|
|
379
|
+
return a;
|
|
380
380
|
}, de.apply(this, arguments);
|
|
381
381
|
}
|
|
382
|
-
var
|
|
383
|
-
(function(
|
|
384
|
-
|
|
385
|
-
})(
|
|
386
|
-
var
|
|
387
|
-
return Object.freeze(
|
|
388
|
-
} : function(
|
|
389
|
-
return
|
|
382
|
+
var U;
|
|
383
|
+
(function(a) {
|
|
384
|
+
a.Pop = "POP", a.Push = "PUSH", a.Replace = "REPLACE";
|
|
385
|
+
})(U || (U = {}));
|
|
386
|
+
var _e = process.env.NODE_ENV !== "production" ? function(a) {
|
|
387
|
+
return Object.freeze(a);
|
|
388
|
+
} : function(a) {
|
|
389
|
+
return a;
|
|
390
390
|
};
|
|
391
|
-
function je(
|
|
392
|
-
if (!
|
|
391
|
+
function je(a, e) {
|
|
392
|
+
if (!a) {
|
|
393
393
|
typeof console < "u" && console.warn(e);
|
|
394
394
|
try {
|
|
395
395
|
throw new Error(e);
|
|
@@ -397,31 +397,31 @@ function je(r, e) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
var
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
var e =
|
|
404
|
-
function
|
|
405
|
-
var
|
|
406
|
-
return [E.idx,
|
|
400
|
+
var De = "beforeunload", Ht = "hashchange", dt = "popstate";
|
|
401
|
+
function Vt(a) {
|
|
402
|
+
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
407
|
pathname: l,
|
|
408
|
-
search:
|
|
408
|
+
search: d,
|
|
409
409
|
hash: v,
|
|
410
410
|
state: E.usr || null,
|
|
411
411
|
key: E.key || "default"
|
|
412
412
|
})];
|
|
413
413
|
}
|
|
414
|
-
var
|
|
415
|
-
function
|
|
416
|
-
if (
|
|
417
|
-
|
|
414
|
+
var s = null;
|
|
415
|
+
function h() {
|
|
416
|
+
if (s)
|
|
417
|
+
m.call(s), s = null;
|
|
418
418
|
else {
|
|
419
|
-
var
|
|
420
|
-
if (
|
|
421
|
-
if (
|
|
422
|
-
var E =
|
|
423
|
-
E && (
|
|
424
|
-
action:
|
|
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,
|
|
425
425
|
location: v,
|
|
426
426
|
retry: function() {
|
|
427
427
|
D(E * -1);
|
|
@@ -436,76 +436,76 @@ function Dt(r) {
|
|
|
436
436
|
"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
437
|
);
|
|
438
438
|
else
|
|
439
|
-
re(
|
|
439
|
+
re(y);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
|
-
n.addEventListener(
|
|
443
|
-
var c =
|
|
444
|
-
|
|
445
|
-
idx:
|
|
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
|
|
446
446
|
}), ""));
|
|
447
|
-
function $(
|
|
448
|
-
return typeof
|
|
447
|
+
function $(y) {
|
|
448
|
+
return typeof y == "string" ? y : Ue(y);
|
|
449
449
|
}
|
|
450
|
-
function N(
|
|
451
|
-
return l === void 0 && (l = null),
|
|
450
|
+
function N(y, l) {
|
|
451
|
+
return l === void 0 && (l = null), _e(de({
|
|
452
452
|
pathname: b.pathname,
|
|
453
453
|
hash: "",
|
|
454
454
|
search: ""
|
|
455
|
-
}, typeof
|
|
455
|
+
}, typeof y == "string" ? Ke(y) : y, {
|
|
456
456
|
state: l,
|
|
457
|
-
key:
|
|
457
|
+
key: gt()
|
|
458
458
|
}));
|
|
459
459
|
}
|
|
460
|
-
function ge(
|
|
460
|
+
function ge(y, l) {
|
|
461
461
|
return [{
|
|
462
|
-
usr:
|
|
463
|
-
key:
|
|
462
|
+
usr: y.state,
|
|
463
|
+
key: y.key,
|
|
464
464
|
idx: l
|
|
465
|
-
}, $(
|
|
465
|
+
}, $(y)];
|
|
466
466
|
}
|
|
467
|
-
function pe(
|
|
468
|
-
return !
|
|
469
|
-
action:
|
|
467
|
+
function pe(y, l, d) {
|
|
468
|
+
return !m.length || (m.call({
|
|
469
|
+
action: y,
|
|
470
470
|
location: l,
|
|
471
|
-
retry:
|
|
471
|
+
retry: d
|
|
472
472
|
}), !1);
|
|
473
473
|
}
|
|
474
|
-
function re(
|
|
475
|
-
c =
|
|
476
|
-
var l =
|
|
477
|
-
|
|
474
|
+
function re(y) {
|
|
475
|
+
c = y;
|
|
476
|
+
var l = r();
|
|
477
|
+
p = l[0], b = l[1], f.call({
|
|
478
478
|
action: c,
|
|
479
479
|
location: b
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
function ae(
|
|
483
|
-
var
|
|
482
|
+
function ae(y, l) {
|
|
483
|
+
var d = U.Push, v = N(y, l);
|
|
484
484
|
function E() {
|
|
485
|
-
ae(
|
|
485
|
+
ae(y, l);
|
|
486
486
|
}
|
|
487
|
-
if (pe(
|
|
488
|
-
var
|
|
487
|
+
if (pe(d, v, E)) {
|
|
488
|
+
var M = ge(v, p + 1), x = M[0], A = M[1];
|
|
489
489
|
try {
|
|
490
|
-
|
|
490
|
+
o.pushState(x, "", A);
|
|
491
491
|
} catch {
|
|
492
492
|
n.location.assign(A);
|
|
493
493
|
}
|
|
494
|
-
re(
|
|
494
|
+
re(d);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function me(
|
|
498
|
-
var
|
|
497
|
+
function me(y, l) {
|
|
498
|
+
var d = U.Replace, v = N(y, l);
|
|
499
499
|
function E() {
|
|
500
|
-
me(
|
|
500
|
+
me(y, l);
|
|
501
501
|
}
|
|
502
|
-
if (pe(
|
|
503
|
-
var
|
|
504
|
-
|
|
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);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function D(
|
|
508
|
-
|
|
507
|
+
function D(y) {
|
|
508
|
+
o.go(y);
|
|
509
509
|
}
|
|
510
510
|
var B = {
|
|
511
511
|
get action() {
|
|
@@ -525,46 +525,46 @@ function Dt(r) {
|
|
|
525
525
|
D(1);
|
|
526
526
|
},
|
|
527
527
|
listen: function(l) {
|
|
528
|
-
return
|
|
528
|
+
return f.push(l);
|
|
529
529
|
},
|
|
530
530
|
block: function(l) {
|
|
531
|
-
var
|
|
532
|
-
return
|
|
533
|
-
|
|
531
|
+
var d = m.push(l);
|
|
532
|
+
return m.length === 1 && n.addEventListener(De, He), function() {
|
|
533
|
+
d(), m.length || n.removeEventListener(De, He);
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
};
|
|
537
537
|
return B;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
|
|
541
|
-
var e =
|
|
542
|
-
function
|
|
543
|
-
var l = Ke(n.location.hash.substr(1)),
|
|
544
|
-
return [
|
|
539
|
+
function Ft(a) {
|
|
540
|
+
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({
|
|
545
545
|
pathname: v,
|
|
546
|
-
search:
|
|
546
|
+
search: M,
|
|
547
547
|
hash: A,
|
|
548
|
-
state:
|
|
549
|
-
key:
|
|
548
|
+
state: q.usr || null,
|
|
549
|
+
key: q.key || "default"
|
|
550
550
|
})];
|
|
551
551
|
}
|
|
552
|
-
var
|
|
553
|
-
function
|
|
554
|
-
if (
|
|
555
|
-
|
|
552
|
+
var s = null;
|
|
553
|
+
function h() {
|
|
554
|
+
if (s)
|
|
555
|
+
m.call(s), s = null;
|
|
556
556
|
else {
|
|
557
|
-
var l =
|
|
558
|
-
if (
|
|
557
|
+
var l = U.Pop, d = r(), v = d[0], E = d[1];
|
|
558
|
+
if (m.length)
|
|
559
559
|
if (v != null) {
|
|
560
|
-
var
|
|
561
|
-
|
|
560
|
+
var M = p - v;
|
|
561
|
+
M && (s = {
|
|
562
562
|
action: l,
|
|
563
563
|
location: E,
|
|
564
564
|
retry: function() {
|
|
565
|
-
B(
|
|
565
|
+
B(M * -1);
|
|
566
566
|
}
|
|
567
|
-
}, B(
|
|
567
|
+
}, B(M));
|
|
568
568
|
} else
|
|
569
569
|
process.env.NODE_ENV !== "production" && je(
|
|
570
570
|
!1,
|
|
@@ -577,86 +577,86 @@ function Ht(r) {
|
|
|
577
577
|
ae(l);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
n.addEventListener(
|
|
581
|
-
var l =
|
|
582
|
-
|
|
580
|
+
n.addEventListener(dt, h), n.addEventListener(Ht, function() {
|
|
581
|
+
var l = r(), d = l[1];
|
|
582
|
+
Ue(d) !== Ue(b) && h();
|
|
583
583
|
});
|
|
584
|
-
var c =
|
|
585
|
-
|
|
586
|
-
idx:
|
|
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
|
|
587
587
|
}), ""));
|
|
588
588
|
function $() {
|
|
589
|
-
var l = document.querySelector("base"),
|
|
589
|
+
var l = document.querySelector("base"), d = "";
|
|
590
590
|
if (l && l.getAttribute("href")) {
|
|
591
591
|
var v = n.location.href, E = v.indexOf("#");
|
|
592
|
-
|
|
592
|
+
d = E === -1 ? v : v.slice(0, E);
|
|
593
593
|
}
|
|
594
|
-
return
|
|
594
|
+
return d;
|
|
595
595
|
}
|
|
596
596
|
function N(l) {
|
|
597
|
-
return $() + "#" + (typeof l == "string" ? l :
|
|
597
|
+
return $() + "#" + (typeof l == "string" ? l : Ue(l));
|
|
598
598
|
}
|
|
599
|
-
function ge(l,
|
|
600
|
-
return
|
|
599
|
+
function ge(l, d) {
|
|
600
|
+
return d === void 0 && (d = null), _e(de({
|
|
601
601
|
pathname: b.pathname,
|
|
602
602
|
hash: "",
|
|
603
603
|
search: ""
|
|
604
604
|
}, typeof l == "string" ? Ke(l) : l, {
|
|
605
|
-
state:
|
|
606
|
-
key:
|
|
605
|
+
state: d,
|
|
606
|
+
key: gt()
|
|
607
607
|
}));
|
|
608
608
|
}
|
|
609
|
-
function pe(l,
|
|
609
|
+
function pe(l, d) {
|
|
610
610
|
return [{
|
|
611
611
|
usr: l.state,
|
|
612
612
|
key: l.key,
|
|
613
|
-
idx:
|
|
613
|
+
idx: d
|
|
614
614
|
}, N(l)];
|
|
615
615
|
}
|
|
616
|
-
function re(l,
|
|
617
|
-
return !
|
|
616
|
+
function re(l, d, v) {
|
|
617
|
+
return !m.length || (m.call({
|
|
618
618
|
action: l,
|
|
619
|
-
location:
|
|
619
|
+
location: d,
|
|
620
620
|
retry: v
|
|
621
621
|
}), !1);
|
|
622
622
|
}
|
|
623
623
|
function ae(l) {
|
|
624
624
|
c = l;
|
|
625
|
-
var
|
|
626
|
-
|
|
625
|
+
var d = r();
|
|
626
|
+
p = d[0], b = d[1], f.call({
|
|
627
627
|
action: c,
|
|
628
628
|
location: b
|
|
629
629
|
});
|
|
630
630
|
}
|
|
631
|
-
function me(l,
|
|
632
|
-
var v =
|
|
633
|
-
function
|
|
634
|
-
me(l,
|
|
631
|
+
function me(l, d) {
|
|
632
|
+
var v = U.Push, E = ge(l, d);
|
|
633
|
+
function M() {
|
|
634
|
+
me(l, d);
|
|
635
635
|
}
|
|
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,
|
|
637
|
-
var
|
|
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];
|
|
638
638
|
try {
|
|
639
|
-
|
|
639
|
+
o.pushState(A, "", q);
|
|
640
640
|
} catch {
|
|
641
|
-
n.location.assign(
|
|
641
|
+
n.location.assign(q);
|
|
642
642
|
}
|
|
643
643
|
ae(v);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
function D(l,
|
|
647
|
-
var v =
|
|
648
|
-
function
|
|
649
|
-
D(l,
|
|
646
|
+
function D(l, d) {
|
|
647
|
+
var v = U.Replace, E = ge(l, d);
|
|
648
|
+
function M() {
|
|
649
|
+
D(l, d);
|
|
650
650
|
}
|
|
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,
|
|
652
|
-
var
|
|
653
|
-
|
|
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);
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
function B(l) {
|
|
657
|
-
|
|
657
|
+
o.go(l);
|
|
658
658
|
}
|
|
659
|
-
var
|
|
659
|
+
var y = {
|
|
660
660
|
get action() {
|
|
661
661
|
return c;
|
|
662
662
|
},
|
|
@@ -673,80 +673,80 @@ function Ht(r) {
|
|
|
673
673
|
forward: function() {
|
|
674
674
|
B(1);
|
|
675
675
|
},
|
|
676
|
-
listen: function(
|
|
677
|
-
return
|
|
676
|
+
listen: function(d) {
|
|
677
|
+
return f.push(d);
|
|
678
678
|
},
|
|
679
|
-
block: function(
|
|
680
|
-
var v =
|
|
681
|
-
return
|
|
682
|
-
v(),
|
|
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);
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
};
|
|
686
|
-
return
|
|
686
|
+
return y;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
|
|
688
|
+
function He(a) {
|
|
689
|
+
a.preventDefault(), a.returnValue = "";
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
var
|
|
691
|
+
function Ve() {
|
|
692
|
+
var a = [];
|
|
693
693
|
return {
|
|
694
694
|
get length() {
|
|
695
|
-
return
|
|
695
|
+
return a.length;
|
|
696
696
|
},
|
|
697
697
|
push: function(t) {
|
|
698
|
-
return
|
|
699
|
-
|
|
698
|
+
return a.push(t), function() {
|
|
699
|
+
a = a.filter(function(n) {
|
|
700
700
|
return n !== t;
|
|
701
701
|
});
|
|
702
702
|
};
|
|
703
703
|
},
|
|
704
704
|
call: function(t) {
|
|
705
|
-
|
|
705
|
+
a.forEach(function(n) {
|
|
706
706
|
return n && n(t);
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function gt() {
|
|
712
712
|
return Math.random().toString(36).substr(2, 8);
|
|
713
713
|
}
|
|
714
|
-
function
|
|
715
|
-
var e =
|
|
716
|
-
return
|
|
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;
|
|
717
717
|
}
|
|
718
|
-
function Ke(
|
|
718
|
+
function Ke(a) {
|
|
719
719
|
var e = {};
|
|
720
|
-
if (
|
|
721
|
-
var t =
|
|
722
|
-
t >= 0 && (e.hash =
|
|
723
|
-
var n =
|
|
724
|
-
n >= 0 && (e.search =
|
|
720
|
+
if (a) {
|
|
721
|
+
var t = a.indexOf("#");
|
|
722
|
+
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);
|
|
725
725
|
}
|
|
726
726
|
return e;
|
|
727
727
|
}
|
|
728
|
-
function ye(
|
|
729
|
-
return
|
|
728
|
+
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 !== "");
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function ie(a) {
|
|
732
732
|
var t;
|
|
733
|
-
|
|
733
|
+
Lt(
|
|
734
734
|
(n) => Ze(n == null ? void 0 : n.toString),
|
|
735
|
-
|
|
735
|
+
a,
|
|
736
736
|
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
737
|
-
),
|
|
738
|
-
let e = (t =
|
|
737
|
+
), a = a.filter((n) => n).flatMap(String);
|
|
738
|
+
let e = (t = a.shift()) == null ? void 0 : t.toString();
|
|
739
739
|
if (e) {
|
|
740
|
-
for (const n of
|
|
741
|
-
n.startsWith(".") ? 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;
|
|
742
742
|
e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
|
|
743
743
|
}
|
|
744
744
|
return e ?? "";
|
|
745
745
|
}
|
|
746
|
-
function
|
|
747
|
-
if (
|
|
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("/"))
|
|
748
748
|
return e;
|
|
749
|
-
let t =
|
|
749
|
+
let t = a;
|
|
750
750
|
for (; ; )
|
|
751
751
|
if (e.startsWith("..")) {
|
|
752
752
|
for (let n = t.length; n > 0; --n)
|
|
@@ -758,177 +758,177 @@ function Ue(r, e) {
|
|
|
758
758
|
e = e.replace(/^\.\/?/, "");
|
|
759
759
|
else
|
|
760
760
|
break;
|
|
761
|
-
return
|
|
761
|
+
return ie([t, e]);
|
|
762
762
|
}
|
|
763
|
-
function Je(
|
|
764
|
-
if (!
|
|
765
|
-
|
|
766
|
-
const e =
|
|
767
|
-
const [n,
|
|
768
|
-
return
|
|
763
|
+
function Je(a) {
|
|
764
|
+
if (!a) return {};
|
|
765
|
+
a.startsWith("?") && (a = a.slice(1));
|
|
766
|
+
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)];
|
|
769
769
|
});
|
|
770
770
|
return Object.fromEntries(e);
|
|
771
771
|
}
|
|
772
|
-
function ot(
|
|
773
|
-
var
|
|
774
|
-
const [n,
|
|
775
|
-
e: for (const
|
|
776
|
-
const { fragments: c } =
|
|
777
|
-
if (!(((
|
|
772
|
+
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))
|
|
778
778
|
continue e;
|
|
779
|
-
const
|
|
780
|
-
t: for (let
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
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)
|
|
783
783
|
continue e;
|
|
784
784
|
switch ($.type) {
|
|
785
785
|
case 1:
|
|
786
|
-
if ($.name.toLowerCase() ===
|
|
787
|
-
|
|
786
|
+
if ($.name.toLowerCase() === m.toLowerCase()) {
|
|
787
|
+
p.push($);
|
|
788
788
|
break;
|
|
789
789
|
} else
|
|
790
790
|
continue e;
|
|
791
791
|
case 2:
|
|
792
|
-
|
|
792
|
+
p.push({ ...$, value: m });
|
|
793
793
|
break;
|
|
794
794
|
case 3:
|
|
795
|
-
|
|
795
|
+
p.push({ ...$, value: r.slice(f).join("/") });
|
|
796
796
|
break t;
|
|
797
797
|
case 4:
|
|
798
|
-
if (isNaN(Number(
|
|
798
|
+
if (isNaN(Number(m)))
|
|
799
799
|
continue e;
|
|
800
|
-
|
|
800
|
+
p.push({ ...$, value: Number(m) });
|
|
801
801
|
break;
|
|
802
802
|
default:
|
|
803
803
|
throw new Error(`Unknown fragment type: ${$.type}`);
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
const b = /* @__PURE__ */ Object.create(null);
|
|
807
|
-
for (const
|
|
808
|
-
|
|
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));
|
|
809
809
|
return {
|
|
810
|
-
path: "/" +
|
|
811
|
-
pattern: "/" + c.map((
|
|
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("/"),
|
|
812
812
|
params: b,
|
|
813
|
-
query: Je(
|
|
814
|
-
meta:
|
|
813
|
+
query: Je(o),
|
|
814
|
+
meta: h.meta
|
|
815
815
|
};
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
function
|
|
819
|
-
const e = [], t = [], n = [],
|
|
820
|
-
for (const
|
|
821
|
-
const { fragments:
|
|
822
|
-
|
|
818
|
+
function Wt(a) {
|
|
819
|
+
const e = [], t = [], n = [], o = [];
|
|
820
|
+
for (const s of a) {
|
|
821
|
+
const { fragments: h } = s;
|
|
822
|
+
h.some(
|
|
823
823
|
(c) => c.type === 3
|
|
824
824
|
/* Wildcard */
|
|
825
|
-
) ?
|
|
825
|
+
) ? o.push(s) : h.some(
|
|
826
826
|
(c) => c.type === 4
|
|
827
827
|
/* NumericParam */
|
|
828
|
-
) ? t.push(
|
|
828
|
+
) ? t.push(s) : h.some(
|
|
829
829
|
(c) => c.type === 2
|
|
830
830
|
/* Param */
|
|
831
|
-
) ? n.push(
|
|
831
|
+
) ? n.push(s) : e.push(s);
|
|
832
832
|
}
|
|
833
|
-
const
|
|
834
|
-
return e.sort(
|
|
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];
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
const e = ye(
|
|
836
|
+
function It(a) {
|
|
837
|
+
const e = ye(a), t = [];
|
|
838
838
|
for (let n = 0; n < e.length; n++) {
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
839
|
+
const o = e[n];
|
|
840
|
+
if (o === "*") {
|
|
841
841
|
if (n !== e.length - 1)
|
|
842
|
-
throw new Error(`Wildcard must be at the end of a pattern. Received: ${
|
|
842
|
+
throw new Error(`Wildcard must be at the end of a pattern. Received: ${a}`);
|
|
843
843
|
t.push({
|
|
844
844
|
type: 3,
|
|
845
845
|
name: "*",
|
|
846
846
|
value: null
|
|
847
847
|
});
|
|
848
|
-
} else
|
|
849
|
-
type:
|
|
850
|
-
name:
|
|
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),
|
|
851
851
|
value: null
|
|
852
852
|
}) : t.push({
|
|
853
853
|
type: 1,
|
|
854
|
-
name:
|
|
855
|
-
value:
|
|
854
|
+
name: o,
|
|
855
|
+
value: o
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
858
|
return t;
|
|
859
859
|
}
|
|
860
|
-
var
|
|
861
|
-
class
|
|
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 {
|
|
862
862
|
constructor(e, t) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
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);
|
|
873
873
|
/**
|
|
874
874
|
* The currently matched route pattern, if any.
|
|
875
875
|
*/
|
|
876
876
|
k(this, "$pattern");
|
|
877
|
-
|
|
877
|
+
g(this, ue);
|
|
878
878
|
/**
|
|
879
879
|
* The current URL path.
|
|
880
880
|
*/
|
|
881
881
|
k(this, "$path");
|
|
882
|
-
|
|
882
|
+
g(this, he);
|
|
883
883
|
/**
|
|
884
884
|
* The current named path params.
|
|
885
885
|
*/
|
|
886
886
|
k(this, "$params");
|
|
887
|
-
|
|
887
|
+
g(this, fe);
|
|
888
888
|
/**
|
|
889
889
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
890
890
|
*/
|
|
891
891
|
k(this, "$query");
|
|
892
|
-
|
|
892
|
+
g(this, Se);
|
|
893
893
|
w(this, Le, e), w(this, j, e.createLogger("dolla/router")), w(this, X, t);
|
|
894
|
-
const [n,
|
|
895
|
-
this.$pattern = n, w(this,
|
|
896
|
-
w(this, ee,
|
|
897
|
-
const
|
|
898
|
-
for (const N in
|
|
899
|
-
|
|
900
|
-
const $ = "?" +
|
|
901
|
-
$ !=
|
|
902
|
-
pathname:
|
|
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
903
|
search: $
|
|
904
904
|
});
|
|
905
905
|
}));
|
|
906
|
-
const b = (
|
|
907
|
-
P(this, G, Xe).call(this,
|
|
906
|
+
const b = (f) => {
|
|
907
|
+
P(this, G, Xe).call(this, f);
|
|
908
908
|
};
|
|
909
|
-
|
|
910
|
-
let
|
|
911
|
-
|
|
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
912
|
});
|
|
913
913
|
}), e.onUnmount(() => {
|
|
914
|
-
|
|
914
|
+
i(this, ee) && (i(this, ee).call(this), w(this, ee, void 0));
|
|
915
915
|
});
|
|
916
916
|
}
|
|
917
917
|
setup(e) {
|
|
918
|
-
e.style === "hash" && w(this, S,
|
|
918
|
+
e.style === "hash" && w(this, S, Ft()), w(this, Z, Wt(
|
|
919
919
|
e.routes.flatMap((t) => P(this, G, Ye).call(this, t)).map((t) => ({
|
|
920
920
|
pattern: t.pattern,
|
|
921
921
|
meta: t.meta,
|
|
922
|
-
fragments:
|
|
922
|
+
fragments: It(t.pattern)
|
|
923
923
|
}))
|
|
924
924
|
));
|
|
925
|
-
for (const t of
|
|
925
|
+
for (const t of i(this, Z))
|
|
926
926
|
if (t.meta.redirect) {
|
|
927
927
|
let n;
|
|
928
928
|
if (!Ze(t.meta.redirect)) if (H(t.meta.redirect)) {
|
|
929
|
-
if (n = t.meta.redirect, !ot(
|
|
930
|
-
willMatch(
|
|
931
|
-
return
|
|
929
|
+
if (n = t.meta.redirect, !ot(i(this, Z), n, {
|
|
930
|
+
willMatch(r) {
|
|
931
|
+
return r !== t;
|
|
932
932
|
}
|
|
933
933
|
}))
|
|
934
934
|
throw new Error(
|
|
@@ -947,22 +947,22 @@ class pt {
|
|
|
947
947
|
*/
|
|
948
948
|
go(e, t = {}) {
|
|
949
949
|
let n;
|
|
950
|
-
Array.isArray(e) ? 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);
|
|
951
951
|
}
|
|
952
952
|
/**
|
|
953
953
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
954
954
|
*/
|
|
955
955
|
back(e = 1) {
|
|
956
|
-
|
|
956
|
+
i(this, S).go(-e);
|
|
957
957
|
}
|
|
958
958
|
/**
|
|
959
959
|
* Navigate forward. Pass a number of steps to hit the forward button that many times.
|
|
960
960
|
*/
|
|
961
961
|
forward(e = 1) {
|
|
962
|
-
|
|
962
|
+
i(this, S).go(e);
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
Le = new WeakMap(), j = new WeakMap(), X = new WeakMap(), S = new WeakMap(),
|
|
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(), /**
|
|
966
966
|
* Parses a route definition object into a set of matchable routes.
|
|
967
967
|
*
|
|
968
968
|
* @param route - Route config object.
|
|
@@ -977,44 +977,44 @@ Ye = function(e, t = [], n = []) {
|
|
|
977
977
|
throw new Error("Route cannot have both a 'redirect' and a 'view'.");
|
|
978
978
|
if (!e.view && !e.routes && !e.redirect)
|
|
979
979
|
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
980
|
-
let
|
|
981
|
-
for (const
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
const
|
|
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 = [];
|
|
985
985
|
if (e.redirect) {
|
|
986
|
-
let
|
|
987
|
-
return H(
|
|
988
|
-
pattern: "/" +
|
|
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)]),
|
|
989
989
|
meta: {
|
|
990
|
-
redirect:
|
|
990
|
+
redirect: u
|
|
991
991
|
}
|
|
992
|
-
}),
|
|
992
|
+
}), r;
|
|
993
993
|
}
|
|
994
|
-
let
|
|
994
|
+
let s = ht;
|
|
995
995
|
if (typeof e.view == "function")
|
|
996
|
-
|
|
996
|
+
s = e.view;
|
|
997
997
|
else if (e.view)
|
|
998
998
|
throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
|
|
999
|
-
const
|
|
999
|
+
const h = Ce(s), c = { id: tt(this, Ie)._++, markup: h };
|
|
1000
1000
|
if (e.routes)
|
|
1001
|
-
for (const
|
|
1002
|
-
|
|
1001
|
+
for (const u of e.routes)
|
|
1002
|
+
r.push(...P(this, G, Ye).call(this, u, [...t, e], [...n, c]));
|
|
1003
1003
|
else
|
|
1004
|
-
|
|
1005
|
-
pattern: parent ?
|
|
1004
|
+
r.push({
|
|
1005
|
+
pattern: parent ? ie([...t.map((u) => u.path), e.path]) : e.path,
|
|
1006
1006
|
meta: {
|
|
1007
1007
|
pattern: e.path,
|
|
1008
1008
|
layers: [...n, c],
|
|
1009
1009
|
beforeMatch: e.beforeMatch
|
|
1010
1010
|
}
|
|
1011
1011
|
});
|
|
1012
|
-
return
|
|
1012
|
+
return r;
|
|
1013
1013
|
}, Xe = async function({ location: e }) {
|
|
1014
|
-
e.search !==
|
|
1015
|
-
const t = ot(
|
|
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);
|
|
1016
1016
|
if (!t) {
|
|
1017
|
-
|
|
1017
|
+
i(this, ue).call(this, null), i(this, he).call(this, e.pathname), i(this, fe).call(this, {
|
|
1018
1018
|
wildcard: e.pathname
|
|
1019
1019
|
});
|
|
1020
1020
|
return;
|
|
@@ -1023,10 +1023,10 @@ Ye = function(e, t = [], n = []) {
|
|
|
1023
1023
|
redirect: (n) => {
|
|
1024
1024
|
throw new Error("Redirect not yet implemented.");
|
|
1025
1025
|
}
|
|
1026
|
-
}),
|
|
1026
|
+
}), i(this, j).info(`Matched route: '${t.pattern}' ('${t.path}')`), t.meta.redirect != null)
|
|
1027
1027
|
if (typeof t.meta.redirect == "string") {
|
|
1028
|
-
const n =
|
|
1029
|
-
|
|
1028
|
+
const n = Bt(t.meta.redirect, t.params);
|
|
1029
|
+
i(this, j).info(`Redirecting to: '${n}'`), i(this, S).replace(n);
|
|
1030
1030
|
} else if (typeof t.meta.redirect == "function") {
|
|
1031
1031
|
const n = {
|
|
1032
1032
|
path: t.path,
|
|
@@ -1034,123 +1034,123 @@ Ye = function(e, t = [], n = []) {
|
|
|
1034
1034
|
params: t.params,
|
|
1035
1035
|
query: t.query
|
|
1036
1036
|
};
|
|
1037
|
-
let
|
|
1038
|
-
if (typeof
|
|
1037
|
+
let o = await t.meta.redirect(n);
|
|
1038
|
+
if (typeof o != "string")
|
|
1039
1039
|
throw new Error("Redirect function must return a path to redirect to.");
|
|
1040
|
-
|
|
1040
|
+
o.startsWith("/") || (o = qe(t.path, o)), i(this, j).info(`Redirecting to: '${o}'`), i(this, S).replace(o);
|
|
1041
1041
|
} else
|
|
1042
1042
|
throw new TypeError("Redirect must either be a path string or a function.");
|
|
1043
|
-
else if (
|
|
1044
|
-
|
|
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
1045
|
const n = t.meta.layers;
|
|
1046
|
-
for (let
|
|
1047
|
-
const
|
|
1048
|
-
if ((
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
},
|
|
1053
|
-
|
|
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 });
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
1057
|
};
|
|
1058
|
-
const
|
|
1059
|
-
function
|
|
1060
|
-
function n(
|
|
1061
|
-
return !
|
|
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;
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1064
|
-
if (
|
|
1063
|
+
function o(r) {
|
|
1064
|
+
if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
|
|
1065
1065
|
return;
|
|
1066
|
-
const
|
|
1067
|
-
|
|
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)));
|
|
1068
1068
|
}
|
|
1069
|
-
return
|
|
1070
|
-
|
|
1069
|
+
return a.addEventListener("click", o), function() {
|
|
1070
|
+
a.removeEventListener("click", o);
|
|
1071
1071
|
};
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function Bt(a, e) {
|
|
1074
1074
|
for (const t in e) {
|
|
1075
1075
|
const n = e[t].toString();
|
|
1076
|
-
|
|
1076
|
+
a = a.replace(`{${t}}`, n).replace(`{#${t}}`, n);
|
|
1077
1077
|
}
|
|
1078
|
-
return
|
|
1078
|
+
return a;
|
|
1079
1079
|
}
|
|
1080
|
-
const
|
|
1080
|
+
const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1081
1081
|
__proto__: null,
|
|
1082
|
-
Router:
|
|
1083
|
-
RoutingStyle:
|
|
1084
|
-
catchLinks:
|
|
1082
|
+
Router: mt,
|
|
1083
|
+
RoutingStyle: pt,
|
|
1084
|
+
catchLinks: yt
|
|
1085
1085
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1086
|
-
var I, Pe, te, ne,
|
|
1087
|
-
class
|
|
1086
|
+
var I, Pe, te, ne, Me, Re, Oe, xe, R, z;
|
|
1087
|
+
class Qt {
|
|
1088
1088
|
constructor() {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1089
|
+
g(this, I, !1);
|
|
1090
|
+
g(this, Pe, "production");
|
|
1091
|
+
g(this, te);
|
|
1092
|
+
g(this, ne);
|
|
1093
1093
|
k(this, "http");
|
|
1094
1094
|
k(this, "language");
|
|
1095
1095
|
k(this, "render");
|
|
1096
1096
|
k(this, "router");
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1097
|
+
g(this, Me, []);
|
|
1098
|
+
g(this, Re, []);
|
|
1099
|
+
g(this, Oe, []);
|
|
1100
|
+
g(this, xe, []);
|
|
1101
|
+
g(this, R, {
|
|
1102
1102
|
info: "development",
|
|
1103
1103
|
log: "development",
|
|
1104
1104
|
warn: "development",
|
|
1105
1105
|
error: !0
|
|
1106
1106
|
});
|
|
1107
|
-
|
|
1107
|
+
g(this, z, nt("*,-dolla/*"));
|
|
1108
1108
|
k(this, "createSignal", Q);
|
|
1109
|
-
k(this, "createSettableSignal",
|
|
1110
|
-
k(this, "toSettableSignal",
|
|
1111
|
-
k(this, "signalify",
|
|
1112
|
-
k(this, "designalify",
|
|
1113
|
-
k(this, "derive",
|
|
1114
|
-
k(this, "watch",
|
|
1115
|
-
k(this, "createRef",
|
|
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);
|
|
1114
|
+
k(this, "watch", ut);
|
|
1115
|
+
k(this, "createRef", Ot);
|
|
1116
1116
|
k(this, "isRef", xt);
|
|
1117
1117
|
const e = this;
|
|
1118
|
-
this.http = new
|
|
1118
|
+
this.http = new Tt(), this.language = new Ct(this), this.render = new Dt(this), this.router = new mt(this, {
|
|
1119
1119
|
get rootElement() {
|
|
1120
|
-
return
|
|
1120
|
+
return i(e, te);
|
|
1121
1121
|
},
|
|
1122
1122
|
get rootView() {
|
|
1123
|
-
return
|
|
1123
|
+
return i(e, ne);
|
|
1124
1124
|
}
|
|
1125
1125
|
});
|
|
1126
1126
|
}
|
|
1127
1127
|
get isMounted() {
|
|
1128
|
-
return
|
|
1128
|
+
return i(this, I);
|
|
1129
1129
|
}
|
|
1130
1130
|
get env() {
|
|
1131
|
-
return
|
|
1131
|
+
return i(this, Pe);
|
|
1132
1132
|
}
|
|
1133
1133
|
set env(e) {
|
|
1134
1134
|
w(this, Pe, e);
|
|
1135
1135
|
}
|
|
1136
1136
|
async mount(e, t) {
|
|
1137
|
-
if (
|
|
1137
|
+
if (i(this, I))
|
|
1138
1138
|
throw new Error("Dolla is already mounted.");
|
|
1139
1139
|
if (H(e)) {
|
|
1140
|
-
const
|
|
1141
|
-
rt(HTMLElement,
|
|
1140
|
+
const o = document.querySelector(e);
|
|
1141
|
+
rt(HTMLElement, o, `Selector '${e}' did not match any element.`), w(this, te, o);
|
|
1142
1142
|
} else
|
|
1143
1143
|
rt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), w(this, te, e);
|
|
1144
1144
|
let n;
|
|
1145
|
-
t ? n =
|
|
1146
|
-
for (const
|
|
1147
|
-
|
|
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();
|
|
1148
1148
|
}
|
|
1149
1149
|
async unmount() {
|
|
1150
1150
|
var e;
|
|
1151
|
-
if (
|
|
1152
|
-
await Promise.all(
|
|
1153
|
-
for (const t of
|
|
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))
|
|
1154
1154
|
t();
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
@@ -1159,51 +1159,51 @@ class Gt {
|
|
|
1159
1159
|
* it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
|
|
1160
1160
|
*/
|
|
1161
1161
|
beforeMount(e) {
|
|
1162
|
-
|
|
1162
|
+
i(this, Me).push(e);
|
|
1163
1163
|
}
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Registers a `callback` to run after the app is mounted.
|
|
1166
1166
|
*/
|
|
1167
1167
|
onMount(e) {
|
|
1168
|
-
|
|
1168
|
+
i(this, Re).push(e);
|
|
1169
1169
|
}
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
|
|
1172
1172
|
* it will be awaited before unmounting finishes. Use this to perform cleanup.
|
|
1173
1173
|
*/
|
|
1174
1174
|
beforeUnmount(e) {
|
|
1175
|
-
|
|
1175
|
+
i(this, Oe).push(e);
|
|
1176
1176
|
}
|
|
1177
1177
|
/**
|
|
1178
1178
|
* Registers a `callback` to run after the app is unmounted.
|
|
1179
1179
|
*/
|
|
1180
1180
|
onUnmount(e) {
|
|
1181
|
-
|
|
1181
|
+
i(this, xe).push(e);
|
|
1182
1182
|
}
|
|
1183
1183
|
/**
|
|
1184
|
-
* Update log
|
|
1184
|
+
* Update log type toggles. Values that are not passed will remain unchanged.
|
|
1185
1185
|
*/
|
|
1186
1186
|
setLoggles(e) {
|
|
1187
1187
|
for (const t in e) {
|
|
1188
1188
|
const n = e[t];
|
|
1189
|
-
n && (
|
|
1189
|
+
n && (i(this, R)[t] = n);
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
1192
|
setLogFilter(e) {
|
|
1193
1193
|
w(this, z, nt(e));
|
|
1194
1194
|
}
|
|
1195
1195
|
createLogger(e, t) {
|
|
1196
|
-
const n =
|
|
1196
|
+
const n = Be(e), o = (t == null ? void 0 : t.console) ?? Nt(), r = this;
|
|
1197
1197
|
return {
|
|
1198
1198
|
get info() {
|
|
1199
|
-
var
|
|
1200
|
-
const
|
|
1201
|
-
if (
|
|
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
1202
|
return Ne;
|
|
1203
1203
|
{
|
|
1204
|
-
let c = `%c${
|
|
1205
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1206
|
-
|
|
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
1207
|
c,
|
|
1208
1208
|
`color:${Te(c)};font-weight:bold`,
|
|
1209
1209
|
"color:#777",
|
|
@@ -1213,14 +1213,14 @@ class Gt {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
},
|
|
1215
1215
|
get log() {
|
|
1216
|
-
var
|
|
1217
|
-
const
|
|
1218
|
-
if (
|
|
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
1219
|
return Ne;
|
|
1220
1220
|
{
|
|
1221
|
-
let c = `%c${
|
|
1222
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1223
|
-
|
|
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
1224
|
c,
|
|
1225
1225
|
`color:${Te(c)};font-weight:bold`,
|
|
1226
1226
|
"color:#777",
|
|
@@ -1230,14 +1230,14 @@ class Gt {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
},
|
|
1232
1232
|
get warn() {
|
|
1233
|
-
var
|
|
1234
|
-
const
|
|
1235
|
-
if (
|
|
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
1236
|
return Ne;
|
|
1237
1237
|
{
|
|
1238
|
-
let c = `%c${
|
|
1239
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1240
|
-
|
|
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
1241
|
c,
|
|
1242
1242
|
`color:${Te(c)};font-weight:bold`,
|
|
1243
1243
|
"color:#777",
|
|
@@ -1247,14 +1247,14 @@ class Gt {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
},
|
|
1249
1249
|
get error() {
|
|
1250
|
-
var
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
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
1253
|
return Ne;
|
|
1254
1254
|
{
|
|
1255
|
-
let c = `%c${
|
|
1256
|
-
return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c",
|
|
1257
|
-
|
|
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
1258
|
c,
|
|
1259
1259
|
`color:${Te(c)};font-weight:bold`,
|
|
1260
1260
|
"color:#777",
|
|
@@ -1263,46 +1263,69 @@ class Gt {
|
|
|
1263
1263
|
);
|
|
1264
1264
|
}
|
|
1265
1265
|
},
|
|
1266
|
-
crash(
|
|
1266
|
+
crash(s) {
|
|
1267
1267
|
}
|
|
1268
1268
|
};
|
|
1269
1269
|
}
|
|
1270
1270
|
constructView(e, t, n = []) {
|
|
1271
|
-
return at({
|
|
1271
|
+
return at({ root: this }, e, t, n);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
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);
|
|
1272
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];
|
|
1273
1296
|
}
|
|
1274
|
-
|
|
1275
|
-
const L = new Gt(), Yt = L.beforeMount.bind(L), Xt = L.onMount.bind(L), Zt = L.beforeUnmount.bind(L), en = L.onUnmount.bind(L), tn = L.mount.bind(L), nn = L.unmount.bind(L), rn = L.http, an = L.render, sn = L.createLogger.bind(L), on = L.setLogFilter.bind(L), cn = L.setLoggles.bind(L), ln = L.language.t.bind(L.language), hn = L.constructView.bind(L);
|
|
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);
|
|
1276
1298
|
export {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
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,
|
|
1285
1308
|
Q as createSignal,
|
|
1286
|
-
|
|
1309
|
+
bn as createSignalSetter,
|
|
1287
1310
|
L as default,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1311
|
+
Qe as derive,
|
|
1312
|
+
Rt as designalify,
|
|
1313
|
+
dn as html,
|
|
1314
|
+
on as http,
|
|
1291
1315
|
xt as isRef,
|
|
1292
|
-
|
|
1293
|
-
tn as
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
lt as watch
|
|
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
|
|
1307
1330
|
};
|
|
1308
1331
|
//# sourceMappingURL=index.js.map
|