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