"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../tslib.es6-C4EgNkz1.js"),D=require("classnames"),o=require("react"),g=require("../ebay-details-BEt1xrPn.js"),_=require("../utils-C9NL3q0j.js"),N=t=>{var{size:b,autoCollapse:E,className:f,children:p,onToggle:i,"aria-roledescription":m="accordion"}=t,v=A.__rest(t,["size","autoCollapse","className","children","onToggle","aria-roledescription"]);const c=o.useRef(null),n=_.filterByType(p,g.EbayDetails);if(!n.length)throw new Error(`EbayAccordion: Please use a
        EbayDetails that defines the sections of the accordion`);const h=n.map((e,d)=>o.cloneElement(e,{onToggle:(u,{open:l})=>{var r,y,a;if(E&&l){const s=(r=c.current)===null||r===void 0?void 0:r.querySelectorAll("details");s?.forEach((q,T)=>{T!==d&&(q.open=!1)})}(a=(y=e.props).onToggle)===null||a===void 0||a.call(y,u,{open:l}),i?.(u,{open:l,index:d})}}));return o.createElement("ul",Object.assign({},v,{ref:c,className:D("accordion",f,{"accordion--large":b==="large"}),"aria-roledescription":m}),h.map(e=>o.createElement("li",{key:e.key},e)))};exports.EbayDetails=g.EbayDetails;exports.EbayAccordion=N;
