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