import{makeGlobalSize as t,composeSize as e,removePaddingYInStyle as r,makeStyle as o,getSingleColorVariable as i,getGlobalColorStateStyle as a}from"@gem-sdk/core";let MINIMUM_CHILD=1,BODY_CHILD_INDEX=0,ICON_MINUS="<svg width='16' height='16' fill='currentColor' viewBox=\"0 0 448 512\"><path fill='currentColor' d=\"M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z\"/></svg>",ICON_PLUS="<svg fill='currentColor' width='16' height='16' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path fill='currentColor' d=\"M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z\"/></svg>",getDataState=(t,e)=>{let{setting:r={},styles:o={},builderProps:i}=t,{activeKey:a,iconSvg:l,expandItem:n,iconPosition:s,iconCollapseSize:c,iconGlobalSize:g,iconExpand:I,iconCollapse:p,layoutHeader:S,expandedMode:m,configIconSize:u}=r,{bgColor:d,color:v,headerBorder:C,width:h,fullWidth:N,textColor:L,itemHeaderSpacing:_,contentSizePadding:w,iconColor:M,headerContentPadding:D,widthHeightSize:U}=o,O="multiple"===m,H=t=>t?t.toString().toLowerCase().split(",").map(t=>parseInt(t.trim())-1).map(t=>t.toString()):[],P=n?H(a):[],f=O?[...P]:P,x=()=>({iconSvg:l,isIconPlus:"plus"===l,activeKey:a,expanded:O,expandItem:n,iconPosition:s,iconGlobalSize:g,iconCollapse:p,iconExpand:I,iconCollapseSize:c,layoutHeader:S,expandedMode:m,configIconSize:u,parentUid:i?.uid,childListNumber:n?a?.toString().toLowerCase()==="all"?e?.map((t,e)=>e.toString()):f:[],chidlrenUid:e?.map(t=>t.uid)}),B=()=>({bgColor:d,color:v,headerBorder:C,fullWidth:N,width:h,itemHeaderSpacing:_,textColor:L,iconColor:M,contentSizePadding:w,headerContentPadding:D,widthHeightSize:U});return{uidState:i?.uid,settingState:x(),stylesState:B(),accordions:f}},getParentSettings=(t={})=>{let{iconSvg:e,titleTypo:r,layoutHeader:o,iconGlobalSize:i,iconCollapseSize:a,iconCollapse:l,iconExpand:n,alignment:s,configIconSize:c,iconPosition:g}=t,I=r?{...r,attrs:{...r.attrs}}:void 0;return I?.attrs?.color&&delete I.attrs.color,{iconSvg:e,titleTypo:I,layoutHeader:o,iconGlobalSize:i,iconCollapseSize:a,iconCollapse:l,iconExpand:n,alignment:s,configIconSize:c,iconPosition:g}},composeIconSvg=({isShow:t,iconExpand:e,iconCollapse:r,iconSvg:o})=>e&&t?e:r&&!t?r:"plus"===o?t?ICON_MINUS:ICON_PLUS:o,getSettingItemLiquid=l=>{let{index:n,accordions:s,parentSetting:c,parentStyle:g}=l,{titleTypo:I,iconCollapse:p,iconExpand:S,activeKey:m,expandItem:u,iconSvg:d}=c??{};delete I?.attrs?.color;let{itemContentSpacing:v,iconColor:C,contentSizePadding:h}=g??{},N=!!u&&(m?.toString()?.toLowerCase()==="all"||s?.includes(n?.toString()??"")),L=t(h),_=()=>{let t={...h&&L.padding,...v?.type||h?{}:e(v?.custom)};return N?t:r(t)},w=composeIconSvg({isShow:N,iconExpand:S,iconCollapse:p,iconSvg:d}),M=()=>{let t={normal:C?.normal??"transparent",hover:C?.hover??C?.active??C?.normal??"transparent",active:C?.active??"transparent"};return N?o({c:i(t?.active)}):a("c",t)};return{isShow:N,composeContentSizeStyle:_,collapsibleIcon:w,composeIconColor:M(),makeIcon:w}};export{BODY_CHILD_INDEX,ICON_MINUS,ICON_PLUS,MINIMUM_CHILD,composeIconSvg,getDataState,getParentSettings,getSettingItemLiquid};
