@storyblok/vue 9.4.0 → 9.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/storyblok-vue.js +2 -2
- package/dist/storyblok-vue.mjs +516 -434
- package/package.json +2 -2
package/dist/storyblok-vue.mjs
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
* description: SDK to integrate Storyblok into your project using Vue.
|
|
5
5
|
* author: Storyblok
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent as
|
|
8
|
-
var
|
|
7
|
+
import { defineComponent as te, ref as N, resolveDynamicComponent as D, inject as ve, createBlock as se, openBlock as re, mergeProps as be, createSlots as ke, renderList as Re, withCtx as _e, renderSlot as we, normalizeProps as Te, guardReactiveProps as Ae, h as ne, createTextVNode as Ee, watch as Le, onMounted as $e, defineAsyncComponent as Se } from "vue";
|
|
8
|
+
var Ie = Object.defineProperty, Ce = (e, t, s) => t in e ? Ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, g = (e, t, s) => Ce(e, typeof t != "symbol" ? t + "" : t, s);
|
|
9
9
|
let k = /* @__PURE__ */ function(e) {
|
|
10
10
|
return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
|
|
11
|
-
}({}),
|
|
11
|
+
}({}), T = /* @__PURE__ */ function(e) {
|
|
12
12
|
return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
|
|
13
|
-
}({}),
|
|
13
|
+
}({}), xe = /* @__PURE__ */ function(e) {
|
|
14
14
|
return e.TEXT = "text", e;
|
|
15
|
-
}({}),
|
|
15
|
+
}({}), j = /* @__PURE__ */ function(e) {
|
|
16
16
|
return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
|
|
17
17
|
}({});
|
|
18
|
-
const
|
|
18
|
+
const Oe = [
|
|
19
19
|
"area",
|
|
20
20
|
"base",
|
|
21
21
|
"br",
|
|
@@ -30,46 +30,46 @@ const Se = [
|
|
|
30
30
|
"source",
|
|
31
31
|
"track",
|
|
32
32
|
"wbr"
|
|
33
|
-
],
|
|
34
|
-
const { custom: t, ...
|
|
35
|
-
...
|
|
33
|
+
], je = (e = {}) => {
|
|
34
|
+
const { custom: t, ...s } = e, r = {
|
|
35
|
+
...s,
|
|
36
36
|
...t
|
|
37
37
|
};
|
|
38
|
-
return Object.keys(
|
|
39
|
-
},
|
|
40
|
-
function
|
|
38
|
+
return Object.keys(r).map((n) => `${n}="${r[n]}"`).join(" ");
|
|
39
|
+
}, Pe = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
|
|
40
|
+
function Me(e) {
|
|
41
41
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
function
|
|
43
|
+
const I = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
|
|
44
|
+
function Ne(e, t) {
|
|
45
45
|
if (!t) return {
|
|
46
46
|
src: e,
|
|
47
47
|
attrs: {}
|
|
48
48
|
};
|
|
49
|
-
let
|
|
49
|
+
let s = 0, r = 0;
|
|
50
50
|
const n = {}, o = [];
|
|
51
|
-
function l(c,
|
|
52
|
-
typeof c != "number" || c <=
|
|
51
|
+
function l(c, f, m, h, w) {
|
|
52
|
+
typeof c != "number" || c <= f || c >= m ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${f} and ${m} (inclusive)`) : w.push(`${h}(${c})`);
|
|
53
53
|
}
|
|
54
54
|
if (typeof t == "object") {
|
|
55
|
-
if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (n.width = t.width,
|
|
56
|
-
const { filters: c } = t || {}, { blur:
|
|
57
|
-
|
|
55
|
+
if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (n.width = t.width, s = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (n.height = t.height, r = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete n.width, delete n.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (n.loading = t.loading), t.class && (n.class = t.class), t.filters) {
|
|
56
|
+
const { filters: c } = t || {}, { blur: f, brightness: m, fill: h, format: w, grayscale: L, quality: _, rotate: $ } = c || {};
|
|
57
|
+
f && l(f, 0, 100, "blur", o), _ && l(_, 0, 100, "quality", o), m && l(m, 0, 100, "brightness", o), h && o.push(`fill(${h})`), L && o.push("grayscale()"), $ && [
|
|
58
58
|
0,
|
|
59
59
|
90,
|
|
60
60
|
180,
|
|
61
61
|
270
|
|
62
|
-
].includes(t.filters.rotate || 0) && o.push(`rotate(${
|
|
62
|
+
].includes(t.filters.rotate || 0) && o.push(`rotate(${$})`), w && [
|
|
63
63
|
"webp",
|
|
64
64
|
"png",
|
|
65
65
|
"jpeg"
|
|
66
|
-
].includes(
|
|
66
|
+
].includes(w) && o.push(`format(${w})`);
|
|
67
67
|
}
|
|
68
68
|
t.srcset && (n.srcset = t.srcset.map((c) => {
|
|
69
69
|
if (typeof c == "number") return `${e}/m/${c}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${c}w`;
|
|
70
70
|
if (Array.isArray(c) && c.length === 2) {
|
|
71
|
-
const [
|
|
72
|
-
return `${e}/m/${
|
|
71
|
+
const [f, m] = c;
|
|
72
|
+
return `${e}/m/${f}x${m}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${f}w`;
|
|
73
73
|
} else {
|
|
74
74
|
console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
|
|
75
75
|
return;
|
|
@@ -77,204 +77,204 @@ function Ce(e, t) {
|
|
|
77
77
|
}).join(", ")), t.sizes && (n.sizes = t.sizes.join(", "));
|
|
78
78
|
}
|
|
79
79
|
let a = `${e}/m/`;
|
|
80
|
-
return (
|
|
80
|
+
return (s > 0 || r > 0) && (a = `${a}${s}x${r}/`), o.length > 0 && (a = `${a}filters:${o.join(":")}`), {
|
|
81
81
|
src: a,
|
|
82
82
|
attrs: n
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
85
|
+
function J(e, t = {}, s) {
|
|
86
|
+
const r = je(t), n = r ? `${e} ${r}` : e, o = Array.isArray(s) ? s.join("") : s || "";
|
|
87
87
|
if (e) {
|
|
88
|
-
if (
|
|
88
|
+
if (Oe.includes(e)) return `<${n}>`;
|
|
89
89
|
} else return o;
|
|
90
90
|
return `<${n}>${o}</${e}>`;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
const t = /* @__PURE__ */ new Map(), { renderFn:
|
|
94
|
-
const { textAlign:
|
|
95
|
-
return
|
|
96
|
-
...
|
|
92
|
+
function oe(e = {}) {
|
|
93
|
+
const t = /* @__PURE__ */ new Map(), { renderFn: s = J, textFn: r = Me, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: l = !1 } = e, a = s !== J, c = (i = {}) => {
|
|
94
|
+
const { textAlign: u, class: d, id: p, style: y, ...b } = i, v = [];
|
|
95
|
+
return y && v.push(y.endsWith(";") ? y : `${y};`), u && v.push(`text-align: ${u};`), I({
|
|
96
|
+
...b,
|
|
97
97
|
class: d,
|
|
98
98
|
id: p,
|
|
99
|
-
...
|
|
99
|
+
...v.length > 0 ? { style: v.join(" ") } : {}
|
|
100
100
|
});
|
|
101
|
-
},
|
|
102
|
-
const p = c(
|
|
103
|
-
return d.render(i, p,
|
|
104
|
-
},
|
|
105
|
-
const { src: d, alt: p, title:
|
|
106
|
-
let
|
|
101
|
+
}, f = (i) => (u, d) => {
|
|
102
|
+
const p = c(u.attrs);
|
|
103
|
+
return d.render(i, p, u.children || null);
|
|
104
|
+
}, m = (i, u) => {
|
|
105
|
+
const { src: d, alt: p, title: y, srcset: b, sizes: v } = i.attrs || {};
|
|
106
|
+
let A = d, R = {};
|
|
107
107
|
if (o) {
|
|
108
|
-
const { src:
|
|
109
|
-
|
|
108
|
+
const { src: ye, attrs: ge } = Ne(d, o);
|
|
109
|
+
A = ye, R = ge;
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
src:
|
|
111
|
+
const S = {
|
|
112
|
+
src: A,
|
|
113
113
|
alt: p,
|
|
114
|
-
title:
|
|
115
|
-
srcset:
|
|
116
|
-
sizes:
|
|
117
|
-
...
|
|
114
|
+
title: y,
|
|
115
|
+
srcset: b,
|
|
116
|
+
sizes: v,
|
|
117
|
+
...R
|
|
118
118
|
};
|
|
119
|
-
return
|
|
120
|
-
},
|
|
121
|
-
const { level: d, ...p } = i.attrs || {},
|
|
122
|
-
return
|
|
123
|
-
},
|
|
124
|
-
var d, p,
|
|
125
|
-
const
|
|
119
|
+
return u.render("img", I(S));
|
|
120
|
+
}, h = (i, u) => {
|
|
121
|
+
const { level: d, ...p } = i.attrs || {}, y = c(p);
|
|
122
|
+
return u.render(`h${d}`, y, i.children);
|
|
123
|
+
}, w = (i, u) => {
|
|
124
|
+
var d, p, y, b;
|
|
125
|
+
const v = u.render("img", {
|
|
126
126
|
src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
|
|
127
127
|
alt: (p = i.attrs) == null ? void 0 : p.alt,
|
|
128
128
|
style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
|
|
129
129
|
draggable: "false",
|
|
130
130
|
loading: "lazy"
|
|
131
131
|
});
|
|
132
|
-
return
|
|
132
|
+
return u.render("span", {
|
|
133
133
|
"data-type": "emoji",
|
|
134
|
-
"data-name": (
|
|
135
|
-
"data-emoji": (
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
const { class:
|
|
139
|
-
class:
|
|
140
|
-
id:
|
|
141
|
-
style:
|
|
134
|
+
"data-name": (y = i.attrs) == null ? void 0 : y.name,
|
|
135
|
+
"data-emoji": (b = i.attrs) == null ? void 0 : b.emoji
|
|
136
|
+
}, v);
|
|
137
|
+
}, L = (i, u) => u.render("pre", i.attrs || {}, u.render("code", {}, i.children || "")), _ = (i, u = !1) => ({ text: d, attrs: p }, y) => {
|
|
138
|
+
const { class: b, id: v, ...A } = p || {}, R = u ? {
|
|
139
|
+
class: b,
|
|
140
|
+
id: v,
|
|
141
|
+
style: Pe(A) || void 0
|
|
142
142
|
} : p || {};
|
|
143
|
-
return
|
|
144
|
-
},
|
|
145
|
-
const { marks:
|
|
143
|
+
return y.render(i, I(R), d);
|
|
144
|
+
}, $ = (i) => H(i), ce = (i) => {
|
|
145
|
+
const { marks: u, ...d } = i;
|
|
146
146
|
if ("text" in i) {
|
|
147
|
-
if (
|
|
148
|
-
...
|
|
149
|
-
text:
|
|
150
|
-
}),
|
|
147
|
+
if (u) return u.reduce((y, b) => $({
|
|
148
|
+
...b,
|
|
149
|
+
text: y
|
|
150
|
+
}), $({
|
|
151
151
|
...d,
|
|
152
152
|
children: d.children
|
|
153
153
|
}));
|
|
154
154
|
const p = i.attrs || {};
|
|
155
155
|
if (l) {
|
|
156
|
-
const
|
|
157
|
-
t.set("txt",
|
|
156
|
+
const y = t.get("txt") || 0;
|
|
157
|
+
t.set("txt", y + 1), p.key = `txt-${y}`;
|
|
158
158
|
}
|
|
159
|
-
return
|
|
159
|
+
return r(d.text, p);
|
|
160
160
|
}
|
|
161
161
|
return "";
|
|
162
|
-
},
|
|
163
|
-
const { linktype: d, href: p, anchor:
|
|
164
|
-
let
|
|
162
|
+
}, V = (i, u) => {
|
|
163
|
+
const { linktype: d, href: p, anchor: y, ...b } = i.attrs || {};
|
|
164
|
+
let v = "";
|
|
165
165
|
switch (d) {
|
|
166
|
-
case
|
|
167
|
-
case
|
|
168
|
-
|
|
166
|
+
case j.ASSET:
|
|
167
|
+
case j.URL:
|
|
168
|
+
v = p;
|
|
169
169
|
break;
|
|
170
|
-
case
|
|
171
|
-
|
|
170
|
+
case j.EMAIL:
|
|
171
|
+
v = `mailto:${p}`;
|
|
172
172
|
break;
|
|
173
|
-
case
|
|
174
|
-
|
|
173
|
+
case j.STORY:
|
|
174
|
+
v = p, y && (v = `${v}#${y}`);
|
|
175
175
|
break;
|
|
176
176
|
default:
|
|
177
|
-
|
|
177
|
+
v = p;
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
return
|
|
182
|
-
},
|
|
180
|
+
const A = { ...b };
|
|
181
|
+
return v && (A.href = v), u.render("a", A, i.text);
|
|
182
|
+
}, ue = (i, u) => {
|
|
183
183
|
var d, p;
|
|
184
|
-
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),
|
|
184
|
+
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
|
|
185
185
|
blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
|
|
186
186
|
id: (p = i.attrs) == null ? void 0 : p.id,
|
|
187
187
|
style: "display: none"
|
|
188
188
|
});
|
|
189
|
-
},
|
|
189
|
+
}, he = (i, u) => {
|
|
190
190
|
const d = c(i.attrs), p = i.children || null;
|
|
191
|
-
return
|
|
192
|
-
},
|
|
191
|
+
return u.render("table", d, u.render("tbody", {}, p));
|
|
192
|
+
}, de = (i, u) => {
|
|
193
193
|
const d = c(i.attrs);
|
|
194
|
-
return
|
|
195
|
-
},
|
|
196
|
-
const { colspan: d, rowspan: p, colwidth:
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
194
|
+
return u.render("tr", d, i.children);
|
|
195
|
+
}, pe = (i, u) => {
|
|
196
|
+
const { colspan: d, rowspan: p, colwidth: y, backgroundColor: b, textAlign: v, ...A } = i.attrs || {}, R = [];
|
|
197
|
+
y && R.push(`width: ${y}px;`), b && R.push(`background-color: ${b};`), v && R.push(`text-align: ${v};`);
|
|
198
|
+
const S = {
|
|
199
|
+
...A,
|
|
200
200
|
...d > 1 ? { colspan: d } : {},
|
|
201
201
|
...p > 1 ? { rowspan: p } : {},
|
|
202
|
-
...
|
|
202
|
+
...R.length > 0 ? { style: R.join(" ") } : {}
|
|
203
203
|
};
|
|
204
|
-
return
|
|
205
|
-
},
|
|
206
|
-
const { colspan: d, rowspan: p, colwidth:
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
204
|
+
return u.render("td", I(S), i.children);
|
|
205
|
+
}, fe = (i, u) => {
|
|
206
|
+
const { colspan: d, rowspan: p, colwidth: y, backgroundColor: b, textAlign: v, ...A } = i.attrs || {}, R = [];
|
|
207
|
+
y && R.push(`width: ${y}px;`), b && R.push(`background-color: ${b};`), v && R.push(`text-align: ${v};`);
|
|
208
|
+
const S = {
|
|
209
|
+
...A,
|
|
210
210
|
...d > 1 ? { colspan: d } : {},
|
|
211
211
|
...p > 1 ? { rowspan: p } : {},
|
|
212
|
-
...
|
|
212
|
+
...R.length > 0 ? { style: R.join(" ") } : {}
|
|
213
213
|
};
|
|
214
|
-
return
|
|
215
|
-
},
|
|
216
|
-
[k.DOCUMENT,
|
|
217
|
-
[k.HEADING,
|
|
218
|
-
[k.PARAGRAPH,
|
|
219
|
-
[k.UL_LIST,
|
|
220
|
-
[k.OL_LIST,
|
|
221
|
-
[k.LIST_ITEM,
|
|
222
|
-
[k.IMAGE,
|
|
223
|
-
[k.EMOJI,
|
|
224
|
-
[k.CODE_BLOCK,
|
|
225
|
-
[k.HR,
|
|
226
|
-
[k.BR,
|
|
227
|
-
[k.QUOTE,
|
|
228
|
-
[k.COMPONENT,
|
|
229
|
-
[
|
|
230
|
-
[
|
|
231
|
-
[
|
|
232
|
-
[
|
|
233
|
-
[
|
|
234
|
-
[
|
|
235
|
-
[
|
|
236
|
-
[
|
|
237
|
-
[
|
|
238
|
-
[
|
|
239
|
-
[
|
|
240
|
-
[
|
|
241
|
-
[
|
|
242
|
-
[k.TABLE,
|
|
243
|
-
[k.TABLE_ROW,
|
|
244
|
-
[k.TABLE_CELL,
|
|
245
|
-
[k.TABLE_HEADER,
|
|
246
|
-
]),
|
|
247
|
-
render: (i,
|
|
214
|
+
return u.render("th", I(S), i.children);
|
|
215
|
+
}, z = /* @__PURE__ */ new Map([
|
|
216
|
+
[k.DOCUMENT, f("")],
|
|
217
|
+
[k.HEADING, h],
|
|
218
|
+
[k.PARAGRAPH, f("p")],
|
|
219
|
+
[k.UL_LIST, f("ul")],
|
|
220
|
+
[k.OL_LIST, f("ol")],
|
|
221
|
+
[k.LIST_ITEM, f("li")],
|
|
222
|
+
[k.IMAGE, m],
|
|
223
|
+
[k.EMOJI, w],
|
|
224
|
+
[k.CODE_BLOCK, L],
|
|
225
|
+
[k.HR, f("hr")],
|
|
226
|
+
[k.BR, f("br")],
|
|
227
|
+
[k.QUOTE, f("blockquote")],
|
|
228
|
+
[k.COMPONENT, ue],
|
|
229
|
+
[xe.TEXT, ce],
|
|
230
|
+
[T.LINK, V],
|
|
231
|
+
[T.ANCHOR, V],
|
|
232
|
+
[T.STYLED, _("span", !0)],
|
|
233
|
+
[T.BOLD, _("strong")],
|
|
234
|
+
[T.TEXT_STYLE, _("span", !0)],
|
|
235
|
+
[T.ITALIC, _("em")],
|
|
236
|
+
[T.UNDERLINE, _("u")],
|
|
237
|
+
[T.STRIKE, _("s")],
|
|
238
|
+
[T.CODE, _("code")],
|
|
239
|
+
[T.SUPERSCRIPT, _("sup")],
|
|
240
|
+
[T.SUBSCRIPT, _("sub")],
|
|
241
|
+
[T.HIGHLIGHT, _("mark")],
|
|
242
|
+
[k.TABLE, he],
|
|
243
|
+
[k.TABLE_ROW, de],
|
|
244
|
+
[k.TABLE_CELL, pe],
|
|
245
|
+
[k.TABLE_HEADER, fe]
|
|
246
|
+
]), Y = new Map([...z, ...Object.entries(n).map(([i, u]) => [i, u])]), me = () => ({
|
|
247
|
+
render: (i, u = {}, d) => {
|
|
248
248
|
if (l && i) {
|
|
249
249
|
const p = t.get(i) || 0;
|
|
250
|
-
t.set(i, p + 1),
|
|
250
|
+
t.set(i, p + 1), u.key = `${i}-${p}`;
|
|
251
251
|
}
|
|
252
|
-
return
|
|
252
|
+
return s(i, u, d);
|
|
253
253
|
},
|
|
254
|
-
originalResolvers:
|
|
255
|
-
mergedResolvers:
|
|
254
|
+
originalResolvers: z,
|
|
255
|
+
mergedResolvers: Y
|
|
256
256
|
});
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
if (!
|
|
257
|
+
function O(i) {
|
|
258
|
+
const u = Y.get(i.type);
|
|
259
|
+
if (!u)
|
|
260
260
|
return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
|
|
261
|
-
const d =
|
|
262
|
-
if (i.type === "text") return
|
|
263
|
-
const p = i.content ? i.content.map(
|
|
264
|
-
return
|
|
261
|
+
const d = me();
|
|
262
|
+
if (i.type === "text") return u(i, d);
|
|
263
|
+
const p = i.content ? i.content.map(H) : void 0;
|
|
264
|
+
return u({
|
|
265
265
|
...i,
|
|
266
266
|
children: p
|
|
267
267
|
}, d);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
return i.type === "doc" ? a ? i.content.map(
|
|
269
|
+
function H(i) {
|
|
270
|
+
return i.type === "doc" ? a ? i.content.map(O) : i.content.map(O).join("") : Array.isArray(i) ? i.map(O) : O(i);
|
|
271
271
|
}
|
|
272
|
-
return { render:
|
|
272
|
+
return { render: H };
|
|
273
273
|
}
|
|
274
|
-
let
|
|
275
|
-
const
|
|
274
|
+
let K = !1;
|
|
275
|
+
const W = [], He = (e) => new Promise((t, s) => {
|
|
276
276
|
if (typeof window > "u") {
|
|
277
|
-
|
|
277
|
+
s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
if (window.storyblokRegisterEvent = (n) => {
|
|
@@ -282,70 +282,34 @@ const q = [], Oe = (e) => new Promise((t, r) => {
|
|
|
282
282
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
K ? n() : W.push(n);
|
|
286
286
|
}, document.getElementById("storyblok-javascript-bridge")) {
|
|
287
287
|
t(void 0);
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}, document.getElementsByTagName("head")[0].appendChild(
|
|
294
|
-
})
|
|
295
|
-
var je = class extends Error {
|
|
296
|
-
constructor(e) {
|
|
297
|
-
super(e), this.name = "AbortError";
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
function xe(e, t, r) {
|
|
301
|
-
if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
|
|
302
|
-
if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
|
|
303
|
-
const s = [];
|
|
304
|
-
let n = [], o = 0, l = !1;
|
|
305
|
-
const a = async () => {
|
|
306
|
-
o++;
|
|
307
|
-
const u = s.shift();
|
|
308
|
-
if (u) try {
|
|
309
|
-
const y = await e(...u.args);
|
|
310
|
-
u.resolve(y);
|
|
311
|
-
} catch (y) {
|
|
312
|
-
u.reject(y);
|
|
313
|
-
}
|
|
314
|
-
const f = setTimeout(() => {
|
|
315
|
-
o--, s.length > 0 && a(), n = n.filter((y) => y !== f);
|
|
316
|
-
}, r);
|
|
317
|
-
n.includes(f) || n.push(f);
|
|
318
|
-
}, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, y) => {
|
|
319
|
-
s.push({
|
|
320
|
-
resolve: f,
|
|
321
|
-
reject: y,
|
|
322
|
-
args: u
|
|
323
|
-
}), o < t && a();
|
|
324
|
-
});
|
|
325
|
-
return c.abort = () => {
|
|
326
|
-
l = !0, n.forEach(clearTimeout), n = [], s.forEach((u) => u.reject(() => new je("Throttle function aborted"))), s.length = 0;
|
|
327
|
-
}, c;
|
|
328
|
-
}
|
|
329
|
-
var Pe = xe;
|
|
330
|
-
const G = (e = "") => e.includes("/cdn/"), Ne = (e, t = 25, r = 1) => ({
|
|
290
|
+
const r = document.createElement("script");
|
|
291
|
+
r.async = !0, r.src = e, r.id = "storyblok-javascript-bridge", r.onerror = (n) => s(n), r.onload = (n) => {
|
|
292
|
+
W.forEach((o) => o()), K = !0, t(n);
|
|
293
|
+
}, document.getElementsByTagName("head")[0].appendChild(r);
|
|
294
|
+
}), X = (e = "") => e.includes("/cdn/"), De = (e, t = 25, s = 1) => ({
|
|
331
295
|
...e,
|
|
332
296
|
per_page: t,
|
|
333
|
-
page:
|
|
334
|
-
}),
|
|
335
|
-
const
|
|
336
|
-
return
|
|
337
|
-
},
|
|
338
|
-
const
|
|
297
|
+
page: s
|
|
298
|
+
}), Ue = (e) => new Promise((t) => setTimeout(t, e)), Be = (e = 0, t) => Array.from({ length: e }, t), Fe = (e = 0, t = e) => {
|
|
299
|
+
const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
|
|
300
|
+
return Be(s, (n, o) => o * r + e);
|
|
301
|
+
}, qe = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []), G = (e, t, s) => {
|
|
302
|
+
const r = [];
|
|
339
303
|
for (const n in e) {
|
|
340
304
|
if (!Object.prototype.hasOwnProperty.call(e, n)) continue;
|
|
341
305
|
const o = e[n];
|
|
342
306
|
if (o == null) continue;
|
|
343
|
-
const l =
|
|
307
|
+
const l = s ? "" : encodeURIComponent(n);
|
|
344
308
|
let a;
|
|
345
|
-
typeof o == "object" ? a =
|
|
309
|
+
typeof o == "object" ? a = G(o, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(o)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(o)}`, r.push(a);
|
|
346
310
|
}
|
|
347
|
-
return
|
|
348
|
-
},
|
|
311
|
+
return r.join("&");
|
|
312
|
+
}, Q = (e) => {
|
|
349
313
|
const t = {
|
|
350
314
|
eu: "api.storyblok.com",
|
|
351
315
|
us: "api-us.storyblok.com",
|
|
@@ -355,9 +319,9 @@ const G = (e = "") => e.includes("/cdn/"), Ne = (e, t = 25, r = 1) => ({
|
|
|
355
319
|
};
|
|
356
320
|
return t[e] ?? t.eu;
|
|
357
321
|
};
|
|
358
|
-
var
|
|
322
|
+
var Ve = class {
|
|
359
323
|
constructor(e) {
|
|
360
|
-
|
|
324
|
+
g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(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 = {};
|
|
361
325
|
}
|
|
362
326
|
/**
|
|
363
327
|
*
|
|
@@ -378,33 +342,33 @@ var Fe = class {
|
|
|
378
342
|
return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
|
|
379
343
|
}
|
|
380
344
|
async _responseHandler(e) {
|
|
381
|
-
const t = [],
|
|
345
|
+
const t = [], s = {
|
|
382
346
|
data: {},
|
|
383
347
|
headers: {},
|
|
384
348
|
status: 0,
|
|
385
349
|
statusText: ""
|
|
386
350
|
};
|
|
387
|
-
e.status !== 204 && await e.json().then((
|
|
388
|
-
|
|
351
|
+
e.status !== 204 && await e.json().then((r) => {
|
|
352
|
+
s.data = r;
|
|
389
353
|
});
|
|
390
|
-
for (const
|
|
391
|
-
return
|
|
354
|
+
for (const r of e.headers.entries()) t[r[0]] = r[1];
|
|
355
|
+
return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
|
|
392
356
|
}
|
|
393
357
|
async _methodHandler(e) {
|
|
394
|
-
let t = `${this.baseURL}${this.url}`,
|
|
395
|
-
e === "get" ? t = `${this.baseURL}${this.url}?${
|
|
396
|
-
const
|
|
397
|
-
let l;
|
|
358
|
+
let t = `${this.baseURL}${this.url}`, s = null;
|
|
359
|
+
e === "get" ? t = `${this.baseURL}${this.url}?${G(this.parameters)}` : s = JSON.stringify(this.parameters);
|
|
360
|
+
const r = new URL(t), n = new AbortController(), { signal: o } = n;
|
|
361
|
+
let l = null;
|
|
398
362
|
this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
|
|
399
363
|
try {
|
|
400
|
-
const a = await this.fetch(`${
|
|
364
|
+
const a = await this.fetch(`${r}`, {
|
|
401
365
|
method: e,
|
|
402
366
|
headers: this.headers,
|
|
403
|
-
body:
|
|
367
|
+
body: s,
|
|
404
368
|
signal: o,
|
|
405
369
|
...this.fetchOptions
|
|
406
370
|
});
|
|
407
|
-
this.timeout && clearTimeout(l);
|
|
371
|
+
this.timeout && l && clearTimeout(l);
|
|
408
372
|
const c = await this._responseHandler(a);
|
|
409
373
|
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
|
|
410
374
|
} catch (a) {
|
|
@@ -436,93 +400,209 @@ var Fe = class {
|
|
|
436
400
|
}
|
|
437
401
|
_statusHandler(e) {
|
|
438
402
|
const t = /20[0-6]/g;
|
|
439
|
-
return new Promise((
|
|
440
|
-
if (t.test(`${e.status}`)) return
|
|
403
|
+
return new Promise((s, r) => {
|
|
404
|
+
if (t.test(`${e.status}`)) return s(e);
|
|
441
405
|
const n = {
|
|
442
406
|
message: this._normalizeErrorMessage(e.data),
|
|
443
407
|
status: e.status,
|
|
444
408
|
response: e
|
|
445
409
|
};
|
|
446
|
-
|
|
410
|
+
r(n);
|
|
447
411
|
});
|
|
448
412
|
}
|
|
449
|
-
},
|
|
450
|
-
const
|
|
413
|
+
}, ze = Ve;
|
|
414
|
+
const Z = "SB-Agent", U = {
|
|
451
415
|
defaultAgentName: "SB-JS-CLIENT",
|
|
452
416
|
defaultAgentVersion: "SB-Agent-Version",
|
|
453
417
|
packageVersion: "7.0.0"
|
|
454
|
-
},
|
|
418
|
+
}, ie = {
|
|
419
|
+
DRAFT: "draft",
|
|
455
420
|
PUBLISHED: "published"
|
|
421
|
+
}, Ye = 25, B = {
|
|
422
|
+
SMALL: 25,
|
|
423
|
+
MEDIUM: 50,
|
|
424
|
+
LARGE: 75
|
|
425
|
+
}, C = {
|
|
426
|
+
SINGLE_OR_SMALL: 50,
|
|
427
|
+
MEDIUM: 15,
|
|
428
|
+
LARGE: 10,
|
|
429
|
+
VERY_LARGE: 6
|
|
430
|
+
}, F = 1e3, q = 3;
|
|
431
|
+
function Je(e) {
|
|
432
|
+
return e.version === ie.DRAFT;
|
|
433
|
+
}
|
|
434
|
+
function Ke(e, t) {
|
|
435
|
+
const s = e.includes("/cdn/stories/"), r = e.split("/").length > 3 && !e.endsWith("/cdn/stories"), n = "find_by" in t;
|
|
436
|
+
return s && r || n;
|
|
437
|
+
}
|
|
438
|
+
function We(e) {
|
|
439
|
+
return e <= B.SMALL ? C.SINGLE_OR_SMALL : e <= B.MEDIUM ? C.MEDIUM : e <= B.LARGE ? C.LARGE : C.VERY_LARGE;
|
|
440
|
+
}
|
|
441
|
+
function P(e, t, s = {}, r) {
|
|
442
|
+
if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, F);
|
|
443
|
+
if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, F);
|
|
444
|
+
if (t && !Je(t)) return F;
|
|
445
|
+
if (r !== void 0) return r;
|
|
446
|
+
if (Ke(e, t)) return C.SINGLE_OR_SMALL;
|
|
447
|
+
const n = t.per_page || Ye;
|
|
448
|
+
return We(n);
|
|
449
|
+
}
|
|
450
|
+
function Xe(e) {
|
|
451
|
+
if (!e) return null;
|
|
452
|
+
const t = e["x-ratelimit"] || e["X-RateLimit"], s = e["x-ratelimit-policy"] || e["X-RateLimit-Policy"];
|
|
453
|
+
if (!t && !s) return null;
|
|
454
|
+
const r = {};
|
|
455
|
+
if (t) {
|
|
456
|
+
const n = t.match(/r=(\d+)/);
|
|
457
|
+
n && (r.remaining = Number.parseInt(n[1], 10));
|
|
458
|
+
}
|
|
459
|
+
if (s) {
|
|
460
|
+
const n = s.match(/q=(\d+)/);
|
|
461
|
+
n && (r.max = Number.parseInt(n[1], 10));
|
|
462
|
+
}
|
|
463
|
+
return Object.keys(r).length > 0 ? r : null;
|
|
464
|
+
}
|
|
465
|
+
function Qe(e, t = !1) {
|
|
466
|
+
return {
|
|
467
|
+
userRateLimit: e,
|
|
468
|
+
serverHeadersRateLimit: void 0,
|
|
469
|
+
isManagementApi: t
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
var Ze = class extends Error {
|
|
473
|
+
constructor(e) {
|
|
474
|
+
super(e), this.name = "AbortError";
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
function et(e, t, s) {
|
|
478
|
+
if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
|
|
479
|
+
if (!Number.isFinite(s)) throw new TypeError("Expected `interval` to be a finite number");
|
|
480
|
+
const r = [];
|
|
481
|
+
let n = [], o = 0, l = !1;
|
|
482
|
+
const a = async () => {
|
|
483
|
+
o++;
|
|
484
|
+
const f = r.shift();
|
|
485
|
+
if (f) try {
|
|
486
|
+
const h = await e(...f.args);
|
|
487
|
+
f.resolve(h);
|
|
488
|
+
} catch (h) {
|
|
489
|
+
f.reject(h);
|
|
490
|
+
}
|
|
491
|
+
const m = setTimeout(() => {
|
|
492
|
+
o--, r.length > 0 && a(), n = n.filter((h) => h !== m);
|
|
493
|
+
}, s);
|
|
494
|
+
n.includes(m) || n.push(m);
|
|
495
|
+
}, c = (...f) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((m, h) => {
|
|
496
|
+
r.push({
|
|
497
|
+
resolve: m,
|
|
498
|
+
reject: h,
|
|
499
|
+
args: f
|
|
500
|
+
}), o < t && a();
|
|
501
|
+
});
|
|
502
|
+
return c.abort = () => {
|
|
503
|
+
l = !0, n.forEach(clearTimeout), n = [], r.forEach((f) => f.reject(() => new Ze("Throttle function aborted"))), r.length = 0;
|
|
504
|
+
}, c;
|
|
505
|
+
}
|
|
506
|
+
var tt = et, st = class {
|
|
507
|
+
constructor(e, t = 1e3) {
|
|
508
|
+
g(this, "queues"), g(this, "interval"), g(this, "throttledRequestFn"), this.queues = /* @__PURE__ */ new Map(), this.interval = t, this.throttledRequestFn = e;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Gets or creates a throttle queue for the specified rate limit
|
|
512
|
+
*/
|
|
513
|
+
getQueue(e) {
|
|
514
|
+
let t = this.queues.get(e);
|
|
515
|
+
return t || (t = tt(this.throttledRequestFn, e, this.interval), this.queues.set(e, t)), t;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Executes a request through the appropriate throttle queue based on rate limit
|
|
519
|
+
*/
|
|
520
|
+
execute(e, ...t) {
|
|
521
|
+
return this.getQueue(e)(...t);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Aborts all throttle queues
|
|
525
|
+
*/
|
|
526
|
+
abortAll() {
|
|
527
|
+
this.queues.forEach((e) => {
|
|
528
|
+
var t;
|
|
529
|
+
(t = e.abort) == null || t.call(e);
|
|
530
|
+
}), this.queues.clear();
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Gets the number of active queues
|
|
534
|
+
*/
|
|
535
|
+
getQueueCount() {
|
|
536
|
+
return this.queues.size;
|
|
537
|
+
}
|
|
456
538
|
};
|
|
457
|
-
let
|
|
458
|
-
const
|
|
459
|
-
var
|
|
539
|
+
let M = {};
|
|
540
|
+
const E = {};
|
|
541
|
+
var rt = class {
|
|
460
542
|
/**
|
|
461
543
|
*
|
|
462
544
|
* @param config ISbConfig interface
|
|
463
545
|
* @param pEndpoint string, optional
|
|
464
546
|
*/
|
|
465
547
|
constructor(e, t) {
|
|
466
|
-
|
|
467
|
-
let
|
|
468
|
-
if (!
|
|
469
|
-
const
|
|
470
|
-
e.oauthToken ?
|
|
548
|
+
g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttleManager"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "rateLimitConfig"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
|
|
549
|
+
let s = e.endpoint || t;
|
|
550
|
+
if (!s) {
|
|
551
|
+
const n = e.https === !1 ? "http" : "https";
|
|
552
|
+
e.oauthToken ? s = `${n}://${Q(e.region)}/v1` : s = `${n}://${Q(e.region)}/v2`;
|
|
471
553
|
}
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}),
|
|
476
|
-
|
|
477
|
-
e.oauthToken && (s.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Pe(this.throttledRequest.bind(this), n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ze.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Ve({
|
|
478
|
-
baseURL: r,
|
|
554
|
+
const r = new Headers();
|
|
555
|
+
r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, o]) => {
|
|
556
|
+
r.set(n, o);
|
|
557
|
+
}), r.has(Z) || (r.set(Z, U.defaultAgentName), r.set(U.defaultAgentVersion, U.packageVersion)), e.oauthToken && r.set("Authorization", e.oauthToken), this.rateLimitConfig = Qe(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new st(this.throttledRequest.bind(this), 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ie.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new ze({
|
|
558
|
+
baseURL: s,
|
|
479
559
|
timeout: e.timeout || 0,
|
|
480
|
-
headers:
|
|
560
|
+
headers: r,
|
|
481
561
|
responseInterceptor: e.responseInterceptor,
|
|
482
562
|
fetch: e.fetch
|
|
483
563
|
});
|
|
484
564
|
}
|
|
485
565
|
parseParams(e) {
|
|
486
|
-
return e.token || (e.token = this.getToken()), e.cv || (e.cv =
|
|
566
|
+
return e.token || (e.token = this.getToken()), e.cv || (e.cv = E[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
|
|
487
567
|
}
|
|
488
568
|
factoryParamOptions(e, t) {
|
|
489
|
-
return
|
|
569
|
+
return X(e) ? this.parseParams(t) : t;
|
|
490
570
|
}
|
|
491
|
-
makeRequest(e, t,
|
|
492
|
-
const o = this.factoryParamOptions(e,
|
|
571
|
+
makeRequest(e, t, s, r, n) {
|
|
572
|
+
const o = this.factoryParamOptions(e, De(t, s, r));
|
|
493
573
|
return this.cacheResponse(e, o, void 0, n);
|
|
494
574
|
}
|
|
495
|
-
get(e, t = {},
|
|
575
|
+
get(e, t = {}, s) {
|
|
496
576
|
t || (t = {});
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
const n = this.factoryParamOptions(
|
|
500
|
-
return this.cacheResponse(
|
|
577
|
+
const r = `/${e}`;
|
|
578
|
+
X(r) && (t.version = t.version || this.version);
|
|
579
|
+
const n = this.factoryParamOptions(r, t);
|
|
580
|
+
return this.cacheResponse(r, n, void 0, s);
|
|
501
581
|
}
|
|
502
|
-
async getAll(e, t = {},
|
|
503
|
-
const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`.replace(/\/$/, ""), l =
|
|
582
|
+
async getAll(e, t = {}, s, r) {
|
|
583
|
+
const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`.replace(/\/$/, ""), l = s ?? o.substring(o.lastIndexOf("/") + 1);
|
|
504
584
|
t.version = t.version || this.version;
|
|
505
|
-
const a = 1, c = await this.makeRequest(o, t, n, a,
|
|
506
|
-
return
|
|
585
|
+
const a = 1, c = await this.makeRequest(o, t, n, a, r), f = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, m = await qe(Fe(a, f), (h) => this.makeRequest(o, t, n, h + 1, r));
|
|
586
|
+
return Ge([c, ...m], (h) => Object.values(h.data[l]));
|
|
507
587
|
}
|
|
508
|
-
post(e, t = {},
|
|
509
|
-
const
|
|
510
|
-
return this.
|
|
588
|
+
post(e, t = {}, s) {
|
|
589
|
+
const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
|
|
590
|
+
return this.throttleManager.execute(n, "post", r, t, s);
|
|
511
591
|
}
|
|
512
|
-
put(e, t = {},
|
|
513
|
-
const
|
|
514
|
-
return this.
|
|
592
|
+
put(e, t = {}, s) {
|
|
593
|
+
const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
|
|
594
|
+
return this.throttleManager.execute(n, "put", r, t, s);
|
|
515
595
|
}
|
|
516
|
-
delete(e, t = {},
|
|
596
|
+
delete(e, t = {}, s) {
|
|
517
597
|
t || (t = {});
|
|
518
|
-
const
|
|
519
|
-
return this.
|
|
598
|
+
const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
|
|
599
|
+
return this.throttleManager.execute(n, "delete", r, t, s);
|
|
520
600
|
}
|
|
521
601
|
getStories(e = {}, t) {
|
|
522
602
|
return this._addResolveLevel(e), this.get("cdn/stories", e, t);
|
|
523
603
|
}
|
|
524
|
-
getStory(e, t = {},
|
|
525
|
-
return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t,
|
|
604
|
+
getStory(e, t = {}, s) {
|
|
605
|
+
return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
|
|
526
606
|
}
|
|
527
607
|
getToken() {
|
|
528
608
|
return this.accessToken;
|
|
@@ -536,9 +616,9 @@ var qe = class {
|
|
|
536
616
|
_cleanCopy(e) {
|
|
537
617
|
return JSON.parse(JSON.stringify(e));
|
|
538
618
|
}
|
|
539
|
-
_insertLinks(e, t,
|
|
540
|
-
const
|
|
541
|
-
|
|
619
|
+
_insertLinks(e, t, s) {
|
|
620
|
+
const r = e[t];
|
|
621
|
+
r && r.fieldtype === "multilink" && r.linktype === "story" && typeof r.id == "string" && this.links[s][r.id] ? r.story = this._cleanCopy(this.links[s][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[s][r.uuid] && (r.story = this._cleanCopy(this.links[s][r.uuid]));
|
|
542
622
|
}
|
|
543
623
|
/**
|
|
544
624
|
*
|
|
@@ -559,9 +639,9 @@ var qe = class {
|
|
|
559
639
|
* - For single strings: directly replaces the UUID with the story reference
|
|
560
640
|
* - For arrays: maps through each UUID and replaces with corresponding story references
|
|
561
641
|
*/
|
|
562
|
-
_resolveField(e, t,
|
|
563
|
-
const
|
|
564
|
-
typeof
|
|
642
|
+
_resolveField(e, t, s) {
|
|
643
|
+
const r = e[t];
|
|
644
|
+
typeof r == "string" ? e[t] = this.getStoryReference(s, r) : Array.isArray(r) && (e[t] = r.map((n) => this.getStoryReference(s, n)).filter(Boolean));
|
|
565
645
|
}
|
|
566
646
|
/**
|
|
567
647
|
* Inserts relations into the JSON tree by resolving references
|
|
@@ -580,13 +660,13 @@ var qe = class {
|
|
|
580
660
|
* The method supports both string and array formats for the fields parameter,
|
|
581
661
|
* allowing flexible specification of relation patterns.
|
|
582
662
|
*/
|
|
583
|
-
_insertRelations(e, t,
|
|
584
|
-
if (Array.isArray(
|
|
585
|
-
this._resolveField(e, t,
|
|
663
|
+
_insertRelations(e, t, s, r) {
|
|
664
|
+
if (Array.isArray(s) ? s.find((o) => o.endsWith(`.${t}`)) : s.endsWith(`.${t}`)) {
|
|
665
|
+
this._resolveField(e, t, r);
|
|
586
666
|
return;
|
|
587
667
|
}
|
|
588
668
|
const n = e.component ? `${e.component}.${t}` : t;
|
|
589
|
-
(Array.isArray(
|
|
669
|
+
(Array.isArray(s) ? s.includes(n) : s === n) && this._resolveField(e, t, r);
|
|
590
670
|
}
|
|
591
671
|
/**
|
|
592
672
|
* Recursively traverses and resolves relations in the story content tree
|
|
@@ -594,20 +674,20 @@ var qe = class {
|
|
|
594
674
|
* @param fields - The relation patterns to resolve
|
|
595
675
|
* @param resolveId - The unique identifier for the current resolution context
|
|
596
676
|
*/
|
|
597
|
-
iterateTree(e, t,
|
|
598
|
-
const
|
|
677
|
+
iterateTree(e, t, s) {
|
|
678
|
+
const r = (n, o = "") => {
|
|
599
679
|
if (!(!n || n._stopResolving)) {
|
|
600
|
-
if (Array.isArray(n)) n.forEach((l, a) =>
|
|
680
|
+
if (Array.isArray(n)) n.forEach((l, a) => r(l, `${o}[${a}]`));
|
|
601
681
|
else if (typeof n == "object") for (const l in n) {
|
|
602
682
|
const a = o ? `${o}.${l}` : l;
|
|
603
|
-
(n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t,
|
|
683
|
+
(n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t, s), this._insertLinks(n, l, s)), r(n[l], a);
|
|
604
684
|
}
|
|
605
685
|
}
|
|
606
686
|
};
|
|
607
|
-
|
|
687
|
+
r(e.content);
|
|
608
688
|
}
|
|
609
|
-
async resolveLinks(e, t,
|
|
610
|
-
let
|
|
689
|
+
async resolveLinks(e, t, s) {
|
|
690
|
+
let r = [];
|
|
611
691
|
if (e.link_uuids) {
|
|
612
692
|
const n = e.link_uuids.length, o = [], l = 50;
|
|
613
693
|
for (let a = 0; a < n; a += l) {
|
|
@@ -622,18 +702,18 @@ var qe = class {
|
|
|
622
702
|
starts_with: t.starts_with,
|
|
623
703
|
by_uuids: o[a].join(",")
|
|
624
704
|
})).data.stories.forEach((c) => {
|
|
625
|
-
|
|
705
|
+
r.push(c);
|
|
626
706
|
});
|
|
627
|
-
} else
|
|
628
|
-
|
|
629
|
-
this.links[
|
|
707
|
+
} else r = e.links;
|
|
708
|
+
r.forEach((n) => {
|
|
709
|
+
this.links[s][n.uuid] = {
|
|
630
710
|
...n,
|
|
631
711
|
_stopResolving: !0
|
|
632
712
|
};
|
|
633
713
|
});
|
|
634
714
|
}
|
|
635
|
-
async resolveRelations(e, t,
|
|
636
|
-
let
|
|
715
|
+
async resolveRelations(e, t, s) {
|
|
716
|
+
let r = [];
|
|
637
717
|
if (e.rel_uuids) {
|
|
638
718
|
const n = e.rel_uuids.length, o = [], l = 50;
|
|
639
719
|
for (let a = 0; a < n; a += l) {
|
|
@@ -649,12 +729,12 @@ var qe = class {
|
|
|
649
729
|
by_uuids: o[a].join(","),
|
|
650
730
|
excluding_fields: t.excluding_fields
|
|
651
731
|
})).data.stories.forEach((c) => {
|
|
652
|
-
|
|
732
|
+
r.push(c);
|
|
653
733
|
});
|
|
654
|
-
|
|
655
|
-
} else
|
|
656
|
-
|
|
657
|
-
this.relations[
|
|
734
|
+
r.length > 0 && (e.rels = r, delete e.rel_uuids);
|
|
735
|
+
} else r = e.rels;
|
|
736
|
+
r && r.length > 0 && r.forEach((n) => {
|
|
737
|
+
this.relations[s][n.uuid] = {
|
|
658
738
|
...n,
|
|
659
739
|
_stopResolving: !0
|
|
660
740
|
};
|
|
@@ -669,84 +749,86 @@ var qe = class {
|
|
|
669
749
|
* @returns Promise<void>
|
|
670
750
|
*
|
|
671
751
|
*/
|
|
672
|
-
async resolveStories(e, t,
|
|
673
|
-
var
|
|
752
|
+
async resolveStories(e, t, s) {
|
|
753
|
+
var r, n;
|
|
674
754
|
let o = [];
|
|
675
|
-
if (this.links[
|
|
755
|
+
if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && [
|
|
676
756
|
"1",
|
|
677
757
|
"story",
|
|
678
758
|
"url",
|
|
679
759
|
"link"
|
|
680
|
-
].includes(t.resolve_links) && ((
|
|
681
|
-
e.story ? this.iterateTree(e.story, o,
|
|
682
|
-
this.iterateTree(l, o,
|
|
683
|
-
}), this.stringifiedStoriesCache = {}, delete this.links[
|
|
760
|
+
].includes(t.resolve_links) && ((r = e.links) != null && r.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations) for (const l in this.relations[s]) this.iterateTree(this.relations[s][l], o, s);
|
|
761
|
+
e.story ? this.iterateTree(e.story, o, s) : e.stories.forEach((l) => {
|
|
762
|
+
this.iterateTree(l, o, s);
|
|
763
|
+
}), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
|
|
684
764
|
}
|
|
685
|
-
async cacheResponse(e, t,
|
|
686
|
-
const n =
|
|
765
|
+
async cacheResponse(e, t, s, r) {
|
|
766
|
+
const n = G({
|
|
687
767
|
url: e,
|
|
688
768
|
params: t
|
|
689
769
|
}), o = this.cacheProvider();
|
|
690
770
|
if (t.version === "published" && e !== "/cdn/spaces/me") {
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
771
|
+
const a = await o.get(n);
|
|
772
|
+
if (a) return Promise.resolve(a);
|
|
693
773
|
}
|
|
694
|
-
|
|
695
|
-
|
|
774
|
+
const l = P(e, t, this.rateLimitConfig);
|
|
775
|
+
return new Promise(async (a, c) => {
|
|
776
|
+
var f;
|
|
696
777
|
try {
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
699
|
-
let
|
|
700
|
-
data:
|
|
701
|
-
headers:
|
|
778
|
+
const m = await this.throttleManager.execute(l, "get", e, t, r);
|
|
779
|
+
if (m.status !== 200) return c(m);
|
|
780
|
+
let h = {
|
|
781
|
+
data: m.data,
|
|
782
|
+
headers: m.headers
|
|
702
783
|
};
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
784
|
+
const w = Xe(m.headers);
|
|
785
|
+
if ((w == null ? void 0 : w.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = w.max), (f = m.headers) != null && f["per-page"] && (h = Object.assign({}, h, {
|
|
786
|
+
perPage: m.headers["per-page"] ? Number.parseInt(m.headers["per-page"]) : 0,
|
|
787
|
+
total: m.headers["per-page"] ? Number.parseInt(m.headers.total) : 0
|
|
788
|
+
})), h.data.story || h.data.stories) {
|
|
789
|
+
const _ = this.resolveCounter = ++this.resolveCounter % 1e3;
|
|
790
|
+
await this.resolveStories(h.data, t, `${_}`), h = await this.processInlineAssets(h);
|
|
709
791
|
}
|
|
710
|
-
t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n,
|
|
711
|
-
const
|
|
712
|
-
return t.token &&
|
|
713
|
-
} catch (
|
|
714
|
-
if (
|
|
715
|
-
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await
|
|
716
|
-
|
|
792
|
+
t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, h);
|
|
793
|
+
const L = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
|
|
794
|
+
return t.token && h.data.cv && (L && E[t.token] && E[t.token] !== h.data.cv && await this.flushCache(), E[t.token] = h.data.cv), a(h);
|
|
795
|
+
} catch (m) {
|
|
796
|
+
if (m.response && m.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
|
|
797
|
+
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Ue(this.retriesDelay), this.cacheResponse(e, t, s).then(a).catch(c);
|
|
798
|
+
c(m);
|
|
717
799
|
}
|
|
718
800
|
});
|
|
719
801
|
}
|
|
720
|
-
throttledRequest(e, t,
|
|
721
|
-
return this.client.setFetchOptions(
|
|
802
|
+
throttledRequest(e, t, s, r) {
|
|
803
|
+
return this.client.setFetchOptions(r), this.client[e](t, s);
|
|
722
804
|
}
|
|
723
805
|
cacheVersions() {
|
|
724
|
-
return
|
|
806
|
+
return E;
|
|
725
807
|
}
|
|
726
808
|
cacheVersion() {
|
|
727
|
-
return
|
|
809
|
+
return E[this.accessToken];
|
|
728
810
|
}
|
|
729
811
|
setCacheVersion(e) {
|
|
730
|
-
this.accessToken && (
|
|
812
|
+
this.accessToken && (E[this.accessToken] = e);
|
|
731
813
|
}
|
|
732
814
|
clearCacheVersion() {
|
|
733
|
-
this.accessToken && (
|
|
815
|
+
this.accessToken && (E[this.accessToken] = 0);
|
|
734
816
|
}
|
|
735
817
|
cacheProvider() {
|
|
736
818
|
switch (this.cache.type) {
|
|
737
819
|
case "memory":
|
|
738
820
|
return {
|
|
739
821
|
get(e) {
|
|
740
|
-
return Promise.resolve(
|
|
822
|
+
return Promise.resolve(M[e]);
|
|
741
823
|
},
|
|
742
824
|
getAll() {
|
|
743
|
-
return Promise.resolve(
|
|
825
|
+
return Promise.resolve(M);
|
|
744
826
|
},
|
|
745
827
|
set(e, t) {
|
|
746
|
-
return
|
|
828
|
+
return M[e] = t, Promise.resolve(void 0);
|
|
747
829
|
},
|
|
748
830
|
flush() {
|
|
749
|
-
return
|
|
831
|
+
return M = {}, Promise.resolve(void 0);
|
|
750
832
|
}
|
|
751
833
|
};
|
|
752
834
|
case "custom":
|
|
@@ -773,21 +855,21 @@ var qe = class {
|
|
|
773
855
|
}
|
|
774
856
|
async processInlineAssets(e) {
|
|
775
857
|
if (!this.inlineAssets) return e;
|
|
776
|
-
const t = (
|
|
777
|
-
if (!
|
|
778
|
-
if (Array.isArray(
|
|
779
|
-
let
|
|
780
|
-
|
|
781
|
-
...e.data.assets.find((n) => n.id ===
|
|
782
|
-
...
|
|
858
|
+
const t = (s) => {
|
|
859
|
+
if (!s || typeof s != "object") return s;
|
|
860
|
+
if (Array.isArray(s)) return s.map((n) => t(n));
|
|
861
|
+
let r = { ...s };
|
|
862
|
+
r.fieldtype === "asset" && Array.isArray(e.data.assets) && (r = {
|
|
863
|
+
...e.data.assets.find((n) => n.id === r.id),
|
|
864
|
+
...r
|
|
783
865
|
});
|
|
784
|
-
for (const n in
|
|
785
|
-
return
|
|
866
|
+
for (const n in r) typeof r[n] == "object" && (r[n] = t(r[n]));
|
|
867
|
+
return r;
|
|
786
868
|
};
|
|
787
|
-
return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((
|
|
869
|
+
return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((s) => (s.content = t(s.content), s))), e;
|
|
788
870
|
}
|
|
789
|
-
},
|
|
790
|
-
const
|
|
871
|
+
}, nt = rt;
|
|
872
|
+
const pt = (e = {}) => {
|
|
791
873
|
const { apiOptions: t } = e;
|
|
792
874
|
if (!t || !t.accessToken) {
|
|
793
875
|
console.error(
|
|
@@ -795,8 +877,8 @@ const tt = (e = {}) => {
|
|
|
795
877
|
);
|
|
796
878
|
return;
|
|
797
879
|
}
|
|
798
|
-
return { storyblokApi: new
|
|
799
|
-
},
|
|
880
|
+
return { storyblokApi: new nt(t) };
|
|
881
|
+
}, ot = (e) => {
|
|
800
882
|
if (typeof e != "object" || typeof e._editable > "u")
|
|
801
883
|
return {};
|
|
802
884
|
try {
|
|
@@ -811,10 +893,10 @@ const tt = (e = {}) => {
|
|
|
811
893
|
return {};
|
|
812
894
|
}
|
|
813
895
|
};
|
|
814
|
-
let
|
|
815
|
-
const
|
|
816
|
-
var
|
|
817
|
-
const n = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((
|
|
896
|
+
let ee = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
897
|
+
const it = (e, t, s = {}) => {
|
|
898
|
+
var r;
|
|
899
|
+
const n = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
|
|
818
900
|
"_storyblok"
|
|
819
901
|
), l = o !== null && +o === e;
|
|
820
902
|
if (!(!n || !l)) {
|
|
@@ -823,158 +905,158 @@ const Ke = (e, t, r = {}) => {
|
|
|
823
905
|
return;
|
|
824
906
|
}
|
|
825
907
|
window.storyblokRegisterEvent(() => {
|
|
826
|
-
new window.StoryblokBridge(
|
|
908
|
+
new window.StoryblokBridge(s).on(["input", "published", "change"], (a) => {
|
|
827
909
|
var c;
|
|
828
910
|
a && (a.action === "input" && ((c = a.story) == null ? void 0 : c.id) === e ? t(a.story) : (a.action === "change" || a.action === "published") && a.storyId === e && window.location.reload());
|
|
829
911
|
});
|
|
830
912
|
});
|
|
831
913
|
}
|
|
832
|
-
},
|
|
833
|
-
var t,
|
|
914
|
+
}, at = (e = {}) => {
|
|
915
|
+
var t, s;
|
|
834
916
|
const {
|
|
835
|
-
bridge:
|
|
917
|
+
bridge: r,
|
|
836
918
|
accessToken: n,
|
|
837
919
|
use: o = [],
|
|
838
920
|
apiOptions: l = {},
|
|
839
921
|
bridgeUrl: a
|
|
840
922
|
} = e;
|
|
841
923
|
l.accessToken = l.accessToken || n;
|
|
842
|
-
const c = { bridge:
|
|
843
|
-
let
|
|
844
|
-
o.forEach((
|
|
845
|
-
|
|
846
|
-
}), a && (
|
|
847
|
-
const
|
|
848
|
-
return
|
|
924
|
+
const c = { bridge: r, apiOptions: l };
|
|
925
|
+
let f = {};
|
|
926
|
+
o.forEach((h) => {
|
|
927
|
+
f = { ...f, ...h(c) };
|
|
928
|
+
}), a && (ee = a);
|
|
929
|
+
const m = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
|
|
930
|
+
return r !== !1 && m && He(ee), f;
|
|
849
931
|
};
|
|
850
|
-
function
|
|
851
|
-
return
|
|
932
|
+
function ft(e, t) {
|
|
933
|
+
return oe(t).render(e);
|
|
852
934
|
}
|
|
853
|
-
const
|
|
935
|
+
const ae = /* @__PURE__ */ te({
|
|
854
936
|
__name: "StoryblokComponent",
|
|
855
937
|
props: {
|
|
856
938
|
blok: {}
|
|
857
939
|
},
|
|
858
940
|
setup(e, { expose: t }) {
|
|
859
941
|
var a;
|
|
860
|
-
const
|
|
942
|
+
const s = e, r = N();
|
|
861
943
|
t({
|
|
862
|
-
value:
|
|
944
|
+
value: r
|
|
863
945
|
});
|
|
864
|
-
const n = typeof
|
|
865
|
-
return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof
|
|
946
|
+
const n = typeof D(s.blok.component) != "string", o = ve("VueSDKOptions"), l = N((a = s.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
|
|
947
|
+
return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof D(l.value) == "string" && console.error(
|
|
866
948
|
`Is the Fallback component "${l.value}" registered properly?`
|
|
867
949
|
)) : console.error(
|
|
868
|
-
`Component could not be found for blok "${
|
|
869
|
-
)), (c,
|
|
950
|
+
`Component could not be found for blok "${s.blok.component}"! Is it defined in main.ts as "app.component("${s.blok.component}", ${s.blok.component});"?`
|
|
951
|
+
)), (c, f) => (re(), se(D(l.value), be({
|
|
870
952
|
ref_key: "blokRef",
|
|
871
|
-
ref:
|
|
872
|
-
}, { ...c.$props, ...c.$attrs }),
|
|
873
|
-
|
|
874
|
-
name:
|
|
875
|
-
fn:
|
|
876
|
-
|
|
953
|
+
ref: r
|
|
954
|
+
}, { ...c.$props, ...c.$attrs }), ke({ _: 2 }, [
|
|
955
|
+
Re(c.$slots, (m, h) => ({
|
|
956
|
+
name: h,
|
|
957
|
+
fn: _e((w) => [
|
|
958
|
+
we(c.$slots, h, Te(Ae(w)))
|
|
877
959
|
])
|
|
878
960
|
}))
|
|
879
961
|
]), 1040));
|
|
880
962
|
}
|
|
881
|
-
}),
|
|
882
|
-
var
|
|
883
|
-
const t = (
|
|
963
|
+
}), lt = (e) => {
|
|
964
|
+
var s;
|
|
965
|
+
const t = (s = e == null ? void 0 : e.attrs) == null ? void 0 : s.body;
|
|
884
966
|
return !Array.isArray(t) || t.length === 0 ? [] : t.map(
|
|
885
|
-
(
|
|
967
|
+
(r) => {
|
|
886
968
|
var n;
|
|
887
|
-
return
|
|
888
|
-
blok:
|
|
969
|
+
return ne(ae, {
|
|
970
|
+
blok: r,
|
|
889
971
|
id: (n = e == null ? void 0 : e.attrs) == null ? void 0 : n.id
|
|
890
972
|
}, e.children);
|
|
891
973
|
}
|
|
892
974
|
);
|
|
893
975
|
};
|
|
894
|
-
function
|
|
976
|
+
function ct(e) {
|
|
895
977
|
const t = {
|
|
896
|
-
renderFn:
|
|
978
|
+
renderFn: ne,
|
|
897
979
|
// TODO: Check why this changed.
|
|
898
980
|
// @ts-expect-error - createTextVNode types has been recently changed.
|
|
899
|
-
textFn:
|
|
981
|
+
textFn: Ee,
|
|
900
982
|
keyedResolvers: !0,
|
|
901
983
|
resolvers: {
|
|
902
|
-
[k.COMPONENT]:
|
|
984
|
+
[k.COMPONENT]: lt,
|
|
903
985
|
...e.resolvers
|
|
904
986
|
}
|
|
905
987
|
};
|
|
906
|
-
return
|
|
988
|
+
return oe(t);
|
|
907
989
|
}
|
|
908
|
-
const
|
|
990
|
+
const ut = /* @__PURE__ */ te({
|
|
909
991
|
__name: "StoryblokRichText",
|
|
910
992
|
props: {
|
|
911
993
|
doc: {},
|
|
912
994
|
resolvers: {}
|
|
913
995
|
},
|
|
914
996
|
setup(e) {
|
|
915
|
-
const t = e,
|
|
916
|
-
return
|
|
917
|
-
const { render: l } =
|
|
997
|
+
const t = e, s = N(), r = () => s.value;
|
|
998
|
+
return Le([() => t.doc, () => t.resolvers], ([n, o]) => {
|
|
999
|
+
const { render: l } = ct({
|
|
918
1000
|
resolvers: o ?? {}
|
|
919
1001
|
});
|
|
920
|
-
|
|
1002
|
+
s.value = l(n);
|
|
921
1003
|
}, {
|
|
922
1004
|
immediate: !0,
|
|
923
1005
|
deep: !0
|
|
924
|
-
}), (n, o) => (
|
|
1006
|
+
}), (n, o) => (re(), se(r));
|
|
925
1007
|
}
|
|
926
|
-
}),
|
|
1008
|
+
}), ht = {
|
|
927
1009
|
beforeMount(e, t) {
|
|
928
1010
|
if (t.value) {
|
|
929
|
-
const
|
|
930
|
-
Object.keys(
|
|
1011
|
+
const s = ot(t.value);
|
|
1012
|
+
Object.keys(s).length > 0 && (e.setAttribute("data-blok-c", s["data-blok-c"]), e.setAttribute("data-blok-uid", s["data-blok-uid"]), e.classList.add("storyblok__outline"));
|
|
931
1013
|
}
|
|
932
1014
|
}
|
|
933
|
-
},
|
|
1015
|
+
}, le = (e) => {
|
|
934
1016
|
console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
|
|
935
1017
|
`);
|
|
936
1018
|
};
|
|
937
|
-
let
|
|
938
|
-
const
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
(n) =>
|
|
944
|
-
|
|
1019
|
+
let x = null;
|
|
1020
|
+
const mt = () => (x || le("useStoryblokApi"), x), yt = async (e, t = {}, s = {}) => {
|
|
1021
|
+
const r = N(null);
|
|
1022
|
+
if (s.resolveRelations = s.resolveRelations ?? t.resolve_relations, s.resolveLinks = s.resolveLinks ?? t.resolve_links, $e(() => {
|
|
1023
|
+
r.value && r.value.id && it(
|
|
1024
|
+
r.value.id,
|
|
1025
|
+
(n) => r.value = n,
|
|
1026
|
+
s
|
|
945
1027
|
);
|
|
946
|
-
}),
|
|
947
|
-
const { data: n } = await
|
|
1028
|
+
}), x) {
|
|
1029
|
+
const { data: n } = await x.get(
|
|
948
1030
|
`cdn/stories/${e}`,
|
|
949
1031
|
t
|
|
950
1032
|
);
|
|
951
|
-
|
|
1033
|
+
r.value = n.story;
|
|
952
1034
|
} else
|
|
953
|
-
|
|
954
|
-
return
|
|
955
|
-
},
|
|
1035
|
+
le("useStoryblok");
|
|
1036
|
+
return r;
|
|
1037
|
+
}, gt = {
|
|
956
1038
|
install(e, t = {}) {
|
|
957
|
-
e.directive("editable",
|
|
1039
|
+
e.directive("editable", ht), e.component("StoryblokComponent", ae), e.component("StoryblokRichText", ut), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
|
|
958
1040
|
"FallbackComponent",
|
|
959
|
-
|
|
1041
|
+
Se(() => import("./FallbackComponent-vpkAikkq.js"))
|
|
960
1042
|
);
|
|
961
|
-
const { storyblokApi:
|
|
962
|
-
|
|
1043
|
+
const { storyblokApi: s } = at(t);
|
|
1044
|
+
x = s || null, e.provide("VueSDKOptions", t);
|
|
963
1045
|
}
|
|
964
1046
|
};
|
|
965
1047
|
export {
|
|
966
1048
|
k as BlockTypes,
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1049
|
+
T as MarkTypes,
|
|
1050
|
+
nt as StoryblokClient,
|
|
1051
|
+
ae as StoryblokComponent,
|
|
1052
|
+
ut as StoryblokRichText,
|
|
1053
|
+
gt as StoryblokVue,
|
|
1054
|
+
xe as TextTypes,
|
|
1055
|
+
pt as apiPlugin,
|
|
1056
|
+
ft as renderRichText,
|
|
1057
|
+
oe as richTextResolver,
|
|
1058
|
+
yt as useStoryblok,
|
|
1059
|
+
mt as useStoryblokApi,
|
|
1060
|
+
it as useStoryblokBridge,
|
|
1061
|
+
ct as useStoryblokRichText
|
|
980
1062
|
};
|