@storyblok/vue 8.1.9 → 8.1.11

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