@storyblok/vue 8.0.9 → 8.1.1

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,76 +1,76 @@
1
- import { defineComponent as O, ref as _, resolveDynamicComponent as $, inject as N, openBlock as L, createBlock as M, mergeProps as z, onMounted as U, defineAsyncComponent as H } from "vue";
2
- let j = !1;
3
- const C = [], V = (i) => new Promise((e, t) => {
4
- if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
1
+ import { defineComponent as F, ref as P, resolveDynamicComponent as A, inject as te, openBlock as V, createBlock as G, mergeProps as re, h as K, createTextVNode as se, onMounted as oe, defineAsyncComponent as ne } from "vue";
2
+ let H = !1;
3
+ const U = [], ie = (s) => new Promise((e, t) => {
4
+ if (typeof window > "u" || (window.storyblokRegisterEvent = (o) => {
5
5
  if (window.location === window.parent.location) {
6
6
  console.warn("You are not in Draft Mode or in the Visual Editor.");
7
7
  return;
8
8
  }
9
- j ? r() : C.push(r);
9
+ H ? o() : U.push(o);
10
10
  }, document.getElementById("storyblok-javascript-bridge"))) return;
11
- const s = document.createElement("script");
12
- s.async = !0, s.src = i, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
13
- C.forEach((o) => o()), j = !0, e(r);
14
- }, document.getElementsByTagName("head")[0].appendChild(s);
11
+ const r = document.createElement("script");
12
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (o) => t(o), r.onload = (o) => {
13
+ U.forEach((n) => n()), H = !0, e(o);
14
+ }, document.getElementsByTagName("head")[0].appendChild(r);
15
15
  });
16
- var D = Object.defineProperty, q = (i, e, t) => e in i ? D(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, c = (i, e, t) => (q(i, typeof e != "symbol" ? e + "" : e, t), t);
17
- function x(i) {
18
- return !(i !== i || i === 1 / 0 || i === -1 / 0);
16
+ var ae = Object.defineProperty, le = (s, e, t) => e in s ? ae(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, d = (s, e, t) => le(s, typeof e != "symbol" ? e + "" : e, t);
17
+ function D(s) {
18
+ return !(s !== s || s === 1 / 0 || s === -1 / 0);
19
19
  }
20
- function F(i, e, t) {
21
- if (!x(e))
20
+ function ce(s, e, t) {
21
+ if (!D(e))
22
22
  throw new TypeError("Expected `limit` to be a finite number");
23
- if (!x(t))
23
+ if (!D(t))
24
24
  throw new TypeError("Expected `interval` to be a finite number");
25
- const s = [];
26
- let r = [], o = 0;
27
- const n = function() {
28
- o++;
25
+ const r = [];
26
+ let o = [], n = 0;
27
+ const i = function() {
28
+ n++;
29
29
  const a = setTimeout(function() {
30
- o--, s.length > 0 && n(), r = r.filter(function(h) {
31
- return h !== a;
30
+ n--, r.length > 0 && i(), o = o.filter(function(p) {
31
+ return p !== a;
32
32
  });
33
33
  }, t);
34
- r.indexOf(a) < 0 && r.push(a);
35
- const u = s.shift();
36
- u.resolve(i.apply(u.self, u.args));
34
+ o.indexOf(a) < 0 && o.push(a);
35
+ const u = r.shift();
36
+ u.resolve(s.apply(u.self, u.args));
37
37
  }, l = function(...a) {
38
38
  const u = this;
39
- return new Promise(function(h, p) {
40
- s.push({
41
- resolve: h,
42
- reject: p,
39
+ return new Promise(function(p, h) {
40
+ r.push({
41
+ resolve: p,
42
+ reject: h,
43
43
  args: a,
44
44
  self: u
45
- }), o < e && n();
45
+ }), n < e && i();
46
46
  });
47
47
  };
48
48
  return l.abort = function() {
49
- r.forEach(clearTimeout), r = [], s.forEach(function(a) {
49
+ o.forEach(clearTimeout), o = [], r.forEach(function(a) {
50
50
  a.reject(function() {
51
51
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
52
52
  });
53
- }), s.length = 0;
53
+ }), r.length = 0;
54
54
  }, l;
55
55
  }
56
- class k {
56
+ class j {
57
57
  constructor() {
58
- c(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), c(this, "getOptionsPage", (e, t = 25, s = 1) => ({
58
+ d(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), d(this, "getOptionsPage", (e, t = 25, r = 1) => ({
59
59
  ...e,
60
60
  per_page: t,
61
- page: s
62
- })), c(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), c(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), c(this, "range", (e = 0, t = e) => {
63
- const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
64
- return this.arrayFrom(s, (o, n) => n * r + e);
65
- }), c(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), c(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], [])), c(this, "escapeHTML", function(e) {
61
+ page: r
62
+ })), d(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), d(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), d(this, "range", (e = 0, t = e) => {
63
+ const r = Math.abs(t - e) || 0, o = e < t ? 1 : -1;
64
+ return this.arrayFrom(r, (n, i) => i * o + e);
65
+ }), d(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), d(this, "flatMap", (e = [], t) => e.map(t).reduce((r, o) => [...r, ...o], [])), d(this, "escapeHTML", function(e) {
66
66
  const t = {
67
67
  "&": "&amp;",
68
68
  "<": "&lt;",
69
69
  ">": "&gt;",
70
70
  '"': "&quot;",
71
71
  "'": "&#39;"
72
- }, s = /[&<>"']/g, r = RegExp(s.source);
73
- return e && r.test(e) ? e.replace(s, (o) => t[o]) : e;
72
+ }, r = /[&<>"']/g, o = RegExp(r.source);
73
+ return e && o.test(e) ? e.replace(r, (n) => t[n]) : e;
74
74
  });
75
75
  }
76
76
  /**
@@ -80,20 +80,20 @@ class k {
80
80
  * @param {Boolean} isArray
81
81
  * @return {String} Stringified object
82
82
  */
83
- stringify(e, t, s) {
84
- const r = [];
85
- for (const o in e) {
86
- if (!Object.prototype.hasOwnProperty.call(e, o))
83
+ stringify(e, t, r) {
84
+ const o = [];
85
+ for (const n in e) {
86
+ if (!Object.prototype.hasOwnProperty.call(e, n))
87
87
  continue;
88
- const n = e[o], l = s ? "" : encodeURIComponent(o);
88
+ const i = e[n], l = r ? "" : encodeURIComponent(n);
89
89
  let a;
90
- typeof n == "object" ? a = this.stringify(
91
- n,
90
+ typeof i == "object" ? a = this.stringify(
91
+ i,
92
92
  t ? t + encodeURIComponent("[" + l + "]") : l,
93
- Array.isArray(n)
94
- ) : a = (t ? t + encodeURIComponent("[" + l + "]") : l) + "=" + encodeURIComponent(n), r.push(a);
93
+ Array.isArray(i)
94
+ ) : a = (t ? t + encodeURIComponent("[" + l + "]") : l) + "=" + encodeURIComponent(i), o.push(a);
95
95
  }
96
- return r.join("&");
96
+ return o.join("&");
97
97
  }
98
98
  /**
99
99
  * @method getRegionURL
@@ -101,91 +101,91 @@ class k {
101
101
  * @return {String} The base URL of the region
102
102
  */
103
103
  getRegionURL(e) {
104
- const t = "api.storyblok.com", s = "api-us.storyblok.com", r = "app.storyblokchina.cn", o = "api-ap.storyblok.com", n = "api-ca.storyblok.com";
104
+ const t = "api.storyblok.com", r = "api-us.storyblok.com", o = "app.storyblokchina.cn", n = "api-ap.storyblok.com", i = "api-ca.storyblok.com";
105
105
  switch (e) {
106
106
  case "us":
107
- return s;
108
- case "cn":
109
107
  return r;
110
- case "ap":
108
+ case "cn":
111
109
  return o;
112
- case "ca":
110
+ case "ap":
113
111
  return n;
112
+ case "ca":
113
+ return i;
114
114
  default:
115
115
  return t;
116
116
  }
117
117
  }
118
118
  }
119
- const B = function(i, e) {
119
+ const he = function(s, e) {
120
120
  const t = {};
121
- for (const s in i) {
122
- const r = i[s];
123
- e.indexOf(s) > -1 && r !== null && (t[s] = r);
121
+ for (const r in s) {
122
+ const o = s[r];
123
+ e.indexOf(r) > -1 && o !== null && (t[r] = o);
124
124
  }
125
125
  return t;
126
- }, J = (i) => i === "email", K = () => ({
126
+ }, ue = (s) => s === "email", pe = () => ({
127
127
  singleTag: "hr"
128
- }), Y = () => ({
128
+ }), de = () => ({
129
129
  tag: "blockquote"
130
- }), W = () => ({
130
+ }), ge = () => ({
131
131
  tag: "ul"
132
- }), G = (i) => ({
132
+ }), fe = (s) => ({
133
133
  tag: [
134
134
  "pre",
135
135
  {
136
136
  tag: "code",
137
- attrs: i.attrs
137
+ attrs: s.attrs
138
138
  }
139
139
  ]
140
- }), Q = () => ({
140
+ }), me = () => ({
141
141
  singleTag: "br"
142
- }), X = (i) => ({
143
- tag: `h${i.attrs.level}`
144
- }), Z = (i) => ({
142
+ }), ye = (s) => ({
143
+ tag: `h${s.attrs.level}`
144
+ }), be = (s) => ({
145
145
  singleTag: [
146
146
  {
147
147
  tag: "img",
148
- attrs: B(i.attrs, ["src", "alt", "title"])
148
+ attrs: he(s.attrs, ["src", "alt", "title"])
149
149
  }
150
150
  ]
151
- }), ee = () => ({
151
+ }), ke = () => ({
152
152
  tag: "li"
153
- }), te = () => ({
153
+ }), ve = () => ({
154
154
  tag: "ol"
155
- }), se = () => ({
155
+ }), $e = () => ({
156
156
  tag: "p"
157
- }), re = (i) => ({
157
+ }), Te = (s) => ({
158
158
  tag: [
159
159
  {
160
160
  tag: "span",
161
161
  attrs: {
162
162
  "data-type": "emoji",
163
- "data-name": i.attrs.name,
164
- emoji: i.attrs.emoji
163
+ "data-name": s.attrs.name,
164
+ emoji: s.attrs.emoji
165
165
  }
166
166
  }
167
167
  ]
168
- }), oe = () => ({
168
+ }), Re = () => ({
169
169
  tag: "b"
170
- }), ie = () => ({
170
+ }), we = () => ({
171
171
  tag: "s"
172
- }), ne = () => ({
172
+ }), _e = () => ({
173
173
  tag: "u"
174
- }), ae = () => ({
174
+ }), Se = () => ({
175
175
  tag: "strong"
176
- }), le = () => ({
176
+ }), Ee = () => ({
177
177
  tag: "code"
178
- }), ce = () => ({
178
+ }), xe = () => ({
179
179
  tag: "i"
180
- }), he = (i) => {
181
- if (!i.attrs)
180
+ }), Ie = (s) => {
181
+ if (!s.attrs)
182
182
  return {
183
183
  tag: ""
184
184
  };
185
- const e = new k().escapeHTML, t = { ...i.attrs }, { linktype: s = "url" } = i.attrs;
186
- if (delete t.linktype, t.href && (t.href = e(i.attrs.href || "")), J(s) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
187
- for (const r in t.custom)
188
- t[r] = t.custom[r];
185
+ const e = new j().escapeHTML, t = { ...s.attrs }, { linktype: r = "url" } = s.attrs;
186
+ if (delete t.linktype, t.href && (t.href = e(s.attrs.href || "")), ue(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
187
+ for (const o in t.custom)
188
+ t[o] = t.custom[o];
189
189
  delete t.custom;
190
190
  }
191
191
  return {
@@ -196,94 +196,95 @@ const B = function(i, e) {
196
196
  }
197
197
  ]
198
198
  };
199
- }, ue = (i) => ({
199
+ }, je = (s) => ({
200
200
  tag: [
201
201
  {
202
202
  tag: "span",
203
- attrs: i.attrs
203
+ attrs: s.attrs
204
204
  }
205
205
  ]
206
- }), pe = () => ({
206
+ }), Ce = () => ({
207
207
  tag: "sub"
208
- }), de = () => ({
208
+ }), Oe = () => ({
209
209
  tag: "sup"
210
- }), ge = (i) => ({
210
+ }), Ae = (s) => ({
211
211
  tag: [
212
212
  {
213
213
  tag: "span",
214
- attrs: i.attrs
214
+ attrs: s.attrs
215
215
  }
216
216
  ]
217
- }), fe = (i) => {
217
+ }), Le = (s) => {
218
218
  var e;
219
- return (e = i.attrs) != null && e.color ? {
219
+ return (e = s.attrs) != null && e.color ? {
220
220
  tag: [
221
221
  {
222
222
  tag: "span",
223
223
  attrs: {
224
- style: `background-color:${i.attrs.color};`
224
+ style: `background-color:${s.attrs.color};`
225
225
  }
226
226
  }
227
227
  ]
228
228
  } : {
229
229
  tag: ""
230
230
  };
231
- }, me = (i) => {
231
+ }, Pe = (s) => {
232
232
  var e;
233
- return (e = i.attrs) != null && e.color ? {
233
+ return (e = s.attrs) != null && e.color ? {
234
234
  tag: [
235
235
  {
236
236
  tag: "span",
237
237
  attrs: {
238
- style: `color:${i.attrs.color}`
238
+ style: `color:${s.attrs.color}`
239
239
  }
240
240
  }
241
241
  ]
242
242
  } : {
243
243
  tag: ""
244
244
  };
245
- }, ye = {
245
+ }, Ne = {
246
246
  nodes: {
247
- horizontal_rule: K,
248
- blockquote: Y,
249
- bullet_list: W,
250
- code_block: G,
251
- hard_break: Q,
252
- heading: X,
253
- image: Z,
254
- list_item: ee,
255
- ordered_list: te,
256
- paragraph: se,
257
- emoji: re
247
+ horizontal_rule: pe,
248
+ blockquote: de,
249
+ bullet_list: ge,
250
+ code_block: fe,
251
+ hard_break: me,
252
+ heading: ye,
253
+ image: be,
254
+ list_item: ke,
255
+ ordered_list: ve,
256
+ paragraph: $e,
257
+ emoji: Te
258
258
  },
259
259
  marks: {
260
- bold: oe,
261
- strike: ie,
262
- underline: ne,
263
- strong: ae,
264
- code: le,
265
- italic: ce,
266
- link: he,
267
- styled: ue,
268
- subscript: pe,
269
- superscript: de,
270
- anchor: ge,
271
- highlight: fe,
272
- textStyle: me
273
- }
274
- }, be = function(i) {
260
+ bold: Re,
261
+ strike: we,
262
+ underline: _e,
263
+ strong: Se,
264
+ code: Ee,
265
+ italic: xe,
266
+ link: Ie,
267
+ styled: je,
268
+ subscript: Ce,
269
+ superscript: Oe,
270
+ anchor: Ae,
271
+ highlight: Le,
272
+ textStyle: Pe
273
+ }
274
+ }, Me = function(s) {
275
275
  const e = {
276
276
  "&": "&amp;",
277
277
  "<": "&lt;",
278
278
  ">": "&gt;",
279
279
  '"': "&quot;",
280
280
  "'": "&#39;"
281
- }, t = /[&<>"']/g, s = RegExp(t.source);
282
- return i && s.test(i) ? i.replace(t, (r) => e[r]) : i;
281
+ }, t = /[&<>"']/g, r = RegExp(t.source);
282
+ return s && r.test(s) ? s.replace(t, (o) => e[o]) : s;
283
283
  };
284
- class v {
284
+ let z = !1;
285
+ class He {
285
286
  constructor(e) {
286
- c(this, "marks"), c(this, "nodes"), e || (e = ye), this.marks = e.marks || [], this.nodes = e.nodes || [];
287
+ d(this, "marks"), d(this, "nodes"), e || (e = Ne), this.marks = e.marks || [], this.nodes = e.nodes || [];
287
288
  }
288
289
  addNode(e, t) {
289
290
  this.nodes[e] = t;
@@ -291,12 +292,14 @@ class v {
291
292
  addMark(e, t) {
292
293
  this.marks[e] = t;
293
294
  }
294
- render(e, t = { optimizeImages: !1 }) {
295
- if (e && e.content && Array.isArray(e.content)) {
296
- let s = "";
297
- return e.content.forEach((r) => {
298
- s += this.renderNode(r);
299
- }), t.optimizeImages ? this.optimizeImages(s, t.optimizeImages) : s;
295
+ render(e, t = { optimizeImages: !1 }, r = !0) {
296
+ if (!z && r && (console.warn(
297
+ "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/"
298
+ ), z = !0), e && e.content && Array.isArray(e.content)) {
299
+ let o = "";
300
+ return e.content.forEach((n) => {
301
+ o += this.renderNode(n);
302
+ }), t.optimizeImages ? this.optimizeImages(o, t.optimizeImages) : o;
300
303
  }
301
304
  return console.warn(
302
305
  `The render method must receive an Object with a "content" field.
@@ -326,63 +329,63 @@ class v {
326
329
  ), "";
327
330
  }
328
331
  optimizeImages(e, t) {
329
- let s = 0, r = 0, o = "", n = "";
330
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (o += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (o += `height="${t.height}" `, r = 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 && (n += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (n += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (n += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (n += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (n += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (n += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (n += `:rotate(${t.filters.rotate})`), n.length > 0 && (n = "/filters" + n))), o.length > 0 && (e = e.replace(/<img/g, `<img ${o.trim()}`));
331
- const l = s > 0 || r > 0 || n.length > 0 ? `${s}x${r}${n}` : "";
332
+ let r = 0, o = 0, n = "", i = "";
333
+ 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-Fa-f]{6}/g) || 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()}`));
334
+ const l = r > 0 || o > 0 || i.length > 0 ? `${r}x${o}${i}` : "";
332
335
  return e = e.replace(
333
336
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
334
337
  `a.storyblok.com/f/$1/$2.$3/m/${l}`
335
338
  ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (a) => {
336
- var u, h;
337
- const p = a.match(
339
+ var u, p;
340
+ const h = a.match(
338
341
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
339
342
  );
340
- if (p && p.length > 0) {
341
- const g = {
342
- srcset: (u = t.srcset) == null ? void 0 : u.map((d) => {
343
- if (typeof d == "number")
344
- return `//${p}/m/${d}x0${n} ${d}w`;
345
- if (typeof d == "object" && d.length === 2) {
346
- let w = 0, S = 0;
347
- return typeof d[0] == "number" && (w = d[0]), typeof d[1] == "number" && (S = d[1]), `//${p}/m/${w}x${S}${n} ${w}w`;
343
+ if (h && h.length > 0) {
344
+ const m = {
345
+ srcset: (u = t.srcset) == null ? void 0 : u.map((y) => {
346
+ if (typeof y == "number")
347
+ return `//${h}/m/${y}x0${i} ${y}w`;
348
+ if (typeof y == "object" && y.length === 2) {
349
+ let w = 0, x = 0;
350
+ return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (x = y[1]), `//${h}/m/${w}x${x}${i} ${w}w`;
348
351
  }
349
352
  }).join(", "),
350
- sizes: (h = t.sizes) == null ? void 0 : h.map((d) => d).join(", ")
353
+ sizes: (p = t.sizes) == null ? void 0 : p.map((y) => y).join(", ")
351
354
  };
352
- let f = "";
353
- return g.srcset && (f += `srcset="${g.srcset}" `), g.sizes && (f += `sizes="${g.sizes}" `), a.replace(/<img/g, `<img ${f.trim()}`);
355
+ let $ = "";
356
+ return m.srcset && ($ += `srcset="${m.srcset}" `), m.sizes && ($ += `sizes="${m.sizes}" `), a.replace(/<img/g, `<img ${$.trim()}`);
354
357
  }
355
358
  return a;
356
359
  })), e;
357
360
  }
358
361
  renderNode(e) {
359
362
  const t = [];
360
- e.marks && e.marks.forEach((r) => {
361
- const o = this.getMatchingMark(r);
362
- o && o.tag !== "" && t.push(this.renderOpeningTag(o.tag));
363
+ e.marks && e.marks.forEach((o) => {
364
+ const n = this.getMatchingMark(o);
365
+ n && n.tag !== "" && t.push(this.renderOpeningTag(n.tag));
363
366
  });
364
- const s = this.getMatchingNode(e);
365
- return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((r) => {
366
- t.push(this.renderNode(r));
367
- }) : e.text ? t.push(be(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((r) => {
368
- const o = this.getMatchingMark(r);
369
- o && o.tag !== "" && t.push(this.renderClosingTag(o.tag));
367
+ const r = this.getMatchingNode(e);
368
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((o) => {
369
+ t.push(this.renderNode(o));
370
+ }) : e.text ? t.push(Me(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) => {
371
+ const n = this.getMatchingMark(o);
372
+ n && n.tag !== "" && t.push(this.renderClosingTag(n.tag));
370
373
  }), t.join("");
371
374
  }
372
375
  renderTag(e, t) {
373
- return e.constructor === String ? `<${e}${t}>` : e.map((s) => {
374
- if (s.constructor === String)
375
- return `<${s}${t}>`;
376
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
377
+ if (r.constructor === String)
378
+ return `<${r}${t}>`;
376
379
  {
377
- let r = `<${s.tag}`;
378
- if (s.attrs) {
379
- for (const o in s.attrs)
380
- if (Object.prototype.hasOwnProperty.call(s.attrs, o)) {
381
- const n = s.attrs[o];
382
- n !== null && (r += ` ${o}="${n}"`);
380
+ let o = `<${r.tag}`;
381
+ if (r.attrs) {
382
+ for (const n in r.attrs)
383
+ if (Object.prototype.hasOwnProperty.call(r.attrs, n)) {
384
+ const i = r.attrs[n];
385
+ i !== null && (o += ` ${n}="${i}"`);
383
386
  }
384
387
  }
385
- return `${r}${t}>`;
388
+ return `${o}${t}>`;
386
389
  }
387
390
  }).join("");
388
391
  }
@@ -419,9 +422,10 @@ class v {
419
422
  return this.renderTag(t, " /");
420
423
  }
421
424
  }
422
- class ke {
425
+ const C = He;
426
+ class Ue {
423
427
  constructor(e) {
424
- c(this, "baseURL"), c(this, "timeout"), c(this, "headers"), c(this, "responseInterceptor"), c(this, "fetch"), c(this, "ejectInterceptor"), c(this, "url"), c(this, "parameters"), c(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 = {};
428
+ d(this, "baseURL"), d(this, "timeout"), d(this, "headers"), d(this, "responseInterceptor"), d(this, "fetch"), d(this, "ejectInterceptor"), d(this, "url"), d(this, "parameters"), d(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 = {};
425
429
  }
426
430
  /**
427
431
  *
@@ -442,37 +446,37 @@ class ke {
442
446
  return this.url = e, this.parameters = t, this._methodHandler("delete");
443
447
  }
444
448
  async _responseHandler(e) {
445
- const t = [], s = {
449
+ const t = [], r = {
446
450
  data: {},
447
451
  headers: {},
448
452
  status: 0,
449
453
  statusText: ""
450
454
  };
451
- e.status !== 204 && await e.json().then((r) => {
452
- s.data = r;
455
+ e.status !== 204 && await e.json().then((o) => {
456
+ r.data = o;
453
457
  });
454
- for (const r of e.headers.entries())
455
- t[r[0]] = r[1];
456
- return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
458
+ for (const o of e.headers.entries())
459
+ t[o[0]] = o[1];
460
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
457
461
  }
458
462
  async _methodHandler(e) {
459
- let t = `${this.baseURL}${this.url}`, s = null;
463
+ let t = `${this.baseURL}${this.url}`, r = null;
460
464
  if (e === "get") {
461
- const a = new k();
465
+ const a = new j();
462
466
  t = `${this.baseURL}${this.url}?${a.stringify(
463
467
  this.parameters
464
468
  )}`;
465
469
  } else
466
- s = JSON.stringify(this.parameters);
467
- const r = new URL(t), o = new AbortController(), { signal: n } = o;
470
+ r = JSON.stringify(this.parameters);
471
+ const o = new URL(t), n = new AbortController(), { signal: i } = n;
468
472
  let l;
469
- this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
473
+ this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
470
474
  try {
471
- const a = await this.fetch(`${r}`, {
475
+ const a = await this.fetch(`${o}`, {
472
476
  method: e,
473
477
  headers: this.headers,
474
- body: s,
475
- signal: n,
478
+ body: r,
479
+ signal: i,
476
480
  ...this.fetchOptions
477
481
  });
478
482
  this.timeout && clearTimeout(l);
@@ -494,116 +498,115 @@ class ke {
494
498
  }
495
499
  _statusHandler(e) {
496
500
  const t = /20[0-6]/g;
497
- return new Promise((s, r) => {
501
+ return new Promise((r, o) => {
498
502
  if (t.test(`${e.status}`))
499
- return s(e);
500
- const o = {
503
+ return r(e);
504
+ const n = {
501
505
  message: e.statusText,
502
506
  status: e.status,
503
507
  response: Array.isArray(e.data) ? e.data[0] : e.data.error || e.data.slug
504
508
  };
505
- r(o);
509
+ o(n);
506
510
  });
507
511
  }
508
512
  }
509
- const P = "SB-Agent", R = {
513
+ const De = Ue, B = "SB-Agent", L = {
510
514
  defaultAgentName: "SB-JS-CLIENT",
511
515
  defaultAgentVersion: "SB-Agent-Version",
512
516
  packageVersion: "6.0.0"
513
517
  };
514
- let b = {};
515
- const m = {};
516
- class ve {
518
+ let I = {};
519
+ const _ = {};
520
+ class ze {
517
521
  /**
518
522
  *
519
523
  * @param config ISbConfig interface
520
524
  * @param endpoint string, optional
521
525
  */
522
526
  constructor(e, t) {
523
- c(this, "client"), c(this, "maxRetries"), c(this, "retriesDelay"), c(this, "throttle"), c(this, "accessToken"), c(this, "cache"), c(this, "helpers"), c(this, "resolveCounter"), c(this, "relations"), c(this, "links"), c(this, "richTextResolver"), c(this, "resolveNestedRelations"), c(this, "stringifiedStoriesCache");
524
- let s = e.endpoint || t;
525
- if (!s) {
526
- const n = new k().getRegionURL, l = e.https === !1 ? "http" : "https";
527
- e.oauthToken ? s = `${l}://${n(e.region)}/v1` : s = `${l}://${n(e.region)}/v2`;
527
+ d(this, "client"), d(this, "maxRetries"), d(this, "retriesDelay"), d(this, "throttle"), d(this, "accessToken"), d(this, "cache"), d(this, "helpers"), d(this, "resolveCounter"), d(this, "relations"), d(this, "links"), d(this, "richTextResolver"), d(this, "resolveNestedRelations"), d(this, "stringifiedStoriesCache");
528
+ let r = e.endpoint || t;
529
+ if (!r) {
530
+ const i = new j().getRegionURL, l = e.https === !1 ? "http" : "https";
531
+ e.oauthToken ? r = `${l}://${i(e.region)}/v1` : r = `${l}://${i(e.region)}/v2`;
528
532
  }
529
- const r = new Headers();
530
- if (r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers)
531
- for (const n in e.headers)
532
- r.set(n, e.headers[n]);
533
- r.has(P) || (r.set(P, R.defaultAgentName), r.set(
534
- R.defaultAgentVersion,
535
- R.packageVersion
533
+ const o = new Headers();
534
+ 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]) => {
535
+ o.set(i, l);
536
+ }), o.has(B) || (o.set(B, L.defaultAgentName), o.set(
537
+ L.defaultAgentVersion,
538
+ L.packageVersion
536
539
  ));
537
- let o = 5;
538
- e.oauthToken && (r.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), e.richTextSchema ? this.richTextResolver = new v(e.richTextSchema) : this.richTextResolver = new v(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = F(this.throttledRequest, o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new k(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new ke({
539
- baseURL: s,
540
+ let n = 5;
541
+ e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = 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 = ce(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new j(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new De({
542
+ baseURL: r,
540
543
  timeout: e.timeout || 0,
541
- headers: r,
544
+ headers: o,
542
545
  responseInterceptor: e.responseInterceptor,
543
546
  fetch: e.fetch
544
547
  });
545
548
  }
546
549
  setComponentResolver(e) {
547
550
  this.richTextResolver.addNode("blok", (t) => {
548
- let s = "";
549
- return t.attrs.body && t.attrs.body.forEach((r) => {
550
- s += e(r.component, r);
551
+ let r = "";
552
+ return t.attrs.body && t.attrs.body.forEach((o) => {
553
+ r += e(o.component, o);
551
554
  }), {
552
- html: s
555
+ html: r
553
556
  };
554
557
  });
555
558
  }
556
559
  parseParams(e) {
557
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = m[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
560
+ return e.token || (e.token = this.getToken()), e.cv || (e.cv = _[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
558
561
  }
559
562
  factoryParamOptions(e, t) {
560
563
  return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
561
564
  }
562
- makeRequest(e, t, s, r, o) {
563
- const n = this.factoryParamOptions(
565
+ makeRequest(e, t, r, o, n) {
566
+ const i = this.factoryParamOptions(
564
567
  e,
565
- this.helpers.getOptionsPage(t, s, r)
568
+ this.helpers.getOptionsPage(t, r, o)
566
569
  );
567
- return this.cacheResponse(e, n, void 0, o);
570
+ return this.cacheResponse(e, i, void 0, n);
568
571
  }
569
- get(e, t, s) {
572
+ get(e, t, r) {
570
573
  t || (t = {});
571
- const r = `/${e}`, o = this.factoryParamOptions(r, t);
572
- return this.cacheResponse(r, o, void 0, s);
574
+ const o = `/${e}`, n = this.factoryParamOptions(o, t);
575
+ return this.cacheResponse(o, n, void 0, r);
573
576
  }
574
- async getAll(e, t, s, r) {
575
- const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`, l = n.split("/"), a = s || l[l.length - 1], u = 1, h = await this.makeRequest(
576
- n,
577
+ async getAll(e, t, r, o) {
578
+ const n = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, l = i.split("/"), a = r || l[l.length - 1], u = 1, p = await this.makeRequest(
579
+ i,
577
580
  t,
578
- o,
581
+ n,
579
582
  u,
580
- r
581
- ), p = h.total ? Math.ceil(h.total / o) : 1, g = await this.helpers.asyncMap(
582
- this.helpers.range(u, p),
583
- (f) => this.makeRequest(n, t, o, f + 1, r)
583
+ o
584
+ ), h = p.total ? Math.ceil(p.total / n) : 1, m = await this.helpers.asyncMap(
585
+ this.helpers.range(u, h),
586
+ ($) => this.makeRequest(i, t, n, $ + 1, o)
584
587
  );
585
588
  return this.helpers.flatMap(
586
- [h, ...g],
587
- (f) => Object.values(f.data[a])
589
+ [p, ...m],
590
+ ($) => Object.values($.data[a])
588
591
  );
589
592
  }
590
- post(e, t, s) {
591
- const r = `/${e}`;
592
- return Promise.resolve(this.throttle("post", r, t, s));
593
+ post(e, t, r) {
594
+ const o = `/${e}`;
595
+ return Promise.resolve(this.throttle("post", o, t, r));
593
596
  }
594
- put(e, t, s) {
595
- const r = `/${e}`;
596
- return Promise.resolve(this.throttle("put", r, t, s));
597
+ put(e, t, r) {
598
+ const o = `/${e}`;
599
+ return Promise.resolve(this.throttle("put", o, t, r));
597
600
  }
598
- delete(e, t, s) {
599
- const r = `/${e}`;
600
- return Promise.resolve(this.throttle("delete", r, t, s));
601
+ delete(e, t, r) {
602
+ const o = `/${e}`;
603
+ return Promise.resolve(this.throttle("delete", o, t, r));
601
604
  }
602
605
  getStories(e, t) {
603
606
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
604
607
  }
605
- getStory(e, t, s) {
606
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
608
+ getStory(e, t, r) {
609
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
607
610
  }
608
611
  getToken() {
609
612
  return this.accessToken;
@@ -617,9 +620,9 @@ class ve {
617
620
  _cleanCopy(e) {
618
621
  return JSON.parse(JSON.stringify(e));
619
622
  }
620
- _insertLinks(e, t, s) {
621
- const r = e[t];
622
- r && r.fieldtype == "multilink" && r.linktype == "story" && typeof r.id == "string" && this.links[s][r.id] ? r.story = this._cleanCopy(this.links[s][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[s][r.uuid] && (r.story = this._cleanCopy(this.links[s][r.uuid]));
623
+ _insertLinks(e, t, r) {
624
+ const o = e[t];
625
+ 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]));
623
626
  }
624
627
  /**
625
628
  *
@@ -632,85 +635,85 @@ class ve {
632
635
  this.relations[e][t]
633
636
  )), JSON.parse(this.stringifiedStoriesCache[t])) : t;
634
637
  }
635
- _insertRelations(e, t, s, r) {
636
- s.indexOf(`${e.component}.${t}`) > -1 && (typeof e[t] == "string" ? e[t] = this.getStoryReference(r, e[t]) : Array.isArray(e[t]) && (e[t] = e[t].map((o) => this.getStoryReference(r, o)).filter(Boolean)));
637
- }
638
- iterateTree(e, t, s) {
639
- const r = (o) => {
640
- if (o != null) {
641
- if (o.constructor === Array)
642
- for (let n = 0; n < o.length; n++)
643
- r(o[n]);
644
- else if (o.constructor === Object) {
645
- if (o._stopResolving)
638
+ _insertRelations(e, t, r, o) {
639
+ r.indexOf(`${e.component}.${t}`) > -1 && (typeof e[t] == "string" ? e[t] = this.getStoryReference(o, e[t]) : Array.isArray(e[t]) && (e[t] = e[t].map((n) => this.getStoryReference(o, n)).filter(Boolean)));
640
+ }
641
+ iterateTree(e, t, r) {
642
+ const o = (n) => {
643
+ if (n != null) {
644
+ if (n.constructor === Array)
645
+ for (let i = 0; i < n.length; i++)
646
+ o(n[i]);
647
+ else if (n.constructor === Object) {
648
+ if (n._stopResolving)
646
649
  return;
647
- for (const n in o)
648
- (o.component && o._uid || o.type === "link") && (this._insertRelations(
649
- o,
650
+ for (const i in n)
651
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(
650
652
  n,
653
+ i,
651
654
  t,
652
- s
655
+ r
653
656
  ), this._insertLinks(
654
- o,
655
657
  n,
656
- s
657
- )), r(o[n]);
658
+ i,
659
+ r
660
+ )), o(n[i]);
658
661
  }
659
662
  }
660
663
  };
661
- r(e.content);
664
+ o(e.content);
662
665
  }
663
- async resolveLinks(e, t, s) {
664
- let r = [];
666
+ async resolveLinks(e, t, r) {
667
+ let o = [];
665
668
  if (e.link_uuids) {
666
- const o = e.link_uuids.length, n = [], l = 50;
667
- for (let a = 0; a < o; a += l) {
668
- const u = Math.min(o, a + l);
669
- n.push(e.link_uuids.slice(a, u));
669
+ const n = e.link_uuids.length, i = [], l = 50;
670
+ for (let a = 0; a < n; a += l) {
671
+ const u = Math.min(n, a + l);
672
+ i.push(e.link_uuids.slice(a, u));
670
673
  }
671
- for (let a = 0; a < n.length; a++)
674
+ for (let a = 0; a < i.length; a++)
672
675
  (await this.getStories({
673
676
  per_page: l,
674
677
  language: t.language,
675
678
  version: t.version,
676
- by_uuids: n[a].join(",")
679
+ by_uuids: i[a].join(",")
677
680
  })).data.stories.forEach(
678
681
  (u) => {
679
- r.push(u);
682
+ o.push(u);
680
683
  }
681
684
  );
682
685
  } else
683
- r = e.links;
684
- r.forEach((o) => {
685
- this.links[s][o.uuid] = {
686
- ...o,
686
+ o = e.links;
687
+ o.forEach((n) => {
688
+ this.links[r][n.uuid] = {
689
+ ...n,
687
690
  _stopResolving: !0
688
691
  };
689
692
  });
690
693
  }
691
- async resolveRelations(e, t, s) {
692
- let r = [];
694
+ async resolveRelations(e, t, r) {
695
+ let o = [];
693
696
  if (e.rel_uuids) {
694
- const o = e.rel_uuids.length, n = [], l = 50;
695
- for (let a = 0; a < o; a += l) {
696
- const u = Math.min(o, a + l);
697
- n.push(e.rel_uuids.slice(a, u));
697
+ const n = e.rel_uuids.length, i = [], l = 50;
698
+ for (let a = 0; a < n; a += l) {
699
+ const u = Math.min(n, a + l);
700
+ i.push(e.rel_uuids.slice(a, u));
698
701
  }
699
- for (let a = 0; a < n.length; a++)
702
+ for (let a = 0; a < i.length; a++)
700
703
  (await this.getStories({
701
704
  per_page: l,
702
705
  language: t.language,
703
706
  version: t.version,
704
- by_uuids: n[a].join(","),
707
+ by_uuids: i[a].join(","),
705
708
  excluding_fields: t.excluding_fields
706
709
  })).data.stories.forEach((u) => {
707
- r.push(u);
710
+ o.push(u);
708
711
  });
709
712
  } else
710
- r = e.rels;
711
- r && r.length > 0 && r.forEach((o) => {
712
- this.relations[s][o.uuid] = {
713
- ...o,
713
+ o = e.rels;
714
+ o && o.length > 0 && o.forEach((n) => {
715
+ this.relations[r][n.uuid] = {
716
+ ...n,
714
717
  _stopResolving: !0
715
718
  };
716
719
  });
@@ -724,86 +727,85 @@ class ve {
724
727
  * @returns Promise<void>
725
728
  *
726
729
  */
727
- async resolveStories(e, t, s) {
728
- var r, o;
729
- let n = [];
730
- if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && ["1", "story", "url", "link"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
731
- for (const l in this.relations[s])
730
+ async resolveStories(e, t, r) {
731
+ var o, n;
732
+ let i = [];
733
+ 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"].indexOf(t.resolve_links) > -1 && ((o = e.links) != null && o.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations)
734
+ for (const l in this.relations[r])
732
735
  this.iterateTree(
733
- this.relations[s][l],
734
- n,
735
- s
736
+ this.relations[r][l],
737
+ i,
738
+ r
736
739
  );
737
- e.story ? this.iterateTree(e.story, n, s) : e.stories.forEach((l) => {
738
- this.iterateTree(l, n, s);
739
- }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
740
+ e.story ? this.iterateTree(e.story, i, r) : e.stories.forEach((l) => {
741
+ this.iterateTree(l, i, r);
742
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
740
743
  }
741
- async cacheResponse(e, t, s, r) {
742
- const o = this.helpers.stringify({ url: e, params: t }), n = this.cacheProvider();
744
+ async cacheResponse(e, t, r, o) {
745
+ const n = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
743
746
  if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
744
- const l = await n.get(o);
747
+ const l = await i.get(n);
745
748
  if (l)
746
749
  return Promise.resolve(l);
747
750
  }
748
751
  return new Promise(async (l, a) => {
749
752
  var u;
750
753
  try {
751
- const h = await this.throttle("get", e, t, r);
752
- if (h.status !== 200)
753
- return a(h);
754
- let p = { data: h.data, headers: h.headers };
755
- if ((u = h.headers) != null && u["per-page"] && (p = Object.assign({}, p, {
756
- perPage: h.headers["per-page"] ? parseInt(h.headers["per-page"]) : 0,
757
- total: h.headers["per-page"] ? parseInt(h.headers.total) : 0
758
- })), p.data.story || p.data.stories) {
759
- const g = this.resolveCounter = ++this.resolveCounter % 1e3;
760
- await this.resolveStories(p.data, t, `${g}`);
754
+ const p = await this.throttle("get", e, t, o);
755
+ if (p.status !== 200)
756
+ return a(p);
757
+ let h = { data: p.data, headers: p.headers };
758
+ if ((u = p.headers) != null && u["per-page"] && (h = Object.assign({}, h, {
759
+ perPage: p.headers["per-page"] ? parseInt(p.headers["per-page"]) : 0,
760
+ total: p.headers["per-page"] ? parseInt(p.headers.total) : 0
761
+ })), h.data.story || h.data.stories) {
762
+ const m = this.resolveCounter = ++this.resolveCounter % 1e3;
763
+ await this.resolveStories(h.data, t, `${m}`);
761
764
  }
762
- return t.version === "published" && e != "/cdn/spaces/me" && await n.set(o, p), p.data.cv && t.token && (t.version === "draft" && m[t.token] != p.data.cv && await this.flushCache(), m[t.token] = t.cv ? t.cv : p.data.cv), l(p);
763
- } catch (h) {
764
- if (h.response && h.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
765
+ return t.version === "published" && e != "/cdn/spaces/me" && await i.set(n, h), h.data.cv && t.token && (t.version === "draft" && _[t.token] != h.data.cv && await this.flushCache(), _[t.token] = t.cv ? t.cv : h.data.cv), l(h);
766
+ } catch (p) {
767
+ if (p.response && p.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
765
768
  return console.log(
766
769
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
767
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(l).catch(a);
768
- a(h);
770
+ ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
771
+ a(p);
769
772
  }
770
773
  });
771
774
  }
772
- throttledRequest(e, t, s, r) {
773
- return this.client.setFetchOptions(r), this.client[e](t, s);
775
+ throttledRequest(e, t, r, o) {
776
+ return this.client.setFetchOptions(o), this.client[e](t, r);
774
777
  }
775
778
  cacheVersions() {
776
- return m;
779
+ return _;
777
780
  }
778
781
  cacheVersion() {
779
- return m[this.accessToken];
782
+ return _[this.accessToken];
780
783
  }
781
784
  setCacheVersion(e) {
782
- this.accessToken && (m[this.accessToken] = e);
785
+ this.accessToken && (_[this.accessToken] = e);
783
786
  }
784
787
  clearCacheVersion() {
785
- this.accessToken && (m[this.accessToken] = 0);
788
+ this.accessToken && (_[this.accessToken] = 0);
786
789
  }
787
790
  cacheProvider() {
788
791
  switch (this.cache.type) {
789
792
  case "memory":
790
793
  return {
791
794
  get(e) {
792
- return Promise.resolve(b[e]);
795
+ return Promise.resolve(I[e]);
793
796
  },
794
797
  getAll() {
795
- return Promise.resolve(b);
798
+ return Promise.resolve(I);
796
799
  },
797
800
  set(e, t) {
798
- return b[e] = t, Promise.resolve(void 0);
801
+ return I[e] = t, Promise.resolve(void 0);
799
802
  },
800
803
  flush() {
801
- return b = {}, Promise.resolve(void 0);
804
+ return I = {}, Promise.resolve(void 0);
802
805
  }
803
806
  };
804
807
  case "custom":
805
- if (this.cache.custom)
806
- return this.cache.custom;
808
+ if (this.cache.custom) return this.cache.custom;
807
809
  default:
808
810
  return {
809
811
  get() {
@@ -825,21 +827,21 @@ class ve {
825
827
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
826
828
  }
827
829
  }
828
- const Ce = (i = {}) => {
829
- const { apiOptions: e } = i;
830
+ const st = (s = {}) => {
831
+ const { apiOptions: e } = s;
830
832
  if (!e.accessToken) {
831
833
  console.error(
832
834
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
833
835
  );
834
836
  return;
835
837
  }
836
- return { storyblokApi: new ve(e) };
837
- }, we = (i) => {
838
- if (typeof i != "object" || typeof i._editable > "u")
838
+ return { storyblokApi: new ze(e) };
839
+ }, Be = (s) => {
840
+ if (typeof s != "object" || typeof s._editable > "u")
839
841
  return {};
840
842
  try {
841
843
  const e = JSON.parse(
842
- i._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
844
+ s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
843
845
  );
844
846
  return e ? {
845
847
  "data-blok-c": JSON.stringify(e),
@@ -849,125 +851,325 @@ const Ce = (i = {}) => {
849
851
  return {};
850
852
  }
851
853
  };
852
- let T, I = "https://app.storyblok.com/f/storyblok-v2-latest.js";
853
- const $e = (i, e, t = {}) => {
854
- var s;
855
- const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
854
+ var b = /* @__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))(b || {}), k = /* @__PURE__ */ ((s) => (s.BOLD = "bold", s.STRONG = "strong", s.STRIKE = "strike", s.UNDERLINE = "underline", s.ITALIC = "italic", s.CODE = "code", s.LINK = "link", s.ANCHOR = "anchor", s.STYLED = "styled", s.SUPERSCRIPT = "superscript", s.SUBSCRIPT = "subscript", s.TEXT_STYLE = "textStyle", s.HIGHLIGHT = "highlight", s))(k || {}), J = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(J || {}), S = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(S || {});
855
+ function qe(s, e) {
856
+ if (!e) return { src: s, attrs: {} };
857
+ let t = 0, r = 0;
858
+ const o = {}, n = [];
859
+ function i(a, u, p, h, m) {
860
+ typeof a != "number" || a <= u || a >= p ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${u} and ${p} (inclusive)`) : m.push(`${h}(${a})`);
861
+ }
862
+ if (typeof e == "object") {
863
+ 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) {
864
+ const { filters: a } = e || {}, { blur: u, brightness: p, fill: h, format: m, grayscale: $, quality: y, rotate: w } = a || {};
865
+ u && i(u, 0, 100, "blur", n), y && i(y, 0, 100, "quality", n), p && i(p, 0, 100, "brightness", n), h && n.push(`fill(${h})`), $ && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), m && ["webp", "png", "jpeg"].includes(m) && n.push(`format(${m})`);
866
+ }
867
+ e.srcset && (o.srcset = e.srcset.map((a) => {
868
+ if (typeof a == "number")
869
+ return `${s}/m/${a}x0/${n.length > 0 ? "filters:" + n.join(":") : ""} ${a}w`;
870
+ if (Array.isArray(a) && a.length === 2) {
871
+ const [u, p] = a;
872
+ return `${s}/m/${u}x${p}/${n.length > 0 ? "filters:" + n.join(":") : ""} ${u}w`;
873
+ }
874
+ }).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
875
+ }
876
+ let l = `${s}/m/`;
877
+ return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
878
+ src: l,
879
+ attrs: o
880
+ };
881
+ }
882
+ const Fe = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), Ve = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
883
+ function Ge(s) {
884
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
885
+ }
886
+ function Ke(s, e = {}, t) {
887
+ const r = Fe(e);
888
+ return `<${r ? `${s} ${r}` : s}>${Array.isArray(t) ? t.join("") : t || ""}</${s}>`;
889
+ }
890
+ function Je(s = {}) {
891
+ let e = 0;
892
+ const {
893
+ renderFn: t = Ke,
894
+ textFn: r = Ge,
895
+ resolvers: o = {},
896
+ optimizeImages: n = !1
897
+ } = s, i = (c) => (g) => t(c, { ...g.attrs, key: `${c}-${e}` }, g.children || null), l = (c) => {
898
+ const { src: g, alt: f, ...v } = c.attrs || {};
899
+ let T = g, R = {};
900
+ if (n) {
901
+ const { src: Z, attrs: ee } = qe(g, n);
902
+ T = Z, R = ee;
903
+ }
904
+ const Q = {
905
+ src: T,
906
+ alt: f || "",
907
+ key: `img-${e}`,
908
+ ...v,
909
+ ...R
910
+ };
911
+ return t("img", Q, "");
912
+ }, a = (c) => {
913
+ const { level: g, ...f } = c.attrs || {};
914
+ return t(`h${g}`, { ...f, key: `h${g}-${e}` }, c.children);
915
+ }, u = (c) => {
916
+ var g, f, v, T;
917
+ return t("span", {
918
+ "data-type": "emoji",
919
+ "data-name": (g = c.attrs) == null ? void 0 : g.name,
920
+ emoji: (f = c.attrs) == null ? void 0 : f.emoji,
921
+ key: `emoji-${e}`
922
+ }, t("img", {
923
+ src: (v = c.attrs) == null ? void 0 : v.fallbackImage,
924
+ alt: (T = c.attrs) == null ? void 0 : T.alt,
925
+ style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
926
+ draggable: "false",
927
+ loading: "lazy"
928
+ }, ""));
929
+ }, p = (c) => t("pre", { ...c.attrs, key: `code-${e}` }, t("code", { key: `code-${e}` }, c.children || "")), h = (c, g = !1) => ({ text: f, attrs: v }) => t(c, g ? {
930
+ style: Ve(v),
931
+ key: `${c}-${e}`
932
+ } : { ...v, key: `${c}-${e}` }, f), m = (c) => O(c), $ = (c) => {
933
+ const { marks: g, ...f } = c;
934
+ return "text" in c ? g ? g.reduce(
935
+ (v, T) => m({ ...T, text: v }),
936
+ // Fix: Ensure render function returns a string
937
+ m({ ...f, children: f.children })
938
+ // Fix: Cast children to string
939
+ ) : r(f.text) : "";
940
+ }, y = (c) => {
941
+ const { linktype: g, href: f, anchor: v, ...T } = c.attrs || {};
942
+ let R = "";
943
+ switch (g) {
944
+ case S.ASSET:
945
+ case S.URL:
946
+ R = f;
947
+ break;
948
+ case S.EMAIL:
949
+ R = `mailto:${f}`;
950
+ break;
951
+ case S.STORY:
952
+ R = f;
953
+ break;
954
+ }
955
+ return v && (R = `${R}#${v}`), t("a", { ...T, href: R, key: `a-${e}` }, c.text);
956
+ }, w = (c) => {
957
+ var g, f;
958
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), t("span", {
959
+ blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
960
+ id: (f = c.attrs) == null ? void 0 : f.id,
961
+ key: `component-${e}`,
962
+ style: "display: none"
963
+ }, "");
964
+ }, x = new Map([
965
+ [b.DOCUMENT, i("div")],
966
+ [b.HEADING, a],
967
+ [b.PARAGRAPH, i("p")],
968
+ [b.UL_LIST, i("ul")],
969
+ [b.OL_LIST, i("ol")],
970
+ [b.LIST_ITEM, i("li")],
971
+ [b.IMAGE, l],
972
+ [b.EMOJI, u],
973
+ [b.CODE_BLOCK, p],
974
+ [b.HR, i("hr")],
975
+ [b.BR, i("br")],
976
+ [b.QUOTE, i("blockquote")],
977
+ [b.COMPONENT, w],
978
+ [J.TEXT, $],
979
+ [k.LINK, y],
980
+ [k.ANCHOR, y],
981
+ [k.STYLED, h("span", !0)],
982
+ [k.BOLD, h("strong")],
983
+ [k.TEXT_STYLE, h("span", !0)],
984
+ [k.ITALIC, h("em")],
985
+ [k.UNDERLINE, h("u")],
986
+ [k.STRIKE, h("s")],
987
+ [k.CODE, h("code")],
988
+ [k.SUPERSCRIPT, h("sup")],
989
+ [k.SUBSCRIPT, h("sub")],
990
+ [k.HIGHLIGHT, h("mark")],
991
+ ...Object.entries(o).map(([c, g]) => [c, g])
992
+ ]);
993
+ function M(c) {
994
+ e += 1;
995
+ const g = x.get(c.type);
996
+ if (!g)
997
+ return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
998
+ if (c.type === "text")
999
+ return g(c);
1000
+ const f = c.content ? c.content.map(O) : void 0;
1001
+ return g({
1002
+ ...c,
1003
+ children: f
1004
+ // Fix: Update the type of 'children' to Node[]
1005
+ });
1006
+ }
1007
+ function O(c) {
1008
+ return Array.isArray(c) ? c.map(M) : M(c);
1009
+ }
1010
+ return {
1011
+ render: O
1012
+ };
1013
+ }
1014
+ let N, q = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1015
+ const Ye = (s, e, t = {}) => {
1016
+ var r;
1017
+ const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = +new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
856
1018
  "_storyblok"
857
- ) === i;
858
- if (!(!r || !o)) {
859
- if (!i) {
1019
+ ) === s;
1020
+ if (!(!o || !n)) {
1021
+ if (!s) {
860
1022
  console.warn("Story ID is not defined. Please provide a valid ID.");
861
1023
  return;
862
1024
  }
863
1025
  window.storyblokRegisterEvent(() => {
864
- new window.StoryblokBridge(t).on(["input", "published", "change"], (n) => {
865
- n.action === "input" && n.story.id === i ? e(n.story) : (n.action === "change" || n.action === "published") && n.storyId === i && window.location.reload();
1026
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (i) => {
1027
+ i.action === "input" && i.story.id === s ? e(i.story) : (i.action === "change" || i.action === "published") && i.storyId === s && window.location.reload();
866
1028
  });
867
1029
  });
868
1030
  }
869
- }, Re = (i = {}) => {
1031
+ }, Xe = (s = {}) => {
870
1032
  var e, t;
871
1033
  const {
872
- bridge: s,
873
- accessToken: r,
874
- use: o = [],
875
- apiOptions: n = {},
1034
+ bridge: r,
1035
+ accessToken: o,
1036
+ use: n = [],
1037
+ apiOptions: i = {},
876
1038
  richText: l = {},
877
1039
  bridgeUrl: a
878
- } = i;
879
- n.accessToken = n.accessToken || r;
880
- const u = { bridge: s, apiOptions: n };
881
- let h = {};
882
- o.forEach((g) => {
883
- h = { ...h, ...g(u) };
884
- }), a && (I = a);
885
- const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
886
- return s !== !1 && p && V(I), T = new v(l.schema), l.resolver && E(T, l.resolver), h;
887
- }, E = (i, e) => {
888
- i.addNode("blok", (t) => {
889
- let s = "";
890
- return t.attrs.body.forEach((r) => {
891
- s += e(r.component, r);
1040
+ } = s;
1041
+ i.accessToken = i.accessToken || o;
1042
+ const u = { bridge: r, apiOptions: i };
1043
+ let p = {};
1044
+ n.forEach((m) => {
1045
+ p = { ...p, ...m(u) };
1046
+ }), a && (q = a);
1047
+ const h = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1048
+ return r !== !1 && h && ie(q), N = new C(l.schema), l.resolver && Y(N, l.resolver), p;
1049
+ }, Y = (s, e) => {
1050
+ s.addNode("blok", (t) => {
1051
+ let r = "";
1052
+ return t.attrs.body.forEach((o) => {
1053
+ r += e(o.component, o);
892
1054
  }), {
893
- html: s
1055
+ html: r
894
1056
  };
895
1057
  });
896
- }, _e = (i) => !i || !(i != null && i.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), xe = (i, e, t) => {
897
- let s = t || T;
898
- if (!s) {
1058
+ }, We = (s) => !s || !(s != null && s.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), ot = (s, e, t) => {
1059
+ let r = t || N;
1060
+ if (!r) {
899
1061
  console.error(
900
1062
  "Please initialize the Storyblok SDK before calling the renderRichText function"
901
1063
  );
902
1064
  return;
903
1065
  }
904
- return _e(i) ? "" : (e && (s = new v(e.schema), e.resolver && E(s, e.resolver)), s.render(i));
905
- }, Te = /* @__PURE__ */ O({
1066
+ return We(s) ? "" : (e && (r = new C(e.schema), e.resolver && Y(r, e.resolver)), r.render(s, {}, !1));
1067
+ }, X = /* @__PURE__ */ F({
906
1068
  __name: "StoryblokComponent",
907
1069
  props: {
908
1070
  blok: {}
909
1071
  },
910
- setup(i, { expose: e }) {
911
- const t = i, s = _();
1072
+ setup(s, { expose: e }) {
1073
+ const t = s, r = P();
912
1074
  e({
913
- value: s
1075
+ value: r
914
1076
  });
915
- const r = typeof $(t.blok.component) != "string", o = N("VueSDKOptions"), n = _(t.blok.component);
916
- return r || (o.enableFallbackComponent ? (n.value = o.customFallbackComponent ?? "FallbackComponent", typeof $(n.value) == "string" && console.error(
917
- `Is the Fallback component "${n.value}" registered properly?`
1077
+ const o = typeof A(t.blok.component) != "string", n = te("VueSDKOptions"), i = P(t.blok.component);
1078
+ return o || (n.enableFallbackComponent ? (i.value = n.customFallbackComponent ?? "FallbackComponent", typeof A(i.value) == "string" && console.error(
1079
+ `Is the Fallback component "${i.value}" registered properly?`
918
1080
  )) : console.error(
919
1081
  `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});"?`
920
- )), (l, a) => (L(), M($(n.value), z({
1082
+ )), (l, a) => (V(), G(A(i.value), re({
921
1083
  ref_key: "blokRef",
922
- ref: s
1084
+ ref: r
923
1085
  }, { ...l.$props, ...l.$attrs }), null, 16));
924
1086
  }
925
- }), Se = {
926
- beforeMount(i, e) {
1087
+ }), Qe = (s) => {
1088
+ var e, t;
1089
+ return K(
1090
+ X,
1091
+ {
1092
+ blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
1093
+ id: (t = s.attrs) == null ? void 0 : t.id
1094
+ },
1095
+ s.children
1096
+ );
1097
+ };
1098
+ function Ze(s) {
1099
+ const e = {
1100
+ renderFn: K,
1101
+ textFn: se,
1102
+ resolvers: {
1103
+ [b.COMPONENT]: Qe,
1104
+ ...s.resolvers
1105
+ }
1106
+ };
1107
+ return Je(e);
1108
+ }
1109
+ const et = /* @__PURE__ */ F({
1110
+ __name: "StoryblokRichText",
1111
+ props: {
1112
+ doc: {},
1113
+ resolvers: {}
1114
+ },
1115
+ setup(s) {
1116
+ const e = s, { render: t } = Ze({
1117
+ resolvers: e.resolvers ?? {}
1118
+ }), r = () => t(e.doc);
1119
+ return (o, n) => (V(), G(r));
1120
+ }
1121
+ }), tt = {
1122
+ beforeMount(s, e) {
927
1123
  if (e.value) {
928
- const t = we(e.value);
929
- Object.keys(t).length > 0 && (i.setAttribute("data-blok-c", t["data-blok-c"]), i.setAttribute("data-blok-uid", t["data-blok-uid"]), i.classList.add("storyblok__outline"));
1124
+ const t = Be(e.value);
1125
+ 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"));
930
1126
  }
931
1127
  }
932
- }, A = (i) => {
933
- console.error(`You can't use ${i} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1128
+ }, W = (s) => {
1129
+ console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
934
1130
  `);
935
1131
  };
936
- let y = null;
937
- const Pe = () => (y || A("useStoryblokApi"), y), Ie = async (i, e = {}, t = {}) => {
938
- const s = _(null);
939
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, U(() => {
940
- s.value && s.value.id && $e(
941
- s.value.id,
942
- (r) => s.value = r,
1132
+ let E = null;
1133
+ const nt = () => (E || W("useStoryblokApi"), E), it = async (s, e = {}, t = {}) => {
1134
+ const r = P(null);
1135
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, oe(() => {
1136
+ r.value && r.value.id && Ye(
1137
+ r.value.id,
1138
+ (o) => r.value = o,
943
1139
  t
944
1140
  );
945
- }), y) {
946
- const { data: r } = await y.get(
947
- `cdn/stories/${i}`,
1141
+ }), E) {
1142
+ const { data: o } = await E.get(
1143
+ `cdn/stories/${s}`,
948
1144
  e
949
1145
  );
950
- s.value = r.story;
951
- } else A("useStoryblok");
952
- return s;
953
- }, Ee = {
954
- install(i, e = {}) {
955
- i.directive("editable", Se), i.component("StoryblokComponent", Te), e.enableFallbackComponent && !e.customFallbackComponent && i.component(
1146
+ r.value = o.story;
1147
+ } else W("useStoryblok");
1148
+ return r;
1149
+ }, at = {
1150
+ install(s, e = {}) {
1151
+ s.directive("editable", tt), s.component("StoryblokComponent", X), s.component("StoryblokRichText", et), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
956
1152
  "FallbackComponent",
957
- H(() => import("./FallbackComponent-D9TGQNbC.mjs"))
1153
+ ne(() => import("./FallbackComponent-D9TGQNbC.mjs"))
958
1154
  );
959
- const { storyblokApi: t } = Re(e);
960
- y = t, i.provide("VueSDKOptions", e);
1155
+ const { storyblokApi: t } = Xe(e);
1156
+ E = t, s.provide("VueSDKOptions", e);
961
1157
  }
962
1158
  };
963
1159
  export {
964
- v as RichTextResolver,
965
- ye as RichTextSchema,
966
- Te as StoryblokComponent,
967
- Ee as StoryblokVue,
968
- Ce as apiPlugin,
969
- xe as renderRichText,
970
- Ie as useStoryblok,
971
- Pe as useStoryblokApi,
972
- $e as useStoryblokBridge
1160
+ b as BlockTypes,
1161
+ k as MarkTypes,
1162
+ C as RichTextResolver,
1163
+ Ne as RichTextSchema,
1164
+ X as StoryblokComponent,
1165
+ et as StoryblokRichText,
1166
+ at as StoryblokVue,
1167
+ J as TextTypes,
1168
+ st as apiPlugin,
1169
+ ot as renderRichText,
1170
+ Je as richTextResolver,
1171
+ it as useStoryblok,
1172
+ nt as useStoryblokApi,
1173
+ Ye as useStoryblokBridge,
1174
+ Ze as useStoryblokRichText
973
1175
  };