@1urso/generic-editor 0.1.42 → 0.1.44

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.
@@ -804,15 +804,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
804
804
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
805
805
  branches: /* @__PURE__ */ new Set()
806
806
  }), DismissableLayer = React$1.forwardRef((_, E) => {
807
- let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)), Aj = Array.from(B.layers), [jj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), Mj = Aj.indexOf(jj), Nj = H ? Aj.indexOf(H) : -1, Pj = B.layersWithOutsidePointerEventsDisabled.size > 0, Fj = Nj >= Mj, Ij = usePointerDownOutside((n) => {
807
+ let { disableOutsidePointerEvents: O = !1, onEscapeKeyDown: A, onPointerDownOutside: j, onFocusOutside: M, onInteractOutside: N, onDismiss: P, ...z } = _, B = React$1.useContext(DismissableLayerContext), [H, U] = React$1.useState(null), W = H?.ownerDocument ?? globalThis?.document, [, G] = React$1.useState({}), Z = useComposedRefs$1(E, (n) => U(n)), Lj = Array.from(B.layers), [Rj] = [...B.layersWithOutsidePointerEventsDisabled].slice(-1), zj = Lj.indexOf(Rj), Bj = H ? Lj.indexOf(H) : -1, Vj = B.layersWithOutsidePointerEventsDisabled.size > 0, Hj = Bj >= zj, Uj = usePointerDownOutside((n) => {
808
808
  let _ = n.target, E = [...B.branches].some((n) => n.contains(_));
809
- !Fj || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
810
- }, W), Lj = useFocusOutside((n) => {
809
+ !Hj || E || (j?.(n), N?.(n), n.defaultPrevented || P?.());
810
+ }, W), Wj = useFocusOutside((n) => {
811
811
  let _ = n.target;
812
812
  [...B.branches].some((n) => n.contains(_)) || (M?.(n), N?.(n), n.defaultPrevented || P?.());
813
813
  }, W);
814
814
  return useEscapeKeydown((n) => {
815
- Nj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
815
+ Bj === B.layers.size - 1 && (A?.(n), !n.defaultPrevented && P && (n.preventDefault(), P()));
816
816
  }, W), React$1.useEffect(() => {
817
817
  if (H) return O && (B.layersWithOutsidePointerEventsDisabled.size === 0 && (originalBodyPointerEvents = W.body.style.pointerEvents, W.body.style.pointerEvents = "none"), B.layersWithOutsidePointerEventsDisabled.add(H)), B.layers.add(H), dispatchUpdate(), () => {
818
818
  O && B.layersWithOutsidePointerEventsDisabled.size === 1 && (W.body.style.pointerEvents = originalBodyPointerEvents);
@@ -831,12 +831,12 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
831
831
  ...z,
832
832
  ref: Z,
833
833
  style: {
834
- pointerEvents: Pj ? Fj ? "auto" : "none" : void 0,
834
+ pointerEvents: Vj ? Hj ? "auto" : "none" : void 0,
835
835
  ..._.style
836
836
  },
837
- onFocusCapture: composeEventHandlers(_.onFocusCapture, Lj.onFocusCapture),
838
- onBlurCapture: composeEventHandlers(_.onBlurCapture, Lj.onBlurCapture),
839
- onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, Ij.onPointerDownCapture)
837
+ onFocusCapture: composeEventHandlers(_.onFocusCapture, Wj.onFocusCapture),
838
+ onBlurCapture: composeEventHandlers(_.onBlurCapture, Wj.onBlurCapture),
839
+ onPointerDownCapture: composeEventHandlers(_.onPointerDownCapture, Uj.onPointerDownCapture)
840
840
  });
841
841
  });
842
842
  DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
@@ -1195,7 +1195,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
1195
1195
  onScrollCapture: nothing,
1196
1196
  onWheelCapture: nothing,
1197
1197
  onTouchMoveCapture: nothing
1198
- }), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, Aj = _.inert, jj = _.allowPinchZoom, Mj = _.as, Nj = Mj === void 0 ? "div" : Mj, Pj = _.gapMode, Fj = __rest(_, [
1198
+ }), j = A[0], M = A[1], N = _.forwardProps, P = _.children, z = _.className, B = _.removeScrollBar, H = _.enabled, U = _.shards, W = _.sideCar, G = _.noRelative, Z = _.noIsolation, Lj = _.inert, Rj = _.allowPinchZoom, zj = _.as, Bj = zj === void 0 ? "div" : zj, Vj = _.gapMode, Hj = __rest(_, [
1199
1199
  "forwardProps",
1200
1200
  "children",
1201
1201
  "className",
@@ -1209,21 +1209,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
1209
1209
  "allowPinchZoom",
1210
1210
  "as",
1211
1211
  "gapMode"
1212
- ]), Ij = W, Lj = useMergeRefs([O, E]), Rj = __assign$2(__assign$2({}, Fj), j);
1213
- return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(Ij, {
1212
+ ]), Uj = W, Wj = useMergeRefs([O, E]), Gj = __assign$2(__assign$2({}, Hj), j);
1213
+ return React$1.createElement(React$1.Fragment, null, H && React$1.createElement(Uj, {
1214
1214
  sideCar: effectCar,
1215
1215
  removeScrollBar: B,
1216
1216
  shards: U,
1217
1217
  noRelative: G,
1218
1218
  noIsolation: Z,
1219
- inert: Aj,
1219
+ inert: Lj,
1220
1220
  setCallbacks: M,
1221
- allowPinchZoom: !!jj,
1221
+ allowPinchZoom: !!Rj,
1222
1222
  lockRef: O,
1223
- gapMode: Pj
1224
- }), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, Rj), { ref: Lj })) : React$1.createElement(Nj, __assign$2({}, Rj, {
1223
+ gapMode: Vj
1224
+ }), N ? React$1.cloneElement(React$1.Children.only(P), __assign$2(__assign$2({}, Gj), { ref: Wj })) : React$1.createElement(Bj, __assign$2({}, Gj, {
1225
1225
  className: z,
1226
- ref: Lj
1226
+ ref: Wj
1227
1227
  }), P));
1228
1228
  });
1229
1229
  RemoveScroll.defaultProps = {
@@ -1413,8 +1413,8 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
1413
1413
  if (!N) break;
1414
1414
  var W = getScrollVariables(n, N), G = W[0], Z = W[1] - W[2] - j * G;
1415
1415
  (G || Z) && elementCouldBeScrolled(n, N) && (H += Z, U += G);
1416
- var Aj = N.parentNode;
1417
- N = Aj && Aj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Aj.host : Aj;
1416
+ var Lj = N.parentNode;
1417
+ N = Lj && Lj.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Lj.host : Lj;
1418
1418
  } while (!P && N !== document.body || P && (_.contains(N) || _ === N));
1419
1419
  return (B && (A && Math.abs(H) < 1 || !A && M > H) || !B && (A && Math.abs(U) < 1 || !A && -M > U)) && (z = !0), z;
1420
1420
  }, getTouchXY = function(n) {
@@ -1961,7 +1961,7 @@ var computePosition$1 = async (n, _, E) => {
1961
1961
  strategy: A
1962
1962
  }), { x: B, y: H } = computeCoordsFromPlacement(z, O, P), U = O, W = {}, G = 0;
1963
1963
  for (let E = 0; E < N.length; E++) {
1964
- let { name: j, fn: Z } = N[E], { x: Aj, y: jj, data: Mj, reset: Nj } = await Z({
1964
+ let { name: j, fn: Z } = N[E], { x: Lj, y: Rj, data: zj, reset: Bj } = await Z({
1965
1965
  x: B,
1966
1966
  y: H,
1967
1967
  initialPlacement: O,
@@ -1975,17 +1975,17 @@ var computePosition$1 = async (n, _, E) => {
1975
1975
  floating: _
1976
1976
  }
1977
1977
  });
1978
- B = Aj ?? B, H = jj ?? H, W = {
1978
+ B = Lj ?? B, H = Rj ?? H, W = {
1979
1979
  ...W,
1980
1980
  [j]: {
1981
1981
  ...W[j],
1982
- ...Mj
1982
+ ...zj
1983
1983
  }
1984
- }, Nj && G <= 50 && (G++, typeof Nj == "object" && (Nj.placement && (U = Nj.placement), Nj.rects && (z = Nj.rects === !0 ? await M.getElementRects({
1984
+ }, Bj && G <= 50 && (G++, typeof Bj == "object" && (Bj.placement && (U = Bj.placement), Bj.rects && (z = Bj.rects === !0 ? await M.getElementRects({
1985
1985
  reference: n,
1986
1986
  floating: _,
1987
1987
  strategy: A
1988
- }) : Nj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
1988
+ }) : Bj.rects), {x: B, y: H} = computeCoordsFromPlacement(z, U, P)), E = -1);
1989
1989
  }
1990
1990
  return {
1991
1991
  x: B,
@@ -2002,25 +2002,25 @@ async function detectOverflow$1(n, _) {
2002
2002
  boundary: P,
2003
2003
  rootBoundary: z,
2004
2004
  strategy: N
2005
- })), Aj = B === "floating" ? {
2005
+ })), Lj = B === "floating" ? {
2006
2006
  x: E,
2007
2007
  y: O,
2008
2008
  width: j.floating.width,
2009
2009
  height: j.floating.height
2010
- } : j.reference, jj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), Mj = await (A.isElement == null ? void 0 : A.isElement(jj)) && await (A.getScale == null ? void 0 : A.getScale(jj)) || {
2010
+ } : j.reference, Rj = await (A.getOffsetParent == null ? void 0 : A.getOffsetParent(M.floating)), zj = await (A.isElement == null ? void 0 : A.isElement(Rj)) && await (A.getScale == null ? void 0 : A.getScale(Rj)) || {
2011
2011
  x: 1,
2012
2012
  y: 1
2013
- }, Nj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
2013
+ }, Bj = rectToClientRect(A.convertOffsetParentRelativeRectToViewportRelativeRect ? await A.convertOffsetParentRelativeRectToViewportRelativeRect({
2014
2014
  elements: M,
2015
- rect: Aj,
2016
- offsetParent: jj,
2015
+ rect: Lj,
2016
+ offsetParent: Rj,
2017
2017
  strategy: N
2018
- }) : Aj);
2018
+ }) : Lj);
2019
2019
  return {
2020
- top: (Z.top - Nj.top + W.top) / Mj.y,
2021
- bottom: (Nj.bottom - Z.bottom + W.bottom) / Mj.y,
2022
- left: (Z.left - Nj.left + W.left) / Mj.x,
2023
- right: (Nj.right - Z.right + W.right) / Mj.x
2020
+ top: (Z.top - Bj.top + W.top) / zj.y,
2021
+ bottom: (Bj.bottom - Z.bottom + W.bottom) / zj.y,
2022
+ left: (Z.left - Bj.left + W.left) / zj.x,
2023
+ right: (Bj.right - Z.right + W.right) / zj.x
2024
2024
  };
2025
2025
  }
2026
2026
  var arrow$2 = (n) => ({
@@ -2032,17 +2032,17 @@ var arrow$2 = (n) => ({
2032
2032
  let H = getPaddingObject(B), U = {
2033
2033
  x: E,
2034
2034
  y: O
2035
- }, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Aj = W === "y", jj = Aj ? "top" : "left", Mj = Aj ? "bottom" : "right", Nj = Aj ? "clientHeight" : "clientWidth", Pj = j.reference[G] + j.reference[W] - U[W] - j.floating[G], Fj = U[W] - j.reference[W], Ij = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), Lj = Ij ? Ij[Nj] : 0;
2036
- (!Lj || !await (M.isElement == null ? void 0 : M.isElement(Ij))) && (Lj = N.floating[Nj] || j.floating[G]);
2037
- let Rj = Pj / 2 - Fj / 2, zj = Lj / 2 - Z[G] / 2 - 1, Bj = min(H[jj], zj), Vj = min(H[Mj], zj), Hj = Bj, Uj = Lj - Z[G] - Vj, Wj = Lj / 2 - Z[G] / 2 + Rj, Gj = clamp$3(Hj, Wj, Uj), Kj = !P.arrow && getAlignment(A) != null && Wj !== Gj && j.reference[G] / 2 - (Wj < Hj ? Bj : Vj) - Z[G] / 2 < 0, qj = Kj ? Wj < Hj ? Wj - Hj : Wj - Uj : 0;
2035
+ }, W = getAlignmentAxis(A), G = getAxisLength(W), Z = await M.getDimensions(z), Lj = W === "y", Rj = Lj ? "top" : "left", zj = Lj ? "bottom" : "right", Bj = Lj ? "clientHeight" : "clientWidth", Vj = j.reference[G] + j.reference[W] - U[W] - j.floating[G], Hj = U[W] - j.reference[W], Uj = await (M.getOffsetParent == null ? void 0 : M.getOffsetParent(z)), Wj = Uj ? Uj[Bj] : 0;
2036
+ (!Wj || !await (M.isElement == null ? void 0 : M.isElement(Uj))) && (Wj = N.floating[Bj] || j.floating[G]);
2037
+ let Gj = Vj / 2 - Hj / 2, Kj = Wj / 2 - Z[G] / 2 - 1, qj = min(H[Rj], Kj), Jj = min(H[zj], Kj), Yj = qj, Xj = Wj - Z[G] - Jj, Zj = Wj / 2 - Z[G] / 2 + Gj, Qj = clamp$3(Yj, Zj, Xj), $j = !P.arrow && getAlignment(A) != null && Zj !== Qj && j.reference[G] / 2 - (Zj < Yj ? qj : Jj) - Z[G] / 2 < 0, eM = $j ? Zj < Yj ? Zj - Yj : Zj - Xj : 0;
2038
2038
  return {
2039
- [W]: U[W] + qj,
2039
+ [W]: U[W] + eM,
2040
2040
  data: {
2041
- [W]: Gj,
2042
- centerOffset: Wj - Gj - qj,
2043
- ...Kj && { alignmentOffset: qj }
2041
+ [W]: Qj,
2042
+ centerOffset: Zj - Qj - eM,
2043
+ ...$j && { alignmentOffset: eM }
2044
2044
  },
2045
- reset: Kj
2045
+ reset: $j
2046
2046
  };
2047
2047
  }
2048
2048
  }), flip$2 = function(n) {
@@ -2053,32 +2053,32 @@ var arrow$2 = (n) => ({
2053
2053
  var E;
2054
2054
  let { placement: O, middlewareData: A, rects: j, initialPlacement: M, platform: N, elements: P } = _, { mainAxis: z = !0, crossAxis: B = !0, fallbackPlacements: H, fallbackStrategy: U = "bestFit", fallbackAxisSideDirection: W = "none", flipAlignment: G = !0, ...Z } = evaluate(n, _);
2055
2055
  if ((E = A.arrow) != null && E.alignmentOffset) return {};
2056
- let Aj = getSide(O), jj = getSideAxis(M), Mj = getSide(M) === M, Nj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), Pj = H || (Mj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), Fj = W !== "none";
2057
- !H && Fj && Pj.push(...getOppositeAxisPlacements(M, G, W, Nj));
2058
- let Ij = [M, ...Pj], Lj = await detectOverflow$1(_, Z), Rj = [], zj = A.flip?.overflows || [];
2059
- if (z && Rj.push(Lj[Aj]), B) {
2060
- let n = getAlignmentSides(O, j, Nj);
2061
- Rj.push(Lj[n[0]], Lj[n[1]]);
2056
+ let Lj = getSide(O), Rj = getSideAxis(M), zj = getSide(M) === M, Bj = await (N.isRTL == null ? void 0 : N.isRTL(P.floating)), Vj = H || (zj || !G ? [getOppositePlacement(M)] : getExpandedPlacements(M)), Hj = W !== "none";
2057
+ !H && Hj && Vj.push(...getOppositeAxisPlacements(M, G, W, Bj));
2058
+ let Uj = [M, ...Vj], Wj = await detectOverflow$1(_, Z), Gj = [], Kj = A.flip?.overflows || [];
2059
+ if (z && Gj.push(Wj[Lj]), B) {
2060
+ let n = getAlignmentSides(O, j, Bj);
2061
+ Gj.push(Wj[n[0]], Wj[n[1]]);
2062
2062
  }
2063
- if (zj = [...zj, {
2063
+ if (Kj = [...Kj, {
2064
2064
  placement: O,
2065
- overflows: Rj
2066
- }], !Rj.every((n) => n <= 0)) {
2067
- let n = (A.flip?.index || 0) + 1, _ = Ij[n];
2068
- if (_ && (!(B === "alignment" && jj !== getSideAxis(_)) || zj.every((n) => getSideAxis(n.placement) === jj ? n.overflows[0] > 0 : !0))) return {
2065
+ overflows: Gj
2066
+ }], !Gj.every((n) => n <= 0)) {
2067
+ let n = (A.flip?.index || 0) + 1, _ = Uj[n];
2068
+ if (_ && (!(B === "alignment" && Rj !== getSideAxis(_)) || Kj.every((n) => getSideAxis(n.placement) === Rj ? n.overflows[0] > 0 : !0))) return {
2069
2069
  data: {
2070
2070
  index: n,
2071
- overflows: zj
2071
+ overflows: Kj
2072
2072
  },
2073
2073
  reset: { placement: _ }
2074
2074
  };
2075
- let E = zj.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
2075
+ let E = Kj.filter((n) => n.overflows[0] <= 0).sort((n, _) => n.overflows[1] - _.overflows[1])[0]?.placement;
2076
2076
  if (!E) switch (U) {
2077
2077
  case "bestFit": {
2078
- let n = zj.filter((n) => {
2079
- if (Fj) {
2078
+ let n = Kj.filter((n) => {
2079
+ if (Hj) {
2080
2080
  let _ = getSideAxis(n.placement);
2081
- return _ === jj || _ === "y";
2081
+ return _ === Rj || _ === "y";
2082
2082
  }
2083
2083
  return !0;
2084
2084
  }).map((n) => [n.placement, n.overflows.filter((n) => n > 0).reduce((n, _) => n + _, 0)]).sort((n, _) => n[1] - _[1])[0]?.[0];
@@ -2221,7 +2221,7 @@ var offset$2 = function(n) {
2221
2221
  let { x: E, y: O, placement: A, rects: j, middlewareData: M } = _, { offset: N = 0, mainAxis: P = !0, crossAxis: z = !0 } = evaluate(n, _), B = {
2222
2222
  x: E,
2223
2223
  y: O
2224
- }, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), Aj = typeof Z == "number" ? {
2224
+ }, H = getSideAxis(A), U = getOppositeAxis(H), W = B[U], G = B[H], Z = evaluate(N, _), Lj = typeof Z == "number" ? {
2225
2225
  mainAxis: Z,
2226
2226
  crossAxis: 0
2227
2227
  } : {
@@ -2230,11 +2230,11 @@ var offset$2 = function(n) {
2230
2230
  ...Z
2231
2231
  };
2232
2232
  if (P) {
2233
- let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + Aj.mainAxis, E = j.reference[U] + j.reference[n] - Aj.mainAxis;
2233
+ let n = U === "y" ? "height" : "width", _ = j.reference[U] - j.floating[n] + Lj.mainAxis, E = j.reference[U] + j.reference[n] - Lj.mainAxis;
2234
2234
  W < _ ? W = _ : W > E && (W = E);
2235
2235
  }
2236
2236
  if (z) {
2237
- let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : Aj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Aj.crossAxis : 0);
2237
+ let n = U === "y" ? "width" : "height", _ = originSides.has(getSide(A)), E = j.reference[H] - j.floating[n] + (_ && M.offset?.[H] || 0) + (_ ? 0 : Lj.crossAxis), O = j.reference[H] + j.reference[n] + (_ ? 0 : M.offset?.[H] || 0) - (_ ? Lj.crossAxis : 0);
2238
2238
  G < E ? G = E : G > O && (G = O);
2239
2239
  }
2240
2240
  return {
@@ -2249,20 +2249,20 @@ var offset$2 = function(n) {
2249
2249
  options: n,
2250
2250
  async fn(_) {
2251
2251
  var E, O;
2252
- let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating, Aj, jj;
2253
- H === "top" || H === "bottom" ? (Aj = H, jj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (jj = H, Aj = U === "end" ? "top" : "bottom");
2254
- let Mj = Z - B.top - B.bottom, Nj = G - B.left - B.right, Pj = min(Z - B[Aj], Mj), Fj = min(G - B[jj], Nj), Ij = !_.middlewareData.shift, Lj = Pj, Rj = Fj;
2255
- if ((E = _.middlewareData.shift) != null && E.enabled.x && (Rj = Nj), (O = _.middlewareData.shift) != null && O.enabled.y && (Lj = Mj), Ij && !U) {
2252
+ let { placement: A, rects: j, platform: M, elements: N } = _, { apply: P = () => {}, ...z } = evaluate(n, _), B = await detectOverflow$1(_, z), H = getSide(A), U = getAlignment(A), W = getSideAxis(A) === "y", { width: G, height: Z } = j.floating, Lj, Rj;
2253
+ H === "top" || H === "bottom" ? (Lj = H, Rj = U === (await (M.isRTL == null ? void 0 : M.isRTL(N.floating)) ? "start" : "end") ? "left" : "right") : (Rj = H, Lj = U === "end" ? "top" : "bottom");
2254
+ let zj = Z - B.top - B.bottom, Bj = G - B.left - B.right, Vj = min(Z - B[Lj], zj), Hj = min(G - B[Rj], Bj), Uj = !_.middlewareData.shift, Wj = Vj, Gj = Hj;
2255
+ if ((E = _.middlewareData.shift) != null && E.enabled.x && (Gj = Bj), (O = _.middlewareData.shift) != null && O.enabled.y && (Wj = zj), Uj && !U) {
2256
2256
  let n = max(B.left, 0), _ = max(B.right, 0), E = max(B.top, 0), O = max(B.bottom, 0);
2257
- W ? Rj = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : Lj = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
2257
+ W ? Gj = G - 2 * (n !== 0 || _ !== 0 ? n + _ : max(B.left, B.right)) : Wj = Z - 2 * (E !== 0 || O !== 0 ? E + O : max(B.top, B.bottom));
2258
2258
  }
2259
2259
  await P({
2260
2260
  ..._,
2261
- availableWidth: Rj,
2262
- availableHeight: Lj
2261
+ availableWidth: Gj,
2262
+ availableHeight: Wj
2263
2263
  });
2264
- let zj = await M.getDimensions(N.floating);
2265
- return G !== zj.width || Z !== zj.height ? { reset: { rects: !0 } } : {};
2264
+ let Kj = await M.getDimensions(N.floating);
2265
+ return G !== Kj.width || Z !== Kj.height ? { reset: { rects: !0 } } : {};
2266
2266
  }
2267
2267
  };
2268
2268
  };
@@ -2646,27 +2646,27 @@ function observeMove(n, _) {
2646
2646
  N === void 0 && (N = !1), P === void 0 && (P = 1), j();
2647
2647
  let z = n.getBoundingClientRect(), { left: B, top: H, width: U, height: W } = z;
2648
2648
  if (N || _(), !U || !W) return;
2649
- let G = floor(H), Z = floor(A.clientWidth - (B + U)), Aj = floor(A.clientHeight - (H + W)), jj = floor(B), Mj = {
2650
- rootMargin: -G + "px " + -Z + "px " + -Aj + "px " + -jj + "px",
2649
+ let G = floor(H), Z = floor(A.clientWidth - (B + U)), Lj = floor(A.clientHeight - (H + W)), Rj = floor(B), zj = {
2650
+ rootMargin: -G + "px " + -Z + "px " + -Lj + "px " + -Rj + "px",
2651
2651
  threshold: max(0, min(1, P)) || 1
2652
- }, Nj = !0;
2653
- function Pj(_) {
2652
+ }, Bj = !0;
2653
+ function Vj(_) {
2654
2654
  let E = _[0].intersectionRatio;
2655
2655
  if (E !== P) {
2656
- if (!Nj) return M();
2656
+ if (!Bj) return M();
2657
2657
  E ? M(!1, E) : O = setTimeout(() => {
2658
2658
  M(!1, 1e-7);
2659
2659
  }, 1e3);
2660
2660
  }
2661
- E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Nj = !1;
2661
+ E === 1 && !rectsAreEqual(z, n.getBoundingClientRect()) && M(), Bj = !1;
2662
2662
  }
2663
2663
  try {
2664
- E = new IntersectionObserver(Pj, {
2665
- ...Mj,
2664
+ E = new IntersectionObserver(Vj, {
2665
+ ...zj,
2666
2666
  root: A.ownerDocument
2667
2667
  });
2668
2668
  } catch {
2669
- E = new IntersectionObserver(Pj, Mj);
2669
+ E = new IntersectionObserver(Vj, zj);
2670
2670
  }
2671
2671
  E.observe(n);
2672
2672
  }
@@ -2687,10 +2687,10 @@ function autoUpdate(n, _, E, O) {
2687
2687
  })), E();
2688
2688
  }), z && !P && W.observe(z), W.observe(_));
2689
2689
  let G, Z = P ? getBoundingClientRect(n) : null;
2690
- P && Aj();
2691
- function Aj() {
2690
+ P && Lj();
2691
+ function Lj() {
2692
2692
  let _ = getBoundingClientRect(n);
2693
- Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Aj);
2693
+ Z && !rectsAreEqual(Z, _) && E(), Z = _, G = requestAnimationFrame(Lj);
2694
2694
  }
2695
2695
  return E(), () => {
2696
2696
  var n;
@@ -2757,23 +2757,23 @@ function useFloating(_) {
2757
2757
  isPositioned: !1
2758
2758
  }), [W, G] = React$1.useState(A);
2759
2759
  deepEqual(W, A) || G(A);
2760
- let [Z, Aj] = React$1.useState(null), [jj, Mj] = React$1.useState(null), Nj = React$1.useCallback((n) => {
2761
- n !== Rj.current && (Rj.current = n, Aj(n));
2762
- }, []), Pj = React$1.useCallback((n) => {
2763
- n !== zj.current && (zj.current = n, Mj(n));
2764
- }, []), Ij = M || Z, Lj = N || jj, Rj = React$1.useRef(null), zj = React$1.useRef(null), Bj = React$1.useRef(H), Vj = z != null, Hj = useLatestRef(z), Uj = useLatestRef(j), Wj = useLatestRef(B), Gj = React$1.useCallback(() => {
2765
- if (!Rj.current || !zj.current) return;
2760
+ let [Z, Lj] = React$1.useState(null), [Rj, zj] = React$1.useState(null), Bj = React$1.useCallback((n) => {
2761
+ n !== Gj.current && (Gj.current = n, Lj(n));
2762
+ }, []), Vj = React$1.useCallback((n) => {
2763
+ n !== Kj.current && (Kj.current = n, zj(n));
2764
+ }, []), Uj = M || Z, Wj = N || Rj, Gj = React$1.useRef(null), Kj = React$1.useRef(null), qj = React$1.useRef(H), Jj = z != null, Yj = useLatestRef(z), Xj = useLatestRef(j), Zj = useLatestRef(B), Qj = React$1.useCallback(() => {
2765
+ if (!Gj.current || !Kj.current) return;
2766
2766
  let n = {
2767
2767
  placement: E,
2768
2768
  strategy: O,
2769
2769
  middleware: W
2770
2770
  };
2771
- Uj.current && (n.platform = Uj.current), computePosition(Rj.current, zj.current, n).then((n) => {
2771
+ Xj.current && (n.platform = Xj.current), computePosition(Gj.current, Kj.current, n).then((n) => {
2772
2772
  let _ = {
2773
2773
  ...n,
2774
- isPositioned: Wj.current !== !1
2774
+ isPositioned: Zj.current !== !1
2775
2775
  };
2776
- Kj.current && !deepEqual(Bj.current, _) && (Bj.current = _, ReactDOM$1.flushSync(() => {
2776
+ $j.current && !deepEqual(qj.current, _) && (qj.current = _, ReactDOM$1.flushSync(() => {
2777
2777
  U(_);
2778
2778
  }));
2779
2779
  });
@@ -2781,50 +2781,50 @@ function useFloating(_) {
2781
2781
  W,
2782
2782
  E,
2783
2783
  O,
2784
- Uj,
2785
- Wj
2784
+ Xj,
2785
+ Zj
2786
2786
  ]);
2787
2787
  index(() => {
2788
- B === !1 && Bj.current.isPositioned && (Bj.current.isPositioned = !1, U((n) => ({
2788
+ B === !1 && qj.current.isPositioned && (qj.current.isPositioned = !1, U((n) => ({
2789
2789
  ...n,
2790
2790
  isPositioned: !1
2791
2791
  })));
2792
2792
  }, [B]);
2793
- let Kj = React$1.useRef(!1);
2794
- index(() => (Kj.current = !0, () => {
2795
- Kj.current = !1;
2793
+ let $j = React$1.useRef(!1);
2794
+ index(() => ($j.current = !0, () => {
2795
+ $j.current = !1;
2796
2796
  }), []), index(() => {
2797
- if (Ij && (Rj.current = Ij), Lj && (zj.current = Lj), Ij && Lj) {
2798
- if (Hj.current) return Hj.current(Ij, Lj, Gj);
2799
- Gj();
2797
+ if (Uj && (Gj.current = Uj), Wj && (Kj.current = Wj), Uj && Wj) {
2798
+ if (Yj.current) return Yj.current(Uj, Wj, Qj);
2799
+ Qj();
2800
2800
  }
2801
2801
  }, [
2802
- Ij,
2803
- Lj,
2804
- Gj,
2805
- Hj,
2806
- Vj
2802
+ Uj,
2803
+ Wj,
2804
+ Qj,
2805
+ Yj,
2806
+ Jj
2807
2807
  ]);
2808
- let qj = React$1.useMemo(() => ({
2809
- reference: Rj,
2810
- floating: zj,
2811
- setReference: Nj,
2812
- setFloating: Pj
2813
- }), [Nj, Pj]), Jj = React$1.useMemo(() => ({
2814
- reference: Ij,
2815
- floating: Lj
2816
- }), [Ij, Lj]), Yj = React$1.useMemo(() => {
2808
+ let eM = React$1.useMemo(() => ({
2809
+ reference: Gj,
2810
+ floating: Kj,
2811
+ setReference: Bj,
2812
+ setFloating: Vj
2813
+ }), [Bj, Vj]), tM = React$1.useMemo(() => ({
2814
+ reference: Uj,
2815
+ floating: Wj
2816
+ }), [Uj, Wj]), nM = React$1.useMemo(() => {
2817
2817
  let n = {
2818
2818
  position: O,
2819
2819
  left: 0,
2820
2820
  top: 0
2821
2821
  };
2822
- if (!Jj.floating) return n;
2823
- let _ = roundByDPR(Jj.floating, H.x), E = roundByDPR(Jj.floating, H.y);
2822
+ if (!tM.floating) return n;
2823
+ let _ = roundByDPR(tM.floating, H.x), E = roundByDPR(tM.floating, H.y);
2824
2824
  return P ? {
2825
2825
  ...n,
2826
2826
  transform: "translate(" + _ + "px, " + E + "px)",
2827
- ...getDPR(Jj.floating) >= 1.5 && { willChange: "transform" }
2827
+ ...getDPR(tM.floating) >= 1.5 && { willChange: "transform" }
2828
2828
  } : {
2829
2829
  position: O,
2830
2830
  left: _,
@@ -2833,22 +2833,22 @@ function useFloating(_) {
2833
2833
  }, [
2834
2834
  O,
2835
2835
  P,
2836
- Jj.floating,
2836
+ tM.floating,
2837
2837
  H.x,
2838
2838
  H.y
2839
2839
  ]);
2840
2840
  return React$1.useMemo(() => ({
2841
2841
  ...H,
2842
- update: Gj,
2843
- refs: qj,
2844
- elements: Jj,
2845
- floatingStyles: Yj
2842
+ update: Qj,
2843
+ refs: eM,
2844
+ elements: tM,
2845
+ floatingStyles: nM
2846
2846
  }), [
2847
2847
  H,
2848
- Gj,
2849
- qj,
2850
- Jj,
2851
- Yj
2848
+ Qj,
2849
+ eM,
2850
+ tM,
2851
+ nM
2852
2852
  ]);
2853
2853
  }
2854
2854
  var arrow$1$1 = (n) => {
@@ -2925,70 +2925,70 @@ var ANCHOR_NAME$2 = "PopperAnchor", PopperAnchor = React$1.forwardRef((_, E) =>
2925
2925
  });
2926
2926
  PopperAnchor.displayName = ANCHOR_NAME$2;
2927
2927
  var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$6), PopperContent = React$1.forwardRef((_, E) => {
2928
- let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...Aj } = _, jj = usePopperContext(CONTENT_NAME$6, O), [Mj, Nj] = React$1.useState(null), Pj = useComposedRefs$1(E, (n) => Nj(n)), [Fj, Ij] = React$1.useState(null), Lj = useSize(Fj), Rj = Lj?.width ?? 0, Bj = Lj?.height ?? 0, Vj = A + (M === "center" ? "" : "-" + M), Hj = typeof H == "number" ? H : {
2928
+ let { __scopePopper: O, side: A = "bottom", sideOffset: j = 0, align: M = "center", alignOffset: N = 0, arrowPadding: P = 0, avoidCollisions: z = !0, collisionBoundary: B = [], collisionPadding: H = 0, sticky: U = "partial", hideWhenDetached: W = !1, updatePositionStrategy: G = "optimized", onPlaced: Z, ...Lj } = _, Rj = usePopperContext(CONTENT_NAME$6, O), [zj, Bj] = React$1.useState(null), Vj = useComposedRefs$1(E, (n) => Bj(n)), [Hj, Uj] = React$1.useState(null), Wj = useSize(Hj), Gj = Wj?.width ?? 0, qj = Wj?.height ?? 0, Jj = A + (M === "center" ? "" : "-" + M), Yj = typeof H == "number" ? H : {
2929
2929
  top: 0,
2930
2930
  right: 0,
2931
2931
  bottom: 0,
2932
2932
  left: 0,
2933
2933
  ...H
2934
- }, Uj = Array.isArray(B) ? B : [B], Wj = Uj.length > 0, Gj = {
2935
- padding: Hj,
2936
- boundary: Uj.filter(isNotNull$2),
2937
- altBoundary: Wj
2938
- }, { refs: Kj, floatingStyles: qj, placement: Jj, isPositioned: Yj, middlewareData: Xj } = useFloating({
2934
+ }, Xj = Array.isArray(B) ? B : [B], Zj = Xj.length > 0, Qj = {
2935
+ padding: Yj,
2936
+ boundary: Xj.filter(isNotNull$2),
2937
+ altBoundary: Zj
2938
+ }, { refs: $j, floatingStyles: eM, placement: tM, isPositioned: nM, middlewareData: rM } = useFloating({
2939
2939
  strategy: "fixed",
2940
- placement: Vj,
2940
+ placement: Jj,
2941
2941
  whileElementsMounted: (...n) => autoUpdate(...n, { animationFrame: G === "always" }),
2942
- elements: { reference: jj.anchor },
2942
+ elements: { reference: Rj.anchor },
2943
2943
  middleware: [
2944
2944
  offset({
2945
- mainAxis: j + Bj,
2945
+ mainAxis: j + qj,
2946
2946
  alignmentAxis: N
2947
2947
  }),
2948
2948
  z && shift({
2949
2949
  mainAxis: !0,
2950
2950
  crossAxis: !1,
2951
2951
  limiter: U === "partial" ? limitShift() : void 0,
2952
- ...Gj
2952
+ ...Qj
2953
2953
  }),
2954
- z && flip({ ...Gj }),
2954
+ z && flip({ ...Qj }),
2955
2955
  size({
2956
- ...Gj,
2956
+ ...Qj,
2957
2957
  apply: ({ elements: n, rects: _, availableWidth: E, availableHeight: O }) => {
2958
2958
  let { width: A, height: j } = _.reference, M = n.floating.style;
2959
2959
  M.setProperty("--radix-popper-available-width", `${E}px`), M.setProperty("--radix-popper-available-height", `${O}px`), M.setProperty("--radix-popper-anchor-width", `${A}px`), M.setProperty("--radix-popper-anchor-height", `${j}px`);
2960
2960
  }
2961
2961
  }),
2962
- Fj && arrow({
2963
- element: Fj,
2962
+ Hj && arrow({
2963
+ element: Hj,
2964
2964
  padding: P
2965
2965
  }),
2966
2966
  transformOrigin({
2967
- arrowWidth: Rj,
2968
- arrowHeight: Bj
2967
+ arrowWidth: Gj,
2968
+ arrowHeight: qj
2969
2969
  }),
2970
2970
  W && hide({
2971
2971
  strategy: "referenceHidden",
2972
- ...Gj
2972
+ ...Qj
2973
2973
  })
2974
2974
  ]
2975
- }), [Zj, Qj] = getSideAndAlignFromPlacement(Jj), $j = useCallbackRef(Z);
2975
+ }), [iM, aM] = getSideAndAlignFromPlacement(tM), oM = useCallbackRef(Z);
2976
2976
  useLayoutEffect2(() => {
2977
- Yj && $j?.();
2978
- }, [Yj, $j]);
2979
- let eM = Xj.arrow?.x, tM = Xj.arrow?.y, nM = Xj.arrow?.centerOffset !== 0, [rM, iM] = React$1.useState();
2977
+ nM && oM?.();
2978
+ }, [nM, oM]);
2979
+ let sM = rM.arrow?.x, cM = rM.arrow?.y, lM = rM.arrow?.centerOffset !== 0, [uM, dM] = React$1.useState();
2980
2980
  return useLayoutEffect2(() => {
2981
- Mj && iM(window.getComputedStyle(Mj).zIndex);
2982
- }, [Mj]), /* @__PURE__ */ jsx("div", {
2983
- ref: Kj.setFloating,
2981
+ zj && dM(window.getComputedStyle(zj).zIndex);
2982
+ }, [zj]), /* @__PURE__ */ jsx("div", {
2983
+ ref: $j.setFloating,
2984
2984
  "data-radix-popper-content-wrapper": "",
2985
2985
  style: {
2986
- ...qj,
2987
- transform: Yj ? qj.transform : "translate(0, -200%)",
2986
+ ...eM,
2987
+ transform: nM ? eM.transform : "translate(0, -200%)",
2988
2988
  minWidth: "max-content",
2989
- zIndex: rM,
2990
- "--radix-popper-transform-origin": [Xj.transformOrigin?.x, Xj.transformOrigin?.y].join(" "),
2991
- ...Xj.hide?.referenceHidden && {
2989
+ zIndex: uM,
2990
+ "--radix-popper-transform-origin": [rM.transformOrigin?.x, rM.transformOrigin?.y].join(" "),
2991
+ ...rM.hide?.referenceHidden && {
2992
2992
  visibility: "hidden",
2993
2993
  pointerEvents: "none"
2994
2994
  }
@@ -2996,19 +2996,19 @@ var CONTENT_NAME$6 = "PopperContent", [PopperContentProvider, useContentContext]
2996
2996
  dir: _.dir,
2997
2997
  children: /* @__PURE__ */ jsx(PopperContentProvider, {
2998
2998
  scope: O,
2999
- placedSide: Zj,
3000
- onArrowChange: Ij,
3001
- arrowX: eM,
3002
- arrowY: tM,
3003
- shouldHideArrow: nM,
2999
+ placedSide: iM,
3000
+ onArrowChange: Uj,
3001
+ arrowX: sM,
3002
+ arrowY: cM,
3003
+ shouldHideArrow: lM,
3004
3004
  children: /* @__PURE__ */ jsx(Primitive.div, {
3005
- "data-side": Zj,
3006
- "data-align": Qj,
3007
- ...Aj,
3008
- ref: Pj,
3005
+ "data-side": iM,
3006
+ "data-align": aM,
3007
+ ...Lj,
3008
+ ref: Vj,
3009
3009
  style: {
3010
- ...Aj.style,
3011
- animation: Yj ? void 0 : "none"
3010
+ ...Lj.style,
3011
+ animation: nM ? void 0 : "none"
3012
3012
  }
3013
3013
  })
3014
3014
  })
@@ -3091,27 +3091,27 @@ var Root2$4 = Popper, Anchor = PopperAnchor, Content$1 = PopperContent, Arrow =
3091
3091
  }));
3092
3092
  RovingFocusGroup.displayName = GROUP_NAME$3;
3093
3093
  var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
3094
- let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [Aj, jj] = useControllableState({
3094
+ let { __scopeRovingFocusGroup: O, orientation: A, loop: j = !1, dir: M, currentTabStopId: N, defaultCurrentTabStopId: P, onCurrentTabStopIdChange: z, onEntryFocus: B, preventScrollOnEntryFocus: H = !1, ...U } = _, W = React$1.useRef(null), G = useComposedRefs$1(E, W), Z = useDirection(M), [Lj, Rj] = useControllableState({
3095
3095
  prop: N,
3096
3096
  defaultProp: P ?? null,
3097
3097
  onChange: z,
3098
3098
  caller: GROUP_NAME$3
3099
- }), [Mj, Nj] = React$1.useState(!1), Pj = useCallbackRef(B), Fj = useCollection$1(O), Ij = React$1.useRef(!1), [Lj, Rj] = React$1.useState(0);
3099
+ }), [zj, Bj] = React$1.useState(!1), Vj = useCallbackRef(B), Hj = useCollection$1(O), Uj = React$1.useRef(!1), [Wj, Gj] = React$1.useState(0);
3100
3100
  return React$1.useEffect(() => {
3101
3101
  let n = W.current;
3102
- if (n) return n.addEventListener(ENTRY_FOCUS, Pj), () => n.removeEventListener(ENTRY_FOCUS, Pj);
3103
- }, [Pj]), /* @__PURE__ */ jsx(RovingFocusProvider, {
3102
+ if (n) return n.addEventListener(ENTRY_FOCUS, Vj), () => n.removeEventListener(ENTRY_FOCUS, Vj);
3103
+ }, [Vj]), /* @__PURE__ */ jsx(RovingFocusProvider, {
3104
3104
  scope: O,
3105
3105
  orientation: A,
3106
3106
  dir: Z,
3107
3107
  loop: j,
3108
- currentTabStopId: Aj,
3109
- onItemFocus: React$1.useCallback((n) => jj(n), [jj]),
3110
- onItemShiftTab: React$1.useCallback(() => Nj(!0), []),
3111
- onFocusableItemAdd: React$1.useCallback(() => Rj((n) => n + 1), []),
3112
- onFocusableItemRemove: React$1.useCallback(() => Rj((n) => n - 1), []),
3108
+ currentTabStopId: Lj,
3109
+ onItemFocus: React$1.useCallback((n) => Rj(n), [Rj]),
3110
+ onItemShiftTab: React$1.useCallback(() => Bj(!0), []),
3111
+ onFocusableItemAdd: React$1.useCallback(() => Gj((n) => n + 1), []),
3112
+ onFocusableItemRemove: React$1.useCallback(() => Gj((n) => n - 1), []),
3113
3113
  children: /* @__PURE__ */ jsx(Primitive.div, {
3114
- tabIndex: Mj || Lj === 0 ? -1 : 0,
3114
+ tabIndex: zj || Wj === 0 ? -1 : 0,
3115
3115
  "data-orientation": A,
3116
3116
  ...U,
3117
3117
  ref: G,
@@ -3120,28 +3120,28 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
3120
3120
  ..._.style
3121
3121
  },
3122
3122
  onMouseDown: composeEventHandlers(_.onMouseDown, () => {
3123
- Ij.current = !0;
3123
+ Uj.current = !0;
3124
3124
  }),
3125
3125
  onFocus: composeEventHandlers(_.onFocus, (n) => {
3126
- let _ = !Ij.current;
3127
- if (n.target === n.currentTarget && _ && !Mj) {
3126
+ let _ = !Uj.current;
3127
+ if (n.target === n.currentTarget && _ && !zj) {
3128
3128
  let _ = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
3129
3129
  if (n.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
3130
- let n = Fj().filter((n) => n.focusable);
3130
+ let n = Hj().filter((n) => n.focusable);
3131
3131
  focusFirst$1([
3132
3132
  n.find((n) => n.active),
3133
- n.find((n) => n.id === Aj),
3133
+ n.find((n) => n.id === Lj),
3134
3134
  ...n
3135
3135
  ].filter(Boolean).map((n) => n.ref.current), H);
3136
3136
  }
3137
3137
  }
3138
- Ij.current = !1;
3138
+ Uj.current = !1;
3139
3139
  }),
3140
- onBlur: composeEventHandlers(_.onBlur, () => Nj(!1))
3140
+ onBlur: composeEventHandlers(_.onBlur, () => Bj(!1))
3141
3141
  })
3142
3142
  });
3143
3143
  }), ITEM_NAME$3 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((_, E) => {
3144
- let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId: Aj } = H;
3144
+ let { __scopeRovingFocusGroup: O, focusable: A = !0, active: j = !1, tabStopId: M, children: N, ...P } = _, z = useId$1(), B = M || z, H = useRovingFocusContext(ITEM_NAME$3, O), U = H.currentTabStopId === B, W = useCollection$1(O), { onFocusableItemAdd: G, onFocusableItemRemove: Z, currentTabStopId: Lj } = H;
3145
3145
  return React$1.useEffect(() => {
3146
3146
  if (A) return G(), () => Z();
3147
3147
  }, [
@@ -3184,7 +3184,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((_, E) => {
3184
3184
  }),
3185
3185
  children: typeof N == "function" ? N({
3186
3186
  isCurrentTabStop: U,
3187
- hasTabStop: Aj != null
3187
+ hasTabStop: Lj != null
3188
3188
  }) : N
3189
3189
  })
3190
3190
  });
@@ -3335,40 +3335,40 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
3335
3335
  onDismiss: () => E.onOpenChange(!1)
3336
3336
  });
3337
3337
  }), Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((_, E) => {
3338
- let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...Aj } = _, jj = useMenuContext(CONTENT_NAME$5, O), Mj = useMenuRootContext(CONTENT_NAME$5, O), Nj = usePopperScope$2(O), Pj = useRovingFocusGroupScope$1(O), Fj = useCollection(O), [Ij, Lj] = React$1.useState(null), Rj = React$1.useRef(null), Bj = useComposedRefs$1(E, Rj, jj.onContentChange), Vj = React$1.useRef(0), Hj = React$1.useRef(""), Uj = React$1.useRef(0), Wj = React$1.useRef(null), Gj = React$1.useRef("right"), Kj = React$1.useRef(0), qj = Z ? Combination_default : React$1.Fragment, Jj = Z ? {
3338
+ let { __scopeMenu: O, loop: A = !1, trapFocus: j, onOpenAutoFocus: M, onCloseAutoFocus: N, disableOutsidePointerEvents: P, onEntryFocus: z, onEscapeKeyDown: B, onPointerDownOutside: H, onFocusOutside: U, onInteractOutside: W, onDismiss: G, disableOutsideScroll: Z, ...Lj } = _, Rj = useMenuContext(CONTENT_NAME$5, O), zj = useMenuRootContext(CONTENT_NAME$5, O), Bj = usePopperScope$2(O), Vj = useRovingFocusGroupScope$1(O), Hj = useCollection(O), [Uj, Wj] = React$1.useState(null), Gj = React$1.useRef(null), qj = useComposedRefs$1(E, Gj, Rj.onContentChange), Jj = React$1.useRef(0), Yj = React$1.useRef(""), Xj = React$1.useRef(0), Zj = React$1.useRef(null), Qj = React$1.useRef("right"), $j = React$1.useRef(0), eM = Z ? Combination_default : React$1.Fragment, tM = Z ? {
3339
3339
  as: Slot$1,
3340
3340
  allowPinchZoom: !0
3341
- } : void 0, Yj = (n) => {
3342
- let _ = Hj.current + n, E = Fj().filter((n) => !n.disabled), O = document.activeElement, A = E.find((n) => n.ref.current === O)?.textValue, j = getNextMatch(E.map((n) => n.textValue), _, A), M = E.find((n) => n.textValue === j)?.ref.current;
3341
+ } : void 0, nM = (n) => {
3342
+ let _ = Yj.current + n, E = Hj().filter((n) => !n.disabled), O = document.activeElement, A = E.find((n) => n.ref.current === O)?.textValue, j = getNextMatch(E.map((n) => n.textValue), _, A), M = E.find((n) => n.textValue === j)?.ref.current;
3343
3343
  (function n(_) {
3344
- Hj.current = _, window.clearTimeout(Vj.current), _ !== "" && (Vj.current = window.setTimeout(() => n(""), 1e3));
3344
+ Yj.current = _, window.clearTimeout(Jj.current), _ !== "" && (Jj.current = window.setTimeout(() => n(""), 1e3));
3345
3345
  })(_), M && setTimeout(() => M.focus());
3346
3346
  };
3347
- React$1.useEffect(() => () => window.clearTimeout(Vj.current), []), useFocusGuards();
3348
- let Xj = React$1.useCallback((n) => Gj.current === Wj.current?.side && isPointerInGraceArea(n, Wj.current?.area), []);
3347
+ React$1.useEffect(() => () => window.clearTimeout(Jj.current), []), useFocusGuards();
3348
+ let rM = React$1.useCallback((n) => Qj.current === Zj.current?.side && isPointerInGraceArea(n, Zj.current?.area), []);
3349
3349
  return /* @__PURE__ */ jsx(MenuContentProvider, {
3350
3350
  scope: O,
3351
- searchRef: Hj,
3351
+ searchRef: Yj,
3352
3352
  onItemEnter: React$1.useCallback((n) => {
3353
- Xj(n) && n.preventDefault();
3354
- }, [Xj]),
3353
+ rM(n) && n.preventDefault();
3354
+ }, [rM]),
3355
3355
  onItemLeave: React$1.useCallback((n) => {
3356
- Xj(n) || (Rj.current?.focus(), Lj(null));
3357
- }, [Xj]),
3356
+ rM(n) || (Gj.current?.focus(), Wj(null));
3357
+ }, [rM]),
3358
3358
  onTriggerLeave: React$1.useCallback((n) => {
3359
- Xj(n) && n.preventDefault();
3360
- }, [Xj]),
3361
- pointerGraceTimerRef: Uj,
3359
+ rM(n) && n.preventDefault();
3360
+ }, [rM]),
3361
+ pointerGraceTimerRef: Xj,
3362
3362
  onPointerGraceIntentChange: React$1.useCallback((n) => {
3363
- Wj.current = n;
3363
+ Zj.current = n;
3364
3364
  }, []),
3365
- children: /* @__PURE__ */ jsx(qj, {
3366
- ...Jj,
3365
+ children: /* @__PURE__ */ jsx(eM, {
3366
+ ...tM,
3367
3367
  children: /* @__PURE__ */ jsx(FocusScope, {
3368
3368
  asChild: !0,
3369
3369
  trapped: j,
3370
3370
  onMountAutoFocus: composeEventHandlers(M, (n) => {
3371
- n.preventDefault(), Rj.current?.focus({ preventScroll: !0 });
3371
+ n.preventDefault(), Gj.current?.focus({ preventScroll: !0 });
3372
3372
  }),
3373
3373
  onUnmountAutoFocus: N,
3374
3374
  children: /* @__PURE__ */ jsx(DismissableLayer, {
@@ -3381,44 +3381,44 @@ var CONTENT_NAME$5 = "MenuContent", [MenuContentProvider, useMenuContentContext]
3381
3381
  onDismiss: G,
3382
3382
  children: /* @__PURE__ */ jsx(Root$2, {
3383
3383
  asChild: !0,
3384
- ...Pj,
3385
- dir: Mj.dir,
3384
+ ...Vj,
3385
+ dir: zj.dir,
3386
3386
  orientation: "vertical",
3387
3387
  loop: A,
3388
- currentTabStopId: Ij,
3389
- onCurrentTabStopIdChange: Lj,
3388
+ currentTabStopId: Uj,
3389
+ onCurrentTabStopIdChange: Wj,
3390
3390
  onEntryFocus: composeEventHandlers(z, (n) => {
3391
- Mj.isUsingKeyboardRef.current || n.preventDefault();
3391
+ zj.isUsingKeyboardRef.current || n.preventDefault();
3392
3392
  }),
3393
3393
  preventScrollOnEntryFocus: !0,
3394
3394
  children: /* @__PURE__ */ jsx(Content$1, {
3395
3395
  role: "menu",
3396
3396
  "aria-orientation": "vertical",
3397
- "data-state": getOpenState(jj.open),
3397
+ "data-state": getOpenState(Rj.open),
3398
3398
  "data-radix-menu-content": "",
3399
- dir: Mj.dir,
3400
- ...Nj,
3401
- ...Aj,
3402
- ref: Bj,
3399
+ dir: zj.dir,
3400
+ ...Bj,
3401
+ ...Lj,
3402
+ ref: qj,
3403
3403
  style: {
3404
3404
  outline: "none",
3405
- ...Aj.style
3405
+ ...Lj.style
3406
3406
  },
3407
- onKeyDown: composeEventHandlers(Aj.onKeyDown, (n) => {
3407
+ onKeyDown: composeEventHandlers(Lj.onKeyDown, (n) => {
3408
3408
  let _ = n.target.closest("[data-radix-menu-content]") === n.currentTarget, E = n.ctrlKey || n.altKey || n.metaKey, O = n.key.length === 1;
3409
- _ && (n.key === "Tab" && n.preventDefault(), !E && O && Yj(n.key));
3410
- let A = Rj.current;
3409
+ _ && (n.key === "Tab" && n.preventDefault(), !E && O && nM(n.key));
3410
+ let A = Gj.current;
3411
3411
  if (n.target !== A || !FIRST_LAST_KEYS.includes(n.key)) return;
3412
3412
  n.preventDefault();
3413
- let j = Fj().filter((n) => !n.disabled).map((n) => n.ref.current);
3413
+ let j = Hj().filter((n) => !n.disabled).map((n) => n.ref.current);
3414
3414
  LAST_KEYS.includes(n.key) && j.reverse(), focusFirst(j);
3415
3415
  }),
3416
3416
  onBlur: composeEventHandlers(_.onBlur, (n) => {
3417
- n.currentTarget.contains(n.target) || (window.clearTimeout(Vj.current), Hj.current = "");
3417
+ n.currentTarget.contains(n.target) || (window.clearTimeout(Jj.current), Yj.current = "");
3418
3418
  }),
3419
3419
  onPointerMove: composeEventHandlers(_.onPointerMove, whenMouse((n) => {
3420
- let _ = n.target, E = Kj.current !== n.clientX;
3421
- n.currentTarget.contains(_) && E && (Gj.current = n.clientX > Kj.current ? "right" : "left", Kj.current = n.clientX);
3420
+ let _ = n.target, E = $j.current !== n.clientX;
3421
+ n.currentTarget.contains(_) && E && (Qj.current = n.clientX > $j.current ? "right" : "left", $j.current = n.clientX);
3422
3422
  }))
3423
3423
  })
3424
3424
  })
@@ -4366,11 +4366,11 @@ function useStateMachine(_, E) {
4366
4366
  return React$1.useReducer((n, _) => E[n][_] ?? n, _);
4367
4367
  }
4368
4368
  var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((_, E) => {
4369
- let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [Aj, jj] = React$1.useState(null), [Mj, Nj] = React$1.useState(0), [Pj, Fj] = React$1.useState(0), [Ij, Lj] = React$1.useState(!1), [Rj, Bj] = React$1.useState(!1), Vj = useComposedRefs$1(E, (n) => z(n)), Hj = useDirection(j);
4369
+ let { __scopeScrollArea: O, type: A = "hover", dir: j, scrollHideDelay: M = 600, ...N } = _, [P, z] = React$1.useState(null), [B, H] = React$1.useState(null), [U, W] = React$1.useState(null), [G, Z] = React$1.useState(null), [Lj, Rj] = React$1.useState(null), [zj, Bj] = React$1.useState(0), [Vj, Hj] = React$1.useState(0), [Uj, Wj] = React$1.useState(!1), [Gj, qj] = React$1.useState(!1), Jj = useComposedRefs$1(E, (n) => z(n)), Yj = useDirection(j);
4370
4370
  return /* @__PURE__ */ jsx(ScrollAreaProvider, {
4371
4371
  scope: O,
4372
4372
  type: A,
4373
- dir: Hj,
4373
+ dir: Yj,
4374
4374
  scrollHideDelay: M,
4375
4375
  scrollArea: P,
4376
4376
  viewport: B,
@@ -4379,22 +4379,22 @@ var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaS
4379
4379
  onContentChange: W,
4380
4380
  scrollbarX: G,
4381
4381
  onScrollbarXChange: Z,
4382
- scrollbarXEnabled: Ij,
4383
- onScrollbarXEnabledChange: Lj,
4384
- scrollbarY: Aj,
4385
- onScrollbarYChange: jj,
4386
- scrollbarYEnabled: Rj,
4387
- onScrollbarYEnabledChange: Bj,
4388
- onCornerWidthChange: Nj,
4389
- onCornerHeightChange: Fj,
4382
+ scrollbarXEnabled: Uj,
4383
+ onScrollbarXEnabledChange: Wj,
4384
+ scrollbarY: Lj,
4385
+ onScrollbarYChange: Rj,
4386
+ scrollbarYEnabled: Gj,
4387
+ onScrollbarYEnabledChange: qj,
4388
+ onCornerWidthChange: Bj,
4389
+ onCornerHeightChange: Hj,
4390
4390
  children: /* @__PURE__ */ jsx(Primitive.div, {
4391
- dir: Hj,
4391
+ dir: Yj,
4392
4392
  ...N,
4393
- ref: Vj,
4393
+ ref: Jj,
4394
4394
  style: {
4395
4395
  position: "relative",
4396
- "--radix-scroll-area-corner-width": Mj + "px",
4397
- "--radix-scroll-area-corner-height": Pj + "px",
4396
+ "--radix-scroll-area-corner-width": zj + "px",
4397
+ "--radix-scroll-area-corner-height": Vj + "px",
4398
4398
  ..._.style
4399
4399
  }
4400
4400
  })
@@ -4665,46 +4665,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((_, E) => {
4665
4665
  }
4666
4666
  });
4667
4667
  }), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((_, E) => {
4668
- let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z, Aj] = React$1.useState(null), jj = useComposedRefs$1(E, (n) => Aj(n)), Mj = React$1.useRef(null), Nj = React$1.useRef(""), Pj = G.viewport, Fj = A.content - A.viewport, Ij = useCallbackRef(H), Lj = useCallbackRef(z), Rj = useDebounceCallback(U, 10);
4669
- function Bj(n) {
4670
- Mj.current && B({
4671
- x: n.clientX - Mj.current.left,
4672
- y: n.clientY - Mj.current.top
4668
+ let { __scopeScrollArea: O, sizes: A, hasThumb: j, onThumbChange: M, onThumbPointerUp: N, onThumbPointerDown: P, onThumbPositionChange: z, onDragScroll: B, onWheelScroll: H, onResize: U, ...W } = _, G = useScrollAreaContext(SCROLLBAR_NAME, O), [Z, Lj] = React$1.useState(null), Rj = useComposedRefs$1(E, (n) => Lj(n)), zj = React$1.useRef(null), Bj = React$1.useRef(""), Vj = G.viewport, Hj = A.content - A.viewport, Uj = useCallbackRef(H), Wj = useCallbackRef(z), Gj = useDebounceCallback(U, 10);
4669
+ function qj(n) {
4670
+ zj.current && B({
4671
+ x: n.clientX - zj.current.left,
4672
+ y: n.clientY - zj.current.top
4673
4673
  });
4674
4674
  }
4675
4675
  return React$1.useEffect(() => {
4676
4676
  let n = (n) => {
4677
4677
  let _ = n.target;
4678
- Z?.contains(_) && Ij(n, Fj);
4678
+ Z?.contains(_) && Uj(n, Hj);
4679
4679
  };
4680
4680
  return document.addEventListener("wheel", n, { passive: !1 }), () => document.removeEventListener("wheel", n, { passive: !1 });
4681
4681
  }, [
4682
- Pj,
4682
+ Vj,
4683
4683
  Z,
4684
- Fj,
4685
- Ij
4686
- ]), React$1.useEffect(Lj, [A, Lj]), useResizeObserver(Z, Rj), useResizeObserver(G.content, Rj), /* @__PURE__ */ jsx(ScrollbarProvider, {
4684
+ Hj,
4685
+ Uj
4686
+ ]), React$1.useEffect(Wj, [A, Wj]), useResizeObserver(Z, Gj), useResizeObserver(G.content, Gj), /* @__PURE__ */ jsx(ScrollbarProvider, {
4687
4687
  scope: O,
4688
4688
  scrollbar: Z,
4689
4689
  hasThumb: j,
4690
4690
  onThumbChange: useCallbackRef(M),
4691
4691
  onThumbPointerUp: useCallbackRef(N),
4692
- onThumbPositionChange: Lj,
4692
+ onThumbPositionChange: Wj,
4693
4693
  onThumbPointerDown: useCallbackRef(P),
4694
4694
  children: /* @__PURE__ */ jsx(Primitive.div, {
4695
4695
  ...W,
4696
- ref: jj,
4696
+ ref: Rj,
4697
4697
  style: {
4698
4698
  position: "absolute",
4699
4699
  ...W.style
4700
4700
  },
4701
4701
  onPointerDown: composeEventHandlers(_.onPointerDown, (n) => {
4702
- n.button === 0 && (n.target.setPointerCapture(n.pointerId), Mj.current = Z.getBoundingClientRect(), Nj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), Bj(n));
4702
+ n.button === 0 && (n.target.setPointerCapture(n.pointerId), zj.current = Z.getBoundingClientRect(), Bj.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", G.viewport && (G.viewport.style.scrollBehavior = "auto"), qj(n));
4703
4703
  }),
4704
- onPointerMove: composeEventHandlers(_.onPointerMove, Bj),
4704
+ onPointerMove: composeEventHandlers(_.onPointerMove, qj),
4705
4705
  onPointerUp: composeEventHandlers(_.onPointerUp, (n) => {
4706
4706
  let _ = n.target;
4707
- _.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Nj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), Mj.current = null;
4707
+ _.hasPointerCapture(n.pointerId) && _.releasePointerCapture(n.pointerId), document.body.style.webkitUserSelect = Bj.current, G.viewport && (G.viewport.style.scrollBehavior = ""), zj.current = null;
4708
4708
  })
4709
4709
  })
4710
4710
  });
@@ -4846,7 +4846,7 @@ function useResizeObserver(n, _) {
4846
4846
  }, [n, E]);
4847
4847
  }
4848
4848
  var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaScrollbar, Thumb$1 = ScrollAreaThumb, Corner = ScrollAreaCorner, SWITCH_NAME = "Switch", [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME), [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME), Switch = React$1.forwardRef((_, E) => {
4849
- let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)), Aj = React$1.useRef(!1), jj = W ? H || !!W.closest("form") : !0, [Mj, Nj] = useControllableState({
4849
+ let { __scopeSwitch: O, name: A, checked: j, defaultChecked: M, required: N, disabled: P, value: z = "on", onCheckedChange: B, form: H, ...U } = _, [W, G] = React$1.useState(null), Z = useComposedRefs$1(E, (n) => G(n)), Lj = React$1.useRef(!1), Rj = W ? H || !!W.closest("form") : !0, [zj, Bj] = useControllableState({
4850
4850
  prop: j,
4851
4851
  defaultProp: M ?? !1,
4852
4852
  onChange: B,
@@ -4854,28 +4854,28 @@ var Root$1 = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaSc
4854
4854
  });
4855
4855
  return /* @__PURE__ */ jsxs(SwitchProvider, {
4856
4856
  scope: O,
4857
- checked: Mj,
4857
+ checked: zj,
4858
4858
  disabled: P,
4859
4859
  children: [/* @__PURE__ */ jsx(Primitive.button, {
4860
4860
  type: "button",
4861
4861
  role: "switch",
4862
- "aria-checked": Mj,
4862
+ "aria-checked": zj,
4863
4863
  "aria-required": N,
4864
- "data-state": getState(Mj),
4864
+ "data-state": getState(zj),
4865
4865
  "data-disabled": P ? "" : void 0,
4866
4866
  disabled: P,
4867
4867
  value: z,
4868
4868
  ...U,
4869
4869
  ref: Z,
4870
4870
  onClick: composeEventHandlers(_.onClick, (n) => {
4871
- Nj((n) => !n), jj && (Aj.current = n.isPropagationStopped(), Aj.current || n.stopPropagation());
4871
+ Bj((n) => !n), Rj && (Lj.current = n.isPropagationStopped(), Lj.current || n.stopPropagation());
4872
4872
  })
4873
- }), jj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
4873
+ }), Rj && /* @__PURE__ */ jsx(SwitchBubbleInput, {
4874
4874
  control: W,
4875
- bubbles: !Aj.current,
4875
+ bubbles: !Lj.current,
4876
4876
  name: A,
4877
4877
  value: z,
4878
- checked: Mj,
4878
+ checked: zj,
4879
4879
  required: N,
4880
4880
  disabled: P,
4881
4881
  form: H,
@@ -5059,22 +5059,22 @@ var Root2 = Tabs, List = TabsList, Trigger = TabsTrigger, Content = TabsContent,
5059
5059
  };
5060
5060
  TooltipProvider.displayName = PROVIDER_NAME;
5061
5061
  var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (_) => {
5062
- let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent, Aj = P ?? z.delayDuration, jj = React$1.useRef(!1), [Mj, Nj] = useControllableState({
5062
+ let { __scopeTooltip: E, children: O, open: A, defaultOpen: j, onOpenChange: M, disableHoverableContent: N, delayDuration: P } = _, z = useTooltipProviderContext(TOOLTIP_NAME, _.__scopeTooltip), B = usePopperScope(E), [H, U] = React$1.useState(null), W = useId$1(), G = React$1.useRef(0), Z = N ?? z.disableHoverableContent, Lj = P ?? z.delayDuration, Rj = React$1.useRef(!1), [zj, Bj] = useControllableState({
5063
5063
  prop: A,
5064
5064
  defaultProp: j ?? !1,
5065
5065
  onChange: (n) => {
5066
5066
  n ? (z.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : z.onClose(), M?.(n);
5067
5067
  },
5068
5068
  caller: TOOLTIP_NAME
5069
- }), Pj = React$1.useMemo(() => Mj ? jj.current ? "delayed-open" : "instant-open" : "closed", [Mj]), Fj = React$1.useCallback(() => {
5070
- window.clearTimeout(G.current), G.current = 0, jj.current = !1, Nj(!0);
5071
- }, [Nj]), Ij = React$1.useCallback(() => {
5072
- window.clearTimeout(G.current), G.current = 0, Nj(!1);
5073
- }, [Nj]), Lj = React$1.useCallback(() => {
5069
+ }), Vj = React$1.useMemo(() => zj ? Rj.current ? "delayed-open" : "instant-open" : "closed", [zj]), Hj = React$1.useCallback(() => {
5070
+ window.clearTimeout(G.current), G.current = 0, Rj.current = !1, Bj(!0);
5071
+ }, [Bj]), Uj = React$1.useCallback(() => {
5072
+ window.clearTimeout(G.current), G.current = 0, Bj(!1);
5073
+ }, [Bj]), Wj = React$1.useCallback(() => {
5074
5074
  window.clearTimeout(G.current), G.current = window.setTimeout(() => {
5075
- jj.current = !0, Nj(!0), G.current = 0;
5076
- }, Aj);
5077
- }, [Aj, Nj]);
5075
+ Rj.current = !0, Bj(!0), G.current = 0;
5076
+ }, Lj);
5077
+ }, [Lj, Bj]);
5078
5078
  return React$1.useEffect(() => () => {
5079
5079
  G.current &&= (window.clearTimeout(G.current), 0);
5080
5080
  }, []), /* @__PURE__ */ jsx(Root2$4, {
@@ -5082,22 +5082,22 @@ var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = crea
5082
5082
  children: /* @__PURE__ */ jsx(TooltipContextProvider, {
5083
5083
  scope: E,
5084
5084
  contentId: W,
5085
- open: Mj,
5086
- stateAttribute: Pj,
5085
+ open: zj,
5086
+ stateAttribute: Vj,
5087
5087
  trigger: H,
5088
5088
  onTriggerChange: U,
5089
5089
  onTriggerEnter: React$1.useCallback(() => {
5090
- z.isOpenDelayedRef.current ? Lj() : Fj();
5090
+ z.isOpenDelayedRef.current ? Wj() : Hj();
5091
5091
  }, [
5092
5092
  z.isOpenDelayedRef,
5093
- Lj,
5094
- Fj
5093
+ Wj,
5094
+ Hj
5095
5095
  ]),
5096
5096
  onTriggerLeave: React$1.useCallback(() => {
5097
- Z ? Ij() : (window.clearTimeout(G.current), G.current = 0);
5098
- }, [Ij, Z]),
5099
- onOpen: Fj,
5100
- onClose: Ij,
5097
+ Z ? Uj() : (window.clearTimeout(G.current), G.current = 0);
5098
+ }, [Uj, Z]),
5099
+ onOpen: Hj,
5100
+ onClose: Uj,
5101
5101
  disableHoverableContent: Z,
5102
5102
  children: O
5103
5103
  })
@@ -5910,14 +5910,14 @@ var I$3 = React$1.forwardRef((_, E) => {
5910
5910
  React$1.useEffect(() => U(O), [O]);
5911
5911
  let [W, G] = React$1.useState(A);
5912
5912
  React$1.useEffect(() => G(A), [A]);
5913
- let [Z, Aj] = React$1.useState(j);
5914
- React$1.useEffect(() => Aj(j), [j]);
5915
- let [jj, Mj] = React$1.useState(M);
5916
- React$1.useEffect(() => Mj(M), [M]);
5917
- let [Nj, Pj] = React$1.useState(N);
5918
- React$1.useEffect(() => Pj(N), [N]);
5919
- let [Fj, Ij] = React$1.useState(P);
5920
- return React$1.useEffect(() => Ij(P), [P]), React$1.createElement(A$2, {
5913
+ let [Z, Lj] = React$1.useState(j);
5914
+ React$1.useEffect(() => Lj(j), [j]);
5915
+ let [Rj, zj] = React$1.useState(M);
5916
+ React$1.useEffect(() => zj(M), [M]);
5917
+ let [Bj, Vj] = React$1.useState(N);
5918
+ React$1.useEffect(() => Vj(N), [N]);
5919
+ let [Hj, Uj] = React$1.useState(P);
5920
+ return React$1.useEffect(() => Uj(P), [P]), React$1.createElement(A$2, {
5921
5921
  ...B,
5922
5922
  ref: E,
5923
5923
  isRoot: !0,
@@ -5925,62 +5925,62 @@ var I$3 = React$1.forwardRef((_, E) => {
5925
5925
  appearance: H,
5926
5926
  accentColor: W,
5927
5927
  grayColor: Z,
5928
- panelBackground: jj,
5929
- radius: Nj,
5930
- scaling: Fj,
5928
+ panelBackground: Rj,
5929
+ radius: Bj,
5930
+ scaling: Hj,
5931
5931
  onAppearanceChange: U,
5932
5932
  onAccentColorChange: G,
5933
- onGrayColorChange: Aj,
5934
- onPanelBackgroundChange: Mj,
5935
- onRadiusChange: Pj,
5936
- onScalingChange: Ij
5933
+ onGrayColorChange: Lj,
5934
+ onPanelBackgroundChange: zj,
5935
+ onRadiusChange: Vj,
5936
+ onScalingChange: Uj
5937
5937
  });
5938
5938
  });
5939
5939
  I$3.displayName = "ThemeRoot";
5940
5940
  var A$2 = React$1.forwardRef((_, E) => {
5941
- let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange: Aj = d$5, onRadiusChange: jj = d$5, onScalingChange: Mj = d$5, ...Nj } = _, Pj = A ? Slot$3 : "div", Fj = z === "auto" ? a$12(P) : z, Ij = _.appearance === "light" || _.appearance === "dark", Lj = M === void 0 ? j || Ij : M;
5941
+ let O = React$1.useContext(P$3), { asChild: A, isRoot: j, hasBackground: M, appearance: N = O?.appearance ?? s$13.appearance.default, accentColor: P = O?.accentColor ?? s$13.accentColor.default, grayColor: z = O?.resolvedGrayColor ?? s$13.grayColor.default, panelBackground: B = O?.panelBackground ?? s$13.panelBackground.default, radius: H = O?.radius ?? s$13.radius.default, scaling: U = O?.scaling ?? s$13.scaling.default, onAppearanceChange: W = d$5, onAccentColorChange: G = d$5, onGrayColorChange: Z = d$5, onPanelBackgroundChange: Lj = d$5, onRadiusChange: Rj = d$5, onScalingChange: zj = d$5, ...Bj } = _, Vj = A ? Slot$3 : "div", Hj = z === "auto" ? a$12(P) : z, Uj = _.appearance === "light" || _.appearance === "dark", Wj = M === void 0 ? j || Uj : M;
5942
5942
  return React$1.createElement(P$3.Provider, { value: React$1.useMemo(() => ({
5943
5943
  appearance: N,
5944
5944
  accentColor: P,
5945
5945
  grayColor: z,
5946
- resolvedGrayColor: Fj,
5946
+ resolvedGrayColor: Hj,
5947
5947
  panelBackground: B,
5948
5948
  radius: H,
5949
5949
  scaling: U,
5950
5950
  onAppearanceChange: W,
5951
5951
  onAccentColorChange: G,
5952
5952
  onGrayColorChange: Z,
5953
- onPanelBackgroundChange: Aj,
5954
- onRadiusChange: jj,
5955
- onScalingChange: Mj
5953
+ onPanelBackgroundChange: Lj,
5954
+ onRadiusChange: Rj,
5955
+ onScalingChange: zj
5956
5956
  }), [
5957
5957
  N,
5958
5958
  P,
5959
5959
  z,
5960
- Fj,
5960
+ Hj,
5961
5961
  B,
5962
5962
  H,
5963
5963
  U,
5964
5964
  W,
5965
5965
  G,
5966
5966
  Z,
5967
- Aj,
5968
- jj,
5969
- Mj
5970
- ]) }, React$1.createElement(Pj, {
5967
+ Lj,
5968
+ Rj,
5969
+ zj
5970
+ ]) }, React$1.createElement(Vj, {
5971
5971
  "data-is-root-theme": j ? "true" : "false",
5972
5972
  "data-accent-color": P,
5973
- "data-gray-color": Fj,
5974
- "data-has-background": Lj ? "true" : "false",
5973
+ "data-gray-color": Hj,
5974
+ "data-has-background": Wj ? "true" : "false",
5975
5975
  "data-panel-background": B,
5976
5976
  "data-radius": H,
5977
5977
  "data-scaling": U,
5978
5978
  ref: E,
5979
- ...Nj,
5979
+ ...Bj,
5980
5980
  className: (0, import_classnames$18.default)("radix-themes", {
5981
5981
  light: N === "light",
5982
5982
  dark: N === "dark"
5983
- }, Nj.className)
5983
+ }, Bj.className)
5984
5984
  }));
5985
5985
  });
5986
5986
  A$2.displayName = "ThemeImpl";
@@ -6752,7 +6752,7 @@ function S$2(n) {
6752
6752
  return [(0, import_classnames$10.default)(_, O, j, N, z, H, W), l$1(E, A, M, P, B, U, G)];
6753
6753
  }
6754
6754
  var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((_, E) => {
6755
- let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars: Aj = t$3.scrollbars.default, ...jj } = O;
6755
+ let { rest: O, ...A } = a$5(_), [j, M] = S$2(A), { asChild: N, children: P, className: z, style: B, type: H, scrollHideDelay: U = H === "scroll" ? void 0 : 0, dir: W, size: G = t$3.size.default, radius: Z = t$3.radius.default, scrollbars: Lj = t$3.scrollbars.default, ...Rj } = O;
6756
6756
  return React$1.createElement(Root$1, {
6757
6757
  type: H,
6758
6758
  scrollHideDelay: U,
@@ -6763,10 +6763,10 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
6763
6763
  asChild: N,
6764
6764
  children: P
6765
6765
  }, (_) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
6766
- ...jj,
6766
+ ...Rj,
6767
6767
  ref: E,
6768
6768
  className: "rt-ScrollAreaViewport"
6769
- }, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Aj === "vertical" ? null : React$1.createElement(Scrollbar, {
6769
+ }, _), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), Lj === "vertical" ? null : React$1.createElement(Scrollbar, {
6770
6770
  "data-radius": Z,
6771
6771
  orientation: "horizontal",
6772
6772
  className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
@@ -6774,7 +6774,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
6774
6774
  value: G,
6775
6775
  propValues: t$3.size.values
6776
6776
  }))
6777
- }, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Aj === "horizontal" ? null : React$1.createElement(Scrollbar, {
6777
+ }, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Lj === "horizontal" ? null : React$1.createElement(Scrollbar, {
6778
6778
  "data-radius": Z,
6779
6779
  orientation: "vertical",
6780
6780
  className: (0, import_classnames$9.default)("rt-ScrollAreaScrollbar", g$3({
@@ -6782,7 +6782,7 @@ var import_classnames$9 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
6782
6782
  value: G,
6783
6783
  propValues: t$3.size.values
6784
6784
  }))
6785
- }, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Aj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
6785
+ }, React$1.createElement(Thumb$1, { className: "rt-ScrollAreaThumb" })), Lj === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
6786
6786
  });
6787
6787
  c.displayName = "ScrollArea";
6788
6788
  var n$2 = {
@@ -7985,17 +7985,17 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
7985
7985
  E.forEach((n) => {
7986
7986
  let { group: E, groupSize: P } = n, { disableCursor: z, orientation: B, panels: H } = E, U = 0;
7987
7987
  U = j ? B === "horizontal" ? (_.clientX - j.x) / P * 100 : (_.clientY - j.y) / P * 100 : B === "horizontal" ? _.clientX < 0 ? -100 : 100 : _.clientY < 0 ? -100 : 100;
7988
- let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Aj, separatorToPanels: jj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
7989
- if (Z && W && Aj && jj) {
7988
+ let W = O.get(E), { defaultLayoutDeferred: G, derivedPanelConstraints: Z, layout: Lj, separatorToPanels: Rj } = A.get(E) ?? { defaultLayoutDeferred: !1 };
7989
+ if (Z && W && Lj && Rj) {
7990
7990
  let _ = Z$1({
7991
7991
  delta: U,
7992
7992
  initialLayout: W,
7993
7993
  panelConstraints: Z,
7994
7994
  pivotIndices: n.panels.map((n) => H.indexOf(n)),
7995
- prevLayout: Aj,
7995
+ prevLayout: Lj,
7996
7996
  trigger: "mouse-or-touch"
7997
7997
  });
7998
- if (B$1(_, Aj)) {
7998
+ if (B$1(_, Lj)) {
7999
7999
  if (U !== 0 && !z) switch (B) {
8000
8000
  case "horizontal":
8001
8001
  M |= U < 0 ? De : Oe$1;
@@ -8009,7 +8009,7 @@ function $e({ document: n, event: _, hitRegions: E, initialLayoutMap: O, mounted
8009
8009
  defaultLayoutDeferred: G,
8010
8010
  derivedPanelConstraints: Z,
8011
8011
  layout: _,
8012
- separatorToPanels: jj
8012
+ separatorToPanels: Rj
8013
8013
  });
8014
8014
  let E = n.group.panels.map(({ id: n }) => n).join(",");
8015
8015
  n.group.inMemoryLayouts[E] = _;
@@ -8221,64 +8221,64 @@ function Pt(n, _) {
8221
8221
  function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, disabled: A, elementRef: j, groupRef: M, id: N, onLayoutChange: P, orientation: z = "horizontal", style: B, ...H }) {
8222
8222
  let U = useRef({}), G = le$1((n) => {
8223
8223
  B$1(U.current, n) || (U.current = n, P?.(n));
8224
- }), Z = ae$1(N), Aj = useRef(null), [jj, Fj] = useState(!1), [Ij, Lj] = useState(E ?? {}), [Rj, Bj] = wt(), Vj = useRef({
8224
+ }), Z = ae$1(N), Lj = useRef(null), [Rj, Hj] = useState(!1), [Uj, Wj] = useState(E ?? {}), [Gj, qj] = wt(), Jj = useRef({
8225
8225
  lastExpandedPanelSizes: {},
8226
8226
  layouts: {},
8227
8227
  panels: [],
8228
8228
  separators: []
8229
- }), Hj = ue$1(Aj, j);
8229
+ }), Yj = ue$1(Lj, j);
8230
8230
  Pt(Z, M);
8231
- let Uj = useMemo(() => ({
8231
+ let Xj = useMemo(() => ({
8232
8232
  id: Z,
8233
8233
  orientation: z,
8234
8234
  registerPanel: (n) => {
8235
- let _ = Vj.current;
8236
- return _.panels = ie$1(z, [..._.panels, n]), Bj(), () => {
8237
- _.panels = _.panels.filter((_) => _ !== n), Bj();
8235
+ let _ = Jj.current;
8236
+ return _.panels = ie$1(z, [..._.panels, n]), qj(), () => {
8237
+ _.panels = _.panels.filter((_) => _ !== n), qj();
8238
8238
  };
8239
8239
  },
8240
8240
  registerSeparator: (n) => {
8241
- let _ = Vj.current;
8242
- return _.separators = ie$1(z, [..._.separators, n]), Bj(), () => {
8243
- _.separators = _.separators.filter((_) => _ !== n), Bj();
8241
+ let _ = Jj.current;
8242
+ return _.separators = ie$1(z, [..._.separators, n]), qj(), () => {
8243
+ _.separators = _.separators.filter((_) => _ !== n), qj();
8244
8244
  };
8245
8245
  }
8246
8246
  }), [
8247
8247
  Z,
8248
- Bj,
8248
+ qj,
8249
8249
  z
8250
- ]), Wj = Lt({
8250
+ ]), Zj = Lt({
8251
8251
  defaultLayout: E,
8252
8252
  disableCursor: O
8253
- }), Gj = useRef(null);
8253
+ }), Qj = useRef(null);
8254
8254
  A$1(() => {
8255
- let n = Aj.current;
8255
+ let n = Lj.current;
8256
8256
  if (n === null) return;
8257
- let _ = Vj.current, E = {
8258
- defaultLayout: Wj.defaultLayout,
8259
- disableCursor: !!Wj.disableCursor,
8257
+ let _ = Jj.current, E = {
8258
+ defaultLayout: Zj.defaultLayout,
8259
+ disableCursor: !!Zj.disableCursor,
8260
8260
  disabled: !!A,
8261
8261
  element: n,
8262
8262
  id: Z,
8263
- inMemoryLastExpandedPanelSizes: Vj.current.lastExpandedPanelSizes,
8264
- inMemoryLayouts: Vj.current.layouts,
8263
+ inMemoryLastExpandedPanelSizes: Jj.current.lastExpandedPanelSizes,
8264
+ inMemoryLayouts: Jj.current.layouts,
8265
8265
  orientation: z,
8266
8266
  panels: _.panels,
8267
8267
  separators: _.separators
8268
8268
  };
8269
- Gj.current = E;
8269
+ Qj.current = E;
8270
8270
  let O = bt(E), j = D$1().mountedGroups.get(E);
8271
8271
  if (j) {
8272
8272
  let { defaultLayoutDeferred: n, derivedPanelConstraints: _, layout: E } = j;
8273
- !n && _.length > 0 && (Lj(E), G?.(E));
8273
+ !n && _.length > 0 && (Wj(E), G?.(E));
8274
8274
  }
8275
8275
  let M = T$1.addListener("interactionStateChange", (n) => {
8276
8276
  switch (n.state) {
8277
8277
  case "active":
8278
- Fj(n.hitRegions.some((n) => n.group === E));
8278
+ Hj(n.hitRegions.some((n) => n.group === E));
8279
8279
  break;
8280
8280
  default:
8281
- Fj(!1);
8281
+ Hj(!1);
8282
8282
  break;
8283
8283
  }
8284
8284
  }), N = T$1.addListener("mountedGroupsChange", (n) => {
@@ -8286,30 +8286,30 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
8286
8286
  if (_) {
8287
8287
  let { defaultLayoutDeferred: n, derivedPanelConstraints: E, layout: O } = _;
8288
8288
  if (n || E.length === 0) return;
8289
- Lj(O), G?.(O);
8289
+ Wj(O), G?.(O);
8290
8290
  }
8291
8291
  });
8292
8292
  return () => {
8293
- Gj.current = null, O(), M(), N();
8293
+ Qj.current = null, O(), M(), N();
8294
8294
  };
8295
8295
  }, [
8296
8296
  A,
8297
8297
  Z,
8298
8298
  G,
8299
8299
  z,
8300
- Rj,
8301
- Wj
8300
+ Gj,
8301
+ Zj
8302
8302
  ]), useEffect(() => {
8303
- let n = Gj.current;
8303
+ let n = Qj.current;
8304
8304
  n && (n.defaultLayout = E, n.disableCursor = !!O);
8305
8305
  });
8306
- let Kj = { [Fe]: jj ? "none" : void 0 };
8307
- for (let n in Ij) {
8306
+ let $j = { [Fe]: Rj ? "none" : void 0 };
8307
+ for (let n in Uj) {
8308
8308
  let _ = Ve(Z, n);
8309
- Kj[_] = Ij[n];
8309
+ $j[_] = Uj[n];
8310
8310
  }
8311
8311
  return /* @__PURE__ */ jsx(je.Provider, {
8312
- value: Uj,
8312
+ value: Xj,
8313
8313
  children: /* @__PURE__ */ jsx("div", {
8314
8314
  ...H,
8315
8315
  "aria-orientation": z,
@@ -8317,13 +8317,13 @@ function Rt({ children: n, className: _, defaultLayout: E, disableCursor: O, dis
8317
8317
  "data-group": !0,
8318
8318
  "data-testid": Z,
8319
8319
  id: Z,
8320
- ref: Hj,
8320
+ ref: Yj,
8321
8321
  style: {
8322
8322
  height: "100%",
8323
8323
  width: "100%",
8324
8324
  overflow: "hidden",
8325
8325
  ...B,
8326
- ...Kj,
8326
+ ...$j,
8327
8327
  display: "flex",
8328
8328
  flexDirection: z === "horizontal" ? "row" : "column",
8329
8329
  flexWrap: "nowrap"
@@ -8441,12 +8441,12 @@ function It(n, _) {
8441
8441
  });
8442
8442
  }
8443
8443
  function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O = !1, defaultSize: A, elementRef: j, id: M, maxSize: N = "100%", minSize: P = "0%", onResize: z, panelRef: B, style: H, ...U }) {
8444
- let W = !!M, G = ae$1(M), Z = useRef(null), Aj = ue$1(Z, j), { id: jj, registerPanel: Mj } = ce$1(), Pj = z !== null, Fj = le$1((n, _, E) => {
8444
+ let W = !!M, G = ae$1(M), Z = useRef(null), Lj = ue$1(Z, j), { id: Rj, registerPanel: zj } = ce$1(), Vj = z !== null, Hj = le$1((n, _, E) => {
8445
8445
  z?.(n, M, E);
8446
8446
  });
8447
8447
  A$1(() => {
8448
8448
  let n = Z.current;
8449
- if (n !== null) return Mj({
8449
+ if (n !== null) return zj({
8450
8450
  element: n,
8451
8451
  id: G,
8452
8452
  idIsStable: W,
@@ -8454,7 +8454,7 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
8454
8454
  expandToSize: void 0,
8455
8455
  prevSize: void 0
8456
8456
  },
8457
- onResize: Pj ? Fj : void 0,
8457
+ onResize: Vj ? Hj : void 0,
8458
8458
  panelConstraints: {
8459
8459
  collapsedSize: E,
8460
8460
  collapsible: O,
@@ -8467,25 +8467,25 @@ function kt({ children: n, className: _, collapsedSize: E = "0%", collapsible: O
8467
8467
  E,
8468
8468
  O,
8469
8469
  A,
8470
- Pj,
8470
+ Vj,
8471
8471
  G,
8472
8472
  W,
8473
8473
  N,
8474
8474
  P,
8475
- Fj,
8476
- Mj
8475
+ Hj,
8476
+ zj
8477
8477
  ]), It(G, B);
8478
- let Ij = Ve(jj, G);
8478
+ let Uj = Ve(Rj, G);
8479
8479
  return /* @__PURE__ */ jsx("div", {
8480
8480
  ...U,
8481
8481
  "data-panel": !0,
8482
8482
  "data-testid": G,
8483
8483
  id: G,
8484
- ref: Aj,
8484
+ ref: Lj,
8485
8485
  style: {
8486
8486
  ...Gt,
8487
8487
  flexBasis: 0,
8488
- flexGrow: `var(${Ij}, 1)`,
8488
+ flexGrow: `var(${Uj}, 1)`,
8489
8489
  flexShrink: 1,
8490
8490
  overflow: "hidden",
8491
8491
  pointerEvents: `var(${Fe})`
@@ -8548,7 +8548,7 @@ function Dt({ layout: n, panelConstraints: _, panelId: E, panelIndex: O }) {
8548
8548
  };
8549
8549
  }
8550
8550
  function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j }) {
8551
- let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(), Aj = G === "horizontal" ? "vertical" : "horizontal";
8551
+ let M = ae$1(O), [N, P] = useState({}), [z, B] = useState("inactive"), H = useRef(null), U = ue$1(H, E), { id: W, orientation: G, registerSeparator: Z } = ce$1(), Lj = G === "horizontal" ? "vertical" : "horizontal";
8552
8552
  return A$1(() => {
8553
8553
  let n = H.current;
8554
8554
  if (n !== null) {
@@ -8584,7 +8584,7 @@ function Ot({ children: n, className: _, elementRef: E, id: O, style: A, ...j })
8584
8584
  ]), /* @__PURE__ */ jsx("div", {
8585
8585
  ...j,
8586
8586
  "aria-controls": N.valueControls,
8587
- "aria-orientation": Aj,
8587
+ "aria-orientation": Lj,
8588
8588
  "aria-valuemax": N.valueMax,
8589
8589
  "aria-valuemin": N.valueMin,
8590
8590
  "aria-valuenow": N.valueNow,
@@ -8750,7 +8750,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8750
8750
  }
8751
8751
  return n;
8752
8752
  });
8753
- }, []), Aj = React.useCallback(() => {
8753
+ }, []), Lj = React.useCallback(() => {
8754
8754
  M((n) => {
8755
8755
  if (n.clipboard.length > 0) {
8756
8756
  let _ = n.clipboard.map((n) => ({
@@ -8769,7 +8769,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8769
8769
  }
8770
8770
  return n;
8771
8771
  });
8772
- }, []), jj = React.useCallback((n) => {
8772
+ }, []), Rj = React.useCallback((n) => {
8773
8773
  let _ = {};
8774
8774
  n.type === "box" && (_.backgroundColor = "var(--gray-4)"), n.type === "text-container" && (_.backgroundColor = "var(--gray-4)", _.border = "1px solid var(--gray-8)", _.padding = "8px", _.display = "flex", _.alignItems = "flex-start", _.justifyContent = "flex-start");
8775
8775
  let E = {
@@ -8794,7 +8794,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8794
8794
  selectedElementIds: [E.id]
8795
8795
  };
8796
8796
  });
8797
- }, []), Mj = React.useCallback((n) => {
8797
+ }, []), zj = React.useCallback((n) => {
8798
8798
  M((_) => {
8799
8799
  let E = _.elements.filter((_) => _.id !== n), O = _.history.slice(0, _.historyIndex + 1);
8800
8800
  return O.push(E), {
@@ -8805,7 +8805,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8805
8805
  historyIndex: O.length - 1
8806
8806
  };
8807
8807
  });
8808
- }, []), Nj = React.useCallback(() => {
8808
+ }, []), Bj = React.useCallback(() => {
8809
8809
  M((n) => {
8810
8810
  if (n.selectedElementIds.length === 0) return n;
8811
8811
  let _ = n.elements.filter((_) => !n.selectedElementIds.includes(_.id)), E = n.history.slice(0, n.historyIndex + 1);
@@ -8817,7 +8817,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8817
8817
  historyIndex: E.length - 1
8818
8818
  };
8819
8819
  });
8820
- }, []), Fj = React.useCallback((n, _ = !1) => {
8820
+ }, []), Hj = React.useCallback((n, _ = !1) => {
8821
8821
  M((E) => {
8822
8822
  if (n === null) return {
8823
8823
  ...E,
@@ -8834,12 +8834,12 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8834
8834
  selectedElementIds: [n]
8835
8835
  };
8836
8836
  });
8837
- }, []), Ij = React.useCallback((n) => {
8837
+ }, []), Uj = React.useCallback((n) => {
8838
8838
  M((_) => ({
8839
8839
  ..._,
8840
8840
  selectedElementIds: n
8841
8841
  }));
8842
- }, []), Lj = React.useCallback((n, _) => {
8842
+ }, []), Wj = React.useCallback((n, _) => {
8843
8843
  M((E) => {
8844
8844
  let O = [...E.elements], A = O[n];
8845
8845
  O.splice(n, 1), O.splice(_, 0, A);
@@ -8851,7 +8851,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8851
8851
  historyIndex: j.length - 1
8852
8852
  };
8853
8853
  });
8854
- }, []), Rj = React.useCallback((n, _, E = !0) => {
8854
+ }, []), Gj = React.useCallback((n, _, E = !0) => {
8855
8855
  M((O) => {
8856
8856
  let A = O.elements.map((E) => E.id === n ? {
8857
8857
  ...E,
@@ -8864,7 +8864,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8864
8864
  historyIndex: M
8865
8865
  };
8866
8866
  });
8867
- }, []), Bj = React.useCallback((n, _ = !0) => {
8867
+ }, []), qj = React.useCallback((n, _ = !0) => {
8868
8868
  M((E) => {
8869
8869
  let O = [...E.elements], A = [], j = /* @__PURE__ */ new Set();
8870
8870
  n.forEach(({ id: n, changes: _ }) => {
@@ -8918,7 +8918,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8918
8918
  historyIndex: P
8919
8919
  };
8920
8920
  });
8921
- }, []), Vj = React.useCallback((n) => {
8921
+ }, []), Jj = React.useCallback((n) => {
8922
8922
  M((_) => {
8923
8923
  let E = _.elements.filter((_) => n.includes(_.id));
8924
8924
  if (E.length === 0) return _;
@@ -8946,7 +8946,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8946
8946
  historyIndex: z.length - 1
8947
8947
  };
8948
8948
  });
8949
- }, []), Hj = React.useCallback((n) => {
8949
+ }, []), Yj = React.useCallback((n) => {
8950
8950
  M((_) => {
8951
8951
  let E = _.elements.find((_) => _.id === n);
8952
8952
  if (!E || E.type !== "group") return _;
@@ -8962,7 +8962,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8962
8962
  historyIndex: j.length - 1
8963
8963
  };
8964
8964
  });
8965
- }, []), Uj = React.useCallback((n, _) => {
8965
+ }, []), Xj = React.useCallback((n, _) => {
8966
8966
  M((E) => {
8967
8967
  let O = E.elements.map((E) => E.id === n ? {
8968
8968
  ...E,
@@ -8973,7 +8973,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8973
8973
  elements: O
8974
8974
  };
8975
8975
  });
8976
- }, []), Wj = React.useCallback((n, _) => {
8976
+ }, []), Zj = React.useCallback((n, _) => {
8977
8977
  if (!n.find((n) => n.id === _ && n.type === "group")) return n;
8978
8978
  let E = n.filter((n) => n.groupId === _);
8979
8979
  if (E.length === 0) return n;
@@ -8985,7 +8985,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8985
8985
  width: j - O,
8986
8986
  height: M - A
8987
8987
  } : n);
8988
- }, []), Gj = React.useCallback((n, _) => {
8988
+ }, []), Qj = React.useCallback((n, _) => {
8989
8989
  M((E) => {
8990
8990
  let O = E.elements.find((_) => _.id === n), A = E.elements.find((n) => n.id === _ && n.type === "group");
8991
8991
  if (!O || !A) return E;
@@ -8993,7 +8993,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
8993
8993
  ...E,
8994
8994
  groupId: _
8995
8995
  } : E);
8996
- j = Wj(j, _);
8996
+ j = Zj(j, _);
8997
8997
  let M = E.history.slice(0, E.historyIndex + 1);
8998
8998
  return M.push(j), {
8999
8999
  ...E,
@@ -9002,7 +9002,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
9002
9002
  historyIndex: M.length - 1
9003
9003
  };
9004
9004
  });
9005
- }, [Wj]), Kj = React.useCallback((n) => {
9005
+ }, [Zj]), $j = React.useCallback((n) => {
9006
9006
  M((_) => {
9007
9007
  let E = _.elements.find((_) => _.id === n);
9008
9008
  if (!E || !E.groupId) return _;
@@ -9010,7 +9010,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
9010
9010
  ..._,
9011
9011
  groupId: void 0
9012
9012
  } : _);
9013
- A = Wj(A, O);
9013
+ A = Zj(A, O);
9014
9014
  let j = _.history.slice(0, _.historyIndex + 1);
9015
9015
  return j.push(A), {
9016
9016
  ..._,
@@ -9019,7 +9019,7 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
9019
9019
  historyIndex: j.length - 1
9020
9020
  };
9021
9021
  });
9022
- }, [Wj]), qj = React.useCallback((n, _, E) => {
9022
+ }, [Zj]), eM = React.useCallback((n, _, E) => {
9023
9023
  M((O) => {
9024
9024
  let A = O.elements.find((_) => _.id === n && _.type === "group");
9025
9025
  if (!A) return O;
@@ -9048,13 +9048,13 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
9048
9048
  historyIndex: B.length - 1
9049
9049
  };
9050
9050
  });
9051
- }, []), Jj = React.useCallback((n, _) => {
9051
+ }, []), tM = React.useCallback((n, _) => {
9052
9052
  M((E) => ({
9053
9053
  ...E,
9054
9054
  mockData: n,
9055
9055
  singleMockData: _
9056
9056
  }));
9057
- }, []), Yj = React.useCallback((n) => {
9057
+ }, []), nM = React.useCallback((n) => {
9058
9058
  M((_) => ({
9059
9059
  ..._,
9060
9060
  listSettings: {
@@ -9062,65 +9062,65 @@ const EditorProvider = ({ children: n, isList: E = !1, availableProps: O = [], t
9062
9062
  ...n
9063
9063
  }
9064
9064
  }));
9065
- }, []), Xj = React.useMemo(() => ({
9065
+ }, []), rM = React.useMemo(() => ({
9066
9066
  state: j,
9067
- addElement: jj,
9068
- removeElement: Mj,
9069
- removeSelected: Nj,
9070
- selectElement: Fj,
9071
- setSelectedElements: Ij,
9072
- moveElement: Lj,
9073
- updateElement: Rj,
9074
- updateElements: Bj,
9075
- groupElements: Vj,
9076
- ungroupElements: Hj,
9077
- renameElement: Uj,
9078
- addToGroup: Gj,
9079
- removeFromGroup: Kj,
9080
- resizeGroup: qj,
9081
- setMockData: Jj,
9082
- updateListSettings: Yj,
9067
+ addElement: Rj,
9068
+ removeElement: zj,
9069
+ removeSelected: Bj,
9070
+ selectElement: Hj,
9071
+ setSelectedElements: Uj,
9072
+ moveElement: Wj,
9073
+ updateElement: Gj,
9074
+ updateElements: qj,
9075
+ groupElements: Jj,
9076
+ ungroupElements: Yj,
9077
+ renameElement: Xj,
9078
+ addToGroup: Qj,
9079
+ removeFromGroup: $j,
9080
+ resizeGroup: eM,
9081
+ setMockData: tM,
9082
+ updateListSettings: nM,
9083
9083
  setCanvasHeight: N,
9084
9084
  loadState: U,
9085
9085
  undo: W,
9086
9086
  redo: G,
9087
9087
  copy: Z,
9088
- paste: Aj,
9088
+ paste: Lj,
9089
9089
  setGridSize: P,
9090
9090
  setZoom: z,
9091
9091
  setPan: B,
9092
9092
  setSnapLines: H
9093
9093
  }), [
9094
9094
  j,
9095
- jj,
9096
- Mj,
9097
- Nj,
9098
- Fj,
9099
- Ij,
9100
- Lj,
9101
9095
  Rj,
9096
+ zj,
9102
9097
  Bj,
9103
- Vj,
9104
9098
  Hj,
9105
9099
  Uj,
9100
+ Wj,
9106
9101
  Gj,
9107
- Kj,
9108
9102
  qj,
9109
9103
  Jj,
9110
9104
  Yj,
9105
+ Xj,
9106
+ Qj,
9107
+ $j,
9108
+ eM,
9109
+ tM,
9110
+ nM,
9111
9111
  N,
9112
9112
  U,
9113
9113
  W,
9114
9114
  G,
9115
9115
  Z,
9116
- Aj,
9116
+ Lj,
9117
9117
  P,
9118
9118
  z,
9119
9119
  B,
9120
9120
  H
9121
9121
  ]);
9122
9122
  return /* @__PURE__ */ jsx(EditorContext.Provider, {
9123
- value: Xj,
9123
+ value: rM,
9124
9124
  children: n
9125
9125
  });
9126
9126
  }, useEditor = () => {
@@ -9562,16 +9562,16 @@ var __assign$1 = function() {
9562
9562
  maxHeight: _
9563
9563
  };
9564
9564
  }, _.prototype.calculateNewSizeFromDirection = function(n, _) {
9565
- var E = this.props.scale || 1, O = normalizeToPair(this.props.resizeRatio || 1), A = O[0], j = O[1], M = this.state, N = M.direction, P = M.original, z = this.props, B = z.lockAspectRatio, H = z.lockAspectRatioExtraHeight, U = z.lockAspectRatioExtraWidth, W = P.width, G = P.height, Z = H || 0, Aj = U || 0;
9566
- return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Aj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Aj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Aj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Aj)), {
9565
+ var E = this.props.scale || 1, O = normalizeToPair(this.props.resizeRatio || 1), A = O[0], j = O[1], M = this.state, N = M.direction, P = M.original, z = this.props, B = z.lockAspectRatio, H = z.lockAspectRatioExtraHeight, U = z.lockAspectRatioExtraWidth, W = P.width, G = P.height, Z = H || 0, Lj = U || 0;
9566
+ return hasDirection("right", N) && (W = P.width + (n - P.x) * A / E, B && (G = (W - Lj) / this.ratio + Z)), hasDirection("left", N) && (W = P.width - (n - P.x) * A / E, B && (G = (W - Lj) / this.ratio + Z)), hasDirection("bottom", N) && (G = P.height + (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Lj)), hasDirection("top", N) && (G = P.height - (_ - P.y) * j / E, B && (W = (G - Z) * this.ratio + Lj)), {
9567
9567
  newWidth: W,
9568
9568
  newHeight: G
9569
9569
  };
9570
9570
  }, _.prototype.calculateNewSizeFromAspectRatio = function(n, _, E, O) {
9571
9571
  var A = this.props, j = A.lockAspectRatio, M = A.lockAspectRatioExtraHeight, N = A.lockAspectRatioExtraWidth, P = O.width === void 0 ? 10 : O.width, z = E.width === void 0 || E.width < 0 ? n : E.width, B = O.height === void 0 ? 10 : O.height, H = E.height === void 0 || E.height < 0 ? _ : E.height, U = M || 0, W = N || 0;
9572
9572
  if (j) {
9573
- var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Aj = (P - W) / this.ratio + U, jj = (z - W) / this.ratio + U, Mj = Math.max(P, G), Nj = Math.min(z, Z), Pj = Math.max(B, Aj), Fj = Math.min(H, jj);
9574
- n = clamp$1(n, Mj, Nj), _ = clamp$1(_, Pj, Fj);
9573
+ var G = (B - U) * this.ratio + W, Z = (H - U) * this.ratio + W, Lj = (P - W) / this.ratio + U, Rj = (z - W) / this.ratio + U, zj = Math.max(P, G), Bj = Math.min(z, Z), Vj = Math.max(B, Lj), Hj = Math.min(H, Rj);
9574
+ n = clamp$1(n, zj, Bj), _ = clamp$1(_, Vj, Hj);
9575
9575
  } else n = clamp$1(n, P, z), _ = clamp$1(_, B, H);
9576
9576
  return {
9577
9577
  newWidth: n,
@@ -9628,56 +9628,56 @@ var __assign$1 = function() {
9628
9628
  } catch {}
9629
9629
  var E = this.props, O = E.maxWidth, A = E.maxHeight, j = E.minWidth, M = E.minHeight, N = isTouchEvent(n) ? n.touches[0].clientX : n.clientX, P = isTouchEvent(n) ? n.touches[0].clientY : n.clientY, z = this.state, B = z.direction, H = z.original, U = z.width, W = z.height, G = this.getParentSize(), Z = calculateNewMax(G, this.window.innerWidth, this.window.innerHeight, O, A, j, M);
9630
9630
  O = Z.maxWidth, A = Z.maxHeight, j = Z.minWidth, M = Z.minHeight;
9631
- var Aj = this.calculateNewSizeFromDirection(N, P), jj = Aj.newHeight, Mj = Aj.newWidth, Nj = this.calculateNewMaxFromBoundary(O, A);
9632
- this.props.snap && this.props.snap.x && (Mj = findClosestSnap(Mj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (jj = findClosestSnap(jj, this.props.snap.y, this.props.snapGap));
9633
- var Pj = this.calculateNewSizeFromAspectRatio(Mj, jj, {
9634
- width: Nj.maxWidth,
9635
- height: Nj.maxHeight
9631
+ var Lj = this.calculateNewSizeFromDirection(N, P), Rj = Lj.newHeight, zj = Lj.newWidth, Bj = this.calculateNewMaxFromBoundary(O, A);
9632
+ this.props.snap && this.props.snap.x && (zj = findClosestSnap(zj, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (Rj = findClosestSnap(Rj, this.props.snap.y, this.props.snapGap));
9633
+ var Vj = this.calculateNewSizeFromAspectRatio(zj, Rj, {
9634
+ width: Bj.maxWidth,
9635
+ height: Bj.maxHeight
9636
9636
  }, {
9637
9637
  width: j,
9638
9638
  height: M
9639
9639
  });
9640
- if (Mj = Pj.newWidth, jj = Pj.newHeight, this.props.grid) {
9641
- var Fj = snap(Mj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), Ij = snap(jj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Rj = this.props.snapGap || 0, zj = Rj === 0 || Math.abs(Fj - Mj) <= Rj ? Fj : Mj, Bj = Rj === 0 || Math.abs(Ij - jj) <= Rj ? Ij : jj;
9642
- Mj = zj, jj = Bj;
9640
+ if (zj = Vj.newWidth, Rj = Vj.newHeight, this.props.grid) {
9641
+ var Hj = snap(zj, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), Uj = snap(Rj, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), Gj = this.props.snapGap || 0, Kj = Gj === 0 || Math.abs(Hj - zj) <= Gj ? Hj : zj, qj = Gj === 0 || Math.abs(Uj - Rj) <= Gj ? Uj : Rj;
9642
+ zj = Kj, Rj = qj;
9643
9643
  }
9644
- var Vj = {
9645
- width: Mj - H.width,
9646
- height: jj - H.height
9644
+ var Jj = {
9645
+ width: zj - H.width,
9646
+ height: Rj - H.height
9647
9647
  };
9648
- if (this.delta = Vj, U && typeof U == "string") {
9648
+ if (this.delta = Jj, U && typeof U == "string") {
9649
9649
  if (U.endsWith("%")) {
9650
- var Hj = Mj / G.width * 100;
9651
- Mj = `${Hj}%`;
9650
+ var Yj = zj / G.width * 100;
9651
+ zj = `${Yj}%`;
9652
9652
  } else if (U.endsWith("vw")) {
9653
- var Uj = Mj / this.window.innerWidth * 100;
9654
- Mj = `${Uj}vw`;
9653
+ var Xj = zj / this.window.innerWidth * 100;
9654
+ zj = `${Xj}vw`;
9655
9655
  } else if (U.endsWith("vh")) {
9656
- var Wj = Mj / this.window.innerHeight * 100;
9657
- Mj = `${Wj}vh`;
9656
+ var Zj = zj / this.window.innerHeight * 100;
9657
+ zj = `${Zj}vh`;
9658
9658
  }
9659
9659
  }
9660
9660
  if (W && typeof W == "string") {
9661
9661
  if (W.endsWith("%")) {
9662
- var Hj = jj / G.height * 100;
9663
- jj = `${Hj}%`;
9662
+ var Yj = Rj / G.height * 100;
9663
+ Rj = `${Yj}%`;
9664
9664
  } else if (W.endsWith("vw")) {
9665
- var Uj = jj / this.window.innerWidth * 100;
9666
- jj = `${Uj}vw`;
9665
+ var Xj = Rj / this.window.innerWidth * 100;
9666
+ Rj = `${Xj}vw`;
9667
9667
  } else if (W.endsWith("vh")) {
9668
- var Wj = jj / this.window.innerHeight * 100;
9669
- jj = `${Wj}vh`;
9668
+ var Zj = Rj / this.window.innerHeight * 100;
9669
+ Rj = `${Zj}vh`;
9670
9670
  }
9671
9671
  }
9672
- var Gj = {
9673
- width: this.createSizeForCssProperty(Mj, "width"),
9674
- height: this.createSizeForCssProperty(jj, "height")
9672
+ var Qj = {
9673
+ width: this.createSizeForCssProperty(zj, "width"),
9674
+ height: this.createSizeForCssProperty(Rj, "height")
9675
9675
  };
9676
- this.flexDir === "row" ? Gj.flexBasis = Gj.width : this.flexDir === "column" && (Gj.flexBasis = Gj.height);
9677
- var Kj = this.state.width !== Gj.width, qj = this.state.height !== Gj.height, Jj = this.state.flexBasis !== Gj.flexBasis, Yj = Kj || qj || Jj;
9678
- Yj && flushSync(function() {
9679
- _.setState(Gj);
9680
- }), this.props.onResize && Yj && this.props.onResize(n, B, this.resizable, Vj);
9676
+ this.flexDir === "row" ? Qj.flexBasis = Qj.width : this.flexDir === "column" && (Qj.flexBasis = Qj.height);
9677
+ var $j = this.state.width !== Qj.width, eM = this.state.height !== Qj.height, tM = this.state.flexBasis !== Qj.flexBasis, nM = $j || eM || tM;
9678
+ nM && flushSync(function() {
9679
+ _.setState(Qj);
9680
+ }), this.props.onResize && nM && this.props.onResize(n, B, this.resizable, Jj);
9681
9681
  }
9682
9682
  }, _.prototype.onMouseUp = function(n) {
9683
9683
  var _ = this.state, E = _.isResizing, O = _.direction;
@@ -11186,32 +11186,32 @@ var AnimationSettings = ({ element: n, updateElement: _ }) => {
11186
11186
  });
11187
11187
  };
11188
11188
  const ElementContextMenu = ({ children: n, element: _ }) => {
11189
- let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z, renameElement: B, groupElements: H, ungroupElements: U } = useEditor(), [W, G] = useState(!1), [Z, Aj] = useState(!1), [jj, Mj] = useState(!1), [Fj, Ij] = useState(!1), [Lj, Vj] = useState("formatting"), [Hj, Uj] = useState({
11189
+ let { updateElement: E, removeElement: O, removeSelected: A, addElement: j, moveElement: M, copy: N, paste: P, state: z, renameElement: B, groupElements: H, ungroupElements: U } = useEditor(), [W, G] = useState(!1), [Z, Lj] = useState(!1), [Rj, zj] = useState(!1), [Hj, Uj] = useState(!1), [Wj, Jj] = useState("formatting"), [Yj, Xj] = useState({
11190
11190
  open: !1,
11191
11191
  prop: "",
11192
11192
  value: ""
11193
- }), [Wj, Gj] = useState(!1), [Kj, qj] = useState(""), [Jj, Yj] = useState(""), [Xj, Zj] = useState(_.content), [Qj, $j] = useState(_.dataBinding || ""), eM = useRef(null), tM = useRef(null), nM = (n) => {
11194
- let _ = eM.current;
11193
+ }), [Zj, Qj] = useState(!1), [$j, eM] = useState(""), [tM, nM] = useState(""), [rM, iM] = useState(_.content), [aM, oM] = useState(_.dataBinding || ""), sM = useRef(null), cM = useRef(null), lM = (n) => {
11194
+ let _ = sM.current;
11195
11195
  if (_) {
11196
- let E = _.selectionStart, O = _.selectionEnd, A = Xj;
11197
- Zj(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
11196
+ let E = _.selectionStart, O = _.selectionEnd, A = rM;
11197
+ iM(A.substring(0, E) + `{{${n}}}` + A.substring(O)), setTimeout(() => {
11198
11198
  _.focus();
11199
11199
  let O = E + n.length + 4;
11200
11200
  _.setSelectionRange(O, O);
11201
11201
  }, 0);
11202
- } else Zj((_) => _ + `{{${n}}}`);
11203
- }, rM = (n) => {
11202
+ } else iM((_) => _ + `{{${n}}}`);
11203
+ }, uM = (n) => {
11204
11204
  E(_.id, { style: {
11205
11205
  ..._.style,
11206
11206
  ...n
11207
11207
  } });
11208
- }, iM = () => {
11208
+ }, dM = () => {
11209
11209
  let n = z.elements.findIndex((n) => n.id === _.id);
11210
11210
  n < z.elements.length - 1 && M(n, z.elements.length - 1);
11211
- }, aM = () => {
11211
+ }, fM = () => {
11212
11212
  let n = z.elements.findIndex((n) => n.id === _.id);
11213
11213
  n > 0 && M(n, 0);
11214
- }, oM = () => {
11214
+ }, pM = () => {
11215
11215
  z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? (N(), P()) : j({
11216
11216
  type: _.type,
11217
11217
  content: _.content,
@@ -11221,7 +11221,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11221
11221
  height: _.height,
11222
11222
  style: _.style
11223
11223
  });
11224
- }, sM = [
11224
+ }, mM = [
11225
11225
  "#000000",
11226
11226
  "#FFFFFF",
11227
11227
  "#FF0000",
@@ -11231,36 +11231,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11231
11231
  "#808080",
11232
11232
  "#800080",
11233
11233
  "transparent"
11234
- ], cM = (n, _) => {
11235
- Uj({
11234
+ ], hM = (n, _) => {
11235
+ Xj({
11236
11236
  open: !0,
11237
11237
  prop: n,
11238
11238
  value: _
11239
11239
  });
11240
- }, lM = () => {
11241
- rM({ [Hj.prop]: Hj.value }), Uj((n) => ({
11242
- ...n,
11243
- open: !1
11244
- }));
11245
- }, uM = (n) => {
11246
- let O = n.target.files?.[0];
11247
- if (O) {
11248
- let n = new FileReader();
11249
- n.onload = (n) => {
11250
- n.target?.result && E(_.id, { content: n.target.result });
11251
- }, n.readAsDataURL(O);
11252
- }
11253
- }, dM = () => {
11254
- qj(typeof _.content == "string" ? _.content : ""), Gj(!0);
11255
- }, fM = () => {
11256
- E(_.id, { content: Kj }), Gj(!1);
11257
- }, pM = () => {
11258
- $j(_.dataBinding || ""), Mj(!0);
11259
- }, mM = () => {
11260
- let n = Qj, O = { dataBinding: n };
11261
- (_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O), Mj(!1);
11262
- }, hM = () => {
11263
- Zj(_.content), Aj(!0);
11264
11240
  };
11265
11241
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
11266
11242
  /* @__PURE__ */ jsx(s$4, {
@@ -11272,8 +11248,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11272
11248
  direction: "column",
11273
11249
  gap: "3",
11274
11250
  children: [/* @__PURE__ */ jsx(u$1, {
11275
- value: Jj,
11276
- onChange: (n) => Yj(n.target.value),
11251
+ value: tM,
11252
+ onChange: (n) => nM(n.target.value),
11277
11253
  placeholder: "Nome da camada..."
11278
11254
  }), /* @__PURE__ */ jsxs(p$1, {
11279
11255
  gap: "3",
@@ -11284,7 +11260,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11284
11260
  children: "Cancelar"
11285
11261
  }) }), /* @__PURE__ */ jsx(o, {
11286
11262
  onClick: () => {
11287
- B(_.id, Jj), G(!1);
11263
+ B(_.id, tM), G(!1);
11288
11264
  },
11289
11265
  children: "Salvar"
11290
11266
  })]
@@ -11294,7 +11270,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11294
11270
  }),
11295
11271
  /* @__PURE__ */ jsx(s$4, {
11296
11272
  open: Z,
11297
- onOpenChange: Aj,
11273
+ onOpenChange: Lj,
11298
11274
  children: /* @__PURE__ */ jsxs(p$8, {
11299
11275
  style: { maxWidth: 450 },
11300
11276
  children: [/* @__PURE__ */ jsx(g$2, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p$1, {
@@ -11302,9 +11278,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11302
11278
  gap: "3",
11303
11279
  children: [
11304
11280
  /* @__PURE__ */ jsx(r, {
11305
- ref: eM,
11306
- value: Xj,
11307
- onChange: (n) => Zj(n.target.value),
11281
+ ref: sM,
11282
+ value: rM,
11283
+ onChange: (n) => iM(n.target.value),
11308
11284
  placeholder: "Digite o novo texto...",
11309
11285
  style: { height: 100 }
11310
11286
  }),
@@ -11322,7 +11298,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11322
11298
  color: "blue",
11323
11299
  variant: "surface",
11324
11300
  style: { cursor: "pointer" },
11325
- onClick: () => nM(n.dataName),
11301
+ onClick: () => lM(n.dataName),
11326
11302
  children: n.name
11327
11303
  }, n.dataName))
11328
11304
  })]
@@ -11336,7 +11312,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11336
11312
  children: "Cancelar"
11337
11313
  }) }), /* @__PURE__ */ jsx(o, {
11338
11314
  onClick: () => {
11339
- E(_.id, { content: Xj }), Aj(!1);
11315
+ E(_.id, { content: rM }), Lj(!1);
11340
11316
  },
11341
11317
  children: "Salvar"
11342
11318
  })]
@@ -11346,8 +11322,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11346
11322
  })
11347
11323
  }),
11348
11324
  /* @__PURE__ */ jsx(s$4, {
11349
- open: jj,
11350
- onOpenChange: Mj,
11325
+ open: Rj,
11326
+ onOpenChange: zj,
11351
11327
  children: /* @__PURE__ */ jsxs(p$8, {
11352
11328
  style: { maxWidth: 450 },
11353
11329
  children: [/* @__PURE__ */ jsx(g$2, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p$1, {
@@ -11359,8 +11335,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11359
11335
  children: "Nome da propriedade (ex: titulo, preco, imagem):"
11360
11336
  }),
11361
11337
  /* @__PURE__ */ jsx(u$1, {
11362
- value: Qj,
11363
- onChange: (n) => $j(n.target.value),
11338
+ value: aM,
11339
+ onChange: (n) => oM(n.target.value),
11364
11340
  placeholder: "propriedade"
11365
11341
  }),
11366
11342
  /* @__PURE__ */ jsxs(p$1, {
@@ -11371,7 +11347,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11371
11347
  color: "gray",
11372
11348
  children: "Cancelar"
11373
11349
  }) }), /* @__PURE__ */ jsx(o, {
11374
- onClick: mM,
11350
+ onClick: () => {
11351
+ let n = aM, O = { dataBinding: n };
11352
+ (_.type === "text" || _.type === "text-container") && (O.content = `{{${n}}}`), E(_.id, O), zj(!1);
11353
+ },
11375
11354
  children: "Vincular"
11376
11355
  })]
11377
11356
  })
@@ -11380,8 +11359,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11380
11359
  })
11381
11360
  }),
11382
11361
  /* @__PURE__ */ jsx(s$4, {
11383
- open: Hj.open,
11384
- onOpenChange: (n) => Uj((_) => ({
11362
+ open: Yj.open,
11363
+ onOpenChange: (n) => Xj((_) => ({
11385
11364
  ..._,
11386
11365
  open: n
11387
11366
  })),
@@ -11390,8 +11369,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11390
11369
  children: [
11391
11370
  /* @__PURE__ */ jsx(g$2, { children: "Selecionar Cor" }),
11392
11371
  /* @__PURE__ */ jsx(ColorPickerContent, {
11393
- color: Hj.value,
11394
- onChange: (n) => Uj((_) => ({
11372
+ color: Yj.value,
11373
+ onChange: (n) => Xj((_) => ({
11395
11374
  ..._,
11396
11375
  value: n
11397
11376
  }))
@@ -11405,7 +11384,12 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11405
11384
  color: "gray",
11406
11385
  children: "Cancelar"
11407
11386
  }) }), /* @__PURE__ */ jsx(o, {
11408
- onClick: lM,
11387
+ onClick: () => {
11388
+ uM({ [Yj.prop]: Yj.value }), Xj((n) => ({
11389
+ ...n,
11390
+ open: !1
11391
+ }));
11392
+ },
11409
11393
  children: "Aplicar"
11410
11394
  })]
11411
11395
  })
@@ -11414,21 +11398,21 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11414
11398
  }),
11415
11399
  /* @__PURE__ */ jsx(ElementAdvancedSettings, {
11416
11400
  elementId: _.id,
11417
- open: Fj,
11418
- onOpenChange: Ij,
11419
- initialTab: Lj
11401
+ open: Hj,
11402
+ onOpenChange: Uj,
11403
+ initialTab: Wj
11420
11404
  }),
11421
11405
  /* @__PURE__ */ jsx(s$4, {
11422
- open: Wj,
11423
- onOpenChange: Gj,
11406
+ open: Zj,
11407
+ onOpenChange: Qj,
11424
11408
  children: /* @__PURE__ */ jsxs(p$8, {
11425
11409
  style: { maxWidth: 450 },
11426
11410
  children: [/* @__PURE__ */ jsx(g$2, { children: "Inserir URL da Imagem" }), /* @__PURE__ */ jsxs(p$1, {
11427
11411
  direction: "column",
11428
11412
  gap: "3",
11429
11413
  children: [/* @__PURE__ */ jsx(u$1, {
11430
- value: Kj,
11431
- onChange: (n) => qj(n.target.value),
11414
+ value: $j,
11415
+ onChange: (n) => eM(n.target.value),
11432
11416
  placeholder: "https://exemplo.com/imagem.png"
11433
11417
  }), /* @__PURE__ */ jsxs(p$1, {
11434
11418
  gap: "3",
@@ -11438,7 +11422,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11438
11422
  color: "gray",
11439
11423
  children: "Cancelar"
11440
11424
  }) }), /* @__PURE__ */ jsx(o, {
11441
- onClick: fM,
11425
+ onClick: () => {
11426
+ E(_.id, { content: $j }), Qj(!1);
11427
+ },
11442
11428
  children: "Aplicar"
11443
11429
  })]
11444
11430
  })]
@@ -11447,18 +11433,23 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11447
11433
  }),
11448
11434
  /* @__PURE__ */ jsx("input", {
11449
11435
  type: "file",
11450
- ref: tM,
11436
+ ref: cM,
11451
11437
  style: { display: "none" },
11452
11438
  accept: "image/*",
11453
- onChange: uM
11439
+ onChange: (n) => {
11440
+ let O = n.target.files?.[0];
11441
+ if (O) {
11442
+ let n = new FileReader();
11443
+ n.onload = (n) => {
11444
+ n.target?.result && E(_.id, { content: n.target.result });
11445
+ }, n.readAsDataURL(O);
11446
+ }
11447
+ }
11454
11448
  }),
11455
11449
  /* @__PURE__ */ jsxs(Root2$3, { children: [/* @__PURE__ */ jsx(Trigger$3, {
11456
11450
  asChild: !0,
11457
11451
  children: /* @__PURE__ */ jsx("div", {
11458
11452
  style: { display: "contents" },
11459
- onDoubleClick: (n) => {
11460
- (_.type === "text" || _.type === "text-container") && (n.stopPropagation(), hM());
11461
- },
11462
11453
  children: n
11463
11454
  })
11464
11455
  }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(Content2$2, {
@@ -11507,7 +11498,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11507
11498
  }, n.dataName)), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
11508
11499
  /* @__PURE__ */ jsx(Item2$1, {
11509
11500
  className: "ContextMenuItem",
11510
- onSelect: pM,
11501
+ onSelect: () => {
11502
+ oM(_.dataBinding || ""), zj(!0);
11503
+ },
11511
11504
  children: "Outro / Manual..."
11512
11505
  }),
11513
11506
  _.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }), /* @__PURE__ */ jsx(Item2$1, {
@@ -11519,15 +11512,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11519
11512
  ]
11520
11513
  }) })] }),
11521
11514
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11522
- _.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
11515
+ (_.type === "text" || _.type === "text-container") && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
11523
11516
  className: "ContextMenuItem",
11524
- onSelect: hM,
11517
+ onSelect: () => {
11518
+ iM(_.content), Lj(!0);
11519
+ },
11525
11520
  children: "Editar Texto..."
11526
11521
  }), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
11527
11522
  /* @__PURE__ */ jsx(Item2$1, {
11528
11523
  className: "ContextMenuItem",
11529
11524
  onSelect: () => {
11530
- Yj(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
11525
+ nM(_.name || (_.type === "group" ? "Grupo" : "Elemento")), G(!0);
11531
11526
  },
11532
11527
  children: "Renomear..."
11533
11528
  }),
@@ -11544,13 +11539,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11544
11539
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11545
11540
  /* @__PURE__ */ jsx(Item2$1, {
11546
11541
  className: "ContextMenuItem",
11547
- onSelect: () => Ij(!0),
11542
+ onSelect: () => Uj(!0),
11548
11543
  children: "Configurações Avançadas..."
11549
11544
  }),
11550
11545
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11551
11546
  /* @__PURE__ */ jsx(Item2$1, {
11552
11547
  className: "ContextMenuItem",
11553
- onSelect: oM,
11548
+ onSelect: pM,
11554
11549
  children: z.selectedElementIds.includes(_.id) && z.selectedElementIds.length > 1 ? `Duplicar Selecionados (${z.selectedElementIds.length})` : "Duplicar"
11555
11550
  }),
11556
11551
  /* @__PURE__ */ jsx(Item2$1, {
@@ -11574,11 +11569,13 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11574
11569
  alignOffset: -5,
11575
11570
  children: [/* @__PURE__ */ jsx(Item2$1, {
11576
11571
  className: "ContextMenuItem",
11577
- onSelect: () => tM.current?.click(),
11572
+ onSelect: () => cM.current?.click(),
11578
11573
  children: "Carregar do Computador"
11579
11574
  }), /* @__PURE__ */ jsx(Item2$1, {
11580
11575
  className: "ContextMenuItem",
11581
- onSelect: dM,
11576
+ onSelect: () => {
11577
+ eM(typeof _.content == "string" ? _.content : ""), Qj(!0);
11578
+ },
11582
11579
  children: "Inserir URL"
11583
11580
  })]
11584
11581
  }) })] }),
@@ -11595,17 +11592,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11595
11592
  children: [
11596
11593
  /* @__PURE__ */ jsx(Item2$1, {
11597
11594
  className: "ContextMenuItem",
11598
- onSelect: () => rM({ objectFit: "cover" }),
11595
+ onSelect: () => uM({ objectFit: "cover" }),
11599
11596
  children: "Preencher (Cover)"
11600
11597
  }),
11601
11598
  /* @__PURE__ */ jsx(Item2$1, {
11602
11599
  className: "ContextMenuItem",
11603
- onSelect: () => rM({ objectFit: "contain" }),
11600
+ onSelect: () => uM({ objectFit: "contain" }),
11604
11601
  children: "Ajustar (Contain)"
11605
11602
  }),
11606
11603
  /* @__PURE__ */ jsx(Item2$1, {
11607
11604
  className: "ContextMenuItem",
11608
- onSelect: () => rM({ objectFit: "fill" }),
11605
+ onSelect: () => uM({ objectFit: "fill" }),
11609
11606
  children: "Esticar (Fill)"
11610
11607
  })
11611
11608
  ]
@@ -11624,16 +11621,16 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11624
11621
  alignOffset: -5,
11625
11622
  children: [/* @__PURE__ */ jsx(Item2$1, {
11626
11623
  className: "ContextMenuItem",
11627
- onSelect: iM,
11624
+ onSelect: dM,
11628
11625
  children: "Trazer para frente"
11629
11626
  }), /* @__PURE__ */ jsx(Item2$1, {
11630
11627
  className: "ContextMenuItem",
11631
- onSelect: aM,
11628
+ onSelect: fM,
11632
11629
  children: "Enviar para trás"
11633
11630
  })]
11634
11631
  }) })] }),
11635
11632
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11636
- _.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
11633
+ (_.type === "text" || _.type === "text-container") && /* @__PURE__ */ jsxs(Fragment$1, { children: [
11637
11634
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
11638
11635
  className: "ContextMenuSubTrigger",
11639
11636
  children: ["Fonte", /* @__PURE__ */ jsx("div", {
@@ -11646,7 +11643,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11646
11643
  alignOffset: -5,
11647
11644
  children: z.availableFonts && z.availableFonts.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11648
11645
  className: "ContextMenuItem",
11649
- onSelect: () => rM({ fontFamily: n }),
11646
+ onSelect: () => uM({ fontFamily: n }),
11650
11647
  style: { fontFamily: n },
11651
11648
  children: [n, _.style?.fontFamily === n && /* @__PURE__ */ jsx("div", {
11652
11649
  className: "RightSlot",
@@ -11675,7 +11672,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11675
11672
  64
11676
11673
  ].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11677
11674
  className: "ContextMenuItem",
11678
- onSelect: () => rM({ fontSize: `${n}px` }),
11675
+ onSelect: () => uM({ fontSize: `${n}px` }),
11679
11676
  children: [n, "px"]
11680
11677
  }, n))
11681
11678
  }) })] }),
@@ -11690,9 +11687,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11690
11687
  sideOffset: 2,
11691
11688
  alignOffset: -5,
11692
11689
  children: [
11693
- sM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11690
+ mM.filter((n) => n !== "transparent").map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11694
11691
  className: "ContextMenuItem",
11695
- onSelect: () => rM({ color: n }),
11692
+ onSelect: () => uM({ color: n }),
11696
11693
  children: [/* @__PURE__ */ jsx("div", { style: {
11697
11694
  width: 12,
11698
11695
  height: 12,
@@ -11704,7 +11701,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11704
11701
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11705
11702
  /* @__PURE__ */ jsx(Item2$1, {
11706
11703
  className: "ContextMenuItem",
11707
- onSelect: () => cM("color", _.style?.color || "#000000"),
11704
+ onSelect: () => hM("color", _.style?.color || "#000000"),
11708
11705
  children: "Outra Cor..."
11709
11706
  })
11710
11707
  ]
@@ -11721,11 +11718,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11721
11718
  alignOffset: -5,
11722
11719
  children: [/* @__PURE__ */ jsx(Item2$1, {
11723
11720
  className: "ContextMenuItem",
11724
- onSelect: () => rM({ fontWeight: "normal" }),
11721
+ onSelect: () => uM({ fontWeight: "normal" }),
11725
11722
  children: "Normal"
11726
11723
  }), /* @__PURE__ */ jsx(Item2$1, {
11727
11724
  className: "ContextMenuItem",
11728
- onSelect: () => rM({ fontWeight: "bold" }),
11725
+ onSelect: () => uM({ fontWeight: "bold" }),
11729
11726
  children: "Negrito"
11730
11727
  })]
11731
11728
  }) })] }),
@@ -11742,17 +11739,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11742
11739
  children: [
11743
11740
  /* @__PURE__ */ jsx(Item2$1, {
11744
11741
  className: "ContextMenuItem",
11745
- onSelect: () => rM({ textAlign: "left" }),
11742
+ onSelect: () => uM({ textAlign: "left" }),
11746
11743
  children: "Esquerda"
11747
11744
  }),
11748
11745
  /* @__PURE__ */ jsx(Item2$1, {
11749
11746
  className: "ContextMenuItem",
11750
- onSelect: () => rM({ textAlign: "center" }),
11747
+ onSelect: () => uM({ textAlign: "center" }),
11751
11748
  children: "Centro"
11752
11749
  }),
11753
11750
  /* @__PURE__ */ jsx(Item2$1, {
11754
11751
  className: "ContextMenuItem",
11755
- onSelect: () => rM({ textAlign: "right" }),
11752
+ onSelect: () => uM({ textAlign: "right" }),
11756
11753
  children: "Direita"
11757
11754
  })
11758
11755
  ]
@@ -11770,7 +11767,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11770
11767
  children: [
11771
11768
  /* @__PURE__ */ jsx(Item2$1, {
11772
11769
  className: "ContextMenuItem",
11773
- onSelect: () => rM({
11770
+ onSelect: () => uM({
11774
11771
  display: "flex",
11775
11772
  flexDirection: "column",
11776
11773
  justifyContent: "flex-start"
@@ -11779,7 +11776,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11779
11776
  }),
11780
11777
  /* @__PURE__ */ jsx(Item2$1, {
11781
11778
  className: "ContextMenuItem",
11782
- onSelect: () => rM({
11779
+ onSelect: () => uM({
11783
11780
  display: "flex",
11784
11781
  flexDirection: "column",
11785
11782
  justifyContent: "center"
@@ -11788,7 +11785,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11788
11785
  }),
11789
11786
  /* @__PURE__ */ jsx(Item2$1, {
11790
11787
  className: "ContextMenuItem",
11791
- onSelect: () => rM({
11788
+ onSelect: () => uM({
11792
11789
  display: "flex",
11793
11790
  flexDirection: "column",
11794
11791
  justifyContent: "flex-end"
@@ -11809,9 +11806,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11809
11806
  sideOffset: 2,
11810
11807
  alignOffset: -5,
11811
11808
  children: [
11812
- sM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11809
+ mM.map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11813
11810
  className: "ContextMenuItem",
11814
- onSelect: () => rM({ backgroundColor: n }),
11811
+ onSelect: () => uM({ backgroundColor: n }),
11815
11812
  children: [/* @__PURE__ */ jsx("div", { style: {
11816
11813
  width: 12,
11817
11814
  height: 12,
@@ -11823,7 +11820,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11823
11820
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11824
11821
  /* @__PURE__ */ jsx(Item2$1, {
11825
11822
  className: "ContextMenuItem",
11826
- onSelect: () => cM("backgroundColor", _.style?.backgroundColor || "transparent"),
11823
+ onSelect: () => hM("backgroundColor", _.style?.backgroundColor || "transparent"),
11827
11824
  children: "Outra Cor..."
11828
11825
  })
11829
11826
  ]
@@ -11849,14 +11846,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11849
11846
  "50%"
11850
11847
  ].map((n) => /* @__PURE__ */ jsx(Item2$1, {
11851
11848
  className: "ContextMenuItem",
11852
- onSelect: () => rM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
11849
+ onSelect: () => uM({ borderRadius: typeof n == "number" ? `${n}px` : n }),
11853
11850
  children: n === "50%" ? "Círculo" : `${n}px`
11854
11851
  }, n)),
11855
11852
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11856
11853
  /* @__PURE__ */ jsx(Item2$1, {
11857
11854
  className: "ContextMenuItem",
11858
11855
  onSelect: () => {
11859
- Vj("style"), Ij(!0);
11856
+ Jj("style"), Uj(!0);
11860
11857
  },
11861
11858
  children: "Personalizar..."
11862
11859
  })
@@ -11883,14 +11880,14 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11883
11880
  32
11884
11881
  ].map((n) => /* @__PURE__ */ jsxs(Item2$1, {
11885
11882
  className: "ContextMenuItem",
11886
- onSelect: () => rM({ padding: `${n}px` }),
11883
+ onSelect: () => uM({ padding: `${n}px` }),
11887
11884
  children: [n, "px"]
11888
11885
  }, n)),
11889
11886
  /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
11890
11887
  /* @__PURE__ */ jsx(Item2$1, {
11891
11888
  className: "ContextMenuItem",
11892
11889
  onSelect: () => {
11893
- Vj("style"), Ij(!0);
11890
+ Jj("style"), Uj(!0);
11894
11891
  },
11895
11892
  children: "Personalizar..."
11896
11893
  })
@@ -11900,55 +11897,55 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11900
11897
  }) })] })
11901
11898
  ] });
11902
11899
  }, DraggableElement = React.memo(({ element: n, isSelected: _ }) => {
11903
- let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, G] = useState(!1), Z = useRef(null), Aj = useRef({
11900
+ let { selectElement: E, updateElement: O, updateElements: A, state: j, resizeGroup: M, setSnapLines: N } = useEditor(), [P, z] = useState(!1), [B, H] = useState(!1), [U, G] = useState(!1), Z = useRef(null), Lj = useRef({
11904
11901
  x: 0,
11905
11902
  y: 0
11906
- }), jj = useRef({}), Mj = useRef(!1), Fj = useRef(!1), Ij = useRef(0), Lj = useRef(0), Rj = useRef({
11903
+ }), Rj = useRef({}), zj = useRef(!1), Hj = useRef(!1), Uj = useRef(0), Wj = useRef(0), Gj = useRef({
11907
11904
  x: 0,
11908
11905
  y: 0
11909
- }), Vj = useRef(!1), Hj = j.canvasHeight || 150, Uj = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, Wj = n.content, Gj = {};
11910
- if (Uj) {
11911
- if (n.type === "text" || n.type === "text-container") Wj = Wj.replace(/\{\{(.*?)\}\}/g, (_, E) => {
11912
- let O = Uj[E.trim()];
11906
+ }), Jj = useRef(!1), Yj = j.canvasHeight || 150, Xj = j.isList ? j.mockData.length > 0 ? j.mockData[0] : null : j.singleMockData, Zj = n.content, Qj = {};
11907
+ if (Xj) {
11908
+ if (n.type === "text" || n.type === "text-container") Zj = Zj.replace(/\{\{(.*?)\}\}/g, (_, E) => {
11909
+ let O = Xj[E.trim()];
11913
11910
  return O == null ? _ : n.formatting ? formatValue(O, n.formatting) : String(O);
11914
11911
  });
11915
11912
  else if (n.type === "image") if (n.dataBinding) {
11916
- let _ = Uj[n.dataBinding];
11917
- _ != null && (Wj = String(_));
11918
- } else Wj = Wj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
11919
- let E = Uj[_.trim()];
11913
+ let _ = Xj[n.dataBinding];
11914
+ _ != null && (Zj = String(_));
11915
+ } else Zj = Zj.replace(/\{\{(.*?)\}\}/g, (n, _) => {
11916
+ let E = Xj[_.trim()];
11920
11917
  return E == null ? n : String(E);
11921
11918
  });
11922
11919
  n.styleBindings && Object.entries(n.styleBindings).forEach(([n, _]) => {
11923
- let E = Uj[_];
11924
- E != null && (Gj = {
11925
- ...Gj,
11920
+ let E = Xj[_];
11921
+ E != null && (Qj = {
11922
+ ...Qj,
11926
11923
  [n]: String(E)
11927
11924
  });
11928
11925
  }), n.conditions && n.conditions.forEach((n) => {
11929
- let _ = Uj[n.property];
11930
- checkCondition(_, n.operator, n.value) && (Gj = {
11931
- ...Gj,
11926
+ let _ = Xj[n.property];
11927
+ checkCondition(_, n.operator, n.value) && (Qj = {
11928
+ ...Qj,
11932
11929
  ...n.style
11933
11930
  });
11934
11931
  });
11935
11932
  }
11936
- let Kj = Gj.display === "none";
11937
- if (Kj && _) {
11938
- let { display: n, ..._ } = Gj;
11939
- Gj = _;
11933
+ let $j = Qj.display === "none";
11934
+ if ($j && _) {
11935
+ let { display: n, ..._ } = Qj;
11936
+ Qj = _;
11940
11937
  }
11941
- let qj = (_) => {
11942
- _.stopPropagation(), !Mj.current && !Fj.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
11943
- }, Jj = (O) => {
11938
+ let eM = (_) => {
11939
+ _.stopPropagation(), !zj.current && !Hj.current && !P && (_.shiftKey ? E(n.id, !0) : E(n.id, !1));
11940
+ }, tM = (O) => {
11944
11941
  if (O.button !== 0) return;
11945
11942
  O.stopPropagation();
11946
11943
  let A = O.shiftKey;
11947
- if (Mj.current = !1, Fj.current = !1, n.groupId && !_) {
11944
+ if (zj.current = !1, Hj.current = !1, n.groupId && !_) {
11948
11945
  E(n.groupId, A);
11949
11946
  return;
11950
11947
  }
11951
- _ || (E(n.id, A), Fj.current = !0), z(!0), Aj.current = {
11948
+ _ || (E(n.id, A), Hj.current = !0), z(!0), Lj.current = {
11952
11949
  x: O.clientX,
11953
11950
  y: O.clientY
11954
11951
  }, O.currentTarget.setPointerCapture(O.pointerId);
@@ -11960,17 +11957,17 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
11960
11957
  x: n.x,
11961
11958
  y: n.y
11962
11959
  });
11963
- }), jj.current = N;
11964
- }, Yj = (_) => {
11960
+ }), Rj.current = N;
11961
+ }, nM = (_) => {
11965
11962
  if (P) {
11966
- let E = j.zoom || 1, O = (_.clientX - Aj.current.x) / E, M = (_.clientY - Aj.current.y) / E;
11967
- (Math.abs(O) > 2 || Math.abs(M) > 2) && (Mj.current = !0);
11968
- let P = 5 / E, z = [], B = Object.entries(jj.current).map(([_, E]) => {
11963
+ let E = j.zoom || 1, O = (_.clientX - Lj.current.x) / E, M = (_.clientY - Lj.current.y) / E;
11964
+ (Math.abs(O) > 2 || Math.abs(M) > 2) && (zj.current = !0);
11965
+ let P = 5 / E, z = [], B = Object.entries(Rj.current).map(([_, E]) => {
11969
11966
  let A = E.x + O, N = E.y + M;
11970
11967
  if (j.gridSize > 0) A = Math.round(A / j.gridSize) * j.gridSize, N = Math.round(N / j.gridSize) * j.gridSize;
11971
11968
  else {
11972
11969
  let E = !1, O = !1, M = n.width ?? 100, B = n.height ?? 100;
11973
- Object.keys(jj.current).length === 1 && j.elements.forEach((n) => {
11970
+ Object.keys(Rj.current).length === 1 && j.elements.forEach((n) => {
11974
11971
  if (n.id === _) return;
11975
11972
  let j = n.width ?? 100, H = n.height ?? 100;
11976
11973
  E || (Math.abs(A - n.x) < P ? (A = n.x, E = !0, z.push({
@@ -12010,25 +12007,25 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12010
12007
  });
12011
12008
  N && N(z), A(B, !1);
12012
12009
  }
12013
- }, Xj = (n) => {
12010
+ }, rM = (n) => {
12014
12011
  P && (z(!1), n.currentTarget.releasePointerCapture(n.pointerId), A([], !0), N && N([]));
12015
- }, Zj = (_) => {
12012
+ }, iM = (_) => {
12016
12013
  _.stopPropagation(), _.preventDefault(), G(!0);
12017
12014
  let E = _.target.closest(".resizable-element");
12018
12015
  if (E) {
12019
12016
  let O = E.getBoundingClientRect();
12020
- Rj.current = {
12017
+ Gj.current = {
12021
12018
  x: O.left + O.width / 2,
12022
12019
  y: O.top + O.height / 2
12023
12020
  };
12024
- let A = _.clientX - Rj.current.x, j = _.clientY - Rj.current.y;
12025
- Ij.current = Math.atan2(j, A) * (180 / Math.PI), Lj.current = n.rotation || 0;
12021
+ let A = _.clientX - Gj.current.x, j = _.clientY - Gj.current.y;
12022
+ Uj.current = Math.atan2(j, A) * (180 / Math.PI), Wj.current = n.rotation || 0;
12026
12023
  }
12027
12024
  };
12028
12025
  useEffect(() => {
12029
12026
  let _ = (_) => {
12030
12027
  if (U) {
12031
- let E = _.clientX - Rj.current.x, A = _.clientY - Rj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Ij.current, M = (Lj.current + j) % 360;
12028
+ let E = _.clientX - Gj.current.x, A = _.clientY - Gj.current.y, j = Math.atan2(A, E) * (180 / Math.PI) - Uj.current, M = (Wj.current + j) % 360;
12032
12029
  O(n.id, { rotation: M }, !1);
12033
12030
  }
12034
12031
  }, E = () => {
@@ -12050,7 +12047,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12050
12047
  }
12051
12048
  });
12052
12049
  }, [
12053
- Wj,
12050
+ Zj,
12054
12051
  n.autoGrow,
12055
12052
  n.containerExpansion,
12056
12053
  n.style,
@@ -12060,7 +12057,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12060
12057
  n.id,
12061
12058
  n.type
12062
12059
  ]);
12063
- let Qj = {
12060
+ let aM = {
12064
12061
  position: "absolute",
12065
12062
  left: 0,
12066
12063
  top: 0,
@@ -12077,7 +12074,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12077
12074
  wordBreak: n.autoGrow ? "break-word" : void 0,
12078
12075
  userSelect: "none",
12079
12076
  ...n.style,
12080
- ...Gj
12077
+ ...Qj
12081
12078
  };
12082
12079
  return /* @__PURE__ */ jsx(Resizable, {
12083
12080
  className: "resizable-element",
@@ -12085,9 +12082,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12085
12082
  width: n.width ?? 100,
12086
12083
  height: n.autoGrow ? "auto" : n.height ?? 100
12087
12084
  },
12088
- maxHeight: j.isList ? Math.max(10, Hj - n.y) : void 0,
12085
+ maxHeight: j.isList ? Math.max(10, Yj - n.y) : void 0,
12089
12086
  onResizeStart: (n) => {
12090
- H(!0), Vj.current = !!n.shiftKey;
12087
+ H(!0), Jj.current = !!n.shiftKey;
12091
12088
  },
12092
12089
  onResizeStop: (_, E, A, j) => {
12093
12090
  H(!1);
@@ -12101,8 +12098,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12101
12098
  position: "absolute",
12102
12099
  transform: `translate(${n.x ?? 0}px, ${n.y ?? 0}px) rotate(${n.rotation || 0}deg)`,
12103
12100
  height: n.autoGrow ? "auto" : void 0,
12104
- display: Kj && !_ ? "none" : void 0,
12105
- opacity: Kj && _ ? .4 : 1,
12101
+ display: $j && !_ ? "none" : void 0,
12102
+ opacity: $j && _ ? .4 : 1,
12106
12103
  zIndex: _ ? 1e3 : void 0,
12107
12104
  outline: _ ? "1px dashed var(--accent-9)" : void 0
12108
12105
  },
@@ -12116,7 +12113,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12116
12113
  bottomLeft: !1,
12117
12114
  topLeft: !1
12118
12115
  },
12119
- lockAspectRatio: Vj.current === !0,
12116
+ lockAspectRatio: Jj.current === !0,
12120
12117
  grid: j.gridSize > 0 ? [j.gridSize, j.gridSize] : void 0,
12121
12118
  children: /* @__PURE__ */ jsx(ElementContextMenu, {
12122
12119
  element: n,
@@ -12129,18 +12126,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12129
12126
  children: [/* @__PURE__ */ jsxs(p, {
12130
12127
  ref: Z,
12131
12128
  style: {
12132
- ...Qj,
12133
- whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : Qj.whiteSpace,
12129
+ ...aM,
12130
+ whiteSpace: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "nowrap" : aM.whiteSpace,
12134
12131
  width: n.type === "text-container" && n.autoGrow && n.containerExpansion === "horizontal" ? "max-content" : "100%",
12135
12132
  height: n.type === "text-container" && n.autoGrow && n.containerExpansion === "vertical" ? "auto" : "100%"
12136
12133
  },
12137
- onPointerDown: Jj,
12138
- onPointerMove: Yj,
12139
- onPointerUp: Xj,
12134
+ onPointerDown: tM,
12135
+ onPointerMove: nM,
12136
+ onPointerUp: rM,
12140
12137
  onMouseDown: (n) => {
12141
12138
  n.button === 0 && n.stopPropagation();
12142
12139
  },
12143
- onClick: qj,
12140
+ onClick: eM,
12144
12141
  title: n.name,
12145
12142
  onMouseEnter: (n) => {
12146
12143
  _ || (n.currentTarget.style.borderColor = "var(--gray-6)");
@@ -12148,13 +12145,30 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12148
12145
  onMouseLeave: (n) => {
12149
12146
  _ || (n.currentTarget.style.borderColor = "transparent");
12150
12147
  },
12148
+ onDragOver: (n) => {
12149
+ n.preventDefault(), n.stopPropagation(), n.dataTransfer.dropEffect = "copy";
12150
+ },
12151
+ onDrop: (_) => {
12152
+ _.preventDefault(), _.stopPropagation();
12153
+ let E = _.dataTransfer.getData("application/x-editor-prop");
12154
+ if (E) if (n.type === "text" || n.type === "text-container") {
12155
+ let _ = n.content ? `${n.content} {{${E}}}` : `{{${E}}}`;
12156
+ O(n.id, {
12157
+ content: _,
12158
+ dataBinding: E
12159
+ });
12160
+ } else n.type === "image" && O(n.id, {
12161
+ dataBinding: E,
12162
+ content: `{{${E}}}`
12163
+ });
12164
+ },
12151
12165
  children: [
12152
12166
  n.type === "text" && /* @__PURE__ */ jsx(p$2, {
12153
12167
  style: {
12154
12168
  width: "100%",
12155
12169
  height: "100%"
12156
12170
  },
12157
- children: Wj
12171
+ children: Zj
12158
12172
  }),
12159
12173
  n.type === "text-container" && /* @__PURE__ */ jsx(p$2, {
12160
12174
  style: {
@@ -12162,10 +12176,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12162
12176
  height: "100%",
12163
12177
  display: "block"
12164
12178
  },
12165
- children: Wj
12179
+ children: Zj
12166
12180
  }),
12167
- n.type === "image" && (Wj ? /* @__PURE__ */ jsx("img", {
12168
- src: Wj,
12181
+ n.type === "image" && (Zj ? /* @__PURE__ */ jsx("img", {
12182
+ src: Zj,
12169
12183
  alt: "Element",
12170
12184
  style: {
12171
12185
  width: "100%",
@@ -12230,7 +12244,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12230
12244
  zIndex: 50,
12231
12245
  boxShadow: "0 0 0 2px white"
12232
12246
  },
12233
- onMouseDown: Zj,
12247
+ onMouseDown: iM,
12234
12248
  children: /* @__PURE__ */ jsx(p, { style: {
12235
12249
  position: "absolute",
12236
12250
  top: 12,
@@ -12245,44 +12259,44 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12245
12259
  })
12246
12260
  });
12247
12261
  }), Canvas = () => {
12248
- let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: U } = useEditor(), G = useRef(null), [Z, Aj] = useState(null), jj = useRef(!1), Mj = useRef(!1), Fj = useRef(!1), Ij = useRef({
12262
+ let { state: n, selectElement: _, setSelectedElements: E, addElement: O, setZoom: A, setPan: j, undo: M, redo: N, copy: P, paste: z, removeSelected: B, updateElements: U } = useEditor(), G = useRef(null), [Z, Lj] = useState(null), Rj = useRef(!1), zj = useRef(!1), Hj = useRef(!1), Uj = useRef({
12249
12263
  x: 0,
12250
12264
  y: 0
12251
- }), Lj = useRef({
12265
+ }), Wj = useRef({
12252
12266
  x: 0,
12253
12267
  y: 0
12254
- }), Rj = useRef([]), Vj = (E) => {
12255
- if (E.button === 1 || E.button === 0 && Fj.current) {
12256
- E.preventDefault(), Mj.current = !0, Lj.current = {
12268
+ }), Gj = useRef([]), Jj = (E) => {
12269
+ if (E.button === 1 || E.button === 0 && Hj.current) {
12270
+ E.preventDefault(), zj.current = !0, Wj.current = {
12257
12271
  x: E.clientX,
12258
12272
  y: E.clientY
12259
12273
  };
12260
12274
  return;
12261
12275
  }
12262
- jj.current = !0;
12276
+ Rj.current = !0;
12263
12277
  let O = G.current?.getBoundingClientRect();
12264
12278
  if (!O) return;
12265
12279
  let A = O.left, j = O.top;
12266
- Ij.current = {
12280
+ Uj.current = {
12267
12281
  x: (E.clientX - A - n.pan.x) / n.zoom,
12268
12282
  y: (E.clientY - j - n.pan.y) / n.zoom
12269
- }, Rj.current = n.selectedElementIds, E.shiftKey || (_(null), Rj.current = []), window.addEventListener("mousemove", Hj), window.addEventListener("mouseup", Uj);
12270
- }, Hj = useCallback((_) => {
12283
+ }, Gj.current = n.selectedElementIds, E.shiftKey || (_(null), Gj.current = []), window.addEventListener("mousemove", Yj), window.addEventListener("mouseup", Xj);
12284
+ }, Yj = useCallback((_) => {
12271
12285
  if (!G.current) return;
12272
- if (Mj.current) {
12273
- let E = _.clientX - Lj.current.x, O = _.clientY - Lj.current.y;
12286
+ if (zj.current) {
12287
+ let E = _.clientX - Wj.current.x, O = _.clientY - Wj.current.y;
12274
12288
  j({
12275
12289
  x: n.pan.x + E,
12276
12290
  y: n.pan.y + O
12277
- }), Lj.current = {
12291
+ }), Wj.current = {
12278
12292
  x: _.clientX,
12279
12293
  y: _.clientY
12280
12294
  };
12281
12295
  return;
12282
12296
  }
12283
- if (!jj.current) return;
12284
- let O = G.current.getBoundingClientRect(), A = (_.clientX - O.left - n.pan.x) / n.zoom, M = (_.clientY - O.top - n.pan.y) / n.zoom, N = Math.min(Ij.current.x, A), P = Math.min(Ij.current.y, M), z = Math.abs(A - Ij.current.x), B = Math.abs(M - Ij.current.y);
12285
- if (Aj({
12297
+ if (!Rj.current) return;
12298
+ let O = G.current.getBoundingClientRect(), A = (_.clientX - O.left - n.pan.x) / n.zoom, M = (_.clientY - O.top - n.pan.y) / n.zoom, N = Math.min(Uj.current.x, A), P = Math.min(Uj.current.y, M), z = Math.abs(A - Uj.current.x), B = Math.abs(M - Uj.current.y);
12299
+ if (Lj({
12286
12300
  x: N,
12287
12301
  y: P,
12288
12302
  width: z,
@@ -12292,7 +12306,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12292
12306
  n.elements.forEach((n) => {
12293
12307
  let E = n.x ?? 0, O = n.y ?? 0, A = n.width ?? 100, j = n.height ?? 100, M = E + A, H = O + j, U = N + z, W = P + B;
12294
12308
  E < U && M > N && O < W && H > P && _.push(n.id);
12295
- }), E(Array.from(new Set([...Rj.current, ..._])));
12309
+ }), E(Array.from(new Set([...Gj.current, ..._])));
12296
12310
  }
12297
12311
  }, [
12298
12312
  n.elements,
@@ -12300,9 +12314,9 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12300
12314
  n.zoom,
12301
12315
  E,
12302
12316
  j
12303
- ]), Uj = useCallback(() => {
12304
- jj.current = !1, Mj.current = !1, Aj(null), window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Uj);
12305
- }, [Hj]), Wj = (_) => {
12317
+ ]), Xj = useCallback(() => {
12318
+ Rj.current = !1, zj.current = !1, Lj(null), window.removeEventListener("mousemove", Yj), window.removeEventListener("mouseup", Xj);
12319
+ }, [Yj]), Zj = (_) => {
12306
12320
  if (_.ctrlKey || _.metaKey) _.preventDefault(), A(Math.min(Math.max(.1, n.zoom - _.deltaY * .001), 5));
12307
12321
  else {
12308
12322
  let E = _.shiftKey ? _.deltaY : _.deltaX, O = _.shiftKey ? _.deltaX : _.deltaY;
@@ -12314,7 +12328,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12314
12328
  };
12315
12329
  useEffect(() => {
12316
12330
  let _ = (_) => {
12317
- if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (Fj.current = !0, G.current && (G.current.style.cursor = "grab")), !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && ((_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "z" && (_.preventDefault(), _.shiftKey ? N() : M()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "y" && (_.preventDefault(), N()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "c" && (_.preventDefault(), P()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "v" && (_.preventDefault(), z()), (_.key === "Delete" || _.key === "Backspace") && (_.preventDefault(), B()), [
12331
+ if (_.code === "Space" && !_.repeat && !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && (Hj.current = !0, G.current && (G.current.style.cursor = "grab")), !(_.target instanceof HTMLInputElement || _.target instanceof HTMLTextAreaElement) && ((_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "z" && (_.preventDefault(), _.shiftKey ? N() : M()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "y" && (_.preventDefault(), N()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "c" && (_.preventDefault(), P()), (_.ctrlKey || _.metaKey) && _.key.toLowerCase() === "v" && (_.preventDefault(), z()), (_.key === "Delete" || _.key === "Backspace") && (_.preventDefault(), B()), [
12318
12332
  "ArrowUp",
12319
12333
  "ArrowDown",
12320
12334
  "ArrowLeft",
@@ -12337,10 +12351,10 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12337
12351
  }), O.length > 0 && U(O);
12338
12352
  }
12339
12353
  }, E = (n) => {
12340
- n.code === "Space" && (Fj.current = !1, G.current && !Mj.current && (G.current.style.cursor = "default"));
12354
+ n.code === "Space" && (Hj.current = !1, G.current && !zj.current && (G.current.style.cursor = "default"));
12341
12355
  };
12342
12356
  return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
12343
- window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove", Hj), window.removeEventListener("mouseup", Uj);
12357
+ window.removeEventListener("keydown", _), window.removeEventListener("keyup", E), window.removeEventListener("mousemove", Yj), window.removeEventListener("mouseup", Xj);
12344
12358
  };
12345
12359
  }, [
12346
12360
  M,
@@ -12351,24 +12365,24 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12351
12365
  U,
12352
12366
  n.selectedElementIds,
12353
12367
  n.elements,
12354
- Hj,
12355
- Uj
12368
+ Yj,
12369
+ Xj
12356
12370
  ]);
12357
- let Gj = useRef(!1), { setCanvasHeight: Kj } = useEditor(), qj = (n) => {
12358
- n.stopPropagation(), n.preventDefault(), Gj.current = !0, window.addEventListener("mousemove", Jj), window.addEventListener("mouseup", Yj);
12359
- }, Jj = useCallback((n) => {
12360
- if (!Gj.current || !G.current) return;
12371
+ let Qj = useRef(!1), { setCanvasHeight: $j } = useEditor(), eM = (n) => {
12372
+ n.stopPropagation(), n.preventDefault(), Qj.current = !0, window.addEventListener("mousemove", tM), window.addEventListener("mouseup", nM);
12373
+ }, tM = useCallback((n) => {
12374
+ if (!Qj.current || !G.current) return;
12361
12375
  let _ = G.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
12362
- Kj(Math.round(O));
12363
- }, [Kj]), Yj = useCallback(() => {
12364
- Gj.current = !1, window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
12365
- }, [Jj]);
12376
+ $j(Math.round(O));
12377
+ }, [$j]), nM = useCallback(() => {
12378
+ Qj.current = !1, window.removeEventListener("mousemove", tM), window.removeEventListener("mouseup", nM);
12379
+ }, [tM]);
12366
12380
  useEffect(() => () => {
12367
- window.removeEventListener("mousemove", Jj), window.removeEventListener("mouseup", Yj);
12368
- }, [Jj, Yj]);
12369
- let Xj = (n) => {
12381
+ window.removeEventListener("mousemove", tM), window.removeEventListener("mouseup", nM);
12382
+ }, [tM, nM]);
12383
+ let rM = (n) => {
12370
12384
  n.preventDefault(), n.dataTransfer.dropEffect = "copy";
12371
- }, Zj = (n) => {
12385
+ }, iM = (n) => {
12372
12386
  n.preventDefault();
12373
12387
  let _ = n.dataTransfer.getData("application/x-editor-prop");
12374
12388
  if (_) {
@@ -12383,20 +12397,20 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12383
12397
  dataBinding: _
12384
12398
  });
12385
12399
  }
12386
- }, Qj = n.canvasHeight || 150;
12400
+ }, aM = n.canvasHeight || 150;
12387
12401
  return /* @__PURE__ */ jsxs(p, {
12388
12402
  ref: G,
12389
- onMouseDown: Vj,
12390
- onDragOver: Xj,
12391
- onDrop: Zj,
12392
- onWheel: Wj,
12403
+ onMouseDown: Jj,
12404
+ onDragOver: rM,
12405
+ onDrop: iM,
12406
+ onWheel: Zj,
12393
12407
  style: {
12394
12408
  width: "100%",
12395
12409
  height: "100%",
12396
12410
  position: "relative",
12397
12411
  overflow: "hidden",
12398
12412
  backgroundColor: "var(--color-background)",
12399
- cursor: Mj.current ? "grabbing" : "default",
12413
+ cursor: zj.current ? "grabbing" : "default",
12400
12414
  backgroundImage: "radial-gradient(var(--gray-5) 1px, transparent 1px)",
12401
12415
  backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
12402
12416
  backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
@@ -12445,7 +12459,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12445
12459
  n.isList && /* @__PURE__ */ jsxs("div", {
12446
12460
  style: {
12447
12461
  position: "absolute",
12448
- top: Qj,
12462
+ top: aM,
12449
12463
  left: 0,
12450
12464
  right: 0,
12451
12465
  height: "10px",
@@ -12457,7 +12471,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12457
12471
  justifyContent: "center",
12458
12472
  group: "resize-handle"
12459
12473
  },
12460
- onMouseDown: qj,
12474
+ onMouseDown: eM,
12461
12475
  children: [/* @__PURE__ */ jsx("div", { style: {
12462
12476
  width: "100%",
12463
12477
  height: "2px",
@@ -12481,7 +12495,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12481
12495
  },
12482
12496
  children: [
12483
12497
  "Altura do Item: ",
12484
- Qj,
12498
+ aM,
12485
12499
  "px"
12486
12500
  ]
12487
12501
  })]
@@ -12560,22 +12574,22 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12560
12574
  })]
12561
12575
  });
12562
12576
  }, EditorSettings = () => {
12563
- let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, G] = useState("down"), [Z, Aj] = useState("150"), [jj, Mj] = useState(""), [Nj, Fj] = useState("0"), [Ij, Lj] = useState("slideIn"), [Rj, Vj] = useState(.3), [Hj, Uj] = useState("ease-out");
12577
+ let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, G] = useState("down"), [Z, Lj] = useState("150"), [Rj, zj] = useState(""), [Bj, Hj] = useState("0"), [Uj, Wj] = useState("slideIn"), [Gj, Jj] = useState(.3), [Yj, Xj] = useState("ease-out");
12564
12578
  return useEffect(() => {
12565
12579
  if (A) {
12566
- N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"), Mj(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), Aj(String(n.canvasHeight || 150)), Fj(String(n.gridSize || 0));
12580
+ N(n.listSettings.sortProp || "__none__"), z(n.listSettings.sortOrder || "asc"), H(n.listSettings.newestPosition || "bottom"), G(n.listSettings.scrollDirection || "down"), zj(n.listSettings.containerHeight ? String(n.listSettings.containerHeight) : ""), Lj(String(n.canvasHeight || 150)), Hj(String(n.gridSize || 0));
12567
12581
  let _ = n.listSettings.entryAnimation;
12568
- Lj(_?.type || "slideIn"), Vj(_?.duration || .3), Uj(_?.timingFunction || "ease-out");
12582
+ Wj(_?.type || "slideIn"), Jj(_?.duration || .3), Xj(_?.timingFunction || "ease-out");
12569
12583
  }
12570
12584
  }, [A]), useEffect(() => {
12571
12585
  if (!A) return;
12572
12586
  let _ = parseInt(Z, 10);
12573
12587
  !isNaN(_) && _ > 0 && n.canvasHeight !== _ && E(_);
12574
- let j = parseInt(Nj, 10);
12588
+ let j = parseInt(Bj, 10);
12575
12589
  !isNaN(j) && j >= 0 && n.gridSize !== j && O(j);
12576
12590
  }, [
12577
12591
  Z,
12578
- Nj,
12592
+ Bj,
12579
12593
  A,
12580
12594
  E,
12581
12595
  O,
@@ -12754,7 +12768,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12754
12768
  type: "number",
12755
12769
  min: "10",
12756
12770
  value: Z,
12757
- onChange: (n) => Aj(n.target.value)
12771
+ onChange: (n) => Lj(n.target.value)
12758
12772
  }),
12759
12773
  /* @__PURE__ */ jsx(p$2, {
12760
12774
  size: "1",
@@ -12775,8 +12789,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12775
12789
  type: "number",
12776
12790
  min: "0",
12777
12791
  placeholder: "Auto (100%)",
12778
- value: jj,
12779
- onChange: (n) => Mj(n.target.value)
12792
+ value: Rj,
12793
+ onChange: (n) => zj(n.target.value)
12780
12794
  }),
12781
12795
  /* @__PURE__ */ jsx(p$2, {
12782
12796
  size: "1",
@@ -12802,8 +12816,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12802
12816
  as: "div",
12803
12817
  children: "Efeito"
12804
12818
  }), /* @__PURE__ */ jsxs("select", {
12805
- value: Ij,
12806
- onChange: (n) => Lj(n.target.value),
12819
+ value: Uj,
12820
+ onChange: (n) => Wj(n.target.value),
12807
12821
  style: {
12808
12822
  width: "100%",
12809
12823
  padding: "6px",
@@ -12865,8 +12879,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12865
12879
  type: "number",
12866
12880
  step: "0.1",
12867
12881
  min: "0.1",
12868
- value: Rj,
12869
- onChange: (n) => Vj(parseFloat(n.target.value) || .3)
12882
+ value: Gj,
12883
+ onChange: (n) => Jj(parseFloat(n.target.value) || .3)
12870
12884
  })] }),
12871
12885
  /* @__PURE__ */ jsxs(p, { children: [/* @__PURE__ */ jsx(p$2, {
12872
12886
  size: "1",
@@ -12874,8 +12888,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12874
12888
  as: "div",
12875
12889
  children: "Curva (Easing)"
12876
12890
  }), /* @__PURE__ */ jsxs("select", {
12877
- value: Hj,
12878
- onChange: (n) => Uj(n.target.value),
12891
+ value: Yj,
12892
+ onChange: (n) => Xj(n.target.value),
12879
12893
  style: {
12880
12894
  width: "100%",
12881
12895
  padding: "6px",
@@ -12930,8 +12944,8 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12930
12944
  children: "Tamanho do Grid (px) - 0 para desativar"
12931
12945
  }), /* @__PURE__ */ jsx(u$1, {
12932
12946
  type: "number",
12933
- value: Nj,
12934
- onChange: (n) => Fj(n.target.value),
12947
+ value: Bj,
12948
+ onChange: (n) => Hj(n.target.value),
12935
12949
  placeholder: "0"
12936
12950
  })]
12937
12951
  })
@@ -12950,11 +12964,11 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
12950
12964
  children: "Cancelar"
12951
12965
  }) }), /* @__PURE__ */ jsx(D$2, { children: /* @__PURE__ */ jsx(o, {
12952
12966
  onClick: () => {
12953
- let n = parseInt(jj, 10), E = {
12954
- type: Ij,
12955
- duration: Number(Rj),
12967
+ let n = parseInt(Rj, 10), E = {
12968
+ type: Uj,
12969
+ duration: Number(Gj),
12956
12970
  delay: 0,
12957
- timingFunction: Hj
12971
+ timingFunction: Yj
12958
12972
  };
12959
12973
  _({
12960
12974
  sortProp: M === "__none__" ? "" : M,
@@ -13118,13 +13132,13 @@ function createRenderBatcher(n, _) {
13118
13132
  }, j = () => E = !0, M = stepsOrder.reduce((n, E) => (n[E] = createRenderStep(j, _ ? E : void 0), n), {}), { setup: N, read: P, resolveKeyframes: z, preUpdate: B, update: H, preRender: U, render: W, postRender: G } = M, Z = () => {
13119
13133
  let j = MotionGlobalConfig.useManualTiming ? A.timestamp : performance.now();
13120
13134
  E = !1, MotionGlobalConfig.useManualTiming || (A.delta = O ? 1e3 / 60 : Math.max(Math.min(j - A.timestamp, maxElapsed), 1)), A.timestamp = j, A.isProcessing = !0, N.process(A), P.process(A), z.process(A), B.process(A), H.process(A), U.process(A), W.process(A), G.process(A), A.isProcessing = !1, E && _ && (O = !1, n(Z));
13121
- }, Aj = () => {
13135
+ }, Lj = () => {
13122
13136
  E = !0, O = !0, A.isProcessing || n(Z);
13123
13137
  };
13124
13138
  return {
13125
13139
  schedule: stepsOrder.reduce((n, _) => {
13126
13140
  let O = M[_];
13127
- return n[_] = (n, _ = !1, A = !1) => (E || Aj(), O.schedule(n, _, A)), n;
13141
+ return n[_] = (n, _ = !1, A = !1) => (E || Lj(), O.schedule(n, _, A)), n;
13128
13142
  }, {}),
13129
13143
  cancel: (n) => {
13130
13144
  for (let _ = 0; _ < stepsOrder.length; _++) M[stepsOrder[_]].cancel(n);
@@ -13482,40 +13496,40 @@ function spring(n = springDefaults.visualDuration, _ = springDefaults.bounce) {
13482
13496
  }, { stiffness: P, damping: z, mass: B, duration: H, velocity: U, isResolvedFromDuration: W } = getSpringOptions({
13483
13497
  ...E,
13484
13498
  velocity: -/* @__PURE__ */ millisecondsToSeconds(E.velocity || 0)
13485
- }), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Aj = M - j, jj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), Mj = Math.abs(Aj) < 5;
13486
- O ||= Mj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= Mj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
13487
- let Nj;
13499
+ }), G = U || 0, Z = z / (2 * Math.sqrt(P * B)), Lj = M - j, Rj = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(P / B)), zj = Math.abs(Lj) < 5;
13500
+ O ||= zj ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, A ||= zj ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
13501
+ let Bj;
13488
13502
  if (Z < 1) {
13489
- let n = calcAngularFreq(jj, Z);
13490
- Nj = (_) => M - Math.exp(-Z * jj * _) * ((G + Z * jj * Aj) / n * Math.sin(n * _) + Aj * Math.cos(n * _));
13491
- } else if (Z === 1) Nj = (n) => M - Math.exp(-jj * n) * (Aj + (G + jj * Aj) * n);
13503
+ let n = calcAngularFreq(Rj, Z);
13504
+ Bj = (_) => M - Math.exp(-Z * Rj * _) * ((G + Z * Rj * Lj) / n * Math.sin(n * _) + Lj * Math.cos(n * _));
13505
+ } else if (Z === 1) Bj = (n) => M - Math.exp(-Rj * n) * (Lj + (G + Rj * Lj) * n);
13492
13506
  else {
13493
- let n = jj * Math.sqrt(Z * Z - 1);
13494
- Nj = (_) => {
13495
- let E = Math.exp(-Z * jj * _), O = Math.min(n * _, 300);
13496
- return M - E * ((G + Z * jj * Aj) * Math.sinh(O) + n * Aj * Math.cosh(O)) / n;
13507
+ let n = Rj * Math.sqrt(Z * Z - 1);
13508
+ Bj = (_) => {
13509
+ let E = Math.exp(-Z * Rj * _), O = Math.min(n * _, 300);
13510
+ return M - E * ((G + Z * Rj * Lj) * Math.sinh(O) + n * Lj * Math.cosh(O)) / n;
13497
13511
  };
13498
13512
  }
13499
- let Pj = {
13513
+ let Vj = {
13500
13514
  calculatedDuration: W && H || null,
13501
13515
  next: (n) => {
13502
- let _ = Nj(n);
13516
+ let _ = Bj(n);
13503
13517
  if (W) N.done = n >= H;
13504
13518
  else {
13505
13519
  let E = n === 0 ? G : 0;
13506
- Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Nj, n, _));
13520
+ Z < 1 && (E = n === 0 ? /* @__PURE__ */ secondsToMilliseconds(G) : calcGeneratorVelocity(Bj, n, _));
13507
13521
  let j = Math.abs(E) <= O, P = Math.abs(M - _) <= A;
13508
13522
  N.done = j && P;
13509
13523
  }
13510
13524
  return N.value = N.done ? M : _, N;
13511
13525
  },
13512
13526
  toString: () => {
13513
- let n = Math.min(calcGeneratorDuration(Pj), maxGeneratorDuration), _ = generateLinearEasing((_) => Pj.next(n * _).value, n, 30);
13527
+ let n = Math.min(calcGeneratorDuration(Vj), maxGeneratorDuration), _ = generateLinearEasing((_) => Vj.next(n * _).value, n, 30);
13514
13528
  return n + "ms " + _;
13515
13529
  },
13516
13530
  toTransition: () => {}
13517
13531
  };
13518
- return Pj;
13532
+ return Vj;
13519
13533
  }
13520
13534
  spring.applyToOptions = (n) => {
13521
13535
  let _ = createGeneratorEasing(n, 100, spring);
@@ -13525,26 +13539,26 @@ function inertia({ keyframes: n, velocity: _ = 0, power: E = .8, timeConstant: O
13525
13539
  let H = n[0], U = {
13526
13540
  done: !1,
13527
13541
  value: H
13528
- }, W = (n) => N !== void 0 && n < N || P !== void 0 && n > P, G = (n) => N === void 0 ? P : P === void 0 || Math.abs(N - n) < Math.abs(P - n) ? N : P, Z = E * _, Aj = H + Z, jj = M === void 0 ? Aj : M(Aj);
13529
- jj !== Aj && (Z = jj - H);
13530
- let Mj = (n) => -Z * Math.exp(-n / O), Nj = (n) => jj + Mj(n), Pj = (n) => {
13531
- let _ = Mj(n), E = Nj(n);
13532
- U.done = Math.abs(_) <= z, U.value = U.done ? jj : E;
13533
- }, Fj, Ij, Lj = (n) => {
13534
- W(U.value) && (Fj = n, Ij = spring({
13542
+ }, W = (n) => N !== void 0 && n < N || P !== void 0 && n > P, G = (n) => N === void 0 ? P : P === void 0 || Math.abs(N - n) < Math.abs(P - n) ? N : P, Z = E * _, Lj = H + Z, Rj = M === void 0 ? Lj : M(Lj);
13543
+ Rj !== Lj && (Z = Rj - H);
13544
+ let zj = (n) => -Z * Math.exp(-n / O), Bj = (n) => Rj + zj(n), Vj = (n) => {
13545
+ let _ = zj(n), E = Bj(n);
13546
+ U.done = Math.abs(_) <= z, U.value = U.done ? Rj : E;
13547
+ }, Hj, Uj, Wj = (n) => {
13548
+ W(U.value) && (Hj = n, Uj = spring({
13535
13549
  keyframes: [U.value, G(U.value)],
13536
- velocity: calcGeneratorVelocity(Nj, n, U.value),
13550
+ velocity: calcGeneratorVelocity(Bj, n, U.value),
13537
13551
  damping: A,
13538
13552
  stiffness: j,
13539
13553
  restDelta: z,
13540
13554
  restSpeed: B
13541
13555
  }));
13542
13556
  };
13543
- return Lj(0), {
13557
+ return Wj(0), {
13544
13558
  calculatedDuration: null,
13545
13559
  next: (n) => {
13546
13560
  let _ = !1;
13547
- return !Ij && Fj === void 0 && (_ = !0, Pj(n), Lj(n)), Fj !== void 0 && n >= Fj ? Ij.next(n - Fj) : (!_ && Pj(n), U);
13561
+ return !Uj && Hj === void 0 && (_ = !0, Vj(n), Wj(n)), Hj !== void 0 && n >= Hj ? Uj.next(n - Hj) : (!_ && Vj(n), U);
13548
13562
  }
13549
13563
  };
13550
13564
  }
@@ -13664,22 +13678,22 @@ var WithPromise = class {
13664
13678
  if (this.startTime === null) return E.next(0);
13665
13679
  let { delay: P = 0, keyframes: z, repeat: B, repeatType: H, repeatDelay: U, type: W, onUpdate: G, finalKeyframe: Z } = this.options;
13666
13680
  this.speed > 0 ? this.startTime = Math.min(this.startTime, n) : this.speed < 0 && (this.startTime = Math.min(n - O / this.speed, this.startTime)), _ ? this.currentTime = n : this.updateTime(n);
13667
- let Aj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), jj = this.playbackSpeed >= 0 ? Aj < 0 : Aj > O;
13668
- this.currentTime = Math.max(Aj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
13669
- let Mj = this.currentTime, Nj = E;
13681
+ let Lj = this.currentTime - P * (this.playbackSpeed >= 0 ? 1 : -1), Rj = this.playbackSpeed >= 0 ? Lj < 0 : Lj > O;
13682
+ this.currentTime = Math.max(Lj, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = O);
13683
+ let zj = this.currentTime, Bj = E;
13670
13684
  if (B) {
13671
13685
  let n = Math.min(this.currentTime, O) / M, _ = Math.floor(n), E = n % 1;
13672
- !E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Nj = j)), Mj = clamp(0, 1, E) * M;
13686
+ !E && n >= 1 && (E = 1), E === 1 && _--, _ = Math.min(_, B + 1), _ % 2 && (H === "reverse" ? (E = 1 - E, U && (E -= U / M)) : H === "mirror" && (Bj = j)), zj = clamp(0, 1, E) * M;
13673
13687
  }
13674
- let Pj = jj ? {
13688
+ let Vj = Rj ? {
13675
13689
  done: !1,
13676
13690
  value: z[0]
13677
- } : Nj.next(Mj);
13678
- A && (Pj.value = A(Pj.value));
13679
- let { done: Fj } = Pj;
13680
- !jj && N !== null && (Fj = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
13681
- let Ij = this.holdTime === null && (this.state === "finished" || this.state === "running" && Fj);
13682
- return Ij && W !== inertia && (Pj.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(Pj.value), Ij && this.finish(), Pj;
13691
+ } : Bj.next(zj);
13692
+ A && (Vj.value = A(Vj.value));
13693
+ let { done: Hj } = Vj;
13694
+ !Rj && N !== null && (Hj = this.playbackSpeed >= 0 ? this.currentTime >= O : this.currentTime <= 0);
13695
+ let Uj = this.holdTime === null && (this.state === "finished" || this.state === "running" && Hj);
13696
+ return Uj && W !== inertia && (Vj.value = getFinalKeyframe$1(z, this.options, Z, this.speed)), G && G(Vj.value), Uj && this.finish(), Vj;
13683
13697
  }
13684
13698
  then(n, _) {
13685
13699
  return this.finished.then(n, _);
@@ -14742,46 +14756,46 @@ function onlyElements(n) {
14742
14756
  }), _;
14743
14757
  }
14744
14758
  var AnimatePresence = ({ children: n, custom: _, initial: E = !0, onExitComplete: O, presenceAffectsLayout: A = !0, mode: j = "sync", propagate: M = !1, anchorX: N = "left", root: P }) => {
14745
- let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Aj = useConstant(() => /* @__PURE__ */ new Map()), jj = useRef(/* @__PURE__ */ new Set()), [Fj, Ij] = useState(H), [Lj, Bj] = useState(H);
14759
+ let [z, B] = usePresence(M), H = useMemo(() => onlyElements(n), [n]), W = M && !z ? [] : H.map(getChildKey), G = useRef(!0), Z = useRef(H), Lj = useConstant(() => /* @__PURE__ */ new Map()), Rj = useRef(/* @__PURE__ */ new Set()), [Hj, Uj] = useState(H), [Wj, qj] = useState(H);
14746
14760
  useIsomorphicLayoutEffect(() => {
14747
14761
  G.current = !1, Z.current = H;
14748
- for (let n = 0; n < Lj.length; n++) {
14749
- let _ = getChildKey(Lj[n]);
14750
- W.includes(_) ? (Aj.delete(_), jj.current.delete(_)) : Aj.get(_) !== !0 && Aj.set(_, !1);
14762
+ for (let n = 0; n < Wj.length; n++) {
14763
+ let _ = getChildKey(Wj[n]);
14764
+ W.includes(_) ? (Lj.delete(_), Rj.current.delete(_)) : Lj.get(_) !== !0 && Lj.set(_, !1);
14751
14765
  }
14752
14766
  }, [
14753
- Lj,
14767
+ Wj,
14754
14768
  W.length,
14755
14769
  W.join("-")
14756
14770
  ]);
14757
- let Vj = [];
14758
- if (H !== Fj) {
14771
+ let Jj = [];
14772
+ if (H !== Hj) {
14759
14773
  let n = [...H];
14760
- for (let _ = 0; _ < Lj.length; _++) {
14761
- let E = Lj[_], O = getChildKey(E);
14762
- W.includes(O) || (n.splice(_, 0, E), Vj.push(E));
14774
+ for (let _ = 0; _ < Wj.length; _++) {
14775
+ let E = Wj[_], O = getChildKey(E);
14776
+ W.includes(O) || (n.splice(_, 0, E), Jj.push(E));
14763
14777
  }
14764
- return j === "wait" && Vj.length && (n = Vj), Bj(onlyElements(n)), Ij(H), null;
14778
+ return j === "wait" && Jj.length && (n = Jj), qj(onlyElements(n)), Uj(H), null;
14765
14779
  }
14766
- process.env.NODE_ENV !== "production" && j === "wait" && Lj.length > 1 && console.warn("You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.");
14767
- let { forceRender: Hj } = useContext(LayoutGroupContext);
14768
- return jsx(Fragment$1, { children: Lj.map((n) => {
14769
- let U = getChildKey(n), Mj = M && !z ? !1 : H === Lj || W.includes(U);
14780
+ process.env.NODE_ENV !== "production" && j === "wait" && Wj.length > 1 && console.warn("You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.");
14781
+ let { forceRender: Yj } = useContext(LayoutGroupContext);
14782
+ return jsx(Fragment$1, { children: Wj.map((n) => {
14783
+ let U = getChildKey(n), zj = M && !z ? !1 : H === Wj || W.includes(U);
14770
14784
  return jsx(PresenceChild, {
14771
- isPresent: Mj,
14785
+ isPresent: zj,
14772
14786
  initial: !G.current || E ? void 0 : !1,
14773
14787
  custom: _,
14774
14788
  presenceAffectsLayout: A,
14775
14789
  mode: j,
14776
14790
  root: P,
14777
- onExitComplete: Mj ? void 0 : () => {
14778
- if (jj.current.has(U)) return;
14779
- if (jj.current.add(U), Aj.has(U)) Aj.set(U, !0);
14791
+ onExitComplete: zj ? void 0 : () => {
14792
+ if (Rj.current.has(U)) return;
14793
+ if (Rj.current.add(U), Lj.has(U)) Lj.set(U, !0);
14780
14794
  else return;
14781
14795
  let n = !0;
14782
- Aj.forEach((_) => {
14796
+ Lj.forEach((_) => {
14783
14797
  _ || (n = !1);
14784
- }), n && (Hj?.(), Bj(Z.current), M && B?.(), O && O());
14798
+ }), n && (Yj?.(), qj(Z.current), M && B?.(), O && O());
14785
14799
  },
14786
14800
  anchorX: N,
14787
14801
  children: n
@@ -15210,12 +15224,12 @@ function useVisualElement(n, _, E, O, A, j) {
15210
15224
  useInsertionEffect(() => {
15211
15225
  H && Z.current && H.update(E, P);
15212
15226
  });
15213
- let jj = E[optimizedAppearDataAttribute], Mj = useRef(!!jj && !window.MotionHandoffIsComplete?.(jj) && window.MotionHasOptimisedAnimation?.(jj));
15227
+ let Rj = E[optimizedAppearDataAttribute], zj = useRef(!!Rj && !window.MotionHandoffIsComplete?.(Rj) && window.MotionHasOptimisedAnimation?.(Rj));
15214
15228
  return useIsomorphicLayoutEffect(() => {
15215
- H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), Mj.current && H.animationState && H.animationState.animateChanges());
15229
+ H && (Z.current = !0, window.MotionIsMounted = !0, H.updateFeatures(), H.scheduleRenderMicrotask(), zj.current && H.animationState && H.animationState.animateChanges());
15216
15230
  }), useEffect(() => {
15217
- H && (!Mj.current && H.animationState && H.animationState.animateChanges(), Mj.current &&= (queueMicrotask(() => {
15218
- window.MotionHandoffMarkAsComplete?.(jj);
15231
+ H && (!zj.current && H.animationState && H.animationState.animateChanges(), zj.current &&= (queueMicrotask(() => {
15232
+ window.MotionHandoffMarkAsComplete?.(Rj);
15219
15233
  }), !1), H.enteringChildren = void 0);
15220
15234
  }), H;
15221
15235
  }
@@ -15893,34 +15907,34 @@ function createAnimationState(n) {
15893
15907
  function M(j) {
15894
15908
  let { props: M } = n, N = getVariantContext(n.parent) || {}, P = [], z = /* @__PURE__ */ new Set(), B = {}, H = Infinity;
15895
15909
  for (let _ = 0; _ < numAnimationTypes; _++) {
15896
- let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Aj = U === j ? W.isActive : null;
15897
- Aj === !1 && (H = _);
15898
- let jj = G === N[U] && G !== M[U] && Z;
15899
- if (jj && O && n.manuallyAnimateOnMount && (jj = !1), W.protectedKeys = { ...B }, !W.isActive && Aj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
15900
- let Mj = checkVariantsDidChange(W.prevProp, G), Nj = Mj || U === j && W.isActive && !jj && Z || _ > H && Z, Pj = !1, Fj = Array.isArray(G) ? G : [G], Ij = Fj.reduce(A(U), {});
15901
- Aj === !1 && (Ij = {});
15902
- let { prevResolvedValues: Lj = {} } = W, Rj = {
15903
- ...Lj,
15904
- ...Ij
15905
- }, zj = (_) => {
15906
- Nj = !0, z.has(_) && (Pj = !0, z.delete(_)), W.needsAnimating[_] = !0;
15910
+ let U = reversePriorityOrder[_], W = E[U], G = M[U] === void 0 ? N[U] : M[U], Z = isVariantLabel(G), Lj = U === j ? W.isActive : null;
15911
+ Lj === !1 && (H = _);
15912
+ let Rj = G === N[U] && G !== M[U] && Z;
15913
+ if (Rj && O && n.manuallyAnimateOnMount && (Rj = !1), W.protectedKeys = { ...B }, !W.isActive && Lj === null || !G && !W.prevProp || isAnimationControls(G) || typeof G == "boolean") continue;
15914
+ let zj = checkVariantsDidChange(W.prevProp, G), Bj = zj || U === j && W.isActive && !Rj && Z || _ > H && Z, Vj = !1, Hj = Array.isArray(G) ? G : [G], Uj = Hj.reduce(A(U), {});
15915
+ Lj === !1 && (Uj = {});
15916
+ let { prevResolvedValues: Wj = {} } = W, Gj = {
15917
+ ...Wj,
15918
+ ...Uj
15919
+ }, Kj = (_) => {
15920
+ Bj = !0, z.has(_) && (Vj = !0, z.delete(_)), W.needsAnimating[_] = !0;
15907
15921
  let E = n.getValue(_);
15908
15922
  E && (E.liveStyle = !1);
15909
15923
  };
15910
- for (let n in Rj) {
15911
- let _ = Ij[n], E = Lj[n];
15924
+ for (let n in Gj) {
15925
+ let _ = Uj[n], E = Wj[n];
15912
15926
  if (B.hasOwnProperty(n)) continue;
15913
15927
  let O = !1;
15914
- O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : zj(n) : _ !== void 0 && z.has(n) ? zj(n) : W.protectedKeys[n] = !0;
15928
+ O = isKeyframesTarget(_) && isKeyframesTarget(E) ? !shallowCompare(_, E) : _ !== E, O ? _ == null ? z.add(n) : Kj(n) : _ !== void 0 && z.has(n) ? Kj(n) : W.protectedKeys[n] = !0;
15915
15929
  }
15916
- W.prevProp = G, W.prevResolvedValues = Ij, W.isActive && (B = {
15930
+ W.prevProp = G, W.prevResolvedValues = Uj, W.isActive && (B = {
15917
15931
  ...B,
15918
- ...Ij
15919
- }), O && n.blockInitialAnimation && (Nj = !1);
15920
- let Bj = jj && Mj;
15921
- Nj && (!Bj || Pj) && P.push(...Fj.map((_) => {
15932
+ ...Uj
15933
+ }), O && n.blockInitialAnimation && (Bj = !1);
15934
+ let qj = Rj && zj;
15935
+ Bj && (!qj || Vj) && P.push(...Hj.map((_) => {
15922
15936
  let E = { type: U };
15923
- if (typeof _ == "string" && O && !Bj && n.manuallyAnimateOnMount && n.parent) {
15937
+ if (typeof _ == "string" && O && !qj && n.manuallyAnimateOnMount && n.parent) {
15924
15938
  let { parent: O } = n, A = resolveVariant(O, _);
15925
15939
  if (O.enteringChildren && A) {
15926
15940
  let { delayChildren: _ } = A.transition || {};
@@ -17592,9 +17606,9 @@ var getAnimationVariants = (n) => {
17592
17606
  }, PreviewElementRenderer = ({ element: n, offsetY: _ = 0, dataContext: E }) => {
17593
17607
  let O = n.content;
17594
17608
  if (E) {
17595
- if (n.type === "text" || n.type === "text-container") O = O.replace(/\{\{(.*?)\}\}/g, (n, _) => {
17596
- let O = E[_.trim()];
17597
- return O == null ? n : String(O);
17609
+ if (n.type === "text" || n.type === "text-container") O = O.replace(/\{\{(.*?)\}\}/g, (_, O) => {
17610
+ let A = E[O.trim()];
17611
+ return A == null ? _ : n.formatting ? formatValue(A, n.formatting) : String(A);
17598
17612
  });
17599
17613
  else if (n.type === "image") if (n.dataBinding) {
17600
17614
  let _ = E[n.dataBinding];
@@ -17800,16 +17814,16 @@ const Preview = () => {
17800
17814
  });
17801
17815
  };
17802
17816
  var LayersPanel = ({ onOpenSettings: n }) => {
17803
- let { state: _, selectElement: E, renameElement: O, addToGroup: A, removeFromGroup: j, groupElements: M } = useEditor(), [N, P] = useState({}), [z, B] = useState(!1), [H, U] = useState(null), [W, G] = useState(""), Z = _.elements.filter((n) => n.type === "group"), Aj = /* @__PURE__ */ new Map();
17817
+ let { state: _, selectElement: E, renameElement: O, addToGroup: A, removeFromGroup: j, groupElements: M } = useEditor(), [N, P] = useState({}), [z, B] = useState(!1), [H, U] = useState(null), [W, G] = useState(""), Z = _.elements.filter((n) => n.type === "group"), Lj = /* @__PURE__ */ new Map();
17804
17818
  Z.forEach((n) => {
17805
- Aj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
17819
+ Lj.set(n.id, _.elements.filter((_) => _.groupId === n.id));
17806
17820
  });
17807
- let jj = _.elements.filter((n) => n.type !== "group" && !n.groupId), Mj = (n) => {
17821
+ let Rj = _.elements.filter((n) => n.type !== "group" && !n.groupId), zj = (n) => {
17808
17822
  P((_) => ({
17809
17823
  ..._,
17810
17824
  [n]: !_[n]
17811
17825
  }));
17812
- }, Nj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
17826
+ }, Bj = (O, j = 0) => /* @__PURE__ */ jsx(p, {
17813
17827
  style: {
17814
17828
  borderRadius: 6,
17815
17829
  backgroundColor: _.selectedElementIds.includes(O.id) ? "var(--gray-5)" : "var(--gray-3)",
@@ -17874,9 +17888,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
17874
17888
  direction: "column",
17875
17889
  gap: "2",
17876
17890
  children: [
17877
- jj.map((n) => Nj(n, 0)),
17891
+ Rj.map((n) => Bj(n, 0)),
17878
17892
  Z.map((_) => {
17879
- let O = N[_.id] === !0, j = Aj.get(_.id) || [];
17893
+ let O = N[_.id] === !0, j = Lj.get(_.id) || [];
17880
17894
  return /* @__PURE__ */ jsxs(p, {
17881
17895
  style: {
17882
17896
  border: "1px dashed var(--gray-6)",
@@ -17893,7 +17907,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
17893
17907
  onClick: () => {
17894
17908
  E(_.id), n && n(_.id);
17895
17909
  },
17896
- onDoubleClick: () => Mj(_.id),
17910
+ onDoubleClick: () => zj(_.id),
17897
17911
  onDragOver: (n) => {
17898
17912
  n.preventDefault();
17899
17913
  },
@@ -17922,7 +17936,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
17922
17936
  direction: "column",
17923
17937
  gap: "2",
17924
17938
  style: { padding: "6px 8px" },
17925
- children: [j.map((n) => Nj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
17939
+ children: [j.map((n) => Bj(n, 1)), j.length === 0 && /* @__PURE__ */ jsx(p$2, {
17926
17940
  size: "1",
17927
17941
  color: "gray",
17928
17942
  children: "Solte elementos aqui para agrupar"
@@ -17982,7 +17996,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
17982
17996
  ]
17983
17997
  });
17984
17998
  }, EditorContent = ({ layout: n, initialState: E, onSave: O, theme: A = "light" }) => {
17985
- let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Aj, redo: jj, copy: Mj, paste: Nj, removeSelected: Fj, updateElements: Ij } = useEditor(), Lj = React.useRef(null), Rj = () => {
17999
+ let [j, M] = useState(!0), [N, P] = useState(!0), [z, B] = useState(null), [H, U] = useState(!1), { addElement: W, loadState: G, state: Z, undo: Lj, redo: Rj, copy: zj, paste: Bj, removeSelected: Hj, updateElements: Uj } = useEditor(), Wj = React.useRef(null), Gj = () => {
17986
18000
  let n = {
17987
18001
  elements: Z.elements,
17988
18002
  isList: Z.isList,
@@ -17993,9 +18007,9 @@ var LayersPanel = ({ onOpenSettings: n }) => {
17993
18007
  gridSize: Z.gridSize
17994
18008
  }, _ = JSON.stringify(n, null, 2), E = new Blob([_], { type: "application/json" }), O = URL.createObjectURL(E), A = document.createElement("a");
17995
18009
  A.href = O, A.download = `layout-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`, document.body.appendChild(A), A.click(), document.body.removeChild(A), URL.revokeObjectURL(O);
17996
- }, Vj = () => {
17997
- Lj.current?.click();
17998
- }, Hj = (n) => {
18010
+ }, Jj = () => {
18011
+ Wj.current?.click();
18012
+ }, Yj = (n) => {
17999
18013
  let _ = n.target.files?.[0];
18000
18014
  if (!_) return;
18001
18015
  let E = new FileReader();
@@ -18035,11 +18049,11 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18035
18049
  }, [W]), React.useEffect(() => {
18036
18050
  let n = (n) => {
18037
18051
  if (!(document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.isContentEditable)) {
18038
- if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), jj()) : (n.preventDefault(), Aj());
18039
- else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), jj();
18040
- else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), Mj();
18041
- else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Nj();
18042
- else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), Fj());
18052
+ if ((n.ctrlKey || n.metaKey) && n.key === "z") n.shiftKey ? (n.preventDefault(), Rj()) : (n.preventDefault(), Lj());
18053
+ else if ((n.ctrlKey || n.metaKey) && n.key === "y") n.preventDefault(), Rj();
18054
+ else if ((n.ctrlKey || n.metaKey) && n.key === "c") n.preventDefault(), zj();
18055
+ else if ((n.ctrlKey || n.metaKey) && n.key === "v") n.preventDefault(), Bj();
18056
+ else if (n.key === "Delete" || n.key === "Backspace") Z.selectedElementIds.length > 0 && (n.preventDefault(), Hj());
18043
18057
  else if ([
18044
18058
  "ArrowUp",
18045
18059
  "ArrowDown",
@@ -18057,20 +18071,20 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18057
18071
  changes: j
18058
18072
  });
18059
18073
  }
18060
- }), E.length > 0 && Ij(E);
18074
+ }), E.length > 0 && Uj(E);
18061
18075
  }
18062
18076
  }
18063
18077
  };
18064
18078
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
18065
18079
  }, [
18066
- Aj,
18067
- jj,
18068
- Mj,
18069
- Nj,
18070
- Fj,
18080
+ Lj,
18081
+ Rj,
18082
+ zj,
18083
+ Bj,
18084
+ Hj,
18071
18085
  Z.selectedElementIds,
18072
18086
  Z.elements,
18073
- Ij
18087
+ Uj
18074
18088
  ]), React.useEffect(() => {
18075
18089
  if (E) try {
18076
18090
  let n = typeof E == "string" ? JSON.parse(E) : E;
@@ -18079,7 +18093,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18079
18093
  console.error("Failed to load initial state", n);
18080
18094
  }
18081
18095
  }, [E, G]);
18082
- let Uj = (n) => {
18096
+ let Xj = (n) => {
18083
18097
  console.log(`Adding element of type: ${n}`), W({
18084
18098
  type: n,
18085
18099
  content: `New ${n}`
@@ -18140,19 +18154,19 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18140
18154
  style: { width: "240px" },
18141
18155
  children: [
18142
18156
  /* @__PURE__ */ jsx(v$3, {
18143
- onSelect: () => Uj("text"),
18157
+ onSelect: () => Xj("text"),
18144
18158
  children: "Texto"
18145
18159
  }),
18146
18160
  /* @__PURE__ */ jsx(v$3, {
18147
- onSelect: () => Uj("image"),
18161
+ onSelect: () => Xj("image"),
18148
18162
  children: "Imagem"
18149
18163
  }),
18150
18164
  /* @__PURE__ */ jsx(v$3, {
18151
- onSelect: () => Uj("box"),
18165
+ onSelect: () => Xj("box"),
18152
18166
  children: "Caixa (Container)"
18153
18167
  }),
18154
18168
  /* @__PURE__ */ jsx(v$3, {
18155
- onSelect: () => Uj("text-container"),
18169
+ onSelect: () => Xj("text-container"),
18156
18170
  children: "Container com Texto"
18157
18171
  })
18158
18172
  ]
@@ -18191,7 +18205,7 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18191
18205
  cursor: "pointer",
18192
18206
  justifyContent: "center"
18193
18207
  },
18194
- onClick: Rj,
18208
+ onClick: Gj,
18195
18209
  children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Exportar"]
18196
18210
  }), /* @__PURE__ */ jsxs(o, {
18197
18211
  variant: "soft",
@@ -18201,16 +18215,16 @@ var LayersPanel = ({ onOpenSettings: n }) => {
18201
18215
  cursor: "pointer",
18202
18216
  justifyContent: "center"
18203
18217
  },
18204
- onClick: Vj,
18218
+ onClick: Jj,
18205
18219
  children: [/* @__PURE__ */ jsx(UploadIcon, {}), " Importar"]
18206
18220
  })]
18207
18221
  }),
18208
18222
  /* @__PURE__ */ jsx("input", {
18209
18223
  type: "file",
18210
- ref: Lj,
18224
+ ref: Wj,
18211
18225
  style: { display: "none" },
18212
18226
  accept: ".json",
18213
- onChange: Hj
18227
+ onChange: Yj
18214
18228
  }),
18215
18229
  /* @__PURE__ */ jsx(p, {
18216
18230
  mt: "2",
@@ -18396,5 +18410,5 @@ const GenericEditor = (n) => /* @__PURE__ */ jsx(EditorProvider, {
18396
18410
  availableProps: n.layout.props,
18397
18411
  theme: n.theme,
18398
18412
  children: /* @__PURE__ */ jsx(EditorContent, { ...n })
18399
- }), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const measureTextHeight = (text, width, fontFamily, fontSize, lineHeightMultiplier = 1.2) => {\n if (!text) return 0;\n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return 0;\n context.font = `${fontSize}px ${fontFamily}`;\n const words = String(text).split(' ');\n let line = '';\n let lineCount = 1;\n for (let i = 0; i < words.length; i++) {\n const testLine = line + words[i] + ' ';\n const metrics = context.measureText(testLine);\n const testWidth = metrics.width;\n if (testWidth > width && i > 0) {\n line = words[i] + ' ';\n lineCount++;\n } else {\n line = testLine;\n }\n }\n const explicitLines = String(text).split('\\n').length - 1;\n lineCount += explicitLines;\n return Math.ceil(lineCount * fontSize * lineHeightMultiplier);\n } catch (_) {\n return 0;\n }\n };\n\n const computeLayout = (elements, itemData) => {\n const layoutElements = JSON.parse(JSON.stringify(elements));\n \n const isInside = (inner, outer) => {\n const eps = 0.1;\n return (\n inner.x >= outer.x - eps &&\n inner.x + inner.width <= outer.x + outer.width + eps &&\n inner.y >= outer.y - eps &&\n inner.y + inner.height <= outer.y + outer.height + eps\n );\n };\n\n const autoGrowElements = layoutElements\n .filter(el => (el.type === 'text' || el.type === 'text-container') && el.autoGrow)\n .sort((a, b) => a.y - b.y);\n\n autoGrowElements.forEach(textEl => {\n let content = textEl.content;\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n \n const fontSize = parseInt(String((textEl.style && textEl.style.fontSize) || 16));\n const fontFamily = String((textEl.style && textEl.style.fontFamily) || 'Arial');\n \n const isHorizontal = textEl.type === 'text-container' && textEl.containerExpansion === 'horizontal';\n \n if (isHorizontal) {\n // Horizontal expansion: Update width only\n // Requires canvas context which is available in measureTextHeight scope or we create new one\n // For simplicity, we can't easily access the measure logic here if it's not exposed, \n // but measureTextHeight is available in this scope.\n // However measureTextHeight calculates HEIGHT. We need WIDTH.\n \n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (context) {\n context.font = `${fontSize}px ${fontFamily}`;\n const metrics = context.measureText(content);\n const padding = parseInt(String((textEl.style && textEl.style.padding) || 0)) * 2;\n const newWidth = Math.ceil(metrics.width + padding);\n if (newWidth > textEl.width) {\n textEl.width = newWidth;\n }\n }\n } catch(e) {}\n } else {\n // Vertical Expansion\n const measuredHeight = measureTextHeight(content, textEl.width, fontFamily, fontSize);\n const designHeight = textEl.height;\n const delta = measuredHeight - designHeight;\n \n if (delta > 0) {\n const originalBottom = textEl.y + designHeight;\n const originalTextRect = {\n x: textEl.x,\n y: textEl.y,\n width: textEl.width,\n height: designHeight\n };\n \n textEl.height = measuredHeight;\n \n layoutElements.forEach(other => {\n if (other.id === textEl.id) return;\n \n if (isInside(originalTextRect, other)) {\n other.height += delta;\n }\n \n if (other.y >= originalBottom) {\n other.y += delta;\n }\n });\n }\n }\n });\n \n let maxY = 0;\n layoutElements.forEach(el => {\n const bottom = el.y + el.height;\n if (bottom > maxY) maxY = bottom;\n });\n \n return { layoutElements, maxY };\n };\n\n const computeItemHeight = (elements, itemData, fallbackHeight) => {\n const { maxY } = computeLayout(elements, itemData);\n return fallbackHeight ? Math.max(maxY, fallbackHeight) : maxY;\n };\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = [\n 'width', 'height', 'top', 'left', 'right', 'bottom', \n 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth',\n 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'\n ];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n let cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n if (typeof cssValue === 'string') {\n if (/^#([0-9a-fA-F]{8})$/.test(cssValue)) {\n cssValue = hex8ToRgba(cssValue);\n }\n }\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const getAnimationStyles = (anim) => {\n if (!anim || anim.type === 'none') return {};\n return {\n animationName: anim.type,\n animationDuration: (anim.duration || 1) + 's',\n animationDelay: (anim.delay || 0) + 's',\n animationIterationCount: anim.iterationCount || 1,\n animationTimingFunction: anim.timingFunction || 'ease',\n animationFillMode: 'both'\n };\n };\n\n const keyframesCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeIn { \n from { opacity: 0; } \n to { opacity: 1; } \n }\n @keyframes slideInLeft { \n from { opacity: 0; transform: translateX(-50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInRight { \n from { opacity: 0; transform: translateX(50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInUp { \n from { opacity: 0; transform: translateY(50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes slideInDown { \n from { opacity: 0; transform: translateY(-50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes zoomIn { \n from { opacity: 0; transform: scale(0.5); } \n to { opacity: 1; transform: scale(1); } \n }\n @keyframes bounceIn {\n 0% { opacity: 0; transform: scale(0.3); }\n 50% { opacity: 1; transform: scale(1.05); }\n 70% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n @keyframes pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }\n 20%, 40%, 60%, 80% { transform: translateX(5px); }\n }\n @keyframes spin { \n from { transform: rotate(0deg); } \n to { transform: rotate(360deg); } \n }\n \n /* Improved / Smoother Animations */\n @keyframes smoothSlideUp {\n 0% { opacity: 0; transform: translateY(30px); }\n 100% { opacity: 1; transform: translateY(0); }\n }\n @keyframes popIn {\n 0% { opacity: 0; transform: scale(0.8) translateY(10px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes blurIn {\n 0% { opacity: 0; filter: blur(10px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n const { layoutElements } = computeLayout(elements, itemData);\n return layoutElements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n // Resolve Style Bindings\n let bindingStyles = {};\n if (element.styleBindings) {\n Object.entries(element.styleBindings).forEach(([styleProp, variableName]) => {\n const val = itemData[variableName];\n if (val !== undefined && val !== null) {\n bindingStyles[styleProp] = String(val);\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: (element.type === 'text-container' && element.autoGrow && element.containerExpansion === 'horizontal') ? 'nowrap' : (element.autoGrow ? 'pre-wrap' : undefined),\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles,\n ...bindingStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text' || element.type === 'text-container') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate per-item height respecting autoGrow\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemHeight = computeItemHeight(elements, item, canvasHeight);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%'\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const measureTextHeight = ${measureTextHeight.toString()};\n const computeLayout = ${computeLayout.toString()};\n const computeItemHeight = ${computeItemHeight.toString()};\n const itemHeightFallback = ${canvasHeight || 0};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemHeight = computeItemHeight(elements, data, itemHeightFallback);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%'\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
18413
+ }), generateHTML = (n, _, E = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(n, _, E), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc', newestPosition: 'top'|'bottom', scrollDirection: 'up'|'down', containerHeight: number }, canvasHeight: number }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings, canvasHeight } = options;\n\n const measureTextHeight = (text, width, fontFamily, fontSize, lineHeightMultiplier = 1.2) => {\n if (!text) return 0;\n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return 0;\n context.font = `${fontSize}px ${fontFamily}`;\n const words = String(text).split(' ');\n let line = '';\n let lineCount = 1;\n for (let i = 0; i < words.length; i++) {\n const testLine = line + words[i] + ' ';\n const metrics = context.measureText(testLine);\n const testWidth = metrics.width;\n if (testWidth > width && i > 0) {\n line = words[i] + ' ';\n lineCount++;\n } else {\n line = testLine;\n }\n }\n const explicitLines = String(text).split('\\n').length - 1;\n lineCount += explicitLines;\n return Math.ceil(lineCount * fontSize * lineHeightMultiplier);\n } catch (_) {\n return 0;\n }\n };\n\n const computeLayout = (elements, itemData) => {\n const layoutElements = JSON.parse(JSON.stringify(elements));\n \n const isInside = (inner, outer) => {\n const eps = 0.1;\n return (\n inner.x >= outer.x - eps &&\n inner.x + inner.width <= outer.x + outer.width + eps &&\n inner.y >= outer.y - eps &&\n inner.y + inner.height <= outer.y + outer.height + eps\n );\n };\n\n const autoGrowElements = layoutElements\n .filter(el => (el.type === 'text' || el.type === 'text-container') && el.autoGrow)\n .sort((a, b) => a.y - b.y);\n\n autoGrowElements.forEach(textEl => {\n let content = textEl.content;\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n \n const fontSize = parseInt(String((textEl.style && textEl.style.fontSize) || 16));\n const fontFamily = String((textEl.style && textEl.style.fontFamily) || 'Arial');\n \n const isHorizontal = textEl.type === 'text-container' && textEl.containerExpansion === 'horizontal';\n \n if (isHorizontal) {\n // Horizontal expansion: Update width only\n // Requires canvas context which is available in measureTextHeight scope or we create new one\n // For simplicity, we can't easily access the measure logic here if it's not exposed, \n // but measureTextHeight is available in this scope.\n // However measureTextHeight calculates HEIGHT. We need WIDTH.\n \n try {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (context) {\n context.font = `${fontSize}px ${fontFamily}`;\n const metrics = context.measureText(content);\n const padding = parseInt(String((textEl.style && textEl.style.padding) || 0)) * 2;\n const newWidth = Math.ceil(metrics.width + padding);\n if (newWidth > textEl.width) {\n textEl.width = newWidth;\n }\n }\n } catch(e) {}\n } else {\n // Vertical Expansion\n const measuredHeight = measureTextHeight(content, textEl.width, fontFamily, fontSize);\n const designHeight = textEl.height;\n const delta = measuredHeight - designHeight;\n \n if (delta > 0) {\n const originalBottom = textEl.y + designHeight;\n const originalTextRect = {\n x: textEl.x,\n y: textEl.y,\n width: textEl.width,\n height: designHeight\n };\n \n textEl.height = measuredHeight;\n \n layoutElements.forEach(other => {\n if (other.id === textEl.id) return;\n \n if (isInside(originalTextRect, other)) {\n other.height += delta;\n }\n \n if (other.y >= originalBottom) {\n other.y += delta;\n }\n });\n }\n }\n });\n \n let maxY = 0;\n layoutElements.forEach(el => {\n const bottom = el.y + el.height;\n if (bottom > maxY) maxY = bottom;\n });\n \n return { layoutElements, maxY };\n };\n\n const computeItemHeight = (elements, itemData, fallbackHeight) => {\n const { maxY } = computeLayout(elements, itemData);\n return fallbackHeight ? Math.max(maxY, fallbackHeight) : maxY;\n };\n\n const formatValue = (value, formatting) => {\n if (!formatting || formatting.type === 'text') return value !== undefined && value !== null ? String(value) : '';\n if (value === undefined || value === null) return '';\n\n if (formatting.type === 'boolean') {\n const isTrue = String(value) === 'true' || value === true || (typeof value === 'number' && value > 0);\n return isTrue ? (formatting.trueLabel || 'Sim') : (formatting.falseLabel || 'Não');\n }\n\n if (formatting.type === 'date') {\n try {\n const date = new Date(value);\n if (isNaN(date.getTime())) return String(value);\n \n if (formatting.dateFormat) {\n const d = date.getDate().toString().padStart(2, '0');\n const m = (date.getMonth() + 1).toString().padStart(2, '0');\n const y = date.getFullYear();\n const H = date.getHours().toString().padStart(2, '0');\n const M = date.getMinutes().toString().padStart(2, '0');\n const S = date.getSeconds().toString().padStart(2, '0');\n \n return formatting.dateFormat\n .replace('DD', d)\n .replace('MM', m)\n .replace('YYYY', String(y))\n .replace('HH', H)\n .replace('mm', M)\n .replace('ss', S);\n }\n return date.toLocaleDateString();\n } catch (e) { return String(value); }\n }\n\n if (formatting.type === 'number') {\n const num = parseFloat(value);\n if (isNaN(num)) return String(value);\n \n if (formatting.numberFormat === 'currency') {\n return (formatting.currencySymbol || 'R$') + ' ' + num.toFixed(formatting.decimalPlaces || 2);\n }\n if (formatting.numberFormat === 'percent') {\n return num.toFixed(formatting.decimalPlaces || 0) + '%';\n }\n if (formatting.decimalPlaces !== undefined) {\n return num.toFixed(formatting.decimalPlaces);\n }\n return num.toFixed(formatting.decimalPlaces || 0);\n }\n \n return String(value);\n };\n\n const checkCondition = (propValue, operator, ruleValue) => {\n const val = String(propValue).toLowerCase();\n const target = String(ruleValue).toLowerCase();\n \n switch (operator) {\n case 'equals': return val === target;\n case 'notEquals': return val !== target;\n case 'contains': return val.includes(target);\n case 'greaterThan': return parseFloat(val) > parseFloat(target);\n case 'lessThan': return parseFloat(val) < parseFloat(target);\n case 'truthy': return !!propValue;\n case 'falsy': return !propValue;\n default: return false;\n }\n };\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const hex8ToRgba = (hex) => {\n const m = /^#([0-9a-fA-F]{8})$/.exec(hex);\n if (!m) return hex;\n const h = m[1];\n const r = parseInt(h.slice(0, 2), 16);\n const g = parseInt(h.slice(2, 4), 16);\n const b = parseInt(h.slice(4, 6), 16);\n const a = parseInt(h.slice(6, 8), 16) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = [\n 'width', 'height', 'top', 'left', 'right', 'bottom', \n 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth',\n 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'\n ];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n let cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n if (typeof cssValue === 'string') {\n if (/^#([0-9a-fA-F]{8})$/.test(cssValue)) {\n cssValue = hex8ToRgba(cssValue);\n }\n }\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const getAnimationStyles = (anim) => {\n if (!anim || anim.type === 'none') return {};\n return {\n animationName: anim.type,\n animationDuration: (anim.duration || 1) + 's',\n animationDelay: (anim.delay || 0) + 's',\n animationIterationCount: anim.iterationCount || 1,\n animationTimingFunction: anim.timingFunction || 'ease',\n animationFillMode: 'both'\n };\n };\n\n const keyframesCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fadeIn { \n from { opacity: 0; } \n to { opacity: 1; } \n }\n @keyframes slideInLeft { \n from { opacity: 0; transform: translateX(-50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInRight { \n from { opacity: 0; transform: translateX(50px); } \n to { opacity: 1; transform: translateX(0); } \n }\n @keyframes slideInUp { \n from { opacity: 0; transform: translateY(50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes slideInDown { \n from { opacity: 0; transform: translateY(-50px); } \n to { opacity: 1; transform: translateY(0); } \n }\n @keyframes zoomIn { \n from { opacity: 0; transform: scale(0.5); } \n to { opacity: 1; transform: scale(1); } \n }\n @keyframes bounceIn {\n 0% { opacity: 0; transform: scale(0.3); }\n 50% { opacity: 1; transform: scale(1.05); }\n 70% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n @keyframes pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); }\n }\n @keyframes shake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }\n 20%, 40%, 60%, 80% { transform: translateX(5px); }\n }\n @keyframes spin { \n from { transform: rotate(0deg); } \n to { transform: rotate(360deg); } \n }\n \n /* Improved / Smoother Animations */\n @keyframes smoothSlideUp {\n 0% { opacity: 0; transform: translateY(30px); }\n 100% { opacity: 1; transform: translateY(0); }\n }\n @keyframes popIn {\n 0% { opacity: 0; transform: scale(0.8) translateY(10px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes blurIn {\n 0% { opacity: 0; filter: blur(10px); }\n 100% { opacity: 1; filter: blur(0); }\n }\n `;\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n const { layoutElements } = computeLayout(elements, itemData);\n return layoutElements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n // Resolve Content & Formatting\n if (element.type === 'text' || element.type === 'text-container') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n if (val === undefined || val === null) return match;\n if (element.formatting) {\n return formatValue(val, element.formatting);\n }\n return String(val);\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n // Resolve Conditional Styles\n let conditionalStyles = {};\n if (element.conditions) {\n element.conditions.forEach(rule => {\n const propVal = itemData[rule.property];\n if (checkCondition(propVal, rule.operator, rule.value)) {\n conditionalStyles = { ...conditionalStyles, ...rule.style };\n }\n });\n }\n\n // Resolve Style Bindings\n let bindingStyles = {};\n if (element.styleBindings) {\n Object.entries(element.styleBindings).forEach(([styleProp, variableName]) => {\n const val = itemData[variableName];\n if (val !== undefined && val !== null) {\n bindingStyles[styleProp] = String(val);\n }\n });\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.autoGrow ? 'auto' : element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: element.autoGrow ? 'visible' : 'hidden',\n whiteSpace: (element.type === 'text-container' && element.autoGrow && element.containerExpansion === 'horizontal') ? 'nowrap' : (element.autoGrow ? 'pre-wrap' : undefined),\n wordBreak: element.autoGrow ? 'break-word' : undefined,\n ...element.style,\n ...conditionalStyles,\n ...bindingStyles\n };\n \n // Fix: remove padding if it's not explicitly set, or handle it for text\n if (element.type === 'text' && !baseStyle.padding) {\n // baseStyle.padding = '8px'; // Removed default padding to respect resize box\n }\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text' || element.type === 'text-container') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate per-item height respecting autoGrow\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n \n // Handle newest position\n if (listSettings && listSettings.newestPosition === 'top') {\n listData.reverse();\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n const itemHtml = renderItem(item, index, 0); \n const itemHeight = computeItemHeight(elements, item, canvasHeight);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%'\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles based on settings\n const scrollDirection = (listSettings && listSettings.scrollDirection) || 'down';\n const containerHeight = (listSettings && listSettings.containerHeight) ? listSettings.containerHeight + 'px' : '100%';\n \n const justify = (listSettings && listSettings.newestPosition === 'top') ? 'flex-start' : 'flex-end';\n\n // Entry Animation from settings\n const entryAnim = listSettings && listSettings.entryAnimation ? listSettings.entryAnimation : { type: 'slideIn', duration: 0.3, timingFunction: 'ease-out' };\n const entryAnimName = entryAnim.type === 'none' ? 'none' : entryAnim.type;\n const entryAnimDuration = entryAnim.duration + 's';\n const entryAnimTiming = entryAnim.timingFunction || 'ease-out';\n\n const animationCss = `\n ${keyframesCss}\n\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: ${justify};\n height: ${containerHeight};\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n padding: 10px;\n }\n .list-item {\n flex-shrink: 0;\n animation: ${entryAnimName} ${entryAnimDuration} ${entryAnimTiming};\n margin-bottom: 10px;\n width: 100%;\n position: relative;\n }\n `;\n \n const scrollScript = scrollDirection === 'up' \n ? `<script>\n document.addEventListener('DOMContentLoaded', () => {\n const wrapper = document.querySelector('.list-wrapper');\n if(wrapper) wrapper.scrollTop = wrapper.scrollHeight;\n });\n <\/script>`\n : '';\n\n // Inject Smart Script for Dynamic Updates\n const injectionScript = `\n <script>\n (function() {\n try {\n const elements = ${JSON.stringify(elements)};\n const formatValue = ${formatValue.toString()};\n const checkCondition = ${checkCondition.toString()};\n const camelToKebab = ${camelToKebab.toString()};\n const hex8ToRgba = ${hex8ToRgba.toString()};\n const styleObjectToString = ${styleObjectToString.toString()};\n const getAnimationStyles = ${getAnimationStyles.toString()};\n const renderItem = ${renderItem.toString()};\n\n const measureTextHeight = ${measureTextHeight.toString()};\n const computeLayout = ${computeLayout.toString()};\n const computeItemHeight = ${computeItemHeight.toString()};\n const itemHeightFallback = ${canvasHeight || 0};\n const newestPosition = \"${(listSettings && listSettings.newestPosition) || 'bottom'}\";\n const scrollDirection = \"${(listSettings && listSettings.scrollDirection) || 'down'}\";\n\n window.addItem = function(data) {\n const wrapper = document.querySelector('.list-wrapper');\n if (!wrapper) return;\n\n const itemHtml = renderItem(data, 0, 0);\n const itemHeight = computeItemHeight(elements, data, itemHeightFallback);\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%'\n });\n\n const div = document.createElement('div');\n div.className = 'list-item';\n div.setAttribute('style', itemContainerStyle);\n div.innerHTML = itemHtml;\n\n if (newestPosition === 'top') {\n wrapper.insertBefore(div, wrapper.firstChild);\n } else {\n wrapper.appendChild(div);\n }\n \n if (scrollDirection === 'up') {\n wrapper.scrollTop = wrapper.scrollHeight;\n }\n };\n } catch(e) { console.error(\"Smart List Init Error\", e); }\n })();\n <\/script>\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n ${scrollScript}\n ${injectionScript}\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
18400
18414
  export { GenericEditor as EditorContent, generateHTML };