@storyblok/js 4.2.3 → 4.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,19 +4,22 @@
4
4
  * description: SDK to integrate Storyblok into your project using JavaScript.
5
5
  * author: undefined
6
6
  */
7
- const lt = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/, ht = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
8
- function O(s) {
9
- switch (s) {
7
+ var lt = Object.defineProperty;
8
+ var ht = (t, e, s) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
9
+ var E = (t, e, s) => ht(t, typeof e != "symbol" ? e + "" : e, s);
10
+ const Dt = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/, dt = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
11
+ function O(t) {
12
+ switch (t) {
10
13
  case 9:
11
14
  case 32:
12
15
  return !0;
13
16
  }
14
17
  return !1;
15
18
  }
16
- function G(s) {
17
- if (s >= 8192 && s <= 8202)
19
+ function G(t) {
20
+ if (t >= 8192 && t <= 8202)
18
21
  return !0;
19
- switch (s) {
22
+ switch (t) {
20
23
  case 9:
21
24
  // \t
22
25
  case 10:
@@ -37,11 +40,11 @@ function G(s) {
37
40
  }
38
41
  return !1;
39
42
  }
40
- function q(s) {
41
- return lt.test(s) || ht.test(s);
43
+ function q(t) {
44
+ return Dt.test(t) || dt.test(t);
42
45
  }
43
- function J(s) {
44
- switch (s) {
46
+ function J(t) {
47
+ switch (t) {
45
48
  case 33:
46
49
  case 34:
47
50
  case 35:
@@ -79,118 +82,118 @@ function J(s) {
79
82
  return !1;
80
83
  }
81
84
  }
82
- function x(s, t, e) {
83
- this.type = s, this.tag = t, this.attrs = null, this.map = null, this.nesting = e, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
85
+ function x(t, e, s) {
86
+ this.type = t, this.tag = e, this.attrs = null, this.map = null, this.nesting = s, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
84
87
  }
85
- x.prototype.attrIndex = function(t) {
88
+ x.prototype.attrIndex = function(e) {
86
89
  if (!this.attrs)
87
90
  return -1;
88
- const e = this.attrs;
89
- for (let r = 0, u = e.length; r < u; r++)
90
- if (e[r][0] === t)
91
+ const s = this.attrs;
92
+ for (let r = 0, u = s.length; r < u; r++)
93
+ if (s[r][0] === e)
91
94
  return r;
92
95
  return -1;
93
96
  };
94
- x.prototype.attrPush = function(t) {
95
- this.attrs ? this.attrs.push(t) : this.attrs = [t];
97
+ x.prototype.attrPush = function(e) {
98
+ this.attrs ? this.attrs.push(e) : this.attrs = [e];
96
99
  };
97
- x.prototype.attrSet = function(t, e) {
98
- const r = this.attrIndex(t), u = [t, e];
100
+ x.prototype.attrSet = function(e, s) {
101
+ const r = this.attrIndex(e), u = [e, s];
99
102
  r < 0 ? this.attrPush(u) : this.attrs[r] = u;
100
103
  };
101
- x.prototype.attrGet = function(t) {
102
- const e = this.attrIndex(t);
104
+ x.prototype.attrGet = function(e) {
105
+ const s = this.attrIndex(e);
103
106
  let r = null;
104
- return e >= 0 && (r = this.attrs[e][1]), r;
107
+ return s >= 0 && (r = this.attrs[s][1]), r;
105
108
  };
106
- x.prototype.attrJoin = function(t, e) {
107
- const r = this.attrIndex(t);
108
- r < 0 ? this.attrPush([t, e]) : this.attrs[r][1] = this.attrs[r][1] + " " + e;
109
+ x.prototype.attrJoin = function(e, s) {
110
+ const r = this.attrIndex(e);
111
+ r < 0 ? this.attrPush([e, s]) : this.attrs[r][1] = this.attrs[r][1] + " " + s;
109
112
  };
110
- function Dt(s, t, e) {
111
- this.src = s, this.env = e, this.tokens = [], this.inlineMode = !1, this.md = t;
113
+ function ft(t, e, s) {
114
+ this.src = t, this.env = s, this.tokens = [], this.inlineMode = !1, this.md = e;
112
115
  }
113
- Dt.prototype.Token = x;
114
- function w(s, t, e, r) {
115
- this.src = s, this.md = t, this.env = e, this.tokens = r, this.bMarks = [], this.eMarks = [], this.tShift = [], this.sCount = [], this.bsCount = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.ddIndent = -1, this.listIndent = -1, this.parentType = "root", this.level = 0;
116
+ ft.prototype.Token = x;
117
+ function _(t, e, s, r) {
118
+ this.src = t, this.md = e, this.env = s, this.tokens = r, this.bMarks = [], this.eMarks = [], this.tShift = [], this.sCount = [], this.bsCount = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.ddIndent = -1, this.listIndent = -1, this.parentType = "root", this.level = 0;
116
119
  const u = this.src;
117
- for (let i = 0, a = 0, o = 0, n = 0, c = u.length, h = !1; a < c; a++) {
118
- const D = u.charCodeAt(a);
120
+ for (let i = 0, o = 0, n = 0, a = 0, c = u.length, h = !1; o < c; o++) {
121
+ const D = u.charCodeAt(o);
119
122
  if (!h)
120
123
  if (O(D)) {
121
- o++, D === 9 ? n += 4 - n % 4 : n++;
124
+ n++, D === 9 ? a += 4 - a % 4 : a++;
122
125
  continue;
123
126
  } else
124
127
  h = !0;
125
- (D === 10 || a === c - 1) && (D !== 10 && a++, this.bMarks.push(i), this.eMarks.push(a), this.tShift.push(o), this.sCount.push(n), this.bsCount.push(0), h = !1, o = 0, n = 0, i = a + 1);
128
+ (D === 10 || o === c - 1) && (D !== 10 && o++, this.bMarks.push(i), this.eMarks.push(o), this.tShift.push(n), this.sCount.push(a), this.bsCount.push(0), h = !1, n = 0, a = 0, i = o + 1);
126
129
  }
127
130
  this.bMarks.push(u.length), this.eMarks.push(u.length), this.tShift.push(0), this.sCount.push(0), this.bsCount.push(0), this.lineMax = this.bMarks.length - 1;
128
131
  }
129
- w.prototype.push = function(s, t, e) {
130
- const r = new x(s, t, e);
131
- return r.block = !0, e < 0 && this.level--, r.level = this.level, e > 0 && this.level++, this.tokens.push(r), r;
132
+ _.prototype.push = function(t, e, s) {
133
+ const r = new x(t, e, s);
134
+ return r.block = !0, s < 0 && this.level--, r.level = this.level, s > 0 && this.level++, this.tokens.push(r), r;
132
135
  };
133
- w.prototype.isEmpty = function(t) {
134
- return this.bMarks[t] + this.tShift[t] >= this.eMarks[t];
136
+ _.prototype.isEmpty = function(e) {
137
+ return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
135
138
  };
136
- w.prototype.skipEmptyLines = function(t) {
137
- for (let e = this.lineMax; t < e && !(this.bMarks[t] + this.tShift[t] < this.eMarks[t]); t++)
139
+ _.prototype.skipEmptyLines = function(e) {
140
+ for (let s = this.lineMax; e < s && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++)
138
141
  ;
139
- return t;
142
+ return e;
140
143
  };
141
- w.prototype.skipSpaces = function(t) {
142
- for (let e = this.src.length; t < e; t++) {
143
- const r = this.src.charCodeAt(t);
144
+ _.prototype.skipSpaces = function(e) {
145
+ for (let s = this.src.length; e < s; e++) {
146
+ const r = this.src.charCodeAt(e);
144
147
  if (!O(r))
145
148
  break;
146
149
  }
147
- return t;
150
+ return e;
148
151
  };
149
- w.prototype.skipSpacesBack = function(t, e) {
150
- if (t <= e)
151
- return t;
152
- for (; t > e; )
153
- if (!O(this.src.charCodeAt(--t)))
154
- return t + 1;
155
- return t;
152
+ _.prototype.skipSpacesBack = function(e, s) {
153
+ if (e <= s)
154
+ return e;
155
+ for (; e > s; )
156
+ if (!O(this.src.charCodeAt(--e)))
157
+ return e + 1;
158
+ return e;
156
159
  };
157
- w.prototype.skipChars = function(t, e) {
158
- for (let r = this.src.length; t < r && this.src.charCodeAt(t) === e; t++)
160
+ _.prototype.skipChars = function(e, s) {
161
+ for (let r = this.src.length; e < r && this.src.charCodeAt(e) === s; e++)
159
162
  ;
160
- return t;
163
+ return e;
161
164
  };
162
- w.prototype.skipCharsBack = function(t, e, r) {
163
- if (t <= r)
164
- return t;
165
- for (; t > r; )
166
- if (e !== this.src.charCodeAt(--t))
167
- return t + 1;
168
- return t;
165
+ _.prototype.skipCharsBack = function(e, s, r) {
166
+ if (e <= r)
167
+ return e;
168
+ for (; e > r; )
169
+ if (s !== this.src.charCodeAt(--e))
170
+ return e + 1;
171
+ return e;
169
172
  };
170
- w.prototype.getLines = function(t, e, r, u) {
171
- if (t >= e)
173
+ _.prototype.getLines = function(e, s, r, u) {
174
+ if (e >= s)
172
175
  return "";
173
- const i = new Array(e - t);
174
- for (let a = 0, o = t; o < e; o++, a++) {
175
- let n = 0;
176
- const c = this.bMarks[o];
176
+ const i = new Array(s - e);
177
+ for (let o = 0, n = e; n < s; n++, o++) {
178
+ let a = 0;
179
+ const c = this.bMarks[n];
177
180
  let h = c, D;
178
- for (o + 1 < e || u ? D = this.eMarks[o] + 1 : D = this.eMarks[o]; h < D && n < r; ) {
179
- const A = this.src.charCodeAt(h);
180
- if (O(A))
181
- A === 9 ? n += 4 - (n + this.bsCount[o]) % 4 : n++;
182
- else if (h - c < this.tShift[o])
183
- n++;
181
+ for (n + 1 < s || u ? D = this.eMarks[n] + 1 : D = this.eMarks[n]; h < D && a < r; ) {
182
+ const g = this.src.charCodeAt(h);
183
+ if (O(g))
184
+ g === 9 ? a += 4 - (a + this.bsCount[n]) % 4 : a++;
185
+ else if (h - c < this.tShift[n])
186
+ a++;
184
187
  else
185
188
  break;
186
189
  h++;
187
190
  }
188
- n > r ? i[a] = new Array(n - r + 1).join(" ") + this.src.slice(h, D) : i[a] = this.src.slice(h, D);
191
+ a > r ? i[o] = new Array(a - r + 1).join(" ") + this.src.slice(h, D) : i[o] = this.src.slice(h, D);
189
192
  }
190
193
  return i.join("");
191
194
  };
192
- w.prototype.Token = x;
193
- const dt = [
195
+ _.prototype.Token = x;
196
+ const Ft = [
194
197
  "address",
195
198
  "article",
196
199
  "aside",
@@ -253,87 +256,87 @@ const dt = [
253
256
  "tr",
254
257
  "track",
255
258
  "ul"
256
- ], Ft = "[a-zA-Z_:][a-zA-Z0-9:._-]*", ft = "[^\"'=<>`\\x00-\\x20]+", pt = "'[^']*'", Et = '"[^"]*"', At = "(?:" + ft + "|" + pt + "|" + Et + ")", Ct = "(?:\\s+" + Ft + "(?:\\s*=\\s*" + At + ")?)", gt = "<[A-Za-z][A-Za-z0-9\\-]*" + Ct + "*\\s*\\/?>", mt = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", yt = new RegExp("^(?:" + gt + "|" + mt + ")");
257
- new RegExp("^</?(" + dt.join("|") + ")(?=(\\s|/?>|$))", "i"), new RegExp(yt.source + "\\s*$");
258
- function P(s, t, e, r) {
259
- this.src = s, this.env = e, this.md = t, this.tokens = r, this.tokens_meta = Array(r.length), this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = {}, this.delimiters = [], this._prev_delimiters = [], this.backticks = {}, this.backticksScanned = !1, this.linkLevel = 0;
259
+ ], Et = "[a-zA-Z_:][a-zA-Z0-9:._-]*", pt = "[^\"'=<>`\\x00-\\x20]+", Ct = "'[^']*'", At = '"[^"]*"', gt = "(?:" + pt + "|" + Ct + "|" + At + ")", yt = "(?:\\s+" + Et + "(?:\\s*=\\s*" + gt + ")?)", bt = "<[A-Za-z][A-Za-z0-9\\-]*" + yt + "*\\s*\\/?>", kt = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", mt = new RegExp("^(?:" + bt + "|" + kt + ")");
260
+ new RegExp("^</?(" + Ft.join("|") + ")(?=(\\s|/?>|$))", "i"), new RegExp(mt.source + "\\s*$");
261
+ function I(t, e, s, r) {
262
+ this.src = t, this.env = s, this.md = e, this.tokens = r, this.tokens_meta = Array(r.length), this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = {}, this.delimiters = [], this._prev_delimiters = [], this.backticks = {}, this.backticksScanned = !1, this.linkLevel = 0;
260
263
  }
261
- P.prototype.pushPending = function() {
262
- const s = new x("text", "", 0);
263
- return s.content = this.pending, s.level = this.pendingLevel, this.tokens.push(s), this.pending = "", s;
264
+ I.prototype.pushPending = function() {
265
+ const t = new x("text", "", 0);
266
+ return t.content = this.pending, t.level = this.pendingLevel, this.tokens.push(t), this.pending = "", t;
264
267
  };
265
- P.prototype.push = function(s, t, e) {
268
+ I.prototype.push = function(t, e, s) {
266
269
  this.pending && this.pushPending();
267
- const r = new x(s, t, e);
270
+ const r = new x(t, e, s);
268
271
  let u = null;
269
- return e < 0 && (this.level--, this.delimiters = this._prev_delimiters.pop()), r.level = this.level, e > 0 && (this.level++, this._prev_delimiters.push(this.delimiters), this.delimiters = [], u = { delimiters: this.delimiters }), this.pendingLevel = this.level, this.tokens.push(r), this.tokens_meta.push(u), r;
272
+ return s < 0 && (this.level--, this.delimiters = this._prev_delimiters.pop()), r.level = this.level, s > 0 && (this.level++, this._prev_delimiters.push(this.delimiters), this.delimiters = [], u = { delimiters: this.delimiters }), this.pendingLevel = this.level, this.tokens.push(r), this.tokens_meta.push(u), r;
270
273
  };
271
- P.prototype.scanDelims = function(s, t) {
272
- const e = this.posMax, r = this.src.charCodeAt(s), u = s > 0 ? this.src.charCodeAt(s - 1) : 32;
273
- let i = s;
274
- for (; i < e && this.src.charCodeAt(i) === r; )
274
+ I.prototype.scanDelims = function(t, e) {
275
+ const s = this.posMax, r = this.src.charCodeAt(t), u = t > 0 ? this.src.charCodeAt(t - 1) : 32;
276
+ let i = t;
277
+ for (; i < s && this.src.charCodeAt(i) === r; )
275
278
  i++;
276
- const a = i - s, o = i < e ? this.src.charCodeAt(i) : 32, n = J(u) || q(String.fromCharCode(u)), c = J(o) || q(String.fromCharCode(o)), h = G(u), D = G(o), A = !D && (!c || h || n), m = !h && (!n || D || c);
277
- return { can_open: A && (t || !m || n), can_close: m && (t || !A || c), length: a };
279
+ const o = i - t, n = i < s ? this.src.charCodeAt(i) : 32, a = J(u) || q(String.fromCharCode(u)), c = J(n) || q(String.fromCharCode(n)), h = G(u), D = G(n), g = !D && (!c || h || a), k = !h && (!a || D || c);
280
+ return { can_open: g && (e || !k || a), can_close: k && (e || !g || c), length: o };
278
281
  };
279
- P.prototype.Token = x;
282
+ I.prototype.Token = x;
280
283
  const Q = [];
281
- for (let s = 0; s < 256; s++)
284
+ for (let t = 0; t < 256; t++)
282
285
  Q.push(0);
283
- "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(s) {
284
- Q[s.charCodeAt(0)] = 1;
286
+ "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t) {
287
+ Q[t.charCodeAt(0)] = 1;
285
288
  });
286
- let b = /* @__PURE__ */ function(s) {
287
- return s.DOCUMENT = "doc", s.HEADING = "heading", s.PARAGRAPH = "paragraph", s.QUOTE = "blockquote", s.OL_LIST = "ordered_list", s.UL_LIST = "bullet_list", s.LIST_ITEM = "list_item", s.CODE_BLOCK = "code_block", s.HR = "horizontal_rule", s.BR = "hard_break", s.IMAGE = "image", s.EMOJI = "emoji", s.COMPONENT = "blok", s.TABLE = "table", s.TABLE_ROW = "tableRow", s.TABLE_CELL = "tableCell", s.TABLE_HEADER = "tableHeader", s;
288
- }({}), k = /* @__PURE__ */ function(s) {
289
- return s.BOLD = "bold", s.STRONG = "strong", s.STRIKE = "strike", s.UNDERLINE = "underline", s.ITALIC = "italic", s.CODE = "code", s.LINK = "link", s.ANCHOR = "anchor", s.STYLED = "styled", s.SUPERSCRIPT = "superscript", s.SUBSCRIPT = "subscript", s.TEXT_STYLE = "textStyle", s.HIGHLIGHT = "highlight", s;
290
- }({}), bt = /* @__PURE__ */ function(s) {
291
- return s.TEXT = "text", s;
292
- }({}), I = /* @__PURE__ */ function(s) {
293
- return s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s;
289
+ let b = /* @__PURE__ */ function(t) {
290
+ return t.DOCUMENT = "doc", t.HEADING = "heading", t.PARAGRAPH = "paragraph", t.QUOTE = "blockquote", t.OL_LIST = "ordered_list", t.UL_LIST = "bullet_list", t.LIST_ITEM = "list_item", t.CODE_BLOCK = "code_block", t.HR = "horizontal_rule", t.BR = "hard_break", t.IMAGE = "image", t.EMOJI = "emoji", t.COMPONENT = "blok", t.TABLE = "table", t.TABLE_ROW = "tableRow", t.TABLE_CELL = "tableCell", t.TABLE_HEADER = "tableHeader", t;
291
+ }({}), v = /* @__PURE__ */ function(t) {
292
+ return t.BOLD = "bold", t.STRONG = "strong", t.STRIKE = "strike", t.UNDERLINE = "underline", t.ITALIC = "italic", t.CODE = "code", t.LINK = "link", t.ANCHOR = "anchor", t.STYLED = "styled", t.SUPERSCRIPT = "superscript", t.SUBSCRIPT = "subscript", t.TEXT_STYLE = "textStyle", t.HIGHLIGHT = "highlight", t;
293
+ }({}), vt = /* @__PURE__ */ function(t) {
294
+ return t.TEXT = "text", t;
295
+ }({}), L = /* @__PURE__ */ function(t) {
296
+ return t.URL = "url", t.STORY = "story", t.ASSET = "asset", t.EMAIL = "email", t;
294
297
  }({});
295
- function vt(s, t) {
296
- if (!t) return {
297
- src: s,
298
+ function xt(t, e) {
299
+ if (!e) return {
300
+ src: t,
298
301
  attrs: {}
299
302
  };
300
- let e = 0, r = 0;
303
+ let s = 0, r = 0;
301
304
  const u = {}, i = [];
302
- function a(n, c, h, D, A) {
303
- typeof n != "number" || n <= c || n >= h ? console.warn(`[StoryblokRichText] - ${D.charAt(0).toUpperCase() + D.slice(1)} value must be a number between ${c} and ${h} (inclusive)`) : A.push(`${D}(${n})`);
305
+ function o(a, c, h, D, g) {
306
+ typeof a != "number" || a <= c || a >= h ? console.warn(`[StoryblokRichText] - ${D.charAt(0).toUpperCase() + D.slice(1)} value must be a number between ${c} and ${h} (inclusive)`) : g.push(`${D}(${a})`);
304
307
  }
305
- if (typeof t == "object") {
306
- if (typeof t.width == "number" && t.width > 0 ? (u.width = t.width, e = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (u.height = t.height, r = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (u.loading = t.loading), t.class && (u.class = t.class), t.filters) {
307
- const { filters: n } = t || {}, { blur: c, brightness: h, fill: D, format: A, grayscale: m, quality: _, rotate: R } = n || {};
308
- c && a(c, 0, 100, "blur", i), _ && a(_, 0, 100, "quality", i), h && a(h, 0, 100, "brightness", i), D && i.push(`fill(${D})`), m && i.push("grayscale()"), R && [
308
+ if (typeof e == "object") {
309
+ if (typeof e.width == "number" && e.width > 0 ? (u.width = e.width, s = e.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), e.height && typeof e.height == "number" && e.height > 0 ? (u.height = e.height, r = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (u.loading = e.loading), e.class && (u.class = e.class), e.filters) {
310
+ const { filters: a } = e || {}, { blur: c, brightness: h, fill: D, format: g, grayscale: k, quality: w, rotate: R } = a || {};
311
+ c && o(c, 0, 100, "blur", i), w && o(w, 0, 100, "quality", i), h && o(h, 0, 100, "brightness", i), D && i.push(`fill(${D})`), k && i.push("grayscale()"), R && [
309
312
  0,
310
313
  90,
311
314
  180,
312
315
  270
313
- ].includes(t.filters.rotate || 0) && i.push(`rotate(${R})`), A && [
316
+ ].includes(e.filters.rotate || 0) && i.push(`rotate(${R})`), g && [
314
317
  "webp",
315
318
  "png",
316
319
  "jpeg"
317
- ].includes(A) && i.push(`format(${A})`);
320
+ ].includes(g) && i.push(`format(${g})`);
318
321
  }
319
- t.srcset && (u.srcset = t.srcset.map((n) => {
320
- if (typeof n == "number") return `${s}/m/${n}x0/${i.length > 0 ? `filters:${i.join(":")}` : ""} ${n}w`;
321
- if (Array.isArray(n) && n.length === 2) {
322
- const [c, h] = n;
323
- return `${s}/m/${c}x${h}/${i.length > 0 ? `filters:${i.join(":")}` : ""} ${c}w`;
322
+ e.srcset && (u.srcset = e.srcset.map((a) => {
323
+ if (typeof a == "number") return `${t}/m/${a}x0/${i.length > 0 ? `filters:${i.join(":")}` : ""} ${a}w`;
324
+ if (Array.isArray(a) && a.length === 2) {
325
+ const [c, h] = a;
326
+ return `${t}/m/${c}x${h}/${i.length > 0 ? `filters:${i.join(":")}` : ""} ${c}w`;
324
327
  } else {
325
328
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
326
329
  return;
327
330
  }
328
- }).join(", ")), t.sizes && (u.sizes = t.sizes.join(", "));
331
+ }).join(", ")), e.sizes && (u.sizes = e.sizes.join(", "));
329
332
  }
330
- let o = `${s}/m/`;
331
- return e > 0 && r > 0 && (o = `${o}${e}x${r}/`), i.length > 0 && (o = `${o}filters:${i.join(":")}`), {
332
- src: o,
333
+ let n = `${t}/m/`;
334
+ return s > 0 && r > 0 && (n = `${n}${s}x${r}/`), i.length > 0 && (n = `${n}filters:${i.join(":")}`), {
335
+ src: n,
333
336
  attrs: u
334
337
  };
335
338
  }
336
- const kt = [
339
+ const _t = [
337
340
  "area",
338
341
  "base",
339
342
  "br",
@@ -348,186 +351,186 @@ const kt = [
348
351
  "source",
349
352
  "track",
350
353
  "wbr"
351
- ], xt = (s = {}) => Object.keys(s).map((t) => `${t}="${s[t]}"`).join(" "), wt = (s = {}) => Object.keys(s).map((t) => `${t}: ${s[t]}`).join("; ");
352
- function Bt(s) {
353
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
354
+ ], Bt = (t = {}) => Object.keys(t).map((e) => `${e}="${t[e]}"`).join(" "), wt = (t = {}) => Object.keys(t).map((e) => `${e}: ${t[e]}`).join("; ");
355
+ function Rt(t) {
356
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
354
357
  }
355
- const L = (s) => Object.fromEntries(Object.entries(s).filter(([t, e]) => e !== void 0));
356
- function V(s, t = {}, e) {
357
- const r = xt(t), u = r ? `${s} ${r}` : s, i = Array.isArray(e) ? e.join("") : e || "";
358
- if (s) {
359
- if (kt.includes(s)) return `<${u}>`;
358
+ const T = (t) => Object.fromEntries(Object.entries(t).filter(([e, s]) => s !== void 0));
359
+ function V(t, e = {}, s) {
360
+ const r = Bt(e), u = r ? `${t} ${r}` : t, i = Array.isArray(s) ? s.join("") : s || "";
361
+ if (t) {
362
+ if (_t.includes(t)) return `<${u}>`;
360
363
  } else return i;
361
- return `<${u}>${i}</${s}>`;
364
+ return `<${u}>${i}</${t}>`;
362
365
  }
363
- function _t(s = {}) {
364
- const t = /* @__PURE__ */ new Map(), { renderFn: e = V, textFn: r = Bt, resolvers: u = {}, optimizeImages: i = !1, keyedResolvers: a = !1 } = s, o = e !== V, n = (l) => (F, d) => {
365
- const f = F.attrs || {};
366
- return d.render(l, f, F.children || null);
367
- }, c = (l, F) => {
368
- const { src: d, alt: f, title: E, srcset: C, sizes: g } = l.attrs || {};
369
- let y = d, v = {};
366
+ function St(t = {}) {
367
+ const e = /* @__PURE__ */ new Map(), { renderFn: s = V, textFn: r = Rt, resolvers: u = {}, optimizeImages: i = !1, keyedResolvers: o = !1 } = t, n = s !== V, a = (l) => (f, d) => {
368
+ const F = f.attrs || {};
369
+ return d.render(l, F, f.children || null);
370
+ }, c = (l, f) => {
371
+ const { src: d, alt: F, title: p, srcset: C, sizes: A } = l.attrs || {};
372
+ let y = d, m = {};
370
373
  if (i) {
371
- const { src: at, attrs: ct } = vt(d, i);
372
- y = at, v = ct;
374
+ const { src: at, attrs: ct } = xt(d, i);
375
+ y = at, m = ct;
373
376
  }
374
377
  const ot = {
375
378
  src: y,
376
- alt: f,
377
- title: E,
379
+ alt: F,
380
+ title: p,
378
381
  srcset: C,
379
- sizes: g,
380
- ...v
382
+ sizes: A,
383
+ ...m
381
384
  };
382
- return F.render("img", L(ot));
383
- }, h = (l, F) => {
384
- const { level: d, ...f } = l.attrs || {};
385
- return F.render(`h${d}`, f, l.children);
386
- }, D = (l, F) => {
387
- var f, E, C, g;
388
- const d = F.render("img", {
389
- src: (f = l.attrs) == null ? void 0 : f.fallbackImage,
390
- alt: (E = l.attrs) == null ? void 0 : E.alt,
385
+ return f.render("img", T(ot));
386
+ }, h = (l, f) => {
387
+ const { level: d, ...F } = l.attrs || {};
388
+ return f.render(`h${d}`, F, l.children);
389
+ }, D = (l, f) => {
390
+ var F, p, C, A;
391
+ const d = f.render("img", {
392
+ src: (F = l.attrs) == null ? void 0 : F.fallbackImage,
393
+ alt: (p = l.attrs) == null ? void 0 : p.alt,
391
394
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
392
395
  draggable: "false",
393
396
  loading: "lazy"
394
397
  });
395
- return F.render("span", {
398
+ return f.render("span", {
396
399
  "data-type": "emoji",
397
400
  "data-name": (C = l.attrs) == null ? void 0 : C.name,
398
- "data-emoji": (g = l.attrs) == null ? void 0 : g.emoji
401
+ "data-emoji": (A = l.attrs) == null ? void 0 : A.emoji
399
402
  }, d);
400
- }, A = (l, F) => F.render("pre", l.attrs || {}, F.render("code", {}, l.children || "")), m = (l, F = !1) => ({ text: d, attrs: f }, E) => {
401
- const { class: C, id: g, ...y } = f || {}, v = F ? {
403
+ }, g = (l, f) => f.render("pre", l.attrs || {}, f.render("code", {}, l.children || "")), k = (l, f = !1) => ({ text: d, attrs: F }, p) => {
404
+ const { class: C, id: A, ...y } = F || {}, m = f ? {
402
405
  class: C,
403
- id: g,
406
+ id: A,
404
407
  style: wt(y) || void 0
405
- } : f || {};
406
- return E.render(l, L(v), d);
407
- }, _ = (l) => $(l), R = (l) => {
408
- const { marks: F, ...d } = l;
408
+ } : F || {};
409
+ return p.render(l, T(m), d);
410
+ }, w = (l) => N(l), R = (l) => {
411
+ const { marks: f, ...d } = l;
409
412
  if ("text" in l) {
410
- if (F) return F.reduce((E, C) => _({
413
+ if (f) return f.reduce((p, C) => w({
411
414
  ...C,
412
- text: E
413
- }), _({
415
+ text: p
416
+ }), w({
414
417
  ...d,
415
418
  children: d.children
416
419
  }));
417
- const f = l.attrs || {};
418
- if (a) {
419
- const E = t.get("txt") || 0;
420
- t.set("txt", E + 1), f.key = `txt-${E}`;
420
+ const F = l.attrs || {};
421
+ if (o) {
422
+ const p = e.get("txt") || 0;
423
+ e.set("txt", p + 1), F.key = `txt-${p}`;
421
424
  }
422
- return r(d.text, f);
425
+ return r(d.text, F);
423
426
  }
424
427
  return "";
425
- }, M = (l, F) => {
426
- const { linktype: d, href: f, anchor: E, ...C } = l.attrs || {};
427
- let g = "";
428
+ }, U = (l, f) => {
429
+ const { linktype: d, href: F, anchor: p, ...C } = l.attrs || {};
430
+ let A = "";
428
431
  switch (d) {
429
- case I.ASSET:
430
- case I.URL:
431
- g = f;
432
+ case L.ASSET:
433
+ case L.URL:
434
+ A = F;
432
435
  break;
433
- case I.EMAIL:
434
- g = `mailto:${f}`;
436
+ case L.EMAIL:
437
+ A = `mailto:${F}`;
435
438
  break;
436
- case I.STORY:
437
- g = f, E && (g = `${g}#${E}`);
439
+ case L.STORY:
440
+ A = F, p && (A = `${A}#${p}`);
438
441
  break;
439
442
  default:
440
- g = f;
443
+ A = F;
441
444
  break;
442
445
  }
443
446
  const y = { ...C };
444
- return g && (y.href = g), F.render("a", y, l.text);
445
- }, et = (l, F) => {
446
- var d, f;
447
- return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), F.render("span", {
447
+ return A && (y.href = A), f.render("a", y, l.text);
448
+ }, et = (l, f) => {
449
+ var d, F;
450
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), f.render("span", {
448
451
  blok: (d = l == null ? void 0 : l.attrs) == null ? void 0 : d.body[0],
449
- id: (f = l.attrs) == null ? void 0 : f.id,
452
+ id: (F = l.attrs) == null ? void 0 : F.id,
450
453
  style: "display: none"
451
454
  });
452
- }, st = (l, F) => {
453
- const d = {}, f = F.render("tbody", {}, l.children);
454
- return F.render("table", d, f);
455
- }, rt = (l, F) => {
455
+ }, st = (l, f) => {
456
+ const d = {}, F = f.render("tbody", {}, l.children);
457
+ return f.render("table", d, F);
458
+ }, rt = (l, f) => {
456
459
  const d = {};
457
- return F.render("tr", d, l.children);
458
- }, ut = (l, F) => {
459
- const { colspan: d, rowspan: f, colwidth: E, backgroundColor: C, ...g } = l.attrs || {}, y = { ...g };
460
- d > 1 && (y.colspan = d), f > 1 && (y.rowspan = f);
461
- const v = [];
462
- return E && v.push(`width: ${E}px;`), C && v.push(`background-color: ${C};`), v.length > 0 && (y.style = v.join(" ")), F.render("td", L(y), l.children);
463
- }, it = (l, F) => {
464
- const { colspan: d, rowspan: f, colwidth: E, backgroundColor: C, ...g } = l.attrs || {}, y = { ...g };
465
- d > 1 && (y.colspan = d), f > 1 && (y.rowspan = f);
466
- const v = [];
467
- return E && v.push(`width: ${E}px;`), C && v.push(`background-color: ${C};`), v.length > 0 && (y.style = v.join(" ")), F.render("th", L(y), l.children);
468
- }, U = /* @__PURE__ */ new Map([
469
- [b.DOCUMENT, n("")],
460
+ return f.render("tr", d, l.children);
461
+ }, ut = (l, f) => {
462
+ const { colspan: d, rowspan: F, colwidth: p, backgroundColor: C, ...A } = l.attrs || {}, y = { ...A };
463
+ d > 1 && (y.colspan = d), F > 1 && (y.rowspan = F);
464
+ const m = [];
465
+ return p && m.push(`width: ${p}px;`), C && m.push(`background-color: ${C};`), m.length > 0 && (y.style = m.join(" ")), f.render("td", T(y), l.children);
466
+ }, it = (l, f) => {
467
+ const { colspan: d, rowspan: F, colwidth: p, backgroundColor: C, ...A } = l.attrs || {}, y = { ...A };
468
+ d > 1 && (y.colspan = d), F > 1 && (y.rowspan = F);
469
+ const m = [];
470
+ return p && m.push(`width: ${p}px;`), C && m.push(`background-color: ${C};`), m.length > 0 && (y.style = m.join(" ")), f.render("th", T(y), l.children);
471
+ }, M = /* @__PURE__ */ new Map([
472
+ [b.DOCUMENT, a("")],
470
473
  [b.HEADING, h],
471
- [b.PARAGRAPH, n("p")],
472
- [b.UL_LIST, n("ul")],
473
- [b.OL_LIST, n("ol")],
474
- [b.LIST_ITEM, n("li")],
474
+ [b.PARAGRAPH, a("p")],
475
+ [b.UL_LIST, a("ul")],
476
+ [b.OL_LIST, a("ol")],
477
+ [b.LIST_ITEM, a("li")],
475
478
  [b.IMAGE, c],
476
479
  [b.EMOJI, D],
477
- [b.CODE_BLOCK, A],
478
- [b.HR, n("hr")],
479
- [b.BR, n("br")],
480
- [b.QUOTE, n("blockquote")],
480
+ [b.CODE_BLOCK, g],
481
+ [b.HR, a("hr")],
482
+ [b.BR, a("br")],
483
+ [b.QUOTE, a("blockquote")],
481
484
  [b.COMPONENT, et],
482
- [bt.TEXT, R],
483
- [k.LINK, M],
484
- [k.ANCHOR, M],
485
- [k.STYLED, m("span", !0)],
486
- [k.BOLD, m("strong")],
487
- [k.TEXT_STYLE, m("span", !0)],
488
- [k.ITALIC, m("em")],
489
- [k.UNDERLINE, m("u")],
490
- [k.STRIKE, m("s")],
491
- [k.CODE, m("code")],
492
- [k.SUPERSCRIPT, m("sup")],
493
- [k.SUBSCRIPT, m("sub")],
494
- [k.HIGHLIGHT, m("mark")],
485
+ [vt.TEXT, R],
486
+ [v.LINK, U],
487
+ [v.ANCHOR, U],
488
+ [v.STYLED, k("span", !0)],
489
+ [v.BOLD, k("strong")],
490
+ [v.TEXT_STYLE, k("span", !0)],
491
+ [v.ITALIC, k("em")],
492
+ [v.UNDERLINE, k("u")],
493
+ [v.STRIKE, k("s")],
494
+ [v.CODE, k("code")],
495
+ [v.SUPERSCRIPT, k("sup")],
496
+ [v.SUBSCRIPT, k("sub")],
497
+ [v.HIGHLIGHT, k("mark")],
495
498
  [b.TABLE, st],
496
499
  [b.TABLE_ROW, rt],
497
500
  [b.TABLE_CELL, ut],
498
501
  [b.TABLE_HEADER, it]
499
- ]), z = new Map([...U, ...Object.entries(u).map(([l, F]) => [l, F])]), nt = () => ({
500
- render: (d, f = {}, E) => {
501
- if (a && d) {
502
- const C = t.get(d) || 0;
503
- t.set(d, C + 1), f.key = `${d}-${C}`;
502
+ ]), z = new Map([...M, ...Object.entries(u).map(([l, f]) => [l, f])]), nt = () => ({
503
+ render: (d, F = {}, p) => {
504
+ if (o && d) {
505
+ const C = e.get(d) || 0;
506
+ e.set(d, C + 1), F.key = `${d}-${C}`;
504
507
  }
505
- return e(d, f, E);
508
+ return s(d, F, p);
506
509
  },
507
- originalResolvers: U,
510
+ originalResolvers: M,
508
511
  mergedResolvers: z
509
512
  });
510
513
  function S(l) {
511
- const F = z.get(l.type);
512
- if (!F)
514
+ const f = z.get(l.type);
515
+ if (!f)
513
516
  return console.error("<Storyblok>", `No resolver found for node type ${l.type}`), "";
514
517
  const d = nt();
515
- if (l.type === "text") return F(l, d);
516
- const f = l.content ? l.content.map($) : void 0;
517
- return F({
518
+ if (l.type === "text") return f(l, d);
519
+ const F = l.content ? l.content.map(N) : void 0;
520
+ return f({
518
521
  ...l,
519
- children: f
522
+ children: F
520
523
  }, d);
521
524
  }
522
- function $(l) {
523
- return l.type === "doc" ? o ? l.content.map(S) : l.content.map(S).join("") : Array.isArray(l) ? l.map(S) : S(l);
525
+ function N(l) {
526
+ return l.type === "doc" ? n ? l.content.map(S) : l.content.map(S).join("") : Array.isArray(l) ? l.map(S) : S(l);
524
527
  }
525
- return { render: $ };
528
+ return { render: N };
526
529
  }
527
- let W = !1;
528
- const Y = [], tt = (s) => new Promise((t, e) => {
530
+ let K = !1;
531
+ const Y = [], tt = (t) => new Promise((e, s) => {
529
532
  if (typeof window > "u") {
530
- e(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
533
+ s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
531
534
  return;
532
535
  }
533
536
  if (window.storyblokRegisterEvent = (u) => {
@@ -535,104 +538,98 @@ const Y = [], tt = (s) => new Promise((t, e) => {
535
538
  console.warn("You are not in Draft Mode or in the Visual Editor.");
536
539
  return;
537
540
  }
538
- W ? u() : Y.push(u);
541
+ K ? u() : Y.push(u);
539
542
  }, document.getElementById("storyblok-javascript-bridge")) {
540
- t(void 0);
543
+ e(void 0);
541
544
  return;
542
545
  }
543
546
  const r = document.createElement("script");
544
- r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (u) => e(u), r.onload = (u) => {
545
- Y.forEach((i) => i()), W = !0, t(u);
547
+ r.async = !0, r.src = t, r.id = "storyblok-javascript-bridge", r.onerror = (u) => s(u), r.onload = (u) => {
548
+ Y.forEach((i) => i()), K = !0, e(u);
546
549
  }, document.getElementsByTagName("head")[0].appendChild(r);
547
550
  });
548
- var Rt = Object.defineProperty, St = (s, t, e) => t in s ? Rt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, p = (s, t, e) => St(s, typeof t != "symbol" ? t + "" : t, e);
549
- class It extends Error {
551
+ var Lt = class extends Error {
550
552
  constructor(t) {
551
553
  super(t), this.name = "AbortError";
552
554
  }
553
- }
554
- function Lt(s, t, e) {
555
- if (!Number.isFinite(t))
556
- throw new TypeError("Expected `limit` to be a finite number");
557
- if (!Number.isFinite(e))
558
- throw new TypeError("Expected `interval` to be a finite number");
555
+ };
556
+ function Tt(t, e, s) {
557
+ if (!Number.isFinite(e)) throw new TypeError("Expected `limit` to be a finite number");
558
+ if (!Number.isFinite(s)) throw new TypeError("Expected `interval` to be a finite number");
559
559
  const r = [];
560
- let u = [], i = 0, a = !1;
561
- const o = async () => {
560
+ let u = [], i = 0, o = !1;
561
+ const n = async () => {
562
562
  i++;
563
563
  const c = r.shift();
564
- if (c)
565
- try {
566
- const D = await s(...c.args);
567
- c.resolve(D);
568
- } catch (D) {
569
- c.reject(D);
570
- }
564
+ if (c) try {
565
+ const D = await t(...c.args);
566
+ c.resolve(D);
567
+ } catch (D) {
568
+ c.reject(D);
569
+ }
571
570
  const h = setTimeout(() => {
572
- i--, r.length > 0 && o(), u = u.filter((D) => D !== h);
573
- }, e);
571
+ i--, r.length > 0 && n(), u = u.filter((D) => D !== h);
572
+ }, s);
574
573
  u.includes(h) || u.push(h);
575
- }, n = (...c) => a ? Promise.reject(
576
- new Error(
577
- "Throttled function is already aborted and not accepting new promises"
578
- )
579
- ) : new Promise((h, D) => {
574
+ }, a = (...c) => o ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((h, D) => {
580
575
  r.push({
581
576
  resolve: h,
582
577
  reject: D,
583
578
  args: c
584
- }), i < t && o();
579
+ }), i < e && n();
585
580
  });
586
- return n.abort = () => {
587
- a = !0, u.forEach(clearTimeout), u = [], r.forEach(
588
- (c) => c.reject(() => new It("Throttle function aborted"))
589
- ), r.length = 0;
590
- }, n;
581
+ return a.abort = () => {
582
+ o = !0, u.forEach(clearTimeout), u = [], r.forEach((c) => c.reject(() => new Lt("Throttle function aborted"))), r.length = 0;
583
+ }, a;
591
584
  }
592
- const K = (s = "") => s.includes("/cdn/"), Tt = (s, t = 25, e = 1) => ({
593
- ...s,
594
- per_page: t,
595
- page: e
596
- }), Ot = (s) => new Promise((t) => setTimeout(t, s)), Pt = (s = 0, t) => Array.from({ length: s }, t), $t = (s = 0, t = s) => {
597
- const e = Math.abs(t - s) || 0, r = s < t ? 1 : -1;
598
- return Pt(e, (u, i) => i * r + s);
599
- }, jt = async (s, t) => Promise.all(s.map(t)), Nt = (s = [], t) => s.map(t).reduce((e, r) => [...e, ...r], []), H = (s, t, e) => {
585
+ var Pt = Tt;
586
+ const W = (t = "") => t.includes("/cdn/"), Ot = (t, e = 25, s = 1) => ({
587
+ ...t,
588
+ per_page: e,
589
+ page: s
590
+ }), It = (t) => new Promise((e) => setTimeout(e, t)), Nt = (t = 0, e) => Array.from({ length: t }, e), $t = (t = 0, e = t) => {
591
+ const s = Math.abs(e - t) || 0, r = t < e ? 1 : -1;
592
+ return Nt(s, (u, i) => i * r + t);
593
+ }, jt = async (t, e) => Promise.all(t.map(e)), Ht = (t = [], e) => t.map(e).reduce((s, r) => [...s, ...r], []), H = (t, e, s) => {
600
594
  const r = [];
601
- for (const u in s) {
602
- if (!Object.prototype.hasOwnProperty.call(s, u))
603
- continue;
604
- const i = s[u];
605
- if (i == null)
606
- continue;
607
- const a = e ? "" : encodeURIComponent(u);
608
- let o;
609
- typeof i == "object" ? o = H(
610
- i,
611
- t ? t + encodeURIComponent(`[${a}]`) : a,
612
- Array.isArray(i)
613
- ) : o = `${t ? t + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(i)}`, r.push(o);
595
+ for (const u in t) {
596
+ if (!Object.prototype.hasOwnProperty.call(t, u)) continue;
597
+ const i = t[u];
598
+ if (i == null) continue;
599
+ const o = s ? "" : encodeURIComponent(u);
600
+ let n;
601
+ typeof i == "object" ? n = H(i, e ? e + encodeURIComponent(`[${o}]`) : o, Array.isArray(i)) : n = `${e ? e + encodeURIComponent(`[${o}]`) : o}=${encodeURIComponent(i)}`, r.push(n);
614
602
  }
615
603
  return r.join("&");
616
- }, Z = (s) => {
617
- const t = {
604
+ }, Z = (t) => {
605
+ const e = {
618
606
  eu: "api.storyblok.com",
619
607
  us: "api-us.storyblok.com",
620
608
  cn: "app.storyblokchina.cn",
621
609
  ap: "api-ap.storyblok.com",
622
610
  ca: "api-ca.storyblok.com"
623
611
  };
624
- return t[s] ?? t.eu;
612
+ return e[t] ?? e.eu;
625
613
  };
626
- class Ht {
614
+ var Ut = class {
627
615
  constructor(t) {
628
- p(this, "baseURL"), p(this, "timeout"), p(this, "headers"), p(this, "responseInterceptor"), p(this, "fetch"), p(this, "ejectInterceptor"), p(this, "url"), p(this, "parameters"), p(this, "fetchOptions"), this.baseURL = t.baseURL, this.headers = t.headers || new 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 = {}, this.fetchOptions = {};
616
+ E(this, "baseURL");
617
+ E(this, "timeout");
618
+ E(this, "headers");
619
+ E(this, "responseInterceptor");
620
+ E(this, "fetch");
621
+ E(this, "ejectInterceptor");
622
+ E(this, "url");
623
+ E(this, "parameters");
624
+ E(this, "fetchOptions");
625
+ this.baseURL = t.baseURL, this.headers = t.headers || new 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 = {}, this.fetchOptions = {};
629
626
  }
630
627
  /**
631
- *
632
- * @param url string
633
- * @param params ISbStoriesParams
634
- * @returns Promise<ISbResponse | Error>
635
- */
628
+ *
629
+ * @param url string
630
+ * @param params ISbStoriesParams
631
+ * @returns Promise<ISbResponse | Error>
632
+ */
636
633
  get(t, e) {
637
634
  return this.url = t, this.parameters = e, this._methodHandler("get");
638
635
  }
@@ -646,42 +643,37 @@ class Ht {
646
643
  return this.url = t, this.parameters = e ?? {}, this._methodHandler("delete");
647
644
  }
648
645
  async _responseHandler(t) {
649
- const e = [], r = {
646
+ const e = [], s = {
650
647
  data: {},
651
648
  headers: {},
652
649
  status: 0,
653
650
  statusText: ""
654
651
  };
655
- t.status !== 204 && await t.json().then((u) => {
656
- r.data = u;
652
+ t.status !== 204 && await t.json().then((r) => {
653
+ s.data = r;
657
654
  });
658
- for (const u of t.headers.entries())
659
- e[u[0]] = u[1];
660
- return r.headers = { ...e }, r.status = t.status, r.statusText = t.statusText, r;
655
+ for (const r of t.headers.entries()) e[r[0]] = r[1];
656
+ return s.headers = { ...e }, s.status = t.status, s.statusText = t.statusText, s;
661
657
  }
662
658
  async _methodHandler(t) {
663
- let e = `${this.baseURL}${this.url}`, r = null;
664
- t === "get" ? e = `${this.baseURL}${this.url}?${H(this.parameters)}` : r = JSON.stringify(this.parameters);
665
- const u = new URL(e), i = new AbortController(), { signal: a } = i;
659
+ let e = `${this.baseURL}${this.url}`, s = null;
660
+ t === "get" ? e = `${this.baseURL}${this.url}?${H(this.parameters)}` : s = JSON.stringify(this.parameters);
661
+ const r = new URL(e), u = new AbortController(), { signal: i } = u;
666
662
  let o;
667
- this.timeout && (o = setTimeout(() => i.abort(), this.timeout));
663
+ this.timeout && (o = setTimeout(() => u.abort(), this.timeout));
668
664
  try {
669
- const n = await this.fetch(`${u}`, {
665
+ const n = await this.fetch(`${r}`, {
670
666
  method: t,
671
667
  headers: this.headers,
672
- body: r,
673
- signal: a,
668
+ body: s,
669
+ signal: i,
674
670
  ...this.fetchOptions
675
671
  });
676
672
  this.timeout && clearTimeout(o);
677
- const c = await this._responseHandler(
678
- n
679
- );
680
- return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
673
+ const a = await this._responseHandler(n);
674
+ return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(a)) : this._statusHandler(a);
681
675
  } catch (n) {
682
- return {
683
- message: n
684
- };
676
+ return { message: n };
685
677
  }
686
678
  }
687
679
  setFetchOptions(t = {}) {
@@ -691,79 +683,83 @@ class Ht {
691
683
  this.ejectInterceptor = !0;
692
684
  }
693
685
  /**
694
- * Normalizes error messages from different response structures
695
- * @param data The response data that might contain error information
696
- * @returns A normalized error message string
697
- */
686
+ * Normalizes error messages from different response structures
687
+ * @param data The response data that might contain error information
688
+ * @returns A normalized error message string
689
+ */
698
690
  _normalizeErrorMessage(t) {
699
- if (Array.isArray(t))
700
- return t[0] || "Unknown error";
691
+ if (Array.isArray(t)) return t[0] || "Unknown error";
701
692
  if (t && typeof t == "object") {
702
- if (t.error)
703
- return t.error;
693
+ if (t.error) return t.error;
704
694
  for (const e in t) {
705
- if (Array.isArray(t[e]))
706
- return `${e}: ${t[e][0]}`;
707
- if (typeof t[e] == "string")
708
- return `${e}: ${t[e]}`;
695
+ if (Array.isArray(t[e])) return `${e}: ${t[e][0]}`;
696
+ if (typeof t[e] == "string") return `${e}: ${t[e]}`;
709
697
  }
710
- if (t.slug)
711
- return t.slug;
698
+ if (t.slug) return t.slug;
712
699
  }
713
700
  return "Unknown error";
714
701
  }
715
702
  _statusHandler(t) {
716
703
  const e = /20[0-6]/g;
717
- return new Promise((r, u) => {
718
- if (e.test(`${t.status}`))
719
- return r(t);
720
- const i = {
704
+ return new Promise((s, r) => {
705
+ if (e.test(`${t.status}`)) return s(t);
706
+ const u = {
721
707
  message: this._normalizeErrorMessage(t.data),
722
708
  status: t.status,
723
709
  response: t
724
710
  };
725
- u(i);
711
+ r(u);
726
712
  });
727
713
  }
728
- }
729
- const X = "SB-Agent", j = {
714
+ }, Mt = Ut;
715
+ const X = "SB-Agent", $ = {
730
716
  defaultAgentName: "SB-JS-CLIENT",
731
717
  defaultAgentVersion: "SB-Agent-Version",
732
718
  packageVersion: "7.0.0"
733
- }, Mt = {
719
+ }, zt = {
734
720
  PUBLISHED: "published"
735
721
  };
736
- let T = {};
722
+ let P = {};
737
723
  const B = {};
738
- class Ut {
724
+ var Gt = class {
739
725
  /**
740
- *
741
- * @param config ISbConfig interface
742
- * @param pEndpoint string, optional
743
- */
726
+ *
727
+ * @param config ISbConfig interface
728
+ * @param pEndpoint string, optional
729
+ */
744
730
  constructor(t, e) {
745
- p(this, "client"), p(this, "maxRetries"), p(this, "retriesDelay"), p(this, "throttle"), p(this, "accessToken"), p(this, "cache"), p(this, "resolveCounter"), p(this, "relations"), p(this, "links"), p(this, "version"), p(this, "richTextResolver"), p(this, "resolveNestedRelations"), p(this, "stringifiedStoriesCache"), p(this, "inlineAssets");
746
- let r = t.endpoint || e;
747
- if (!r) {
748
- const a = t.https === !1 ? "http" : "https";
749
- t.oauthToken ? r = `${a}://${Z(t.region)}/v1` : r = `${a}://${Z(t.region)}/v2`;
731
+ E(this, "client");
732
+ E(this, "maxRetries");
733
+ E(this, "retriesDelay");
734
+ E(this, "throttle");
735
+ E(this, "accessToken");
736
+ E(this, "cache");
737
+ E(this, "resolveCounter");
738
+ E(this, "relations");
739
+ E(this, "links");
740
+ E(this, "version");
741
+ /**
742
+ * @deprecated This property is deprecated. Use the standalone `richTextResolver` from `@storyblok/richtext` instead.
743
+ * @see https://github.com/storyblok/richtext
744
+ */
745
+ E(this, "richTextResolver");
746
+ E(this, "resolveNestedRelations");
747
+ E(this, "stringifiedStoriesCache");
748
+ E(this, "inlineAssets");
749
+ let s = t.endpoint || e;
750
+ if (!s) {
751
+ const i = t.https === !1 ? "http" : "https";
752
+ t.oauthToken ? s = `${i}://${Z(t.region)}/v1` : s = `${i}://${Z(t.region)}/v2`;
750
753
  }
751
- const u = new Headers();
752
- u.set("Content-Type", "application/json"), u.set("Accept", "application/json"), t.headers && (t.headers.constructor.name === "Headers" ? t.headers.entries().toArray() : Object.entries(t.headers)).forEach(([a, o]) => {
753
- u.set(a, o);
754
- }), u.has(X) || (u.set(X, j.defaultAgentName), u.set(
755
- j.defaultAgentVersion,
756
- j.packageVersion
757
- ));
758
- let i = 5;
759
- t.oauthToken && (u.set("Authorization", t.oauthToken), i = 3), t.rateLimit && (i = t.rateLimit), this.maxRetries = t.maxRetries || 10, this.retriesDelay = 300, this.throttle = Lt(
760
- this.throttledRequest.bind(this),
761
- i,
762
- 1e3
763
- ), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = t.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = t.version || Mt.PUBLISHED, this.inlineAssets = t.inlineAssets || !1, this.client = new Ht({
764
- baseURL: r,
754
+ const r = new Headers();
755
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), t.headers && (t.headers.constructor.name === "Headers" ? t.headers.entries().toArray() : Object.entries(t.headers)).forEach(([o, n]) => {
756
+ r.set(o, n);
757
+ }), r.has(X) || (r.set(X, $.defaultAgentName), r.set($.defaultAgentVersion, $.packageVersion));
758
+ let u = 5;
759
+ t.oauthToken && (r.set("Authorization", t.oauthToken), u = 3), t.rateLimit && (u = t.rateLimit), this.maxRetries = t.maxRetries || 10, this.retriesDelay = 300, this.throttle = Pt(this.throttledRequest.bind(this), u, 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = t.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = t.version || zt.PUBLISHED, this.inlineAssets = t.inlineAssets || !1, this.client = new Mt({
760
+ baseURL: s,
765
761
  timeout: t.timeout || 0,
766
- headers: u,
762
+ headers: r,
767
763
  responseInterceptor: t.responseInterceptor,
768
764
  fetch: t.fetch
769
765
  });
@@ -772,55 +768,43 @@ class Ut {
772
768
  return t.token || (t.token = this.getToken()), t.cv || (t.cv = B[t.token]), Array.isArray(t.resolve_relations) && (t.resolve_relations = t.resolve_relations.join(",")), typeof t.resolve_relations < "u" && (t.resolve_level = 2), t;
773
769
  }
774
770
  factoryParamOptions(t, e) {
775
- return K(t) ? this.parseParams(e) : e;
771
+ return W(t) ? this.parseParams(e) : e;
776
772
  }
777
- makeRequest(t, e, r, u, i) {
778
- const a = this.factoryParamOptions(
779
- t,
780
- Tt(e, r, u)
781
- );
782
- return this.cacheResponse(t, a, void 0, i);
773
+ makeRequest(t, e, s, r, u) {
774
+ const i = this.factoryParamOptions(t, Ot(e, s, r));
775
+ return this.cacheResponse(t, i, void 0, u);
783
776
  }
784
- get(t, e = {}, r) {
777
+ get(t, e = {}, s) {
785
778
  e || (e = {});
786
- const u = `/${t}`;
787
- K(u) && (e.version = e.version || this.version);
788
- const i = this.factoryParamOptions(u, e);
789
- return this.cacheResponse(u, i, void 0, r);
779
+ const r = `/${t}`;
780
+ W(r) && (e.version = e.version || this.version);
781
+ const u = this.factoryParamOptions(r, e);
782
+ return this.cacheResponse(r, u, void 0, s);
790
783
  }
791
- async getAll(t, e = {}, r, u) {
792
- const i = (e == null ? void 0 : e.per_page) || 25, a = `/${t}`.replace(/\/$/, ""), o = r ?? a.substring(a.lastIndexOf("/") + 1);
784
+ async getAll(t, e = {}, s, r) {
785
+ const u = (e == null ? void 0 : e.per_page) || 25, i = `/${t}`.replace(/\/$/, ""), o = s ?? i.substring(i.lastIndexOf("/") + 1);
793
786
  e.version = e.version || this.version;
794
- const n = 1, c = await this.makeRequest(
795
- a,
796
- e,
797
- i,
798
- n,
799
- u
800
- ), h = c.total ? Math.ceil(c.total / (c.perPage || i)) : 1, D = await jt(
801
- $t(n, h),
802
- (A) => this.makeRequest(a, e, i, A + 1, u)
803
- );
804
- return Nt([c, ...D], (A) => Object.values(A.data[o]));
787
+ const n = 1, a = await this.makeRequest(i, e, u, n, r), c = a.total ? Math.ceil(a.total / (a.perPage || u)) : 1, h = await jt($t(n, c), (D) => this.makeRequest(i, e, u, D + 1, r));
788
+ return Ht([a, ...h], (D) => Object.values(D.data[o]));
805
789
  }
806
- post(t, e = {}, r) {
807
- const u = `/${t}`;
808
- return this.throttle("post", u, e, r);
790
+ post(t, e = {}, s) {
791
+ const r = `/${t}`;
792
+ return this.throttle("post", r, e, s);
809
793
  }
810
- put(t, e = {}, r) {
811
- const u = `/${t}`;
812
- return this.throttle("put", u, e, r);
794
+ put(t, e = {}, s) {
795
+ const r = `/${t}`;
796
+ return this.throttle("put", r, e, s);
813
797
  }
814
- delete(t, e = {}, r) {
798
+ delete(t, e = {}, s) {
815
799
  e || (e = {});
816
- const u = `/${t}`;
817
- return this.throttle("delete", u, e, r);
800
+ const r = `/${t}`;
801
+ return this.throttle("delete", r, e, s);
818
802
  }
819
803
  getStories(t = {}, e) {
820
804
  return this._addResolveLevel(t), this.get("cdn/stories", t, e);
821
805
  }
822
- getStory(t, e = {}, r) {
823
- return this._addResolveLevel(e), this.get(`cdn/stories/${t}`, e, r);
806
+ getStory(t, e = {}, s) {
807
+ return this._addResolveLevel(e), this.get(`cdn/stories/${t}`, e, s);
824
808
  }
825
809
  getToken() {
826
810
  return this.accessToken;
@@ -834,201 +818,189 @@ class Ut {
834
818
  _cleanCopy(t) {
835
819
  return JSON.parse(JSON.stringify(t));
836
820
  }
837
- _insertLinks(t, e, r) {
838
- const u = t[e];
839
- u && u.fieldtype === "multilink" && u.linktype === "story" && typeof u.id == "string" && this.links[r][u.id] ? u.story = this._cleanCopy(this.links[r][u.id]) : u && u.linktype === "story" && typeof u.uuid == "string" && this.links[r][u.uuid] && (u.story = this._cleanCopy(this.links[r][u.uuid]));
821
+ _insertLinks(t, e, s) {
822
+ const r = t[e];
823
+ 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]));
840
824
  }
841
825
  /**
842
- *
843
- * @param resolveId A counter number as a string
844
- * @param uuid The uuid of the story
845
- * @returns string | object
846
- */
826
+ *
827
+ * @param resolveId A counter number as a string
828
+ * @param uuid The uuid of the story
829
+ * @returns string | object
830
+ */
847
831
  getStoryReference(t, e) {
848
832
  return this.relations[t][e] ? JSON.parse(this.stringifiedStoriesCache[e] || JSON.stringify(this.relations[t][e])) : e;
849
833
  }
850
834
  /**
851
- * Resolves a field's value by replacing UUIDs with their corresponding story references
852
- * @param jtree - The JSON tree object containing the field to resolve
853
- * @param treeItem - The key of the field to resolve
854
- * @param resolveId - The unique identifier for the current resolution context
855
- *
856
- * This method handles both single string UUIDs and arrays of UUIDs:
857
- * - For single strings: directly replaces the UUID with the story reference
858
- * - For arrays: maps through each UUID and replaces with corresponding story references
859
- */
860
- _resolveField(t, e, r) {
861
- const u = t[e];
862
- typeof u == "string" ? t[e] = this.getStoryReference(r, u) : Array.isArray(u) && (t[e] = u.map(
863
- (i) => this.getStoryReference(r, i)
864
- ).filter(Boolean));
835
+ * Resolves a field's value by replacing UUIDs with their corresponding story references
836
+ * @param jtree - The JSON tree object containing the field to resolve
837
+ * @param treeItem - The key of the field to resolve
838
+ * @param resolveId - The unique identifier for the current resolution context
839
+ *
840
+ * This method handles both single string UUIDs and arrays of UUIDs:
841
+ * - For single strings: directly replaces the UUID with the story reference
842
+ * - For arrays: maps through each UUID and replaces with corresponding story references
843
+ */
844
+ _resolveField(t, e, s) {
845
+ const r = t[e];
846
+ typeof r == "string" ? t[e] = this.getStoryReference(s, r) : Array.isArray(r) && (t[e] = r.map((u) => this.getStoryReference(s, u)).filter(Boolean));
865
847
  }
866
848
  /**
867
- * Inserts relations into the JSON tree by resolving references
868
- * @param jtree - The JSON tree object to process
869
- * @param treeItem - The current field being processed
870
- * @param fields - The relation patterns to resolve (string or array of strings)
871
- * @param resolveId - The unique identifier for the current resolution context
872
- *
873
- * This method handles two types of relation patterns:
874
- * 1. Nested relations: matches fields that end with the current field name
875
- * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
876
- *
877
- * 2. Direct component relations: matches exact component.field patterns
878
- * Example: "event.event_type" for component "event" and field "event_type"
879
- *
880
- * The method supports both string and array formats for the fields parameter,
881
- * allowing flexible specification of relation patterns.
882
- */
883
- _insertRelations(t, e, r, u) {
884
- if (Array.isArray(r) ? r.find((a) => a.endsWith(`.${e}`)) : r.endsWith(`.${e}`)) {
885
- this._resolveField(t, e, u);
849
+ * Inserts relations into the JSON tree by resolving references
850
+ * @param jtree - The JSON tree object to process
851
+ * @param treeItem - The current field being processed
852
+ * @param fields - The relation patterns to resolve (string or array of strings)
853
+ * @param resolveId - The unique identifier for the current resolution context
854
+ *
855
+ * This method handles two types of relation patterns:
856
+ * 1. Nested relations: matches fields that end with the current field name
857
+ * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
858
+ *
859
+ * 2. Direct component relations: matches exact component.field patterns
860
+ * Example: "event.event_type" for component "event" and field "event_type"
861
+ *
862
+ * The method supports both string and array formats for the fields parameter,
863
+ * allowing flexible specification of relation patterns.
864
+ */
865
+ _insertRelations(t, e, s, r) {
866
+ if (Array.isArray(s) ? s.find((o) => o.endsWith(`.${e}`)) : s.endsWith(`.${e}`)) {
867
+ this._resolveField(t, e, r);
886
868
  return;
887
869
  }
888
870
  const i = t.component ? `${t.component}.${e}` : e;
889
- (Array.isArray(r) ? r.includes(i) : r === i) && this._resolveField(t, e, u);
871
+ (Array.isArray(s) ? s.includes(i) : s === i) && this._resolveField(t, e, r);
890
872
  }
891
873
  /**
892
- * Recursively traverses and resolves relations in the story content tree
893
- * @param story - The story object containing the content to process
894
- * @param fields - The relation patterns to resolve
895
- * @param resolveId - The unique identifier for the current resolution context
896
- */
897
- iterateTree(t, e, r) {
898
- const u = (i, a = "") => {
899
- if (!(!i || i._stopResolving)) {
900
- if (Array.isArray(i))
901
- i.forEach((o, n) => u(o, `${a}[${n}]`));
902
- else if (typeof i == "object")
903
- for (const o in i) {
904
- const n = a ? `${a}.${o}` : o;
905
- (i.component && i._uid || i.type === "link") && (this._insertRelations(i, o, e, r), this._insertLinks(i, o, r)), u(i[o], n);
906
- }
874
+ * Recursively traverses and resolves relations in the story content tree
875
+ * @param story - The story object containing the content to process
876
+ * @param fields - The relation patterns to resolve
877
+ * @param resolveId - The unique identifier for the current resolution context
878
+ */
879
+ iterateTree(t, e, s) {
880
+ const r = (u, i = "") => {
881
+ if (!(!u || u._stopResolving)) {
882
+ if (Array.isArray(u)) u.forEach((o, n) => r(o, `${i}[${n}]`));
883
+ else if (typeof u == "object") for (const o in u) {
884
+ const n = i ? `${i}.${o}` : o;
885
+ (u.component && u._uid || u.type === "link") && (this._insertRelations(u, o, e, s), this._insertLinks(u, o, s)), r(u[o], n);
886
+ }
907
887
  }
908
888
  };
909
- u(t.content);
889
+ r(t.content);
910
890
  }
911
- async resolveLinks(t, e, r) {
912
- let u = [];
891
+ async resolveLinks(t, e, s) {
892
+ let r = [];
913
893
  if (t.link_uuids) {
914
- const i = t.link_uuids.length, a = [], o = 50;
915
- for (let n = 0; n < i; n += o) {
916
- const c = Math.min(i, n + o);
917
- a.push(t.link_uuids.slice(n, c));
894
+ const u = t.link_uuids.length, i = [], o = 50;
895
+ for (let n = 0; n < u; n += o) {
896
+ const a = Math.min(u, n + o);
897
+ i.push(t.link_uuids.slice(n, a));
918
898
  }
919
- for (let n = 0; n < a.length; n++)
899
+ for (let n = 0; n < i.length; n++)
920
900
  (await this.getStories({
921
901
  per_page: o,
922
902
  language: e.language,
923
903
  version: e.version,
924
904
  starts_with: e.starts_with,
925
- by_uuids: a[n].join(",")
926
- })).data.stories.forEach(
927
- (c) => {
928
- u.push(c);
929
- }
930
- );
931
- } else
932
- u = t.links;
933
- u.forEach((i) => {
934
- this.links[r][i.uuid] = {
935
- ...i,
905
+ by_uuids: i[n].join(",")
906
+ })).data.stories.forEach((c) => {
907
+ r.push(c);
908
+ });
909
+ } else r = t.links;
910
+ r.forEach((u) => {
911
+ this.links[s][u.uuid] = {
912
+ ...u,
936
913
  _stopResolving: !0
937
914
  };
938
915
  });
939
916
  }
940
- async resolveRelations(t, e, r) {
941
- let u = [];
917
+ async resolveRelations(t, e, s) {
918
+ let r = [];
942
919
  if (t.rel_uuids) {
943
- const i = t.rel_uuids.length, a = [], o = 50;
944
- for (let n = 0; n < i; n += o) {
945
- const c = Math.min(i, n + o);
946
- a.push(t.rel_uuids.slice(n, c));
920
+ const u = t.rel_uuids.length, i = [], o = 50;
921
+ for (let n = 0; n < u; n += o) {
922
+ const a = Math.min(u, n + o);
923
+ i.push(t.rel_uuids.slice(n, a));
947
924
  }
948
- for (let n = 0; n < a.length; n++)
925
+ for (let n = 0; n < i.length; n++)
949
926
  (await this.getStories({
950
927
  per_page: o,
951
928
  language: e.language,
952
929
  version: e.version,
953
930
  starts_with: e.starts_with,
954
- by_uuids: a[n].join(","),
931
+ by_uuids: i[n].join(","),
955
932
  excluding_fields: e.excluding_fields
956
933
  })).data.stories.forEach((c) => {
957
- u.push(c);
934
+ r.push(c);
958
935
  });
959
- u.length > 0 && (t.rels = u, delete t.rel_uuids);
960
- } else
961
- u = t.rels;
962
- u && u.length > 0 && u.forEach((i) => {
963
- this.relations[r][i.uuid] = {
964
- ...i,
936
+ r.length > 0 && (t.rels = r, delete t.rel_uuids);
937
+ } else r = t.rels;
938
+ r && r.length > 0 && r.forEach((u) => {
939
+ this.relations[s][u.uuid] = {
940
+ ...u,
965
941
  _stopResolving: !0
966
942
  };
967
943
  });
968
944
  }
969
945
  /**
970
- *
971
- * @param responseData
972
- * @param params
973
- * @param resolveId
974
- * @description Resolves the relations and links of the stories
975
- * @returns Promise<void>
976
- *
977
- */
978
- async resolveStories(t, e, r) {
946
+ *
947
+ * @param responseData
948
+ * @param params
949
+ * @param resolveId
950
+ * @description Resolves the relations and links of the stories
951
+ * @returns Promise<void>
952
+ *
953
+ */
954
+ async resolveStories(t, e, s) {
979
955
  var u, i;
980
- let a = [];
981
- if (this.links[r] = {}, this.relations[r] = {}, typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (typeof e.resolve_relations == "string" && (a = e.resolve_relations.split(",")), await this.resolveRelations(t, e, r)), e.resolve_links && ["1", "story", "url", "link"].includes(e.resolve_links) && ((u = t.links) != null && u.length || (i = t.link_uuids) != null && i.length) && await this.resolveLinks(t, e, r), this.resolveNestedRelations)
982
- for (const o in this.relations[r])
983
- this.iterateTree(
984
- this.relations[r][o],
985
- a,
986
- r
987
- );
988
- t.story ? this.iterateTree(t.story, a, r) : t.stories.forEach((o) => {
989
- this.iterateTree(o, a, r);
990
- }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
956
+ let r = [];
957
+ if (this.links[s] = {}, this.relations[s] = {}, typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (typeof e.resolve_relations == "string" && (r = e.resolve_relations.split(",")), await this.resolveRelations(t, e, s)), e.resolve_links && [
958
+ "1",
959
+ "story",
960
+ "url",
961
+ "link"
962
+ ].includes(e.resolve_links) && ((u = t.links) != null && u.length || (i = t.link_uuids) != null && i.length) && await this.resolveLinks(t, e, s), this.resolveNestedRelations) for (const o in this.relations[s]) this.iterateTree(this.relations[s][o], r, s);
963
+ t.story ? this.iterateTree(t.story, r, s) : t.stories.forEach((o) => {
964
+ this.iterateTree(o, r, s);
965
+ }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
991
966
  }
992
- async cacheResponse(t, e, r, u) {
993
- const i = H({ url: t, params: e }), a = this.cacheProvider();
967
+ async cacheResponse(t, e, s, r) {
968
+ const u = H({
969
+ url: t,
970
+ params: e
971
+ }), i = this.cacheProvider();
994
972
  if (e.version === "published" && t !== "/cdn/spaces/me") {
995
- const o = await a.get(i);
996
- if (o)
997
- return Promise.resolve(o);
973
+ const o = await i.get(u);
974
+ if (o) return Promise.resolve(o);
998
975
  }
999
976
  return new Promise(async (o, n) => {
1000
- var c;
977
+ var a;
1001
978
  try {
1002
- const h = await this.throttle(
1003
- "get",
1004
- t,
1005
- e,
1006
- u
1007
- );
1008
- if (h.status !== 200)
1009
- return n(h);
1010
- let D = { data: h.data, headers: h.headers };
1011
- if ((c = h.headers) != null && c["per-page"] && (D = Object.assign({}, D, {
1012
- perPage: h.headers["per-page"] ? Number.parseInt(h.headers["per-page"]) : 0,
1013
- total: h.headers["per-page"] ? Number.parseInt(h.headers.total) : 0
1014
- })), D.data.story || D.data.stories) {
1015
- const m = this.resolveCounter = ++this.resolveCounter % 1e3;
1016
- await this.resolveStories(D.data, e, `${m}`), D = await this.processInlineAssets(D);
979
+ const c = await this.throttle("get", t, e, r);
980
+ if (c.status !== 200) return n(c);
981
+ let h = {
982
+ data: c.data,
983
+ headers: c.headers
984
+ };
985
+ if ((a = c.headers) != null && a["per-page"] && (h = Object.assign({}, h, {
986
+ perPage: c.headers["per-page"] ? Number.parseInt(c.headers["per-page"]) : 0,
987
+ total: c.headers["per-page"] ? Number.parseInt(c.headers.total) : 0
988
+ })), h.data.story || h.data.stories) {
989
+ const g = this.resolveCounter = ++this.resolveCounter % 1e3;
990
+ await this.resolveStories(h.data, e, `${g}`), h = await this.processInlineAssets(h);
1017
991
  }
1018
- e.version === "published" && t !== "/cdn/spaces/me" && await a.set(i, D);
1019
- const A = this.cache.clear === "onpreview" && e.version === "draft" || this.cache.clear === "auto";
1020
- return e.token && D.data.cv && (A && B[e.token] && B[e.token] !== D.data.cv && await this.flushCache(), B[e.token] = D.data.cv), o(D);
1021
- } catch (h) {
1022
- if (h.response && h.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
1023
- return console.log(
1024
- `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
1025
- ), await Ot(this.retriesDelay), this.cacheResponse(t, e, r).then(o).catch(n);
1026
- n(h);
992
+ e.version === "published" && t !== "/cdn/spaces/me" && await i.set(u, h);
993
+ const D = this.cache.clear === "onpreview" && e.version === "draft" || this.cache.clear === "auto";
994
+ return e.token && h.data.cv && (D && B[e.token] && B[e.token] !== h.data.cv && await this.flushCache(), B[e.token] = h.data.cv), o(h);
995
+ } catch (c) {
996
+ if (c.response && c.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
997
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await It(this.retriesDelay), this.cacheResponse(t, e, s).then(o).catch(n);
998
+ n(c);
1027
999
  }
1028
1000
  });
1029
1001
  }
1030
- throttledRequest(t, e, r, u) {
1031
- return this.client.setFetchOptions(u), this.client[t](e, r);
1002
+ throttledRequest(t, e, s, r) {
1003
+ return this.client.setFetchOptions(r), this.client[t](e, s);
1032
1004
  }
1033
1005
  cacheVersions() {
1034
1006
  return B;
@@ -1047,22 +1019,20 @@ class Ut {
1047
1019
  case "memory":
1048
1020
  return {
1049
1021
  get(t) {
1050
- return Promise.resolve(T[t]);
1022
+ return Promise.resolve(P[t]);
1051
1023
  },
1052
1024
  getAll() {
1053
- return Promise.resolve(T);
1025
+ return Promise.resolve(P);
1054
1026
  },
1055
1027
  set(t, e) {
1056
- return T[t] = e, Promise.resolve(void 0);
1028
+ return P[t] = e, Promise.resolve(void 0);
1057
1029
  },
1058
1030
  flush() {
1059
- return T = {}, Promise.resolve(void 0);
1031
+ return P = {}, Promise.resolve(void 0);
1060
1032
  }
1061
1033
  };
1062
1034
  case "custom":
1063
- if (this.cache.custom)
1064
- return this.cache.custom;
1065
- // eslint-disable-next-line no-fallthrough
1035
+ if (this.cache.custom) return this.cache.custom;
1066
1036
  default:
1067
1037
  return {
1068
1038
  get() {
@@ -1084,99 +1054,95 @@ class Ut {
1084
1054
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
1085
1055
  }
1086
1056
  async processInlineAssets(t) {
1087
- if (!this.inlineAssets)
1088
- return t;
1089
- const e = (r) => {
1090
- if (!r || typeof r != "object")
1091
- return r;
1092
- if (Array.isArray(r))
1093
- return r.map((i) => e(i));
1094
- let u = { ...r };
1095
- u.fieldtype === "asset" && Array.isArray(t.data.assets) && (u = {
1096
- ...u,
1097
- ...t.data.assets.find((i) => i.id === u.id)
1057
+ if (!this.inlineAssets) return t;
1058
+ const e = (s) => {
1059
+ if (!s || typeof s != "object") return s;
1060
+ if (Array.isArray(s)) return s.map((u) => e(u));
1061
+ let r = { ...s };
1062
+ r.fieldtype === "asset" && Array.isArray(t.data.assets) && (r = {
1063
+ ...r,
1064
+ ...t.data.assets.find((u) => u.id === r.id)
1098
1065
  });
1099
- for (const i in u)
1100
- typeof u[i] == "object" && (u[i] = e(u[i]));
1101
- return u;
1066
+ for (const u in r) typeof r[u] == "object" && (r[u] = e(r[u]));
1067
+ return r;
1102
1068
  };
1103
- return t.data.story && (t.data.story.content = e(t.data.story.content)), t.data.stories && (t.data.stories = t.data.stories.map((r) => (r.content = e(r.content), r))), t;
1069
+ return t.data.story && (t.data.story.content = e(t.data.story.content)), t.data.stories && (t.data.stories = t.data.stories.map((s) => (s.content = e(s.content), s))), t;
1104
1070
  }
1105
- }
1106
- const zt = (s = {}) => {
1107
- const { apiOptions: t } = s;
1108
- if (!t || !t.accessToken) {
1071
+ }, qt = Gt;
1072
+ const Vt = (t = {}) => {
1073
+ const { apiOptions: e } = t;
1074
+ if (!e || !e.accessToken) {
1109
1075
  console.error(
1110
1076
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
1111
1077
  );
1112
1078
  return;
1113
1079
  }
1114
- return { storyblokApi: new Ut(t) };
1115
- }, Gt = (s) => {
1116
- if (typeof s != "object" || typeof s._editable > "u")
1080
+ return { storyblokApi: new qt(e) };
1081
+ }, Kt = (t) => {
1082
+ if (typeof t != "object" || typeof t._editable > "u")
1117
1083
  return {};
1118
1084
  try {
1119
- const t = JSON.parse(
1120
- s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
1085
+ const e = JSON.parse(
1086
+ t._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
1121
1087
  );
1122
- return t ? {
1123
- "data-blok-c": JSON.stringify(t),
1124
- "data-blok-uid": `${t.id}-${t.uid}`
1088
+ return e ? {
1089
+ "data-blok-c": JSON.stringify(e),
1090
+ "data-blok-uid": `${e.id}-${e.uid}`
1125
1091
  } : {};
1126
1092
  } catch {
1127
1093
  return {};
1128
1094
  }
1129
1095
  };
1130
- let N = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1131
- const qt = (s, t, e = {}) => {
1132
- var o;
1133
- const u = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", i = new URL((o = window.location) == null ? void 0 : o.href).searchParams.get(
1096
+ let j = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1097
+ const Yt = (t, e, s = {}) => {
1098
+ var n;
1099
+ const u = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", i = new URL((n = window.location) == null ? void 0 : n.href).searchParams.get(
1134
1100
  "_storyblok"
1135
- ), a = i !== null && +i === s;
1136
- if (!(!u || !a)) {
1137
- if (!s) {
1101
+ ), o = i !== null && +i === t;
1102
+ if (!(!u || !o)) {
1103
+ if (!t) {
1138
1104
  console.warn("Story ID is not defined. Please provide a valid ID.");
1139
1105
  return;
1140
1106
  }
1141
1107
  window.storyblokRegisterEvent(() => {
1142
- new window.StoryblokBridge(e).on(["input", "published", "change"], (c) => {
1108
+ new window.StoryblokBridge(s).on(["input", "published", "change"], (c) => {
1143
1109
  var h;
1144
- c && (c.action === "input" && ((h = c.story) == null ? void 0 : h.id) === s ? t(c.story) : (c.action === "change" || c.action === "published") && c.storyId === s && window.location.reload());
1110
+ c && (c.action === "input" && ((h = c.story) == null ? void 0 : h.id) === t ? e(c.story) : (c.action === "change" || c.action === "published") && c.storyId === t && window.location.reload());
1145
1111
  });
1146
1112
  });
1147
1113
  }
1148
- }, Jt = (s = {}) => {
1114
+ }, Wt = (t = {}) => {
1149
1115
  var h, D;
1150
1116
  const {
1151
- bridge: t,
1152
- accessToken: e,
1117
+ bridge: e,
1118
+ accessToken: s,
1153
1119
  use: r = [],
1154
1120
  apiOptions: u = {},
1155
1121
  bridgeUrl: i
1156
- } = s;
1157
- u.accessToken = u.accessToken || e;
1158
- const a = { bridge: t, apiOptions: u };
1159
- let o = {};
1160
- r.forEach((A) => {
1161
- o = { ...o, ...A(a) };
1162
- }), i && (N = i);
1122
+ } = t;
1123
+ u.accessToken = u.accessToken || s;
1124
+ const o = { bridge: e, apiOptions: u };
1125
+ let n = {};
1126
+ r.forEach((g) => {
1127
+ n = { ...n, ...g(o) };
1128
+ }), i && (j = i);
1163
1129
  const c = !(typeof window > "u") && ((D = (h = window.location) == null ? void 0 : h.search) == null ? void 0 : D.includes("_storyblok_tk"));
1164
- return t !== !1 && c && tt(N), o;
1130
+ return e !== !1 && c && tt(j), n;
1165
1131
  };
1166
- function Vt(s, t) {
1167
- return _t(t).render(s);
1132
+ function Zt(t, e) {
1133
+ return St(e).render(t);
1168
1134
  }
1169
- const Wt = () => tt(N);
1135
+ const Xt = () => tt(j);
1170
1136
  export {
1171
1137
  b as BlockTypes,
1172
- k as MarkTypes,
1173
- bt as TextTypes,
1174
- zt as apiPlugin,
1175
- Wt as loadStoryblokBridge,
1176
- qt as registerStoryblokBridge,
1177
- Vt as renderRichText,
1178
- _t as richTextResolver,
1179
- Gt as storyblokEditable,
1180
- Jt as storyblokInit,
1181
- qt as useStoryblokBridge
1138
+ v as MarkTypes,
1139
+ vt as TextTypes,
1140
+ Vt as apiPlugin,
1141
+ Xt as loadStoryblokBridge,
1142
+ Yt as registerStoryblokBridge,
1143
+ Zt as renderRichText,
1144
+ St as richTextResolver,
1145
+ Kt as storyblokEditable,
1146
+ Wt as storyblokInit,
1147
+ Yt as useStoryblokBridge
1182
1148
  };