import{a$ as g,w as y,Q as f,r as j,y as b,H as c,e,D,f as v,g as C,T as u,aq as k,aZ as R,a_ as A,i as S,A as l,l as T,P as d}from"./index-_6SmYgWK.js";import{S as n}from"./StatsCard-DjLJlF2a.js";/**
 * @license @tabler/icons-react v3.31.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var I=g("outline","zoom-scan","IconZoomScan",[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-4"}],["path",{d:"M16 16l-2.5 -2.5",key:"svg-5"}]]);const E=({show:a,dialogProps:t,onCancel:i,onGoToRetrievalQuery:p})=>{const m=document.getElementById("portal"),s=y(),o=f(r=>r.customization);j.useEffect(()=>(s(a?{type:b}:{type:c}),()=>s({type:c})),[a,s]);const h=a?e.jsxs(D,{onClose:i,open:a,fullWidth:!0,maxWidth:"sm","aria-labelledby":"upsert-result-dialog-title","aria-describedby":"upsert-result-dialog-description",children:[e.jsx(v,{sx:{fontSize:"1rem"},id:"upsert-result-dialog-title",children:"Upsert Record"}),e.jsx(C,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:5},children:[e.jsx(n,{title:"Added",stat:t.numAdded??0}),e.jsx(n,{title:"Updated",stat:t.numUpdated??0}),e.jsx(n,{title:"Skipped",stat:t.numSkipped??0}),e.jsx(n,{title:"Deleted",stat:t.numDeleted??0})]}),t.addedDocs&&t.addedDocs.length>0&&e.jsxs(u,{sx:{mt:2,mb:2,fontWeight:500},children:[t.numAdded," Added Documents"]}),t.addedDocs&&t.addedDocs.length>0&&t.addedDocs.map((r,x)=>e.jsx(k,{sx:{border:"1px solid #e0e0e0",borderRadius:`${o.borderRadius}px`,mb:1},children:e.jsxs(R,{children:[e.jsx(u,{sx:{fontSize:14},color:"text.primary",gutterBottom:!0,children:r.pageContent}),e.jsx(A,{theme:o.isDarkMode?"ocean":"rjv-default",style:{padding:10,borderRadius:10},src:r.metadata,name:null,quotesOnKeys:!1,enableClipboard:!1,displayDataTypes:!1,collapsed:!0})]})},x))]})}),e.jsxs(S,{children:[t.goToRetrievalQuery&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",marginLeft:"15px",marginRight:"15px"},children:[e.jsx(l,{variant:"contained",fullWidth:!0,sx:{borderRadius:2,height:"100%",backgroundImage:"linear-gradient(to right, #3f5efb, #fc466b)","&:hover":{backgroundImage:"linear-gradient(to right, #2b4efb, #fe2752)"},mb:2},startIcon:e.jsx(I,{}),onClick:p,children:"Test Retrieval"}),e.jsx(l,{fullWidth:!0,onClick:i,children:"Close"})]}),!t.goToRetrievalQuery&&e.jsx(l,{onClick:i,children:"Close"})]})]}):null;return T.createPortal(h,m)};E.propTypes={show:d.bool,dialogProps:d.object,onCancel:d.func,onGoToRetrievalQuery:d.func};export{E as U};
