import { e as u } from "../../../../sdk/dist/shared/chunk-GOMXZC4B.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-PSCN3VVA.js";
import "../../../../sdk/dist/shared/chunk-R6ATC4TC.js";
import "../../../../sdk/dist/shared/chunk-CFF6Q7O7.js";
import "../../../../sdk/dist/shared/chunk-IKC3FK7L.js";
import "../../../../sdk/dist/shared/chunk-E6XEI7IK.js";
import "../../../../sdk/dist/shared/chunk-SQ5T4AT5.js";
import "../../../../sdk/dist/shared/chunk-G5CJU6RD.js";
import "../../../../sdk/dist/shared/chunk-PSTFJ5IJ.js";
import "../../../../sdk/dist/shared/chunk-NJGXC7D6.js";
import "../../../../sdk/dist/shared/chunk-SXHDQ64Z.js";
import "../../../../sdk/dist/shared/chunk-QX6OGRRT.js";
import "../../../../sdk/dist/shared/chunk-FLOMNC6J.js";
import "../../../../sdk/dist/shared/chunk-PLSV746R.js";
import "../../../../sdk/dist/shared/chunk-WBZW5LVH.js";
import "../../../../sdk/dist/shared/chunk-WYVJE6J5.js";
import "../../../../sdk/dist/shared/chunk-I3VL6SRH.js";
import "../../../../sdk/dist/shared/chunk-B3EATRFX.js";
import "../../../../sdk/dist/shared/chunk-IKHZD2JH.js";
import "../../../../sdk/dist/shared/chunk-PXI7AHWS.js";
import { merge as x, get as a } from "lodash-es";
import "../../../../sdk/dist/shared/chunk-SY6DZLTC.js";
import "../../../../sdk/dist/shared/chunk-7A2JNQX3.js";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import { b as S, d as P } from "../../../../sdk/dist/shared/chunk-QGYZ7CG5.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import { extractStylePath as w, brickStylesHelpersMap as y, brickWrapperStylesHelpersMap as H } from "../styles/helpers.js";
import { tx as h, css as g } from "../../../../style-system/dist/twind.js";
import { getStyleProperties as F } from "../styles/style-props.js";
import { usePageAttributes as j } from "../../../../../use-page-data.js";
function at({
  section: t,
  selected: i,
  editable: s,
  previewMode: p,
  isDropTarget: f
}) {
  const m = F(u), d = k(m, t);
  return h(
    // @mobile:flex-col @desktop:flex-row
    "flex flex-wrap w-full @container/section group/section overflow-visible relative mx-auto max-sm:max-w-dvw",
    [
      Object.values(d),
      t.props.maxWidth,
      typeof t.props.minHeight == "string" && t.props.minHeight !== "full" && `min-h-[${t.props.minHeight}]`,
      // full height
      t.props.minHeight === "full" && (s ? "min-h-[calc(100dvh-60px)]" : "min-h-dvh"),
      g({
        "&:has([data-no-section-padding])": {
          // This is a hack to ensure that the navbar is not affected by the section's padding
          paddingInline: "0px !important",
          paddingBlock: "0px !important"
        }
      }),
      // Section editor styles
      M({ editable: s, previewMode: p, selected: i, isDropTarget: f }),
      // Manage the section order using css "order" (flex) property
      g({
        order: t.order
      })
    ]
  );
}
function M({ editable: t, selected: i, previewMode: s, isDropTarget: p }) {
  return t ? [
    "select-none relative outline-dashed outline-2 -outline-offset-2",
    !p && !i && "outline-transparent",
    i || p ? "outline-upstart-500/40" : "hover:outline-upstart-500/40",
    // this is the grid overlay shown when dragging
    s && g`
      &:has(.moving), &:has(.moving) ~ section {
        & [data-floating-ui-portal] {
          display: none;
        }
        & .resizable-handle {
          display: none;
        }
      }`
  ] : null;
}
const O = S(u);
function k(t, i) {
  const { props: s, mobileProps: p } = i, f = j(), m = x({}, O, s), d = Object.entries(t).reduce((r, [e, l]) => {
    const n = a(u.properties, e);
    if (n) {
      const o = P(n);
      if (o.metadata?.filter) {
        const c = o.metadata.filter;
        c(o, m, f) || r.push(e);
      }
    }
    return r;
  }, []);
  return Object.entries(t).reduce(
    (r, [e, l]) => {
      const n = y[l] ?? H[l];
      if (!n)
        return console.warn("No helper found for styleId", l), r;
      if (d.includes(e))
        return console.warn("Filtered out section path", e), r;
      const o = w(e);
      r[o] = r[o] ?? [];
      const c = a(m, e), v = a(p, e), b = a(u.properties, e);
      return r[o].push(
        // @ts-expect-error
        h(n?.(c, v, b))
      ), r;
    },
    {}
  );
}
export {
  at as useSectionStyle
};
//# sourceMappingURL=use-section-style.js.map
