@storyblok/astro 7.3.4 → 7.3.6

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,15 +1,15 @@
1
- const de = `
1
+ const be = `
2
2
  <svg class="logo-storyblok logo-storyblok--dark" role="img" aria-label="Storyblok Official Logo" viewBox="0 0 19 22" xmlns="http://www.w3.org/2000/svg">
3
3
  <path d="M29.0287 14.9132C28.2686 14.9132 27.5302 14.8018 26.7918 14.5568C26.0988 14.3265 25.462 13.9468 24.924 13.4432L25.9013 11.7504C26.4443 12.1291 26.9655 12.4186 27.4867 12.6414C27.9862 12.8641 28.4858 12.9532 28.9636 12.9532C29.3111 12.9532 29.5934 12.8864 29.7888 12.7527C29.9843 12.6414 30.0712 12.4409 30.0712 12.1959C30.0712 11.9732 29.9626 11.7504 29.702 11.6168C29.2938 11.4162 28.8636 11.2666 28.4206 11.1714L26.9003 10.6591C26.4877 10.4809 26.1619 10.3027 25.9013 10.1023C25.6407 9.92408 25.4452 9.67908 25.3366 9.43408C25.2184 9.1529 25.1592 8.84935 25.1629 8.54317C25.1502 7.66646 25.5255 6.83107 26.1836 6.27136C26.4877 6.00408 26.8786 5.80363 27.313 5.64772C27.7473 5.49181 28.2251 5.42499 28.7247 5.42499C29.3979 5.42499 30.0277 5.51408 30.6141 5.69226C31.2005 5.89272 31.7652 6.22681 32.3081 6.71681L31.244 8.38726C30.8236 8.07881 30.3722 7.81747 29.8974 7.60772C29.4848 7.42954 29.1156 7.36272 28.7247 7.36272C28.4423 7.36272 28.1817 7.40726 27.9862 7.5409C27.7691 7.65226 27.6822 7.85272 27.6822 8.11999C27.6822 8.38726 27.7908 8.56545 28.008 8.69908C28.2251 8.83272 28.6595 8.96635 29.2459 9.12226C29.7903 9.26289 30.3268 9.4339 30.853 9.63454C31.2874 9.81272 31.6349 10.0132 31.9172 10.2136C32.4511 10.6169 32.7463 11.2726 32.6991 11.9509C32.6991 12.8641 32.3733 13.5768 31.7 14.1114C31.0485 14.6459 30.1798 14.9132 29.0287 14.9132ZM39.7792 14.2673C39.41 14.4232 38.9756 14.5791 38.4978 14.7127C38.02 14.8464 37.5422 14.9354 37.0427 14.9354C36.6952 14.9354 36.3911 14.8909 36.0871 14.8018C35.7915 14.7134 35.5176 14.5616 35.2835 14.3564C35.0663 14.1782 34.8926 13.9109 34.7623 13.6214C34.632 13.3095 34.5451 12.9309 34.5451 12.4854V7.69681H33.4158V5.60317H34.5668V2.68545H37.2599V5.5809H39.0842V7.69681H37.2599V11.5277C37.2599 11.8173 37.325 12.04 37.4771 12.1959C37.6291 12.3073 37.8245 12.3741 38.0417 12.3741C38.2589 12.3741 38.4761 12.3518 38.6715 12.2627C38.8887 12.1959 39.0842 12.1291 39.2362 12.04L39.7575 14.2673H39.7792ZM44.8612 14.9132C44.1701 14.9255 43.4835 14.7968 42.8414 14.5345C41.7112 14.076 40.8261 13.1439 40.409 11.9732C39.9823 10.8102 39.9823 9.52792 40.409 8.36499C40.8261 7.19423 41.7112 6.26214 42.8414 5.80363C43.4278 5.55863 44.1011 5.42499 44.8612 5.42499C46.1833 5.36117 47.4671 5.88947 48.3795 6.87272C48.7922 7.2959 49.0962 7.80817 49.3134 8.36499C49.758 9.5322 49.758 10.8282 49.3134 11.9954C48.8937 13.1518 48.0186 14.0734 46.9027 14.5345C46.2538 14.7998 45.5596 14.9285 44.8612 14.9132ZM42.9066 10.1914C42.9066 10.9041 43.0803 11.4832 43.4495 11.9064C43.8405 12.3518 44.3183 12.5745 44.8829 12.5745C45.4284 12.5853 45.9487 12.3391 46.2946 11.9064C46.4683 11.6836 46.5987 11.4609 46.7072 11.1491C46.8158 10.8595 46.8593 10.5254 46.8593 10.1914C46.8593 9.45636 46.6638 8.87726 46.2946 8.45408C45.9254 8.00863 45.4476 7.78589 44.8829 7.78589C44.3394 7.78464 43.8229 8.02909 43.4712 8.45408C43.2975 8.67681 43.1455 8.89954 43.0369 9.21136C42.939 9.52794 42.8949 9.85944 42.9066 10.1914ZM56.6541 7.98636C56.0026 7.98636 55.3945 8.09772 54.8515 8.32045C54.3736 8.48572 53.9666 8.81646 53.7005 9.2559V14.7573H50.9857V5.60317H53.4833V7.42954C53.7873 6.8059 54.1783 6.3159 54.6778 5.98181C55.1556 5.62545 55.6551 5.44726 56.1981 5.42499H56.4804L56.6541 5.44726V7.96408V7.98636ZM57.8486 16.1159C58.2263 16.2505 58.6217 16.3256 59.0214 16.3386C59.3472 16.3386 59.6078 16.2273 59.8033 16.0045C59.977 15.7818 60.129 15.3364 60.2811 14.7573L56.893 5.60317H59.6947L61.7579 12.3518L63.5605 5.60317H66.1015L62.6918 16.2273C62.1569 18.0318 60.3638 19.1157 58.5653 18.7218C58.3481 18.6773 58.0875 18.6104 57.8486 18.4991V16.1159ZM72.5301 14.9133C71.8568 14.9133 71.2487 14.7795 70.7492 14.4677C70.2417 14.1818 69.8208 13.758 69.533 13.2427V14.7573H67.1657V2.01727H69.9022V7.09545C70.4962 6.02938 71.6157 5.38681 72.8124 5.42499C73.3771 5.42499 73.8983 5.53636 74.3761 5.80363C74.8539 6.02636 75.2448 6.38272 75.614 6.8059C76.6831 8.32739 76.974 10.2831 76.3959 12.0623C76.1787 12.6414 75.8746 13.1536 75.5054 13.5768C74.7429 14.4342 73.6616 14.9198 72.5301 14.9133ZM71.7699 12.5745C72.6515 12.5764 73.4369 12.0037 73.7245 11.1491C74.043 10.2518 73.887 9.24956 73.3119 8.49863C72.9724 8.0401 72.4398 7.7753 71.8785 7.7859C71.4659 7.7859 71.0749 7.94181 70.7057 8.23136C70.3582 8.54317 70.0759 8.92181 69.8805 9.38954V11.305C70.2309 12.0628 70.9738 12.5476 71.7916 12.5523L71.7699 12.5745ZM78.0247 2.01727H80.7395V11.4832C80.7395 12.1959 81.0218 12.53 81.6082 12.53C81.9183 12.5309 82.2239 12.4545 82.4987 12.3073L82.8679 14.3786C82.1072 14.7203 81.2875 14.902 80.4572 14.9132C79.6753 14.9132 79.0672 14.6904 78.6546 14.2895C78.2202 13.8441 78.003 13.265 78.003 12.4632V2.01727H78.0247ZM87.9933 14.9132C87.3023 14.9255 86.6157 14.7968 85.9736 14.5345C84.8367 14.0789 83.9437 13.1469 83.5194 11.9732C82.8914 10.2226 83.2408 8.26037 84.4316 6.85045C84.8659 6.40499 85.3437 6.0709 85.9518 5.80363C86.5382 5.55863 87.2115 5.42499 87.9716 5.42499C89.2937 5.36117 90.5776 5.88947 91.49 6.87272C91.9243 7.2959 92.2066 7.80817 92.4238 8.36499C93.0767 10.1133 92.7249 12.0889 91.5117 13.4877C91.099 13.9332 90.5995 14.2895 89.9914 14.5345C89.3493 14.7968 88.6627 14.9255 87.9716 14.9132H87.9933ZM86.017 10.1914C86.017 10.9041 86.1907 11.4832 86.5599 11.9064C86.9509 12.3518 87.4287 12.5745 87.9933 12.5745C88.5382 12.5821 89.0571 12.3364 89.405 11.9064C89.5788 11.6836 89.7091 11.4609 89.8177 11.1491C89.9262 10.8595 89.9697 10.5254 89.9697 10.1914C89.9697 9.45636 89.7742 8.87726 89.405 8.45408C89.0358 8.00863 88.558 7.78589 87.9933 7.78589C87.4498 7.78464 86.9334 8.02909 86.5817 8.45408C86.4079 8.67681 86.2559 8.89954 86.1473 9.21136C86.0387 9.52317 86.017 9.83499 86.017 10.1914ZM100.112 14.7573L97.7882 11.06L96.8326 12.0845V14.7573H94.1178V2.01727H96.8326V9.38954L99.8514 5.60317H102.74L99.5256 9.54545L103.001 14.7573H100.112Z" fill="currentColor"></path>
4
4
  <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.71089C0 0.76599 0.76599 0 1.71089 0H17.1089C18.0538 0 18.8198 0.76599 18.8198 1.71089V17.1089C18.8198 18.0538 18.0538 18.8198 17.1089 18.8198H7.13145L4.57616 20.9297C4.24445 21.2036 3.74366 20.9676 3.74366 20.5375V18.8198H1.71089C0.76599 18.8198 0 18.0538 0 17.1089V1.71089ZM3.74233 3.10946H11.9675C13.7438 3.10946 15.1839 4.5495 15.1839 6.32587C15.1839 7.74936 14.2592 8.95687 12.9777 9.38045C14.4761 9.65447 15.6117 10.9667 15.6117 12.5443C15.6117 14.3207 14.1717 15.7607 12.3953 15.7607H3.74247V9.54229H3.74233V3.10946ZM10.583 6.00384H6.73607V7.93369H10.583C11.1159 7.93369 11.5479 7.50168 11.5479 6.96877C11.5479 6.43585 11.1159 6.00384 10.583 6.00384ZM6.73607 10.2925H10.9035C11.4956 10.2925 11.9757 10.7725 11.9757 11.3647C11.9757 11.9568 11.4956 12.4368 10.9035 12.4368H6.73607V10.2925Z" fill="currentColor"></path>
5
5
  </svg>
6
6
  `;
7
- function pe(e, t, r) {
8
- const s = "virtual:storyblok-init", o = `\0${s}`;
7
+ function Ce(e, t, s) {
8
+ const r = "virtual:storyblok-init", o = `\0${r}`;
9
9
  return {
10
10
  name: "vite-plugin-storyblok-init",
11
11
  async resolveId(n) {
12
- if (n === s)
12
+ if (n === r)
13
13
  return o;
14
14
  },
15
15
  async load(n) {
@@ -19,54 +19,54 @@ function pe(e, t, r) {
19
19
  const { storyblokApi } = storyblokInit({
20
20
  accessToken: "${e}",
21
21
  use: ${t ? "[]" : "[apiPlugin]"},
22
- apiOptions: ${JSON.stringify(r)},
22
+ apiOptions: ${JSON.stringify(s)},
23
23
  });
24
24
  export const storyblokApiInstance = storyblokApi;
25
25
  `;
26
26
  }
27
27
  };
28
28
  }
29
- function fe(e) {
30
- const t = "virtual:storyblok-options", r = `\0${t}`;
29
+ function ve(e) {
30
+ const t = "virtual:storyblok-options", s = `\0${t}`;
31
31
  return {
32
32
  name: "vite-plugin-storyblok-options",
33
- async resolveId(s) {
34
- if (s === t)
35
- return r;
33
+ async resolveId(r) {
34
+ if (r === t)
35
+ return s;
36
36
  },
37
- async load(s) {
38
- if (s === r)
37
+ async load(r) {
38
+ if (r === s)
39
39
  return `export default ${JSON.stringify(e)}`;
40
40
  }
41
41
  };
42
42
  }
43
- function et() {
43
+ function dt() {
44
44
  if (!(globalThis != null && globalThis.storyblokApiInstance))
45
45
  throw new Error("storyblokApiInstance has not been initialized correctly");
46
46
  return globalThis.storyblokApiInstance;
47
47
  }
48
- async function tt(e) {
48
+ async function pt(e) {
49
49
  let t = null;
50
50
  return e && e.locals._storyblok_preview_data && (t = e.locals._storyblok_preview_data), t;
51
51
  }
52
- function me(e) {
52
+ function ke(e) {
53
53
  return typeof e == "object" ? `const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});` : "const storyblokInstance = new StoryblokBridge();";
54
54
  }
55
- function ye(e) {
55
+ function we(e) {
56
56
  return e.endsWith(".astro") ? e : `${e}.astro`;
57
57
  }
58
- function N(e) {
58
+ function B(e) {
59
59
  return `/${e.trim().replace(/^\/+/, "").replace(/\/+$/, "").replace(/\/{2,}/g, "/")}`;
60
60
  }
61
- const be = /[\p{Lu}]/u, ge = /[\p{Ll}]/u, z = /^[\p{Lu}](?![\p{Lu}])/gu, te = /([\p{Alpha}\p{N}_]|$)/u, D = /[_.\- ]+/, Ce = new RegExp("^" + D.source), Z = new RegExp(D.source + te.source, "gu"), G = new RegExp("\\d+" + te.source, "gu"), ve = (e, t, r, s) => {
62
- let o = !1, n = !1, i = !1, l = !1;
61
+ const Le = /[\p{Lu}]/u, Ae = /[\p{Ll}]/u, W = /^[\p{Lu}](?![\p{Lu}])/gu, ie = /([\p{Alpha}\p{N}_]|$)/u, q = /[_.\- ]+/, Ee = new RegExp("^" + q.source), Y = new RegExp(q.source + ie.source, "gu"), K = new RegExp("\\d+" + ie.source, "gu"), Re = (e, t, s, r) => {
62
+ let o = !1, n = !1, l = !1, i = !1;
63
63
  for (let c = 0; c < e.length; c++) {
64
64
  const u = e[c];
65
- l = c > 2 ? e[c - 3] === "-" : !0, o && be.test(u) ? (e = e.slice(0, c) + "-" + e.slice(c), o = !1, i = n, n = !0, c++) : n && i && ge.test(u) && (!l || s) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), i = n, n = !1, o = !0) : (o = t(u) === u && r(u) !== u, i = n, n = r(u) === u && t(u) !== u);
65
+ i = c > 2 ? e[c - 3] === "-" : !0, o && Le.test(u) ? (e = e.slice(0, c) + "-" + e.slice(c), o = !1, l = n, n = !0, c++) : n && l && Ae.test(u) && (!i || r) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), l = n, n = !1, o = !0) : (o = t(u) === u && s(u) !== u, l = n, n = s(u) === u && t(u) !== u);
66
66
  }
67
67
  return e;
68
- }, ke = (e, t) => (z.lastIndex = 0, e.replaceAll(z, (r) => t(r))), we = (e, t) => (Z.lastIndex = 0, G.lastIndex = 0, e.replaceAll(G, (r, s, o) => ["_", "-"].includes(e.charAt(o + r.length)) ? r : t(r)).replaceAll(Z, (r, s) => t(s)));
69
- function Ae(e, t) {
68
+ }, _e = (e, t) => (W.lastIndex = 0, e.replaceAll(W, (s) => t(s))), Te = (e, t) => (Y.lastIndex = 0, K.lastIndex = 0, e.replaceAll(K, (s, r, o) => ["_", "-"].includes(e.charAt(o + s.length)) ? s : t(s)).replaceAll(Y, (s, r) => t(r)));
69
+ function $e(e, t) {
70
70
  if (!(typeof e == "string" || Array.isArray(e)))
71
71
  throw new TypeError("Expected the input to be `string | string[]`");
72
72
  if (t = {
@@ -75,55 +75,55 @@ function Ae(e, t) {
75
75
  ...t
76
76
  }, Array.isArray(e) ? e = e.map((n) => n.trim()).filter((n) => n.length).join("-") : e = e.trim(), e.length === 0)
77
77
  return "";
78
- const r = t.locale === !1 ? (n) => n.toLowerCase() : (n) => n.toLocaleLowerCase(t.locale), s = t.locale === !1 ? (n) => n.toUpperCase() : (n) => n.toLocaleUpperCase(t.locale);
79
- return e.length === 1 ? D.test(e) ? "" : t.pascalCase ? s(e) : r(e) : (e !== r(e) && (e = ve(e, r, s, t.preserveConsecutiveUppercase)), e = e.replace(Ce, ""), e = t.preserveConsecutiveUppercase ? ke(e, r) : r(e), t.pascalCase && (e = s(e.charAt(0)) + e.slice(1)), we(e, s));
78
+ const s = t.locale === !1 ? (n) => n.toLowerCase() : (n) => n.toLocaleLowerCase(t.locale), r = t.locale === !1 ? (n) => n.toUpperCase() : (n) => n.toLocaleUpperCase(t.locale);
79
+ return e.length === 1 ? q.test(e) ? "" : t.pascalCase ? r(e) : s(e) : (e !== s(e) && (e = Re(e, s, r, t.preserveConsecutiveUppercase)), e = e.replace(Ee, ""), e = t.preserveConsecutiveUppercase ? _e(e, s) : s(e), t.pascalCase && (e = r(e.charAt(0)) + e.slice(1)), Te(e, r));
80
80
  }
81
- function $e(e) {
82
- return Ae(e);
81
+ function Se(e) {
82
+ return $e(e);
83
83
  }
84
- function Te(e, t, r, s) {
84
+ function Ie(e, t, s, r) {
85
85
  const o = "virtual:import-storyblok-components", n = `\0${o}`;
86
86
  return {
87
87
  name: "vite-plugin-import-storyblok-components",
88
88
  /**
89
89
  * Resolves virtual module imports
90
90
  */
91
- async resolveId(i) {
92
- if (i === o)
91
+ async resolveId(l) {
92
+ if (l === o)
93
93
  return n;
94
94
  },
95
95
  /**
96
96
  * Generates the virtual module content with dynamic imports
97
97
  */
98
- async load(i) {
99
- if (i !== n)
98
+ async load(l) {
99
+ if (l !== n)
100
100
  return;
101
- const l = await Le(
101
+ const i = await xe(
102
102
  this,
103
103
  t,
104
- r,
105
- s
106
- ), c = await _e(
104
+ s,
105
+ r
106
+ ), c = await Me(
107
107
  this,
108
108
  e,
109
109
  t,
110
- r
110
+ s
111
111
  );
112
- return Ee(
112
+ return Oe(
113
113
  t,
114
- l,
114
+ i,
115
115
  c
116
116
  );
117
117
  }
118
118
  };
119
119
  }
120
- function Ee(e, t, r) {
121
- const o = `${N(e)}/storyblok/**/*.astro`;
120
+ function Oe(e, t, s) {
121
+ const o = `${B(e)}/storyblok/**/*.astro`;
122
122
  return `
123
123
  // Import utilities and fallback component
124
124
  import { toCamelCase } from '@storyblok/astro';
125
125
  ${t}
126
- ${r.join(`
126
+ ${s.join(`
127
127
  `)}
128
128
 
129
129
  // Dynamically import all Storyblok components using Vite's glob import
@@ -147,10 +147,10 @@ function Ee(e, t, r) {
147
147
  }
148
148
 
149
149
  // Manual imports (overwrite auto if same key exists)
150
- ${r.map((n) => {
151
- var l;
152
- const i = (l = n.match(/import\s+(\w+)\s+from/)) == null ? void 0 : l[1];
153
- return `storyblokComponents['${i}'] = ${i};`;
150
+ ${s.map((n) => {
151
+ var i;
152
+ const l = (i = n.match(/import\s+(\w+)\s+from/)) == null ? void 0 : i[1];
153
+ return `storyblokComponents['${l}'] = ${l};`;
154
154
  }).join(`
155
155
  `)}
156
156
 
@@ -161,13 +161,13 @@ function Ee(e, t, r) {
161
161
  export { storyblokComponents };
162
162
  `.trim();
163
163
  }
164
- async function Le(e, t, r, s) {
165
- if (!r)
164
+ async function xe(e, t, s, r) {
165
+ if (!s)
166
166
  return "";
167
- if (s) {
168
- const o = re(
167
+ if (r) {
168
+ const o = ae(
169
169
  t,
170
- s
170
+ r
171
171
  );
172
172
  if (!await e.resolve(o))
173
173
  throw new Error(
@@ -177,24 +177,24 @@ async function Le(e, t, r, s) {
177
177
  }
178
178
  return "import FallbackComponent from '@storyblok/astro/FallbackComponent.astro';";
179
179
  }
180
- async function _e(e, t, r, s) {
180
+ async function Me(e, t, s, r) {
181
181
  const o = [];
182
- for await (const [n, i] of Object.entries(t)) {
183
- const l = re(r, i), c = await e.resolve(l);
182
+ for await (const [n, l] of Object.entries(t)) {
183
+ const i = ae(s, l), c = await e.resolve(i);
184
184
  if (c)
185
- o.push(`import ${$e(n)} from "${c.id}"`);
186
- else if (!s)
185
+ o.push(`import ${Se(n)} from "${c.id}"`);
186
+ else if (!r)
187
187
  throw new Error(
188
- `Component could not be found for blok "${n}"! Does "${l}" exist?`
188
+ `Component could not be found for blok "${n}"! Does "${i}" exist?`
189
189
  );
190
190
  }
191
191
  return o;
192
192
  }
193
- function re(e, t) {
194
- const s = `${N(e)}${N(t)}`;
195
- return ye(s);
193
+ function ae(e, t) {
194
+ const r = `${B(e)}${B(t)}`;
195
+ return we(r);
196
196
  }
197
- function rt(e) {
197
+ function ft(e) {
198
198
  const t = {
199
199
  useCustomApi: !1,
200
200
  bridge: !0,
@@ -203,55 +203,55 @@ function rt(e) {
203
203
  livePreview: !1,
204
204
  ...e
205
205
  }, {
206
- accessToken: r,
207
- useCustomApi: s,
206
+ accessToken: s,
207
+ useCustomApi: r,
208
208
  apiOptions: o,
209
209
  componentsDir: n,
210
- customFallbackComponent: i,
211
- enableFallbackComponent: l,
210
+ customFallbackComponent: l,
211
+ enableFallbackComponent: i,
212
212
  components: c,
213
213
  bridge: u,
214
- livePreview: f
215
- } = t, m = me(t.bridge);
214
+ livePreview: d
215
+ } = t, p = ke(t.bridge);
216
216
  return {
217
217
  name: "@storyblok/astro",
218
218
  hooks: {
219
219
  "astro:config:setup": ({
220
- injectScript: A,
220
+ injectScript: L,
221
221
  updateConfig: _,
222
- addDevToolbarApp: w,
223
- addMiddleware: L,
224
- config: S
222
+ addDevToolbarApp: v,
223
+ addMiddleware: T,
224
+ config: $
225
225
  }) => {
226
226
  if (_({
227
227
  vite: {
228
228
  plugins: [
229
- pe(r, s, o),
230
- Te(
229
+ Ce(s, r, o),
230
+ Ie(
231
231
  c || {},
232
232
  n,
233
- l,
234
- i
233
+ i,
234
+ l
235
235
  ),
236
- fe(t)
236
+ ve(t)
237
237
  ]
238
238
  }
239
- }), f && (S == null ? void 0 : S.output) !== "server")
239
+ }), d && ($ == null ? void 0 : $.output) !== "server")
240
240
  throw new Error(
241
241
  "To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode."
242
242
  );
243
- A(
243
+ L(
244
244
  "page-ssr",
245
245
  `
246
246
  import { storyblokApiInstance } from "virtual:storyblok-init";
247
247
  globalThis.storyblokApiInstance = storyblokApiInstance;
248
248
  `
249
- ), u && !f && A(
249
+ ), u && !d && L(
250
250
  "page",
251
251
  `import { loadStoryblokBridge } from "@storyblok/astro";
252
252
  loadStoryblokBridge().then(() => {
253
253
  const { StoryblokBridge, location } = window;
254
- ${m}
254
+ ${p}
255
255
  storyblokInstance.on(["published", "change"], (event) => {
256
256
  if (!event.slugChanged) {
257
257
  location.reload(true);
@@ -259,55 +259,55 @@ function rt(e) {
259
259
  });
260
260
  });
261
261
  `
262
- ), f && (A(
262
+ ), d && (L(
263
263
  "page",
264
264
  `import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
265
265
  loadStoryblokBridge().then(() => {
266
266
  const { StoryblokBridge, location } = window;
267
- ${m}
267
+ ${p}
268
268
  storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
269
269
  });
270
270
  `
271
- ), L({
271
+ ), T({
272
272
  entrypoint: "@storyblok/astro/middleware.ts",
273
273
  order: "pre"
274
- })), w({
274
+ })), v({
275
275
  id: "storyblok",
276
276
  name: "Storyblok",
277
- icon: de,
277
+ icon: be,
278
278
  entrypoint: "@storyblok/astro/toolbarApp.ts"
279
279
  });
280
280
  }
281
281
  }
282
282
  };
283
283
  }
284
- let q;
285
- async function st(e) {
286
- const { action: t, story: r } = e || {};
287
- if (t === "input" && r) {
288
- const s = async () => {
289
- J("storyblok-live-preview-updating", { story: r });
290
- const n = await Ie(r), i = document.body;
291
- if (n.outerHTML === i.outerHTML)
284
+ let X;
285
+ async function mt(e) {
286
+ const { action: t, story: s } = e || {};
287
+ if (t === "input" && s) {
288
+ const r = async () => {
289
+ Q("storyblok-live-preview-updating", { story: s });
290
+ const n = await He(s), l = document.body;
291
+ if (n.outerHTML === l.outerHTML)
292
292
  return;
293
- const l = document.querySelector('[data-blok-focused="true"]');
294
- Se(i, n, l), J("storyblok-live-preview-updated", { story: r });
293
+ const i = document.querySelector('[data-blok-focused="true"]');
294
+ Pe(l, n, i), Q("storyblok-live-preview-updated", { story: s });
295
295
  };
296
- clearTimeout(q), q = setTimeout(s, 500);
296
+ clearTimeout(X), X = setTimeout(r, 500);
297
297
  }
298
298
  ["published", "change"].includes(e == null ? void 0 : e.action) && location.reload();
299
299
  }
300
- function Se(e, t, r) {
301
- if (r) {
302
- const s = r.getAttribute("data-blok-uid"), o = t.querySelector(
303
- `[data-blok-uid="${s}"]`
300
+ function Pe(e, t, s) {
301
+ if (s) {
302
+ const r = s.getAttribute("data-blok-uid"), o = t.querySelector(
303
+ `[data-blok-uid="${r}"]`
304
304
  );
305
- o && (o.setAttribute("data-blok-focused", "true"), r.replaceWith(o));
305
+ o && (o.setAttribute("data-blok-focused", "true"), s.replaceWith(o));
306
306
  } else
307
307
  e.replaceWith(t);
308
308
  }
309
- async function Ie(e) {
310
- const r = await (await fetch(location.href, {
309
+ async function He(e) {
310
+ const s = await (await fetch(location.href, {
311
311
  method: "POST",
312
312
  body: JSON.stringify({
313
313
  ...e,
@@ -317,22 +317,22 @@ async function Ie(e) {
317
317
  "Content-Type": "application/json"
318
318
  }
319
319
  })).text();
320
- return new DOMParser().parseFromString(r, "text/html").body;
320
+ return new DOMParser().parseFromString(s, "text/html").body;
321
321
  }
322
- function J(e, t) {
322
+ function Q(e, t) {
323
323
  document.dispatchEvent(new CustomEvent(e, { detail: t }));
324
324
  }
325
- var Re = Object.defineProperty, Oe = (e, t, r) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, g = (e, t, r) => Oe(e, typeof t != "symbol" ? t + "" : t, r);
326
- let v = /* @__PURE__ */ function(e) {
325
+ var Ne = Object.defineProperty, je = (e, t, s) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, g = (e, t, s) => je(e, typeof t != "symbol" ? t + "" : t, s);
326
+ let k = /* @__PURE__ */ function(e) {
327
327
  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;
328
- }({}), $ = /* @__PURE__ */ function(e) {
328
+ }({}), A = /* @__PURE__ */ function(e) {
329
329
  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;
330
- }({}), Pe = /* @__PURE__ */ function(e) {
330
+ }({}), De = /* @__PURE__ */ function(e) {
331
331
  return e.TEXT = "text", e;
332
- }({}), P = /* @__PURE__ */ function(e) {
332
+ }({}), M = /* @__PURE__ */ function(e) {
333
333
  return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
334
334
  }({});
335
- const xe = [
335
+ const Ue = [
336
336
  "area",
337
337
  "base",
338
338
  "br",
@@ -347,101 +347,101 @@ const xe = [
347
347
  "source",
348
348
  "track",
349
349
  "wbr"
350
- ], He = (e = {}) => {
351
- const { custom: t, ...r } = e, s = {
352
- ...r,
350
+ ], Ve = (e = {}) => {
351
+ const { custom: t, ...s } = e, r = {
352
+ ...s,
353
353
  ...t
354
354
  };
355
- return Object.keys(s).map((o) => `${o}="${s[o]}"`).join(" ");
356
- }, je = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
357
- function Ne(e) {
355
+ return Object.keys(r).map((o) => `${o}="${r[o]}"`).join(" ");
356
+ }, Be = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
357
+ function Fe(e) {
358
358
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
359
359
  }
360
- const R = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
361
- function Me(e, t) {
360
+ const I = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
361
+ function qe(e, t) {
362
362
  if (!t) return {
363
363
  src: e,
364
364
  attrs: {}
365
365
  };
366
- let r = 0, s = 0;
366
+ let s = 0, r = 0;
367
367
  const o = {}, n = [];
368
- function i(c, u, f, m, A) {
369
- typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${m.charAt(0).toUpperCase() + m.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : A.push(`${m}(${c})`);
368
+ function l(c, u, d, p, L) {
369
+ typeof c != "number" || c <= u || c >= d ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${u} and ${d} (inclusive)`) : L.push(`${p}(${c})`);
370
370
  }
371
371
  if (typeof t == "object") {
372
- if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (o.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (o.height = t.height, s = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete o.width, delete o.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
373
- const { filters: c } = t || {}, { blur: u, brightness: f, fill: m, format: A, grayscale: _, quality: w, rotate: L } = c || {};
374
- u && i(u, 0, 100, "blur", n), w && i(w, 0, 100, "quality", n), f && i(f, 0, 100, "brightness", n), m && n.push(`fill(${m})`), _ && n.push("grayscale()"), L && [
372
+ if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (o.width = t.width, s = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (o.height = t.height, r = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete o.width, delete o.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
373
+ const { filters: c } = t || {}, { blur: u, brightness: d, fill: p, format: L, grayscale: _, quality: v, rotate: T } = c || {};
374
+ u && l(u, 0, 100, "blur", n), v && l(v, 0, 100, "quality", n), d && l(d, 0, 100, "brightness", n), p && n.push(`fill(${p})`), _ && n.push("grayscale()"), T && [
375
375
  0,
376
376
  90,
377
377
  180,
378
378
  270
379
- ].includes(t.filters.rotate || 0) && n.push(`rotate(${L})`), A && [
379
+ ].includes(t.filters.rotate || 0) && n.push(`rotate(${T})`), L && [
380
380
  "webp",
381
381
  "png",
382
382
  "jpeg"
383
- ].includes(A) && n.push(`format(${A})`);
383
+ ].includes(L) && n.push(`format(${L})`);
384
384
  }
385
385
  t.srcset && (o.srcset = t.srcset.map((c) => {
386
386
  if (typeof c == "number") return `${e}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
387
387
  if (Array.isArray(c) && c.length === 2) {
388
- const [u, f] = c;
389
- return `${e}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
388
+ const [u, d] = c;
389
+ return `${e}/m/${u}x${d}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
390
390
  } else {
391
391
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
392
392
  return;
393
393
  }
394
394
  }).join(", ")), t.sizes && (o.sizes = t.sizes.join(", "));
395
395
  }
396
- let l = `${e}/m/`;
397
- return (r > 0 || s > 0) && (l = `${l}${r}x${s}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
398
- src: l,
396
+ let i = `${e}/m/`;
397
+ return (s > 0 || r > 0) && (i = `${i}${s}x${r}/`), n.length > 0 && (i = `${i}filters:${n.join(":")}`), {
398
+ src: i,
399
399
  attrs: o
400
400
  };
401
401
  }
402
- function W(e, t = {}, r) {
403
- const s = He(t), o = s ? `${e} ${s}` : e, n = Array.isArray(r) ? r.join("") : r || "";
402
+ function ee(e, t = {}, s) {
403
+ const r = Ve(t), o = r ? `${e} ${r}` : e, n = Array.isArray(s) ? s.join("") : s || "";
404
404
  if (e) {
405
- if (xe.includes(e)) return `<${o}>`;
405
+ if (Ue.includes(e)) return `<${o}>`;
406
406
  } else return n;
407
407
  return `<${o}>${n}</${e}>`;
408
408
  }
409
- function De(e = {}) {
410
- const t = /* @__PURE__ */ new Map(), { renderFn: r = W, textFn: s = Ne, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: i = !1 } = e, l = r !== W, c = (a = {}) => {
411
- const { textAlign: h, class: d, id: p, style: y, ...C } = a, b = [];
412
- return y && b.push(y.endsWith(";") ? y : `${y};`), h && b.push(`text-align: ${h};`), R({
409
+ function Ge(e = {}) {
410
+ const t = /* @__PURE__ */ new Map(), { renderFn: s = ee, textFn: r = Fe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: l = !1 } = e, i = s !== ee, c = (a = {}) => {
411
+ const { textAlign: h, class: f, id: m, style: y, ...C } = a, b = [];
412
+ return y && b.push(y.endsWith(";") ? y : `${y};`), h && b.push(`text-align: ${h};`), I({
413
413
  ...C,
414
- class: d,
415
- id: p,
414
+ class: f,
415
+ id: m,
416
416
  ...b.length > 0 ? { style: b.join(" ") } : {}
417
417
  });
418
- }, u = (a) => (h, d) => {
419
- const p = c(h.attrs);
420
- return d.render(a, p, h.children || null);
421
- }, f = (a, h) => {
422
- const { src: d, alt: p, title: y, srcset: C, sizes: b } = a.attrs || {};
423
- let T = d, k = {};
418
+ }, u = (a) => (h, f) => {
419
+ const m = c(h.attrs);
420
+ return f.render(a, m, h.children || null);
421
+ }, d = (a, h) => {
422
+ const { src: f, alt: m, title: y, srcset: C, sizes: b } = a.attrs || {};
423
+ let E = f, w = {};
424
424
  if (n) {
425
- const { src: ue, attrs: he } = Me(d, n);
426
- T = ue, k = he;
425
+ const { src: ye, attrs: ge } = qe(f, n);
426
+ E = ye, w = ge;
427
427
  }
428
- const I = {
429
- src: T,
430
- alt: p,
428
+ const S = {
429
+ src: E,
430
+ alt: m,
431
431
  title: y,
432
432
  srcset: C,
433
433
  sizes: b,
434
- ...k
434
+ ...w
435
435
  };
436
- return h.render("img", R(I));
437
- }, m = (a, h) => {
438
- const { level: d, ...p } = a.attrs || {}, y = c(p);
439
- return h.render(`h${d}`, y, a.children);
440
- }, A = (a, h) => {
441
- var d, p, y, C;
436
+ return h.render("img", I(S));
437
+ }, p = (a, h) => {
438
+ const { level: f, ...m } = a.attrs || {}, y = c(m);
439
+ return h.render(`h${f}`, y, a.children);
440
+ }, L = (a, h) => {
441
+ var f, m, y, C;
442
442
  const b = h.render("img", {
443
- src: (d = a.attrs) == null ? void 0 : d.fallbackImage,
444
- alt: (p = a.attrs) == null ? void 0 : p.alt,
443
+ src: (f = a.attrs) == null ? void 0 : f.fallbackImage,
444
+ alt: (m = a.attrs) == null ? void 0 : m.alt,
445
445
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
446
446
  draggable: "false",
447
447
  loading: "lazy"
@@ -451,147 +451,147 @@ function De(e = {}) {
451
451
  "data-name": (y = a.attrs) == null ? void 0 : y.name,
452
452
  "data-emoji": (C = a.attrs) == null ? void 0 : C.emoji
453
453
  }, b);
454
- }, _ = (a, h) => h.render("pre", a.attrs || {}, h.render("code", {}, a.children || "")), w = (a, h = !1) => ({ text: d, attrs: p }, y) => {
455
- const { class: C, id: b, ...T } = p || {}, k = h ? {
454
+ }, _ = (a, h) => h.render("pre", a.attrs || {}, h.render("code", {}, a.children || "")), v = (a, h = !1) => ({ text: f, attrs: m }, y) => {
455
+ const { class: C, id: b, ...E } = m || {}, w = h ? {
456
456
  class: C,
457
457
  id: b,
458
- style: je(T) || void 0
459
- } : p || {};
460
- return y.render(a, R(k), d);
461
- }, L = (a) => H(a), S = (a) => {
462
- const { marks: h, ...d } = a;
458
+ style: Be(E) || void 0
459
+ } : m || {};
460
+ return y.render(a, I(w), f);
461
+ }, T = (a) => N(a), $ = (a) => {
462
+ const { marks: h, ...f } = a;
463
463
  if ("text" in a) {
464
- if (h) return h.reduce((y, C) => L({
464
+ if (h) return h.reduce((y, C) => T({
465
465
  ...C,
466
466
  text: y
467
- }), L({
468
- ...d,
469
- children: d.children
467
+ }), T({
468
+ ...f,
469
+ children: f.children
470
470
  }));
471
- const p = a.attrs || {};
472
- if (i) {
471
+ const m = a.attrs || {};
472
+ if (l) {
473
473
  const y = t.get("txt") || 0;
474
- t.set("txt", y + 1), p.key = `txt-${y}`;
474
+ t.set("txt", y + 1), m.key = `txt-${y}`;
475
475
  }
476
- return s(d.text, p);
476
+ return r(f.text, m);
477
477
  }
478
478
  return "";
479
- }, V = (a, h) => {
480
- const { linktype: d, href: p, anchor: y, ...C } = a.attrs || {};
479
+ }, z = (a, h) => {
480
+ const { linktype: f, href: m, anchor: y, ...C } = a.attrs || {};
481
481
  let b = "";
482
- switch (d) {
483
- case P.ASSET:
484
- case P.URL:
485
- b = p;
482
+ switch (f) {
483
+ case M.ASSET:
484
+ case M.URL:
485
+ b = m;
486
486
  break;
487
- case P.EMAIL:
488
- b = `mailto:${p}`;
487
+ case M.EMAIL:
488
+ b = `mailto:${m}`;
489
489
  break;
490
- case P.STORY:
491
- b = p, y && (b = `${b}#${y}`);
490
+ case M.STORY:
491
+ b = m, y && (b = `${b}#${y}`);
492
492
  break;
493
493
  default:
494
- b = p;
494
+ b = m;
495
495
  break;
496
496
  }
497
- const T = { ...C };
498
- return b && (T.href = b), h.render("a", T, a.text);
499
- }, oe = (a, h) => {
500
- var d, p;
497
+ const E = { ...C };
498
+ return b && (E.href = b), h.render("a", E, a.text);
499
+ }, ue = (a, h) => {
500
+ var f, m;
501
501
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
502
- blok: (d = a == null ? void 0 : a.attrs) == null ? void 0 : d.body[0],
503
- id: (p = a.attrs) == null ? void 0 : p.id,
502
+ blok: (f = a == null ? void 0 : a.attrs) == null ? void 0 : f.body[0],
503
+ id: (m = a.attrs) == null ? void 0 : m.id,
504
504
  style: "display: none"
505
505
  });
506
- }, ne = (a, h) => {
507
- const d = c(a.attrs), p = a.children || null;
508
- return h.render("table", d, h.render("tbody", {}, p));
509
- }, ie = (a, h) => {
510
- const d = c(a.attrs);
511
- return h.render("tr", d, a.children);
512
- }, ae = (a, h) => {
513
- const { colspan: d, rowspan: p, colwidth: y, backgroundColor: C, textAlign: b, ...T } = a.attrs || {}, k = [];
514
- y && k.push(`width: ${y}px;`), C && k.push(`background-color: ${C};`), b && k.push(`text-align: ${b};`);
515
- const I = {
516
- ...T,
517
- ...d > 1 ? { colspan: d } : {},
518
- ...p > 1 ? { rowspan: p } : {},
519
- ...k.length > 0 ? { style: k.join(" ") } : {}
506
+ }, he = (a, h) => {
507
+ const f = c(a.attrs), m = a.children || null;
508
+ return h.render("table", f, h.render("tbody", {}, m));
509
+ }, de = (a, h) => {
510
+ const f = c(a.attrs);
511
+ return h.render("tr", f, a.children);
512
+ }, pe = (a, h) => {
513
+ const { colspan: f, rowspan: m, colwidth: y, backgroundColor: C, textAlign: b, ...E } = a.attrs || {}, w = [];
514
+ y && w.push(`width: ${y}px;`), C && w.push(`background-color: ${C};`), b && w.push(`text-align: ${b};`);
515
+ const S = {
516
+ ...E,
517
+ ...f > 1 ? { colspan: f } : {},
518
+ ...m > 1 ? { rowspan: m } : {},
519
+ ...w.length > 0 ? { style: w.join(" ") } : {}
520
520
  };
521
- return h.render("td", R(I), a.children);
522
- }, le = (a, h) => {
523
- const { colspan: d, rowspan: p, colwidth: y, backgroundColor: C, textAlign: b, ...T } = a.attrs || {}, k = [];
524
- y && k.push(`width: ${y}px;`), C && k.push(`background-color: ${C};`), b && k.push(`text-align: ${b};`);
525
- const I = {
526
- ...T,
527
- ...d > 1 ? { colspan: d } : {},
528
- ...p > 1 ? { rowspan: p } : {},
529
- ...k.length > 0 ? { style: k.join(" ") } : {}
521
+ return h.render("td", I(S), a.children);
522
+ }, fe = (a, h) => {
523
+ const { colspan: f, rowspan: m, colwidth: y, backgroundColor: C, textAlign: b, ...E } = a.attrs || {}, w = [];
524
+ y && w.push(`width: ${y}px;`), C && w.push(`background-color: ${C};`), b && w.push(`text-align: ${b};`);
525
+ const S = {
526
+ ...E,
527
+ ...f > 1 ? { colspan: f } : {},
528
+ ...m > 1 ? { rowspan: m } : {},
529
+ ...w.length > 0 ? { style: w.join(" ") } : {}
530
530
  };
531
- return h.render("th", R(I), a.children);
532
- }, B = /* @__PURE__ */ new Map([
533
- [v.DOCUMENT, u("")],
534
- [v.HEADING, m],
535
- [v.PARAGRAPH, u("p")],
536
- [v.UL_LIST, u("ul")],
537
- [v.OL_LIST, u("ol")],
538
- [v.LIST_ITEM, u("li")],
539
- [v.IMAGE, f],
540
- [v.EMOJI, A],
541
- [v.CODE_BLOCK, _],
542
- [v.HR, u("hr")],
543
- [v.BR, u("br")],
544
- [v.QUOTE, u("blockquote")],
545
- [v.COMPONENT, oe],
546
- [Pe.TEXT, S],
547
- [$.LINK, V],
548
- [$.ANCHOR, V],
549
- [$.STYLED, w("span", !0)],
550
- [$.BOLD, w("strong")],
551
- [$.TEXT_STYLE, w("span", !0)],
552
- [$.ITALIC, w("em")],
553
- [$.UNDERLINE, w("u")],
554
- [$.STRIKE, w("s")],
555
- [$.CODE, w("code")],
556
- [$.SUPERSCRIPT, w("sup")],
557
- [$.SUBSCRIPT, w("sub")],
558
- [$.HIGHLIGHT, w("mark")],
559
- [v.TABLE, ne],
560
- [v.TABLE_ROW, ie],
561
- [v.TABLE_CELL, ae],
562
- [v.TABLE_HEADER, le]
563
- ]), F = new Map([...B, ...Object.entries(o).map(([a, h]) => [a, h])]), ce = () => ({
564
- render: (a, h = {}, d) => {
565
- if (i && a) {
566
- const p = t.get(a) || 0;
567
- t.set(a, p + 1), h.key = `${a}-${p}`;
531
+ return h.render("th", I(S), a.children);
532
+ }, Z = /* @__PURE__ */ new Map([
533
+ [k.DOCUMENT, u("")],
534
+ [k.HEADING, p],
535
+ [k.PARAGRAPH, u("p")],
536
+ [k.UL_LIST, u("ul")],
537
+ [k.OL_LIST, u("ol")],
538
+ [k.LIST_ITEM, u("li")],
539
+ [k.IMAGE, d],
540
+ [k.EMOJI, L],
541
+ [k.CODE_BLOCK, _],
542
+ [k.HR, u("hr")],
543
+ [k.BR, u("br")],
544
+ [k.QUOTE, u("blockquote")],
545
+ [k.COMPONENT, ue],
546
+ [De.TEXT, $],
547
+ [A.LINK, z],
548
+ [A.ANCHOR, z],
549
+ [A.STYLED, v("span", !0)],
550
+ [A.BOLD, v("strong")],
551
+ [A.TEXT_STYLE, v("span", !0)],
552
+ [A.ITALIC, v("em")],
553
+ [A.UNDERLINE, v("u")],
554
+ [A.STRIKE, v("s")],
555
+ [A.CODE, v("code")],
556
+ [A.SUPERSCRIPT, v("sup")],
557
+ [A.SUBSCRIPT, v("sub")],
558
+ [A.HIGHLIGHT, v("mark")],
559
+ [k.TABLE, he],
560
+ [k.TABLE_ROW, de],
561
+ [k.TABLE_CELL, pe],
562
+ [k.TABLE_HEADER, fe]
563
+ ]), J = new Map([...Z, ...Object.entries(o).map(([a, h]) => [a, h])]), me = () => ({
564
+ render: (a, h = {}, f) => {
565
+ if (l && a) {
566
+ const m = t.get(a) || 0;
567
+ t.set(a, m + 1), h.key = `${a}-${m}`;
568
568
  }
569
- return r(a, h, d);
569
+ return s(a, h, f);
570
570
  },
571
- originalResolvers: B,
572
- mergedResolvers: F
571
+ originalResolvers: Z,
572
+ mergedResolvers: J
573
573
  });
574
- function O(a) {
575
- const h = F.get(a.type);
574
+ function x(a) {
575
+ const h = J.get(a.type);
576
576
  if (!h)
577
577
  return console.error("<Storyblok>", `No resolver found for node type ${a.type}`), "";
578
- const d = ce();
579
- if (a.type === "text") return h(a, d);
580
- const p = a.content ? a.content.map(H) : void 0;
578
+ const f = me();
579
+ if (a.type === "text") return h(a, f);
580
+ const m = a.content ? a.content.map(N) : void 0;
581
581
  return h({
582
582
  ...a,
583
- children: p
584
- }, d);
583
+ children: m
584
+ }, f);
585
585
  }
586
- function H(a) {
587
- return a.type === "doc" ? l ? a.content.map(O) : a.content.map(O).join("") : Array.isArray(a) ? a.map(O) : O(a);
586
+ function N(a) {
587
+ return a.type === "doc" ? i ? a.content.map(x) : a.content.map(x).join("") : Array.isArray(a) ? a.map(x) : x(a);
588
588
  }
589
- return { render: H };
589
+ return { render: N };
590
590
  }
591
- let Y = !1;
592
- const K = [], se = (e) => new Promise((t, r) => {
591
+ let te = !1;
592
+ const se = [], le = (e) => new Promise((t, s) => {
593
593
  if (typeof window > "u") {
594
- r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
594
+ s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
595
595
  return;
596
596
  }
597
597
  if (window.storyblokRegisterEvent = (o) => {
@@ -599,70 +599,34 @@ const K = [], se = (e) => new Promise((t, r) => {
599
599
  console.warn("You are not in Draft Mode or in the Visual Editor.");
600
600
  return;
601
601
  }
602
- Y ? o() : K.push(o);
602
+ te ? o() : se.push(o);
603
603
  }, document.getElementById("storyblok-javascript-bridge")) {
604
604
  t(void 0);
605
605
  return;
606
606
  }
607
- const s = document.createElement("script");
608
- s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (o) => r(o), s.onload = (o) => {
609
- K.forEach((n) => n()), Y = !0, t(o);
610
- }, document.getElementsByTagName("head")[0].appendChild(s);
611
- });
612
- var Ue = class extends Error {
613
- constructor(e) {
614
- super(e), this.name = "AbortError";
615
- }
616
- };
617
- function Ve(e, t, r) {
618
- if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
619
- if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
620
- const s = [];
621
- let o = [], n = 0, i = !1;
622
- const l = async () => {
623
- n++;
624
- const u = s.shift();
625
- if (u) try {
626
- const m = await e(...u.args);
627
- u.resolve(m);
628
- } catch (m) {
629
- u.reject(m);
630
- }
631
- const f = setTimeout(() => {
632
- n--, s.length > 0 && l(), o = o.filter((m) => m !== f);
633
- }, r);
634
- o.includes(f) || o.push(f);
635
- }, c = (...u) => i ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, m) => {
636
- s.push({
637
- resolve: f,
638
- reject: m,
639
- args: u
640
- }), n < t && l();
641
- });
642
- return c.abort = () => {
643
- i = !0, o.forEach(clearTimeout), o = [], s.forEach((u) => u.reject(() => new Ue("Throttle function aborted"))), s.length = 0;
644
- }, c;
645
- }
646
- var Be = Ve;
647
- const X = (e = "") => e.includes("/cdn/"), Fe = (e, t = 25, r = 1) => ({
607
+ const r = document.createElement("script");
608
+ r.async = !0, r.src = e, r.id = "storyblok-javascript-bridge", r.onerror = (o) => s(o), r.onload = (o) => {
609
+ se.forEach((n) => n()), te = !0, t(o);
610
+ }, document.getElementsByTagName("head")[0].appendChild(r);
611
+ }), re = (e = "") => e.includes("/cdn/"), ze = (e, t = 25, s = 1) => ({
648
612
  ...e,
649
613
  per_page: t,
650
- page: r
651
- }), ze = (e) => new Promise((t) => setTimeout(t, e)), Ze = (e = 0, t) => Array.from({ length: e }, t), Ge = (e = 0, t = e) => {
652
- const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
653
- return Ze(r, (o, n) => n * s + e);
654
- }, qe = async (e, t) => Promise.all(e.map(t)), Je = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), U = (e, t, r) => {
655
- const s = [];
614
+ page: s
615
+ }), Ze = (e) => new Promise((t) => setTimeout(t, e)), Je = (e = 0, t) => Array.from({ length: e }, t), We = (e = 0, t = e) => {
616
+ const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
617
+ return Je(s, (o, n) => n * r + e);
618
+ }, Ye = async (e, t) => Promise.all(e.map(t)), Ke = (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []), G = (e, t, s) => {
619
+ const r = [];
656
620
  for (const o in e) {
657
621
  if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
658
622
  const n = e[o];
659
623
  if (n == null) continue;
660
- const i = r ? "" : encodeURIComponent(o);
661
- let l;
662
- typeof n == "object" ? l = U(n, t ? t + encodeURIComponent(`[${i}]`) : i, Array.isArray(n)) : l = `${t ? t + encodeURIComponent(`[${i}]`) : i}=${encodeURIComponent(n)}`, s.push(l);
624
+ const l = s ? "" : encodeURIComponent(o);
625
+ let i;
626
+ typeof n == "object" ? i = G(n, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(n)) : i = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(n)}`, r.push(i);
663
627
  }
664
- return s.join("&");
665
- }, Q = (e) => {
628
+ return r.join("&");
629
+ }, oe = (e) => {
666
630
  const t = {
667
631
  eu: "api.storyblok.com",
668
632
  us: "api-us.storyblok.com",
@@ -672,7 +636,7 @@ const X = (e = "") => e.includes("/cdn/"), Fe = (e, t = 25, r = 1) => ({
672
636
  };
673
637
  return t[e] ?? t.eu;
674
638
  };
675
- var We = class {
639
+ var Xe = class {
676
640
  constructor(e) {
677
641
  g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(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 = {};
678
642
  }
@@ -695,37 +659,37 @@ var We = class {
695
659
  return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
696
660
  }
697
661
  async _responseHandler(e) {
698
- const t = [], r = {
662
+ const t = [], s = {
699
663
  data: {},
700
664
  headers: {},
701
665
  status: 0,
702
666
  statusText: ""
703
667
  };
704
- e.status !== 204 && await e.json().then((s) => {
705
- r.data = s;
668
+ e.status !== 204 && await e.json().then((r) => {
669
+ s.data = r;
706
670
  });
707
- for (const s of e.headers.entries()) t[s[0]] = s[1];
708
- return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
671
+ for (const r of e.headers.entries()) t[r[0]] = r[1];
672
+ return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
709
673
  }
710
674
  async _methodHandler(e) {
711
- let t = `${this.baseURL}${this.url}`, r = null;
712
- e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : r = JSON.stringify(this.parameters);
713
- const s = new URL(t), o = new AbortController(), { signal: n } = o;
714
- let i;
715
- this.timeout && (i = setTimeout(() => o.abort(), this.timeout));
675
+ let t = `${this.baseURL}${this.url}`, s = null;
676
+ e === "get" ? t = `${this.baseURL}${this.url}?${G(this.parameters)}` : s = JSON.stringify(this.parameters);
677
+ const r = new URL(t), o = new AbortController(), { signal: n } = o;
678
+ let l = null;
679
+ this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
716
680
  try {
717
- const l = await this.fetch(`${s}`, {
681
+ const i = await this.fetch(`${r}`, {
718
682
  method: e,
719
683
  headers: this.headers,
720
- body: r,
684
+ body: s,
721
685
  signal: n,
722
686
  ...this.fetchOptions
723
687
  });
724
- this.timeout && clearTimeout(i);
725
- const c = await this._responseHandler(l);
688
+ this.timeout && l && clearTimeout(l);
689
+ const c = await this._responseHandler(i);
726
690
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
727
- } catch (l) {
728
- return { message: l };
691
+ } catch (i) {
692
+ return { message: i };
729
693
  }
730
694
  }
731
695
  setFetchOptions(e = {}) {
@@ -753,93 +717,209 @@ var We = class {
753
717
  }
754
718
  _statusHandler(e) {
755
719
  const t = /20[0-6]/g;
756
- return new Promise((r, s) => {
757
- if (t.test(`${e.status}`)) return r(e);
720
+ return new Promise((s, r) => {
721
+ if (t.test(`${e.status}`)) return s(e);
758
722
  const o = {
759
723
  message: this._normalizeErrorMessage(e.data),
760
724
  status: e.status,
761
725
  response: e
762
726
  };
763
- s(o);
727
+ r(o);
764
728
  });
765
729
  }
766
- }, Ye = We;
767
- const ee = "SB-Agent", j = {
730
+ }, Qe = Xe;
731
+ const ne = "SB-Agent", j = {
768
732
  defaultAgentName: "SB-JS-CLIENT",
769
733
  defaultAgentVersion: "SB-Agent-Version",
770
734
  packageVersion: "7.0.0"
771
- }, Ke = {
735
+ }, ce = {
736
+ DRAFT: "draft",
772
737
  PUBLISHED: "published"
738
+ }, et = 25, D = {
739
+ SMALL: 25,
740
+ MEDIUM: 50,
741
+ LARGE: 75
742
+ }, O = {
743
+ SINGLE_OR_SMALL: 50,
744
+ MEDIUM: 15,
745
+ LARGE: 10,
746
+ VERY_LARGE: 6
747
+ }, U = 1e3, V = 3;
748
+ function tt(e) {
749
+ return e.version === ce.DRAFT;
750
+ }
751
+ function st(e, t) {
752
+ const s = e.includes("/cdn/stories/"), r = e.split("/").length > 3 && !e.endsWith("/cdn/stories"), o = "find_by" in t;
753
+ return s && r || o;
754
+ }
755
+ function rt(e) {
756
+ return e <= D.SMALL ? O.SINGLE_OR_SMALL : e <= D.MEDIUM ? O.MEDIUM : e <= D.LARGE ? O.LARGE : O.VERY_LARGE;
757
+ }
758
+ function P(e, t, s = {}, r) {
759
+ if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, U);
760
+ if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, U);
761
+ if (t && !tt(t)) return U;
762
+ if (r !== void 0) return r;
763
+ if (st(e, t)) return O.SINGLE_OR_SMALL;
764
+ const o = t.per_page || et;
765
+ return rt(o);
766
+ }
767
+ function ot(e) {
768
+ if (!e) return null;
769
+ const t = e["x-ratelimit"] || e["X-RateLimit"], s = e["x-ratelimit-policy"] || e["X-RateLimit-Policy"];
770
+ if (!t && !s) return null;
771
+ const r = {};
772
+ if (t) {
773
+ const o = t.match(/r=(\d+)/);
774
+ o && (r.remaining = Number.parseInt(o[1], 10));
775
+ }
776
+ if (s) {
777
+ const o = s.match(/q=(\d+)/);
778
+ o && (r.max = Number.parseInt(o[1], 10));
779
+ }
780
+ return Object.keys(r).length > 0 ? r : null;
781
+ }
782
+ function nt(e, t = !1) {
783
+ return {
784
+ userRateLimit: e,
785
+ serverHeadersRateLimit: void 0,
786
+ isManagementApi: t
787
+ };
788
+ }
789
+ var it = class extends Error {
790
+ constructor(e) {
791
+ super(e), this.name = "AbortError";
792
+ }
773
793
  };
774
- let x = {};
775
- const E = {};
776
- var Xe = class {
794
+ function at(e, t, s) {
795
+ if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
796
+ if (!Number.isFinite(s)) throw new TypeError("Expected `interval` to be a finite number");
797
+ const r = [];
798
+ let o = [], n = 0, l = !1;
799
+ const i = async () => {
800
+ n++;
801
+ const u = r.shift();
802
+ if (u) try {
803
+ const p = await e(...u.args);
804
+ u.resolve(p);
805
+ } catch (p) {
806
+ u.reject(p);
807
+ }
808
+ const d = setTimeout(() => {
809
+ n--, r.length > 0 && i(), o = o.filter((p) => p !== d);
810
+ }, s);
811
+ o.includes(d) || o.push(d);
812
+ }, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((d, p) => {
813
+ r.push({
814
+ resolve: d,
815
+ reject: p,
816
+ args: u
817
+ }), n < t && i();
818
+ });
819
+ return c.abort = () => {
820
+ l = !0, o.forEach(clearTimeout), o = [], r.forEach((u) => u.reject(() => new it("Throttle function aborted"))), r.length = 0;
821
+ }, c;
822
+ }
823
+ var lt = at, ct = class {
824
+ constructor(e, t = 1e3) {
825
+ g(this, "queues"), g(this, "interval"), g(this, "throttledRequestFn"), this.queues = /* @__PURE__ */ new Map(), this.interval = t, this.throttledRequestFn = e;
826
+ }
827
+ /**
828
+ * Gets or creates a throttle queue for the specified rate limit
829
+ */
830
+ getQueue(e) {
831
+ let t = this.queues.get(e);
832
+ return t || (t = lt(this.throttledRequestFn, e, this.interval), this.queues.set(e, t)), t;
833
+ }
834
+ /**
835
+ * Executes a request through the appropriate throttle queue based on rate limit
836
+ */
837
+ execute(e, ...t) {
838
+ return this.getQueue(e)(...t);
839
+ }
840
+ /**
841
+ * Aborts all throttle queues
842
+ */
843
+ abortAll() {
844
+ this.queues.forEach((e) => {
845
+ var t;
846
+ (t = e.abort) == null || t.call(e);
847
+ }), this.queues.clear();
848
+ }
849
+ /**
850
+ * Gets the number of active queues
851
+ */
852
+ getQueueCount() {
853
+ return this.queues.size;
854
+ }
855
+ };
856
+ let H = {};
857
+ const R = {};
858
+ var ut = class {
777
859
  /**
778
860
  *
779
861
  * @param config ISbConfig interface
780
862
  * @param pEndpoint string, optional
781
863
  */
782
864
  constructor(e, t) {
783
- g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttle"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
784
- let r = e.endpoint || t;
785
- if (!r) {
786
- const n = e.https === !1 ? "http" : "https";
787
- e.oauthToken ? r = `${n}://${Q(e.region)}/v1` : r = `${n}://${Q(e.region)}/v2`;
865
+ g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttleManager"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "rateLimitConfig"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
866
+ let s = e.endpoint || t;
867
+ if (!s) {
868
+ const o = e.https === !1 ? "http" : "https";
869
+ e.oauthToken ? s = `${o}://${oe(e.region)}/v1` : s = `${o}://${oe(e.region)}/v2`;
788
870
  }
789
- const s = new Headers();
790
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, i]) => {
791
- s.set(n, i);
792
- }), s.has(ee) || (s.set(ee, j.defaultAgentName), s.set(j.defaultAgentVersion, j.packageVersion));
793
- let o = 5;
794
- e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Be(this.throttledRequest.bind(this), o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Ke.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Ye({
795
- baseURL: r,
871
+ const r = new Headers();
872
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([o, n]) => {
873
+ r.set(o, n);
874
+ }), r.has(ne) || (r.set(ne, j.defaultAgentName), r.set(j.defaultAgentVersion, j.packageVersion)), e.oauthToken && r.set("Authorization", e.oauthToken), this.rateLimitConfig = nt(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new ct(this.throttledRequest.bind(this), 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 || ce.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Qe({
875
+ baseURL: s,
796
876
  timeout: e.timeout || 0,
797
- headers: s,
877
+ headers: r,
798
878
  responseInterceptor: e.responseInterceptor,
799
879
  fetch: e.fetch
800
880
  });
801
881
  }
802
882
  parseParams(e) {
803
- 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;
883
+ return e.token || (e.token = this.getToken()), e.cv || (e.cv = R[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
804
884
  }
805
885
  factoryParamOptions(e, t) {
806
- return X(e) ? this.parseParams(t) : t;
886
+ return re(e) ? this.parseParams(t) : t;
807
887
  }
808
- makeRequest(e, t, r, s, o) {
809
- const n = this.factoryParamOptions(e, Fe(t, r, s));
888
+ makeRequest(e, t, s, r, o) {
889
+ const n = this.factoryParamOptions(e, ze(t, s, r));
810
890
  return this.cacheResponse(e, n, void 0, o);
811
891
  }
812
- get(e, t = {}, r) {
892
+ get(e, t = {}, s) {
813
893
  t || (t = {});
814
- const s = `/${e}`;
815
- X(s) && (t.version = t.version || this.version);
816
- const o = this.factoryParamOptions(s, t);
817
- return this.cacheResponse(s, o, void 0, r);
894
+ const r = `/${e}`;
895
+ re(r) && (t.version = t.version || this.version);
896
+ const o = this.factoryParamOptions(r, t);
897
+ return this.cacheResponse(r, o, void 0, s);
818
898
  }
819
- async getAll(e, t = {}, r, s) {
820
- const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), i = r ?? n.substring(n.lastIndexOf("/") + 1);
899
+ async getAll(e, t = {}, s, r) {
900
+ const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), l = s ?? n.substring(n.lastIndexOf("/") + 1);
821
901
  t.version = t.version || this.version;
822
- const l = 1, c = await this.makeRequest(n, t, o, l, s), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, f = await qe(Ge(l, u), (m) => this.makeRequest(n, t, o, m + 1, s));
823
- return Je([c, ...f], (m) => Object.values(m.data[i]));
902
+ const i = 1, c = await this.makeRequest(n, t, o, i, r), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, d = await Ye(We(i, u), (p) => this.makeRequest(n, t, o, p + 1, r));
903
+ return Ke([c, ...d], (p) => Object.values(p.data[l]));
824
904
  }
825
- post(e, t = {}, r) {
826
- const s = `/${e}`;
827
- return this.throttle("post", s, t, r);
905
+ post(e, t = {}, s) {
906
+ const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
907
+ return this.throttleManager.execute(o, "post", r, t, s);
828
908
  }
829
- put(e, t = {}, r) {
830
- const s = `/${e}`;
831
- return this.throttle("put", s, t, r);
909
+ put(e, t = {}, s) {
910
+ const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
911
+ return this.throttleManager.execute(o, "put", r, t, s);
832
912
  }
833
- delete(e, t = {}, r) {
913
+ delete(e, t = {}, s) {
834
914
  t || (t = {});
835
- const s = `/${e}`;
836
- return this.throttle("delete", s, t, r);
915
+ const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
916
+ return this.throttleManager.execute(o, "delete", r, t, s);
837
917
  }
838
918
  getStories(e = {}, t) {
839
919
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
840
920
  }
841
- getStory(e, t = {}, r) {
842
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
921
+ getStory(e, t = {}, s) {
922
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
843
923
  }
844
924
  getToken() {
845
925
  return this.accessToken;
@@ -853,9 +933,9 @@ var Xe = class {
853
933
  _cleanCopy(e) {
854
934
  return JSON.parse(JSON.stringify(e));
855
935
  }
856
- _insertLinks(e, t, r) {
857
- const s = e[t];
858
- 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]));
936
+ _insertLinks(e, t, s) {
937
+ const r = e[t];
938
+ r && r.fieldtype === "multilink" && r.linktype === "story" && typeof r.id == "string" && this.links[s][r.id] ? r.story = this._cleanCopy(this.links[s][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[s][r.uuid] && (r.story = this._cleanCopy(this.links[s][r.uuid]));
859
939
  }
860
940
  /**
861
941
  *
@@ -876,9 +956,9 @@ var Xe = class {
876
956
  * - For single strings: directly replaces the UUID with the story reference
877
957
  * - For arrays: maps through each UUID and replaces with corresponding story references
878
958
  */
879
- _resolveField(e, t, r) {
880
- const s = e[t];
881
- typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((o) => this.getStoryReference(r, o)).filter(Boolean));
959
+ _resolveField(e, t, s) {
960
+ const r = e[t];
961
+ typeof r == "string" ? e[t] = this.getStoryReference(s, r) : Array.isArray(r) && (e[t] = r.map((o) => this.getStoryReference(s, o)).filter(Boolean));
882
962
  }
883
963
  /**
884
964
  * Inserts relations into the JSON tree by resolving references
@@ -897,13 +977,13 @@ var Xe = class {
897
977
  * The method supports both string and array formats for the fields parameter,
898
978
  * allowing flexible specification of relation patterns.
899
979
  */
900
- _insertRelations(e, t, r, s) {
901
- if (Array.isArray(r) ? r.find((n) => n.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
902
- this._resolveField(e, t, s);
980
+ _insertRelations(e, t, s, r) {
981
+ if (Array.isArray(s) ? s.find((n) => n.endsWith(`.${t}`)) : s.endsWith(`.${t}`)) {
982
+ this._resolveField(e, t, r);
903
983
  return;
904
984
  }
905
985
  const o = e.component ? `${e.component}.${t}` : t;
906
- (Array.isArray(r) ? r.includes(o) : r === o) && this._resolveField(e, t, s);
986
+ (Array.isArray(s) ? s.includes(o) : s === o) && this._resolveField(e, t, r);
907
987
  }
908
988
  /**
909
989
  * Recursively traverses and resolves relations in the story content tree
@@ -911,67 +991,67 @@ var Xe = class {
911
991
  * @param fields - The relation patterns to resolve
912
992
  * @param resolveId - The unique identifier for the current resolution context
913
993
  */
914
- iterateTree(e, t, r) {
915
- const s = (o, n = "") => {
994
+ iterateTree(e, t, s) {
995
+ const r = (o, n = "") => {
916
996
  if (!(!o || o._stopResolving)) {
917
- if (Array.isArray(o)) o.forEach((i, l) => s(i, `${n}[${l}]`));
918
- else if (typeof o == "object") for (const i in o) {
919
- const l = n ? `${n}.${i}` : i;
920
- (o.component && o._uid || o.type === "link") && (this._insertRelations(o, i, t, r), this._insertLinks(o, i, r)), s(o[i], l);
997
+ if (Array.isArray(o)) o.forEach((l, i) => r(l, `${n}[${i}]`));
998
+ else if (typeof o == "object") for (const l in o) {
999
+ const i = n ? `${n}.${l}` : l;
1000
+ (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, s), this._insertLinks(o, l, s)), r(o[l], i);
921
1001
  }
922
1002
  }
923
1003
  };
924
- s(e.content);
1004
+ r(e.content);
925
1005
  }
926
- async resolveLinks(e, t, r) {
927
- let s = [];
1006
+ async resolveLinks(e, t, s) {
1007
+ let r = [];
928
1008
  if (e.link_uuids) {
929
- const o = e.link_uuids.length, n = [], i = 50;
930
- for (let l = 0; l < o; l += i) {
931
- const c = Math.min(o, l + i);
932
- n.push(e.link_uuids.slice(l, c));
1009
+ const o = e.link_uuids.length, n = [], l = 50;
1010
+ for (let i = 0; i < o; i += l) {
1011
+ const c = Math.min(o, i + l);
1012
+ n.push(e.link_uuids.slice(i, c));
933
1013
  }
934
- for (let l = 0; l < n.length; l++)
1014
+ for (let i = 0; i < n.length; i++)
935
1015
  (await this.getStories({
936
- per_page: i,
1016
+ per_page: l,
937
1017
  language: t.language,
938
1018
  version: t.version,
939
1019
  starts_with: t.starts_with,
940
- by_uuids: n[l].join(",")
1020
+ by_uuids: n[i].join(",")
941
1021
  })).data.stories.forEach((c) => {
942
- s.push(c);
1022
+ r.push(c);
943
1023
  });
944
- } else s = e.links;
945
- s.forEach((o) => {
946
- this.links[r][o.uuid] = {
1024
+ } else r = e.links;
1025
+ r.forEach((o) => {
1026
+ this.links[s][o.uuid] = {
947
1027
  ...o,
948
1028
  _stopResolving: !0
949
1029
  };
950
1030
  });
951
1031
  }
952
- async resolveRelations(e, t, r) {
953
- let s = [];
1032
+ async resolveRelations(e, t, s) {
1033
+ let r = [];
954
1034
  if (e.rel_uuids) {
955
- const o = e.rel_uuids.length, n = [], i = 50;
956
- for (let l = 0; l < o; l += i) {
957
- const c = Math.min(o, l + i);
958
- n.push(e.rel_uuids.slice(l, c));
1035
+ const o = e.rel_uuids.length, n = [], l = 50;
1036
+ for (let i = 0; i < o; i += l) {
1037
+ const c = Math.min(o, i + l);
1038
+ n.push(e.rel_uuids.slice(i, c));
959
1039
  }
960
- for (let l = 0; l < n.length; l++)
1040
+ for (let i = 0; i < n.length; i++)
961
1041
  (await this.getStories({
962
- per_page: i,
1042
+ per_page: l,
963
1043
  language: t.language,
964
1044
  version: t.version,
965
1045
  starts_with: t.starts_with,
966
- by_uuids: n[l].join(","),
1046
+ by_uuids: n[i].join(","),
967
1047
  excluding_fields: t.excluding_fields
968
1048
  })).data.stories.forEach((c) => {
969
- s.push(c);
1049
+ r.push(c);
970
1050
  });
971
- s.length > 0 && (e.rels = s, delete e.rel_uuids);
972
- } else s = e.rels;
973
- s && s.length > 0 && s.forEach((o) => {
974
- this.relations[r][o.uuid] = {
1051
+ r.length > 0 && (e.rels = r, delete e.rel_uuids);
1052
+ } else r = e.rels;
1053
+ r && r.length > 0 && r.forEach((o) => {
1054
+ this.relations[s][o.uuid] = {
975
1055
  ...o,
976
1056
  _stopResolving: !0
977
1057
  };
@@ -986,21 +1066,21 @@ var Xe = class {
986
1066
  * @returns Promise<void>
987
1067
  *
988
1068
  */
989
- async resolveStories(e, t, r) {
990
- var s, o;
1069
+ async resolveStories(e, t, s) {
1070
+ var r, o;
991
1071
  let n = [];
992
- if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && [
1072
+ if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && [
993
1073
  "1",
994
1074
  "story",
995
1075
  "url",
996
1076
  "link"
997
- ].includes(t.resolve_links) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations) for (const i in this.relations[r]) this.iterateTree(this.relations[r][i], n, r);
998
- e.story ? this.iterateTree(e.story, n, r) : e.stories.forEach((i) => {
999
- this.iterateTree(i, n, r);
1000
- }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
1077
+ ].includes(t.resolve_links) && ((r = e.links) != null && r.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations) for (const l in this.relations[s]) this.iterateTree(this.relations[s][l], n, s);
1078
+ e.story ? this.iterateTree(e.story, n, s) : e.stories.forEach((l) => {
1079
+ this.iterateTree(l, n, s);
1080
+ }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
1001
1081
  }
1002
- async cacheResponse(e, t, r, s) {
1003
- const o = U({
1082
+ async cacheResponse(e, t, s, r) {
1083
+ const o = G({
1004
1084
  url: e,
1005
1085
  params: t
1006
1086
  }), n = this.cacheProvider();
@@ -1008,62 +1088,64 @@ var Xe = class {
1008
1088
  const i = await n.get(o);
1009
1089
  if (i) return Promise.resolve(i);
1010
1090
  }
1011
- return new Promise(async (i, l) => {
1012
- var c;
1091
+ const l = P(e, t, this.rateLimitConfig);
1092
+ return new Promise(async (i, c) => {
1093
+ var u;
1013
1094
  try {
1014
- const u = await this.throttle("get", e, t, s);
1015
- if (u.status !== 200) return l(u);
1016
- let f = {
1017
- data: u.data,
1018
- headers: u.headers
1095
+ const d = await this.throttleManager.execute(l, "get", e, t, r);
1096
+ if (d.status !== 200) return c(d);
1097
+ let p = {
1098
+ data: d.data,
1099
+ headers: d.headers
1019
1100
  };
1020
- if ((c = u.headers) != null && c["per-page"] && (f = Object.assign({}, f, {
1021
- perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
1022
- total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
1023
- })), f.data.story || f.data.stories) {
1024
- const A = this.resolveCounter = ++this.resolveCounter % 1e3;
1025
- await this.resolveStories(f.data, t, `${A}`), f = await this.processInlineAssets(f);
1101
+ const L = ot(d.headers);
1102
+ if ((L == null ? void 0 : L.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = L.max), (u = d.headers) != null && u["per-page"] && (p = Object.assign({}, p, {
1103
+ perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
1104
+ total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
1105
+ })), p.data.story || p.data.stories) {
1106
+ const v = this.resolveCounter = ++this.resolveCounter % 1e3;
1107
+ await this.resolveStories(p.data, t, `${v}`), p = await this.processInlineAssets(p);
1026
1108
  }
1027
- t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, f);
1028
- const m = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
1029
- return t.token && f.data.cv && (m && E[t.token] && E[t.token] !== f.data.cv && await this.flushCache(), E[t.token] = f.data.cv), i(f);
1030
- } catch (u) {
1031
- if (u.response && u.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
1032
- return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await ze(this.retriesDelay), this.cacheResponse(e, t, r).then(i).catch(l);
1033
- l(u);
1109
+ t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, p);
1110
+ const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
1111
+ return t.token && p.data.cv && (_ && R[t.token] && R[t.token] !== p.data.cv && await this.flushCache(), R[t.token] = p.data.cv), i(p);
1112
+ } catch (d) {
1113
+ if (d.response && d.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
1114
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Ze(this.retriesDelay), this.cacheResponse(e, t, s).then(i).catch(c);
1115
+ c(d);
1034
1116
  }
1035
1117
  });
1036
1118
  }
1037
- throttledRequest(e, t, r, s) {
1038
- return this.client.setFetchOptions(s), this.client[e](t, r);
1119
+ throttledRequest(e, t, s, r) {
1120
+ return this.client.setFetchOptions(r), this.client[e](t, s);
1039
1121
  }
1040
1122
  cacheVersions() {
1041
- return E;
1123
+ return R;
1042
1124
  }
1043
1125
  cacheVersion() {
1044
- return E[this.accessToken];
1126
+ return R[this.accessToken];
1045
1127
  }
1046
1128
  setCacheVersion(e) {
1047
- this.accessToken && (E[this.accessToken] = e);
1129
+ this.accessToken && (R[this.accessToken] = e);
1048
1130
  }
1049
1131
  clearCacheVersion() {
1050
- this.accessToken && (E[this.accessToken] = 0);
1132
+ this.accessToken && (R[this.accessToken] = 0);
1051
1133
  }
1052
1134
  cacheProvider() {
1053
1135
  switch (this.cache.type) {
1054
1136
  case "memory":
1055
1137
  return {
1056
1138
  get(e) {
1057
- return Promise.resolve(x[e]);
1139
+ return Promise.resolve(H[e]);
1058
1140
  },
1059
1141
  getAll() {
1060
- return Promise.resolve(x);
1142
+ return Promise.resolve(H);
1061
1143
  },
1062
1144
  set(e, t) {
1063
- return x[e] = t, Promise.resolve(void 0);
1145
+ return H[e] = t, Promise.resolve(void 0);
1064
1146
  },
1065
1147
  flush() {
1066
- return x = {}, Promise.resolve(void 0);
1148
+ return H = {}, Promise.resolve(void 0);
1067
1149
  }
1068
1150
  };
1069
1151
  case "custom":
@@ -1090,21 +1172,21 @@ var Xe = class {
1090
1172
  }
1091
1173
  async processInlineAssets(e) {
1092
1174
  if (!this.inlineAssets) return e;
1093
- const t = (r) => {
1094
- if (!r || typeof r != "object") return r;
1095
- if (Array.isArray(r)) return r.map((o) => t(o));
1096
- let s = { ...r };
1097
- s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
1098
- ...e.data.assets.find((o) => o.id === s.id),
1099
- ...s
1175
+ const t = (s) => {
1176
+ if (!s || typeof s != "object") return s;
1177
+ if (Array.isArray(s)) return s.map((o) => t(o));
1178
+ let r = { ...s };
1179
+ r.fieldtype === "asset" && Array.isArray(e.data.assets) && (r = {
1180
+ ...e.data.assets.find((o) => o.id === r.id),
1181
+ ...r
1100
1182
  });
1101
- for (const o in s) typeof s[o] == "object" && (s[o] = t(s[o]));
1102
- return s;
1183
+ for (const o in r) typeof r[o] == "object" && (r[o] = t(r[o]));
1184
+ return r;
1103
1185
  };
1104
- 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;
1186
+ 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;
1105
1187
  }
1106
- }, Qe = Xe;
1107
- const ot = (e = {}) => {
1188
+ }, ht = ut;
1189
+ const yt = (e = {}) => {
1108
1190
  const { apiOptions: t } = e;
1109
1191
  if (!t || !t.accessToken) {
1110
1192
  console.error(
@@ -1112,8 +1194,8 @@ const ot = (e = {}) => {
1112
1194
  );
1113
1195
  return;
1114
1196
  }
1115
- return { storyblokApi: new Qe(t) };
1116
- }, nt = (e) => {
1197
+ return { storyblokApi: new ht(t) };
1198
+ }, gt = (e) => {
1117
1199
  if (typeof e != "object" || typeof e._editable > "u")
1118
1200
  return {};
1119
1201
  try {
@@ -1128,39 +1210,39 @@ const ot = (e = {}) => {
1128
1210
  return {};
1129
1211
  }
1130
1212
  };
1131
- let M = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1132
- const it = (e = {}) => {
1133
- var t, r;
1213
+ let F = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1214
+ const bt = (e = {}) => {
1215
+ var t, s;
1134
1216
  const {
1135
- bridge: s,
1217
+ bridge: r,
1136
1218
  accessToken: o,
1137
1219
  use: n = [],
1138
- apiOptions: i = {},
1139
- bridgeUrl: l
1220
+ apiOptions: l = {},
1221
+ bridgeUrl: i
1140
1222
  } = e;
1141
- i.accessToken = i.accessToken || o;
1142
- const c = { bridge: s, apiOptions: i };
1223
+ l.accessToken = l.accessToken || o;
1224
+ const c = { bridge: r, apiOptions: l };
1143
1225
  let u = {};
1144
- n.forEach((m) => {
1145
- u = { ...u, ...m(c) };
1146
- }), l && (M = l);
1147
- const f = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
1148
- return s !== !1 && f && se(M), u;
1226
+ n.forEach((p) => {
1227
+ u = { ...u, ...p(c) };
1228
+ }), i && (F = i);
1229
+ const d = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
1230
+ return r !== !1 && d && le(F), u;
1149
1231
  };
1150
- function at(e, t) {
1151
- return De(t).render(e);
1232
+ function Ct(e, t) {
1233
+ return Ge(t).render(e);
1152
1234
  }
1153
- const lt = () => se(M);
1235
+ const vt = () => le(F);
1154
1236
  export {
1155
- ot as apiPlugin,
1156
- tt as getLiveStory,
1157
- st as handleStoryblokMessage,
1158
- lt as loadStoryblokBridge,
1159
- at as renderRichText,
1160
- De as richTextResolver,
1161
- rt as storyblok,
1162
- nt as storyblokEditable,
1163
- it as storyblokInit,
1164
- $e as toCamelCase,
1165
- et as useStoryblokApi
1237
+ yt as apiPlugin,
1238
+ pt as getLiveStory,
1239
+ mt as handleStoryblokMessage,
1240
+ vt as loadStoryblokBridge,
1241
+ Ct as renderRichText,
1242
+ Ge as richTextResolver,
1243
+ ft as storyblok,
1244
+ gt as storyblokEditable,
1245
+ bt as storyblokInit,
1246
+ Se as toCamelCase,
1247
+ dt as useStoryblokApi
1166
1248
  };