'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("@gem-sdk/core"),a=require("../../grid/components/ChildrenDroppable.js"),r=require("../../text/components/Text.js"),l=require("../hooks/useAccordionItem.js"),n=require("@gem-sdk/system"),o=require("../common/styles.js"),c=require("../common/classes.js"),i=require("../common/helpers.js");exports.default=d=>{let{children:y,index:g,parentUid:m,title:p,childrenIcon:C}=d,{iconSvg:u,titleTypo:S,layoutHeader:x,iconGlobalSize:h,iconCollapseSize:j,iconCollapse:I,iconExpand:v,alignment:N,configIconSize:f,iconPosition:_}=i.getParentSettings(d.parentSetting)??{},{refContainer:q,getIdDropdownItem:b,makeIcon:D,isShow:M,uniqueId:L,composeIconColor:T,isRenderChildren:H,composeContentSizeStyle:k,hasTransitionedIn:w,isMounted:R,productID:A}=l.default(d),G=n.createClass(c.getItemContainerClasses),O=n.createClass(c.getDropdownClasses(d.parentStyle,{isShow:M,uniqueId:L,makeIcon:D,index:g})),P=n.createClass(c.getIconClasses),z=n.createClass(c.getIconRotateClasses(d.parentStyle,{isShow:M,iconExpand:v,iconSvg:u,iconCollapse:I})),B=n.createClass(c.getContentClasses(m)),E=n.createClass(c.getGapClasses),F=n.createStyle(o.getItemContainerStyles(d.parentStyle,M)),U=n.createStyle(o.getDropdownStyles(d.parentStyle,{isShow:M,iconPosition:_})),X=n.createStyle(o.getDropdownTextStyles(d.parentStyle?.textColor,M)),Y=n.createStyle(o.getIconRotateStyles(d.parentStyle,M,j)),J=n.createStyle(o.getIconGlobalSize(h)),K=n.createStyle(o.getGapStyles(h,N)),Q=n.createClass(t.composeClasses("gp-inline-flex")),V=n.createClass(c.getLayoutIconClasses),W=n.createStyle(o.getIconStyles(T,f)),Z=n.createClass(c.getRenderChildrenClasses(d.parentStyle,{isShow:M,hasTransitionedIn:w,isMounted:R})),$=n.createStyle(o.getRenderChildrenStyles()),ee=n.createClass(t.composeClasses("gp-accordion-item_body-inner gp-transition-all gp-duration-500 gp-min-h-0")),es=n.createClass(t.composeClasses("gp-border gp-border-transparent group-hover:[color:var(--text-hover-color)]")),et=s.useMemo(()=>{let t=s.Children.toArray(y);return t.length>=i.MINIMUM_CHILD?t[i.BODY_CHILD_INDEX]:e.jsx(a.default,{})},[y]);return e.jsx("div",{className:G,ref:q,style:F,children:e.jsxs("div",{"data-index":g?.toString(),className:B,children:[e.jsxs("div",{"aria-hidden":!0,onClick:e=>{b(e,g?.toString())},className:O,style:U,children:[n.If(!!D,e.jsx("div",{className:P,children:e.jsx("span",{style:Y,className:z,dangerouslySetInnerHTML:{__html:D??""}})})),e.jsxs("div",{className:E,style:K,children:[n.If("before-text"===x,e.jsx("div",{className:Q,style:{...J},children:e.jsx("span",{className:V,style:W,dangerouslySetInnerHTML:{__html:C??""}})})),e.jsx(r.default,{setting:{text:p,htmlTag:"div",options:{uniqueId:L,productID:A,useState:!0},excludeFlex:!0},style:X,styles:{typo:S},className:es}),n.If("after-text"===x,e.jsx("div",{className:Q,style:{...J},children:e.jsx("span",{className:V,style:W,dangerouslySetInnerHTML:{__html:C??""}})}))]})]}),H&&e.jsx("div",{...d?.builderAttrs,className:Z,style:$,"data-index":g,"data-show":M,children:e.jsx("div",{className:ee,style:k,children:et})})]})})};
