"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../helpers.js"),s=require("@gem-sdk/system"),a=require("../common/attrs.js"),l=require("../../text/components/Text.liquid.js"),i=require("../settings/configs/translate.js"),r=require("../common/styles.js"),c=require("../common/classes.js");exports.default=d=>{let{builderProps:n,style:p,setting:o,advanced:g,rawChildren:u}=d;delete o?.labelTypoV2?.attrs?.color;let{cssClass:y}=g??{},{panelWidth:C,childItem:m,labelAlign:v,labelTypo:$,labelTypoV2:S}=o??{},b=s.createStateOrContext({setting:o,builderProps:n}),h=void 0;o&&!o?.labelWidth&&(o.labelWidth={desktop:"200px"});let x=s.createAttr({...a.getAttr({uid:n?.uid||""})}),T=s.createStyle({...r.getStyleWrapper({setting:o,style:p,uid:n?.uid,pageContext:d.pageContext??{},type:"Liquid"})}),f=s.createClass({...c.getClassesWrapper({builderProps:n,advancedCssClass:y})}),q=s.createClass({...c.getContainClasses({setting:o})}),A=c.getStyleTagClasses({panelWidth:C,builderProps:n}),j=s.createClass({...c.getTabParentListClasses()}),I=s.createStyle({...r.getTabParentListStyle(o)}),L=s.createClass({...c.getTabListClasses({setting:o})}),P=s.createStyle({...r.getTabListStyle(o)}),k=e=>s.createClass({...c.getItemClasses({setting:o,isNotLiquid:!1,isActive:e,currentDevice:h})}),K=e=>s.createStyle({...r.getItemStyle(o,e)}),W=s.createClass({...c.getWrapperContentClasses()}),E=s.createClass({...c.getContainContentClasses()}),R=s.createStyle({...r.getContainContentStyle()}),N=s.createAttr({...a.getAttrContent({uid:n?.uid||""})}),O=s.createClass({...c.getTextClasses()});return e.template`
    <gp-tab
      ${{...x}}
      style="${T}"
      class="${f}"
      gp-data='${JSON.stringify(b)?.replaceAll("'","&#039;")}'>
        <style>${A}</style>
        <div class="${q}">
          <div class="${j}" style="${I}">
            <ul class="${L}" style="${P}">
              ${m?.map(e=>e?.replaceAll("'","&#039;"))?.map((s,a)=>{let r=(o?.activeKey??0)<0||(o?.activeKey??0)>=(o?.childItem??[]).length?0===a:a===o?.activeKey,c=t.getDynamicSourceLocales({val:s,uid:n?.uid,settingId:t.createSettingId({id:i.Tabs?.childItem?.id,index:a}),pageContext:d.pageContext??{},isCapitalize:o?.labelTypoV2?.attrs?.transform==="capitalize"});return e.template`
      <li
        aria-hidden
        class="${k(r)}"
        style="${K(r)}"
        key="${n?.uid}"

      >
        ${l.default({className:O,styles:{typo:S,typography:$,textAlign:v},setting:{text:c,htmlTag:"div",excludeFlex:!0,isForceValue:!0},translateSetting:i.Tabs?.childItem?.id})}
      </li>
    `}).join("")}
            </ul>
          </div>
          <div class="${W}">
            <div
              ${{...N}}
              class="${E}"
              style="${R}"
            >
              ${e.WrapRenderChildren({uid:n?.uid||"",customProps:u?.[0].customProps},u?.map((t,s)=>{let a=(o?.activeKey??0)<0||(o?.activeKey??0)>=(o?.childItem??[]).length?0===s:s===o?.activeKey;return t?e.template`${e.RenderChildren({...t,parentUid:n?.uid,isActive:a})}`:""}))}
            </div>
          </div>
        </div>
    </gp-tab>
    ${e.RenderIf(e.isLocalEnv,`<script ${t.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-tab-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${t.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-tab-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};
