import{useCurrentDevice as e}from"@gem-sdk/core";import{useState as t}from"react";import{useGetProductId as o}from"../../hooks/useGetProductId.js";import{useTabInteraction as r}from"./useTabInteraction.js";let useTab=(i,m)=>{let{activeKey:d}=i??{},s=e(),[a,l]=t(!d||d<0||d>=(i?.childItem??[]).length?0:d),{refContainer:p,productID:c}=o(),{dispatchEventTabActive:u}=r({activeKey:d||1,setActiveKey:l,activeTab:a,refContainer:p,componentUid:m?.uid||""});return i&&!i?.labelWidth&&(i.labelWidth={desktop:"200px"}),{currentDevice:s,productID:c,dispatchEventTabActive:u,activeTab:a,setActiveKey:l,refContainer:p}};export{useTab};
