@storyblok/react 4.6.0 → 4.7.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.
@@ -1,80 +1,80 @@
1
- let B = !1;
2
- const z = [], G = (r) => new Promise((e, t) => {
1
+ let z = !1;
2
+ const D = [], V = (n) => new Promise((e, t) => {
3
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (s) => {
4
4
  if (window.location === window.parent.location) {
5
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
6
6
  return;
7
7
  }
8
- B ? s() : z.push(s);
8
+ z ? s() : D.push(s);
9
9
  }, document.getElementById("storyblok-javascript-bridge")))
10
10
  return;
11
- const n = document.createElement("script");
12
- n.async = !0, n.src = r, n.id = "storyblok-javascript-bridge", n.onerror = (s) => t(s), n.onload = (s) => {
13
- z.forEach((o) => o()), B = !0, e(s);
14
- }, document.getElementsByTagName("head")[0].appendChild(n);
11
+ const r = document.createElement("script");
12
+ r.async = !0, r.src = n, r.id = "storyblok-javascript-bridge", r.onerror = (s) => t(s), r.onload = (s) => {
13
+ D.forEach((o) => o()), z = !0, e(s);
14
+ }, document.getElementsByTagName("head")[0].appendChild(r);
15
15
  });
16
- var ne = Object.defineProperty, oe = (r, e, t) => e in r ? ne(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, m = (r, e, t) => oe(r, typeof e != "symbol" ? e + "" : e, t);
16
+ var ne = Object.defineProperty, oe = (n, e, t) => e in n ? ne(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, m = (n, e, t) => oe(n, typeof e != "symbol" ? e + "" : e, t);
17
17
  class ae extends Error {
18
18
  constructor(e) {
19
19
  super(e), this.name = "AbortError";
20
20
  }
21
21
  }
22
- function ie(r, e, t) {
22
+ function ie(n, e, t) {
23
23
  if (!Number.isFinite(e))
24
24
  throw new TypeError("Expected `limit` to be a finite number");
25
25
  if (!Number.isFinite(t))
26
26
  throw new TypeError("Expected `interval` to be a finite number");
27
- const n = [];
28
- let s = [], o = 0, l = !1;
29
- const a = async () => {
27
+ const r = [];
28
+ let s = [], o = 0, a = !1;
29
+ const l = async () => {
30
30
  o++;
31
- const h = n.shift();
31
+ const h = r.shift();
32
32
  if (h)
33
33
  try {
34
- const p = await r(...h.args);
34
+ const p = await n(...h.args);
35
35
  h.resolve(p);
36
36
  } catch (p) {
37
37
  h.reject(p);
38
38
  }
39
- const u = setTimeout(() => {
40
- o--, n.length > 0 && a(), s = s.filter((p) => p !== u);
39
+ const d = setTimeout(() => {
40
+ o--, r.length > 0 && l(), s = s.filter((p) => p !== d);
41
41
  }, t);
42
- s.includes(u) || s.push(u);
43
- }, i = (...h) => l ? Promise.reject(
42
+ s.includes(d) || s.push(d);
43
+ }, i = (...h) => a ? Promise.reject(
44
44
  new Error(
45
45
  "Throttled function is already aborted and not accepting new promises"
46
46
  )
47
- ) : new Promise((u, p) => {
48
- n.push({
49
- resolve: u,
47
+ ) : new Promise((d, p) => {
48
+ r.push({
49
+ resolve: d,
50
50
  reject: p,
51
51
  args: h
52
- }), o < e && a();
52
+ }), o < e && l();
53
53
  });
54
54
  return i.abort = () => {
55
- l = !0, s.forEach(clearTimeout), s = [], n.forEach(
55
+ a = !0, s.forEach(clearTimeout), s = [], r.forEach(
56
56
  (h) => h.reject(() => new ae("Throttle function aborted"))
57
- ), n.length = 0;
57
+ ), r.length = 0;
58
58
  }, i;
59
59
  }
60
- class L {
60
+ class C {
61
61
  constructor() {
62
- m(this, "isCDNUrl", (e = "") => e.includes("/cdn/")), m(this, "getOptionsPage", (e, t = 25, n = 1) => ({
62
+ m(this, "isCDNUrl", (e = "") => e.includes("/cdn/")), m(this, "getOptionsPage", (e, t = 25, r = 1) => ({
63
63
  ...e,
64
64
  per_page: t,
65
- page: n
65
+ page: r
66
66
  })), 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) => {
67
- const n = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
68
- return this.arrayFrom(n, (o, l) => l * s + e);
69
- }), m(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), m(this, "flatMap", (e = [], t) => e.map(t).reduce((n, s) => [...n, ...s], [])), m(this, "escapeHTML", function(e) {
67
+ const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
68
+ return this.arrayFrom(r, (o, a) => a * s + e);
69
+ }), m(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), m(this, "flatMap", (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], [])), m(this, "escapeHTML", function(e) {
70
70
  const t = {
71
71
  "&": "&amp;",
72
72
  "<": "&lt;",
73
73
  ">": "&gt;",
74
74
  '"': "&quot;",
75
75
  "'": "&#39;"
76
- }, n = /[&<>"']/g, s = new RegExp(n.source);
77
- return e && s.test(e) ? e.replace(n, (o) => t[o]) : e;
76
+ }, r = /[&<>"']/g, s = new RegExp(r.source);
77
+ return e && s.test(e) ? e.replace(r, (o) => t[o]) : e;
78
78
  });
79
79
  }
80
80
  /**
@@ -84,21 +84,21 @@ class L {
84
84
  * @param {boolean} isArray
85
85
  * @return {string} Stringified object
86
86
  */
87
- stringify(e, t, n) {
87
+ stringify(e, t, r) {
88
88
  const s = [];
89
89
  for (const o in e) {
90
90
  if (!Object.prototype.hasOwnProperty.call(e, o))
91
91
  continue;
92
- const l = e[o];
93
- if (l == null)
92
+ const a = e[o];
93
+ if (a == null)
94
94
  continue;
95
- const a = n ? "" : encodeURIComponent(o);
95
+ const l = r ? "" : encodeURIComponent(o);
96
96
  let i;
97
- typeof l == "object" ? i = this.stringify(
98
- l,
99
- t ? t + encodeURIComponent(`[${a}]`) : a,
100
- Array.isArray(l)
101
- ) : i = `${t ? t + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(l)}`, s.push(i);
97
+ typeof a == "object" ? i = this.stringify(
98
+ a,
99
+ t ? t + encodeURIComponent(`[${l}]`) : l,
100
+ Array.isArray(a)
101
+ ) : i = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(a)}`, s.push(i);
102
102
  }
103
103
  return s.join("&");
104
104
  }
@@ -108,51 +108,51 @@ class L {
108
108
  * @return {string} The base URL of the region
109
109
  */
110
110
  getRegionURL(e) {
111
- const t = "api.storyblok.com", n = "api-us.storyblok.com", s = "app.storyblokchina.cn", o = "api-ap.storyblok.com", l = "api-ca.storyblok.com";
111
+ const t = "api.storyblok.com", r = "api-us.storyblok.com", s = "app.storyblokchina.cn", o = "api-ap.storyblok.com", a = "api-ca.storyblok.com";
112
112
  switch (e) {
113
113
  case "us":
114
- return n;
114
+ return r;
115
115
  case "cn":
116
116
  return s;
117
117
  case "ap":
118
118
  return o;
119
119
  case "ca":
120
- return l;
120
+ return a;
121
121
  default:
122
122
  return t;
123
123
  }
124
124
  }
125
125
  }
126
- const le = function(r, e) {
126
+ const le = function(n, e) {
127
127
  const t = {};
128
- for (const n in r) {
129
- const s = r[n];
130
- e.includes(n) && s !== null && (t[n] = s);
128
+ for (const r in n) {
129
+ const s = n[r];
130
+ e.includes(r) && s !== null && (t[r] = s);
131
131
  }
132
132
  return t;
133
- }, ce = (r) => r === "email", he = () => ({
133
+ }, ce = (n) => n === "email", he = () => ({
134
134
  singleTag: "hr"
135
135
  }), ue = () => ({
136
136
  tag: "blockquote"
137
137
  }), de = () => ({
138
138
  tag: "ul"
139
- }), pe = (r) => ({
139
+ }), pe = (n) => ({
140
140
  tag: [
141
141
  "pre",
142
142
  {
143
143
  tag: "code",
144
- attrs: r.attrs
144
+ attrs: n.attrs
145
145
  }
146
146
  ]
147
147
  }), ge = () => ({
148
148
  singleTag: "br"
149
- }), fe = (r) => ({
150
- tag: `h${r.attrs.level}`
151
- }), me = (r) => ({
149
+ }), fe = (n) => ({
150
+ tag: `h${n.attrs.level}`
151
+ }), me = (n) => ({
152
152
  singleTag: [
153
153
  {
154
154
  tag: "img",
155
- attrs: le(r.attrs, ["src", "alt", "title"])
155
+ attrs: le(n.attrs, ["src", "alt", "title"])
156
156
  }
157
157
  ]
158
158
  }), ye = () => ({
@@ -161,14 +161,14 @@ const le = function(r, e) {
161
161
  tag: "ol"
162
162
  }), ve = () => ({
163
163
  tag: "p"
164
- }), ke = (r) => ({
164
+ }), ke = (n) => ({
165
165
  tag: [
166
166
  {
167
167
  tag: "span",
168
168
  attrs: {
169
169
  "data-type": "emoji",
170
- "data-name": r.attrs.name,
171
- emoji: r.attrs.emoji
170
+ "data-name": n.attrs.name,
171
+ emoji: n.attrs.emoji
172
172
  }
173
173
  }
174
174
  ]
@@ -184,13 +184,13 @@ const le = function(r, e) {
184
184
  tag: "code"
185
185
  }), Ee = () => ({
186
186
  tag: "i"
187
- }), Se = (r) => {
188
- if (!r.attrs)
187
+ }), Se = (n) => {
188
+ if (!n.attrs)
189
189
  return {
190
190
  tag: ""
191
191
  };
192
- const e = new L().escapeHTML, t = { ...r.attrs }, { linktype: n = "url" } = r.attrs;
193
- if (delete t.linktype, t.href && (t.href = e(r.attrs.href || "")), ce(n) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
192
+ const e = new C().escapeHTML, t = { ...n.attrs }, { linktype: r = "url" } = n.attrs;
193
+ if (delete t.linktype, t.href && (t.href = e(n.attrs.href || "")), ce(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
194
194
  for (const s in t.custom)
195
195
  t[s] = t.custom[s];
196
196
  delete t.custom;
@@ -203,46 +203,46 @@ const le = function(r, e) {
203
203
  }
204
204
  ]
205
205
  };
206
- }, je = (r) => ({
206
+ }, je = (n) => ({
207
207
  tag: [
208
208
  {
209
209
  tag: "span",
210
- attrs: r.attrs
210
+ attrs: n.attrs
211
211
  }
212
212
  ]
213
213
  }), xe = () => ({
214
214
  tag: "sub"
215
215
  }), Ie = () => ({
216
216
  tag: "sup"
217
- }), Ae = (r) => ({
217
+ }), Ae = (n) => ({
218
218
  tag: [
219
219
  {
220
220
  tag: "span",
221
- attrs: r.attrs
221
+ attrs: n.attrs
222
222
  }
223
223
  ]
224
- }), Oe = (r) => {
224
+ }), Oe = (n) => {
225
225
  var e;
226
- return (e = r.attrs) != null && e.color ? {
226
+ return (e = n.attrs) != null && e.color ? {
227
227
  tag: [
228
228
  {
229
229
  tag: "span",
230
230
  attrs: {
231
- style: `background-color:${r.attrs.color};`
231
+ style: `background-color:${n.attrs.color};`
232
232
  }
233
233
  }
234
234
  ]
235
235
  } : {
236
236
  tag: ""
237
237
  };
238
- }, Le = (r) => {
238
+ }, Le = (n) => {
239
239
  var e;
240
- return (e = r.attrs) != null && e.color ? {
240
+ return (e = n.attrs) != null && e.color ? {
241
241
  tag: [
242
242
  {
243
243
  tag: "span",
244
244
  attrs: {
245
- style: `color:${r.attrs.color}`
245
+ style: `color:${n.attrs.color}`
246
246
  }
247
247
  }
248
248
  ]
@@ -278,34 +278,35 @@ const le = function(r, e) {
278
278
  highlight: Oe,
279
279
  textStyle: Le
280
280
  }
281
- }, Pe = function(r) {
281
+ }, Pe = function(n) {
282
282
  const e = {
283
283
  "&": "&amp;",
284
284
  "<": "&lt;",
285
285
  ">": "&gt;",
286
286
  '"': "&quot;",
287
287
  "'": "&#39;"
288
- }, t = /[&<>"']/g, n = new RegExp(t.source);
289
- return r && n.test(r) ? r.replace(t, (s) => e[s]) : r;
288
+ }, t = /[&<>"']/g, r = new RegExp(t.source);
289
+ return n && r.test(n) ? n.replace(t, (s) => e[s]) : n;
290
290
  };
291
- let D = !1, C = class {
292
- constructor(r) {
293
- m(this, "marks"), m(this, "nodes"), r || (r = Ce), this.marks = r.marks || [], this.nodes = r.nodes || [];
291
+ let q = !1;
292
+ class P {
293
+ constructor(e) {
294
+ m(this, "marks"), m(this, "nodes"), e || (e = Ce), this.marks = e.marks || [], this.nodes = e.nodes || [];
294
295
  }
295
- addNode(r, e) {
296
- this.nodes[r] = e;
296
+ addNode(e, t) {
297
+ this.nodes[e] = t;
297
298
  }
298
- addMark(r, e) {
299
- this.marks[r] = e;
299
+ addMark(e, t) {
300
+ this.marks[e] = t;
300
301
  }
301
- render(r, e = { optimizeImages: !1 }, t = !0) {
302
- if (!D && t && (console.warn(
302
+ render(e, t = { optimizeImages: !1 }, r = !0) {
303
+ if (!q && r && (console.warn(
303
304
  "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/"
304
- ), D = !0), r && r.content && Array.isArray(r.content)) {
305
- let n = "";
306
- return r.content.forEach((s) => {
307
- n += this.renderNode(s);
308
- }), e.optimizeImages ? this.optimizeImages(n, e.optimizeImages) : n;
305
+ ), q = !0), e && e.content && Array.isArray(e.content)) {
306
+ let s = "";
307
+ return e.content.forEach((o) => {
308
+ s += this.renderNode(o);
309
+ }), t.optimizeImages ? this.optimizeImages(s, t.optimizeImages) : s;
309
310
  }
310
311
  return console.warn(
311
312
  `The render method must receive an Object with a "content" field.
@@ -334,101 +335,101 @@ let D = !1, C = class {
334
335
  }`
335
336
  ), "";
336
337
  }
337
- optimizeImages(r, e) {
338
- let t = 0, n = 0, s = "", o = "";
339
- typeof e != "boolean" && (typeof e.width == "number" && e.width > 0 && (s += `width="${e.width}" `, t = e.width), typeof e.height == "number" && e.height > 0 && (s += `height="${e.height}" `, n = e.height), (e.loading === "lazy" || e.loading === "eager") && (s += `loading="${e.loading}" `), typeof e.class == "string" && e.class.length > 0 && (s += `class="${e.class}" `), e.filters && (typeof e.filters.blur == "number" && e.filters.blur >= 0 && e.filters.blur <= 100 && (o += `:blur(${e.filters.blur})`), typeof e.filters.brightness == "number" && e.filters.brightness >= -100 && e.filters.brightness <= 100 && (o += `:brightness(${e.filters.brightness})`), e.filters.fill && (e.filters.fill.match(/[0-9A-F]{6}/gi) || e.filters.fill === "transparent") && (o += `:fill(${e.filters.fill})`), e.filters.format && ["webp", "png", "jpeg"].includes(e.filters.format) && (o += `:format(${e.filters.format})`), typeof e.filters.grayscale == "boolean" && e.filters.grayscale && (o += ":grayscale()"), typeof e.filters.quality == "number" && e.filters.quality >= 0 && e.filters.quality <= 100 && (o += `:quality(${e.filters.quality})`), e.filters.rotate && [90, 180, 270].includes(e.filters.rotate) && (o += `:rotate(${e.filters.rotate})`), o.length > 0 && (o = `/filters${o}`))), s.length > 0 && (r = r.replace(/<img/g, `<img ${s.trim()}`));
340
- const l = t > 0 || n > 0 || o.length > 0 ? `${t}x${n}${o}` : "";
341
- return r = r.replace(
338
+ optimizeImages(e, t) {
339
+ let r = 0, s = 0, o = "", a = "";
340
+ typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (o += `width="${t.width}" `, r = t.width), typeof t.height == "number" && t.height > 0 && (o += `height="${t.height}" `, s = t.height), (t.loading === "lazy" || t.loading === "eager") && (o += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (o += `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}`))), o.length > 0 && (e = e.replace(/<img/g, `<img ${o.trim()}`));
341
+ const l = r > 0 || s > 0 || a.length > 0 ? `${r}x${s}${a}` : "";
342
+ return e = e.replace(
342
343
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,
343
344
  `a.storyblok.com/f/$1/$2.$3/m/${l}`
344
- ), typeof e != "boolean" && (e.sizes || e.srcset) && (r = r.replace(/<img.*?src=["|'](.*?)["|']/g, (a) => {
345
- var i, h;
346
- const u = a.match(
345
+ ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (i) => {
346
+ var h, d;
347
+ const p = i.match(
347
348
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g
348
349
  );
349
- if (u && u.length > 0) {
350
- const p = {
351
- srcset: (i = e.srcset) == null ? void 0 : i.map((T) => {
352
- if (typeof T == "number")
353
- return `//${u}/m/${T}x0${o} ${T}w`;
354
- if (typeof T == "object" && T.length === 2) {
355
- let w = 0, S = 0;
356
- return typeof T[0] == "number" && (w = T[0]), typeof T[1] == "number" && (S = T[1]), `//${u}/m/${w}x${S}${o} ${w}w`;
350
+ if (p && p.length > 0) {
351
+ const b = {
352
+ srcset: (h = t.srcset) == null ? void 0 : h.map((y) => {
353
+ if (typeof y == "number")
354
+ return `//${p}/m/${y}x0${a} ${y}w`;
355
+ if (typeof y == "object" && y.length === 2) {
356
+ let S = 0, I = 0;
357
+ return typeof y[0] == "number" && (S = y[0]), typeof y[1] == "number" && (I = y[1]), `//${p}/m/${S}x${I}${a} ${S}w`;
357
358
  }
358
359
  return "";
359
360
  }).join(", "),
360
- sizes: (h = e.sizes) == null ? void 0 : h.map((T) => T).join(", ")
361
+ sizes: (d = t.sizes) == null ? void 0 : d.map((y) => y).join(", ")
361
362
  };
362
- let b = "";
363
- return p.srcset && (b += `srcset="${p.srcset}" `), p.sizes && (b += `sizes="${p.sizes}" `), a.replace(/<img/g, `<img ${b.trim()}`);
363
+ let E = "";
364
+ return b.srcset && (E += `srcset="${b.srcset}" `), b.sizes && (E += `sizes="${b.sizes}" `), i.replace(/<img/g, `<img ${E.trim()}`);
364
365
  }
365
- return a;
366
- })), r;
367
- }
368
- renderNode(r) {
369
- const e = [];
370
- r.marks && r.marks.forEach((n) => {
371
- const s = this.getMatchingMark(n);
372
- s && s.tag !== "" && e.push(this.renderOpeningTag(s.tag));
366
+ return i;
367
+ })), e;
368
+ }
369
+ renderNode(e) {
370
+ const t = [];
371
+ e.marks && e.marks.forEach((s) => {
372
+ const o = this.getMatchingMark(s);
373
+ o && o.tag !== "" && t.push(this.renderOpeningTag(o.tag));
373
374
  });
374
- const t = this.getMatchingNode(r);
375
- return t && t.tag && e.push(this.renderOpeningTag(t.tag)), r.content ? r.content.forEach((n) => {
376
- e.push(this.renderNode(n));
377
- }) : r.text ? e.push(Pe(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((n) => {
378
- const s = this.getMatchingMark(n);
379
- s && s.tag !== "" && e.push(this.renderClosingTag(s.tag));
380
- }), e.join("");
381
- }
382
- renderTag(r, e) {
383
- return r.constructor === String ? `<${r}${e}>` : r.map((t) => {
384
- if (t.constructor === String)
385
- return `<${t}${e}>`;
375
+ const r = this.getMatchingNode(e);
376
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((s) => {
377
+ t.push(this.renderNode(s));
378
+ }) : e.text ? t.push(Pe(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((s) => {
379
+ const o = this.getMatchingMark(s);
380
+ o && o.tag !== "" && t.push(this.renderClosingTag(o.tag));
381
+ }), t.join("");
382
+ }
383
+ renderTag(e, t) {
384
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
385
+ if (r.constructor === String)
386
+ return `<${r}${t}>`;
386
387
  {
387
- let n = `<${t.tag}`;
388
- if (t.attrs) {
389
- for (const s in t.attrs)
390
- if (Object.prototype.hasOwnProperty.call(t.attrs, s)) {
391
- const o = t.attrs[s];
392
- o !== null && (n += ` ${s}="${o}"`);
388
+ let s = `<${r.tag}`;
389
+ if (r.attrs) {
390
+ for (const o in r.attrs)
391
+ if (Object.prototype.hasOwnProperty.call(r.attrs, o)) {
392
+ const a = r.attrs[o];
393
+ a !== null && (s += ` ${o}="${a}"`);
393
394
  }
394
395
  }
395
- return `${n}${e}>`;
396
+ return `${s}${t}>`;
396
397
  }
397
398
  }).join("");
398
399
  }
399
- renderOpeningTag(r) {
400
- return this.renderTag(r, "");
400
+ renderOpeningTag(e) {
401
+ return this.renderTag(e, "");
401
402
  }
402
- renderClosingTag(r) {
403
- return r.constructor === String ? `</${r}>` : r.slice(0).reverse().map((e) => e.constructor === String ? `</${e}>` : `</${e.tag}>`).join("");
403
+ renderClosingTag(e) {
404
+ return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
404
405
  }
405
- getMatchingNode(r) {
406
- const e = this.nodes[r.type];
407
- if (typeof e == "function")
408
- return e(r);
406
+ getMatchingNode(e) {
407
+ const t = this.nodes[e.type];
408
+ if (typeof t == "function")
409
+ return t(e);
409
410
  }
410
- getMatchingMark(r) {
411
- const e = this.marks[r.type];
412
- if (typeof e == "function")
413
- return e(r);
411
+ getMatchingMark(e) {
412
+ const t = this.marks[e.type];
413
+ if (typeof t == "function")
414
+ return t(e);
414
415
  }
415
- renderEmoji(r) {
416
- if (r.attrs.emoji)
417
- return r.attrs.emoji;
418
- const e = [
416
+ renderEmoji(e) {
417
+ if (e.attrs.emoji)
418
+ return e.attrs.emoji;
419
+ const t = [
419
420
  {
420
421
  tag: "img",
421
422
  attrs: {
422
- src: r.attrs.fallbackImage,
423
+ src: e.attrs.fallbackImage,
423
424
  draggable: "false",
424
425
  loading: "lazy",
425
426
  align: "absmiddle"
426
427
  }
427
428
  }
428
429
  ];
429
- return this.renderTag(e, " /");
430
+ return this.renderTag(t, " /");
430
431
  }
431
- };
432
+ }
432
433
  class Ne {
433
434
  constructor(e) {
434
435
  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 = {};
@@ -452,40 +453,40 @@ class Ne {
452
453
  return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
453
454
  }
454
455
  async _responseHandler(e) {
455
- const t = [], n = {
456
+ const t = [], r = {
456
457
  data: {},
457
458
  headers: {},
458
459
  status: 0,
459
460
  statusText: ""
460
461
  };
461
462
  e.status !== 204 && await e.json().then((s) => {
462
- n.data = s;
463
+ r.data = s;
463
464
  });
464
465
  for (const s of e.headers.entries())
465
466
  t[s[0]] = s[1];
466
- return n.headers = { ...t }, n.status = e.status, n.statusText = e.statusText, n;
467
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
467
468
  }
468
469
  async _methodHandler(e) {
469
- let t = `${this.baseURL}${this.url}`, n = null;
470
+ let t = `${this.baseURL}${this.url}`, r = null;
470
471
  if (e === "get") {
471
- const i = new L();
472
+ const i = new C();
472
473
  t = `${this.baseURL}${this.url}?${i.stringify(
473
474
  this.parameters
474
475
  )}`;
475
476
  } else
476
- n = JSON.stringify(this.parameters);
477
- const s = new URL(t), o = new AbortController(), { signal: l } = o;
478
- let a;
479
- this.timeout && (a = setTimeout(() => o.abort(), this.timeout));
477
+ r = JSON.stringify(this.parameters);
478
+ const s = new URL(t), o = new AbortController(), { signal: a } = o;
479
+ let l;
480
+ this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
480
481
  try {
481
482
  const i = await this.fetch(`${s}`, {
482
483
  method: e,
483
484
  headers: this.headers,
484
- body: n,
485
- signal: l,
485
+ body: r,
486
+ signal: a,
486
487
  ...this.fetchOptions
487
488
  });
488
- this.timeout && clearTimeout(a);
489
+ this.timeout && clearTimeout(l);
489
490
  const h = await this._responseHandler(
490
491
  i
491
492
  );
@@ -504,9 +505,9 @@ class Ne {
504
505
  }
505
506
  _statusHandler(e) {
506
507
  const t = /20[0-6]/g;
507
- return new Promise((n, s) => {
508
+ return new Promise((r, s) => {
508
509
  if (t.test(`${e.status}`))
509
- return n(e);
510
+ return r(e);
510
511
  const o = {
511
512
  message: e.statusText,
512
513
  status: e.status,
@@ -516,12 +517,12 @@ class Ne {
516
517
  });
517
518
  }
518
519
  }
519
- const q = "SB-Agent", N = {
520
+ const F = "SB-Agent", H = {
520
521
  defaultAgentName: "SB-JS-CLIENT",
521
522
  defaultAgentVersion: "SB-Agent-Version",
522
523
  packageVersion: "6.0.0"
523
524
  };
524
- let A = {};
525
+ let O = {};
525
526
  const j = {};
526
527
  class He {
527
528
  /**
@@ -531,25 +532,25 @@ class He {
531
532
  */
532
533
  constructor(e, t) {
533
534
  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");
534
- let n = e.endpoint || t;
535
- if (!n) {
536
- const l = new L().getRegionURL, a = e.https === !1 ? "http" : "https";
537
- e.oauthToken ? n = `${a}://${l(e.region)}/v1` : n = `${a}://${l(e.region)}/v2`;
535
+ let r = e.endpoint || t;
536
+ if (!r) {
537
+ const a = new C().getRegionURL, l = e.https === !1 ? "http" : "https";
538
+ e.oauthToken ? r = `${l}://${a(e.region)}/v1` : r = `${l}://${a(e.region)}/v2`;
538
539
  }
539
540
  const s = new Headers();
540
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([l, a]) => {
541
- s.set(l, a);
542
- }), s.has(q) || (s.set(q, N.defaultAgentName), s.set(
543
- N.defaultAgentVersion,
544
- N.packageVersion
541
+ s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([a, l]) => {
542
+ s.set(a, l);
543
+ }), s.has(F) || (s.set(F, H.defaultAgentName), s.set(
544
+ H.defaultAgentVersion,
545
+ H.packageVersion
545
546
  ));
546
547
  let o = 5;
547
- e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), e.richTextSchema ? this.richTextResolver = new C(e.richTextSchema) : this.richTextResolver = new C(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = ie(
548
+ e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = 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 = ie(
548
549
  this.throttledRequest.bind(this),
549
550
  o,
550
551
  1e3
551
- ), 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 Ne({
552
- baseURL: n,
552
+ ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new C(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Ne({
553
+ baseURL: r,
553
554
  timeout: e.timeout || 0,
554
555
  headers: s,
555
556
  responseInterceptor: e.responseInterceptor,
@@ -558,11 +559,11 @@ class He {
558
559
  }
559
560
  setComponentResolver(e) {
560
561
  this.richTextResolver.addNode("blok", (t) => {
561
- let n = "";
562
+ let r = "";
562
563
  return t.attrs.body && t.attrs.body.forEach((s) => {
563
- n += e(s.component, s);
564
+ r += e(s.component, s);
564
565
  }), {
565
- html: n
566
+ html: r
566
567
  };
567
568
  });
568
569
  }
@@ -572,55 +573,55 @@ class He {
572
573
  factoryParamOptions(e, t) {
573
574
  return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
574
575
  }
575
- makeRequest(e, t, n, s, o) {
576
- const l = this.factoryParamOptions(
576
+ makeRequest(e, t, r, s, o) {
577
+ const a = this.factoryParamOptions(
577
578
  e,
578
- this.helpers.getOptionsPage(t, n, s)
579
+ this.helpers.getOptionsPage(t, r, s)
579
580
  );
580
- return this.cacheResponse(e, l, void 0, o);
581
+ return this.cacheResponse(e, a, void 0, o);
581
582
  }
582
- get(e, t, n) {
583
+ get(e, t, r) {
583
584
  t || (t = {});
584
585
  const s = `/${e}`, o = this.factoryParamOptions(s, t);
585
- return this.cacheResponse(s, o, void 0, n);
586
+ return this.cacheResponse(s, o, void 0, r);
586
587
  }
587
- async getAll(e, t, n, s) {
588
- const o = (t == null ? void 0 : t.per_page) || 25, l = `/${e}`.replace(/\/$/, ""), a = n ?? l.substring(l.lastIndexOf("/") + 1), i = 1, h = await this.makeRequest(
589
- l,
588
+ async getAll(e, t, r, s) {
589
+ const o = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), l = r ?? a.substring(a.lastIndexOf("/") + 1), i = 1, h = await this.makeRequest(
590
+ a,
590
591
  t,
591
592
  o,
592
593
  i,
593
594
  s
594
- ), u = h.total ? Math.ceil(h.total / o) : 1, p = await this.helpers.asyncMap(
595
- this.helpers.range(i, u),
596
- (b) => this.makeRequest(l, t, o, b + 1, s)
595
+ ), d = h.total ? Math.ceil(h.total / o) : 1, p = await this.helpers.asyncMap(
596
+ this.helpers.range(i, d),
597
+ (b) => this.makeRequest(a, t, o, b + 1, s)
597
598
  );
598
- return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[a]));
599
+ return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[l]));
599
600
  }
600
- post(e, t, n) {
601
+ post(e, t, r) {
601
602
  const s = `/${e}`;
602
603
  return Promise.resolve(
603
- this.throttle("post", s, t, n)
604
+ this.throttle("post", s, t, r)
604
605
  );
605
606
  }
606
- put(e, t, n) {
607
+ put(e, t, r) {
607
608
  const s = `/${e}`;
608
609
  return Promise.resolve(
609
- this.throttle("put", s, t, n)
610
+ this.throttle("put", s, t, r)
610
611
  );
611
612
  }
612
- delete(e, t, n) {
613
+ delete(e, t, r) {
613
614
  t || (t = {});
614
615
  const s = `/${e}`;
615
616
  return Promise.resolve(
616
- this.throttle("delete", s, t, n)
617
+ this.throttle("delete", s, t, r)
617
618
  );
618
619
  }
619
620
  getStories(e, t) {
620
621
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
621
622
  }
622
- getStory(e, t, n) {
623
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, n);
623
+ getStory(e, t, r) {
624
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
624
625
  }
625
626
  getToken() {
626
627
  return this.accessToken;
@@ -634,9 +635,9 @@ class He {
634
635
  _cleanCopy(e) {
635
636
  return JSON.parse(JSON.stringify(e));
636
637
  }
637
- _insertLinks(e, t, n) {
638
+ _insertLinks(e, t, r) {
638
639
  const s = e[t];
639
- s && s.fieldtype === "multilink" && s.linktype === "story" && typeof s.id == "string" && this.links[n][s.id] ? s.story = this._cleanCopy(this.links[n][s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[n][s.uuid] && (s.story = this._cleanCopy(this.links[n][s.uuid]));
640
+ s && s.fieldtype === "multilink" && s.linktype === "story" && typeof s.id == "string" && this.links[r][s.id] ? s.story = this._cleanCopy(this.links[r][s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[r][s.uuid] && (s.story = this._cleanCopy(this.links[r][s.uuid]));
640
641
  }
641
642
  /**
642
643
  *
@@ -657,10 +658,10 @@ class He {
657
658
  * - For single strings: directly replaces the UUID with the story reference
658
659
  * - For arrays: maps through each UUID and replaces with corresponding story references
659
660
  */
660
- _resolveField(e, t, n) {
661
+ _resolveField(e, t, r) {
661
662
  const s = e[t];
662
- typeof s == "string" ? e[t] = this.getStoryReference(n, s) : Array.isArray(s) && (e[t] = s.map(
663
- (o) => this.getStoryReference(n, o)
663
+ typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map(
664
+ (o) => this.getStoryReference(r, o)
664
665
  ).filter(Boolean));
665
666
  }
666
667
  /**
@@ -680,13 +681,13 @@ class He {
680
681
  * The method supports both string and array formats for the fields parameter,
681
682
  * allowing flexible specification of relation patterns.
682
683
  */
683
- _insertRelations(e, t, n, s) {
684
- if (Array.isArray(n) ? n.find((l) => l.endsWith(`.${t}`)) : n.endsWith(`.${t}`)) {
684
+ _insertRelations(e, t, r, s) {
685
+ if (Array.isArray(r) ? r.find((a) => a.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
685
686
  this._resolveField(e, t, s);
686
687
  return;
687
688
  }
688
689
  const o = e.component ? `${e.component}.${t}` : t;
689
- (Array.isArray(n) ? n.includes(o) : n === o) && this._resolveField(e, t, s);
690
+ (Array.isArray(r) ? r.includes(o) : r === o) && this._resolveField(e, t, s);
690
691
  }
691
692
  /**
692
693
  * Recursively traverses and resolves relations in the story content tree
@@ -694,35 +695,35 @@ class He {
694
695
  * @param fields - The relation patterns to resolve
695
696
  * @param resolveId - The unique identifier for the current resolution context
696
697
  */
697
- iterateTree(e, t, n) {
698
- const s = (o, l = "") => {
698
+ iterateTree(e, t, r) {
699
+ const s = (o, a = "") => {
699
700
  if (!(!o || o._stopResolving)) {
700
701
  if (Array.isArray(o))
701
- o.forEach((a, i) => s(a, `${l}[${i}]`));
702
+ o.forEach((l, i) => s(l, `${a}[${i}]`));
702
703
  else if (typeof o == "object")
703
- for (const a in o) {
704
- const i = l ? `${l}.${a}` : a;
705
- (o.component && o._uid || o.type === "link") && (this._insertRelations(o, a, t, n), this._insertLinks(o, a, n)), s(o[a], i);
704
+ for (const l in o) {
705
+ const i = a ? `${a}.${l}` : l;
706
+ (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, r), this._insertLinks(o, l, r)), s(o[l], i);
706
707
  }
707
708
  }
708
709
  };
709
710
  s(e.content);
710
711
  }
711
- async resolveLinks(e, t, n) {
712
+ async resolveLinks(e, t, r) {
712
713
  let s = [];
713
714
  if (e.link_uuids) {
714
- const o = e.link_uuids.length, l = [], a = 50;
715
- for (let i = 0; i < o; i += a) {
716
- const h = Math.min(o, i + a);
717
- l.push(e.link_uuids.slice(i, h));
715
+ const o = e.link_uuids.length, a = [], l = 50;
716
+ for (let i = 0; i < o; i += l) {
717
+ const h = Math.min(o, i + l);
718
+ a.push(e.link_uuids.slice(i, h));
718
719
  }
719
- for (let i = 0; i < l.length; i++)
720
+ for (let i = 0; i < a.length; i++)
720
721
  (await this.getStories({
721
- per_page: a,
722
+ per_page: l,
722
723
  language: t.language,
723
724
  version: t.version,
724
725
  starts_with: t.starts_with,
725
- by_uuids: l[i].join(",")
726
+ by_uuids: a[i].join(",")
726
727
  })).data.stories.forEach(
727
728
  (h) => {
728
729
  s.push(h);
@@ -731,35 +732,36 @@ class He {
731
732
  } else
732
733
  s = e.links;
733
734
  s.forEach((o) => {
734
- this.links[n][o.uuid] = {
735
+ this.links[r][o.uuid] = {
735
736
  ...o,
736
737
  _stopResolving: !0
737
738
  };
738
739
  });
739
740
  }
740
- async resolveRelations(e, t, n) {
741
+ async resolveRelations(e, t, r) {
741
742
  let s = [];
742
743
  if (e.rel_uuids) {
743
- const o = e.rel_uuids.length, l = [], a = 50;
744
- for (let i = 0; i < o; i += a) {
745
- const h = Math.min(o, i + a);
746
- l.push(e.rel_uuids.slice(i, h));
744
+ const o = e.rel_uuids.length, a = [], l = 50;
745
+ for (let i = 0; i < o; i += l) {
746
+ const h = Math.min(o, i + l);
747
+ a.push(e.rel_uuids.slice(i, h));
747
748
  }
748
- for (let i = 0; i < l.length; i++)
749
+ for (let i = 0; i < a.length; i++)
749
750
  (await this.getStories({
750
- per_page: a,
751
+ per_page: l,
751
752
  language: t.language,
752
753
  version: t.version,
753
754
  starts_with: t.starts_with,
754
- by_uuids: l[i].join(","),
755
+ by_uuids: a[i].join(","),
755
756
  excluding_fields: t.excluding_fields
756
757
  })).data.stories.forEach((h) => {
757
758
  s.push(h);
758
759
  });
760
+ s.length > 0 && (e.rels = s, delete e.rel_uuids);
759
761
  } else
760
762
  s = e.rels;
761
763
  s && s.length > 0 && s.forEach((o) => {
762
- this.relations[n][o.uuid] = {
764
+ this.relations[r][o.uuid] = {
763
765
  ...o,
764
766
  _stopResolving: !0
765
767
  };
@@ -774,60 +776,60 @@ class He {
774
776
  * @returns Promise<void>
775
777
  *
776
778
  */
777
- async resolveStories(e, t, n) {
779
+ async resolveStories(e, t, r) {
778
780
  var s, o;
779
- let l = [];
780
- if (this.links[n] = {}, this.relations[n] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (l = t.resolve_relations.split(",")), await this.resolveRelations(e, t, n)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, n), this.resolveNestedRelations)
781
- for (const a in this.relations[n])
781
+ let a = [];
782
+ 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) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations)
783
+ for (const l in this.relations[r])
782
784
  this.iterateTree(
783
- this.relations[n][a],
784
- l,
785
- n
785
+ this.relations[r][l],
786
+ a,
787
+ r
786
788
  );
787
- e.story ? this.iterateTree(e.story, l, n) : e.stories.forEach((a) => {
788
- this.iterateTree(a, l, n);
789
- }), this.stringifiedStoriesCache = {}, delete this.links[n], delete this.relations[n];
789
+ e.story ? this.iterateTree(e.story, a, r) : e.stories.forEach((l) => {
790
+ this.iterateTree(l, a, r);
791
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
790
792
  }
791
- async cacheResponse(e, t, n, s) {
792
- const o = this.helpers.stringify({ url: e, params: t }), l = this.cacheProvider();
793
+ async cacheResponse(e, t, r, s) {
794
+ const o = this.helpers.stringify({ url: e, params: t }), a = this.cacheProvider();
793
795
  if (t.version === "published" && e !== "/cdn/spaces/me") {
794
- const a = await l.get(o);
795
- if (a)
796
- return Promise.resolve(a);
796
+ const l = await a.get(o);
797
+ if (l)
798
+ return Promise.resolve(l);
797
799
  }
798
- return new Promise(async (a, i) => {
800
+ return new Promise(async (l, i) => {
799
801
  var h;
800
802
  try {
801
- const u = await this.throttle(
803
+ const d = await this.throttle(
802
804
  "get",
803
805
  e,
804
806
  t,
805
807
  s
806
808
  );
807
- if (u.status !== 200)
808
- return i(u);
809
- let p = { data: u.data, headers: u.headers };
810
- if ((h = u.headers) != null && h["per-page"] && (p = Object.assign({}, p, {
811
- perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
812
- total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
809
+ if (d.status !== 200)
810
+ return i(d);
811
+ let p = { data: d.data, headers: d.headers };
812
+ if ((h = d.headers) != null && h["per-page"] && (p = Object.assign({}, p, {
813
+ perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
814
+ total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
813
815
  })), p.data.story || p.data.stories) {
814
- const T = this.resolveCounter = ++this.resolveCounter % 1e3;
815
- await this.resolveStories(p.data, t, `${T}`);
816
+ const E = this.resolveCounter = ++this.resolveCounter % 1e3;
817
+ await this.resolveStories(p.data, t, `${E}`);
816
818
  }
817
- t.version === "published" && e !== "/cdn/spaces/me" && await l.set(o, p);
819
+ t.version === "published" && e !== "/cdn/spaces/me" && await a.set(o, p);
818
820
  const b = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
819
- return t.token && p.data.cv && (b && j[t.token] && j[t.token] !== p.data.cv && await this.flushCache(), j[t.token] = p.data.cv), a(p);
820
- } catch (u) {
821
- if (u.response && u.status === 429 && (n = typeof n > "u" ? 0 : n + 1, n < this.maxRetries))
821
+ return t.token && p.data.cv && (b && j[t.token] && j[t.token] !== p.data.cv && await this.flushCache(), j[t.token] = p.data.cv), l(p);
822
+ } catch (d) {
823
+ if (d.response && d.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
822
824
  return console.log(
823
825
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
824
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, n).then(a).catch(i);
825
- i(u);
826
+ ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(i);
827
+ i(d);
826
828
  }
827
829
  });
828
830
  }
829
- throttledRequest(e, t, n, s) {
830
- return this.client.setFetchOptions(s), this.client[e](t, n);
831
+ throttledRequest(e, t, r, s) {
832
+ return this.client.setFetchOptions(s), this.client[e](t, r);
831
833
  }
832
834
  cacheVersions() {
833
835
  return j;
@@ -846,16 +848,16 @@ class He {
846
848
  case "memory":
847
849
  return {
848
850
  get(e) {
849
- return Promise.resolve(A[e]);
851
+ return Promise.resolve(O[e]);
850
852
  },
851
853
  getAll() {
852
- return Promise.resolve(A);
854
+ return Promise.resolve(O);
853
855
  },
854
856
  set(e, t) {
855
- return A[e] = t, Promise.resolve(void 0);
857
+ return O[e] = t, Promise.resolve(void 0);
856
858
  },
857
859
  flush() {
858
- return A = {}, Promise.resolve(void 0);
860
+ return O = {}, Promise.resolve(void 0);
859
861
  }
860
862
  };
861
863
  case "custom":
@@ -882,8 +884,8 @@ class He {
882
884
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
883
885
  }
884
886
  }
885
- const Fe = (r = {}) => {
886
- const { apiOptions: e } = r;
887
+ const Fe = (n = {}) => {
888
+ const { apiOptions: e } = n;
887
889
  if (!e || !e.accessToken) {
888
890
  console.error(
889
891
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
@@ -891,12 +893,12 @@ const Fe = (r = {}) => {
891
893
  return;
892
894
  }
893
895
  return { storyblokApi: new He(e) };
894
- }, Ge = (r) => {
895
- if (typeof r != "object" || typeof r._editable > "u")
896
+ }, Ge = (n) => {
897
+ if (typeof n != "object" || typeof n._editable > "u")
896
898
  return {};
897
899
  try {
898
900
  const e = JSON.parse(
899
- r._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
901
+ n._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
900
902
  );
901
903
  return e ? {
902
904
  "data-blok-c": JSON.stringify(e),
@@ -906,38 +908,38 @@ const Fe = (r = {}) => {
906
908
  return {};
907
909
  }
908
910
  };
909
- function Me(r, e) {
911
+ function Me(n, e) {
910
912
  if (!e)
911
- return { src: r, attrs: {} };
912
- let t = 0, n = 0;
913
+ return { src: n, attrs: {} };
914
+ let t = 0, r = 0;
913
915
  const s = {}, o = [];
914
- function l(i, h, u, p, b) {
915
- typeof i != "number" || i <= h || i >= u ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${h} and ${u} (inclusive)`) : b.push(`${p}(${i})`);
916
+ function a(i, h, d, p, b) {
917
+ 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})`);
916
918
  }
917
919
  if (typeof e == "object") {
918
- if (typeof e.width == "number" && e.width > 0 ? (s.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 ? (s.height = e.height, n = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (s.loading = e.loading), e.class && (s.class = e.class), e.filters) {
919
- const { filters: i } = e || {}, { blur: h, brightness: u, fill: p, format: b, grayscale: T, quality: w, rotate: S } = i || {};
920
- h && l(h, 0, 100, "blur", o), w && l(w, 0, 100, "quality", o), u && l(u, 0, 100, "brightness", o), p && o.push(`fill(${p})`), T && o.push("grayscale()"), S && [0, 90, 180, 270].includes(e.filters.rotate || 0) && o.push(`rotate(${S})`), b && ["webp", "png", "jpeg"].includes(b) && o.push(`format(${b})`);
920
+ if (typeof e.width == "number" && e.width > 0 ? (s.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 ? (s.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) && (s.loading = e.loading), e.class && (s.class = e.class), e.filters) {
921
+ const { filters: i } = e || {}, { blur: h, brightness: d, fill: p, format: b, grayscale: E, quality: y, rotate: S } = i || {};
922
+ h && a(h, 0, 100, "blur", o), y && a(y, 0, 100, "quality", o), d && a(d, 0, 100, "brightness", o), p && o.push(`fill(${p})`), E && o.push("grayscale()"), S && [0, 90, 180, 270].includes(e.filters.rotate || 0) && o.push(`rotate(${S})`), b && ["webp", "png", "jpeg"].includes(b) && o.push(`format(${b})`);
921
923
  }
922
924
  e.srcset && (s.srcset = e.srcset.map((i) => {
923
925
  if (typeof i == "number")
924
- return `${r}/m/${i}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${i}w`;
926
+ return `${n}/m/${i}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${i}w`;
925
927
  if (Array.isArray(i) && i.length === 2) {
926
- const [h, u] = i;
927
- return `${r}/m/${h}x${u}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${h}w`;
928
+ const [h, d] = i;
929
+ return `${n}/m/${h}x${d}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${h}w`;
928
930
  } else {
929
931
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
930
932
  return;
931
933
  }
932
934
  }).join(", ")), e.sizes && (s.sizes = e.sizes.join(", "));
933
935
  }
934
- let a = `${r}/m/`;
935
- return t > 0 && n > 0 && (a = `${a}${t}x${n}/`), o.length > 0 && (a = `${a}filters:${o.join(":")}`), {
936
- src: a,
936
+ let l = `${n}/m/`;
937
+ return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), o.length > 0 && (l = `${l}filters:${o.join(":")}`), {
938
+ src: l,
937
939
  attrs: s
938
940
  };
939
941
  }
940
- 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 || {}), E = /* @__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))(E || {}), V = /* @__PURE__ */ ((r) => (r.TEXT = "text", r))(V || {}), x = /* @__PURE__ */ ((r) => (r.URL = "url", r.STORY = "story", r.ASSET = "asset", r.EMAIL = "email", r))(x || {});
942
+ var T = /* @__PURE__ */ ((n) => (n.DOCUMENT = "doc", n.HEADING = "heading", n.PARAGRAPH = "paragraph", n.QUOTE = "blockquote", n.OL_LIST = "ordered_list", n.UL_LIST = "bullet_list", n.LIST_ITEM = "list_item", n.CODE_BLOCK = "code_block", n.HR = "horizontal_rule", n.BR = "hard_break", n.IMAGE = "image", n.EMOJI = "emoji", n.COMPONENT = "blok", n.TABLE = "table", n.TABLE_ROW = "tableRow", n.TABLE_CELL = "tableCell", n.TABLE_HEADER = "tableHeader", n))(T || {}), _ = /* @__PURE__ */ ((n) => (n.BOLD = "bold", n.STRONG = "strong", n.STRIKE = "strike", n.UNDERLINE = "underline", n.ITALIC = "italic", n.CODE = "code", n.LINK = "link", n.ANCHOR = "anchor", n.STYLED = "styled", n.SUPERSCRIPT = "superscript", n.SUBSCRIPT = "subscript", n.TEXT_STYLE = "textStyle", n.HIGHLIGHT = "highlight", n))(_ || {}), J = /* @__PURE__ */ ((n) => (n.TEXT = "text", n))(J || {}), x = /* @__PURE__ */ ((n) => (n.URL = "url", n.STORY = "story", n.ASSET = "asset", n.EMAIL = "email", n))(x || {});
941
943
  const Ue = [
942
944
  "area",
943
945
  "base",
@@ -953,259 +955,259 @@ const Ue = [
953
955
  "source",
954
956
  "track",
955
957
  "wbr"
956
- ], Be = (r = {}) => Object.keys(r).map((e) => `${e}="${r[e]}"`).join(" "), ze = (r = {}) => Object.keys(r).map((e) => `${e}: ${r[e]}`).join("; ");
957
- function De(r) {
958
- return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
958
+ ], Be = (n = {}) => Object.keys(n).map((e) => `${e}="${n[e]}"`).join(" "), ze = (n = {}) => Object.keys(n).map((e) => `${e}: ${n[e]}`).join("; ");
959
+ function De(n) {
960
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
959
961
  }
960
- const O = (r) => Object.fromEntries(Object.entries(r).filter(([e, t]) => t !== void 0));
961
- function F(r, e = {}, t) {
962
- const n = Be(e), s = n ? `${r} ${n}` : r, o = Array.isArray(t) ? t.join("") : t || "";
963
- if (r) {
964
- if (Ue.includes(r))
962
+ const L = (n) => Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0));
963
+ function G(n, e = {}, t) {
964
+ const r = Be(e), s = r ? `${n} ${r}` : n, o = Array.isArray(t) ? t.join("") : t || "";
965
+ if (n) {
966
+ if (Ue.includes(n))
965
967
  return `<${s}>`;
966
968
  } else return o;
967
- return `<${s}>${o}</${r}>`;
969
+ return `<${s}>${o}</${n}>`;
968
970
  }
969
- function Ve(r = {}) {
971
+ function Ve(n = {}) {
970
972
  const e = /* @__PURE__ */ new Map(), {
971
- renderFn: t = F,
972
- textFn: n = De,
973
+ renderFn: t = G,
974
+ textFn: r = De,
973
975
  resolvers: s = {},
974
976
  optimizeImages: o = !1,
975
- keyedResolvers: l = !1
976
- } = r, a = t !== F, i = () => ({ render: (c, d = {}, g) => {
977
- if (l && c) {
977
+ keyedResolvers: a = !1
978
+ } = n, l = t !== G, i = () => ({ render: (c, u = {}, g) => {
979
+ if (a && c) {
978
980
  const f = e.get(c) || 0;
979
- e.set(c, f + 1), d.key = `${c}-${f}`;
981
+ e.set(c, f + 1), u.key = `${c}-${f}`;
980
982
  }
981
- return t(c, d, g);
982
- } }), h = (c) => (d, g) => {
983
- const f = d.attrs || {};
984
- return g.render(c, f, d.children || null);
985
- }, u = (c, d) => {
986
- const { src: g, alt: f, title: y, srcset: R, sizes: v } = c.attrs || {};
987
- let $ = g, _ = {};
983
+ return t(c, u, g);
984
+ } }), h = (c) => (u, g) => {
985
+ const f = u.attrs || {};
986
+ return g.render(c, f, u.children || null);
987
+ }, d = (c, u) => {
988
+ const { src: g, alt: f, title: v, srcset: $, sizes: k } = c.attrs || {};
989
+ let w = g, R = {};
988
990
  if (o) {
989
991
  const { src: re, attrs: se } = Me(g, o);
990
- $ = re, _ = se;
992
+ w = re, R = se;
991
993
  }
992
994
  const te = {
993
- src: $,
995
+ src: w,
994
996
  alt: f,
995
- title: y,
996
- srcset: R,
997
- sizes: v,
998
- ..._
997
+ title: v,
998
+ srcset: $,
999
+ sizes: k,
1000
+ ...R
999
1001
  };
1000
- return d.render("img", O(te));
1001
- }, p = (c, d) => {
1002
+ return u.render("img", L(te));
1003
+ }, p = (c, u) => {
1002
1004
  const { level: g, ...f } = c.attrs || {};
1003
- return d.render(`h${g}`, f, c.children);
1004
- }, b = (c, d) => {
1005
- var g, f, y, R;
1006
- const v = d.render("img", {
1005
+ return u.render(`h${g}`, f, c.children);
1006
+ }, b = (c, u) => {
1007
+ var g, f, v, $;
1008
+ const k = u.render("img", {
1007
1009
  src: (g = c.attrs) == null ? void 0 : g.fallbackImage,
1008
1010
  alt: (f = c.attrs) == null ? void 0 : f.alt,
1009
1011
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
1010
1012
  draggable: "false",
1011
1013
  loading: "lazy"
1012
1014
  });
1013
- return d.render("span", {
1015
+ return u.render("span", {
1014
1016
  "data-type": "emoji",
1015
- "data-name": (y = c.attrs) == null ? void 0 : y.name,
1016
- "data-emoji": (R = c.attrs) == null ? void 0 : R.emoji
1017
- }, v);
1018
- }, T = (c, d) => d.render(
1017
+ "data-name": (v = c.attrs) == null ? void 0 : v.name,
1018
+ "data-emoji": ($ = c.attrs) == null ? void 0 : $.emoji
1019
+ }, k);
1020
+ }, E = (c, u) => u.render(
1019
1021
  "pre",
1020
1022
  c.attrs || {},
1021
- d.render("code", {}, c.children || "")
1022
- ), w = (c, d = !1) => ({ text: g, attrs: f }, y) => {
1023
- const { class: R, id: v, ...$ } = f || {}, _ = d ? {
1024
- class: R,
1025
- id: v,
1026
- style: ze($) || void 0
1023
+ u.render("code", {}, c.children || "")
1024
+ ), y = (c, u = !1) => ({ text: g, attrs: f }, v) => {
1025
+ const { class: $, id: k, ...w } = f || {}, R = u ? {
1026
+ class: $,
1027
+ id: k,
1028
+ style: ze(w) || void 0
1027
1029
  } : f || {};
1028
- return y.render(c, O(_), g);
1029
- }, S = (c) => P(c), K = (c) => {
1030
- const { marks: d, ...g } = c;
1030
+ return v.render(c, L(R), g);
1031
+ }, S = (c) => N(c), I = (c) => {
1032
+ const { marks: u, ...g } = c;
1031
1033
  if ("text" in c) {
1032
- if (d)
1033
- return d.reduce(
1034
- (y, R) => S({ ...R, text: y }),
1034
+ if (u)
1035
+ return u.reduce(
1036
+ (v, $) => S({ ...$, text: v }),
1035
1037
  S({ ...g, children: g.children })
1036
1038
  );
1037
1039
  const f = c.attrs || {};
1038
- if (l) {
1039
- const y = e.get("txt") || 0;
1040
- e.set("txt", y + 1), f.key = `txt-${y}`;
1040
+ if (a) {
1041
+ const v = e.get("txt") || 0;
1042
+ e.set("txt", v + 1), f.key = `txt-${v}`;
1041
1043
  }
1042
- return n(g.text, f);
1044
+ return r(g.text, f);
1043
1045
  }
1044
1046
  return "";
1045
- }, U = (c, d) => {
1046
- const { linktype: g, href: f, anchor: y, ...R } = c.attrs || {};
1047
- let v = "";
1047
+ }, B = (c, u) => {
1048
+ const { linktype: g, href: f, anchor: v, ...$ } = c.attrs || {};
1049
+ let k = "";
1048
1050
  switch (g) {
1049
1051
  case x.ASSET:
1050
1052
  case x.URL:
1051
- v = f;
1053
+ k = f;
1052
1054
  break;
1053
1055
  case x.EMAIL:
1054
- v = `mailto:${f}`;
1056
+ k = `mailto:${f}`;
1055
1057
  break;
1056
1058
  case x.STORY:
1057
- v = f, y && (v = `${v}#${y}`);
1059
+ k = f, v && (k = `${k}#${v}`);
1058
1060
  break;
1059
1061
  default:
1060
- v = f;
1062
+ k = f;
1061
1063
  break;
1062
1064
  }
1063
- const $ = { ...R };
1064
- return v && ($.href = v), d.render("a", $, c.text);
1065
- }, Y = (c, d) => {
1065
+ const w = { ...$ };
1066
+ return k && (w.href = k), u.render("a", w, c.text);
1067
+ }, Y = (c, u) => {
1066
1068
  var g, f;
1067
- return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), d.render("span", {
1069
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
1068
1070
  blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
1069
1071
  id: (f = c.attrs) == null ? void 0 : f.id,
1070
1072
  style: "display: none"
1071
1073
  });
1072
- }, W = (c, d) => {
1073
- const g = {}, f = d.render("tbody", {}, c.children);
1074
- return d.render("table", g, f);
1075
- }, X = (c, d) => {
1074
+ }, W = (c, u) => {
1075
+ const g = {}, f = u.render("tbody", {}, c.children);
1076
+ return u.render("table", g, f);
1077
+ }, X = (c, u) => {
1076
1078
  const g = {};
1077
- return d.render("tr", g, c.children);
1078
- }, Q = (c, d) => {
1079
- const { colspan: g, rowspan: f, colwidth: y, backgroundColor: R, ...v } = c.attrs || {}, $ = {
1080
- ...v
1079
+ return u.render("tr", g, c.children);
1080
+ }, Q = (c, u) => {
1081
+ const { colspan: g, rowspan: f, colwidth: v, backgroundColor: $, ...k } = c.attrs || {}, w = {
1082
+ ...k
1081
1083
  };
1082
- g > 1 && ($.colspan = g), f > 1 && ($.rowspan = f);
1083
- const _ = [];
1084
- return y && _.push(`width: ${y}px;`), R && _.push(`background-color: ${R};`), _.length > 0 && ($.style = _.join(" ")), d.render("td", O($), c.children);
1085
- }, Z = (c, d) => {
1086
- const { colspan: g, rowspan: f, colwidth: y, backgroundColor: R, ...v } = c.attrs || {}, $ = {
1087
- ...v
1084
+ g > 1 && (w.colspan = g), f > 1 && (w.rowspan = f);
1085
+ const R = [];
1086
+ return v && R.push(`width: ${v}px;`), $ && R.push(`background-color: ${$};`), R.length > 0 && (w.style = R.join(" ")), u.render("td", L(w), c.children);
1087
+ }, Z = (c, u) => {
1088
+ const { colspan: g, rowspan: f, colwidth: v, backgroundColor: $, ...k } = c.attrs || {}, w = {
1089
+ ...k
1088
1090
  };
1089
- g > 1 && ($.colspan = g), f > 1 && ($.rowspan = f);
1090
- const _ = [];
1091
- return y && _.push(`width: ${y}px;`), R && _.push(`background-color: ${R};`), _.length > 0 && ($.style = _.join(" ")), d.render("th", O($), c.children);
1091
+ g > 1 && (w.colspan = g), f > 1 && (w.rowspan = f);
1092
+ const R = [];
1093
+ return v && R.push(`width: ${v}px;`), $ && R.push(`background-color: ${$};`), R.length > 0 && (w.style = R.join(" ")), u.render("th", L(w), c.children);
1092
1094
  }, ee = new Map([
1093
- [k.DOCUMENT, h("")],
1094
- [k.HEADING, p],
1095
- [k.PARAGRAPH, h("p")],
1096
- [k.UL_LIST, h("ul")],
1097
- [k.OL_LIST, h("ol")],
1098
- [k.LIST_ITEM, h("li")],
1099
- [k.IMAGE, u],
1100
- [k.EMOJI, b],
1101
- [k.CODE_BLOCK, T],
1102
- [k.HR, h("hr")],
1103
- [k.BR, h("br")],
1104
- [k.QUOTE, h("blockquote")],
1105
- [k.COMPONENT, Y],
1106
- [V.TEXT, K],
1107
- [E.LINK, U],
1108
- [E.ANCHOR, U],
1109
- [E.STYLED, w("span", !0)],
1110
- [E.BOLD, w("strong")],
1111
- [E.TEXT_STYLE, w("span", !0)],
1112
- [E.ITALIC, w("em")],
1113
- [E.UNDERLINE, w("u")],
1114
- [E.STRIKE, w("s")],
1115
- [E.CODE, w("code")],
1116
- [E.SUPERSCRIPT, w("sup")],
1117
- [E.SUBSCRIPT, w("sub")],
1118
- [E.HIGHLIGHT, w("mark")],
1119
- [k.TABLE, W],
1120
- [k.TABLE_ROW, X],
1121
- [k.TABLE_CELL, Q],
1122
- [k.TABLE_HEADER, Z],
1123
- ...Object.entries(s).map(([c, d]) => [c, d])
1095
+ [T.DOCUMENT, h("")],
1096
+ [T.HEADING, p],
1097
+ [T.PARAGRAPH, h("p")],
1098
+ [T.UL_LIST, h("ul")],
1099
+ [T.OL_LIST, h("ol")],
1100
+ [T.LIST_ITEM, h("li")],
1101
+ [T.IMAGE, d],
1102
+ [T.EMOJI, b],
1103
+ [T.CODE_BLOCK, E],
1104
+ [T.HR, h("hr")],
1105
+ [T.BR, h("br")],
1106
+ [T.QUOTE, h("blockquote")],
1107
+ [T.COMPONENT, Y],
1108
+ [J.TEXT, I],
1109
+ [_.LINK, B],
1110
+ [_.ANCHOR, B],
1111
+ [_.STYLED, y("span", !0)],
1112
+ [_.BOLD, y("strong")],
1113
+ [_.TEXT_STYLE, y("span", !0)],
1114
+ [_.ITALIC, y("em")],
1115
+ [_.UNDERLINE, y("u")],
1116
+ [_.STRIKE, y("s")],
1117
+ [_.CODE, y("code")],
1118
+ [_.SUPERSCRIPT, y("sup")],
1119
+ [_.SUBSCRIPT, y("sub")],
1120
+ [_.HIGHLIGHT, y("mark")],
1121
+ [T.TABLE, W],
1122
+ [T.TABLE_ROW, X],
1123
+ [T.TABLE_CELL, Q],
1124
+ [T.TABLE_HEADER, Z],
1125
+ ...Object.entries(s).map(([c, u]) => [c, u])
1124
1126
  ]);
1125
- function I(c) {
1126
- const d = ee.get(c.type);
1127
- if (!d)
1127
+ function A(c) {
1128
+ const u = ee.get(c.type);
1129
+ if (!u)
1128
1130
  return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
1129
1131
  const g = i();
1130
1132
  if (c.type === "text")
1131
- return d(c, g);
1132
- const f = c.content ? c.content.map(P) : void 0;
1133
- return d({
1133
+ return u(c, g);
1134
+ const f = c.content ? c.content.map(N) : void 0;
1135
+ return u({
1134
1136
  ...c,
1135
1137
  children: f
1136
1138
  }, g);
1137
1139
  }
1138
- function P(c) {
1139
- return c.type === "doc" ? a ? c.content.map(I) : c.content.map(I).join("") : Array.isArray(c) ? c.map(I) : I(c);
1140
+ function N(c) {
1141
+ return c.type === "doc" ? l ? c.content.map(A) : c.content.map(A).join("") : Array.isArray(c) ? c.map(A) : A(c);
1140
1142
  }
1141
1143
  return {
1142
- render: P
1144
+ render: N
1143
1145
  };
1144
1146
  }
1145
- let H, M = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1146
- const Je = (r, e, t = {}) => {
1147
- var n;
1148
- const s = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((n = window.location) == null ? void 0 : n.href).searchParams.get(
1147
+ let M, U = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1148
+ const Je = (n, e, t = {}) => {
1149
+ var r;
1150
+ const s = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
1149
1151
  "_storyblok"
1150
- ), l = o !== null && +o === r;
1151
- if (!(!s || !l)) {
1152
- if (!r) {
1152
+ ), a = o !== null && +o === n;
1153
+ if (!(!s || !a)) {
1154
+ if (!n) {
1153
1155
  console.warn("Story ID is not defined. Please provide a valid ID.");
1154
1156
  return;
1155
1157
  }
1156
1158
  window.storyblokRegisterEvent(() => {
1157
- new window.StoryblokBridge(t).on(["input", "published", "change"], (a) => {
1159
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (l) => {
1158
1160
  var i;
1159
- a && (a.action === "input" && ((i = a.story) == null ? void 0 : i.id) === r ? e(a.story) : (a.action === "change" || a.action === "published") && a.storyId === r && window.location.reload());
1161
+ l && (l.action === "input" && ((i = l.story) == null ? void 0 : i.id) === n ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === n && window.location.reload());
1160
1162
  });
1161
1163
  });
1162
1164
  }
1163
- }, J = (r, e) => {
1164
- r.addNode("blok", (t) => {
1165
- let n = "";
1165
+ }, K = (n, e) => {
1166
+ n.addNode("blok", (t) => {
1167
+ let r = "";
1166
1168
  return t.attrs.body.forEach((s) => {
1167
- n += e(s.component, s);
1169
+ r += e(s.component, s);
1168
1170
  }), {
1169
- html: n
1171
+ html: r
1170
1172
  };
1171
1173
  });
1172
- }, Ke = (r = {}) => {
1174
+ }, Ke = (n = {}) => {
1173
1175
  var e, t;
1174
1176
  const {
1175
- bridge: n,
1177
+ bridge: r,
1176
1178
  accessToken: s,
1177
1179
  use: o = [],
1178
- apiOptions: l = {},
1179
- richText: a = {},
1180
+ apiOptions: a = {},
1181
+ richText: l = {},
1180
1182
  bridgeUrl: i
1181
- } = r;
1182
- l.accessToken = l.accessToken || s;
1183
- const h = { bridge: n, apiOptions: l };
1184
- let u = {};
1183
+ } = n;
1184
+ a.accessToken = a.accessToken || s;
1185
+ const h = { bridge: r, apiOptions: a };
1186
+ let d = {};
1185
1187
  o.forEach((b) => {
1186
- u = { ...u, ...b(h) };
1187
- }), i && (M = i);
1188
+ d = { ...d, ...b(h) };
1189
+ }), i && (U = i);
1188
1190
  const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1189
- return n !== !1 && p && G(M), H = new C(a.schema), a.resolver && J(H, a.resolver), u;
1190
- }, qe = (r) => {
1191
+ return r !== !1 && p && V(U), M = new P(l.schema), l.resolver && K(M, l.resolver), d;
1192
+ }, qe = (n) => {
1191
1193
  var e;
1192
- return !r || !((e = r == null ? void 0 : r.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
1193
- }, Ye = (r, e, t) => {
1194
- let n = t || H;
1195
- if (!n) {
1194
+ return !n || !((e = n == null ? void 0 : n.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
1195
+ }, Ye = (n, e, t) => {
1196
+ let r = t || M;
1197
+ if (!r) {
1196
1198
  console.error(
1197
1199
  "Please initialize the Storyblok SDK before calling the renderRichText function"
1198
1200
  );
1199
1201
  return;
1200
1202
  }
1201
- return qe(r) ? "" : (e && (n = new C(e.schema), e.resolver && J(n, e.resolver)), n.render(r, {}, !1));
1202
- }, We = () => G(M);
1203
+ return qe(n) ? "" : (e && (r = new P(e.schema), e.resolver && K(r, e.resolver)), r.render(n, {}, !1));
1204
+ }, We = () => V(U);
1203
1205
  export {
1204
- k as BlockTypes,
1205
- E as MarkTypes,
1206
- C as RichTextResolver,
1206
+ T as BlockTypes,
1207
+ _ as MarkTypes,
1208
+ P as RichTextResolver,
1207
1209
  Ce as RichTextSchema,
1208
- V as TextTypes,
1210
+ J as TextTypes,
1209
1211
  Fe as apiPlugin,
1210
1212
  qe as isRichTextEmpty,
1211
1213
  We as loadStoryblokBridge,