'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),useTab=require("../hooks/useTab.js"),system=require("@gem-sdk/system"),attrs=require("../common/attrs.js"),Text=require("../../text/components/Text.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js");const Tabs=e=>{let{builderAttrs:s,builderProps:t,style:a,setting:l,advanced:r,children:i}=e,{cssClass:c}=r??{},{panelWidth:n,childItem:m,labelAlign:y,labelTypo:u,labelTypoV2:d}=l??{},{currentDevice:o,productID:x,dispatchEventTabActive:C,activeTab:j,setActiveKey:p,refContainer:g}=useTab.useTab(l,t);l&&!l?.labelWidth&&(l.labelWidth={desktop:"200px"});let T=system.createAttr({...attrs.getAttr({uid:t?.uid||""})}),h=system.createStyle({...styles.getStyleWrapper(l,a)}),b=system.createClass({...classes.getClassesWrapper({builderProps:t,advancedCssClass:c})}),R=system.createClass({...classes.getContainClasses({setting:l})}),v=classes.getStyleTagClasses({panelWidth:n,builderProps:t}),S=system.createClass({...classes.getTabParentListClasses()}),q=system.createStyle({...styles.getTabParentListStyle(l)}),N=system.createClass({...classes.getTabListClasses({setting:l})}),f=system.createStyle({...styles.getTabListStyle(l)}),A=e=>system.createClass({...classes.getItemClasses({setting:l,isNotLiquid:!0,isActive:e,currentDevice:o})}),k=e=>system.createStyle({...styles.getItemStyle(l,e)}),L=React.Children.map(i,e=>e?.props?.uid),P=system.createClass({...classes.getWrapperContentClasses()}),W=system.createClass({...classes.getContainContentClasses()}),I=system.createStyle({...styles.getContainContentStyle()}),$=system.createClass({...classes.getTextClasses()}),w=system.createAttr({...attrs.getAttrContent({uid:t?.uid||""})}),_=()=>m?.map((e,s)=>{let t=j==s;return jsxRuntime.jsx("li",{"aria-hidden":!0,className:A(t),style:k(t),onClick:()=>{p(s),C(s)},children:jsxRuntime.jsx(Text.default,{className:$,styles:{typo:d,typography:u,textAlign:y},setting:{text:e,htmlTag:"div",excludeFlex:!0,options:{useState:!0,uniqueId:x?`${L?.[s]}-${x}`:`${L?.[s]}`,productID:x}}})},L&&L[s])}),E=()=>React.Children.map(core.filterToolbarPreview(i),(e,s)=>React.isValidElement(e)?jsxRuntime.jsx(e.type,{...e.props,isActive:s==j,parentUid:t?.uid}):null);return jsxRuntime.jsxs("div",{ref:g,...s,...T,style:h,className:b,children:[jsxRuntime.jsx("style",{children:v}),jsxRuntime.jsxs("div",{className:R,children:[jsxRuntime.jsx("div",{className:S,style:q,children:jsxRuntime.jsx("ul",{className:N,style:f,children:_()})}),jsxRuntime.jsx("div",{className:P,children:jsxRuntime.jsx("div",{...w,className:W,style:I,children:E()})})]}),core.filterToolbarPreview(i,!0)]})};exports.default=Tabs;
