@storyblok/vue 9.2.3 → 9.2.5

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