@storyblok/astro 4.1.0-alpha.1 → 4.1.0-alpha.3
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/README.md +61 -1
- package/dist/storyblok-astro.js +19 -19
- package/dist/storyblok-astro.mjs +582 -568
- package/dist/types/index.d.ts +2 -7
- package/dist/types/utils/generateFinalBridgeObject.d.ts +3 -8
- package/dist/types/utils/parseAstCode.d.ts +7 -1
- package/dist/types/vite-plugins/vite-plugin-storyblok-bridge.d.ts +10 -0
- package/live-preview/handleStoryblokMessage.ts +3 -2
- package/package.json +2 -1
- package/utils/generateFinalBridgeObject.ts +11 -20
- package/utils/parseAstCode.ts +51 -24
package/dist/storyblok-astro.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function Or(o, r, e) {
|
|
2
|
+
const i = "virtual:storyblok-init", s = "\0" + i;
|
|
3
3
|
return {
|
|
4
4
|
name: "vite-plugin-storyblok-init",
|
|
5
5
|
async resolveId(l) {
|
|
6
|
-
if (l ===
|
|
6
|
+
if (l === i)
|
|
7
7
|
return s;
|
|
8
8
|
},
|
|
9
9
|
async load(l) {
|
|
@@ -12,35 +12,35 @@ function Sr(o, e, r) {
|
|
|
12
12
|
import { storyblokInit, apiPlugin } from "@storyblok/js";
|
|
13
13
|
const { storyblokApi } = storyblokInit({
|
|
14
14
|
accessToken: "${o}",
|
|
15
|
-
use: ${
|
|
16
|
-
apiOptions: ${JSON.stringify(
|
|
15
|
+
use: ${r ? "[]" : "[apiPlugin]"},
|
|
16
|
+
apiOptions: ${JSON.stringify(e)},
|
|
17
17
|
});
|
|
18
18
|
export const storyblokApiInstance = storyblokApi;
|
|
19
19
|
`;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const Cr = /[\p{Lu}]/u, jr = /[\p{Ll}]/u, zt = /^[\p{Lu}](?![\p{Lu}])/gu, Gt = /([\p{Alpha}\p{N}_]|$)/u, ft = /[_.\- ]+/, $r = new RegExp("^" + ft.source), Lt = new RegExp(ft.source + Gt.source, "gu"), Dt = new RegExp("\\d+" + Gt.source, "gu"), xr = (o, r, e, i) => {
|
|
24
24
|
let s = !1, l = !1, u = !1, f = !1;
|
|
25
25
|
for (let g = 0; g < o.length; g++) {
|
|
26
|
-
const
|
|
27
|
-
f = g > 2 ? o[g - 3] === "-" : !0, s &&
|
|
26
|
+
const b = o[g];
|
|
27
|
+
f = g > 2 ? o[g - 3] === "-" : !0, s && Cr.test(b) ? (o = o.slice(0, g) + "-" + o.slice(g), s = !1, u = l, l = !0, g++) : l && u && jr.test(b) && (!f || i) ? (o = o.slice(0, g - 1) + "-" + o.slice(g - 1), u = l, l = !1, s = !0) : (s = r(b) === b && e(b) !== b, u = l, l = e(b) === b && r(b) !== b);
|
|
28
28
|
}
|
|
29
29
|
return o;
|
|
30
|
-
},
|
|
31
|
-
function
|
|
30
|
+
}, Er = (o, r) => (zt.lastIndex = 0, o.replaceAll(zt, (e) => r(e))), Rr = (o, r) => (Lt.lastIndex = 0, Dt.lastIndex = 0, o.replaceAll(Dt, (e, i, s) => ["_", "-"].includes(o.charAt(s + e.length)) ? e : r(e)).replaceAll(Lt, (e, i) => r(i)));
|
|
31
|
+
function Ut(o, r) {
|
|
32
32
|
if (!(typeof o == "string" || Array.isArray(o)))
|
|
33
33
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
34
|
-
if (
|
|
34
|
+
if (r = {
|
|
35
35
|
pascalCase: !1,
|
|
36
36
|
preserveConsecutiveUppercase: !1,
|
|
37
|
-
...
|
|
37
|
+
...r
|
|
38
38
|
}, Array.isArray(o) ? o = o.map((l) => l.trim()).filter((l) => l.length).join("-") : o = o.trim(), o.length === 0)
|
|
39
39
|
return "";
|
|
40
|
-
const
|
|
41
|
-
return o.length === 1 ? ft.test(o) ? "" :
|
|
40
|
+
const e = r.locale === !1 ? (l) => l.toLowerCase() : (l) => l.toLocaleLowerCase(r.locale), i = r.locale === !1 ? (l) => l.toUpperCase() : (l) => l.toLocaleUpperCase(r.locale);
|
|
41
|
+
return o.length === 1 ? ft.test(o) ? "" : r.pascalCase ? i(o) : e(o) : (o !== e(o) && (o = xr(o, e, i, r.preserveConsecutiveUppercase)), o = o.replace($r, ""), o = r.preserveConsecutiveUppercase ? Er(o, e) : e(o), r.pascalCase && (o = i(o.charAt(0)) + o.slice(1)), Rr(o, i));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Pr(o, r, e, i) {
|
|
44
44
|
const s = "virtual:storyblok-components", l = "\0" + s;
|
|
45
45
|
return {
|
|
46
46
|
name: "vite-plugin-storyblok-components",
|
|
@@ -51,28 +51,28 @@ function Rr(o, e, r, a) {
|
|
|
51
51
|
async load(u) {
|
|
52
52
|
if (u === l) {
|
|
53
53
|
const f = [], g = [];
|
|
54
|
-
for await (const [_,
|
|
55
|
-
const
|
|
56
|
-
"/" + o + "/" +
|
|
54
|
+
for await (const [_, k] of Object.entries(r)) {
|
|
55
|
+
const I = await this.resolve(
|
|
56
|
+
"/" + o + "/" + k + ".astro"
|
|
57
57
|
);
|
|
58
|
-
if (
|
|
59
|
-
f.push(`import ${
|
|
60
|
-
else if (
|
|
58
|
+
if (I)
|
|
59
|
+
f.push(`import ${Ut(_)} from "${I.id}"`);
|
|
60
|
+
else if (e)
|
|
61
61
|
g.push(_);
|
|
62
62
|
else
|
|
63
63
|
throw new Error(
|
|
64
|
-
`Component could not be found for blok "${_}"! Does "${"/" + o + "/" +
|
|
64
|
+
`Component could not be found for blok "${_}"! Does "${"/" + o + "/" + k}.astro" exist?`
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
69
|
-
if (
|
|
67
|
+
let b = "";
|
|
68
|
+
if (e)
|
|
69
|
+
if (b = ",FallbackComponent", i) {
|
|
70
70
|
const _ = await this.resolve(
|
|
71
|
-
"/" + o + "/" +
|
|
71
|
+
"/" + o + "/" + i + ".astro"
|
|
72
72
|
);
|
|
73
73
|
if (!_)
|
|
74
74
|
throw new Error(
|
|
75
|
-
`Custom fallback component could not be found. Does "${"/" + o + "/" +
|
|
75
|
+
`Custom fallback component could not be found. Does "${"/" + o + "/" + i}.astro" exist?`
|
|
76
76
|
);
|
|
77
77
|
f.push(
|
|
78
78
|
`import FallbackComponent from "${_.id}"`
|
|
@@ -81,10 +81,10 @@ function Rr(o, e, r, a) {
|
|
|
81
81
|
f.push(
|
|
82
82
|
"import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'"
|
|
83
83
|
);
|
|
84
|
-
if (Object.values(
|
|
85
|
-
return `${f.join(";")};export default {${Object.keys(
|
|
86
|
-
if (
|
|
87
|
-
return `${f[0]}; export default {${
|
|
84
|
+
if (Object.values(r).length)
|
|
85
|
+
return `${f.join(";")};export default {${Object.keys(r).filter((_) => !g.includes(_)).map((_) => Ut(_)).join(",")}${b}}`;
|
|
86
|
+
if (e)
|
|
87
|
+
return `${f[0]}; export default {${b.replace(",", "")}}`;
|
|
88
88
|
throw new Error(
|
|
89
89
|
`Currently, no Storyblok components are registered in astro.config.mjs.
|
|
90
90
|
Please register your components or enable the fallback component.
|
|
@@ -94,22 +94,22 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
97
|
+
function Mr(o) {
|
|
98
|
+
const r = "virtual:storyblok-options", e = "\0" + r;
|
|
99
99
|
return {
|
|
100
100
|
name: "vite-plugin-storyblok-options",
|
|
101
|
-
async resolveId(
|
|
102
|
-
if (
|
|
103
|
-
return
|
|
101
|
+
async resolveId(i) {
|
|
102
|
+
if (i === r)
|
|
103
|
+
return e;
|
|
104
104
|
},
|
|
105
|
-
async load(
|
|
106
|
-
if (
|
|
105
|
+
async load(i) {
|
|
106
|
+
if (i === e)
|
|
107
107
|
return `export default ${JSON.stringify(o)}`;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
let Bt = !1;
|
|
112
|
-
const Ft = [],
|
|
112
|
+
const Ft = [], Nr = (o) => new Promise((r, e) => {
|
|
113
113
|
if (typeof window > "u" || (window.storyblokRegisterEvent = (s) => {
|
|
114
114
|
if (window.location === window.parent.location) {
|
|
115
115
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
@@ -118,30 +118,30 @@ const Ft = [], Mr = (o) => new Promise((e, r) => {
|
|
|
118
118
|
Bt ? s() : Ft.push(s);
|
|
119
119
|
}, document.getElementById("storyblok-javascript-bridge")))
|
|
120
120
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
Ft.forEach((l) => l()), Bt = !0,
|
|
124
|
-
}, document.getElementsByTagName("head")[0].appendChild(
|
|
121
|
+
const i = document.createElement("script");
|
|
122
|
+
i.async = !0, i.src = o, i.id = "storyblok-javascript-bridge", i.onerror = (s) => e(s), i.onload = (s) => {
|
|
123
|
+
Ft.forEach((l) => l()), Bt = !0, r(s);
|
|
124
|
+
}, document.getElementsByTagName("head")[0].appendChild(i);
|
|
125
125
|
});
|
|
126
|
-
var
|
|
127
|
-
class
|
|
126
|
+
var zr = Object.defineProperty, Lr = (o, r, e) => r in o ? zr(o, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[r] = e, S = (o, r, e) => (Lr(o, typeof r != "symbol" ? r + "" : r, e), e);
|
|
127
|
+
class Dr {
|
|
128
128
|
constructor() {
|
|
129
|
-
S(this, "isCDNUrl", (
|
|
130
|
-
...
|
|
131
|
-
per_page:
|
|
132
|
-
page:
|
|
133
|
-
})), S(this, "delay", (
|
|
134
|
-
const
|
|
135
|
-
return this.arrayFrom(
|
|
136
|
-
}), S(this, "asyncMap", async (
|
|
137
|
-
const
|
|
129
|
+
S(this, "isCDNUrl", (r = "") => r.indexOf("/cdn/") > -1), S(this, "getOptionsPage", (r, e = 25, i = 1) => ({
|
|
130
|
+
...r,
|
|
131
|
+
per_page: e,
|
|
132
|
+
page: i
|
|
133
|
+
})), S(this, "delay", (r) => new Promise((e) => setTimeout(e, r))), S(this, "arrayFrom", (r = 0, e) => [...Array(r)].map(e)), S(this, "range", (r = 0, e = r) => {
|
|
134
|
+
const i = Math.abs(e - r) || 0, s = r < e ? 1 : -1;
|
|
135
|
+
return this.arrayFrom(i, (l, u) => u * s + r);
|
|
136
|
+
}), S(this, "asyncMap", async (r, e) => Promise.all(r.map(e))), S(this, "flatMap", (r = [], e) => r.map(e).reduce((i, s) => [...i, ...s], [])), S(this, "escapeHTML", function(r) {
|
|
137
|
+
const e = {
|
|
138
138
|
"&": "&",
|
|
139
139
|
"<": "<",
|
|
140
140
|
">": ">",
|
|
141
141
|
'"': """,
|
|
142
142
|
"'": "'"
|
|
143
|
-
},
|
|
144
|
-
return
|
|
143
|
+
}, i = /[&<>"']/g, s = RegExp(i.source);
|
|
144
|
+
return r && s.test(r) ? r.replace(i, (l) => e[l]) : r;
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
@@ -151,18 +151,18 @@ class zr {
|
|
|
151
151
|
* @param {Boolean} isArray
|
|
152
152
|
* @return {String} Stringified object
|
|
153
153
|
*/
|
|
154
|
-
stringify(
|
|
154
|
+
stringify(r, e, i) {
|
|
155
155
|
const s = [];
|
|
156
|
-
for (const l in
|
|
157
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
156
|
+
for (const l in r) {
|
|
157
|
+
if (!Object.prototype.hasOwnProperty.call(r, l))
|
|
158
158
|
continue;
|
|
159
|
-
const u =
|
|
159
|
+
const u = r[l], f = i ? "" : encodeURIComponent(l);
|
|
160
160
|
let g;
|
|
161
161
|
typeof u == "object" ? g = this.stringify(
|
|
162
162
|
u,
|
|
163
|
-
|
|
163
|
+
e ? e + encodeURIComponent("[" + f + "]") : f,
|
|
164
164
|
Array.isArray(u)
|
|
165
|
-
) : g = (
|
|
165
|
+
) : g = (e ? e + encodeURIComponent("[" + f + "]") : f) + "=" + encodeURIComponent(u), s.push(g);
|
|
166
166
|
}
|
|
167
167
|
return s.join("&");
|
|
168
168
|
}
|
|
@@ -171,11 +171,11 @@ class zr {
|
|
|
171
171
|
* @param {String} regionCode region code, could be eu, us, cn, ap or ca
|
|
172
172
|
* @return {String} The base URL of the region
|
|
173
173
|
*/
|
|
174
|
-
getRegionURL(
|
|
175
|
-
const
|
|
176
|
-
switch (
|
|
174
|
+
getRegionURL(r) {
|
|
175
|
+
const e = "api.storyblok.com", i = "api-us.storyblok.com", s = "app.storyblokchina.cn", l = "api-ap.storyblok.com", u = "api-ca.storyblok.com";
|
|
176
|
+
switch (r) {
|
|
177
177
|
case "us":
|
|
178
|
-
return
|
|
178
|
+
return i;
|
|
179
179
|
case "cn":
|
|
180
180
|
return s;
|
|
181
181
|
case "ap":
|
|
@@ -183,24 +183,24 @@ class zr {
|
|
|
183
183
|
case "ca":
|
|
184
184
|
return u;
|
|
185
185
|
default:
|
|
186
|
-
return
|
|
186
|
+
return e;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
const Ur = function(o,
|
|
191
|
-
const
|
|
192
|
-
for (const
|
|
193
|
-
const s = o[
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
return
|
|
197
|
-
},
|
|
190
|
+
const Ur = function(o, r) {
|
|
191
|
+
const e = {};
|
|
192
|
+
for (const i in o) {
|
|
193
|
+
const s = o[i];
|
|
194
|
+
r.indexOf(i) > -1 && s !== null && (e[i] = s);
|
|
195
|
+
}
|
|
196
|
+
return e;
|
|
197
|
+
}, Br = (o) => o === "email", Fr = () => ({
|
|
198
198
|
singleTag: "hr"
|
|
199
|
-
}), Fr = () => ({
|
|
200
|
-
tag: "blockquote"
|
|
201
199
|
}), Hr = () => ({
|
|
200
|
+
tag: "blockquote"
|
|
201
|
+
}), qr = () => ({
|
|
202
202
|
tag: "ul"
|
|
203
|
-
}),
|
|
203
|
+
}), Gr = (o) => ({
|
|
204
204
|
tag: [
|
|
205
205
|
"pre",
|
|
206
206
|
{
|
|
@@ -208,20 +208,20 @@ const Ur = function(o, e) {
|
|
|
208
208
|
attrs: o.attrs
|
|
209
209
|
}
|
|
210
210
|
]
|
|
211
|
-
}),
|
|
211
|
+
}), Jr = () => ({
|
|
212
212
|
singleTag: "br"
|
|
213
|
-
}), Jr = (o) => ({
|
|
214
|
-
tag: `h${o.attrs.level}`
|
|
215
213
|
}), Kr = (o) => ({
|
|
214
|
+
tag: `h${o.attrs.level}`
|
|
215
|
+
}), Wr = (o) => ({
|
|
216
216
|
singleTag: [
|
|
217
217
|
{
|
|
218
218
|
tag: "img",
|
|
219
219
|
attrs: Ur(o.attrs, ["src", "alt", "title"])
|
|
220
220
|
}
|
|
221
221
|
]
|
|
222
|
-
}), Wr = () => ({
|
|
223
|
-
tag: "li"
|
|
224
222
|
}), Yr = () => ({
|
|
223
|
+
tag: "li"
|
|
224
|
+
}), Vr = () => ({
|
|
225
225
|
tag: "ol"
|
|
226
226
|
}), Xr = () => ({
|
|
227
227
|
tag: "p"
|
|
@@ -238,56 +238,56 @@ const Ur = function(o, e) {
|
|
|
238
238
|
]
|
|
239
239
|
}), Qr = () => ({
|
|
240
240
|
tag: "b"
|
|
241
|
-
}), Vr = () => ({
|
|
242
|
-
tag: "s"
|
|
243
241
|
}), tn = () => ({
|
|
244
|
-
tag: "
|
|
242
|
+
tag: "s"
|
|
245
243
|
}), en = () => ({
|
|
246
|
-
tag: "
|
|
244
|
+
tag: "u"
|
|
247
245
|
}), rn = () => ({
|
|
248
|
-
tag: "
|
|
246
|
+
tag: "strong"
|
|
249
247
|
}), nn = () => ({
|
|
248
|
+
tag: "code"
|
|
249
|
+
}), on = () => ({
|
|
250
250
|
tag: "i"
|
|
251
|
-
}),
|
|
251
|
+
}), an = (o) => {
|
|
252
252
|
if (!o.attrs)
|
|
253
253
|
return {
|
|
254
254
|
tag: ""
|
|
255
255
|
};
|
|
256
|
-
const
|
|
257
|
-
if (delete
|
|
258
|
-
for (const s in
|
|
259
|
-
|
|
260
|
-
delete
|
|
256
|
+
const r = new Dr().escapeHTML, e = { ...o.attrs }, { linktype: i = "url" } = o.attrs;
|
|
257
|
+
if (delete e.linktype, e.href && (e.href = r(o.attrs.href || "")), Br(i) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), e.custom) {
|
|
258
|
+
for (const s in e.custom)
|
|
259
|
+
e[s] = e.custom[s];
|
|
260
|
+
delete e.custom;
|
|
261
261
|
}
|
|
262
262
|
return {
|
|
263
263
|
tag: [
|
|
264
264
|
{
|
|
265
265
|
tag: "a",
|
|
266
|
-
attrs:
|
|
266
|
+
attrs: e
|
|
267
267
|
}
|
|
268
268
|
]
|
|
269
269
|
};
|
|
270
|
-
},
|
|
270
|
+
}, sn = (o) => ({
|
|
271
271
|
tag: [
|
|
272
272
|
{
|
|
273
273
|
tag: "span",
|
|
274
274
|
attrs: o.attrs
|
|
275
275
|
}
|
|
276
276
|
]
|
|
277
|
-
}), sn = () => ({
|
|
278
|
-
tag: "sub"
|
|
279
277
|
}), ln = () => ({
|
|
278
|
+
tag: "sub"
|
|
279
|
+
}), cn = () => ({
|
|
280
280
|
tag: "sup"
|
|
281
|
-
}),
|
|
281
|
+
}), un = (o) => ({
|
|
282
282
|
tag: [
|
|
283
283
|
{
|
|
284
284
|
tag: "span",
|
|
285
285
|
attrs: o.attrs
|
|
286
286
|
}
|
|
287
287
|
]
|
|
288
|
-
}),
|
|
289
|
-
var
|
|
290
|
-
return (
|
|
288
|
+
}), fn = (o) => {
|
|
289
|
+
var r;
|
|
290
|
+
return (r = o.attrs) != null && r.color ? {
|
|
291
291
|
tag: [
|
|
292
292
|
{
|
|
293
293
|
tag: "span",
|
|
@@ -299,9 +299,9 @@ const Ur = function(o, e) {
|
|
|
299
299
|
} : {
|
|
300
300
|
tag: ""
|
|
301
301
|
};
|
|
302
|
-
},
|
|
303
|
-
var
|
|
304
|
-
return (
|
|
302
|
+
}, pn = (o) => {
|
|
303
|
+
var r;
|
|
304
|
+
return (r = o.attrs) != null && r.color ? {
|
|
305
305
|
tag: [
|
|
306
306
|
{
|
|
307
307
|
tag: "span",
|
|
@@ -315,59 +315,59 @@ const Ur = function(o, e) {
|
|
|
315
315
|
};
|
|
316
316
|
}, dn = {
|
|
317
317
|
nodes: {
|
|
318
|
-
horizontal_rule:
|
|
319
|
-
blockquote:
|
|
320
|
-
bullet_list:
|
|
321
|
-
code_block:
|
|
322
|
-
hard_break:
|
|
323
|
-
heading:
|
|
324
|
-
image:
|
|
325
|
-
list_item:
|
|
326
|
-
ordered_list:
|
|
318
|
+
horizontal_rule: Fr,
|
|
319
|
+
blockquote: Hr,
|
|
320
|
+
bullet_list: qr,
|
|
321
|
+
code_block: Gr,
|
|
322
|
+
hard_break: Jr,
|
|
323
|
+
heading: Kr,
|
|
324
|
+
image: Wr,
|
|
325
|
+
list_item: Yr,
|
|
326
|
+
ordered_list: Vr,
|
|
327
327
|
paragraph: Xr,
|
|
328
328
|
emoji: Zr
|
|
329
329
|
},
|
|
330
330
|
marks: {
|
|
331
331
|
bold: Qr,
|
|
332
|
-
strike:
|
|
333
|
-
underline:
|
|
334
|
-
strong:
|
|
335
|
-
code:
|
|
336
|
-
italic:
|
|
337
|
-
link:
|
|
338
|
-
styled:
|
|
339
|
-
subscript:
|
|
340
|
-
superscript:
|
|
341
|
-
anchor:
|
|
342
|
-
highlight:
|
|
343
|
-
textStyle:
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
const
|
|
332
|
+
strike: tn,
|
|
333
|
+
underline: en,
|
|
334
|
+
strong: rn,
|
|
335
|
+
code: nn,
|
|
336
|
+
italic: on,
|
|
337
|
+
link: an,
|
|
338
|
+
styled: sn,
|
|
339
|
+
subscript: ln,
|
|
340
|
+
superscript: cn,
|
|
341
|
+
anchor: un,
|
|
342
|
+
highlight: fn,
|
|
343
|
+
textStyle: pn
|
|
344
|
+
}
|
|
345
|
+
}, gn = function(o) {
|
|
346
|
+
const r = {
|
|
347
347
|
"&": "&",
|
|
348
348
|
"<": "<",
|
|
349
349
|
">": ">",
|
|
350
350
|
'"': """,
|
|
351
351
|
"'": "'"
|
|
352
|
-
},
|
|
353
|
-
return o &&
|
|
352
|
+
}, e = /[&<>"']/g, i = RegExp(e.source);
|
|
353
|
+
return o && i.test(o) ? o.replace(e, (s) => r[s]) : o;
|
|
354
354
|
};
|
|
355
|
-
class
|
|
356
|
-
constructor(
|
|
357
|
-
S(this, "marks"), S(this, "nodes"),
|
|
358
|
-
}
|
|
359
|
-
addNode(
|
|
360
|
-
this.nodes[
|
|
361
|
-
}
|
|
362
|
-
addMark(
|
|
363
|
-
this.marks[
|
|
364
|
-
}
|
|
365
|
-
render(
|
|
366
|
-
if (
|
|
367
|
-
let
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
}),
|
|
355
|
+
class hn {
|
|
356
|
+
constructor(r) {
|
|
357
|
+
S(this, "marks"), S(this, "nodes"), r || (r = dn), this.marks = r.marks || [], this.nodes = r.nodes || [];
|
|
358
|
+
}
|
|
359
|
+
addNode(r, e) {
|
|
360
|
+
this.nodes[r] = e;
|
|
361
|
+
}
|
|
362
|
+
addMark(r, e) {
|
|
363
|
+
this.marks[r] = e;
|
|
364
|
+
}
|
|
365
|
+
render(r, e = { optimizeImages: !1 }) {
|
|
366
|
+
if (r && r.content && Array.isArray(r.content)) {
|
|
367
|
+
let i = "";
|
|
368
|
+
return r.content.forEach((s) => {
|
|
369
|
+
i += this.renderNode(s);
|
|
370
|
+
}), e.optimizeImages ? this.optimizeImages(i, e.optimizeImages) : i;
|
|
371
371
|
}
|
|
372
372
|
return console.warn(
|
|
373
373
|
`The render method must receive an Object with a "content" field.
|
|
@@ -396,185 +396,187 @@ class gn {
|
|
|
396
396
|
}`
|
|
397
397
|
), "";
|
|
398
398
|
}
|
|
399
|
-
optimizeImages(
|
|
400
|
-
let
|
|
401
|
-
typeof
|
|
402
|
-
const f =
|
|
403
|
-
return
|
|
399
|
+
optimizeImages(r, e) {
|
|
400
|
+
let i = 0, s = 0, l = "", u = "";
|
|
401
|
+
typeof e != "boolean" && (typeof e.width == "number" && e.width > 0 && (l += `width="${e.width}" `, i = e.width), typeof e.height == "number" && e.height > 0 && (l += `height="${e.height}" `, s = e.height), (e.loading === "lazy" || e.loading === "eager") && (l += `loading="${e.loading}" `), typeof e.class == "string" && e.class.length > 0 && (l += `class="${e.class}" `), e.filters && (typeof e.filters.blur == "number" && e.filters.blur >= 0 && e.filters.blur <= 100 && (u += `:blur(${e.filters.blur})`), typeof e.filters.brightness == "number" && e.filters.brightness >= -100 && e.filters.brightness <= 100 && (u += `:brightness(${e.filters.brightness})`), e.filters.fill && (e.filters.fill.match(/[0-9A-Fa-f]{6}/g) || e.filters.fill === "transparent") && (u += `:fill(${e.filters.fill})`), e.filters.format && ["webp", "png", "jpeg"].includes(e.filters.format) && (u += `:format(${e.filters.format})`), typeof e.filters.grayscale == "boolean" && e.filters.grayscale && (u += ":grayscale()"), typeof e.filters.quality == "number" && e.filters.quality >= 0 && e.filters.quality <= 100 && (u += `:quality(${e.filters.quality})`), e.filters.rotate && [90, 180, 270].includes(e.filters.rotate) && (u += `:rotate(${e.filters.rotate})`), u.length > 0 && (u = "/filters" + u))), l.length > 0 && (r = r.replace(/<img/g, `<img ${l.trim()}`));
|
|
402
|
+
const f = i > 0 || s > 0 || u.length > 0 ? `${i}x${s}${u}` : "";
|
|
403
|
+
return r = r.replace(
|
|
404
404
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
|
|
405
405
|
`a.storyblok.com/f/$1/$2.$3/m/${f}`
|
|
406
|
-
), typeof
|
|
407
|
-
var
|
|
408
|
-
const
|
|
406
|
+
), typeof e != "boolean" && (e.sizes || e.srcset) && (r = r.replace(/<img.*?src=["|'](.*?)["|']/g, (g) => {
|
|
407
|
+
var b, _;
|
|
408
|
+
const k = g.match(
|
|
409
409
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
|
|
410
410
|
);
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
413
|
-
srcset: (
|
|
414
|
-
if (typeof
|
|
415
|
-
return `//${
|
|
416
|
-
if (typeof
|
|
411
|
+
if (k && k.length > 0) {
|
|
412
|
+
const I = {
|
|
413
|
+
srcset: (b = e.srcset) == null ? void 0 : b.map((w) => {
|
|
414
|
+
if (typeof w == "number")
|
|
415
|
+
return `//${k}/m/${w}x0${u} ${w}w`;
|
|
416
|
+
if (typeof w == "object" && w.length === 2) {
|
|
417
417
|
let M = 0, F = 0;
|
|
418
|
-
return typeof
|
|
418
|
+
return typeof w[0] == "number" && (M = w[0]), typeof w[1] == "number" && (F = w[1]), `//${k}/m/${M}x${F}${u} ${M}w`;
|
|
419
419
|
}
|
|
420
420
|
}).join(", "),
|
|
421
|
-
sizes: (_ =
|
|
421
|
+
sizes: (_ = e.sizes) == null ? void 0 : _.map((w) => w).join(", ")
|
|
422
422
|
};
|
|
423
423
|
let O = "";
|
|
424
|
-
return
|
|
424
|
+
return I.srcset && (O += `srcset="${I.srcset}" `), I.sizes && (O += `sizes="${I.sizes}" `), g.replace(/<img/g, `<img ${O.trim()}`);
|
|
425
425
|
}
|
|
426
426
|
return g;
|
|
427
|
-
})),
|
|
427
|
+
})), r;
|
|
428
428
|
}
|
|
429
|
-
renderNode(
|
|
430
|
-
const
|
|
431
|
-
|
|
429
|
+
renderNode(r) {
|
|
430
|
+
const e = [];
|
|
431
|
+
r.marks && r.marks.forEach((s) => {
|
|
432
432
|
const l = this.getMatchingMark(s);
|
|
433
|
-
l && l.tag !== "" &&
|
|
433
|
+
l && l.tag !== "" && e.push(this.renderOpeningTag(l.tag));
|
|
434
434
|
});
|
|
435
|
-
const
|
|
436
|
-
return
|
|
437
|
-
|
|
438
|
-
}) :
|
|
435
|
+
const i = this.getMatchingNode(r);
|
|
436
|
+
return i && i.tag && e.push(this.renderOpeningTag(i.tag)), r.content ? r.content.forEach((s) => {
|
|
437
|
+
e.push(this.renderNode(s));
|
|
438
|
+
}) : r.text ? e.push(gn(r.text)) : i && i.singleTag ? e.push(this.renderTag(i.singleTag, " /")) : i && i.html ? e.push(i.html) : r.type === "emoji" && e.push(this.renderEmoji(r)), i && i.tag && e.push(this.renderClosingTag(i.tag)), r.marks && r.marks.slice(0).reverse().forEach((s) => {
|
|
439
439
|
const l = this.getMatchingMark(s);
|
|
440
|
-
l && l.tag !== "" &&
|
|
441
|
-
}),
|
|
440
|
+
l && l.tag !== "" && e.push(this.renderClosingTag(l.tag));
|
|
441
|
+
}), e.join("");
|
|
442
442
|
}
|
|
443
|
-
renderTag(
|
|
444
|
-
return
|
|
445
|
-
if (
|
|
446
|
-
return `<${
|
|
443
|
+
renderTag(r, e) {
|
|
444
|
+
return r.constructor === String ? `<${r}${e}>` : r.map((i) => {
|
|
445
|
+
if (i.constructor === String)
|
|
446
|
+
return `<${i}${e}>`;
|
|
447
447
|
{
|
|
448
|
-
let s = `<${
|
|
449
|
-
if (
|
|
450
|
-
for (const l in
|
|
451
|
-
const u =
|
|
448
|
+
let s = `<${i.tag}`;
|
|
449
|
+
if (i.attrs)
|
|
450
|
+
for (const l in i.attrs) {
|
|
451
|
+
const u = i.attrs[l];
|
|
452
452
|
u !== null && (s += ` ${l}="${u}"`);
|
|
453
453
|
}
|
|
454
|
-
return `${s}${
|
|
454
|
+
return `${s}${e}>`;
|
|
455
455
|
}
|
|
456
456
|
}).join("");
|
|
457
457
|
}
|
|
458
|
-
renderOpeningTag(
|
|
459
|
-
return this.renderTag(
|
|
458
|
+
renderOpeningTag(r) {
|
|
459
|
+
return this.renderTag(r, "");
|
|
460
460
|
}
|
|
461
|
-
renderClosingTag(
|
|
462
|
-
return
|
|
461
|
+
renderClosingTag(r) {
|
|
462
|
+
return r.constructor === String ? `</${r}>` : r.slice(0).reverse().map((e) => e.constructor === String ? `</${e}>` : `</${e.tag}>`).join("");
|
|
463
463
|
}
|
|
464
|
-
getMatchingNode(
|
|
465
|
-
const
|
|
466
|
-
if (typeof
|
|
467
|
-
return r
|
|
464
|
+
getMatchingNode(r) {
|
|
465
|
+
const e = this.nodes[r.type];
|
|
466
|
+
if (typeof e == "function")
|
|
467
|
+
return e(r);
|
|
468
468
|
}
|
|
469
|
-
getMatchingMark(
|
|
470
|
-
const
|
|
471
|
-
if (typeof
|
|
472
|
-
return r
|
|
469
|
+
getMatchingMark(r) {
|
|
470
|
+
const e = this.marks[r.type];
|
|
471
|
+
if (typeof e == "function")
|
|
472
|
+
return e(r);
|
|
473
473
|
}
|
|
474
|
-
renderEmoji(
|
|
475
|
-
if (
|
|
476
|
-
return
|
|
477
|
-
const
|
|
474
|
+
renderEmoji(r) {
|
|
475
|
+
if (r.attrs.emoji)
|
|
476
|
+
return r.attrs.emoji;
|
|
477
|
+
const e = [
|
|
478
478
|
{
|
|
479
479
|
tag: "img",
|
|
480
480
|
attrs: {
|
|
481
|
-
src:
|
|
481
|
+
src: r.attrs.fallbackImage,
|
|
482
482
|
draggable: "false",
|
|
483
483
|
loading: "lazy",
|
|
484
484
|
align: "absmiddle"
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
];
|
|
488
|
-
return this.renderTag(
|
|
488
|
+
return this.renderTag(e, " /");
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
const $n = (o) => {
|
|
492
492
|
if (typeof o != "object" || typeof o._editable > "u")
|
|
493
493
|
return {};
|
|
494
494
|
try {
|
|
495
|
-
const
|
|
495
|
+
const r = JSON.parse(
|
|
496
496
|
o._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
497
497
|
);
|
|
498
|
-
return
|
|
499
|
-
"data-blok-c": JSON.stringify(
|
|
500
|
-
"data-blok-uid":
|
|
498
|
+
return r ? {
|
|
499
|
+
"data-blok-c": JSON.stringify(r),
|
|
500
|
+
"data-blok-uid": r.id + "-" + r.uid
|
|
501
501
|
} : {};
|
|
502
502
|
} catch {
|
|
503
503
|
return {};
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
|
-
let
|
|
507
|
-
const
|
|
508
|
-
o.addNode("blok", (
|
|
509
|
-
let
|
|
510
|
-
return
|
|
511
|
-
|
|
506
|
+
let yn, bn = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
507
|
+
const mn = (o, r) => {
|
|
508
|
+
o.addNode("blok", (e) => {
|
|
509
|
+
let i = "";
|
|
510
|
+
return e.attrs.body.forEach((s) => {
|
|
511
|
+
i += r(s.component, s);
|
|
512
512
|
}), {
|
|
513
|
-
html:
|
|
513
|
+
html: i
|
|
514
514
|
};
|
|
515
515
|
});
|
|
516
|
-
},
|
|
517
|
-
let
|
|
518
|
-
if (!
|
|
516
|
+
}, vn = (o) => !o || !(o != null && o.content.some((r) => r.content || r.type === "blok" || r.type === "horizontal_rule")), _n = (o, r, e) => {
|
|
517
|
+
let i = e || yn;
|
|
518
|
+
if (!i) {
|
|
519
519
|
console.error(
|
|
520
520
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
521
521
|
);
|
|
522
522
|
return;
|
|
523
523
|
}
|
|
524
|
-
return
|
|
525
|
-
},
|
|
526
|
-
function
|
|
527
|
-
let
|
|
524
|
+
return vn(o) ? "" : (r && (i = new hn(r.schema), r.resolver && mn(i, r.resolver)), i.render(o));
|
|
525
|
+
}, xn = () => Nr(bn);
|
|
526
|
+
function wn(o) {
|
|
527
|
+
let r = {
|
|
528
528
|
resolveRelations: []
|
|
529
529
|
};
|
|
530
|
-
function
|
|
531
|
-
|
|
530
|
+
function e(i) {
|
|
531
|
+
i && Array.isArray(r.resolveRelations) && r.resolveRelations.push(
|
|
532
|
+
...Array.isArray(i) ? i : [i]
|
|
533
|
+
);
|
|
532
534
|
}
|
|
533
|
-
for (const
|
|
534
|
-
if (
|
|
535
|
-
const { apiOptions: s, bridgeOptions: l } =
|
|
536
|
-
if (
|
|
535
|
+
for (const i of o)
|
|
536
|
+
if (i.options) {
|
|
537
|
+
const { apiOptions: s, bridgeOptions: l } = i.options;
|
|
538
|
+
if (e(s == null ? void 0 : s.resolve_relations), l) {
|
|
537
539
|
const { resolveRelations: u, ...f } = l;
|
|
538
|
-
|
|
540
|
+
e(u), Object.assign(r, f);
|
|
539
541
|
}
|
|
540
542
|
}
|
|
541
|
-
return
|
|
543
|
+
return r.resolveRelations = [...new Set(r.resolveRelations)], r;
|
|
542
544
|
}
|
|
543
|
-
var
|
|
544
|
-
function
|
|
545
|
+
var X = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
546
|
+
function Tn(o) {
|
|
545
547
|
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
546
548
|
}
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
(function(o,
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
var
|
|
549
|
+
var Z = { exports: {} };
|
|
550
|
+
Z.exports;
|
|
551
|
+
(function(o, r) {
|
|
552
|
+
var e = 200, i = "__lodash_hash_undefined__", s = 800, l = 16, u = 9007199254740991, f = "[object Arguments]", g = "[object Array]", b = "[object AsyncFunction]", _ = "[object Boolean]", k = "[object Date]", I = "[object Error]", O = "[object Function]", w = "[object GeneratorFunction]", M = "[object Map]", F = "[object Number]", Jt = "[object Null]", pt = "[object Object]", Kt = "[object Proxy]", Wt = "[object RegExp]", Yt = "[object Set]", Vt = "[object String]", Xt = "[object Undefined]", Zt = "[object WeakMap]", Qt = "[object ArrayBuffer]", te = "[object DataView]", ee = "[object Float32Array]", re = "[object Float64Array]", ne = "[object Int8Array]", oe = "[object Int16Array]", ae = "[object Int32Array]", ie = "[object Uint8Array]", se = "[object Uint8ClampedArray]", le = "[object Uint16Array]", ce = "[object Uint32Array]", ue = /[\\^$.*+?()[\]{}|]/g, fe = /^\[object .+?Constructor\]$/, pe = /^(?:0|[1-9]\d*)$/, y = {};
|
|
553
|
+
y[ee] = y[re] = y[ne] = y[oe] = y[ae] = y[ie] = y[se] = y[le] = y[ce] = !0, y[f] = y[g] = y[Qt] = y[_] = y[te] = y[k] = y[I] = y[O] = y[M] = y[F] = y[pt] = y[Wt] = y[Yt] = y[Vt] = y[Zt] = !1;
|
|
554
|
+
var dt = typeof X == "object" && X && X.Object === Object && X, de = typeof self == "object" && self && self.Object === Object && self, N = dt || de || Function("return this")(), gt = r && !r.nodeType && r, z = gt && !0 && o && !o.nodeType && o, ht = z && z.exports === gt, Q = ht && dt.process, yt = function() {
|
|
553
555
|
try {
|
|
554
|
-
var t =
|
|
555
|
-
return t ||
|
|
556
|
+
var t = z && z.require && z.require("util").types;
|
|
557
|
+
return t || Q && Q.binding && Q.binding("util");
|
|
556
558
|
} catch {
|
|
557
559
|
}
|
|
558
|
-
}(),
|
|
559
|
-
function
|
|
560
|
-
switch (
|
|
560
|
+
}(), bt = yt && yt.isTypedArray;
|
|
561
|
+
function ge(t, n, a) {
|
|
562
|
+
switch (a.length) {
|
|
561
563
|
case 0:
|
|
562
564
|
return t.call(n);
|
|
563
565
|
case 1:
|
|
564
|
-
return t.call(n,
|
|
566
|
+
return t.call(n, a[0]);
|
|
565
567
|
case 2:
|
|
566
|
-
return t.call(n,
|
|
568
|
+
return t.call(n, a[0], a[1]);
|
|
567
569
|
case 3:
|
|
568
|
-
return t.call(n,
|
|
570
|
+
return t.call(n, a[0], a[1], a[2]);
|
|
569
571
|
}
|
|
570
|
-
return t.apply(n,
|
|
572
|
+
return t.apply(n, a);
|
|
571
573
|
}
|
|
572
|
-
function
|
|
573
|
-
for (var
|
|
574
|
-
c[
|
|
574
|
+
function he(t, n) {
|
|
575
|
+
for (var a = -1, c = Array(t); ++a < t; )
|
|
576
|
+
c[a] = n(a);
|
|
575
577
|
return c;
|
|
576
578
|
}
|
|
577
|
-
function
|
|
579
|
+
function ye(t) {
|
|
578
580
|
return function(n) {
|
|
579
581
|
return t(n);
|
|
580
582
|
};
|
|
@@ -582,23 +584,23 @@ Q.exports;
|
|
|
582
584
|
function be(t, n) {
|
|
583
585
|
return t == null ? void 0 : t[n];
|
|
584
586
|
}
|
|
585
|
-
function
|
|
586
|
-
return function(
|
|
587
|
-
return t(n(
|
|
587
|
+
function me(t, n) {
|
|
588
|
+
return function(a) {
|
|
589
|
+
return t(n(a));
|
|
588
590
|
};
|
|
589
591
|
}
|
|
590
|
-
var
|
|
592
|
+
var ve = Array.prototype, _e = Function.prototype, H = Object.prototype, tt = N["__core-js_shared__"], q = _e.toString, C = H.hasOwnProperty, mt = function() {
|
|
591
593
|
var t = /[^.]+$/.exec(tt && tt.keys && tt.keys.IE_PROTO || "");
|
|
592
594
|
return t ? "Symbol(src)_1." + t : "";
|
|
593
|
-
}(), vt = H.toString,
|
|
594
|
-
"^" + q.call(C).replace(
|
|
595
|
-
), G = ht ?
|
|
595
|
+
}(), vt = H.toString, we = q.call(Object), Te = RegExp(
|
|
596
|
+
"^" + q.call(C).replace(ue, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
597
|
+
), G = ht ? N.Buffer : void 0, _t = N.Symbol, wt = N.Uint8Array, Tt = G ? G.allocUnsafe : void 0, kt = me(Object.getPrototypeOf, Object), At = Object.create, ke = H.propertyIsEnumerable, Ae = ve.splice, $ = _t ? _t.toStringTag : void 0, J = function() {
|
|
596
598
|
try {
|
|
597
599
|
var t = nt(Object, "defineProperty");
|
|
598
600
|
return t({}, "", {}), t;
|
|
599
601
|
} catch {
|
|
600
602
|
}
|
|
601
|
-
}(),
|
|
603
|
+
}(), Ie = G ? G.isBuffer : void 0, It = Math.max, Se = Date.now, St = nt(N, "Map"), L = nt(Object, "create"), Oe = /* @__PURE__ */ function() {
|
|
602
604
|
function t() {
|
|
603
605
|
}
|
|
604
606
|
return function(n) {
|
|
@@ -607,337 +609,337 @@ Q.exports;
|
|
|
607
609
|
if (At)
|
|
608
610
|
return At(n);
|
|
609
611
|
t.prototype = n;
|
|
610
|
-
var
|
|
611
|
-
return t.prototype = void 0,
|
|
612
|
+
var a = new t();
|
|
613
|
+
return t.prototype = void 0, a;
|
|
612
614
|
};
|
|
613
615
|
}();
|
|
614
|
-
function
|
|
615
|
-
var n = -1,
|
|
616
|
-
for (this.clear(); ++n <
|
|
616
|
+
function x(t) {
|
|
617
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
618
|
+
for (this.clear(); ++n < a; ) {
|
|
617
619
|
var c = t[n];
|
|
618
620
|
this.set(c[0], c[1]);
|
|
619
621
|
}
|
|
620
622
|
}
|
|
621
|
-
function
|
|
622
|
-
this.__data__ =
|
|
623
|
+
function Ce() {
|
|
624
|
+
this.__data__ = L ? L(null) : {}, this.size = 0;
|
|
623
625
|
}
|
|
624
|
-
function
|
|
626
|
+
function je(t) {
|
|
625
627
|
var n = this.has(t) && delete this.__data__[t];
|
|
626
628
|
return this.size -= n ? 1 : 0, n;
|
|
627
629
|
}
|
|
628
|
-
function
|
|
630
|
+
function $e(t) {
|
|
629
631
|
var n = this.__data__;
|
|
630
|
-
if (
|
|
631
|
-
var
|
|
632
|
-
return
|
|
632
|
+
if (L) {
|
|
633
|
+
var a = n[t];
|
|
634
|
+
return a === i ? void 0 : a;
|
|
633
635
|
}
|
|
634
636
|
return C.call(n, t) ? n[t] : void 0;
|
|
635
637
|
}
|
|
636
|
-
function
|
|
638
|
+
function xe(t) {
|
|
637
639
|
var n = this.__data__;
|
|
638
|
-
return
|
|
640
|
+
return L ? n[t] !== void 0 : C.call(n, t);
|
|
639
641
|
}
|
|
640
|
-
function
|
|
641
|
-
var
|
|
642
|
-
return this.size += this.has(t) ? 0 : 1,
|
|
642
|
+
function Ee(t, n) {
|
|
643
|
+
var a = this.__data__;
|
|
644
|
+
return this.size += this.has(t) ? 0 : 1, a[t] = L && n === void 0 ? i : n, this;
|
|
643
645
|
}
|
|
644
|
-
|
|
645
|
-
function
|
|
646
|
-
var n = -1,
|
|
647
|
-
for (this.clear(); ++n <
|
|
646
|
+
x.prototype.clear = Ce, x.prototype.delete = je, x.prototype.get = $e, x.prototype.has = xe, x.prototype.set = Ee;
|
|
647
|
+
function j(t) {
|
|
648
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
649
|
+
for (this.clear(); ++n < a; ) {
|
|
648
650
|
var c = t[n];
|
|
649
651
|
this.set(c[0], c[1]);
|
|
650
652
|
}
|
|
651
653
|
}
|
|
652
|
-
function
|
|
654
|
+
function Re() {
|
|
653
655
|
this.__data__ = [], this.size = 0;
|
|
654
656
|
}
|
|
655
|
-
function
|
|
656
|
-
var n = this.__data__,
|
|
657
|
-
if (
|
|
657
|
+
function Pe(t) {
|
|
658
|
+
var n = this.__data__, a = K(n, t);
|
|
659
|
+
if (a < 0)
|
|
658
660
|
return !1;
|
|
659
661
|
var c = n.length - 1;
|
|
660
|
-
return
|
|
661
|
-
}
|
|
662
|
-
function Pe(t) {
|
|
663
|
-
var n = this.__data__, i = K(n, t);
|
|
664
|
-
return i < 0 ? void 0 : n[i][1];
|
|
662
|
+
return a == c ? n.pop() : Ae.call(n, a, 1), --this.size, !0;
|
|
665
663
|
}
|
|
666
664
|
function Me(t) {
|
|
665
|
+
var n = this.__data__, a = K(n, t);
|
|
666
|
+
return a < 0 ? void 0 : n[a][1];
|
|
667
|
+
}
|
|
668
|
+
function Ne(t) {
|
|
667
669
|
return K(this.__data__, t) > -1;
|
|
668
670
|
}
|
|
669
|
-
function
|
|
670
|
-
var
|
|
671
|
-
return c < 0 ? (++this.size,
|
|
671
|
+
function ze(t, n) {
|
|
672
|
+
var a = this.__data__, c = K(a, t);
|
|
673
|
+
return c < 0 ? (++this.size, a.push([t, n])) : a[c][1] = n, this;
|
|
672
674
|
}
|
|
673
|
-
|
|
675
|
+
j.prototype.clear = Re, j.prototype.delete = Pe, j.prototype.get = Me, j.prototype.has = Ne, j.prototype.set = ze;
|
|
674
676
|
function R(t) {
|
|
675
|
-
var n = -1,
|
|
676
|
-
for (this.clear(); ++n <
|
|
677
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
678
|
+
for (this.clear(); ++n < a; ) {
|
|
677
679
|
var c = t[n];
|
|
678
680
|
this.set(c[0], c[1]);
|
|
679
681
|
}
|
|
680
682
|
}
|
|
681
|
-
function
|
|
683
|
+
function Le() {
|
|
682
684
|
this.size = 0, this.__data__ = {
|
|
683
|
-
hash: new
|
|
684
|
-
map: new (St ||
|
|
685
|
-
string: new
|
|
685
|
+
hash: new x(),
|
|
686
|
+
map: new (St || j)(),
|
|
687
|
+
string: new x()
|
|
686
688
|
};
|
|
687
689
|
}
|
|
688
|
-
function
|
|
690
|
+
function De(t) {
|
|
689
691
|
var n = Y(this, t).delete(t);
|
|
690
692
|
return this.size -= n ? 1 : 0, n;
|
|
691
693
|
}
|
|
692
694
|
function Ue(t) {
|
|
693
695
|
return Y(this, t).get(t);
|
|
694
696
|
}
|
|
695
|
-
function
|
|
697
|
+
function Be(t) {
|
|
696
698
|
return Y(this, t).has(t);
|
|
697
699
|
}
|
|
698
|
-
function
|
|
699
|
-
var
|
|
700
|
-
return
|
|
700
|
+
function Fe(t, n) {
|
|
701
|
+
var a = Y(this, t), c = a.size;
|
|
702
|
+
return a.set(t, n), this.size += a.size == c ? 0 : 1, this;
|
|
701
703
|
}
|
|
702
|
-
R.prototype.clear =
|
|
704
|
+
R.prototype.clear = Le, R.prototype.delete = De, R.prototype.get = Ue, R.prototype.has = Be, R.prototype.set = Fe;
|
|
703
705
|
function P(t) {
|
|
704
|
-
var n = this.__data__ = new
|
|
706
|
+
var n = this.__data__ = new j(t);
|
|
705
707
|
this.size = n.size;
|
|
706
708
|
}
|
|
707
|
-
function
|
|
708
|
-
this.__data__ = new
|
|
709
|
-
}
|
|
710
|
-
function He(t) {
|
|
711
|
-
var n = this.__data__, i = n.delete(t);
|
|
712
|
-
return this.size = n.size, i;
|
|
709
|
+
function He() {
|
|
710
|
+
this.__data__ = new j(), this.size = 0;
|
|
713
711
|
}
|
|
714
712
|
function qe(t) {
|
|
715
|
-
|
|
713
|
+
var n = this.__data__, a = n.delete(t);
|
|
714
|
+
return this.size = n.size, a;
|
|
716
715
|
}
|
|
717
716
|
function Ge(t) {
|
|
718
|
-
return this.__data__.
|
|
717
|
+
return this.__data__.get(t);
|
|
719
718
|
}
|
|
720
|
-
function Je(t
|
|
721
|
-
|
|
722
|
-
if (i instanceof x) {
|
|
723
|
-
var c = i.__data__;
|
|
724
|
-
if (!St || c.length < r - 1)
|
|
725
|
-
return c.push([t, n]), this.size = ++i.size, this;
|
|
726
|
-
i = this.__data__ = new R(c);
|
|
727
|
-
}
|
|
728
|
-
return i.set(t, n), this.size = i.size, this;
|
|
719
|
+
function Je(t) {
|
|
720
|
+
return this.__data__.has(t);
|
|
729
721
|
}
|
|
730
|
-
P.prototype.clear = Fe, P.prototype.delete = He, P.prototype.get = qe, P.prototype.has = Ge, P.prototype.set = Je;
|
|
731
722
|
function Ke(t, n) {
|
|
732
|
-
var
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
(
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
return
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
723
|
+
var a = this.__data__;
|
|
724
|
+
if (a instanceof j) {
|
|
725
|
+
var c = a.__data__;
|
|
726
|
+
if (!St || c.length < e - 1)
|
|
727
|
+
return c.push([t, n]), this.size = ++a.size, this;
|
|
728
|
+
a = this.__data__ = new R(c);
|
|
729
|
+
}
|
|
730
|
+
return a.set(t, n), this.size = a.size, this;
|
|
731
|
+
}
|
|
732
|
+
P.prototype.clear = He, P.prototype.delete = qe, P.prototype.get = Ge, P.prototype.has = Je, P.prototype.set = Ke;
|
|
733
|
+
function We(t, n) {
|
|
734
|
+
var a = it(t), c = !a && at(t), d = !a && !c && xt(t), h = !a && !c && !d && Rt(t), m = a || c || d || h, p = m ? he(t.length, String) : [], v = p.length;
|
|
735
|
+
for (var A in t)
|
|
736
|
+
(n || C.call(t, A)) && !(m && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
737
|
+
(A == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
738
|
+
d && (A == "offset" || A == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
739
|
+
h && (A == "buffer" || A == "byteLength" || A == "byteOffset") || // Skip index properties.
|
|
740
|
+
jt(A, v))) && p.push(A);
|
|
741
|
+
return p;
|
|
742
|
+
}
|
|
743
|
+
function et(t, n, a) {
|
|
744
|
+
(a !== void 0 && !V(t[n], a) || a === void 0 && !(n in t)) && rt(t, n, a);
|
|
745
|
+
}
|
|
746
|
+
function Ye(t, n, a) {
|
|
745
747
|
var c = t[n];
|
|
746
|
-
(!(C.call(t, n) &&
|
|
748
|
+
(!(C.call(t, n) && V(c, a)) || a === void 0 && !(n in t)) && rt(t, n, a);
|
|
747
749
|
}
|
|
748
750
|
function K(t, n) {
|
|
749
|
-
for (var
|
|
750
|
-
if (
|
|
751
|
-
return
|
|
751
|
+
for (var a = t.length; a--; )
|
|
752
|
+
if (V(t[a][0], n))
|
|
753
|
+
return a;
|
|
752
754
|
return -1;
|
|
753
755
|
}
|
|
754
|
-
function rt(t, n,
|
|
756
|
+
function rt(t, n, a) {
|
|
755
757
|
n == "__proto__" && J ? J(t, n, {
|
|
756
758
|
configurable: !0,
|
|
757
759
|
enumerable: !0,
|
|
758
|
-
value:
|
|
760
|
+
value: a,
|
|
759
761
|
writable: !0
|
|
760
|
-
}) : t[n] =
|
|
762
|
+
}) : t[n] = a;
|
|
761
763
|
}
|
|
762
|
-
var
|
|
764
|
+
var Ve = cr();
|
|
763
765
|
function W(t) {
|
|
764
|
-
return t == null ? t === void 0 ? Xt :
|
|
766
|
+
return t == null ? t === void 0 ? Xt : Jt : $ && $ in Object(t) ? ur(t) : yr(t);
|
|
765
767
|
}
|
|
766
768
|
function Ot(t) {
|
|
767
|
-
return
|
|
769
|
+
return D(t) && W(t) == f;
|
|
768
770
|
}
|
|
769
771
|
function Xe(t) {
|
|
770
|
-
if (!E(t) ||
|
|
772
|
+
if (!E(t) || gr(t))
|
|
771
773
|
return !1;
|
|
772
|
-
var n = lt(t) ?
|
|
773
|
-
return n.test(
|
|
774
|
+
var n = lt(t) ? Te : fe;
|
|
775
|
+
return n.test(_r(t));
|
|
774
776
|
}
|
|
775
777
|
function Ze(t) {
|
|
776
|
-
return
|
|
778
|
+
return D(t) && Et(t.length) && !!y[W(t)];
|
|
777
779
|
}
|
|
778
780
|
function Qe(t) {
|
|
779
781
|
if (!E(t))
|
|
780
|
-
return
|
|
781
|
-
var n = $t(t),
|
|
782
|
+
return hr(t);
|
|
783
|
+
var n = $t(t), a = [];
|
|
782
784
|
for (var c in t)
|
|
783
|
-
c == "constructor" && (n || !C.call(t, c)) ||
|
|
784
|
-
return
|
|
785
|
+
c == "constructor" && (n || !C.call(t, c)) || a.push(c);
|
|
786
|
+
return a;
|
|
785
787
|
}
|
|
786
|
-
function Ct(t, n,
|
|
787
|
-
t !== n &&
|
|
788
|
-
if (
|
|
789
|
-
|
|
788
|
+
function Ct(t, n, a, c, d) {
|
|
789
|
+
t !== n && Ve(n, function(h, m) {
|
|
790
|
+
if (d || (d = new P()), E(h))
|
|
791
|
+
tr(t, n, m, a, Ct, c, d);
|
|
790
792
|
else {
|
|
791
|
-
var
|
|
792
|
-
|
|
793
|
+
var p = c ? c(ot(t, m), h, m + "", t, n, d) : void 0;
|
|
794
|
+
p === void 0 && (p = h), et(t, m, p);
|
|
793
795
|
}
|
|
794
796
|
}, Pt);
|
|
795
797
|
}
|
|
796
|
-
function
|
|
797
|
-
var
|
|
798
|
-
if (
|
|
799
|
-
et(t,
|
|
798
|
+
function tr(t, n, a, c, d, h, m) {
|
|
799
|
+
var p = ot(t, a), v = ot(n, a), A = m.get(v);
|
|
800
|
+
if (A) {
|
|
801
|
+
et(t, a, A);
|
|
800
802
|
return;
|
|
801
803
|
}
|
|
802
|
-
var
|
|
803
|
-
if (
|
|
804
|
-
var ct =
|
|
805
|
-
|
|
804
|
+
var T = h ? h(p, v, a + "", t, n, m) : void 0, U = T === void 0;
|
|
805
|
+
if (U) {
|
|
806
|
+
var ct = it(v), ut = !ct && xt(v), Nt = !ct && !ut && Rt(v);
|
|
807
|
+
T = v, ct || ut || Nt ? it(p) ? T = p : wr(p) ? T = ir(p) : ut ? (U = !1, T = nr(v, !0)) : Nt ? (U = !1, T = ar(v, !0)) : T = [] : Tr(v) || at(v) ? (T = p, at(p) ? T = kr(p) : (!E(p) || lt(p)) && (T = fr(v))) : U = !1;
|
|
806
808
|
}
|
|
807
|
-
|
|
809
|
+
U && (m.set(v, T), d(T, v, c, h, m), m.delete(v)), et(t, a, T);
|
|
808
810
|
}
|
|
809
|
-
function
|
|
810
|
-
return
|
|
811
|
+
function er(t, n) {
|
|
812
|
+
return mr(br(t, n, Mt), t + "");
|
|
811
813
|
}
|
|
812
|
-
var
|
|
814
|
+
var rr = J ? function(t, n) {
|
|
813
815
|
return J(t, "toString", {
|
|
814
816
|
configurable: !0,
|
|
815
817
|
enumerable: !1,
|
|
816
|
-
value:
|
|
818
|
+
value: Ir(n),
|
|
817
819
|
writable: !0
|
|
818
820
|
});
|
|
819
821
|
} : Mt;
|
|
820
|
-
function
|
|
822
|
+
function nr(t, n) {
|
|
821
823
|
if (n)
|
|
822
824
|
return t.slice();
|
|
823
|
-
var
|
|
825
|
+
var a = t.length, c = Tt ? Tt(a) : new t.constructor(a);
|
|
824
826
|
return t.copy(c), c;
|
|
825
827
|
}
|
|
826
|
-
function
|
|
828
|
+
function or(t) {
|
|
827
829
|
var n = new t.constructor(t.byteLength);
|
|
828
830
|
return new wt(n).set(new wt(t)), n;
|
|
829
831
|
}
|
|
830
|
-
function
|
|
831
|
-
var
|
|
832
|
-
return new t.constructor(
|
|
832
|
+
function ar(t, n) {
|
|
833
|
+
var a = n ? or(t.buffer) : t.buffer;
|
|
834
|
+
return new t.constructor(a, t.byteOffset, t.length);
|
|
833
835
|
}
|
|
834
836
|
function ir(t, n) {
|
|
835
|
-
var
|
|
836
|
-
for (n || (n = Array(c)); ++
|
|
837
|
-
n[
|
|
837
|
+
var a = -1, c = t.length;
|
|
838
|
+
for (n || (n = Array(c)); ++a < c; )
|
|
839
|
+
n[a] = t[a];
|
|
838
840
|
return n;
|
|
839
841
|
}
|
|
840
|
-
function
|
|
841
|
-
var
|
|
842
|
-
|
|
842
|
+
function sr(t, n, a, c) {
|
|
843
|
+
var d = !a;
|
|
844
|
+
a || (a = {});
|
|
843
845
|
for (var h = -1, m = n.length; ++h < m; ) {
|
|
844
|
-
var
|
|
845
|
-
v === void 0 && (v = t[
|
|
846
|
+
var p = n[h], v = c ? c(a[p], t[p], p, a, t) : void 0;
|
|
847
|
+
v === void 0 && (v = t[p]), d ? rt(a, p, v) : Ye(a, p, v);
|
|
846
848
|
}
|
|
847
|
-
return
|
|
848
|
-
}
|
|
849
|
-
function
|
|
850
|
-
return
|
|
851
|
-
var c = -1,
|
|
852
|
-
for (h = t.length > 3 && typeof h == "function" ? (
|
|
853
|
-
var
|
|
854
|
-
|
|
849
|
+
return a;
|
|
850
|
+
}
|
|
851
|
+
function lr(t) {
|
|
852
|
+
return er(function(n, a) {
|
|
853
|
+
var c = -1, d = a.length, h = d > 1 ? a[d - 1] : void 0, m = d > 2 ? a[2] : void 0;
|
|
854
|
+
for (h = t.length > 3 && typeof h == "function" ? (d--, h) : void 0, m && pr(a[0], a[1], m) && (h = d < 3 ? void 0 : h, d = 1), n = Object(n); ++c < d; ) {
|
|
855
|
+
var p = a[c];
|
|
856
|
+
p && t(n, p, c, h);
|
|
855
857
|
}
|
|
856
858
|
return n;
|
|
857
859
|
});
|
|
858
860
|
}
|
|
859
|
-
function
|
|
860
|
-
return function(n,
|
|
861
|
-
for (var
|
|
862
|
-
var v = m[t ?
|
|
863
|
-
if (
|
|
861
|
+
function cr(t) {
|
|
862
|
+
return function(n, a, c) {
|
|
863
|
+
for (var d = -1, h = Object(n), m = c(n), p = m.length; p--; ) {
|
|
864
|
+
var v = m[t ? p : ++d];
|
|
865
|
+
if (a(h[v], v, h) === !1)
|
|
864
866
|
break;
|
|
865
867
|
}
|
|
866
868
|
return n;
|
|
867
869
|
};
|
|
868
870
|
}
|
|
869
871
|
function Y(t, n) {
|
|
870
|
-
var
|
|
871
|
-
return dr(n) ?
|
|
872
|
+
var a = t.__data__;
|
|
873
|
+
return dr(n) ? a[typeof n == "string" ? "string" : "hash"] : a.map;
|
|
872
874
|
}
|
|
873
875
|
function nt(t, n) {
|
|
874
|
-
var
|
|
875
|
-
return Xe(
|
|
876
|
+
var a = be(t, n);
|
|
877
|
+
return Xe(a) ? a : void 0;
|
|
876
878
|
}
|
|
877
|
-
function
|
|
878
|
-
var n = C.call(t, $),
|
|
879
|
+
function ur(t) {
|
|
880
|
+
var n = C.call(t, $), a = t[$];
|
|
879
881
|
try {
|
|
880
882
|
t[$] = void 0;
|
|
881
883
|
var c = !0;
|
|
882
884
|
} catch {
|
|
883
885
|
}
|
|
884
|
-
var
|
|
885
|
-
return c && (n ? t[$] =
|
|
886
|
+
var d = vt.call(t);
|
|
887
|
+
return c && (n ? t[$] = a : delete t[$]), d;
|
|
886
888
|
}
|
|
887
|
-
function
|
|
888
|
-
return typeof t.constructor == "function" && !$t(t) ?
|
|
889
|
+
function fr(t) {
|
|
890
|
+
return typeof t.constructor == "function" && !$t(t) ? Oe(kt(t)) : {};
|
|
889
891
|
}
|
|
890
|
-
function
|
|
891
|
-
var
|
|
892
|
-
return n = n ?? u, !!n && (
|
|
892
|
+
function jt(t, n) {
|
|
893
|
+
var a = typeof t;
|
|
894
|
+
return n = n ?? u, !!n && (a == "number" || a != "symbol" && pe.test(t)) && t > -1 && t % 1 == 0 && t < n;
|
|
893
895
|
}
|
|
894
|
-
function
|
|
895
|
-
if (!E(
|
|
896
|
+
function pr(t, n, a) {
|
|
897
|
+
if (!E(a))
|
|
896
898
|
return !1;
|
|
897
899
|
var c = typeof n;
|
|
898
|
-
return (c == "number" ? st(
|
|
900
|
+
return (c == "number" ? st(a) && jt(n, a.length) : c == "string" && n in a) ? V(a[n], t) : !1;
|
|
899
901
|
}
|
|
900
902
|
function dr(t) {
|
|
901
903
|
var n = typeof t;
|
|
902
904
|
return n == "string" || n == "number" || n == "symbol" || n == "boolean" ? t !== "__proto__" : t === null;
|
|
903
905
|
}
|
|
904
|
-
function
|
|
906
|
+
function gr(t) {
|
|
905
907
|
return !!mt && mt in t;
|
|
906
908
|
}
|
|
907
909
|
function $t(t) {
|
|
908
|
-
var n = t && t.constructor,
|
|
909
|
-
return t ===
|
|
910
|
+
var n = t && t.constructor, a = typeof n == "function" && n.prototype || H;
|
|
911
|
+
return t === a;
|
|
910
912
|
}
|
|
911
|
-
function
|
|
913
|
+
function hr(t) {
|
|
912
914
|
var n = [];
|
|
913
915
|
if (t != null)
|
|
914
|
-
for (var
|
|
915
|
-
n.push(
|
|
916
|
+
for (var a in Object(t))
|
|
917
|
+
n.push(a);
|
|
916
918
|
return n;
|
|
917
919
|
}
|
|
918
|
-
function
|
|
920
|
+
function yr(t) {
|
|
919
921
|
return vt.call(t);
|
|
920
922
|
}
|
|
921
|
-
function br(t, n,
|
|
923
|
+
function br(t, n, a) {
|
|
922
924
|
return n = It(n === void 0 ? t.length - 1 : n, 0), function() {
|
|
923
|
-
for (var c = arguments,
|
|
924
|
-
m[
|
|
925
|
-
|
|
926
|
-
for (var
|
|
927
|
-
d
|
|
928
|
-
return
|
|
925
|
+
for (var c = arguments, d = -1, h = It(c.length - n, 0), m = Array(h); ++d < h; )
|
|
926
|
+
m[d] = c[n + d];
|
|
927
|
+
d = -1;
|
|
928
|
+
for (var p = Array(n + 1); ++d < n; )
|
|
929
|
+
p[d] = c[d];
|
|
930
|
+
return p[n] = a(m), ge(t, this, p);
|
|
929
931
|
};
|
|
930
932
|
}
|
|
931
933
|
function ot(t, n) {
|
|
932
934
|
if (!(n === "constructor" && typeof t[n] == "function") && n != "__proto__")
|
|
933
935
|
return t[n];
|
|
934
936
|
}
|
|
935
|
-
var
|
|
936
|
-
function
|
|
937
|
-
var n = 0,
|
|
937
|
+
var mr = vr(rr);
|
|
938
|
+
function vr(t) {
|
|
939
|
+
var n = 0, a = 0;
|
|
938
940
|
return function() {
|
|
939
|
-
var c =
|
|
940
|
-
if (
|
|
941
|
+
var c = Se(), d = l - (c - a);
|
|
942
|
+
if (a = c, d > 0) {
|
|
941
943
|
if (++n >= s)
|
|
942
944
|
return arguments[0];
|
|
943
945
|
} else
|
|
@@ -945,7 +947,7 @@ Q.exports;
|
|
|
945
947
|
return t.apply(void 0, arguments);
|
|
946
948
|
};
|
|
947
949
|
}
|
|
948
|
-
function
|
|
950
|
+
function _r(t) {
|
|
949
951
|
if (t != null) {
|
|
950
952
|
try {
|
|
951
953
|
return q.call(t);
|
|
@@ -958,26 +960,26 @@ Q.exports;
|
|
|
958
960
|
}
|
|
959
961
|
return "";
|
|
960
962
|
}
|
|
961
|
-
function
|
|
963
|
+
function V(t, n) {
|
|
962
964
|
return t === n || t !== t && n !== n;
|
|
963
965
|
}
|
|
964
|
-
var
|
|
966
|
+
var at = Ot(/* @__PURE__ */ function() {
|
|
965
967
|
return arguments;
|
|
966
968
|
}()) ? Ot : function(t) {
|
|
967
|
-
return
|
|
968
|
-
},
|
|
969
|
+
return D(t) && C.call(t, "callee") && !ke.call(t, "callee");
|
|
970
|
+
}, it = Array.isArray;
|
|
969
971
|
function st(t) {
|
|
970
972
|
return t != null && Et(t.length) && !lt(t);
|
|
971
973
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
974
|
+
function wr(t) {
|
|
975
|
+
return D(t) && st(t);
|
|
974
976
|
}
|
|
975
|
-
var
|
|
977
|
+
var xt = Ie || Sr;
|
|
976
978
|
function lt(t) {
|
|
977
979
|
if (!E(t))
|
|
978
980
|
return !1;
|
|
979
981
|
var n = W(t);
|
|
980
|
-
return n == O || n ==
|
|
982
|
+
return n == O || n == w || n == b || n == Kt;
|
|
981
983
|
}
|
|
982
984
|
function Et(t) {
|
|
983
985
|
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= u;
|
|
@@ -986,29 +988,29 @@ Q.exports;
|
|
|
986
988
|
var n = typeof t;
|
|
987
989
|
return t != null && (n == "object" || n == "function");
|
|
988
990
|
}
|
|
989
|
-
function
|
|
991
|
+
function D(t) {
|
|
990
992
|
return t != null && typeof t == "object";
|
|
991
993
|
}
|
|
992
|
-
function
|
|
993
|
-
if (!
|
|
994
|
+
function Tr(t) {
|
|
995
|
+
if (!D(t) || W(t) != pt)
|
|
994
996
|
return !1;
|
|
995
997
|
var n = kt(t);
|
|
996
998
|
if (n === null)
|
|
997
999
|
return !0;
|
|
998
|
-
var
|
|
999
|
-
return typeof
|
|
1000
|
+
var a = C.call(n, "constructor") && n.constructor;
|
|
1001
|
+
return typeof a == "function" && a instanceof a && q.call(a) == we;
|
|
1000
1002
|
}
|
|
1001
|
-
var Rt =
|
|
1002
|
-
function
|
|
1003
|
-
return
|
|
1003
|
+
var Rt = bt ? ye(bt) : Ze;
|
|
1004
|
+
function kr(t) {
|
|
1005
|
+
return sr(t, Pt(t));
|
|
1004
1006
|
}
|
|
1005
1007
|
function Pt(t) {
|
|
1006
|
-
return st(t) ?
|
|
1008
|
+
return st(t) ? We(t, !0) : Qe(t);
|
|
1007
1009
|
}
|
|
1008
|
-
var
|
|
1009
|
-
Ct(t, n,
|
|
1010
|
+
var Ar = lr(function(t, n, a, c) {
|
|
1011
|
+
Ct(t, n, a, c);
|
|
1010
1012
|
});
|
|
1011
|
-
function
|
|
1013
|
+
function Ir(t) {
|
|
1012
1014
|
return function() {
|
|
1013
1015
|
return t;
|
|
1014
1016
|
};
|
|
@@ -1016,111 +1018,128 @@ Q.exports;
|
|
|
1016
1018
|
function Mt(t) {
|
|
1017
1019
|
return t;
|
|
1018
1020
|
}
|
|
1019
|
-
function
|
|
1021
|
+
function Sr() {
|
|
1020
1022
|
return !1;
|
|
1021
1023
|
}
|
|
1022
|
-
o.exports =
|
|
1023
|
-
})(
|
|
1024
|
-
var
|
|
1025
|
-
const
|
|
1026
|
-
function
|
|
1027
|
-
let
|
|
1028
|
-
function
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1024
|
+
o.exports = Ar;
|
|
1025
|
+
})(Z, Z.exports);
|
|
1026
|
+
var kn = Z.exports;
|
|
1027
|
+
const An = /* @__PURE__ */ Tn(kn);
|
|
1028
|
+
function In(o) {
|
|
1029
|
+
let r = {};
|
|
1030
|
+
function e(i, s) {
|
|
1031
|
+
if ((s == null ? void 0 : s.type) === "AwaitExpression" && s.argument.type === "CallExpression" && s.argument.callee.type === "Identifier" && s.argument.callee.name === "useStoryblok") {
|
|
1032
|
+
const l = s.argument.arguments;
|
|
1033
|
+
if (l && l[1].type === "ObjectExpression") {
|
|
1034
|
+
const u = Ht(l[1].properties);
|
|
1035
|
+
r = {
|
|
1036
|
+
...r,
|
|
1037
|
+
apiOptions: u
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
if (l && l[2].type === "ObjectExpression") {
|
|
1041
|
+
const u = Ht(l[2].properties);
|
|
1042
|
+
r = {
|
|
1043
|
+
...r,
|
|
1044
|
+
bridgeOptions: u
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1040
1048
|
}
|
|
1041
|
-
return
|
|
1049
|
+
return An({}, o, e), r;
|
|
1042
1050
|
}
|
|
1043
|
-
function
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1051
|
+
function Ht(o) {
|
|
1052
|
+
const r = {};
|
|
1053
|
+
return o.reduce((e, i) => {
|
|
1054
|
+
if (i.type !== "Property")
|
|
1055
|
+
return e;
|
|
1056
|
+
const { key: s, value: l } = i, { type: u } = l;
|
|
1057
|
+
if (s.type !== "Identifier")
|
|
1058
|
+
return e;
|
|
1059
|
+
if (u === "Literal")
|
|
1060
|
+
e[s.name] = l.value;
|
|
1061
|
+
else if (u === "ArrayExpression") {
|
|
1062
|
+
const f = l.elements.reduce((g, b) => b.type === "Literal" && b.value ? [...g, b.value] : g, []);
|
|
1063
|
+
e[s.name] = f;
|
|
1064
|
+
}
|
|
1065
|
+
return e;
|
|
1066
|
+
}, r);
|
|
1048
1067
|
}
|
|
1049
1068
|
let B = [];
|
|
1050
|
-
function Sn(o,
|
|
1051
|
-
const
|
|
1052
|
-
if (!o ||
|
|
1069
|
+
function Sn(o, r) {
|
|
1070
|
+
const e = "virtual:storyblok-bridge", i = "\0" + e;
|
|
1071
|
+
if (!o || r !== "server")
|
|
1053
1072
|
return {
|
|
1054
1073
|
name: "vite-plugin-storyblok-bridge",
|
|
1055
1074
|
resolveId(f) {
|
|
1056
|
-
if (f ===
|
|
1057
|
-
return
|
|
1075
|
+
if (f === e)
|
|
1076
|
+
return i;
|
|
1058
1077
|
},
|
|
1059
1078
|
load(f) {
|
|
1060
|
-
if (f ===
|
|
1079
|
+
if (f === i)
|
|
1061
1080
|
return "export const bridgeOptions = null";
|
|
1062
1081
|
}
|
|
1063
1082
|
};
|
|
1064
|
-
let s = [], l = null, u
|
|
1083
|
+
let s = [], l = null, u;
|
|
1065
1084
|
return {
|
|
1066
1085
|
name: "vite-plugin-storyblok-bridge",
|
|
1067
1086
|
async resolveId(f) {
|
|
1068
|
-
if (f ===
|
|
1069
|
-
return
|
|
1087
|
+
if (f === e)
|
|
1088
|
+
return i;
|
|
1070
1089
|
},
|
|
1071
1090
|
async transform(f, g) {
|
|
1072
1091
|
var O;
|
|
1073
1092
|
if (g.includes("node_modules") && !g.includes("/pages/") || !f.includes("useStoryblok") || !((O = this.getModuleInfo(g).meta) != null && O.astro))
|
|
1074
1093
|
return;
|
|
1075
|
-
const [, ..._] = g.split("src/pages/"),
|
|
1076
|
-
B.length && (s = B.filter((
|
|
1077
|
-
url:
|
|
1078
|
-
options:
|
|
1094
|
+
const [, ..._] = g.split("src/pages/"), k = _.join("/").replace(".astro", ""), I = In(this.parse(f));
|
|
1095
|
+
B.length && (s = B.filter((w) => w.url !== k)), s.push({
|
|
1096
|
+
url: k,
|
|
1097
|
+
options: I
|
|
1079
1098
|
}), l && (u && clearTimeout(u), u = setTimeout(() => {
|
|
1080
|
-
On(B, s) || (B.length !== 0 && (l.restart(), console.info("
|
|
1099
|
+
On(B, s) || (B.length !== 0 && (l.restart(), console.info("Bridge options updated. Restarting...")), B = [...s]);
|
|
1081
1100
|
}, 1e3));
|
|
1082
1101
|
},
|
|
1083
1102
|
async load(f) {
|
|
1084
|
-
if (f ===
|
|
1085
|
-
return `export const bridgeOptions = ${JSON.stringify(
|
|
1103
|
+
if (f === i)
|
|
1104
|
+
return `export const bridgeOptions = ${JSON.stringify(wn(s))}`;
|
|
1086
1105
|
},
|
|
1087
1106
|
configureServer(f) {
|
|
1088
1107
|
l = f;
|
|
1089
1108
|
}
|
|
1090
1109
|
};
|
|
1091
1110
|
}
|
|
1092
|
-
function On(o = [],
|
|
1093
|
-
return
|
|
1094
|
-
const s = o.find((l) => (l == null ? void 0 : l.url) ===
|
|
1095
|
-
return s && JSON.stringify(
|
|
1111
|
+
function On(o = [], r = []) {
|
|
1112
|
+
return r.every(({ url: e, options: i }) => {
|
|
1113
|
+
const s = o.find((l) => (l == null ? void 0 : l.url) === e);
|
|
1114
|
+
return s && JSON.stringify(i) === JSON.stringify(s.options);
|
|
1096
1115
|
});
|
|
1097
1116
|
}
|
|
1098
|
-
let
|
|
1117
|
+
let qt;
|
|
1099
1118
|
async function En(o) {
|
|
1100
|
-
const { action:
|
|
1101
|
-
if (
|
|
1102
|
-
const
|
|
1103
|
-
const l = await
|
|
1119
|
+
const { action: r, story: e } = o || {};
|
|
1120
|
+
if (r === "input" && e) {
|
|
1121
|
+
const i = async () => {
|
|
1122
|
+
const l = await jn(e), u = document.body;
|
|
1104
1123
|
if (l.outerHTML === u.outerHTML)
|
|
1105
1124
|
return;
|
|
1106
1125
|
const f = document.querySelector('[data-blok-focused="true"]');
|
|
1107
1126
|
Cn(u, l, f);
|
|
1108
1127
|
};
|
|
1109
|
-
clearTimeout(
|
|
1128
|
+
clearTimeout(qt), qt = setTimeout(i, 500);
|
|
1110
1129
|
}
|
|
1111
1130
|
["published", "change"].includes(o == null ? void 0 : o.action) && location.reload();
|
|
1112
1131
|
}
|
|
1113
|
-
function Cn(o,
|
|
1114
|
-
if (
|
|
1115
|
-
const
|
|
1116
|
-
`[data-blok-uid="${
|
|
1132
|
+
function Cn(o, r, e) {
|
|
1133
|
+
if (e) {
|
|
1134
|
+
const i = e.getAttribute("data-blok-uid"), s = r.querySelector(
|
|
1135
|
+
`[data-blok-uid="${i}"]`
|
|
1117
1136
|
);
|
|
1118
|
-
s && (s.setAttribute("data-blok-focused", "true"),
|
|
1137
|
+
s && (s.setAttribute("data-blok-focused", "true"), e.replaceWith(s));
|
|
1119
1138
|
} else
|
|
1120
|
-
o.replaceWith(
|
|
1139
|
+
o.replaceWith(r);
|
|
1121
1140
|
}
|
|
1122
|
-
async function
|
|
1123
|
-
const
|
|
1141
|
+
async function jn(o) {
|
|
1142
|
+
const e = await (await fetch(location.href, {
|
|
1124
1143
|
method: "POST",
|
|
1125
1144
|
body: JSON.stringify({
|
|
1126
1145
|
...o,
|
|
@@ -1130,101 +1149,96 @@ async function xn(o) {
|
|
|
1130
1149
|
"Content-Type": "application/json"
|
|
1131
1150
|
}
|
|
1132
1151
|
})).text();
|
|
1133
|
-
return new DOMParser().parseFromString(
|
|
1152
|
+
return new DOMParser().parseFromString(e, "text/html").body;
|
|
1134
1153
|
}
|
|
1135
1154
|
function Rn() {
|
|
1136
1155
|
return globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly"), globalThis.storyblokApiInstance;
|
|
1137
1156
|
}
|
|
1138
|
-
async function Pn({
|
|
1139
|
-
slug: o,
|
|
1140
|
-
apiOptions: e = {},
|
|
1141
|
-
bridgeOptions: r = {},
|
|
1142
|
-
Astro: a
|
|
1143
|
-
}) {
|
|
1157
|
+
async function Pn(o, r = {}, e = {}, i) {
|
|
1144
1158
|
globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly");
|
|
1145
1159
|
let s = null;
|
|
1146
|
-
if (
|
|
1147
|
-
s =
|
|
1160
|
+
if (i && i.locals._storyblok_preview_data)
|
|
1161
|
+
s = i.locals._storyblok_preview_data;
|
|
1148
1162
|
else {
|
|
1149
1163
|
const { data: l } = await globalThis.storyblokApiInstance.get(
|
|
1150
1164
|
o,
|
|
1151
|
-
|
|
1152
|
-
|
|
1165
|
+
r,
|
|
1166
|
+
e
|
|
1153
1167
|
);
|
|
1154
1168
|
s = l.story;
|
|
1155
1169
|
}
|
|
1156
1170
|
return s;
|
|
1157
1171
|
}
|
|
1158
|
-
function Mn(o,
|
|
1159
|
-
const
|
|
1160
|
-
if (!
|
|
1172
|
+
function Mn(o, r) {
|
|
1173
|
+
const e = globalThis.storyblokApiInstance.richTextResolver;
|
|
1174
|
+
if (!e) {
|
|
1161
1175
|
console.error(
|
|
1162
1176
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
1163
1177
|
);
|
|
1164
1178
|
return;
|
|
1165
1179
|
}
|
|
1166
|
-
return
|
|
1180
|
+
return _n(o, r, e);
|
|
1167
1181
|
}
|
|
1168
|
-
function
|
|
1169
|
-
const
|
|
1182
|
+
function Nn(o) {
|
|
1183
|
+
const r = {
|
|
1170
1184
|
useCustomApi: !1,
|
|
1171
1185
|
bridge: !0,
|
|
1172
1186
|
componentsDir: "src",
|
|
1173
1187
|
enableFallbackComponent: !1,
|
|
1174
|
-
|
|
1188
|
+
livePreview: !1,
|
|
1175
1189
|
...o
|
|
1176
1190
|
};
|
|
1177
1191
|
return {
|
|
1178
1192
|
name: "@storyblok/astro",
|
|
1179
1193
|
hooks: {
|
|
1180
1194
|
"astro:config:setup": ({
|
|
1181
|
-
injectScript:
|
|
1182
|
-
updateConfig:
|
|
1195
|
+
injectScript: e,
|
|
1196
|
+
updateConfig: i,
|
|
1183
1197
|
addDevToolbarApp: s,
|
|
1184
1198
|
addMiddleware: l,
|
|
1185
1199
|
config: u
|
|
1186
1200
|
}) => {
|
|
1187
|
-
if (
|
|
1201
|
+
if (i({
|
|
1188
1202
|
vite: {
|
|
1189
1203
|
plugins: [
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1204
|
+
Or(
|
|
1205
|
+
r.accessToken,
|
|
1206
|
+
r.useCustomApi,
|
|
1207
|
+
r.apiOptions
|
|
1194
1208
|
),
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1209
|
+
Pr(
|
|
1210
|
+
r.componentsDir,
|
|
1211
|
+
r.components,
|
|
1212
|
+
r.enableFallbackComponent,
|
|
1213
|
+
r.customFallbackComponent
|
|
1200
1214
|
),
|
|
1201
|
-
|
|
1215
|
+
Mr(r),
|
|
1202
1216
|
Sn(
|
|
1203
|
-
|
|
1217
|
+
r.livePreview,
|
|
1204
1218
|
u.output
|
|
1205
1219
|
)
|
|
1206
1220
|
]
|
|
1207
1221
|
}
|
|
1208
|
-
}),
|
|
1222
|
+
}), r.livePreview && (u == null ? void 0 : u.output) !== "server")
|
|
1209
1223
|
throw new Error(
|
|
1210
|
-
"To utilize the Astro Storyblok Live feature, Astro must be configured in SSR mode. Please disable this feature or switch Astro to SSR mode."
|
|
1224
|
+
"To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode."
|
|
1211
1225
|
);
|
|
1212
|
-
if (
|
|
1226
|
+
if (e(
|
|
1213
1227
|
"page-ssr",
|
|
1214
1228
|
`
|
|
1215
1229
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
1216
1230
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
1217
1231
|
`
|
|
1218
|
-
),
|
|
1232
|
+
), r.bridge && !r.livePreview) {
|
|
1219
1233
|
let f = "";
|
|
1220
|
-
if (typeof
|
|
1221
|
-
const g = { ...
|
|
1234
|
+
if (typeof r.bridge == "object") {
|
|
1235
|
+
const g = { ...r.bridge };
|
|
1222
1236
|
f = `const storyblokInstance = new StoryblokBridge(${JSON.stringify(
|
|
1223
1237
|
g
|
|
1224
1238
|
)});`;
|
|
1225
1239
|
} else
|
|
1226
1240
|
f = "const storyblokInstance = new StoryblokBridge()";
|
|
1227
|
-
|
|
1241
|
+
e(
|
|
1228
1242
|
"page",
|
|
1229
1243
|
`
|
|
1230
1244
|
import { loadStoryblokBridge } from "@storyblok/astro";
|
|
@@ -1241,20 +1255,20 @@ function Ln(o) {
|
|
|
1241
1255
|
`
|
|
1242
1256
|
);
|
|
1243
1257
|
}
|
|
1244
|
-
|
|
1258
|
+
r.livePreview && (e(
|
|
1245
1259
|
"page",
|
|
1246
1260
|
`
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1261
|
+
import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|
|
1262
|
+
import { bridgeOptions } from "virtual:storyblok-bridge";
|
|
1263
|
+
console.info("The Storyblok Astro live preview feature is currently in an experimental phase, and its API is subject to change in the future.")
|
|
1264
|
+
loadStoryblokBridge().then(() => {
|
|
1265
|
+
const { StoryblokBridge, location } = window;
|
|
1266
|
+
if(bridgeOptions){
|
|
1267
|
+
const storyblokInstance = new StoryblokBridge(bridgeOptions);
|
|
1268
|
+
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
1269
|
+
};
|
|
1270
|
+
});
|
|
1271
|
+
`
|
|
1258
1272
|
), l({
|
|
1259
1273
|
entrypoint: "@storyblok/astro/middleware.ts",
|
|
1260
1274
|
order: "pre"
|
|
@@ -1264,11 +1278,11 @@ function Ln(o) {
|
|
|
1264
1278
|
};
|
|
1265
1279
|
}
|
|
1266
1280
|
export {
|
|
1267
|
-
|
|
1281
|
+
hn as RichTextResolver,
|
|
1268
1282
|
dn as RichTextSchema,
|
|
1269
|
-
|
|
1283
|
+
Nn as default,
|
|
1270
1284
|
En as handleStoryblokMessage,
|
|
1271
|
-
|
|
1285
|
+
xn as loadStoryblokBridge,
|
|
1272
1286
|
Mn as renderRichText,
|
|
1273
1287
|
$n as storyblokEditable,
|
|
1274
1288
|
Pn as useStoryblok,
|