"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const index = require("../../icons/index.cjs");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
const useUncontrolled = require("../../node_modules/.pnpm/@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.cjs");
const Card = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Card/Card.cjs");
const Group = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Group/Group.cjs");
const Collapse = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Collapse/Collapse.cjs");
const Box = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
const CollapsibleCard = ({
  children,
  title,
  opened,
  defaultOpened = false,
  headerProps,
  contentProps,
  onToggle,
  onTransitionEnd
}) => {
  const [finalOpened, setOpened] = useUncontrolled.useUncontrolled({
    value: opened,
    defaultValue: defaultOpened,
    finalValue: false,
    onChange: onToggle
  });
  const handleToggle = () => {
    setOpened(!finalOpened);
  };
  return /* @__PURE__ */ jsxRuntime.jsxs(Card.Card, { children: [
    /* @__PURE__ */ jsxRuntime.jsx(Card.Card.Section, { children: /* @__PURE__ */ jsxRuntime.jsxs(
      Group.Group,
      {
        onClick: handleToggle,
        align: "center",
        sx: {
          cursor: "pointer",
          userSelect: "none",
          borderBottom: finalOpened ? "1px solid var(--mantine-color-carbon-3)" : void 0
        },
        p: 16,
        bg: "carbon.2",
        ...headerProps,
        children: [
          /* @__PURE__ */ jsxRuntime.jsx(
            index.IconChevronRight,
            {
              size: 18,
              sx: {
                transform: finalOpened ? "rotate(90deg)" : "rotate(0deg)",
                transition: "transform 200ms ease"
              }
            }
          ),
          title
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntime.jsx(Card.Card.Section, { children: /* @__PURE__ */ jsxRuntime.jsx(Collapse.Collapse, { in: finalOpened, onTransitionEnd: onTransitionEnd ? () => onTransitionEnd(finalOpened) : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { p: 16, ...contentProps, children }) }) })
  ] });
};
exports.CollapsibleCard = CollapsibleCard;
