"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("../../_svg/CognitiveDecisioning.js"),t=require("lucide-react"),o=require("../../TooltipComponent.js"),s=require("../../ConflictingReasoningCard.js"),a=i.forwardRef(function(a,l){var c=a.rows,d=void 0===c?1:c,p=a.placeholder,x=a.value,u=a.onChange,g=a.onFocus,f=a.isHighlighted,h=void 0!==f&&f,v=a.customClass,b=a.showNumber,y=a.numberIndex,_=a.isReadOnly,j=void 0!==_&&_,C=a.isOpen,w=void 0!==C&&C,m=a.onToggle,k=a.showCognitiveIcon,z=void 0!==k&&k,I=a.cognitiveIcon,R=a.tooltipDescription,S=a.isConflicting,T=a.conflictMsg,D=a.conflictingReasoning,E=a.decisionStrength,q=a.conflictingGap,F=a.errorMessage,M=a.inputReadOnly,O=void 0!==M&&M,H=a.citations,L=void 0===H?[]:H,N=function(){return I||n.jsx(r.default,{})},A=i.useRef(null),U=i.useCallback(function(e){e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px")},[]);i.useEffect(function(){var e=function(){A.current&&U(A.current)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[U]);var V=i.useCallback(function(e){A.current=e,l&&("function"==typeof l?l(e):l.current=e),e&&U(e)},[l,U]);return n.jsxs("div",e.__assign({style:{width:"100%"}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",width:"100%",border:"1px solid ".concat(S||F?"#ef4444":h?"#2563EB":"#ccc"),borderRadius:"0.5rem",backgroundColor:j?"#f9fafb":"white",opacity:j?.8:1,cursor:j?"not-allowed":"text",pointerEvents:"auto",transition:"all 0.3s ease-in-out",overflow:"hidden",boxShadow:S&&h?"0 0 20px 3px rgba(239, 68, 68, 0.45)":h?"\n          0 0 12px 3px rgba(37, 99, 235, 0.3),\n          -6px 0 10px rgba(37, 99, 235, 0.2),\n          6px 0 10px rgba(37, 99, 235, 0.2)\n        ":"none"},onMouseEnter:function(e){h||S||j||(e.currentTarget.style.border="1px solid black"),j&&(e.currentTarget.style.cursor="not-allowed")},onMouseLeave:function(e){h||S||j||(e.currentTarget.style.border="1px solid #ccc")}},{children:[n.jsx("div",e.__assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:S&&T&&n.jsx("div",e.__assign({style:{padding:"12px 12px 0 12px"}},{children:n.jsxs("div",e.__assign({style:{display:"inline-flex",alignItems:"center",gap:"6px",backgroundColor:"#FFE9E980",padding:"4px 10px",borderRadius:"16px",color:"#b91c1c",fontSize:"12px",fontWeight:500}},{children:[n.jsx(t.AlertTriangle,{size:14,strokeWidth:2}),T]}))}))})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"flex-start"}},{children:[b&&void 0!==y&&n.jsxs("span",e.__assign({style:{fontSize:"14px",padding:"12px 0",width:"40px",textAlign:"center",color:"#666"}},{children:[y,"."]})),n.jsx("textarea",{ref:V,rows:d,placeholder:p,className:"textarea ".concat(v),value:x,onChange:u,onFocus:g,readOnly:O,style:{border:"none",background:"transparent",flex:1,padding:"12px 12px 12px 12px",fontFamily:"inherit",fontSize:"14px",color:"#101828",resize:"both",width:"100%",boxSizing:"border-box",maxHeight:"200px",overflowY:"auto",outline:"none",display:"block",margin:"0 auto",alignSelf:"center",cursor:O?"default":"text"},onInput:function(e){return U(e.target)}}),S&&D&&n.jsx(o.default,e.__assign({description:"View Conflict Details"},{children:n.jsxs("button",e.__assign({onClick:function(e){e.preventDefault(),null==m||m()},style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",border:"none",backgroundColor:"transparent",borderRadius:"4px",margin:"8px",cursor:"pointer",flexShrink:0}},{children:[N(),w?n.jsx(t.ChevronUpIcon,{size:14}):n.jsx(t.ChevronDownIcon,{size:14})]}))})),z&&!S&&n.jsx(o.default,e.__assign({description:null!=R?R:""},{children:n.jsxs("button",e.__assign({onClick:function(e){e.preventDefault(),null==m||m()},style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",border:"none",backgroundColor:"transparent",borderRadius:"4px",margin:"8px",cursor:"pointer",flexShrink:0}},{children:[N(),w?n.jsx(t.ChevronUpIcon,{size:14}):n.jsx(t.ChevronDownIcon,{size:14})]}))}))]}))]})),S&&w&&n.jsx("div",e.__assign({style:{marginTop:"8px"}},{children:n.jsx(s.ConflictReasoningCard,{isVisible:!0,decisionStrength:E,reasoning:D,gap:q,citations:L})})),F&&n.jsx("div",e.__assign({style:{color:"#ef4444",fontSize:"12px",marginTop:"4px"}},{children:F}))]}))});a.displayName="Textarea",exports.Textarea=a;
//# sourceMappingURL=Textarea.js.map
