'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 m,createStyle as a,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 v,getTabParentListClasses as g,getTabListClasses as j,getWrapperContentClasses as b,getContainContentClasses as k,getTextClasses as T,getItemClasses as C}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=m({...d({uid:A?.uid||""})}),P=a({...n(F,W)}),Q=o({...x({builderProps:A,advancedCssClass:S})}),R=o({...N({setting:F})}),V=v({panelWidth:U,builderProps:A}),X=o({...g()}),Y=a({...u(F)}),Z=o({...j({setting:F})}),_=a({...h(F)}),ee=e=>o({...C({setting:F,isNotLiquid:!0,isActive:e,currentDevice:E})}),es=e=>a({...f(F,e)}),et=i.map(L,e=>e?.props?.uid),ei=o({...b()}),el=o({...k()}),er=a({...y()}),em=o({...T()}),ea=m({...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:em,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",{...ea,className:el,style:er,children:ed()})})]}),t(L,!0)]})};export{Tabs as default};
