import{__assign as n,__spreadArray as o}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as r}from"react";import{Box as a,Typography as e,Accordion as l,AccordionSummary as c,AccordionDetails as s}from"@mui/material";import u from"@mui/icons-material/KeyboardArrowDown";import d from"@mui/material/Tooltip";import{Info as f}from"lucide-react";var p=function(p){var m,h,x=p.conflictingConditions,b=function(n){var o={};return n.forEach(function(n){var t="".concat(n.conflictType,"_").concat(n.reason);o[t]||(o[t]=[]),o[t].push(n)}),o},g=(null==x?void 0:x.filter(function(n){return n.condition_wta||n.condition_wnta}))||[],y=(m=b(g),h=[],Object.values(m).forEach(function(n){n.length>0&&h.push(n[0])}),h),F=r(function(){return y.map(function(n,o){return o})}),w=F[0],v=F[1];return g&&0!==g.length?t(a,n({sx:{backgroundColor:"#FEF2F2",border:"1px solid #FCA5A5",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.04)",padding:3,borderRadius:2,mt:3,mb:3,fontFamily:"Plus Jakarta Sans"}},{children:[t(a,n({sx:{display:"flex",alignItems:"center",mb:2}},{children:[i(e,n({sx:{fontSize:"1.15rem",fontWeight:700,color:"#B91C1C",fontFamily:"Plus Jakarta Sans"}},{children:"Conflicting Conditions Found"})),i(d,n({title:"The current learning contains conditions that conflicting. Please review and adjust them to ensure consistency.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:i(f,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),i(a,n({sx:{maxHeight:360,overflowY:"auto",pr:1.5}},{children:y.map(function(r,d){var f=[],p=function(n){return n.map(function(n,o){return"".concat(o+1,". ").concat(n)}).join("\n\n")},m=[],h=[],x=b(g)["".concat(r.conflictType,"_").concat(r.reason)]||[];x.length>1?x.forEach(function(n){n.condition_wta&&m.push(n.condition_wta),n.condition_wnta&&h.push(n.condition_wnta)}):(r.condition_wta&&m.push(r.condition_wta),r.condition_wnta&&h.push(r.condition_wnta)),m.length>0&&f.push({label:"When To Apply",value:p(m)}),h.length>0&&f.push({label:"When Not To Apply",value:p(h)});var y=w.includes(d);return t(l,n({expanded:y,onChange:function(){return function(n){v(function(t){return t.includes(n)?t.filter(function(o){return o!==n}):o(o([],t,!0),[n],!1)})}(d)},disableGutters:!0,sx:{mb:2,border:"1px solid #FCA5A5",fontFamily:"Plus Jakarta Sans",borderRadius:2,"&::before":{display:"none"}}},{children:[i(c,n({expandIcon:i(u,{style:{color:"#991B1B",transition:"transform 0.3s ease-in-out"}}),"aria-controls":"panel-".concat(d,"-content"),id:"panel-".concat(d,"-header"),sx:{fontFamily:"Plus Jakarta Sans",color:"#991B1B",fontWeight:600,px:2,py:1.5}},{children:"Conflict in current conditions"})),t(s,n({sx:{px:2,pb:2}},{children:[i(a,n({sx:{display:"flex",flexDirection:{xs:"column",sm:2===f.length?"row":"column"},gap:2,mb:2}},{children:f.map(function(o,r){return t(a,n({sx:{flex:2===f.length?1:"none",border:"1px solid #FCA5A5",borderRadius:2,padding:2,backgroundColor:"#FFFFFF"}},{children:[i(e,n({variant:"caption",sx:{fontSize:"0.9rem",color:"#6B7280",fontWeight:600,mb:.5,display:"block",fontFamily:"Plus Jakarta Sans"}},{children:o.label})),i(e,n({variant:"body2",sx:{fontSize:"1rem",color:"#374151",whiteSpace:"pre-line",fontFamily:"Plus Jakarta Sans"}},{children:o.value}))]}),r)})})),t(e,n({variant:"body2",sx:{fontSize:"1rem",color:"#1F2937",lineHeight:1.6,fontFamily:"Plus Jakarta Sans"}},{children:[i("strong",{children:"Reason:"})," ",r.reason]}))]}))]}),d)})}))]})):null};export{p as default};
//# sourceMappingURL=ConflictingLearningWarnCard.js.map
