import{r as s,m as V,X as ye,u as we,ae as pe,b as je,af as ne,j as e,ag as Ne,ah as ve,ai as Ce}from"./index-B1SopS7p.js";import{S as Ee}from"./folder-tWfgBi6i.js";import{S as B}from"./execute-C-yj1Gio.js";import{S as Se}from"./help-C01WnYKy.js";import{m as Ie}from"./proxy-CeMnCUct.js";import{A as ie}from"./arrow-right-BGdoQViA.js";import{T as Le}from"./trash-2-CqyRxcpu.js";const Re=t=>s.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.80443 5.60156C7.59109 5.60156 6.60749 6.58517 6.60749 7.79851C6.60749 9.01185 7.59109 9.99545 8.80443 9.99545C10.0178 9.99545 11.0014 9.01185 11.0014 7.79851C11.0014 6.58517 10.0178 5.60156 8.80443 5.60156ZM5.10749 7.79851C5.10749 5.75674 6.76267 4.10156 8.80443 4.10156C10.8462 4.10156 12.5014 5.75674 12.5014 7.79851C12.5014 9.84027 10.8462 11.4955 8.80443 11.4955C6.76267 11.4955 5.10749 9.84027 5.10749 7.79851ZM4.86252 15.3208C4.08769 16.0881 3.70377 17.0608 3.51705 17.8611C3.48384 18.0034 3.5211 18.1175 3.60712 18.2112C3.70161 18.3141 3.86659 18.3987 4.07591 18.3987H13.4249C13.6343 18.3987 13.7992 18.3141 13.8937 18.2112C13.9797 18.1175 14.017 18.0034 13.9838 17.8611C13.7971 17.0608 13.4132 16.0881 12.6383 15.3208C11.8821 14.572 10.6899 13.955 8.75042 13.955C6.81096 13.955 5.61877 14.572 4.86252 15.3208ZM3.8071 14.2549C4.87163 13.2009 6.45602 12.455 8.75042 12.455C11.0448 12.455 12.6292 13.2009 13.6937 14.2549C14.7397 15.2906 15.2207 16.5607 15.4446 17.5202C15.7658 18.8971 14.6071 19.8987 13.4249 19.8987H4.07591C2.89369 19.8987 1.73504 18.8971 2.05628 17.5202C2.28015 16.5607 2.76117 15.2906 3.8071 14.2549ZM15.3042 11.4955C14.4702 11.4955 13.7006 11.2193 13.0821 10.7533C13.3742 10.3314 13.6054 9.86419 13.7632 9.36432C14.1597 9.75463 14.7039 9.99545 15.3042 9.99545C16.5176 9.99545 17.5012 9.01185 17.5012 7.79851C17.5012 6.58517 16.5176 5.60156 15.3042 5.60156C14.7039 5.60156 14.1597 5.84239 13.7632 6.23271C13.6054 5.73284 13.3741 5.26561 13.082 4.84371C13.7006 4.37777 14.4702 4.10156 15.3042 4.10156C17.346 4.10156 19.0012 5.75674 19.0012 7.79851C19.0012 9.84027 17.346 11.4955 15.3042 11.4955ZM19.9248 19.8987H16.3901C16.7014 19.4736 16.9159 18.969 16.9827 18.3987H19.9248C20.1341 18.3987 20.2991 18.3141 20.3936 18.2112C20.4796 18.1175 20.5169 18.0034 20.4837 17.861C20.2969 17.0607 19.913 16.088 19.1382 15.3208C18.4047 14.5945 17.261 13.9921 15.4231 13.9566C15.2232 13.6945 14.9995 13.437 14.7491 13.1891C14.5144 12.9566 14.262 12.7384 13.9916 12.5362C14.3853 12.4831 14.8044 12.4549 15.2503 12.4549C17.5447 12.4549 19.1291 13.2008 20.1936 14.2549C21.2395 15.2906 21.7206 16.5607 21.9444 17.5202C22.2657 18.8971 21.107 19.8987 19.9248 19.8987Z",fill:"currentColor"})),Ue=t=>s.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",...t},s.createElement("path",{d:"M14.375 5.75L8.125 12L14.375 18.25",stroke:"#344054",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),Pe=t=>s.createElement("svg",{id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 486.988 486.988",style:{enableBackground:"new 0 0 486.988 486.988"},xmlSpace:"preserve",width:"1em",height:"1em",...t},s.createElement("g",null,s.createElement("g",null,s.createElement("path",{d:"M16.822,284.968h39.667v158.667c0,9.35,7.65,17,17,17h116.167c9.35,0,17-7.65,17-17V327.468h70.833v116.167 c0,9.35,7.65,17,17,17h110.5c9.35,0,17-7.65,17-17V284.968h48.167c6.8,0,13.033-4.25,15.583-10.483 c2.55-6.233,1.133-13.6-3.683-18.417L260.489,31.385c-6.517-6.517-17.283-6.8-23.8-0.283L5.206,255.785 c-5.1,4.817-6.517,12.183-3.967,18.7C3.789,281.001,10.022,284.968,16.822,284.968z M248.022,67.368l181.333,183.6h-24.367 c-9.35,0-17,7.65-17,17v158.667h-76.5V310.468c0-9.35-7.65-17-17-17H189.656c-9.35,0-17,7.65-17,17v116.167H90.489V267.968 c0-9.35-7.65-17-17-17H58.756L248.022,67.368z"}))),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null),s.createElement("g",null));/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Te=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ae=V("chevron-down",Te);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Me=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Fe=V("chevron-up",Me);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Be=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],He=V("file-text",Be);function w(...t){return t.filter(Boolean).join(" ")}const R="subpixel-antialiased [text-rendering:optimizeLegibility]",de={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"brightBlack",91:"brightRed",92:"brightGreen",93:"brightYellow",94:"brightBlue",95:"brightMagenta",96:"brightCyan",97:"brightWhite"};function $e(t){switch(t){case"black":return"text-slate-700 dark:text-slate-300";case"red":return"text-red-700 dark:text-red-300";case"green":return"text-emerald-700 dark:text-emerald-300";case"yellow":return"text-amber-700 dark:text-amber-300";case"blue":return"text-blue-700 dark:text-blue-300";case"magenta":return"text-fuchsia-700 dark:text-fuchsia-300";case"cyan":return"text-cyan-700 dark:text-cyan-300";case"white":return"text-slate-700 dark:text-slate-100";case"brightBlack":return"text-slate-500 dark:text-slate-400";case"brightRed":return"text-rose-700 dark:text-rose-300";case"brightGreen":return"text-lime-700 dark:text-lime-300";case"brightYellow":return"text-yellow-700 dark:text-yellow-300";case"brightBlue":return"text-sky-700 dark:text-sky-300";case"brightMagenta":return"text-pink-700 dark:text-pink-300";case"brightCyan":return"text-teal-700 dark:text-teal-300";case"brightWhite":return"text-slate-800 dark:text-white";default:return"text-slate-700 dark:text-slate-200"}}function Ve(t){var j,N;if(!t)return[];const b=/\x1b\[([0-9;]*)m/g,E=[];let i=0,r=!1,f=null;const S=c=>{c&&E.push({text:c,bold:r,color:f})};for(const c of t.matchAll(b)){const I=c[0],v=(j=c[1])!=null?j:"",d=(N=c.index)!=null?N:0;d>i&&S(t.slice(i,d));const x=v.length>0?v.split(";").map(p=>Number.parseInt(p,10)):[0];for(let p=0;p<x.length;p+=1){const m=x[p];if(!Number.isNaN(m)){if(m===0){r=!1,f=null;continue}if(m===1){r=!0;continue}if(m===22){r=!1;continue}if(m===39){f=null;continue}if(m in de){f=de[m];continue}}}i=d+I.length}return i<t.length&&S(t.slice(i)),E}function $(t){return e.jsx("div",{className:w(R,"relative overflow-hidden rounded-2xl border p-5 shadow-sm","border-gray-300/90 bg-white","dark:border-gray-700 dark:bg-slate-900","lg:p-6"),children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[15px] font-semibold tracking-[0.01em] text-gray-950 dark:text-white",children:t.title}),t.subtitle?e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300",children:t.subtitle}):null]}),t.right?e.jsx("div",{className:"shrink-0",children:t.right}):null]}),t.children]})})}function A(t){return e.jsxs("div",{className:w(R,"rounded-2xl border p-4 shadow-sm","border-gray-300/80 bg-white","dark:border-gray-700 dark:bg-slate-900"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border border-gray-300/80 bg-gray-100 text-gray-800 dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200",children:t.icon}),e.jsx("div",{className:"text-sm font-semibold text-gray-950 dark:text-white",children:t.title})]}),e.jsx("div",{className:"mt-4 text-sm leading-6 text-gray-700 dark:text-gray-300",children:t.children})]})}function H(t){return e.jsxs("div",{className:w(R,"inline-flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-semibold","border-gray-300/80 bg-white text-gray-700","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:t.label}),e.jsx("span",{className:"text-gray-950 dark:text-white",children:t.value})]})}function _e(t){return e.jsx("button",{type:"button",onClick:t.onClick,disabled:t.disabled,title:t.title,className:w("inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-sm font-semibold transition","text-white shadow-sm","bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600","hover:brightness-[0.98] hover:shadow-md","disabled:cursor-not-allowed disabled:opacity-60",t.className),children:t.children})}function L(t){return e.jsx("button",{type:"button",onClick:t.onClick,disabled:t.disabled,title:t.title,className:w(R,"inline-flex items-center justify-center gap-2 rounded-xl border px-4 py-2 text-sm font-semibold transition","border-gray-300/80 bg-white text-gray-800 shadow-sm hover:border-gray-400 hover:shadow-md","dark:border-gray-700 dark:bg-slate-900 dark:text-white dark:hover:border-gray-600","disabled:cursor-not-allowed disabled:opacity-60",t.className),children:t.children})}function Ge(t){var i;const b=String((i=t.status)!=null?i:"UNKNOWN").toUpperCase(),E=b==="SUCCESS"?"border-green-200/80 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-950/30 dark:text-green-200":b==="FAILURE"?"border-red-200/80 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200":"border-amber-200/80 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200";return e.jsx("span",{className:w("inline-flex items-center rounded-xl border px-3 py-1 text-xs font-semibold",E),children:b})}function Ze(t){var i,r,f,S,j,N;const b=s.useMemo(()=>Ve(t.taskLog),[t.taskLog]),E=s.useMemo(()=>t.taskLog?t.taskLog.split(/\r?\n/).length:0,[t.taskLog]);return e.jsxs($,{title:"Task log",subtitle:t.logTask?`${t.logTask.operation==="install"?"Install/Update":"Uninstall"} output for ${(i=t.logTask.pluginName)!=null?i:"plugin"}`:"Live output from the current plugin operation.",right:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(r=t.logTask)!=null&&r.status?e.jsx(Ge,{status:t.logTask.status}):null,e.jsx(L,{onClick:t.onToggleAutoScroll,className:"px-3 py-2 text-xs",title:"Toggle auto-scroll",children:t.autoScroll?"Auto-scroll on":"Auto-scroll off"}),e.jsx(L,{onClick:t.onToggleExpanded,className:"px-3 py-2 text-xs",title:t.expanded?"Collapse log":"Expand log",children:t.expanded?e.jsxs(e.Fragment,{children:["Collapse",e.jsx(Fe,{className:"h-4 w-4"})]}):e.jsxs(e.Fragment,{children:["Expand",e.jsx(Ae,{className:"h-4 w-4"})]})}),e.jsxs(L,{onClick:t.onClear,className:"px-3 py-2 text-xs",title:"Clear task log",children:[e.jsx(Le,{className:"h-4 w-4"}),"Clear"]})]}),children:[(f=t.logTask)!=null&&f.error?e.jsx("div",{className:"mb-3 rounded-xl border border-red-200/80 bg-red-50 p-3 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:t.logTask.error}):null,t.taskLogError?e.jsx("div",{className:"mb-3 rounded-xl border border-red-200/80 bg-red-50 p-3 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:t.taskLogError}):null,e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-300/80 shadow-sm dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-300/80 bg-gradient-to-r from-slate-50 via-white to-slate-50 px-4 py-3 dark:border-gray-700 dark:from-slate-800 dark:via-slate-900 dark:to-slate-800",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl border border-gray-300/80 bg-white text-gray-700 shadow-sm dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200",children:e.jsx(He,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-gray-950 dark:text-white",children:(S=t.logTask)!=null&&S.taskId?`Task ${t.logTask.taskId}`:"Task output"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("span",{children:(j=t.logTask)!=null&&j.completed?"Completed output":"Streaming output"}),e.jsxs("span",{children:[E," lines"]})]})]})]}),(N=t.logTask)!=null&&N.completed?e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Completed"}):e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Live"})]}),e.jsx("div",{ref:t.logContainerRef,className:w("overflow-auto px-4 py-4",t.expanded?"max-h-[560px]":"max-h-[320px]","bg-gradient-to-b from-slate-50 via-white to-slate-50 dark:from-slate-950 dark:via-slate-900 dark:to-slate-950"),children:b.length>0?e.jsx("pre",{className:w(R,"font-mono text-xs leading-6 whitespace-pre-wrap break-words","text-slate-700 dark:text-slate-200"),children:b.map((c,I)=>e.jsx("span",{className:w($e(c.color),c.bold?"font-semibold":""),children:c.text},`${I}-${c.text.length}`))}):e.jsx("div",{className:"rounded-xl border border-dashed border-gray-300/80 bg-white/70 px-4 py-5 text-sm text-gray-500 dark:border-gray-700 dark:bg-slate-900/60 dark:text-gray-400",children:"Waiting for log output..."})})]})]})}function Ke(){var Q,ee,te,re,ae;const{pipName:t}=ye(),b=we(),i=(Q=pe().state)!=null?Q:null,[r,f]=s.useState((ee=i==null?void 0:i.plugin)!=null?ee:null),[S,j]=s.useState(!(i!=null&&i.plugin)),[N,c]=s.useState(null),[I,v]=s.useState(null),[d,x]=s.useState(null),[p,m]=s.useState(""),[_,U]=s.useState(null),[M,oe]=s.useState(!0),[ce,F]=s.useState(!1),k=s.useRef(!0),P=s.useRef(0),G=s.useRef(null),{tasks:Z,installing:z,removing:O,startInstall:ue,finishInstall:ge,startRemove:xe,finishRemove:me,registerTask:W,waitForTask:D}=je(),o=s.useMemo(()=>Z.find(a=>a.pipName===t),[Z,t]),q=o==null?void 0:o.step;s.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]),s.useEffect(()=>{t&&(c(null),v(null),i!=null&&i.plugin||j(!0),ne(t).then(a=>{k.current&&f(a)}).catch(a=>{console.error(a),k.current&&c("Error loading plugin details")}).finally(()=>{k.current&&j(!1)}))},[t,i==null?void 0:i.plugin]),s.useEffect(()=>{o&&x(a=>{var l,n,u,y,C,g,h;return a&&a.taskId===o.taskId?{...a,status:String((l=o.status)!=null?l:a.status),error:(u=(n=o.error)!=null?n:a.error)!=null?u:null,completed:["SUCCESS","FAILURE"].includes(String((y=o.status)!=null?y:""))}:{taskId:o.taskId,operation:o.operation==="uninstall"?"uninstall":"install",status:String((C=o.status)!=null?C:"PENDING"),completed:["SUCCESS","FAILURE"].includes(String((g=o.status)!=null?g:"")),pluginName:r==null?void 0:r.name,error:(h=o.error)!=null?h:null}})},[o,r==null?void 0:r.name]),s.useEffect(()=>{var C;const a=d==null?void 0:d.taskId;if(!a)return;let l=!1;const n=async()=>{try{const g=await Ne(a,P.current);if(l)return;g.text&&m(h=>h+g.text),P.current=g.nextOffset,U(null),x(h=>{var se,le;return h&&h.taskId===a?{...h,status:String((se=g.status)!=null?se:h.status),completed:!!g.completed||["SUCCESS","FAILURE"].includes(String((le=g.status)!=null?le:h.status))}:h})}catch(g){if(l)return;U((g==null?void 0:g.message)||"Failed to load task log")}};if(n(),!(!d.completed&&!["SUCCESS","FAILURE"].includes(String((C=d.status)!=null?C:""))))return()=>{l=!0};const y=window.setInterval(()=>{n()},2e3);return()=>{l=!0,window.clearInterval(y)}},[d==null?void 0:d.taskId,d==null?void 0:d.status,d==null?void 0:d.completed]),s.useEffect(()=>{if(!M)return;const a=G.current;if(!a)return;a.scrollHeight-a.scrollTop-a.clientHeight<60&&(a.scrollTop=a.scrollHeight)},[p,M]);const X=s.useMemo(()=>t?z.has(t):!1,[z,t]),Y=s.useMemo(()=>t?O.has(t):!1,[O,t]),T=!!(r!=null&&r.installed&&(r!=null&&r.toUpdate));async function K(){if(!t)return;const a=await ne(t);k.current&&f(a)}function J(a,l){x({taskId:a,operation:l,status:"PENDING",completed:!1,pluginName:r==null?void 0:r.name,error:null}),m(""),U(null),F(!0),P.current=0}function he(){x(null),m(""),U(null),F(!1),P.current=0}const be=async()=>{if(!t)return;const a=!!(r!=null&&r.installed&&(r!=null&&r.toUpdate));c(null),v(null),ue(t);try{const l=await ve(t);J(l.taskId,"install"),W({taskId:l.taskId,pipName:t,pluginName:r==null?void 0:r.name,operation:"install",initialStatus:l.status});const n=await D(l.taskId);if(x(u=>{var y,C;return u&&u.taskId===l.taskId?{...u,status:String((y=n.status)!=null?y:u.status),completed:!0,error:n.status==="FAILURE"?String((C=n.error)!=null?C:"Plugin operation failed"):null}:u}),n.status==="FAILURE"){const u=typeof n.error=="string"&&n.error.trim().length>0?n.error:"Plugin operation failed";throw new Error(u)}if(await K(),!k.current)return;v(a?"Plugin updated successfully":"Plugin installed successfully")}catch(l){if(console.error(l),ge(t),x(n=>n&&{...n,status:"FAILURE",completed:!0,error:l instanceof Error?l.message:"Error installing/updating the plugin"}),!k.current)return;c(l instanceof Error?l.message:"Error installing/updating the plugin")}},fe=async()=>{if(t){c(null),v(null),xe(t);try{const a=await Ce(t);J(a.taskId,"uninstall"),W({taskId:a.taskId,pipName:t,pluginName:r==null?void 0:r.name,operation:"uninstall",initialStatus:a.status});const l=await D(a.taskId);if(x(n=>{var u,y;return n&&n.taskId===a.taskId?{...n,status:String((u=l.status)!=null?u:n.status),completed:!0,error:l.status==="FAILURE"?String((y=l.error)!=null?y:"Plugin operation failed"):null}:n}),l.status==="FAILURE"){const n=typeof l.error=="string"&&l.error.trim().length>0?l.error:"Plugin operation failed";throw new Error(n)}if(await K(),!k.current)return;v("Plugin removed successfully")}catch(a){if(console.error(a),me(t),x(l=>l&&{...l,status:"FAILURE",completed:!0,error:a instanceof Error?a.message:"Error uninstalling the plugin"}),!k.current)return;c(a instanceof Error?a.message:"Error uninstalling the plugin")}}},ke=(()=>{var l,n;const a=(n=(l=r==null?void 0:r.compatibleReleases)==null?void 0:l[r.latestRelease])==null?void 0:n.upload_time;return a?a.split("T")[0]:"N/A"})();return S||!r?e.jsx("div",{className:"mx-auto max-w-6xl px-4 py-6",children:e.jsx($,{title:"Plugin",subtitle:"Loading plugin details...",children:e.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"h-8 w-8 rounded-full border-2 border-gray-300 dark:border-gray-700"}),e.jsx("div",{className:"absolute inset-0 animate-spin rounded-full border-2 border-transparent border-t-gray-700 dark:border-t-gray-200"})]}),e.jsx("p",{className:"mt-3 text-sm text-gray-600 dark:text-gray-300",children:"Loading plugin..."})]})})})}):e.jsxs(Ie.div,{className:"mx-auto max-w-6xl space-y-6 px-4 py-6",initial:{y:"100vh",opacity:0},animate:{y:0,opacity:1},exit:{y:"100vh",opacity:0},transition:{duration:.5,ease:"easeOut"},children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(L,{onClick:()=>b(-1),className:"h-11 w-11 px-0",title:"Go back",children:e.jsx(Ue,{className:"h-5 w-5"})})}),e.jsx($,{title:r.name,subtitle:`Latest release: v${r.latestRelease}`,right:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(_e,{onClick:be,disabled:X||r.installed&&!T,title:T?"Update plugin":"Install plugin",children:X?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4 animate-spin"}),T?"Updating…":"Installing…"]}):r.installed?T?e.jsxs(e.Fragment,{children:["Update",e.jsx(ie,{className:"h-4 w-4"})]}):"Installed":e.jsxs(e.Fragment,{children:["Install",e.jsx(ie,{className:"h-4 w-4"})]})}),e.jsx(L,{onClick:fe,disabled:Y||!r.installed,title:"Remove plugin",className:w(r.installed?"border-red-300/80 text-red-700 hover:border-red-400 dark:border-red-900/50 dark:text-red-300 dark:hover:border-red-800":""),children:Y?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4 animate-spin"}),"Removing…"]}):"Remove"})]}),children:e.jsxs("div",{className:"flex flex-col gap-6 xl:flex-row",children:[e.jsx("div",{className:"flex shrink-0 justify-center xl:block",children:r.fullLogo?e.jsx("img",{src:r.fullLogo,alt:`${r.name} logo`,className:"h-40 w-40 rounded-2xl border border-gray-300/80 bg-white object-contain p-3 shadow-sm dark:border-gray-700 dark:bg-slate-900"}):e.jsx("div",{className:"h-40 w-40 rounded-2xl border border-gray-300/80 bg-gray-100 shadow-sm dark:border-gray-700 dark:bg-slate-800"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(H,{label:"Installed",value:r.installed?`v${(te=r.pipVersion)!=null?te:"-"}`:"No"}),e.jsx(H,{label:"Latest",value:`v${r.latestRelease}`}),e.jsx(H,{label:"Published",value:ke})]}),o?e.jsxs("div",{className:"mt-4 rounded-xl border border-gray-300/80 bg-gray-50/80 p-4 text-sm text-gray-700 dark:border-gray-700 dark:bg-slate-800/70 dark:text-gray-300",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-gray-950 dark:text-white",children:[e.jsx(B,{className:"h-4 w-4 animate-spin"}),"Active task: ",o.operation==="install"?"Install/Update":"Uninstall"]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:["Status: ",o.status]}),q?e.jsx("div",{className:"mt-1 break-all text-xs text-gray-600 dark:text-gray-300",children:q}):null,o.error?e.jsx("div",{className:"mt-2 break-all text-xs text-red-600 dark:text-red-300",children:o.error}):null]}):null,N?e.jsx("div",{className:"mt-4 rounded-xl border border-red-200/80 bg-red-50 p-4 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:N}):null,I?e.jsx("div",{className:"mt-4 rounded-xl border border-green-200/80 bg-green-50 p-4 text-sm leading-6 text-green-700 dark:border-green-900/50 dark:bg-green-950/30 dark:text-green-200",children:I}):null,e.jsxs("div",{className:"mt-5 rounded-xl border border-gray-300/80 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-slate-900",children:[e.jsx("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400",children:"Summary"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-gray-700 dark:text-gray-300",children:(re=r.summary)!=null?re:"General"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(A,{icon:e.jsx(Ee,{className:"h-5 w-5"}),title:"Pip name",children:e.jsx("div",{className:"break-all font-medium text-gray-950 dark:text-white",children:r.pipName})}),e.jsx(A,{icon:e.jsx(Re,{className:"h-5 w-5"}),title:"Author",children:r.author?e.jsx("div",{className:"flex flex-wrap gap-2",children:r.author.split(",").map((a,l)=>e.jsx("span",{className:"inline-block max-w-full truncate rounded-full border border-gray-300/80 bg-gray-100 px-3 py-1 text-xs font-medium text-gray-800 dark:border-gray-700 dark:bg-slate-800 dark:text-white",title:a.trim(),children:a.trim()},l))}):"Unknown"}),e.jsx(A,{icon:e.jsx(Se,{className:"h-5 w-5"}),title:"Summary",children:(ae=r.summary)!=null?ae:"General"}),e.jsx(A,{icon:e.jsx(Pe,{className:"h-5 w-5"}),title:"Home page",children:r.homePage?e.jsx("a",{href:r.homePage,target:"_blank",rel:"noopener noreferrer",className:"break-words text-gray-800 underline dark:text-white",children:r.homePage}):"N/A"})]}),d||p||_?e.jsx(Ze,{logTask:d,taskLog:p,taskLogError:_,autoScroll:M,expanded:ce,onToggleAutoScroll:()=>oe(a=>!a),onClear:he,onToggleExpanded:()=>F(a=>!a),logContainerRef:G}):null]})}export{Ke as default};
