'use client';
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{filterToolbarPreview as t}from"@gem-sdk/core";import{Children as i,isValidElement as l}from"react";import{useTab as r}from"../hooks/useTab.js";import{createAttr as a,createStyle as m,createClass as o}from"@gem-sdk/system";import{getAttr as d,getAttrContent as c}from"../common/attrs.js";import p from"../../text/components/Text.js";import{getStyleWrapper as n,getTabParentListStyle as u,getTabListStyle as h,getContainContentStyle as y,getItemStyle as f}from"../common/styles.js";import{getClassesWrapper as x,getContainClasses as N,getStyleTagClasses as g,getTabParentListClasses as v,getTabListClasses as j,getWrapperContentClasses as b,getContainContentClasses as k,getTextClasses as C,getItemClasses as T}from"../common/classes.js";let Tabs=$=>{let{builderAttrs:q,builderProps:A,style:W,setting:F,advanced:I,children:L}=$,{cssClass:S}=I??{},{panelWidth:U,childItem:w,labelAlign:z,labelTypo:B,labelTypoV2:D}=F??{},{currentDevice:E,productID:G,dispatchEventTabActive:H,activeTab:J,setActiveKey:K,refContainer:M}=r(F,A);F&&!F?.labelWidth&&(F.labelWidth={desktop:"200px"});let O=a({...d({uid:A?.uid||""})}),P=m({...n({setting:F,style:W,uid:A?.uid,pageContext:$.pageContext??{}})}),Q=o({...x({builderProps:A,advancedCssClass:S})}),R=o({...N({setting:F})}),V=g({panelWidth:U,builderProps:A}),X=o({...v()}),Y=m({...u(F)}),Z=o({...j({setting:F})}),_=m({...h(F)}),ee=e=>o({...T({setting:F,isNotLiquid:!0,isActive:e,currentDevice:E})}),es=e=>m({...f(F,e)}),et=i.map(L,e=>e?.props?.uid),ei=o({...b()}),el=o({...k()}),er=m({...y()}),ea=o({...C()}),em=a({...c({uid:A?.uid||""})}),eo=()=>w?.map((e,t)=>{let i=J==t;return s("li",{"aria-hidden":!0,className:ee(i),style:es(i),onClick:()=>{K(t),H(t)},children:s(p,{className:ea,styles:{typo:D,typography:B,textAlign:z},setting:{text:e,htmlTag:"div",excludeFlex:!0,options:{useState:!0,uniqueId:G?`${et?.[t]}-${G}`:`${et?.[t]}`,productID:G}}})},et&&et[t])}),ed=()=>i.map(t(L),(e,t)=>l(e)?s(e.type,{...e.props,isActive:t==J,parentUid:A?.uid}):null);return e("div",{ref:M,...q,...O,style:P,className:Q,children:[s("style",{children:V}),e("div",{className:R,children:[s("div",{className:X,style:Y,children:s("ul",{className:Z,style:_,children:eo()})}),s("div",{className:ei,children:s("div",{...em,className:el,style:er,children:ed()})})]}),t(L,!0)]})};export{Tabs as default};
