"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../_virtual/jsx-runtime.js"),s=require("react"),a=require("./styles.js"),x=require("../../utils/index.js");function u(e){const{isCollapsed:d=!0}=e,[n,r]=s.useState(d),i=x.getId(e["data-testid"]);function c(l){l.preventDefault();const o=!n;r(o),e.variant!=="custom"&&e.onToggle&&e.onToggle(o)}switch(s.useEffect(()=>{r(!!d)},[d]),e.variant){case"default":case"low-emphasis":return t.jsxRuntimeExports.jsxs(a.AccordionWrapper,{hasDivider:e.divider,"data-testid":e["data-testid"],"data-trackid":e["data-trackid"],children:[t.jsxRuntimeExports.jsxs(a.AccordionHeader,{type:"button",id:"accordion-button",disabled:e.disableCollapse,isCollapsed:n,onClick:c,"data-testid":i("header"),"aria-controls":"accordion-content","aria-expanded":!n,children:[t.jsxRuntimeExports.jsxs(a.AccordionHeaderPrimaryRow,{children:[t.jsxRuntimeExports.jsxs(a.AccordionHeaderTitle,{variant:e.variant,"data-testid":i("title-wrapper"),children:[e.icon&&t.jsxRuntimeExports.jsx("span",{"data-testid":i("title-icon"),children:e.icon}),t.jsxRuntimeExports.jsx("span",{"data-testid":i("title-text"),children:e.primaryText})]}),!e.hideChevron&&t.jsxRuntimeExports.jsx(a.AccordionChevron,{"data-testid":i("header-chevron")})]}),e.secondaryText&&t.jsxRuntimeExports.jsx(a.AccordionHeaderSecondaryRow,{"data-testid":i("secondary-row"),children:e.secondaryText})]}),t.jsxRuntimeExports.jsx(a.AccordionContent,{id:"accordion-content",role:"region","aria-labelledby":"accordion-button",isCollapsed:n,"data-testid":i("content"),"aria-hidden":n,children:e.children})]});case"custom":return t.jsxRuntimeExports.jsxs(a.AccordionWrapper,{"data-testid":e["data-testid"],children:[e.header,t.jsxRuntimeExports.jsx(a.CollapsableContainer,{isCollapsed:n,"data-testid":i("content"),"aria-hidden":n,children:e.content})]});default:throw new Error("Incorrect variant")}}exports.Accordion=u;
