@storyblok/vue 9.4.1 → 9.4.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,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 W, ref as x, resolveDynamicComponent as H, inject as de, createBlock as X, openBlock as Q, mergeProps as pe, createSlots as fe, renderList as ye, withCtx as me, renderSlot as ge, normalizeProps as be, guardReactiveProps as ve, h as Z, createTextVNode as ke, watch as we, onMounted as Te, defineAsyncComponent as _e } from "vue";
8
- var Re = Object.defineProperty, $e = (e, t, r) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, b = (e, t, r) => $e(e, typeof t != "symbol" ? t + "" : t, r);
9
- let k = /* @__PURE__ */ function(e) {
7
+ import { defineComponent as te, ref as H, resolveDynamicComponent as U, inject as ve, createBlock as se, openBlock as re, mergeProps as be, createSlots as ke, renderList as Re, withCtx as we, renderSlot as _e, normalizeProps as Te, guardReactiveProps as Ae, h as ne, createTextVNode as Le, watch as Ee, 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, y = (e, t, s) => Ce(e, typeof t != "symbol" ? t + "" : t, s);
9
+ let R = /* @__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
- }({}), _ = /* @__PURE__ */ function(e) {
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
- }({}), Ae = /* @__PURE__ */ function(e) {
13
+ }({}), xe = /* @__PURE__ */ function(e) {
14
14
  return e.TEXT = "text", e;
15
- }({}), O = /* @__PURE__ */ function(e) {
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 Se = [
18
+ const Oe = [
19
19
  "area",
20
20
  "base",
21
21
  "br",
@@ -30,251 +30,251 @@ const Se = [
30
30
  "source",
31
31
  "track",
32
32
  "wbr"
33
- ], Ee = (e = {}) => {
34
- const { custom: t, ...r } = e, s = {
35
- ...r,
33
+ ], je = (e = {}) => {
34
+ const { custom: t, ...s } = e, r = {
35
+ ...s,
36
36
  ...t
37
37
  };
38
- return Object.keys(s).map((n) => `${n}="${s[n]}"`).join(" ");
39
- }, Le = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
40
- function Ie(e) {
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
42
42
  }
43
- const L = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
44
- function Ce(e, t) {
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 r = 0, s = 0;
49
+ let s = 0, r = 0;
50
50
  const n = {}, o = [];
51
- function a(c, u, f, y, R) {
52
- typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : R.push(`${y}(${c})`);
51
+ function l(c, d, v, h, b) {
52
+ typeof c != "number" || c <= d || c >= v ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${d} and ${v} (inclusive)`) : b.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, r = 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, s = 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: u, brightness: f, fill: y, format: R, grayscale: P, quality: T, rotate: S } = c || {};
57
- u && a(u, 0, 100, "blur", o), T && a(T, 0, 100, "quality", o), f && a(f, 0, 100, "brightness", o), y && o.push(`fill(${y})`), P && o.push("grayscale()"), S && [
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: d, brightness: v, fill: h, format: b, grayscale: E, quality: _, rotate: $ } = c || {};
57
+ d && l(d, 0, 100, "blur", o), _ && l(_, 0, 100, "quality", o), v && l(v, 0, 100, "brightness", o), h && o.push(`fill(${h})`), E && o.push("grayscale()"), $ && [
58
58
  0,
59
59
  90,
60
60
  180,
61
61
  270
62
- ].includes(t.filters.rotate || 0) && o.push(`rotate(${S})`), R && [
62
+ ].includes(t.filters.rotate || 0) && o.push(`rotate(${$})`), b && [
63
63
  "webp",
64
64
  "png",
65
65
  "jpeg"
66
- ].includes(R) && o.push(`format(${R})`);
66
+ ].includes(b) && o.push(`format(${b})`);
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 [u, f] = c;
72
- return `${e}/m/${u}x${f}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${u}w`;
71
+ const [d, v] = c;
72
+ return `${e}/m/${d}x${v}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${d}w`;
73
73
  } else {
74
74
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
75
75
  return;
76
76
  }
77
77
  }).join(", ")), t.sizes && (n.sizes = t.sizes.join(", "));
78
78
  }
79
- let l = `${e}/m/`;
80
- return (r > 0 || s > 0) && (l = `${l}${r}x${s}/`), o.length > 0 && (l = `${l}filters:${o.join(":")}`), {
81
- src: l,
79
+ let a = `${e}/m/`;
80
+ return (s > 0 || r > 0) && (a = `${a}${s}x${r}/`), o.length > 0 && (a = `${a}filters:${o.join(":")}`), {
81
+ src: a,
82
82
  attrs: n
83
83
  };
84
84
  }
85
- function V(e, t = {}, r) {
86
- const s = Ee(t), n = s ? `${e} ${s}` : e, o = Array.isArray(r) ? r.join("") : r || "";
85
+ function K(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 (Se.includes(e)) return `<${n}>`;
88
+ if (Oe.includes(e)) return `<${n}>`;
89
89
  } else return o;
90
90
  return `<${n}>${o}</${e}>`;
91
91
  }
92
- function ee(e = {}) {
93
- const t = /* @__PURE__ */ new Map(), { renderFn: r = V, textFn: s = Ie, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: a = !1 } = e, l = r !== V, c = (i = {}) => {
94
- const { textAlign: h, class: d, id: p, style: m, ...v } = i, g = [];
95
- return m && g.push(m.endsWith(";") ? m : `${m};`), h && g.push(`text-align: ${h};`), L({
96
- ...v,
97
- class: d,
98
- id: p,
92
+ function oe(e = {}) {
93
+ const t = /* @__PURE__ */ new Map(), { renderFn: s = K, textFn: r = Me, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: l = !1 } = e, a = s !== K, c = (i = {}) => {
94
+ const { textAlign: u, class: p, id: f, style: m, ...k } = i, g = [];
95
+ return m && g.push(m.endsWith(";") ? m : `${m};`), u && g.push(`text-align: ${u};`), I({
96
+ ...k,
97
+ class: p,
98
+ id: f,
99
99
  ...g.length > 0 ? { style: g.join(" ") } : {}
100
100
  });
101
- }, u = (i) => (h, d) => {
102
- const p = c(h.attrs);
103
- return d.render(i, p, h.children || null);
104
- }, f = (i, h) => {
105
- const { src: d, alt: p, title: m, srcset: v, sizes: g } = i.attrs || {};
106
- let $ = d, w = {};
101
+ }, d = (i) => (u, p) => {
102
+ const f = c(u.attrs);
103
+ return p.render(i, f, u.children || null);
104
+ }, v = (i, u) => {
105
+ const { src: p, alt: f, title: m, srcset: k, sizes: g } = i.attrs || {};
106
+ let A = p, w = {};
107
107
  if (o) {
108
- const { src: ue, attrs: he } = Ce(d, o);
109
- $ = ue, w = he;
108
+ const { src: ye, attrs: ge } = Ne(p, o);
109
+ A = ye, w = ge;
110
110
  }
111
- const E = {
112
- src: $,
113
- alt: p,
111
+ const S = {
112
+ src: A,
113
+ alt: f,
114
114
  title: m,
115
- srcset: v,
115
+ srcset: k,
116
116
  sizes: g,
117
117
  ...w
118
118
  };
119
- return h.render("img", L(E));
120
- }, y = (i, h) => {
121
- const { level: d, ...p } = i.attrs || {}, m = c(p);
122
- return h.render(`h${d}`, m, i.children);
123
- }, R = (i, h) => {
124
- var d, p, m, v;
125
- const g = h.render("img", {
126
- src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
127
- alt: (p = i.attrs) == null ? void 0 : p.alt,
119
+ return u.render("img", I(S));
120
+ }, h = (i, u) => {
121
+ const { level: p, ...f } = i.attrs || {}, m = c(f);
122
+ return u.render(`h${p}`, m, i.children);
123
+ }, b = (i, u) => {
124
+ var p, f, m, k;
125
+ const g = u.render("img", {
126
+ src: (p = i.attrs) == null ? void 0 : p.fallbackImage,
127
+ alt: (f = i.attrs) == null ? void 0 : f.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 h.render("span", {
132
+ return u.render("span", {
133
133
  "data-type": "emoji",
134
134
  "data-name": (m = i.attrs) == null ? void 0 : m.name,
135
- "data-emoji": (v = i.attrs) == null ? void 0 : v.emoji
135
+ "data-emoji": (k = i.attrs) == null ? void 0 : k.emoji
136
136
  }, g);
137
- }, P = (i, h) => h.render("pre", i.attrs || {}, h.render("code", {}, i.children || "")), T = (i, h = !1) => ({ text: d, attrs: p }, m) => {
138
- const { class: v, id: g, ...$ } = p || {}, w = h ? {
139
- class: v,
137
+ }, E = (i, u) => u.render("pre", i.attrs || {}, u.render("code", {}, i.children || "")), _ = (i, u = !1) => ({ text: p, attrs: f }, m) => {
138
+ const { class: k, id: g, ...A } = f || {}, w = u ? {
139
+ class: k,
140
140
  id: g,
141
- style: Le($) || void 0
142
- } : p || {};
143
- return m.render(i, L(w), d);
144
- }, S = (i) => N(i), se = (i) => {
145
- const { marks: h, ...d } = i;
141
+ style: Pe(A) || void 0
142
+ } : f || {};
143
+ return m.render(i, I(w), p);
144
+ }, $ = (i) => D(i), ce = (i) => {
145
+ const { marks: u, ...p } = i;
146
146
  if ("text" in i) {
147
- if (h) return h.reduce((m, v) => S({
148
- ...v,
147
+ if (u) return u.reduce((m, k) => $({
148
+ ...k,
149
149
  text: m
150
- }), S({
151
- ...d,
152
- children: d.children
150
+ }), $({
151
+ ...p,
152
+ children: p.children
153
153
  }));
154
- const p = i.attrs || {};
155
- if (a) {
154
+ const f = i.attrs || {};
155
+ if (l) {
156
156
  const m = t.get("txt") || 0;
157
- t.set("txt", m + 1), p.key = `txt-${m}`;
157
+ t.set("txt", m + 1), f.key = `txt-${m}`;
158
158
  }
159
- return s(d.text, p);
159
+ return r(p.text, f);
160
160
  }
161
161
  return "";
162
- }, B = (i, h) => {
163
- const { linktype: d, href: p, anchor: m, ...v } = i.attrs || {};
162
+ }, z = (i, u) => {
163
+ const { linktype: p, href: f, anchor: m, ...k } = i.attrs || {};
164
164
  let g = "";
165
- switch (d) {
166
- case O.ASSET:
167
- case O.URL:
168
- g = p;
165
+ switch (p) {
166
+ case j.ASSET:
167
+ case j.URL:
168
+ g = f;
169
169
  break;
170
- case O.EMAIL:
171
- g = `mailto:${p}`;
170
+ case j.EMAIL:
171
+ g = `mailto:${f}`;
172
172
  break;
173
- case O.STORY:
174
- g = p, m && (g = `${g}#${m}`);
173
+ case j.STORY:
174
+ g = f, m && (g = `${g}#${m}`);
175
175
  break;
176
176
  default:
177
- g = p;
177
+ g = f;
178
178
  break;
179
179
  }
180
- const $ = { ...v };
181
- return g && ($.href = g), h.render("a", $, i.text);
182
- }, ne = (i, h) => {
183
- var d, p;
184
- return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
185
- blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
186
- id: (p = i.attrs) == null ? void 0 : p.id,
180
+ const A = { ...k };
181
+ return g && (A.href = g), u.render("a", A, i.text);
182
+ }, ue = (i, u) => {
183
+ var p, f;
184
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
185
+ blok: (p = i == null ? void 0 : i.attrs) == null ? void 0 : p.body[0],
186
+ id: (f = i.attrs) == null ? void 0 : f.id,
187
187
  style: "display: none"
188
188
  });
189
- }, oe = (i, h) => {
190
- const d = c(i.attrs), p = i.children || null;
191
- return h.render("table", d, h.render("tbody", {}, p));
192
- }, ie = (i, h) => {
193
- const d = c(i.attrs);
194
- return h.render("tr", d, i.children);
195
- }, ae = (i, h) => {
196
- const { colspan: d, rowspan: p, colwidth: m, backgroundColor: v, textAlign: g, ...$ } = i.attrs || {}, w = [];
197
- m && w.push(`width: ${m}px;`), v && w.push(`background-color: ${v};`), g && w.push(`text-align: ${g};`);
198
- const E = {
199
- ...$,
200
- ...d > 1 ? { colspan: d } : {},
201
- ...p > 1 ? { rowspan: p } : {},
189
+ }, he = (i, u) => {
190
+ const p = c(i.attrs), f = i.children || null;
191
+ return u.render("table", p, u.render("tbody", {}, f));
192
+ }, de = (i, u) => {
193
+ const p = c(i.attrs);
194
+ return u.render("tr", p, i.children);
195
+ }, pe = (i, u) => {
196
+ const { colspan: p, rowspan: f, colwidth: m, backgroundColor: k, textAlign: g, ...A } = i.attrs || {}, w = [];
197
+ m && w.push(`width: ${m}px;`), k && w.push(`background-color: ${k};`), g && w.push(`text-align: ${g};`);
198
+ const S = {
199
+ ...A,
200
+ ...p > 1 ? { colspan: p } : {},
201
+ ...f > 1 ? { rowspan: f } : {},
202
202
  ...w.length > 0 ? { style: w.join(" ") } : {}
203
203
  };
204
- return h.render("td", L(E), i.children);
205
- }, le = (i, h) => {
206
- const { colspan: d, rowspan: p, colwidth: m, backgroundColor: v, textAlign: g, ...$ } = i.attrs || {}, w = [];
207
- m && w.push(`width: ${m}px;`), v && w.push(`background-color: ${v};`), g && w.push(`text-align: ${g};`);
208
- const E = {
209
- ...$,
210
- ...d > 1 ? { colspan: d } : {},
211
- ...p > 1 ? { rowspan: p } : {},
204
+ return u.render("td", I(S), i.children);
205
+ }, fe = (i, u) => {
206
+ const { colspan: p, rowspan: f, colwidth: m, backgroundColor: k, textAlign: g, ...A } = i.attrs || {}, w = [];
207
+ m && w.push(`width: ${m}px;`), k && w.push(`background-color: ${k};`), g && w.push(`text-align: ${g};`);
208
+ const S = {
209
+ ...A,
210
+ ...p > 1 ? { colspan: p } : {},
211
+ ...f > 1 ? { rowspan: f } : {},
212
212
  ...w.length > 0 ? { style: w.join(" ") } : {}
213
213
  };
214
- return h.render("th", L(E), i.children);
215
- }, M = /* @__PURE__ */ new Map([
216
- [k.DOCUMENT, u("")],
217
- [k.HEADING, y],
218
- [k.PARAGRAPH, u("p")],
219
- [k.UL_LIST, u("ul")],
220
- [k.OL_LIST, u("ol")],
221
- [k.LIST_ITEM, u("li")],
222
- [k.IMAGE, f],
223
- [k.EMOJI, R],
224
- [k.CODE_BLOCK, P],
225
- [k.HR, u("hr")],
226
- [k.BR, u("br")],
227
- [k.QUOTE, u("blockquote")],
228
- [k.COMPONENT, ne],
229
- [Ae.TEXT, se],
230
- [_.LINK, B],
231
- [_.ANCHOR, B],
232
- [_.STYLED, T("span", !0)],
233
- [_.BOLD, T("strong")],
234
- [_.TEXT_STYLE, T("span", !0)],
235
- [_.ITALIC, T("em")],
236
- [_.UNDERLINE, T("u")],
237
- [_.STRIKE, T("s")],
238
- [_.CODE, T("code")],
239
- [_.SUPERSCRIPT, T("sup")],
240
- [_.SUBSCRIPT, T("sub")],
241
- [_.HIGHLIGHT, T("mark")],
242
- [k.TABLE, oe],
243
- [k.TABLE_ROW, ie],
244
- [k.TABLE_CELL, ae],
245
- [k.TABLE_HEADER, le]
246
- ]), F = new Map([...M, ...Object.entries(n).map(([i, h]) => [i, h])]), ce = () => ({
247
- render: (i, h = {}, d) => {
248
- if (a && i) {
249
- const p = t.get(i) || 0;
250
- t.set(i, p + 1), h.key = `${i}-${p}`;
214
+ return u.render("th", I(S), i.children);
215
+ }, Y = /* @__PURE__ */ new Map([
216
+ [R.DOCUMENT, d("")],
217
+ [R.HEADING, h],
218
+ [R.PARAGRAPH, d("p")],
219
+ [R.UL_LIST, d("ul")],
220
+ [R.OL_LIST, d("ol")],
221
+ [R.LIST_ITEM, d("li")],
222
+ [R.IMAGE, v],
223
+ [R.EMOJI, b],
224
+ [R.CODE_BLOCK, E],
225
+ [R.HR, d("hr")],
226
+ [R.BR, d("br")],
227
+ [R.QUOTE, d("blockquote")],
228
+ [R.COMPONENT, ue],
229
+ [xe.TEXT, ce],
230
+ [T.LINK, z],
231
+ [T.ANCHOR, z],
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
+ [R.TABLE, he],
243
+ [R.TABLE_ROW, de],
244
+ [R.TABLE_CELL, pe],
245
+ [R.TABLE_HEADER, fe]
246
+ ]), J = new Map([...Y, ...Object.entries(n).map(([i, u]) => [i, u])]), me = () => ({
247
+ render: (i, u = {}, p) => {
248
+ if (l && i) {
249
+ const f = t.get(i) || 0;
250
+ t.set(i, f + 1), u.key = `${i}-${f}`;
251
251
  }
252
- return r(i, h, d);
252
+ return s(i, u, p);
253
253
  },
254
- originalResolvers: M,
255
- mergedResolvers: F
254
+ originalResolvers: Y,
255
+ mergedResolvers: J
256
256
  });
257
- function C(i) {
258
- const h = F.get(i.type);
259
- if (!h)
257
+ function O(i) {
258
+ const u = J.get(i.type);
259
+ if (!u)
260
260
  return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
261
- const d = ce();
262
- if (i.type === "text") return h(i, d);
263
- const p = i.content ? i.content.map(N) : void 0;
264
- return h({
261
+ const p = me();
262
+ if (i.type === "text") return u(i, p);
263
+ const f = i.content ? i.content.map(D) : void 0;
264
+ return u({
265
265
  ...i,
266
- children: p
267
- }, d);
266
+ children: f
267
+ }, p);
268
268
  }
269
- function N(i) {
270
- return i.type === "doc" ? l ? i.content.map(C) : i.content.map(C).join("") : Array.isArray(i) ? i.map(C) : C(i);
269
+ function D(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: N };
272
+ return { render: D };
273
273
  }
274
- let z = !1;
275
- const q = [], Oe = (e) => new Promise((t, r) => {
274
+ let W = !1;
275
+ const X = [], He = (e) => new Promise((t, s) => {
276
276
  if (typeof window > "u") {
277
- r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
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
- z ? n() : q.push(n);
285
+ W ? n() : X.push(n);
286
286
  }, document.getElementById("storyblok-javascript-bridge")) {
287
287
  t(void 0);
288
288
  return;
289
289
  }
290
- const s = document.createElement("script");
291
- s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (n) => r(n), s.onload = (n) => {
292
- q.forEach((o) => o()), z = !0, t(n);
293
- }, document.getElementsByTagName("head")[0].appendChild(s);
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, a = !1;
305
- const l = 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 && l(), n = n.filter((y) => y !== f);
316
- }, r);
317
- n.includes(f) || n.push(f);
318
- }, c = (...u) => a ? 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 && l();
324
- });
325
- return c.abort = () => {
326
- a = !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
+ X.forEach((o) => o()), W = !0, t(n);
293
+ }, document.getElementsByTagName("head")[0].appendChild(r);
294
+ }), B = (e = "") => e.includes("/cdn/"), De = (e, t = 25, s = 1) => ({
331
295
  ...e,
332
296
  per_page: t,
333
- page: r
334
- }), He = (e) => new Promise((t) => setTimeout(t, e)), Ue = (e = 0, t) => Array.from({ length: e }, t), De = (e = 0, t = e) => {
335
- const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
336
- return Ue(r, (n, o) => o * s + e);
337
- }, Be = async (e, t) => Promise.all(e.map(t)), Me = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), D = (e, t, r) => {
338
- const s = [];
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], []), V = (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 a = r ? "" : encodeURIComponent(n);
344
- let l;
345
- typeof o == "object" ? l = D(o, t ? t + encodeURIComponent(`[${a}]`) : a, Array.isArray(o)) : l = `${t ? t + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(o)}`, s.push(l);
307
+ const l = s ? "" : encodeURIComponent(n);
308
+ let a;
309
+ typeof o == "object" ? a = V(o, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(o)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(o)}`, r.push(a);
346
310
  }
347
- return s.join("&");
348
- }, J = (e) => {
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 Fe = class {
322
+ var Ve = class {
359
323
  constructor(e) {
360
- b(this, "baseURL"), b(this, "timeout"), b(this, "headers"), b(this, "responseInterceptor"), b(this, "fetch"), b(this, "ejectInterceptor"), b(this, "url"), b(this, "parameters"), b(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 = {};
324
+ y(this, "baseURL"), y(this, "timeout"), y(this, "headers"), y(this, "responseInterceptor"), y(this, "fetch"), y(this, "ejectInterceptor"), y(this, "url"), y(this, "parameters"), y(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,37 +342,37 @@ 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 = [], r = {
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((s) => {
388
- r.data = s;
351
+ e.status !== 204 && await e.json().then((r) => {
352
+ s.data = r;
389
353
  });
390
- for (const s of e.headers.entries()) t[s[0]] = s[1];
391
- return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
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}`, r = null;
395
- e === "get" ? t = `${this.baseURL}${this.url}?${D(this.parameters)}` : r = JSON.stringify(this.parameters);
396
- const s = new URL(t), n = new AbortController(), { signal: o } = n;
397
- let a = null;
398
- this.timeout && (a = setTimeout(() => n.abort(), this.timeout));
358
+ let t = `${this.baseURL}${this.url}`, s = null;
359
+ e === "get" ? t = `${this.baseURL}${this.url}?${V(this.parameters)}` : s = JSON.stringify(this.parameters);
360
+ const r = new URL(t), n = new AbortController(), { signal: o } = n;
361
+ let l = null;
362
+ this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
399
363
  try {
400
- const l = await this.fetch(`${s}`, {
364
+ const a = await this.fetch(`${r}`, {
401
365
  method: e,
402
366
  headers: this.headers,
403
- body: r,
367
+ body: s,
404
368
  signal: o,
405
369
  ...this.fetchOptions
406
370
  });
407
- this.timeout && a && clearTimeout(a);
408
- const c = await this._responseHandler(l);
371
+ this.timeout && l && clearTimeout(l);
372
+ const c = await this._responseHandler(a);
409
373
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
410
- } catch (l) {
411
- return { message: l };
374
+ } catch (a) {
375
+ return { message: a };
412
376
  }
413
377
  }
414
378
  setFetchOptions(e = {}) {
@@ -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((r, s) => {
440
- if (t.test(`${e.status}`)) return r(e);
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
- s(n);
410
+ r(n);
447
411
  });
448
412
  }
449
- }, Ve = Fe;
450
- const K = "SB-Agent", U = {
413
+ }, ze = Ve;
414
+ const Z = "SB-Agent", F = {
451
415
  defaultAgentName: "SB-JS-CLIENT",
452
416
  defaultAgentVersion: "SB-Agent-Version",
453
417
  packageVersion: "7.0.0"
454
- }, ze = {
418
+ }, ie = {
419
+ DRAFT: "draft",
455
420
  PUBLISHED: "published"
421
+ }, Ye = 25, q = {
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
+ }, G = 1e3, P = 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 <= q.SMALL ? C.SINGLE_OR_SMALL : e <= q.MEDIUM ? C.MEDIUM : e <= q.LARGE ? C.LARGE : C.VERY_LARGE;
440
+ }
441
+ function M(e, t, s = {}, r) {
442
+ if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, G);
443
+ if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, G);
444
+ if (r !== void 0) return r;
445
+ if (t && !Je(t)) return G;
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 d = r.shift();
485
+ if (d) try {
486
+ const h = await e(...d.args);
487
+ d.resolve(h);
488
+ } catch (h) {
489
+ d.reject(h);
490
+ }
491
+ const v = setTimeout(() => {
492
+ o--, r.length > 0 && a(), n = n.filter((h) => h !== v);
493
+ }, s);
494
+ n.includes(v) || n.push(v);
495
+ }, c = (...d) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((v, h) => {
496
+ r.push({
497
+ resolve: v,
498
+ reject: h,
499
+ args: d
500
+ }), o < t && a();
501
+ });
502
+ return c.abort = () => {
503
+ l = !0, n.forEach(clearTimeout), n = [], r.forEach((d) => d.reject(() => new Ze("Throttle function aborted"))), r.length = 0;
504
+ }, c;
505
+ }
506
+ var tt = et, st = class {
507
+ constructor(e, t = 1e3) {
508
+ y(this, "queues"), y(this, "interval"), y(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 j = {};
458
- const A = {};
459
- var qe = class {
539
+ let N = {};
540
+ const L = {};
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
- b(this, "client"), b(this, "maxRetries"), b(this, "retriesDelay"), b(this, "throttle"), b(this, "accessToken"), b(this, "cache"), b(this, "resolveCounter"), b(this, "relations"), b(this, "links"), b(this, "version"), b(this, "richTextResolver"), b(this, "resolveNestedRelations"), b(this, "stringifiedStoriesCache"), b(this, "inlineAssets");
467
- let r = e.endpoint || t;
468
- if (!r) {
469
- const o = e.https === !1 ? "http" : "https";
470
- e.oauthToken ? r = `${o}://${J(e.region)}/v1` : r = `${o}://${J(e.region)}/v2`;
548
+ y(this, "client"), y(this, "maxRetries"), y(this, "retriesDelay"), y(this, "throttleManager"), y(this, "accessToken"), y(this, "cache"), y(this, "resolveCounter"), y(this, "relations"), y(this, "links"), y(this, "version"), y(this, "rateLimitConfig"), y(this, "richTextResolver"), y(this, "resolveNestedRelations"), y(this, "stringifiedStoriesCache"), y(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 s = new Headers();
473
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([o, a]) => {
474
- s.set(o, a);
475
- }), s.has(K) || (s.set(K, U.defaultAgentName), s.set(U.defaultAgentVersion, U.packageVersion));
476
- let n = 5;
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, F.defaultAgentName), r.set(F.defaultAgentVersion, F.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: s,
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 = A[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
566
+ return e.token || (e.token = this.getToken()), e.cv || (e.cv = L[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 G(e) ? this.parseParams(t) : t;
569
+ return B(e) ? this.parseParams(t) : t;
490
570
  }
491
- makeRequest(e, t, r, s, n) {
492
- const o = this.factoryParamOptions(e, Ne(t, r, s));
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 = {}, r) {
575
+ get(e, t = {}, s) {
496
576
  t || (t = {});
497
- const s = `/${e}`;
498
- G(s) && (t.version = t.version || this.version);
499
- const n = this.factoryParamOptions(s, t);
500
- return this.cacheResponse(s, n, void 0, r);
577
+ const r = `/${e}`;
578
+ B(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 = {}, r, s) {
503
- const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`.replace(/\/$/, ""), a = r ?? o.substring(o.lastIndexOf("/") + 1);
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 l = 1, c = await this.makeRequest(o, t, n, l, s), u = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, f = await Be(De(l, u), (y) => this.makeRequest(o, t, n, y + 1, s));
506
- return Me([c, ...f], (y) => Object.values(y.data[a]));
585
+ const a = 1, c = await this.makeRequest(o, t, n, a, r), d = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, v = await qe(Fe(a, d), (h) => this.makeRequest(o, t, n, h + 1, r));
586
+ return Ge([c, ...v], (h) => Object.values(h.data[l]));
507
587
  }
508
- post(e, t = {}, r) {
509
- const s = `/${e}`;
510
- return this.throttle("post", s, t, r);
588
+ post(e, t = {}, s) {
589
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
590
+ return this.throttleManager.execute(n, "post", r, t, s);
511
591
  }
512
- put(e, t = {}, r) {
513
- const s = `/${e}`;
514
- return this.throttle("put", s, t, r);
592
+ put(e, t = {}, s) {
593
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
594
+ return this.throttleManager.execute(n, "put", r, t, s);
515
595
  }
516
- delete(e, t = {}, r) {
596
+ delete(e, t = {}, s) {
517
597
  t || (t = {});
518
- const s = `/${e}`;
519
- return this.throttle("delete", s, t, r);
598
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
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 = {}, r) {
525
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
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, r) {
540
- const s = e[t];
541
- s && s.fieldtype === "multilink" && s.linktype === "story" && typeof s.id == "string" && this.links[r][s.id] ? s.story = this._cleanCopy(this.links[r][s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[r][s.uuid] && (s.story = this._cleanCopy(this.links[r][s.uuid]));
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, r) {
563
- const s = e[t];
564
- typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((n) => this.getStoryReference(r, n)).filter(Boolean));
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, r, s) {
584
- if (Array.isArray(r) ? r.find((o) => o.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
585
- this._resolveField(e, t, s);
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(r) ? r.includes(n) : r === n) && this._resolveField(e, t, s);
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,67 +674,67 @@ 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, r) {
598
- const s = (n, o = "") => {
677
+ iterateTree(e, t, s) {
678
+ const r = (n, o = "") => {
599
679
  if (!(!n || n._stopResolving)) {
600
- if (Array.isArray(n)) n.forEach((a, l) => s(a, `${o}[${l}]`));
601
- else if (typeof n == "object") for (const a in n) {
602
- const l = o ? `${o}.${a}` : a;
603
- (n.component && n._uid || n.type === "link") && (this._insertRelations(n, a, t, r), this._insertLinks(n, a, r)), s(n[a], l);
680
+ if (Array.isArray(n)) n.forEach((l, a) => r(l, `${o}[${a}]`));
681
+ else if (typeof n == "object") for (const l in n) {
682
+ const a = o ? `${o}.${l}` : l;
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
- s(e.content);
687
+ r(e.content);
608
688
  }
609
- async resolveLinks(e, t, r) {
610
- let s = [];
689
+ async resolveLinks(e, t, s) {
690
+ let r = [];
611
691
  if (e.link_uuids) {
612
- const n = e.link_uuids.length, o = [], a = 50;
613
- for (let l = 0; l < n; l += a) {
614
- const c = Math.min(n, l + a);
615
- o.push(e.link_uuids.slice(l, c));
692
+ const n = e.link_uuids.length, o = [], l = 50;
693
+ for (let a = 0; a < n; a += l) {
694
+ const c = Math.min(n, a + l);
695
+ o.push(e.link_uuids.slice(a, c));
616
696
  }
617
- for (let l = 0; l < o.length; l++)
697
+ for (let a = 0; a < o.length; a++)
618
698
  (await this.getStories({
619
- per_page: a,
699
+ per_page: l,
620
700
  language: t.language,
621
701
  version: t.version,
622
702
  starts_with: t.starts_with,
623
- by_uuids: o[l].join(",")
703
+ by_uuids: o[a].join(",")
624
704
  })).data.stories.forEach((c) => {
625
- s.push(c);
705
+ r.push(c);
626
706
  });
627
- } else s = e.links;
628
- s.forEach((n) => {
629
- this.links[r][n.uuid] = {
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, r) {
636
- let s = [];
715
+ async resolveRelations(e, t, s) {
716
+ let r = [];
637
717
  if (e.rel_uuids) {
638
- const n = e.rel_uuids.length, o = [], a = 50;
639
- for (let l = 0; l < n; l += a) {
640
- const c = Math.min(n, l + a);
641
- o.push(e.rel_uuids.slice(l, c));
718
+ const n = e.rel_uuids.length, o = [], l = 50;
719
+ for (let a = 0; a < n; a += l) {
720
+ const c = Math.min(n, a + l);
721
+ o.push(e.rel_uuids.slice(a, c));
642
722
  }
643
- for (let l = 0; l < o.length; l++)
723
+ for (let a = 0; a < o.length; a++)
644
724
  (await this.getStories({
645
- per_page: a,
725
+ per_page: l,
646
726
  language: t.language,
647
727
  version: t.version,
648
728
  starts_with: t.starts_with,
649
- by_uuids: o[l].join(","),
729
+ by_uuids: o[a].join(","),
650
730
  excluding_fields: t.excluding_fields
651
731
  })).data.stories.forEach((c) => {
652
- s.push(c);
732
+ r.push(c);
653
733
  });
654
- s.length > 0 && (e.rels = s, delete e.rel_uuids);
655
- } else s = e.rels;
656
- s && s.length > 0 && s.forEach((n) => {
657
- this.relations[r][n.uuid] = {
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, r) {
673
- var s, n;
752
+ async resolveStories(e, t, s) {
753
+ var r, n;
674
754
  let o = [];
675
- if (this.links[r] = {}, this.relations[r] = {}, 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, r)), t.resolve_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) && ((s = e.links) != null && s.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations) for (const a in this.relations[r]) this.iterateTree(this.relations[r][a], o, r);
681
- e.story ? this.iterateTree(e.story, o, r) : e.stories.forEach((a) => {
682
- this.iterateTree(a, o, r);
683
- }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
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, r, s) {
686
- const n = D({
765
+ async cacheResponse(e, t, s, r) {
766
+ const n = V({
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 a = await o.get(n);
692
- if (a) return Promise.resolve(a);
771
+ const c = await o.get(n);
772
+ if (c) return Promise.resolve(c);
693
773
  }
694
- return new Promise(async (a, l) => {
695
- var c;
774
+ const l = !B(e) && this.rateLimitConfig.isManagementApi ? P : void 0, a = M(e, t, this.rateLimitConfig, l);
775
+ return new Promise(async (c, d) => {
776
+ var v;
696
777
  try {
697
- const u = await this.throttle("get", e, t, s);
698
- if (u.status !== 200) return l(u);
699
- let f = {
700
- data: u.data,
701
- headers: u.headers
778
+ const h = await this.throttleManager.execute(a, "get", e, t, r);
779
+ if (h.status !== 200) return d(h);
780
+ let b = {
781
+ data: h.data,
782
+ headers: h.headers
702
783
  };
703
- if ((c = u.headers) != null && c["per-page"] && (f = Object.assign({}, f, {
704
- perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
705
- total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
706
- })), f.data.story || f.data.stories) {
707
- const R = this.resolveCounter = ++this.resolveCounter % 1e3;
708
- await this.resolveStories(f.data, t, `${R}`), f = await this.processInlineAssets(f);
784
+ const E = Xe(h.headers);
785
+ if ((E == null ? void 0 : E.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = E.max), (v = h.headers) != null && v["per-page"] && (b = Object.assign({}, b, {
786
+ perPage: h.headers["per-page"] ? Number.parseInt(h.headers["per-page"]) : 0,
787
+ total: h.headers["per-page"] ? Number.parseInt(h.headers.total) : 0
788
+ })), b.data.story || b.data.stories) {
789
+ const $ = this.resolveCounter = ++this.resolveCounter % 1e3;
790
+ await this.resolveStories(b.data, t, `${$}`), b = await this.processInlineAssets(b);
709
791
  }
710
- t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, f);
711
- const y = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
712
- return t.token && f.data.cv && (y && A[t.token] && A[t.token] !== f.data.cv && await this.flushCache(), A[t.token] = f.data.cv), a(f);
713
- } catch (u) {
714
- if (u.response && u.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
715
- return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await He(this.retriesDelay), this.cacheResponse(e, t, r).then(a).catch(l);
716
- l(u);
792
+ t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, b);
793
+ const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
794
+ return t.token && b.data.cv && (_ && L[t.token] && L[t.token] !== b.data.cv && await this.flushCache(), L[t.token] = b.data.cv), c(b);
795
+ } catch (h) {
796
+ if (h.response && h.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(c).catch(d);
798
+ d(h);
717
799
  }
718
800
  });
719
801
  }
720
- throttledRequest(e, t, r, s) {
721
- return this.client.setFetchOptions(s), this.client[e](t, r);
802
+ throttledRequest(e, t, s, r) {
803
+ return this.client.setFetchOptions(r), this.client[e](t, s);
722
804
  }
723
805
  cacheVersions() {
724
- return A;
806
+ return L;
725
807
  }
726
808
  cacheVersion() {
727
- return A[this.accessToken];
809
+ return L[this.accessToken];
728
810
  }
729
811
  setCacheVersion(e) {
730
- this.accessToken && (A[this.accessToken] = e);
812
+ this.accessToken && (L[this.accessToken] = e);
731
813
  }
732
814
  clearCacheVersion() {
733
- this.accessToken && (A[this.accessToken] = 0);
815
+ this.accessToken && (L[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(j[e]);
822
+ return Promise.resolve(N[e]);
741
823
  },
742
824
  getAll() {
743
- return Promise.resolve(j);
825
+ return Promise.resolve(N);
744
826
  },
745
827
  set(e, t) {
746
- return j[e] = t, Promise.resolve(void 0);
828
+ return N[e] = t, Promise.resolve(void 0);
747
829
  },
748
830
  flush() {
749
- return j = {}, Promise.resolve(void 0);
831
+ return N = {}, 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 = (r) => {
777
- if (!r || typeof r != "object") return r;
778
- if (Array.isArray(r)) return r.map((n) => t(n));
779
- let s = { ...r };
780
- s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
781
- ...e.data.assets.find((n) => n.id === s.id),
782
- ...s
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 s) typeof s[n] == "object" && (s[n] = t(s[n]));
785
- return s;
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((r) => (r.content = t(r.content), r))), e;
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
- }, Ge = qe;
790
- const tt = (e = {}) => {
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 Ge(t) };
799
- }, Je = (e) => {
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,170 +893,170 @@ const tt = (e = {}) => {
811
893
  return {};
812
894
  }
813
895
  };
814
- let Y = "https://app.storyblok.com/f/storyblok-v2-latest.js";
815
- const Ke = (e, t, r = {}) => {
816
- var s;
817
- const n = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
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
- ), a = o !== null && +o === e;
820
- if (!(!n || !a)) {
901
+ ), l = o !== null && +o === e;
902
+ if (!(!n || !l)) {
821
903
  if (!e) {
822
904
  console.warn("Story ID is not defined. Please provide a valid ID.");
823
905
  return;
824
906
  }
825
907
  window.storyblokRegisterEvent(() => {
826
- new window.StoryblokBridge(r).on(["input", "published", "change"], (l) => {
908
+ new window.StoryblokBridge(s).on(["input", "published", "change"], (a) => {
827
909
  var c;
828
- l && (l.action === "input" && ((c = l.story) == null ? void 0 : c.id) === e ? t(l.story) : (l.action === "change" || l.action === "published") && l.storyId === e && window.location.reload());
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
- }, Ye = (e = {}) => {
833
- var t, r;
914
+ }, at = (e = {}) => {
915
+ var t, s;
834
916
  const {
835
- bridge: s,
917
+ bridge: r,
836
918
  accessToken: n,
837
919
  use: o = [],
838
- apiOptions: a = {},
839
- bridgeUrl: l
920
+ apiOptions: l = {},
921
+ bridgeUrl: a
840
922
  } = e;
841
- a.accessToken = a.accessToken || n;
842
- const c = { bridge: s, apiOptions: a };
843
- let u = {};
844
- o.forEach((y) => {
845
- u = { ...u, ...y(c) };
846
- }), l && (Y = l);
847
- const f = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
848
- return s !== !1 && f && Oe(Y), u;
923
+ l.accessToken = l.accessToken || n;
924
+ const c = { bridge: r, apiOptions: l };
925
+ let d = {};
926
+ o.forEach((h) => {
927
+ d = { ...d, ...h(c) };
928
+ }), a && (ee = a);
929
+ const v = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
930
+ return r !== !1 && v && He(ee), d;
849
931
  };
850
- function rt(e, t) {
851
- return ee(t).render(e);
932
+ function ft(e, t) {
933
+ return oe(t).render(e);
852
934
  }
853
- const te = /* @__PURE__ */ W({
935
+ const ae = /* @__PURE__ */ te({
854
936
  __name: "StoryblokComponent",
855
937
  props: {
856
938
  blok: {}
857
939
  },
858
940
  setup(e, { expose: t }) {
859
- var l;
860
- const r = e, s = x();
941
+ var a;
942
+ const s = e, r = H();
861
943
  t({
862
- value: s
944
+ value: r
863
945
  });
864
- const n = typeof H(r.blok.component) != "string", o = de("VueSDKOptions"), a = x((l = r.blok.component) == null ? void 0 : l.replace(/_/g, "-"));
865
- return !n && o && (o.enableFallbackComponent ? (a.value = o.customFallbackComponent ?? "FallbackComponent", typeof H(a.value) == "string" && console.error(
866
- `Is the Fallback component "${a.value}" registered properly?`
946
+ const n = typeof U(s.blok.component) != "string", o = ve("VueSDKOptions"), l = H((a = s.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
947
+ return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof U(l.value) == "string" && console.error(
948
+ `Is the Fallback component "${l.value}" registered properly?`
867
949
  )) : console.error(
868
- `Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`
869
- )), (c, u) => (Q(), X(H(a.value), pe({
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, d) => (re(), se(U(l.value), be({
870
952
  ref_key: "blokRef",
871
- ref: s
872
- }, { ...c.$props, ...c.$attrs }), fe({ _: 2 }, [
873
- ye(c.$slots, (f, y) => ({
874
- name: y,
875
- fn: me((R) => [
876
- ge(c.$slots, y, be(ve(R)))
953
+ ref: r
954
+ }, { ...c.$props, ...c.$attrs }), ke({ _: 2 }, [
955
+ Re(c.$slots, (v, h) => ({
956
+ name: h,
957
+ fn: we((b) => [
958
+ _e(c.$slots, h, Te(Ae(b)))
877
959
  ])
878
960
  }))
879
961
  ]), 1040));
880
962
  }
881
- }), We = (e) => {
882
- var r;
883
- const t = (r = e == null ? void 0 : e.attrs) == null ? void 0 : r.body;
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
- (s) => {
967
+ (r) => {
886
968
  var n;
887
- return Z(te, {
888
- blok: s,
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 Xe(e) {
976
+ function ct(e) {
895
977
  const t = {
896
- renderFn: Z,
978
+ renderFn: ne,
897
979
  // TODO: Check why this changed.
898
980
  // @ts-expect-error - createTextVNode types has been recently changed.
899
- textFn: ke,
981
+ textFn: Le,
900
982
  keyedResolvers: !0,
901
983
  resolvers: {
902
- [k.COMPONENT]: We,
984
+ [R.COMPONENT]: lt,
903
985
  ...e.resolvers
904
986
  }
905
987
  };
906
- return ee(t);
988
+ return oe(t);
907
989
  }
908
- const Qe = /* @__PURE__ */ W({
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, r = x(), s = () => r.value;
916
- return we([() => t.doc, () => t.resolvers], ([n, o]) => {
917
- const { render: a } = Xe({
997
+ const t = e, s = H(), r = () => s.value;
998
+ return Ee([() => t.doc, () => t.resolvers], ([n, o]) => {
999
+ const { render: l } = ct({
918
1000
  resolvers: o ?? {}
919
1001
  });
920
- r.value = a(n);
1002
+ s.value = l(n);
921
1003
  }, {
922
1004
  immediate: !0,
923
1005
  deep: !0
924
- }), (n, o) => (Q(), X(s));
1006
+ }), (n, o) => (re(), se(r));
925
1007
  }
926
- }), Ze = {
1008
+ }), ht = {
927
1009
  beforeMount(e, t) {
928
1010
  if (t.value) {
929
- const r = Je(t.value);
930
- Object.keys(r).length > 0 && (e.setAttribute("data-blok-c", r["data-blok-c"]), e.setAttribute("data-blok-uid", r["data-blok-uid"]), e.classList.add("storyblok__outline"));
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
- }, re = (e) => {
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 I = null;
938
- const st = () => (I || re("useStoryblokApi"), I), nt = async (e, t = {}, r = {}) => {
939
- const s = x(null);
940
- if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, Te(() => {
941
- s.value && s.value.id && Ke(
942
- s.value.id,
943
- (n) => s.value = n,
944
- r
1019
+ let x = null;
1020
+ const mt = () => (x || le("useStoryblokApi"), x), yt = async (e, t = {}, s = {}) => {
1021
+ const r = H(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
- }), I) {
947
- const { data: n } = await I.get(
1028
+ }), x) {
1029
+ const { data: n } = await x.get(
948
1030
  `cdn/stories/${e}`,
949
1031
  t
950
1032
  );
951
- s.value = n.story;
1033
+ r.value = n.story;
952
1034
  } else
953
- re("useStoryblok");
954
- return s;
955
- }, ot = {
1035
+ le("useStoryblok");
1036
+ return r;
1037
+ }, gt = {
956
1038
  install(e, t = {}) {
957
- e.directive("editable", Ze), e.component("StoryblokComponent", te), e.component("StoryblokRichText", Qe), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
1039
+ e.directive("editable", ht), e.component("StoryblokComponent", ae), e.component("StoryblokRichText", ut), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
958
1040
  "FallbackComponent",
959
- _e(() => import("./FallbackComponent-vpkAikkq.js"))
1041
+ Se(() => import("./FallbackComponent-vpkAikkq.js"))
960
1042
  );
961
- const { storyblokApi: r } = Ye(t);
962
- I = r || null, e.provide("VueSDKOptions", t);
1043
+ const { storyblokApi: s } = at(t);
1044
+ x = s || null, e.provide("VueSDKOptions", t);
963
1045
  }
964
1046
  };
965
1047
  export {
966
- k as BlockTypes,
967
- _ as MarkTypes,
968
- Ge as StoryblokClient,
969
- te as StoryblokComponent,
970
- Qe as StoryblokRichText,
971
- ot as StoryblokVue,
972
- Ae as TextTypes,
973
- tt as apiPlugin,
974
- rt as renderRichText,
975
- ee as richTextResolver,
976
- nt as useStoryblok,
977
- st as useStoryblokApi,
978
- Ke as useStoryblokBridge,
979
- Xe as useStoryblokRichText
1048
+ R as BlockTypes,
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
  };