@storyblok/astro 4.0.5 → 4.1.0-next.1
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.
- package/dist/storyblok-astro.js +15 -17
- package/dist/storyblok-astro.mjs +935 -331
- package/dist/types/components/FallbackComponent.d.ts +1 -2
- package/dist/types/components/RichTextRenderer.d.ts +1 -2
- package/dist/types/components/StoryblokComponent.d.ts +1 -2
- package/dist/types/index.d.ts +8 -5
- package/dist/types/live-preview/handleStoryblokMessage.d.ts +1 -0
- package/dist/types/live-preview/middleware.d.ts +1 -0
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils/generateFinalBridgeObject.d.ts +3 -0
- package/dist/types/utils/parseAstCode.d.ts +1 -0
- package/dist/types/vite-plugins/vite-plugin-storyblok-bridge.d.ts +2 -0
- package/dist/types/vite-plugins/vite-plugin-storyblok-components.d.ts +1 -2
- package/dist/types/vite-plugins/vite-plugin-storyblok-init.d.ts +2 -3
- package/dist/types/vite-plugins/vite-plugin-storyblok-options.d.ts +1 -2
- package/live-preview/handleStoryblokMessage.ts +57 -0
- package/live-preview/middleware.ts +11 -0
- package/package.json +13 -4
- package/utils/generateFinalBridgeObject.ts +32 -0
- package/utils/parseAstCode.ts +41 -0
- package/vite-plugins/vite-plugin-storyblok-bridge.ts +69 -0
- package/vite-plugins/vite-plugin-storyblok-components.ts +124 -0
- package/vite-plugins/vite-plugin-storyblok-init.ts +33 -0
- package/vite-plugins/vite-plugin-storyblok-options.ts +20 -0
package/dist/storyblok-astro.mjs
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function Or(o, e, r) {
|
|
2
|
+
const i = "virtual:storyblok-init", s = "\0" + i;
|
|
3
3
|
return {
|
|
4
4
|
name: "vite-plugin-storyblok-init",
|
|
5
|
-
async resolveId(
|
|
6
|
-
if (
|
|
5
|
+
async resolveId(l) {
|
|
6
|
+
if (l === i)
|
|
7
7
|
return s;
|
|
8
8
|
},
|
|
9
|
-
async load(
|
|
10
|
-
if (
|
|
9
|
+
async load(l) {
|
|
10
|
+
if (l === s)
|
|
11
11
|
return `
|
|
12
12
|
import { storyblokInit, apiPlugin } from "@storyblok/js";
|
|
13
13
|
const { storyblokApi } = storyblokInit({
|
|
14
|
-
accessToken: "${
|
|
15
|
-
use: ${
|
|
16
|
-
apiOptions: ${JSON.stringify(
|
|
14
|
+
accessToken: "${o}",
|
|
15
|
+
use: ${e ? "[]" : "[apiPlugin]"},
|
|
16
|
+
apiOptions: ${JSON.stringify(r)},
|
|
17
17
|
});
|
|
18
18
|
export const storyblokApiInstance = storyblokApi;
|
|
19
19
|
`;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
let s = !1,
|
|
25
|
-
for (let
|
|
26
|
-
const
|
|
27
|
-
|
|
23
|
+
const Sr = /[\p{Lu}]/u, Cr = /[\p{Ll}]/u, zt = /^[\p{Lu}](?![\p{Lu}])/gu, qt = /([\p{Alpha}\p{N}_]|$)/u, ft = /[_.\- ]+/, jr = new RegExp("^" + ft.source), Lt = new RegExp(ft.source + qt.source, "gu"), Ut = new RegExp("\\d+" + qt.source, "gu"), $r = (o, e, r, i) => {
|
|
24
|
+
let s = !1, l = !1, u = !1, b = !1;
|
|
25
|
+
for (let d = 0; d < o.length; d++) {
|
|
26
|
+
const h = o[d];
|
|
27
|
+
b = d > 2 ? o[d - 3] === "-" : !0, s && Sr.test(h) ? (o = o.slice(0, d) + "-" + o.slice(d), s = !1, u = l, l = !0, d++) : l && u && Cr.test(h) && (!b || i) ? (o = o.slice(0, d - 1) + "-" + o.slice(d - 1), u = l, l = !1, s = !0) : (s = e(h) === h && r(h) !== h, u = l, l = r(h) === h && e(h) !== h);
|
|
28
28
|
}
|
|
29
|
-
return
|
|
30
|
-
},
|
|
31
|
-
function
|
|
32
|
-
if (!(typeof
|
|
29
|
+
return o;
|
|
30
|
+
}, xr = (o, e) => (zt.lastIndex = 0, o.replaceAll(zt, (r) => e(r))), Er = (o, e) => (Lt.lastIndex = 0, Ut.lastIndex = 0, o.replaceAll(Ut, (r, i, s) => ["_", "-"].includes(o.charAt(s + r.length)) ? r : e(r)).replaceAll(Lt, (r, i) => e(i)));
|
|
31
|
+
function Dt(o, e) {
|
|
32
|
+
if (!(typeof o == "string" || Array.isArray(o)))
|
|
33
33
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
34
|
-
if (
|
|
34
|
+
if (e = {
|
|
35
35
|
pascalCase: !1,
|
|
36
36
|
preserveConsecutiveUppercase: !1,
|
|
37
|
-
...
|
|
38
|
-
}, Array.isArray(
|
|
37
|
+
...e
|
|
38
|
+
}, Array.isArray(o) ? o = o.map((l) => l.trim()).filter((l) => l.length).join("-") : o = o.trim(), o.length === 0)
|
|
39
39
|
return "";
|
|
40
|
-
const
|
|
41
|
-
return
|
|
40
|
+
const r = e.locale === !1 ? (l) => l.toLowerCase() : (l) => l.toLocaleLowerCase(e.locale), i = e.locale === !1 ? (l) => l.toUpperCase() : (l) => l.toLocaleUpperCase(e.locale);
|
|
41
|
+
return o.length === 1 ? ft.test(o) ? "" : e.pascalCase ? i(o) : r(o) : (o !== r(o) && (o = $r(o, r, i, e.preserveConsecutiveUppercase)), o = o.replace(jr, ""), o = e.preserveConsecutiveUppercase ? xr(o, r) : r(o), e.pascalCase && (o = i(o.charAt(0)) + o.slice(1)), Er(o, i));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const s = "virtual:storyblok-components",
|
|
43
|
+
function Rr(o, e, r, i) {
|
|
44
|
+
const s = "virtual:storyblok-components", l = "\0" + s;
|
|
45
45
|
return {
|
|
46
46
|
name: "vite-plugin-storyblok-components",
|
|
47
|
-
async resolveId(
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
47
|
+
async resolveId(u) {
|
|
48
|
+
if (u === s)
|
|
49
|
+
return l;
|
|
50
50
|
},
|
|
51
|
-
async load(
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
for await (const [
|
|
55
|
-
const
|
|
56
|
-
"/" +
|
|
51
|
+
async load(u) {
|
|
52
|
+
if (u === l) {
|
|
53
|
+
const b = [], d = [];
|
|
54
|
+
for await (const [v, w] of Object.entries(e)) {
|
|
55
|
+
const T = await this.resolve(
|
|
56
|
+
"/" + o + "/" + w + ".astro"
|
|
57
57
|
);
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
else if (
|
|
61
|
-
|
|
58
|
+
if (T)
|
|
59
|
+
b.push(`import ${Dt(v)} from "${T.id}"`);
|
|
60
|
+
else if (r)
|
|
61
|
+
d.push(v);
|
|
62
62
|
else
|
|
63
63
|
throw new Error(
|
|
64
|
-
`Component could not be found for blok "${
|
|
64
|
+
`Component could not be found for blok "${v}"! Does "${"/" + o + "/" + w}.astro" exist?`
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
"/" +
|
|
67
|
+
let h = "";
|
|
68
|
+
if (r)
|
|
69
|
+
if (h = ",FallbackComponent", i) {
|
|
70
|
+
const v = await this.resolve(
|
|
71
|
+
"/" + o + "/" + i + ".astro"
|
|
72
72
|
);
|
|
73
|
-
if (!
|
|
73
|
+
if (!v)
|
|
74
74
|
throw new Error(
|
|
75
|
-
`Custom fallback component could not be found. Does "${"/" +
|
|
75
|
+
`Custom fallback component could not be found. Does "${"/" + o + "/" + i}.astro" exist?`
|
|
76
76
|
);
|
|
77
|
-
|
|
78
|
-
`import FallbackComponent from "${
|
|
77
|
+
b.push(
|
|
78
|
+
`import FallbackComponent from "${v.id}"`
|
|
79
79
|
);
|
|
80
80
|
} else
|
|
81
|
-
|
|
81
|
+
b.push(
|
|
82
82
|
"import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'"
|
|
83
83
|
);
|
|
84
|
-
if (Object.values(
|
|
85
|
-
return `${
|
|
86
|
-
if (
|
|
87
|
-
return `${
|
|
84
|
+
if (Object.values(e).length)
|
|
85
|
+
return `${b.join(";")};export default {${Object.keys(e).filter((v) => !d.includes(v)).map((v) => Dt(v)).join(",")}${h}}`;
|
|
86
|
+
if (r)
|
|
87
|
+
return `${b[0]}; export default {${h.replace(",", "")}}`;
|
|
88
88
|
throw new Error(
|
|
89
89
|
`Currently, no Storyblok components are registered in astro.config.mjs.
|
|
90
90
|
Please register your components or enable the fallback component.
|
|
@@ -94,54 +94,615 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
97
|
+
function Mr(o) {
|
|
98
|
+
const e = "virtual:storyblok-options", r = "\0" + e;
|
|
99
99
|
return {
|
|
100
100
|
name: "vite-plugin-storyblok-options",
|
|
101
|
-
async resolveId(
|
|
102
|
-
if (
|
|
103
|
-
return
|
|
101
|
+
async resolveId(i) {
|
|
102
|
+
if (i === e)
|
|
103
|
+
return r;
|
|
104
|
+
},
|
|
105
|
+
async load(i) {
|
|
106
|
+
if (i === r)
|
|
107
|
+
return `export default ${JSON.stringify(o)}`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
var Z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
112
|
+
function Pr(o) {
|
|
113
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
114
|
+
}
|
|
115
|
+
var Q = { exports: {} };
|
|
116
|
+
Q.exports;
|
|
117
|
+
(function(o, e) {
|
|
118
|
+
var r = 200, i = "__lodash_hash_undefined__", s = 800, l = 16, u = 9007199254740991, b = "[object Arguments]", d = "[object Array]", h = "[object AsyncFunction]", v = "[object Boolean]", w = "[object Date]", T = "[object Error]", E = "[object Function]", A = "[object GeneratorFunction]", P = "[object Map]", B = "[object Number]", Gt = "[object Null]", pt = "[object Object]", Jt = "[object Proxy]", Kt = "[object RegExp]", Wt = "[object Set]", Yt = "[object String]", Xt = "[object Undefined]", Zt = "[object WeakMap]", Qt = "[object ArrayBuffer]", Vt = "[object DataView]", te = "[object Float32Array]", ee = "[object Float64Array]", re = "[object Int8Array]", ne = "[object Int16Array]", oe = "[object Int32Array]", ae = "[object Uint8Array]", ie = "[object Uint8ClampedArray]", se = "[object Uint16Array]", le = "[object Uint32Array]", ce = /[\\^$.*+?()[\]{}|]/g, ue = /^\[object .+?Constructor\]$/, fe = /^(?:0|[1-9]\d*)$/, y = {};
|
|
119
|
+
y[te] = y[ee] = y[re] = y[ne] = y[oe] = y[ae] = y[ie] = y[se] = y[le] = !0, y[b] = y[d] = y[Qt] = y[v] = y[Vt] = y[w] = y[T] = y[E] = y[P] = y[B] = y[pt] = y[Kt] = y[Wt] = y[Yt] = y[Zt] = !1;
|
|
120
|
+
var dt = typeof Z == "object" && Z && Z.Object === Object && Z, pe = typeof self == "object" && self && self.Object === Object && self, N = dt || pe || Function("return this")(), gt = e && !e.nodeType && e, z = gt && !0 && o && !o.nodeType && o, ht = z && z.exports === gt, V = ht && dt.process, yt = function() {
|
|
121
|
+
try {
|
|
122
|
+
var t = z && z.require && z.require("util").types;
|
|
123
|
+
return t || V && V.binding && V.binding("util");
|
|
124
|
+
} catch {
|
|
125
|
+
}
|
|
126
|
+
}(), bt = yt && yt.isTypedArray;
|
|
127
|
+
function de(t, n, a) {
|
|
128
|
+
switch (a.length) {
|
|
129
|
+
case 0:
|
|
130
|
+
return t.call(n);
|
|
131
|
+
case 1:
|
|
132
|
+
return t.call(n, a[0]);
|
|
133
|
+
case 2:
|
|
134
|
+
return t.call(n, a[0], a[1]);
|
|
135
|
+
case 3:
|
|
136
|
+
return t.call(n, a[0], a[1], a[2]);
|
|
137
|
+
}
|
|
138
|
+
return t.apply(n, a);
|
|
139
|
+
}
|
|
140
|
+
function ge(t, n) {
|
|
141
|
+
for (var a = -1, c = Array(t); ++a < t; )
|
|
142
|
+
c[a] = n(a);
|
|
143
|
+
return c;
|
|
144
|
+
}
|
|
145
|
+
function he(t) {
|
|
146
|
+
return function(n) {
|
|
147
|
+
return t(n);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function ye(t, n) {
|
|
151
|
+
return t == null ? void 0 : t[n];
|
|
152
|
+
}
|
|
153
|
+
function be(t, n) {
|
|
154
|
+
return function(a) {
|
|
155
|
+
return t(n(a));
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var me = Array.prototype, _e = Function.prototype, H = Object.prototype, tt = N["__core-js_shared__"], q = _e.toString, S = H.hasOwnProperty, mt = function() {
|
|
159
|
+
var t = /[^.]+$/.exec(tt && tt.keys && tt.keys.IE_PROTO || "");
|
|
160
|
+
return t ? "Symbol(src)_1." + t : "";
|
|
161
|
+
}(), _t = H.toString, ve = q.call(Object), Te = RegExp(
|
|
162
|
+
"^" + q.call(S).replace(ce, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
163
|
+
), G = ht ? N.Buffer : void 0, vt = N.Symbol, Tt = N.Uint8Array, wt = G ? G.allocUnsafe : void 0, At = be(Object.getPrototypeOf, Object), It = Object.create, we = H.propertyIsEnumerable, Ae = me.splice, j = vt ? vt.toStringTag : void 0, J = function() {
|
|
164
|
+
try {
|
|
165
|
+
var t = nt(Object, "defineProperty");
|
|
166
|
+
return t({}, "", {}), t;
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
}(), Ie = G ? G.isBuffer : void 0, kt = Math.max, ke = Date.now, Ot = nt(N, "Map"), L = nt(Object, "create"), Oe = /* @__PURE__ */ function() {
|
|
170
|
+
function t() {
|
|
171
|
+
}
|
|
172
|
+
return function(n) {
|
|
173
|
+
if (!x(n))
|
|
174
|
+
return {};
|
|
175
|
+
if (It)
|
|
176
|
+
return It(n);
|
|
177
|
+
t.prototype = n;
|
|
178
|
+
var a = new t();
|
|
179
|
+
return t.prototype = void 0, a;
|
|
180
|
+
};
|
|
181
|
+
}();
|
|
182
|
+
function $(t) {
|
|
183
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
184
|
+
for (this.clear(); ++n < a; ) {
|
|
185
|
+
var c = t[n];
|
|
186
|
+
this.set(c[0], c[1]);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function Se() {
|
|
190
|
+
this.__data__ = L ? L(null) : {}, this.size = 0;
|
|
191
|
+
}
|
|
192
|
+
function Ce(t) {
|
|
193
|
+
var n = this.has(t) && delete this.__data__[t];
|
|
194
|
+
return this.size -= n ? 1 : 0, n;
|
|
195
|
+
}
|
|
196
|
+
function je(t) {
|
|
197
|
+
var n = this.__data__;
|
|
198
|
+
if (L) {
|
|
199
|
+
var a = n[t];
|
|
200
|
+
return a === i ? void 0 : a;
|
|
201
|
+
}
|
|
202
|
+
return S.call(n, t) ? n[t] : void 0;
|
|
203
|
+
}
|
|
204
|
+
function $e(t) {
|
|
205
|
+
var n = this.__data__;
|
|
206
|
+
return L ? n[t] !== void 0 : S.call(n, t);
|
|
207
|
+
}
|
|
208
|
+
function xe(t, n) {
|
|
209
|
+
var a = this.__data__;
|
|
210
|
+
return this.size += this.has(t) ? 0 : 1, a[t] = L && n === void 0 ? i : n, this;
|
|
211
|
+
}
|
|
212
|
+
$.prototype.clear = Se, $.prototype.delete = Ce, $.prototype.get = je, $.prototype.has = $e, $.prototype.set = xe;
|
|
213
|
+
function C(t) {
|
|
214
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
215
|
+
for (this.clear(); ++n < a; ) {
|
|
216
|
+
var c = t[n];
|
|
217
|
+
this.set(c[0], c[1]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function Ee() {
|
|
221
|
+
this.__data__ = [], this.size = 0;
|
|
222
|
+
}
|
|
223
|
+
function Re(t) {
|
|
224
|
+
var n = this.__data__, a = K(n, t);
|
|
225
|
+
if (a < 0)
|
|
226
|
+
return !1;
|
|
227
|
+
var c = n.length - 1;
|
|
228
|
+
return a == c ? n.pop() : Ae.call(n, a, 1), --this.size, !0;
|
|
229
|
+
}
|
|
230
|
+
function Me(t) {
|
|
231
|
+
var n = this.__data__, a = K(n, t);
|
|
232
|
+
return a < 0 ? void 0 : n[a][1];
|
|
233
|
+
}
|
|
234
|
+
function Pe(t) {
|
|
235
|
+
return K(this.__data__, t) > -1;
|
|
236
|
+
}
|
|
237
|
+
function Ne(t, n) {
|
|
238
|
+
var a = this.__data__, c = K(a, t);
|
|
239
|
+
return c < 0 ? (++this.size, a.push([t, n])) : a[c][1] = n, this;
|
|
240
|
+
}
|
|
241
|
+
C.prototype.clear = Ee, C.prototype.delete = Re, C.prototype.get = Me, C.prototype.has = Pe, C.prototype.set = Ne;
|
|
242
|
+
function R(t) {
|
|
243
|
+
var n = -1, a = t == null ? 0 : t.length;
|
|
244
|
+
for (this.clear(); ++n < a; ) {
|
|
245
|
+
var c = t[n];
|
|
246
|
+
this.set(c[0], c[1]);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function ze() {
|
|
250
|
+
this.size = 0, this.__data__ = {
|
|
251
|
+
hash: new $(),
|
|
252
|
+
map: new (Ot || C)(),
|
|
253
|
+
string: new $()
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function Le(t) {
|
|
257
|
+
var n = Y(this, t).delete(t);
|
|
258
|
+
return this.size -= n ? 1 : 0, n;
|
|
259
|
+
}
|
|
260
|
+
function Ue(t) {
|
|
261
|
+
return Y(this, t).get(t);
|
|
262
|
+
}
|
|
263
|
+
function De(t) {
|
|
264
|
+
return Y(this, t).has(t);
|
|
265
|
+
}
|
|
266
|
+
function Fe(t, n) {
|
|
267
|
+
var a = Y(this, t), c = a.size;
|
|
268
|
+
return a.set(t, n), this.size += a.size == c ? 0 : 1, this;
|
|
269
|
+
}
|
|
270
|
+
R.prototype.clear = ze, R.prototype.delete = Le, R.prototype.get = Ue, R.prototype.has = De, R.prototype.set = Fe;
|
|
271
|
+
function M(t) {
|
|
272
|
+
var n = this.__data__ = new C(t);
|
|
273
|
+
this.size = n.size;
|
|
274
|
+
}
|
|
275
|
+
function Be() {
|
|
276
|
+
this.__data__ = new C(), this.size = 0;
|
|
277
|
+
}
|
|
278
|
+
function He(t) {
|
|
279
|
+
var n = this.__data__, a = n.delete(t);
|
|
280
|
+
return this.size = n.size, a;
|
|
281
|
+
}
|
|
282
|
+
function qe(t) {
|
|
283
|
+
return this.__data__.get(t);
|
|
284
|
+
}
|
|
285
|
+
function Ge(t) {
|
|
286
|
+
return this.__data__.has(t);
|
|
287
|
+
}
|
|
288
|
+
function Je(t, n) {
|
|
289
|
+
var a = this.__data__;
|
|
290
|
+
if (a instanceof C) {
|
|
291
|
+
var c = a.__data__;
|
|
292
|
+
if (!Ot || c.length < r - 1)
|
|
293
|
+
return c.push([t, n]), this.size = ++a.size, this;
|
|
294
|
+
a = this.__data__ = new R(c);
|
|
295
|
+
}
|
|
296
|
+
return a.set(t, n), this.size = a.size, this;
|
|
297
|
+
}
|
|
298
|
+
M.prototype.clear = Be, M.prototype.delete = He, M.prototype.get = qe, M.prototype.has = Ge, M.prototype.set = Je;
|
|
299
|
+
function Ke(t, n) {
|
|
300
|
+
var a = it(t), c = !a && at(t), p = !a && !c && xt(t), g = !a && !c && !p && Rt(t), m = a || c || p || g, f = m ? ge(t.length, String) : [], _ = f.length;
|
|
301
|
+
for (var k in t)
|
|
302
|
+
(n || S.call(t, k)) && !(m && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
303
|
+
(k == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
304
|
+
p && (k == "offset" || k == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
305
|
+
g && (k == "buffer" || k == "byteLength" || k == "byteOffset") || // Skip index properties.
|
|
306
|
+
jt(k, _))) && f.push(k);
|
|
307
|
+
return f;
|
|
308
|
+
}
|
|
309
|
+
function et(t, n, a) {
|
|
310
|
+
(a !== void 0 && !X(t[n], a) || a === void 0 && !(n in t)) && rt(t, n, a);
|
|
311
|
+
}
|
|
312
|
+
function We(t, n, a) {
|
|
313
|
+
var c = t[n];
|
|
314
|
+
(!(S.call(t, n) && X(c, a)) || a === void 0 && !(n in t)) && rt(t, n, a);
|
|
315
|
+
}
|
|
316
|
+
function K(t, n) {
|
|
317
|
+
for (var a = t.length; a--; )
|
|
318
|
+
if (X(t[a][0], n))
|
|
319
|
+
return a;
|
|
320
|
+
return -1;
|
|
321
|
+
}
|
|
322
|
+
function rt(t, n, a) {
|
|
323
|
+
n == "__proto__" && J ? J(t, n, {
|
|
324
|
+
configurable: !0,
|
|
325
|
+
enumerable: !0,
|
|
326
|
+
value: a,
|
|
327
|
+
writable: !0
|
|
328
|
+
}) : t[n] = a;
|
|
329
|
+
}
|
|
330
|
+
var Ye = lr();
|
|
331
|
+
function W(t) {
|
|
332
|
+
return t == null ? t === void 0 ? Xt : Gt : j && j in Object(t) ? cr(t) : hr(t);
|
|
333
|
+
}
|
|
334
|
+
function St(t) {
|
|
335
|
+
return U(t) && W(t) == b;
|
|
336
|
+
}
|
|
337
|
+
function Xe(t) {
|
|
338
|
+
if (!x(t) || dr(t))
|
|
339
|
+
return !1;
|
|
340
|
+
var n = lt(t) ? Te : ue;
|
|
341
|
+
return n.test(_r(t));
|
|
342
|
+
}
|
|
343
|
+
function Ze(t) {
|
|
344
|
+
return U(t) && Et(t.length) && !!y[W(t)];
|
|
345
|
+
}
|
|
346
|
+
function Qe(t) {
|
|
347
|
+
if (!x(t))
|
|
348
|
+
return gr(t);
|
|
349
|
+
var n = $t(t), a = [];
|
|
350
|
+
for (var c in t)
|
|
351
|
+
c == "constructor" && (n || !S.call(t, c)) || a.push(c);
|
|
352
|
+
return a;
|
|
353
|
+
}
|
|
354
|
+
function Ct(t, n, a, c, p) {
|
|
355
|
+
t !== n && Ye(n, function(g, m) {
|
|
356
|
+
if (p || (p = new M()), x(g))
|
|
357
|
+
Ve(t, n, m, a, Ct, c, p);
|
|
358
|
+
else {
|
|
359
|
+
var f = c ? c(ot(t, m), g, m + "", t, n, p) : void 0;
|
|
360
|
+
f === void 0 && (f = g), et(t, m, f);
|
|
361
|
+
}
|
|
362
|
+
}, Mt);
|
|
363
|
+
}
|
|
364
|
+
function Ve(t, n, a, c, p, g, m) {
|
|
365
|
+
var f = ot(t, a), _ = ot(n, a), k = m.get(_);
|
|
366
|
+
if (k) {
|
|
367
|
+
et(t, a, k);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
var I = g ? g(f, _, a + "", t, n, m) : void 0, D = I === void 0;
|
|
371
|
+
if (D) {
|
|
372
|
+
var ct = it(_), ut = !ct && xt(_), Nt = !ct && !ut && Rt(_);
|
|
373
|
+
I = _, ct || ut || Nt ? it(f) ? I = f : vr(f) ? I = ar(f) : ut ? (D = !1, I = rr(_, !0)) : Nt ? (D = !1, I = or(_, !0)) : I = [] : Tr(_) || at(_) ? (I = f, at(f) ? I = wr(f) : (!x(f) || lt(f)) && (I = ur(_))) : D = !1;
|
|
374
|
+
}
|
|
375
|
+
D && (m.set(_, I), p(I, _, c, g, m), m.delete(_)), et(t, a, I);
|
|
376
|
+
}
|
|
377
|
+
function tr(t, n) {
|
|
378
|
+
return br(yr(t, n, Pt), t + "");
|
|
379
|
+
}
|
|
380
|
+
var er = J ? function(t, n) {
|
|
381
|
+
return J(t, "toString", {
|
|
382
|
+
configurable: !0,
|
|
383
|
+
enumerable: !1,
|
|
384
|
+
value: Ir(n),
|
|
385
|
+
writable: !0
|
|
386
|
+
});
|
|
387
|
+
} : Pt;
|
|
388
|
+
function rr(t, n) {
|
|
389
|
+
if (n)
|
|
390
|
+
return t.slice();
|
|
391
|
+
var a = t.length, c = wt ? wt(a) : new t.constructor(a);
|
|
392
|
+
return t.copy(c), c;
|
|
393
|
+
}
|
|
394
|
+
function nr(t) {
|
|
395
|
+
var n = new t.constructor(t.byteLength);
|
|
396
|
+
return new Tt(n).set(new Tt(t)), n;
|
|
397
|
+
}
|
|
398
|
+
function or(t, n) {
|
|
399
|
+
var a = n ? nr(t.buffer) : t.buffer;
|
|
400
|
+
return new t.constructor(a, t.byteOffset, t.length);
|
|
401
|
+
}
|
|
402
|
+
function ar(t, n) {
|
|
403
|
+
var a = -1, c = t.length;
|
|
404
|
+
for (n || (n = Array(c)); ++a < c; )
|
|
405
|
+
n[a] = t[a];
|
|
406
|
+
return n;
|
|
407
|
+
}
|
|
408
|
+
function ir(t, n, a, c) {
|
|
409
|
+
var p = !a;
|
|
410
|
+
a || (a = {});
|
|
411
|
+
for (var g = -1, m = n.length; ++g < m; ) {
|
|
412
|
+
var f = n[g], _ = c ? c(a[f], t[f], f, a, t) : void 0;
|
|
413
|
+
_ === void 0 && (_ = t[f]), p ? rt(a, f, _) : We(a, f, _);
|
|
414
|
+
}
|
|
415
|
+
return a;
|
|
416
|
+
}
|
|
417
|
+
function sr(t) {
|
|
418
|
+
return tr(function(n, a) {
|
|
419
|
+
var c = -1, p = a.length, g = p > 1 ? a[p - 1] : void 0, m = p > 2 ? a[2] : void 0;
|
|
420
|
+
for (g = t.length > 3 && typeof g == "function" ? (p--, g) : void 0, m && fr(a[0], a[1], m) && (g = p < 3 ? void 0 : g, p = 1), n = Object(n); ++c < p; ) {
|
|
421
|
+
var f = a[c];
|
|
422
|
+
f && t(n, f, c, g);
|
|
423
|
+
}
|
|
424
|
+
return n;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function lr(t) {
|
|
428
|
+
return function(n, a, c) {
|
|
429
|
+
for (var p = -1, g = Object(n), m = c(n), f = m.length; f--; ) {
|
|
430
|
+
var _ = m[t ? f : ++p];
|
|
431
|
+
if (a(g[_], _, g) === !1)
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
return n;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function Y(t, n) {
|
|
438
|
+
var a = t.__data__;
|
|
439
|
+
return pr(n) ? a[typeof n == "string" ? "string" : "hash"] : a.map;
|
|
440
|
+
}
|
|
441
|
+
function nt(t, n) {
|
|
442
|
+
var a = ye(t, n);
|
|
443
|
+
return Xe(a) ? a : void 0;
|
|
444
|
+
}
|
|
445
|
+
function cr(t) {
|
|
446
|
+
var n = S.call(t, j), a = t[j];
|
|
447
|
+
try {
|
|
448
|
+
t[j] = void 0;
|
|
449
|
+
var c = !0;
|
|
450
|
+
} catch {
|
|
451
|
+
}
|
|
452
|
+
var p = _t.call(t);
|
|
453
|
+
return c && (n ? t[j] = a : delete t[j]), p;
|
|
454
|
+
}
|
|
455
|
+
function ur(t) {
|
|
456
|
+
return typeof t.constructor == "function" && !$t(t) ? Oe(At(t)) : {};
|
|
457
|
+
}
|
|
458
|
+
function jt(t, n) {
|
|
459
|
+
var a = typeof t;
|
|
460
|
+
return n = n ?? u, !!n && (a == "number" || a != "symbol" && fe.test(t)) && t > -1 && t % 1 == 0 && t < n;
|
|
461
|
+
}
|
|
462
|
+
function fr(t, n, a) {
|
|
463
|
+
if (!x(a))
|
|
464
|
+
return !1;
|
|
465
|
+
var c = typeof n;
|
|
466
|
+
return (c == "number" ? st(a) && jt(n, a.length) : c == "string" && n in a) ? X(a[n], t) : !1;
|
|
467
|
+
}
|
|
468
|
+
function pr(t) {
|
|
469
|
+
var n = typeof t;
|
|
470
|
+
return n == "string" || n == "number" || n == "symbol" || n == "boolean" ? t !== "__proto__" : t === null;
|
|
471
|
+
}
|
|
472
|
+
function dr(t) {
|
|
473
|
+
return !!mt && mt in t;
|
|
474
|
+
}
|
|
475
|
+
function $t(t) {
|
|
476
|
+
var n = t && t.constructor, a = typeof n == "function" && n.prototype || H;
|
|
477
|
+
return t === a;
|
|
478
|
+
}
|
|
479
|
+
function gr(t) {
|
|
480
|
+
var n = [];
|
|
481
|
+
if (t != null)
|
|
482
|
+
for (var a in Object(t))
|
|
483
|
+
n.push(a);
|
|
484
|
+
return n;
|
|
485
|
+
}
|
|
486
|
+
function hr(t) {
|
|
487
|
+
return _t.call(t);
|
|
488
|
+
}
|
|
489
|
+
function yr(t, n, a) {
|
|
490
|
+
return n = kt(n === void 0 ? t.length - 1 : n, 0), function() {
|
|
491
|
+
for (var c = arguments, p = -1, g = kt(c.length - n, 0), m = Array(g); ++p < g; )
|
|
492
|
+
m[p] = c[n + p];
|
|
493
|
+
p = -1;
|
|
494
|
+
for (var f = Array(n + 1); ++p < n; )
|
|
495
|
+
f[p] = c[p];
|
|
496
|
+
return f[n] = a(m), de(t, this, f);
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function ot(t, n) {
|
|
500
|
+
if (!(n === "constructor" && typeof t[n] == "function") && n != "__proto__")
|
|
501
|
+
return t[n];
|
|
502
|
+
}
|
|
503
|
+
var br = mr(er);
|
|
504
|
+
function mr(t) {
|
|
505
|
+
var n = 0, a = 0;
|
|
506
|
+
return function() {
|
|
507
|
+
var c = ke(), p = l - (c - a);
|
|
508
|
+
if (a = c, p > 0) {
|
|
509
|
+
if (++n >= s)
|
|
510
|
+
return arguments[0];
|
|
511
|
+
} else
|
|
512
|
+
n = 0;
|
|
513
|
+
return t.apply(void 0, arguments);
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function _r(t) {
|
|
517
|
+
if (t != null) {
|
|
518
|
+
try {
|
|
519
|
+
return q.call(t);
|
|
520
|
+
} catch {
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
return t + "";
|
|
524
|
+
} catch {
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return "";
|
|
528
|
+
}
|
|
529
|
+
function X(t, n) {
|
|
530
|
+
return t === n || t !== t && n !== n;
|
|
531
|
+
}
|
|
532
|
+
var at = St(/* @__PURE__ */ function() {
|
|
533
|
+
return arguments;
|
|
534
|
+
}()) ? St : function(t) {
|
|
535
|
+
return U(t) && S.call(t, "callee") && !we.call(t, "callee");
|
|
536
|
+
}, it = Array.isArray;
|
|
537
|
+
function st(t) {
|
|
538
|
+
return t != null && Et(t.length) && !lt(t);
|
|
539
|
+
}
|
|
540
|
+
function vr(t) {
|
|
541
|
+
return U(t) && st(t);
|
|
542
|
+
}
|
|
543
|
+
var xt = Ie || kr;
|
|
544
|
+
function lt(t) {
|
|
545
|
+
if (!x(t))
|
|
546
|
+
return !1;
|
|
547
|
+
var n = W(t);
|
|
548
|
+
return n == E || n == A || n == h || n == Jt;
|
|
549
|
+
}
|
|
550
|
+
function Et(t) {
|
|
551
|
+
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= u;
|
|
552
|
+
}
|
|
553
|
+
function x(t) {
|
|
554
|
+
var n = typeof t;
|
|
555
|
+
return t != null && (n == "object" || n == "function");
|
|
556
|
+
}
|
|
557
|
+
function U(t) {
|
|
558
|
+
return t != null && typeof t == "object";
|
|
559
|
+
}
|
|
560
|
+
function Tr(t) {
|
|
561
|
+
if (!U(t) || W(t) != pt)
|
|
562
|
+
return !1;
|
|
563
|
+
var n = At(t);
|
|
564
|
+
if (n === null)
|
|
565
|
+
return !0;
|
|
566
|
+
var a = S.call(n, "constructor") && n.constructor;
|
|
567
|
+
return typeof a == "function" && a instanceof a && q.call(a) == ve;
|
|
568
|
+
}
|
|
569
|
+
var Rt = bt ? he(bt) : Ze;
|
|
570
|
+
function wr(t) {
|
|
571
|
+
return ir(t, Mt(t));
|
|
572
|
+
}
|
|
573
|
+
function Mt(t) {
|
|
574
|
+
return st(t) ? Ke(t, !0) : Qe(t);
|
|
575
|
+
}
|
|
576
|
+
var Ar = sr(function(t, n, a, c) {
|
|
577
|
+
Ct(t, n, a, c);
|
|
578
|
+
});
|
|
579
|
+
function Ir(t) {
|
|
580
|
+
return function() {
|
|
581
|
+
return t;
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function Pt(t) {
|
|
585
|
+
return t;
|
|
586
|
+
}
|
|
587
|
+
function kr() {
|
|
588
|
+
return !1;
|
|
589
|
+
}
|
|
590
|
+
o.exports = Ar;
|
|
591
|
+
})(Q, Q.exports);
|
|
592
|
+
var Nr = Q.exports;
|
|
593
|
+
const zr = /* @__PURE__ */ Pr(Nr);
|
|
594
|
+
function Lr(o) {
|
|
595
|
+
let e;
|
|
596
|
+
function r(i, s) {
|
|
597
|
+
var l, u, b, d, h, v, w;
|
|
598
|
+
if ((s == null ? void 0 : s.type) === "AwaitExpression" && ((u = (l = s == null ? void 0 : s.argument) == null ? void 0 : l.callee) == null ? void 0 : u.name) === "useStoryblok") {
|
|
599
|
+
const T = (b = s == null ? void 0 : s.argument) == null ? void 0 : b.arguments;
|
|
600
|
+
((d = T[1]) == null ? void 0 : d.type) === "ObjectExpression" && (e = {
|
|
601
|
+
...e,
|
|
602
|
+
apiOptions: Ft((h = T[1]) == null ? void 0 : h.properties)
|
|
603
|
+
}), ((v = T[2]) == null ? void 0 : v.type) === "ObjectExpression" && (e = {
|
|
604
|
+
...e,
|
|
605
|
+
bridgeOptions: Ft((w = T[2]) == null ? void 0 : w.properties)
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return zr({}, o, r), e;
|
|
610
|
+
}
|
|
611
|
+
function Ft(o) {
|
|
612
|
+
return o.reduce((e, { key: r, value: i }) => {
|
|
613
|
+
const { type: s } = i;
|
|
614
|
+
return e[r.name] = s === "Literal" ? i.value : s === "ArrayExpression" ? i.elements.map((l) => l.value) : i.value, e;
|
|
615
|
+
}, {});
|
|
616
|
+
}
|
|
617
|
+
function Ur(o) {
|
|
618
|
+
let e = {
|
|
619
|
+
resolveRelations: []
|
|
620
|
+
};
|
|
621
|
+
function r(i) {
|
|
622
|
+
i && (Array.isArray(i) ? e.resolveRelations.push(...i) : e.resolveRelations.push(i));
|
|
623
|
+
}
|
|
624
|
+
for (const i of o)
|
|
625
|
+
if (i.options) {
|
|
626
|
+
const { apiOptions: s, bridgeOptions: l } = i.options;
|
|
627
|
+
if (r(s == null ? void 0 : s.resolve_relations), l) {
|
|
628
|
+
const { resolveRelations: u, ...b } = l;
|
|
629
|
+
r(u), Object.assign(e, b);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return e.resolveRelations = [...new Set(e.resolveRelations)], e;
|
|
633
|
+
}
|
|
634
|
+
let F = [];
|
|
635
|
+
function Dr() {
|
|
636
|
+
let o = [];
|
|
637
|
+
const e = "virtual:storyblok-bridge", r = "\0" + e;
|
|
638
|
+
let i = null, s = null;
|
|
639
|
+
return {
|
|
640
|
+
name: "vite-plugin-storyblok-bridge",
|
|
641
|
+
async resolveId(l) {
|
|
642
|
+
if (l === e)
|
|
643
|
+
return r;
|
|
644
|
+
},
|
|
645
|
+
async transform(l, u) {
|
|
646
|
+
var w;
|
|
647
|
+
if (u.includes("node_modules") && !u.includes("/pages/") || !l.includes("useStoryblok") || !((w = this.getModuleInfo(u).meta) != null && w.astro))
|
|
648
|
+
return;
|
|
649
|
+
const [, ...d] = u.split("src/pages/"), h = d.join("/").replace(".astro", ""), v = Lr(this.parse(l));
|
|
650
|
+
F.length && (o = F.filter((T) => T.url !== h)), o.push({
|
|
651
|
+
url: h,
|
|
652
|
+
options: v
|
|
653
|
+
}), i && (s && clearTimeout(s), s = setTimeout(() => {
|
|
654
|
+
Fr(F, o) || (F.length !== 0 && (i.restart(), console.info("Updating bridge options...")), F = [...o]);
|
|
655
|
+
}, 1e3));
|
|
656
|
+
},
|
|
657
|
+
async load(l) {
|
|
658
|
+
if (l === r)
|
|
659
|
+
return `export const bridgeOptions = ${JSON.stringify(Ur(o))}`;
|
|
104
660
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return `export default ${JSON.stringify(r)}`;
|
|
661
|
+
configureServer(l) {
|
|
662
|
+
i = l;
|
|
108
663
|
}
|
|
109
664
|
};
|
|
110
665
|
}
|
|
111
|
-
|
|
112
|
-
|
|
666
|
+
function Fr(o = [], e = []) {
|
|
667
|
+
return e.every(({ url: r, options: i }) => {
|
|
668
|
+
const s = o.find((l) => (l == null ? void 0 : l.url) === r);
|
|
669
|
+
return s && JSON.stringify(i) === JSON.stringify(s.options);
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
let Bt = !1;
|
|
673
|
+
const Ht = [], Br = (o) => new Promise((e, r) => {
|
|
113
674
|
if (typeof window > "u" || (window.storyblokRegisterEvent = (s) => {
|
|
114
675
|
if (window.location === window.parent.location) {
|
|
115
676
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
116
677
|
return;
|
|
117
678
|
}
|
|
118
|
-
|
|
679
|
+
Bt ? s() : Ht.push(s);
|
|
119
680
|
}, document.getElementById("storyblok-javascript-bridge")))
|
|
120
681
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, document.getElementsByTagName("head")[0].appendChild(
|
|
682
|
+
const i = document.createElement("script");
|
|
683
|
+
i.async = !0, i.src = o, i.id = "storyblok-javascript-bridge", i.onerror = (s) => r(s), i.onload = (s) => {
|
|
684
|
+
Ht.forEach((l) => l()), Bt = !0, e(s);
|
|
685
|
+
}, document.getElementsByTagName("head")[0].appendChild(i);
|
|
125
686
|
});
|
|
126
|
-
var
|
|
127
|
-
class
|
|
687
|
+
var Hr = Object.defineProperty, qr = (o, e, r) => e in o ? Hr(o, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[e] = r, O = (o, e, r) => (qr(o, typeof e != "symbol" ? e + "" : e, r), r);
|
|
688
|
+
class Gr {
|
|
128
689
|
constructor() {
|
|
129
|
-
|
|
130
|
-
...
|
|
131
|
-
per_page:
|
|
132
|
-
page:
|
|
133
|
-
})),
|
|
134
|
-
const
|
|
135
|
-
return this.arrayFrom(
|
|
136
|
-
}),
|
|
137
|
-
const
|
|
690
|
+
O(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), O(this, "getOptionsPage", (e, r = 25, i = 1) => ({
|
|
691
|
+
...e,
|
|
692
|
+
per_page: r,
|
|
693
|
+
page: i
|
|
694
|
+
})), O(this, "delay", (e) => new Promise((r) => setTimeout(r, e))), O(this, "arrayFrom", (e = 0, r) => [...Array(e)].map(r)), O(this, "range", (e = 0, r = e) => {
|
|
695
|
+
const i = Math.abs(r - e) || 0, s = e < r ? 1 : -1;
|
|
696
|
+
return this.arrayFrom(i, (l, u) => u * s + e);
|
|
697
|
+
}), O(this, "asyncMap", async (e, r) => Promise.all(e.map(r))), O(this, "flatMap", (e = [], r) => e.map(r).reduce((i, s) => [...i, ...s], [])), O(this, "escapeHTML", function(e) {
|
|
698
|
+
const r = {
|
|
138
699
|
"&": "&",
|
|
139
700
|
"<": "<",
|
|
140
701
|
">": ">",
|
|
141
702
|
'"': """,
|
|
142
703
|
"'": "'"
|
|
143
|
-
},
|
|
144
|
-
return
|
|
704
|
+
}, i = /[&<>"']/g, s = RegExp(i.source);
|
|
705
|
+
return e && s.test(e) ? e.replace(i, (l) => r[l]) : e;
|
|
145
706
|
});
|
|
146
707
|
}
|
|
147
708
|
/**
|
|
@@ -151,18 +712,18 @@ class z {
|
|
|
151
712
|
* @param {Boolean} isArray
|
|
152
713
|
* @return {String} Stringified object
|
|
153
714
|
*/
|
|
154
|
-
stringify(
|
|
715
|
+
stringify(e, r, i) {
|
|
155
716
|
const s = [];
|
|
156
|
-
for (const
|
|
157
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
717
|
+
for (const l in e) {
|
|
718
|
+
if (!Object.prototype.hasOwnProperty.call(e, l))
|
|
158
719
|
continue;
|
|
159
|
-
const
|
|
160
|
-
let
|
|
161
|
-
typeof
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Array.isArray(
|
|
165
|
-
) :
|
|
720
|
+
const u = e[l], b = i ? "" : encodeURIComponent(l);
|
|
721
|
+
let d;
|
|
722
|
+
typeof u == "object" ? d = this.stringify(
|
|
723
|
+
u,
|
|
724
|
+
r ? r + encodeURIComponent("[" + b + "]") : b,
|
|
725
|
+
Array.isArray(u)
|
|
726
|
+
) : d = (r ? r + encodeURIComponent("[" + b + "]") : b) + "=" + encodeURIComponent(u), s.push(d);
|
|
166
727
|
}
|
|
167
728
|
return s.join("&");
|
|
168
729
|
}
|
|
@@ -171,203 +732,203 @@ class z {
|
|
|
171
732
|
* @param {String} regionCode region code, could be eu, us, cn, ap or ca
|
|
172
733
|
* @return {String} The base URL of the region
|
|
173
734
|
*/
|
|
174
|
-
getRegionURL(
|
|
175
|
-
const
|
|
176
|
-
switch (
|
|
735
|
+
getRegionURL(e) {
|
|
736
|
+
const r = "api.storyblok.com", i = "api-us.storyblok.com", s = "app.storyblokchina.cn", l = "api-ap.storyblok.com", u = "api-ca.storyblok.com";
|
|
737
|
+
switch (e) {
|
|
177
738
|
case "us":
|
|
178
|
-
return
|
|
739
|
+
return i;
|
|
179
740
|
case "cn":
|
|
180
741
|
return s;
|
|
181
742
|
case "ap":
|
|
182
|
-
return
|
|
743
|
+
return l;
|
|
183
744
|
case "ca":
|
|
184
|
-
return
|
|
745
|
+
return u;
|
|
185
746
|
default:
|
|
186
|
-
return
|
|
747
|
+
return r;
|
|
187
748
|
}
|
|
188
749
|
}
|
|
189
750
|
}
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
for (const
|
|
193
|
-
const s =
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
return
|
|
197
|
-
},
|
|
751
|
+
const Jr = function(o, e) {
|
|
752
|
+
const r = {};
|
|
753
|
+
for (const i in o) {
|
|
754
|
+
const s = o[i];
|
|
755
|
+
e.indexOf(i) > -1 && s !== null && (r[i] = s);
|
|
756
|
+
}
|
|
757
|
+
return r;
|
|
758
|
+
}, Kr = (o) => o === "email", Wr = () => ({
|
|
198
759
|
singleTag: "hr"
|
|
199
|
-
}),
|
|
760
|
+
}), Yr = () => ({
|
|
200
761
|
tag: "blockquote"
|
|
201
|
-
}),
|
|
762
|
+
}), Xr = () => ({
|
|
202
763
|
tag: "ul"
|
|
203
|
-
}),
|
|
764
|
+
}), Zr = (o) => ({
|
|
204
765
|
tag: [
|
|
205
766
|
"pre",
|
|
206
767
|
{
|
|
207
768
|
tag: "code",
|
|
208
|
-
attrs:
|
|
769
|
+
attrs: o.attrs
|
|
209
770
|
}
|
|
210
771
|
]
|
|
211
|
-
}),
|
|
772
|
+
}), Qr = () => ({
|
|
212
773
|
singleTag: "br"
|
|
213
|
-
}),
|
|
214
|
-
tag: `h${
|
|
215
|
-
}),
|
|
774
|
+
}), Vr = (o) => ({
|
|
775
|
+
tag: `h${o.attrs.level}`
|
|
776
|
+
}), tn = (o) => ({
|
|
216
777
|
singleTag: [
|
|
217
778
|
{
|
|
218
779
|
tag: "img",
|
|
219
|
-
attrs:
|
|
780
|
+
attrs: Jr(o.attrs, ["src", "alt", "title"])
|
|
220
781
|
}
|
|
221
782
|
]
|
|
222
|
-
}),
|
|
783
|
+
}), en = () => ({
|
|
223
784
|
tag: "li"
|
|
224
|
-
}),
|
|
785
|
+
}), rn = () => ({
|
|
225
786
|
tag: "ol"
|
|
226
|
-
}),
|
|
787
|
+
}), nn = () => ({
|
|
227
788
|
tag: "p"
|
|
228
|
-
}),
|
|
789
|
+
}), on = (o) => ({
|
|
229
790
|
tag: [
|
|
230
791
|
{
|
|
231
792
|
tag: "span",
|
|
232
793
|
attrs: {
|
|
233
794
|
"data-type": "emoji",
|
|
234
|
-
"data-name":
|
|
235
|
-
emoji:
|
|
795
|
+
"data-name": o.attrs.name,
|
|
796
|
+
emoji: o.attrs.emoji
|
|
236
797
|
}
|
|
237
798
|
}
|
|
238
799
|
]
|
|
239
|
-
}),
|
|
800
|
+
}), an = () => ({
|
|
240
801
|
tag: "b"
|
|
241
|
-
}),
|
|
802
|
+
}), sn = () => ({
|
|
242
803
|
tag: "s"
|
|
243
|
-
}),
|
|
804
|
+
}), ln = () => ({
|
|
244
805
|
tag: "u"
|
|
245
|
-
}),
|
|
806
|
+
}), cn = () => ({
|
|
246
807
|
tag: "strong"
|
|
247
|
-
}),
|
|
808
|
+
}), un = () => ({
|
|
248
809
|
tag: "code"
|
|
249
|
-
}),
|
|
810
|
+
}), fn = () => ({
|
|
250
811
|
tag: "i"
|
|
251
|
-
}),
|
|
252
|
-
if (!
|
|
812
|
+
}), pn = (o) => {
|
|
813
|
+
if (!o.attrs)
|
|
253
814
|
return {
|
|
254
815
|
tag: ""
|
|
255
816
|
};
|
|
256
|
-
const
|
|
257
|
-
if (delete
|
|
258
|
-
for (const s in
|
|
259
|
-
|
|
260
|
-
delete
|
|
817
|
+
const e = new Gr().escapeHTML, r = { ...o.attrs }, { linktype: i = "url" } = o.attrs;
|
|
818
|
+
if (delete r.linktype, r.href && (r.href = e(o.attrs.href || "")), Kr(i) && (r.href = `mailto:${r.href}`), r.anchor && (r.href = `${r.href}#${r.anchor}`, delete r.anchor), r.custom) {
|
|
819
|
+
for (const s in r.custom)
|
|
820
|
+
r[s] = r.custom[s];
|
|
821
|
+
delete r.custom;
|
|
261
822
|
}
|
|
262
823
|
return {
|
|
263
824
|
tag: [
|
|
264
825
|
{
|
|
265
826
|
tag: "a",
|
|
266
|
-
attrs:
|
|
827
|
+
attrs: r
|
|
267
828
|
}
|
|
268
829
|
]
|
|
269
830
|
};
|
|
270
|
-
},
|
|
831
|
+
}, dn = (o) => ({
|
|
271
832
|
tag: [
|
|
272
833
|
{
|
|
273
834
|
tag: "span",
|
|
274
|
-
attrs:
|
|
835
|
+
attrs: o.attrs
|
|
275
836
|
}
|
|
276
837
|
]
|
|
277
|
-
}),
|
|
838
|
+
}), gn = () => ({
|
|
278
839
|
tag: "sub"
|
|
279
|
-
}),
|
|
840
|
+
}), hn = () => ({
|
|
280
841
|
tag: "sup"
|
|
281
|
-
}),
|
|
842
|
+
}), yn = (o) => ({
|
|
282
843
|
tag: [
|
|
283
844
|
{
|
|
284
845
|
tag: "span",
|
|
285
|
-
attrs:
|
|
846
|
+
attrs: o.attrs
|
|
286
847
|
}
|
|
287
848
|
]
|
|
288
|
-
}),
|
|
289
|
-
var
|
|
290
|
-
return (
|
|
849
|
+
}), bn = (o) => {
|
|
850
|
+
var e;
|
|
851
|
+
return (e = o.attrs) != null && e.color ? {
|
|
291
852
|
tag: [
|
|
292
853
|
{
|
|
293
854
|
tag: "span",
|
|
294
855
|
attrs: {
|
|
295
|
-
style: `background-color:${
|
|
856
|
+
style: `background-color:${o.attrs.color};`
|
|
296
857
|
}
|
|
297
858
|
}
|
|
298
859
|
]
|
|
299
860
|
} : {
|
|
300
861
|
tag: ""
|
|
301
862
|
};
|
|
302
|
-
},
|
|
303
|
-
var
|
|
304
|
-
return (
|
|
863
|
+
}, mn = (o) => {
|
|
864
|
+
var e;
|
|
865
|
+
return (e = o.attrs) != null && e.color ? {
|
|
305
866
|
tag: [
|
|
306
867
|
{
|
|
307
868
|
tag: "span",
|
|
308
869
|
attrs: {
|
|
309
|
-
style: `color:${
|
|
870
|
+
style: `color:${o.attrs.color}`
|
|
310
871
|
}
|
|
311
872
|
}
|
|
312
873
|
]
|
|
313
874
|
} : {
|
|
314
875
|
tag: ""
|
|
315
876
|
};
|
|
316
|
-
},
|
|
877
|
+
}, _n = {
|
|
317
878
|
nodes: {
|
|
318
|
-
horizontal_rule:
|
|
319
|
-
blockquote:
|
|
320
|
-
bullet_list:
|
|
321
|
-
code_block:
|
|
322
|
-
hard_break:
|
|
323
|
-
heading:
|
|
324
|
-
image:
|
|
325
|
-
list_item:
|
|
326
|
-
ordered_list:
|
|
327
|
-
paragraph:
|
|
328
|
-
emoji:
|
|
879
|
+
horizontal_rule: Wr,
|
|
880
|
+
blockquote: Yr,
|
|
881
|
+
bullet_list: Xr,
|
|
882
|
+
code_block: Zr,
|
|
883
|
+
hard_break: Qr,
|
|
884
|
+
heading: Vr,
|
|
885
|
+
image: tn,
|
|
886
|
+
list_item: en,
|
|
887
|
+
ordered_list: rn,
|
|
888
|
+
paragraph: nn,
|
|
889
|
+
emoji: on
|
|
329
890
|
},
|
|
330
891
|
marks: {
|
|
331
|
-
bold:
|
|
332
|
-
strike:
|
|
333
|
-
underline:
|
|
334
|
-
strong:
|
|
335
|
-
code:
|
|
336
|
-
italic:
|
|
337
|
-
link:
|
|
338
|
-
styled:
|
|
339
|
-
subscript:
|
|
340
|
-
superscript:
|
|
341
|
-
anchor:
|
|
342
|
-
highlight:
|
|
343
|
-
textStyle:
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
const
|
|
892
|
+
bold: an,
|
|
893
|
+
strike: sn,
|
|
894
|
+
underline: ln,
|
|
895
|
+
strong: cn,
|
|
896
|
+
code: un,
|
|
897
|
+
italic: fn,
|
|
898
|
+
link: pn,
|
|
899
|
+
styled: dn,
|
|
900
|
+
subscript: gn,
|
|
901
|
+
superscript: hn,
|
|
902
|
+
anchor: yn,
|
|
903
|
+
highlight: bn,
|
|
904
|
+
textStyle: mn
|
|
905
|
+
}
|
|
906
|
+
}, vn = function(o) {
|
|
907
|
+
const e = {
|
|
347
908
|
"&": "&",
|
|
348
909
|
"<": "<",
|
|
349
910
|
">": ">",
|
|
350
911
|
'"': """,
|
|
351
912
|
"'": "'"
|
|
352
|
-
},
|
|
353
|
-
return
|
|
913
|
+
}, r = /[&<>"']/g, i = RegExp(r.source);
|
|
914
|
+
return o && i.test(o) ? o.replace(r, (s) => e[s]) : o;
|
|
354
915
|
};
|
|
355
|
-
class
|
|
356
|
-
constructor(
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
addNode(
|
|
360
|
-
this.nodes[
|
|
361
|
-
}
|
|
362
|
-
addMark(
|
|
363
|
-
this.marks[
|
|
364
|
-
}
|
|
365
|
-
render(
|
|
366
|
-
if (
|
|
367
|
-
let
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
}),
|
|
916
|
+
class Tn {
|
|
917
|
+
constructor(e) {
|
|
918
|
+
O(this, "marks"), O(this, "nodes"), e || (e = _n), this.marks = e.marks || [], this.nodes = e.nodes || [];
|
|
919
|
+
}
|
|
920
|
+
addNode(e, r) {
|
|
921
|
+
this.nodes[e] = r;
|
|
922
|
+
}
|
|
923
|
+
addMark(e, r) {
|
|
924
|
+
this.marks[e] = r;
|
|
925
|
+
}
|
|
926
|
+
render(e, r = { optimizeImages: !1 }) {
|
|
927
|
+
if (e && e.content && Array.isArray(e.content)) {
|
|
928
|
+
let i = "";
|
|
929
|
+
return e.content.forEach((s) => {
|
|
930
|
+
i += this.renderNode(s);
|
|
931
|
+
}), r.optimizeImages ? this.optimizeImages(i, r.optimizeImages) : i;
|
|
371
932
|
}
|
|
372
933
|
return console.warn(
|
|
373
934
|
`The render method must receive an Object with a "content" field.
|
|
@@ -396,222 +957,265 @@ class fe {
|
|
|
396
957
|
}`
|
|
397
958
|
), "";
|
|
398
959
|
}
|
|
399
|
-
optimizeImages(
|
|
400
|
-
let
|
|
401
|
-
typeof
|
|
402
|
-
const
|
|
403
|
-
return
|
|
960
|
+
optimizeImages(e, r) {
|
|
961
|
+
let i = 0, s = 0, l = "", u = "";
|
|
962
|
+
typeof r != "boolean" && (typeof r.width == "number" && r.width > 0 && (l += `width="${r.width}" `, i = r.width), typeof r.height == "number" && r.height > 0 && (l += `height="${r.height}" `, s = r.height), (r.loading === "lazy" || r.loading === "eager") && (l += `loading="${r.loading}" `), typeof r.class == "string" && r.class.length > 0 && (l += `class="${r.class}" `), r.filters && (typeof r.filters.blur == "number" && r.filters.blur >= 0 && r.filters.blur <= 100 && (u += `:blur(${r.filters.blur})`), typeof r.filters.brightness == "number" && r.filters.brightness >= -100 && r.filters.brightness <= 100 && (u += `:brightness(${r.filters.brightness})`), r.filters.fill && (r.filters.fill.match(/[0-9A-Fa-f]{6}/g) || r.filters.fill === "transparent") && (u += `:fill(${r.filters.fill})`), r.filters.format && ["webp", "png", "jpeg"].includes(r.filters.format) && (u += `:format(${r.filters.format})`), typeof r.filters.grayscale == "boolean" && r.filters.grayscale && (u += ":grayscale()"), typeof r.filters.quality == "number" && r.filters.quality >= 0 && r.filters.quality <= 100 && (u += `:quality(${r.filters.quality})`), r.filters.rotate && [90, 180, 270].includes(r.filters.rotate) && (u += `:rotate(${r.filters.rotate})`), u.length > 0 && (u = "/filters" + u))), l.length > 0 && (e = e.replace(/<img/g, `<img ${l.trim()}`));
|
|
963
|
+
const b = i > 0 || s > 0 || u.length > 0 ? `${i}x${s}${u}` : "";
|
|
964
|
+
return e = e.replace(
|
|
404
965
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
|
|
405
|
-
`a.storyblok.com/f/$1/$2.$3/m/${
|
|
406
|
-
), typeof
|
|
407
|
-
var
|
|
408
|
-
const
|
|
966
|
+
`a.storyblok.com/f/$1/$2.$3/m/${b}`
|
|
967
|
+
), typeof r != "boolean" && (r.sizes || r.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (d) => {
|
|
968
|
+
var h, v;
|
|
969
|
+
const w = d.match(
|
|
409
970
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
|
|
410
971
|
);
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
413
|
-
srcset: (
|
|
414
|
-
if (typeof
|
|
415
|
-
return `//${
|
|
416
|
-
if (typeof
|
|
417
|
-
let
|
|
418
|
-
return typeof
|
|
972
|
+
if (w && w.length > 0) {
|
|
973
|
+
const T = {
|
|
974
|
+
srcset: (h = r.srcset) == null ? void 0 : h.map((A) => {
|
|
975
|
+
if (typeof A == "number")
|
|
976
|
+
return `//${w}/m/${A}x0${u} ${A}w`;
|
|
977
|
+
if (typeof A == "object" && A.length === 2) {
|
|
978
|
+
let P = 0, B = 0;
|
|
979
|
+
return typeof A[0] == "number" && (P = A[0]), typeof A[1] == "number" && (B = A[1]), `//${w}/m/${P}x${B}${u} ${P}w`;
|
|
419
980
|
}
|
|
420
981
|
}).join(", "),
|
|
421
|
-
sizes: (
|
|
982
|
+
sizes: (v = r.sizes) == null ? void 0 : v.map((A) => A).join(", ")
|
|
422
983
|
};
|
|
423
|
-
let
|
|
424
|
-
return
|
|
984
|
+
let E = "";
|
|
985
|
+
return T.srcset && (E += `srcset="${T.srcset}" `), T.sizes && (E += `sizes="${T.sizes}" `), d.replace(/<img/g, `<img ${E.trim()}`);
|
|
425
986
|
}
|
|
426
|
-
return
|
|
427
|
-
})),
|
|
428
|
-
}
|
|
429
|
-
renderNode(
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
|
|
987
|
+
return d;
|
|
988
|
+
})), e;
|
|
989
|
+
}
|
|
990
|
+
renderNode(e) {
|
|
991
|
+
const r = [];
|
|
992
|
+
e.marks && e.marks.forEach((s) => {
|
|
993
|
+
const l = this.getMatchingMark(s);
|
|
994
|
+
l && l.tag !== "" && r.push(this.renderOpeningTag(l.tag));
|
|
434
995
|
});
|
|
435
|
-
const
|
|
436
|
-
return
|
|
437
|
-
|
|
438
|
-
}) :
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
}),
|
|
442
|
-
}
|
|
443
|
-
renderTag(
|
|
444
|
-
return
|
|
445
|
-
if (
|
|
446
|
-
return `<${
|
|
996
|
+
const i = this.getMatchingNode(e);
|
|
997
|
+
return i && i.tag && r.push(this.renderOpeningTag(i.tag)), e.content ? e.content.forEach((s) => {
|
|
998
|
+
r.push(this.renderNode(s));
|
|
999
|
+
}) : e.text ? r.push(vn(e.text)) : i && i.singleTag ? r.push(this.renderTag(i.singleTag, " /")) : i && i.html ? r.push(i.html) : e.type === "emoji" && r.push(this.renderEmoji(e)), i && i.tag && r.push(this.renderClosingTag(i.tag)), e.marks && e.marks.slice(0).reverse().forEach((s) => {
|
|
1000
|
+
const l = this.getMatchingMark(s);
|
|
1001
|
+
l && l.tag !== "" && r.push(this.renderClosingTag(l.tag));
|
|
1002
|
+
}), r.join("");
|
|
1003
|
+
}
|
|
1004
|
+
renderTag(e, r) {
|
|
1005
|
+
return e.constructor === String ? `<${e}${r}>` : e.map((i) => {
|
|
1006
|
+
if (i.constructor === String)
|
|
1007
|
+
return `<${i}${r}>`;
|
|
447
1008
|
{
|
|
448
|
-
let s = `<${
|
|
449
|
-
if (
|
|
450
|
-
for (const
|
|
451
|
-
const
|
|
452
|
-
|
|
1009
|
+
let s = `<${i.tag}`;
|
|
1010
|
+
if (i.attrs)
|
|
1011
|
+
for (const l in i.attrs) {
|
|
1012
|
+
const u = i.attrs[l];
|
|
1013
|
+
u !== null && (s += ` ${l}="${u}"`);
|
|
453
1014
|
}
|
|
454
|
-
return `${s}${
|
|
1015
|
+
return `${s}${r}>`;
|
|
455
1016
|
}
|
|
456
1017
|
}).join("");
|
|
457
1018
|
}
|
|
458
|
-
renderOpeningTag(
|
|
459
|
-
return this.renderTag(
|
|
1019
|
+
renderOpeningTag(e) {
|
|
1020
|
+
return this.renderTag(e, "");
|
|
460
1021
|
}
|
|
461
|
-
renderClosingTag(
|
|
462
|
-
return
|
|
1022
|
+
renderClosingTag(e) {
|
|
1023
|
+
return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((r) => r.constructor === String ? `</${r}>` : `</${r.tag}>`).join("");
|
|
463
1024
|
}
|
|
464
|
-
getMatchingNode(
|
|
465
|
-
const
|
|
466
|
-
if (typeof
|
|
467
|
-
return e
|
|
1025
|
+
getMatchingNode(e) {
|
|
1026
|
+
const r = this.nodes[e.type];
|
|
1027
|
+
if (typeof r == "function")
|
|
1028
|
+
return r(e);
|
|
468
1029
|
}
|
|
469
|
-
getMatchingMark(
|
|
470
|
-
const
|
|
471
|
-
if (typeof
|
|
472
|
-
return e
|
|
1030
|
+
getMatchingMark(e) {
|
|
1031
|
+
const r = this.marks[e.type];
|
|
1032
|
+
if (typeof r == "function")
|
|
1033
|
+
return r(e);
|
|
473
1034
|
}
|
|
474
|
-
renderEmoji(
|
|
475
|
-
if (
|
|
476
|
-
return
|
|
477
|
-
const
|
|
1035
|
+
renderEmoji(e) {
|
|
1036
|
+
if (e.attrs.emoji)
|
|
1037
|
+
return e.attrs.emoji;
|
|
1038
|
+
const r = [
|
|
478
1039
|
{
|
|
479
1040
|
tag: "img",
|
|
480
1041
|
attrs: {
|
|
481
|
-
src:
|
|
1042
|
+
src: e.attrs.fallbackImage,
|
|
482
1043
|
draggable: "false",
|
|
483
1044
|
loading: "lazy",
|
|
484
1045
|
align: "absmiddle"
|
|
485
1046
|
}
|
|
486
1047
|
}
|
|
487
1048
|
];
|
|
488
|
-
return this.renderTag(
|
|
1049
|
+
return this.renderTag(r, " /");
|
|
489
1050
|
}
|
|
490
1051
|
}
|
|
491
|
-
const
|
|
492
|
-
if (typeof
|
|
1052
|
+
const jn = (o) => {
|
|
1053
|
+
if (typeof o != "object" || typeof o._editable > "u")
|
|
493
1054
|
return {};
|
|
494
1055
|
try {
|
|
495
|
-
const
|
|
496
|
-
|
|
1056
|
+
const e = JSON.parse(
|
|
1057
|
+
o._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
497
1058
|
);
|
|
498
|
-
return
|
|
499
|
-
"data-blok-c": JSON.stringify(
|
|
500
|
-
"data-blok-uid":
|
|
1059
|
+
return e ? {
|
|
1060
|
+
"data-blok-c": JSON.stringify(e),
|
|
1061
|
+
"data-blok-uid": e.id + "-" + e.uid
|
|
501
1062
|
} : {};
|
|
502
1063
|
} catch {
|
|
503
1064
|
return {};
|
|
504
1065
|
}
|
|
505
1066
|
};
|
|
506
|
-
let
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
let
|
|
510
|
-
return
|
|
511
|
-
|
|
1067
|
+
let wn, An = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
1068
|
+
const In = (o, e) => {
|
|
1069
|
+
o.addNode("blok", (r) => {
|
|
1070
|
+
let i = "";
|
|
1071
|
+
return r.attrs.body.forEach((s) => {
|
|
1072
|
+
i += e(s.component, s);
|
|
512
1073
|
}), {
|
|
513
|
-
html:
|
|
1074
|
+
html: i
|
|
514
1075
|
};
|
|
515
1076
|
});
|
|
516
|
-
},
|
|
517
|
-
let
|
|
518
|
-
if (!
|
|
1077
|
+
}, kn = (o) => !o || !(o != null && o.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), On = (o, e, r) => {
|
|
1078
|
+
let i = r || wn;
|
|
1079
|
+
if (!i) {
|
|
519
1080
|
console.error(
|
|
520
1081
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
521
1082
|
);
|
|
522
1083
|
return;
|
|
523
1084
|
}
|
|
524
|
-
return
|
|
525
|
-
}, $
|
|
526
|
-
function
|
|
1085
|
+
return kn(o) ? "" : (e && (i = new Tn(e.schema), e.resolver && In(i, e.resolver)), i.render(o));
|
|
1086
|
+
}, $n = () => Br(An);
|
|
1087
|
+
async function xn(o) {
|
|
1088
|
+
var i;
|
|
1089
|
+
const { action: e, story: r } = o || {};
|
|
1090
|
+
if (e === "input" && r) {
|
|
1091
|
+
const s = document.body, l = await Cn(r);
|
|
1092
|
+
if (l.outerHTML === s.outerHTML)
|
|
1093
|
+
return;
|
|
1094
|
+
const u = document.querySelector('[data-blok-focused="true"]');
|
|
1095
|
+
Sn(s, l, u);
|
|
1096
|
+
} else
|
|
1097
|
+
["published", "change"].includes((i = o == null ? void 0 : o.data) == null ? void 0 : i.action) && location.reload();
|
|
1098
|
+
}
|
|
1099
|
+
function Sn(o, e, r) {
|
|
1100
|
+
if (r) {
|
|
1101
|
+
const i = r.getAttribute("data-blok-uid"), s = e.querySelector(
|
|
1102
|
+
`[data-blok-uid="${i}"]`
|
|
1103
|
+
);
|
|
1104
|
+
s && (s.setAttribute("data-blok-focused", "true"), console.log("Doing partial replace"), r.replaceWith(s));
|
|
1105
|
+
} else
|
|
1106
|
+
console.log("Doing full replace"), o.replaceWith(e);
|
|
1107
|
+
}
|
|
1108
|
+
async function Cn(o) {
|
|
1109
|
+
const r = await (await fetch(location.href, {
|
|
1110
|
+
method: "POST",
|
|
1111
|
+
body: JSON.stringify({
|
|
1112
|
+
...o,
|
|
1113
|
+
is_storyblok_preview: !0
|
|
1114
|
+
}),
|
|
1115
|
+
headers: {
|
|
1116
|
+
"Content-Type": "application/json"
|
|
1117
|
+
}
|
|
1118
|
+
})).text();
|
|
1119
|
+
return new DOMParser().parseFromString(r, "text/html").body;
|
|
1120
|
+
}
|
|
1121
|
+
function En() {
|
|
527
1122
|
return globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly"), globalThis.storyblokApiInstance;
|
|
528
1123
|
}
|
|
529
|
-
function
|
|
530
|
-
|
|
531
|
-
|
|
1124
|
+
async function Rn(o, e = {}, r = {}, i) {
|
|
1125
|
+
globalThis.storyblokApiInstance || console.error("storyblokApiInstance has not been initialized correctly");
|
|
1126
|
+
let s = null;
|
|
1127
|
+
if (i && i.locals._storyblok_preview_data)
|
|
1128
|
+
s = i.locals._storyblok_preview_data;
|
|
1129
|
+
else {
|
|
1130
|
+
const { data: l } = await globalThis.storyblokApiInstance.get(
|
|
1131
|
+
o,
|
|
1132
|
+
e,
|
|
1133
|
+
r
|
|
1134
|
+
);
|
|
1135
|
+
s = l.story;
|
|
1136
|
+
}
|
|
1137
|
+
return s;
|
|
1138
|
+
}
|
|
1139
|
+
function Mn(o, e) {
|
|
1140
|
+
const r = globalThis.storyblokApiInstance.richTextResolver;
|
|
1141
|
+
if (!r) {
|
|
532
1142
|
console.error(
|
|
533
1143
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
534
1144
|
);
|
|
535
1145
|
return;
|
|
536
1146
|
}
|
|
537
|
-
return
|
|
1147
|
+
return On(o, e, r);
|
|
538
1148
|
}
|
|
539
|
-
function
|
|
540
|
-
const
|
|
1149
|
+
function Pn(o) {
|
|
1150
|
+
const e = {
|
|
541
1151
|
useCustomApi: !1,
|
|
542
1152
|
bridge: !0,
|
|
543
1153
|
componentsDir: "src",
|
|
544
1154
|
enableFallbackComponent: !1,
|
|
545
|
-
...
|
|
1155
|
+
...o
|
|
546
1156
|
};
|
|
547
1157
|
return {
|
|
548
1158
|
name: "@storyblok/astro",
|
|
549
1159
|
hooks: {
|
|
550
1160
|
"astro:config:setup": ({
|
|
551
|
-
injectScript:
|
|
552
|
-
updateConfig:
|
|
553
|
-
addDevToolbarApp: s
|
|
1161
|
+
injectScript: r,
|
|
1162
|
+
updateConfig: i,
|
|
1163
|
+
addDevToolbarApp: s,
|
|
1164
|
+
addMiddleware: l
|
|
554
1165
|
}) => {
|
|
555
|
-
|
|
1166
|
+
i({
|
|
556
1167
|
vite: {
|
|
557
1168
|
plugins: [
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
1169
|
+
Or(
|
|
1170
|
+
e.accessToken,
|
|
1171
|
+
e.useCustomApi,
|
|
1172
|
+
e.apiOptions
|
|
562
1173
|
),
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
1174
|
+
Rr(
|
|
1175
|
+
e.componentsDir,
|
|
1176
|
+
e.components,
|
|
1177
|
+
e.enableFallbackComponent,
|
|
1178
|
+
e.customFallbackComponent
|
|
568
1179
|
),
|
|
569
|
-
|
|
1180
|
+
Mr(e),
|
|
1181
|
+
Dr()
|
|
570
1182
|
]
|
|
571
1183
|
}
|
|
572
|
-
}),
|
|
1184
|
+
}), r(
|
|
573
1185
|
"page-ssr",
|
|
574
1186
|
`
|
|
575
1187
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
576
1188
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
577
1189
|
`
|
|
578
|
-
),
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
n
|
|
584
|
-
)});`;
|
|
585
|
-
} else
|
|
586
|
-
a = "const storyblokInstance = new StoryblokBridge()";
|
|
587
|
-
e(
|
|
588
|
-
"page",
|
|
589
|
-
`
|
|
590
|
-
import { loadStoryblokBridge } from "@storyblok/astro";
|
|
1190
|
+
), e.bridge && (r(
|
|
1191
|
+
"page",
|
|
1192
|
+
`
|
|
1193
|
+
import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|
|
1194
|
+
import { bridgeOptions } from "virtual:storyblok-bridge";
|
|
591
1195
|
loadStoryblokBridge().then(() => {
|
|
592
1196
|
const { StoryblokBridge, location } = window;
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
location.reload(true);
|
|
598
|
-
}
|
|
599
|
-
});
|
|
1197
|
+
if(bridgeOptions){
|
|
1198
|
+
const storyblokInstance = new StoryblokBridge(bridgeOptions);
|
|
1199
|
+
storyblokInstance.on(["published", "change","input"], handleStoryblokMessage);
|
|
1200
|
+
};
|
|
600
1201
|
});
|
|
601
1202
|
`
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
1203
|
+
), l({
|
|
1204
|
+
entrypoint: "@storyblok/astro/middleware.ts",
|
|
1205
|
+
order: "pre"
|
|
1206
|
+
})), s("@storyblok/astro/toolbarApp.ts");
|
|
605
1207
|
}
|
|
606
1208
|
}
|
|
607
1209
|
};
|
|
608
1210
|
}
|
|
609
1211
|
export {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
1212
|
+
Tn as RichTextResolver,
|
|
1213
|
+
_n as RichTextSchema,
|
|
1214
|
+
Pn as default,
|
|
1215
|
+
xn as handleStoryblokMessage,
|
|
1216
|
+
$n as loadStoryblokBridge,
|
|
1217
|
+
Mn as renderRichText,
|
|
1218
|
+
jn as storyblokEditable,
|
|
1219
|
+
Rn as useStoryblok,
|
|
1220
|
+
En as useStoryblokApi
|
|
617
1221
|
};
|