import{makeStyleResponsive as s,template as e,WrapRenderChildren as i,RenderChildren as t,RenderIf as r,isLocalEnv as o,baseAssetURL as c}from"@gem-sdk/core";import{getDynamicSourceLocales as d,getSettingPreloadData as a}from"../../helpers.js";import{createStateOrContext as l,createClass as p,createStyle as m,createAttr as n}from"@gem-sdk/system";import{getDataState as f}from"../common/helpers.js";import{getContainerStyles as g}from"../common/styles.js";import{getContainerClasses as $,extendClasses as u}from"../common/classes.js";let Accordion=({rawChildren:y,setting:v,styles:S,builderProps:j,pageContext:h,advanced:A,style:k,builderAttrs:E})=>{let{align:I}=S??{},{translate:x,childItem:C,activeKey:P}=v??{},{uidState:_,settingState:z,stylesState:G,accordions:N}=f({setting:v,styles:S,builderProps:j},y),O=l({uid:_,setting:z,styles:{...G}}),T=p($(A?.cssClass)),J=m({...g(k,S)}),K=n({...E,"data-id":j?.uid??""}),M=m({...s("jc",I)}),R=p({"gp-flex":!0}),U=p(u()),V=()=>i({uid:j?.uid??"",customProps:y?.[0].customProps},y?.map((s,i)=>{if(s){let r=d({val:C?.[i],uid:j?.uid,settingId:`childItem_${i}`,pageContext:h,isCapitalize:v?.titleTypo?.attrs?.transform==="capitalize",translate:x});return e`
          <div class="${R}" style="${M}">
            ${t({...s,index:i,title:r,accordions:N,parentSetting:v,parentStyle:S,parentUid:j?.uid,childrenIcon:v?.childConfig?.[i],activeKey:P})}
          </div>
            `}})),b=()=>r(o,`
    <script ${a('class="gps-link" delay',"src")}="{{ 'gp-accordion-v7-5.js' | asset_url }}"
      defer="defer"></script>`,`
    <script ${a('class="gps-link" delay',"src")}="${c}/assets-v2/gp-accordion-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>
    `);return e`
    <gp-accordion ${K} class="${T}" style="${J}"
      gp-data='${JSON.stringify(O).replaceAll("'","&#039;")}'
        >
        <div class=" ${U}"></div>
      ${V()}
    </gp-accordion>
    ${b()}
  `};export{Accordion as default};
