1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3871],{92735:function(e,t,a){a.d(t,{Z:function(){return s}});let s=(0,a(79205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},42208:function(e,t,a){a.d(t,{Z:function(){return s}});let s=(0,a(79205).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},2207:function(e,t,a){a.d(t,{Z:function(){return s}});let s=(0,a(79205).Z)("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]])},62883:function(e,t,a){a.d(t,{Z:function(){return s}});let s=(0,a(79205).Z)("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]])},43871:function(e,t,a){a.r(t),a.d(t,{InvestmentMemoStage:function(){return f}});var s=a(57437),r=a(2265),i=a(93448),n=a(48736),c=a(51817),o=a(62883),l=a(30401),d=a(92735),m=a(2207),x=a(42208);let u=[{id:"executive_summary",title:"Executive Summary"},{id:"facility_overview",title:"Facility Overview"},{id:"market_analysis",title:"Market Analysis"},{id:"financial_analysis",title:"Financial Analysis"},{id:"risk_assessment",title:"Risk Assessment"}
1,{id:"investment_thesis",title:"Investment Thesis & Value Creation"},{id:"due_diligence",title:"Due Diligence Checklist"},{id:"recommendation",title:"Recommendation"}];function f(e){var t,a;let{dealId:f,stageData:p,onUpdate:h}=e,[b,y]=(0,r.useState)("executive_summary"),[k,v]=(0,r.useState)("edit"),[g,w]=(0,r.useState)(!1),[j,N]=(0,r.useState)(!1),Z=p.sections||[],C=Z.find(e=>e.id===b),M=p.status||"not_started",_=async()=>{w(!0);try{let e=await fetch("/api/deals/".concat(f,"/workspace/memo"),{method:"POST"});if(e.ok){let t=await e.json();h({sections:t.sections,memoId:t.memoId,status:"draft"})}}catch(e){console.error("Failed to generate memo:",e)}finally{w(!1)}},E=(e,t)=>{h({sections:Z.map(a=>a.id===e?{...a,content:t,isEdited:!0}:a)})},S=async e=>{try{let t=await fetch("/api/deals/".concat(f,"/workspace/memo"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({regenerateSection:e})});if(t.ok){let a=await t.json();a.section&&h({sections:Z.map(t=>t.id===e?{...a.section,isEdited:!1}:t)})}}catch(e){console.error("Failed to regenerate section:",e)}},L=async e=>{N(!0);try{let t=await fetch("/api/deals/".concat(f,"/workspace/memo/export?format=").concat(e));if(t.ok){let a=await t.blob(),s=URL.createObjectURL(a),r=document.createElement("a");r.href=s,r.download="investment-memo.".concat(e),r.click(),URL.revokeObjectURL(s),h({lastExportedAt:new Date().toISOString(),exportFormat:e})}}catch(e){console.error("Export failed:",e)}finally{N(!1)}};return"not_started"===M?(0,s.jsxs)("div",{className:"max-w-3xl mx-auto text-center py-16",children:[(0,s.jsx)(n.Z,{className:"w-12 h-12 text-surface-300 mx-auto mb-4"}),(0,s.jsx)("h3",{className:"text-lg font-semibold text-surface-700 dark:text-surface-300 mb-2",children:"Generate Investment Memo"}),(0,s.jsx)("p",{className:"text-sm text-surface-500 mb-6 max-w-md mx-auto",children:"Auto-generate a professional 8-section investment memorandum from your deal data. You can edit every section after generation."}),(0,s.jsxs)("button",{onClick:_,disabled:g,className:"px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 disabled:opacity-50 font-medium transition-colors flex items-center gap-2 mx-auto",children:[g?(0,s.jsx)(c.Z,{className:"w-4 h-4 animate-spin"}):(0,s.jsx)(o.Z,{className:"w-4 h-4"}),g?"Generating Memo...":"Generate Investment Memo"]})]}):(0,s.jsxs)("div",{className:"max-w-5xl mx-auto flex flex-col md:flex-row gap-4 h-full",children:[(0,s.jsxs)("div",{className:"md:w-56 shrink-0 space-y-1 flex md:flex-col gap-1 md:gap-0 overflow-x-auto md:overflow-x-visible pb-2 md:pb-0",children:[u.map(e=>{let t=Z.find(t=>t.id===e.id),a=!!(null==t?void 0:t.content),r=b===e.id;return(0,s.jsx)("button",{onClick:()=>y(e.id),className:(0,i.cn)("w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors",r?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 font-medium":"text-surface-600 dark:text-surface-400 hover:bg-surface-100 dark:hover:bg-surface-800"),children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a?(0,s.jsx)(l.Z,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}):(0,s.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-surface-300 dark:border-surface-600 shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:e.title})]})},e.id)}),(0,s.jsxs)("div",{className:"border-t border-surface-200 dark:border-surface-700 pt-3 mt-3 space-y-2",children:[(0,s.jsxs)("button",{onClick:()=>L("pdf"),disabled:j,className:"w-full flex items-center gap-2 px-3 py-2 text-xs bg-surface-100 dark:bg-surface-800 hover:bg-surface-200 dark:hover:bg-surface-700 rounded-lg transition-colors",children:[(0,s.jsx)(d.Z,{className:"w-3.5 h-3.5"}),"Export PDF"]}),(0,s.jsxs)("button",{onClick:()=>L("docx"),disabled:j,className:"w-full flex items-center gap-2 px-3 py-2 text-xs bg-surface-100 dark:bg-surface-800 hover:bg-surface-200 dark:hover:bg-surface-700 rounded-lg transition-colors",children:[(0,s.jsx)(d.Z,{className:"w-3.5 h-3.5"}),"Export DOCX"]})]})]}),(0,s.jsxs)("div",{className:"flex-1 border border-surface-200 dark:border-surface-700 rounded-xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-surface-200 dark:border-surface-700 bg-surface-50 dark:bg-surface-800",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-surface-800 dark:text-surface-200",children:null===(t=u.find(e=>
1e.id===b))||void 0===t?void 0:t.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("button",{onClick:()=>S(b),className:"flex items-center gap-1 px-2 py-1 text-xs text-primary-600 hover:text-primary-700 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded transition-colors",children:[(0,s.jsx)(o.Z,{className:"w-3 h-3"})," Regenerate"]}),(0,s.jsxs)("div",{className:"flex bg-surface-200 dark:bg-surface-700 rounded-md p-0.5",children:[(0,s.jsxs)("button",{onClick:()=>v("edit"),className:(0,i.cn)("px-2 py-1 text-xs rounded","edit"===k?"bg-white dark:bg-surface-600 shadow-sm":"text-surface-500"),children:[(0,s.jsx)(m.Z,{className:"w-3 h-3 inline mr-1"}),"Edit"]}),(0,s.jsxs)("button",{onClick:()=>v("preview"),className:(0,i.cn)("px-2 py-1 text-xs rounded","preview"===k?"bg-white dark:bg-surface-600 shadow-sm":"text-surface-500"),children:[(0,s.jsx)(x.Z,{className:"w-3 h-3 inline mr-1"}),"Preview"]})]})]})]}),(0,s.jsx)("div",{className:"p-5",children:"edit"===k?(0,s.jsx)("textarea",{value:(null==C?void 0:C.content)||"",onChange:e=>E(b,e.target.value),placeholder:"Write or edit the ".concat(null===(a=u.find(e=>e.id===b))||void 0===a?void 0:a.title," section..."),className:"w-full min-h-[400px] text-sm text-surface-800 dark:text-surface-200 bg-transparent border-none outline-none resize-y leading-relaxed placeholder-surface-400"}):(0,s.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none min-h-[400px]",children:(null==C?void 0:C.content)?(0,s.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-relaxed text-surface-800 dark:text-surface-200",children:C.content}):(0,s.jsx)("p",{className:"text-surface-400 italic",children:"No content yet. Generate or write this section."})})})]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.