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