webim-adapter 0.5.0 → 0.6.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.
@@ -1,7 +1,7 @@
1
1
  import { Fragment as e, createContext as t, useContext as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
2
2
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
3
  //#region ../ui/src/components/builder/styles.js
4
- var u = /* @__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(".")), d = (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? `${Number(e)}px` : e, f = [
4
+ var u = /* @__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.textDecorationThickness.textUnderlineOffset.top.right.bottom.left".split(".")), d = (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? `${Number(e)}px` : e, f = [
5
5
  "borderWidth",
6
6
  "borderStyle",
7
7
  "borderColor",
@@ -52,29 +52,29 @@ function p(e) {
52
52
  delete t.filters, delete t.backdropFilters, delete t.filterBlur, delete t.filterGrayscale, delete t.filterBrightness, delete t.filterContrast, delete t.filterSaturate;
53
53
  let B = F(I);
54
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;
55
+ let re = F(L);
56
+ re.length && (t.backdropFilter = re.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
+ let { textStrokeWidth: V, textStrokeColor: ie } = t;
58
+ delete t.textStrokeWidth, delete t.textStrokeColor, (V !== void 0 || ie !== void 0) && (t.WebkitTextStroke = `${d(V ?? 1)} ${ie || "currentColor"}`);
59
+ let { clipText: H } = t;
60
+ delete t.clipText, H && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
+ let { transitions: U, transitionDuration: W, transitionEasing: ae, transitionProperty: G } = t, oe = (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(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) {
63
+ let K = (Array.isArray(U) ? U : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${oe(e.duration ?? 200)} ${e.easing || "ease"}`);
64
+ if (W !== void 0 && K.push(`${G || "all"} ${oe(W)} ${ae || "ease"}`), K.length && (t.transition = K.join(", ")), t.textDecoration !== void 0 && (t.textDecorationLine = t.textDecoration, delete t.textDecoration), 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
  }
68
68
  delete t.backgroundVideo;
69
- let { overlayColor: J, overlayOpacity: oe } = t;
70
- if (delete t.overlayColor, delete t.overlayOpacity, J) {
71
- let e = `color-mix(in srgb, ${J} ${oe ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
69
+ let { overlayColor: se, overlayOpacity: q } = t;
70
+ if (delete t.overlayColor, delete t.overlayOpacity, se) {
71
+ let e = `color-mix(in srgb, ${se} ${q ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
72
72
  t.backgroundImage = t.backgroundImage ? `${n}, ${t.backgroundImage}` : n;
73
73
  }
74
74
  t.backgroundImage && (t.backgroundSize ??= "cover", t.backgroundPosition ??= "center", t.backgroundRepeat ??= "no-repeat");
75
- let { backgroundLayers: se } = t;
75
+ let { backgroundLayers: J } = t;
76
76
  delete t.backgroundLayers;
77
- let Y = (Array.isArray(se) ? se : []).filter((e) => e && e.on !== !1);
77
+ let Y = (Array.isArray(J) ? J : []).filter((e) => e && e.on !== !1);
78
78
  if (Y.length) {
79
79
  let e = [], n = [], r = [], i = [], a = [];
80
80
  for (let t of Y) 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");
@@ -298,6 +298,8 @@ function L({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
298
298
  components: a.builder_components?.components ?? {},
299
299
  custom: o.custom,
300
300
  seo: o.seo,
301
+ direction: o.direction,
302
+ locale: i || a.locales?.default,
301
303
  locales: a.locales,
302
304
  tenant: n ?? "",
303
305
  apiUrl: r ?? ""
@@ -456,15 +458,26 @@ function B(e, t) {
456
458
  return [...n].sort();
457
459
  }
458
460
  //#endregion
459
- //#region ../ui/src/components/builder/views.jsx
460
- var V = t({
461
+ //#region ../ui/src/components/builder/locale.js
462
+ var re = /* @__PURE__ */ new Set([
463
+ "ar",
464
+ "he",
465
+ "fa",
466
+ "ur",
467
+ "ps",
468
+ "sd",
469
+ "ug",
470
+ "yi",
471
+ "dv",
472
+ "ckb"
473
+ ]), V = (e) => re.has(String(e || "").toLowerCase().split(/[-_]/)[0]) ? "rtl" : "ltr", ie = (e, t) => e === "ltr" || e === "rtl" ? e : t ? V(t) : void 0, H = t({
461
474
  tenant: "",
462
475
  apiUrl: "/api"
463
- }), H = t(null), U = t(null), re = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
464
- function W(e, t) {
476
+ }), U = t(null), W = t(null), ae = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
477
+ function G(e, t) {
465
478
  if (t) return t.includes(".") ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e?.[t];
466
479
  }
467
- var ie = (e) => {
480
+ var oe = (e) => {
468
481
  let t = [];
469
482
  for (let [n, r] of Object.entries(e ?? {})) {
470
483
  if (!/^[\w-]+$/.test(n)) continue;
@@ -474,36 +487,36 @@ var ie = (e) => {
474
487
  }
475
488
  return t;
476
489
  };
477
- function G(e) {
490
+ function K(e) {
478
491
  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
492
  }
480
- function ae(e, t) {
481
- let n = t?.data ?? {}, r = ie(n);
493
+ function se(e, t) {
494
+ let n = t?.data ?? {}, r = oe(n);
482
495
  if (!r.length) return 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;
496
+ let i = RegExp(`:(${r.map(ae).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => K(G(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
497
  return a(e);
485
498
  }
486
- var K = {
499
+ var q = {
487
500
  margin: 0,
488
501
  fontWeight: 700,
489
502
  lineHeight: 1.2,
490
503
  fontFamily: "var(--page-heading-font, inherit)"
491
- }, q = { margin: 0 }, J = {
504
+ }, J = { margin: 0 }, Y = {
492
505
  display: "inline-block",
493
506
  textDecoration: "none",
494
507
  cursor: "pointer",
495
508
  backgroundColor: "var(--page-accent, #111827)",
496
509
  color: "var(--page-accent-text, #ffffff)"
497
- }, oe = {
510
+ }, ce = {
498
511
  flexGrow: 1,
499
512
  display: "flex",
500
513
  flexDirection: "column",
501
514
  position: "relative"
502
- }, se = {
515
+ }, le = {
503
516
  display: "flex",
504
517
  flexDirection: "column"
505
518
  };
506
- function Y({ style: e }) {
519
+ function ue({ style: e }) {
507
520
  let t = e?.backgroundVideo;
508
521
  if (!t) return null;
509
522
  let n = {
@@ -529,7 +542,7 @@ function Y({ style: e }) {
529
542
  background: r
530
543
  } })] });
531
544
  }
532
- var ce = (e, t) => e?.backgroundVideo ? {
545
+ var de = (e, t) => e?.backgroundVideo ? {
533
546
  position: "relative",
534
547
  ...t,
535
548
  ...p(e)
@@ -537,24 +550,24 @@ var ce = (e, t) => e?.backgroundVideo ? {
537
550
  ...t,
538
551
  ...p(e)
539
552
  };
540
- function le({ style: e, nodeRef: t, children: n }) {
553
+ function fe({ style: e, nodeRef: t, children: n }) {
541
554
  return /* @__PURE__ */ l("div", {
542
555
  ref: t,
543
556
  style: {
544
- ...oe,
557
+ ...ce,
545
558
  ...p(e)
546
559
  },
547
- children: [/* @__PURE__ */ c(Y, { style: e }), n]
560
+ children: [/* @__PURE__ */ c(ue, { style: e }), n]
548
561
  });
549
562
  }
550
- function ue({ style: e, nodeRef: t, children: n }) {
563
+ function pe({ style: e, nodeRef: t, children: n }) {
551
564
  return /* @__PURE__ */ l("section", {
552
565
  ref: t,
553
- style: ce(e, se),
554
- children: [/* @__PURE__ */ c(Y, { style: e }), n]
566
+ style: de(e, le),
567
+ children: [/* @__PURE__ */ c(ue, { style: e }), n]
555
568
  });
556
569
  }
557
- function de({ style: e, freeLayout: t, nodeRef: n, children: r }) {
570
+ function me({ style: e, freeLayout: t, nodeRef: n, children: r }) {
558
571
  let i = t ? {
559
572
  position: "relative",
560
573
  minHeight: 240
@@ -563,32 +576,32 @@ function de({ style: e, freeLayout: t, nodeRef: n, children: r }) {
563
576
  ref: n,
564
577
  style: i ? {
565
578
  ...i,
566
- ...ce(e)
567
- } : ce(e),
568
- children: [/* @__PURE__ */ c(Y, { style: e }), r]
579
+ ...de(e)
580
+ } : de(e),
581
+ children: [/* @__PURE__ */ c(ue, { style: e }), r]
569
582
  });
570
583
  }
571
- function fe({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
584
+ function he({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
572
585
  return /* @__PURE__ */ c(n, {
573
586
  ref: a,
574
587
  style: {
575
- ...K,
588
+ ...q,
576
589
  ...p(r)
577
590
  },
578
591
  children: X(t, e, i)
579
592
  });
580
593
  }
581
- var pe = {
594
+ var ge = {
582
595
  fontFamily: k.mono.value,
583
596
  background: "rgba(148, 163, 184, 0.18)",
584
597
  padding: "1px 5px",
585
598
  borderRadius: 4,
586
599
  fontSize: "0.9em"
587
600
  };
588
- function me(e, t = [], n, r) {
601
+ function _e(e, t = [], n, r) {
589
602
  let i = e;
590
603
  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
- style: pe,
604
+ style: ge,
592
605
  children: i
593
606
  })), 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
607
  href: n,
@@ -604,7 +617,7 @@ function X(t, n, r) {
604
617
  if (t.parts) return /* @__PURE__ */ c(e, { children: X(t.parts, "", r) }, n);
605
618
  let i = t.text;
606
619
  return t.sup ? i = /* @__PURE__ */ c("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ c("sub", { children: i })), t.code && (i = /* @__PURE__ */ c("code", {
607
- style: pe,
620
+ style: ge,
608
621
  children: i
609
622
  })), 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
623
  style: {
@@ -621,13 +634,13 @@ function X(t, n, r) {
621
634
  })), /* @__PURE__ */ c(e, { children: i }, n);
622
635
  }) : n;
623
636
  }
624
- function he({ parts: e, text: t, marks: n, href: r, target: i, style: a }) {
637
+ function ve({ parts: e, text: t, marks: n, href: r, target: i, style: a }) {
625
638
  return /* @__PURE__ */ c("span", {
626
639
  style: p(a),
627
- children: e?.length ? X(e, t) : me(t, n, r, i)
640
+ children: e?.length ? X(e, t) : _e(t, n, r, i)
628
641
  });
629
642
  }
630
- var ge = {
643
+ var ye = {
631
644
  h1: 40,
632
645
  h2: 32,
633
646
  h3: 26,
@@ -635,7 +648,7 @@ var ge = {
635
648
  h5: 19,
636
649
  h6: 16
637
650
  };
638
- function _e({ align: e = "center", width: t, wrap: n } = {}) {
651
+ function be({ align: e = "center", width: t, wrap: n } = {}) {
639
652
  let r = t ? `${t}%` : void 0;
640
653
  if (e === "full") return { width: "100%" };
641
654
  let i = e === "left" || e === "right";
@@ -669,7 +682,7 @@ function _e({ align: e = "center", width: t, wrap: n } = {}) {
669
682
  marginRight: "auto"
670
683
  };
671
684
  }
672
- function ve(e = [], t, n) {
685
+ function xe(e = [], t, n) {
673
686
  let r = n ?? ((e, n) => X(e, n, t));
674
687
  return e.map((t, n) => {
675
688
  let i = {
@@ -692,7 +705,7 @@ function ve(e = [], t, n) {
692
705
  marginLeft: 0,
693
706
  marginRight: 0,
694
707
  ...i,
695
- ..._e(t)
708
+ ...be(t)
696
709
  },
697
710
  children: [t.href ? /* @__PURE__ */ c("a", {
698
711
  href: t.href,
@@ -711,16 +724,16 @@ function ve(e = [], t, n) {
711
724
  })]
712
725
  }, n);
713
726
  }
714
- if (t.type === "video") return ke(t.url) ? /* @__PURE__ */ c("div", {
727
+ if (t.type === "video") return Me(t.url) ? /* @__PURE__ */ c("div", {
715
728
  style: {
716
729
  ...i,
717
- ..._e({
730
+ ...be({
718
731
  align: t.align,
719
732
  wrap: t.wrap,
720
733
  width: t.width ?? 100
721
734
  })
722
735
  },
723
- children: /* @__PURE__ */ c(Ae, {
736
+ children: /* @__PURE__ */ c(Ne, {
724
737
  url: t.url,
725
738
  autoplay: t.autoplay,
726
739
  muted: t.muted,
@@ -749,17 +762,17 @@ function ve(e = [], t, n) {
749
762
  }
750
763
  if (t.type === "quote") return /* @__PURE__ */ c("blockquote", {
751
764
  style: {
752
- ...be,
765
+ ...Ce,
753
766
  ...i
754
767
  },
755
768
  children: r(t.parts, t.text)
756
769
  }, n);
757
- if (ge[t.type]) {
770
+ if (ye[t.type]) {
758
771
  let e = t.type;
759
772
  return /* @__PURE__ */ c(e, {
760
773
  style: {
761
- ...K,
762
- fontSize: ge[t.type],
774
+ ...q,
775
+ fontSize: ye[t.type],
763
776
  ...i
764
777
  },
765
778
  children: r(t.parts, t.text)
@@ -767,39 +780,39 @@ function ve(e = [], t, n) {
767
780
  }
768
781
  return /* @__PURE__ */ c("p", {
769
782
  style: {
770
- ...q,
783
+ ...J,
771
784
  ...i
772
785
  },
773
786
  children: r(t.parts, t.text)
774
787
  }, n);
775
788
  });
776
789
  }
777
- function ye({ content: e, style: t, linked: n, nodeRef: r }) {
790
+ function Se({ content: e, style: t, linked: n, nodeRef: r }) {
778
791
  return /* @__PURE__ */ c("div", {
779
792
  ref: r,
780
793
  style: {
781
794
  display: "flow-root",
782
795
  ...p(t)
783
796
  },
784
- children: ve(e, n)
797
+ children: xe(e, n)
785
798
  });
786
799
  }
787
- var be = {
800
+ var Ce = {
788
801
  margin: 0,
789
802
  padding: "8px 0 8px 20px",
790
803
  borderLeft: "4px solid var(--page-accent, rgba(148, 163, 184, 0.6))"
791
804
  };
792
- function xe({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
805
+ function we({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
793
806
  return /* @__PURE__ */ c("blockquote", {
794
807
  ref: i,
795
808
  style: {
796
- ...be,
809
+ ...Ce,
797
810
  ...p(n)
798
811
  },
799
812
  children: X(t, e, r)
800
813
  });
801
814
  }
802
- function Se({ ordered: e, items: t = [], style: n, nodeRef: r }) {
815
+ function Te({ ordered: e, items: t = [], style: n, nodeRef: r }) {
803
816
  return /* @__PURE__ */ c(e ? "ol" : "ul", {
804
817
  ref: r,
805
818
  style: {
@@ -813,49 +826,49 @@ function Se({ ordered: e, items: t = [], style: n, nodeRef: r }) {
813
826
  }, t))
814
827
  });
815
828
  }
816
- function Ce({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
829
+ function Ee({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
817
830
  return /* @__PURE__ */ c("p", {
818
831
  ref: i,
819
832
  style: {
820
- ...q,
833
+ ...J,
821
834
  ...p(n)
822
835
  },
823
836
  children: X(t, e, r)
824
837
  });
825
838
  }
826
- var we = {
839
+ var De = {
827
840
  color: "var(--page-accent, inherit)",
828
841
  textDecoration: "underline",
829
842
  textUnderlineOffset: 3,
830
843
  cursor: "pointer"
831
844
  };
832
- function Te({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
845
+ function Oe({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
833
846
  return /* @__PURE__ */ c("a", {
834
847
  ref: o,
835
848
  href: n || "#",
836
849
  target: r || void 0,
837
850
  rel: r === "_blank" ? "noopener noreferrer" : void 0,
838
851
  style: {
839
- ...we,
852
+ ...De,
840
853
  ...p(i)
841
854
  },
842
855
  children: X(t, e, a)
843
856
  });
844
857
  }
845
- function Ee({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
858
+ function ke({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
846
859
  return /* @__PURE__ */ c("a", {
847
860
  ref: o,
848
861
  href: n || "#",
849
862
  target: r || void 0,
850
863
  rel: r === "_blank" ? "noopener noreferrer" : void 0,
851
864
  style: {
852
- ...J,
865
+ ...Y,
853
866
  ...p(i)
854
867
  },
855
868
  children: X(t, e, a)
856
869
  });
857
870
  }
858
- function De({ src: e, alt: t, style: n, nodeRef: r }) {
871
+ function Ae({ src: e, alt: t, style: n, nodeRef: r }) {
859
872
  return e ? /* @__PURE__ */ c("img", {
860
873
  ref: r,
861
874
  src: e,
@@ -867,7 +880,7 @@ function De({ src: e, alt: t, style: n, nodeRef: r }) {
867
880
  }
868
881
  }) : null;
869
882
  }
870
- function Oe({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: s }) {
883
+ function je({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: s }) {
871
884
  return e ? /* @__PURE__ */ c("video", {
872
885
  ref: s,
873
886
  src: e,
@@ -885,9 +898,9 @@ function Oe({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !
885
898
  }
886
899
  }) : null;
887
900
  }
888
- var ke = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
889
- function Ae({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: s }) {
890
- let l = ke(e);
901
+ var Me = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
902
+ function Ne({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: s }) {
903
+ let l = Me(e);
891
904
  if (!l) return null;
892
905
  let u = new URLSearchParams({ rel: "0" });
893
906
  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__ */ c("div", {
@@ -913,7 +926,7 @@ function Ae({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i
913
926
  })
914
927
  });
915
928
  }
916
- function je({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
929
+ function Pe({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
917
930
  return e ? /* @__PURE__ */ c("iframe", {
918
931
  ref: i,
919
932
  src: e,
@@ -929,7 +942,7 @@ function je({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i })
929
942
  }
930
943
  }) : null;
931
944
  }
932
- function Me({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
945
+ function Fe({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
933
946
  let [a, s] = o(null);
934
947
  return r(() => {
935
948
  a && (a.innerHTML = e || "", t && a.querySelectorAll("script").forEach((e) => {
@@ -948,7 +961,7 @@ function Me({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
948
961
  style: p(n)
949
962
  });
950
963
  }
951
- function Ne({ height: e, nodeRef: t }) {
964
+ function Ie({ height: e, nodeRef: t }) {
952
965
  return /* @__PURE__ */ c("div", {
953
966
  ref: t,
954
967
  style: {
@@ -958,7 +971,7 @@ function Ne({ height: e, nodeRef: t }) {
958
971
  }
959
972
  });
960
973
  }
961
- function Pe({ style: e, nodeRef: t }) {
974
+ function Le({ style: e, nodeRef: t }) {
962
975
  return /* @__PURE__ */ c("div", {
963
976
  ref: t,
964
977
  style: {
@@ -969,7 +982,7 @@ function Pe({ style: e, nodeRef: t }) {
969
982
  }
970
983
  });
971
984
  }
972
- var Fe = {
985
+ var Re = {
973
986
  position: "absolute",
974
987
  top: "50%",
975
988
  transform: "translateY(-50%)",
@@ -986,7 +999,7 @@ var Fe = {
986
999
  alignItems: "center",
987
1000
  justifyContent: "center",
988
1001
  padding: 0
989
- }, Ie = {
1002
+ }, ze = {
990
1003
  bottom: {
991
1004
  inset: "auto 0 0 0",
992
1005
  padding: "40px 24px 20px",
@@ -1005,8 +1018,8 @@ var Fe = {
1005
1018
  padding: 24,
1006
1019
  textShadow: "0 2px 12px rgba(0, 0, 0, 0.6)"
1007
1020
  }
1008
- }, Le = 48;
1009
- function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, height: a = 320, swipe: u = !0, style: d, nodeRef: f }) {
1021
+ }, Be = 48;
1022
+ function Ve({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, height: a = 320, swipe: u = !0, style: d, nodeRef: f }) {
1010
1023
  let [m, h] = o(0), [g, _] = o(!1), [v, y] = o(null), b = e ? Math.min(m, e - 1) : 0;
1011
1024
  if (r(() => {
1012
1025
  if (!n || g || v || e < 2) return;
@@ -1022,7 +1035,7 @@ function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1022
1035
  let x = (t) => h((t + e) % e), S = () => {
1023
1036
  if (!v) return;
1024
1037
  let { dx: e } = v;
1025
- y(null), e < -48 ? x(b + 1) : e > Le && x(b - 1);
1038
+ y(null), e < -48 ? x(b + 1) : e > Be && x(b - 1);
1026
1039
  };
1027
1040
  return /* @__PURE__ */ l("div", {
1028
1041
  ref: f,
@@ -1070,7 +1083,7 @@ function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1070
1083
  type: "button",
1071
1084
  "aria-label": "Previous slide",
1072
1085
  style: {
1073
- ...Fe,
1086
+ ...Re,
1074
1087
  left: 12
1075
1088
  },
1076
1089
  onClick: () => x(b - 1),
@@ -1080,7 +1093,7 @@ function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1080
1093
  type: "button",
1081
1094
  "aria-label": "Next slide",
1082
1095
  style: {
1083
- ...Fe,
1096
+ ...Re,
1084
1097
  right: 12
1085
1098
  },
1086
1099
  onClick: () => x(b + 1),
@@ -1114,7 +1127,7 @@ function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1114
1127
  ] })]
1115
1128
  });
1116
1129
  }
1117
- var ze = (e, t) => ({
1130
+ var He = (e, t) => ({
1118
1131
  position: "absolute",
1119
1132
  inset: 0,
1120
1133
  backgroundImage: e ? `url(${e})` : "none",
@@ -1122,18 +1135,18 @@ var ze = (e, t) => ({
1122
1135
  backgroundSize: "cover",
1123
1136
  backgroundPosition: "center"
1124
1137
  });
1125
- function Be({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
1126
- return e.length ? /* @__PURE__ */ c(Re, {
1138
+ function Ue({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
1139
+ return e.length ? /* @__PURE__ */ c(Ve, {
1127
1140
  ...r,
1128
1141
  count: e.length,
1129
1142
  renderSlide: (r) => {
1130
1143
  let i = e[r];
1131
- return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: ze(i.image) }), (i.title || i.text) && /* @__PURE__ */ l("div", {
1144
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: He(i.image) }), (i.title || i.text) && /* @__PURE__ */ l("div", {
1132
1145
  style: {
1133
1146
  position: "absolute",
1134
1147
  color: "#fff",
1135
1148
  textAlign: n,
1136
- ...Ie[t] ?? Ie.bottom
1149
+ ...ze[t] ?? ze.bottom
1137
1150
  },
1138
1151
  children: [i.title && /* @__PURE__ */ c("div", {
1139
1152
  style: {
@@ -1153,13 +1166,13 @@ function Be({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "
1153
1166
  }
1154
1167
  }) : null;
1155
1168
  }
1156
- function Ve({ slides: e = [], linked: t, ...n }) {
1157
- return e.length ? /* @__PURE__ */ c(Re, {
1169
+ function We({ slides: e = [], linked: t, ...n }) {
1170
+ return e.length ? /* @__PURE__ */ c(Ve, {
1158
1171
  ...n,
1159
1172
  count: e.length,
1160
1173
  renderSlide: (n) => {
1161
1174
  let r = e[n];
1162
- return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: ze(r.image, r.color) }), /* @__PURE__ */ c("div", {
1175
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: He(r.image, r.color) }), /* @__PURE__ */ c("div", {
1163
1176
  style: {
1164
1177
  position: "absolute",
1165
1178
  inset: 0,
@@ -1176,14 +1189,14 @@ var Z = {
1176
1189
  textDecoration: "none",
1177
1190
  fontSize: 14,
1178
1191
  opacity: .85
1179
- }, He = {
1192
+ }, Ge = {
1180
1193
  background: "var(--page-bg, #ffffff)",
1181
1194
  color: "var(--page-text, #111827)",
1182
1195
  border: "1px solid rgba(148, 163, 184, 0.25)",
1183
1196
  boxShadow: "0 16px 40px rgba(15, 23, 42, 0.16)",
1184
1197
  zIndex: 60
1185
1198
  };
1186
- function Ue({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u = "auto", breakpoint: d = 768 }) {
1199
+ function Ke({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u = "auto", breakpoint: d = 768 }) {
1187
1200
  let [f, m] = o(null), [h, g] = o(!1), [_, v] = o(!1), [y, b] = o(null);
1188
1201
  r(() => {
1189
1202
  if (!f) return;
@@ -1294,7 +1307,7 @@ function Ue({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u =
1294
1307
  ]
1295
1308
  }), y === e.key && (n ? /* @__PURE__ */ c("div", {
1296
1309
  style: {
1297
- ...He,
1310
+ ...Ge,
1298
1311
  position: "absolute",
1299
1312
  left: 0,
1300
1313
  right: 0,
@@ -1310,7 +1323,7 @@ function Ue({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u =
1310
1323
  }))
1311
1324
  }) : /* @__PURE__ */ c("div", {
1312
1325
  style: {
1313
- ...He,
1326
+ ...Ge,
1314
1327
  position: "absolute",
1315
1328
  top: "100%",
1316
1329
  left: 0,
@@ -1350,7 +1363,7 @@ function Ue({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u =
1350
1363
  ]
1351
1364
  });
1352
1365
  }
1353
- function We({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1366
+ function qe({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1354
1367
  let [i, a] = o(0), s = e.length ? Math.min(i, e.length - 1) : 0;
1355
1368
  return e.length ? /* @__PURE__ */ l("div", {
1356
1369
  ref: r,
@@ -1390,7 +1403,7 @@ function We({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1390
1403
  }, e.key))]
1391
1404
  }) : null;
1392
1405
  }
1393
- function Ge({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1406
+ function Je({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1394
1407
  let [a, s] = o(() => new Set(e.length ? [e[0].key] : []));
1395
1408
  if (!e.length) return null;
1396
1409
  let u = (e) => s((t) => {
@@ -1447,11 +1460,11 @@ function Ge({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }
1447
1460
  })
1448
1461
  });
1449
1462
  }
1450
- var Ke = {
1463
+ var Ye = {
1451
1464
  display: "flex",
1452
1465
  flexDirection: "column",
1453
1466
  gap: "12px"
1454
- }, qe = {
1467
+ }, Xe = {
1455
1468
  fontSize: "14px",
1456
1469
  fontWeight: 500,
1457
1470
  color: "var(--page-text, #111827)"
@@ -1465,18 +1478,18 @@ var Ke = {
1465
1478
  boxSizing: "border-box",
1466
1479
  backgroundColor: "#ffffff",
1467
1480
  color: "#111827"
1468
- }, Je = {
1481
+ }, Ze = {
1469
1482
  display: "flex",
1470
1483
  alignItems: "center",
1471
1484
  gap: "8px",
1472
1485
  fontSize: "14px",
1473
1486
  color: "var(--page-text, #111827)"
1474
- }, Ye = (e) => e ? {
1487
+ }, Qe = (e) => e ? {
1475
1488
  readOnly: !0,
1476
1489
  tabIndex: -1,
1477
1490
  onMouseDown: (e) => e.preventDefault()
1478
1491
  } : {};
1479
- function Xe(e, t) {
1492
+ function $e(e, t) {
1480
1493
  if (!e) return !0;
1481
1494
  let n = t[e.field], r = n == null || n === "" ? "" : String(n), i = e.value ?? "";
1482
1495
  switch (e.op) {
@@ -1490,11 +1503,11 @@ function Xe(e, t) {
1490
1503
  default: return !1;
1491
1504
  }
1492
1505
  }
1493
- var Ze = {
1506
+ var et = {
1494
1507
  display: "flex",
1495
1508
  flexDirection: "column",
1496
1509
  gap: 6
1497
- }, Qe = {
1510
+ }, tt = {
1498
1511
  font: "inherit",
1499
1512
  fontSize: 15,
1500
1513
  padding: "10px 12px",
@@ -1505,10 +1518,10 @@ var Ze = {
1505
1518
  width: "100%",
1506
1519
  boxSizing: "border-box"
1507
1520
  };
1508
- function $e({ field: e, value: t, onChange: n, inert: r }) {
1521
+ function nt({ field: e, value: t, onChange: n, inert: r }) {
1509
1522
  let i = /* @__PURE__ */ l("span", {
1510
1523
  style: {
1511
- ...qe,
1524
+ ...Xe,
1512
1525
  fontSize: 14
1513
1526
  },
1514
1527
  children: [e.label, e.required ? " *" : ""]
@@ -1517,7 +1530,7 @@ function $e({ field: e, value: t, onChange: n, inert: r }) {
1517
1530
  required: e.required || void 0,
1518
1531
  placeholder: e.placeholder || void 0,
1519
1532
  disabled: r || void 0,
1520
- style: Qe,
1533
+ style: tt,
1521
1534
  value: t ?? "",
1522
1535
  onChange: (t) => n(e.name, t.target.value)
1523
1536
  };
@@ -1546,7 +1559,7 @@ function $e({ field: e, value: t, onChange: n, inert: r }) {
1546
1559
  borderRadius: 8,
1547
1560
  display: "block"
1548
1561
  }
1549
- }) : null : e.type === "video" ? e.src ? /youtube\.com|youtu\.be|vimeo\.com/i.test(e.src) ? /* @__PURE__ */ c(Ae, {
1562
+ }) : null : e.type === "video" ? e.src ? /youtube\.com|youtu\.be|vimeo\.com/i.test(e.src) ? /* @__PURE__ */ c(Ne, {
1550
1563
  url: e.src,
1551
1564
  style: { width: "100%" }
1552
1565
  }) : /* @__PURE__ */ c("video", {
@@ -1558,14 +1571,14 @@ function $e({ field: e, value: t, onChange: n, inert: r }) {
1558
1571
  display: "block"
1559
1572
  }
1560
1573
  }) : null : /* @__PURE__ */ l("label", {
1561
- style: Ze,
1574
+ style: et,
1562
1575
  children: [
1563
1576
  i,
1564
1577
  e.type === "textarea" || e.multiline ? /* @__PURE__ */ c("textarea", {
1565
1578
  ...a,
1566
1579
  rows: 4,
1567
1580
  style: {
1568
- ...Qe,
1581
+ ...tt,
1569
1582
  resize: "vertical"
1570
1583
  }
1571
1584
  }) : e.type === "select" ? /* @__PURE__ */ l("select", {
@@ -1620,12 +1633,12 @@ function $e({ field: e, value: t, onChange: n, inert: r }) {
1620
1633
  ]
1621
1634
  });
1622
1635
  }
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;
1636
+ function rt({ 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 }) {
1637
+ let { tenant: b, apiUrl: x } = n(H), [S, C] = o("form"), [w, T] = o(null), [E, D] = o({}), [O, k] = o(0), A = g ? y || "form" : S;
1625
1638
  r(() => {
1626
1639
  if (!f || !d) return;
1627
1640
  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)), () => {
1641
+ return fetch(`${x || "/api"}/forms/${encodeURIComponent(d)}`, { headers: b ? { "x-tenant": b } : {} }).then((e) => e.json()).then((t) => e && T(t?.payload && typeof t.payload == "object" ? t.payload : null)).catch(() => e && T(null)), () => {
1629
1642
  e = !1;
1630
1643
  };
1631
1644
  }, [
@@ -1638,13 +1651,13 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1638
1651
  section: null,
1639
1652
  fields: []
1640
1653
  }];
1641
- for (let e of w?.fields ?? []) e.type === "section" ? j.push({
1654
+ for (let e of Array.isArray(w?.fields) ? w.fields : []) e.type === "section" ? j.push({
1642
1655
  section: e,
1643
1656
  fields: []
1644
1657
  }) : 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) => ({
1658
+ let M = j.filter((e) => e.section || e.fields.length), N = M.filter((e) => !e.section || $e(e.section.condition, E)).map((e) => ({
1646
1659
  ...e,
1647
- fields: e.fields.filter((e) => Xe(e.condition, E))
1660
+ fields: e.fields.filter((e) => $e(e.condition, E))
1648
1661
  })), 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
1662
  let t = E[e.name];
1650
1663
  return e.required && (t == null || t === "" || t === !1);
@@ -1698,11 +1711,11 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1698
1711
  }
1699
1712
  },
1700
1713
  style: {
1701
- ...Ke,
1714
+ ...Ye,
1702
1715
  display: A === "success" ? "none" : "flex"
1703
1716
  },
1704
1717
  children: f && d ? /* @__PURE__ */ l(s, { children: [
1705
- P && /* @__PURE__ */ c(ft, {
1718
+ P && /* @__PURE__ */ c(ht, {
1706
1719
  steps: N.map((e) => ({ label: e.section?.label ?? "Start" })),
1707
1720
  active: F + 1,
1708
1721
  style: { marginBottom: 8 }
@@ -1715,7 +1728,7 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1715
1728
  },
1716
1729
  children: N[F].section.help
1717
1730
  }),
1718
- I.map((e) => /* @__PURE__ */ c($e, {
1731
+ I.map((e) => /* @__PURE__ */ c(nt, {
1719
1732
  field: e,
1720
1733
  value: E[e.name],
1721
1734
  onChange: z,
@@ -1733,7 +1746,7 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1733
1746
  disabled: g || void 0,
1734
1747
  onClick: () => k(F - 1),
1735
1748
  style: {
1736
- ...J,
1749
+ ...Y,
1737
1750
  background: "transparent",
1738
1751
  color: "inherit",
1739
1752
  border: 0,
@@ -1746,7 +1759,7 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1746
1759
  disabled: g || L.length > 0,
1747
1760
  onClick: () => k(F + 1),
1748
1761
  style: {
1749
- ...J,
1762
+ ...Y,
1750
1763
  border: 0,
1751
1764
  padding: "10px 22px",
1752
1765
  borderRadius: 8,
@@ -1760,7 +1773,7 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1760
1773
  type: "submit",
1761
1774
  disabled: g || void 0,
1762
1775
  style: {
1763
- ...J,
1776
+ ...Y,
1764
1777
  border: 0,
1765
1778
  padding: "10px 22px",
1766
1779
  borderRadius: 8,
@@ -1787,17 +1800,17 @@ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d,
1787
1800
  ]
1788
1801
  });
1789
1802
  }
1790
- function tt({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1803
+ function it({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1791
1804
  return /* @__PURE__ */ c("label", {
1792
1805
  ref: r,
1793
1806
  style: {
1794
- ...qe,
1807
+ ...Xe,
1795
1808
  ...p(n)
1796
1809
  },
1797
1810
  children: X(t, e, i)
1798
1811
  });
1799
1812
  }
1800
- function nt({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1813
+ function at({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1801
1814
  return /* @__PURE__ */ c("input", {
1802
1815
  ref: a,
1803
1816
  type: e,
@@ -1808,10 +1821,10 @@ function nt({ type: e = "text", name: t, placeholder: n, required: r, style: i,
1808
1821
  ...Q,
1809
1822
  ...p(i)
1810
1823
  },
1811
- ...Ye(o)
1824
+ ...Qe(o)
1812
1825
  });
1813
1826
  }
1814
- function rt({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1827
+ function ot({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1815
1828
  return /* @__PURE__ */ c("textarea", {
1816
1829
  ref: a,
1817
1830
  name: e || void 0,
@@ -1823,14 +1836,14 @@ function rt({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeR
1823
1836
  resize: "vertical",
1824
1837
  ...p(i)
1825
1838
  },
1826
- ...Ye(o)
1839
+ ...Qe(o)
1827
1840
  });
1828
1841
  }
1829
- function it({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
1842
+ function st({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
1830
1843
  return /* @__PURE__ */ l("label", {
1831
1844
  ref: o,
1832
1845
  style: {
1833
- ...Je,
1846
+ ...Ze,
1834
1847
  ...p(a)
1835
1848
  },
1836
1849
  children: [/* @__PURE__ */ c("input", {
@@ -1847,7 +1860,7 @@ function it({ kind: e = "checkbox", label: t, name: n, value: r, required: i, st
1847
1860
  }), t]
1848
1861
  });
1849
1862
  }
1850
- function at({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1863
+ function ct({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1851
1864
  return /* @__PURE__ */ l("select", {
1852
1865
  ref: a,
1853
1866
  name: e || void 0,
@@ -1870,7 +1883,7 @@ function at({ name: e, placeholder: t, options: n = [], required: r, style: i, n
1870
1883
  }, t))]
1871
1884
  });
1872
1885
  }
1873
- function ot({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
1886
+ function lt({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
1874
1887
  let [u, d] = o(null);
1875
1888
  return /* @__PURE__ */ l("label", {
1876
1889
  ref: a,
@@ -1902,12 +1915,12 @@ function ot({ name: e, accept: t, required: n, text: r = "Choose a file…", sty
1902
1915
  ]
1903
1916
  });
1904
1917
  }
1905
- function st({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1918
+ function ut({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1906
1919
  return /* @__PURE__ */ c("button", {
1907
1920
  ref: n,
1908
1921
  type: r ? "button" : "submit",
1909
1922
  style: {
1910
- ...J,
1923
+ ...Y,
1911
1924
  border: 0,
1912
1925
  cursor: "pointer",
1913
1926
  alignSelf: "flex-start",
@@ -1922,7 +1935,7 @@ function st({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1922
1935
  children: e
1923
1936
  });
1924
1937
  }
1925
- function ct({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1938
+ function dt({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1926
1939
  let a = Math.max(1, (Number(e) || 1) * (Number(t) || 1));
1927
1940
  return /* @__PURE__ */ c("div", {
1928
1941
  ref: r,
@@ -1939,12 +1952,12 @@ function ct({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1939
1952
  }, t))
1940
1953
  });
1941
1954
  }
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);
1955
+ function ft({ 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 }) {
1956
+ let { tenant: _, apiUrl: v } = n(H), y = n(W), b = n(U)?.[e], [x, S] = o(null);
1944
1957
  if (r(() => {
1945
1958
  if (!e || b) return;
1946
1959
  let t = !0, n = e.startsWith("api:") ? `${v}/data/${encodeURIComponent(e.slice(4))}` : `${v}/dynamic/${encodeURIComponent(e)}`;
1947
- return fetch(n, { headers: _ ? { "x-tenant": _ } : {} }).then((e) => e.json()).then((e) => t && S(Array.isArray(e?.payload) ? e.payload : [])).catch(() => t && S([])), () => {
1960
+ return fetch(n, { headers: _ ? { "x-tenant": _ } : {} }).then((e) => e.json()).then((e) => t && S(Array.isArray(e?.payload) ? e.payload.filter((e) => e && typeof e == "object") : [])).catch(() => t && S([])), () => {
1948
1961
  t = !1;
1949
1962
  };
1950
1963
  }, [
@@ -1971,7 +1984,7 @@ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
1971
1984
  },
1972
1985
  children: C.map((e) => /* @__PURE__ */ c("div", {
1973
1986
  style: { minWidth: 0 },
1974
- children: y.render(m, (t) => ae(t, e))
1987
+ children: y.render(m, (t) => se(t, e))
1975
1988
  }, e.id ?? e?.data?.slug))
1976
1989
  }) : /* @__PURE__ */ c("div", {
1977
1990
  ref: g,
@@ -1981,7 +1994,7 @@ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
1981
1994
  ...p(h)
1982
1995
  },
1983
1996
  children: C.map((e) => {
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";
1997
+ let t = s ? G(e?.data, s) : null, n = u ? K(G(e?.data, u)) : null, r = d ? G(e?.data, d) : null, a = Array.isArray(r) ? r : null, o = a || r == null ? null : K(r), f = i === "list";
1985
1998
  return /* @__PURE__ */ l("div", {
1986
1999
  style: {
1987
2000
  display: "flex",
@@ -2028,7 +2041,7 @@ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
2028
2041
  lineHeight: 1.55,
2029
2042
  opacity: .85
2030
2043
  },
2031
- children: ve(a)
2044
+ children: xe(a)
2032
2045
  })
2033
2046
  ]
2034
2047
  })]
@@ -2036,7 +2049,7 @@ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
2036
2049
  })
2037
2050
  });
2038
2051
  }
2039
- function ut({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
2052
+ function pt({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
2040
2053
  return e.length ? /* @__PURE__ */ c("nav", {
2041
2054
  ref: r,
2042
2055
  "aria-label": "Breadcrumb",
@@ -2086,7 +2099,7 @@ function ut({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
2086
2099
  })
2087
2100
  }) : null;
2088
2101
  }
2089
- function dt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
2102
+ function mt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
2090
2103
  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) => ({
2091
2104
  display: "inline-flex",
2092
2105
  alignItems: "center",
@@ -2139,7 +2152,7 @@ function dt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", sty
2139
2152
  ]
2140
2153
  });
2141
2154
  }
2142
- function ft({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
2155
+ function ht({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
2143
2156
  if (!t.length) return null;
2144
2157
  let o = Math.min(Math.max(Number(n) || 1, 1), t.length), s = (e) => ({
2145
2158
  width: 32,
@@ -2217,8 +2230,8 @@ function ft({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef:
2217
2230
  })
2218
2231
  });
2219
2232
  }
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);
2233
+ function gt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped: s = !0, bordered: u = !1, compact: d = !1, style: f, nodeRef: m }) {
2234
+ let { tenant: h, apiUrl: g } = n(H), _ = n(U)?.[i], [v, y] = o(null);
2222
2235
  if (r(() => {
2223
2236
  if (!i || _) return;
2224
2237
  let e = !0, t = i.startsWith("api:") ? `${g}/data/${encodeURIComponent(i.slice(4))}` : `${g}/dynamic/${encodeURIComponent(i)}`;
@@ -2231,7 +2244,7 @@ function pt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped:
2231
2244
  g,
2232
2245
  _
2233
2246
  ]), !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 };
2247
+ let b = i ? (_ ?? v ?? []).slice(0, Math.max(1, Number(a) || 10)) : null, x = b ? b.map((t) => e.map((e) => K(G(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 };
2235
2248
  return /* @__PURE__ */ c("div", {
2236
2249
  ref: m,
2237
2250
  style: {
@@ -2268,52 +2281,52 @@ function pt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped:
2268
2281
  })
2269
2282
  });
2270
2283
  }
2271
- var mt = {
2272
- PageRoot: le,
2273
- Section: ue,
2274
- Container: de,
2275
- Heading: fe,
2276
- TextBlock: Ce,
2277
- ButtonBlock: Ee,
2278
- ImageBlock: De,
2279
- Spacer: Ne,
2280
- Divider: Pe,
2281
- SliderBlock: Be,
2282
- CanvasSlider: Ve,
2283
- TabsBlock: We,
2284
- QuickStack: ct,
2285
- CollectionList: lt,
2286
- BreadcrumbsBlock: ut,
2287
- PaginationBlock: dt,
2288
- StepperBlock: ft,
2289
- TableBlock: pt,
2290
- AccordionBlock: Ge,
2291
- NavbarBlock: Ue,
2292
- ListBlock: Se,
2293
- TextSpan: he,
2294
- QuoteBlock: xe,
2295
- TextLink: Te,
2296
- RichTextBlock: ye,
2297
- RichContentBlock: ye,
2298
- VideoBlock: Oe,
2299
- YouTubeBlock: Ae,
2300
- IframeBlock: je,
2301
- EmbedBlock: Me,
2302
- FormBlock: et,
2303
- FormLabel: tt,
2304
- FormInput: nt,
2305
- FormTextarea: rt,
2306
- FormCheckbox: (e) => /* @__PURE__ */ c(it, {
2284
+ var _t = {
2285
+ PageRoot: fe,
2286
+ Section: pe,
2287
+ Container: me,
2288
+ Heading: he,
2289
+ TextBlock: Ee,
2290
+ ButtonBlock: ke,
2291
+ ImageBlock: Ae,
2292
+ Spacer: Ie,
2293
+ Divider: Le,
2294
+ SliderBlock: Ue,
2295
+ CanvasSlider: We,
2296
+ TabsBlock: qe,
2297
+ QuickStack: dt,
2298
+ CollectionList: ft,
2299
+ BreadcrumbsBlock: pt,
2300
+ PaginationBlock: mt,
2301
+ StepperBlock: ht,
2302
+ TableBlock: gt,
2303
+ AccordionBlock: Je,
2304
+ NavbarBlock: Ke,
2305
+ ListBlock: Te,
2306
+ TextSpan: ve,
2307
+ QuoteBlock: we,
2308
+ TextLink: Oe,
2309
+ RichTextBlock: Se,
2310
+ RichContentBlock: Se,
2311
+ VideoBlock: je,
2312
+ YouTubeBlock: Ne,
2313
+ IframeBlock: Pe,
2314
+ EmbedBlock: Fe,
2315
+ FormBlock: rt,
2316
+ FormLabel: it,
2317
+ FormInput: at,
2318
+ FormTextarea: ot,
2319
+ FormCheckbox: (e) => /* @__PURE__ */ c(st, {
2307
2320
  kind: "checkbox",
2308
2321
  ...e
2309
2322
  }),
2310
- FormRadio: (e) => /* @__PURE__ */ c(it, {
2323
+ FormRadio: (e) => /* @__PURE__ */ c(st, {
2311
2324
  kind: "radio",
2312
2325
  ...e
2313
2326
  }),
2314
- FormSelect: at,
2315
- FormFile: ot,
2316
- FormSubmit: st
2327
+ FormSelect: ct,
2328
+ FormFile: lt,
2329
+ FormSubmit: ut
2317
2330
  };
2318
2331
  //#endregion
2319
2332
  //#region ../ui/src/components/builder/render.jsx
@@ -2327,7 +2340,7 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
2327
2340
  let l = new Set(i).add(n);
2328
2341
  return /* @__PURE__ */ c(e, { children: $(s.template.rootId, s.template.nodes, r, l, a) }, t);
2329
2342
  }
2330
- let u = mt[s];
2343
+ let u = _t[s];
2331
2344
  if (!u) return null;
2332
2345
  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;
2333
2346
  return /* @__PURE__ */ c(u, {
@@ -2342,74 +2355,79 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
2342
2355
  }
2343
2356
  //#endregion
2344
2357
  //#region ../ui/src/components/builder/PageRenderer.jsx
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 }) {
2347
- let p = s?.js?.trim();
2358
+ var vt = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
2359
+ function yt({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, custom: s, tenant: u, apiUrl: d, datasets: f, locale: p, direction: m }) {
2360
+ let h = s?.js?.trim();
2348
2361
  if (r(() => {
2349
- if (!p) return;
2362
+ if (!h) return;
2350
2363
  let e = document.createElement("script");
2351
- return e.text = p, document.body.appendChild(e), () => e.remove();
2352
- }, [p]), !e?.ROOT) return null;
2353
- let m = {
2364
+ return e.text = h, document.body.appendChild(e), () => e.remove();
2365
+ }, [h]), !e?.ROOT) return null;
2366
+ let g = {
2367
+ lang: p || void 0,
2368
+ dir: ie(m, p)
2369
+ }, _ = {
2354
2370
  minHeight: "100%",
2355
2371
  display: "flex",
2356
2372
  flexDirection: "column"
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", {
2373
+ }, v = $("ROOT", e, n), y = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), b = T(e, n), x = w(e, n), S = s?.css?.trim(), C = B(e, n).map((e) => /* @__PURE__ */ c("link", {
2358
2374
  rel: "stylesheet",
2359
2375
  precedence: "default",
2360
2376
  href: te(e)
2361
2377
  }, e));
2362
- if (a !== "auto") return /* @__PURE__ */ c(V.Provider, {
2378
+ if (a !== "auto") return /* @__PURE__ */ c(H.Provider, {
2363
2379
  value: {
2364
2380
  tenant: u || "",
2365
2381
  apiUrl: d || "/api"
2366
2382
  },
2367
- children: /* @__PURE__ */ c(H.Provider, {
2383
+ children: /* @__PURE__ */ c(U.Provider, {
2368
2384
  value: f ?? null,
2369
- children: /* @__PURE__ */ c(U.Provider, {
2370
- value: g,
2385
+ children: /* @__PURE__ */ c(W.Provider, {
2386
+ value: y,
2371
2387
  children: /* @__PURE__ */ l("div", {
2388
+ ...g,
2372
2389
  style: {
2373
- ...m,
2390
+ ..._,
2374
2391
  ...F(t, a),
2375
2392
  ...o
2376
2393
  },
2377
2394
  children: [
2378
- b,
2379
- _ && /* @__PURE__ */ c("style", { children: _ }),
2380
- v && /* @__PURE__ */ c("style", { children: v }),
2381
- y && /* @__PURE__ */ c("style", { children: y }),
2382
- h
2395
+ C,
2396
+ b && /* @__PURE__ */ c("style", { children: b }),
2397
+ x && /* @__PURE__ */ c("style", { children: x }),
2398
+ S && /* @__PURE__ */ c("style", { children: S }),
2399
+ v
2383
2400
  ]
2384
2401
  })
2385
2402
  })
2386
2403
  })
2387
2404
  });
2388
- let x = M(t);
2389
- return /* @__PURE__ */ c(V.Provider, {
2405
+ let E = M(t);
2406
+ return /* @__PURE__ */ c(H.Provider, {
2390
2407
  value: {
2391
2408
  tenant: u || "",
2392
2409
  apiUrl: d || "/api"
2393
2410
  },
2394
- children: /* @__PURE__ */ c(H.Provider, {
2411
+ children: /* @__PURE__ */ c(U.Provider, {
2395
2412
  value: f ?? null,
2396
- children: /* @__PURE__ */ c(U.Provider, {
2397
- value: g,
2413
+ children: /* @__PURE__ */ c(W.Provider, {
2414
+ value: y,
2398
2415
  children: /* @__PURE__ */ l("div", {
2416
+ ...g,
2399
2417
  className: "webim-page",
2400
2418
  style: {
2401
- ...m,
2419
+ ..._,
2402
2420
  ...P(t),
2403
2421
  ...o
2404
2422
  },
2405
2423
  children: [
2406
- /* @__PURE__ */ c("style", { children: `.webim-page { ${ht(N(x.light))} }
2407
- @media (prefers-color-scheme: dark) { .webim-page { ${ht(N(x.dark))} } }` }),
2408
- b,
2409
- _ && /* @__PURE__ */ c("style", { children: _ }),
2410
- v && /* @__PURE__ */ c("style", { children: v }),
2411
- y && /* @__PURE__ */ c("style", { children: y }),
2412
- h
2424
+ /* @__PURE__ */ c("style", { children: `.webim-page { ${vt(N(E.light))} }
2425
+ @media (prefers-color-scheme: dark) { .webim-page { ${vt(N(E.dark))} } }` }),
2426
+ C,
2427
+ b && /* @__PURE__ */ c("style", { children: b }),
2428
+ x && /* @__PURE__ */ c("style", { children: x }),
2429
+ S && /* @__PURE__ */ c("style", { children: S }),
2430
+ v
2413
2431
  ]
2414
2432
  })
2415
2433
  })
@@ -2418,8 +2436,8 @@ function gt({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
2418
2436
  }
2419
2437
  //#endregion
2420
2438
  //#region src/WebimContent.jsx
2421
- function _t({ bundle: e, mode: t = "auto", style: n }) {
2422
- return e?.blocks?.ROOT ? /* @__PURE__ */ c(gt, {
2439
+ function bt({ bundle: e, mode: t = "auto", style: n }) {
2440
+ return e?.blocks?.ROOT ? /* @__PURE__ */ c(yt, {
2423
2441
  blocks: e.blocks,
2424
2442
  theme: e.theme,
2425
2443
  components: e.components,
@@ -2427,13 +2445,15 @@ function _t({ bundle: e, mode: t = "auto", style: n }) {
2427
2445
  tenant: e.tenant,
2428
2446
  apiUrl: e.apiUrl,
2429
2447
  datasets: e.datasets,
2448
+ locale: e.locale,
2449
+ direction: e.direction,
2430
2450
  mode: t,
2431
2451
  style: n
2432
2452
  }) : null;
2433
2453
  }
2434
2454
  //#endregion
2435
2455
  //#region src/WebimPage.jsx
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 }) {
2456
+ function xt({ 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 }) {
2437
2457
  let [h, g] = o({ status: "loading" }), _ = a({
2438
2458
  onLoad: p,
2439
2459
  onError: m
@@ -2468,11 +2488,11 @@ function vt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "a
2468
2488
  n,
2469
2489
  i,
2470
2490
  s
2471
- ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(_t, {
2491
+ ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(bt, {
2472
2492
  bundle: h.bundle,
2473
2493
  mode: l,
2474
2494
  style: u
2475
2495
  });
2476
2496
  }
2477
2497
  //#endregion
2478
- export { gt as PageRenderer, _t as WebimContent, vt as WebimPage, z as fetchPage, ve as renderRichContent, I as resolveTheme };
2498
+ export { yt as PageRenderer, bt as WebimContent, xt as WebimPage, z as fetchPage, xe as renderRichContent, I as resolveTheme };