"use client";
const require_get_size = require("../../core/utils/get-size/get-size.cjs");
const require_create_vars_resolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
const require_use_props = require("../../core/MantineProvider/use-props/use-props.cjs");
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
const require_polymorphic_factory = require("../../core/factory/polymorphic-factory.cjs");
const require_Paper = require("../Paper/Paper.cjs");
const require_Card_context = require("./Card.context.cjs");
const require_Card_module = require("./Card.module.cjs");
const require_CardSection = require("./CardSection/CardSection.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/Card/Card.tsx
const varsResolver = require_create_vars_resolver.createVarsResolver((_, { padding }) => ({ root: { "--card-padding": require_get_size.getSpacing(padding) } }));
const defaultProps = { orientation: "vertical" };
const Card = require_polymorphic_factory.polymorphicFactory((_props) => {
	const props = require_use_props.useProps("Card", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, children, padding, attributes, orientation, ...others } = props;
	const getStyles = require_use_styles.useStyles({
		name: "Card",
		props,
		classes: require_Card_module.default,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	const _children = react.Children.toArray(children);
	const content = _children.map((child, index) => {
		if (typeof child === "object" && child && "type" in child && (child.type === require_CardSection.CardSection || child.type?.displayName === "@mantine/core/CardSection")) return (0, react.cloneElement)(child, {
			"data-orientation": orientation,
			"data-first-section": index === 0 || void 0,
			"data-last-section": index === _children.length - 1 || void 0
		});
		return child;
	});
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Card_context.CardProvider, {
		value: { getStyles },
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Paper.Paper, {
			unstyled,
			"data-orientation": orientation,
			...getStyles("root"),
			...others,
			children: content
		})
	});
});
Card.classes = require_Card_module.default;
Card.varsResolver = varsResolver;
Card.displayName = "@mantine/core/Card";
Card.Section = require_CardSection.CardSection;
//#endregion
exports.Card = Card;

//# sourceMappingURL=Card.cjs.map