import { d as u } from "../../../../sdk/dist/shared/chunk-NLEWXPVM.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-AQPN5SE2.js";
import "../../../../sdk/dist/shared/chunk-DQXDGV67.js";
import "../../../../sdk/dist/shared/chunk-7DMUDZ4H.js";
import "../../../../sdk/dist/shared/chunk-LSPN22SI.js";
import "../../../../sdk/dist/shared/chunk-ETYYRWLK.js";
import "../../../../sdk/dist/shared/chunk-4TH3C76A.js";
import "../../../../sdk/dist/shared/chunk-FKNNTHWX.js";
import "../../../../sdk/dist/shared/chunk-JS4K5JRM.js";
import "../../../../sdk/dist/shared/chunk-WU6Q4WYD.js";
import "../../../../sdk/dist/shared/chunk-QISTDGPP.js";
import "../../../../sdk/dist/shared/chunk-LFQZRGHS.js";
import "../../../../sdk/dist/shared/chunk-SLRU4CT6.js";
import "../../../../sdk/dist/shared/chunk-TTTXV7TJ.js";
import "../../../../sdk/dist/shared/chunk-UHF6IEKV.js";
import "../../../../sdk/dist/shared/chunk-LGP6GWIY.js";
import "../../../../sdk/dist/shared/chunk-X43MB5WD.js";
import "../../../../sdk/dist/shared/chunk-NNI225RG.js";
import "../../../../sdk/dist/shared/chunk-ZQGNYK5I.js";
import "../../../../sdk/dist/shared/chunk-KHFNN4P3.js";
import "../../../../sdk/dist/shared/chunk-BZGNY7LB.js";
import "../../../../sdk/dist/shared/chunk-IIFTGWFZ.js";
import { merge as b, get as a } from "lodash-es";
import "../../../../sdk/dist/shared/chunk-UU2MSQXY.js";
import "../../../../sdk/dist/shared/chunk-T3LIA4YB.js";
import "../../../../sdk/dist/shared/chunk-YBGPPF7T.js";
import "../../../../sdk/dist/shared/chunk-UMHXXXVP.js";
import "../../../../sdk/dist/shared/chunk-5N6MBJJ4.js";
import { b as S } from "../../../../sdk/dist/shared/chunk-I46VBMLF.js";
import { extractStylePath as P, brickStylesHelpersMap as y, brickWrapperStylesHelpersMap as w } from "../styles/helpers.js";
import { tx as g, css as h } from "../../../../style-system/dist/twind.js";
import { getStyleProperties as H } from "../styles/style-props.js";
import { resolveSchema as F } from "../../../../sdk/dist/shared/utils/schema-resolver.js";
import { usePageAttributes as j } from "../../../../../use-page-data.js";
function ft({
  section: t,
  selected: i,
  editable: s,
  previewMode: p,
  isDropTarget: f
}) {
  const m = H(u), c = k(m, t);
  return g(
    // @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(c),
      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"),
      h({
        "&: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
      h({
        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 && h`
      &: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 = b({}, O, s), c = Object.entries(t).reduce((r, [o, l]) => {
    const n = a(u.properties, o);
    if (n) {
      const e = F(n);
      if (e.metadata?.filter) {
        const d = e.metadata.filter;
        d(e, m, f) || r.push(o);
      }
    }
    return r;
  }, []);
  return Object.entries(t).reduce(
    (r, [o, l]) => {
      const n = y[l] ?? w[l];
      if (!n)
        return console.warn("No helper found for styleId", l), r;
      if (c.includes(o))
        return console.warn("Filtered out section path", o), r;
      const e = P(o);
      r[e] = r[e] ?? [];
      const d = a(m, o), v = a(p, o), x = a(u.properties, o);
      return r[e].push(
        // @ts-expect-error
        g(n?.(d, v, x))
      ), r;
    },
    {}
  );
}
export {
  ft as useSectionStyle
};
//# sourceMappingURL=use-section-style.js.map
