@storyblok/vue 9.2.3 → 9.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,94 +4,95 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as Z, ref as P, resolveDynamicComponent as D, inject as pe, createBlock as W, openBlock as X, mergeProps as fe, h as Q, createTextVNode as ye, watch as me, onMounted as ge, defineAsyncComponent as be } from "vue";
8
- function I(r, e, t) {
9
- this.type = r, this.tag = e, this.attrs = null, this.map = null, this.nesting = t, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
7
+ import { defineComponent as Z, ref as P, resolveDynamicComponent as H, inject as pe, createBlock as W, openBlock as X, mergeProps as fe, h as Q, createTextVNode as ye, watch as me, onMounted as be, defineAsyncComponent as ge } from "vue";
8
+ var ve = Object.defineProperty, ke = (e, t, r) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, m = (e, t, r) => ke(e, typeof t != "symbol" ? t + "" : t, r);
9
+ function I(e, t, r) {
10
+ this.type = e, this.tag = t, this.attrs = null, this.map = null, this.nesting = r, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
10
11
  }
11
- I.prototype.attrIndex = function(r) {
12
+ I.prototype.attrIndex = function(e) {
12
13
  if (!this.attrs)
13
14
  return -1;
14
- const e = this.attrs;
15
- for (let t = 0, s = e.length; t < s; t++)
16
- if (e[t][0] === r)
17
- return t;
15
+ const t = this.attrs;
16
+ for (let r = 0, s = t.length; r < s; r++)
17
+ if (t[r][0] === e)
18
+ return r;
18
19
  return -1;
19
20
  };
20
- I.prototype.attrPush = function(r) {
21
- this.attrs ? this.attrs.push(r) : this.attrs = [r];
21
+ I.prototype.attrPush = function(e) {
22
+ this.attrs ? this.attrs.push(e) : this.attrs = [e];
22
23
  };
23
- I.prototype.attrSet = function(r, e) {
24
- const t = this.attrIndex(r), s = [r, e];
25
- t < 0 ? this.attrPush(s) : this.attrs[t] = s;
24
+ I.prototype.attrSet = function(e, t) {
25
+ const r = this.attrIndex(e), s = [e, t];
26
+ r < 0 ? this.attrPush(s) : this.attrs[r] = s;
26
27
  };
27
- I.prototype.attrGet = function(r) {
28
- const e = this.attrIndex(r);
29
- let t = null;
30
- return e >= 0 && (t = this.attrs[e][1]), t;
28
+ I.prototype.attrGet = function(e) {
29
+ const t = this.attrIndex(e);
30
+ let r = null;
31
+ return t >= 0 && (r = this.attrs[t][1]), r;
31
32
  };
32
- I.prototype.attrJoin = function(r, e) {
33
- const t = this.attrIndex(r);
34
- t < 0 ? this.attrPush([r, e]) : this.attrs[t][1] = this.attrs[t][1] + " " + e;
33
+ I.prototype.attrJoin = function(e, t) {
34
+ const r = this.attrIndex(e);
35
+ r < 0 ? this.attrPush([e, t]) : this.attrs[r][1] = this.attrs[r][1] + " " + t;
35
36
  };
36
- const ve = "[a-zA-Z_:][a-zA-Z0-9:._-]*", ke = "[^\"'=<>`\\x00-\\x20]+", we = "'[^']*'", _e = '"[^"]*"', Te = "(?:" + ke + "|" + we + "|" + _e + ")", Re = "(?:\\s+" + ve + "(?:\\s*=\\s*" + Te + ")?)", $e = "<[A-Za-z][A-Za-z0-9\\-]*" + Re + "*\\s*\\/?>", Ee = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", Ae = new RegExp("^(?:" + $e + "|" + Ee + ")");
37
- new RegExp(Ae.source + "\\s*$");
37
+ const we = "[a-zA-Z_:][a-zA-Z0-9:._-]*", _e = "[^\"'=<>`\\x00-\\x20]+", Te = "'[^']*'", Re = '"[^"]*"', Ae = "(?:" + _e + "|" + Te + "|" + Re + ")", $e = "(?:\\s+" + we + "(?:\\s*=\\s*" + Ae + ")?)", Ee = "<[A-Za-z][A-Za-z0-9\\-]*" + $e + "*\\s*\\/?>", Se = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", Ie = new RegExp("^(?:" + Ee + "|" + Se + ")");
38
+ new RegExp(Ie.source + "\\s*$");
38
39
  const ee = [];
39
- for (let r = 0; r < 256; r++)
40
+ for (let e = 0; e < 256; e++)
40
41
  ee.push(0);
41
- "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(r) {
42
- ee[r.charCodeAt(0)] = 1;
42
+ "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e) {
43
+ ee[e.charCodeAt(0)] = 1;
43
44
  });
44
- let v = /* @__PURE__ */ function(r) {
45
- return r.DOCUMENT = "doc", r.HEADING = "heading", r.PARAGRAPH = "paragraph", r.QUOTE = "blockquote", r.OL_LIST = "ordered_list", r.UL_LIST = "bullet_list", r.LIST_ITEM = "list_item", r.CODE_BLOCK = "code_block", r.HR = "horizontal_rule", r.BR = "hard_break", r.IMAGE = "image", r.EMOJI = "emoji", r.COMPONENT = "blok", r.TABLE = "table", r.TABLE_ROW = "tableRow", r.TABLE_CELL = "tableCell", r.TABLE_HEADER = "tableHeader", r;
46
- }({}), $ = /* @__PURE__ */ function(r) {
47
- return 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;
48
- }({}), Se = /* @__PURE__ */ function(r) {
49
- return r.TEXT = "text", r;
50
- }({}), j = /* @__PURE__ */ function(r) {
51
- return r.URL = "url", r.STORY = "story", r.ASSET = "asset", r.EMAIL = "email", r;
45
+ let v = /* @__PURE__ */ function(e) {
46
+ return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
47
+ }({}), R = /* @__PURE__ */ function(e) {
48
+ return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
49
+ }({}), Ce = /* @__PURE__ */ function(e) {
50
+ return e.TEXT = "text", e;
51
+ }({}), j = /* @__PURE__ */ function(e) {
52
+ return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
52
53
  }({});
53
- function Ie(r, e) {
54
- if (!e) return {
55
- src: r,
54
+ function Le(e, t) {
55
+ if (!t) return {
56
+ src: e,
56
57
  attrs: {}
57
58
  };
58
- let t = 0, s = 0;
59
+ let r = 0, s = 0;
59
60
  const o = {}, n = [];
60
- function a(i, u, f, y, R) {
61
- typeof i != "number" || i <= u || i >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : R.push(`${y}(${i})`);
61
+ function l(c, u, f, y, A) {
62
+ typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : A.push(`${y}(${c})`);
62
63
  }
63
- if (typeof e == "object") {
64
- 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) {
65
- const { filters: i } = e || {}, { blur: u, brightness: f, fill: y, format: R, grayscale: _, quality: A, rotate: C } = i || {};
66
- u && a(u, 0, 100, "blur", n), A && a(A, 0, 100, "quality", n), f && a(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), _ && n.push("grayscale()"), C && [
64
+ if (typeof t == "object") {
65
+ if (typeof t.width == "number" && t.width > 0 ? (o.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (o.height = t.height, s = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
66
+ const { filters: c } = t || {}, { blur: u, brightness: f, fill: y, format: A, grayscale: T, quality: E, rotate: C } = c || {};
67
+ u && l(u, 0, 100, "blur", n), E && l(E, 0, 100, "quality", n), f && l(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), T && n.push("grayscale()"), C && [
67
68
  0,
68
69
  90,
69
70
  180,
70
71
  270
71
- ].includes(e.filters.rotate || 0) && n.push(`rotate(${C})`), R && [
72
+ ].includes(t.filters.rotate || 0) && n.push(`rotate(${C})`), A && [
72
73
  "webp",
73
74
  "png",
74
75
  "jpeg"
75
- ].includes(R) && n.push(`format(${R})`);
76
+ ].includes(A) && n.push(`format(${A})`);
76
77
  }
77
- e.srcset && (o.srcset = e.srcset.map((i) => {
78
- if (typeof i == "number") return `${r}/m/${i}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${i}w`;
79
- if (Array.isArray(i) && i.length === 2) {
80
- const [u, f] = i;
81
- return `${r}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
78
+ t.srcset && (o.srcset = t.srcset.map((c) => {
79
+ if (typeof c == "number") return `${e}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
80
+ if (Array.isArray(c) && c.length === 2) {
81
+ const [u, f] = c;
82
+ return `${e}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
82
83
  } else {
83
84
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
84
85
  return;
85
86
  }
86
- }).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
87
+ }).join(", ")), t.sizes && (o.sizes = t.sizes.join(", "));
87
88
  }
88
- let c = `${r}/m/`;
89
- return t > 0 && s > 0 && (c = `${c}${t}x${s}/`), n.length > 0 && (c = `${c}filters:${n.join(":")}`), {
90
- src: c,
89
+ let a = `${e}/m/`;
90
+ return r > 0 && s > 0 && (a = `${a}${r}x${s}/`), n.length > 0 && (a = `${a}filters:${n.join(":")}`), {
91
+ src: a,
91
92
  attrs: o
92
93
  };
93
94
  }
94
- const Ce = [
95
+ const je = [
95
96
  "area",
96
97
  "base",
97
98
  "br",
@@ -106,186 +107,186 @@ const Ce = [
106
107
  "source",
107
108
  "track",
108
109
  "wbr"
109
- ], Le = (r = {}) => Object.keys(r).map((e) => `${e}="${r[e]}"`).join(" "), je = (r = {}) => Object.keys(r).map((e) => `${e}: ${r[e]}`).join("; ");
110
- function Oe(r) {
111
- return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
110
+ ], Oe = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), xe = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
111
+ function Pe(e) {
112
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
112
113
  }
113
- const O = (r) => Object.fromEntries(Object.entries(r).filter(([e, t]) => t !== void 0));
114
- function V(r, e = {}, t) {
115
- const s = Le(e), o = s ? `${r} ${s}` : r, n = Array.isArray(t) ? t.join("") : t || "";
116
- if (r) {
117
- if (Ce.includes(r)) return `<${o}>`;
114
+ const O = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
115
+ function z(e, t = {}, r) {
116
+ const s = Oe(t), o = s ? `${e} ${s}` : e, n = Array.isArray(r) ? r.join("") : r || "";
117
+ if (e) {
118
+ if (je.includes(e)) return `<${o}>`;
118
119
  } else return n;
119
- return `<${o}>${n}</${r}>`;
120
+ return `<${o}>${n}</${e}>`;
120
121
  }
121
- function te(r = {}) {
122
- const e = /* @__PURE__ */ new Map(), { renderFn: t = V, textFn: s = Oe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: a = !1 } = r, c = t !== V, i = (l) => (h, d) => {
122
+ function te(e = {}) {
123
+ const t = /* @__PURE__ */ new Map(), { renderFn: r = z, textFn: s = Pe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: l = !1 } = e, a = r !== z, c = (i) => (h, d) => {
123
124
  const p = h.attrs || {};
124
- return d.render(l, p, h.children || null);
125
- }, u = (l, h) => {
126
- const { src: d, alt: p, title: g, srcset: w, sizes: b } = l.attrs || {};
127
- let k = d, T = {};
125
+ return d.render(i, p, h.children || null);
126
+ }, u = (i, h) => {
127
+ const { src: d, alt: p, title: b, srcset: w, sizes: g } = i.attrs || {};
128
+ let k = d, _ = {};
128
129
  if (n) {
129
- const { src: he, attrs: de } = Ie(d, n);
130
- k = he, T = de;
130
+ const { src: he, attrs: de } = Le(d, n);
131
+ k = he, _ = de;
131
132
  }
132
133
  const ue = {
133
134
  src: k,
134
135
  alt: p,
135
- title: g,
136
+ title: b,
136
137
  srcset: w,
137
- sizes: b,
138
- ...T
138
+ sizes: g,
139
+ ..._
139
140
  };
140
141
  return h.render("img", O(ue));
141
- }, f = (l, h) => {
142
- const { level: d, ...p } = l.attrs || {};
143
- return h.render(`h${d}`, p, l.children);
144
- }, y = (l, h) => {
145
- var d, p, g, w;
146
- const b = h.render("img", {
147
- src: (d = l.attrs) == null ? void 0 : d.fallbackImage,
148
- alt: (p = l.attrs) == null ? void 0 : p.alt,
142
+ }, f = (i, h) => {
143
+ const { level: d, ...p } = i.attrs || {};
144
+ return h.render(`h${d}`, p, i.children);
145
+ }, y = (i, h) => {
146
+ var d, p, b, w;
147
+ const g = h.render("img", {
148
+ src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
149
+ alt: (p = i.attrs) == null ? void 0 : p.alt,
149
150
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
150
151
  draggable: "false",
151
152
  loading: "lazy"
152
153
  });
153
154
  return h.render("span", {
154
155
  "data-type": "emoji",
155
- "data-name": (g = l.attrs) == null ? void 0 : g.name,
156
- "data-emoji": (w = l.attrs) == null ? void 0 : w.emoji
157
- }, b);
158
- }, R = (l, h) => h.render("pre", l.attrs || {}, h.render("code", {}, l.children || "")), _ = (l, h = !1) => ({ text: d, attrs: p }, g) => {
159
- const { class: w, id: b, ...k } = p || {}, T = h ? {
156
+ "data-name": (b = i.attrs) == null ? void 0 : b.name,
157
+ "data-emoji": (w = i.attrs) == null ? void 0 : w.emoji
158
+ }, g);
159
+ }, A = (i, h) => h.render("pre", i.attrs || {}, h.render("code", {}, i.children || "")), T = (i, h = !1) => ({ text: d, attrs: p }, b) => {
160
+ const { class: w, id: g, ...k } = p || {}, _ = h ? {
160
161
  class: w,
161
- id: b,
162
- style: je(k) || void 0
162
+ id: g,
163
+ style: xe(k) || void 0
163
164
  } : p || {};
164
- return g.render(l, O(T), d);
165
- }, A = (l) => N(l), C = (l) => {
166
- const { marks: h, ...d } = l;
167
- if ("text" in l) {
168
- if (h) return h.reduce((g, w) => A({
165
+ return b.render(i, O(_), d);
166
+ }, E = (i) => N(i), C = (i) => {
167
+ const { marks: h, ...d } = i;
168
+ if ("text" in i) {
169
+ if (h) return h.reduce((b, w) => E({
169
170
  ...w,
170
- text: g
171
- }), A({
171
+ text: b
172
+ }), E({
172
173
  ...d,
173
174
  children: d.children
174
175
  }));
175
- const p = l.attrs || {};
176
- if (a) {
177
- const g = e.get("txt") || 0;
178
- e.set("txt", g + 1), p.key = `txt-${g}`;
176
+ const p = i.attrs || {};
177
+ if (l) {
178
+ const b = t.get("txt") || 0;
179
+ t.set("txt", b + 1), p.key = `txt-${b}`;
179
180
  }
180
181
  return s(d.text, p);
181
182
  }
182
183
  return "";
183
- }, B = (l, h) => {
184
- const { linktype: d, href: p, anchor: g, ...w } = l.attrs || {};
185
- let b = "";
184
+ }, B = (i, h) => {
185
+ const { linktype: d, href: p, anchor: b, ...w } = i.attrs || {};
186
+ let g = "";
186
187
  switch (d) {
187
188
  case j.ASSET:
188
189
  case j.URL:
189
- b = p;
190
+ g = p;
190
191
  break;
191
192
  case j.EMAIL:
192
- b = `mailto:${p}`;
193
+ g = `mailto:${p}`;
193
194
  break;
194
195
  case j.STORY:
195
- b = p, g && (b = `${b}#${g}`);
196
+ g = p, b && (g = `${g}#${b}`);
196
197
  break;
197
198
  default:
198
- b = p;
199
+ g = p;
199
200
  break;
200
201
  }
201
202
  const k = { ...w };
202
- return b && (k.href = b), h.render("a", k, l.text);
203
- }, oe = (l, h) => {
203
+ return g && (k.href = g), h.render("a", k, i.text);
204
+ }, oe = (i, h) => {
204
205
  var d, p;
205
206
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
206
- blok: (d = l == null ? void 0 : l.attrs) == null ? void 0 : d.body[0],
207
- id: (p = l.attrs) == null ? void 0 : p.id,
207
+ blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
208
+ id: (p = i.attrs) == null ? void 0 : p.id,
208
209
  style: "display: none"
209
210
  });
210
- }, ne = (l, h) => {
211
- const d = {}, p = h.render("tbody", {}, l.children);
211
+ }, ne = (i, h) => {
212
+ const d = {}, p = h.render("tbody", {}, i.children);
212
213
  return h.render("table", d, p);
213
- }, ie = (l, h) => {
214
+ }, ie = (i, h) => {
214
215
  const d = {};
215
- return h.render("tr", d, l.children);
216
- }, ae = (l, h) => {
217
- const { colspan: d, rowspan: p, colwidth: g, backgroundColor: w, ...b } = l.attrs || {}, k = { ...b };
216
+ return h.render("tr", d, i.children);
217
+ }, ae = (i, h) => {
218
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
218
219
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
219
- const T = [];
220
- return g && T.push(`width: ${g}px;`), w && T.push(`background-color: ${w};`), T.length > 0 && (k.style = T.join(" ")), h.render("td", O(k), l.children);
221
- }, le = (l, h) => {
222
- const { colspan: d, rowspan: p, colwidth: g, backgroundColor: w, ...b } = l.attrs || {}, k = { ...b };
220
+ const _ = [];
221
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("td", O(k), i.children);
222
+ }, le = (i, h) => {
223
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
223
224
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
224
- const T = [];
225
- return g && T.push(`width: ${g}px;`), w && T.push(`background-color: ${w};`), T.length > 0 && (k.style = T.join(" ")), h.render("th", O(k), l.children);
226
- }, M = /* @__PURE__ */ new Map([
227
- [v.DOCUMENT, i("")],
225
+ const _ = [];
226
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("th", O(k), i.children);
227
+ }, F = /* @__PURE__ */ new Map([
228
+ [v.DOCUMENT, c("")],
228
229
  [v.HEADING, f],
229
- [v.PARAGRAPH, i("p")],
230
- [v.UL_LIST, i("ul")],
231
- [v.OL_LIST, i("ol")],
232
- [v.LIST_ITEM, i("li")],
230
+ [v.PARAGRAPH, c("p")],
231
+ [v.UL_LIST, c("ul")],
232
+ [v.OL_LIST, c("ol")],
233
+ [v.LIST_ITEM, c("li")],
233
234
  [v.IMAGE, u],
234
235
  [v.EMOJI, y],
235
- [v.CODE_BLOCK, R],
236
- [v.HR, i("hr")],
237
- [v.BR, i("br")],
238
- [v.QUOTE, i("blockquote")],
236
+ [v.CODE_BLOCK, A],
237
+ [v.HR, c("hr")],
238
+ [v.BR, c("br")],
239
+ [v.QUOTE, c("blockquote")],
239
240
  [v.COMPONENT, oe],
240
- [Se.TEXT, C],
241
- [$.LINK, B],
242
- [$.ANCHOR, B],
243
- [$.STYLED, _("span", !0)],
244
- [$.BOLD, _("strong")],
245
- [$.TEXT_STYLE, _("span", !0)],
246
- [$.ITALIC, _("em")],
247
- [$.UNDERLINE, _("u")],
248
- [$.STRIKE, _("s")],
249
- [$.CODE, _("code")],
250
- [$.SUPERSCRIPT, _("sup")],
251
- [$.SUBSCRIPT, _("sub")],
252
- [$.HIGHLIGHT, _("mark")],
241
+ [Ce.TEXT, C],
242
+ [R.LINK, B],
243
+ [R.ANCHOR, B],
244
+ [R.STYLED, T("span", !0)],
245
+ [R.BOLD, T("strong")],
246
+ [R.TEXT_STYLE, T("span", !0)],
247
+ [R.ITALIC, T("em")],
248
+ [R.UNDERLINE, T("u")],
249
+ [R.STRIKE, T("s")],
250
+ [R.CODE, T("code")],
251
+ [R.SUPERSCRIPT, T("sup")],
252
+ [R.SUBSCRIPT, T("sub")],
253
+ [R.HIGHLIGHT, T("mark")],
253
254
  [v.TABLE, ne],
254
255
  [v.TABLE_ROW, ie],
255
256
  [v.TABLE_CELL, ae],
256
257
  [v.TABLE_HEADER, le]
257
- ]), z = new Map([...M, ...Object.entries(o).map(([l, h]) => [l, h])]), ce = () => ({
258
- render: (l, h = {}, d) => {
259
- if (a && l) {
260
- const p = e.get(l) || 0;
261
- e.set(l, p + 1), h.key = `${l}-${p}`;
258
+ ]), M = new Map([...F, ...Object.entries(o).map(([i, h]) => [i, h])]), ce = () => ({
259
+ render: (i, h = {}, d) => {
260
+ if (l && i) {
261
+ const p = t.get(i) || 0;
262
+ t.set(i, p + 1), h.key = `${i}-${p}`;
262
263
  }
263
- return t(l, h, d);
264
+ return r(i, h, d);
264
265
  },
265
- originalResolvers: M,
266
- mergedResolvers: z
266
+ originalResolvers: F,
267
+ mergedResolvers: M
267
268
  });
268
- function L(l) {
269
- const h = z.get(l.type);
269
+ function L(i) {
270
+ const h = M.get(i.type);
270
271
  if (!h)
271
- return console.error("<Storyblok>", `No resolver found for node type ${l.type}`), "";
272
+ return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
272
273
  const d = ce();
273
- if (l.type === "text") return h(l, d);
274
- const p = l.content ? l.content.map(N) : void 0;
274
+ if (i.type === "text") return h(i, d);
275
+ const p = i.content ? i.content.map(N) : void 0;
275
276
  return h({
276
- ...l,
277
+ ...i,
277
278
  children: p
278
279
  }, d);
279
280
  }
280
- function N(l) {
281
- return l.type === "doc" ? c ? l.content.map(L) : l.content.map(L).join("") : Array.isArray(l) ? l.map(L) : L(l);
281
+ function N(i) {
282
+ return i.type === "doc" ? a ? i.content.map(L) : i.content.map(L).join("") : Array.isArray(i) ? i.map(L) : L(i);
282
283
  }
283
284
  return { render: N };
284
285
  }
285
- let F = !1;
286
- const G = [], xe = (r) => new Promise((e, t) => {
286
+ let V = !1;
287
+ const G = [], Ne = (e) => new Promise((t, r) => {
287
288
  if (typeof window > "u") {
288
- t(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
289
+ r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
289
290
  return;
290
291
  }
291
292
  if (window.storyblokRegisterEvent = (o) => {
@@ -293,104 +294,89 @@ const G = [], xe = (r) => new Promise((e, t) => {
293
294
  console.warn("You are not in Draft Mode or in the Visual Editor.");
294
295
  return;
295
296
  }
296
- F ? o() : G.push(o);
297
+ V ? o() : G.push(o);
297
298
  }, document.getElementById("storyblok-javascript-bridge")) {
298
- e(void 0);
299
+ t(void 0);
299
300
  return;
300
301
  }
301
302
  const s = document.createElement("script");
302
- s.async = !0, s.src = r, s.id = "storyblok-javascript-bridge", s.onerror = (o) => t(o), s.onload = (o) => {
303
- G.forEach((n) => n()), F = !0, e(o);
303
+ s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (o) => r(o), s.onload = (o) => {
304
+ G.forEach((n) => n()), V = !0, t(o);
304
305
  }, document.getElementsByTagName("head")[0].appendChild(s);
305
306
  });
306
- var Pe = Object.defineProperty, Ne = (r, e, t) => e in r ? Pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, m = (r, e, t) => Ne(r, typeof e != "symbol" ? e + "" : e, t);
307
- class De extends Error {
307
+ var He = class extends Error {
308
308
  constructor(e) {
309
309
  super(e), this.name = "AbortError";
310
310
  }
311
- }
312
- function He(r, e, t) {
313
- if (!Number.isFinite(e))
314
- throw new TypeError("Expected `limit` to be a finite number");
315
- if (!Number.isFinite(t))
316
- throw new TypeError("Expected `interval` to be a finite number");
311
+ };
312
+ function De(e, t, r) {
313
+ if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
314
+ if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
317
315
  const s = [];
318
- let o = [], n = 0, a = !1;
319
- const c = async () => {
316
+ let o = [], n = 0, l = !1;
317
+ const a = async () => {
320
318
  n++;
321
319
  const u = s.shift();
322
- if (u)
323
- try {
324
- const y = await r(...u.args);
325
- u.resolve(y);
326
- } catch (y) {
327
- u.reject(y);
328
- }
320
+ if (u) try {
321
+ const y = await e(...u.args);
322
+ u.resolve(y);
323
+ } catch (y) {
324
+ u.reject(y);
325
+ }
329
326
  const f = setTimeout(() => {
330
- n--, s.length > 0 && c(), o = o.filter((y) => y !== f);
331
- }, t);
327
+ n--, s.length > 0 && a(), o = o.filter((y) => y !== f);
328
+ }, r);
332
329
  o.includes(f) || o.push(f);
333
- }, i = (...u) => a ? Promise.reject(
334
- new Error(
335
- "Throttled function is already aborted and not accepting new promises"
336
- )
337
- ) : new Promise((f, y) => {
330
+ }, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, y) => {
338
331
  s.push({
339
332
  resolve: f,
340
333
  reject: y,
341
334
  args: u
342
- }), n < e && c();
335
+ }), n < t && a();
343
336
  });
344
- return i.abort = () => {
345
- a = !0, o.forEach(clearTimeout), o = [], s.forEach(
346
- (u) => u.reject(() => new De("Throttle function aborted"))
347
- ), s.length = 0;
348
- }, i;
337
+ return c.abort = () => {
338
+ l = !0, o.forEach(clearTimeout), o = [], s.forEach((u) => u.reject(() => new He("Throttle function aborted"))), s.length = 0;
339
+ }, c;
349
340
  }
350
- const J = (r = "") => r.includes("/cdn/"), Ue = (r, e = 25, t = 1) => ({
351
- ...r,
352
- per_page: e,
353
- page: t
354
- }), Be = (r) => new Promise((e) => setTimeout(e, r)), Me = (r = 0, e) => Array.from({ length: r }, e), ze = (r = 0, e = r) => {
355
- const t = Math.abs(e - r) || 0, s = r < e ? 1 : -1;
356
- return Me(t, (o, n) => n * s + r);
357
- }, Ve = async (r, e) => Promise.all(r.map(e)), Fe = (r = [], e) => r.map(e).reduce((t, s) => [...t, ...s], []), U = (r, e, t) => {
341
+ var Ue = De;
342
+ const K = (e = "") => e.includes("/cdn/"), Be = (e, t = 25, r = 1) => ({
343
+ ...e,
344
+ per_page: t,
345
+ page: r
346
+ }), Fe = (e) => new Promise((t) => setTimeout(t, e)), Me = (e = 0, t) => Array.from({ length: e }, t), ze = (e = 0, t = e) => {
347
+ const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
348
+ return Me(r, (o, n) => n * s + e);
349
+ }, Ve = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), U = (e, t, r) => {
358
350
  const s = [];
359
- for (const o in r) {
360
- if (!Object.prototype.hasOwnProperty.call(r, o))
361
- continue;
362
- const n = r[o];
363
- if (n == null)
364
- continue;
365
- const a = t ? "" : encodeURIComponent(o);
366
- let c;
367
- typeof n == "object" ? c = U(
368
- n,
369
- e ? e + encodeURIComponent(`[${a}]`) : a,
370
- Array.isArray(n)
371
- ) : c = `${e ? e + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(n)}`, s.push(c);
351
+ for (const o in e) {
352
+ if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
353
+ const n = e[o];
354
+ if (n == null) continue;
355
+ const l = r ? "" : encodeURIComponent(o);
356
+ let a;
357
+ typeof n == "object" ? a = U(n, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(n)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(n)}`, s.push(a);
372
358
  }
373
359
  return s.join("&");
374
- }, q = (r) => {
375
- const e = {
360
+ }, q = (e) => {
361
+ const t = {
376
362
  eu: "api.storyblok.com",
377
363
  us: "api-us.storyblok.com",
378
364
  cn: "app.storyblokchina.cn",
379
365
  ap: "api-ap.storyblok.com",
380
366
  ca: "api-ca.storyblok.com"
381
367
  };
382
- return e[r] ?? e.eu;
368
+ return t[e] ?? t.eu;
383
369
  };
384
- class Ge {
370
+ var Ke = class {
385
371
  constructor(e) {
386
372
  m(this, "baseURL"), m(this, "timeout"), m(this, "headers"), m(this, "responseInterceptor"), m(this, "fetch"), m(this, "ejectInterceptor"), m(this, "url"), m(this, "parameters"), m(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
387
373
  }
388
374
  /**
389
- *
390
- * @param url string
391
- * @param params ISbStoriesParams
392
- * @returns Promise<ISbResponse | Error>
393
- */
375
+ *
376
+ * @param url string
377
+ * @param params ISbStoriesParams
378
+ * @returns Promise<ISbResponse | Error>
379
+ */
394
380
  get(e, t) {
395
381
  return this.url = e, this.parameters = t, this._methodHandler("get");
396
382
  }
@@ -404,42 +390,37 @@ class Ge {
404
390
  return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
405
391
  }
406
392
  async _responseHandler(e) {
407
- const t = [], s = {
393
+ const t = [], r = {
408
394
  data: {},
409
395
  headers: {},
410
396
  status: 0,
411
397
  statusText: ""
412
398
  };
413
- e.status !== 204 && await e.json().then((o) => {
414
- s.data = o;
399
+ e.status !== 204 && await e.json().then((s) => {
400
+ r.data = s;
415
401
  });
416
- for (const o of e.headers.entries())
417
- t[o[0]] = o[1];
418
- return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
402
+ for (const s of e.headers.entries()) t[s[0]] = s[1];
403
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
419
404
  }
420
405
  async _methodHandler(e) {
421
- let t = `${this.baseURL}${this.url}`, s = null;
422
- e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : s = JSON.stringify(this.parameters);
423
- const o = new URL(t), n = new AbortController(), { signal: a } = n;
424
- let c;
425
- this.timeout && (c = setTimeout(() => n.abort(), this.timeout));
406
+ let t = `${this.baseURL}${this.url}`, r = null;
407
+ e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : r = JSON.stringify(this.parameters);
408
+ const s = new URL(t), o = new AbortController(), { signal: n } = o;
409
+ let l;
410
+ this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
426
411
  try {
427
- const i = await this.fetch(`${o}`, {
412
+ const a = await this.fetch(`${s}`, {
428
413
  method: e,
429
414
  headers: this.headers,
430
- body: s,
431
- signal: a,
415
+ body: r,
416
+ signal: n,
432
417
  ...this.fetchOptions
433
418
  });
434
- this.timeout && clearTimeout(c);
435
- const u = await this._responseHandler(
436
- i
437
- );
438
- return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(u)) : this._statusHandler(u);
439
- } catch (i) {
440
- return {
441
- message: i
442
- };
419
+ this.timeout && clearTimeout(l);
420
+ const c = await this._responseHandler(a);
421
+ return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
422
+ } catch (a) {
423
+ return { message: a };
443
424
  }
444
425
  }
445
426
  setFetchOptions(e = {}) {
@@ -449,42 +430,36 @@ class Ge {
449
430
  this.ejectInterceptor = !0;
450
431
  }
451
432
  /**
452
- * Normalizes error messages from different response structures
453
- * @param data The response data that might contain error information
454
- * @returns A normalized error message string
455
- */
433
+ * Normalizes error messages from different response structures
434
+ * @param data The response data that might contain error information
435
+ * @returns A normalized error message string
436
+ */
456
437
  _normalizeErrorMessage(e) {
457
- if (Array.isArray(e))
458
- return e[0] || "Unknown error";
438
+ if (Array.isArray(e)) return e[0] || "Unknown error";
459
439
  if (e && typeof e == "object") {
460
- if (e.error)
461
- return e.error;
440
+ if (e.error) return e.error;
462
441
  for (const t in e) {
463
- if (Array.isArray(e[t]))
464
- return `${t}: ${e[t][0]}`;
465
- if (typeof e[t] == "string")
466
- return `${t}: ${e[t]}`;
442
+ if (Array.isArray(e[t])) return `${t}: ${e[t][0]}`;
443
+ if (typeof e[t] == "string") return `${t}: ${e[t]}`;
467
444
  }
468
- if (e.slug)
469
- return e.slug;
445
+ if (e.slug) return e.slug;
470
446
  }
471
447
  return "Unknown error";
472
448
  }
473
449
  _statusHandler(e) {
474
450
  const t = /20[0-6]/g;
475
- return new Promise((s, o) => {
476
- if (t.test(`${e.status}`))
477
- return s(e);
478
- const n = {
451
+ return new Promise((r, s) => {
452
+ if (t.test(`${e.status}`)) return r(e);
453
+ const o = {
479
454
  message: this._normalizeErrorMessage(e.data),
480
455
  status: e.status,
481
456
  response: e
482
457
  };
483
- o(n);
458
+ s(o);
484
459
  });
485
460
  }
486
- }
487
- const K = "SB-Agent", H = {
461
+ }, qe = Ke;
462
+ const J = "SB-Agent", D = {
488
463
  defaultAgentName: "SB-JS-CLIENT",
489
464
  defaultAgentVersion: "SB-Agent-Version",
490
465
  packageVersion: "7.0.0"
@@ -492,93 +467,74 @@ const K = "SB-Agent", H = {
492
467
  PUBLISHED: "published"
493
468
  };
494
469
  let x = {};
495
- const E = {};
496
- class qe {
470
+ const $ = {};
471
+ var Ye = class {
497
472
  /**
498
- *
499
- * @param config ISbConfig interface
500
- * @param pEndpoint string, optional
501
- */
473
+ *
474
+ * @param config ISbConfig interface
475
+ * @param pEndpoint string, optional
476
+ */
502
477
  constructor(e, t) {
503
478
  m(this, "client"), m(this, "maxRetries"), m(this, "retriesDelay"), m(this, "throttle"), m(this, "accessToken"), m(this, "cache"), m(this, "resolveCounter"), m(this, "relations"), m(this, "links"), m(this, "version"), m(this, "richTextResolver"), m(this, "resolveNestedRelations"), m(this, "stringifiedStoriesCache"), m(this, "inlineAssets");
504
- let s = e.endpoint || t;
505
- if (!s) {
506
- const a = e.https === !1 ? "http" : "https";
507
- e.oauthToken ? s = `${a}://${q(e.region)}/v1` : s = `${a}://${q(e.region)}/v2`;
479
+ let r = e.endpoint || t;
480
+ if (!r) {
481
+ const n = e.https === !1 ? "http" : "https";
482
+ e.oauthToken ? r = `${n}://${q(e.region)}/v1` : r = `${n}://${q(e.region)}/v2`;
508
483
  }
509
- const o = new Headers();
510
- 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, c]) => {
511
- o.set(a, c);
512
- }), o.has(K) || (o.set(K, H.defaultAgentName), o.set(
513
- H.defaultAgentVersion,
514
- H.packageVersion
515
- ));
516
- let n = 5;
517
- e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = He(
518
- this.throttledRequest.bind(this),
519
- n,
520
- 1e3
521
- ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Je.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Ge({
522
- baseURL: s,
484
+ const s = new Headers();
485
+ s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, l]) => {
486
+ s.set(n, l);
487
+ }), s.has(J) || (s.set(J, D.defaultAgentName), s.set(D.defaultAgentVersion, D.packageVersion));
488
+ let o = 5;
489
+ e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Ue(this.throttledRequest.bind(this), o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Je.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new qe({
490
+ baseURL: r,
523
491
  timeout: e.timeout || 0,
524
- headers: o,
492
+ headers: s,
525
493
  responseInterceptor: e.responseInterceptor,
526
494
  fetch: e.fetch
527
495
  });
528
496
  }
529
497
  parseParams(e) {
530
- 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;
498
+ 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;
531
499
  }
532
500
  factoryParamOptions(e, t) {
533
- return J(e) ? this.parseParams(t) : t;
501
+ return K(e) ? this.parseParams(t) : t;
534
502
  }
535
- makeRequest(e, t, s, o, n) {
536
- const a = this.factoryParamOptions(
537
- e,
538
- Ue(t, s, o)
539
- );
540
- return this.cacheResponse(e, a, void 0, n);
503
+ makeRequest(e, t, r, s, o) {
504
+ const n = this.factoryParamOptions(e, Be(t, r, s));
505
+ return this.cacheResponse(e, n, void 0, o);
541
506
  }
542
- get(e, t = {}, s) {
507
+ get(e, t = {}, r) {
543
508
  t || (t = {});
544
- const o = `/${e}`;
545
- J(o) && (t.version = t.version || this.version);
546
- const n = this.factoryParamOptions(o, t);
547
- return this.cacheResponse(o, n, void 0, s);
509
+ const s = `/${e}`;
510
+ K(s) && (t.version = t.version || this.version);
511
+ const o = this.factoryParamOptions(s, t);
512
+ return this.cacheResponse(s, o, void 0, r);
548
513
  }
549
- async getAll(e, t = {}, s, o) {
550
- const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), c = s ?? a.substring(a.lastIndexOf("/") + 1);
514
+ async getAll(e, t = {}, r, s) {
515
+ const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), l = r ?? n.substring(n.lastIndexOf("/") + 1);
551
516
  t.version = t.version || this.version;
552
- const i = 1, u = await this.makeRequest(
553
- a,
554
- t,
555
- n,
556
- i,
557
- o
558
- ), f = u.total ? Math.ceil(u.total / (u.perPage || n)) : 1, y = await Ve(
559
- ze(i, f),
560
- (R) => this.makeRequest(a, t, n, R + 1, o)
561
- );
562
- return Fe([u, ...y], (R) => Object.values(R.data[c]));
517
+ const a = 1, c = await this.makeRequest(n, t, o, a, s), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, f = await Ve(ze(a, u), (y) => this.makeRequest(n, t, o, y + 1, s));
518
+ return Ge([c, ...f], (y) => Object.values(y.data[l]));
563
519
  }
564
- post(e, t = {}, s) {
565
- const o = `/${e}`;
566
- return this.throttle("post", o, t, s);
520
+ post(e, t = {}, r) {
521
+ const s = `/${e}`;
522
+ return this.throttle("post", s, t, r);
567
523
  }
568
- put(e, t = {}, s) {
569
- const o = `/${e}`;
570
- return this.throttle("put", o, t, s);
524
+ put(e, t = {}, r) {
525
+ const s = `/${e}`;
526
+ return this.throttle("put", s, t, r);
571
527
  }
572
- delete(e, t = {}, s) {
528
+ delete(e, t = {}, r) {
573
529
  t || (t = {});
574
- const o = `/${e}`;
575
- return this.throttle("delete", o, t, s);
530
+ const s = `/${e}`;
531
+ return this.throttle("delete", s, t, r);
576
532
  }
577
533
  getStories(e = {}, t) {
578
534
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
579
535
  }
580
- getStory(e, t = {}, s) {
581
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
536
+ getStory(e, t = {}, r) {
537
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
582
538
  }
583
539
  getToken() {
584
540
  return this.accessToken;
@@ -592,213 +548,201 @@ class qe {
592
548
  _cleanCopy(e) {
593
549
  return JSON.parse(JSON.stringify(e));
594
550
  }
595
- _insertLinks(e, t, s) {
596
- const o = e[t];
597
- 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]));
551
+ _insertLinks(e, t, r) {
552
+ const s = e[t];
553
+ s && s.fieldtype === "multilink" && s.linktype === "story" && typeof s.id == "string" && this.links[r][s.id] ? s.story = this._cleanCopy(this.links[r][s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[r][s.uuid] && (s.story = this._cleanCopy(this.links[r][s.uuid]));
598
554
  }
599
555
  /**
600
- *
601
- * @param resolveId A counter number as a string
602
- * @param uuid The uuid of the story
603
- * @returns string | object
604
- */
556
+ *
557
+ * @param resolveId A counter number as a string
558
+ * @param uuid The uuid of the story
559
+ * @returns string | object
560
+ */
605
561
  getStoryReference(e, t) {
606
562
  return this.relations[e][t] ? JSON.parse(this.stringifiedStoriesCache[t] || JSON.stringify(this.relations[e][t])) : t;
607
563
  }
608
564
  /**
609
- * Resolves a field's value by replacing UUIDs with their corresponding story references
610
- * @param jtree - The JSON tree object containing the field to resolve
611
- * @param treeItem - The key of the field to resolve
612
- * @param resolveId - The unique identifier for the current resolution context
613
- *
614
- * This method handles both single string UUIDs and arrays of UUIDs:
615
- * - For single strings: directly replaces the UUID with the story reference
616
- * - For arrays: maps through each UUID and replaces with corresponding story references
617
- */
618
- _resolveField(e, t, s) {
619
- const o = e[t];
620
- typeof o == "string" ? e[t] = this.getStoryReference(s, o) : Array.isArray(o) && (e[t] = o.map(
621
- (n) => this.getStoryReference(s, n)
622
- ).filter(Boolean));
565
+ * Resolves a field's value by replacing UUIDs with their corresponding story references
566
+ * @param jtree - The JSON tree object containing the field to resolve
567
+ * @param treeItem - The key of the field to resolve
568
+ * @param resolveId - The unique identifier for the current resolution context
569
+ *
570
+ * This method handles both single string UUIDs and arrays of UUIDs:
571
+ * - For single strings: directly replaces the UUID with the story reference
572
+ * - For arrays: maps through each UUID and replaces with corresponding story references
573
+ */
574
+ _resolveField(e, t, r) {
575
+ const s = e[t];
576
+ typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((o) => this.getStoryReference(r, o)).filter(Boolean));
623
577
  }
624
578
  /**
625
- * Inserts relations into the JSON tree by resolving references
626
- * @param jtree - The JSON tree object to process
627
- * @param treeItem - The current field being processed
628
- * @param fields - The relation patterns to resolve (string or array of strings)
629
- * @param resolveId - The unique identifier for the current resolution context
630
- *
631
- * This method handles two types of relation patterns:
632
- * 1. Nested relations: matches fields that end with the current field name
633
- * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
634
- *
635
- * 2. Direct component relations: matches exact component.field patterns
636
- * Example: "event.event_type" for component "event" and field "event_type"
637
- *
638
- * The method supports both string and array formats for the fields parameter,
639
- * allowing flexible specification of relation patterns.
640
- */
641
- _insertRelations(e, t, s, o) {
642
- if (Array.isArray(s) ? s.find((a) => a.endsWith(`.${t}`)) : s.endsWith(`.${t}`)) {
643
- this._resolveField(e, t, o);
579
+ * Inserts relations into the JSON tree by resolving references
580
+ * @param jtree - The JSON tree object to process
581
+ * @param treeItem - The current field being processed
582
+ * @param fields - The relation patterns to resolve (string or array of strings)
583
+ * @param resolveId - The unique identifier for the current resolution context
584
+ *
585
+ * This method handles two types of relation patterns:
586
+ * 1. Nested relations: matches fields that end with the current field name
587
+ * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
588
+ *
589
+ * 2. Direct component relations: matches exact component.field patterns
590
+ * Example: "event.event_type" for component "event" and field "event_type"
591
+ *
592
+ * The method supports both string and array formats for the fields parameter,
593
+ * allowing flexible specification of relation patterns.
594
+ */
595
+ _insertRelations(e, t, r, s) {
596
+ if (Array.isArray(r) ? r.find((n) => n.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
597
+ this._resolveField(e, t, s);
644
598
  return;
645
599
  }
646
- const n = e.component ? `${e.component}.${t}` : t;
647
- (Array.isArray(s) ? s.includes(n) : s === n) && this._resolveField(e, t, o);
600
+ const o = e.component ? `${e.component}.${t}` : t;
601
+ (Array.isArray(r) ? r.includes(o) : r === o) && this._resolveField(e, t, s);
648
602
  }
649
603
  /**
650
- * Recursively traverses and resolves relations in the story content tree
651
- * @param story - The story object containing the content to process
652
- * @param fields - The relation patterns to resolve
653
- * @param resolveId - The unique identifier for the current resolution context
654
- */
655
- iterateTree(e, t, s) {
656
- const o = (n, a = "") => {
657
- if (!(!n || n._stopResolving)) {
658
- if (Array.isArray(n))
659
- n.forEach((c, i) => o(c, `${a}[${i}]`));
660
- else if (typeof n == "object")
661
- for (const c in n) {
662
- const i = a ? `${a}.${c}` : c;
663
- (n.component && n._uid || n.type === "link") && (this._insertRelations(n, c, t, s), this._insertLinks(n, c, s)), o(n[c], i);
664
- }
604
+ * Recursively traverses and resolves relations in the story content tree
605
+ * @param story - The story object containing the content to process
606
+ * @param fields - The relation patterns to resolve
607
+ * @param resolveId - The unique identifier for the current resolution context
608
+ */
609
+ iterateTree(e, t, r) {
610
+ const s = (o, n = "") => {
611
+ if (!(!o || o._stopResolving)) {
612
+ if (Array.isArray(o)) o.forEach((l, a) => s(l, `${n}[${a}]`));
613
+ else if (typeof o == "object") for (const l in o) {
614
+ const a = n ? `${n}.${l}` : l;
615
+ (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, r), this._insertLinks(o, l, r)), s(o[l], a);
616
+ }
665
617
  }
666
618
  };
667
- o(e.content);
619
+ s(e.content);
668
620
  }
669
- async resolveLinks(e, t, s) {
670
- let o = [];
621
+ async resolveLinks(e, t, r) {
622
+ let s = [];
671
623
  if (e.link_uuids) {
672
- const n = e.link_uuids.length, a = [], c = 50;
673
- for (let i = 0; i < n; i += c) {
674
- const u = Math.min(n, i + c);
675
- a.push(e.link_uuids.slice(i, u));
624
+ const o = e.link_uuids.length, n = [], l = 50;
625
+ for (let a = 0; a < o; a += l) {
626
+ const c = Math.min(o, a + l);
627
+ n.push(e.link_uuids.slice(a, c));
676
628
  }
677
- for (let i = 0; i < a.length; i++)
629
+ for (let a = 0; a < n.length; a++)
678
630
  (await this.getStories({
679
- per_page: c,
631
+ per_page: l,
680
632
  language: t.language,
681
633
  version: t.version,
682
634
  starts_with: t.starts_with,
683
- by_uuids: a[i].join(",")
684
- })).data.stories.forEach(
685
- (u) => {
686
- o.push(u);
687
- }
688
- );
689
- } else
690
- o = e.links;
691
- o.forEach((n) => {
692
- this.links[s][n.uuid] = {
693
- ...n,
635
+ by_uuids: n[a].join(",")
636
+ })).data.stories.forEach((c) => {
637
+ s.push(c);
638
+ });
639
+ } else s = e.links;
640
+ s.forEach((o) => {
641
+ this.links[r][o.uuid] = {
642
+ ...o,
694
643
  _stopResolving: !0
695
644
  };
696
645
  });
697
646
  }
698
- async resolveRelations(e, t, s) {
699
- let o = [];
647
+ async resolveRelations(e, t, r) {
648
+ let s = [];
700
649
  if (e.rel_uuids) {
701
- const n = e.rel_uuids.length, a = [], c = 50;
702
- for (let i = 0; i < n; i += c) {
703
- const u = Math.min(n, i + c);
704
- a.push(e.rel_uuids.slice(i, u));
650
+ const o = e.rel_uuids.length, n = [], l = 50;
651
+ for (let a = 0; a < o; a += l) {
652
+ const c = Math.min(o, a + l);
653
+ n.push(e.rel_uuids.slice(a, c));
705
654
  }
706
- for (let i = 0; i < a.length; i++)
655
+ for (let a = 0; a < n.length; a++)
707
656
  (await this.getStories({
708
- per_page: c,
657
+ per_page: l,
709
658
  language: t.language,
710
659
  version: t.version,
711
660
  starts_with: t.starts_with,
712
- by_uuids: a[i].join(","),
661
+ by_uuids: n[a].join(","),
713
662
  excluding_fields: t.excluding_fields
714
- })).data.stories.forEach((u) => {
715
- o.push(u);
663
+ })).data.stories.forEach((c) => {
664
+ s.push(c);
716
665
  });
717
- o.length > 0 && (e.rels = o, delete e.rel_uuids);
718
- } else
719
- o = e.rels;
720
- o && o.length > 0 && o.forEach((n) => {
721
- this.relations[s][n.uuid] = {
722
- ...n,
666
+ s.length > 0 && (e.rels = s, delete e.rel_uuids);
667
+ } else s = e.rels;
668
+ s && s.length > 0 && s.forEach((o) => {
669
+ this.relations[r][o.uuid] = {
670
+ ...o,
723
671
  _stopResolving: !0
724
672
  };
725
673
  });
726
674
  }
727
675
  /**
728
- *
729
- * @param responseData
730
- * @param params
731
- * @param resolveId
732
- * @description Resolves the relations and links of the stories
733
- * @returns Promise<void>
734
- *
735
- */
736
- async resolveStories(e, t, s) {
737
- var o, n;
738
- let a = [];
739
- 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)
740
- for (const c in this.relations[s])
741
- this.iterateTree(
742
- this.relations[s][c],
743
- a,
744
- s
745
- );
746
- e.story ? this.iterateTree(e.story, a, s) : e.stories.forEach((c) => {
747
- this.iterateTree(c, a, s);
748
- }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
749
- }
750
- async cacheResponse(e, t, s, o) {
751
- const n = U({ url: e, params: t }), a = this.cacheProvider();
676
+ *
677
+ * @param responseData
678
+ * @param params
679
+ * @param resolveId
680
+ * @description Resolves the relations and links of the stories
681
+ * @returns Promise<void>
682
+ *
683
+ */
684
+ async resolveStories(e, t, r) {
685
+ var s, o;
686
+ let n = [];
687
+ if (this.links[r] = {}, this.relations[r] = {}, 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, r)), t.resolve_links && [
688
+ "1",
689
+ "story",
690
+ "url",
691
+ "link"
692
+ ].includes(t.resolve_links) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations) for (const l in this.relations[r]) this.iterateTree(this.relations[r][l], n, r);
693
+ e.story ? this.iterateTree(e.story, n, r) : e.stories.forEach((l) => {
694
+ this.iterateTree(l, n, r);
695
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
696
+ }
697
+ async cacheResponse(e, t, r, s) {
698
+ const o = U({
699
+ url: e,
700
+ params: t
701
+ }), n = this.cacheProvider();
752
702
  if (t.version === "published" && e !== "/cdn/spaces/me") {
753
- const c = await a.get(n);
754
- if (c)
755
- return Promise.resolve(c);
703
+ const l = await n.get(o);
704
+ if (l) return Promise.resolve(l);
756
705
  }
757
- return new Promise(async (c, i) => {
758
- var u;
706
+ return new Promise(async (l, a) => {
707
+ var c;
759
708
  try {
760
- const f = await this.throttle(
761
- "get",
762
- e,
763
- t,
764
- o
765
- );
766
- if (f.status !== 200)
767
- return i(f);
768
- let y = { data: f.data, headers: f.headers };
769
- if ((u = f.headers) != null && u["per-page"] && (y = Object.assign({}, y, {
770
- perPage: f.headers["per-page"] ? Number.parseInt(f.headers["per-page"]) : 0,
771
- total: f.headers["per-page"] ? Number.parseInt(f.headers.total) : 0
772
- })), y.data.story || y.data.stories) {
773
- const _ = this.resolveCounter = ++this.resolveCounter % 1e3;
774
- await this.resolveStories(y.data, t, `${_}`), y = await this.processInlineAssets(y);
709
+ const u = await this.throttle("get", e, t, s);
710
+ if (u.status !== 200) return a(u);
711
+ let f = {
712
+ data: u.data,
713
+ headers: u.headers
714
+ };
715
+ if ((c = u.headers) != null && c["per-page"] && (f = Object.assign({}, f, {
716
+ perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
717
+ total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
718
+ })), f.data.story || f.data.stories) {
719
+ const A = this.resolveCounter = ++this.resolveCounter % 1e3;
720
+ await this.resolveStories(f.data, t, `${A}`), f = await this.processInlineAssets(f);
775
721
  }
776
- t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, y);
777
- const R = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
778
- return t.token && y.data.cv && (R && E[t.token] && E[t.token] !== y.data.cv && await this.flushCache(), E[t.token] = y.data.cv), c(y);
779
- } catch (f) {
780
- if (f.response && f.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
781
- return console.log(
782
- `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
783
- ), await Be(this.retriesDelay), this.cacheResponse(e, t, s).then(c).catch(i);
784
- i(f);
722
+ t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, f);
723
+ const y = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
724
+ return t.token && f.data.cv && (y && $[t.token] && $[t.token] !== f.data.cv && await this.flushCache(), $[t.token] = f.data.cv), l(f);
725
+ } catch (u) {
726
+ if (u.response && u.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
727
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Fe(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
728
+ a(u);
785
729
  }
786
730
  });
787
731
  }
788
- throttledRequest(e, t, s, o) {
789
- return this.client.setFetchOptions(o), this.client[e](t, s);
732
+ throttledRequest(e, t, r, s) {
733
+ return this.client.setFetchOptions(s), this.client[e](t, r);
790
734
  }
791
735
  cacheVersions() {
792
- return E;
736
+ return $;
793
737
  }
794
738
  cacheVersion() {
795
- return E[this.accessToken];
739
+ return $[this.accessToken];
796
740
  }
797
741
  setCacheVersion(e) {
798
- this.accessToken && (E[this.accessToken] = e);
742
+ this.accessToken && ($[this.accessToken] = e);
799
743
  }
800
744
  clearCacheVersion() {
801
- this.accessToken && (E[this.accessToken] = 0);
745
+ this.accessToken && ($[this.accessToken] = 0);
802
746
  }
803
747
  cacheProvider() {
804
748
  switch (this.cache.type) {
@@ -818,9 +762,7 @@ class qe {
818
762
  }
819
763
  };
820
764
  case "custom":
821
- if (this.cache.custom)
822
- return this.cache.custom;
823
- // eslint-disable-next-line no-fallthrough
765
+ if (this.cache.custom) return this.cache.custom;
824
766
  default:
825
767
  return {
826
768
  get() {
@@ -842,203 +784,199 @@ class qe {
842
784
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
843
785
  }
844
786
  async processInlineAssets(e) {
845
- if (!this.inlineAssets)
846
- return e;
847
- const t = (s) => {
848
- if (!s || typeof s != "object")
849
- return s;
850
- if (Array.isArray(s))
851
- return s.map((n) => t(n));
852
- let o = { ...s };
853
- o.fieldtype === "asset" && Array.isArray(e.data.assets) && (o = {
854
- ...o,
855
- ...e.data.assets.find((n) => n.id === o.id)
787
+ if (!this.inlineAssets) return e;
788
+ const t = (r) => {
789
+ if (!r || typeof r != "object") return r;
790
+ if (Array.isArray(r)) return r.map((o) => t(o));
791
+ let s = { ...r };
792
+ s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
793
+ ...s,
794
+ ...e.data.assets.find((o) => o.id === s.id)
856
795
  });
857
- for (const n in o)
858
- typeof o[n] == "object" && (o[n] = t(o[n]));
859
- return o;
796
+ for (const o in s) typeof s[o] == "object" && (s[o] = t(s[o]));
797
+ return s;
860
798
  };
861
- return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((s) => (s.content = t(s.content), s))), e;
799
+ return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((r) => (r.content = t(r.content), r))), e;
862
800
  }
863
- }
864
- const rt = (r = {}) => {
865
- const { apiOptions: e } = r;
866
- if (!e || !e.accessToken) {
801
+ }, Ze = Ye;
802
+ const nt = (e = {}) => {
803
+ const { apiOptions: t } = e;
804
+ if (!t || !t.accessToken) {
867
805
  console.error(
868
806
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
869
807
  );
870
808
  return;
871
809
  }
872
- return { storyblokApi: new qe(e) };
873
- }, Ke = (r) => {
874
- if (typeof r != "object" || typeof r._editable > "u")
810
+ return { storyblokApi: new Ze(t) };
811
+ }, We = (e) => {
812
+ if (typeof e != "object" || typeof e._editable > "u")
875
813
  return {};
876
814
  try {
877
- const e = JSON.parse(
878
- r._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
815
+ const t = JSON.parse(
816
+ e._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
879
817
  );
880
- return e ? {
881
- "data-blok-c": JSON.stringify(e),
882
- "data-blok-uid": `${e.id}-${e.uid}`
818
+ return t ? {
819
+ "data-blok-c": JSON.stringify(t),
820
+ "data-blok-uid": `${t.id}-${t.uid}`
883
821
  } : {};
884
822
  } catch {
885
823
  return {};
886
824
  }
887
825
  };
888
826
  let Y = "https://app.storyblok.com/f/storyblok-v2-latest.js";
889
- const Ye = (r, e, t = {}) => {
827
+ const Xe = (e, t, r = {}) => {
890
828
  var s;
891
829
  const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
892
830
  "_storyblok"
893
- ), a = n !== null && +n === r;
894
- if (!(!o || !a)) {
895
- if (!r) {
831
+ ), l = n !== null && +n === e;
832
+ if (!(!o || !l)) {
833
+ if (!e) {
896
834
  console.warn("Story ID is not defined. Please provide a valid ID.");
897
835
  return;
898
836
  }
899
837
  window.storyblokRegisterEvent(() => {
900
- new window.StoryblokBridge(t).on(["input", "published", "change"], (c) => {
901
- var i;
902
- c && (c.action === "input" && ((i = c.story) == null ? void 0 : i.id) === r ? e(c.story) : (c.action === "change" || c.action === "published") && c.storyId === r && window.location.reload());
838
+ new window.StoryblokBridge(r).on(["input", "published", "change"], (a) => {
839
+ var c;
840
+ a && (a.action === "input" && ((c = a.story) == null ? void 0 : c.id) === e ? t(a.story) : (a.action === "change" || a.action === "published") && a.storyId === e && window.location.reload());
903
841
  });
904
842
  });
905
843
  }
906
- }, Ze = (r = {}) => {
907
- var e, t;
844
+ }, Qe = (e = {}) => {
845
+ var t, r;
908
846
  const {
909
847
  bridge: s,
910
848
  accessToken: o,
911
849
  use: n = [],
912
- apiOptions: a = {},
913
- bridgeUrl: c
914
- } = r;
915
- a.accessToken = a.accessToken || o;
916
- const i = { bridge: s, apiOptions: a };
850
+ apiOptions: l = {},
851
+ bridgeUrl: a
852
+ } = e;
853
+ l.accessToken = l.accessToken || o;
854
+ const c = { bridge: s, apiOptions: l };
917
855
  let u = {};
918
856
  n.forEach((y) => {
919
- u = { ...u, ...y(i) };
920
- }), c && (Y = c);
921
- const f = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
922
- return s !== !1 && f && xe(Y), u;
857
+ u = { ...u, ...y(c) };
858
+ }), a && (Y = a);
859
+ const f = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
860
+ return s !== !1 && f && Ne(Y), u;
923
861
  };
924
- function st(r, e) {
925
- return te(e).render(r);
862
+ function it(e, t) {
863
+ return te(t).render(e);
926
864
  }
927
865
  const re = /* @__PURE__ */ Z({
928
866
  __name: "StoryblokComponent",
929
867
  props: {
930
868
  blok: {}
931
869
  },
932
- setup(r, { expose: e }) {
933
- var c;
934
- const t = r, s = P();
935
- e({
870
+ setup(e, { expose: t }) {
871
+ var a;
872
+ const r = e, s = P();
873
+ t({
936
874
  value: s
937
875
  });
938
- const o = typeof D(t.blok.component) != "string", n = pe("VueSDKOptions"), a = P((c = t.blok.component) == null ? void 0 : c.replace(/_/g, "-"));
939
- return !o && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof D(a.value) == "string" && console.error(
940
- `Is the Fallback component "${a.value}" registered properly?`
876
+ const o = typeof H(r.blok.component) != "string", n = pe("VueSDKOptions"), l = P((a = r.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
877
+ return !o && n && (n.enableFallbackComponent ? (l.value = n.customFallbackComponent ?? "FallbackComponent", typeof H(l.value) == "string" && console.error(
878
+ `Is the Fallback component "${l.value}" registered properly?`
941
879
  )) : console.error(
942
- `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});"?`
943
- )), (i, u) => (X(), W(D(a.value), fe({
880
+ `Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`
881
+ )), (c, u) => (X(), W(H(l.value), fe({
944
882
  ref_key: "blokRef",
945
883
  ref: s
946
- }, { ...i.$props, ...i.$attrs }), null, 16));
884
+ }, { ...c.$props, ...c.$attrs }), null, 16));
947
885
  }
948
- }), We = (r) => {
949
- var e, t;
886
+ }), et = (e) => {
887
+ var t, r;
950
888
  return Q(
951
889
  re,
952
890
  {
953
- blok: (e = r == null ? void 0 : r.attrs) == null ? void 0 : e.body[0],
954
- id: (t = r.attrs) == null ? void 0 : t.id
891
+ blok: (t = e == null ? void 0 : e.attrs) == null ? void 0 : t.body[0],
892
+ id: (r = e.attrs) == null ? void 0 : r.id
955
893
  },
956
- r.children
894
+ e.children
957
895
  );
958
896
  };
959
- function Xe(r) {
960
- const e = {
897
+ function tt(e) {
898
+ const t = {
961
899
  renderFn: Q,
962
900
  // TODO: Check why this changed.
963
901
  // @ts-expect-error - createTextVNode types has been recently changed.
964
902
  textFn: ye,
965
903
  keyedResolvers: !0,
966
904
  resolvers: {
967
- [v.COMPONENT]: We,
968
- ...r.resolvers
905
+ [v.COMPONENT]: et,
906
+ ...e.resolvers
969
907
  }
970
908
  };
971
- return te(e);
909
+ return te(t);
972
910
  }
973
- const Qe = /* @__PURE__ */ Z({
911
+ const rt = /* @__PURE__ */ Z({
974
912
  __name: "StoryblokRichText",
975
913
  props: {
976
914
  doc: {},
977
915
  resolvers: {}
978
916
  },
979
- setup(r) {
980
- const e = r, t = P(), s = () => t.value;
981
- return me([() => e.doc, () => e.resolvers], ([o, n]) => {
982
- const { render: a } = Xe({
917
+ setup(e) {
918
+ const t = e, r = P(), s = () => r.value;
919
+ return me([() => t.doc, () => t.resolvers], ([o, n]) => {
920
+ const { render: l } = tt({
983
921
  resolvers: n ?? {}
984
922
  });
985
- t.value = a(o);
923
+ r.value = l(o);
986
924
  }, {
987
925
  immediate: !0,
988
926
  deep: !0
989
927
  }), (o, n) => (X(), W(s));
990
928
  }
991
- }), et = {
992
- beforeMount(r, e) {
993
- if (e.value) {
994
- const t = Ke(e.value);
995
- 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"));
929
+ }), st = {
930
+ beforeMount(e, t) {
931
+ if (t.value) {
932
+ const r = We(t.value);
933
+ Object.keys(r).length > 0 && (e.setAttribute("data-blok-c", r["data-blok-c"]), e.setAttribute("data-blok-uid", r["data-blok-uid"]), e.classList.add("storyblok__outline"));
996
934
  }
997
935
  }
998
- }, se = (r) => {
999
- console.error(`You can't use ${r} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
936
+ }, se = (e) => {
937
+ console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1000
938
  `);
1001
939
  };
1002
940
  let S = null;
1003
- const ot = () => (S || se("useStoryblokApi"), S), nt = async (r, e = {}, t = {}) => {
941
+ const at = () => (S || se("useStoryblokApi"), S), lt = async (e, t = {}, r = {}) => {
1004
942
  const s = P(null);
1005
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, ge(() => {
1006
- s.value && s.value.id && Ye(
943
+ if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, be(() => {
944
+ s.value && s.value.id && Xe(
1007
945
  s.value.id,
1008
946
  (o) => s.value = o,
1009
- t
947
+ r
1010
948
  );
1011
949
  }), S) {
1012
950
  const { data: o } = await S.get(
1013
- `cdn/stories/${r}`,
1014
- e
951
+ `cdn/stories/${e}`,
952
+ t
1015
953
  );
1016
954
  s.value = o.story;
1017
955
  } else
1018
956
  se("useStoryblok");
1019
957
  return s;
1020
- }, it = {
1021
- install(r, e = {}) {
1022
- r.directive("editable", et), r.component("StoryblokComponent", re), r.component("StoryblokRichText", Qe), e.enableFallbackComponent && !e.customFallbackComponent && r.component(
958
+ }, ct = {
959
+ install(e, t = {}) {
960
+ e.directive("editable", st), e.component("StoryblokComponent", re), e.component("StoryblokRichText", rt), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
1023
961
  "FallbackComponent",
1024
- be(() => import("./FallbackComponent-Dky11gEu.js"))
962
+ ge(() => import("./FallbackComponent-Dky11gEu.js"))
1025
963
  );
1026
- const { storyblokApi: t } = Ze(e);
1027
- S = t || null, r.provide("VueSDKOptions", e);
964
+ const { storyblokApi: r } = Qe(t);
965
+ S = r || null, e.provide("VueSDKOptions", t);
1028
966
  }
1029
967
  };
1030
968
  export {
1031
969
  v as BlockTypes,
1032
- $ as MarkTypes,
970
+ R as MarkTypes,
1033
971
  re as StoryblokComponent,
1034
- Qe as StoryblokRichText,
1035
- it as StoryblokVue,
1036
- Se as TextTypes,
1037
- rt as apiPlugin,
1038
- st as renderRichText,
972
+ rt as StoryblokRichText,
973
+ ct as StoryblokVue,
974
+ Ce as TextTypes,
975
+ nt as apiPlugin,
976
+ it as renderRichText,
1039
977
  te as richTextResolver,
1040
- nt as useStoryblok,
1041
- ot as useStoryblokApi,
1042
- Ye as useStoryblokBridge,
1043
- Xe as useStoryblokRichText
978
+ lt as useStoryblok,
979
+ at as useStoryblokApi,
980
+ Xe as useStoryblokBridge,
981
+ tt as useStoryblokRichText
1044
982
  };