@storyblok/astro 4.1.0-alpha.2 → 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 +11 -1
- package/dist/storyblok-astro.js +9 -9
- package/dist/storyblok-astro.mjs +441 -429
- 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 +2 -1
- package/package.json +1 -1
- package/utils/generateFinalBridgeObject.ts +11 -20
- package/utils/parseAstCode.ts +41 -18
package/dist/storyblok-astro.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function Or(o,
|
|
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 Or(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 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"),
|
|
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 && Cr.test(
|
|
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
|
-
}, Er = (o,
|
|
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 Pr(o,
|
|
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 Pr(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 Pr(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.
|
|
@@ -95,21 +95,21 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
function Mr(o) {
|
|
98
|
-
const
|
|
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 = [], Nr = (o) => new Promise((
|
|
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 = [], Nr = (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 zr = Object.defineProperty, Lr = (o,
|
|
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
|
-
|
|
130
|
-
...
|
|
131
|
-
per_page:
|
|
132
|
-
page:
|
|
133
|
-
})),
|
|
134
|
-
const
|
|
135
|
-
return this.arrayFrom(
|
|
136
|
-
}),
|
|
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 Ur {
|
|
|
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 Ur {
|
|
|
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,17 +183,17 @@ class Ur {
|
|
|
183
183
|
case "ca":
|
|
184
184
|
return u;
|
|
185
185
|
default:
|
|
186
|
-
return
|
|
186
|
+
return e;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
for (const
|
|
193
|
-
const s = o[
|
|
194
|
-
|
|
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
195
|
}
|
|
196
|
-
return
|
|
196
|
+
return e;
|
|
197
197
|
}, Br = (o) => o === "email", Fr = () => ({
|
|
198
198
|
singleTag: "hr"
|
|
199
199
|
}), Hr = () => ({
|
|
@@ -216,16 +216,16 @@ const Dr = function(o, e) {
|
|
|
216
216
|
singleTag: [
|
|
217
217
|
{
|
|
218
218
|
tag: "img",
|
|
219
|
-
attrs:
|
|
219
|
+
attrs: Ur(o.attrs, ["src", "alt", "title"])
|
|
220
220
|
}
|
|
221
221
|
]
|
|
222
222
|
}), Yr = () => ({
|
|
223
223
|
tag: "li"
|
|
224
|
-
}),
|
|
224
|
+
}), Vr = () => ({
|
|
225
225
|
tag: "ol"
|
|
226
|
-
}),
|
|
226
|
+
}), Xr = () => ({
|
|
227
227
|
tag: "p"
|
|
228
|
-
}),
|
|
228
|
+
}), Zr = (o) => ({
|
|
229
229
|
tag: [
|
|
230
230
|
{
|
|
231
231
|
tag: "span",
|
|
@@ -236,7 +236,7 @@ const Dr = function(o, e) {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
]
|
|
239
|
-
}),
|
|
239
|
+
}), Qr = () => ({
|
|
240
240
|
tag: "b"
|
|
241
241
|
}), tn = () => ({
|
|
242
242
|
tag: "s"
|
|
@@ -253,17 +253,17 @@ const Dr = function(o, e) {
|
|
|
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
|
};
|
|
@@ -286,8 +286,8 @@ const Dr = function(o, e) {
|
|
|
286
286
|
}
|
|
287
287
|
]
|
|
288
288
|
}), fn = (o) => {
|
|
289
|
-
var
|
|
290
|
-
return (
|
|
289
|
+
var r;
|
|
290
|
+
return (r = o.attrs) != null && r.color ? {
|
|
291
291
|
tag: [
|
|
292
292
|
{
|
|
293
293
|
tag: "span",
|
|
@@ -300,8 +300,8 @@ const Dr = function(o, e) {
|
|
|
300
300
|
tag: ""
|
|
301
301
|
};
|
|
302
302
|
}, pn = (o) => {
|
|
303
|
-
var
|
|
304
|
-
return (
|
|
303
|
+
var r;
|
|
304
|
+
return (r = o.attrs) != null && r.color ? {
|
|
305
305
|
tag: [
|
|
306
306
|
{
|
|
307
307
|
tag: "span",
|
|
@@ -323,12 +323,12 @@ const Dr = function(o, e) {
|
|
|
323
323
|
heading: Kr,
|
|
324
324
|
image: Wr,
|
|
325
325
|
list_item: Yr,
|
|
326
|
-
ordered_list:
|
|
327
|
-
paragraph:
|
|
328
|
-
emoji:
|
|
326
|
+
ordered_list: Vr,
|
|
327
|
+
paragraph: Xr,
|
|
328
|
+
emoji: Zr
|
|
329
329
|
},
|
|
330
330
|
marks: {
|
|
331
|
-
bold:
|
|
331
|
+
bold: Qr,
|
|
332
332
|
strike: tn,
|
|
333
333
|
underline: en,
|
|
334
334
|
strong: rn,
|
|
@@ -343,31 +343,31 @@ const Dr = function(o, e) {
|
|
|
343
343
|
textStyle: pn
|
|
344
344
|
}
|
|
345
345
|
}, gn = function(o) {
|
|
346
|
-
const
|
|
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
355
|
class hn {
|
|
356
|
-
constructor(
|
|
357
|
-
|
|
356
|
+
constructor(r) {
|
|
357
|
+
S(this, "marks"), S(this, "nodes"), r || (r = dn), this.marks = r.marks || [], this.nodes = r.nodes || [];
|
|
358
358
|
}
|
|
359
|
-
addNode(
|
|
360
|
-
this.nodes[
|
|
359
|
+
addNode(r, e) {
|
|
360
|
+
this.nodes[r] = e;
|
|
361
361
|
}
|
|
362
|
-
addMark(
|
|
363
|
-
this.marks[
|
|
362
|
+
addMark(r, e) {
|
|
363
|
+
this.marks[r] = e;
|
|
364
364
|
}
|
|
365
|
-
render(
|
|
366
|
-
if (
|
|
367
|
-
let
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
}),
|
|
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,195 +396,197 @@ class hn {
|
|
|
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
|
-
let
|
|
424
|
-
return
|
|
423
|
+
let O = "";
|
|
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 mn = (o,
|
|
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
|
-
}, vn = (o) => !o || !(o != null && o.content.some((
|
|
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 vn(o) ? "" : (
|
|
525
|
-
}, xn = () => Nr(
|
|
524
|
+
return vn(o) ? "" : (r && (i = new hn(r.schema), r.resolver && mn(i, r.resolver)), i.render(o));
|
|
525
|
+
}, xn = () => Nr(bn);
|
|
526
526
|
function wn(o) {
|
|
527
|
-
let
|
|
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
|
|
545
|
+
var X = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
544
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 dt = typeof
|
|
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
556
|
var t = z && z.require && z.require("util").types;
|
|
555
|
-
return t ||
|
|
557
|
+
return t || Q && Q.binding && Q.binding("util");
|
|
556
558
|
} catch {
|
|
557
559
|
}
|
|
558
|
-
}(),
|
|
559
|
-
function ge(t, n,
|
|
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
574
|
function he(t, n) {
|
|
573
|
-
for (var
|
|
574
|
-
c[
|
|
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
|
};
|
|
581
583
|
}
|
|
582
|
-
function
|
|
584
|
+
function be(t, n) {
|
|
583
585
|
return t == null ? void 0 : t[n];
|
|
584
586
|
}
|
|
585
587
|
function me(t, n) {
|
|
586
|
-
return function(
|
|
587
|
-
return t(n(
|
|
588
|
+
return function(a) {
|
|
589
|
+
return t(n(a));
|
|
588
590
|
};
|
|
589
591
|
}
|
|
590
592
|
var ve = Array.prototype, _e = Function.prototype, H = Object.prototype, tt = N["__core-js_shared__"], q = _e.toString, C = H.hasOwnProperty, mt = function() {
|
|
@@ -607,13 +609,13 @@ 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
616
|
function x(t) {
|
|
615
|
-
var n = -1,
|
|
616
|
-
for (this.clear(); ++n <
|
|
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
|
}
|
|
@@ -628,8 +630,8 @@ Q.exports;
|
|
|
628
630
|
function $e(t) {
|
|
629
631
|
var n = this.__data__;
|
|
630
632
|
if (L) {
|
|
631
|
-
var
|
|
632
|
-
return
|
|
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
|
}
|
|
@@ -638,13 +640,13 @@ Q.exports;
|
|
|
638
640
|
return L ? n[t] !== void 0 : C.call(n, t);
|
|
639
641
|
}
|
|
640
642
|
function Ee(t, n) {
|
|
641
|
-
var
|
|
642
|
-
return this.size += this.has(t) ? 0 : 1,
|
|
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
646
|
x.prototype.clear = Ce, x.prototype.delete = je, x.prototype.get = $e, x.prototype.has = xe, x.prototype.set = Ee;
|
|
645
647
|
function j(t) {
|
|
646
|
-
var n = -1,
|
|
647
|
-
for (this.clear(); ++n <
|
|
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
|
}
|
|
@@ -653,27 +655,27 @@ Q.exports;
|
|
|
653
655
|
this.__data__ = [], this.size = 0;
|
|
654
656
|
}
|
|
655
657
|
function Pe(t) {
|
|
656
|
-
var n = this.__data__,
|
|
657
|
-
if (
|
|
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
|
|
662
|
+
return a == c ? n.pop() : Ae.call(n, a, 1), --this.size, !0;
|
|
661
663
|
}
|
|
662
664
|
function Me(t) {
|
|
663
|
-
var n = this.__data__,
|
|
664
|
-
return
|
|
665
|
+
var n = this.__data__, a = K(n, t);
|
|
666
|
+
return a < 0 ? void 0 : n[a][1];
|
|
665
667
|
}
|
|
666
668
|
function Ne(t) {
|
|
667
669
|
return K(this.__data__, t) > -1;
|
|
668
670
|
}
|
|
669
671
|
function ze(t, n) {
|
|
670
|
-
var
|
|
671
|
-
return c < 0 ? (++this.size,
|
|
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
|
}
|
|
@@ -685,21 +687,21 @@ Q.exports;
|
|
|
685
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
|
-
function
|
|
694
|
+
function Ue(t) {
|
|
693
695
|
return Y(this, t).get(t);
|
|
694
696
|
}
|
|
695
697
|
function Be(t) {
|
|
696
698
|
return Y(this, t).has(t);
|
|
697
699
|
}
|
|
698
700
|
function Fe(t, n) {
|
|
699
|
-
var
|
|
700
|
-
return
|
|
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 = Le, R.prototype.delete =
|
|
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
706
|
var n = this.__data__ = new j(t);
|
|
705
707
|
this.size = n.size;
|
|
@@ -708,8 +710,8 @@ Q.exports;
|
|
|
708
710
|
this.__data__ = new j(), this.size = 0;
|
|
709
711
|
}
|
|
710
712
|
function qe(t) {
|
|
711
|
-
var n = this.__data__,
|
|
712
|
-
return this.size = n.size,
|
|
713
|
+
var n = this.__data__, a = n.delete(t);
|
|
714
|
+
return this.size = n.size, a;
|
|
713
715
|
}
|
|
714
716
|
function Ge(t) {
|
|
715
717
|
return this.__data__.get(t);
|
|
@@ -718,96 +720,96 @@ Q.exports;
|
|
|
718
720
|
return this.__data__.has(t);
|
|
719
721
|
}
|
|
720
722
|
function Ke(t, n) {
|
|
721
|
-
var
|
|
722
|
-
if (
|
|
723
|
-
var c =
|
|
724
|
-
if (!St || c.length <
|
|
725
|
-
return c.push([t, n]), this.size = ++
|
|
726
|
-
|
|
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);
|
|
727
729
|
}
|
|
728
|
-
return
|
|
730
|
+
return a.set(t, n), this.size = a.size, this;
|
|
729
731
|
}
|
|
730
732
|
P.prototype.clear = He, P.prototype.delete = qe, P.prototype.get = Ge, P.prototype.has = Je, P.prototype.set = Ke;
|
|
731
733
|
function We(t, n) {
|
|
732
|
-
var
|
|
733
|
-
for (var
|
|
734
|
-
(n || C.call(t,
|
|
735
|
-
(
|
|
736
|
-
d && (
|
|
737
|
-
h && (
|
|
738
|
-
jt(
|
|
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);
|
|
739
741
|
return p;
|
|
740
742
|
}
|
|
741
|
-
function et(t, n,
|
|
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);
|
|
743
745
|
}
|
|
744
|
-
function Ye(t, n,
|
|
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 ?
|
|
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
|
-
function
|
|
771
|
+
function Xe(t) {
|
|
770
772
|
if (!E(t) || gr(t))
|
|
771
773
|
return !1;
|
|
772
774
|
var n = lt(t) ? Te : fe;
|
|
773
775
|
return n.test(_r(t));
|
|
774
776
|
}
|
|
775
|
-
function
|
|
776
|
-
return
|
|
777
|
+
function Ze(t) {
|
|
778
|
+
return D(t) && Et(t.length) && !!y[W(t)];
|
|
777
779
|
}
|
|
778
|
-
function
|
|
780
|
+
function Qe(t) {
|
|
779
781
|
if (!E(t))
|
|
780
782
|
return hr(t);
|
|
781
|
-
var n = $t(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
|
+
function Ct(t, n, a, c, d) {
|
|
789
|
+
t !== n && Ve(n, function(h, m) {
|
|
788
790
|
if (d || (d = new P()), E(h))
|
|
789
|
-
tr(t, n,
|
|
791
|
+
tr(t, n, m, a, Ct, c, d);
|
|
790
792
|
else {
|
|
791
|
-
var p = c ? c(ot(t,
|
|
792
|
-
p === void 0 && (p = h), et(t,
|
|
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 tr(t, n,
|
|
797
|
-
var p = ot(t,
|
|
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
811
|
function er(t, n) {
|
|
810
|
-
return mr(
|
|
812
|
+
return mr(br(t, n, Mt), t + "");
|
|
811
813
|
}
|
|
812
814
|
var rr = J ? function(t, n) {
|
|
813
815
|
return J(t, "toString", {
|
|
@@ -820,82 +822,82 @@ Q.exports;
|
|
|
820
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
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 ir(t, n) {
|
|
831
|
-
var i = n ? or(t.buffer) : t.buffer;
|
|
832
|
-
return new t.constructor(i, t.byteOffset, t.length);
|
|
833
|
-
}
|
|
834
832
|
function ar(t, n) {
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
|
|
833
|
+
var a = n ? or(t.buffer) : t.buffer;
|
|
834
|
+
return new t.constructor(a, t.byteOffset, t.length);
|
|
835
|
+
}
|
|
836
|
+
function ir(t, 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 sr(t, n,
|
|
841
|
-
var d = !
|
|
842
|
-
|
|
843
|
-
for (var h = -1,
|
|
844
|
-
var p = n[h],
|
|
845
|
-
|
|
842
|
+
function sr(t, n, a, c) {
|
|
843
|
+
var d = !a;
|
|
844
|
+
a || (a = {});
|
|
845
|
+
for (var h = -1, m = n.length; ++h < m; ) {
|
|
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
|
|
849
|
+
return a;
|
|
848
850
|
}
|
|
849
851
|
function lr(t) {
|
|
850
|
-
return er(function(n,
|
|
851
|
-
var c = -1, d =
|
|
852
|
-
for (h = t.length > 3 && typeof h == "function" ? (d--, h) : void 0,
|
|
853
|
-
var p =
|
|
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];
|
|
854
856
|
p && t(n, p, c, h);
|
|
855
857
|
}
|
|
856
858
|
return n;
|
|
857
859
|
});
|
|
858
860
|
}
|
|
859
861
|
function cr(t) {
|
|
860
|
-
return function(n,
|
|
861
|
-
for (var d = -1, h = Object(n),
|
|
862
|
-
var
|
|
863
|
-
if (
|
|
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
|
|
876
|
+
var a = be(t, n);
|
|
877
|
+
return Xe(a) ? a : void 0;
|
|
876
878
|
}
|
|
877
879
|
function ur(t) {
|
|
878
|
-
var n = C.call(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
886
|
var d = vt.call(t);
|
|
885
|
-
return c && (n ? t[$] =
|
|
887
|
+
return c && (n ? t[$] = a : delete t[$]), d;
|
|
886
888
|
}
|
|
887
889
|
function fr(t) {
|
|
888
890
|
return typeof t.constructor == "function" && !$t(t) ? Oe(kt(t)) : {};
|
|
889
891
|
}
|
|
890
892
|
function jt(t, n) {
|
|
891
|
-
var
|
|
892
|
-
return n = n ?? u, !!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 pr(t, n,
|
|
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;
|
|
@@ -905,27 +907,27 @@ Q.exports;
|
|
|
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
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
|
|
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, d = -1, h = It(c.length - n, 0),
|
|
924
|
-
|
|
925
|
+
for (var c = arguments, d = -1, h = It(c.length - n, 0), m = Array(h); ++d < h; )
|
|
926
|
+
m[d] = c[n + d];
|
|
925
927
|
d = -1;
|
|
926
928
|
for (var p = Array(n + 1); ++d < n; )
|
|
927
929
|
p[d] = c[d];
|
|
928
|
-
return p[n] =
|
|
930
|
+
return p[n] = a(m), ge(t, this, p);
|
|
929
931
|
};
|
|
930
932
|
}
|
|
931
933
|
function ot(t, n) {
|
|
@@ -934,10 +936,10 @@ Q.exports;
|
|
|
934
936
|
}
|
|
935
937
|
var mr = vr(rr);
|
|
936
938
|
function vr(t) {
|
|
937
|
-
var n = 0,
|
|
939
|
+
var n = 0, a = 0;
|
|
938
940
|
return function() {
|
|
939
|
-
var c = Se(), d = l - (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
|
|
@@ -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
974
|
function wr(t) {
|
|
973
|
-
return
|
|
975
|
+
return D(t) && st(t);
|
|
974
976
|
}
|
|
975
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 ==
|
|
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,27 +988,27 @@ 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
994
|
function Tr(t) {
|
|
993
|
-
if (!
|
|
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 =
|
|
1003
|
+
var Rt = bt ? ye(bt) : Ze;
|
|
1002
1004
|
function kr(t) {
|
|
1003
1005
|
return sr(t, Pt(t));
|
|
1004
1006
|
}
|
|
1005
1007
|
function Pt(t) {
|
|
1006
|
-
return st(t) ? We(t, !0) :
|
|
1008
|
+
return st(t) ? We(t, !0) : Qe(t);
|
|
1007
1009
|
}
|
|
1008
|
-
var Ar = lr(function(t, n,
|
|
1009
|
-
Ct(t, n,
|
|
1010
|
+
var Ar = lr(function(t, n, a, c) {
|
|
1011
|
+
Ct(t, n, a, c);
|
|
1010
1012
|
});
|
|
1011
1013
|
function Ir(t) {
|
|
1012
1014
|
return function() {
|
|
@@ -1020,75 +1022,85 @@ Q.exports;
|
|
|
1020
1022
|
return !1;
|
|
1021
1023
|
}
|
|
1022
1024
|
o.exports = Ar;
|
|
1023
|
-
})(
|
|
1024
|
-
var kn =
|
|
1025
|
+
})(Z, Z.exports);
|
|
1026
|
+
var kn = Z.exports;
|
|
1025
1027
|
const An = /* @__PURE__ */ Tn(kn);
|
|
1026
1028
|
function In(o) {
|
|
1027
|
-
let
|
|
1028
|
-
function
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
apiOptions: A
|
|
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
|
|
1037
1038
|
};
|
|
1038
1039
|
}
|
|
1039
|
-
if (
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
...
|
|
1043
|
-
bridgeOptions:
|
|
1040
|
+
if (l && l[2].type === "ObjectExpression") {
|
|
1041
|
+
const u = Ht(l[2].properties);
|
|
1042
|
+
r = {
|
|
1043
|
+
...r,
|
|
1044
|
+
bridgeOptions: u
|
|
1044
1045
|
};
|
|
1045
1046
|
}
|
|
1046
1047
|
}
|
|
1047
1048
|
}
|
|
1048
|
-
return An({}, o,
|
|
1049
|
+
return An({}, o, e), r;
|
|
1049
1050
|
}
|
|
1050
1051
|
function Ht(o) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
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);
|
|
1055
1067
|
}
|
|
1056
1068
|
let B = [];
|
|
1057
|
-
function Sn(o,
|
|
1058
|
-
const
|
|
1059
|
-
if (!o ||
|
|
1069
|
+
function Sn(o, r) {
|
|
1070
|
+
const e = "virtual:storyblok-bridge", i = "\0" + e;
|
|
1071
|
+
if (!o || r !== "server")
|
|
1060
1072
|
return {
|
|
1061
1073
|
name: "vite-plugin-storyblok-bridge",
|
|
1062
1074
|
resolveId(f) {
|
|
1063
|
-
if (f ===
|
|
1064
|
-
return
|
|
1075
|
+
if (f === e)
|
|
1076
|
+
return i;
|
|
1065
1077
|
},
|
|
1066
1078
|
load(f) {
|
|
1067
|
-
if (f ===
|
|
1079
|
+
if (f === i)
|
|
1068
1080
|
return "export const bridgeOptions = null";
|
|
1069
1081
|
}
|
|
1070
1082
|
};
|
|
1071
|
-
let s = [], l = null, u
|
|
1083
|
+
let s = [], l = null, u;
|
|
1072
1084
|
return {
|
|
1073
1085
|
name: "vite-plugin-storyblok-bridge",
|
|
1074
1086
|
async resolveId(f) {
|
|
1075
|
-
if (f ===
|
|
1076
|
-
return
|
|
1087
|
+
if (f === e)
|
|
1088
|
+
return i;
|
|
1077
1089
|
},
|
|
1078
1090
|
async transform(f, g) {
|
|
1079
|
-
var
|
|
1080
|
-
if (g.includes("node_modules") && !g.includes("/pages/") || !f.includes("useStoryblok") || !((
|
|
1091
|
+
var O;
|
|
1092
|
+
if (g.includes("node_modules") && !g.includes("/pages/") || !f.includes("useStoryblok") || !((O = this.getModuleInfo(g).meta) != null && O.astro))
|
|
1081
1093
|
return;
|
|
1082
|
-
const [, ..._] = g.split("src/pages/"),
|
|
1083
|
-
B.length && (s = B.filter((
|
|
1084
|
-
url:
|
|
1085
|
-
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
|
|
1086
1098
|
}), l && (u && clearTimeout(u), u = setTimeout(() => {
|
|
1087
|
-
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]);
|
|
1088
1100
|
}, 1e3));
|
|
1089
1101
|
},
|
|
1090
1102
|
async load(f) {
|
|
1091
|
-
if (f ===
|
|
1103
|
+
if (f === i)
|
|
1092
1104
|
return `export const bridgeOptions = ${JSON.stringify(wn(s))}`;
|
|
1093
1105
|
},
|
|
1094
1106
|
configureServer(f) {
|
|
@@ -1096,38 +1108,38 @@ function Sn(o, e) {
|
|
|
1096
1108
|
}
|
|
1097
1109
|
};
|
|
1098
1110
|
}
|
|
1099
|
-
function On(o = [],
|
|
1100
|
-
return
|
|
1101
|
-
const s = o.find((l) => (l == null ? void 0 : l.url) ===
|
|
1102
|
-
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);
|
|
1103
1115
|
});
|
|
1104
1116
|
}
|
|
1105
1117
|
let qt;
|
|
1106
1118
|
async function En(o) {
|
|
1107
|
-
const { action:
|
|
1108
|
-
if (
|
|
1109
|
-
const
|
|
1110
|
-
const l = await jn(
|
|
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;
|
|
1111
1123
|
if (l.outerHTML === u.outerHTML)
|
|
1112
1124
|
return;
|
|
1113
1125
|
const f = document.querySelector('[data-blok-focused="true"]');
|
|
1114
1126
|
Cn(u, l, f);
|
|
1115
1127
|
};
|
|
1116
|
-
clearTimeout(qt), qt = setTimeout(
|
|
1128
|
+
clearTimeout(qt), qt = setTimeout(i, 500);
|
|
1117
1129
|
}
|
|
1118
1130
|
["published", "change"].includes(o == null ? void 0 : o.action) && location.reload();
|
|
1119
1131
|
}
|
|
1120
|
-
function Cn(o,
|
|
1121
|
-
if (
|
|
1122
|
-
const
|
|
1123
|
-
`[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}"]`
|
|
1124
1136
|
);
|
|
1125
|
-
s && (s.setAttribute("data-blok-focused", "true"),
|
|
1137
|
+
s && (s.setAttribute("data-blok-focused", "true"), e.replaceWith(s));
|
|
1126
1138
|
} else
|
|
1127
|
-
o.replaceWith(
|
|
1139
|
+
o.replaceWith(r);
|
|
1128
1140
|
}
|
|
1129
1141
|
async function jn(o) {
|
|
1130
|
-
const
|
|
1142
|
+
const e = await (await fetch(location.href, {
|
|
1131
1143
|
method: "POST",
|
|
1132
1144
|
body: JSON.stringify({
|
|
1133
1145
|
...o,
|
|
@@ -1137,38 +1149,38 @@ async function jn(o) {
|
|
|
1137
1149
|
"Content-Type": "application/json"
|
|
1138
1150
|
}
|
|
1139
1151
|
})).text();
|
|
1140
|
-
return new DOMParser().parseFromString(
|
|
1152
|
+
return new DOMParser().parseFromString(e, "text/html").body;
|
|
1141
1153
|
}
|
|
1142
1154
|
function Rn() {
|
|
1143
1155
|
return globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly"), globalThis.storyblokApiInstance;
|
|
1144
1156
|
}
|
|
1145
|
-
async function Pn(o,
|
|
1157
|
+
async function Pn(o, r = {}, e = {}, i) {
|
|
1146
1158
|
globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly");
|
|
1147
1159
|
let s = null;
|
|
1148
|
-
if (
|
|
1149
|
-
s =
|
|
1160
|
+
if (i && i.locals._storyblok_preview_data)
|
|
1161
|
+
s = i.locals._storyblok_preview_data;
|
|
1150
1162
|
else {
|
|
1151
1163
|
const { data: l } = await globalThis.storyblokApiInstance.get(
|
|
1152
1164
|
o,
|
|
1153
|
-
|
|
1154
|
-
|
|
1165
|
+
r,
|
|
1166
|
+
e
|
|
1155
1167
|
);
|
|
1156
1168
|
s = l.story;
|
|
1157
1169
|
}
|
|
1158
1170
|
return s;
|
|
1159
1171
|
}
|
|
1160
|
-
function Mn(o,
|
|
1161
|
-
const
|
|
1162
|
-
if (!
|
|
1172
|
+
function Mn(o, r) {
|
|
1173
|
+
const e = globalThis.storyblokApiInstance.richTextResolver;
|
|
1174
|
+
if (!e) {
|
|
1163
1175
|
console.error(
|
|
1164
1176
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
1165
1177
|
);
|
|
1166
1178
|
return;
|
|
1167
1179
|
}
|
|
1168
|
-
return _n(o,
|
|
1180
|
+
return _n(o, r, e);
|
|
1169
1181
|
}
|
|
1170
1182
|
function Nn(o) {
|
|
1171
|
-
const
|
|
1183
|
+
const r = {
|
|
1172
1184
|
useCustomApi: !1,
|
|
1173
1185
|
bridge: !0,
|
|
1174
1186
|
componentsDir: "src",
|
|
@@ -1180,53 +1192,53 @@ function Nn(o) {
|
|
|
1180
1192
|
name: "@storyblok/astro",
|
|
1181
1193
|
hooks: {
|
|
1182
1194
|
"astro:config:setup": ({
|
|
1183
|
-
injectScript:
|
|
1184
|
-
updateConfig:
|
|
1195
|
+
injectScript: e,
|
|
1196
|
+
updateConfig: i,
|
|
1185
1197
|
addDevToolbarApp: s,
|
|
1186
1198
|
addMiddleware: l,
|
|
1187
1199
|
config: u
|
|
1188
1200
|
}) => {
|
|
1189
|
-
if (
|
|
1201
|
+
if (i({
|
|
1190
1202
|
vite: {
|
|
1191
1203
|
plugins: [
|
|
1192
1204
|
Or(
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1205
|
+
r.accessToken,
|
|
1206
|
+
r.useCustomApi,
|
|
1207
|
+
r.apiOptions
|
|
1196
1208
|
),
|
|
1197
1209
|
Pr(
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1210
|
+
r.componentsDir,
|
|
1211
|
+
r.components,
|
|
1212
|
+
r.enableFallbackComponent,
|
|
1213
|
+
r.customFallbackComponent
|
|
1202
1214
|
),
|
|
1203
|
-
Mr(
|
|
1215
|
+
Mr(r),
|
|
1204
1216
|
Sn(
|
|
1205
|
-
|
|
1217
|
+
r.livePreview,
|
|
1206
1218
|
u.output
|
|
1207
1219
|
)
|
|
1208
1220
|
]
|
|
1209
1221
|
}
|
|
1210
|
-
}),
|
|
1222
|
+
}), r.livePreview && (u == null ? void 0 : u.output) !== "server")
|
|
1211
1223
|
throw new Error(
|
|
1212
|
-
"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."
|
|
1213
1225
|
);
|
|
1214
|
-
if (
|
|
1226
|
+
if (e(
|
|
1215
1227
|
"page-ssr",
|
|
1216
1228
|
`
|
|
1217
1229
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
1218
1230
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
1219
1231
|
`
|
|
1220
|
-
),
|
|
1232
|
+
), r.bridge && !r.livePreview) {
|
|
1221
1233
|
let f = "";
|
|
1222
|
-
if (typeof
|
|
1223
|
-
const g = { ...
|
|
1234
|
+
if (typeof r.bridge == "object") {
|
|
1235
|
+
const g = { ...r.bridge };
|
|
1224
1236
|
f = `const storyblokInstance = new StoryblokBridge(${JSON.stringify(
|
|
1225
1237
|
g
|
|
1226
1238
|
)});`;
|
|
1227
1239
|
} else
|
|
1228
1240
|
f = "const storyblokInstance = new StoryblokBridge()";
|
|
1229
|
-
|
|
1241
|
+
e(
|
|
1230
1242
|
"page",
|
|
1231
1243
|
`
|
|
1232
1244
|
import { loadStoryblokBridge } from "@storyblok/astro";
|
|
@@ -1243,7 +1255,7 @@ function Nn(o) {
|
|
|
1243
1255
|
`
|
|
1244
1256
|
);
|
|
1245
1257
|
}
|
|
1246
|
-
|
|
1258
|
+
r.livePreview && (e(
|
|
1247
1259
|
"page",
|
|
1248
1260
|
`
|
|
1249
1261
|
import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|