import{c as r,r as j,j as e,ab as n,B as g}from"./main-pzSpmpV2.js";import{C as u}from"./card-DyOnRGQP.js";import{L as w}from"./label-DdsMBmyI.js";import{C as t,A as C,a as M}from"./alert-B_Eu6yIO.js";import{P as I,S as L}from"./scroll-area--L0sX2-B.js";import{B as A}from"./badge-DNC7XzqG.js";import{D as F,a as D,b as P,c as T,d as S}from"./dialog-CwPbkvSr.js";import{L as E}from"./loader-2-fAceJRLq.js";/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const U=r("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B=r("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i=r("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Q=r("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const H=r("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const V=r("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function R({open:f,onOpenChange:x,isRunning:l,importSuccess:d,error:o,elapsedTime:v,progress:m,stats:s,logs:c}){const h=j.useRef(null);j.useEffect(()=>{var a;(a=h.current)==null||a.scrollIntoView({behavior:"smooth"})},[c]);const y=a=>{const b=Math.floor(a/60),k=a%60;return`${b}:${k.toString().padStart(2,"0")}`},N=a=>{switch(a){case"success":return e.jsx(t,{className:"w-4 h-4 text-green-600"});case"error":return e.jsx(n,{className:"w-4 h-4 text-red-600"});default:return e.jsx(i,{className:"w-4 h-4 text-blue-600"})}},p=()=>s.links.imported+s.links.updated+s.links.skipped;return e.jsx(F,{open:f,onOpenChange:a=>{l||x(a)},children:e.jsxs(D,{className:"max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs(P,{children:[e.jsx(T,{className:"flex items-center gap-2",children:l?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"w-5 h-5 animate-spin text-blue-600"}),"Import in Progress"]}):d?e.jsxs(e.Fragment,{children:[e.jsx(t,{className:"w-5 h-5 text-green-600"}),"Import Complete"]}):e.jsxs(e.Fragment,{children:[e.jsx(n,{className:"w-5 h-5 text-red-600"}),"Import Failed"]})}),e.jsx(S,{children:l?"Migrating your ThirstyAffiliates data...":d?"All data has been successfully imported":"An error occurred during import"})]}),e.jsxs("div",{className:"space-y-6 overflow-y-auto flex-1 pr-2",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Elapsed Time"}),e.jsxs("div",{className:"flex items-center gap-2 text-lg font-bold text-gray-900",children:[e.jsx(U,{className:"w-5 h-5"}),y(v)]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"font-medium",children:"Overall Progress"}),e.jsxs("span",{className:"text-gray-600",children:[Math.round(m),"%"]})]}),e.jsx(I,{value:m,className:"h-3"}),e.jsxs("div",{className:"flex justify-between text-xs text-gray-600",children:[e.jsxs("span",{children:[p()," of ",s.links.total," links processed"]}),s.links.total>0&&e.jsxs("span",{children:[s.links.total-p()," remaining"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-sm",children:"Links"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200",children:[e.jsx(V,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-green-700",children:s.links.imported}),e.jsx("div",{className:"text-xs text-green-600",children:"Imported"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 rounded-lg border border-blue-200",children:[e.jsx(t,{className:"w-6 h-6 text-blue-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-blue-700",children:s.links.updated}),e.jsx("div",{className:"text-xs text-blue-600",children:"Updated"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx(i,{className:"w-6 h-6 text-gray-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-gray-700",children:s.links.skipped}),e.jsx("div",{className:"text-xs text-gray-600",children:"Skipped"})]})]})]}),s.categories.total>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-semibold text-sm pt-2",children:"Categories"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-purple-50 rounded-lg border border-purple-200",children:[e.jsx(B,{className:"w-6 h-6 text-purple-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-purple-700",children:s.categories.imported}),e.jsx("div",{className:"text-xs text-purple-600",children:"Imported"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 rounded-lg border border-blue-200",children:[e.jsx(t,{className:"w-6 h-6 text-blue-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-blue-700",children:s.categories.updated}),e.jsx("div",{className:"text-xs text-blue-600",children:"Updated"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx(i,{className:"w-6 h-6 text-gray-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-gray-700",children:s.categories.skipped}),e.jsx("div",{className:"text-xs text-gray-600",children:"Skipped"})]})]})]})]}),s.clicks.imported>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-semibold text-sm pt-2",children:"Click Statistics"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200",children:[e.jsx(H,{className:"w-6 h-6 text-green-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-green-700",children:s.clicks.imported}),e.jsx("div",{className:"text-xs text-green-600",children:"Clicks Imported"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx(i,{className:"w-6 h-6 text-gray-600 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-gray-700",children:s.clicks.skipped}),e.jsx("div",{className:"text-xs text-gray-600",children:"Skipped"})]})]})]})]})]}),o&&e.jsxs(C,{variant:"destructive",children:[e.jsx(n,{className:"h-4 w-4"}),e.jsx(M,{children:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(w,{className:"text-base font-medium",children:"Activity Log"}),e.jsxs(A,{variant:"outline",children:[c.length," events"]})]}),e.jsx(u,{className:"border-2",children:e.jsx(L,{className:"h-64 p-4",children:e.jsxs("div",{className:"space-y-2",children:[c.map(a=>e.jsxs("div",{className:"flex items-start gap-3 p-2 hover:bg-gray-50 rounded transition-colors",children:[N(a.type),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm break-words",children:a.message}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a.timestamp})]})]},a.id)),e.jsx("div",{ref:h})]})})})]})]}),!l&&e.jsxs("div",{className:"pt-4 border-t flex gap-2 justify-end",children:[e.jsx(g,{variant:"outline",onClick:()=>x(!1),children:"Close"}),d&&e.jsx(g,{onClick:()=>window.location.reload(),children:"View Links"})]})]})})}export{B as F,i as I,Q as L,H as M,V as U,R as a};
//# sourceMappingURL=import-progress-modal-A7wAkFv1.js.map
