@storyblok/vue 8.1.11 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,84 +4,84 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as K, ref as O, resolveDynamicComponent as M, inject as ae, createBlock as J, openBlock as Y, mergeProps as ie, h as W, createTextVNode as le, watch as ce, onMounted as he, defineAsyncComponent as ue } from "vue";
8
- let D = !1;
9
- const z = [], de = (r) => new Promise((e, t) => {
7
+ import { defineComponent as J, ref as O, resolveDynamicComponent as H, inject as he, createBlock as K, openBlock as Y, mergeProps as ue, h as W, createTextVNode as de, watch as pe, onMounted as ge, defineAsyncComponent as me } from "vue";
8
+ let B = !1;
9
+ const z = [], fe = (s) => new Promise((e, t) => {
10
10
  if (typeof window > "u" || (window.storyblokRegisterEvent = (o) => {
11
11
  if (window.location === window.parent.location) {
12
12
  console.warn("You are not in Draft Mode or in the Visual Editor.");
13
13
  return;
14
14
  }
15
- D ? o() : z.push(o);
15
+ B ? o() : z.push(o);
16
16
  }, document.getElementById("storyblok-javascript-bridge")))
17
17
  return;
18
- const s = document.createElement("script");
19
- s.async = !0, s.src = r, s.id = "storyblok-javascript-bridge", s.onerror = (o) => t(o), s.onload = (o) => {
20
- z.forEach((n) => n()), D = !0, e(o);
21
- }, document.getElementsByTagName("head")[0].appendChild(s);
18
+ const r = document.createElement("script");
19
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (o) => t(o), r.onload = (o) => {
20
+ z.forEach((n) => n()), B = !0, e(o);
21
+ }, document.getElementsByTagName("head")[0].appendChild(r);
22
22
  });
23
- var pe = Object.defineProperty, ge = (r, e, t) => e in r ? pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t) => ge(r, typeof e != "symbol" ? e + "" : e, t);
24
- class me extends Error {
23
+ var ye = Object.defineProperty, be = (s, e, t) => e in s ? ye(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, g = (s, e, t) => be(s, typeof e != "symbol" ? e + "" : e, t);
24
+ class ke extends Error {
25
25
  constructor(e) {
26
26
  super(e), this.name = "AbortError";
27
27
  }
28
28
  }
29
- function fe(r, e, t) {
29
+ function ve(s, e, t) {
30
30
  if (!Number.isFinite(e))
31
31
  throw new TypeError("Expected `limit` to be a finite number");
32
32
  if (!Number.isFinite(t))
33
33
  throw new TypeError("Expected `interval` to be a finite number");
34
- const s = [];
34
+ const r = [];
35
35
  let o = [], n = 0, a = !1;
36
36
  const l = async () => {
37
37
  n++;
38
- const h = s.shift();
38
+ const h = r.shift();
39
39
  if (h)
40
40
  try {
41
- const d = await r(...h.args);
42
- h.resolve(d);
43
- } catch (d) {
44
- h.reject(d);
41
+ const p = await s(...h.args);
42
+ h.resolve(p);
43
+ } catch (p) {
44
+ h.reject(p);
45
45
  }
46
- const u = setTimeout(() => {
47
- n--, s.length > 0 && l(), o = o.filter((d) => d !== u);
46
+ const d = setTimeout(() => {
47
+ n--, r.length > 0 && l(), o = o.filter((p) => p !== d);
48
48
  }, t);
49
- o.includes(u) || o.push(u);
49
+ o.includes(d) || o.push(d);
50
50
  }, i = (...h) => a ? Promise.reject(
51
51
  new Error(
52
52
  "Throttled function is already aborted and not accepting new promises"
53
53
  )
54
- ) : new Promise((u, d) => {
55
- s.push({
56
- resolve: u,
57
- reject: d,
54
+ ) : new Promise((d, p) => {
55
+ r.push({
56
+ resolve: d,
57
+ reject: p,
58
58
  args: h
59
59
  }), n < e && l();
60
60
  });
61
61
  return i.abort = () => {
62
- a = !0, o.forEach(clearTimeout), o = [], s.forEach(
63
- (h) => h.reject(() => new me("Throttle function aborted"))
64
- ), s.length = 0;
62
+ a = !0, o.forEach(clearTimeout), o = [], r.forEach(
63
+ (h) => h.reject(() => new ke("Throttle function aborted"))
64
+ ), r.length = 0;
65
65
  }, i;
66
66
  }
67
- let L = class {
67
+ class P {
68
68
  constructor() {
69
- p(this, "isCDNUrl", (r = "") => r.includes("/cdn/")), p(this, "getOptionsPage", (r, e = 25, t = 1) => ({
70
- ...r,
71
- per_page: e,
72
- page: t
73
- })), p(this, "delay", (r) => new Promise((e) => setTimeout(e, r))), p(this, "arrayFrom", (r = 0, e) => Array.from({ length: r }, e)), p(this, "range", (r = 0, e = r) => {
74
- const t = Math.abs(e - r) || 0, s = r < e ? 1 : -1;
75
- return this.arrayFrom(t, (o, n) => n * s + r);
76
- }), p(this, "asyncMap", async (r, e) => Promise.all(r.map(e))), p(this, "flatMap", (r = [], e) => r.map(e).reduce((t, s) => [...t, ...s], [])), p(this, "escapeHTML", function(r) {
77
- const e = {
69
+ g(this, "isCDNUrl", (e = "") => e.includes("/cdn/")), g(this, "getOptionsPage", (e, t = 25, r = 1) => ({
70
+ ...e,
71
+ per_page: t,
72
+ page: r
73
+ })), g(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), g(this, "arrayFrom", (e = 0, t) => Array.from({ length: e }, t)), g(this, "range", (e = 0, t = e) => {
74
+ const r = Math.abs(t - e) || 0, o = e < t ? 1 : -1;
75
+ return this.arrayFrom(r, (n, a) => a * o + e);
76
+ }), g(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), g(this, "flatMap", (e = [], t) => e.map(t).reduce((r, o) => [...r, ...o], [])), g(this, "escapeHTML", function(e) {
77
+ const t = {
78
78
  "&": "&amp;",
79
79
  "<": "&lt;",
80
80
  ">": "&gt;",
81
81
  '"': "&quot;",
82
82
  "'": "&#39;"
83
- }, t = /[&<>"']/g, s = new RegExp(t.source);
84
- return r && s.test(r) ? r.replace(t, (o) => e[o]) : r;
83
+ }, r = /[&<>"']/g, o = new RegExp(r.source);
84
+ return e && o.test(e) ? e.replace(r, (n) => t[n]) : e;
85
85
  });
86
86
  }
87
87
  /**
@@ -91,110 +91,110 @@ let L = class {
91
91
  * @param {boolean} isArray
92
92
  * @return {string} Stringified object
93
93
  */
94
- stringify(r, e, t) {
95
- const s = [];
96
- for (const o in r) {
97
- if (!Object.prototype.hasOwnProperty.call(r, o))
94
+ stringify(e, t, r) {
95
+ const o = [];
96
+ for (const n in e) {
97
+ if (!Object.prototype.hasOwnProperty.call(e, n))
98
98
  continue;
99
- const n = r[o], a = t ? "" : encodeURIComponent(o);
100
- let l;
101
- typeof n == "object" ? l = this.stringify(
102
- n,
103
- e ? e + encodeURIComponent(`[${a}]`) : a,
104
- Array.isArray(n)
105
- ) : l = `${e ? e + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(n)}`, s.push(l);
99
+ const a = e[n], l = r ? "" : encodeURIComponent(n);
100
+ let i;
101
+ typeof a == "object" ? i = this.stringify(
102
+ a,
103
+ t ? t + encodeURIComponent(`[${l}]`) : l,
104
+ Array.isArray(a)
105
+ ) : i = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(a)}`, o.push(i);
106
106
  }
107
- return s.join("&");
107
+ return o.join("&");
108
108
  }
109
109
  /**
110
110
  * @method getRegionURL
111
111
  * @param {string} regionCode region code, could be eu, us, cn, ap or ca
112
112
  * @return {string} The base URL of the region
113
113
  */
114
- getRegionURL(r) {
115
- const e = "api.storyblok.com", t = "api-us.storyblok.com", s = "app.storyblokchina.cn", o = "api-ap.storyblok.com", n = "api-ca.storyblok.com";
116
- switch (r) {
114
+ getRegionURL(e) {
115
+ const t = "api.storyblok.com", r = "api-us.storyblok.com", o = "app.storyblokchina.cn", n = "api-ap.storyblok.com", a = "api-ca.storyblok.com";
116
+ switch (e) {
117
117
  case "us":
118
- return t;
118
+ return r;
119
119
  case "cn":
120
- return s;
121
- case "ap":
122
120
  return o;
123
- case "ca":
121
+ case "ap":
124
122
  return n;
123
+ case "ca":
124
+ return a;
125
125
  default:
126
- return e;
126
+ return t;
127
127
  }
128
128
  }
129
- };
130
- const ye = function(r, e) {
129
+ }
130
+ const $e = function(s, e) {
131
131
  const t = {};
132
- for (const s in r) {
133
- const o = r[s];
134
- e.includes(s) && o !== null && (t[s] = o);
132
+ for (const r in s) {
133
+ const o = s[r];
134
+ e.includes(r) && o !== null && (t[r] = o);
135
135
  }
136
136
  return t;
137
- }, be = (r) => r === "email", ke = () => ({
137
+ }, we = (s) => s === "email", Te = () => ({
138
138
  singleTag: "hr"
139
- }), ve = () => ({
139
+ }), Re = () => ({
140
140
  tag: "blockquote"
141
- }), $e = () => ({
141
+ }), _e = () => ({
142
142
  tag: "ul"
143
- }), Te = (r) => ({
143
+ }), Ee = (s) => ({
144
144
  tag: [
145
145
  "pre",
146
146
  {
147
147
  tag: "code",
148
- attrs: r.attrs
148
+ attrs: s.attrs
149
149
  }
150
150
  ]
151
- }), we = () => ({
151
+ }), Se = () => ({
152
152
  singleTag: "br"
153
- }), Re = (r) => ({
154
- tag: `h${r.attrs.level}`
155
- }), _e = (r) => ({
153
+ }), je = (s) => ({
154
+ tag: `h${s.attrs.level}`
155
+ }), Ae = (s) => ({
156
156
  singleTag: [
157
157
  {
158
158
  tag: "img",
159
- attrs: ye(r.attrs, ["src", "alt", "title"])
159
+ attrs: $e(s.attrs, ["src", "alt", "title"])
160
160
  }
161
161
  ]
162
- }), Se = () => ({
162
+ }), xe = () => ({
163
163
  tag: "li"
164
- }), Ee = () => ({
164
+ }), Ie = () => ({
165
165
  tag: "ol"
166
- }), je = () => ({
166
+ }), Ce = () => ({
167
167
  tag: "p"
168
- }), Ie = (r) => ({
168
+ }), Le = (s) => ({
169
169
  tag: [
170
170
  {
171
171
  tag: "span",
172
172
  attrs: {
173
173
  "data-type": "emoji",
174
- "data-name": r.attrs.name,
175
- emoji: r.attrs.emoji
174
+ "data-name": s.attrs.name,
175
+ emoji: s.attrs.emoji
176
176
  }
177
177
  }
178
178
  ]
179
- }), xe = () => ({
179
+ }), Oe = () => ({
180
180
  tag: "b"
181
- }), Ae = () => ({
181
+ }), Pe = () => ({
182
182
  tag: "s"
183
- }), Ce = () => ({
183
+ }), Ne = () => ({
184
184
  tag: "u"
185
- }), Oe = () => ({
185
+ }), Me = () => ({
186
186
  tag: "strong"
187
- }), Le = () => ({
187
+ }), He = () => ({
188
188
  tag: "code"
189
- }), Pe = () => ({
189
+ }), De = () => ({
190
190
  tag: "i"
191
- }), Ne = (r) => {
192
- if (!r.attrs)
191
+ }), Ue = (s) => {
192
+ if (!s.attrs)
193
193
  return {
194
194
  tag: ""
195
195
  };
196
- const e = new L().escapeHTML, t = { ...r.attrs }, { linktype: s = "url" } = r.attrs;
197
- if (delete t.linktype, t.href && (t.href = e(r.attrs.href || "")), be(s) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
196
+ const e = new P().escapeHTML, t = { ...s.attrs }, { linktype: r = "url" } = s.attrs;
197
+ if (delete t.linktype, t.href && (t.href = e(s.attrs.href || "")), we(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
198
198
  for (const o in t.custom)
199
199
  t[o] = t.custom[o];
200
200
  delete t.custom;
@@ -207,95 +207,95 @@ const ye = function(r, e) {
207
207
  }
208
208
  ]
209
209
  };
210
- }, Me = (r) => ({
210
+ }, Be = (s) => ({
211
211
  tag: [
212
212
  {
213
213
  tag: "span",
214
- attrs: r.attrs
214
+ attrs: s.attrs
215
215
  }
216
216
  ]
217
- }), Ue = () => ({
217
+ }), ze = () => ({
218
218
  tag: "sub"
219
- }), He = () => ({
219
+ }), Fe = () => ({
220
220
  tag: "sup"
221
- }), De = (r) => ({
221
+ }), qe = (s) => ({
222
222
  tag: [
223
223
  {
224
224
  tag: "span",
225
- attrs: r.attrs
225
+ attrs: s.attrs
226
226
  }
227
227
  ]
228
- }), ze = (r) => {
228
+ }), Ve = (s) => {
229
229
  var e;
230
- return (e = r.attrs) != null && e.color ? {
230
+ return (e = s.attrs) != null && e.color ? {
231
231
  tag: [
232
232
  {
233
233
  tag: "span",
234
234
  attrs: {
235
- style: `background-color:${r.attrs.color};`
235
+ style: `background-color:${s.attrs.color};`
236
236
  }
237
237
  }
238
238
  ]
239
239
  } : {
240
240
  tag: ""
241
241
  };
242
- }, Fe = (r) => {
242
+ }, Ge = (s) => {
243
243
  var e;
244
- return (e = r.attrs) != null && e.color ? {
244
+ return (e = s.attrs) != null && e.color ? {
245
245
  tag: [
246
246
  {
247
247
  tag: "span",
248
248
  attrs: {
249
- style: `color:${r.attrs.color}`
249
+ style: `color:${s.attrs.color}`
250
250
  }
251
251
  }
252
252
  ]
253
253
  } : {
254
254
  tag: ""
255
255
  };
256
- }, Be = {
256
+ }, Je = {
257
257
  nodes: {
258
- horizontal_rule: ke,
259
- blockquote: ve,
260
- bullet_list: $e,
261
- code_block: Te,
262
- hard_break: we,
263
- heading: Re,
264
- image: _e,
265
- list_item: Se,
266
- ordered_list: Ee,
267
- paragraph: je,
268
- emoji: Ie
258
+ horizontal_rule: Te,
259
+ blockquote: Re,
260
+ bullet_list: _e,
261
+ code_block: Ee,
262
+ hard_break: Se,
263
+ heading: je,
264
+ image: Ae,
265
+ list_item: xe,
266
+ ordered_list: Ie,
267
+ paragraph: Ce,
268
+ emoji: Le
269
269
  },
270
270
  marks: {
271
- bold: xe,
272
- strike: Ae,
273
- underline: Ce,
274
- strong: Oe,
275
- code: Le,
276
- italic: Pe,
277
- link: Ne,
278
- styled: Me,
279
- subscript: Ue,
280
- superscript: He,
281
- anchor: De,
282
- highlight: ze,
283
- textStyle: Fe
284
- }
285
- }, qe = function(r) {
271
+ bold: Oe,
272
+ strike: Pe,
273
+ underline: Ne,
274
+ strong: Me,
275
+ code: He,
276
+ italic: De,
277
+ link: Ue,
278
+ styled: Be,
279
+ subscript: ze,
280
+ superscript: Fe,
281
+ anchor: qe,
282
+ highlight: Ve,
283
+ textStyle: Ge
284
+ }
285
+ }, Ke = function(s) {
286
286
  const e = {
287
287
  "&": "&amp;",
288
288
  "<": "&lt;",
289
289
  ">": "&gt;",
290
290
  '"': "&quot;",
291
291
  "'": "&#39;"
292
- }, t = /[&<>"']/g, s = new RegExp(t.source);
293
- return r && s.test(r) ? r.replace(t, (o) => e[o]) : r;
292
+ }, t = /[&<>"']/g, r = new RegExp(t.source);
293
+ return s && r.test(s) ? s.replace(t, (o) => e[o]) : s;
294
294
  };
295
295
  let F = !1;
296
- class P {
296
+ class N {
297
297
  constructor(e) {
298
- p(this, "marks"), p(this, "nodes"), e || (e = Be), this.marks = e.marks || [], this.nodes = e.nodes || [];
298
+ g(this, "marks"), g(this, "nodes"), e || (e = Je), this.marks = e.marks || [], this.nodes = e.nodes || [];
299
299
  }
300
300
  addNode(e, t) {
301
301
  this.nodes[e] = t;
@@ -303,8 +303,8 @@ class P {
303
303
  addMark(e, t) {
304
304
  this.marks[e] = t;
305
305
  }
306
- render(e, t = { optimizeImages: !1 }, s = !0) {
307
- if (!F && s && (console.warn(
306
+ render(e, t = { optimizeImages: !1 }, r = !0) {
307
+ if (!F && r && (console.warn(
308
308
  "Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"
309
309
  ), F = !0), e && e.content && Array.isArray(e.content)) {
310
310
  let o = "";
@@ -340,32 +340,32 @@ class P {
340
340
  ), "";
341
341
  }
342
342
  optimizeImages(e, t) {
343
- let s = 0, o = 0, n = "", a = "";
344
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (n += `height="${t.height}" `, o = t.height), (t.loading === "lazy" || t.loading === "eager") && (n += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (n += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (a += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (a += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-F]{6}/gi) || t.filters.fill === "transparent") && (a += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (a += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (a += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (a += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (a += `:rotate(${t.filters.rotate})`), a.length > 0 && (a = `/filters${a}`))), n.length > 0 && (e = e.replace(/<img/g, `<img ${n.trim()}`));
345
- const l = s > 0 || o > 0 || a.length > 0 ? `${s}x${o}${a}` : "";
343
+ let r = 0, o = 0, n = "", a = "";
344
+ typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, r = t.width), typeof t.height == "number" && t.height > 0 && (n += `height="${t.height}" `, o = t.height), (t.loading === "lazy" || t.loading === "eager") && (n += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (n += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (a += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (a += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-F]{6}/gi) || t.filters.fill === "transparent") && (a += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (a += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (a += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (a += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (a += `:rotate(${t.filters.rotate})`), a.length > 0 && (a = `/filters${a}`))), n.length > 0 && (e = e.replace(/<img/g, `<img ${n.trim()}`));
345
+ const l = r > 0 || o > 0 || a.length > 0 ? `${r}x${o}${a}` : "";
346
346
  return e = e.replace(
347
347
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,
348
348
  `a.storyblok.com/f/$1/$2.$3/m/${l}`
349
349
  ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (i) => {
350
- var h, u;
351
- const d = i.match(
350
+ var h, d;
351
+ const p = i.match(
352
352
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g
353
353
  );
354
- if (d && d.length > 0) {
355
- const f = {
356
- srcset: (h = t.srcset) == null ? void 0 : h.map((b) => {
357
- if (typeof b == "number")
358
- return `//${d}/m/${b}x0${a} ${b}w`;
359
- if (typeof b == "object" && b.length === 2) {
360
- let _ = 0, j = 0;
361
- return typeof b[0] == "number" && (_ = b[0]), typeof b[1] == "number" && (j = b[1]), `//${d}/m/${_}x${j}${a} ${_}w`;
354
+ if (p && p.length > 0) {
355
+ const b = {
356
+ srcset: (h = t.srcset) == null ? void 0 : h.map((w) => {
357
+ if (typeof w == "number")
358
+ return `//${p}/m/${w}x0${a} ${w}w`;
359
+ if (typeof w == "object" && w.length === 2) {
360
+ let E = 0, j = 0;
361
+ return typeof w[0] == "number" && (E = w[0]), typeof w[1] == "number" && (j = w[1]), `//${p}/m/${E}x${j}${a} ${E}w`;
362
362
  }
363
363
  return "";
364
364
  }).join(", "),
365
- sizes: (u = t.sizes) == null ? void 0 : u.map((b) => b).join(", ")
365
+ sizes: (d = t.sizes) == null ? void 0 : d.map((w) => w).join(", ")
366
366
  };
367
- let y = "";
368
- return f.srcset && (y += `srcset="${f.srcset}" `), f.sizes && (y += `sizes="${f.sizes}" `), i.replace(/<img/g, `<img ${y.trim()}`);
367
+ let v = "";
368
+ return b.srcset && (v += `srcset="${b.srcset}" `), b.sizes && (v += `sizes="${b.sizes}" `), i.replace(/<img/g, `<img ${v.trim()}`);
369
369
  }
370
370
  return i;
371
371
  })), e;
@@ -376,24 +376,24 @@ class P {
376
376
  const n = this.getMatchingMark(o);
377
377
  n && n.tag !== "" && t.push(this.renderOpeningTag(n.tag));
378
378
  });
379
- const s = this.getMatchingNode(e);
380
- return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((o) => {
379
+ const r = this.getMatchingNode(e);
380
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((o) => {
381
381
  t.push(this.renderNode(o));
382
- }) : e.text ? t.push(qe(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((o) => {
382
+ }) : e.text ? t.push(Ke(e.text)) : r && r.singleTag ? t.push(this.renderTag(r.singleTag, " /")) : r && r.html ? t.push(r.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), r && r.tag && t.push(this.renderClosingTag(r.tag)), e.marks && e.marks.slice(0).reverse().forEach((o) => {
383
383
  const n = this.getMatchingMark(o);
384
384
  n && n.tag !== "" && t.push(this.renderClosingTag(n.tag));
385
385
  }), t.join("");
386
386
  }
387
387
  renderTag(e, t) {
388
- return e.constructor === String ? `<${e}${t}>` : e.map((s) => {
389
- if (s.constructor === String)
390
- return `<${s}${t}>`;
388
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
389
+ if (r.constructor === String)
390
+ return `<${r}${t}>`;
391
391
  {
392
- let o = `<${s.tag}`;
393
- if (s.attrs) {
394
- for (const n in s.attrs)
395
- if (Object.prototype.hasOwnProperty.call(s.attrs, n)) {
396
- const a = s.attrs[n];
392
+ let o = `<${r.tag}`;
393
+ if (r.attrs) {
394
+ for (const n in r.attrs)
395
+ if (Object.prototype.hasOwnProperty.call(r.attrs, n)) {
396
+ const a = r.attrs[n];
397
397
  a !== null && (o += ` ${n}="${a}"`);
398
398
  }
399
399
  }
@@ -434,9 +434,9 @@ class P {
434
434
  return this.renderTag(t, " /");
435
435
  }
436
436
  }
437
- class Ve {
437
+ class Ye {
438
438
  constructor(e) {
439
- p(this, "baseURL"), p(this, "timeout"), p(this, "headers"), p(this, "responseInterceptor"), p(this, "fetch"), p(this, "ejectInterceptor"), p(this, "url"), p(this, "parameters"), p(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 = {};
439
+ g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
440
440
  }
441
441
  /**
442
442
  *
@@ -457,28 +457,28 @@ class Ve {
457
457
  return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
458
458
  }
459
459
  async _responseHandler(e) {
460
- const t = [], s = {
460
+ const t = [], r = {
461
461
  data: {},
462
462
  headers: {},
463
463
  status: 0,
464
464
  statusText: ""
465
465
  };
466
466
  e.status !== 204 && await e.json().then((o) => {
467
- s.data = o;
467
+ r.data = o;
468
468
  });
469
469
  for (const o of e.headers.entries())
470
470
  t[o[0]] = o[1];
471
- return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
471
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
472
472
  }
473
473
  async _methodHandler(e) {
474
- let t = `${this.baseURL}${this.url}`, s = null;
474
+ let t = `${this.baseURL}${this.url}`, r = null;
475
475
  if (e === "get") {
476
- const i = new L();
476
+ const i = new P();
477
477
  t = `${this.baseURL}${this.url}?${i.stringify(
478
478
  this.parameters
479
479
  )}`;
480
480
  } else
481
- s = JSON.stringify(this.parameters);
481
+ r = JSON.stringify(this.parameters);
482
482
  const o = new URL(t), n = new AbortController(), { signal: a } = n;
483
483
  let l;
484
484
  this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
@@ -486,7 +486,7 @@ class Ve {
486
486
  const i = await this.fetch(`${o}`, {
487
487
  method: e,
488
488
  headers: this.headers,
489
- body: s,
489
+ body: r,
490
490
  signal: a,
491
491
  ...this.fetchOptions
492
492
  });
@@ -509,9 +509,9 @@ class Ve {
509
509
  }
510
510
  _statusHandler(e) {
511
511
  const t = /20[0-6]/g;
512
- return new Promise((s, o) => {
512
+ return new Promise((r, o) => {
513
513
  if (t.test(`${e.status}`))
514
- return s(e);
514
+ return r(e);
515
515
  const n = {
516
516
  message: e.statusText,
517
517
  status: e.status,
@@ -521,40 +521,40 @@ class Ve {
521
521
  });
522
522
  }
523
523
  }
524
- const B = "SB-Agent", U = {
524
+ const q = "SB-Agent", D = {
525
525
  defaultAgentName: "SB-JS-CLIENT",
526
526
  defaultAgentVersion: "SB-Agent-Version",
527
527
  packageVersion: "6.0.0"
528
528
  };
529
529
  let C = {};
530
530
  const S = {};
531
- class Ge {
531
+ class We {
532
532
  /**
533
533
  *
534
534
  * @param config ISbConfig interface
535
535
  * @param pEndpoint string, optional
536
536
  */
537
537
  constructor(e, t) {
538
- p(this, "client"), p(this, "maxRetries"), p(this, "retriesDelay"), p(this, "throttle"), p(this, "accessToken"), p(this, "cache"), p(this, "helpers"), p(this, "resolveCounter"), p(this, "relations"), p(this, "links"), p(this, "richTextResolver"), p(this, "resolveNestedRelations"), p(this, "stringifiedStoriesCache");
539
- let s = e.endpoint || t;
540
- if (!s) {
541
- const a = new L().getRegionURL, l = e.https === !1 ? "http" : "https";
542
- e.oauthToken ? s = `${l}://${a(e.region)}/v1` : s = `${l}://${a(e.region)}/v2`;
538
+ g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttle"), g(this, "accessToken"), g(this, "cache"), g(this, "helpers"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache");
539
+ let r = e.endpoint || t;
540
+ if (!r) {
541
+ const a = new P().getRegionURL, l = e.https === !1 ? "http" : "https";
542
+ e.oauthToken ? r = `${l}://${a(e.region)}/v1` : r = `${l}://${a(e.region)}/v2`;
543
543
  }
544
544
  const o = new Headers();
545
545
  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, l]) => {
546
546
  o.set(a, l);
547
- }), o.has(B) || (o.set(B, U.defaultAgentName), o.set(
548
- U.defaultAgentVersion,
549
- U.packageVersion
547
+ }), o.has(q) || (o.set(q, D.defaultAgentName), o.set(
548
+ D.defaultAgentVersion,
549
+ D.packageVersion
550
550
  ));
551
551
  let n = 5;
552
- e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new P(e.richTextSchema) : this.richTextResolver = new P(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = fe(
552
+ e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new N(e.richTextSchema) : this.richTextResolver = new N(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = ve(
553
553
  this.throttledRequest.bind(this),
554
554
  n,
555
555
  1e3
556
- ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new L(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Ve({
557
- baseURL: s,
556
+ ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new P(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Ye({
557
+ baseURL: r,
558
558
  timeout: e.timeout || 0,
559
559
  headers: o,
560
560
  responseInterceptor: e.responseInterceptor,
@@ -563,11 +563,11 @@ class Ge {
563
563
  }
564
564
  setComponentResolver(e) {
565
565
  this.richTextResolver.addNode("blok", (t) => {
566
- let s = "";
566
+ let r = "";
567
567
  return t.attrs.body && t.attrs.body.forEach((o) => {
568
- s += e(o.component, o);
568
+ r += e(o.component, o);
569
569
  }), {
570
- html: s
570
+ html: r
571
571
  };
572
572
  });
573
573
  }
@@ -577,55 +577,55 @@ class Ge {
577
577
  factoryParamOptions(e, t) {
578
578
  return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
579
579
  }
580
- makeRequest(e, t, s, o, n) {
580
+ makeRequest(e, t, r, o, n) {
581
581
  const a = this.factoryParamOptions(
582
582
  e,
583
- this.helpers.getOptionsPage(t, s, o)
583
+ this.helpers.getOptionsPage(t, r, o)
584
584
  );
585
585
  return this.cacheResponse(e, a, void 0, n);
586
586
  }
587
- get(e, t, s) {
587
+ get(e, t, r) {
588
588
  t || (t = {});
589
589
  const o = `/${e}`, n = this.factoryParamOptions(o, t);
590
- return this.cacheResponse(o, n, void 0, s);
590
+ return this.cacheResponse(o, n, void 0, r);
591
591
  }
592
- async getAll(e, t, s, o) {
593
- const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), l = s ?? a.substring(a.lastIndexOf("/") + 1), i = 1, h = await this.makeRequest(
592
+ async getAll(e, t, r, o) {
593
+ const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), l = r ?? a.substring(a.lastIndexOf("/") + 1), i = 1, h = await this.makeRequest(
594
594
  a,
595
595
  t,
596
596
  n,
597
597
  i,
598
598
  o
599
- ), u = h.total ? Math.ceil(h.total / n) : 1, d = await this.helpers.asyncMap(
600
- this.helpers.range(i, u),
601
- (f) => this.makeRequest(a, t, n, f + 1, o)
599
+ ), d = h.total ? Math.ceil(h.total / n) : 1, p = await this.helpers.asyncMap(
600
+ this.helpers.range(i, d),
601
+ (b) => this.makeRequest(a, t, n, b + 1, o)
602
602
  );
603
- return this.helpers.flatMap([h, ...d], (f) => Object.values(f.data[l]));
603
+ return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[l]));
604
604
  }
605
- post(e, t, s) {
605
+ post(e, t, r) {
606
606
  const o = `/${e}`;
607
607
  return Promise.resolve(
608
- this.throttle("post", o, t, s)
608
+ this.throttle("post", o, t, r)
609
609
  );
610
610
  }
611
- put(e, t, s) {
611
+ put(e, t, r) {
612
612
  const o = `/${e}`;
613
613
  return Promise.resolve(
614
- this.throttle("put", o, t, s)
614
+ this.throttle("put", o, t, r)
615
615
  );
616
616
  }
617
- delete(e, t, s) {
617
+ delete(e, t, r) {
618
618
  t || (t = {});
619
619
  const o = `/${e}`;
620
620
  return Promise.resolve(
621
- this.throttle("delete", o, t, s)
621
+ this.throttle("delete", o, t, r)
622
622
  );
623
623
  }
624
624
  getStories(e, t) {
625
625
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
626
626
  }
627
- getStory(e, t, s) {
628
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
627
+ getStory(e, t, r) {
628
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
629
629
  }
630
630
  getToken() {
631
631
  return this.accessToken;
@@ -639,9 +639,9 @@ class Ge {
639
639
  _cleanCopy(e) {
640
640
  return JSON.parse(JSON.stringify(e));
641
641
  }
642
- _insertLinks(e, t, s) {
642
+ _insertLinks(e, t, r) {
643
643
  const o = e[t];
644
- 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]));
644
+ o && o.fieldtype === "multilink" && o.linktype === "story" && typeof o.id == "string" && this.links[r][o.id] ? o.story = this._cleanCopy(this.links[r][o.id]) : o && o.linktype === "story" && typeof o.uuid == "string" && this.links[r][o.uuid] && (o.story = this._cleanCopy(this.links[r][o.uuid]));
645
645
  }
646
646
  /**
647
647
  *
@@ -662,10 +662,10 @@ class Ge {
662
662
  * - For single strings: directly replaces the UUID with the story reference
663
663
  * - For arrays: maps through each UUID and replaces with corresponding story references
664
664
  */
665
- _resolveField(e, t, s) {
665
+ _resolveField(e, t, r) {
666
666
  const o = e[t];
667
- typeof o == "string" ? e[t] = this.getStoryReference(s, o) : Array.isArray(o) && (e[t] = o.map(
668
- (n) => this.getStoryReference(s, n)
667
+ typeof o == "string" ? e[t] = this.getStoryReference(r, o) : Array.isArray(o) && (e[t] = o.map(
668
+ (n) => this.getStoryReference(r, n)
669
669
  ).filter(Boolean));
670
670
  }
671
671
  /**
@@ -685,13 +685,13 @@ class Ge {
685
685
  * The method supports both string and array formats for the fields parameter,
686
686
  * allowing flexible specification of relation patterns.
687
687
  */
688
- _insertRelations(e, t, s, o) {
689
- if (Array.isArray(s) ? s.find((a) => a.endsWith(`.${t}`)) : s.endsWith(`.${t}`)) {
688
+ _insertRelations(e, t, r, o) {
689
+ if (Array.isArray(r) ? r.find((a) => a.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
690
690
  this._resolveField(e, t, o);
691
691
  return;
692
692
  }
693
693
  const n = e.component ? `${e.component}.${t}` : t;
694
- (Array.isArray(s) ? s.includes(n) : s === n) && this._resolveField(e, t, o);
694
+ (Array.isArray(r) ? r.includes(n) : r === n) && this._resolveField(e, t, o);
695
695
  }
696
696
  /**
697
697
  * Recursively traverses and resolves relations in the story content tree
@@ -699,7 +699,7 @@ class Ge {
699
699
  * @param fields - The relation patterns to resolve
700
700
  * @param resolveId - The unique identifier for the current resolution context
701
701
  */
702
- iterateTree(e, t, s) {
702
+ iterateTree(e, t, r) {
703
703
  const o = (n, a = "") => {
704
704
  if (!(!n || n._stopResolving)) {
705
705
  if (Array.isArray(n))
@@ -707,13 +707,13 @@ class Ge {
707
707
  else if (typeof n == "object")
708
708
  for (const l in n) {
709
709
  const i = a ? `${a}.${l}` : l;
710
- (n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t, s), this._insertLinks(n, l, s)), o(n[l], i);
710
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t, r), this._insertLinks(n, l, r)), o(n[l], i);
711
711
  }
712
712
  }
713
713
  };
714
714
  o(e.content);
715
715
  }
716
- async resolveLinks(e, t, s) {
716
+ async resolveLinks(e, t, r) {
717
717
  let o = [];
718
718
  if (e.link_uuids) {
719
719
  const n = e.link_uuids.length, a = [], l = 50;
@@ -726,6 +726,7 @@ class Ge {
726
726
  per_page: l,
727
727
  language: t.language,
728
728
  version: t.version,
729
+ starts_with: t.starts_with,
729
730
  by_uuids: a[i].join(",")
730
731
  })).data.stories.forEach(
731
732
  (h) => {
@@ -735,13 +736,13 @@ class Ge {
735
736
  } else
736
737
  o = e.links;
737
738
  o.forEach((n) => {
738
- this.links[s][n.uuid] = {
739
+ this.links[r][n.uuid] = {
739
740
  ...n,
740
741
  _stopResolving: !0
741
742
  };
742
743
  });
743
744
  }
744
- async resolveRelations(e, t, s) {
745
+ async resolveRelations(e, t, r) {
745
746
  let o = [];
746
747
  if (e.rel_uuids) {
747
748
  const n = e.rel_uuids.length, a = [], l = 50;
@@ -754,6 +755,7 @@ class Ge {
754
755
  per_page: l,
755
756
  language: t.language,
756
757
  version: t.version,
758
+ starts_with: t.starts_with,
757
759
  by_uuids: a[i].join(","),
758
760
  excluding_fields: t.excluding_fields
759
761
  })).data.stories.forEach((h) => {
@@ -762,7 +764,7 @@ class Ge {
762
764
  } else
763
765
  o = e.rels;
764
766
  o && o.length > 0 && o.forEach((n) => {
765
- this.relations[s][n.uuid] = {
767
+ this.relations[r][n.uuid] = {
766
768
  ...n,
767
769
  _stopResolving: !0
768
770
  };
@@ -777,21 +779,21 @@ class Ge {
777
779
  * @returns Promise<void>
778
780
  *
779
781
  */
780
- async resolveStories(e, t, s) {
782
+ async resolveStories(e, t, r) {
781
783
  var o, n;
782
784
  let a = [];
783
- 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)
784
- for (const l in this.relations[s])
785
+ if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (a = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((o = e.links) != null && o.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations)
786
+ for (const l in this.relations[r])
785
787
  this.iterateTree(
786
- this.relations[s][l],
788
+ this.relations[r][l],
787
789
  a,
788
- s
790
+ r
789
791
  );
790
- e.story ? this.iterateTree(e.story, a, s) : e.stories.forEach((l) => {
791
- this.iterateTree(l, a, s);
792
- }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
792
+ e.story ? this.iterateTree(e.story, a, r) : e.stories.forEach((l) => {
793
+ this.iterateTree(l, a, r);
794
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
793
795
  }
794
- async cacheResponse(e, t, s, o) {
796
+ async cacheResponse(e, t, r, o) {
795
797
  const n = this.helpers.stringify({ url: e, params: t }), a = this.cacheProvider();
796
798
  if (t.version === "published" && e !== "/cdn/spaces/me") {
797
799
  const l = await a.get(n);
@@ -801,36 +803,36 @@ class Ge {
801
803
  return new Promise(async (l, i) => {
802
804
  var h;
803
805
  try {
804
- const u = await this.throttle(
806
+ const d = await this.throttle(
805
807
  "get",
806
808
  e,
807
809
  t,
808
810
  o
809
811
  );
810
- if (u.status !== 200)
811
- return i(u);
812
- let d = { data: u.data, headers: u.headers };
813
- if ((h = u.headers) != null && h["per-page"] && (d = Object.assign({}, d, {
814
- perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
815
- total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
816
- })), d.data.story || d.data.stories) {
817
- const y = this.resolveCounter = ++this.resolveCounter % 1e3;
818
- await this.resolveStories(d.data, t, `${y}`);
812
+ if (d.status !== 200)
813
+ return i(d);
814
+ let p = { data: d.data, headers: d.headers };
815
+ if ((h = d.headers) != null && h["per-page"] && (p = Object.assign({}, p, {
816
+ perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
817
+ total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
818
+ })), p.data.story || p.data.stories) {
819
+ const v = this.resolveCounter = ++this.resolveCounter % 1e3;
820
+ await this.resolveStories(p.data, t, `${v}`);
819
821
  }
820
- t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, d);
821
- const f = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
822
- return t.token && d.data.cv && (f && S[t.token] && S[t.token] !== d.data.cv && await this.flushCache(), S[t.token] = d.data.cv), l(d);
823
- } catch (u) {
824
- if (u.response && u.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
822
+ t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, p);
823
+ const b = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
824
+ return t.token && p.data.cv && (b && S[t.token] && S[t.token] !== p.data.cv && await this.flushCache(), S[t.token] = p.data.cv), l(p);
825
+ } catch (d) {
826
+ if (d.response && d.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
825
827
  return console.log(
826
828
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
827
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(l).catch(i);
828
- i(u);
829
+ ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(i);
830
+ i(d);
829
831
  }
830
832
  });
831
833
  }
832
- throttledRequest(e, t, s, o) {
833
- return this.client.setFetchOptions(o), this.client[e](t, s);
834
+ throttledRequest(e, t, r, o) {
835
+ return this.client.setFetchOptions(o), this.client[e](t, r);
834
836
  }
835
837
  cacheVersions() {
836
838
  return S;
@@ -886,21 +888,21 @@ class Ge {
886
888
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
887
889
  }
888
890
  }
889
- const lt = (r = {}) => {
890
- const { apiOptions: e } = r;
891
+ const dt = (s = {}) => {
892
+ const { apiOptions: e } = s;
891
893
  if (!e || !e.accessToken) {
892
894
  console.error(
893
895
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
894
896
  );
895
897
  return;
896
898
  }
897
- return { storyblokApi: new Ge(e) };
898
- }, Ke = (r) => {
899
- if (typeof r != "object" || typeof r._editable > "u")
899
+ return { storyblokApi: new We(e) };
900
+ }, Xe = (s) => {
901
+ if (typeof s != "object" || typeof s._editable > "u")
900
902
  return {};
901
903
  try {
902
904
  const e = JSON.parse(
903
- r._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
905
+ s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
904
906
  );
905
907
  return e ? {
906
908
  "data-blok-c": JSON.stringify(e),
@@ -910,39 +912,39 @@ const lt = (r = {}) => {
910
912
  return {};
911
913
  }
912
914
  };
913
- function Je(r, e) {
915
+ function Qe(s, e) {
914
916
  if (!e)
915
- return { src: r, attrs: {} };
916
- let t = 0, s = 0;
917
+ return { src: s, attrs: {} };
918
+ let t = 0, r = 0;
917
919
  const o = {}, n = [];
918
- function a(i, h, u, d, f) {
919
- typeof i != "number" || i <= h || i >= u ? console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase() + d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`) : f.push(`${d}(${i})`);
920
+ function a(i, h, d, p, b) {
921
+ typeof i != "number" || i <= h || i >= d ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`) : b.push(`${p}(${i})`);
920
922
  }
921
923
  if (typeof e == "object") {
922
- 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) {
923
- const { filters: i } = e || {}, { blur: h, brightness: u, fill: d, format: f, grayscale: y, quality: b, rotate: _ } = i || {};
924
- h && a(h, 0, 100, "blur", n), b && a(b, 0, 100, "quality", n), u && a(u, 0, 100, "brightness", n), d && n.push(`fill(${d})`), y && n.push("grayscale()"), _ && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${_})`), f && ["webp", "png", "jpeg"].includes(f) && n.push(`format(${f})`);
924
+ if (typeof e.width == "number" && e.width > 0 ? (o.width = e.width, t = e.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), e.height && typeof e.height == "number" && e.height > 0 ? (o.height = e.height, r = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (o.loading = e.loading), e.class && (o.class = e.class), e.filters) {
925
+ const { filters: i } = e || {}, { blur: h, brightness: d, fill: p, format: b, grayscale: v, quality: w, rotate: E } = i || {};
926
+ h && a(h, 0, 100, "blur", n), w && a(w, 0, 100, "quality", n), d && a(d, 0, 100, "brightness", n), p && n.push(`fill(${p})`), v && n.push("grayscale()"), E && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${E})`), b && ["webp", "png", "jpeg"].includes(b) && n.push(`format(${b})`);
925
927
  }
926
928
  e.srcset && (o.srcset = e.srcset.map((i) => {
927
929
  if (typeof i == "number")
928
- return `${r}/m/${i}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${i}w`;
930
+ return `${s}/m/${i}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${i}w`;
929
931
  if (Array.isArray(i) && i.length === 2) {
930
- const [h, u] = i;
931
- return `${r}/m/${h}x${u}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${h}w`;
932
+ const [h, d] = i;
933
+ return `${s}/m/${h}x${d}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${h}w`;
932
934
  } else {
933
935
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
934
936
  return;
935
937
  }
936
938
  }).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
937
939
  }
938
- let l = `${r}/m/`;
939
- return t > 0 && s > 0 && (l = `${l}${t}x${s}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
940
+ let l = `${s}/m/`;
941
+ return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
940
942
  src: l,
941
943
  attrs: o
942
944
  };
943
945
  }
944
- var v = /* @__PURE__ */ ((r) => (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))(v || {}), T = /* @__PURE__ */ ((r) => (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))(T || {}), X = /* @__PURE__ */ ((r) => (r.TEXT = "text", r))(X || {}), I = /* @__PURE__ */ ((r) => (r.URL = "url", r.STORY = "story", r.ASSET = "asset", r.EMAIL = "email", r))(I || {});
945
- const Ye = [
946
+ var k = /* @__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))(k || {}), _ = /* @__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))(_ || {}), X = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(X || {}), A = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(A || {});
947
+ const Ze = [
946
948
  "area",
947
949
  "base",
948
950
  "br",
@@ -957,336 +959,360 @@ const Ye = [
957
959
  "source",
958
960
  "track",
959
961
  "wbr"
960
- ], We = (r = {}) => Object.keys(r).map((e) => `${e}="${r[e]}"`).join(" "), Xe = (r = {}) => Object.keys(r).map((e) => `${e}: ${r[e]}`).join("; ");
961
- function Qe(r) {
962
- return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
962
+ ], et = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), tt = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
963
+ function rt(s) {
964
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
963
965
  }
964
- const q = (r) => Object.fromEntries(Object.entries(r).filter(([e, t]) => t !== void 0));
965
- function V(r, e = {}, t) {
966
- const s = We(e), o = s ? `${r} ${s}` : r, n = Array.isArray(t) ? t.join("") : t || "";
967
- if (r) {
968
- if (Ye.includes(r))
966
+ const L = (s) => Object.fromEntries(Object.entries(s).filter(([e, t]) => t !== void 0));
967
+ function V(s, e = {}, t) {
968
+ const r = et(e), o = r ? `${s} ${r}` : s, n = Array.isArray(t) ? t.join("") : t || "";
969
+ if (s) {
970
+ if (Ze.includes(s))
969
971
  return `<${o}>`;
970
972
  } else return n;
971
- return `<${o}>${n}</${r}>`;
973
+ return `<${o}>${n}</${s}>`;
972
974
  }
973
- function Ze(r = {}) {
975
+ function st(s = {}) {
974
976
  let e = 0;
975
977
  const {
976
978
  renderFn: t = V,
977
- textFn: s = Qe,
979
+ textFn: r = rt,
978
980
  resolvers: o = {},
979
981
  optimizeImages: n = !1,
980
982
  keyedResolvers: a = !1
981
- } = r, l = t !== V, i = (c) => (g) => {
982
- const m = g.attrs || {};
983
- return a && (m.key = `${c}-${e}`), t(c, m, g.children || null);
983
+ } = s, l = t !== V, i = (c) => (u) => {
984
+ const m = u.attrs || {};
985
+ return a && (m.key = `${c}-${e}`), t(c, m, u.children || null);
984
986
  }, h = (c) => {
985
- const { src: g, alt: m, title: k, srcset: R, sizes: $ } = c.attrs || {};
986
- let w = g, E = {};
987
+ const { src: u, alt: m, title: y, srcset: R, sizes: $ } = c.attrs || {};
988
+ let f = u, T = {};
987
989
  if (n) {
988
- const { src: oe, attrs: ne } = Je(g, n);
989
- w = oe, E = ne;
990
+ const { src: le, attrs: ce } = Qe(u, n);
991
+ f = le, T = ce;
990
992
  }
991
- a && (E = {
992
- ...E,
993
+ a && (T = {
994
+ ...T,
993
995
  key: `img-${e}`
994
996
  });
995
- const se = {
996
- src: w,
997
+ const ie = {
998
+ src: f,
997
999
  alt: m,
998
- title: k,
1000
+ title: y,
999
1001
  srcset: R,
1000
1002
  sizes: $,
1001
- ...E
1003
+ ...T
1002
1004
  };
1003
- return t("img", q(se));
1004
- }, u = (c) => {
1005
- const { level: g, ...m } = c.attrs || {}, k = {
1005
+ return t("img", L(ie));
1006
+ }, d = (c) => {
1007
+ const { level: u, ...m } = c.attrs || {}, y = {
1006
1008
  ...m
1007
1009
  };
1008
- return a && (k.key = `h${g}-${e}`), t(`h${g}`, k, c.children);
1009
- }, d = (c) => {
1010
- var g, m, k, R;
1010
+ return a && (y.key = `h${u}-${e}`), t(`h${u}`, y, c.children);
1011
+ }, p = (c) => {
1012
+ var u, m, y, R;
1011
1013
  const $ = t("img", {
1012
- src: (g = c.attrs) == null ? void 0 : g.fallbackImage,
1014
+ src: (u = c.attrs) == null ? void 0 : u.fallbackImage,
1013
1015
  alt: (m = c.attrs) == null ? void 0 : m.alt,
1014
1016
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
1015
1017
  draggable: "false",
1016
1018
  loading: "lazy"
1017
- }), w = {
1019
+ }), f = {
1018
1020
  "data-type": "emoji",
1019
- "data-name": (k = c.attrs) == null ? void 0 : k.name,
1021
+ "data-name": (y = c.attrs) == null ? void 0 : y.name,
1020
1022
  "data-emoji": (R = c.attrs) == null ? void 0 : R.emoji
1021
1023
  };
1022
- return a && (w.key = `emoji-${e}`), t("span", w, $);
1023
- }, f = (c) => t("pre", {
1024
+ return a && (f.key = `emoji-${e}`), t("span", f, $);
1025
+ }, b = (c) => t("pre", {
1024
1026
  ...c.attrs,
1025
1027
  key: `code-${e}`
1026
- }, t("code", { key: `code-${e}` }, c.children || "")), y = (c, g = !1) => ({ text: m, attrs: k }) => {
1027
- const { class: R, id: $, ...w } = k || {}, E = g ? {
1028
+ }, t("code", { key: `code-${e}` }, c.children || "")), v = (c, u = !1) => ({ text: m, attrs: y }) => {
1029
+ const { class: R, id: $, ...f } = y || {}, T = u ? {
1028
1030
  class: R,
1029
1031
  id: $,
1030
- style: Xe(w) || void 0
1031
- } : k || {};
1032
- return a && (E.key = `${c}-${e}`), t(c, q(E), m);
1033
- }, b = (c) => N(c), _ = (c) => {
1034
- const { marks: g, ...m } = c;
1035
- return "text" in c ? g ? g.reduce(
1036
- (k, R) => b({ ...R, text: k }),
1032
+ style: tt(f) || void 0
1033
+ } : y || {};
1034
+ return a && (T.key = `${c}-${e}`), t(c, L(T), m);
1035
+ }, w = (c) => M(c), E = (c) => {
1036
+ const { marks: u, ...m } = c;
1037
+ return "text" in c ? u ? u.reduce(
1038
+ (y, R) => w({ ...R, text: y }),
1037
1039
  // Fix: Ensure render function returns a string
1038
- b({ ...m, children: m.children })
1040
+ w({ ...m, children: m.children })
1039
1041
  // Fix: Cast children to string
1040
- ) : s(m.text) : "";
1042
+ ) : r(m.text) : "";
1041
1043
  }, j = (c) => {
1042
- const { linktype: g, href: m, anchor: k, ...R } = c.attrs || {};
1044
+ const { linktype: u, href: m, anchor: y, ...R } = c.attrs || {};
1043
1045
  let $ = "";
1044
- switch (g) {
1045
- case I.ASSET:
1046
- case I.URL:
1046
+ switch (u) {
1047
+ case A.ASSET:
1048
+ case A.URL:
1047
1049
  $ = m;
1048
1050
  break;
1049
- case I.EMAIL:
1051
+ case A.EMAIL:
1050
1052
  $ = `mailto:${m}`;
1051
1053
  break;
1052
- case I.STORY:
1053
- $ = m, k && ($ = `${$}#${k}`);
1054
+ case A.STORY:
1055
+ $ = m, y && ($ = `${$}#${y}`);
1054
1056
  break;
1055
1057
  default:
1056
1058
  $ = m;
1057
1059
  break;
1058
1060
  }
1059
- const w = { ...R };
1060
- return $ && (w.href = $), a && (w.key = `a-${e}`), t("a", w, c.text);
1061
+ const f = { ...R };
1062
+ return $ && (f.href = $), a && (f.key = `a-${e}`), t("a", f, c.text);
1061
1063
  }, te = (c) => {
1062
- var g, m;
1064
+ var u, m;
1063
1065
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), t("span", {
1064
- blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
1066
+ blok: (u = c == null ? void 0 : c.attrs) == null ? void 0 : u.body[0],
1065
1067
  id: (m = c.attrs) == null ? void 0 : m.id,
1066
1068
  key: `component-${e}`,
1067
1069
  style: "display: none"
1068
1070
  });
1069
- }, re = new Map([
1070
- [v.DOCUMENT, i("")],
1071
- [v.HEADING, u],
1072
- [v.PARAGRAPH, i("p")],
1073
- [v.UL_LIST, i("ul")],
1074
- [v.OL_LIST, i("ol")],
1075
- [v.LIST_ITEM, i("li")],
1076
- [v.IMAGE, h],
1077
- [v.EMOJI, d],
1078
- [v.CODE_BLOCK, f],
1079
- [v.HR, i("hr")],
1080
- [v.BR, i("br")],
1081
- [v.QUOTE, i("blockquote")],
1082
- [v.COMPONENT, te],
1083
- [X.TEXT, _],
1084
- [T.LINK, j],
1085
- [T.ANCHOR, j],
1086
- [T.STYLED, y("span", !0)],
1087
- [T.BOLD, y("strong")],
1088
- [T.TEXT_STYLE, y("span", !0)],
1089
- [T.ITALIC, y("em")],
1090
- [T.UNDERLINE, y("u")],
1091
- [T.STRIKE, y("s")],
1092
- [T.CODE, y("code")],
1093
- [T.SUPERSCRIPT, y("sup")],
1094
- [T.SUBSCRIPT, y("sub")],
1095
- [T.HIGHLIGHT, y("mark")],
1096
- ...Object.entries(o).map(([c, g]) => [c, g])
1071
+ }, re = (c) => {
1072
+ const u = {};
1073
+ return a && (u.key = `table-${e}`), t("table", u, c.children);
1074
+ }, se = (c) => {
1075
+ const u = {};
1076
+ return a && (u.key = `tr-${e}`), t("tr", u, c.children);
1077
+ }, oe = (c) => {
1078
+ const { colspan: u, rowspan: m, colwidth: y, backgroundColor: R, ...$ } = c.attrs || {}, f = {
1079
+ ...$
1080
+ };
1081
+ u > 1 && (f.colspan = u), m > 1 && (f.rowspan = m);
1082
+ const T = [];
1083
+ return y && T.push(`width: ${y}px;`), R && T.push(`background-color: ${R};`), T.length > 0 && (f.style = T.join(" ")), a && (f.key = `td-${e}`), t("td", L(f), c.children);
1084
+ }, ne = (c) => {
1085
+ const { colspan: u, rowspan: m, colwidth: y, backgroundColor: R, ...$ } = c.attrs || {}, f = {
1086
+ ...$
1087
+ };
1088
+ u > 1 && (f.colspan = u), m > 1 && (f.rowspan = m);
1089
+ const T = [];
1090
+ return y && T.push(`width: ${y}px;`), R && T.push(`background-color: ${R};`), T.length > 0 && (f.style = T.join(" ")), a && (f.key = `th-${e}`), t("th", L(f), c.children);
1091
+ }, ae = new Map([
1092
+ [k.DOCUMENT, i("")],
1093
+ [k.HEADING, d],
1094
+ [k.PARAGRAPH, i("p")],
1095
+ [k.UL_LIST, i("ul")],
1096
+ [k.OL_LIST, i("ol")],
1097
+ [k.LIST_ITEM, i("li")],
1098
+ [k.IMAGE, h],
1099
+ [k.EMOJI, p],
1100
+ [k.CODE_BLOCK, b],
1101
+ [k.HR, i("hr")],
1102
+ [k.BR, i("br")],
1103
+ [k.QUOTE, i("blockquote")],
1104
+ [k.COMPONENT, te],
1105
+ [X.TEXT, E],
1106
+ [_.LINK, j],
1107
+ [_.ANCHOR, j],
1108
+ [_.STYLED, v("span", !0)],
1109
+ [_.BOLD, v("strong")],
1110
+ [_.TEXT_STYLE, v("span", !0)],
1111
+ [_.ITALIC, v("em")],
1112
+ [_.UNDERLINE, v("u")],
1113
+ [_.STRIKE, v("s")],
1114
+ [_.CODE, v("code")],
1115
+ [_.SUPERSCRIPT, v("sup")],
1116
+ [_.SUBSCRIPT, v("sub")],
1117
+ [_.HIGHLIGHT, v("mark")],
1118
+ [k.TABLE, re],
1119
+ [k.TABLE_ROW, se],
1120
+ [k.TABLE_CELL, oe],
1121
+ [k.TABLE_HEADER, ne],
1122
+ ...Object.entries(o).map(([c, u]) => [c, u])
1097
1123
  ]);
1098
- function A(c) {
1124
+ function I(c) {
1099
1125
  e += 1;
1100
- const g = re.get(c.type);
1101
- if (!g)
1126
+ const u = ae.get(c.type);
1127
+ if (!u)
1102
1128
  return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
1103
1129
  if (c.type === "text")
1104
- return g(c);
1105
- const m = c.content ? c.content.map(N) : void 0;
1106
- return g({
1130
+ return u(c);
1131
+ const m = c.content ? c.content.map(M) : void 0;
1132
+ return u({
1107
1133
  ...c,
1108
1134
  children: m
1109
1135
  // Fix: Update the type of 'children' to Node[]
1110
1136
  });
1111
1137
  }
1112
- function N(c) {
1113
- return c.type === "doc" ? l ? c.content.map(A) : c.content.map(A).join("") : Array.isArray(c) ? c.map(A) : A(c);
1138
+ function M(c) {
1139
+ return c.type === "doc" ? l ? c.content.map(I) : c.content.map(I).join("") : Array.isArray(c) ? c.map(I) : I(c);
1114
1140
  }
1115
1141
  return {
1116
- render: N
1142
+ render: M
1117
1143
  };
1118
1144
  }
1119
- let H, G = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1120
- const et = (r, e, t = {}) => {
1121
- var s;
1122
- const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
1145
+ let U, G = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1146
+ const ot = (s, e, t = {}) => {
1147
+ var r;
1148
+ const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
1123
1149
  "_storyblok"
1124
- ), a = n !== null && +n === r;
1150
+ ), a = n !== null && +n === s;
1125
1151
  if (!(!o || !a)) {
1126
- if (!r) {
1152
+ if (!s) {
1127
1153
  console.warn("Story ID is not defined. Please provide a valid ID.");
1128
1154
  return;
1129
1155
  }
1130
1156
  window.storyblokRegisterEvent(() => {
1131
1157
  new window.StoryblokBridge(t).on(["input", "published", "change"], (l) => {
1132
1158
  var i;
1133
- l && (l.action === "input" && ((i = l.story) == null ? void 0 : i.id) === r ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === r && window.location.reload());
1159
+ l && (l.action === "input" && ((i = l.story) == null ? void 0 : i.id) === s ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === s && window.location.reload());
1134
1160
  });
1135
1161
  });
1136
1162
  }
1137
- }, Q = (r, e) => {
1138
- r.addNode("blok", (t) => {
1139
- let s = "";
1163
+ }, Q = (s, e) => {
1164
+ s.addNode("blok", (t) => {
1165
+ let r = "";
1140
1166
  return t.attrs.body.forEach((o) => {
1141
- s += e(o.component, o);
1167
+ r += e(o.component, o);
1142
1168
  }), {
1143
- html: s
1169
+ html: r
1144
1170
  };
1145
1171
  });
1146
- }, tt = (r = {}) => {
1172
+ }, nt = (s = {}) => {
1147
1173
  var e, t;
1148
1174
  const {
1149
- bridge: s,
1175
+ bridge: r,
1150
1176
  accessToken: o,
1151
1177
  use: n = [],
1152
1178
  apiOptions: a = {},
1153
1179
  richText: l = {},
1154
1180
  bridgeUrl: i
1155
- } = r;
1181
+ } = s;
1156
1182
  a.accessToken = a.accessToken || o;
1157
- const h = { bridge: s, apiOptions: a };
1158
- let u = {};
1159
- n.forEach((f) => {
1160
- u = { ...u, ...f(h) };
1183
+ const h = { bridge: r, apiOptions: a };
1184
+ let d = {};
1185
+ n.forEach((b) => {
1186
+ d = { ...d, ...b(h) };
1161
1187
  }), i && (G = i);
1162
- const d = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1163
- return s !== !1 && d && de(G), H = new P(l.schema), l.resolver && Q(H, l.resolver), u;
1164
- }, rt = (r) => {
1188
+ const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1189
+ return r !== !1 && p && fe(G), U = new N(l.schema), l.resolver && Q(U, l.resolver), d;
1190
+ }, at = (s) => {
1165
1191
  var e;
1166
- return !r || !((e = r == null ? void 0 : r.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
1167
- }, ct = (r, e, t) => {
1168
- let s = t || H;
1169
- if (!s) {
1192
+ return !s || !((e = s == null ? void 0 : s.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
1193
+ }, pt = (s, e, t) => {
1194
+ let r = t || U;
1195
+ if (!r) {
1170
1196
  console.error(
1171
1197
  "Please initialize the Storyblok SDK before calling the renderRichText function"
1172
1198
  );
1173
1199
  return;
1174
1200
  }
1175
- return rt(r) ? "" : (e && (s = new P(e.schema), e.resolver && Q(s, e.resolver)), s.render(r, {}, !1));
1176
- }, Z = /* @__PURE__ */ K({
1201
+ return at(s) ? "" : (e && (r = new N(e.schema), e.resolver && Q(r, e.resolver)), r.render(s, {}, !1));
1202
+ }, Z = /* @__PURE__ */ J({
1177
1203
  __name: "StoryblokComponent",
1178
1204
  props: {
1179
1205
  blok: {}
1180
1206
  },
1181
- setup(r, { expose: e }) {
1182
- const t = r, s = O();
1207
+ setup(s, { expose: e }) {
1208
+ const t = s, r = O();
1183
1209
  e({
1184
- value: s
1210
+ value: r
1185
1211
  });
1186
- const o = typeof M(t.blok.component) != "string", n = ae("VueSDKOptions"), a = O(t.blok.component);
1187
- return !o && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof M(a.value) == "string" && console.error(
1212
+ const o = typeof H(t.blok.component) != "string", n = he("VueSDKOptions"), a = O(t.blok.component);
1213
+ return !o && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof H(a.value) == "string" && console.error(
1188
1214
  `Is the Fallback component "${a.value}" registered properly?`
1189
1215
  )) : console.error(
1190
1216
  `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});"?`
1191
- )), (l, i) => (Y(), J(M(a.value), ie({
1217
+ )), (l, i) => (Y(), K(H(a.value), ue({
1192
1218
  ref_key: "blokRef",
1193
- ref: s
1219
+ ref: r
1194
1220
  }, { ...l.$props, ...l.$attrs }), null, 16));
1195
1221
  }
1196
- }), st = (r) => {
1222
+ }), it = (s) => {
1197
1223
  var e, t;
1198
1224
  return W(
1199
1225
  Z,
1200
1226
  {
1201
- blok: (e = r == null ? void 0 : r.attrs) == null ? void 0 : e.body[0],
1202
- id: (t = r.attrs) == null ? void 0 : t.id
1227
+ blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
1228
+ id: (t = s.attrs) == null ? void 0 : t.id
1203
1229
  },
1204
- r.children
1230
+ s.children
1205
1231
  );
1206
1232
  };
1207
- function ot(r) {
1233
+ function lt(s) {
1208
1234
  const e = {
1209
1235
  renderFn: W,
1210
- textFn: le,
1236
+ textFn: de,
1211
1237
  keyedResolvers: !0,
1212
1238
  resolvers: {
1213
- [v.COMPONENT]: st,
1214
- ...r.resolvers
1239
+ [k.COMPONENT]: it,
1240
+ ...s.resolvers
1215
1241
  }
1216
1242
  };
1217
- return Ze(e);
1243
+ return st(e);
1218
1244
  }
1219
- const nt = /* @__PURE__ */ K({
1245
+ const ct = /* @__PURE__ */ J({
1220
1246
  __name: "StoryblokRichText",
1221
1247
  props: {
1222
1248
  doc: {},
1223
1249
  resolvers: {}
1224
1250
  },
1225
- setup(r) {
1226
- const e = r, t = O(), s = () => t.value;
1227
- return ce([() => e.doc, () => e.resolvers], ([o, n]) => {
1228
- const { render: a } = ot({
1251
+ setup(s) {
1252
+ const e = s, t = O(), r = () => t.value;
1253
+ return pe([() => e.doc, () => e.resolvers], ([o, n]) => {
1254
+ const { render: a } = lt({
1229
1255
  resolvers: n ?? {}
1230
1256
  });
1231
1257
  t.value = a(o);
1232
1258
  }, {
1233
1259
  immediate: !0,
1234
1260
  deep: !0
1235
- }), (o, n) => (Y(), J(s));
1261
+ }), (o, n) => (Y(), K(r));
1236
1262
  }
1237
- }), at = {
1238
- beforeMount(r, e) {
1263
+ }), ht = {
1264
+ beforeMount(s, e) {
1239
1265
  if (e.value) {
1240
- const t = Ke(e.value);
1241
- 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"));
1266
+ const t = Xe(e.value);
1267
+ 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"));
1242
1268
  }
1243
1269
  }
1244
- }, ee = (r) => {
1245
- console.error(`You can't use ${r} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1270
+ }, ee = (s) => {
1271
+ console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1246
1272
  `);
1247
1273
  };
1248
1274
  let x = null;
1249
- const ht = () => (x || ee("useStoryblokApi"), x), ut = async (r, e = {}, t = {}) => {
1250
- const s = O(null);
1251
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, he(() => {
1252
- s.value && s.value.id && et(
1253
- s.value.id,
1254
- (o) => s.value = o,
1275
+ const gt = () => (x || ee("useStoryblokApi"), x), mt = async (s, e = {}, t = {}) => {
1276
+ const r = O(null);
1277
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, ge(() => {
1278
+ r.value && r.value.id && ot(
1279
+ r.value.id,
1280
+ (o) => r.value = o,
1255
1281
  t
1256
1282
  );
1257
1283
  }), x) {
1258
1284
  const { data: o } = await x.get(
1259
- `cdn/stories/${r}`,
1285
+ `cdn/stories/${s}`,
1260
1286
  e
1261
1287
  );
1262
- s.value = o.story;
1288
+ r.value = o.story;
1263
1289
  } else
1264
1290
  ee("useStoryblok");
1265
- return s;
1266
- }, dt = {
1267
- install(r, e = {}) {
1268
- r.directive("editable", at), r.component("StoryblokComponent", Z), r.component("StoryblokRichText", nt), e.enableFallbackComponent && !e.customFallbackComponent && r.component(
1291
+ return r;
1292
+ }, ft = {
1293
+ install(s, e = {}) {
1294
+ s.directive("editable", ht), s.component("StoryblokComponent", Z), s.component("StoryblokRichText", ct), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
1269
1295
  "FallbackComponent",
1270
- ue(() => import("./FallbackComponent-Dky11gEu.js"))
1296
+ me(() => import("./FallbackComponent-Dky11gEu.js"))
1271
1297
  );
1272
- const { storyblokApi: t } = tt(e);
1273
- x = t || null, r.provide("VueSDKOptions", e);
1298
+ const { storyblokApi: t } = nt(e);
1299
+ x = t || null, s.provide("VueSDKOptions", e);
1274
1300
  }
1275
1301
  };
1276
1302
  export {
1277
- v as BlockTypes,
1278
- T as MarkTypes,
1279
- P as RichTextResolver,
1280
- Be as RichTextSchema,
1303
+ k as BlockTypes,
1304
+ _ as MarkTypes,
1305
+ N as RichTextResolver,
1306
+ Je as RichTextSchema,
1281
1307
  Z as StoryblokComponent,
1282
- nt as StoryblokRichText,
1283
- dt as StoryblokVue,
1308
+ ct as StoryblokRichText,
1309
+ ft as StoryblokVue,
1284
1310
  X as TextTypes,
1285
- lt as apiPlugin,
1286
- ct as renderRichText,
1287
- Ze as richTextResolver,
1288
- ut as useStoryblok,
1289
- ht as useStoryblokApi,
1290
- et as useStoryblokBridge,
1291
- ot as useStoryblokRichText
1311
+ dt as apiPlugin,
1312
+ pt as renderRichText,
1313
+ st as richTextResolver,
1314
+ mt as useStoryblok,
1315
+ gt as useStoryblokApi,
1316
+ ot as useStoryblokBridge,
1317
+ lt as useStoryblokRichText
1292
1318
  };