import{__assign as e}from"tslib";import{jsxs as i,jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";import a from"./TooltipComponent.js";var p=function(p){var s,c,f=p.title,x=p.subtitle,g=p.children,h=p.defaultOpen,u=void 0===h||h,v=p.footerData,y=p.readOnly,b=void 0!==y&&y,m=p.variant,F=void 0===m?"default":m,w=p.expanded,C=p.onToggle,D=p.actionButtons,E=p.isAiStreaming,S=p.editFlow,z=void 0!==S&&S,k=t(u),I=k[0],B=k[1];n(function(){B(u)},[u]);var R=void 0!==w,A=R?w:I,T=function(){R?null==C||C():B(!A)},W="variant"===f.type,j="other"===f.type,L="tier-header"===F,N="rule-behavior"===F,O={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:L?"0px":"8px",borderBottom:L?"1px solid #E2E8F0":"none"},V={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:j?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":L&&A?"#2563EB":"#19213D",backgroundColor:N&&!f.isNewVariant?"#F7F8FA":W?"#FDF2F8":f.isDefault?"#F7F8FA":"transparent",border:W?"1px solid #FCE7F3":f.isDefault?"1px solid #F0F2F5":"none"},M={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:j?"0px":"10px"},P={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}};return i("div",e({style:{width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:L?"none":N&&A?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:T,style:O},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!f.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o("div",e({style:V},{children:f.label})),f.isDefault&&o("span",e({style:P.defaultTag},{children:"Default"})),f.isModified&&o("span",e({style:P.modifiedTag},{children:"MODIFIED"}))]})),o("div",{children:f.isNewVariant&&i("div",e({style:P.badge},{children:[o("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:o("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),o("div",{children:"New Variant"})]}))}),x&&o("div",e({style:M},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!E&&(z?o(a,e({description:"Coming Soon"},{children:o("div",e({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:o("div",e({style:{pointerEvents:"none"}},{children:D(A,function(){})}))}))})):o("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(A,T)}))),o("div",e({onClick:T,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:A?o(d,{size:18,color:L?"#2563EB":"#64748B"}):o(l,{size:18,color:"#64748B"})}))]}))]})),!A&&v&&o("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:j?i(r,{children:[o("span",e({style:{fontWeight:500,color:"#475569"}},{children:v.ruleTitle||""})),(null!==(c=null===(s=v.tiers)||void 0===s?void 0:s.length)&&void 0!==c?c:0)>0&&i(r,{children:[o("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),o("span",{children:Array.isArray(v.tiers)?v.tiers.join(", "):v.tiers})]})]}):o("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:v.description}))})),A&&o("div",e({style:{padding:"12px"}},{children:g}))]}))};export{p as default};
//# sourceMappingURL=AccordianSection.js.map
