import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{a as t,at as n,l as r,ot as i,pt as a,u as o}from"./element-plus-vendor-BF9PNysW.js";import{A as s,D as c,I as l,N as u,O as d,P as f,Pt as p,Tt as ee,Xt as m,et as h,gt as g,ht as _,k as v}from"./vue-vendor-DMUmTARL.js";import{K as y,Qt as b}from"./icons-vendor-Db5MGAkr.js";import{m as x}from"./index-kSn5YXd0.js";import{t as S}from"./_plugin-vue_export-helper-CWyGVBf-.js";var te={class:`mb-4`},ne={class:`mb-3 flex items-center gap-2 text-sm font-medium text-primary`},re={class:`space-y-2`},C={class:`text-xs text-regular`},w={class:`flex flex-wrap items-center gap-2`},T={class:`space-y-2`},E={class:`flex flex-wrap items-start gap-2`},D={key:0,class:`text-xs text-placeholder`},O={key:1,class:`grid grid-cols-1 gap-3 rounded-xl border border-border-light p-4 sm:grid-cols-2`},k={class:`docker-meta-row`},A=[`title`],j={class:`docker-meta-row`},M={class:`docker-meta-value font-mono text-xs`},N={class:`docker-meta-row`},P={class:`docker-meta-value font-mono text-xs`},F={class:`docker-meta-row`},I={key:0,class:`docker-meta-row`},L={class:`docker-meta-row`},ie={class:`docker-meta-value text-xs text-regular`},R={class:`docker-meta-row`},z={class:`docker-meta-value text-xs text-regular`},B={class:`docker-meta-row`},V={class:`docker-meta-value text-xs text-regular`},H={key:2,class:`h-24 rounded-xl border border-border-light bg-page`},U=`-v /var/run/docker.sock:/var/run/docker.sock:ro`,W=`volumes:
  - /var/run/docker.sock:/var/run/docker.sock:ro`,G=l({__name:`RuntimeDockerMeta`,props:{dockerMeta:{},loading:{type:Boolean}},setup(e){let l=ee(`run`),S=e=>{x(e,`已复制建议命令`)},G=e=>e?e.length>12?e.substring(0,12):e:`-`,K=(e,t)=>e?{running:`运行中`,paused:`已暂停`,restarting:`重启中`,removing:`清理中`,exited:`已退出`,dead:`已停止`,created:`已创建`}[e]||e:t?`运行中`:`未知`,q=e=>{switch(e){case`running`:return`success`;case`paused`:return`warning`;case`restarting`:return`warning`;case`exited`:case`dead`:return`danger`;case`created`:return`info`;default:return`info`}},J=e=>e&&{healthy:`健康`,unhealthy:`不健康`,starting:`启动中`,none:`未配置`}[e]||e||`-`,Y=e=>{switch(e){case`healthy`:return`success`;case`unhealthy`:return`danger`;case`starting`:return`warning`;default:return`info`}},X=e=>{if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>e.toString().padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`};return(ee,x)=>{let Z=i,Q=r,ae=o,oe=a,$=n,se=t;return h(),s(`div`,te,[c(`h4`,ne,[f(p(y),{class:`h-4 w-4 text-blue-500`}),x[3]||=u(` Docker 容器元数据 `,-1)]),!e.loading&&e.dockerMeta&&!e.dockerMeta.available?(h(),d(oe,{key:0,type:`warning`,"show-icon":``,closable:!1,title:`未挂载 docker.sock，无法获取容器元数据`},{default:_(()=>[c(`div`,re,[c(`p`,C,m(e.dockerMeta.hint||`请按你的部署方式（docker run / docker compose）挂载只读 docker.sock 后重建容器，以启用元数据反查。`),1),f(ae,{modelValue:l.value,"onUpdate:modelValue":x[2]||=e=>l.value=e,class:`sock-mount-tabs`},{default:_(()=>[f(Q,{label:`docker run`,name:`run`},{default:_(()=>[c(`div`,w,[c(`code`,{class:`break-all rounded bg-zf-hover px-2 py-1 text-xs text-regular`,style:{"word-break":`break-all`}},m(U)),f(Z,{size:`small`,link:``,type:`primary`,onClick:x[0]||=e=>S(U)},{default:_(()=>[f(p(b),{class:`mr-1 h-4 w-4`}),x[4]||=u(` 复制 `,-1)]),_:1})]),x[5]||=c(`p`,{class:`text-xs text-placeholder`},`修改完删除原容器并重新运行后生效。`,-1)]),_:1}),f(Q,{label:`docker compose`,name:`compose`},{default:_(()=>[c(`div`,T,[c(`div`,E,[c(`pre`,{class:`sock-mount-pre rounded bg-zf-hover px-2 py-1 text-xs text-regular`},m(W)),f(Z,{size:`small`,link:``,type:`primary`,onClick:x[1]||=e=>S(W)},{default:_(()=>[f(p(b),{class:`mr-1 h-4 w-4`}),x[6]||=u(` 复制 `,-1)]),_:1})]),x[7]||=c(`p`,{class:`text-xs text-placeholder`},`修改完重建容器后生效。`,-1)])]),_:1})]),_:1},8,[`modelValue`]),e.dockerMeta.error?(h(),s(`p`,D,` 详细错误: `+m(e.dockerMeta.error),1)):v(``,!0)])]),_:1})):!e.loading&&e.dockerMeta&&e.dockerMeta.available?(h(),s(`div`,O,[c(`div`,k,[x[8]||=c(`span`,{class:`docker-meta-label`},`镜像`,-1),c(`code`,{class:`docker-meta-value font-mono text-xs`,title:e.dockerMeta.image||``},m(e.dockerMeta.image||`-`),9,A)]),c(`div`,j,[x[9]||=c(`span`,{class:`docker-meta-label`},`容器名`,-1),c(`code`,M,m(e.dockerMeta.containerName||`-`),1)]),c(`div`,N,[x[10]||=c(`span`,{class:`docker-meta-label`},`容器 ID`,-1),c(`code`,P,m(G(e.dockerMeta.containerId)),1)]),c(`div`,F,[x[11]||=c(`span`,{class:`docker-meta-label`},`状态`,-1),f($,{type:q(e.dockerMeta.status),size:`small`},{default:_(()=>[u(m(K(e.dockerMeta.status,e.dockerMeta.running)),1)]),_:1},8,[`type`])]),e.dockerMeta.healthStatus?(h(),s(`div`,I,[x[12]||=c(`span`,{class:`docker-meta-label`},`健康检查`,-1),f($,{type:Y(e.dockerMeta.healthStatus),size:`small`},{default:_(()=>[u(m(J(e.dockerMeta.healthStatus)),1)]),_:1},8,[`type`])])):v(``,!0),c(`div`,L,[x[13]||=c(`span`,{class:`docker-meta-label`},`重启策略`,-1),c(`span`,ie,m(e.dockerMeta.restartPolicy||`-`),1)]),c(`div`,R,[x[14]||=c(`span`,{class:`docker-meta-label`},`创建时间`,-1),c(`span`,z,m(X(e.dockerMeta.created)),1)]),c(`div`,B,[x[15]||=c(`span`,{class:`docker-meta-label`},`启动时间`,-1),c(`span`,V,m(X(e.dockerMeta.startedAt)),1)])])):e.loading?g((h(),s(`div`,H,null,512)),[[se,e.loading]]):v(``,!0)])}}}),K=e({default:()=>q}),q=S(G,[[`__scopeId`,`data-v-c30618ba`]]);export{K as n,q as t};