@storyblok/svelte 2.4.6 → 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  let U = !1;
2
- const H = [], tt = (s) => new Promise((t, e) => {
2
+ const H = [], ee = (s) => new Promise((e, t) => {
3
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (n) => {
4
4
  if (window.location === window.parent.location) {
5
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
@@ -9,64 +9,64 @@ const H = [], tt = (s) => new Promise((t, e) => {
9
9
  }, document.getElementById("storyblok-javascript-bridge")))
10
10
  return;
11
11
  const r = document.createElement("script");
12
- r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (n) => e(n), r.onload = (n) => {
13
- H.forEach((o) => o()), U = !0, t(n);
12
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (n) => t(n), r.onload = (n) => {
13
+ H.forEach((o) => o()), U = !0, e(n);
14
14
  }, document.getElementsByTagName("head")[0].appendChild(r);
15
15
  });
16
- var et = Object.defineProperty, st = (s, t, e) => t in s ? et(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, h = (s, t, e) => (st(s, typeof t != "symbol" ? t + "" : t, e), e);
16
+ var te = Object.defineProperty, se = (s, e, t) => e in s ? te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => (se(s, typeof e != "symbol" ? e + "" : e, t), t);
17
17
  function q(s) {
18
18
  return !(s !== s || s === 1 / 0 || s === -1 / 0);
19
19
  }
20
- function rt(s, t, e) {
21
- if (!q(t))
22
- throw new TypeError("Expected `limit` to be a finite number");
20
+ function re(s, e, t) {
23
21
  if (!q(e))
22
+ throw new TypeError("Expected `limit` to be a finite number");
23
+ if (!q(t))
24
24
  throw new TypeError("Expected `interval` to be a finite number");
25
25
  const r = [];
26
26
  let n = [], o = 0;
27
- const c = function() {
27
+ const a = function() {
28
28
  o++;
29
- const a = setTimeout(function() {
30
- o--, r.length > 0 && c(), n = n.filter(function(u) {
31
- return u !== a;
29
+ const c = setTimeout(function() {
30
+ o--, r.length > 0 && a(), n = n.filter(function(u) {
31
+ return u !== c;
32
32
  });
33
- }, e);
34
- n.indexOf(a) < 0 && n.push(a);
33
+ }, t);
34
+ n.indexOf(c) < 0 && n.push(c);
35
35
  const l = r.shift();
36
36
  l.resolve(s.apply(l.self, l.args));
37
- }, i = function(...a) {
37
+ }, i = function(...c) {
38
38
  const l = this;
39
39
  return new Promise(function(u, d) {
40
40
  r.push({
41
41
  resolve: u,
42
42
  reject: d,
43
- args: a,
43
+ args: c,
44
44
  self: l
45
- }), o < t && c();
45
+ }), o < e && a();
46
46
  });
47
47
  };
48
48
  return i.abort = function() {
49
- n.forEach(clearTimeout), n = [], r.forEach(function(a) {
50
- a.reject(function() {
49
+ n.forEach(clearTimeout), n = [], r.forEach(function(c) {
50
+ c.reject(function() {
51
51
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
52
52
  });
53
53
  }), r.length = 0;
54
54
  }, i;
55
55
  }
56
- const nt = function(s, t) {
57
- const e = {};
56
+ const ne = function(s, e) {
57
+ const t = {};
58
58
  for (const r in s) {
59
59
  const n = s[r];
60
- t.indexOf(r) > -1 && n !== null && (e[r] = n);
60
+ e.indexOf(r) > -1 && n !== null && (t[r] = n);
61
61
  }
62
- return e;
63
- }, ot = (s) => s === "email", it = () => ({
62
+ return t;
63
+ }, oe = (s) => s === "email", ie = () => ({
64
64
  singleTag: "hr"
65
- }), at = () => ({
65
+ }), ae = () => ({
66
66
  tag: "blockquote"
67
- }), ct = () => ({
67
+ }), ce = () => ({
68
68
  tag: "ul"
69
- }), lt = (s) => ({
69
+ }), le = (s) => ({
70
70
  tag: [
71
71
  "pre",
72
72
  {
@@ -74,246 +74,249 @@ const nt = function(s, t) {
74
74
  attrs: s.attrs
75
75
  }
76
76
  ]
77
- }), ht = () => ({
77
+ }), he = () => ({
78
78
  singleTag: "br"
79
- }), ut = (s) => ({
79
+ }), ue = (s) => ({
80
80
  tag: `h${s.attrs.level}`
81
- }), dt = (s) => ({
81
+ }), de = (s) => ({
82
82
  singleTag: [
83
83
  {
84
84
  tag: "img",
85
- attrs: nt(s.attrs, ["src", "alt", "title"])
85
+ attrs: ne(s.attrs, ["src", "alt", "title"])
86
86
  }
87
87
  ]
88
- }), ft = () => ({
88
+ }), fe = () => ({
89
89
  tag: "li"
90
- }), pt = () => ({
90
+ }), pe = () => ({
91
91
  tag: "ol"
92
- }), gt = () => ({
92
+ }), ge = () => ({
93
93
  tag: "p"
94
- }), mt = () => ({
94
+ }), me = () => ({
95
95
  tag: "b"
96
- }), yt = () => ({
96
+ }), ye = () => ({
97
97
  tag: "strike"
98
- }), kt = () => ({
98
+ }), ke = () => ({
99
99
  tag: "u"
100
- }), _t = () => ({
100
+ }), _e = () => ({
101
101
  tag: "strong"
102
- }), bt = () => ({
102
+ }), be = () => ({
103
103
  tag: "code"
104
- }), vt = () => ({
104
+ }), ve = () => ({
105
105
  tag: "i"
106
- }), wt = (s) => {
107
- const t = { ...s.attrs }, { linktype: e = "url" } = s.attrs;
108
- return ot(e) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), {
106
+ }), we = (s) => {
107
+ const e = { ...s.attrs }, { linktype: t = "url" } = s.attrs;
108
+ return oe(t) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), {
109
109
  tag: [
110
110
  {
111
111
  tag: "a",
112
- attrs: t
112
+ attrs: e
113
113
  }
114
114
  ]
115
115
  };
116
- }, $t = (s) => ({
116
+ }, $e = (s) => ({
117
117
  tag: [
118
118
  {
119
119
  tag: "span",
120
120
  attrs: s.attrs
121
121
  }
122
122
  ]
123
- }), Tt = {
123
+ }), Te = {
124
124
  nodes: {
125
- horizontal_rule: it,
126
- blockquote: at,
127
- bullet_list: ct,
128
- code_block: lt,
129
- hard_break: ht,
130
- heading: ut,
131
- image: dt,
132
- list_item: ft,
133
- ordered_list: pt,
134
- paragraph: gt
125
+ horizontal_rule: ie,
126
+ blockquote: ae,
127
+ bullet_list: ce,
128
+ code_block: le,
129
+ hard_break: he,
130
+ heading: ue,
131
+ image: de,
132
+ list_item: fe,
133
+ ordered_list: pe,
134
+ paragraph: ge
135
135
  },
136
136
  marks: {
137
- bold: mt,
138
- strike: yt,
139
- underline: kt,
140
- strong: _t,
141
- code: bt,
142
- italic: vt,
143
- link: wt,
144
- styled: $t
145
- }
146
- }, Rt = function(s) {
147
- const t = {
137
+ bold: me,
138
+ strike: ye,
139
+ underline: ke,
140
+ strong: _e,
141
+ code: be,
142
+ italic: ve,
143
+ link: we,
144
+ styled: $e
145
+ }
146
+ }, Re = function(s) {
147
+ const e = {
148
148
  "&": "&amp;",
149
149
  "<": "&lt;",
150
150
  ">": "&gt;",
151
151
  '"': "&quot;",
152
152
  "'": "&#39;"
153
- }, e = /[&<>"']/g, r = RegExp(e.source);
154
- return s && r.test(s) ? s.replace(e, (n) => t[n]) : s;
153
+ }, t = /[&<>"']/g, r = RegExp(t.source);
154
+ return s && r.test(s) ? s.replace(t, (n) => e[n]) : s;
155
155
  };
156
156
  class T {
157
- constructor(t) {
158
- h(this, "marks"), h(this, "nodes"), t || (t = Tt), this.marks = t.marks || [], this.nodes = t.nodes || [];
157
+ constructor(e) {
158
+ h(this, "marks"), h(this, "nodes"), e || (e = Te), this.marks = e.marks || [], this.nodes = e.nodes || [];
159
159
  }
160
- addNode(t, e) {
161
- this.nodes[t] = e;
160
+ addNode(e, t) {
161
+ this.nodes[e] = t;
162
162
  }
163
- addMark(t, e) {
164
- this.marks[t] = e;
163
+ addMark(e, t) {
164
+ this.marks[e] = t;
165
165
  }
166
- render(t) {
167
- if (t && t.content && Array.isArray(t.content)) {
168
- let e = "";
169
- return t.content.forEach((r) => {
170
- e += this.renderNode(r);
171
- }), e;
166
+ render(e) {
167
+ if (e && e.content && Array.isArray(e.content)) {
168
+ let t = "";
169
+ return e.content.forEach((r) => {
170
+ t += this.renderNode(r);
171
+ }), t;
172
172
  }
173
173
  return console.warn(
174
174
  "The render method must receive an object with a content field, which is an array"
175
175
  ), "";
176
176
  }
177
- renderNode(t) {
178
- const e = [];
179
- t.marks && t.marks.forEach((n) => {
177
+ renderNode(e) {
178
+ const t = [];
179
+ e.marks && e.marks.forEach((n) => {
180
180
  const o = this.getMatchingMark(n);
181
- o && e.push(this.renderOpeningTag(o.tag));
181
+ o && t.push(this.renderOpeningTag(o.tag));
182
182
  });
183
- const r = this.getMatchingNode(t);
184
- return r && r.tag && e.push(this.renderOpeningTag(r.tag)), t.content ? t.content.forEach((n) => {
185
- e.push(this.renderNode(n));
186
- }) : t.text ? e.push(Rt(t.text)) : r && r.singleTag ? e.push(this.renderTag(r.singleTag, " /")) : r && r.html && e.push(r.html), r && r.tag && e.push(this.renderClosingTag(r.tag)), t.marks && t.marks.slice(0).reverse().forEach((n) => {
183
+ const r = this.getMatchingNode(e);
184
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((n) => {
185
+ t.push(this.renderNode(n));
186
+ }) : e.text ? t.push(Re(e.text)) : r && r.singleTag ? t.push(this.renderTag(r.singleTag, " /")) : r && r.html && t.push(r.html), r && r.tag && t.push(this.renderClosingTag(r.tag)), e.marks && e.marks.slice(0).reverse().forEach((n) => {
187
187
  const o = this.getMatchingMark(n);
188
- o && e.push(this.renderClosingTag(o.tag));
189
- }), e.join("");
188
+ o && t.push(this.renderClosingTag(o.tag));
189
+ }), t.join("");
190
190
  }
191
- renderTag(t, e) {
192
- return t.constructor === String ? `<${t}${e}>` : t.map((r) => {
191
+ renderTag(e, t) {
192
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
193
193
  if (r.constructor === String)
194
- return `<${r}${e}>`;
194
+ return `<${r}${t}>`;
195
195
  {
196
196
  let n = `<${r.tag}`;
197
197
  if (r.attrs)
198
198
  for (const o in r.attrs) {
199
- const c = r.attrs[o];
200
- c !== null && (n += ` ${o}="${c}"`);
199
+ const a = r.attrs[o];
200
+ a !== null && (n += ` ${o}="${a}"`);
201
201
  }
202
- return `${n}${e}>`;
202
+ return `${n}${t}>`;
203
203
  }
204
204
  }).join("");
205
205
  }
206
- renderOpeningTag(t) {
207
- return this.renderTag(t, "");
206
+ renderOpeningTag(e) {
207
+ return this.renderTag(e, "");
208
208
  }
209
- renderClosingTag(t) {
210
- return t.constructor === String ? `</${t}>` : t.slice(0).reverse().map((e) => e.constructor === String ? `</${e}>` : `</${e.tag}>`).join("");
209
+ renderClosingTag(e) {
210
+ return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
211
211
  }
212
- getMatchingNode(t) {
213
- const e = this.nodes[t.type];
214
- if (typeof e == "function")
215
- return e(t);
212
+ getMatchingNode(e) {
213
+ const t = this.nodes[e.type];
214
+ if (typeof t == "function")
215
+ return t(e);
216
216
  }
217
- getMatchingMark(t) {
218
- const e = this.marks[t.type];
219
- if (typeof e == "function")
220
- return e(t);
217
+ getMatchingMark(e) {
218
+ const t = this.marks[e.type];
219
+ if (typeof t == "function")
220
+ return t(e);
221
221
  }
222
222
  }
223
223
  class K {
224
224
  constructor() {
225
- h(this, "isCDNUrl", (t = "") => t.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (t, e = 25, r = 1) => ({
226
- ...t,
227
- per_page: e,
225
+ h(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (e, t = 25, r = 1) => ({
226
+ ...e,
227
+ per_page: t,
228
228
  page: r
229
- })), h(this, "delay", (t) => new Promise((e) => setTimeout(e, t))), h(this, "arrayFrom", (t = 0, e) => [...Array(t)].map(e)), h(this, "range", (t = 0, e = t) => {
230
- const r = Math.abs(e - t) || 0, n = t < e ? 1 : -1;
231
- return this.arrayFrom(r, (o, c) => c * n + t);
232
- }), h(this, "asyncMap", async (t, e) => Promise.all(t.map(e))), h(this, "flatMap", (t = [], e) => t.map(e).reduce((r, n) => [...r, ...n], []));
229
+ })), h(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), h(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), h(this, "range", (e = 0, t = e) => {
230
+ const r = Math.abs(t - e) || 0, n = e < t ? 1 : -1;
231
+ return this.arrayFrom(r, (o, a) => a * n + e);
232
+ }), h(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), h(this, "flatMap", (e = [], t) => e.map(t).reduce((r, n) => [...r, ...n], []));
233
233
  }
234
- stringify(t, e, r) {
234
+ stringify(e, t, r) {
235
235
  const n = [];
236
- for (const o in t) {
237
- if (!Object.prototype.hasOwnProperty.call(t, o))
236
+ for (const o in e) {
237
+ if (!Object.prototype.hasOwnProperty.call(e, o))
238
238
  continue;
239
- const c = t[o], i = r ? "" : encodeURIComponent(o);
240
- let a;
241
- typeof c == "object" ? a = this.stringify(
242
- c,
243
- e ? e + encodeURIComponent("[" + i + "]") : i,
244
- Array.isArray(c)
245
- ) : a = (e ? e + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(c), n.push(a);
239
+ const a = e[o], i = r ? "" : encodeURIComponent(o);
240
+ let c;
241
+ typeof a == "object" ? c = this.stringify(
242
+ a,
243
+ t ? t + encodeURIComponent("[" + i + "]") : i,
244
+ Array.isArray(a)
245
+ ) : c = (t ? t + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(a), n.push(c);
246
246
  }
247
247
  return n.join("&");
248
248
  }
249
249
  }
250
- class xt {
251
- constructor(t) {
252
- h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = t.baseURL, this.headers = t.headers || [], this.timeout = t != null && t.timeout ? t.timeout * 1e3 : 0, this.responseInterceptor = t.responseInterceptor, this.fetch = (...e) => t.fetch ? t.fetch(...e) : fetch(...e), this.ejectInterceptor = !1, this.url = "", this.parameters = {};
250
+ class xe {
251
+ constructor(e) {
252
+ h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = e.baseURL, this.headers = e.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 = {};
253
253
  }
254
- get(t, e) {
255
- return this.url = t, this.parameters = e, this._methodHandler("get");
254
+ get(e, t) {
255
+ return this.url = e, this.parameters = t, this._methodHandler("get");
256
256
  }
257
- post(t, e) {
258
- return this.url = t, this.parameters = e, this._methodHandler("post");
257
+ post(e, t) {
258
+ return this.url = e, this.parameters = t, this._methodHandler("post");
259
259
  }
260
- put(t, e) {
261
- return this.url = t, this.parameters = e, this._methodHandler("put");
260
+ put(e, t) {
261
+ return this.url = e, this.parameters = t, this._methodHandler("put");
262
262
  }
263
- delete(t, e) {
264
- return this.url = t, this.parameters = e, this._methodHandler("delete");
263
+ delete(e, t) {
264
+ return this.url = e, this.parameters = t, this._methodHandler("delete");
265
265
  }
266
- async _responseHandler(t) {
267
- const e = [], r = {
266
+ async _responseHandler(e) {
267
+ const t = [], r = {
268
268
  data: {},
269
269
  headers: {},
270
270
  status: 0,
271
271
  statusText: ""
272
272
  };
273
- t.status !== 204 && await t.json().then((n) => {
273
+ e.status !== 204 && await e.json().then((n) => {
274
274
  r.data = n;
275
275
  });
276
- for (const n of t.headers.entries())
277
- e[n[0]] = n[1];
278
- return r.headers = { ...e }, r.status = t.status, r.statusText = t.statusText, r;
279
- }
280
- async _methodHandler(t) {
281
- let e = `${this.baseURL}${this.url}`, r = null;
282
- if (t === "get") {
283
- const a = new K();
284
- e = `${this.baseURL}${this.url}?${a.stringify(
276
+ for (const n of e.headers.entries())
277
+ t[n[0]] = n[1];
278
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
279
+ }
280
+ async _methodHandler(e) {
281
+ let t = `${this.baseURL}${this.url}`, r = null;
282
+ if (e === "get") {
283
+ const c = new K();
284
+ t = `${this.baseURL}${this.url}?${c.stringify(
285
285
  this.parameters
286
286
  )}`;
287
287
  } else
288
288
  r = JSON.stringify(this.parameters);
289
- const n = new URL(e), o = new AbortController(), { signal: c } = o;
289
+ const n = new URL(t), o = new AbortController(), { signal: a } = o;
290
290
  let i;
291
291
  this.timeout && (i = setTimeout(() => o.abort(), this.timeout));
292
292
  try {
293
- const a = await this.fetch(`${n}`, {
294
- method: t,
293
+ const c = await this.fetch(`${n}`, {
294
+ method: e,
295
295
  headers: this.headers,
296
296
  body: r,
297
- signal: c
297
+ signal: a
298
298
  });
299
299
  this.timeout && clearTimeout(i);
300
- const l = await this._responseHandler(a);
300
+ const l = await this._responseHandler(c);
301
301
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(l)) : this._statusHandler(l);
302
- } catch (a) {
303
- return a;
302
+ } catch (c) {
303
+ return {
304
+ message: c
305
+ };
304
306
  }
305
307
  }
306
308
  eject() {
307
309
  this.ejectInterceptor = !0;
308
310
  }
309
- _statusHandler(t) {
310
- const e = /20[0-6]/g;
311
+ _statusHandler(e) {
312
+ const t = /20[0-6]/g;
311
313
  return new Promise((r, n) => {
312
- if (e.test(`${t.status}`))
313
- return r(t);
314
+ if (t.test(`${e.status}`))
315
+ return r(e);
314
316
  const o = {
315
- message: new Error(t.statusText || `status: ${t.status}`),
316
- response: t
317
+ message: new Error(e.statusText),
318
+ status: e.status,
319
+ response: e.data.error || e.data.slug
317
320
  };
318
321
  n(o);
319
322
  });
@@ -321,80 +324,80 @@ class xt {
321
324
  }
322
325
  let b = {};
323
326
  const g = {};
324
- class jt {
325
- constructor(t, e) {
326
- if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !e) {
327
- const o = t.region ? `-${t.region}` : "", c = t.https === !1 ? "http" : "https";
328
- t.oauthToken ? e = `${c}://api${o}.storyblok.com/v1` : e = `${c}://api${o}.storyblok.com/v2`;
327
+ class Pe {
328
+ constructor(e, t) {
329
+ if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !t) {
330
+ const o = e.region ? `-${e.region}` : "", a = e.https === !1 ? "http" : "https";
331
+ e.oauthToken ? t = `${a}://api${o}.storyblok.com/v1` : t = `${a}://api${o}.storyblok.com/v2`;
329
332
  }
330
333
  const r = new Headers();
331
- r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, c) => {
332
- t.headers && t.headers[c] && r.set(c, t.headers[c]);
334
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, a) => {
335
+ e.headers && e.headers[a] && r.set(a, e.headers[a]);
333
336
  });
334
337
  let n = 5;
335
- t.oauthToken && (r.set("Authorization", t.oauthToken), n = 3), t.rateLimit && (n = t.rateLimit), t.richTextSchema ? this.richTextResolver = new T(t.richTextSchema) : this.richTextResolver = new T(), t.componentResolver && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries, this.throttle = rt(this.throttledRequest, n, 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.helpers = new K(), this.resolveNestedRelations = !1, this.client = new xt({
336
- baseURL: e,
337
- timeout: t.timeout || 0,
338
+ e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new T(e.richTextSchema) : this.richTextResolver = new T(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries, this.throttle = re(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new K(), this.resolveNestedRelations = !1, this.client = new xe({
339
+ baseURL: t,
340
+ timeout: e.timeout || 0,
338
341
  headers: r,
339
- responseInterceptor: t.responseInterceptor,
340
- fetch: t.fetch
342
+ responseInterceptor: e.responseInterceptor,
343
+ fetch: e.fetch
341
344
  });
342
345
  }
343
- setComponentResolver(t) {
344
- this.richTextResolver.addNode("blok", (e) => {
346
+ setComponentResolver(e) {
347
+ this.richTextResolver.addNode("blok", (t) => {
345
348
  let r = "";
346
- return e.attrs.body.forEach((n) => {
347
- r += t(n.component, n);
349
+ return t.attrs.body.forEach((n) => {
350
+ r += e(n.component, n);
348
351
  }), {
349
352
  html: r
350
353
  };
351
354
  });
352
355
  }
353
- parseParams(t) {
354
- return t.version || (t.version = "published"), t.token || (t.token = this.getToken()), t.cv || (t.cv = g[t.token]), Array.isArray(t.resolve_relations) && (t.resolve_relations = t.resolve_relations.join(",")), t;
356
+ parseParams(e) {
357
+ return e.version || (e.version = "published"), e.token || (e.token = this.getToken()), e.cv || (e.cv = g[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), e;
355
358
  }
356
- factoryParamOptions(t, e) {
357
- return this.helpers.isCDNUrl(t) ? this.parseParams(e) : e;
359
+ factoryParamOptions(e, t) {
360
+ return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
358
361
  }
359
- makeRequest(t, e, r, n) {
362
+ makeRequest(e, t, r, n) {
360
363
  const o = this.factoryParamOptions(
361
- t,
362
- this.helpers.getOptionsPage(e, r, n)
364
+ e,
365
+ this.helpers.getOptionsPage(t, r, n)
363
366
  );
364
- return this.cacheResponse(t, o);
367
+ return this.cacheResponse(e, o);
365
368
  }
366
- get(t, e) {
367
- e || (e = {});
368
- const r = `/${t}`, n = this.factoryParamOptions(r, e);
369
+ get(e, t) {
370
+ t || (t = {});
371
+ const r = `/${e}`, n = this.factoryParamOptions(r, t);
369
372
  return this.cacheResponse(r, n);
370
373
  }
371
- async getAll(t, e, r) {
372
- const n = (e == null ? void 0 : e.per_page) || 25, o = `/${t}`, c = o.split("/"), i = r || c[c.length - 1], a = 1, l = await this.makeRequest(o, e, n, a), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(
373
- this.helpers.range(a, u),
374
- (p) => this.makeRequest(o, e, n, p + 1)
374
+ async getAll(e, t, r) {
375
+ const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, a = o.split("/"), i = r || a[a.length - 1], c = 1, l = await this.makeRequest(o, t, n, c), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(
376
+ this.helpers.range(c, u),
377
+ (p) => this.makeRequest(o, t, n, p + 1)
375
378
  );
376
379
  return this.helpers.flatMap(
377
380
  [l, ...d],
378
381
  (p) => Object.values(p.data[i])
379
382
  );
380
383
  }
381
- post(t, e) {
382
- const r = `/${t}`;
383
- return Promise.resolve(this.throttle("post", r, e));
384
+ post(e, t) {
385
+ const r = `/${e}`;
386
+ return Promise.resolve(this.throttle("post", r, t));
384
387
  }
385
- put(t, e) {
386
- const r = `/${t}`;
387
- return Promise.resolve(this.throttle("put", r, e));
388
+ put(e, t) {
389
+ const r = `/${e}`;
390
+ return Promise.resolve(this.throttle("put", r, t));
388
391
  }
389
- delete(t, e) {
390
- const r = `/${t}`;
391
- return Promise.resolve(this.throttle("delete", r, e));
392
+ delete(e, t) {
393
+ const r = `/${e}`;
394
+ return Promise.resolve(this.throttle("delete", r, t));
392
395
  }
393
- getStories(t) {
394
- return this.get("cdn/stories", t);
396
+ getStories(e) {
397
+ return this.get("cdn/stories", e);
395
398
  }
396
- getStory(t, e) {
397
- return this.get(`cdn/stories/${t}`, e);
399
+ getStory(e, t) {
400
+ return this.get(`cdn/stories/${e}`, t);
398
401
  }
399
402
  getToken() {
400
403
  return this.accessToken;
@@ -402,26 +405,26 @@ class jt {
402
405
  ejectInterceptor() {
403
406
  this.client.eject();
404
407
  }
405
- _cleanCopy(t) {
406
- return JSON.parse(JSON.stringify(t));
408
+ _cleanCopy(e) {
409
+ return JSON.parse(JSON.stringify(e));
407
410
  }
408
- _insertLinks(t, e) {
409
- const r = t[e];
411
+ _insertLinks(e, t) {
412
+ const r = e[t];
410
413
  r && r.fieldtype == "multilink" && r.linktype == "story" && typeof r.id == "string" && this.links[r.id] ? r.story = this._cleanCopy(this.links[r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[r.uuid] && (r.story = this._cleanCopy(this.links[r.uuid]));
411
414
  }
412
- _insertRelations(t, e, r) {
413
- if (r.indexOf(`${t.component}.${e}`) > -1) {
414
- if (typeof t[e] == "string")
415
- this.relations[t[e]] && (t[e] = this._cleanCopy(this.relations[t[e]]));
416
- else if (t[e] && t[e].constructor === Array) {
415
+ _insertRelations(e, t, r) {
416
+ if (r.indexOf(`${e.component}.${t}`) > -1) {
417
+ if (typeof e[t] == "string")
418
+ this.relations[e[t]] && (e[t] = this._cleanCopy(this.relations[e[t]]));
419
+ else if (e[t] && e[t].constructor === Array) {
417
420
  const n = [];
418
- t[e].forEach((o) => {
421
+ e[t].forEach((o) => {
419
422
  this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
420
- }), t[e] = n;
423
+ }), e[t] = n;
421
424
  }
422
425
  }
423
426
  }
424
- iterateTree(t, e) {
427
+ iterateTree(e, t) {
425
428
  const r = (n) => {
426
429
  if (n != null) {
427
430
  if (n.constructor === Array)
@@ -434,97 +437,99 @@ class jt {
434
437
  (n.component && n._uid || n.type === "link") && (this._insertRelations(
435
438
  n,
436
439
  o,
437
- e
440
+ t
438
441
  ), this._insertLinks(n, o)), r(n[o]);
439
442
  }
440
443
  }
441
444
  };
442
- r(t.content);
445
+ r(e.content);
443
446
  }
444
- async resolveLinks(t, e) {
447
+ async resolveLinks(e, t) {
445
448
  let r = [];
446
- if (t.link_uuids) {
447
- const n = t.link_uuids.length, o = [], c = 50;
448
- for (let i = 0; i < n; i += c) {
449
- const a = Math.min(n, i + c);
450
- o.push(t.link_uuids.slice(i, a));
449
+ if (e.link_uuids) {
450
+ const n = e.link_uuids.length, o = [], a = 50;
451
+ for (let i = 0; i < n; i += a) {
452
+ const c = Math.min(n, i + a);
453
+ o.push(e.link_uuids.slice(i, c));
451
454
  }
452
455
  for (let i = 0; i < o.length; i++)
453
456
  (await this.getStories({
454
- per_page: c,
455
- language: e.language,
456
- version: e.version,
457
+ per_page: a,
458
+ language: t.language,
459
+ version: t.version,
457
460
  by_uuids: o[i].join(",")
458
461
  })).data.stories.forEach(
459
- (a) => {
460
- r.push(a);
462
+ (c) => {
463
+ r.push(c);
461
464
  }
462
465
  );
463
466
  } else
464
- r = t.links;
467
+ r = e.links;
465
468
  r.forEach((n) => {
466
469
  this.links[n.uuid] = { ...n, _stopResolving: !0 };
467
470
  });
468
471
  }
469
- async resolveRelations(t, e) {
472
+ async resolveRelations(e, t) {
470
473
  let r = [];
471
- if (t.rel_uuids) {
472
- const n = t.rel_uuids.length, o = [], c = 50;
473
- for (let i = 0; i < n; i += c) {
474
- const a = Math.min(n, i + c);
475
- o.push(t.rel_uuids.slice(i, a));
474
+ if (e.rel_uuids) {
475
+ const n = e.rel_uuids.length, o = [], a = 50;
476
+ for (let i = 0; i < n; i += a) {
477
+ const c = Math.min(n, i + a);
478
+ o.push(e.rel_uuids.slice(i, c));
476
479
  }
477
480
  for (let i = 0; i < o.length; i++)
478
481
  (await this.getStories({
479
- per_page: c,
480
- language: e.language,
481
- version: e.version,
482
+ per_page: a,
483
+ language: t.language,
484
+ version: t.version,
482
485
  by_uuids: o[i].join(",")
483
- })).data.stories.forEach((a) => {
484
- r.push(a);
486
+ })).data.stories.forEach((c) => {
487
+ r.push(c);
485
488
  });
486
489
  } else
487
- r = t.rels;
490
+ r = e.rels;
488
491
  r && r.length > 0 && r.forEach((n) => {
489
492
  this.relations[n.uuid] = { ...n, _stopResolving: !0 };
490
493
  });
491
494
  }
492
- async resolveStories(t, e) {
495
+ async resolveStories(e, t) {
493
496
  var r, n;
494
497
  let o = [];
495
- if (typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (typeof e.resolve_relations == "string" && (o = e.resolve_relations.split(",")), await this.resolveRelations(t, e)), e.resolve_links && ["1", "story", "url"].indexOf(e.resolve_links) > -1 && ((r = t.links) != null && r.length || (n = t.link_uuids) != null && n.length) && await this.resolveLinks(t, e), this.resolveNestedRelations)
496
- for (const c in this.relations)
497
- this.iterateTree(this.relations[c], o);
498
- t.story ? this.iterateTree(t.story, o) : t.stories.forEach((c) => {
499
- this.iterateTree(c, o);
498
+ if (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)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t), this.resolveNestedRelations)
499
+ for (const a in this.relations)
500
+ this.iterateTree(this.relations[a], o);
501
+ e.story ? this.iterateTree(e.story, o) : e.stories.forEach((a) => {
502
+ this.iterateTree(a, o);
500
503
  });
501
504
  }
502
- cacheResponse(t, e, r) {
503
- return new Promise((n, o) => {
504
- const c = this.helpers.stringify({ url: t, params: e }), i = this.cacheProvider();
505
- if (this.cache.clear === "auto" && e.version === "draft" && this.flushCache(), e.version === "published" && t != "/cdn/spaces/me") {
506
- const a = i.get(c);
507
- if (a)
508
- return n(a);
509
- }
505
+ async cacheResponse(e, t, r) {
506
+ const n = this.helpers.stringify({ url: e, params: t }), o = this.cacheProvider();
507
+ if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
508
+ const a = await o.get(n);
509
+ if (a)
510
+ return Promise.resolve(a);
511
+ }
512
+ return new Promise((a, i) => {
510
513
  try {
511
514
  (async () => {
512
- var a;
513
- const l = await this.throttle("get", t, e);
514
- let u = { data: l.data, headers: l.headers };
515
- if ((a = l.headers) != null && a["per-page"] && (u = Object.assign({}, u, {
516
- perPage: l.headers["per-page"] ? parseInt(l.headers["per-page"]) : 0,
517
- total: l.headers["per-page"] ? parseInt(l.headers.total) : 0
518
- })), l.status != 200)
519
- return o(l);
520
- (u.data.story || u.data.stories) && await this.resolveStories(u.data, e), e.version === "published" && t != "/cdn/spaces/me" && i.set(c, u), u.data.cv && e.token && (e.version == "draft" && g[e.token] != u.data.cv && this.flushCache(), g[e.token] = u.data.cv), n(u);
515
+ var c;
516
+ try {
517
+ const l = await this.throttle("get", e, t);
518
+ let u = { data: l.data, headers: l.headers };
519
+ return (c = l.headers) != null && c["per-page"] && (u = Object.assign({}, u, {
520
+ perPage: l.headers["per-page"] ? parseInt(l.headers["per-page"]) : 0,
521
+ total: l.headers["per-page"] ? parseInt(l.headers.total) : 0
522
+ })), l.status != 200 ? i(l) : ((u.data.story || u.data.stories) && await this.resolveStories(u.data, t), t.version === "published" && e != "/cdn/spaces/me" && await o.set(n, u), u.data.cv && t.token && (t.version == "draft" && g[t.token] != u.data.cv && await this.flushCache(), g[t.token] = u.data.cv), a(u));
523
+ } catch (l) {
524
+ return i(l);
525
+ }
521
526
  })();
522
527
  } catch {
523
528
  }
524
529
  });
525
530
  }
526
- throttledRequest(t, e, r) {
527
- return this.client[t](e, r);
531
+ throttledRequest(e, t, r) {
532
+ return this.client[e](t, r);
528
533
  }
529
534
  cacheVersions() {
530
535
  return g;
@@ -532,122 +537,123 @@ class jt {
532
537
  cacheVersion() {
533
538
  return g[this.accessToken];
534
539
  }
535
- setCacheVersion(t) {
536
- this.accessToken && (g[this.accessToken] = t);
540
+ setCacheVersion(e) {
541
+ this.accessToken && (g[this.accessToken] = e);
537
542
  }
538
543
  cacheProvider() {
539
544
  switch (this.cache.type) {
540
545
  case "memory":
541
546
  return {
542
- get(t) {
543
- return b[t];
547
+ get(e) {
548
+ return Promise.resolve(b[e]);
544
549
  },
545
550
  getAll() {
546
- return b;
551
+ return Promise.resolve(b);
547
552
  },
548
- set(t, e) {
549
- b[t] = e;
553
+ set(e, t) {
554
+ return b[e] = t, Promise.resolve(void 0);
550
555
  },
551
556
  flush() {
552
- b = {};
557
+ return b = {}, Promise.resolve(void 0);
553
558
  }
554
559
  };
560
+ case "custom":
561
+ if (this.cache.custom)
562
+ return this.cache.custom;
555
563
  default:
556
564
  return {
557
565
  get() {
566
+ return Promise.resolve(void 0);
558
567
  },
559
568
  getAll() {
569
+ return Promise.resolve(void 0);
560
570
  },
561
571
  set() {
572
+ return Promise.resolve(void 0);
562
573
  },
563
574
  flush() {
575
+ return Promise.resolve(void 0);
564
576
  }
565
577
  };
566
578
  }
567
579
  }
568
- flushCache() {
569
- return this.cacheProvider().flush(), this;
580
+ async flushCache() {
581
+ return await this.cacheProvider().flush(), this;
570
582
  }
571
583
  }
572
- const Wt = (s = {}) => {
573
- const { apiOptions: t } = s;
574
- if (!t.accessToken) {
584
+ const We = (s = {}) => {
585
+ const { apiOptions: e } = s;
586
+ if (!e.accessToken) {
575
587
  console.error(
576
588
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
577
589
  );
578
590
  return;
579
591
  }
580
- return { storyblokApi: new jt(t) };
581
- }, Et = (s) => {
592
+ return { storyblokApi: new Pe(e) };
593
+ }, je = (s) => {
582
594
  if (typeof s != "object" || typeof s._editable > "u")
583
595
  return {};
584
- const t = JSON.parse(
596
+ const e = JSON.parse(
585
597
  s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
586
598
  );
587
599
  return {
588
- "data-blok-c": JSON.stringify(t),
589
- "data-blok-uid": t.id + "-" + t.uid
600
+ "data-blok-c": JSON.stringify(e),
601
+ "data-blok-uid": e.id + "-" + e.uid
590
602
  };
591
603
  };
592
604
  let x;
593
- const St = "https://app.storyblok.com/f/storyblok-v2-latest.js", Xt = (s, t, e = {}) => {
594
- if (!(typeof window > "u")) {
595
- if (typeof window.storyblokRegisterEvent > "u") {
596
- console.error(
597
- "Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js"
598
- );
599
- return;
600
- }
605
+ const Ee = "https://app.storyblok.com/f/storyblok-v2-latest.js", Xe = (s, e, t = {}) => {
606
+ if (!(typeof window > "u") && typeof window.storyblokRegisterEvent < "u") {
601
607
  if (!s) {
602
608
  console.warn("Story ID is not defined. Please provide a valid ID.");
603
609
  return;
604
610
  }
605
611
  window.storyblokRegisterEvent(() => {
606
- new window.StoryblokBridge(e).on(["input", "published", "change"], (r) => {
607
- r.action === "input" && r.story.id === s ? t(r.story) : (r.action === "change" || r.action === "published") && r.storyId === s && window.location.reload();
612
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (r) => {
613
+ r.action === "input" && r.story.id === s ? e(r.story) : (r.action === "change" || r.action === "published") && r.storyId === s && window.location.reload();
608
614
  });
609
615
  });
610
616
  }
611
- }, Pt = (s = {}) => {
617
+ }, Se = (s = {}) => {
612
618
  const {
613
- bridge: t,
614
- accessToken: e,
619
+ bridge: e,
620
+ accessToken: t,
615
621
  use: r = [],
616
622
  apiOptions: n = {},
617
623
  richText: o = {}
618
624
  } = s;
619
- n.accessToken = n.accessToken || e;
620
- const c = { bridge: t, apiOptions: n };
625
+ n.accessToken = n.accessToken || t;
626
+ const a = { bridge: e, apiOptions: n };
621
627
  let i = {};
622
- return r.forEach((a) => {
623
- i = { ...i, ...a(c) };
624
- }), t !== !1 && tt(St), x = new T(o.schema), o.resolver && G(x, o.resolver), i;
625
- }, G = (s, t) => {
626
- s.addNode("blok", (e) => {
628
+ return r.forEach((c) => {
629
+ i = { ...i, ...c(a) };
630
+ }), e !== !1 && ee(Ee), x = new T(o.schema), o.resolver && G(x, o.resolver), i;
631
+ }, G = (s, e) => {
632
+ s.addNode("blok", (t) => {
627
633
  let r = "";
628
- return e.attrs.body.forEach((n) => {
629
- r += t(n.component, n);
634
+ return t.attrs.body.forEach((n) => {
635
+ r += e(n.component, n);
630
636
  }), {
631
637
  html: r
632
638
  };
633
639
  });
634
- }, Zt = (s, t, e) => {
635
- let r = e || x;
640
+ }, Ze = (s, e, t) => {
641
+ let r = t || x;
636
642
  if (!r) {
637
643
  console.error(
638
644
  "Please initialize the Storyblok SDK before calling the renderRichText function"
639
645
  );
640
646
  return;
641
647
  }
642
- return s === "" ? "" : s ? (t && (r = new T(t.schema), t.resolver && G(r, t.resolver)), r.render(s)) : (console.warn(`${s} is not a valid Richtext object. This might be because the value of the richtext field is empty.
648
+ return s === "" ? "" : s ? (e && (r = new T(e.schema), e.resolver && G(r, e.resolver)), r.render(s)) : (console.warn(`${s} is not a valid Richtext object. This might be because the value of the richtext field is empty.
643
649
 
644
650
  For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
645
651
  };
646
- function j() {
652
+ function P() {
647
653
  }
648
- function E(s, t) {
649
- for (const e in t)
650
- s[e] = t[e];
654
+ function j(s, e) {
655
+ for (const t in e)
656
+ s[t] = e[t];
651
657
  return s;
652
658
  }
653
659
  function Q(s) {
@@ -662,53 +668,53 @@ function _(s) {
662
668
  function W(s) {
663
669
  return typeof s == "function";
664
670
  }
665
- function Ot(s, t) {
666
- return s != s ? t == t : s !== t || s && typeof s == "object" || typeof s == "function";
671
+ function Oe(s, e) {
672
+ return s != s ? e == e : s !== e || s && typeof s == "object" || typeof s == "function";
667
673
  }
668
- function Ct(s) {
674
+ function Ce(s) {
669
675
  return Object.keys(s).length === 0;
670
676
  }
671
- function It(s) {
672
- const t = {};
673
- for (const e in s)
674
- e[0] !== "$" && (t[e] = s[e]);
675
- return t;
676
- }
677
- function B(s, t) {
677
+ function Ie(s) {
678
678
  const e = {};
679
- t = new Set(t);
680
- for (const r in s)
681
- !t.has(r) && r[0] !== "$" && (e[r] = s[r]);
679
+ for (const t in s)
680
+ t[0] !== "$" && (e[t] = s[t]);
682
681
  return e;
683
682
  }
684
- function At(s, t, e) {
685
- s.insertBefore(t, e || null);
683
+ function B(s, e) {
684
+ const t = {};
685
+ e = new Set(e);
686
+ for (const r in s)
687
+ !e.has(r) && r[0] !== "$" && (t[r] = s[r]);
688
+ return t;
689
+ }
690
+ function Ae(s, e, t) {
691
+ s.insertBefore(e, t || null);
686
692
  }
687
693
  function X(s) {
688
694
  s.parentNode && s.parentNode.removeChild(s);
689
695
  }
690
- function Nt(s) {
696
+ function Ne(s) {
691
697
  return document.createTextNode(s);
692
698
  }
693
- function Mt() {
694
- return Nt("");
699
+ function Me() {
700
+ return Ne("");
695
701
  }
696
- function Lt(s) {
702
+ function Le(s) {
697
703
  return Array.from(s.childNodes);
698
704
  }
699
- function J(s, t) {
700
- return new s(t);
705
+ function J(s, e) {
706
+ return new s(e);
701
707
  }
702
708
  let N;
703
709
  function k(s) {
704
710
  N = s;
705
711
  }
706
- const y = [], F = [], v = [], V = [], Ut = Promise.resolve();
707
- let S = !1;
708
- function Ht() {
709
- S || (S = !0, Ut.then(Z));
712
+ const y = [], F = [], v = [], V = [], Ue = Promise.resolve();
713
+ let E = !1;
714
+ function He() {
715
+ E || (E = !0, Ue.then(Z));
710
716
  }
711
- function P(s) {
717
+ function S(s) {
712
718
  v.push(s);
713
719
  }
714
720
  const R = /* @__PURE__ */ new Set();
@@ -720,34 +726,34 @@ function Z() {
720
726
  do {
721
727
  try {
722
728
  for (; m < y.length; ) {
723
- const t = y[m];
724
- m++, k(t), qt(t.$$);
729
+ const e = y[m];
730
+ m++, k(e), qe(e.$$);
725
731
  }
726
- } catch (t) {
727
- throw y.length = 0, m = 0, t;
732
+ } catch (e) {
733
+ throw y.length = 0, m = 0, e;
728
734
  }
729
735
  for (k(null), y.length = 0, m = 0; F.length; )
730
736
  F.pop()();
731
- for (let t = 0; t < v.length; t += 1) {
732
- const e = v[t];
733
- R.has(e) || (R.add(e), e());
737
+ for (let e = 0; e < v.length; e += 1) {
738
+ const t = v[e];
739
+ R.has(t) || (R.add(t), t());
734
740
  }
735
741
  v.length = 0;
736
742
  } while (y.length);
737
743
  for (; V.length; )
738
744
  V.pop()();
739
- S = !1, R.clear(), k(s);
745
+ E = !1, R.clear(), k(s);
740
746
  }
741
- function qt(s) {
747
+ function qe(s) {
742
748
  if (s.fragment !== null) {
743
749
  s.update(), _(s.before_update);
744
- const t = s.dirty;
745
- s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, t), s.after_update.forEach(P);
750
+ const e = s.dirty;
751
+ s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, e), s.after_update.forEach(S);
746
752
  }
747
753
  }
748
754
  const w = /* @__PURE__ */ new Set();
749
755
  let f;
750
- function Dt() {
756
+ function De() {
751
757
  f = {
752
758
  r: 0,
753
759
  c: [],
@@ -755,70 +761,70 @@ function Dt() {
755
761
  // parent group
756
762
  };
757
763
  }
758
- function Bt() {
764
+ function Be() {
759
765
  f.r || _(f.c), f = f.p;
760
766
  }
761
- function O(s, t) {
762
- s && s.i && (w.delete(s), s.i(t));
767
+ function O(s, e) {
768
+ s && s.i && (w.delete(s), s.i(e));
763
769
  }
764
- function Y(s, t, e, r) {
770
+ function Y(s, e, t, r) {
765
771
  if (s && s.o) {
766
772
  if (w.has(s))
767
773
  return;
768
774
  w.add(s), f.c.push(() => {
769
- w.delete(s), r && (e && s.d(1), r());
770
- }), s.o(t);
775
+ w.delete(s), r && (t && s.d(1), r());
776
+ }), s.o(e);
771
777
  } else
772
778
  r && r();
773
779
  }
774
- function Jt(s, t) {
775
- const e = {}, r = {}, n = { $$scope: 1 };
780
+ function Je(s, e) {
781
+ const t = {}, r = {}, n = { $$scope: 1 };
776
782
  let o = s.length;
777
783
  for (; o--; ) {
778
- const c = s[o], i = t[o];
784
+ const a = s[o], i = e[o];
779
785
  if (i) {
780
- for (const a in c)
781
- a in i || (r[a] = 1);
782
- for (const a in i)
783
- n[a] || (e[a] = i[a], n[a] = 1);
786
+ for (const c in a)
787
+ c in i || (r[c] = 1);
788
+ for (const c in i)
789
+ n[c] || (t[c] = i[c], n[c] = 1);
784
790
  s[o] = i;
785
791
  } else
786
- for (const a in c)
787
- n[a] = 1;
792
+ for (const c in a)
793
+ n[c] = 1;
788
794
  }
789
- for (const c in r)
790
- c in e || (e[c] = void 0);
791
- return e;
795
+ for (const a in r)
796
+ a in t || (t[a] = void 0);
797
+ return t;
792
798
  }
793
- function Ft(s) {
799
+ function Fe(s) {
794
800
  return typeof s == "object" && s !== null ? s : {};
795
801
  }
796
802
  function z(s) {
797
803
  s && s.c();
798
804
  }
799
- function C(s, t, e, r) {
805
+ function C(s, e, t, r) {
800
806
  const { fragment: n, after_update: o } = s.$$;
801
- n && n.m(t, e), r || P(() => {
802
- const c = s.$$.on_mount.map(Q).filter(W);
803
- s.$$.on_destroy ? s.$$.on_destroy.push(...c) : _(c), s.$$.on_mount = [];
804
- }), o.forEach(P);
807
+ n && n.m(e, t), r || S(() => {
808
+ const a = s.$$.on_mount.map(Q).filter(W);
809
+ s.$$.on_destroy ? s.$$.on_destroy.push(...a) : _(a), s.$$.on_mount = [];
810
+ }), o.forEach(S);
805
811
  }
806
- function I(s, t) {
807
- const e = s.$$;
808
- e.fragment !== null && (_(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
812
+ function I(s, e) {
813
+ const t = s.$$;
814
+ t.fragment !== null && (_(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
809
815
  }
810
- function Vt(s, t) {
811
- s.$$.dirty[0] === -1 && (y.push(s), Ht(), s.$$.dirty.fill(0)), s.$$.dirty[t / 31 | 0] |= 1 << t % 31;
816
+ function Ve(s, e) {
817
+ s.$$.dirty[0] === -1 && (y.push(s), He(), s.$$.dirty.fill(0)), s.$$.dirty[e / 31 | 0] |= 1 << e % 31;
812
818
  }
813
- function Yt(s, t, e, r, n, o, c, i = [-1]) {
814
- const a = N;
819
+ function Ye(s, e, t, r, n, o, a, i = [-1]) {
820
+ const c = N;
815
821
  k(s);
816
822
  const l = s.$$ = {
817
823
  fragment: null,
818
824
  ctx: [],
819
825
  // state
820
826
  props: o,
821
- update: j,
827
+ update: P,
822
828
  not_equal: n,
823
829
  bound: D(),
824
830
  // lifecycle
@@ -827,47 +833,47 @@ function Yt(s, t, e, r, n, o, c, i = [-1]) {
827
833
  on_disconnect: [],
828
834
  before_update: [],
829
835
  after_update: [],
830
- context: new Map(t.context || (a ? a.$$.context : [])),
836
+ context: new Map(e.context || (c ? c.$$.context : [])),
831
837
  // everything else
832
838
  callbacks: D(),
833
839
  dirty: i,
834
840
  skip_bound: !1,
835
- root: t.target || a.$$.root
841
+ root: e.target || c.$$.root
836
842
  };
837
- c && c(l.root);
843
+ a && a(l.root);
838
844
  let u = !1;
839
- if (l.ctx = e ? e(s, t.props || {}, (d, p, ...M) => {
845
+ if (l.ctx = t ? t(s, e.props || {}, (d, p, ...M) => {
840
846
  const L = M.length ? M[0] : p;
841
- return l.ctx && n(l.ctx[d], l.ctx[d] = L) && (!l.skip_bound && l.bound[d] && l.bound[d](L), u && Vt(s, d)), p;
842
- }) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, t.target) {
843
- if (t.hydrate) {
844
- const d = Lt(t.target);
847
+ return l.ctx && n(l.ctx[d], l.ctx[d] = L) && (!l.skip_bound && l.bound[d] && l.bound[d](L), u && Ve(s, d)), p;
848
+ }) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, e.target) {
849
+ if (e.hydrate) {
850
+ const d = Le(e.target);
845
851
  l.fragment && l.fragment.l(d), d.forEach(X);
846
852
  } else
847
853
  l.fragment && l.fragment.c();
848
- t.intro && O(s.$$.fragment), C(s, t.target, t.anchor, t.customElement), Z();
854
+ e.intro && O(s.$$.fragment), C(s, e.target, e.anchor, e.customElement), Z();
849
855
  }
850
- k(a);
856
+ k(c);
851
857
  }
852
- class zt {
858
+ class ze {
853
859
  $destroy() {
854
- I(this, 1), this.$destroy = j;
855
- }
856
- $on(t, e) {
857
- if (!W(e))
858
- return j;
859
- const r = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
860
- return r.push(e), () => {
861
- const n = r.indexOf(e);
860
+ I(this, 1), this.$destroy = P;
861
+ }
862
+ $on(e, t) {
863
+ if (!W(t))
864
+ return P;
865
+ const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
866
+ return r.push(t), () => {
867
+ const n = r.indexOf(t);
862
868
  n !== -1 && r.splice(n, 1);
863
869
  };
864
870
  }
865
- $set(t) {
866
- this.$$set && !Ct(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
871
+ $set(e) {
872
+ this.$$set && !Ce(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
867
873
  }
868
874
  }
869
- function Kt(s) {
870
- let t, e, r;
875
+ function Ke(s) {
876
+ let e, t, r;
871
877
  const n = [
872
878
  { blok: (
873
879
  /*blok*/
@@ -880,108 +886,108 @@ function Kt(s) {
880
886
  /*component*/
881
887
  s[1]
882
888
  );
883
- function c(i) {
884
- let a = {};
889
+ function a(i) {
890
+ let c = {};
885
891
  for (let l = 0; l < n.length; l += 1)
886
- a = E(a, n[l]);
887
- return { props: a };
892
+ c = j(c, n[l]);
893
+ return { props: c };
888
894
  }
889
- return o && (t = J(o, c())), {
895
+ return o && (e = J(o, a())), {
890
896
  c() {
891
- t && z(t.$$.fragment), e = Mt();
897
+ e && z(e.$$.fragment), t = Me();
892
898
  },
893
- m(i, a) {
894
- t && C(t, i, a), At(i, e, a), r = !0;
899
+ m(i, c) {
900
+ e && C(e, i, c), Ae(i, t, c), r = !0;
895
901
  },
896
- p(i, [a]) {
897
- const l = a & /*blok, $$restProps*/
898
- 5 ? Jt(n, [
899
- a & /*blok*/
902
+ p(i, [c]) {
903
+ const l = c & /*blok, $$restProps*/
904
+ 5 ? Je(n, [
905
+ c & /*blok*/
900
906
  1 && { blok: (
901
907
  /*blok*/
902
908
  i[0]
903
909
  ) },
904
- a & /*$$restProps*/
905
- 4 && Ft(
910
+ c & /*$$restProps*/
911
+ 4 && Fe(
906
912
  /*$$restProps*/
907
913
  i[2]
908
914
  )
909
915
  ]) : {};
910
916
  if (o !== (o = /*component*/
911
917
  i[1])) {
912
- if (t) {
913
- Dt();
914
- const u = t;
918
+ if (e) {
919
+ De();
920
+ const u = e;
915
921
  Y(u.$$.fragment, 1, 0, () => {
916
922
  I(u, 1);
917
- }), Bt();
923
+ }), Be();
918
924
  }
919
- o ? (t = J(o, c()), z(t.$$.fragment), O(t.$$.fragment, 1), C(t, e.parentNode, e)) : t = null;
925
+ o ? (e = J(o, a()), z(e.$$.fragment), O(e.$$.fragment, 1), C(e, t.parentNode, t)) : e = null;
920
926
  } else
921
- o && t.$set(l);
927
+ o && e.$set(l);
922
928
  },
923
929
  i(i) {
924
- r || (t && O(t.$$.fragment, i), r = !0);
930
+ r || (e && O(e.$$.fragment, i), r = !0);
925
931
  },
926
932
  o(i) {
927
- t && Y(t.$$.fragment, i), r = !1;
933
+ e && Y(e.$$.fragment, i), r = !1;
928
934
  },
929
935
  d(i) {
930
- i && X(e), t && I(t, i);
936
+ i && X(t), e && I(e, i);
931
937
  }
932
938
  };
933
939
  }
934
- function Gt(s, t, e) {
940
+ function Ge(s, e, t) {
935
941
  const r = ["blok"];
936
- let n = B(t, r), o, { blok: c } = t;
937
- return c ? o = Qt(c.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (i) => {
938
- t = E(E({}, t), It(i)), e(2, n = B(t, r)), "blok" in i && e(0, c = i.blok);
939
- }, [c, o, n];
942
+ let n = B(e, r), o, { blok: a } = e;
943
+ return a ? o = Qe(a.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (i) => {
944
+ e = j(j({}, e), Ie(i)), t(2, n = B(e, r)), "blok" in i && t(0, a = i.blok);
945
+ }, [a, o, n];
940
946
  }
941
- class te extends zt {
942
- constructor(t) {
943
- super(), Yt(this, t, Gt, Kt, Ot, { blok: 0 });
947
+ class et extends ze {
948
+ constructor(e) {
949
+ super(), Ye(this, e, Ge, Ke, Oe, { blok: 0 });
944
950
  }
945
951
  }
946
- const ee = (s, t) => {
947
- const e = (r) => {
948
- const n = Et(r);
952
+ const tt = (s, e) => {
953
+ const t = (r) => {
954
+ const n = je(r);
949
955
  n["data-blok-c"] && (s.setAttribute("data-blok-c", n["data-blok-c"]), s.setAttribute("data-blok-uid", n["data-blok-uid"]), s.classList.add("storyblok__outline"));
950
956
  };
951
- return e(t), {
957
+ return t(e), {
952
958
  update(r) {
953
- e(r);
959
+ t(r);
954
960
  }
955
961
  };
956
962
  };
957
963
  let A = null;
958
- const se = () => (A || console.log(
964
+ const st = () => (A || console.log(
959
965
  "You can't use getStoryblokApi if you're not loading apiPlugin."
960
966
  ), A);
961
967
  let $ = null;
962
- const re = (s) => {
963
- const { storyblokApi: t } = Pt(s);
964
- A = t, $ = s.components || {};
965
- }, Qt = (s) => {
966
- let t = null;
967
- return t = typeof $ == "function" ? $()[s] : $[s], t || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
968
+ const rt = (s) => {
969
+ const { storyblokApi: e } = Se(s);
970
+ A = e, $ = s.components || {};
971
+ }, Qe = (s) => {
972
+ let e = null;
973
+ return e = typeof $ == "function" ? $()[s] : $[s], e || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
968
974
  storyblokInit({
969
975
  accessToken: "<your-token>",
970
976
  components: {
971
977
  "teaser": Teaser
972
978
  }
973
979
  })
974
- `), t;
980
+ `), e;
975
981
  };
976
982
  export {
977
- Tt as RichTextSchema,
978
- te as StoryblokComponent,
979
- Wt as apiPlugin,
980
- Qt as getComponent,
981
- se as getStoryblokApi,
982
- Zt as renderRichText,
983
- ee as storyblokEditable,
984
- re as storyblokInit,
985
- se as useStoryblokApi,
986
- Xt as useStoryblokBridge
983
+ Te as RichTextSchema,
984
+ et as StoryblokComponent,
985
+ We as apiPlugin,
986
+ Qe as getComponent,
987
+ st as getStoryblokApi,
988
+ Ze as renderRichText,
989
+ tt as storyblokEditable,
990
+ rt as storyblokInit,
991
+ st as useStoryblokApi,
992
+ Xe as useStoryblokBridge
987
993
  };