'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-BhM0B89p.js');
var primitives_Accordion = require('./primitives/Accordion.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

const AccordionItemComponent = React.forwardRef(
  ({ title, children, className, value, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
    primitives_Accordion.AccordionItem,
    {
      ref,
      value,
      className: utils.cn(className),
      ...otherProps,
      children: [
        /* @__PURE__ */ jsxRuntime.jsx(primitives_Accordion.AccordionTrigger, { children: title }),
        /* @__PURE__ */ jsxRuntime.jsx(primitives_Accordion.AccordionContent, { children })
      ]
    }
  )
);
AccordionItemComponent.displayName = "Accordion.Item";
const Accordion = React.forwardRef(
  ({ className, children, type = "single", ...otherProps }, ref) => {
    const enhancedChildren = React.Children.map(children, (child, index) => {
      if (!React__default.default.isValidElement(child)) return child;
      const childValue = child.props.value ?? `item-${index}`;
      return React__default.default.cloneElement(child, { value: childValue });
    });
    return /* @__PURE__ */ jsxRuntime.jsx(
      primitives_Accordion.Accordion,
      {
        ref,
        type,
        className: utils.cn(className),
        ...otherProps,
        children: enhancedChildren
      }
    );
  }
);
Accordion.displayName = "Accordion";
Accordion.Item = AccordionItemComponent;

exports.Accordion = Accordion;
//# sourceMappingURL=Accordion-D75SDnkY.js.map
