"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("lucide-react"),t=require("@e-llm-studio/citation"),s=require("./_svg/ButtonCognitiveIcon.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(i);exports.ViewFormUpdateCard=function(i){var o=i.data,l=i.cardMdComponents,d=a.default.useState(!0),p=d[0],c=d[1],g=a.default.useState({}),x=g[0],u=g[1];return o&&o.fields&&Array.isArray(o.fields)?n.jsxs("span",e.__assign({style:{display:"inline",verticalAlign:"middle",marginLeft:"4px"}},{children:[n.jsxs("button",e.__assign({onClick:function(){return c(!p)},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"6px 4px",borderRadius:"8px",border:"none",backgroundColor:"#F5F3FF",color:"#6D28D9",fontWeight:500,fontSize:"14px",cursor:"pointer"}},{children:[n.jsx(r.FileText,{size:15}),n.jsx("span",{children:"View Updated Details"}),p?n.jsx(r.ChevronUp,{size:16}):n.jsx(r.ChevronDown,{size:16})]})),p&&n.jsxs("div",e.__assign({style:{position:"relative",zIndex:10,marginTop:"8px",width:"100%",minWidth:"300px",border:"1px solid #F1F5F9",borderRadius:"8px",backgroundColor:"#FFFFFF",padding:"12px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"}},{children:[n.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:600,color:"#475569",marginBottom:"4px"}},{children:o.title})),n.jsx("div",e.__assign({style:{backgroundColor:"#F8FAFC",borderRadius:"8px",padding:"12px",display:"flex",flexDirection:"column",gap:"12px"}},{children:o.fields.map(function(i,o){var a=i.segments&&i.segments.length>0?i.segments:[{type:"text",content:i.label}];return n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:[n.jsxs("div",e.__assign({style:{fontSize:"14px",color:"#1E293B",lineHeight:"1.6",fontWeight:400}},{children:[n.jsxs("span",{children:[o+1,"."]}),a.map(function(i,t){if("text"===i.type)return n.jsx("span",e.__assign({style:{whiteSpace:"pre-wrap"}},{children:i.content}),t);if("reasoning"===i.type){var a="".concat(o,"-").concat(t),l=x[a];return n.jsxs("span",e.__assign({onClick:function(n){n.stopPropagation(),u(function(n){var i;return e.__assign(e.__assign({},n),((i={})[a]=!n[a],i))})},style:{display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 4px",cursor:"pointer",verticalAlign:"middle"}},{children:[n.jsx(s.ButtonCognitiveIcon,{size:18}),l?n.jsx(r.ChevronUp,{size:12,color:"#667085"}):n.jsx(r.ChevronDown,{size:12,color:"#667085"})]}),t)}return null})]})),a.map(function(i,r){var a,d="".concat(o,"-").concat(r);return"reasoning"===i.type&&x[d]?n.jsx("div",e.__assign({style:{width:"100%",marginTop:"4px"}},{children:n.jsx(t.CognitiveDecisioningCard,{headerIcon:n.jsx(s.ButtonCognitiveIcon,{}),reasoning:null===(a=i.reasoning.reason)||void 0===a?void 0:a.replace(/\\n/g,"\n"),gap:i.reasoning.gap,score:i.reasoning.score,isOpen:!0,onToggle:function(){return u(function(n){var i;return e.__assign(e.__assign({},n),((i={})[d]=!1,i))})},hideTrigger:!0,mdComponents:l,styles:{pill:{gap:"2px",border:"none",backgroundColor:"transparent"}}})}),"card-".concat(r)):null})]}),o)})}))]}))]})):null};
//# sourceMappingURL=ViewFormUpdateCard.js.map
