import { P as e, p as t } from "./use-page-data.Cb2SuuwJ.js";
import { k as n } from "./chunk-LSPN22SI.D75E3zS-.js";
import { b as r, c as i } from "./twind.BiM9xcCd.js";
import { b as a, c as o } from "./schema-resolver.p7B_pu36.js";
import { c as s } from "./attributes.OPcn2TpI.js";
import { d as c, e as l, f as u, g as d, h as f } from "./use-brick-style.DDPl-_C1.js";
import { get as p, merge as m } from "lodash-es";
function h({ attributes: e, editable: t, typography: n, showIntro: r }) {
	let a = f(s), o = g(a);
	return i("flex flex-col group/page mx-auto relative max-w-full w-full p-0 antialiased", t && "overflow-hidden min-h-[100cqh]", e.colorPreset.color, Object.values(o), _(n), t && r && "[&>.brick-wrapper]:(opacity-0 animate-elastic-pop)");
}
function g(e) {
	let n = t(), r = Object.entries(e).reduce((e, [t, r]) => {
		let a = d[r];
		if (!a) return e;
		let c = u(t);
		e[c] = e[c] ?? [];
		let l = o(n, t), f = o(s.properties, t);
		return e[c].push(i(a?.(l, void 0, f))), e;
	}, {});
	return r;
}
function _(e) {
	function t(e) {
		return e.type === "stack" ? `var(--font-${e.family})` : `"${e.family}"`;
	}
	return r({
		fontFamily: t(e.body),
		fontSize: `${e.base}px`,
		"& h1, & h2, & h3, & h4, & h5, & h6, & h7": { fontFamily: t(e.heading) }
	});
}
function v({ section: t, selected: n, editable: a, previewMode: o, isDropTarget: s }) {
	let c = f(e), l = x(c, t);
	return i("flex flex-wrap w-full @container/section group/section overflow-visible relative mx-auto max-sm:max-w-dvw", [
		Object.values(l),
		t.props.maxWidth,
		typeof t.props.minHeight == "string" && t.props.minHeight !== "full" && `min-h-[${t.props.minHeight}]`,
		t.props.minHeight === "full" && (a ? "min-h-[calc(100dvh-60px)]" : "min-h-dvh"),
		r({ "&:has([data-no-section-padding])": {
			paddingInline: "0px !important",
			paddingBlock: "0px !important"
		} }),
		y({
			editable: a,
			previewMode: o,
			section: t,
			selected: n,
			isDropTarget: s
		}),
		r({ order: t.order })
	]);
}
function y({ editable: e, selected: t, previewMode: n, isDropTarget: i }) {
	return e ? [
		"select-none relative outline-dashed outline-2 -outline-offset-2",
		!i && !t && "outline-transparent",
		t || i ? "outline-upstart-500/40" : "hover:outline-upstart-500/40",
		n && r`
      &:has(.moving), &:has(.moving) ~ section {
        & [data-floating-ui-portal] {
          display: none;
        }
        & .resizable-handle {
          display: none;
        }
      }`
	] : null;
}
const b = n(e);
function x(n, r) {
	let { props: o, mobileProps: s } = r, d = t(), f = m({}, b, o), h = Object.entries(n).reduce((t, [n, r]) => {
		let i = p(e.properties, n);
		if (i) {
			let e = a(i);
			if (e.metadata?.filter) {
				let r = e.metadata.filter;
				r(e, f, d) || t.push(n);
			}
		}
		return t;
	}, []), g = Object.entries(n).reduce((t, [n, r]) => {
		let a = c[r] ?? l[r];
		if (!a) return console.warn("No helper found for styleId", r), t;
		if (h.includes(n)) return console.warn("Filtered out section path", n), t;
		let o = u(n);
		t[o] = t[o] ?? [];
		let d = p(f, n), m = p(s, n), g = p(e.properties, n);
		return t[o].push(i(a?.(d, m, g))), t;
	}, {});
	return g;
}
export { v as b, h as c };

//# sourceMappingURL=use-section-style.BqwjknSM.js.map