webim-adapter 0.3.0 → 0.5.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.
@@ -48,20 +48,20 @@ function p(e) {
48
48
  color: j,
49
49
  inset: M
50
50
  })), N.length && (t.boxShadow = N.join(", "));
51
- let ee = (e) => e.type === "blur" ? `blur(${d(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, P = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(ee), { filters: F, backdropFilters: te, filterBlur: I, filterGrayscale: L, filterBrightness: ne, filterContrast: re, filterSaturate: R } = t;
51
+ let P = (e) => e.type === "blur" ? `blur(${d(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, F = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(P), { filters: I, backdropFilters: L, filterBlur: R, filterGrayscale: z, filterBrightness: ee, filterContrast: te, filterSaturate: ne } = t;
52
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 = P(F);
54
- I !== void 0 && z.push(`blur(${d(I)})`), L !== void 0 && z.push(`grayscale(${L}%)`), ne !== void 0 && z.push(`brightness(${ne}%)`), re !== void 0 && z.push(`contrast(${re}%)`), R !== void 0 && z.push(`saturate(${R}%)`), z.length && (t.filter = z.join(" "));
55
- let B = P(te);
56
- B.length && (t.backdropFilter = B.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
- let { textStrokeWidth: V, textStrokeColor: H } = t;
58
- delete t.textStrokeWidth, delete t.textStrokeColor, (V !== void 0 || H !== void 0) && (t.WebkitTextStroke = `${d(V ?? 1)} ${H || "currentColor"}`);
59
- let { clipText: ie } = t;
60
- delete t.clipText, ie && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
- let { transitions: U, transitionDuration: W, transitionEasing: G, transitionProperty: ae } = t, K = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
53
+ let B = F(I);
54
+ R !== void 0 && B.push(`blur(${d(R)})`), z !== void 0 && B.push(`grayscale(${z}%)`), ee !== void 0 && B.push(`brightness(${ee}%)`), te !== void 0 && B.push(`contrast(${te}%)`), ne !== void 0 && B.push(`saturate(${ne}%)`), B.length && (t.filter = B.join(" "));
55
+ let V = F(L);
56
+ V.length && (t.backdropFilter = V.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
+ let { textStrokeWidth: H, textStrokeColor: U } = t;
58
+ delete t.textStrokeWidth, delete t.textStrokeColor, (H !== void 0 || U !== void 0) && (t.WebkitTextStroke = `${d(H ?? 1)} ${U || "currentColor"}`);
59
+ let { clipText: re } = t;
60
+ delete t.clipText, re && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
+ let { transitions: W, transitionDuration: ie, transitionEasing: G, transitionProperty: ae } = t, K = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
62
62
  delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
63
- let q = (Array.isArray(U) ? U : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${K(e.duration ?? 200)} ${e.easing || "ease"}`);
64
- if (W !== void 0 && q.push(`${ae || "all"} ${K(W)} ${G || "ease"}`), q.length && (t.transition = q.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
63
+ let q = (Array.isArray(W) ? W : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${K(e.duration ?? 200)} ${e.easing || "ease"}`);
64
+ if (ie !== void 0 && q.push(`${ae || "all"} ${K(ie)} ${G || "ease"}`), q.length && (t.transition = q.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
65
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
66
  t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
67
67
  }
@@ -263,7 +263,7 @@ function N(e) {
263
263
  "--page-secondary-contrast": e.secondary.contrastText
264
264
  };
265
265
  }
266
- function ee(e) {
266
+ function P(e) {
267
267
  let t = M(e);
268
268
  return {
269
269
  backgroundColor: "var(--page-bg)",
@@ -272,19 +272,19 @@ function ee(e) {
272
272
  "--page-heading-font": t.headingFont === "inherit" ? "inherit" : A(t.headingFont, "inherit")
273
273
  };
274
274
  }
275
- function P(e, t = "light") {
275
+ function F(e, t = "light") {
276
276
  let n = M(e);
277
277
  return {
278
- ...ee(e),
278
+ ...P(e),
279
279
  ...N(n[t] ?? n.light)
280
280
  };
281
281
  }
282
- function F(e, t) {
282
+ function I(e, t) {
283
283
  return e?.themeRef && t?.[e.themeRef] || e?.theme;
284
284
  }
285
285
  //#endregion
286
286
  //#region src/bundle.js
287
- function te({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
287
+ function L({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
288
288
  let a = {
289
289
  ...t?.global ?? {},
290
290
  ...t?.tenant ?? {}
@@ -294,7 +294,7 @@ function te({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
294
294
  title: e.title,
295
295
  slug: e.slug,
296
296
  blocks: i && o.i18n?.[i]?.blocks || e.blocks,
297
- theme: F(o, a.builder_themes?.themes),
297
+ theme: I(o, a.builder_themes?.themes),
298
298
  components: a.builder_components?.components ?? {},
299
299
  custom: o.custom,
300
300
  seo: o.seo,
@@ -305,23 +305,23 @@ function te({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
305
305
  }
306
306
  //#endregion
307
307
  //#region src/fetchPage.js
308
- var I = async (e) => {
308
+ var R = async (e) => {
309
309
  let t = await e.json().catch(() => null);
310
310
  if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
311
311
  return t?.payload ?? t;
312
312
  };
313
- async function L({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
313
+ async function z({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
314
314
  if (!e) throw Error("fetchPage: apiUrl is required");
315
315
  if (!n) throw Error("fetchPage: slug is required");
316
- 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(I), o(`${s}/settings/public`, { headers: c }).then(I)]), d = te({
316
+ 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(R), o(`${s}/settings/public`, { headers: c }).then(R)]), d = L({
317
317
  page: l,
318
318
  settings: u,
319
319
  tenant: t,
320
320
  apiUrl: s,
321
321
  locale: r
322
- }), f = [...new Set(Object.values(d.blocks ?? {}).filter((e) => e?.type?.resolvedName === "CollectionList" && e.props?.collection).map((e) => e.props.collection))];
322
+ }), f = [...new Set(Object.values(d.blocks ?? {}).map((e) => e?.type?.resolvedName === "CollectionList" ? e.props?.collection : e?.type?.resolvedName === "TableBlock" ? e.props?.source : null).filter(Boolean))];
323
323
  if (f.length) {
324
- let e = (e) => e.startsWith("api:") ? `${s}/data/${encodeURIComponent(e.slice(4))}` : `${s}/dynamic/${encodeURIComponent(e)}${r ? `?locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(f.map((t) => o(e(t), { headers: c }).then(I).then((e) => [t, Array.isArray(e) ? e : []]).catch(() => [t, []])));
324
+ let e = (e) => e.startsWith("api:") ? `${s}/data/${encodeURIComponent(e.slice(4))}` : `${s}/dynamic/${encodeURIComponent(e)}${r ? `?locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(f.map((t) => o(e(t), { headers: c }).then(R).then((e) => [t, Array.isArray(e) ? e : []]).catch(() => [t, []])));
325
325
  d.datasets = Object.fromEntries(t);
326
326
  }
327
327
  return d;
@@ -432,14 +432,14 @@ new Map([
432
432
  fallback: "sans-serif"
433
433
  }
434
434
  ].map((e) => [e.family, e]));
435
- function ne(e) {
435
+ function ee(e) {
436
436
  return e.length ? `https://fonts.googleapis.com/css2?${e.map((e) => `family=${e.replace(/ /g, "+")}:wght@100..900`).join("&")}&display=swap` : null;
437
437
  }
438
- var re = (e) => ne([e]), R = (e) => {
438
+ var te = (e) => ee([e]), ne = (e) => {
439
439
  let t = typeof e == "string" && e.match(/^"([^"]+)"/);
440
440
  return t ? t[1] : null;
441
441
  };
442
- function z(e, t) {
442
+ function B(e, t) {
443
443
  let n = /* @__PURE__ */ new Set(), r = (e) => {
444
444
  for (let t of Object.values(e || {})) for (let e of [
445
445
  "style",
@@ -447,7 +447,7 @@ function z(e, t) {
447
447
  "pressed",
448
448
  "focused"
449
449
  ]) {
450
- let r = R(t.props?.[e]?.fontFamily);
450
+ let r = ne(t.props?.[e]?.fontFamily);
451
451
  r && n.add(r);
452
452
  }
453
453
  };
@@ -457,14 +457,14 @@ function z(e, t) {
457
457
  }
458
458
  //#endregion
459
459
  //#region ../ui/src/components/builder/views.jsx
460
- var B = t({
460
+ var V = t({
461
461
  tenant: "",
462
462
  apiUrl: "/api"
463
- }), V = t(null), H = t(null), ie = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
464
- function U(e, t) {
463
+ }), H = t(null), U = t(null), re = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
464
+ function W(e, t) {
465
465
  if (t) return t.includes(".") ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e?.[t];
466
466
  }
467
- var W = (e) => {
467
+ var ie = (e) => {
468
468
  let t = [];
469
469
  for (let [n, r] of Object.entries(e ?? {})) {
470
470
  if (!/^[\w-]+$/.test(n)) continue;
@@ -478,9 +478,9 @@ function G(e) {
478
478
  return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : Array.isArray(e?.parts) ? e.parts.map((e) => e?.text ?? "").join("") : Array.isArray(e?.items) ? e.items.map((e) => e?.text ?? "").join(" ") : "").filter(Boolean).join(" ") : "";
479
479
  }
480
480
  function ae(e, t) {
481
- let n = t?.data ?? {}, r = W(n);
481
+ let n = t?.data ?? {}, r = ie(n);
482
482
  if (!r.length) return e;
483
- let i = RegExp(`:(${r.map(ie).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => G(U(n, t))) : Array.isArray(e) ? e.map(a) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, a(t)])) : e;
483
+ let i = RegExp(`:(${r.map(re).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => G(W(n, t))) : Array.isArray(e) ? e.map(a) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, a(t)])) : e;
484
484
  return a(e);
485
485
  }
486
486
  var K = {
@@ -585,16 +585,18 @@ var pe = {
585
585
  borderRadius: 4,
586
586
  fontSize: "0.9em"
587
587
  };
588
- function me(e, t = [], n) {
589
- let r = e;
590
- return t.includes("sup") ? r = /* @__PURE__ */ c("sup", { children: r }) : t.includes("sub") && (r = /* @__PURE__ */ c("sub", { children: r })), t.includes("code") && (r = /* @__PURE__ */ c("code", {
588
+ function me(e, t = [], n, r) {
589
+ let i = e;
590
+ return t.includes("sup") ? i = /* @__PURE__ */ c("sup", { children: i }) : t.includes("sub") && (i = /* @__PURE__ */ c("sub", { children: i })), t.includes("code") && (i = /* @__PURE__ */ c("code", {
591
591
  style: pe,
592
- children: r
593
- })), t.includes("strike") && (r = /* @__PURE__ */ c("s", { children: r })), t.includes("underline") && (r = /* @__PURE__ */ c("u", { children: r })), t.includes("italic") && (r = /* @__PURE__ */ c("em", { children: r })), t.includes("bold") && (r = /* @__PURE__ */ c("strong", { children: r })), n && (r = /* @__PURE__ */ c("a", {
592
+ children: i
593
+ })), t.includes("strike") && (i = /* @__PURE__ */ c("s", { children: i })), t.includes("underline") && (i = /* @__PURE__ */ c("u", { children: i })), t.includes("italic") && (i = /* @__PURE__ */ c("em", { children: i })), t.includes("bold") && (i = /* @__PURE__ */ c("strong", { children: i })), n && (i = /* @__PURE__ */ c("a", {
594
594
  href: n,
595
+ target: r || void 0,
596
+ rel: r === "_blank" ? "noopener noreferrer" : void 0,
595
597
  style: { color: "inherit" },
596
- children: r
597
- })), r;
598
+ children: i
599
+ })), i;
598
600
  }
599
601
  function X(t, n, r) {
600
602
  return t?.length ? t.map((t, n) => {
@@ -604,17 +606,25 @@ function X(t, n, r) {
604
606
  return t.sup ? i = /* @__PURE__ */ c("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ c("sub", { children: i })), t.code && (i = /* @__PURE__ */ c("code", {
605
607
  style: pe,
606
608
  children: i
607
- })), t.strike && (i = /* @__PURE__ */ c("s", { children: i })), t.underline && (i = /* @__PURE__ */ c("u", { children: i })), t.italic && (i = /* @__PURE__ */ c("em", { children: i })), t.bold && (i = /* @__PURE__ */ c("strong", { children: i })), t.href && (i = /* @__PURE__ */ c("a", {
609
+ })), t.strike && (i = /* @__PURE__ */ c("s", { children: i })), t.underline && (i = /* @__PURE__ */ c("u", { children: i })), t.italic && (i = /* @__PURE__ */ c("em", { children: i })), t.bold && (i = /* @__PURE__ */ c("strong", { children: i })), (t.color || t.background) && (i = /* @__PURE__ */ c("span", {
610
+ style: {
611
+ ...t.color && { color: t.color },
612
+ ...t.background && { backgroundColor: t.background }
613
+ },
614
+ children: i
615
+ })), t.href && (i = /* @__PURE__ */ c("a", {
608
616
  href: t.href,
609
- style: { color: "inherit" },
617
+ target: t.target || void 0,
618
+ rel: t.target === "_blank" ? "noopener noreferrer" : void 0,
619
+ style: { color: t.color ?? "inherit" },
610
620
  children: i
611
621
  })), /* @__PURE__ */ c(e, { children: i }, n);
612
622
  }) : n;
613
623
  }
614
- function he({ parts: e, text: t, marks: n, href: r, style: i }) {
624
+ function he({ parts: e, text: t, marks: n, href: r, target: i, style: a }) {
615
625
  return /* @__PURE__ */ c("span", {
616
- style: p(i),
617
- children: e?.length ? X(e, t) : me(t, n, r)
626
+ style: p(a),
627
+ children: e?.length ? X(e, t) : me(t, n, r, i)
618
628
  });
619
629
  }
620
630
  var ge = {
@@ -625,24 +635,35 @@ var ge = {
625
635
  h5: 19,
626
636
  h6: 16
627
637
  };
628
- function _e({ align: e = "center", width: t } = {}) {
629
- let n = t ? `${t}%` : void 0;
630
- return e === "full" ? { width: "100%" } : e === "left" ? {
631
- float: "left",
632
- width: n ?? "50%",
633
- marginTop: 4,
634
- marginRight: 20,
635
- marginBottom: 12,
636
- marginLeft: 0
637
- } : e === "right" ? {
638
- float: "right",
639
- width: n ?? "50%",
640
- marginTop: 4,
641
- marginLeft: 20,
642
- marginBottom: 12,
643
- marginRight: 0
638
+ function _e({ align: e = "center", width: t, wrap: n } = {}) {
639
+ let r = t ? `${t}%` : void 0;
640
+ if (e === "full") return { width: "100%" };
641
+ let i = e === "left" || e === "right";
642
+ return i && (n ?? !0) ? {
643
+ float: e,
644
+ width: r ?? "50%",
645
+ maxWidth: "100%",
646
+ marginTop: "4px",
647
+ marginBottom: "12px",
648
+ ...e === "left" ? {
649
+ marginRight: "20px",
650
+ marginLeft: 0
651
+ } : {
652
+ marginLeft: "20px",
653
+ marginRight: 0
654
+ }
655
+ } : i ? {
656
+ width: r ?? "fit-content",
657
+ maxWidth: "100%",
658
+ ...e === "left" ? {
659
+ marginLeft: 0,
660
+ marginRight: "auto"
661
+ } : {
662
+ marginLeft: "auto",
663
+ marginRight: 0
664
+ }
644
665
  } : {
645
- width: n ?? "fit-content",
666
+ width: r ?? "fit-content",
646
667
  maxWidth: "100%",
647
668
  marginLeft: "auto",
648
669
  marginRight: "auto"
@@ -675,6 +696,8 @@ function ve(e = [], t, n) {
675
696
  },
676
697
  children: [t.href ? /* @__PURE__ */ c("a", {
677
698
  href: t.href,
699
+ target: t.target || void 0,
700
+ rel: t.target === "_blank" ? "noopener noreferrer" : void 0,
678
701
  style: { display: "block" },
679
702
  children: e
680
703
  }) : e, t.caption && /* @__PURE__ */ c("figcaption", {
@@ -693,6 +716,7 @@ function ve(e = [], t, n) {
693
716
  ...i,
694
717
  ..._e({
695
718
  align: t.align,
719
+ wrap: t.wrap,
696
720
  width: t.width ?? 100
697
721
  })
698
722
  },
@@ -1452,73 +1476,318 @@ var Ke = {
1452
1476
  tabIndex: -1,
1453
1477
  onMouseDown: (e) => e.preventDefault()
1454
1478
  } : {};
1455
- function Xe({ style: e, action: t, method: r, name: i, enctype: a, formSlug: s, nodeRef: u, inert: d, children: f, linked: m, show: h }) {
1456
- let { tenant: g, apiUrl: _ } = n(B), [v, y] = o("form"), b = d ? h || "form" : v;
1479
+ function Xe(e, t) {
1480
+ if (!e) return !0;
1481
+ let n = t[e.field], r = n == null || n === "" ? "" : String(n), i = e.value ?? "";
1482
+ switch (e.op) {
1483
+ case "eq": return r === i;
1484
+ case "neq": return r !== i;
1485
+ case "contains": return r.toLowerCase().includes(i.toLowerCase());
1486
+ case "gt": return Number(r) > Number(i);
1487
+ case "lt": return Number(r) < Number(i);
1488
+ case "empty": return r === "";
1489
+ case "notEmpty": return r !== "";
1490
+ default: return !1;
1491
+ }
1492
+ }
1493
+ var Ze = {
1494
+ display: "flex",
1495
+ flexDirection: "column",
1496
+ gap: 6
1497
+ }, Qe = {
1498
+ font: "inherit",
1499
+ fontSize: 15,
1500
+ padding: "10px 12px",
1501
+ borderRadius: 8,
1502
+ border: "1px solid rgba(148, 163, 184, 0.55)",
1503
+ background: "transparent",
1504
+ color: "inherit",
1505
+ width: "100%",
1506
+ boxSizing: "border-box"
1507
+ };
1508
+ function $e({ field: e, value: t, onChange: n, inert: r }) {
1509
+ let i = /* @__PURE__ */ l("span", {
1510
+ style: {
1511
+ ...qe,
1512
+ fontSize: 14
1513
+ },
1514
+ children: [e.label, e.required ? " *" : ""]
1515
+ }), a = {
1516
+ name: e.name,
1517
+ required: e.required || void 0,
1518
+ placeholder: e.placeholder || void 0,
1519
+ disabled: r || void 0,
1520
+ style: Qe,
1521
+ value: t ?? "",
1522
+ onChange: (t) => n(e.name, t.target.value)
1523
+ };
1524
+ return e.type === "display" ? /* @__PURE__ */ c(e.variant && e.variant !== "p" ? e.variant : "p", {
1525
+ style: {
1526
+ margin: 0,
1527
+ color: e.color || "inherit",
1528
+ fontSize: {
1529
+ h1: 32,
1530
+ h2: 26,
1531
+ h3: 21,
1532
+ h4: 18,
1533
+ h5: 16,
1534
+ h6: 14,
1535
+ p: 15
1536
+ }[e.variant] ?? 16,
1537
+ fontWeight: e.variant === "p" ? 400 : 700,
1538
+ lineHeight: 1.35
1539
+ },
1540
+ children: e.label
1541
+ }) : e.type === "image" ? e.src ? /* @__PURE__ */ c("img", {
1542
+ src: e.src,
1543
+ alt: e.label ?? "",
1544
+ style: {
1545
+ width: "100%",
1546
+ borderRadius: 8,
1547
+ display: "block"
1548
+ }
1549
+ }) : null : e.type === "video" ? e.src ? /youtube\.com|youtu\.be|vimeo\.com/i.test(e.src) ? /* @__PURE__ */ c(Ae, {
1550
+ url: e.src,
1551
+ style: { width: "100%" }
1552
+ }) : /* @__PURE__ */ c("video", {
1553
+ src: e.src,
1554
+ controls: !0,
1555
+ style: {
1556
+ width: "100%",
1557
+ borderRadius: 8,
1558
+ display: "block"
1559
+ }
1560
+ }) : null : /* @__PURE__ */ l("label", {
1561
+ style: Ze,
1562
+ children: [
1563
+ i,
1564
+ e.type === "textarea" || e.multiline ? /* @__PURE__ */ c("textarea", {
1565
+ ...a,
1566
+ rows: 4,
1567
+ style: {
1568
+ ...Qe,
1569
+ resize: "vertical"
1570
+ }
1571
+ }) : e.type === "select" ? /* @__PURE__ */ l("select", {
1572
+ ...a,
1573
+ children: [/* @__PURE__ */ c("option", {
1574
+ value: "",
1575
+ children: e.placeholder || "—"
1576
+ }), (e.options ?? []).map((e, t) => /* @__PURE__ */ c("option", {
1577
+ value: typeof e == "string" ? e : e.value,
1578
+ children: typeof e == "string" ? e : e.label ?? e.value
1579
+ }, t))]
1580
+ }) : e.type === "checkbox" ? /* @__PURE__ */ c("input", {
1581
+ type: "checkbox",
1582
+ name: e.name,
1583
+ required: e.required || void 0,
1584
+ disabled: r || void 0,
1585
+ checked: !!t,
1586
+ onChange: (t) => n(e.name, t.target.checked),
1587
+ style: {
1588
+ width: 18,
1589
+ height: 18
1590
+ }
1591
+ }) : e.type === "upload" ? /* @__PURE__ */ c("input", {
1592
+ type: "file",
1593
+ name: e.name,
1594
+ accept: e.accept || void 0,
1595
+ required: e.required || void 0,
1596
+ disabled: r || void 0,
1597
+ onChange: (t) => n(e.name, t.target.files?.[0]?.name ?? ""),
1598
+ style: {
1599
+ font: "inherit",
1600
+ fontSize: 14
1601
+ }
1602
+ }) : /* @__PURE__ */ c("input", {
1603
+ ...a,
1604
+ type: {
1605
+ email: "email",
1606
+ number: "number",
1607
+ date: "date",
1608
+ datetime: "datetime-local",
1609
+ phone: "tel",
1610
+ link: "url"
1611
+ }[e.type] ?? "text"
1612
+ }),
1613
+ e.help && /* @__PURE__ */ c("span", {
1614
+ style: {
1615
+ fontSize: 12,
1616
+ opacity: .65
1617
+ },
1618
+ children: e.help
1619
+ })
1620
+ ]
1621
+ });
1622
+ }
1623
+ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d, auto: f, submitLabel: m, nodeRef: h, inert: g, children: _, linked: v, show: y }) {
1624
+ let { tenant: b, apiUrl: x } = n(V), [S, C] = o("form"), [w, T] = o(null), [E, D] = o({}), [O, k] = o(0), A = g ? y || "form" : S;
1625
+ r(() => {
1626
+ if (!f || !d) return;
1627
+ let e = !0;
1628
+ return fetch(`${x || "/api"}/forms/${encodeURIComponent(d)}`, { headers: b ? { "x-tenant": b } : {} }).then((e) => e.json()).then((t) => e && T(t?.payload ?? null)).catch(() => e && T(null)), () => {
1629
+ e = !1;
1630
+ };
1631
+ }, [
1632
+ f,
1633
+ d,
1634
+ b,
1635
+ x
1636
+ ]);
1637
+ let j = [{
1638
+ section: null,
1639
+ fields: []
1640
+ }];
1641
+ for (let e of w?.fields ?? []) e.type === "section" ? j.push({
1642
+ section: e,
1643
+ fields: []
1644
+ }) : j[j.length - 1].fields.push(e);
1645
+ let M = j.filter((e) => e.section || e.fields.length), N = M.filter((e) => !e.section || Xe(e.section.condition, E)).map((e) => ({
1646
+ ...e,
1647
+ fields: e.fields.filter((e) => Xe(e.condition, E))
1648
+ })), P = M.length > 1, F = Math.min(O, Math.max(0, N.length - 1)), I = P ? N[F]?.fields ?? [] : N.flatMap((e) => e.fields), L = I.filter((e) => {
1649
+ let t = E[e.name];
1650
+ return e.required && (t == null || t === "" || t === !1);
1651
+ }), R = F >= N.length - 1, z = (e, t) => D((n) => ({
1652
+ ...n,
1653
+ [e]: t
1654
+ }));
1457
1655
  return /* @__PURE__ */ l("div", {
1458
- ref: u,
1656
+ ref: h,
1459
1657
  style: p(e),
1460
1658
  children: [
1461
1659
  /* @__PURE__ */ c("form", {
1462
1660
  action: t || void 0,
1463
- method: r || "post",
1464
- name: i || void 0,
1465
- encType: a || void 0,
1661
+ method: i || "post",
1662
+ name: a || void 0,
1663
+ encType: u || void 0,
1466
1664
  onSubmit: async (e) => {
1467
- if (e.preventDefault(), !d) {
1468
- if (s) {
1665
+ if (e.preventDefault(), !g) {
1666
+ if (d) {
1469
1667
  let t = {};
1470
- for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1668
+ if (f) for (let [e, n] of Object.entries(E)) n != null && n !== "" && (t[e] = n);
1669
+ else for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1471
1670
  try {
1472
- let e = await fetch(`${_ || "/api"}/forms/${s}/submit`, {
1671
+ let e = await fetch(`${x || "/api"}/forms/${d}/submit`, {
1473
1672
  method: "post",
1474
1673
  headers: {
1475
1674
  "content-type": "application/json",
1476
- ...g ? { "x-tenant": g } : {}
1675
+ ...b ? { "x-tenant": b } : {}
1477
1676
  },
1478
1677
  body: JSON.stringify(t)
1479
1678
  }), n = await e.json().catch(() => null);
1480
- y(e.ok && n?.success !== !1 ? "success" : "error");
1679
+ C(e.ok && n?.success !== !1 ? "success" : "error");
1481
1680
  } catch {
1482
- y("error");
1681
+ C("error");
1483
1682
  }
1484
1683
  return;
1485
1684
  }
1486
1685
  if (!t) {
1487
- y("success");
1686
+ C("success");
1488
1687
  return;
1489
1688
  }
1490
1689
  try {
1491
1690
  let n = await fetch(t, {
1492
- method: r || "post",
1691
+ method: i || "post",
1493
1692
  body: new FormData(e.currentTarget)
1494
1693
  });
1495
- y(n.ok ? "success" : "error");
1694
+ C(n.ok ? "success" : "error");
1496
1695
  } catch {
1497
- y("error");
1696
+ C("error");
1498
1697
  }
1499
1698
  }
1500
1699
  },
1501
1700
  style: {
1502
1701
  ...Ke,
1503
- display: b === "success" ? "none" : "flex"
1702
+ display: A === "success" ? "none" : "flex"
1504
1703
  },
1505
- children: f
1704
+ children: f && d ? /* @__PURE__ */ l(s, { children: [
1705
+ P && /* @__PURE__ */ c(ft, {
1706
+ steps: N.map((e) => ({ label: e.section?.label ?? "Start" })),
1707
+ active: F + 1,
1708
+ style: { marginBottom: 8 }
1709
+ }),
1710
+ P && N[F]?.section?.help && /* @__PURE__ */ c("p", {
1711
+ style: {
1712
+ margin: 0,
1713
+ fontSize: 14,
1714
+ opacity: .7
1715
+ },
1716
+ children: N[F].section.help
1717
+ }),
1718
+ I.map((e) => /* @__PURE__ */ c($e, {
1719
+ field: e,
1720
+ value: E[e.name],
1721
+ onChange: z,
1722
+ inert: g
1723
+ }, e.name)),
1724
+ /* @__PURE__ */ l("div", {
1725
+ style: {
1726
+ display: "flex",
1727
+ gap: 10,
1728
+ alignItems: "center",
1729
+ marginTop: 4
1730
+ },
1731
+ children: [P && F > 0 && /* @__PURE__ */ c("button", {
1732
+ type: "button",
1733
+ disabled: g || void 0,
1734
+ onClick: () => k(F - 1),
1735
+ style: {
1736
+ ...J,
1737
+ background: "transparent",
1738
+ color: "inherit",
1739
+ border: 0,
1740
+ padding: "10px 16px",
1741
+ cursor: "pointer"
1742
+ },
1743
+ children: "Back"
1744
+ }), P && !R ? /* @__PURE__ */ c("button", {
1745
+ type: "button",
1746
+ disabled: g || L.length > 0,
1747
+ onClick: () => k(F + 1),
1748
+ style: {
1749
+ ...J,
1750
+ border: 0,
1751
+ padding: "10px 22px",
1752
+ borderRadius: 8,
1753
+ fontSize: 15,
1754
+ fontWeight: 600,
1755
+ cursor: "pointer",
1756
+ opacity: L.length ? .5 : 1
1757
+ },
1758
+ children: "Next"
1759
+ }) : /* @__PURE__ */ c("button", {
1760
+ type: "submit",
1761
+ disabled: g || void 0,
1762
+ style: {
1763
+ ...J,
1764
+ border: 0,
1765
+ padding: "10px 22px",
1766
+ borderRadius: 8,
1767
+ fontSize: 15,
1768
+ fontWeight: 600,
1769
+ cursor: "pointer"
1770
+ },
1771
+ children: m || "Submit"
1772
+ })]
1773
+ })
1774
+ ] }) : _
1506
1775
  }),
1507
1776
  /* @__PURE__ */ c("div", {
1508
- style: { display: b === "success" ? "block" : "none" },
1509
- children: m?.success ?? null
1777
+ style: { display: A === "success" ? "block" : "none" },
1778
+ children: v?.success ?? null
1510
1779
  }),
1511
1780
  /* @__PURE__ */ c("div", {
1512
1781
  style: {
1513
- display: b === "error" ? "block" : "none",
1782
+ display: A === "error" ? "block" : "none",
1514
1783
  marginTop: 12
1515
1784
  },
1516
- children: m?.error ?? null
1785
+ children: v?.error ?? null
1517
1786
  })
1518
1787
  ]
1519
1788
  });
1520
1789
  }
1521
- function Ze({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1790
+ function tt({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1522
1791
  return /* @__PURE__ */ c("label", {
1523
1792
  ref: r,
1524
1793
  style: {
@@ -1528,7 +1797,7 @@ function Ze({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1528
1797
  children: X(t, e, i)
1529
1798
  });
1530
1799
  }
1531
- function Qe({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1800
+ function nt({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1532
1801
  return /* @__PURE__ */ c("input", {
1533
1802
  ref: a,
1534
1803
  type: e,
@@ -1542,7 +1811,7 @@ function Qe({ type: e = "text", name: t, placeholder: n, required: r, style: i,
1542
1811
  ...Ye(o)
1543
1812
  });
1544
1813
  }
1545
- function $e({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1814
+ function rt({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1546
1815
  return /* @__PURE__ */ c("textarea", {
1547
1816
  ref: a,
1548
1817
  name: e || void 0,
@@ -1557,7 +1826,7 @@ function $e({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeR
1557
1826
  ...Ye(o)
1558
1827
  });
1559
1828
  }
1560
- function et({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
1829
+ function it({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
1561
1830
  return /* @__PURE__ */ l("label", {
1562
1831
  ref: o,
1563
1832
  style: {
@@ -1578,7 +1847,7 @@ function et({ kind: e = "checkbox", label: t, name: n, value: r, required: i, st
1578
1847
  }), t]
1579
1848
  });
1580
1849
  }
1581
- function tt({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1850
+ function at({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1582
1851
  return /* @__PURE__ */ l("select", {
1583
1852
  ref: a,
1584
1853
  name: e || void 0,
@@ -1601,7 +1870,7 @@ function tt({ name: e, placeholder: t, options: n = [], required: r, style: i, n
1601
1870
  }, t))]
1602
1871
  });
1603
1872
  }
1604
- function nt({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
1873
+ function ot({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
1605
1874
  let [u, d] = o(null);
1606
1875
  return /* @__PURE__ */ l("label", {
1607
1876
  ref: a,
@@ -1633,7 +1902,7 @@ function nt({ name: e, accept: t, required: n, text: r = "Choose a file…", sty
1633
1902
  ]
1634
1903
  });
1635
1904
  }
1636
- function rt({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1905
+ function st({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1637
1906
  return /* @__PURE__ */ c("button", {
1638
1907
  ref: n,
1639
1908
  type: r ? "button" : "submit",
@@ -1653,7 +1922,7 @@ function rt({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1653
1922
  children: e
1654
1923
  });
1655
1924
  }
1656
- function it({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1925
+ function ct({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1657
1926
  let a = Math.max(1, (Number(e) || 1) * (Number(t) || 1));
1658
1927
  return /* @__PURE__ */ c("div", {
1659
1928
  ref: r,
@@ -1670,8 +1939,8 @@ function it({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1670
1939
  }, t))
1671
1940
  });
1672
1941
  }
1673
- function at({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, imageField: s, titleField: u = "name", textField: d, custom: f, templateId: m, style: h, nodeRef: g }) {
1674
- let { tenant: _, apiUrl: v } = n(B), y = n(H), b = n(V)?.[e], [x, S] = o(null);
1942
+ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, imageField: s, titleField: u = "name", textField: d, custom: f, templateId: m, style: h, nodeRef: g }) {
1943
+ let { tenant: _, apiUrl: v } = n(V), y = n(U), b = n(H)?.[e], [x, S] = o(null);
1675
1944
  if (r(() => {
1676
1945
  if (!e || b) return;
1677
1946
  let t = !0, n = e.startsWith("api:") ? `${v}/data/${encodeURIComponent(e.slice(4))}` : `${v}/dynamic/${encodeURIComponent(e)}`;
@@ -1712,7 +1981,7 @@ function at({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
1712
1981
  ...p(h)
1713
1982
  },
1714
1983
  children: C.map((e) => {
1715
- let t = s ? U(e?.data, s) : null, n = u ? G(U(e?.data, u)) : null, r = d ? U(e?.data, d) : null, a = Array.isArray(r) ? r : null, o = a || r == null ? null : G(r), f = i === "list";
1984
+ let t = s ? W(e?.data, s) : null, n = u ? G(W(e?.data, u)) : null, r = d ? W(e?.data, d) : null, a = Array.isArray(r) ? r : null, o = a || r == null ? null : G(r), f = i === "list";
1716
1985
  return /* @__PURE__ */ l("div", {
1717
1986
  style: {
1718
1987
  display: "flex",
@@ -1767,7 +2036,7 @@ function at({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
1767
2036
  })
1768
2037
  });
1769
2038
  }
1770
- function ot({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
2039
+ function ut({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
1771
2040
  return e.length ? /* @__PURE__ */ c("nav", {
1772
2041
  ref: r,
1773
2042
  "aria-label": "Breadcrumb",
@@ -1817,7 +2086,7 @@ function ot({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
1817
2086
  })
1818
2087
  }) : null;
1819
2088
  }
1820
- function st({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
2089
+ function dt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
1821
2090
  let o = Math.min(Math.max(Number(e) || 1, 1), 50), s = Math.min(Math.max(Number(t) || 1, 1), o), u = (e) => r && r !== "#" ? r.replace("{page}", String(e)) : "#", d = (e) => ({
1822
2091
  display: "inline-flex",
1823
2092
  alignItems: "center",
@@ -1870,7 +2139,7 @@ function st({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", sty
1870
2139
  ]
1871
2140
  });
1872
2141
  }
1873
- function ct({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
2142
+ function ft({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
1874
2143
  if (!t.length) return null;
1875
2144
  let o = Math.min(Math.max(Number(n) || 1, 1), t.length), s = (e) => ({
1876
2145
  width: 32,
@@ -1948,46 +2217,58 @@ function ct({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef:
1948
2217
  })
1949
2218
  });
1950
2219
  }
1951
- function lt({ columns: e = [], rows: t = [], striped: n = !0, bordered: r = !1, compact: i = !1, style: a, nodeRef: o }) {
1952
- if (!e.length) return null;
1953
- let s = i ? "6px 10px" : "10px 14px", u = "1px solid rgba(148, 163, 184, 0.35)", d = r ? { border: u } : { borderBottom: u };
2220
+ function pt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped: s = !0, bordered: u = !1, compact: d = !1, style: f, nodeRef: m }) {
2221
+ let { tenant: h, apiUrl: g } = n(V), _ = n(H)?.[i], [v, y] = o(null);
2222
+ if (r(() => {
2223
+ if (!i || _) return;
2224
+ let e = !0, t = i.startsWith("api:") ? `${g}/data/${encodeURIComponent(i.slice(4))}` : `${g}/dynamic/${encodeURIComponent(i)}`;
2225
+ return fetch(t, { headers: h ? { "x-tenant": h } : {} }).then((e) => e.json()).then((t) => e && y(Array.isArray(t?.payload) ? t.payload : [])).catch(() => e && y([])), () => {
2226
+ e = !1;
2227
+ };
2228
+ }, [
2229
+ i,
2230
+ h,
2231
+ g,
2232
+ _
2233
+ ]), !e.length) return null;
2234
+ let b = i ? (_ ?? v ?? []).slice(0, Math.max(1, Number(a) || 10)) : null, x = b ? b.map((t) => e.map((e) => G(W(t?.data, e.field)))) : t, S = d ? "6px 10px" : "10px 14px", C = "1px solid rgba(148, 163, 184, 0.35)", w = u ? { border: C } : { borderBottom: C };
1954
2235
  return /* @__PURE__ */ c("div", {
1955
- ref: o,
2236
+ ref: m,
1956
2237
  style: {
1957
2238
  width: "100%",
1958
2239
  overflowX: "auto",
1959
- ...p(a)
2240
+ ...p(f)
1960
2241
  },
1961
2242
  children: /* @__PURE__ */ l("table", {
1962
2243
  style: {
1963
2244
  width: "100%",
1964
2245
  borderCollapse: "collapse",
1965
2246
  fontSize: 14,
1966
- ...r ? { border: u } : {}
2247
+ ...u ? { border: C } : {}
1967
2248
  },
1968
2249
  children: [/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: e.map((e, t) => /* @__PURE__ */ c("th", {
1969
2250
  style: {
1970
2251
  textAlign: "left",
1971
2252
  fontWeight: 600,
1972
- padding: s,
2253
+ padding: S,
1973
2254
  background: "rgba(148, 163, 184, 0.12)",
1974
- ...d
2255
+ ...w
1975
2256
  },
1976
2257
  children: e.label ?? e
1977
- }, t)) }) }), /* @__PURE__ */ c("tbody", { children: t.map((t, r) => /* @__PURE__ */ c("tr", {
1978
- style: n && r % 2 == 1 ? { background: "rgba(148, 163, 184, 0.07)" } : void 0,
2258
+ }, t)) }) }), /* @__PURE__ */ c("tbody", { children: x.map((t, n) => /* @__PURE__ */ c("tr", {
2259
+ style: s && n % 2 == 1 ? { background: "rgba(148, 163, 184, 0.07)" } : void 0,
1979
2260
  children: e.map((e, n) => /* @__PURE__ */ c("td", {
1980
2261
  style: {
1981
- padding: s,
1982
- ...d
2262
+ padding: S,
2263
+ ...w
1983
2264
  },
1984
2265
  children: t?.[n] ?? ""
1985
2266
  }, n))
1986
- }, r)) })]
2267
+ }, n)) })]
1987
2268
  })
1988
2269
  });
1989
2270
  }
1990
- var ut = {
2271
+ var mt = {
1991
2272
  PageRoot: le,
1992
2273
  Section: ue,
1993
2274
  Container: de,
@@ -2000,12 +2281,12 @@ var ut = {
2000
2281
  SliderBlock: Be,
2001
2282
  CanvasSlider: Ve,
2002
2283
  TabsBlock: We,
2003
- QuickStack: it,
2004
- CollectionList: at,
2005
- BreadcrumbsBlock: ot,
2006
- PaginationBlock: st,
2007
- StepperBlock: ct,
2008
- TableBlock: lt,
2284
+ QuickStack: ct,
2285
+ CollectionList: lt,
2286
+ BreadcrumbsBlock: ut,
2287
+ PaginationBlock: dt,
2288
+ StepperBlock: ft,
2289
+ TableBlock: pt,
2009
2290
  AccordionBlock: Ge,
2010
2291
  NavbarBlock: Ue,
2011
2292
  ListBlock: Se,
@@ -2018,21 +2299,21 @@ var ut = {
2018
2299
  YouTubeBlock: Ae,
2019
2300
  IframeBlock: je,
2020
2301
  EmbedBlock: Me,
2021
- FormBlock: Xe,
2022
- FormLabel: Ze,
2023
- FormInput: Qe,
2024
- FormTextarea: $e,
2025
- FormCheckbox: (e) => /* @__PURE__ */ c(et, {
2302
+ FormBlock: et,
2303
+ FormLabel: tt,
2304
+ FormInput: nt,
2305
+ FormTextarea: rt,
2306
+ FormCheckbox: (e) => /* @__PURE__ */ c(it, {
2026
2307
  kind: "checkbox",
2027
2308
  ...e
2028
2309
  }),
2029
- FormRadio: (e) => /* @__PURE__ */ c(et, {
2310
+ FormRadio: (e) => /* @__PURE__ */ c(it, {
2030
2311
  kind: "radio",
2031
2312
  ...e
2032
2313
  }),
2033
- FormSelect: tt,
2034
- FormFile: nt,
2035
- FormSubmit: rt
2314
+ FormSelect: at,
2315
+ FormFile: ot,
2316
+ FormSubmit: st
2036
2317
  };
2037
2318
  //#endregion
2038
2319
  //#region ../ui/src/components/builder/render.jsx
@@ -2046,7 +2327,7 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
2046
2327
  let l = new Set(i).add(n);
2047
2328
  return /* @__PURE__ */ c(e, { children: $(s.template.rootId, s.template.nodes, r, l, a) }, t);
2048
2329
  }
2049
- let u = ut[s];
2330
+ let u = mt[s];
2050
2331
  if (!u) return null;
2051
2332
  let d = (o.nodes ?? []).map((e) => $(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, $(t, n, r, i)])) : void 0;
2052
2333
  return /* @__PURE__ */ c(u, {
@@ -2061,8 +2342,8 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
2061
2342
  }
2062
2343
  //#endregion
2063
2344
  //#region ../ui/src/components/builder/PageRenderer.jsx
2064
- var dt = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
2065
- function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, custom: s, tenant: u, apiUrl: d, datasets: f }) {
2345
+ var ht = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
2346
+ function gt({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, custom: s, tenant: u, apiUrl: d, datasets: f }) {
2066
2347
  let p = s?.js?.trim();
2067
2348
  if (r(() => {
2068
2349
  if (!p) return;
@@ -2073,24 +2354,24 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
2073
2354
  minHeight: "100%",
2074
2355
  display: "flex",
2075
2356
  flexDirection: "column"
2076
- }, h = $("ROOT", e, n), g = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), _ = T(e, n), v = w(e, n), y = s?.css?.trim(), b = z(e, n).map((e) => /* @__PURE__ */ c("link", {
2357
+ }, h = $("ROOT", e, n), g = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), _ = T(e, n), v = w(e, n), y = s?.css?.trim(), b = B(e, n).map((e) => /* @__PURE__ */ c("link", {
2077
2358
  rel: "stylesheet",
2078
2359
  precedence: "default",
2079
- href: re(e)
2360
+ href: te(e)
2080
2361
  }, e));
2081
- if (a !== "auto") return /* @__PURE__ */ c(B.Provider, {
2362
+ if (a !== "auto") return /* @__PURE__ */ c(V.Provider, {
2082
2363
  value: {
2083
2364
  tenant: u || "",
2084
2365
  apiUrl: d || "/api"
2085
2366
  },
2086
- children: /* @__PURE__ */ c(V.Provider, {
2367
+ children: /* @__PURE__ */ c(H.Provider, {
2087
2368
  value: f ?? null,
2088
- children: /* @__PURE__ */ c(H.Provider, {
2369
+ children: /* @__PURE__ */ c(U.Provider, {
2089
2370
  value: g,
2090
2371
  children: /* @__PURE__ */ l("div", {
2091
2372
  style: {
2092
2373
  ...m,
2093
- ...P(t, a),
2374
+ ...F(t, a),
2094
2375
  ...o
2095
2376
  },
2096
2377
  children: [
@@ -2105,25 +2386,25 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
2105
2386
  })
2106
2387
  });
2107
2388
  let x = M(t);
2108
- return /* @__PURE__ */ c(B.Provider, {
2389
+ return /* @__PURE__ */ c(V.Provider, {
2109
2390
  value: {
2110
2391
  tenant: u || "",
2111
2392
  apiUrl: d || "/api"
2112
2393
  },
2113
- children: /* @__PURE__ */ c(V.Provider, {
2394
+ children: /* @__PURE__ */ c(H.Provider, {
2114
2395
  value: f ?? null,
2115
- children: /* @__PURE__ */ c(H.Provider, {
2396
+ children: /* @__PURE__ */ c(U.Provider, {
2116
2397
  value: g,
2117
2398
  children: /* @__PURE__ */ l("div", {
2118
2399
  className: "webim-page",
2119
2400
  style: {
2120
2401
  ...m,
2121
- ...ee(t),
2402
+ ...P(t),
2122
2403
  ...o
2123
2404
  },
2124
2405
  children: [
2125
- /* @__PURE__ */ c("style", { children: `.webim-page { ${dt(N(x.light))} }
2126
- @media (prefers-color-scheme: dark) { .webim-page { ${dt(N(x.dark))} } }` }),
2406
+ /* @__PURE__ */ c("style", { children: `.webim-page { ${ht(N(x.light))} }
2407
+ @media (prefers-color-scheme: dark) { .webim-page { ${ht(N(x.dark))} } }` }),
2127
2408
  b,
2128
2409
  _ && /* @__PURE__ */ c("style", { children: _ }),
2129
2410
  v && /* @__PURE__ */ c("style", { children: v }),
@@ -2137,8 +2418,8 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
2137
2418
  }
2138
2419
  //#endregion
2139
2420
  //#region src/WebimContent.jsx
2140
- function pt({ bundle: e, mode: t = "auto", style: n }) {
2141
- return e?.blocks?.ROOT ? /* @__PURE__ */ c(ft, {
2421
+ function _t({ bundle: e, mode: t = "auto", style: n }) {
2422
+ return e?.blocks?.ROOT ? /* @__PURE__ */ c(gt, {
2142
2423
  blocks: e.blocks,
2143
2424
  theme: e.theme,
2144
2425
  components: e.components,
@@ -2152,7 +2433,7 @@ function pt({ bundle: e, mode: t = "auto", style: n }) {
2152
2433
  }
2153
2434
  //#endregion
2154
2435
  //#region src/WebimPage.jsx
2155
- function mt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
2436
+ function vt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
2156
2437
  let [h, g] = o({ status: "loading" }), _ = a({
2157
2438
  onLoad: p,
2158
2439
  onError: m
@@ -2162,7 +2443,7 @@ function mt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "a
2162
2443
  onError: m
2163
2444
  }, r(() => {
2164
2445
  let r = !0;
2165
- return g({ status: "loading" }), L({
2446
+ return g({ status: "loading" }), z({
2166
2447
  apiUrl: e,
2167
2448
  tenant: t,
2168
2449
  slug: n,
@@ -2187,11 +2468,11 @@ function mt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "a
2187
2468
  n,
2188
2469
  i,
2189
2470
  s
2190
- ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(pt, {
2471
+ ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(_t, {
2191
2472
  bundle: h.bundle,
2192
2473
  mode: l,
2193
2474
  style: u
2194
2475
  });
2195
2476
  }
2196
2477
  //#endregion
2197
- export { ft as PageRenderer, pt as WebimContent, mt as WebimPage, L as fetchPage, ve as renderRichContent, F as resolveTheme };
2478
+ export { gt as PageRenderer, _t as WebimContent, vt as WebimPage, z as fetchPage, ve as renderRichContent, I as resolveTheme };