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

      >
        ${Text_liquid.default({className:L,styles:{typo:o,typography:y,textAlign:n},setting:{text:i,htmlTag:"div",excludeFlex:!0,isForceValue:!0},translateSetting:translate.Tabs?.childItem?.id})}
      </li>
    `}).join(""),k=()=>core.WrapRenderChildren({uid:s?.uid||"",customProps:r?.[0].customProps},r?.map((e,t)=>{let l=(a?.activeKey??0)<0||(a?.activeKey??0)>=(a?.childItem??[]).length?0===t:t===a?.activeKey;return e?core.template`${core.RenderChildren({...e,parentUid:s?.uid,isActive:l})}`:""})),K=()=>core.RenderIf(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-tab-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-tab-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
    <gp-tab
      ${{...m}}
      style="${u}"
      class="${C}"
      gp-data='${JSON.stringify(p)?.replaceAll("'","&#039;")}'>
        <style>${$}</style>
        <div class="${v}">
          <div class="${S}" style="${h}">
            <ul class="${b}" style="${x}">
              ${P()}
            </ul>
          </div>
          <div class="${f}">
            <div
              ${{...I}}
              class="${A}"
              style="${j}"
            >
              ${k()}
            </div>
          </div>
        </div>
    </gp-tab>
    ${K()}
  `};exports.default=Tabs;
