@storyblok/vue 8.2.1 → 8.2.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 +6 -6
- package/dist/storyblok-vue.js +3 -3
- package/dist/storyblok-vue.mjs +397 -391
- package/package.json +2 -2
package/dist/storyblok-vue.mjs
CHANGED
|
@@ -4,36 +4,36 @@
|
|
|
4
4
|
* description: SDK to integrate Storyblok into your project using Vue.
|
|
5
5
|
* author: Storyblok
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent as
|
|
8
|
-
let
|
|
9
|
-
const
|
|
7
|
+
import { defineComponent as Y, ref as P, resolveDynamicComponent as D, inject as de, createBlock as W, openBlock as X, mergeProps as pe, h as Q, createTextVNode as ge, watch as fe, onMounted as me, defineAsyncComponent as ye } from "vue";
|
|
8
|
+
let F = !1;
|
|
9
|
+
const q = [], be = (s) => new Promise((e, t) => {
|
|
10
10
|
if (typeof window > "u" || (window.storyblokRegisterEvent = (o) => {
|
|
11
11
|
if (window.location === window.parent.location) {
|
|
12
12
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
F ? o() : q.push(o);
|
|
16
16
|
}, document.getElementById("storyblok-javascript-bridge")))
|
|
17
17
|
return;
|
|
18
18
|
const r = document.createElement("script");
|
|
19
19
|
r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (o) => t(o), r.onload = (o) => {
|
|
20
|
-
|
|
20
|
+
q.forEach((n) => n()), F = !0, e(o);
|
|
21
21
|
}, document.getElementsByTagName("head")[0].appendChild(r);
|
|
22
22
|
});
|
|
23
|
-
var
|
|
24
|
-
class
|
|
23
|
+
var ke = Object.defineProperty, ve = (s, e, t) => e in s ? ke(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, m = (s, e, t) => ve(s, typeof e != "symbol" ? e + "" : e, t);
|
|
24
|
+
class $e extends Error {
|
|
25
25
|
constructor(e) {
|
|
26
26
|
super(e), this.name = "AbortError";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Te(s, e, t) {
|
|
30
30
|
if (!Number.isFinite(e))
|
|
31
31
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
32
32
|
if (!Number.isFinite(t))
|
|
33
33
|
throw new TypeError("Expected `interval` to be a finite number");
|
|
34
34
|
const r = [];
|
|
35
35
|
let o = [], n = 0, a = !1;
|
|
36
|
-
const
|
|
36
|
+
const i = async () => {
|
|
37
37
|
n++;
|
|
38
38
|
const h = r.shift();
|
|
39
39
|
if (h)
|
|
@@ -44,10 +44,10 @@ function ve(s, e, t) {
|
|
|
44
44
|
h.reject(p);
|
|
45
45
|
}
|
|
46
46
|
const d = setTimeout(() => {
|
|
47
|
-
n--, r.length > 0 &&
|
|
47
|
+
n--, r.length > 0 && i(), o = o.filter((p) => p !== d);
|
|
48
48
|
}, t);
|
|
49
49
|
o.includes(d) || o.push(d);
|
|
50
|
-
},
|
|
50
|
+
}, l = (...h) => a ? Promise.reject(
|
|
51
51
|
new Error(
|
|
52
52
|
"Throttled function is already aborted and not accepting new promises"
|
|
53
53
|
)
|
|
@@ -56,24 +56,24 @@ function ve(s, e, t) {
|
|
|
56
56
|
resolve: d,
|
|
57
57
|
reject: p,
|
|
58
58
|
args: h
|
|
59
|
-
}), n < e &&
|
|
59
|
+
}), n < e && i();
|
|
60
60
|
});
|
|
61
|
-
return
|
|
61
|
+
return l.abort = () => {
|
|
62
62
|
a = !0, o.forEach(clearTimeout), o = [], r.forEach(
|
|
63
|
-
(h) => h.reject(() => new
|
|
63
|
+
(h) => h.reject(() => new $e("Throttle function aborted"))
|
|
64
64
|
), r.length = 0;
|
|
65
|
-
},
|
|
65
|
+
}, l;
|
|
66
66
|
}
|
|
67
|
-
class
|
|
67
|
+
class N {
|
|
68
68
|
constructor() {
|
|
69
|
-
|
|
69
|
+
m(this, "isCDNUrl", (e = "") => e.includes("/cdn/")), m(this, "getOptionsPage", (e, t = 25, r = 1) => ({
|
|
70
70
|
...e,
|
|
71
71
|
per_page: t,
|
|
72
72
|
page: r
|
|
73
|
-
})),
|
|
73
|
+
})), m(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), m(this, "arrayFrom", (e = 0, t) => Array.from({ length: e }, t)), m(this, "range", (e = 0, t = e) => {
|
|
74
74
|
const r = Math.abs(t - e) || 0, o = e < t ? 1 : -1;
|
|
75
75
|
return this.arrayFrom(r, (n, a) => a * o + e);
|
|
76
|
-
}),
|
|
76
|
+
}), m(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), m(this, "flatMap", (e = [], t) => e.map(t).reduce((r, o) => [...r, ...o], [])), m(this, "escapeHTML", function(e) {
|
|
77
77
|
const t = {
|
|
78
78
|
"&": "&",
|
|
79
79
|
"<": "<",
|
|
@@ -99,13 +99,13 @@ class P {
|
|
|
99
99
|
const a = e[n];
|
|
100
100
|
if (a == null)
|
|
101
101
|
continue;
|
|
102
|
-
const
|
|
103
|
-
let
|
|
104
|
-
typeof a == "object" ?
|
|
102
|
+
const i = r ? "" : encodeURIComponent(n);
|
|
103
|
+
let l;
|
|
104
|
+
typeof a == "object" ? l = this.stringify(
|
|
105
105
|
a,
|
|
106
|
-
t ? t + encodeURIComponent(`[${
|
|
106
|
+
t ? t + encodeURIComponent(`[${i}]`) : i,
|
|
107
107
|
Array.isArray(a)
|
|
108
|
-
) :
|
|
108
|
+
) : l = `${t ? t + encodeURIComponent(`[${i}]`) : i}=${encodeURIComponent(a)}`, o.push(l);
|
|
109
109
|
}
|
|
110
110
|
return o.join("&");
|
|
111
111
|
}
|
|
@@ -130,20 +130,20 @@ class P {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const we = function(s, e) {
|
|
134
134
|
const t = {};
|
|
135
135
|
for (const r in s) {
|
|
136
136
|
const o = s[r];
|
|
137
137
|
e.includes(r) && o !== null && (t[r] = o);
|
|
138
138
|
}
|
|
139
139
|
return t;
|
|
140
|
-
},
|
|
140
|
+
}, Re = (s) => s === "email", _e = () => ({
|
|
141
141
|
singleTag: "hr"
|
|
142
|
-
}),
|
|
142
|
+
}), Se = () => ({
|
|
143
143
|
tag: "blockquote"
|
|
144
|
-
}),
|
|
144
|
+
}), Ee = () => ({
|
|
145
145
|
tag: "ul"
|
|
146
|
-
}),
|
|
146
|
+
}), xe = (s) => ({
|
|
147
147
|
tag: [
|
|
148
148
|
"pre",
|
|
149
149
|
{
|
|
@@ -151,24 +151,24 @@ const $e = function(s, e) {
|
|
|
151
151
|
attrs: s.attrs
|
|
152
152
|
}
|
|
153
153
|
]
|
|
154
|
-
}),
|
|
154
|
+
}), je = () => ({
|
|
155
155
|
singleTag: "br"
|
|
156
|
-
}), je = (s) => ({
|
|
157
|
-
tag: `h${s.attrs.level}`
|
|
158
156
|
}), Ae = (s) => ({
|
|
157
|
+
tag: `h${s.attrs.level}`
|
|
158
|
+
}), Ie = (s) => ({
|
|
159
159
|
singleTag: [
|
|
160
160
|
{
|
|
161
161
|
tag: "img",
|
|
162
|
-
attrs:
|
|
162
|
+
attrs: we(s.attrs, ["src", "alt", "title"])
|
|
163
163
|
}
|
|
164
164
|
]
|
|
165
|
-
}),
|
|
165
|
+
}), Ce = () => ({
|
|
166
166
|
tag: "li"
|
|
167
|
-
}),
|
|
167
|
+
}), Le = () => ({
|
|
168
168
|
tag: "ol"
|
|
169
|
-
}),
|
|
169
|
+
}), Oe = () => ({
|
|
170
170
|
tag: "p"
|
|
171
|
-
}),
|
|
171
|
+
}), Pe = (s) => ({
|
|
172
172
|
tag: [
|
|
173
173
|
{
|
|
174
174
|
tag: "span",
|
|
@@ -179,25 +179,25 @@ const $e = function(s, e) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
]
|
|
182
|
-
}),
|
|
182
|
+
}), Ne = () => ({
|
|
183
183
|
tag: "b"
|
|
184
|
-
}),
|
|
184
|
+
}), Me = () => ({
|
|
185
185
|
tag: "s"
|
|
186
|
-
}),
|
|
186
|
+
}), He = () => ({
|
|
187
187
|
tag: "u"
|
|
188
|
-
}),
|
|
188
|
+
}), De = () => ({
|
|
189
189
|
tag: "strong"
|
|
190
|
-
}),
|
|
190
|
+
}), Ue = () => ({
|
|
191
191
|
tag: "code"
|
|
192
|
-
}),
|
|
192
|
+
}), Be = () => ({
|
|
193
193
|
tag: "i"
|
|
194
|
-
}),
|
|
194
|
+
}), ze = (s) => {
|
|
195
195
|
if (!s.attrs)
|
|
196
196
|
return {
|
|
197
197
|
tag: ""
|
|
198
198
|
};
|
|
199
|
-
const e = new
|
|
200
|
-
if (delete t.linktype, t.href && (t.href = e(s.attrs.href || "")),
|
|
199
|
+
const e = new N().escapeHTML, t = { ...s.attrs }, { linktype: r = "url" } = s.attrs;
|
|
200
|
+
if (delete t.linktype, t.href && (t.href = e(s.attrs.href || "")), Re(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
|
|
201
201
|
for (const o in t.custom)
|
|
202
202
|
t[o] = t.custom[o];
|
|
203
203
|
delete t.custom;
|
|
@@ -210,25 +210,25 @@ const $e = function(s, e) {
|
|
|
210
210
|
}
|
|
211
211
|
]
|
|
212
212
|
};
|
|
213
|
-
},
|
|
213
|
+
}, Fe = (s) => ({
|
|
214
214
|
tag: [
|
|
215
215
|
{
|
|
216
216
|
tag: "span",
|
|
217
217
|
attrs: s.attrs
|
|
218
218
|
}
|
|
219
219
|
]
|
|
220
|
-
}),
|
|
220
|
+
}), qe = () => ({
|
|
221
221
|
tag: "sub"
|
|
222
|
-
}),
|
|
222
|
+
}), Ve = () => ({
|
|
223
223
|
tag: "sup"
|
|
224
|
-
}),
|
|
224
|
+
}), Ge = (s) => ({
|
|
225
225
|
tag: [
|
|
226
226
|
{
|
|
227
227
|
tag: "span",
|
|
228
228
|
attrs: s.attrs
|
|
229
229
|
}
|
|
230
230
|
]
|
|
231
|
-
}),
|
|
231
|
+
}), Ke = (s) => {
|
|
232
232
|
var e;
|
|
233
233
|
return (e = s.attrs) != null && e.color ? {
|
|
234
234
|
tag: [
|
|
@@ -242,7 +242,7 @@ const $e = function(s, e) {
|
|
|
242
242
|
} : {
|
|
243
243
|
tag: ""
|
|
244
244
|
};
|
|
245
|
-
},
|
|
245
|
+
}, Je = (s) => {
|
|
246
246
|
var e;
|
|
247
247
|
return (e = s.attrs) != null && e.color ? {
|
|
248
248
|
tag: [
|
|
@@ -256,36 +256,36 @@ const $e = function(s, e) {
|
|
|
256
256
|
} : {
|
|
257
257
|
tag: ""
|
|
258
258
|
};
|
|
259
|
-
},
|
|
259
|
+
}, Ye = {
|
|
260
260
|
nodes: {
|
|
261
|
-
horizontal_rule:
|
|
262
|
-
blockquote:
|
|
263
|
-
bullet_list:
|
|
264
|
-
code_block:
|
|
265
|
-
hard_break:
|
|
266
|
-
heading:
|
|
267
|
-
image:
|
|
268
|
-
list_item:
|
|
269
|
-
ordered_list:
|
|
270
|
-
paragraph:
|
|
271
|
-
emoji:
|
|
261
|
+
horizontal_rule: _e,
|
|
262
|
+
blockquote: Se,
|
|
263
|
+
bullet_list: Ee,
|
|
264
|
+
code_block: xe,
|
|
265
|
+
hard_break: je,
|
|
266
|
+
heading: Ae,
|
|
267
|
+
image: Ie,
|
|
268
|
+
list_item: Ce,
|
|
269
|
+
ordered_list: Le,
|
|
270
|
+
paragraph: Oe,
|
|
271
|
+
emoji: Pe
|
|
272
272
|
},
|
|
273
273
|
marks: {
|
|
274
|
-
bold:
|
|
275
|
-
strike:
|
|
276
|
-
underline:
|
|
277
|
-
strong:
|
|
278
|
-
code:
|
|
279
|
-
italic:
|
|
280
|
-
link:
|
|
281
|
-
styled:
|
|
282
|
-
subscript:
|
|
283
|
-
superscript:
|
|
284
|
-
anchor:
|
|
285
|
-
highlight:
|
|
286
|
-
textStyle:
|
|
287
|
-
}
|
|
288
|
-
},
|
|
274
|
+
bold: Ne,
|
|
275
|
+
strike: Me,
|
|
276
|
+
underline: He,
|
|
277
|
+
strong: De,
|
|
278
|
+
code: Ue,
|
|
279
|
+
italic: Be,
|
|
280
|
+
link: ze,
|
|
281
|
+
styled: Fe,
|
|
282
|
+
subscript: qe,
|
|
283
|
+
superscript: Ve,
|
|
284
|
+
anchor: Ge,
|
|
285
|
+
highlight: Ke,
|
|
286
|
+
textStyle: Je
|
|
287
|
+
}
|
|
288
|
+
}, We = function(s) {
|
|
289
289
|
const e = {
|
|
290
290
|
"&": "&",
|
|
291
291
|
"<": "<",
|
|
@@ -295,10 +295,10 @@ const $e = function(s, e) {
|
|
|
295
295
|
}, t = /[&<>"']/g, r = new RegExp(t.source);
|
|
296
296
|
return s && r.test(s) ? s.replace(t, (o) => e[o]) : s;
|
|
297
297
|
};
|
|
298
|
-
let
|
|
299
|
-
class
|
|
298
|
+
let V = !1;
|
|
299
|
+
class M {
|
|
300
300
|
constructor(e) {
|
|
301
|
-
|
|
301
|
+
m(this, "marks"), m(this, "nodes"), e || (e = Ye), this.marks = e.marks || [], this.nodes = e.nodes || [];
|
|
302
302
|
}
|
|
303
303
|
addNode(e, t) {
|
|
304
304
|
this.nodes[e] = t;
|
|
@@ -307,9 +307,9 @@ class N {
|
|
|
307
307
|
this.marks[e] = t;
|
|
308
308
|
}
|
|
309
309
|
render(e, t = { optimizeImages: !1 }, r = !0) {
|
|
310
|
-
if (!
|
|
310
|
+
if (!V && r && (console.warn(
|
|
311
311
|
"Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"
|
|
312
|
-
),
|
|
312
|
+
), V = !0), e && e.content && Array.isArray(e.content)) {
|
|
313
313
|
let o = "";
|
|
314
314
|
return e.content.forEach((n) => {
|
|
315
315
|
o += this.renderNode(n);
|
|
@@ -345,32 +345,32 @@ class N {
|
|
|
345
345
|
optimizeImages(e, t) {
|
|
346
346
|
let r = 0, o = 0, n = "", a = "";
|
|
347
347
|
typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, r = t.width), typeof t.height == "number" && t.height > 0 && (n += `height="${t.height}" `, o = t.height), (t.loading === "lazy" || t.loading === "eager") && (n += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (n += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (a += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (a += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-F]{6}/gi) || t.filters.fill === "transparent") && (a += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (a += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (a += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (a += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (a += `:rotate(${t.filters.rotate})`), a.length > 0 && (a = `/filters${a}`))), n.length > 0 && (e = e.replace(/<img/g, `<img ${n.trim()}`));
|
|
348
|
-
const
|
|
348
|
+
const i = r > 0 || o > 0 || a.length > 0 ? `${r}x${o}${a}` : "";
|
|
349
349
|
return e = e.replace(
|
|
350
350
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,
|
|
351
|
-
`a.storyblok.com/f/$1/$2.$3/m/${
|
|
352
|
-
), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (
|
|
351
|
+
`a.storyblok.com/f/$1/$2.$3/m/${i}`
|
|
352
|
+
), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (l) => {
|
|
353
353
|
var h, d;
|
|
354
|
-
const p =
|
|
354
|
+
const p = l.match(
|
|
355
355
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g
|
|
356
356
|
);
|
|
357
357
|
if (p && p.length > 0) {
|
|
358
358
|
const b = {
|
|
359
|
-
srcset: (h = t.srcset) == null ? void 0 : h.map((
|
|
360
|
-
if (typeof
|
|
361
|
-
return `//${p}/m/${
|
|
362
|
-
if (typeof
|
|
363
|
-
let E = 0,
|
|
364
|
-
return typeof
|
|
359
|
+
srcset: (h = t.srcset) == null ? void 0 : h.map((y) => {
|
|
360
|
+
if (typeof y == "number")
|
|
361
|
+
return `//${p}/m/${y}x0${a} ${y}w`;
|
|
362
|
+
if (typeof y == "object" && y.length === 2) {
|
|
363
|
+
let E = 0, I = 0;
|
|
364
|
+
return typeof y[0] == "number" && (E = y[0]), typeof y[1] == "number" && (I = y[1]), `//${p}/m/${E}x${I}${a} ${E}w`;
|
|
365
365
|
}
|
|
366
366
|
return "";
|
|
367
367
|
}).join(", "),
|
|
368
|
-
sizes: (d = t.sizes) == null ? void 0 : d.map((
|
|
368
|
+
sizes: (d = t.sizes) == null ? void 0 : d.map((y) => y).join(", ")
|
|
369
369
|
};
|
|
370
|
-
let
|
|
371
|
-
return b.srcset && (
|
|
370
|
+
let S = "";
|
|
371
|
+
return b.srcset && (S += `srcset="${b.srcset}" `), b.sizes && (S += `sizes="${b.sizes}" `), l.replace(/<img/g, `<img ${S.trim()}`);
|
|
372
372
|
}
|
|
373
|
-
return
|
|
373
|
+
return l;
|
|
374
374
|
})), e;
|
|
375
375
|
}
|
|
376
376
|
renderNode(e) {
|
|
@@ -382,7 +382,7 @@ class N {
|
|
|
382
382
|
const r = this.getMatchingNode(e);
|
|
383
383
|
return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((o) => {
|
|
384
384
|
t.push(this.renderNode(o));
|
|
385
|
-
}) : e.text ? t.push(
|
|
385
|
+
}) : e.text ? t.push(We(e.text)) : r && r.singleTag ? t.push(this.renderTag(r.singleTag, " /")) : r && r.html ? t.push(r.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), r && r.tag && t.push(this.renderClosingTag(r.tag)), e.marks && e.marks.slice(0).reverse().forEach((o) => {
|
|
386
386
|
const n = this.getMatchingMark(o);
|
|
387
387
|
n && n.tag !== "" && t.push(this.renderClosingTag(n.tag));
|
|
388
388
|
}), t.join("");
|
|
@@ -437,9 +437,9 @@ class N {
|
|
|
437
437
|
return this.renderTag(t, " /");
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
class
|
|
440
|
+
class Xe {
|
|
441
441
|
constructor(e) {
|
|
442
|
-
|
|
442
|
+
m(this, "baseURL"), m(this, "timeout"), m(this, "headers"), m(this, "responseInterceptor"), m(this, "fetch"), m(this, "ejectInterceptor"), m(this, "url"), m(this, "parameters"), m(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
|
|
443
443
|
}
|
|
444
444
|
/**
|
|
445
445
|
*
|
|
@@ -476,31 +476,31 @@ class Ye {
|
|
|
476
476
|
async _methodHandler(e) {
|
|
477
477
|
let t = `${this.baseURL}${this.url}`, r = null;
|
|
478
478
|
if (e === "get") {
|
|
479
|
-
const
|
|
480
|
-
t = `${this.baseURL}${this.url}?${
|
|
479
|
+
const l = new N();
|
|
480
|
+
t = `${this.baseURL}${this.url}?${l.stringify(
|
|
481
481
|
this.parameters
|
|
482
482
|
)}`;
|
|
483
483
|
} else
|
|
484
484
|
r = JSON.stringify(this.parameters);
|
|
485
485
|
const o = new URL(t), n = new AbortController(), { signal: a } = n;
|
|
486
|
-
let
|
|
487
|
-
this.timeout && (
|
|
486
|
+
let i;
|
|
487
|
+
this.timeout && (i = setTimeout(() => n.abort(), this.timeout));
|
|
488
488
|
try {
|
|
489
|
-
const
|
|
489
|
+
const l = await this.fetch(`${o}`, {
|
|
490
490
|
method: e,
|
|
491
491
|
headers: this.headers,
|
|
492
492
|
body: r,
|
|
493
493
|
signal: a,
|
|
494
494
|
...this.fetchOptions
|
|
495
495
|
});
|
|
496
|
-
this.timeout && clearTimeout(
|
|
496
|
+
this.timeout && clearTimeout(i);
|
|
497
497
|
const h = await this._responseHandler(
|
|
498
|
-
|
|
498
|
+
l
|
|
499
499
|
);
|
|
500
500
|
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(h)) : this._statusHandler(h);
|
|
501
|
-
} catch (
|
|
501
|
+
} catch (l) {
|
|
502
502
|
return {
|
|
503
|
-
message:
|
|
503
|
+
message: l
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
}
|
|
@@ -524,39 +524,39 @@ class Ye {
|
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
-
const
|
|
527
|
+
const G = "SB-Agent", U = {
|
|
528
528
|
defaultAgentName: "SB-JS-CLIENT",
|
|
529
529
|
defaultAgentVersion: "SB-Agent-Version",
|
|
530
530
|
packageVersion: "6.0.0"
|
|
531
531
|
};
|
|
532
|
-
let
|
|
533
|
-
const
|
|
534
|
-
class
|
|
532
|
+
let L = {};
|
|
533
|
+
const x = {};
|
|
534
|
+
class Qe {
|
|
535
535
|
/**
|
|
536
536
|
*
|
|
537
537
|
* @param config ISbConfig interface
|
|
538
538
|
* @param pEndpoint string, optional
|
|
539
539
|
*/
|
|
540
540
|
constructor(e, t) {
|
|
541
|
-
|
|
541
|
+
m(this, "client"), m(this, "maxRetries"), m(this, "retriesDelay"), m(this, "throttle"), m(this, "accessToken"), m(this, "cache"), m(this, "helpers"), m(this, "resolveCounter"), m(this, "relations"), m(this, "links"), m(this, "richTextResolver"), m(this, "resolveNestedRelations"), m(this, "stringifiedStoriesCache");
|
|
542
542
|
let r = e.endpoint || t;
|
|
543
543
|
if (!r) {
|
|
544
|
-
const a = new
|
|
545
|
-
e.oauthToken ? r = `${
|
|
544
|
+
const a = new N().getRegionURL, i = e.https === !1 ? "http" : "https";
|
|
545
|
+
e.oauthToken ? r = `${i}://${a(e.region)}/v1` : r = `${i}://${a(e.region)}/v2`;
|
|
546
546
|
}
|
|
547
547
|
const o = new Headers();
|
|
548
|
-
o.set("Content-Type", "application/json"), o.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([a,
|
|
549
|
-
o.set(a,
|
|
550
|
-
}), o.has(
|
|
551
|
-
|
|
552
|
-
|
|
548
|
+
o.set("Content-Type", "application/json"), o.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([a, i]) => {
|
|
549
|
+
o.set(a, i);
|
|
550
|
+
}), o.has(G) || (o.set(G, U.defaultAgentName), o.set(
|
|
551
|
+
U.defaultAgentVersion,
|
|
552
|
+
U.packageVersion
|
|
553
553
|
));
|
|
554
554
|
let n = 5;
|
|
555
|
-
e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new
|
|
555
|
+
e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new M(e.richTextSchema) : this.richTextResolver = new M(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Te(
|
|
556
556
|
this.throttledRequest.bind(this),
|
|
557
557
|
n,
|
|
558
558
|
1e3
|
|
559
|
-
), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new
|
|
559
|
+
), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new N(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Xe({
|
|
560
560
|
baseURL: r,
|
|
561
561
|
timeout: e.timeout || 0,
|
|
562
562
|
headers: o,
|
|
@@ -575,7 +575,7 @@ class We {
|
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
parseParams(e) {
|
|
578
|
-
return e.token || (e.token = this.getToken()), e.cv || (e.cv =
|
|
578
|
+
return e.token || (e.token = this.getToken()), e.cv || (e.cv = x[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
|
|
579
579
|
}
|
|
580
580
|
factoryParamOptions(e, t) {
|
|
581
581
|
return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
|
|
@@ -593,17 +593,17 @@ class We {
|
|
|
593
593
|
return this.cacheResponse(o, n, void 0, r);
|
|
594
594
|
}
|
|
595
595
|
async getAll(e, t, r, o) {
|
|
596
|
-
const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""),
|
|
596
|
+
const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), i = r ?? a.substring(a.lastIndexOf("/") + 1), l = 1, h = await this.makeRequest(
|
|
597
597
|
a,
|
|
598
598
|
t,
|
|
599
599
|
n,
|
|
600
|
-
|
|
600
|
+
l,
|
|
601
601
|
o
|
|
602
602
|
), d = h.total ? Math.ceil(h.total / n) : 1, p = await this.helpers.asyncMap(
|
|
603
|
-
this.helpers.range(
|
|
603
|
+
this.helpers.range(l, d),
|
|
604
604
|
(b) => this.makeRequest(a, t, n, b + 1, o)
|
|
605
605
|
);
|
|
606
|
-
return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[
|
|
606
|
+
return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[i]));
|
|
607
607
|
}
|
|
608
608
|
post(e, t, r) {
|
|
609
609
|
const o = `/${e}`;
|
|
@@ -706,11 +706,11 @@ class We {
|
|
|
706
706
|
const o = (n, a = "") => {
|
|
707
707
|
if (!(!n || n._stopResolving)) {
|
|
708
708
|
if (Array.isArray(n))
|
|
709
|
-
n.forEach((
|
|
709
|
+
n.forEach((i, l) => o(i, `${a}[${l}]`));
|
|
710
710
|
else if (typeof n == "object")
|
|
711
|
-
for (const
|
|
712
|
-
const
|
|
713
|
-
(n.component && n._uid || n.type === "link") && (this._insertRelations(n,
|
|
711
|
+
for (const i in n) {
|
|
712
|
+
const l = a ? `${a}.${i}` : i;
|
|
713
|
+
(n.component && n._uid || n.type === "link") && (this._insertRelations(n, i, t, r), this._insertLinks(n, i, r)), o(n[i], l);
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
};
|
|
@@ -719,18 +719,18 @@ class We {
|
|
|
719
719
|
async resolveLinks(e, t, r) {
|
|
720
720
|
let o = [];
|
|
721
721
|
if (e.link_uuids) {
|
|
722
|
-
const n = e.link_uuids.length, a = [],
|
|
723
|
-
for (let
|
|
724
|
-
const h = Math.min(n,
|
|
725
|
-
a.push(e.link_uuids.slice(
|
|
722
|
+
const n = e.link_uuids.length, a = [], i = 50;
|
|
723
|
+
for (let l = 0; l < n; l += i) {
|
|
724
|
+
const h = Math.min(n, l + i);
|
|
725
|
+
a.push(e.link_uuids.slice(l, h));
|
|
726
726
|
}
|
|
727
|
-
for (let
|
|
727
|
+
for (let l = 0; l < a.length; l++)
|
|
728
728
|
(await this.getStories({
|
|
729
|
-
per_page:
|
|
729
|
+
per_page: i,
|
|
730
730
|
language: t.language,
|
|
731
731
|
version: t.version,
|
|
732
732
|
starts_with: t.starts_with,
|
|
733
|
-
by_uuids: a[
|
|
733
|
+
by_uuids: a[l].join(",")
|
|
734
734
|
})).data.stories.forEach(
|
|
735
735
|
(h) => {
|
|
736
736
|
o.push(h);
|
|
@@ -748,22 +748,23 @@ class We {
|
|
|
748
748
|
async resolveRelations(e, t, r) {
|
|
749
749
|
let o = [];
|
|
750
750
|
if (e.rel_uuids) {
|
|
751
|
-
const n = e.rel_uuids.length, a = [],
|
|
752
|
-
for (let
|
|
753
|
-
const h = Math.min(n,
|
|
754
|
-
a.push(e.rel_uuids.slice(
|
|
751
|
+
const n = e.rel_uuids.length, a = [], i = 50;
|
|
752
|
+
for (let l = 0; l < n; l += i) {
|
|
753
|
+
const h = Math.min(n, l + i);
|
|
754
|
+
a.push(e.rel_uuids.slice(l, h));
|
|
755
755
|
}
|
|
756
|
-
for (let
|
|
756
|
+
for (let l = 0; l < a.length; l++)
|
|
757
757
|
(await this.getStories({
|
|
758
|
-
per_page:
|
|
758
|
+
per_page: i,
|
|
759
759
|
language: t.language,
|
|
760
760
|
version: t.version,
|
|
761
761
|
starts_with: t.starts_with,
|
|
762
|
-
by_uuids: a[
|
|
762
|
+
by_uuids: a[l].join(","),
|
|
763
763
|
excluding_fields: t.excluding_fields
|
|
764
764
|
})).data.stories.forEach((h) => {
|
|
765
765
|
o.push(h);
|
|
766
766
|
});
|
|
767
|
+
o.length > 0 && (e.rels = o, delete e.rel_uuids);
|
|
767
768
|
} else
|
|
768
769
|
o = e.rels;
|
|
769
770
|
o && o.length > 0 && o.forEach((n) => {
|
|
@@ -786,24 +787,24 @@ class We {
|
|
|
786
787
|
var o, n;
|
|
787
788
|
let a = [];
|
|
788
789
|
if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (a = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((o = e.links) != null && o.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations)
|
|
789
|
-
for (const
|
|
790
|
+
for (const i in this.relations[r])
|
|
790
791
|
this.iterateTree(
|
|
791
|
-
this.relations[r][
|
|
792
|
+
this.relations[r][i],
|
|
792
793
|
a,
|
|
793
794
|
r
|
|
794
795
|
);
|
|
795
|
-
e.story ? this.iterateTree(e.story, a, r) : e.stories.forEach((
|
|
796
|
-
this.iterateTree(
|
|
796
|
+
e.story ? this.iterateTree(e.story, a, r) : e.stories.forEach((i) => {
|
|
797
|
+
this.iterateTree(i, a, r);
|
|
797
798
|
}), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
|
|
798
799
|
}
|
|
799
800
|
async cacheResponse(e, t, r, o) {
|
|
800
801
|
const n = this.helpers.stringify({ url: e, params: t }), a = this.cacheProvider();
|
|
801
802
|
if (t.version === "published" && e !== "/cdn/spaces/me") {
|
|
802
|
-
const
|
|
803
|
-
if (
|
|
804
|
-
return Promise.resolve(
|
|
803
|
+
const i = await a.get(n);
|
|
804
|
+
if (i)
|
|
805
|
+
return Promise.resolve(i);
|
|
805
806
|
}
|
|
806
|
-
return new Promise(async (
|
|
807
|
+
return new Promise(async (i, l) => {
|
|
807
808
|
var h;
|
|
808
809
|
try {
|
|
809
810
|
const d = await this.throttle(
|
|
@@ -813,24 +814,24 @@ class We {
|
|
|
813
814
|
o
|
|
814
815
|
);
|
|
815
816
|
if (d.status !== 200)
|
|
816
|
-
return
|
|
817
|
+
return l(d);
|
|
817
818
|
let p = { data: d.data, headers: d.headers };
|
|
818
819
|
if ((h = d.headers) != null && h["per-page"] && (p = Object.assign({}, p, {
|
|
819
820
|
perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
|
|
820
821
|
total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
|
|
821
822
|
})), p.data.story || p.data.stories) {
|
|
822
|
-
const
|
|
823
|
-
await this.resolveStories(p.data, t, `${
|
|
823
|
+
const S = this.resolveCounter = ++this.resolveCounter % 1e3;
|
|
824
|
+
await this.resolveStories(p.data, t, `${S}`);
|
|
824
825
|
}
|
|
825
826
|
t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, p);
|
|
826
827
|
const b = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
|
|
827
|
-
return t.token && p.data.cv && (b &&
|
|
828
|
+
return t.token && p.data.cv && (b && x[t.token] && x[t.token] !== p.data.cv && await this.flushCache(), x[t.token] = p.data.cv), i(p);
|
|
828
829
|
} catch (d) {
|
|
829
830
|
if (d.response && d.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
|
|
830
831
|
return console.log(
|
|
831
832
|
`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
|
|
832
|
-
), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(
|
|
833
|
-
|
|
833
|
+
), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(i).catch(l);
|
|
834
|
+
l(d);
|
|
834
835
|
}
|
|
835
836
|
});
|
|
836
837
|
}
|
|
@@ -838,38 +839,37 @@ class We {
|
|
|
838
839
|
return this.client.setFetchOptions(o), this.client[e](t, r);
|
|
839
840
|
}
|
|
840
841
|
cacheVersions() {
|
|
841
|
-
return
|
|
842
|
+
return x;
|
|
842
843
|
}
|
|
843
844
|
cacheVersion() {
|
|
844
|
-
return
|
|
845
|
+
return x[this.accessToken];
|
|
845
846
|
}
|
|
846
847
|
setCacheVersion(e) {
|
|
847
|
-
this.accessToken && (
|
|
848
|
+
this.accessToken && (x[this.accessToken] = e);
|
|
848
849
|
}
|
|
849
850
|
clearCacheVersion() {
|
|
850
|
-
this.accessToken && (
|
|
851
|
+
this.accessToken && (x[this.accessToken] = 0);
|
|
851
852
|
}
|
|
852
853
|
cacheProvider() {
|
|
853
854
|
switch (this.cache.type) {
|
|
854
855
|
case "memory":
|
|
855
856
|
return {
|
|
856
857
|
get(e) {
|
|
857
|
-
return Promise.resolve(
|
|
858
|
+
return Promise.resolve(L[e]);
|
|
858
859
|
},
|
|
859
860
|
getAll() {
|
|
860
|
-
return Promise.resolve(
|
|
861
|
+
return Promise.resolve(L);
|
|
861
862
|
},
|
|
862
863
|
set(e, t) {
|
|
863
|
-
return
|
|
864
|
+
return L[e] = t, Promise.resolve(void 0);
|
|
864
865
|
},
|
|
865
866
|
flush() {
|
|
866
|
-
return
|
|
867
|
+
return L = {}, Promise.resolve(void 0);
|
|
867
868
|
}
|
|
868
869
|
};
|
|
869
870
|
case "custom":
|
|
870
871
|
if (this.cache.custom)
|
|
871
872
|
return this.cache.custom;
|
|
872
|
-
// eslint-disable-next-line no-fallthrough
|
|
873
873
|
default:
|
|
874
874
|
return {
|
|
875
875
|
get() {
|
|
@@ -891,7 +891,7 @@ class We {
|
|
|
891
891
|
return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
const
|
|
894
|
+
const gt = (s = {}) => {
|
|
895
895
|
const { apiOptions: e } = s;
|
|
896
896
|
if (!e || !e.accessToken) {
|
|
897
897
|
console.error(
|
|
@@ -899,8 +899,8 @@ const dt = (s = {}) => {
|
|
|
899
899
|
);
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
-
return { storyblokApi: new
|
|
903
|
-
},
|
|
902
|
+
return { storyblokApi: new Qe(e) };
|
|
903
|
+
}, Ze = (s) => {
|
|
904
904
|
if (typeof s != "object" || typeof s._editable > "u")
|
|
905
905
|
return {};
|
|
906
906
|
try {
|
|
@@ -915,24 +915,24 @@ const dt = (s = {}) => {
|
|
|
915
915
|
return {};
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
|
-
function
|
|
918
|
+
function et(s, e) {
|
|
919
919
|
if (!e)
|
|
920
920
|
return { src: s, attrs: {} };
|
|
921
921
|
let t = 0, r = 0;
|
|
922
922
|
const o = {}, n = [];
|
|
923
|
-
function a(
|
|
924
|
-
typeof
|
|
923
|
+
function a(l, h, d, p, b) {
|
|
924
|
+
typeof l != "number" || l <= h || l >= d ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`) : b.push(`${p}(${l})`);
|
|
925
925
|
}
|
|
926
926
|
if (typeof e == "object") {
|
|
927
927
|
if (typeof e.width == "number" && e.width > 0 ? (o.width = e.width, t = e.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), e.height && typeof e.height == "number" && e.height > 0 ? (o.height = e.height, r = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (o.loading = e.loading), e.class && (o.class = e.class), e.filters) {
|
|
928
|
-
const { filters:
|
|
929
|
-
h && a(h, 0, 100, "blur", n),
|
|
928
|
+
const { filters: l } = e || {}, { blur: h, brightness: d, fill: p, format: b, grayscale: S, quality: y, rotate: E } = l || {};
|
|
929
|
+
h && a(h, 0, 100, "blur", n), y && a(y, 0, 100, "quality", n), d && a(d, 0, 100, "brightness", n), p && n.push(`fill(${p})`), S && n.push("grayscale()"), E && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${E})`), b && ["webp", "png", "jpeg"].includes(b) && n.push(`format(${b})`);
|
|
930
930
|
}
|
|
931
|
-
e.srcset && (o.srcset = e.srcset.map((
|
|
932
|
-
if (typeof
|
|
933
|
-
return `${s}/m/${
|
|
934
|
-
if (Array.isArray(
|
|
935
|
-
const [h, d] =
|
|
931
|
+
e.srcset && (o.srcset = e.srcset.map((l) => {
|
|
932
|
+
if (typeof l == "number")
|
|
933
|
+
return `${s}/m/${l}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${l}w`;
|
|
934
|
+
if (Array.isArray(l) && l.length === 2) {
|
|
935
|
+
const [h, d] = l;
|
|
936
936
|
return `${s}/m/${h}x${d}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${h}w`;
|
|
937
937
|
} else {
|
|
938
938
|
console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
|
|
@@ -940,14 +940,14 @@ function Qe(s, e) {
|
|
|
940
940
|
}
|
|
941
941
|
}).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
|
|
942
942
|
}
|
|
943
|
-
let
|
|
944
|
-
return t > 0 && r > 0 && (
|
|
945
|
-
src:
|
|
943
|
+
let i = `${s}/m/`;
|
|
944
|
+
return t > 0 && r > 0 && (i = `${i}${t}x${r}/`), n.length > 0 && (i = `${i}filters:${n.join(":")}`), {
|
|
945
|
+
src: i,
|
|
946
946
|
attrs: o
|
|
947
947
|
};
|
|
948
948
|
}
|
|
949
|
-
var
|
|
950
|
-
const
|
|
949
|
+
var v = /* @__PURE__ */ ((s) => (s.DOCUMENT = "doc", s.HEADING = "heading", s.PARAGRAPH = "paragraph", s.QUOTE = "blockquote", s.OL_LIST = "ordered_list", s.UL_LIST = "bullet_list", s.LIST_ITEM = "list_item", s.CODE_BLOCK = "code_block", s.HR = "horizontal_rule", s.BR = "hard_break", s.IMAGE = "image", s.EMOJI = "emoji", s.COMPONENT = "blok", s.TABLE = "table", s.TABLE_ROW = "tableRow", s.TABLE_CELL = "tableCell", s.TABLE_HEADER = "tableHeader", s))(v || {}), _ = /* @__PURE__ */ ((s) => (s.BOLD = "bold", s.STRONG = "strong", s.STRIKE = "strike", s.UNDERLINE = "underline", s.ITALIC = "italic", s.CODE = "code", s.LINK = "link", s.ANCHOR = "anchor", s.STYLED = "styled", s.SUPERSCRIPT = "superscript", s.SUBSCRIPT = "subscript", s.TEXT_STYLE = "textStyle", s.HIGHLIGHT = "highlight", s))(_ || {}), Z = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(Z || {}), j = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(j || {});
|
|
950
|
+
const tt = [
|
|
951
951
|
"area",
|
|
952
952
|
"base",
|
|
953
953
|
"br",
|
|
@@ -962,191 +962,197 @@ const Ze = [
|
|
|
962
962
|
"source",
|
|
963
963
|
"track",
|
|
964
964
|
"wbr"
|
|
965
|
-
],
|
|
966
|
-
function
|
|
965
|
+
], rt = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), st = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
|
|
966
|
+
function ot(s) {
|
|
967
967
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
968
968
|
}
|
|
969
|
-
const
|
|
970
|
-
function
|
|
971
|
-
const r =
|
|
969
|
+
const O = (s) => Object.fromEntries(Object.entries(s).filter(([e, t]) => t !== void 0));
|
|
970
|
+
function K(s, e = {}, t) {
|
|
971
|
+
const r = rt(e), o = r ? `${s} ${r}` : s, n = Array.isArray(t) ? t.join("") : t || "";
|
|
972
972
|
if (s) {
|
|
973
|
-
if (
|
|
973
|
+
if (tt.includes(s))
|
|
974
974
|
return `<${o}>`;
|
|
975
975
|
} else return n;
|
|
976
976
|
return `<${o}>${n}</${s}>`;
|
|
977
977
|
}
|
|
978
|
-
function
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
textFn: r = rt,
|
|
978
|
+
function nt(s = {}) {
|
|
979
|
+
const e = /* @__PURE__ */ new Map(), {
|
|
980
|
+
renderFn: t = K,
|
|
981
|
+
textFn: r = ot,
|
|
983
982
|
resolvers: o = {},
|
|
984
983
|
optimizeImages: n = !1,
|
|
985
984
|
keyedResolvers: a = !1
|
|
986
|
-
} = s,
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
985
|
+
} = s, i = t !== K, l = () => ({ render: (c, u = {}, g) => {
|
|
986
|
+
if (a && c) {
|
|
987
|
+
const f = e.get(c) || 0;
|
|
988
|
+
e.set(c, f + 1), u.key = `${c}-${f}`;
|
|
989
|
+
}
|
|
990
|
+
return t(c, u, g);
|
|
991
|
+
} }), h = (c) => (u, g) => {
|
|
992
|
+
const f = u.attrs || {};
|
|
993
|
+
return g.render(c, f, u.children || null);
|
|
994
|
+
}, d = (c, u) => {
|
|
995
|
+
const { src: g, alt: f, title: k, srcset: w, sizes: $ } = c.attrs || {};
|
|
996
|
+
let T = g, R = {};
|
|
992
997
|
if (n) {
|
|
993
|
-
const { src:
|
|
994
|
-
|
|
998
|
+
const { src: he, attrs: ue } = et(g, n);
|
|
999
|
+
T = he, R = ue;
|
|
995
1000
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
src: f,
|
|
1002
|
-
alt: m,
|
|
1003
|
-
title: y,
|
|
1004
|
-
srcset: R,
|
|
1001
|
+
const ce = {
|
|
1002
|
+
src: T,
|
|
1003
|
+
alt: f,
|
|
1004
|
+
title: k,
|
|
1005
|
+
srcset: w,
|
|
1005
1006
|
sizes: $,
|
|
1006
|
-
...
|
|
1007
|
-
};
|
|
1008
|
-
return t("img", L(ie));
|
|
1009
|
-
}, d = (c) => {
|
|
1010
|
-
const { level: u, ...m } = c.attrs || {}, y = {
|
|
1011
|
-
...m
|
|
1007
|
+
...R
|
|
1012
1008
|
};
|
|
1013
|
-
return
|
|
1014
|
-
}, p = (c) => {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1009
|
+
return u.render("img", O(ce));
|
|
1010
|
+
}, p = (c, u) => {
|
|
1011
|
+
const { level: g, ...f } = c.attrs || {};
|
|
1012
|
+
return u.render(`h${g}`, f, c.children);
|
|
1013
|
+
}, b = (c, u) => {
|
|
1014
|
+
var g, f, k, w;
|
|
1015
|
+
const $ = u.render("img", {
|
|
1016
|
+
src: (g = c.attrs) == null ? void 0 : g.fallbackImage,
|
|
1017
|
+
alt: (f = c.attrs) == null ? void 0 : f.alt,
|
|
1019
1018
|
style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
|
|
1020
1019
|
draggable: "false",
|
|
1021
1020
|
loading: "lazy"
|
|
1022
|
-
})
|
|
1021
|
+
});
|
|
1022
|
+
return u.render("span", {
|
|
1023
1023
|
"data-type": "emoji",
|
|
1024
|
-
"data-name": (
|
|
1025
|
-
"data-emoji": (
|
|
1026
|
-
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
const { class:
|
|
1033
|
-
class:
|
|
1024
|
+
"data-name": (k = c.attrs) == null ? void 0 : k.name,
|
|
1025
|
+
"data-emoji": (w = c.attrs) == null ? void 0 : w.emoji
|
|
1026
|
+
}, $);
|
|
1027
|
+
}, S = (c, u) => u.render(
|
|
1028
|
+
"pre",
|
|
1029
|
+
c.attrs || {},
|
|
1030
|
+
u.render("code", {}, c.children || "")
|
|
1031
|
+
), y = (c, u = !1) => ({ text: g, attrs: f }, k) => {
|
|
1032
|
+
const { class: w, id: $, ...T } = f || {}, R = u ? {
|
|
1033
|
+
class: w,
|
|
1034
1034
|
id: $,
|
|
1035
|
-
style:
|
|
1036
|
-
} :
|
|
1037
|
-
return
|
|
1038
|
-
},
|
|
1039
|
-
const { marks: u, ...
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1035
|
+
style: st(T) || void 0
|
|
1036
|
+
} : f || {};
|
|
1037
|
+
return k.render(c, O(R), g);
|
|
1038
|
+
}, E = (c) => H(c), I = (c) => {
|
|
1039
|
+
const { marks: u, ...g } = c;
|
|
1040
|
+
if ("text" in c) {
|
|
1041
|
+
if (u)
|
|
1042
|
+
return u.reduce(
|
|
1043
|
+
(k, w) => E({ ...w, text: k }),
|
|
1044
|
+
E({ ...g, children: g.children })
|
|
1045
|
+
);
|
|
1046
|
+
const f = c.attrs || {};
|
|
1047
|
+
if (a) {
|
|
1048
|
+
const k = e.get("txt") || 0;
|
|
1049
|
+
e.set("txt", k + 1), f.key = `txt-${k}`;
|
|
1050
|
+
}
|
|
1051
|
+
return r(g.text, f);
|
|
1052
|
+
}
|
|
1053
|
+
return "";
|
|
1054
|
+
}, z = (c, u) => {
|
|
1055
|
+
const { linktype: g, href: f, anchor: k, ...w } = c.attrs || {};
|
|
1048
1056
|
let $ = "";
|
|
1049
|
-
switch (
|
|
1050
|
-
case
|
|
1051
|
-
case
|
|
1052
|
-
$ =
|
|
1057
|
+
switch (g) {
|
|
1058
|
+
case j.ASSET:
|
|
1059
|
+
case j.URL:
|
|
1060
|
+
$ = f;
|
|
1053
1061
|
break;
|
|
1054
|
-
case
|
|
1055
|
-
$ = `mailto:${
|
|
1062
|
+
case j.EMAIL:
|
|
1063
|
+
$ = `mailto:${f}`;
|
|
1056
1064
|
break;
|
|
1057
|
-
case
|
|
1058
|
-
$ =
|
|
1065
|
+
case j.STORY:
|
|
1066
|
+
$ = f, k && ($ = `${$}#${k}`);
|
|
1059
1067
|
break;
|
|
1060
1068
|
default:
|
|
1061
|
-
$ =
|
|
1069
|
+
$ = f;
|
|
1062
1070
|
break;
|
|
1063
1071
|
}
|
|
1064
|
-
const
|
|
1065
|
-
return $ && (
|
|
1066
|
-
},
|
|
1067
|
-
var
|
|
1068
|
-
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),
|
|
1069
|
-
blok: (
|
|
1070
|
-
id: (
|
|
1071
|
-
key: `component-${e}`,
|
|
1072
|
+
const T = { ...w };
|
|
1073
|
+
return $ && (T.href = $), u.render("a", T, c.text);
|
|
1074
|
+
}, se = (c, u) => {
|
|
1075
|
+
var g, f;
|
|
1076
|
+
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
|
|
1077
|
+
blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
|
|
1078
|
+
id: (f = c.attrs) == null ? void 0 : f.id,
|
|
1072
1079
|
style: "display: none"
|
|
1073
1080
|
});
|
|
1074
|
-
},
|
|
1075
|
-
const
|
|
1076
|
-
return
|
|
1077
|
-
},
|
|
1078
|
-
const
|
|
1079
|
-
return
|
|
1080
|
-
},
|
|
1081
|
-
const { colspan:
|
|
1081
|
+
}, oe = (c, u) => {
|
|
1082
|
+
const g = {}, f = u.render("tbody", {}, c.children);
|
|
1083
|
+
return u.render("table", g, f);
|
|
1084
|
+
}, ne = (c, u) => {
|
|
1085
|
+
const g = {};
|
|
1086
|
+
return u.render("tr", g, c.children);
|
|
1087
|
+
}, ae = (c, u) => {
|
|
1088
|
+
const { colspan: g, rowspan: f, colwidth: k, backgroundColor: w, ...$ } = c.attrs || {}, T = {
|
|
1082
1089
|
...$
|
|
1083
1090
|
};
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
return
|
|
1087
|
-
},
|
|
1088
|
-
const { colspan:
|
|
1091
|
+
g > 1 && (T.colspan = g), f > 1 && (T.rowspan = f);
|
|
1092
|
+
const R = [];
|
|
1093
|
+
return k && R.push(`width: ${k}px;`), w && R.push(`background-color: ${w};`), R.length > 0 && (T.style = R.join(" ")), u.render("td", O(T), c.children);
|
|
1094
|
+
}, ie = (c, u) => {
|
|
1095
|
+
const { colspan: g, rowspan: f, colwidth: k, backgroundColor: w, ...$ } = c.attrs || {}, T = {
|
|
1089
1096
|
...$
|
|
1090
1097
|
};
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
return
|
|
1094
|
-
},
|
|
1095
|
-
[
|
|
1096
|
-
[
|
|
1097
|
-
[
|
|
1098
|
-
[
|
|
1099
|
-
[
|
|
1100
|
-
[
|
|
1101
|
-
[
|
|
1102
|
-
[
|
|
1103
|
-
[
|
|
1104
|
-
[
|
|
1105
|
-
[
|
|
1106
|
-
[
|
|
1107
|
-
[
|
|
1108
|
-
[
|
|
1109
|
-
[_.LINK,
|
|
1110
|
-
[_.ANCHOR,
|
|
1111
|
-
[_.STYLED,
|
|
1112
|
-
[_.BOLD,
|
|
1113
|
-
[_.TEXT_STYLE,
|
|
1114
|
-
[_.ITALIC,
|
|
1115
|
-
[_.UNDERLINE,
|
|
1116
|
-
[_.STRIKE,
|
|
1117
|
-
[_.CODE,
|
|
1118
|
-
[_.SUPERSCRIPT,
|
|
1119
|
-
[_.SUBSCRIPT,
|
|
1120
|
-
[_.HIGHLIGHT,
|
|
1121
|
-
[
|
|
1122
|
-
[
|
|
1123
|
-
[
|
|
1124
|
-
[
|
|
1098
|
+
g > 1 && (T.colspan = g), f > 1 && (T.rowspan = f);
|
|
1099
|
+
const R = [];
|
|
1100
|
+
return k && R.push(`width: ${k}px;`), w && R.push(`background-color: ${w};`), R.length > 0 && (T.style = R.join(" ")), u.render("th", O(T), c.children);
|
|
1101
|
+
}, le = new Map([
|
|
1102
|
+
[v.DOCUMENT, h("")],
|
|
1103
|
+
[v.HEADING, p],
|
|
1104
|
+
[v.PARAGRAPH, h("p")],
|
|
1105
|
+
[v.UL_LIST, h("ul")],
|
|
1106
|
+
[v.OL_LIST, h("ol")],
|
|
1107
|
+
[v.LIST_ITEM, h("li")],
|
|
1108
|
+
[v.IMAGE, d],
|
|
1109
|
+
[v.EMOJI, b],
|
|
1110
|
+
[v.CODE_BLOCK, S],
|
|
1111
|
+
[v.HR, h("hr")],
|
|
1112
|
+
[v.BR, h("br")],
|
|
1113
|
+
[v.QUOTE, h("blockquote")],
|
|
1114
|
+
[v.COMPONENT, se],
|
|
1115
|
+
[Z.TEXT, I],
|
|
1116
|
+
[_.LINK, z],
|
|
1117
|
+
[_.ANCHOR, z],
|
|
1118
|
+
[_.STYLED, y("span", !0)],
|
|
1119
|
+
[_.BOLD, y("strong")],
|
|
1120
|
+
[_.TEXT_STYLE, y("span", !0)],
|
|
1121
|
+
[_.ITALIC, y("em")],
|
|
1122
|
+
[_.UNDERLINE, y("u")],
|
|
1123
|
+
[_.STRIKE, y("s")],
|
|
1124
|
+
[_.CODE, y("code")],
|
|
1125
|
+
[_.SUPERSCRIPT, y("sup")],
|
|
1126
|
+
[_.SUBSCRIPT, y("sub")],
|
|
1127
|
+
[_.HIGHLIGHT, y("mark")],
|
|
1128
|
+
[v.TABLE, oe],
|
|
1129
|
+
[v.TABLE_ROW, ne],
|
|
1130
|
+
[v.TABLE_CELL, ae],
|
|
1131
|
+
[v.TABLE_HEADER, ie],
|
|
1125
1132
|
...Object.entries(o).map(([c, u]) => [c, u])
|
|
1126
1133
|
]);
|
|
1127
|
-
function
|
|
1128
|
-
|
|
1129
|
-
const u = ae.get(c.type);
|
|
1134
|
+
function C(c) {
|
|
1135
|
+
const u = le.get(c.type);
|
|
1130
1136
|
if (!u)
|
|
1131
1137
|
return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
|
|
1138
|
+
const g = l();
|
|
1132
1139
|
if (c.type === "text")
|
|
1133
|
-
return u(c);
|
|
1134
|
-
const
|
|
1140
|
+
return u(c, g);
|
|
1141
|
+
const f = c.content ? c.content.map(H) : void 0;
|
|
1135
1142
|
return u({
|
|
1136
1143
|
...c,
|
|
1137
|
-
children:
|
|
1138
|
-
|
|
1139
|
-
});
|
|
1144
|
+
children: f
|
|
1145
|
+
}, g);
|
|
1140
1146
|
}
|
|
1141
|
-
function
|
|
1142
|
-
return c.type === "doc" ?
|
|
1147
|
+
function H(c) {
|
|
1148
|
+
return c.type === "doc" ? i ? c.content.map(C) : c.content.map(C).join("") : Array.isArray(c) ? c.map(C) : C(c);
|
|
1143
1149
|
}
|
|
1144
1150
|
return {
|
|
1145
|
-
render:
|
|
1151
|
+
render: H
|
|
1146
1152
|
};
|
|
1147
1153
|
}
|
|
1148
|
-
let
|
|
1149
|
-
const
|
|
1154
|
+
let B, J = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
1155
|
+
const at = (s, e, t = {}) => {
|
|
1150
1156
|
var r;
|
|
1151
1157
|
const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
|
|
1152
1158
|
"_storyblok"
|
|
@@ -1157,13 +1163,13 @@ const ot = (s, e, t = {}) => {
|
|
|
1157
1163
|
return;
|
|
1158
1164
|
}
|
|
1159
1165
|
window.storyblokRegisterEvent(() => {
|
|
1160
|
-
new window.StoryblokBridge(t).on(["input", "published", "change"], (
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1166
|
+
new window.StoryblokBridge(t).on(["input", "published", "change"], (i) => {
|
|
1167
|
+
var l;
|
|
1168
|
+
i && (i.action === "input" && ((l = i.story) == null ? void 0 : l.id) === s ? e(i.story) : (i.action === "change" || i.action === "published") && i.storyId === s && window.location.reload());
|
|
1163
1169
|
});
|
|
1164
1170
|
});
|
|
1165
1171
|
}
|
|
1166
|
-
},
|
|
1172
|
+
}, ee = (s, e) => {
|
|
1167
1173
|
s.addNode("blok", (t) => {
|
|
1168
1174
|
let r = "";
|
|
1169
1175
|
return t.attrs.body.forEach((o) => {
|
|
@@ -1172,60 +1178,60 @@ const ot = (s, e, t = {}) => {
|
|
|
1172
1178
|
html: r
|
|
1173
1179
|
};
|
|
1174
1180
|
});
|
|
1175
|
-
},
|
|
1181
|
+
}, it = (s = {}) => {
|
|
1176
1182
|
var e, t;
|
|
1177
1183
|
const {
|
|
1178
1184
|
bridge: r,
|
|
1179
1185
|
accessToken: o,
|
|
1180
1186
|
use: n = [],
|
|
1181
1187
|
apiOptions: a = {},
|
|
1182
|
-
richText:
|
|
1183
|
-
bridgeUrl:
|
|
1188
|
+
richText: i = {},
|
|
1189
|
+
bridgeUrl: l
|
|
1184
1190
|
} = s;
|
|
1185
1191
|
a.accessToken = a.accessToken || o;
|
|
1186
1192
|
const h = { bridge: r, apiOptions: a };
|
|
1187
1193
|
let d = {};
|
|
1188
1194
|
n.forEach((b) => {
|
|
1189
1195
|
d = { ...d, ...b(h) };
|
|
1190
|
-
}),
|
|
1196
|
+
}), l && (J = l);
|
|
1191
1197
|
const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
|
|
1192
|
-
return r !== !1 && p &&
|
|
1193
|
-
},
|
|
1198
|
+
return r !== !1 && p && be(J), B = new M(i.schema), i.resolver && ee(B, i.resolver), d;
|
|
1199
|
+
}, lt = (s) => {
|
|
1194
1200
|
var e;
|
|
1195
1201
|
return !s || !((e = s == null ? void 0 : s.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
|
|
1196
|
-
},
|
|
1197
|
-
let r = t ||
|
|
1202
|
+
}, ft = (s, e, t) => {
|
|
1203
|
+
let r = t || B;
|
|
1198
1204
|
if (!r) {
|
|
1199
1205
|
console.error(
|
|
1200
1206
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
1201
1207
|
);
|
|
1202
1208
|
return;
|
|
1203
1209
|
}
|
|
1204
|
-
return
|
|
1205
|
-
},
|
|
1210
|
+
return lt(s) ? "" : (e && (r = new M(e.schema), e.resolver && ee(r, e.resolver)), r.render(s, {}, !1));
|
|
1211
|
+
}, te = /* @__PURE__ */ Y({
|
|
1206
1212
|
__name: "StoryblokComponent",
|
|
1207
1213
|
props: {
|
|
1208
1214
|
blok: {}
|
|
1209
1215
|
},
|
|
1210
1216
|
setup(s, { expose: e }) {
|
|
1211
|
-
const t = s, r =
|
|
1217
|
+
const t = s, r = P();
|
|
1212
1218
|
e({
|
|
1213
1219
|
value: r
|
|
1214
1220
|
});
|
|
1215
|
-
const o = typeof
|
|
1216
|
-
return !o && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof
|
|
1221
|
+
const o = typeof D(t.blok.component) != "string", n = de("VueSDKOptions"), a = P(t.blok.component);
|
|
1222
|
+
return !o && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof D(a.value) == "string" && console.error(
|
|
1217
1223
|
`Is the Fallback component "${a.value}" registered properly?`
|
|
1218
1224
|
)) : console.error(
|
|
1219
1225
|
`Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`
|
|
1220
|
-
)), (
|
|
1226
|
+
)), (i, l) => (X(), W(D(a.value), pe({
|
|
1221
1227
|
ref_key: "blokRef",
|
|
1222
1228
|
ref: r
|
|
1223
|
-
}, { ...
|
|
1229
|
+
}, { ...i.$props, ...i.$attrs }), null, 16));
|
|
1224
1230
|
}
|
|
1225
|
-
}),
|
|
1231
|
+
}), ct = (s) => {
|
|
1226
1232
|
var e, t;
|
|
1227
|
-
return
|
|
1228
|
-
|
|
1233
|
+
return Q(
|
|
1234
|
+
te,
|
|
1229
1235
|
{
|
|
1230
1236
|
blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
|
|
1231
1237
|
id: (t = s.attrs) == null ? void 0 : t.id
|
|
@@ -1233,89 +1239,89 @@ const ot = (s, e, t = {}) => {
|
|
|
1233
1239
|
s.children
|
|
1234
1240
|
);
|
|
1235
1241
|
};
|
|
1236
|
-
function
|
|
1242
|
+
function ht(s) {
|
|
1237
1243
|
const e = {
|
|
1238
|
-
renderFn:
|
|
1239
|
-
textFn:
|
|
1244
|
+
renderFn: Q,
|
|
1245
|
+
textFn: ge,
|
|
1240
1246
|
keyedResolvers: !0,
|
|
1241
1247
|
resolvers: {
|
|
1242
|
-
[
|
|
1248
|
+
[v.COMPONENT]: ct,
|
|
1243
1249
|
...s.resolvers
|
|
1244
1250
|
}
|
|
1245
1251
|
};
|
|
1246
|
-
return
|
|
1252
|
+
return nt(e);
|
|
1247
1253
|
}
|
|
1248
|
-
const
|
|
1254
|
+
const ut = /* @__PURE__ */ Y({
|
|
1249
1255
|
__name: "StoryblokRichText",
|
|
1250
1256
|
props: {
|
|
1251
1257
|
doc: {},
|
|
1252
1258
|
resolvers: {}
|
|
1253
1259
|
},
|
|
1254
1260
|
setup(s) {
|
|
1255
|
-
const e = s, t =
|
|
1256
|
-
return
|
|
1257
|
-
const { render: a } =
|
|
1261
|
+
const e = s, t = P(), r = () => t.value;
|
|
1262
|
+
return fe([() => e.doc, () => e.resolvers], ([o, n]) => {
|
|
1263
|
+
const { render: a } = ht({
|
|
1258
1264
|
resolvers: n ?? {}
|
|
1259
1265
|
});
|
|
1260
1266
|
t.value = a(o);
|
|
1261
1267
|
}, {
|
|
1262
1268
|
immediate: !0,
|
|
1263
1269
|
deep: !0
|
|
1264
|
-
}), (o, n) => (
|
|
1270
|
+
}), (o, n) => (X(), W(r));
|
|
1265
1271
|
}
|
|
1266
|
-
}),
|
|
1272
|
+
}), dt = {
|
|
1267
1273
|
beforeMount(s, e) {
|
|
1268
1274
|
if (e.value) {
|
|
1269
|
-
const t =
|
|
1275
|
+
const t = Ze(e.value);
|
|
1270
1276
|
Object.keys(t).length > 0 && (s.setAttribute("data-blok-c", t["data-blok-c"]), s.setAttribute("data-blok-uid", t["data-blok-uid"]), s.classList.add("storyblok__outline"));
|
|
1271
1277
|
}
|
|
1272
1278
|
}
|
|
1273
|
-
},
|
|
1279
|
+
}, re = (s) => {
|
|
1274
1280
|
console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
|
|
1275
1281
|
`);
|
|
1276
1282
|
};
|
|
1277
|
-
let
|
|
1278
|
-
const
|
|
1279
|
-
const r =
|
|
1280
|
-
if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links,
|
|
1281
|
-
r.value && r.value.id &&
|
|
1283
|
+
let A = null;
|
|
1284
|
+
const mt = () => (A || re("useStoryblokApi"), A), yt = async (s, e = {}, t = {}) => {
|
|
1285
|
+
const r = P(null);
|
|
1286
|
+
if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, me(() => {
|
|
1287
|
+
r.value && r.value.id && at(
|
|
1282
1288
|
r.value.id,
|
|
1283
1289
|
(o) => r.value = o,
|
|
1284
1290
|
t
|
|
1285
1291
|
);
|
|
1286
|
-
}),
|
|
1287
|
-
const { data: o } = await
|
|
1292
|
+
}), A) {
|
|
1293
|
+
const { data: o } = await A.get(
|
|
1288
1294
|
`cdn/stories/${s}`,
|
|
1289
1295
|
e
|
|
1290
1296
|
);
|
|
1291
1297
|
r.value = o.story;
|
|
1292
1298
|
} else
|
|
1293
|
-
|
|
1299
|
+
re("useStoryblok");
|
|
1294
1300
|
return r;
|
|
1295
|
-
},
|
|
1301
|
+
}, bt = {
|
|
1296
1302
|
install(s, e = {}) {
|
|
1297
|
-
s.directive("editable",
|
|
1303
|
+
s.directive("editable", dt), s.component("StoryblokComponent", te), s.component("StoryblokRichText", ut), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
|
|
1298
1304
|
"FallbackComponent",
|
|
1299
|
-
|
|
1305
|
+
ye(() => import("./FallbackComponent-Dky11gEu.js"))
|
|
1300
1306
|
);
|
|
1301
|
-
const { storyblokApi: t } =
|
|
1302
|
-
|
|
1307
|
+
const { storyblokApi: t } = it(e);
|
|
1308
|
+
A = t || null, s.provide("VueSDKOptions", e);
|
|
1303
1309
|
}
|
|
1304
1310
|
};
|
|
1305
1311
|
export {
|
|
1306
|
-
|
|
1312
|
+
v as BlockTypes,
|
|
1307
1313
|
_ as MarkTypes,
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1314
|
+
M as RichTextResolver,
|
|
1315
|
+
Ye as RichTextSchema,
|
|
1316
|
+
te as StoryblokComponent,
|
|
1317
|
+
ut as StoryblokRichText,
|
|
1318
|
+
bt as StoryblokVue,
|
|
1319
|
+
Z as TextTypes,
|
|
1320
|
+
gt as apiPlugin,
|
|
1321
|
+
ft as renderRichText,
|
|
1322
|
+
nt as richTextResolver,
|
|
1323
|
+
yt as useStoryblok,
|
|
1324
|
+
mt as useStoryblokApi,
|
|
1325
|
+
at as useStoryblokBridge,
|
|
1326
|
+
ht as useStoryblokRichText
|
|
1321
1327
|
};
|