@bravostudioai/react 0.1.13 → 0.1.15

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,92 +1,93 @@
1
- import { jsx as f, jsxs as it, Fragment as ut } from "react/jsx-runtime";
2
- import v, { useContext as j, useMemo as zt, useState as Ht, useCallback as Vt } from "react";
3
- import Q from "./contexts/EncoreBindingContext.js";
4
- import z from "./stores/useEncoreState.js";
1
+ import { jsx as p, jsxs as it, Fragment as ut } from "react/jsx-runtime";
2
+ import v, { useContext as N, useMemo as Ht, useState as Vt, useCallback as Nt } from "react";
3
+ import tt from "./contexts/EncoreBindingContext.js";
4
+ import k from "./stores/useEncoreState.js";
5
5
  import lt from "./contexts/EncoreComponentIdContext.js";
6
- import Nt from "axios";
7
- import Lt from "./contexts/EncoreActionContext.js";
8
- import Ot from "./contexts/EncoreRepeatingContainerContext.js";
9
- const ct = v.createContext({}), O = v.createContext(
6
+ import Ot from "axios";
7
+ import ht from "./contexts/EncoreActionContext.js";
8
+ import Mt from "./contexts/EncoreRepeatingContainerContext.js";
9
+ const ct = v.createContext({}), V = v.createContext(
10
10
  {}
11
- ), st = (t) => t.replace(/#(\w{2})(\w{6})/, "#$2$1"), Mt = (t) => t.slice(1, 3) === "00", Gt = (t) => {
11
+ ), st = (t) => t.replace(/#(\w{2})(\w{6})/, "#$2$1"), Gt = (t) => t.slice(1, 3) === "00", jt = (t) => {
12
12
  if (!Array.isArray(t)) return null;
13
13
  const r = t.find((o) => o.startsWith("input-group:"));
14
14
  if (!r) return null;
15
15
  const e = r.split(":");
16
16
  return e.length >= 3 ? { type: e[1], groupName: e[2] } : null;
17
17
  }, rt = () => {
18
- const [t, r] = Ht({ width: 0, height: 0 }), e = v.useRef(null);
18
+ const [t, r] = Vt({ width: 0, height: 0 }), e = v.useRef(null);
19
19
  return v.useEffect(() => {
20
20
  if (!e.current) return;
21
21
  const o = e.current, i = () => {
22
- const { width: a, height: n } = o.getBoundingClientRect();
23
- r({ width: a, height: n });
22
+ const { width: n, height: m } = o.getBoundingClientRect();
23
+ r({ width: n, height: m });
24
24
  };
25
25
  i(), requestAnimationFrame(() => {
26
26
  i();
27
27
  });
28
- const d = new ResizeObserver((a) => {
29
- for (const n of a) {
30
- const c = n.contentRect;
31
- r({ width: c.width, height: c.height });
28
+ const l = new ResizeObserver((n) => {
29
+ for (const m of n) {
30
+ const s = m.contentRect;
31
+ r({ width: s.width, height: s.height });
32
32
  }
33
33
  });
34
- return d.observe(o), () => d.disconnect();
34
+ return l.observe(o), () => l.disconnect();
35
35
  }, []), { dimensions: t, ref: e };
36
- }, R = (t, r = {}) => {
37
- let e = !1;
38
- const o = j(ct), i = j(O), d = {
36
+ }, L = (t, r = {}) => {
37
+ const e = N(ct), o = N(V), i = {
39
38
  width: window.innerWidth,
40
39
  height: window.innerHeight
41
- }, a = Vt(
42
- (s) => (i.dimensions?.width ?? 0) * 0.01 * s,
43
- [i.dimensions?.width]
40
+ }, l = Nt(
41
+ (a) => (o.dimensions?.width ?? 0) * 0.01 * a,
42
+ [o.dimensions?.width]
44
43
  ), n = {};
45
44
  r = { debug: !1, ...r };
46
- const c = z((s) => s.fontsById || {});
47
- if (z((s) => s.fontsByIdFull || {}), !t) return;
48
- const y = i.dimensions?.width ?? d.width, x = i.dimensions?.height ?? d.height;
49
- if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width && y > 0 && (n.width = t.width * y * 0.01), t.aspectRatio && t.width ? y > 0 && (n.height = t.width * y * 0.01 / t.aspectRatio) : t.height && x > 0 && (n.height = t.height * x * 0.01)), !(i?.isFlex ?? !1) && t.positioning) {
50
- const s = t.layout?.layoutSizingHorizontal === "FIXED" || t.layout?.layoutSizingVertical === "FIXED", g = s && t.positioning.top < 0 ? 0 : t.positioning.top, I = s && t.positioning.left < 0 ? 0 : t.positioning.left;
51
- if (s && t.layout?.layoutSizingHorizontal === "FIXED" && t.layout?.size?.x) {
52
- const T = t.layout.size.x, E = o.scaleFactor ?? 1, l = T * E, W = i?.dimensions?.width;
53
- W && typeof W == "number" && W > 0 && l / W >= 0.95 && I >= 15 && I <= 35 && (e = !0);
45
+ const m = k((a) => a.fontsById || {});
46
+ if (k((a) => a.fontsByIdFull || {}), !t || !t) return;
47
+ const s = o.dimensions?.width ?? i.width, y = o.dimensions?.height ?? i.height;
48
+ if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width && s > 0 && (n.width = t.width * s * 0.01), t.aspectRatio && t.width ? s > 0 && (n.height = t.width * s * 0.01 / t.aspectRatio) : t.height && y > 0 && (n.height = t.height * y * 0.01)), !(o?.isFlex ?? !1) && t.positioning) {
49
+ const a = t.layout?.layoutSizingHorizontal === "FIXED" || t.layout?.layoutSizingVertical === "FIXED", u = a && t.positioning.top < 0 ? 0 : t.positioning.top, R = a && t.positioning.left < 0 ? 0 : t.positioning.left;
50
+ let w = !1;
51
+ if (t.horizontalPosition === "center" && (w = !0), !w && a && t.layout?.layoutSizingHorizontal === "FIXED" && t.layout?.size?.x) {
52
+ const B = t.layout.size.x, z = e.scaleFactor ?? 1, f = B * z, S = o?.dimensions?.width;
53
+ S && typeof S == "number" && S > 0 && f / S >= 0.95 && R >= 15 && R <= 35 && (w = !0);
54
54
  }
55
- n.top = `${g}%`;
56
- const A = !!t.inset;
57
- if (e)
58
- if (A) {
59
- const T = String(t.inset).split(/\s+/);
60
- T.length === 3 ? n.inset = `${T[0]} 50% ${T[2]} auto` : T.length === 4 && (n.inset = `${T[0]} 50% ${T[2]} auto`), delete n.left, delete n.right;
55
+ n.top = `${u}%`;
56
+ const x = !!t.inset;
57
+ if (w) {
58
+ if (x) {
59
+ const B = String(t.inset).split(/\s+/);
60
+ B.length === 3 ? n.inset = `${B[0]} 50% ${B[2]} auto` : B.length === 4 && (n.inset = `${B[0]} 50% ${B[2]} auto`), delete n.left, delete n.right;
61
61
  } else
62
62
  n.left = "50%", n.right = "auto";
63
- else
64
- A ? n.inset = t.inset : n.left = `${I}%`;
65
- s ? (n.right = "auto", n.bottom = "auto") : (t.positioning.bottom !== void 0 && (n.bottom = `${t.positioning.bottom}%`), t.positioning.right !== void 0 && (n.right = `${t.positioning.right}%`)), n.position = "absolute";
63
+ n.transform = "translateX(-50%)";
64
+ } else
65
+ x ? n.inset = t.inset : n.left = `${R}%`;
66
+ a ? (n.right = "auto", n.bottom = "auto") : (t.positioning.bottom !== void 0 && (n.bottom = `${t.positioning.bottom}%`), t.positioning.right !== void 0 && (n.right = `${t.positioning.right}%`)), n.position = "absolute";
66
67
  }
67
68
  if (t.layout?.padding) {
68
- const s = o.scaleFactor ?? 1, g = t.layout.padding;
69
- g.top !== void 0 && (n.paddingTop = g.top * s), g.right !== void 0 && (n.paddingRight = g.right * s), g.bottom !== void 0 && (n.paddingBottom = g.bottom * s), g.left !== void 0 && (n.paddingLeft = g.left * s);
69
+ const a = e.scaleFactor ?? 1, u = t.layout.padding;
70
+ u.top !== void 0 && (n.paddingTop = u.top * a), u.right !== void 0 && (n.paddingRight = u.right * a), u.bottom !== void 0 && (n.paddingBottom = u.bottom * a), u.left !== void 0 && (n.paddingLeft = u.left * a);
70
71
  }
71
72
  if (t.layout?.mode) {
72
73
  n.display = "flex";
73
- const s = (E) => E ? {
74
+ const a = (B) => B ? {
74
75
  MIN: "flex-start",
75
76
  MAX: "flex-end",
76
77
  CENTER: "center",
77
78
  SPACE_BETWEEN: "space-between",
78
79
  SPACE_AROUND: "space-around",
79
80
  SPACE_EVENLY: "space-evenly"
80
- }[E] || E.toLowerCase().replace(/_/g, "-") : void 0;
81
- t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent = s(
81
+ }[B] || B.toLowerCase().replace(/_/g, "-") : void 0;
82
+ t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent = a(
82
83
  t.layout.primaryAxisAlignItems
83
- ), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent = s(
84
+ ), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent = a(
84
85
  t.layout.primaryAxisAlignItems
85
86
  ), n.alignItems = t.layout.counterAxisAlignItems), n.flexGrow = t.layout.grow, t.layout.wrap === "NO_WRAP" ? n.flexWrap = "nowrap" : t.layout.flexWrap ? n.flexWrap = t.layout.flexWrap : n.flexWrap = "wrap";
86
- const g = t.layout.itemSpacing, I = o.scaleFactor ?? 1, T = t.layout.primaryAxisAlignItems === "SPACE_BETWEEN" ? 0 : (g !== void 0 ? g : 0) * I;
87
- n.gap = T === 0 ? "0px" : `${T}px`, n.rowGap = T === 0 ? "0px" : `${T}px`, n.columnGap = T === 0 ? "0px" : `${T}px`, (n.flexWrap === "wrap" || n.flexWrap === "wrap-reverse") && (n.alignContent = "flex-start"), r.debug || t.layout?.mode === "HORIZONTAL" && g === 0 ? console.log("[useEncoreStyle] Setting gap properties:", {
88
- itemSpacing: g,
89
- spacing: T,
87
+ const u = t.layout.itemSpacing, R = e.scaleFactor ?? 1, x = t.layout.primaryAxisAlignItems === "SPACE_BETWEEN" ? 0 : (u !== void 0 ? u : 0) * R;
88
+ n.gap = x === 0 ? "0px" : `${x}px`, n.rowGap = x === 0 ? "0px" : `${x}px`, n.columnGap = x === 0 ? "0px" : `${x}px`, (n.flexWrap === "wrap" || n.flexWrap === "wrap-reverse") && (n.alignContent = "flex-start"), r.debug || t.layout?.mode === "HORIZONTAL" && u === 0 ? console.log("[useEncoreStyle] Setting gap properties:", {
89
+ itemSpacing: u,
90
+ spacing: x,
90
91
  gap: n.gap,
91
92
  rowGap: n.rowGap,
92
93
  columnGap: n.columnGap,
@@ -96,54 +97,40 @@ const ct = v.createContext({}), O = v.createContext(
96
97
  "[useEncoreStyle] No gap properties set",
97
98
  r.debug,
98
99
  t.layout?.mode,
99
- g
100
+ u
100
101
  );
101
102
  }
102
103
  if (t.layout?.layoutSizingHorizontal === "FILL" && (n.width = "100%"), t.layout?.layoutSizingHorizontal === "FIXED") {
103
- const s = o.scaleFactor ?? 1;
104
- n.width = t.layout.size.x * s;
104
+ const a = e.scaleFactor ?? 1;
105
+ n.width = t.layout.size.x * a;
105
106
  }
106
- if (t.layout?.layoutSizingVertical === "FIXED") {
107
- const s = o.scaleFactor ?? 1;
108
- n.height = t.layout.size.y * s;
107
+ if (t.layout?.layoutSizingHorizontal, t.layout?.layoutSizingVertical === "FIXED") {
108
+ const a = e.scaleFactor ?? 1;
109
+ n.height = t.layout.size.y * a;
109
110
  }
110
111
  if (t.layout?.layoutSizingVertical === "FILL")
111
- if (!(i?.isFlex ?? !1) && t.positioning && t.positioning?.top !== void 0) {
112
- const A = 100 - t.positioning.top;
113
- n.height = `${A}%`;
112
+ if (!(o?.isFlex ?? !1) && t.positioning && t.positioning?.top !== void 0) {
113
+ const w = 100 - t.positioning.top;
114
+ n.height = `${w}%`;
114
115
  } else
115
116
  n.height = "100%";
116
- if (t.layout?.layoutSizingVertical, t.backgroundColor && !Mt(t.backgroundColor) && (n.backgroundColor = st(t.backgroundColor)), t.color && (n.color = st(t.color)), t.lineHeightPx && (n.lineHeight = (t.lineHeightPx * (o.scaleFactor ?? 1)).toString() + "px"), t.fontSize && (n.fontSize = t.fontSize * (o.scaleFactor ?? 1)), t.fontWeight && (n.fontWeight = `${t.fontWeight}`), t.opacity && (n.opacity = t.opacity * 0.01), t.fontId) {
117
- const s = c[t.fontId] || "sans-serif";
118
- n.fontFamily = `"${s}"`, console.log("[AG_DEBUG] [useEncoreStyle] Font Resolution:", {
117
+ if (t.layout?.layoutSizingVertical, t.backgroundColor && !Gt(t.backgroundColor) && (n.backgroundColor = st(t.backgroundColor)), t.color && (n.color = st(t.color)), t.lineHeightPx && (n.lineHeight = (t.lineHeightPx * (e.scaleFactor ?? 1)).toString() + "px"), t.fontSize && (n.fontSize = t.fontSize * (e.scaleFactor ?? 1)), t.fontWeight && (n.fontWeight = `${t.fontWeight}`), t.opacity && (n.opacity = t.opacity * 0.01), t.fontId) {
118
+ const a = m[t.fontId] || "sans-serif";
119
+ n.fontFamily = `"${a}"`, console.log("[AG_DEBUG] [useEncoreStyle] Font Resolution:", {
119
120
  fontId: t.fontId,
120
- resolvedFamily: s,
121
+ resolvedFamily: a,
121
122
  fontWeight: t.fontWeight,
122
123
  finalStyle: n.fontFamily
123
124
  });
124
125
  }
125
- if (t.borderRadius && (n.borderRadius = a(t.borderRadius)), t.cornerRadii) {
126
- const s = t.cornerRadii.map(a);
127
- n.borderTopLeftRadius = s[0], n.borderTopRightRadius = s[1], n.borderBottomRightRadius = s[2], n.borderBottomLeftRadius = s[3], delete n.borderRadius;
128
- }
129
- if (t.borderWidth && (t.borderWidth > 5 ? n.borderWidth = t.borderWidth * 0.5 : n.borderWidth = t.borderWidth * 1.5), t.borderColor && (n.borderColor = st(t.borderColor)), (t.borderWidth || t.borderColor) && (n.borderStyle = "solid"), t.rotation && (n.transform = `rotate(${t.rotation}deg)`), e) {
130
- const s = n.transform || "";
131
- if (n.transform = s ? `${s} translateX(-50%)` : "translateX(-50%)", n.inset) {
132
- const g = String(n.inset).split(/\s+/);
133
- g.length === 3 ? n.inset = `${g[0]} 50% ${g[2]} auto` : g.length === 4 && (n.inset = `${g[0]} 50% ${g[2]} auto`);
134
- } else if (t.inset) {
135
- const g = String(t.inset).split(/\s+/);
136
- g.length === 3 ? n.inset = `${g[0]} 50% ${g[2]} auto` : g.length === 4 && (n.inset = `${g[0]} 50% ${g[2]} auto`);
137
- }
138
- }
139
- if (t.textCase === "upper" && (n.textTransform = "uppercase"), t.textCase === "lower" && (n.textTransform = "lowercase"), t.letterSpacing && (n.letterSpacing = t.letterSpacing), t.textAlign && (n.textAlign = t.textAlign), r.debug && (n.borderWidth = 1, n.borderColor = "#FF0000FF", n.borderStyle = "solid"), e && (n.inset || t.inset)) {
140
- const s = n.inset || t.inset, g = String(s).split(/\s+/);
141
- g.length === 3 ? n.inset = `${g[0]} 50% ${g[2]} auto` : g.length === 4 && (n.inset = `${g[0]} 50% ${g[2]} auto`);
126
+ if (t.borderRadius && (n.borderRadius = l(t.borderRadius)), t.cornerRadii) {
127
+ const a = t.cornerRadii.map(l);
128
+ n.borderTopLeftRadius = a[0], n.borderTopRightRadius = a[1], n.borderBottomRightRadius = a[2], n.borderBottomLeftRadius = a[3], delete n.borderRadius;
142
129
  }
143
- return n;
144
- }, tt = ({ id: t, nodeData: r }) => {
145
- const e = j(Q), o = e?.nodeData?.[t], { patch: i, list: d } = o ?? { list: null, patch: null }, n = Array.isArray(r?.tags) && (r.tags.includes("encore:data:array") || r.tags.includes("bravo:data:array")) && e?.arrayDataById && e.arrayDataById[t] && Array.isArray(e.arrayDataById[t]) ? e.arrayDataById[t] : null;
146
- let c = i ? {
130
+ return t.borderWidth && (t.borderWidth > 5 ? n.borderWidth = t.borderWidth * 0.5 : n.borderWidth = t.borderWidth * 1.5), t.borderColor && (n.borderColor = st(t.borderColor)), (t.borderWidth || t.borderColor) && (n.borderStyle = "solid"), t.rotation && (n.transform = `rotate(${t.rotation}deg)`), t.textCase === "upper" && (n.textTransform = "uppercase"), t.textCase === "lower" && (n.textTransform = "lowercase"), t.letterSpacing && (n.letterSpacing = t.letterSpacing), t.textAlign && (n.textAlign = t.textAlign), r.debug && (n.borderWidth = 1, n.borderColor = "#FF0000FF", n.borderStyle = "solid"), n;
131
+ }, et = ({ id: t, nodeData: r }) => {
132
+ const e = N(tt), o = e?.nodeData?.[t], { patch: i, list: l } = o ?? { list: null, patch: null }, m = Array.isArray(r?.tags) && (r.tags.includes("encore:data:array") || r.tags.includes("bravo:data:array")) && e?.arrayDataById && e.arrayDataById[t] && Array.isArray(e.arrayDataById[t]) ? e.arrayDataById[t] : null;
133
+ let s = i ? {
147
134
  ...r,
148
135
  ...i || {},
149
136
  ...i && i.data ? { data: { ...r?.data || {}, ...i.data } } : {},
@@ -151,97 +138,97 @@ const ct = v.createContext({}), O = v.createContext(
151
138
  actions: i.actions && Array.isArray(i.actions) && i.actions.length > 0 ? i.actions : r.actions || i.actions || []
152
139
  } : r;
153
140
  const y = e?.textOverridesById && e.textOverridesById[t] !== void 0 ? e.textOverridesById[t] : void 0;
154
- y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (c = {
155
- ...c,
156
- data: { ...c?.data || {}, text: String(y) }
141
+ y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (s = {
142
+ ...s,
143
+ data: { ...s?.data || {}, text: String(y) }
157
144
  });
158
- const x = Array.isArray(r?.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")), h = e?.rootData;
159
- h && h[t] && typeof h[t] == "object" && (c = {
160
- ...c,
145
+ const I = Array.isArray(r?.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")), h = e?.rootData;
146
+ h && h[t] && typeof h[t] == "object" && (s = {
147
+ ...s,
161
148
  data: {
162
- ...c.data || {},
149
+ ...s.data || {},
163
150
  ...h[t]
164
151
  }
165
152
  });
166
- const b = e?.nodeData && typeof e.nodeData == "object";
167
- if (x || b) {
168
- const s = e?.nodeData;
169
- if (s && typeof s == "object") {
170
- if (s[t] !== void 0) {
171
- const I = s[t];
172
- I && typeof I == "object" && c.data && (c = {
173
- ...c,
153
+ const a = e?.nodeData && typeof e.nodeData == "object";
154
+ if (I || a) {
155
+ const u = e?.nodeData;
156
+ if (u && typeof u == "object") {
157
+ if (u[t] !== void 0) {
158
+ const w = u[t];
159
+ w && typeof w == "object" && s.data && (s = {
160
+ ...s,
174
161
  data: {
175
- ...c.data,
176
- ...I
162
+ ...s.data,
163
+ ...w
177
164
  }
178
165
  });
179
- } else if (x && s.description && c.data && (c = {
180
- ...c,
166
+ } else if (I && u.description && s.data && (s = {
167
+ ...s,
181
168
  data: {
182
- ...c.data,
183
- text: s.description
169
+ ...s.data,
170
+ text: u.description
184
171
  }
185
- }), s.image && c.data) {
186
- const I = s.image.startsWith("//") ? `https:${s.image}` : s.image;
187
- c = {
188
- ...c,
172
+ }), u.image && s.data) {
173
+ const w = u.image.startsWith("//") ? `https:${u.image}` : u.image;
174
+ s = {
175
+ ...s,
189
176
  data: {
190
- ...c.data,
191
- imageUrl: I
177
+ ...s.data,
178
+ imageUrl: w
192
179
  }
193
180
  };
194
181
  }
195
- c.encoreData = s;
182
+ s.encoreData = u;
196
183
  }
197
184
  }
198
185
  return {
199
186
  patch: i,
200
- list: d || n,
187
+ list: l || m,
201
188
  // Use arrayData if list is not provided
202
- patchedNodeData: c,
203
- arrayData: n
189
+ patchedNodeData: s,
190
+ arrayData: m
204
191
  // Also return separately for components that need it
205
192
  };
206
- }, q = ({
193
+ }, Y = ({
207
194
  id: t,
208
195
  nodeData: r,
209
196
  children: e,
210
197
  _parentStatefulSetId: o,
211
198
  _parentInputGroupInfo: i,
212
- _parentName: d
199
+ _parentName: l
213
200
  }) => {
214
- const a = z((l) => l.baseURL), n = z((l) => l.appId);
215
- z((l) => l.pageId);
216
- const { onAction: c } = v.useContext(Lt), { statefulSetId: y } = v.useContext(
201
+ const n = k((f) => f.baseURL), m = k((f) => f.appId);
202
+ k((f) => f.pageId);
203
+ const { onAction: s } = v.useContext(ht), { statefulSetId: y } = v.useContext(
217
204
  lt
218
- ), x = o || y, { patchedNodeData: h } = tt({ id: t, nodeData: r }), b = z(
219
- (l) => l.setStatefulSetVariant
220
- ), s = z(
221
- (l) => l.setInputGroupValue
222
- ), g = z((l) => l.setAccessToken), { app: I } = z((l) => l.app);
223
- I.data?.app?.startPageId, I.data?.app?.PageId;
224
- const A = R(
205
+ ), I = o || y, { patchedNodeData: h } = et({ id: t, nodeData: r }), a = k(
206
+ (f) => f.setStatefulSetVariant
207
+ ), u = k(
208
+ (f) => f.setInputGroupValue
209
+ ), R = k((f) => f.setAccessToken), { app: w } = k((f) => f.app);
210
+ w.data?.app?.startPageId, w.data?.app?.PageId;
211
+ const x = L(
225
212
  {
226
213
  positioning: r.style?.positioning
227
214
  },
228
215
  { debug: !1 }
229
216
  );
230
- A.zIndex = 99999, A.backgroundColor = "transparent", A.position = "absolute", A.top = "0", A.left = "0", A.right = "0", A.bottom = "0", A.width = "100%", A.height = "100%", A.pointerEvents = "auto", A.isolation = "isolate";
231
- const T = async (l) => {
232
- let W = !1;
233
- const U = () => {
234
- W = !1;
217
+ x.zIndex = 99999, x.backgroundColor = "transparent", x.position = "absolute", x.top = "0", x.left = "0", x.right = "0", x.bottom = "0", x.width = "100%", x.height = "100%", x.pointerEvents = "auto", x.isolation = "isolate";
218
+ const B = async (f) => {
219
+ let S = !1;
220
+ const O = () => {
221
+ S = !1;
235
222
  };
236
- if (typeof c == "function")
223
+ if (typeof s == "function")
237
224
  try {
238
- await c({ bravo: { cancel: U, action: l } }), W = !0;
225
+ await s({ bravo: { cancel: O, action: f, componentId: t } }), S = !0;
239
226
  } catch {
240
227
  }
241
228
  else
242
- W = !0;
243
- if (W)
244
- switch (l.action) {
229
+ S = !0;
230
+ if (S)
231
+ switch (f.action) {
245
232
  case "login":
246
233
  // TODO firebase
247
234
  // TODO oauth
@@ -251,7 +238,7 @@ const ct = v.createContext({}), O = v.createContext(
251
238
  case "submit":
252
239
  break;
253
240
  case "email":
254
- window.location.href = `mailto:${l.params.email}`;
241
+ window.location.href = `mailto:${f.params.email}`;
255
242
  break;
256
243
  case "goback":
257
244
  break;
@@ -260,32 +247,32 @@ const ct = v.createContext({}), O = v.createContext(
260
247
  case "homepage":
261
248
  break;
262
249
  case "logout":
263
- g(void 0);
250
+ R(void 0);
264
251
  break;
265
252
  case "none":
266
253
  break;
267
254
  case "openurl":
268
- window.open(l.params.url, "_blank");
255
+ window.open(f.params.url, "_blank");
269
256
  break;
270
257
  case "phone":
271
- window.location.href = `tel:${l.params.phone}`;
258
+ window.location.href = `tel:${f.params.phone}`;
272
259
  break;
273
260
  case "remote":
274
- const M = btoa(JSON.stringify(l.params?.data || {})), Z = `${a}/devices/apps/${n}/node/${t}/trigger/${l.event}?params=${M}`, H = await Nt.post(Z);
275
- H.data?.action && await T(H.data);
261
+ const M = btoa(JSON.stringify(f.params?.data || {})), j = `${n}/devices/apps/${m}/node/${t}/trigger/${f.event}?params=${M}`, K = await Ot.post(j);
262
+ K.data?.action && await B(K.data);
276
263
  break;
277
264
  case "set-access-token":
278
- g(l.params);
265
+ R(f.params);
279
266
  break;
280
267
  case "set-state":
281
- if (i && d)
268
+ if (i && l)
282
269
  if (console.log("🔵 Input group change:", {
283
270
  groupName: i.groupName,
284
- elementName: d,
285
- hasOnAction: typeof c == "function"
286
- }), s(i.groupName, d), typeof c == "function")
271
+ elementName: l,
272
+ hasOnAction: typeof s == "function"
273
+ }), u(i.groupName, l), typeof s == "function")
287
274
  try {
288
- await c({
275
+ await s({
289
276
  bravo: {
290
277
  cancel: () => {
291
278
  },
@@ -294,50 +281,51 @@ const ct = v.createContext({}), O = v.createContext(
294
281
  params: {
295
282
  groupName: i.groupName,
296
283
  groupType: i.type,
297
- value: d
284
+ value: l
298
285
  },
299
286
  event: "tap"
300
- }
287
+ },
288
+ componentId: t
301
289
  }
302
290
  }), console.log("✅ Input group change event fired");
303
- } catch (P) {
304
- console.error("❌ Error in onAction callback:", P);
291
+ } catch (E) {
292
+ console.error("❌ Error in onAction callback:", E);
305
293
  }
306
294
  else
307
295
  console.warn("⚠️ No onAction callback provided");
308
296
  else {
309
- let P = x || l.params?.stateSetId || h.data?.stateSetId;
310
- if (!P) {
297
+ let E = I || f.params?.stateSetId || h.data?.stateSetId;
298
+ if (!E) {
311
299
  console.error("❌ No stateSetId found in action or nodeData!", {
312
- actionParams: l.params,
300
+ actionParams: f.params,
313
301
  nodeDataStateSetId: h.data?.stateSetId,
314
- parentStatefulSetId: x
302
+ parentStatefulSetId: I
315
303
  });
316
304
  break;
317
305
  }
318
- b(P, l.params.state);
306
+ a(E, f.params.state);
319
307
  }
320
308
  break;
321
309
  case "showalert":
322
- alert(l.params.message);
310
+ alert(f.params.message);
323
311
  break;
324
312
  default:
325
- console.log(l), alert(l.action);
313
+ console.log(f), alert(f.action);
326
314
  }
327
315
  };
328
316
  if (r.href)
329
317
  return /* @__PURE__ */ it(ut, { children: [
330
- /* @__PURE__ */ f(
318
+ /* @__PURE__ */ p(
331
319
  "button",
332
320
  {
333
321
  type: "button",
334
- onClick: () => T({
322
+ onClick: () => B({
335
323
  action: "goto",
336
324
  params: { href: r.href },
337
325
  event: "tap"
338
326
  }),
339
327
  style: {
340
- ...A,
328
+ ...x,
341
329
  cursor: "pointer",
342
330
  background: "transparent",
343
331
  border: "none",
@@ -348,17 +336,17 @@ const ct = v.createContext({}), O = v.createContext(
348
336
  ),
349
337
  e
350
338
  ] });
351
- let E = h.actions && h.actions.length > 0 ? h.actions : r.actions || [];
352
- if (x && E.length > 0 && (E = E.map((l) => l.action === "set-state" ? (l.params?.stateSetId, {
353
- ...l,
339
+ let z = h.actions && h.actions.length > 0 ? h.actions : r.actions || [];
340
+ if (I && z.length > 0 && (z = z.map((f) => f.action === "set-state" ? (f.params?.stateSetId, {
341
+ ...f,
354
342
  params: {
355
- ...l.params,
356
- stateSetId: x
343
+ ...f.params,
344
+ stateSetId: I
357
345
  // Always use parent's id
358
346
  }
359
- }) : l)), E.length === 0 && (h.data?.stateSetId || x))
360
- if (i && d)
361
- E = [
347
+ }) : f)), z.length === 0 && (h.data?.stateSetId || I))
348
+ if (i && l)
349
+ z = [
362
350
  {
363
351
  action: "set-state",
364
352
  params: {
@@ -369,13 +357,13 @@ const ct = v.createContext({}), O = v.createContext(
369
357
  }
370
358
  ];
371
359
  else {
372
- const l = x || h.data.stateSetId;
373
- l ? E = [
360
+ const f = I || h.data.stateSetId;
361
+ f ? z = [
374
362
  {
375
363
  action: "set-state",
376
364
  params: {
377
- state: z.getState().statefulSetVariants[l] === "active" ? "default" : "active",
378
- stateSetId: l
365
+ state: k.getState().statefulSetVariants[f] === "active" ? "default" : "active",
366
+ stateSetId: f
379
367
  // Use parent's id or button's stateSetId
380
368
  },
381
369
  event: "tap"
@@ -385,29 +373,29 @@ const ct = v.createContext({}), O = v.createContext(
385
373
  { id: t, name: r.name }
386
374
  );
387
375
  }
388
- if (E && E.length > 0) {
389
- const l = E[0];
390
- return l.event !== "tap" ? e : /* @__PURE__ */ it(ut, { children: [
376
+ if (z && z.length > 0) {
377
+ const f = z[0];
378
+ return f.event !== "tap" ? e : /* @__PURE__ */ it(ut, { children: [
391
379
  e,
392
- /* @__PURE__ */ f(
380
+ /* @__PURE__ */ p(
393
381
  "div",
394
382
  {
395
- onClick: (W) => {
396
- W.stopPropagation(), T(l);
383
+ onClick: (S) => {
384
+ S.stopPropagation(), B(f);
397
385
  },
398
- onMouseDown: (W) => W.stopPropagation(),
399
- onMouseUp: (W) => W.stopPropagation(),
400
- style: { ...A, cursor: "pointer", pointerEvents: "auto" }
386
+ onMouseDown: (S) => S.stopPropagation(),
387
+ onMouseUp: (S) => S.stopPropagation(),
388
+ style: { ...x, cursor: "pointer", pointerEvents: "auto" }
401
389
  }
402
390
  )
403
391
  ] });
404
392
  }
405
393
  return e;
406
394
  }, ft = ({ id: t, name: r, nodeData: e }) => {
407
- const o = R(e.style, {
395
+ const o = L(e.style, {
408
396
  debug: !1
409
397
  });
410
- return /* @__PURE__ */ f(
398
+ return /* @__PURE__ */ p(
411
399
  "iframe",
412
400
  {
413
401
  "data-id": t,
@@ -417,86 +405,86 @@ const ct = v.createContext({}), O = v.createContext(
417
405
  src: e.data?.params?.url
418
406
  }
419
407
  );
420
- }, ht = ({ id: t, name: r, nodeData: e }) => {
421
- const o = R(e.style, {
408
+ }, gt = ({ id: t, name: r, nodeData: e }) => {
409
+ const o = L(e.style, {
422
410
  debug: !1
423
411
  });
424
412
  if (!o.backgroundColor && !o.borderColor)
425
413
  return null;
426
414
  if (o.borderColor && !o.backgroundColor && (o.backgroundColor = "transparent"), o.borderColor && o.borderWidth) {
427
- const x = Math.max(o.borderWidth || 0, 1);
428
- (!o.width || typeof o.width == "number" && o.width === 0) && (o.width = x), (!o.height || typeof o.height == "number" && o.height === 0) && (o.height = x), o.boxSizing = "border-box";
415
+ const I = Math.max(o.borderWidth || 0, 1);
416
+ (!o.width || typeof o.width == "number" && o.width === 0) && (o.width = I), (!o.height || typeof o.height == "number" && o.height === 0) && (o.height = I), o.boxSizing = "border-box";
429
417
  }
430
- const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), d = j(O)?.isFlex ?? !1, a = e.style?.positioning, n = a && typeof a.top == "number" && typeof a.left == "number" && typeof a.right == "number" && typeof a.bottom == "number" && a.top === 0 && a.left === 0 && a.right === 0 && a.bottom === 0, c = i && (d || n), y = r && r.toLowerCase().startsWith("clip");
431
- return c && (o.position = "absolute", o.top = 0, o.left = 0, o.right = 0, o.bottom = 0, o.zIndex = -1, o.width && typeof o.width == "string" && o.width.includes("%") && delete o.width, o.height && typeof o.height == "string" && o.height.includes("%") && delete o.height), y && (o.backgroundColor = "transparent"), /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f("div", { "data-name": r, "data-type": "ColorComponent", style: o }) });
432
- }, gt = ({
418
+ const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), l = N(V)?.isFlex ?? !1, n = e.style?.positioning, m = n && typeof n.top == "number" && typeof n.left == "number" && typeof n.right == "number" && typeof n.bottom == "number" && n.top === 0 && n.left === 0 && n.right === 0 && n.bottom === 0, s = i && (l || m), y = r && r.toLowerCase().startsWith("clip");
419
+ return s && (o.position = "absolute", o.top = 0, o.left = 0, o.right = 0, o.bottom = 0, o.zIndex = -1, o.width && typeof o.width == "string" && o.width.includes("%") && delete o.width, o.height && typeof o.height == "string" && o.height.includes("%") && delete o.height), y && (o.backgroundColor = "transparent"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p("div", { "data-name": r, "data-type": "ColorComponent", style: o }) });
420
+ }, mt = ({
433
421
  id: t,
434
422
  name: r,
435
423
  nodeData: e
436
424
  }) => {
437
- const o = R(e.style, {
425
+ const o = L(e.style, {
438
426
  debug: !1
439
- }), i = e.style, d = Array.isArray(i?.gradientColorStops) ? i.gradientColorStops.map((a) => {
440
- if (!a?.color) return null;
441
- const n = st(a.color);
442
- if (typeof a.position == "number") {
443
- const c = a.position * 100;
444
- return `${n} ${c}%`;
427
+ }), i = e.style, l = Array.isArray(i?.gradientColorStops) ? i.gradientColorStops.map((n) => {
428
+ if (!n?.color) return null;
429
+ const m = st(n.color);
430
+ if (typeof n.position == "number") {
431
+ const s = n.position * 100;
432
+ return `${m} ${s}%`;
445
433
  }
446
- return n;
434
+ return m;
447
435
  }).filter(Boolean).join(", ") : "";
448
- if (d) {
449
- const a = i?.gradientType || "linear";
450
- o.backgroundImage = a === "radial" ? `radial-gradient(${d})` : `linear-gradient(${d})`, delete o.backgroundColor;
436
+ if (l) {
437
+ const n = i?.gradientType || "linear";
438
+ o.backgroundImage = n === "radial" ? `radial-gradient(${l})` : `linear-gradient(${l})`, delete o.backgroundColor;
451
439
  }
452
- return /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f("div", { "data-name": r, "data-type": "GradientComponent", style: o }) });
453
- }, mt = ({ id: t, name: r, nodeData: e }) => {
454
- const { patchedNodeData: o } = tt({ id: t, nodeData: e });
440
+ return /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p("div", { "data-name": r, "data-type": "GradientComponent", style: o }) });
441
+ }, yt = ({ id: t, name: r, nodeData: e }) => {
442
+ const { patchedNodeData: o } = et({ id: t, nodeData: e });
455
443
  e = o;
456
- const i = R(e.style, {
444
+ const i = L(e.style, {
457
445
  debug: !1
458
- }), d = j(O), a = z((s) => s.assetsById), n = e.style?.scaleMode || "fill";
459
- n === "fill" ? i.objectFit = "cover" : n === "fit" && (i.objectFit = "contain"), i.objectPosition = "center";
460
- let c = e.data?.imageUrl;
461
- !c && e.encoreData?.image && (c = e.encoreData.image.startsWith("//") ? `https:${e.encoreData.image}` : e.encoreData.image), c || (c = a[e.assetId]?.url);
462
- const y = e.style?.positioning, x = e.style?.aspectRatio, h = d.dimensions?.width || 0, b = d.dimensions?.height || 0;
463
- if (y && x && h > 0) {
464
- const s = typeof y.left == "number" && typeof y.right == "number", g = typeof y.top == "number" && typeof y.bottom == "number";
465
- if (s) {
466
- const I = 100 - y.left - y.right;
467
- if (I > 0) {
468
- const A = I * h / 100;
469
- i.width = A, i.height = A / x, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
446
+ }), l = N(V), n = k((u) => u.assetsById), m = e.style?.scaleMode || "fill";
447
+ m === "fill" ? i.objectFit = "cover" : m === "fit" && (i.objectFit = "contain"), i.objectPosition = "center";
448
+ let s = e.data?.imageUrl;
449
+ !s && e.encoreData?.image && (s = e.encoreData.image.startsWith("//") ? `https:${e.encoreData.image}` : e.encoreData.image), s || (s = n[e.assetId]?.url);
450
+ const y = e.style?.positioning, I = e.style?.aspectRatio, h = l.dimensions?.width || 0, a = l.dimensions?.height || 0;
451
+ if (y && I && h > 0) {
452
+ const u = typeof y.left == "number" && typeof y.right == "number", R = typeof y.top == "number" && typeof y.bottom == "number";
453
+ if (u) {
454
+ const w = 100 - y.left - y.right;
455
+ if (w > 0) {
456
+ const x = w * h / 100;
457
+ i.width = x, i.height = x / I, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
470
458
  }
471
- } else if (g && b > 0) {
472
- const I = 100 - y.top - y.bottom;
473
- if (I > 0) {
474
- const A = I * b / 100;
475
- i.height = A, i.width = A * x, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
459
+ } else if (R && a > 0) {
460
+ const w = 100 - y.top - y.bottom;
461
+ if (w > 0) {
462
+ const x = w * a / 100;
463
+ i.height = x, i.width = x * I, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
476
464
  }
477
465
  }
478
466
  }
479
- return /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f(
467
+ return /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
480
468
  "img",
481
469
  {
482
470
  "data-id": t,
483
471
  "data-name": r,
484
472
  "data-type": "ImageComponent",
485
473
  style: i,
486
- src: c || a[e.assetId]?.url,
474
+ src: s || n[e.assetId]?.url,
487
475
  alt: r
488
476
  }
489
477
  ) });
490
- }, yt = ({
478
+ }, bt = ({
491
479
  id: t,
492
480
  name: r,
493
481
  nodeData: e
494
482
  }) => {
495
- const o = z((d) => d.setFormInputValue), i = R(e.style, { debug: !1 });
496
- return /* @__PURE__ */ f(
483
+ const o = k((l) => l.setFormInputValue), i = L(e.style, { debug: !1 });
484
+ return /* @__PURE__ */ p(
497
485
  "input",
498
486
  {
499
- onChange: (d) => o(t, d.target.value),
487
+ onChange: (l) => o(t, l.target.value),
500
488
  "data-id": t,
501
489
  "data-name": r,
502
490
  "data-type": "EmailInputComponent",
@@ -505,13 +493,13 @@ const ct = v.createContext({}), O = v.createContext(
505
493
  type: "email"
506
494
  }
507
495
  );
508
- }, bt = ({
496
+ }, Ct = ({
509
497
  id: t,
510
498
  name: r,
511
499
  nodeData: e
512
500
  }) => {
513
- const o = R(e.style);
514
- return o.visibility = "hidden", /* @__PURE__ */ f(
501
+ const o = L(e.style);
502
+ return o.visibility = "hidden", /* @__PURE__ */ p(
515
503
  "input",
516
504
  {
517
505
  "data-id": t,
@@ -521,43 +509,43 @@ const ct = v.createContext({}), O = v.createContext(
521
509
  type: "hidden"
522
510
  }
523
511
  );
524
- }, Ct = ({
512
+ }, St = ({
525
513
  id: t,
526
514
  name: r,
527
515
  nodeData: e
528
516
  }) => {
529
- const o = z((a) => a.setFormInputValue), i = R(e.style, { debug: !1 }), d = z((a) => a.assetsById);
517
+ const o = k((n) => n.setFormInputValue), i = L(e.style, { debug: !1 }), l = k((n) => n.assetsById);
530
518
  return /* @__PURE__ */ it(ut, { children: [
531
- /* @__PURE__ */ f(
519
+ /* @__PURE__ */ p(
532
520
  "div",
533
521
  {
534
522
  style: { ...i, zIndex: 9999, cursor: "pointer" },
535
523
  onClick: () => alert("Image picker")
536
524
  }
537
525
  ),
538
- /* @__PURE__ */ f(
526
+ /* @__PURE__ */ p(
539
527
  "img",
540
528
  {
541
- onChange: (a) => o(t, a.target.value),
529
+ onChange: (n) => o(t, n.target.value),
542
530
  style: i,
543
531
  "data-id": t,
544
532
  "data-name": r,
545
533
  "data-type": "ImageInputComponent",
546
- src: d[e.assetId]?.url,
534
+ src: l[e.assetId]?.url,
547
535
  alt: r
548
536
  }
549
537
  )
550
538
  ] });
551
- }, St = ({
539
+ }, xt = ({
552
540
  id: t,
553
541
  name: r,
554
542
  nodeData: e
555
543
  }) => {
556
- const o = z((d) => d.setFormInputValue), i = R(e.style, { debug: !1 });
557
- return /* @__PURE__ */ f(
544
+ const o = k((l) => l.setFormInputValue), i = L(e.style, { debug: !1 });
545
+ return /* @__PURE__ */ p(
558
546
  "input",
559
547
  {
560
- onChange: (d) => o(t, d.target.value),
548
+ onChange: (l) => o(t, l.target.value),
561
549
  "data-id": t,
562
550
  "data-name": r,
563
551
  "data-type": "PasswordInputComponent",
@@ -566,25 +554,25 @@ const ct = v.createContext({}), O = v.createContext(
566
554
  type: "password"
567
555
  }
568
556
  );
569
- }, xt = ({
557
+ }, vt = ({
570
558
  id: t,
571
559
  name: r,
572
560
  nodeData: e
573
561
  }) => {
574
- const o = z((h) => h.setFormInputValue), { onAction: i } = v.useContext(Lt), { patchedNodeData: d } = tt({ id: t, nodeData: e }), a = R(d.style, { debug: !1 });
575
- a.width = "100%", a.flex = "1", a.minWidth = "0", a.boxSizing = "border-box", a.borderColor = a.borderColor ?? "transparent";
576
- const n = d.data?.value, c = d.data?.options, y = v.useMemo(() => !c || !Array.isArray(c) ? [] : c.map((h) => typeof h == "string" ? { value: h, label: h } : h), [c]);
562
+ const o = k((h) => h.setFormInputValue), { onAction: i } = v.useContext(ht), { patchedNodeData: l } = et({ id: t, nodeData: e }), n = L(l.style, { debug: !1 });
563
+ n.width = "100%", n.flex = "1", n.minWidth = "0", n.boxSizing = "border-box", n.borderColor = n.borderColor ?? "transparent";
564
+ const m = l.data?.value, s = l.data?.options, y = v.useMemo(() => !s || !Array.isArray(s) ? [] : s.map((h) => typeof h == "string" ? { value: h, label: h } : h), [s]);
577
565
  return /* @__PURE__ */ it(
578
566
  "select",
579
567
  {
580
568
  "data-id": t,
581
569
  "data-name": r,
582
570
  "data-type": "SelectInputComponent",
583
- value: n ?? "",
584
- style: a,
571
+ value: m ?? "",
572
+ style: n,
585
573
  onChange: async (h) => {
586
- const b = h.target.value;
587
- if (o(t, b), console.log(`Select changed: ${b}`), typeof i == "function")
574
+ const a = h.target.value;
575
+ if (o(t, a), console.log(`Select changed: ${a}`), typeof i == "function")
588
576
  try {
589
577
  await i({
590
578
  bravo: {
@@ -593,31 +581,32 @@ const ct = v.createContext({}), O = v.createContext(
593
581
  action: {
594
582
  action: "select-change",
595
583
  nodeId: t,
596
- params: { value: b }
597
- }
584
+ params: { value: a }
585
+ },
586
+ componentId: t
598
587
  }
599
588
  });
600
589
  } catch {
601
590
  }
602
591
  },
603
592
  children: [
604
- y.length === 0 && /* @__PURE__ */ f("option", { value: "", disabled: !0, children: "Select an option..." }),
605
- y.map((h) => /* @__PURE__ */ f("option", { value: h.value, children: h.label }, h.value))
593
+ y.length === 0 && /* @__PURE__ */ p("option", { value: "", disabled: !0, children: "Select an option..." }),
594
+ y.map((h) => /* @__PURE__ */ p("option", { value: h.value, children: h.label }, h.value))
606
595
  ]
607
596
  }
608
597
  );
609
- }, vt = ({
598
+ }, It = ({
610
599
  id: t,
611
600
  name: r,
612
601
  nodeData: e
613
602
  }) => {
614
- const o = z((d) => d.setFormInputValue), i = R(e.style, {
603
+ const o = k((l) => l.setFormInputValue), i = L(e.style, {
615
604
  debug: !1
616
605
  });
617
- return /* @__PURE__ */ f(
606
+ return /* @__PURE__ */ p(
618
607
  "input",
619
608
  {
620
- onChange: (d) => o(t, d.target.value),
609
+ onChange: (l) => o(t, l.target.value),
621
610
  name: t,
622
611
  "data-id": t,
623
612
  "data-name": r,
@@ -627,9 +616,9 @@ const ct = v.createContext({}), O = v.createContext(
627
616
  type: "text"
628
617
  }
629
618
  );
630
- }, It = ({ id: t, name: r, nodeData: e }) => {
631
- const o = R(e.style);
632
- return /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f(
619
+ }, wt = ({ id: t, name: r, nodeData: e }) => {
620
+ const o = L(e.style);
621
+ return /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
633
622
  "div",
634
623
  {
635
624
  "data-id": t,
@@ -639,11 +628,11 @@ const ct = v.createContext({}), O = v.createContext(
639
628
  children
640
629
  }
641
630
  ) });
642
- }, wt = ({ id: t, name: r, nodeData: e }) => {
643
- const o = R(e.style, {
631
+ }, At = ({ id: t, name: r, nodeData: e }) => {
632
+ const o = L(e.style, {
644
633
  debug: !1
645
- }), i = z((d) => d.assetsById);
646
- return /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f(
634
+ }), i = k((l) => l.assetsById);
635
+ return /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
647
636
  "img",
648
637
  {
649
638
  "data-id": t,
@@ -654,8 +643,8 @@ const ct = v.createContext({}), O = v.createContext(
654
643
  alt: r
655
644
  }
656
645
  ) });
657
- }, At = ({ id: t, name: r, nodeData: e }) => {
658
- const { patchedNodeData: o } = tt({ id: t, nodeData: e });
646
+ }, Et = ({ id: t, name: r, nodeData: e }) => {
647
+ const { patchedNodeData: o } = et({ id: t, nodeData: e });
659
648
  e = o;
660
649
  const i = e.data?.text;
661
650
  r && r.includes("Purpose") && console.log("TextComponent Debug:", {
@@ -665,24 +654,24 @@ const ct = v.createContext({}), O = v.createContext(
665
654
  style: e.style,
666
655
  color: e.style?.color
667
656
  });
668
- const d = e.style, a = e.fontId ? { ...d, fontId: e.fontId } : d, n = R(a, {
657
+ const l = e.style, n = e.fontId ? { ...l, fontId: e.fontId } : l, m = L(n, {
669
658
  debug: !1
670
659
  });
671
- n.display = "flex", n.flexDirection = "column", d.verticalPosition && (n.justifyContent = {
660
+ m.display = "flex", m.flexDirection = "column", l.verticalPosition && (m.justifyContent = {
672
661
  "from-top": "flex-start",
673
662
  center: "center",
674
663
  "from-bottom": "flex-end"
675
- }[d.verticalPosition]);
676
- const c = i && (i.includes(`
664
+ }[l.verticalPosition]);
665
+ const s = i && (i.includes(`
677
666
  `) || i.includes("\r"));
678
667
  let y;
679
- return c && n.flexDirection === "column" ? y = i.split(/\r?\n/).filter((h) => h.length > 0).map((h, b) => /* @__PURE__ */ f("div", { style: { lineHeight: "inherit" }, children: h }, b)) : y = i, /* @__PURE__ */ f(q, { id: t, nodeData: e, children: /* @__PURE__ */ f(
668
+ return s && m.flexDirection === "column" ? y = i.split(/\r?\n/).filter((h) => h.length > 0).map((h, a) => /* @__PURE__ */ p("div", { style: { lineHeight: "inherit" }, children: h }, a)) : y = i, /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
680
669
  "div",
681
670
  {
682
671
  "data-id": t,
683
672
  "data-name": r,
684
673
  "data-type": "TextComponent",
685
- style: n,
674
+ style: m,
686
675
  children: y
687
676
  }
688
677
  ) });
@@ -692,82 +681,82 @@ const ct = v.createContext({}), O = v.createContext(
692
681
  nodeData: e,
693
682
  children: o
694
683
  }) => {
695
- const i = j(Q), { patchedNodeData: d } = tt({ id: t, nodeData: e });
696
- e = d;
697
- const a = Gt(e.tags), n = a ? z((I) => I.inputGroups[a.groupName]) : null, c = z((I) => I.statefulSetVariants[t]), y = R(e.style, {
684
+ const i = N(tt), { patchedNodeData: l } = et({ id: t, nodeData: e });
685
+ e = l;
686
+ const n = jt(e.tags), m = n ? k((w) => w.inputGroups[n.groupName]) : null, s = k((w) => w.statefulSetVariants[t]), y = L(e.style, {
698
687
  debug: !1
699
688
  });
700
- let x;
701
- a && n !== null ? x = n === r ? "active" : "default" : x = c || e.data.initialState || "default";
702
- const h = v.Children.toArray(o).find((I) => v.isValidElement(I) ? I.props?.nodeData?.data?.state === x : !1), b = v.isValidElement(h) ? v.cloneElement(h, {
689
+ let I;
690
+ n && m !== null ? I = m === r ? "active" : "default" : I = s || e.data.initialState || "default";
691
+ const h = v.Children.toArray(o).find((w) => v.isValidElement(w) ? w.props?.nodeData?.data?.state === I : !1), a = v.isValidElement(h) ? v.cloneElement(h, {
703
692
  _parentStatefulSetId: t,
704
- _parentInputGroupInfo: a,
693
+ _parentInputGroupInfo: n,
705
694
  _parentName: r
706
695
  // Pass the name so we can identify which element is active
707
- }) : h, s = /* @__PURE__ */ f(
696
+ }) : h, u = /* @__PURE__ */ p(
708
697
  "div",
709
698
  {
710
699
  "data-id": t,
711
700
  "data-name": r,
712
701
  "data-type": "StatefulSetComponent",
713
702
  style: y,
714
- children: b
703
+ children: a
715
704
  }
716
705
  );
717
706
  if (e.type === "component:input-stateful-set")
718
- return s;
719
- const g = v.useContext(lt);
720
- return /* @__PURE__ */ f(
721
- Q.Provider,
707
+ return u;
708
+ const R = v.useContext(lt);
709
+ return /* @__PURE__ */ p(
710
+ tt.Provider,
722
711
  {
723
712
  value: { nodeData: i?.nodeData?.[t] || {} },
724
- children: /* @__PURE__ */ f(
713
+ children: /* @__PURE__ */ p(
725
714
  lt.Provider,
726
715
  {
727
- value: { ...g, statefulSetId: t },
728
- children: s
716
+ value: { ...R, statefulSetId: t },
717
+ children: u
729
718
  }
730
719
  )
731
720
  }
732
721
  );
733
- }, Et = ({
722
+ }, Ft = ({
734
723
  id: t,
735
724
  name: r,
736
725
  nodeData: e,
737
726
  children: o,
738
727
  _parentStatefulSetId: i,
739
- _parentInputGroupInfo: d,
740
- _parentName: a
728
+ _parentInputGroupInfo: l,
729
+ _parentName: n
741
730
  }) => {
742
- const n = R(e.style, {
731
+ const m = L(e.style, {
743
732
  debug: !1
744
- }), c = {
745
- ...n,
746
- position: n.position || "relative"
733
+ }), s = {
734
+ ...m,
735
+ position: m.position || "relative"
747
736
  };
748
- return /* @__PURE__ */ f(
737
+ return /* @__PURE__ */ p(
749
738
  "div",
750
739
  {
751
740
  "data-id": t,
752
741
  "data-name": r,
753
742
  "data-type": "StatefulCompoundComponent",
754
- style: c,
755
- children: /* @__PURE__ */ f(
756
- q,
743
+ style: s,
744
+ children: /* @__PURE__ */ p(
745
+ Y,
757
746
  {
758
747
  id: t,
759
748
  nodeData: e,
760
749
  _parentStatefulSetId: i,
761
- _parentInputGroupInfo: d,
762
- _parentName: a,
750
+ _parentInputGroupInfo: l,
751
+ _parentName: n,
763
752
  children: o
764
753
  }
765
754
  )
766
755
  }
767
756
  );
768
- }, Ft = ({ id: t, name: r, children: e }) => {
769
- j(O);
770
- const { dimensions: o, ref: i } = rt(), d = {
757
+ }, Tt = ({ id: t, name: r, children: e }) => {
758
+ N(V);
759
+ const { dimensions: o, ref: i } = rt(), l = {
771
760
  zIndex: 0,
772
761
  flex: 1,
773
762
  position: "absolute",
@@ -776,14 +765,14 @@ const ct = v.createContext({}), O = v.createContext(
776
765
  width: "100%",
777
766
  height: "100%"
778
767
  };
779
- return /* @__PURE__ */ f(O.Provider, { value: { dimensions: o, isFlex: !1 }, children: /* @__PURE__ */ f(
768
+ return /* @__PURE__ */ p(V.Provider, { value: { dimensions: o, isFlex: !1 }, children: /* @__PURE__ */ p(
780
769
  "div",
781
770
  {
782
771
  "data-id": t,
783
772
  "data-name": r,
784
773
  "data-type": "BackgroundContainerComponent",
785
774
  ref: i,
786
- style: d,
775
+ style: l,
787
776
  children: e
788
777
  }
789
778
  ) });
@@ -793,57 +782,57 @@ const ct = v.createContext({}), O = v.createContext(
793
782
  nodeData: e,
794
783
  children: o,
795
784
  _arrayItemIndex: i,
796
- _arrayItemData: d
785
+ _arrayItemData: l
797
786
  }) => {
798
787
  t === "01KB929X1KK5TX0K8VBNP6ZDPG" && console.log(
799
788
  `[DEBUG] ContainerComponent ${t} (Hero) FULL nodeData:`,
800
789
  JSON.stringify(e, null, 2)
801
790
  );
802
- const a = j(Q), { patchedNodeData: n, list: c, arrayData: y } = tt({
791
+ const n = N(tt), { patchedNodeData: m, list: s, arrayData: y } = et({
803
792
  id: t,
804
793
  nodeData: e
805
794
  });
806
- e = n;
807
- const { dimensions: x, ref: h } = rt(), b = R(e.style, {
795
+ e = m;
796
+ const { dimensions: I, ref: h } = rt(), a = L(e.style, {
808
797
  debug: !1
809
- }), s = !!e.style.layout?.mode, g = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", I = b.width !== void 0, A = b.height !== void 0, T = j(O), E = T?.isFlex ?? !1, l = T?.flexDirection, W = E && l === "row", U = !E && e.style.positioning, M = e.style.layout?.layoutSizingHorizontal === "FIXED" || e.style.layout?.layoutSizingVertical === "FIXED", Z = e.style.layout?.layoutSizingHorizontal === "HUG" || e.style.layout?.layoutSizingVertical === "HUG";
810
- if (!I && !W && !(U && (M || Z)) && (b.width = "100%"), !A) {
811
- const k = !E && e.style.positioning, X = e.style.layout?.layoutSizingVertical === "FILL";
798
+ }), u = !!e.style.layout?.mode, R = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", w = a.width !== void 0, x = a.height !== void 0, B = N(V), z = B?.isFlex ?? !1, f = B?.flexDirection, S = z && f === "row", O = !z && e.style.positioning, M = e.style.layout?.layoutSizingHorizontal === "FIXED" || e.style.layout?.layoutSizingVertical === "FIXED", j = e.style.layout?.layoutSizingHorizontal === "HUG" || e.style.layout?.layoutSizingVertical === "HUG";
799
+ if (!w && !S && !(O && (M || j)) && (a.width = "100%"), !x) {
800
+ const W = !z && e.style.positioning, Z = e.style.layout?.layoutSizingVertical === "FILL";
812
801
  if (!(e.style.layout?.layoutSizingVertical === "HUG")) {
813
- if (!s) if (k && X && e.style.positioning?.top !== void 0) {
814
- const ot = 100 - e.style.positioning.top;
815
- b.height = `${ot}%`;
802
+ if (!u) if (W && Z && e.style.positioning?.top !== void 0) {
803
+ const D = 100 - e.style.positioning.top;
804
+ a.height = `${D}%`;
816
805
  } else
817
- b.height = "100%";
806
+ a.height = "100%";
818
807
  }
819
808
  }
820
- const H = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, V = e.style.positioning && !s && (H || !0) ? { ...b, position: "absolute" } : b.position === "absolute" ? b : { ...b, position: b.position || "relative" }, N = (k) => typeof k == "number" ? k : typeof k == "string" && k.endsWith("px") && parseFloat(k) || 0, m = N(b.paddingLeft), et = N(b.paddingRight), G = N(b.paddingTop), B = N(b.paddingBottom), L = M && typeof b.width == "number" && typeof b.height == "number" ? {
821
- width: b.width - m - et,
822
- height: b.height - G - B
809
+ const K = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, H = e.style.positioning && !u && (K || !0) ? { ...a, position: "absolute" } : a.position === "absolute" ? a : { ...a, position: a.position || "relative" }, U = (W) => typeof W == "number" ? W : typeof W == "string" && W.endsWith("px") && parseFloat(W) || 0, G = U(a.paddingLeft), g = U(a.paddingRight), q = U(a.paddingTop), X = U(a.paddingBottom), P = M && typeof a.width == "number" && typeof a.height == "number" ? {
810
+ width: a.width - G - g,
811
+ height: a.height - q - X
823
812
  } : {
824
- width: x.width - m - et,
825
- height: x.height - G - B
813
+ width: I.width - G - g,
814
+ height: I.height - q - X
826
815
  };
827
- if (i != null && c) {
828
- const k = c[i];
829
- if (k !== void 0) {
830
- const X = typeof k == "object" && k !== null ? {
831
- nodeData: k,
832
- arrayDataById: a?.arrayDataById,
833
- textOverridesById: a?.textOverridesById,
834
- rootData: a?.rootData
835
- } : { nodeData: k };
836
- return /* @__PURE__ */ f(Q.Provider, { value: X, children: /* @__PURE__ */ f(
837
- O.Provider,
816
+ if (i != null && s) {
817
+ const W = s[i];
818
+ if (W !== void 0) {
819
+ const Z = typeof W == "object" && W !== null ? {
820
+ nodeData: W,
821
+ arrayDataById: n?.arrayDataById,
822
+ textOverridesById: n?.textOverridesById,
823
+ rootData: n?.rootData
824
+ } : { nodeData: W };
825
+ return /* @__PURE__ */ p(tt.Provider, { value: Z, children: /* @__PURE__ */ p(
826
+ V.Provider,
838
827
  {
839
- value: { dimensions: L, isFlex: s, flexDirection: g },
840
- children: /* @__PURE__ */ f(
828
+ value: { dimensions: P, isFlex: u, flexDirection: R },
829
+ children: /* @__PURE__ */ p(
841
830
  "div",
842
831
  {
843
832
  "data-id": `${t}:${i}`,
844
833
  "data-name": r,
845
834
  "data-type": "ContainerComponent",
846
- style: V,
835
+ style: H,
847
836
  children: o
848
837
  }
849
838
  )
@@ -851,89 +840,89 @@ const ct = v.createContext({}), O = v.createContext(
851
840
  ) });
852
841
  }
853
842
  }
854
- if (c) {
855
- const k = y || c;
856
- return zt(() => k.map((J, _) => {
857
- const ot = typeof J == "object" && J !== null ? {
843
+ if (s) {
844
+ const W = y || s;
845
+ return Ht(() => W.map((J, nt) => {
846
+ const D = typeof J == "object" && J !== null ? {
858
847
  nodeData: J,
859
- arrayDataById: a?.arrayDataById,
860
- textOverridesById: a?.textOverridesById,
861
- rootData: a?.rootData
848
+ arrayDataById: n?.arrayDataById,
849
+ textOverridesById: n?.textOverridesById,
850
+ rootData: n?.rootData
862
851
  } : { nodeData: J };
863
- return /* @__PURE__ */ f(
864
- Q.Provider,
852
+ return /* @__PURE__ */ p(
853
+ tt.Provider,
865
854
  {
866
- value: ot,
867
- children: /* @__PURE__ */ f(
868
- O.Provider,
855
+ value: D,
856
+ children: /* @__PURE__ */ p(
857
+ V.Provider,
869
858
  {
870
- value: { dimensions: L, isFlex: s, flexDirection: g },
871
- children: /* @__PURE__ */ f(
859
+ value: { dimensions: P, isFlex: u, flexDirection: R },
860
+ children: /* @__PURE__ */ p(
872
861
  "div",
873
862
  {
874
- "data-id": `${t}:${_}`,
863
+ "data-id": `${t}:${nt}`,
875
864
  "data-name": r,
876
865
  "data-type": "ContainerComponent",
877
- style: V,
866
+ style: H,
878
867
  children: o
879
868
  }
880
869
  )
881
870
  }
882
871
  )
883
872
  },
884
- `${t}:${_}`
873
+ `${t}:${nt}`
885
874
  );
886
- }), [k, t]);
875
+ }), [W, t]);
887
876
  }
888
- let $ = e.actions || [];
889
- !Array.isArray($) && typeof $ == "object" && $ !== null && ($ = Object.entries($).map(
890
- ([k, X]) => ({
891
- event: k,
892
- ...typeof X == "object" && X !== null ? X : {}
877
+ let F = e.actions || [];
878
+ !Array.isArray(F) && typeof F == "object" && F !== null && (F = Object.entries(F).map(
879
+ ([W, Z]) => ({
880
+ event: W,
881
+ ...typeof Z == "object" && Z !== null ? Z : {}
893
882
  })
894
883
  ));
895
- const K = Array.isArray($) && $.length > 0;
896
- return /* @__PURE__ */ f(
897
- O.Provider,
884
+ const $ = Array.isArray(F) && F.length > 0;
885
+ return /* @__PURE__ */ p(
886
+ V.Provider,
898
887
  {
899
- value: { dimensions: L, isFlex: s, flexDirection: g },
900
- children: /* @__PURE__ */ f(
888
+ value: { dimensions: P, isFlex: u, flexDirection: R },
889
+ children: /* @__PURE__ */ p(
901
890
  "div",
902
891
  {
903
892
  "data-id": t,
904
893
  "data-name": r,
905
894
  "data-type": "ContainerComponent",
906
895
  ref: h,
907
- style: V,
908
- children: K ? /* @__PURE__ */ f(q, { id: t, nodeData: e, children: o }) : o
896
+ style: H,
897
+ children: $ ? /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: o }) : o
909
898
  }
910
899
  )
911
900
  }
912
901
  );
913
- }, Tt = pt, Pt = ({ id: t, name: r, nodeData: e, children: o }) => {
914
- const { dimensions: i, ref: d } = rt(), a = R(e.style, {
902
+ }, Pt = pt, Wt = ({ id: t, name: r, nodeData: e, children: o }) => {
903
+ const { dimensions: i, ref: l } = rt(), n = L(e.style, {
915
904
  debug: !1
916
- }), n = !!e.style.layout?.mode, c = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", y = a.position ? a : { ...a, position: "relative" };
917
- return /* @__PURE__ */ f(
918
- O.Provider,
905
+ }), m = !!e.style.layout?.mode, s = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", y = n.position ? n : { ...n, position: "relative" };
906
+ return /* @__PURE__ */ p(
907
+ V.Provider,
919
908
  {
920
- value: { dimensions: i, isFlex: n, flexDirection: c },
921
- children: /* @__PURE__ */ f(
909
+ value: { dimensions: i, isFlex: m, flexDirection: s },
910
+ children: /* @__PURE__ */ p(
922
911
  "div",
923
912
  {
924
913
  "data-id": t,
925
914
  "data-name": r,
926
915
  "data-type": "TopBarContainerComponent",
927
- ref: d,
916
+ ref: l,
928
917
  style: y,
929
918
  children: o
930
919
  }
931
920
  )
932
921
  }
933
922
  );
934
- }, jt = ({ id: t, name: r, nodeData: e, children: o }) => {
935
- const i = R(e.style, { debug: !1 });
936
- return /* @__PURE__ */ f(
923
+ }, Ut = ({ id: t, name: r, nodeData: e, children: o }) => {
924
+ const i = L(e.style, { debug: !1 });
925
+ return /* @__PURE__ */ p(
937
926
  "div",
938
927
  {
939
928
  "data-id": t,
@@ -943,20 +932,20 @@ const ct = v.createContext({}), O = v.createContext(
943
932
  children: o
944
933
  }
945
934
  );
946
- }, $t = ({ id: t, name: r, nodeData: e, children: o }) => /* @__PURE__ */ f(
935
+ }, Bt = ({ id: t, name: r, nodeData: e, children: o }) => /* @__PURE__ */ p(
947
936
  "div",
948
937
  {
949
938
  "data-id": t,
950
939
  "data-name": r,
951
940
  "data-type": "TabsMenuComponent",
952
- style: R(e.style),
941
+ style: L(e.style),
953
942
  children: o
954
943
  }
955
- ), Wt = ({ id: t, name: r, nodeData: e, children: o }) => {
956
- const i = R(e.style, {
944
+ ), Lt = ({ id: t, name: r, nodeData: e, children: o }) => {
945
+ const i = L(e.style, {
957
946
  debug: !1
958
947
  });
959
- return /* @__PURE__ */ f(
948
+ return /* @__PURE__ */ p(
960
949
  "div",
961
950
  {
962
951
  "data-id": t,
@@ -971,250 +960,264 @@ const ct = v.createContext({}), O = v.createContext(
971
960
  `[DEBUG] SliderComponent ${t} FULL nodeData:`,
972
961
  JSON.stringify(e, null, 2)
973
962
  );
974
- const { dimensions: i, ref: d } = rt(), a = v.useRef(null), n = v.useRef(null), c = v.useRef(!1), y = v.useRef(null), x = j(ct), h = j(Ot), [b, s] = v.useState({
963
+ const { dimensions: i, ref: l } = rt(), n = v.useRef(null), m = v.useRef(null), s = v.useRef(!1), y = v.useRef(null), I = N(ct), h = N(Mt), { onAction: a } = N(ht), [u, R] = v.useState({
975
964
  currentIndex: void 0,
976
965
  onIndexChange: void 0
977
- }), [g, I] = v.useState(0), A = v.useRef(null), { patchedNodeData: T } = tt({ id: t, nodeData: e });
978
- e = T;
979
- const E = e.data?.params || {}, l = E.infinite === !0, W = E.automatic === !0;
980
- let M = Array.isArray(e.tags) && e.tags.some((u) => u.includes("container:slider:vertical")) || e.name && e.name.includes("container:slider:vertical");
981
- if (!M && E.animation === "default") {
982
- const u = e.style?.width, p = e.style?.height;
983
- typeof u == "number" && typeof p == "number" && p > u && (M = !0);
966
+ }), [w, x] = v.useState(0), B = v.useRef(null), { patchedNodeData: z } = et({ id: t, nodeData: e });
967
+ e = z;
968
+ const f = e.data?.params || {}, S = f.infinite === !0, O = f.automatic === !0;
969
+ let j = Array.isArray(e.tags) && e.tags.some((c) => c.includes("container:slider:vertical")) || e.name && e.name.includes("container:slider:vertical");
970
+ if (!j && f.animation === "default") {
971
+ const c = e.style?.width, d = e.style?.height;
972
+ typeof c == "number" && typeof d == "number" && d > c && (j = !0);
984
973
  }
985
- const Z = M ? "vertical" : E.animation === "default" ? "horizontal" : E.animation || "horizontal", H = R(e.style, {
974
+ const K = j ? "vertical" : f.animation === "default" ? "horizontal" : f.animation || "horizontal", E = L(e.style, {
986
975
  debug: !1
987
- }), P = H.width !== void 0, V = H.height !== void 0;
988
- P || (H.width = "100%"), V || (H.height = "100%"), H.position || (H.position = "relative");
989
- const N = j(Q), m = v.useMemo(() => {
990
- const u = [];
991
- return v.Children.forEach(o, (p) => {
992
- if (p == null) return;
993
- const w = p?.props || {}, S = w.nodeData || {};
994
- if (Array.isArray(S?.tags) && (S.tags.includes("encore:data:array") || S.tags.includes("bravo:data:array")) && w.id && N) {
995
- const F = N?.arrayDataById && N.arrayDataById[w.id] && Array.isArray(N.arrayDataById[w.id]) ? N.arrayDataById[w.id] : null;
996
- F && F.length > 0 ? F.forEach((D, nt) => {
997
- u.push(
998
- v.cloneElement(p, {
999
- key: `${w.id}:${nt}`,
976
+ }), H = E.width !== void 0, U = E.height !== void 0;
977
+ H || (E.width = "100%"), U || (E.height = "100%"), E.position || (E.position = "relative");
978
+ const G = N(tt), g = v.useMemo(() => {
979
+ const c = [];
980
+ return v.Children.forEach(o, (d) => {
981
+ if (d == null) return;
982
+ const A = d?.props || {}, C = A.nodeData || {};
983
+ if (Array.isArray(C?.tags) && (C.tags.includes("encore:data:array") || C.tags.includes("bravo:data:array")) && A.id && G) {
984
+ const T = G?.arrayDataById && G.arrayDataById[A.id] && Array.isArray(G.arrayDataById[A.id]) ? G.arrayDataById[A.id] : null;
985
+ T && T.length > 0 ? T.forEach((Q, ot) => {
986
+ c.push(
987
+ v.cloneElement(d, {
988
+ key: `${A.id}:${ot}`,
1000
989
  // ContainerComponent will use this to know which item to render
1001
- _arrayItemIndex: nt,
1002
- _arrayItemData: D
990
+ _arrayItemIndex: ot,
991
+ _arrayItemData: Q
1003
992
  })
1004
993
  );
1005
- }) : u.push(p);
994
+ }) : c.push(d);
1006
995
  } else
1007
- u.push(p);
1008
- }), u;
1009
- }, [o, t, N]), et = v.useMemo(() => {
1010
- if (!l || m.length === 0)
1011
- return m;
1012
- const u = m[0], p = m[m.length - 1];
996
+ c.push(d);
997
+ }), c;
998
+ }, [o, t, G]), q = v.useMemo(() => {
999
+ if (!S || g.length === 0)
1000
+ return g;
1001
+ const c = g[0], d = g[g.length - 1];
1013
1002
  return [
1014
- v.cloneElement(p, {
1015
- key: `clone-last-${p.key || p.props.id}`
1003
+ v.cloneElement(d, {
1004
+ key: `clone-last-${d.key || d.props.id}`
1016
1005
  }),
1017
- ...m,
1018
- v.cloneElement(u, {
1019
- key: `clone-first-${u.key || u.props.id}`
1006
+ ...g,
1007
+ v.cloneElement(c, {
1008
+ key: `clone-first-${c.key || c.props.id}`
1020
1009
  })
1021
1010
  ];
1022
- }, [m, l]), G = v.useMemo(() => {
1023
- if (m.length === 0) return { width: 0, height: 0 };
1024
- const p = m[0]?.props?.nodeData?.style, w = x.scaleFactor || 1;
1025
- let S = 0, C = 0;
1026
- return p?.layout?.layoutSizingHorizontal === "FIXED" && p?.layout?.size?.x ? S = p.layout.size.x * w : S = i.width || 0, p?.layout?.layoutSizingVertical === "FIXED" && p?.layout?.size?.y ? C = p.layout.size.y * w : C = i.height || 0, { width: S, height: C };
1027
- }, [m, i.width, i.height, x.scaleFactor]), B = G.width, L = G.height, $ = Z === "vertical", K = v.useCallback(() => {
1028
- if (!a.current || m.length === 0)
1011
+ }, [g, S]), X = v.useMemo(() => {
1012
+ if (g.length === 0) return { width: 0, height: 0 };
1013
+ const d = g[0]?.props?.nodeData?.style, A = I.scaleFactor || 1;
1014
+ let C = 0, b = 0;
1015
+ return d?.layout?.layoutSizingHorizontal === "FIXED" && d?.layout?.size?.x ? C = d.layout.size.x * A : C = i.width || 0, d?.layout?.layoutSizingVertical === "FIXED" && d?.layout?.size?.y ? b = d.layout.size.y * A : b = i.height || 0, { width: C, height: b };
1016
+ }, [g, i.width, i.height, I.scaleFactor]), P = X.width, F = X.height, $ = K === "vertical", _ = v.useCallback(() => {
1017
+ if (!n.current || g.length === 0)
1029
1018
  return 0;
1030
- const u = a.current;
1019
+ const c = n.current;
1031
1020
  if ($) {
1032
- if (L === 0) return 0;
1033
- const p = u.scrollTop;
1034
- if (l) {
1035
- const S = p - L;
1036
- let C = Math.round(S / L);
1037
- return C < 0 && (C = 0), C >= m.length && (C = m.length - 1), C;
1021
+ if (F === 0) return 0;
1022
+ const d = c.scrollTop;
1023
+ if (S) {
1024
+ const C = d - F;
1025
+ let b = Math.round(C / F);
1026
+ return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
1038
1027
  } else {
1039
- const w = Math.round(p / L);
1040
- return w < 0 ? 0 : w >= m.length ? m.length - 1 : w;
1028
+ const A = Math.round(d / F);
1029
+ return A < 0 ? 0 : A >= g.length ? g.length - 1 : A;
1041
1030
  }
1042
1031
  } else {
1043
- if (B === 0) return 0;
1044
- const p = u.scrollLeft;
1045
- if (l) {
1046
- const S = p - B;
1047
- let C = Math.round(S / B);
1048
- return C < 0 && (C = 0), C >= m.length && (C = m.length - 1), C;
1032
+ if (P === 0) return 0;
1033
+ const d = c.scrollLeft;
1034
+ if (S) {
1035
+ const C = d - P;
1036
+ let b = Math.round(C / P);
1037
+ return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
1049
1038
  } else {
1050
- const w = Math.round(p / B);
1051
- return w < 0 ? 0 : w >= m.length ? m.length - 1 : w;
1039
+ const A = Math.round(d / P);
1040
+ return A < 0 ? 0 : A >= g.length ? g.length - 1 : A;
1052
1041
  }
1053
1042
  }
1054
- }, [l, m.length, B, L, $]), Y = v.useCallback(
1055
- (u, p = !0) => {
1056
- if (!a.current || m.length === 0) return;
1057
- const w = a.current;
1043
+ }, [S, g.length, P, F, $]), W = v.useCallback(
1044
+ (c, d = !0) => {
1045
+ if (!n.current || g.length === 0) return;
1046
+ const A = n.current;
1058
1047
  if ($) {
1059
- let S;
1060
- l ? S = L + u * L : S = u * L, w.scrollTo({
1061
- top: S,
1062
- behavior: p ? "smooth" : "auto"
1048
+ let C;
1049
+ S ? C = F + c * F : C = c * F, A.scrollTo({
1050
+ top: C,
1051
+ behavior: d ? "smooth" : "auto"
1063
1052
  });
1064
1053
  } else {
1065
- let S;
1066
- l ? S = B + u * B : S = u * B, w.scrollTo({
1067
- left: S,
1068
- behavior: p ? "smooth" : "auto"
1054
+ let C;
1055
+ S ? C = P + c * P : C = c * P, A.scrollTo({
1056
+ left: C,
1057
+ behavior: d ? "smooth" : "auto"
1069
1058
  });
1070
1059
  }
1071
1060
  },
1072
- [B, L, l, m.length, $]
1073
- ), k = v.useCallback(() => {
1074
- if (!l || !a.current || m.length === 0) return;
1075
- const u = a.current, p = 1;
1061
+ [P, F, S, g.length, $]
1062
+ ), Z = v.useCallback(() => {
1063
+ if (!S || !n.current || g.length === 0) return;
1064
+ const c = n.current, d = 1;
1076
1065
  if ($) {
1077
- if (L === 0) return;
1078
- const w = u.scrollTop, S = L, C = S, F = C + m.length * S;
1079
- w >= F - p ? u.scrollTop = C : w <= p && (u.scrollTop = F - S);
1066
+ if (F === 0) return;
1067
+ const A = c.scrollTop, C = F, b = C, T = b + g.length * C;
1068
+ A >= T - d ? c.scrollTop = b : A <= d && (c.scrollTop = T - C);
1080
1069
  } else {
1081
- if (B === 0) return;
1082
- const w = u.scrollLeft, S = B, C = S, F = C + m.length * S;
1083
- w >= F - p ? u.scrollLeft = C : w <= p && (u.scrollLeft = F - S);
1070
+ if (P === 0) return;
1071
+ const A = c.scrollLeft, C = P, b = C, T = b + g.length * C;
1072
+ A >= T - d ? c.scrollLeft = b : A <= d && (c.scrollLeft = T - C);
1084
1073
  }
1085
- }, [l, m.length, B, L, $]);
1074
+ }, [S, g.length, P, F, $]);
1086
1075
  v.useEffect(() => {
1087
- if (!W || m.length <= 1 || B === 0) return;
1088
- const u = () => {
1089
- if (c.current || !a.current) return;
1090
- const p = a.current;
1076
+ if (!O || g.length <= 1 || P === 0) return;
1077
+ const c = () => {
1078
+ if (s.current || !n.current) return;
1079
+ const d = n.current;
1091
1080
  if ($) {
1092
- if (L === 0) return;
1093
- const w = p.scrollTop, S = L;
1094
- let C;
1095
- if (l) {
1096
- const nt = w - S;
1097
- C = Math.round(nt / S), C < 0 && (C = 0), C >= m.length && (C = m.length - 1);
1081
+ if (F === 0) return;
1082
+ const A = d.scrollTop, C = F;
1083
+ let b;
1084
+ if (S) {
1085
+ const ot = A - C;
1086
+ b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
1098
1087
  } else
1099
- C = Math.round(w / S);
1100
- let F = C + 1;
1101
- if (l) {
1102
- F >= m.length && (F = 0);
1103
- const D = S;
1104
- p.scrollTo({
1105
- top: D + F * S,
1088
+ b = Math.round(A / C);
1089
+ let T = b + 1;
1090
+ if (S) {
1091
+ T >= g.length && (T = 0);
1092
+ const Q = C;
1093
+ d.scrollTo({
1094
+ top: Q + T * C,
1106
1095
  behavior: "smooth"
1107
1096
  });
1108
1097
  } else
1109
- F >= m.length && (F = 0), Y(F);
1098
+ T >= g.length && (T = 0), W(T);
1110
1099
  } else {
1111
- if (B === 0) return;
1112
- const w = p.scrollLeft, S = B;
1113
- let C;
1114
- if (l) {
1115
- const nt = w - S;
1116
- C = Math.round(nt / S), C < 0 && (C = 0), C >= m.length && (C = m.length - 1);
1100
+ if (P === 0) return;
1101
+ const A = d.scrollLeft, C = P;
1102
+ let b;
1103
+ if (S) {
1104
+ const ot = A - C;
1105
+ b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
1117
1106
  } else
1118
- C = Math.round(w / S);
1119
- let F = C + 1;
1120
- if (l) {
1121
- F >= m.length && (F = 0);
1122
- const D = S;
1123
- p.scrollTo({
1124
- left: D + F * S,
1107
+ b = Math.round(A / C);
1108
+ let T = b + 1;
1109
+ if (S) {
1110
+ T >= g.length && (T = 0);
1111
+ const Q = C;
1112
+ d.scrollTo({
1113
+ left: Q + T * C,
1125
1114
  behavior: "smooth"
1126
1115
  });
1127
1116
  } else
1128
- F >= m.length && (F = 0), Y(F);
1117
+ T >= g.length && (T = 0), W(T);
1129
1118
  }
1130
1119
  };
1131
- return n.current = setInterval(u, 4e3), () => {
1132
- n.current && (clearInterval(n.current), n.current = null);
1120
+ return m.current = setInterval(c, 4e3), () => {
1121
+ m.current && (clearInterval(m.current), m.current = null);
1133
1122
  };
1134
1123
  }, [
1135
- W,
1136
- m.length,
1137
- l,
1138
- B,
1139
- L,
1124
+ O,
1125
+ g.length,
1126
+ S,
1127
+ P,
1128
+ F,
1140
1129
  $,
1141
- Y
1130
+ W
1142
1131
  ]);
1143
- const X = v.useCallback(() => {
1144
- c.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
1145
- c.current = !1;
1132
+ const J = v.useCallback(() => {
1133
+ s.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
1134
+ s.current = !1;
1146
1135
  }, 3e3);
1147
- }, []), J = v.useRef(b);
1136
+ }, []), nt = v.useRef(u);
1148
1137
  v.useEffect(() => {
1149
- J.current = b;
1150
- }, [b]);
1151
- const _ = v.useCallback(
1152
- (u) => {
1153
- if (A.current === u) return;
1154
- A.current = u;
1155
- const p = J.current;
1156
- p.currentIndex === void 0 && I(u), p.onIndexChange && p.onIndexChange(u);
1138
+ nt.current = u;
1139
+ }, [u]);
1140
+ const D = v.useCallback(
1141
+ (c) => {
1142
+ if (B.current === c) return;
1143
+ B.current = c;
1144
+ const d = nt.current;
1145
+ if (d.currentIndex === void 0 && x(c), d.onIndexChange && d.onIndexChange(c), typeof a == "function")
1146
+ try {
1147
+ a({
1148
+ bravo: {
1149
+ cancel: () => {
1150
+ },
1151
+ action: {
1152
+ action: "index-change",
1153
+ params: { index: c }
1154
+ },
1155
+ componentId: t
1156
+ }
1157
+ });
1158
+ } catch {
1159
+ }
1157
1160
  },
1158
- []
1159
- // Empty deps - we use ref to access latest controlProps
1161
+ [a, t]
1162
+ // Depend on onAction to ensure we call the latest version
1160
1163
  );
1161
1164
  v.useEffect(() => {
1162
- const u = a.current;
1163
- if (!u) return;
1164
- let p = null;
1165
- const w = () => {
1166
- X(), l ? (p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1167
- k();
1168
- const F = K();
1169
- _(F);
1170
- })) : (p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1171
- const F = K();
1172
- _(F);
1165
+ const c = n.current;
1166
+ if (!c) return;
1167
+ let d = null;
1168
+ const A = () => {
1169
+ J(), S ? (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1170
+ Z();
1171
+ const T = _();
1172
+ D(T);
1173
+ })) : (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1174
+ const T = _();
1175
+ D(T);
1173
1176
  }));
1174
- }, S = () => X(), C = () => X();
1175
- return u.addEventListener("scroll", w, { passive: !0 }), u.addEventListener("touchstart", S, {
1177
+ }, C = () => J(), b = () => J();
1178
+ return c.addEventListener("scroll", A, { passive: !0 }), c.addEventListener("touchstart", C, {
1176
1179
  passive: !0
1177
- }), u.addEventListener("mousedown", C), () => {
1178
- u.removeEventListener("scroll", w), u.removeEventListener("touchstart", S), u.removeEventListener("mousedown", C), y.current && clearTimeout(y.current), p !== null && cancelAnimationFrame(p);
1180
+ }), c.addEventListener("mousedown", b), () => {
1181
+ c.removeEventListener("scroll", A), c.removeEventListener("touchstart", C), c.removeEventListener("mousedown", b), y.current && clearTimeout(y.current), d !== null && cancelAnimationFrame(d);
1179
1182
  };
1180
1183
  }, [
1181
- l,
1182
- X,
1183
- k,
1184
- K,
1185
- _
1184
+ S,
1185
+ J,
1186
+ Z,
1187
+ _,
1188
+ D
1186
1189
  ]), v.useEffect(() => {
1187
1190
  if (h) {
1188
- const u = h.getControlProps(t);
1189
- u && u !== b && s(u);
1191
+ const c = h.getControlProps(t);
1192
+ c && c !== u && R(c);
1190
1193
  }
1191
- }, [t, h, b]), v.useEffect(() => {
1192
- if (b.currentIndex !== void 0 && a.current && m.length > 0 && B > 0) {
1193
- const u = Math.max(
1194
+ }, [t, h, u]), v.useEffect(() => {
1195
+ if (u.currentIndex !== void 0 && n.current && g.length > 0 && P > 0) {
1196
+ const c = Math.max(
1194
1197
  0,
1195
- Math.min(b.currentIndex, m.length - 1)
1196
- ), p = K();
1197
- u !== p && Y(u, !0);
1198
+ Math.min(u.currentIndex, g.length - 1)
1199
+ ), d = _();
1200
+ c !== d && W(c, !0);
1198
1201
  }
1199
1202
  }, [
1200
- b.currentIndex,
1201
- m.length,
1202
- m.length,
1203
- B,
1204
- L,
1203
+ u.currentIndex,
1204
+ g.length,
1205
+ g.length,
1206
+ P,
1207
+ F,
1205
1208
  $,
1206
- Y,
1207
- K
1209
+ W,
1210
+ _
1208
1211
  ]), v.useEffect(() => {
1209
- if (l && a.current && m.length > 0 && m.length > 0 && ($ ? L > 0 : B > 0)) {
1210
- const u = $ ? L : B;
1212
+ if (S && n.current && g.length > 0 && g.length > 0 && ($ ? F > 0 : P > 0)) {
1213
+ const c = $ ? F : P;
1211
1214
  setTimeout(() => {
1212
- a.current && ($ ? a.current.scrollTop = u : a.current.scrollLeft = u);
1215
+ n.current && ($ ? n.current.scrollTop = c : n.current.scrollLeft = c);
1213
1216
  }, 0);
1214
1217
  }
1215
- }, [l, m.length, B, L, $]), v.useEffect(() => {
1218
+ }, [S, g.length, P, F, $]), v.useEffect(() => {
1216
1219
  if (!h) return;
1217
- const { registerContainer: u, unregisterContainer: p } = h;
1220
+ const { registerContainer: c, unregisterContainer: d } = h;
1218
1221
  return () => {
1219
1222
  };
1220
1223
  }, [
@@ -1222,10 +1225,10 @@ const ct = v.createContext({}), O = v.createContext(
1222
1225
  h?.registerContainer,
1223
1226
  h?.unregisterContainer,
1224
1227
  // controlProps, // REMOVED to break infinite loop
1225
- Y,
1226
- K
1228
+ W,
1229
+ _
1227
1230
  ]);
1228
- const ot = {
1231
+ const kt = {
1229
1232
  display: "flex",
1230
1233
  flexDirection: $ ? "column" : "row",
1231
1234
  overflowX: $ ? "hidden" : "auto",
@@ -1236,58 +1239,58 @@ const ct = v.createContext({}), O = v.createContext(
1236
1239
  height: "100%",
1237
1240
  WebkitOverflowScrolling: "touch"
1238
1241
  // Smooth scrolling on iOS
1239
- }, kt = {
1242
+ }, $t = {
1240
1243
  flexShrink: 0,
1241
1244
  scrollSnapAlign: "start",
1242
- width: G.width > 0 ? G.width : void 0,
1243
- height: G.height > 0 ? G.height : void 0,
1245
+ width: X.width > 0 ? X.width : void 0,
1246
+ height: X.height > 0 ? X.height : void 0,
1244
1247
  position: "relative"
1245
1248
  };
1246
- return /* @__PURE__ */ f(
1249
+ return /* @__PURE__ */ p(
1247
1250
  "div",
1248
1251
  {
1249
1252
  "data-id": t,
1250
1253
  "data-name": r,
1251
1254
  "data-type": "SliderComponent",
1252
- ref: d,
1253
- style: H,
1254
- children: /* @__PURE__ */ f("div", { ref: a, style: ot, children: et.map((u, p) => /* @__PURE__ */ f(
1255
- O.Provider,
1255
+ ref: l,
1256
+ style: E,
1257
+ children: /* @__PURE__ */ p("div", { ref: n, style: kt, children: q.map((c, d) => /* @__PURE__ */ p(
1258
+ V.Provider,
1256
1259
  {
1257
1260
  value: {
1258
1261
  dimensions: {
1259
- width: G.width,
1260
- height: G.height
1262
+ width: X.width,
1263
+ height: X.height
1261
1264
  },
1262
1265
  isFlex: !1
1263
1266
  },
1264
- children: /* @__PURE__ */ f("div", { style: kt, children: u })
1267
+ children: /* @__PURE__ */ p("div", { style: $t, children: c })
1265
1268
  },
1266
- u.key || `slide-${p}`
1269
+ c.key || `slide-${d}`
1267
1270
  )) })
1268
1271
  }
1269
1272
  );
1270
- }, Rt = (t, r) => {
1273
+ }, zt = (t, r) => {
1271
1274
  const e = Array.isArray(t) ? t : [t];
1272
1275
  for (const o of e)
1273
1276
  if (!(!o || !o.props)) {
1274
1277
  if (o.props.id === r)
1275
1278
  return o;
1276
1279
  if (o.props.children) {
1277
- const i = Rt(o.props.children, r);
1280
+ const i = zt(o.props.children, r);
1278
1281
  if (i) return i;
1279
1282
  }
1280
1283
  }
1281
1284
  return null;
1282
- }, Bt = ({ id: t, name: r, nodeData: e, children: o }) => {
1283
- const { dimensions: i, ref: d } = rt(), { componentId: a } = j(lt), n = j(O), c = e.style.originalSize?.[0] || 1, y = e.style.originalSize?.[1] || 1, x = n?.dimensions?.width, h = n?.dimensions?.height, b = window.innerWidth, s = window.innerHeight, g = x && x > 0 && x < b * 0.8;
1284
- let I, A;
1285
- i.width > 0 && i.height > 0 ? (I = i.width, A = i.height) : g && x && h || x && h && x > 0 && h > 0 ? (I = x, A = h) : (I = b, A = s);
1286
- const E = { scaleFactor: Math.min(I / c, A / y) || 1 };
1287
- if (a) {
1288
- const P = Rt(o, a);
1289
- return P ? /* @__PURE__ */ f(ct.Provider, { value: E, children: /* @__PURE__ */ f(
1290
- O.Provider,
1285
+ }, Rt = ({ id: t, name: r, nodeData: e, children: o }) => {
1286
+ const { dimensions: i, ref: l } = rt(), { componentId: n } = N(lt), m = N(V), s = e.style.originalSize?.[0] || 1, y = e.style.originalSize?.[1] || 1, I = m?.dimensions?.width, h = m?.dimensions?.height, a = window.innerWidth, u = window.innerHeight, R = I && I > 0 && I < a * 0.8;
1287
+ let w, x;
1288
+ i.width > 0 && i.height > 0 ? (w = i.width, x = i.height) : R && I && h || I && h && I > 0 && h > 0 ? (w = I, x = h) : (w = a, x = u);
1289
+ const z = { scaleFactor: Math.min(w / s, x / y) || 1 };
1290
+ if (n) {
1291
+ const E = zt(o, n);
1292
+ return E ? /* @__PURE__ */ p(ct.Provider, { value: z, children: /* @__PURE__ */ p(
1293
+ V.Provider,
1291
1294
  {
1292
1295
  value: {
1293
1296
  dimensions: {
@@ -1295,14 +1298,14 @@ const ct = v.createContext({}), O = v.createContext(
1295
1298
  height: "100%"
1296
1299
  }
1297
1300
  },
1298
- children: P
1301
+ children: E
1299
1302
  }
1300
- ) }) : (console.warn(`Child with id "${a}" not found`), null);
1303
+ ) }) : (console.warn(`Child with id "${n}" not found`), null);
1301
1304
  }
1302
- const l = Array.isArray(o) ? o : [o], { scrollableChildren: W, nonScrollableChildren: U } = l.reduce(
1303
- (P, V) => {
1304
- const m = V.props.nodeData.type === "container:top-bar" ? "nonScrollableChildren" : "scrollableChildren";
1305
- return P[m].push(V), P;
1305
+ const f = Array.isArray(o) ? o : [o], { scrollableChildren: S, nonScrollableChildren: O } = f.reduce(
1306
+ (E, H) => {
1307
+ const G = H.props.nodeData.type === "container:top-bar" ? "nonScrollableChildren" : "scrollableChildren";
1308
+ return E[G].push(H), E;
1306
1309
  },
1307
1310
  {
1308
1311
  scrollableChildren: [],
@@ -1311,19 +1314,19 @@ const ct = v.createContext({}), O = v.createContext(
1311
1314
  );
1312
1315
  let M = e.style?.layout?.mode;
1313
1316
  if (!M && t === "01KASW494V02Y8P5JVWV5XK62X" && (console.log("🔧 PATCHING missing layout for page", t), M = "HORIZONTAL"), !M && o) {
1314
- const P = Array.isArray(o) ? o : [o];
1315
- let V = 0, N = 0;
1316
- P.forEach((et) => {
1317
- const G = et?.props?.nodeData?.style?.width;
1318
- G && (V += G, G < 99 && N++);
1319
- }), N > 0 && V >= 99 && (console.log(
1320
- `[PATCH] Detected HORIZONTAL WRAP layout for page ${t} (Partial width children: ${N}, Total width: ${V})`
1317
+ const E = Array.isArray(o) ? o : [o];
1318
+ let H = 0, U = 0;
1319
+ E.forEach((g) => {
1320
+ const q = g?.props?.nodeData?.style?.width;
1321
+ q && (H += q, q < 99 && U++);
1322
+ }), U > 0 && H >= 99 && (console.log(
1323
+ `[PATCH] Detected HORIZONTAL WRAP layout for page ${t} (Partial width children: ${U}, Total width: ${H})`
1321
1324
  ), M = "HORIZONTAL", e.style || (e.style = {}), e.style.layout || (e.style.layout = {}), e.style.layout.mode = "HORIZONTAL", e.style.layout.flexWrap = "wrap", e.style.layout.primaryAxisAlignItems = "flex-start", e.style.layout.counterAxisAlignItems = "flex-start");
1322
1325
  }
1323
- const Z = M === "HORIZONTAL" ? "row" : "column", H = U.some(
1324
- (P) => P?.props?.nodeData?.type !== "container:background"
1326
+ const j = M === "HORIZONTAL" ? "row" : "column", K = O.some(
1327
+ (E) => E?.props?.nodeData?.type !== "container:background"
1325
1328
  );
1326
- return /* @__PURE__ */ f(ct.Provider, { value: E, children: /* @__PURE__ */ it(
1329
+ return /* @__PURE__ */ p(ct.Provider, { value: z, children: /* @__PURE__ */ it(
1327
1330
  "div",
1328
1331
  {
1329
1332
  style: {
@@ -1332,20 +1335,20 @@ const ct = v.createContext({}), O = v.createContext(
1332
1335
  position: "relative",
1333
1336
  overflow: "hidden",
1334
1337
  // Only use flex if we have non-background nonScrollableChildren (like top-bar)
1335
- ...H ? {
1338
+ ...K ? {
1336
1339
  display: "flex",
1337
- flexDirection: Z,
1340
+ flexDirection: j,
1338
1341
  gap: 0,
1339
1342
  rowGap: 0,
1340
1343
  columnGap: 0
1341
1344
  } : {}
1342
1345
  },
1343
- ref: d,
1346
+ ref: l,
1344
1347
  children: [
1345
- U.filter(
1346
- (P) => P?.props?.nodeData?.type === "container:background"
1347
- ).map((P, V) => /* @__PURE__ */ f(
1348
- O.Provider,
1348
+ O.filter(
1349
+ (E) => E?.props?.nodeData?.type === "container:background"
1350
+ ).map((E, H) => /* @__PURE__ */ p(
1351
+ V.Provider,
1349
1352
  {
1350
1353
  value: {
1351
1354
  dimensions: {
@@ -1353,14 +1356,14 @@ const ct = v.createContext({}), O = v.createContext(
1353
1356
  height: i.height
1354
1357
  }
1355
1358
  },
1356
- children: P
1359
+ children: E
1357
1360
  },
1358
- `bg-${V}`
1361
+ `bg-${H}`
1359
1362
  )),
1360
- H && U.filter(
1361
- (P) => P?.props?.nodeData?.type !== "container:background"
1362
- ).map((P, V) => /* @__PURE__ */ f(
1363
- O.Provider,
1363
+ K && O.filter(
1364
+ (E) => E?.props?.nodeData?.type !== "container:background"
1365
+ ).map((E, H) => /* @__PURE__ */ p(
1366
+ V.Provider,
1364
1367
  {
1365
1368
  value: {
1366
1369
  dimensions: {
@@ -1368,11 +1371,11 @@ const ct = v.createContext({}), O = v.createContext(
1368
1371
  height: i.height
1369
1372
  }
1370
1373
  },
1371
- children: P
1374
+ children: E
1372
1375
  },
1373
- `non-scroll-${V}`
1376
+ `non-scroll-${H}`
1374
1377
  )),
1375
- /* @__PURE__ */ f(O.Provider, { value: { dimensions: i }, children: /* @__PURE__ */ f(
1378
+ /* @__PURE__ */ p(V.Provider, { value: { dimensions: i }, children: /* @__PURE__ */ p(
1376
1379
  "div",
1377
1380
  {
1378
1381
  "data-id": t,
@@ -1380,80 +1383,80 @@ const ct = v.createContext({}), O = v.createContext(
1380
1383
  "data-type": "PageComponent",
1381
1384
  style: {
1382
1385
  position: "relative",
1383
- ...H ? {
1386
+ ...K ? {
1384
1387
  flex: 1,
1385
- ...Z === "row" ? { alignSelf: "stretch" } : {}
1388
+ ...j === "row" ? { alignSelf: "stretch" } : {}
1386
1389
  // Removed height: "100%" to allow HUG containers to size based on content
1387
1390
  } : {
1388
1391
  width: "100%"
1389
1392
  // Removed height: "100%" to allow HUG containers to size based on content
1390
1393
  },
1391
1394
  // Remove overflow: auto in horizontal mode as it causes height collapse
1392
- ...Z === "column" && { overflow: "auto" },
1393
- ...R(e.style, {
1395
+ ...j === "column" && { overflow: "auto" },
1396
+ ...L(e.style, {
1394
1397
  debug: !1
1395
1398
  })
1396
1399
  },
1397
- children: W
1400
+ children: S
1398
1401
  }
1399
1402
  ) })
1400
1403
  ]
1401
1404
  }
1402
1405
  ) });
1403
- }, Dt = {
1406
+ }, Qt = {
1404
1407
  WebViewComponent: ft,
1405
- ColorComponent: ht,
1406
- GradientComponent: gt,
1407
- ImageComponent: mt,
1408
- EmailInputComponent: yt,
1409
- HiddenInputComponent: bt,
1410
- ImageInputComponent: Ct,
1411
- PasswordInputComponent: St,
1412
- SelectInputComponent: xt,
1413
- TextInputComponent: vt,
1414
- LottieComponent: It,
1415
- SvgComponent: wt,
1416
- TextComponent: At,
1408
+ ColorComponent: gt,
1409
+ GradientComponent: mt,
1410
+ ImageComponent: yt,
1411
+ EmailInputComponent: bt,
1412
+ HiddenInputComponent: Ct,
1413
+ ImageInputComponent: St,
1414
+ PasswordInputComponent: xt,
1415
+ SelectInputComponent: vt,
1416
+ TextInputComponent: It,
1417
+ LottieComponent: wt,
1418
+ SvgComponent: At,
1419
+ TextComponent: Et,
1417
1420
  StatefulSetComponent: dt,
1418
- StatefulCompoundComponent: Et,
1419
- BackgroundContainerComponent: Ft,
1421
+ StatefulCompoundComponent: Ft,
1422
+ BackgroundContainerComponent: Tt,
1420
1423
  ContainerComponent: pt,
1421
- CompoundComponent: Tt,
1422
- TopBarContainerComponent: Pt,
1423
- DefaultLayerComponent: jt,
1424
- TabsMenuComponent: $t,
1425
- MenuSideComponent: Wt,
1424
+ CompoundComponent: Pt,
1425
+ TopBarContainerComponent: Wt,
1426
+ DefaultLayerComponent: Ut,
1427
+ TabsMenuComponent: Bt,
1428
+ MenuSideComponent: Lt,
1426
1429
  SliderComponent: at,
1427
- PageComponent: Bt,
1430
+ PageComponent: Rt,
1428
1431
  // Type string mappings for dynamically loaded components
1429
- "menu:side": Wt,
1430
- "page:default": Bt,
1431
- "container:background": Ft,
1432
+ "menu:side": Lt,
1433
+ "page:default": Rt,
1434
+ "container:background": Tt,
1432
1435
  "container:default": pt,
1433
- "container:top-bar": Pt,
1436
+ "container:top-bar": Wt,
1434
1437
  "container:slider": at,
1435
- "component:text": At,
1436
- "component:color": ht,
1437
- "component:gradient": gt,
1438
- "component:image": mt,
1439
- "component:svg": wt,
1440
- "component:compound": Tt,
1438
+ "component:text": Et,
1439
+ "component:color": gt,
1440
+ "component:gradient": mt,
1441
+ "component:image": yt,
1442
+ "component:svg": At,
1443
+ "component:compound": Pt,
1441
1444
  "component:input-stateful-set": dt,
1442
1445
  "component:stateful-set": dt,
1443
- "component:stateful-compound": Et,
1446
+ "component:stateful-compound": Ft,
1444
1447
  "component:slider": at,
1445
1448
  "component:webview": ft,
1446
- "component:lottie": It,
1447
- "component:email-input": yt,
1448
- "component:text-input": vt,
1449
- "component:password-input": St,
1450
- "component:select-input": xt,
1451
- "component:image-input": Ct,
1452
- "component:hidden-input": bt,
1453
- "component:tabs-menu": $t,
1449
+ "component:lottie": wt,
1450
+ "component:email-input": bt,
1451
+ "component:text-input": It,
1452
+ "component:password-input": xt,
1453
+ "component:select-input": vt,
1454
+ "component:image-input": St,
1455
+ "component:hidden-input": Ct,
1456
+ "component:tabs-menu": Bt,
1454
1457
  ContainerSliderComponent: at
1455
1458
  };
1456
1459
  export {
1457
- Dt as default
1460
+ Qt as default
1458
1461
  };
1459
1462
  //# sourceMappingURL=components.js.map