@storyblok/vue 8.2.2 → 8.2.3

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