webim-adapter 0.1.0

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.
@@ -0,0 +1,1770 @@
1
+ import { Fragment as e, createContext as t, useContext as n, useEffect as r, useRef as i, useState as a } from "react";
2
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
3
+ //#region ../ui/src/components/builder/styles.js
4
+ var l = /* @__PURE__ */ new Set(/* @__PURE__ */ "marginTop.marginRight.marginBottom.marginLeft.paddingTop.paddingRight.paddingBottom.paddingLeft.gap.rowGap.columnGap.flexBasis.fontSize.borderRadius.borderTopLeftRadius.borderTopRightRadius.borderBottomRightRadius.borderBottomLeftRadius.borderWidth.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.letterSpacing.top.right.bottom.left".split(".")), u = (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? `${Number(e)}px` : e, d = [
5
+ "borderWidth",
6
+ "borderStyle",
7
+ "borderColor",
8
+ "borderRadius",
9
+ "gap"
10
+ ];
11
+ function f(e) {
12
+ let t = {};
13
+ for (let n of d) {
14
+ let r = e?.[n];
15
+ r != null && r !== "" && (t[n] = l.has(n) ? u(r) : r);
16
+ }
17
+ for (let [n, r] of Object.entries(e || {})) r == null || r === "" || d.includes(n) || (t[n] = l.has(n) ? u(r) : r);
18
+ let { gradientType: n, gradientAngle: r, gradientFrom: i, gradientTo: a } = t;
19
+ delete t.gradientType, delete t.gradientAngle, delete t.gradientFrom, delete t.gradientTo;
20
+ let { textShadows: o, textShadowX: s, textShadowY: c, textShadowBlur: f, textShadowColor: p } = t;
21
+ delete t.textShadows, delete t.textShadowX, delete t.textShadowY, delete t.textShadowBlur, delete t.textShadowColor;
22
+ let m = (Array.isArray(o) ? o : []).filter((e) => e && e.on !== !1).map((e) => `${u(e.x ?? 0)} ${u(e.y ?? 0)} ${u(e.blur ?? 0)} ${e.color || "rgba(0, 0, 0, 0.35)"}`);
23
+ [
24
+ s,
25
+ c,
26
+ f,
27
+ p
28
+ ].some((e) => e !== void 0) && m.push(`${u(s ?? 0)} ${u(c ?? 0)} ${u(f ?? 0)} ${p || "rgba(0, 0, 0, 0.35)"}`), m.length && (t.textShadow = m.join(", "));
29
+ let h = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}deg` : e, g = (e) => e.type === "move" ? `translate(${u(e.x ?? 0)}, ${u(e.y ?? 0)})` : e.type === "scale" ? `scale(${e.v ?? 1})` : e.type === "rotate" ? `rotate(${h(e.a ?? 0)})` : e.type === "skew" ? `skew(${h(e.x ?? 0)}, ${h(e.y ?? 0)})` : null, { transforms: _, translateX: v, translateY: y, scale: b, rotate: x, skewX: S, skewY: C } = t;
30
+ delete t.transforms, delete t.translateX, delete t.translateY, delete t.scale, delete t.rotate, delete t.skewX, delete t.skewY;
31
+ let w = (Array.isArray(_) ? _ : []).filter((e) => e && e.on !== !1).map(g).filter(Boolean);
32
+ (v !== void 0 || y !== void 0) && w.push(`translate(${u(v ?? 0)}, ${u(y ?? 0)})`), b !== void 0 && w.push(`scale(${b})`), x !== void 0 && w.push(`rotate(${h(x)})`), (S !== void 0 || C !== void 0) && w.push(`skew(${h(S ?? 0)}, ${h(C ?? 0)})`), w.length && (t.transform = w.join(" "));
33
+ let T = (e) => `${e.inset ? "inset " : ""}${u(e.x ?? 0)} ${u(e.y ?? 0)} ${u(e.blur ?? 0)} ${u(e.spread ?? 0)} ${e.color || "rgba(15, 23, 42, 0.2)"}`, { shadows: E, boxShadowX: D, boxShadowY: O, boxShadowBlur: k, boxShadowSpread: A, boxShadowColor: j, boxShadowInset: M } = t;
34
+ delete t.shadows, delete t.boxShadowX, delete t.boxShadowY, delete t.boxShadowBlur, delete t.boxShadowSpread, delete t.boxShadowColor, delete t.boxShadowInset;
35
+ let N = (Array.isArray(E) ? E : []).filter((e) => e && e.on !== !1).map(T);
36
+ [
37
+ D,
38
+ O,
39
+ k,
40
+ A,
41
+ j,
42
+ M
43
+ ].some((e) => e !== void 0) && N.push(T({
44
+ x: D,
45
+ y: O,
46
+ blur: k,
47
+ spread: A,
48
+ color: j,
49
+ inset: M
50
+ })), N.length && (t.boxShadow = N.join(", "));
51
+ let ee = (e) => e.type === "blur" ? `blur(${u(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, te = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(ee), { filters: ne, backdropFilters: re, filterBlur: P, filterGrayscale: F, filterBrightness: I, filterContrast: L, filterSaturate: R } = t;
52
+ delete t.filters, delete t.backdropFilters, delete t.filterBlur, delete t.filterGrayscale, delete t.filterBrightness, delete t.filterContrast, delete t.filterSaturate;
53
+ let z = te(ne);
54
+ P !== void 0 && z.push(`blur(${u(P)})`), F !== void 0 && z.push(`grayscale(${F}%)`), I !== void 0 && z.push(`brightness(${I}%)`), L !== void 0 && z.push(`contrast(${L}%)`), R !== void 0 && z.push(`saturate(${R}%)`), z.length && (t.filter = z.join(" "));
55
+ let ie = te(re);
56
+ ie.length && (t.backdropFilter = ie.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
+ let { textStrokeWidth: B, textStrokeColor: V } = t;
58
+ delete t.textStrokeWidth, delete t.textStrokeColor, (B !== void 0 || V !== void 0) && (t.WebkitTextStroke = `${u(B ?? 1)} ${V || "currentColor"}`);
59
+ let { clipText: ae } = t;
60
+ delete t.clipText, ae && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
+ let { transitions: H, transitionDuration: U, transitionEasing: oe, transitionProperty: W } = t, G = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
62
+ delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
63
+ let K = (Array.isArray(H) ? H : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${G(e.duration ?? 200)} ${e.easing || "ease"}`);
64
+ if (U !== void 0 && K.push(`${W || "all"} ${G(U)} ${oe || "ease"}`), K.length && (t.transition = K.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
65
+ let e = `${i || "rgba(0,0,0,0.5)"}, ${a || "transparent"}`, o = n === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${r ?? 180}deg, ${e})`;
66
+ t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
67
+ }
68
+ delete t.backgroundVideo;
69
+ let { overlayColor: q, overlayOpacity: J } = t;
70
+ if (delete t.overlayColor, delete t.overlayOpacity, q) {
71
+ let e = `color-mix(in srgb, ${q} ${J ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
72
+ t.backgroundImage = t.backgroundImage ? `${n}, ${t.backgroundImage}` : n;
73
+ }
74
+ t.backgroundImage && (t.backgroundSize ??= "cover", t.backgroundPosition ??= "center", t.backgroundRepeat ??= "no-repeat");
75
+ let { backgroundLayers: Y } = t;
76
+ delete t.backgroundLayers;
77
+ let X = (Array.isArray(Y) ? Y : []).filter((e) => e && e.on !== !1);
78
+ if (X.length) {
79
+ let e = [], n = [], r = [], i = [], a = [];
80
+ for (let t of X) if (t.kind === "linear") e.push(`linear-gradient(${t.angle ?? 180}deg, ${t.from || "rgba(0,0,0,0.5)"}, ${t.to || "transparent"})`), n.push("auto"), r.push("0% 0%"), i.push("repeat"), a.push("scroll");
81
+ else if (t.kind === "radial") e.push(`radial-gradient(circle, ${t.from || "rgba(0,0,0,0.5)"}, ${t.to || "transparent"})`), n.push("auto"), r.push("0% 0%"), i.push("repeat"), a.push("scroll");
82
+ else {
83
+ if (!t.src) continue;
84
+ e.push(`url("${t.src}")`), n.push(t.size === "custom" ? `${u(t.w ?? "auto")} ${u(t.h ?? "auto")}` : t.size || "cover"), r.push(`${u(t.posX ?? 0)} ${u(t.posY ?? 0)}`), i.push(t.repeat || "no-repeat"), a.push(t.fixed ? "fixed" : "scroll");
85
+ }
86
+ e.length && (t.backgroundImage && (e.push(t.backgroundImage), n.push(t.backgroundSize || "cover"), r.push(t.backgroundPosition || "center"), i.push(t.backgroundRepeat || "no-repeat"), a.push("scroll")), t.backgroundImage = e.join(", "), t.backgroundSize = n.join(", "), t.backgroundPosition = r.join(", "), t.backgroundRepeat = i.join(", "), t.backgroundAttachment = a.join(", "));
87
+ }
88
+ return t;
89
+ }
90
+ var p = {
91
+ hover: ":hover",
92
+ pressed: ":active",
93
+ focused: ":focus"
94
+ }, m = /* @__PURE__ */ new Set([
95
+ "style",
96
+ "class",
97
+ "id",
98
+ "data-wb",
99
+ "data-wb-class",
100
+ "data-slot"
101
+ ]), h = (e) => /^[a-zA-Z_][\w-]*$/.test(e) && !/^on/i.test(e) && !m.has(e.toLowerCase());
102
+ function g(e, t, n = []) {
103
+ t.htmlId ? e.id = t.htmlId : e.removeAttribute("id");
104
+ for (let t of n) e.removeAttribute(t);
105
+ let r = [];
106
+ for (let n of t.attributes ?? []) {
107
+ let t = String(n?.name ?? "").trim();
108
+ h(t) && (e.setAttribute(t, n.value ?? ""), r.push(t));
109
+ }
110
+ return r;
111
+ }
112
+ var _ = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
113
+ function v(e, t, n, r = !1) {
114
+ let i = Object.entries(f(t)).map(([e, t]) => `${_(e)}: ${t} !important;`).join(" ");
115
+ return i ? `[data-wb="${e}"]${r ? "" : n} { ${i} }` : "";
116
+ }
117
+ function y(e, t, n) {
118
+ return Object.entries(p).map(([r, i]) => v(e, t?.[r], i, n === r)).filter(Boolean).join("\n");
119
+ }
120
+ function b(e, t) {
121
+ let n = [], r = (e) => {
122
+ for (let [t, r] of Object.entries(e || {})) {
123
+ let e = y(t, r.props);
124
+ e && n.push(e);
125
+ }
126
+ };
127
+ r(e);
128
+ for (let e of Object.values(t || {})) r(e.template?.nodes);
129
+ return n.join("\n");
130
+ }
131
+ var x = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", S = {
132
+ light: {
133
+ background: "#ffffff",
134
+ text: "#111827",
135
+ accent: "#111827",
136
+ accentText: "#ffffff",
137
+ primary: {
138
+ light: "#4b5563",
139
+ main: "#111827",
140
+ dark: "#030712",
141
+ contrastText: "#ffffff"
142
+ },
143
+ secondary: {
144
+ light: "#a5b4fc",
145
+ main: "#6366f1",
146
+ dark: "#4338ca",
147
+ contrastText: "#ffffff"
148
+ }
149
+ },
150
+ dark: {
151
+ background: "#0f172a",
152
+ text: "#e2e8f0",
153
+ accent: "#6366f1",
154
+ accentText: "#ffffff",
155
+ primary: {
156
+ light: "#a5b4fc",
157
+ main: "#6366f1",
158
+ dark: "#4338ca",
159
+ contrastText: "#ffffff"
160
+ },
161
+ secondary: {
162
+ light: "#5eead4",
163
+ main: "#14b8a6",
164
+ dark: "#0f766e",
165
+ contrastText: "#052e2b"
166
+ }
167
+ }
168
+ }, C = {
169
+ font: "system",
170
+ headingFont: "inherit",
171
+ light: S.light,
172
+ dark: S.dark
173
+ }, w = {
174
+ system: {
175
+ label: "System",
176
+ value: x
177
+ },
178
+ inter: {
179
+ label: "Inter",
180
+ value: `"Inter", ${x}`
181
+ },
182
+ outfit: {
183
+ label: "Outfit",
184
+ value: `"Outfit", ${x}`
185
+ },
186
+ serif: {
187
+ label: "Serif",
188
+ value: "Georgia, \"Times New Roman\", serif"
189
+ },
190
+ mono: {
191
+ label: "Mono",
192
+ value: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
193
+ }
194
+ }, T = (e, t) => w[e]?.value ?? t, E = (e, ...t) => {
195
+ let n = Object.assign({}, e, ...t);
196
+ return n.primary = {
197
+ ...e.primary,
198
+ ...t.reduce((e, t) => ({
199
+ ...e,
200
+ ...t?.primary
201
+ }), {})
202
+ }, n.secondary = {
203
+ ...e.secondary,
204
+ ...t.reduce((e, t) => ({
205
+ ...e,
206
+ ...t?.secondary
207
+ }), {})
208
+ }, n;
209
+ };
210
+ function D(e) {
211
+ let { light: t, dark: n, font: r, headingFont: i, ...a } = e ?? {};
212
+ return {
213
+ font: r ?? C.font,
214
+ headingFont: i ?? C.headingFont,
215
+ light: E(S.light, a, t),
216
+ dark: E(S.dark, n)
217
+ };
218
+ }
219
+ function O(e) {
220
+ return {
221
+ "--page-bg": e.background,
222
+ "--page-text": e.text,
223
+ "--page-accent": e.accent,
224
+ "--page-accent-text": e.accentText,
225
+ "--page-primary-light": e.primary.light,
226
+ "--page-primary": e.primary.main,
227
+ "--page-primary-dark": e.primary.dark,
228
+ "--page-primary-contrast": e.primary.contrastText,
229
+ "--page-secondary-light": e.secondary.light,
230
+ "--page-secondary": e.secondary.main,
231
+ "--page-secondary-dark": e.secondary.dark,
232
+ "--page-secondary-contrast": e.secondary.contrastText
233
+ };
234
+ }
235
+ function k(e) {
236
+ let t = D(e);
237
+ return {
238
+ backgroundColor: "var(--page-bg)",
239
+ color: "var(--page-text)",
240
+ fontFamily: T(t.font, x),
241
+ "--page-heading-font": t.headingFont === "inherit" ? "inherit" : T(t.headingFont, "inherit")
242
+ };
243
+ }
244
+ function A(e, t = "light") {
245
+ let n = D(e);
246
+ return {
247
+ ...k(e),
248
+ ...O(n[t] ?? n.light)
249
+ };
250
+ }
251
+ function j(e, t) {
252
+ return e?.themeRef && t?.[e.themeRef] || e?.theme;
253
+ }
254
+ //#endregion
255
+ //#region src/bundle.js
256
+ function M({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
257
+ let a = {
258
+ ...t?.global ?? {},
259
+ ...t?.tenant ?? {}
260
+ }, o = e.meta ?? {};
261
+ return {
262
+ schema: 1,
263
+ title: e.title,
264
+ slug: e.slug,
265
+ blocks: i && o.i18n?.[i]?.blocks || e.blocks,
266
+ theme: j(o, a.builder_themes?.themes),
267
+ components: a.builder_components?.components ?? {},
268
+ custom: o.custom,
269
+ seo: o.seo,
270
+ locales: a.locales,
271
+ tenant: n ?? "",
272
+ apiUrl: r ?? ""
273
+ };
274
+ }
275
+ //#endregion
276
+ //#region src/fetchPage.js
277
+ var N = async (e) => {
278
+ let t = await e.json().catch(() => null);
279
+ if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
280
+ return t?.payload ?? t;
281
+ };
282
+ async function ee({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
283
+ if (!e) throw Error("fetchPage: apiUrl is required");
284
+ if (!n) throw Error("fetchPage: slug is required");
285
+ let o = a ?? fetch, s = e.replace(/\/$/, ""), c = t ? { "x-tenant": t } : {}, [l, u] = await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: c }).then(N), o(`${s}/settings/public`, { headers: c }).then(N)]);
286
+ return M({
287
+ page: l,
288
+ settings: u,
289
+ tenant: t,
290
+ apiUrl: s,
291
+ locale: r
292
+ });
293
+ }
294
+ new Map([
295
+ {
296
+ family: "Bebas Neue",
297
+ fallback: "sans-serif"
298
+ },
299
+ {
300
+ family: "Crimson Text",
301
+ fallback: "serif"
302
+ },
303
+ {
304
+ family: "DM Sans",
305
+ fallback: "sans-serif"
306
+ },
307
+ {
308
+ family: "Fira Sans",
309
+ fallback: "sans-serif"
310
+ },
311
+ {
312
+ family: "Inter",
313
+ fallback: "sans-serif"
314
+ },
315
+ {
316
+ family: "JetBrains Mono",
317
+ fallback: "monospace"
318
+ },
319
+ {
320
+ family: "Josefin Sans",
321
+ fallback: "sans-serif"
322
+ },
323
+ {
324
+ family: "Karla",
325
+ fallback: "sans-serif"
326
+ },
327
+ {
328
+ family: "Lato",
329
+ fallback: "sans-serif"
330
+ },
331
+ {
332
+ family: "Lora",
333
+ fallback: "serif"
334
+ },
335
+ {
336
+ family: "Manrope",
337
+ fallback: "sans-serif"
338
+ },
339
+ {
340
+ family: "Merriweather",
341
+ fallback: "serif"
342
+ },
343
+ {
344
+ family: "Montserrat",
345
+ fallback: "sans-serif"
346
+ },
347
+ {
348
+ family: "Nunito",
349
+ fallback: "sans-serif"
350
+ },
351
+ {
352
+ family: "Open Sans",
353
+ fallback: "sans-serif"
354
+ },
355
+ {
356
+ family: "Oswald",
357
+ fallback: "sans-serif"
358
+ },
359
+ {
360
+ family: "Outfit",
361
+ fallback: "sans-serif"
362
+ },
363
+ {
364
+ family: "Playfair Display",
365
+ fallback: "serif"
366
+ },
367
+ {
368
+ family: "Poppins",
369
+ fallback: "sans-serif"
370
+ },
371
+ {
372
+ family: "Quicksand",
373
+ fallback: "sans-serif"
374
+ },
375
+ {
376
+ family: "Raleway",
377
+ fallback: "sans-serif"
378
+ },
379
+ {
380
+ family: "Roboto",
381
+ fallback: "sans-serif"
382
+ },
383
+ {
384
+ family: "Rubik",
385
+ fallback: "sans-serif"
386
+ },
387
+ {
388
+ family: "Source Sans 3",
389
+ fallback: "sans-serif"
390
+ },
391
+ {
392
+ family: "Space Grotesk",
393
+ fallback: "sans-serif"
394
+ },
395
+ {
396
+ family: "Work Sans",
397
+ fallback: "sans-serif"
398
+ }
399
+ ].map((e) => [e.family, e]));
400
+ function te(e) {
401
+ return e.length ? `https://fonts.googleapis.com/css2?${e.map((e) => `family=${e.replace(/ /g, "+")}:wght@100..900`).join("&")}&display=swap` : null;
402
+ }
403
+ var ne = (e) => te([e]), re = (e) => {
404
+ let t = typeof e == "string" && e.match(/^"([^"]+)"/);
405
+ return t ? t[1] : null;
406
+ };
407
+ function P(e, t) {
408
+ let n = /* @__PURE__ */ new Set(), r = (e) => {
409
+ for (let t of Object.values(e || {})) for (let e of [
410
+ "style",
411
+ "hover",
412
+ "pressed",
413
+ "focused"
414
+ ]) {
415
+ let r = re(t.props?.[e]?.fontFamily);
416
+ r && n.add(r);
417
+ }
418
+ };
419
+ r(e);
420
+ for (let e of Object.values(t || {})) r(e.template?.nodes);
421
+ return [...n].sort();
422
+ }
423
+ //#endregion
424
+ //#region ../ui/src/components/builder/views.jsx
425
+ var F = t({
426
+ tenant: "",
427
+ apiUrl: "/api"
428
+ }), I = {
429
+ margin: 0,
430
+ fontWeight: 700,
431
+ lineHeight: 1.2,
432
+ fontFamily: "var(--page-heading-font, inherit)"
433
+ }, L = { margin: 0 }, R = {
434
+ display: "inline-block",
435
+ textDecoration: "none",
436
+ cursor: "pointer",
437
+ backgroundColor: "var(--page-accent, #111827)",
438
+ color: "var(--page-accent-text, #ffffff)"
439
+ }, z = {
440
+ flexGrow: 1,
441
+ display: "flex",
442
+ flexDirection: "column",
443
+ position: "relative"
444
+ }, ie = {
445
+ display: "flex",
446
+ flexDirection: "column"
447
+ };
448
+ function B({ style: e }) {
449
+ let t = e?.backgroundVideo;
450
+ if (!t) return null;
451
+ let n = {
452
+ position: "absolute",
453
+ inset: 0,
454
+ width: "100%",
455
+ height: "100%",
456
+ zIndex: -1,
457
+ pointerEvents: "none"
458
+ }, r = e?.overlayColor ? `color-mix(in srgb, ${e.overlayColor} ${e.overlayOpacity ?? 50}%, transparent)` : null;
459
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("video", {
460
+ src: t,
461
+ autoPlay: !0,
462
+ muted: !0,
463
+ loop: !0,
464
+ playsInline: !0,
465
+ style: {
466
+ ...n,
467
+ objectFit: "cover"
468
+ }
469
+ }), r && /* @__PURE__ */ s("div", { style: {
470
+ ...n,
471
+ background: r
472
+ } })] });
473
+ }
474
+ var V = (e, t) => e?.backgroundVideo ? {
475
+ position: "relative",
476
+ ...t,
477
+ ...f(e)
478
+ } : {
479
+ ...t,
480
+ ...f(e)
481
+ };
482
+ function ae({ style: e, nodeRef: t, children: n }) {
483
+ return /* @__PURE__ */ c("div", {
484
+ ref: t,
485
+ style: {
486
+ ...z,
487
+ ...f(e)
488
+ },
489
+ children: [/* @__PURE__ */ s(B, { style: e }), n]
490
+ });
491
+ }
492
+ function H({ style: e, nodeRef: t, children: n }) {
493
+ return /* @__PURE__ */ c("section", {
494
+ ref: t,
495
+ style: V(e, ie),
496
+ children: [/* @__PURE__ */ s(B, { style: e }), n]
497
+ });
498
+ }
499
+ function U({ style: e, nodeRef: t, children: n }) {
500
+ return /* @__PURE__ */ c("div", {
501
+ ref: t,
502
+ style: V(e),
503
+ children: [/* @__PURE__ */ s(B, { style: e }), n]
504
+ });
505
+ }
506
+ function oe({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
507
+ return /* @__PURE__ */ s(n, {
508
+ ref: a,
509
+ style: {
510
+ ...I,
511
+ ...f(r)
512
+ },
513
+ children: K(t, e, i)
514
+ });
515
+ }
516
+ var W = {
517
+ fontFamily: w.mono.value,
518
+ background: "rgba(148, 163, 184, 0.18)",
519
+ padding: "1px 5px",
520
+ borderRadius: 4,
521
+ fontSize: "0.9em"
522
+ };
523
+ function G(e, t = [], n) {
524
+ let r = e;
525
+ return t.includes("sup") ? r = /* @__PURE__ */ s("sup", { children: r }) : t.includes("sub") && (r = /* @__PURE__ */ s("sub", { children: r })), t.includes("code") && (r = /* @__PURE__ */ s("code", {
526
+ style: W,
527
+ children: r
528
+ })), t.includes("strike") && (r = /* @__PURE__ */ s("s", { children: r })), t.includes("underline") && (r = /* @__PURE__ */ s("u", { children: r })), t.includes("italic") && (r = /* @__PURE__ */ s("em", { children: r })), t.includes("bold") && (r = /* @__PURE__ */ s("strong", { children: r })), n && (r = /* @__PURE__ */ s("a", {
529
+ href: n,
530
+ style: { color: "inherit" },
531
+ children: r
532
+ })), r;
533
+ }
534
+ function K(t, n, r) {
535
+ return t?.length ? t.map((t, n) => {
536
+ if (t.slot) return /* @__PURE__ */ s(e, { children: r?.[t.slot] ?? null }, n);
537
+ if (t.parts) return /* @__PURE__ */ s(e, { children: K(t.parts, "", r) }, n);
538
+ let i = t.text;
539
+ return t.sup ? i = /* @__PURE__ */ s("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ s("sub", { children: i })), t.code && (i = /* @__PURE__ */ s("code", {
540
+ style: W,
541
+ children: i
542
+ })), t.strike && (i = /* @__PURE__ */ s("s", { children: i })), t.underline && (i = /* @__PURE__ */ s("u", { children: i })), t.italic && (i = /* @__PURE__ */ s("em", { children: i })), t.bold && (i = /* @__PURE__ */ s("strong", { children: i })), t.href && (i = /* @__PURE__ */ s("a", {
543
+ href: t.href,
544
+ style: { color: "inherit" },
545
+ children: i
546
+ })), /* @__PURE__ */ s(e, { children: i }, n);
547
+ }) : n;
548
+ }
549
+ function q({ parts: e, text: t, marks: n, href: r, style: i }) {
550
+ return /* @__PURE__ */ s("span", {
551
+ style: f(i),
552
+ children: e?.length ? K(e, t) : G(t, n, r)
553
+ });
554
+ }
555
+ var J = {
556
+ h1: 40,
557
+ h2: 32,
558
+ h3: 26,
559
+ h4: 22,
560
+ h5: 19,
561
+ h6: 16
562
+ };
563
+ function Y({ align: e = "center", width: t } = {}) {
564
+ let n = t ? `${t}%` : void 0;
565
+ return e === "full" ? { width: "100%" } : e === "left" ? {
566
+ float: "left",
567
+ width: n ?? "50%",
568
+ marginTop: 4,
569
+ marginRight: 20,
570
+ marginBottom: 12,
571
+ marginLeft: 0
572
+ } : e === "right" ? {
573
+ float: "right",
574
+ width: n ?? "50%",
575
+ marginTop: 4,
576
+ marginLeft: 20,
577
+ marginBottom: 12,
578
+ marginRight: 0
579
+ } : {
580
+ width: n ?? "fit-content",
581
+ maxWidth: "100%",
582
+ marginLeft: "auto",
583
+ marginRight: "auto"
584
+ };
585
+ }
586
+ function X(e = [], t, n) {
587
+ let r = n ?? ((e, n) => K(e, n, t));
588
+ return e.map((t, n) => {
589
+ let i = {
590
+ marginTop: 0,
591
+ marginBottom: n === e.length - 1 ? 0 : 14
592
+ };
593
+ if (t.type === "image") {
594
+ if (!t.src) return null;
595
+ let e = /* @__PURE__ */ s("img", {
596
+ src: t.src,
597
+ alt: t.alt || "",
598
+ style: {
599
+ width: "100%",
600
+ display: "block",
601
+ borderRadius: 6
602
+ }
603
+ });
604
+ return /* @__PURE__ */ c("figure", {
605
+ style: {
606
+ marginLeft: 0,
607
+ marginRight: 0,
608
+ ...i,
609
+ ...Y(t)
610
+ },
611
+ children: [t.href ? /* @__PURE__ */ s("a", {
612
+ href: t.href,
613
+ style: { display: "block" },
614
+ children: e
615
+ }) : e, t.caption && /* @__PURE__ */ s("figcaption", {
616
+ style: {
617
+ fontSize: 13,
618
+ opacity: .65,
619
+ marginTop: 6,
620
+ textAlign: "center"
621
+ },
622
+ children: t.caption
623
+ })]
624
+ }, n);
625
+ }
626
+ if (t.type === "video") return _e(t.url) ? /* @__PURE__ */ s("div", {
627
+ style: {
628
+ ...i,
629
+ ...Y({
630
+ align: t.align,
631
+ width: t.width ?? 100
632
+ })
633
+ },
634
+ children: /* @__PURE__ */ s(ve, {
635
+ url: t.url,
636
+ autoplay: t.autoplay,
637
+ muted: t.muted,
638
+ loop: t.loop,
639
+ controls: t.controls ?? !0,
640
+ start: t.start
641
+ })
642
+ }, n) : null;
643
+ if (t.type === "divider") return /* @__PURE__ */ s("hr", { style: {
644
+ ...i,
645
+ border: 0,
646
+ borderTop: "1px solid rgba(148, 163, 184, 0.4)"
647
+ } }, n);
648
+ if (t.type === "ul" || t.type === "ol") {
649
+ let e = t.type;
650
+ return /* @__PURE__ */ s(e, {
651
+ style: {
652
+ ...i,
653
+ paddingLeft: 24
654
+ },
655
+ children: (t.items ?? []).map((e, t) => /* @__PURE__ */ s("li", {
656
+ style: { marginBottom: 4 },
657
+ children: r(e.parts, e.text)
658
+ }, t))
659
+ }, n);
660
+ }
661
+ if (t.type === "quote") return /* @__PURE__ */ s("blockquote", {
662
+ style: {
663
+ ...ce,
664
+ ...i
665
+ },
666
+ children: r(t.parts, t.text)
667
+ }, n);
668
+ if (J[t.type]) {
669
+ let e = t.type;
670
+ return /* @__PURE__ */ s(e, {
671
+ style: {
672
+ ...I,
673
+ fontSize: J[t.type],
674
+ ...i
675
+ },
676
+ children: r(t.parts, t.text)
677
+ }, n);
678
+ }
679
+ return /* @__PURE__ */ s("p", {
680
+ style: {
681
+ ...L,
682
+ ...i
683
+ },
684
+ children: r(t.parts, t.text)
685
+ }, n);
686
+ });
687
+ }
688
+ function se({ content: e, style: t, linked: n, nodeRef: r }) {
689
+ return /* @__PURE__ */ s("div", {
690
+ ref: r,
691
+ style: {
692
+ display: "flow-root",
693
+ ...f(t)
694
+ },
695
+ children: X(e, n)
696
+ });
697
+ }
698
+ var ce = {
699
+ margin: 0,
700
+ padding: "8px 0 8px 20px",
701
+ borderLeft: "4px solid var(--page-accent, rgba(148, 163, 184, 0.6))"
702
+ };
703
+ function le({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
704
+ return /* @__PURE__ */ s("blockquote", {
705
+ ref: i,
706
+ style: {
707
+ ...ce,
708
+ ...f(n)
709
+ },
710
+ children: K(t, e, r)
711
+ });
712
+ }
713
+ function ue({ ordered: e, items: t = [], style: n, nodeRef: r }) {
714
+ return /* @__PURE__ */ s(e ? "ol" : "ul", {
715
+ ref: r,
716
+ style: {
717
+ margin: 0,
718
+ paddingLeft: 24,
719
+ ...f(n)
720
+ },
721
+ children: t.map((e, t) => /* @__PURE__ */ s("li", {
722
+ style: { marginBottom: 4 },
723
+ children: K(e.parts, e.text)
724
+ }, t))
725
+ });
726
+ }
727
+ function de({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
728
+ return /* @__PURE__ */ s("p", {
729
+ ref: i,
730
+ style: {
731
+ ...L,
732
+ ...f(n)
733
+ },
734
+ children: K(t, e, r)
735
+ });
736
+ }
737
+ var fe = {
738
+ color: "var(--page-accent, inherit)",
739
+ textDecoration: "underline",
740
+ textUnderlineOffset: 3,
741
+ cursor: "pointer"
742
+ };
743
+ function pe({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
744
+ return /* @__PURE__ */ s("a", {
745
+ ref: o,
746
+ href: n || "#",
747
+ target: r || void 0,
748
+ rel: r === "_blank" ? "noopener noreferrer" : void 0,
749
+ style: {
750
+ ...fe,
751
+ ...f(i)
752
+ },
753
+ children: K(t, e, a)
754
+ });
755
+ }
756
+ function me({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
757
+ return /* @__PURE__ */ s("a", {
758
+ ref: o,
759
+ href: n || "#",
760
+ target: r || void 0,
761
+ rel: r === "_blank" ? "noopener noreferrer" : void 0,
762
+ style: {
763
+ ...R,
764
+ ...f(i)
765
+ },
766
+ children: K(t, e, a)
767
+ });
768
+ }
769
+ function he({ src: e, alt: t, style: n, nodeRef: r }) {
770
+ return e ? /* @__PURE__ */ s("img", {
771
+ ref: r,
772
+ src: e,
773
+ alt: t || "",
774
+ style: {
775
+ display: "block",
776
+ maxWidth: "100%",
777
+ ...f(n)
778
+ }
779
+ }) : null;
780
+ }
781
+ function ge({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: c }) {
782
+ return e ? /* @__PURE__ */ s("video", {
783
+ ref: c,
784
+ src: e,
785
+ poster: t || void 0,
786
+ controls: n,
787
+ autoPlay: r,
788
+ muted: a || r,
789
+ loop: i,
790
+ playsInline: !0,
791
+ style: {
792
+ display: "block",
793
+ width: "100%",
794
+ maxWidth: "100%",
795
+ ...f(o)
796
+ }
797
+ }) : null;
798
+ }
799
+ var _e = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
800
+ function ve({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: c }) {
801
+ let l = _e(e);
802
+ if (!l) return null;
803
+ let u = new URLSearchParams({ rel: "0" });
804
+ return t && u.set("autoplay", "1"), (n || t) && u.set("mute", "1"), i || u.set("controls", "0"), r && (u.set("loop", "1"), u.set("playlist", l)), Number(a) > 0 && u.set("start", String(Math.floor(Number(a)))), /* @__PURE__ */ s("div", {
805
+ ref: c,
806
+ style: {
807
+ position: "relative",
808
+ width: "100%",
809
+ paddingTop: "56.25%",
810
+ ...f(o)
811
+ },
812
+ children: /* @__PURE__ */ s("iframe", {
813
+ src: `https://www.youtube-nocookie.com/embed/${l}?${u}`,
814
+ title: "YouTube video",
815
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
816
+ allowFullScreen: !0,
817
+ style: {
818
+ position: "absolute",
819
+ inset: 0,
820
+ width: "100%",
821
+ height: "100%",
822
+ border: 0
823
+ }
824
+ })
825
+ });
826
+ }
827
+ function ye({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
828
+ return e ? /* @__PURE__ */ s("iframe", {
829
+ ref: i,
830
+ src: e,
831
+ title: t || "Embedded frame",
832
+ loading: "lazy",
833
+ allowFullScreen: n,
834
+ style: {
835
+ display: "block",
836
+ width: "100%",
837
+ height: 300,
838
+ border: 0,
839
+ ...f(r)
840
+ }
841
+ }) : null;
842
+ }
843
+ function be({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
844
+ let [o, c] = a(null);
845
+ return r(() => {
846
+ o && (o.innerHTML = e || "", t && o.querySelectorAll("script").forEach((e) => {
847
+ let t = document.createElement("script");
848
+ for (let { name: n, value: r } of e.attributes) t.setAttribute(n, r);
849
+ t.text = e.textContent, e.replaceWith(t);
850
+ }));
851
+ }, [
852
+ o,
853
+ e,
854
+ t
855
+ ]), /* @__PURE__ */ s("div", {
856
+ ref: (e) => {
857
+ c(e), i && i(e);
858
+ },
859
+ style: f(n)
860
+ });
861
+ }
862
+ function xe({ height: e, nodeRef: t }) {
863
+ return /* @__PURE__ */ s("div", {
864
+ ref: t,
865
+ style: {
866
+ height: e || 32,
867
+ flexShrink: 0,
868
+ alignSelf: "stretch"
869
+ }
870
+ });
871
+ }
872
+ function Se({ style: e, nodeRef: t }) {
873
+ return /* @__PURE__ */ s("div", {
874
+ ref: t,
875
+ style: {
876
+ height: 1,
877
+ alignSelf: "stretch",
878
+ flexShrink: 0,
879
+ ...f(e)
880
+ }
881
+ });
882
+ }
883
+ var Ce = {
884
+ position: "absolute",
885
+ top: "50%",
886
+ transform: "translateY(-50%)",
887
+ width: 36,
888
+ height: 36,
889
+ borderRadius: "50%",
890
+ border: 0,
891
+ cursor: "pointer",
892
+ background: "rgba(17, 24, 39, 0.45)",
893
+ color: "#fff",
894
+ fontSize: 20,
895
+ lineHeight: 1,
896
+ display: "flex",
897
+ alignItems: "center",
898
+ justifyContent: "center",
899
+ padding: 0
900
+ }, we = {
901
+ bottom: {
902
+ inset: "auto 0 0 0",
903
+ padding: "40px 24px 20px",
904
+ background: "linear-gradient(transparent, rgba(0, 0, 0, 0.55))"
905
+ },
906
+ top: {
907
+ inset: "0 0 auto 0",
908
+ padding: "20px 24px 40px",
909
+ background: "linear-gradient(rgba(0, 0, 0, 0.55), transparent)"
910
+ },
911
+ middle: {
912
+ inset: 0,
913
+ display: "flex",
914
+ flexDirection: "column",
915
+ justifyContent: "center",
916
+ padding: 24,
917
+ textShadow: "0 2px 12px rgba(0, 0, 0, 0.6)"
918
+ }
919
+ }, Te = 48;
920
+ function Ee({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, height: l = 320, swipe: u = !0, style: d, nodeRef: p }) {
921
+ let [m, h] = a(0), [g, _] = a(!1), [v, y] = a(null), b = e ? Math.min(m, e - 1) : 0;
922
+ if (r(() => {
923
+ if (!n || g || v || e < 2) return;
924
+ let t = setInterval(() => h((t) => (t + 1) % e), Math.max(2, Number(i) || 5) * 1e3);
925
+ return () => clearInterval(t);
926
+ }, [
927
+ n,
928
+ g,
929
+ v,
930
+ i,
931
+ e
932
+ ]), !e) return null;
933
+ let x = (t) => h((t + e) % e), S = () => {
934
+ if (!v) return;
935
+ let { dx: e } = v;
936
+ y(null), e < -48 ? x(b + 1) : e > Te && x(b - 1);
937
+ };
938
+ return /* @__PURE__ */ c("div", {
939
+ ref: p,
940
+ onMouseEnter: () => _(!0),
941
+ onMouseLeave: () => _(!1),
942
+ onPointerDown: u && e > 1 ? (e) => {
943
+ e.pointerType === "mouse" && e.button !== 0 || e.target.closest("button") || (e.currentTarget.setPointerCapture(e.pointerId), y({
944
+ startX: e.clientX,
945
+ dx: 0
946
+ }));
947
+ } : void 0,
948
+ onPointerMove: v ? (e) => y((t) => t && {
949
+ ...t,
950
+ dx: e.clientX - t.startX
951
+ }) : void 0,
952
+ onPointerUp: S,
953
+ onPointerCancel: S,
954
+ style: {
955
+ position: "relative",
956
+ overflow: "hidden",
957
+ width: "100%",
958
+ touchAction: "pan-y",
959
+ userSelect: v ? "none" : void 0,
960
+ cursor: v ? "grabbing" : void 0,
961
+ ...f(d)
962
+ },
963
+ children: [/* @__PURE__ */ s("div", {
964
+ style: {
965
+ display: "flex",
966
+ height: l,
967
+ transform: `translateX(calc(${-b * 100}% + ${v?.dx ?? 0}px))`,
968
+ transition: v ? "none" : "transform 450ms ease"
969
+ },
970
+ children: Array.from({ length: e }, (e, n) => /* @__PURE__ */ s("div", {
971
+ style: {
972
+ position: "relative",
973
+ width: "100%",
974
+ flexShrink: 0,
975
+ overflow: "hidden"
976
+ },
977
+ children: t(n)
978
+ }, n))
979
+ }), e > 1 && /* @__PURE__ */ c(o, { children: [
980
+ /* @__PURE__ */ s("button", {
981
+ type: "button",
982
+ "aria-label": "Previous slide",
983
+ style: {
984
+ ...Ce,
985
+ left: 12
986
+ },
987
+ onClick: () => x(b - 1),
988
+ children: "‹"
989
+ }),
990
+ /* @__PURE__ */ s("button", {
991
+ type: "button",
992
+ "aria-label": "Next slide",
993
+ style: {
994
+ ...Ce,
995
+ right: 12
996
+ },
997
+ onClick: () => x(b + 1),
998
+ children: "›"
999
+ }),
1000
+ /* @__PURE__ */ s("div", {
1001
+ style: {
1002
+ position: "absolute",
1003
+ bottom: 10,
1004
+ left: 0,
1005
+ right: 0,
1006
+ display: "flex",
1007
+ justifyContent: "center",
1008
+ gap: 6
1009
+ },
1010
+ children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ s("button", {
1011
+ type: "button",
1012
+ "aria-label": `Go to slide ${t + 1}`,
1013
+ onClick: () => x(t),
1014
+ style: {
1015
+ width: 8,
1016
+ height: 8,
1017
+ borderRadius: "50%",
1018
+ border: 0,
1019
+ padding: 0,
1020
+ cursor: "pointer",
1021
+ background: t === b ? "#ffffff" : "rgba(255, 255, 255, 0.45)"
1022
+ }
1023
+ }, t))
1024
+ })
1025
+ ] })]
1026
+ });
1027
+ }
1028
+ var De = (e, t) => ({
1029
+ position: "absolute",
1030
+ inset: 0,
1031
+ backgroundImage: e ? `url(${e})` : "none",
1032
+ backgroundColor: t || (e ? void 0 : "rgba(148, 163, 184, 0.25)"),
1033
+ backgroundSize: "cover",
1034
+ backgroundPosition: "center"
1035
+ });
1036
+ function Oe({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
1037
+ return e.length ? /* @__PURE__ */ s(Ee, {
1038
+ ...r,
1039
+ count: e.length,
1040
+ renderSlide: (r) => {
1041
+ let i = e[r];
1042
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: De(i.image) }), (i.title || i.text) && /* @__PURE__ */ c("div", {
1043
+ style: {
1044
+ position: "absolute",
1045
+ color: "#fff",
1046
+ textAlign: n,
1047
+ ...we[t] ?? we.bottom
1048
+ },
1049
+ children: [i.title && /* @__PURE__ */ s("div", {
1050
+ style: {
1051
+ fontSize: 22,
1052
+ fontWeight: 700
1053
+ },
1054
+ children: i.title
1055
+ }), i.text && /* @__PURE__ */ s("div", {
1056
+ style: {
1057
+ fontSize: 14,
1058
+ opacity: .9,
1059
+ marginTop: 4
1060
+ },
1061
+ children: i.text
1062
+ })]
1063
+ })] });
1064
+ }
1065
+ }) : null;
1066
+ }
1067
+ function ke({ slides: e = [], linked: t, ...n }) {
1068
+ return e.length ? /* @__PURE__ */ s(Ee, {
1069
+ ...n,
1070
+ count: e.length,
1071
+ renderSlide: (n) => {
1072
+ let r = e[n];
1073
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: De(r.image, r.color) }), /* @__PURE__ */ s("div", {
1074
+ style: {
1075
+ position: "absolute",
1076
+ inset: 0,
1077
+ display: "flex",
1078
+ flexDirection: "column"
1079
+ },
1080
+ children: t?.[r.key] ?? null
1081
+ })] });
1082
+ }
1083
+ }) : null;
1084
+ }
1085
+ var Z = {
1086
+ color: "inherit",
1087
+ textDecoration: "none",
1088
+ fontSize: 14,
1089
+ opacity: .85
1090
+ }, Ae = {
1091
+ background: "var(--page-bg, #ffffff)",
1092
+ color: "var(--page-text, #111827)",
1093
+ border: "1px solid rgba(148, 163, 184, 0.25)",
1094
+ boxShadow: "0 16px 40px rgba(15, 23, 42, 0.16)",
1095
+ zIndex: 60
1096
+ };
1097
+ function je({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u = "auto", breakpoint: d = 768 }) {
1098
+ let [p, m] = a(null), [h, g] = a(!1), [_, v] = a(!1), [y, b] = a(null);
1099
+ r(() => {
1100
+ if (!p) return;
1101
+ let e = new ResizeObserver(() => g(p.offsetWidth < d));
1102
+ return e.observe(p), () => e.disconnect();
1103
+ }, [p, d]);
1104
+ let x = u === "hamburger" || u === "auto" && h, S = (e, t) => /* @__PURE__ */ c("a", {
1105
+ href: e.href || "#",
1106
+ style: {
1107
+ ...Z,
1108
+ display: "block",
1109
+ ...t
1110
+ },
1111
+ children: [e.label, e.desc && /* @__PURE__ */ s("span", {
1112
+ style: {
1113
+ display: "block",
1114
+ fontSize: 12,
1115
+ opacity: .6,
1116
+ marginTop: 2
1117
+ },
1118
+ children: e.desc
1119
+ })]
1120
+ }, e.key);
1121
+ return /* @__PURE__ */ c("nav", {
1122
+ ref: (e) => {
1123
+ m(e), l && l(e);
1124
+ },
1125
+ style: {
1126
+ display: "flex",
1127
+ alignItems: "center",
1128
+ gap: 24,
1129
+ flexWrap: "wrap",
1130
+ padding: "14px 24px",
1131
+ width: "100%",
1132
+ position: "relative",
1133
+ ...f(o)
1134
+ },
1135
+ children: [
1136
+ n && /* @__PURE__ */ s("img", {
1137
+ src: n,
1138
+ alt: t || "Logo",
1139
+ style: {
1140
+ height: 28,
1141
+ display: "block"
1142
+ }
1143
+ }),
1144
+ t && /* @__PURE__ */ s("div", {
1145
+ style: {
1146
+ fontWeight: 700,
1147
+ fontSize: 18,
1148
+ fontFamily: "var(--page-heading-font, inherit)"
1149
+ },
1150
+ children: t
1151
+ }),
1152
+ /* @__PURE__ */ s("div", { style: { flexGrow: 1 } }),
1153
+ x ? /* @__PURE__ */ s("button", {
1154
+ type: "button",
1155
+ "aria-label": _ ? "Close menu" : "Open menu",
1156
+ onClick: () => v(!_),
1157
+ style: {
1158
+ background: "transparent",
1159
+ border: 0,
1160
+ color: "inherit",
1161
+ cursor: "pointer",
1162
+ fontSize: 20,
1163
+ lineHeight: 1,
1164
+ padding: 4
1165
+ },
1166
+ children: _ ? "✕" : "☰"
1167
+ }) : /* @__PURE__ */ s("div", {
1168
+ style: {
1169
+ display: "flex",
1170
+ gap: 20,
1171
+ alignItems: "center",
1172
+ flexWrap: "wrap"
1173
+ },
1174
+ children: i.map((e) => {
1175
+ let t = e.children ?? [];
1176
+ if (!t.length) return /* @__PURE__ */ s("a", {
1177
+ href: e.href || "#",
1178
+ style: Z,
1179
+ children: e.label
1180
+ }, e.key);
1181
+ let n = e.type === "mega";
1182
+ return /* @__PURE__ */ c("span", {
1183
+ style: {
1184
+ position: n ? "static" : "relative",
1185
+ display: "inline-flex"
1186
+ },
1187
+ onMouseEnter: () => b(e.key),
1188
+ onMouseLeave: () => b(null),
1189
+ children: [/* @__PURE__ */ c("a", {
1190
+ href: e.href || "#",
1191
+ style: {
1192
+ ...Z,
1193
+ cursor: "pointer"
1194
+ },
1195
+ children: [
1196
+ e.label,
1197
+ " ",
1198
+ /* @__PURE__ */ s("span", {
1199
+ style: {
1200
+ fontSize: 9,
1201
+ opacity: .6
1202
+ },
1203
+ children: "▼"
1204
+ })
1205
+ ]
1206
+ }), y === e.key && (n ? /* @__PURE__ */ s("div", {
1207
+ style: {
1208
+ ...Ae,
1209
+ position: "absolute",
1210
+ left: 0,
1211
+ right: 0,
1212
+ top: "100%",
1213
+ padding: 24,
1214
+ display: "grid",
1215
+ gridTemplateColumns: "repeat(auto-fit, minmax(170px, 1fr))",
1216
+ gap: 16
1217
+ },
1218
+ children: t.map((e) => S(e, {
1219
+ padding: "6px 8px",
1220
+ borderRadius: 6
1221
+ }))
1222
+ }) : /* @__PURE__ */ s("div", {
1223
+ style: {
1224
+ ...Ae,
1225
+ position: "absolute",
1226
+ top: "100%",
1227
+ left: 0,
1228
+ minWidth: 190,
1229
+ borderRadius: 8,
1230
+ padding: 8,
1231
+ display: "flex",
1232
+ flexDirection: "column"
1233
+ },
1234
+ children: t.map((e) => S(e, {
1235
+ padding: "8px 12px",
1236
+ borderRadius: 6
1237
+ }))
1238
+ }))]
1239
+ }, e.key);
1240
+ })
1241
+ }),
1242
+ x && _ && /* @__PURE__ */ s("div", {
1243
+ style: {
1244
+ flexBasis: "100%",
1245
+ width: "100%",
1246
+ display: "flex",
1247
+ flexDirection: "column",
1248
+ paddingTop: 10
1249
+ },
1250
+ children: i.map((t) => /* @__PURE__ */ c(e, { children: [/* @__PURE__ */ s("a", {
1251
+ href: t.href || "#",
1252
+ style: {
1253
+ ...Z,
1254
+ padding: "10px 4px",
1255
+ fontWeight: (t.children ?? []).length ? 600 : 400,
1256
+ opacity: 1
1257
+ },
1258
+ children: t.label
1259
+ }), (t.children ?? []).map((e) => S(e, { padding: "8px 4px 8px 22px" }))] }, t.key))
1260
+ })
1261
+ ]
1262
+ });
1263
+ }
1264
+ function Me({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1265
+ let [i, o] = a(0), l = e.length ? Math.min(i, e.length - 1) : 0;
1266
+ return e.length ? /* @__PURE__ */ c("div", {
1267
+ ref: r,
1268
+ style: {
1269
+ width: "100%",
1270
+ ...f(n)
1271
+ },
1272
+ children: [/* @__PURE__ */ s("div", {
1273
+ style: {
1274
+ display: "flex",
1275
+ gap: 4,
1276
+ borderBottom: "1px solid rgba(148, 163, 184, 0.35)"
1277
+ },
1278
+ children: e.map((e, t) => /* @__PURE__ */ s("button", {
1279
+ type: "button",
1280
+ onClick: () => o(t),
1281
+ style: {
1282
+ background: "transparent",
1283
+ border: 0,
1284
+ padding: "10px 16px",
1285
+ fontSize: 14,
1286
+ fontFamily: "inherit",
1287
+ color: "inherit",
1288
+ cursor: "pointer",
1289
+ opacity: t === l ? 1 : .6,
1290
+ fontWeight: t === l ? 600 : 500,
1291
+ boxShadow: t === l ? "inset 0 -2px 0 var(--page-accent, #111827)" : "none"
1292
+ },
1293
+ children: e.label || `Tab ${t + 1}`
1294
+ }, e.key))
1295
+ }), e.map((e, n) => /* @__PURE__ */ s("div", {
1296
+ style: {
1297
+ display: n === l ? "flex" : "none",
1298
+ flexDirection: "column"
1299
+ },
1300
+ children: t?.[e.key] ?? null
1301
+ }, e.key))]
1302
+ }) : null;
1303
+ }
1304
+ function Ne({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1305
+ let [o, l] = a(() => new Set(e.length ? [e[0].key] : []));
1306
+ if (!e.length) return null;
1307
+ let u = (e) => l((t) => {
1308
+ let r = new Set(n ? t : []);
1309
+ return t.has(e) ? r.delete(e) : r.add(e), r;
1310
+ });
1311
+ return /* @__PURE__ */ s("div", {
1312
+ ref: i,
1313
+ style: {
1314
+ width: "100%",
1315
+ ...f(r)
1316
+ },
1317
+ children: e.map((n, r) => {
1318
+ let i = o.has(n.key);
1319
+ return /* @__PURE__ */ c("div", {
1320
+ style: { borderBottom: r < e.length - 1 ? "1px solid rgba(148, 163, 184, 0.35)" : "none" },
1321
+ children: [/* @__PURE__ */ c("button", {
1322
+ type: "button",
1323
+ onClick: () => u(n.key),
1324
+ style: {
1325
+ width: "100%",
1326
+ display: "flex",
1327
+ alignItems: "center",
1328
+ justifyContent: "space-between",
1329
+ gap: 12,
1330
+ background: "transparent",
1331
+ border: 0,
1332
+ padding: "14px 4px",
1333
+ fontSize: 15,
1334
+ fontWeight: 600,
1335
+ fontFamily: "inherit",
1336
+ color: "inherit",
1337
+ textAlign: "left",
1338
+ cursor: "pointer"
1339
+ },
1340
+ children: [n.title || `Item ${r + 1}`, /* @__PURE__ */ s("span", {
1341
+ "aria-hidden": !0,
1342
+ style: {
1343
+ fontSize: 12,
1344
+ opacity: .6,
1345
+ transform: i ? "rotate(180deg)" : "none",
1346
+ transition: "transform 180ms"
1347
+ },
1348
+ children: "▼"
1349
+ })]
1350
+ }), /* @__PURE__ */ s("div", {
1351
+ style: {
1352
+ display: i ? "flex" : "none",
1353
+ flexDirection: "column"
1354
+ },
1355
+ children: t?.[n.key] ?? null
1356
+ })]
1357
+ }, n.key);
1358
+ })
1359
+ });
1360
+ }
1361
+ var Pe = {
1362
+ display: "flex",
1363
+ flexDirection: "column",
1364
+ gap: "12px"
1365
+ }, Fe = {
1366
+ fontSize: "14px",
1367
+ fontWeight: 500,
1368
+ color: "var(--page-text, #111827)"
1369
+ }, Q = {
1370
+ padding: "10px 12px",
1371
+ border: "1px solid #d1d5db",
1372
+ borderRadius: "6px",
1373
+ fontSize: "14px",
1374
+ fontFamily: "inherit",
1375
+ width: "100%",
1376
+ boxSizing: "border-box",
1377
+ backgroundColor: "#ffffff",
1378
+ color: "#111827"
1379
+ }, Ie = {
1380
+ display: "flex",
1381
+ alignItems: "center",
1382
+ gap: "8px",
1383
+ fontSize: "14px",
1384
+ color: "var(--page-text, #111827)"
1385
+ }, Le = (e) => e ? {
1386
+ readOnly: !0,
1387
+ tabIndex: -1,
1388
+ onMouseDown: (e) => e.preventDefault()
1389
+ } : {};
1390
+ function Re({ style: e, action: t, method: r, name: i, enctype: o, formSlug: l, nodeRef: u, inert: d, children: p, linked: m, show: h }) {
1391
+ let { tenant: g, apiUrl: _ } = n(F), [v, y] = a("form"), b = d ? h || "form" : v;
1392
+ return /* @__PURE__ */ c("div", {
1393
+ ref: u,
1394
+ style: f(e),
1395
+ children: [
1396
+ /* @__PURE__ */ s("form", {
1397
+ action: t || void 0,
1398
+ method: r || "post",
1399
+ name: i || void 0,
1400
+ encType: o || void 0,
1401
+ onSubmit: async (e) => {
1402
+ if (e.preventDefault(), !d) {
1403
+ if (l) {
1404
+ let t = {};
1405
+ for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1406
+ try {
1407
+ let e = await fetch(`${_ || "/api"}/forms/${l}/submit`, {
1408
+ method: "post",
1409
+ headers: {
1410
+ "content-type": "application/json",
1411
+ ...g ? { "x-tenant": g } : {}
1412
+ },
1413
+ body: JSON.stringify(t)
1414
+ }), n = await e.json().catch(() => null);
1415
+ y(e.ok && n?.success !== !1 ? "success" : "error");
1416
+ } catch {
1417
+ y("error");
1418
+ }
1419
+ return;
1420
+ }
1421
+ if (!t) {
1422
+ y("success");
1423
+ return;
1424
+ }
1425
+ try {
1426
+ let n = await fetch(t, {
1427
+ method: r || "post",
1428
+ body: new FormData(e.currentTarget)
1429
+ });
1430
+ y(n.ok ? "success" : "error");
1431
+ } catch {
1432
+ y("error");
1433
+ }
1434
+ }
1435
+ },
1436
+ style: {
1437
+ ...Pe,
1438
+ display: b === "success" ? "none" : "flex"
1439
+ },
1440
+ children: p
1441
+ }),
1442
+ /* @__PURE__ */ s("div", {
1443
+ style: { display: b === "success" ? "block" : "none" },
1444
+ children: m?.success ?? null
1445
+ }),
1446
+ /* @__PURE__ */ s("div", {
1447
+ style: {
1448
+ display: b === "error" ? "block" : "none",
1449
+ marginTop: 12
1450
+ },
1451
+ children: m?.error ?? null
1452
+ })
1453
+ ]
1454
+ });
1455
+ }
1456
+ function ze({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1457
+ return /* @__PURE__ */ s("label", {
1458
+ ref: r,
1459
+ style: {
1460
+ ...Fe,
1461
+ ...f(n)
1462
+ },
1463
+ children: K(t, e, i)
1464
+ });
1465
+ }
1466
+ function Be({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1467
+ return /* @__PURE__ */ s("input", {
1468
+ ref: a,
1469
+ type: e,
1470
+ name: t || void 0,
1471
+ placeholder: n,
1472
+ required: !o && !!r,
1473
+ style: {
1474
+ ...Q,
1475
+ ...f(i)
1476
+ },
1477
+ ...Le(o)
1478
+ });
1479
+ }
1480
+ function Ve({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1481
+ return /* @__PURE__ */ s("textarea", {
1482
+ ref: a,
1483
+ name: e || void 0,
1484
+ placeholder: t,
1485
+ rows: n,
1486
+ required: !o && !!r,
1487
+ style: {
1488
+ ...Q,
1489
+ resize: "vertical",
1490
+ ...f(i)
1491
+ },
1492
+ ...Le(o)
1493
+ });
1494
+ }
1495
+ function He({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: l }) {
1496
+ return /* @__PURE__ */ c("label", {
1497
+ ref: o,
1498
+ style: {
1499
+ ...Ie,
1500
+ ...f(a)
1501
+ },
1502
+ children: [/* @__PURE__ */ s("input", {
1503
+ type: e,
1504
+ name: n || void 0,
1505
+ value: r || void 0,
1506
+ required: !l && !!i,
1507
+ onClick: l ? (e) => e.preventDefault() : void 0,
1508
+ tabIndex: l ? -1 : void 0,
1509
+ style: {
1510
+ margin: 0,
1511
+ accentColor: "var(--page-accent, #111827)"
1512
+ }
1513
+ }), t]
1514
+ });
1515
+ }
1516
+ function Ue({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1517
+ return /* @__PURE__ */ c("select", {
1518
+ ref: a,
1519
+ name: e || void 0,
1520
+ required: !o && !!r,
1521
+ defaultValue: "",
1522
+ onMouseDown: o ? (e) => e.preventDefault() : void 0,
1523
+ tabIndex: o ? -1 : void 0,
1524
+ style: {
1525
+ ...Q,
1526
+ appearance: "auto",
1527
+ ...f(i)
1528
+ },
1529
+ children: [t !== "" && /* @__PURE__ */ s("option", {
1530
+ value: "",
1531
+ disabled: !0,
1532
+ children: t ?? "Select…"
1533
+ }), n.map((e, t) => /* @__PURE__ */ s("option", {
1534
+ value: e,
1535
+ children: e
1536
+ }, t))]
1537
+ });
1538
+ }
1539
+ function We({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: o, inert: l }) {
1540
+ let [u, d] = a(null);
1541
+ return /* @__PURE__ */ c("label", {
1542
+ ref: o,
1543
+ style: {
1544
+ ...Q,
1545
+ display: "flex",
1546
+ alignItems: "center",
1547
+ gap: "8px",
1548
+ cursor: l ? "default" : "pointer",
1549
+ borderStyle: "dashed",
1550
+ color: u ? "#111827" : "#6b7280",
1551
+ ...f(i)
1552
+ },
1553
+ children: [
1554
+ /* @__PURE__ */ s("input", {
1555
+ type: "file",
1556
+ name: e || void 0,
1557
+ accept: t || void 0,
1558
+ required: !l && !!n,
1559
+ disabled: !!l,
1560
+ onChange: (e) => d(e.target.files?.[0]?.name ?? null),
1561
+ style: { display: "none" }
1562
+ }),
1563
+ /* @__PURE__ */ s("span", {
1564
+ "aria-hidden": !0,
1565
+ children: "📎"
1566
+ }),
1567
+ u ?? r
1568
+ ]
1569
+ });
1570
+ }
1571
+ function Ge({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1572
+ return /* @__PURE__ */ s("button", {
1573
+ ref: n,
1574
+ type: r ? "button" : "submit",
1575
+ style: {
1576
+ ...R,
1577
+ border: 0,
1578
+ cursor: "pointer",
1579
+ alignSelf: "flex-start",
1580
+ ...f(t)
1581
+ },
1582
+ children: e
1583
+ });
1584
+ }
1585
+ var Ke = {
1586
+ PageRoot: ae,
1587
+ Section: H,
1588
+ Container: U,
1589
+ Heading: oe,
1590
+ TextBlock: de,
1591
+ ButtonBlock: me,
1592
+ ImageBlock: he,
1593
+ Spacer: xe,
1594
+ Divider: Se,
1595
+ SliderBlock: Oe,
1596
+ CanvasSlider: ke,
1597
+ TabsBlock: Me,
1598
+ AccordionBlock: Ne,
1599
+ NavbarBlock: je,
1600
+ ListBlock: ue,
1601
+ TextSpan: q,
1602
+ QuoteBlock: le,
1603
+ TextLink: pe,
1604
+ RichTextBlock: se,
1605
+ RichContentBlock: se,
1606
+ VideoBlock: ge,
1607
+ YouTubeBlock: ve,
1608
+ IframeBlock: ye,
1609
+ EmbedBlock: be,
1610
+ FormBlock: Re,
1611
+ FormLabel: ze,
1612
+ FormInput: Be,
1613
+ FormTextarea: Ve,
1614
+ FormCheckbox: (e) => /* @__PURE__ */ s(He, {
1615
+ kind: "checkbox",
1616
+ ...e
1617
+ }),
1618
+ FormRadio: (e) => /* @__PURE__ */ s(He, {
1619
+ kind: "radio",
1620
+ ...e
1621
+ }),
1622
+ FormSelect: Ue,
1623
+ FormFile: We,
1624
+ FormSubmit: Ge
1625
+ };
1626
+ //#endregion
1627
+ //#region ../ui/src/components/builder/render.jsx
1628
+ function $(t, n, r, i = /* @__PURE__ */ new Set()) {
1629
+ let a = n[t];
1630
+ if (!a || a.hidden) return null;
1631
+ let o = a.type?.resolvedName;
1632
+ if (o === "ComponentInstance") {
1633
+ let n = a.props?.componentId, o = r?.[n];
1634
+ if (!o?.template || i.has(n)) return null;
1635
+ let c = new Set(i).add(n);
1636
+ return /* @__PURE__ */ s(e, { children: $(o.template.rootId, o.template.nodes, r, c) }, t);
1637
+ }
1638
+ let c = Ke[o];
1639
+ if (!c) return null;
1640
+ let l = (a.nodes ?? []).map((e) => $(e, n, r, i)).filter(Boolean), u = Object.entries(a.linkedNodes ?? {}), d = u.length ? Object.fromEntries(u.map(([e, t]) => [e, $(t, n, r, i)])) : void 0;
1641
+ return /* @__PURE__ */ s(c, {
1642
+ ...a.props,
1643
+ linked: d,
1644
+ nodeRef: (e) => {
1645
+ e && (e.setAttribute("data-wb", t), g(e, a.props ?? {}));
1646
+ },
1647
+ children: l.length ? l : void 0
1648
+ }, t);
1649
+ }
1650
+ //#endregion
1651
+ //#region ../ui/src/components/builder/PageRenderer.jsx
1652
+ var qe = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
1653
+ function Je({ blocks: e, theme: t, components: n, mode: i = "auto", style: a, custom: o, tenant: l, apiUrl: u }) {
1654
+ let d = o?.js?.trim();
1655
+ if (r(() => {
1656
+ if (!d) return;
1657
+ let e = document.createElement("script");
1658
+ return e.text = d, document.body.appendChild(e), () => e.remove();
1659
+ }, [d]), !e?.ROOT) return null;
1660
+ let f = {
1661
+ minHeight: "100%",
1662
+ display: "flex",
1663
+ flexDirection: "column"
1664
+ }, p = $("ROOT", e, n), m = b(e, n), h = o?.css?.trim(), g = P(e, n).map((e) => /* @__PURE__ */ s("link", {
1665
+ rel: "stylesheet",
1666
+ precedence: "default",
1667
+ href: ne(e)
1668
+ }, e));
1669
+ if (i !== "auto") return /* @__PURE__ */ s(F.Provider, {
1670
+ value: {
1671
+ tenant: l || "",
1672
+ apiUrl: u || "/api"
1673
+ },
1674
+ children: /* @__PURE__ */ c("div", {
1675
+ style: {
1676
+ ...f,
1677
+ ...A(t, i),
1678
+ ...a
1679
+ },
1680
+ children: [
1681
+ g,
1682
+ m && /* @__PURE__ */ s("style", { children: m }),
1683
+ h && /* @__PURE__ */ s("style", { children: h }),
1684
+ p
1685
+ ]
1686
+ })
1687
+ });
1688
+ let _ = D(t);
1689
+ return /* @__PURE__ */ s(F.Provider, {
1690
+ value: {
1691
+ tenant: l || "",
1692
+ apiUrl: u || "/api"
1693
+ },
1694
+ children: /* @__PURE__ */ c("div", {
1695
+ className: "webim-page",
1696
+ style: {
1697
+ ...f,
1698
+ ...k(t),
1699
+ ...a
1700
+ },
1701
+ children: [
1702
+ /* @__PURE__ */ s("style", { children: `.webim-page { ${qe(O(_.light))} }
1703
+ @media (prefers-color-scheme: dark) { .webim-page { ${qe(O(_.dark))} } }` }),
1704
+ g,
1705
+ m && /* @__PURE__ */ s("style", { children: m }),
1706
+ h && /* @__PURE__ */ s("style", { children: h }),
1707
+ p
1708
+ ]
1709
+ })
1710
+ });
1711
+ }
1712
+ //#endregion
1713
+ //#region src/WebimContent.jsx
1714
+ function Ye({ bundle: e, mode: t = "auto", style: n }) {
1715
+ return e?.blocks?.ROOT ? /* @__PURE__ */ s(Je, {
1716
+ blocks: e.blocks,
1717
+ theme: e.theme,
1718
+ components: e.components,
1719
+ custom: e.custom,
1720
+ tenant: e.tenant,
1721
+ apiUrl: e.apiUrl,
1722
+ mode: t,
1723
+ style: n
1724
+ }) : null;
1725
+ }
1726
+ //#endregion
1727
+ //#region src/WebimPage.jsx
1728
+ function Xe({ apiUrl: e, tenant: t, slug: n, locale: o, preview: c, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
1729
+ let [h, g] = a({ status: "loading" }), _ = i({
1730
+ onLoad: p,
1731
+ onError: m
1732
+ });
1733
+ return _.current = {
1734
+ onLoad: p,
1735
+ onError: m
1736
+ }, r(() => {
1737
+ let r = !0;
1738
+ return g({ status: "loading" }), ee({
1739
+ apiUrl: e,
1740
+ tenant: t,
1741
+ slug: n,
1742
+ locale: o,
1743
+ preview: c
1744
+ }).then((e) => {
1745
+ r && (g({
1746
+ status: "ready",
1747
+ bundle: e
1748
+ }), _.current.onLoad?.(e));
1749
+ }).catch((e) => {
1750
+ r && (g({
1751
+ status: "error",
1752
+ error: e
1753
+ }), _.current.onError?.(e));
1754
+ }), () => {
1755
+ r = !1;
1756
+ };
1757
+ }, [
1758
+ e,
1759
+ t,
1760
+ n,
1761
+ o,
1762
+ c
1763
+ ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ s(Ye, {
1764
+ bundle: h.bundle,
1765
+ mode: l,
1766
+ style: u
1767
+ });
1768
+ }
1769
+ //#endregion
1770
+ export { Je as PageRenderer, Ye as WebimContent, Xe as WebimPage, ee as fetchPage, X as renderRichContent, j as resolveTheme };