const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PodFileBrowser-Bs6KRfHw.js","assets/vendor-codemirror-C7mXSpXt.js","assets/index-LZWfu62c.js","assets/vendor-icons-Aso0-eeY.js","assets/index-BzYDIT5o.css","assets/use-toast-CkA38LVP.js","assets/index-Z0O8nAcG.js","assets/select-4xU_9B3_.js","assets/index-CYARH0Cq.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/badge-B0F5ZNtn.js"])))=>i.map(i=>d[i]); import{j as e,r as p}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as nt,o as vt,i as Xt,a8 as js,g as Ns}from"./index-LZWfu62c.js";import{C as V,a as F,b as me,c as xe}from"./card-B-RtdR4H.js";import{B as te}from"./badge-B0F5ZNtn.js";import{k as ce}from"./index-Z0O8nAcG.js";import{u as Te}from"./use-toast-CkA38LVP.js";import{S as we,g as fs,f as Ve,h as Ss,s as pt,e as Es,d as It,Y as Ot,P as ws,a as Cs}from"./PodFileBrowser-Bs6KRfHw.js";import{I as y}from"./input-BdDauX3U.js";import{Q as Qt,f as Zt,F as kt,r as es,H as ts,L as ue,N as Ae,E as Ds,A as ss,b as ns,n as Ps,k as Fe,P as oe,aq as As,s as gt,b8 as Ts,aN as os,b9 as mt,T as he,$ as ot,g as Hs,ba as Ms,a4 as as,j as rs,am as Bs,aK as cs,bb as Rs,z as ls,D as et,b2 as Is,h as jt,aM as Os,aL as Ls,G as _s,M as zs,R as at,p as ut,y as bt,d as Lt,J as xt,X as ds,l as is,a as $s,m as Ws,aD as _t,bc as Gs,ar as Vs}from"./vendor-icons-Aso0-eeY.js";import{T as Ie,a as Oe,b as Ne,c as K,d as Le,e as X}from"./table-BPFYQwjr.js";import{L as T}from"./label-u-lNUbKh.js";import{T as tt}from"./textarea-BdtIagjy.js";import{S as $e,a as We,b as st,c as Ge,d as ve}from"./select-4xU_9B3_.js";import{S as Nt}from"./switch-C4PJnJ9I.js";import{R as Fs}from"./ResourceVisualEditor-CXyg-7xn.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function ps(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(c=>(c.type||c.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Be({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:25:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:26:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:27:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function ms({pod:t}){const s=ps(t),o=[{label:"已调度",ts:s.scheduled,color:we.blue},{label:"已初始化",ts:s.initialized,color:we.orange},{label:"容器已就绪",ts:s.containersReady,color:we.green},{label:"容器组已就绪",ts:s.ready,color:we.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,n)=>{const c=o[n-1],d=fs(c?.ts,a.ts);return e.jsxs(p.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50:15",className:"text-[10px] mt-1 font-medium",style:{color:a.ts?a.color:"#475569"},children:a.label}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ve(a.ts):"-"})]}),n{const S=ps(i),l=c===i.name,v=i.node_name||i.node;return e.jsx(V,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>d(l?null:i.name),children:l?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"h-4 w-4"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(i.status)}22`,color:pt(i.status),border:`1px solid ${pt(i.status)}44`},children:i.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${v}`,"_blank"),children:v||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:i.ip||i.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",i.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(S.startTime||i.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(i),children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(i),children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>n(i),children:[e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),l&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:58:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(ms,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:i}),i.containers&&i.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:i.containers.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:64:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:66:29",className:"font-medium text-[var(--dg-text-primary)]",children:g.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:g.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:g.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:27",className:"text-[var(--dg-text-muted)] mt-1",children:g.image}),g.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:71:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:31",children:["CPU: ",g.resources?.requests?.cpu||"0","/",g.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",g.resources?.requests?.memory||"0","/",g.resources?.limits?.memory||"-"]})]})]},A))})]})]})},i.name)})})}function Us({services:t,ingresses:s,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(a.selector).map(([n,c])=>e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:43:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[n,"=",c]},n))})]},a.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ds,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78:21",className:"text-xs text-[var(--dg-text-muted)]",children:a.rules.flatMap(n=>(n.http?.paths||n.paths||[]).map(c=>c.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Ys({events:t,loading:s}){return s==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:15:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:18:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:19:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:21:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:24:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:25:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:26:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:27:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:32:13",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:33:15",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:34:17",variant:"outline",className:o.type==="Warning"?"text-[var(--dg-yellow)] border-[var(--dg-yellow)]/30":"text-[var(--dg-text-muted)] border-[var(--dg-border)]",children:o.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:38:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:39:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md whitespace-normal break-words",children:o.message}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:40:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:41:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:42:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(o.lastTimestamp)})]},a))})]})})}function Js({hpas:t,cronHpas:s,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,c)=>{const d=n.spec?.minReplicas??n.minReplicas??1,i=n.spec?.maxReplicas??n.maxReplicas??10,S=n.spec?.metrics||n.metrics||[],l=n.status?.currentReplicas??n.currentReplicas??0,A=(n.status?.conditions||n.conditions||[]).find(b=>b.type==="AbleToScale")?.status==="True";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[d," → ",i]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:S.map((b,E)=>{const f=b.resource||b.object?.metric?.name||"",w=b.resource?.target?.averageUtilization||b.resource?.target?.averageValue||b.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[f?.name||f,": ",w,b.resource?.target?.averageUtilization?"%":""]},E)})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:l}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:A?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:A?"正常":"异常"})})]},n.name||c)})})]})})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,c)=>{const d=n.spec?.jobs||n.jobs||[],i=n.spec?.timezone||"UTC";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:d.map(S=>S.targetSize||S.targetReplicas||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:d.map(S=>S.schedule||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:i}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||c)})})]})})})]})]})}function Ks({revisions:t,rollbackLoading:s,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,n)=>{const c=a.revision??a.revision_number??a.number??n+1,d=n===0;return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",c]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:d?e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(a.created_at||a.time)}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:d||s!==null,onClick:()=>o(a),children:[s===c?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ps,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},c)})})]})})}function Xs(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:c,onRefresh:d}=t,{toast:i}=Te(),S=nt(),[l,v]=p.useState("pods"),[g,A]=p.useState(null),[b,E]=p.useState(null),[f,w]=p.useState(a?.replicas||0),[_,I]=p.useState(!1),[Z,q]=p.useState([]),[Q,$]=p.useState([]),[U,Y]=p.useState([]),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState([]),ee=a?.ready_replicas??a?.readyReplicas??0,le=a?.replicas??0,ke=ee===le&&le>0;p.useEffect(()=>{l==="services"&&(z("services"),Promise.all([ce.getNamespaceServices(s,o).catch(()=>[]),ce.getNamespaceIngresses(s,o).catch(()=>[])]).then(([r,h])=>{const N=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],O=N(r),B=N(h),J=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},de=O.filter(R=>{const ae=R.spec?.selector||R.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([fe,Se])=>J[fe]===Se)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"",ports:(R.spec?.ports||R.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),Ce=new Set(de.map(R=>R.name)),pe=B.filter(R=>(R.spec?.rules||R.rules||[]).some(fe=>(fe.http?.paths||fe.paths||[]).some(Se=>{const C=Se.backend?.service?.name||Se.backendService||"";return Ce.has(C)}))).map(R=>({name:R.name||R.metadata?.name,className:R.spec?.ingressClassName||R.ingressClass||"-",hosts:(R.spec?.rules||R.rules||[]).map(ae=>ae.host).filter(Boolean),rules:R.spec?.rules||R.rules||[],age:R.age||""}));q(de),$(pe)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a]),p.useEffect(()=>{l==="events"&&(z("events"),ce.getEvents(s,o,void 0).then(r=>{const h=Array.isArray(r)?r:r?.list||r?.items||r?.data||[],N=a?.name||"",O=h.filter(B=>{const J=String(B.object||"");if(!N||!J)return!1;if(J.endsWith(`/${N}`))return!0;const de=J.split("/").pop()||"";return de===N||de.startsWith(`${N}-`)}).map(B=>({type:B.type||"Normal",reason:B.reason||"",message:B.message||"",source:B.object||B.source?.component||B.sourceComponent||"-",firstTimestamp:B.first_time||B.firstTimestamp||B.first_timestamp||"",lastTimestamp:B.last_time||B.lastTimestamp||B.last_timestamp||"",count:B.count||1}));Y(O)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]),p.useEffect(()=>{l==="scale"&&(z("scale"),Promise.all([ce.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([r])=>{const N=(B=>Array.isArray(B)?B:B?.list||B?.items||B?.data||[])(r),O=a?.name||"";H(N.filter(B=>(B.scaleTargetRef?.name||B.targetRef?.name||"")===O)),M([])}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]);const ge=async r=>{const h=r.revision??r.revision_number??r.number;if(await S({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){E(h);try{await ce.rollbackDeployment(s,o,a.name,Number(h)),i({title:"回滚已下发",description:`正在回滚到 #${h}`}),d()}catch(O){i({title:"回滚失败",description:O?.message||String(O),variant:"destructive"})}finally{E(null)}}},m=async()=>{I(!0);try{await ce.scaleDeployment(s,o,a.name,f),i({title:"伸缩已提交",description:`副本数 → ${f}`}),d()}catch(r){i({title:"伸缩失败",description:r?.message||String(r),variant:"destructive"})}finally{I(!1)}},k=[{key:"pods",label:"容器组",icon:Fe,count:n.length},{key:"services",label:"访问方式",icon:Ae,count:Z.length},{key:"events",label:"事件",icon:ss,count:U.length},{key:"scale",label:"容器伸缩",icon:oe},{key:"history",label:"历史版本",icon:As,count:c.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:7",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:189:13",label:"状态",value:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:190:15",style:{background:`${ke?we.green:we.orange}22`,color:ke?we.green:we.orange,border:`1px solid ${ke?we.green:we.orange}44`},children:ke?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:41",className:"font-mono",children:[ee,"/",le]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:198:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:199:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${s}/nodes/${n[0].node_name||n[0].node}`,"_blank"),children:n[0].node_name||n[0].node||"-"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",label:"创建时间",value:Ve(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:209:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(ms,{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:217:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(r=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:219:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${l===r.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>v(r.key),children:[e.jsx(r.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:13",className:"h-4 w-4"}),r.label,r.key==="pods"&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:r.count})]},r.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:233:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_||f<=0,onClick:()=>w(r=>Math.max(0,r-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:13",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:11",type:"number",min:0,value:f,onChange:r=>w(Math.max(0,Number(r.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_,onClick:()=>w(r=>r+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",className:"h-4 w-4"})}),f!==le&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:250:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:_,onClick:m,children:_?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),l==="pods"&&e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:26",...t,expandedPod:g,setExpandedPod:A}),l==="services"&&e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:30",services:Z,ingresses:Q,loading:P,namespace:o}),l==="events"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:28",events:U,loading:P}),l==="scale"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:9",hpas:x,cronHpas:G,loading:P,replicas:le}),l==="history"&&e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:29",revisions:c,rollbackLoading:b,onRollback:ge})]})}async function rt(t,s,o,a){const n=await Es(a);await ce.updateResourceYaml(t,s,"deployments",o,n)}function Xe(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function Re(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState(1),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState([]),[Q,$]=p.useState([]);p.useEffect(()=>{const r=a;if(!r){v(!1);return}A(r),E(r?.spec?.replicas??1),w(Xe(r?.metadata?.labels)),I(Xe(r?.metadata?.annotations)),q(Xe(r?.spec?.selector?.matchLabels)),$(Xe(r?.spec?.template?.metadata?.labels)),v(!1)},[a]);const U=(r,h)=>{w(N=>N.map((O,B)=>B===r?{...O,...h}:O))},Y=()=>w(r=>[...r,{key:"",value:""}]),P=r=>w(h=>h.filter((N,O)=>O!==r)),z=(r,h)=>{I(N=>N.map((O,B)=>B===r?{...O,...h}:O))},x=()=>I(r=>[...r,{key:"",value:""}]),H=r=>I(h=>h.filter((N,O)=>O!==r)),G=(r,h)=>{q(N=>N.map((O,B)=>B===r?{...O,...h}:O))},M=()=>q(r=>[...r,{key:"",value:""}]),ee=r=>q(h=>h.filter((N,O)=>O!==r)),le=(r,h)=>{$(N=>N.map((O,B)=>B===r?{...O,...h}:O))},ke=()=>$(r=>[...r,{key:"",value:""}]),ge=r=>$(h=>h.filter((N,O)=>O!==r)),m=()=>{const r=Re(Z);$(h=>{const N={...Re(h),...r};return Object.entries(N).map(([O,B])=>({key:O,value:B}))}),d({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},k=async()=>{S(!0);try{const r=JSON.parse(JSON.stringify(g));r.spec=r.spec||{},r.spec.replicas=b;const h=Re(f);r.metadata=r.metadata||{},r.metadata.labels=Object.keys(h).length>0?h:void 0;const N=Re(_);r.metadata.annotations=Object.keys(N).length>0?N:void 0;const O=Re(Z);Object.keys(O).length>0&&(r.spec.selector=r.spec.selector||{},r.spec.selector.matchLabels=O);const B=Re(Q);r.spec.template=r.spec.template||{},r.spec.template.metadata=r.spec.template.metadata||{},Object.keys(B).length>0?r.spec.template.metadata.labels=B:delete r.spec.template.metadata.labels,await rt(t,s,o,r),d({title:"基本信息已保存",description:`${o} 更新已提交`}),n(r)}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ts,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:b,onChange:r=>E(Math.max(0,Number(r.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:187:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:f.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Y,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[f.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),f.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:r.key,placeholder:"app",onChange:N=>U(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:r.value,placeholder:"nginx",onChange:N=>U(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>P(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:M,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),Z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),Z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:r.key,placeholder:"app",onChange:N=>G(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:r.value,placeholder:"nginx",onChange:N=>G(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ee(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:m,children:"从 Selector 同步"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ke,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),Q.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),Q.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:r.key,placeholder:"app",onChange:N=>le(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:r.value,placeholder:"nginx",onChange:N=>le(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ge(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:_.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:x,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[_.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),_.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:r.key,placeholder:"deployment.kubernetes.io/revision",onChange:N=>z(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:r.value,placeholder:"1",onChange:N=>z(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>H(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:k,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function zt(t){const s=n=>{if(!n)return null;let c="none";return n.httpGet?c="httpGet":n.tcpSocket?c="tcpSocket":n.exec&&(c="exec"),{type:c,httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",httpHost:n.httpGet?.host||"",tcpPort:n.tcpSocket?.port??"",execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` `):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let c="none";return n.exec?c="exec":n.httpGet?c="httpGet":n.tcpSocket&&(c="tcpSocket"),{type:c,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` `):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function $t(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function ht(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(` `).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function Wt(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(` `).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Gt(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(l=>l.name.trim()).map(l=>{const v={name:l.name};return l.value!=null&&(v.value=l.value),v})),t.ports.length>0&&(s.ports=t.ports.filter(l=>l.containerPort!=="").map(l=>{const v={containerPort:typeof l.containerPort=="number"?l.containerPort:Number(l.containerPort)};return l.name&&(v.name=l.name),l.protocol&&(v.protocol=l.protocol),v}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(l=>l&&l.trim()),c=a&&Object.values(a).some(l=>l&&l.trim());(n||c)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),c&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ht(t.livenessProbe);d&&(s.livenessProbe=d);const i=ht(t.readinessProbe);i&&(s.readinessProbe=i);const S=ht(t.startupProbe);if(S&&(s.startupProbe=S),t.lifecycle){const l={},v=Wt(t.lifecycle.postStart);v&&(l.postStart=v);const g=Wt(t.lifecycle.preStop);g&&(l.preStop=g),Object.keys(l).length>0&&(s.lifecycle=l)}if(t.securityContext){const l=t.securityContext,v={};l.runAsUser!==""&&l.runAsUser!=null&&(v.runAsUser=Number(l.runAsUser)),l.runAsGroup!==""&&l.runAsGroup!=null&&(v.runAsGroup=Number(l.runAsGroup)),l.runAsNonRoot!=null&&(v.runAsNonRoot=l.runAsNonRoot),l.privileged!=null&&(v.privileged=l.privileged),l.readOnlyRootFilesystem!=null&&(v.readOnlyRootFilesystem=l.readOnlyRootFilesystem),l.allowPrivilegeEscalation!=null&&(v.allowPrivilegeEscalation=l.allowPrivilegeEscalation);const g=(l.capabilitiesAdd||[]).filter(Boolean),A=(l.capabilitiesDrop||[]).filter(Boolean);(g.length||A.length)&&(v.capabilities={},g.length&&(v.capabilities.add=g),A.length&&(v.capabilities.drop=A)),Object.keys(v).length>0&&(s.securityContext=v)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(l=>l.name.trim()&&l.mountPath.trim()).map(l=>{const v={name:l.name,mountPath:l.mountPath};return l.subPath&&(v.subPath=l.subPath),l.readOnly&&(v.readOnly=!0),v})),s}function Vt(t){return t.join(` `)}function Ft(t){return t.split(` `).map(s=>s.trim()).filter(Boolean)}function Zs({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:51:11",value:o.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:52:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Vt(o.command),placeholder:`/bin/sh -c`,onChange:n=>s({command:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Vt(o.args),placeholder:`--config=/etc/app.yaml --debug`,onChange:n=>s({args:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:93:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:96:9",className:"space-y-1.5",children:[o.env.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const i=[...o.env];i[c]={...n,name:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const i=[...o.env];i[c]={...n,value:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},c)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:a,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:121:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:124:9",className:"space-y-1.5",children:[o.ports.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const i=[...o.ports];i[c]={...n,name:d.target.value},s({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const i=[...o.ports];i[c]={...n,containerPort:d.target.value},s({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:d=>{const i=[...o.ports];i[c]={...n,protocol:d},s({ports:i})},children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:134:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:o.ports.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},c)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:a,children:[e.jsx(Hs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159:13",value:o.resources.requests?.cpu||"",placeholder:"100m",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165:13",value:o.resources.limits?.cpu||"",placeholder:"500m",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171:13",value:o.resources.requests?.memory||"",placeholder:"128Mi",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177:13",value:o.resources.limits?.memory||"",placeholder:"512Mi",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:a,children:[e.jsx(Ms,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(en,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:o[n],onChange:c=>s({[n]:c})},n))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:a,children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:n=>s({lifecycle:{...o.lifecycle,postStart:n}})}),e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204:11",label:"终止前 (preStop)",handler:o.lifecycle?.preStop,onChange:n=>s({lifecycle:{...o.lifecycle,preStop:n}})})]}),!o.lifecycle&&e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:208:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>s({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:a,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223:17",type:"number",value:o.securityContext.runAsUser??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsUser:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229:17",type:"number",value:o.securityContext.runAsGroup??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsGroup:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235:17",value:(o.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesAdd:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241:17",value:(o.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesDrop:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...o.securityContext,runAsNonRoot:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!o.securityContext.privileged,onChange:n=>s({securityContext:{...o.securityContext,privileged:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...o.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...o.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:a,children:[e.jsx(Bs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({volumeMounts:[...o.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[o.volumeMounts.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,name:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:284:15",value:n.mountPath,placeholder:"/data",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,mountPath:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,subPath:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:d=>{const i=[...o.volumeMounts];i[c]={...n,readOnly:d},s({volumeMounts:i})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:o.volumeMounts.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},c)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function en({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},c=d=>o({...n,...d});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:d=>o(d?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:n.type||"httpGet",onValueChange:d=>c({type:d}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:d=>c({httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:d=>c({httpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:d=>c({httpHost:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),n.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:d=>c({tcpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),n.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:d=>c({execCommand:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:d=>c({initialDelaySeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:d=>c({periodSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:d=>c({timeoutSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:d=>c({successThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:d=>c({failureThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function qt({label:t,handler:s,onChange:o}){const a=s||{type:"none"},n=!a.type||a.type==="none"?"__none":a.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:n,onValueChange:c=>o({...a,type:c==="__none"?"none":c}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423:9",value:a.execCommand||"",placeholder:"每行一个命令片段",onChange:c=>o({...a,execCommand:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),a.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:c=>o({...a,httpPath:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:c=>o({...a,httpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),a.type==="tcpSocket"&&e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:c=>o({...a,tcpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Qe({label:t,value:s,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:s,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Ut({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:c,onRemove:d,onUpdate:i,onDuplicate:S}){const l=nt(),[v,g]=p.useState(new Set([0])),A=f=>{g(w=>{const _=new Set(w);return _.has(f)?_.delete(f):_.add(f),_})},b=n==="blue"?"border-blue-500/30":"border-purple-500/30",E=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[o,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:c,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((f,w)=>{const _=v.has(w)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${b} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${E} cursor-pointer`,onClick:()=>A(w),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[_?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx(Fe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:f.name||"(未命名)"}),f.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:f.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:I=>I.stopPropagation(),children:[S&&e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>S(w),children:e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await l({title:"删除容器",description:`确认删除容器「${f.name}」?`,confirmText:"删除",variant:"destructive"})&&d(w)},children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),_&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Zs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:f,onUpdate:I=>i(w,I)})})]},w)})]})]})}function tn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const x=a?.spec?.template?.spec||{};E((Array.isArray(x.containers)?x.containers:[]).map(zt)),w((Array.isArray(x.initContainers)?x.initContainers:[]).map(zt)),I((Array.isArray(x.imagePullSecrets)?x.imagePullSecrets:[]).map(H=>H.name||"")),v(!1)},[a]);const Z=(x,H)=>{E(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},q=()=>{E(x=>[...x,$t(`container-${x.length+1}`)])},Q=x=>{E(H=>H.filter((G,M)=>M!==x))},$=x=>{E(H=>{const G=JSON.parse(JSON.stringify(H[x]));G.name=`${G.name}-copy`;const M=[...H];return M.splice(x+1,0,G),M})},U=(x,H)=>{w(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},Y=()=>{w(x=>[...x,$t(`init-${x.length+1}`)])},P=x=>{w(H=>H.filter((G,M)=>M!==x))},z=async()=>{for(const x of[...f,...b]){if(!x.name.trim()){d({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!x.image.trim()){d({title:"保存失败",description:`容器 ${x.name} 的镜像不能为空`,variant:"destructive"});return}}S(!0);try{const x=JSON.parse(JSON.stringify(g));x.spec=x.spec||{},x.spec.template=x.spec.template||{},x.spec.template.spec=x.spec.template.spec||{},x.spec.template.spec.containers=b.map(Gt),x.spec.template.spec.initContainers=f.length>0?f.map(Gt):void 0,x.spec.template.spec.imagePullSecrets=_.filter(H=>H.trim()).length>0?_.filter(H=>H.trim()).map(H=>({name:H})):void 0,await rt(t,s,o,x),d({title:"容器配置已保存",description:`${o} 更新已提交`}),n(x)}catch(x){d({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[_.map((x,H)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145:17",className:"text-xs text-slate-300 font-mono",children:x}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>I(G=>G.filter((M,ee)=>ee!==H)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},H)),_.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:x=>{if(x.key==="Enter"){const H=x.target.value.trim();H&&(I(G=>[...G,H]),x.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>I(x=>[...x,""]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:f,accentColor:"purple",onAdd:Y,onRemove:P,onUpdate:U}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:b,accentColor:"blue",onAdd:q,onRemove:Q,onUpdate:Z,onDuplicate:$}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:f.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:b.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:z,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function sn(t=""){return{volume:{name:"",type:"emptyDir"},containerName:t,mountPath:"",subPath:"",readOnly:!1}}const nn=["kube-api-access-","default-token-","kube-"];function yt(t){if(!t||typeof t!="object")return!1;const s=String(t.name||"");return nn.some(o=>s.startsWith(o))?!0:!!(t.projected||t.downwardAPI||t.csi||t.ephemeral)}function Yt(t){const s=t?.trim();if(!s)return;if(s.startsWith("["))try{const a=JSON.parse(s);if(Array.isArray(a))return a.filter(n=>n?.key&&n?.path)}catch{}const o=s.split(",").map(a=>a.trim()).filter(Boolean).map(a=>{const n=a.indexOf(":");return n<=0?null:{key:a.slice(0,n).trim(),path:a.slice(n+1).trim()}}).filter(Boolean);return o.length?o:void 0}function on(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||""}:t.emptyDir!=null?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:yt(t)?{name:s,type:"custom",_raw:t}:{name:s,type:"custom",_raw:t}}function xs(t){if(t.type==="custom"&&t._raw)return JSON.parse(JSON.stringify(t._raw));const s=t.name?.trim();if(!s)return null;const o={name:s};switch(t.type){case"emptyDir":{const a={};t.medium?.trim()&&(a.medium=t.medium.trim()),t.sizeLimit?.trim()&&(a.sizeLimit=t.sizeLimit.trim()),o.emptyDir=a;break}case"hostPath":{const a={path:t.path?.trim()||"/"};t.pathType?.trim()&&(a.type=t.pathType.trim()),o.hostPath=a;break}case"configMap":{const a=t.configMapName?.trim();if(!a)return null;const n={name:a},c=Yt(t.cmItems);c&&(n.items=c),o.configMap=n;break}case"secret":{const a=t.secretName?.trim();if(!a)return null;const n={secretName:a},c=Yt(t.secItems);c&&(n.items=c),o.secret=n;break}case"persistentVolumeClaim":{const a=t.pvcName?.trim();if(!a)return null;const n={claimName:a};t.pvcReadOnly&&(n.readOnly=!0),o.persistentVolumeClaim=n;break}case"nfs":{const a=t.nfsServer?.trim(),n=t.nfsPath?.trim();if(!a||!n)return null;const c={server:a,path:n};t.nfsReadOnly&&(c.readOnly=!0),o.nfs=c;break}default:return null}return o}function an(t,s){return{containerName:t,volumeName:s.name||"",mountPath:s.mountPath||"",subPath:s.subPath||"",readOnly:!!s.readOnly}}function rn(t){if(!t.volumeName?.trim()||!t.mountPath?.trim())return null;const s={name:t.volumeName.trim(),mountPath:t.mountPath.trim()};return t.subPath?.trim()&&(s.subPath=t.subPath.trim()),t.readOnly&&(s.readOnly=!0),s}const cn=["/var/run/secrets/kubernetes.io/serviceaccount"];function hs(t,s){if(!t)return!1;if(s.has(t.name))return!0;const o=t.mountPath||"";return cn.some(a=>o.startsWith(a))}function ln(t){const s=t?.spec?.template?.spec||{},o=Array.isArray(s.volumes)?s.volumes:[],a=o.filter(yt),n=o.filter(l=>!yt(l)),c=[...Array.isArray(s.containers)?s.containers:[],...Array.isArray(s.initContainers)?s.initContainers:[]],d=c.map(l=>l.name||"(unnamed)"),i=new Set(a.map(l=>l.name)),S=[];for(const l of c){const v=l.name||"(unnamed)",g=Array.isArray(l.volumeMounts)?l.volumeMounts:[];for(const A of g)hs(A,i)||S.push(an(v,A))}return{volumes:n.map(on),mounts:S,containers:d,passthroughVolumes:a}}function dn(t){const{volumes:s,mounts:o,containers:a,passthroughVolumes:n}=ln(t),c=a.find(i=>i!=="(unnamed)")||a[0]||"";return{entries:s.map(i=>{const l=o.filter(v=>v.volumeName===i.name)[0];return{volume:i,containerName:l?.containerName||c,mountPath:l?.mountPath||"",subPath:l?.subPath||"",readOnly:l?.readOnly??!1}}),containers:a,passthroughVolumes:n}}function pn(t){const s=t.map(a=>a.volume),o=t.filter(a=>a.volume.name.trim()&&a.mountPath.trim()).map(a=>({containerName:a.containerName,volumeName:a.volume.name.trim(),mountPath:a.mountPath.trim(),subPath:a.subPath.trim(),readOnly:a.readOnly}));return{volumes:s,mounts:o}}function mn(t,s,o,a){const n=JSON.parse(JSON.stringify(t));n.spec=n.spec||{},n.spec.template=n.spec.template||{},n.spec.template.spec=n.spec.template.spec||{};const c=n.spec.template.spec,d=s.map(xs).filter(Boolean),i=[...a,...d];i.length>0?c.volumes=i:delete c.volumes;const S=new Set(a.map(v=>v.name)),l=v=>{const g=v.name||"(unnamed)",b=(Array.isArray(v.volumeMounts)?v.volumeMounts:[]).filter(w=>hs(w,S)),E=o.filter(w=>w.containerName===g).map(rn).filter(Boolean),f=[...b,...E];f.length>0?v.volumeMounts=f:delete v.volumeMounts};return(c.containers||[]).forEach(l),(c.initContainers||[]).forEach(l),n}const Jt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:et,color:"text-emerald-400"},{key:"emptyDir",label:"临时目录",icon:Is,color:"text-slate-400"},{key:"hostPath",label:"HostPath",icon:ts,color:"text-amber-400"},{key:"nfs",label:"NFS",icon:jt,color:"text-purple-400"},{key:"configMap",label:"配置字典",icon:Os,color:"text-blue-400"},{key:"secret",label:"密文",icon:os,color:"text-rose-400"}];function xn({vol:t,onChange:s}){return t.type==="persistentVolumeClaim"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:44:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:45:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"PVC 名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:46:9",value:t.pvcName||"",onChange:o=>s({pvcName:o.target.value}),placeholder:"如 data-pvc",className:"h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:48:9",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:49:11",type:"checkbox",checked:!!t.pvcReadOnly,onChange:o=>s({pvcReadOnly:o.target.checked}),className:"accent-blue-500"}),"卷只读"]})]}):t.type==="emptyDir"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:57:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:58:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"介质"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:59:9",value:t.medium||"",onChange:o=>s({medium:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:61:11",value:"",children:"默认磁盘"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:62:11",value:"Memory",children:"Memory"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:64:9",value:t.sizeLimit||"",onChange:o=>s({sizeLimit:o.target.value}),placeholder:"sizeLimit 如 512Mi",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="hostPath"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:71:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:72:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"主机路径"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:73:9",value:t.path||"",onChange:o=>s({path:o.target.value}),placeholder:"/data/app",className:"h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:75:9",value:t.pathType||"Directory",onChange:o=>s({pathType:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:77:11",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:78:11",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:79:11",value:"",children:"默认"})]})]}):t.type==="nfs"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:86:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:87:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"NFS"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:88:9",value:t.nfsServer||"",onChange:o=>s({nfsServer:o.target.value}),placeholder:"Server IP",className:"h-7 w-36 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:90:9",value:t.nfsPath||"",onChange:o=>s({nfsPath:o.target.value}),placeholder:"/export/path",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="configMap"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:97:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:98:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"ConfigMap"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:99:9",value:t.configMapName||"",onChange:o=>s({configMapName:o.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:101:9",value:t.cmItems||"",onChange:o=>s({cmItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="secret"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:108:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:109:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"Secret"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:110:9",value:t.secretName||"",onChange:o=>s({secretName:o.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:112:9",value:t.secItems||"",onChange:o=>s({secItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):null}function hn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const P=dn(a);E(P.entries),w(P.containers),I(P.passthroughVolumes),v(!1)},[a]);const Z=f.find(P=>P!=="(unnamed)")||f[0]||"",q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,...z}:H)),Q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,volume:{...H.volume,...z}}:H)),$=()=>E(P=>[...P,sn(Z)]),U=P=>E(z=>z.filter((x,H)=>H!==P)),Y=async()=>{for(const P of b){if(!P.volume.name.trim()){d({title:"请填写数据卷名称",variant:"destructive"});return}if(!xs(P.volume)){d({title:"数据卷配置不完整",description:`请补全「${P.volume.name}」的类型必填项`,variant:"destructive"});return}if(!P.mountPath.trim()){d({title:"请填写挂载路径",description:`数据卷「${P.volume.name}」需指定挂载到容器的路径`,variant:"destructive"});return}}S(!0);try{const{volumes:P,mounts:z}=pn(b),x=mn(g,P,z,_);await rt(t,s,o,x),d({title:"存储配置已保存",description:`${o} 更新已提交`}),n(x)}catch(P){d({title:"保存失败",description:P?.message||String(P),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:180:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:181:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:182:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:183:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:198:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:199:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:200:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:11",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:202:13",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:203:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:204:17",className:"h-4 w-4 text-emerald-400"}),"数据卷",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:206:17",variant:"outline",className:"border-slate-700 text-slate-400",children:b.length})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:208:15",className:"text-[11px] text-slate-500 mt-1",children:"定义数据卷,并将其挂载到工作负载的容器中"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:210:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs shrink-0",onClick:$,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:211:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:9",className:"pt-0 space-y-4",children:b.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:13",className:"text-center py-10 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷,点击「添加数据卷」开始"]}):b.map((P,z)=>{const x=P.volume,H=Jt.find(M=>M.key===x.type),G=H?.icon||Ls;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:226:15",className:"bg-slate-950/60 border border-slate-800 rounded-lg overflow-hidden",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:228:17",className:"p-3 space-y-2.5 border-b border-slate-800/80",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:229:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:230:21",className:`h-4 w-4 ${H?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:21",className:"text-xs text-slate-400 shrink-0",children:"数据卷名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:232:21",value:x.name,onChange:M=>{const ee=M.target.value,le={name:ee};x.type==="configMap"&&!x.configMapName&&(le.configMapName=ee),x.type==="secret"&&!x.secretName&&(le.secretName=ee),x.type==="persistentVolumeClaim"&&!x.pvcName&&(le.pvcName=ee),Q(z,le)},placeholder:"如 config / uploads / data",className:"h-8 w-40 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"}),e.jsxs($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:245:21",value:x.type,onValueChange:M=>Q(z,{type:M}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:246:23",className:"h-8 w-[128px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:247:25",children:H?.label||x.type})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:23",children:Jt.map(M=>e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:251:27",value:M.key,children:M.label},M.key))})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:255:21",size:"icon",variant:"ghost",className:"h-8 w-8 text-red-400 ml-auto",onClick:()=>U(z),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:256:23",className:"h-4 w-4"})})]}),e.jsx(xn,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:19",vol:x,onChange:M=>Q(z,M)})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:263:17",className:"px-3 py-2.5 bg-slate-900/40 space-y-2",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:264:19",className:"text-[11px] text-slate-500 flex items-center gap-1.5",children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:265:21",className:"h-3.5 w-3.5 text-blue-400"}),"将上述数据卷挂载到容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:268:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:269:21",value:P.containerName,onChange:M=>q(z,{containerName:M.target.value}),className:"h-8 min-w-[120px] bg-slate-800 border border-slate-700 rounded-md text-sm text-slate-200 px-2 font-medium",children:[f.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:274:51",value:"",children:"(无容器)"}),f.map(M=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:275:47",value:M,children:M},M))]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:21",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:278:23",type:"button",onClick:()=>q(z,{readOnly:!0}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500 hover:text-slate-300"}`,children:"只读"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:282:23",type:"button",onClick:()=>q(z,{readOnly:!1}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"text-slate-500 hover:text-slate-300":"bg-blue-500/20 text-blue-300"}`,children:"读写"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:287:21",value:P.mountPath,onChange:M=>q(z,{mountPath:M.target.value}),placeholder:"挂载路径 /app/data",className:"h-8 flex-1 min-w-[180px] bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:295:21",className:"text-[11px] text-slate-500 shrink-0",children:"子路径 subPath"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:296:21",value:P.subPath,onChange:M=>q(z,{subPath:M.target.value}),placeholder:"如 config.yaml(挂载单文件时填写)",className:"h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]})]},z)})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:310:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:312:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:Y,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:191:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:192:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式。"})})}const un=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function bn({scheduleMode:t,onScheduleModeChange:s,nodeName:o,onNodeNameChange:a,availableNodes:n,nodesLoading:c,labelSelectorKv:d,onAddLabelSelector:i,onRemoveLabelSelector:S,onUpdateLabelSelector:l,nodeLabels:v}){return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:un.map(g=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(g.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===g.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:g.label},g.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),c?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:o,onChange:g=>a(g.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),n.map(g=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:g.name,children:[g.name," ",g.ip?`(${g.ip})`:""]},g.name))]}),o&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:o})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},A))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},A))]})]})]})}function yn({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:n,onDnsOptionsChange:c,hostAliases:d,onHostAliasesChange:i}){const S=()=>c([...n,{name:"",value:""}]),l=(E,f)=>c(n.map((w,_)=>_===E?{...w,...f}:w)),v=E=>c(n.filter((f,w)=>w!==E)),g=()=>i([...d,{ip:"",hostnames:""}]),A=(E,f)=>i(d.map((w,_)=>_===E?{...w,...f}:w)),b=E=>i(d.filter((f,w)=>w!==E));return e.jsxs(e.Fragment,{children:[e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:E=>s(E.target.value),placeholder:`8.8.8.8 114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:E=>a(E.target.value),placeholder:`svc.cluster.local cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:S,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:89:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),n.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:93:15",className:"text-xs text-slate-600 italic",children:"未配置"}):n.map((E,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:w=>l(f,{name:w.target.value}),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:w=>l(f,{value:w.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(f),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},f))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:g,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:134:13",className:"text-xs text-slate-600 italic",children:"未配置"}):d.map((E,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:w=>A(f,{ip:w.target.value}),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:w=>A(f,{hostnames:w.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>b(f),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},f))]})]})]})}function vn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState("RollingUpdate"),[f,w]=p.useState("25%"),[_,I]=p.useState("25%"),[Z,q]=p.useState("10"),[Q,$]=p.useState("600"),[U,Y]=p.useState("nodeSelector"),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState(!1),[ee,le]=p.useState([]),[ke,ge]=p.useState({}),[m,k]=p.useState([]),[r,h]=p.useState("ClusterFirst"),[N,O]=p.useState("Always"),[B,J]=p.useState("default-scheduler"),[de,Ce]=p.useState("30"),[pe,R]=p.useState(""),[ae,fe]=p.useState(""),[Se,C]=p.useState(""),[be,De]=p.useState(""),[je,He]=p.useState(!1),[ct,qe]=p.useState(!1),[lt,Ue]=p.useState(!1),[Pe,ft]=p.useState(!1),[St,Et]=p.useState(!1),[wt,Ct]=p.useState([]),[Dt,Pt]=p.useState(""),[At,Tt]=p.useState(""),[Ht,Mt]=p.useState([]);p.useEffect(()=>{const j=a;if(!j){v(!1);return}A(j);const D=j?.spec||{},W=D?.template?.spec||{},se=D.strategy||{};E(se.type||"RollingUpdate");const re=se.rollingUpdate||{};w(String(re.maxSurge??"25%")),I(String(re.maxUnavailable??"25%")),q(D.revisionHistoryLimit!=null?String(D.revisionHistoryLimit):"10"),$(D.progressDeadlineSeconds!=null?String(D.progressDeadlineSeconds):"600");const ye=W.nodeSelector||{},_e=Object.entries(ye).map(([ie,Bt])=>({key:ie,value:String(Bt)}));le(_e),z(W.nodeName||""),W.nodeName?Y("nodeName"):W.affinity?.nodeAffinity?Y("nodeAffinity"):_e.length>0&&Y("nodeSelector"),t&&(M(!0),ce.getClusterNodes(t).then(ie=>{const Rt=(Array.isArray(ie)?ie:ie?.items||ie?.list||[]).map(Je=>{const Me=Je.metadata||{},Ke=Je.status||{},ks=(Array.isArray(Ke.addresses)?Ke.addresses:[]).find(gs=>gs.type==="InternalIP")?.address||"";return{name:Me.name||"",ip:ks,labels:Me.labels||{}}});H(Rt);const ze={};for(const Je of Rt)for(const[Me,Ke]of Object.entries(Je.labels)){const it=String(Ke);ze[Me]||(ze[Me]=[]),ze[Me].includes(it)||ze[Me].push(it)}ge(ze)}).catch(()=>{}).finally(()=>M(!1)));const Ye=Array.isArray(W.tolerations)?W.tolerations:[];k(Ye.map(ie=>({key:ie.key||"",operator:ie.operator||"Equal",value:ie.value||"",effect:ie.effect||"",tolerationSeconds:ie.tolerationSeconds!=null?String(ie.tolerationSeconds):""}))),h(W.dnsPolicy||"ClusterFirst"),O(W.restartPolicy||"Always"),J(W.schedulerName||"default-scheduler"),Ce(W.terminationGracePeriodSeconds!=null?String(W.terminationGracePeriodSeconds):"30"),R(W.serviceAccountName||"");const Ee=W.securityContext||{};fe(Ee.fsGroup!=null?String(Ee.fsGroup):""),C(Ee.runAsUser!=null?String(Ee.runAsUser):""),De(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),He(!!Ee.runAsNonRoot),qe(!!W.hostNetwork),Ue(!!W.hostIPC),ft(!!W.hostPID),Et(!!W.shareProcessNamespace);const L=Array.isArray(W.hostAliases)?W.hostAliases:[];Ct(L.map(ie=>({ip:ie.ip||"",hostnames:Array.isArray(ie.hostnames)?ie.hostnames.join(", "):""})));const ne=W.dnsConfig||{};Pt(Array.isArray(ne.nameservers)?ne.nameservers.join(` `):""),Tt(Array.isArray(ne.searches)?ne.searches.join(` `):"");const dt=Array.isArray(ne.options)?ne.options:[];Mt(dt.map(ie=>({name:ie.name||"",value:ie.value||""}))),v(!1)},[a]);const us=()=>le(j=>[...j,{key:"",value:""}]),bs=j=>le(D=>D.filter((W,se)=>se!==j)),ys=(j,D)=>le(W=>W.map((se,re)=>re===j?{...se,...D}:se)),vs=async()=>{S(!0);try{const j=JSON.parse(JSON.stringify(g));j.spec=j.spec||{},j.spec.template=j.spec.template||{},j.spec.template.spec=j.spec.template.spec||{};const D=j.spec.template.spec;if(j.spec.strategy={type:b},b==="RollingUpdate"&&(j.spec.strategy.rollingUpdate={maxSurge:f,maxUnavailable:_}),Z&&(j.spec.revisionHistoryLimit=Number(Z)),Q&&(j.spec.progressDeadlineSeconds=Number(Q)),U==="nodeName"&&P.trim())D.nodeName=P.trim(),delete D.nodeSelector,D.affinity&&delete D.affinity.nodeAffinity;else if(U==="nodeSelector"){const L={};for(const{key:ne,value:dt}of ee){const ie=ne.trim();ie&&(L[ie]=dt)}Object.keys(L).length>0?D.nodeSelector=L:delete D.nodeSelector,D.nodeName&&delete D.nodeName,D.affinity&&delete D.affinity.nodeAffinity}else if(U==="nodeAffinity"){const L=ee.filter(ne=>ne.key.trim()).map(ne=>({key:ne.key.trim(),operator:"In",values:[ne.value]}));L.length>0?(D.affinity=D.affinity||{},D.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:L}]}}):D.affinity&&delete D.affinity.nodeAffinity,delete D.nodeSelector,D.nodeName&&delete D.nodeName}const W=m.filter(L=>L.key||L.operator==="Exists").map(L=>{const ne={};return L.key&&(ne.key=L.key),L.operator&&(ne.operator=L.operator),L.value&&L.operator!=="Exists"&&(ne.value=L.value),L.effect&&(ne.effect=L.effect),L.tolerationSeconds&&L.effect==="NoExecute"&&(ne.tolerationSeconds=Number(L.tolerationSeconds)),ne});W.length>0?D.tolerations=W:delete D.tolerations,r&&(D.dnsPolicy=r),N&&(D.restartPolicy=N),B&&(D.schedulerName=B),de&&(D.terminationGracePeriodSeconds=Number(de)),pe&&(D.serviceAccountName=pe);const se={};ae&&(se.fsGroup=Number(ae)),Se&&(se.runAsUser=Number(Se)),be&&(se.runAsGroup=Number(be)),je&&(se.runAsNonRoot=!0),Object.keys(se).length>0?D.securityContext=se:delete D.securityContext,ct?D.hostNetwork=!0:delete D.hostNetwork,lt?D.hostIPC=!0:delete D.hostIPC,Pe?D.hostPID=!0:delete D.hostPID,St?D.shareProcessNamespace=!0:delete D.shareProcessNamespace;const re=wt.filter(L=>L.ip.trim()).map(L=>({ip:L.ip.trim(),hostnames:L.hostnames.split(/[,\s]+/).map(ne=>ne.trim()).filter(Boolean)})).filter(L=>L.hostnames.length>0);re.length>0?D.hostAliases=re:delete D.hostAliases;const ye={},_e=Dt.split(` `).map(L=>L.trim()).filter(Boolean);_e.length>0&&(ye.nameservers=_e);const Ye=At.split(` `).map(L=>L.trim()).filter(Boolean);Ye.length>0&&(ye.searches=Ye);const Ee=Ht.filter(L=>L.name.trim()).map(L=>{const ne={name:L.name.trim()};return L.value.trim()&&(ne.value=L.value.trim()),ne});Ee.length>0&&(ye.options=Ee),Object.keys(ye).length>0?D.dnsConfig=ye:delete D.dnsConfig,await rt(t,s,o,j),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n(j)}catch(j){d({title:"保存失败",description:j?.message||String(j),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:b==="RollingUpdate",onChange:()=>E("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:15",type:"radio",checked:b==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),b==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:f,onChange:j=>w(j.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:_,onChange:j=>I(j.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"number",value:Z,onChange:j=>q(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:Q,onChange:j=>$(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>k(j=>[...j,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[m.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),m.map((j,D)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:j.key,placeholder:"key",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,key:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:j.operator,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,operator:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:j.value,placeholder:"value",disabled:j.operator==="Exists",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,value:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:j.effect,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,effect:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:j.tolerationSeconds,placeholder:"秒",disabled:j.effect!=="NoExecute",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,tolerationSeconds:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>k(W=>W.filter((se,re)=>re!==D)),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},D))]})]}),e.jsx(bn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:U,onScheduleModeChange:Y,nodeName:P,onNodeNameChange:z,availableNodes:x,nodesLoading:G,labelSelectorKv:ee,onAddLabelSelector:us,onRemoveLabelSelector:bs,onUpdateLabelSelector:ys,nodeLabels:ke}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:r,onChange:j=>h(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:N,onChange:j=>O(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:B,onChange:j=>J(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:490:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:de,onChange:j=>Ce(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:11",className:"col-span-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:pe,onChange:j=>R(j.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:ae,onChange:j=>fe(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:Se,onChange:j=>C(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:be,onChange:j=>De(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:528:15",type:"checkbox",checked:je,onChange:j=>He(j.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:545:13",type:"checkbox",checked:ct,onChange:j=>qe(j.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:550:13",type:"checkbox",checked:lt,onChange:j=>Ue(j.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:555:13",type:"checkbox",checked:Pe,onChange:j=>ft(j.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:560:13",type:"checkbox",checked:St,onChange:j=>Et(j.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(yn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:Dt,onDnsNameserversChange:Pt,dnsSearches:At,onDnsSearchesChange:Tt,dnsOptions:Ht,onDnsOptionsChange:Mt,hostAliases:wt,onHostAliasesChange:Ct}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:vs,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const kn=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Kt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function gn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),i=nt(),[S,l]=p.useState(!0),[v,g]=p.useState([]),[A,b]=p.useState([]),[E,f]=p.useState({}),[w,_]=p.useState(null),[I,Z]=p.useState(null),[q,Q]=p.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[$,U]=p.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),Y=m=>{Q(k=>({...k,ports:[...k.ports,m?{name:m.name,port:String(m.port),targetPort:String(m.targetPort),protocol:m.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},P=(m,k,r)=>{Q(h=>({...h,ports:h.ports.map((N,O)=>O===m?{...N,[k]:r}:N)}))},z=m=>{q.ports.length<=1||Q(k=>({...k,ports:k.ports.filter((r,h)=>h!==m)}))},x=p.useCallback(async()=>{l(!0);try{const m=a?.spec?.selector?.matchLabels||a?.selector||{};f(m);const[k,r]=await Promise.all([ce.getNamespaceServices(t,s).catch(()=>[]),ce.getNamespaceIngresses(t,s).catch(()=>[])]),h=Kt(k),N=Kt(r),O=h.map(J=>{const de=J.spec||{},Ce=Array.isArray(de.ports)?de.ports.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):Array.isArray(J.portList)?J.portList.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):[];return{name:J.name||J.metadata?.name||"",type:de.type||J.type||"ClusterIP",clusterIP:de.clusterIP||J.cluster_ip||"",externalIP:Array.isArray(de.externalIPs)?de.externalIPs.join(","):"",ports:Ce,selector:de.selector||J.selector||{},age:J.age||J.created_at||"",raw:J}}),B=N.map(J=>{const de=J.spec||{},pe=(Array.isArray(de.rules)?de.rules:Array.isArray(J.rules)?J.rules:[]).map(R=>({host:R.host||"",paths:(R.http?.paths||R.paths||[]).map(ae=>({path:ae.path||"/",backend:{service:ae.backend?.service?.name||ae.backendService||"",port:ae.backend?.service?.port?.number||ae.backend?.service?.port?.name||ae.backendPort||""}}))}));return{name:J.name||J.metadata?.name||"",className:de.ingressClassName||J.ingressClass||"",hosts:pe.map(R=>R.host).filter(Boolean),rules:pe,raw:J}});g(O),b(B)}catch(m){console.error("M9 load error:",m)}finally{l(!1)}},[t,s,a]);p.useEffect(()=>{x()},[x]);const H=m=>Object.keys(m).length===0?!1:Object.entries(m).every(([k,r])=>E[k]===r),G=v.filter(m=>H(m.selector)),M=new Set(G.map(m=>m.name)),ee=A.filter(m=>m.rules.some(k=>k.paths.some(r=>M.has(r.backend.service)))),le=async()=>{const m=q.name.trim()||`${o}-svc`,k=q.ports.map(h=>{const N={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return q.type==="NodePort"&&h.nodePort&&(N.nodePort=Number(h.nodePort)),N}),r={apiVersion:"v1",kind:"Service",metadata:{name:m,namespace:s,labels:{app:o}},spec:{type:q.type,selector:E,ports:k}};try{const h=await It(r);await ce.applyYAML(t,h),d({title:"Service 已创建",description:m}),Z(null),x()}catch(h){d({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},ke=async()=>{const m=$.name.trim()||`${o}-ingress`,k=G[0]?.name||`${o}-svc`,r=Number($.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:m,namespace:s,labels:{app:o}},spec:{ingressClassName:$.className||void 0,rules:[{host:$.host||void 0,http:{paths:[{path:$.path||"/",pathType:$.pathType||"Prefix",backend:{service:{name:k,port:{number:r}}}}]}}]}};$.className||delete h.spec.ingressClassName;try{const N=await It(h);await ce.applyYAML(t,N),d({title:"Ingress 已创建",description:m}),Z(null),x()}catch(N){d({title:"创建失败",description:N?.message||String(N),variant:"destructive"})}},ge=async(m,k)=>{if(await i({title:"删除资源",description:`确认删除 ${m==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=m==="service"?"services":"ingresses";await ce.deleteResourceYaml(t,s,h,k),d({title:"已删除",description:`${m==="service"?"Service":"Ingress"} ${k} 已删除`}),x()}catch(h){d({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return S?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[m,"=",k]},m)),Object.keys(E).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:x,children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[G.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Q({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),Z("service")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[G.length===0&&I!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:G.map(m=>{const k=H(m.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:19",className:`rounded-lg border p-3 ${k?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.type}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:359:23",className:"text-[11px] text-slate-500 ml-auto",children:m.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>_({resource:"services",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>ge("service",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:m.ports.map((r,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[r.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[r.name,": "]}),r.port,"→",r.targetPort,r.nodePort?`/NodePort:${r.nodePort}`:"","/",r.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(m.selector).map(([r,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[r,"=",h]},r))]})]},m.name)})}),I==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:q.name,onChange:m=>Q(k=>({...k,name:m.target.value})),placeholder:`${o}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:q.type,onChange:m=>Q(k=>({...k,type:m.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:kn.map(m=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>Y(m),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"h-2.5 w-2.5"}),m.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[m.protocol," ",m.port,":",m.targetPort]})]},m.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((m,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:m.name,onChange:r=>P(k,"name",r.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:m.protocol,onChange:r=>P(k,"protocol",r.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:m.port,onChange:r=>P(k,"port",r.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:m.targetPort,onChange:r=>P(k,"targetPort",r.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),q.type==="NodePort"&&e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:r=>P(k,"nodePort",r.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>z(k),disabled:q.ports.length<=1,children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>Y(),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[m,"=",k]},m)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:le,children:"创建"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[ee.length,"/",A.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{U(m=>({...m,name:`${o}-ingress`,svcPort:String(G[0]?.ports[0]?.port||80)})),Z("ingress")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[A.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:A.map(m=>{const k=ee.includes(m);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:19",className:`rounded-lg border p-3 ${k?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.className}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>_({resource:"ingresses",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>ge("ingress",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:m.rules.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:r.host||"*"}),r.paths.map((N,O)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[N.path," → ",N.backend?.service,":",N.backend?.port]},O))]},h))})]},m.name)})}),I==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:$.name,onChange:m=>U(k=>({...k,name:m.target.value})),placeholder:`${o}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:$.className,onChange:m=>U(k=>({...k,className:m.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:$.host,onChange:m=>U(k=>({...k,host:m.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:$.path,onChange:m=>U(k=>({...k,path:m.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:$.svcPort,onChange:m=>U(k=>({...k,svcPort:m.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:ke,children:"创建"})]})]})]})]}),w&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:s,resource:w.resource,name:w.name,onClose:()=>_(null),onSaved:()=>{_(null),x()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:c,children:"返回查看"})})]})}function jn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const[d,i]=p.useState("basic"),[S,l]=p.useState(a);p.useEffect(()=>{a&&l(a)},[a]);const v=b=>{b&&l(b),n()},g=[{key:"basic",label:"基本信息",icon:ut},{key:"containers",label:"容器信息",icon:Fe},{key:"storage",label:"存储挂载",icon:et},{key:"advanced",label:"高级设置",icon:ut},{key:"service",label:"服务/应用路由",icon:Ae}],A={clusterCode:t,namespace:s,deploymentName:o,manifest:S,onSaved:v,onCancel:c};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:g.map(b=>{const E=d===b.key,f=b.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>i(b.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${E?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(f,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),b.label]},b.key)})}),d==="basic"&&e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...A}),d==="containers"&&e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...A}),d==="storage"&&e.jsx(hn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...A}),d==="advanced"&&e.jsx(vn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...A}),d==="service"&&e.jsx(gn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...A})]})}function Nn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Te(),n=vt(S=>S.token)||localStorage.getItem("token")||"",c=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${c}' \\ -H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\ -H 'Content-Type: application/json' \\ -d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,i=S=>{navigator.clipboard.writeText(S).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:28:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:29:7",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:30:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:31:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:32:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:c}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>i(c),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:37:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:38:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:39:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:d}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>i(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:43:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:44:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Ze({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:15:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function fn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:c}=Te(),[d,i]=p.useState(""),[S,l]=p.useState(200),[v,g]=p.useState(a[0]||""),[A,b]=p.useState(!1),[E,f]=p.useState(!1),w=async()=>{b(!0);try{const I=await ce.getPodLogs(t,s,o,S,v||void 0);i(I?.data?.logs||I?.logs||I||"无日志")}catch{i("获取日志失败")}finally{b(!1)}};p.useEffect(()=>{w()},[v,S]);const _=async()=>{f(!0);const I=vt.getState().token||"",Z="",q=v?`&container=${encodeURIComponent(v)}`:"",Q=`${Z}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${S}&stream=true${q}`;try{const U=(await fetch(Q,{headers:{Authorization:`Bearer ${I}`}})).body?.getReader();if(!U)return;const Y=new TextDecoder;let P="";for(;;){const{done:z,value:x}=await U.read();if(z)break;P+=Y.decode(x,{stream:!0}),i(P)}}catch{c({title:"流式日志连接中断",variant:"destructive"})}finally{f(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:64:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:o}),v&&e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:v})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:v,onChange:I=>g(I.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(I=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:I,children:I},I))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:S,onChange:I=>l(Number(I.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:w,disabled:A,children:A?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(at,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:_,disabled:E,children:E?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:d||"无日志内容"})})]})})}function Sn({modal:t,deployment:s,namespace:o,deploymentName:a,newImage:n,setNewImage:c,scaleValue:d,setScaleValue:i,actionLoading:S,onClose:l,onUpdateImage:v,onScaleTo:g,onDelete:A}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:s.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:b=>c(b.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="image"||!n.trim(),onClick:v,children:S==="image"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",s.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale"||d<=0,onClick:()=>i(b=>Math.max(0,b-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:d,onChange:b=>i(Math.max(0,Number(b.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale",onClick:()=>i(b=>b+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="scale",onClick:g,children:S==="scale"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(is,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[o,"/",a]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:S==="delete",onClick:A,children:[S==="delete"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(he,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function En({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:c}){const d=Xt(),{toast:i}=Te(),S=nt(),[l,v]=p.useState(null),[g,A]=p.useState(null),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState(!0),[Q,$]=p.useState(""),[U,Y]=p.useState(null),[P,z]=p.useState(""),[x,H]=p.useState(0),[G,M]=p.useState(null),[ee,le]=p.useState(null),ke=l?.cluster_id||l?.clusterId||t,ge=C=>Array.isArray(C)?C:C?.list||C?.items||C?.data||[],m=p.useCallback(async()=>{q(!0);try{const[C,be,De,je]=await Promise.all([ce.getDeployment(t,s,o).catch(()=>null),ce.getNamespacePods(t,s).catch(()=>[]),ce.getReplicaSets(t,s).catch(()=>[]),ce.getDeploymentRevisions(t,s,o).catch(()=>[])]),He=C||(Array.isArray(C)?C[0]:null);v(He),H(He?.replicas||0),z(He?.image||"");const qe=ge(be).filter(Pe=>Pe.namespace===s&&(Pe.name||"").startsWith(o));E(qe);const Ue=ge(De).filter(Pe=>Pe.namespace===s&&(Pe.owner_deployment===o||(Pe.name||"").startsWith(o)));w(Ue),I(ge(je))}catch(C){console.error("加载详情失败:",C)}finally{q(!1)}},[t,s,o]),k=p.useCallback(async()=>{try{const C=await ce.getResourceYaml(t,s,"deployments",o),{parseEditableManifest:be}=await js(async()=>{const{parseEditableManifest:je}=await import("./PodFileBrowser-Bs6KRfHw.js").then(He=>He.k);return{parseEditableManifest:je}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),{manifest:De}=await be(C);A(De||l)}catch(C){console.warn("加载 manifest 失败(编辑功能降级):",C),A(l)}},[t,s,o,l]);p.useEffect(()=>{m()},[m]),p.useEffect(()=>{a==="edit"&&!g&&k()},[a,g,k]);const r=async()=>{$("scale");try{await ce.scaleDeployment(t,s,o,x),i({title:"伸缩成功",description:`副本数已设置为 ${x}`}),Y(null),m()}catch(C){i({title:"操作失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},h=async()=>{if(await S({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){$("restart");try{await ce.restartDeployment(t,s,o),i({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(m,1500)}catch(be){i({title:"重启失败",description:be?.message||String(be),variant:"destructive"})}finally{$("")}}},N=async()=>{const C=!!l?.paused,be=C?"恢复":"暂停";if(await S({title:`${be}滚动更新`,description:`确认${be} Deployment "${o}" 的滚动更新?`,confirmText:be})){$(C?"resume":"pause");try{C?await ce.resumeDeployment(t,s,o):await ce.pauseDeployment(t,s,o),i({title:`${be}成功`,description:`Deployment 滚动更新已${be}`}),setTimeout(m,1e3)}catch(je){i({title:`${be}失败`,description:je?.message||String(je),variant:"destructive"})}finally{$("")}}},O=()=>{Y({kind:"cicd"})},B=async()=>{if(P.trim()){$("image");try{await ce.updateDeploymentImage(t,s,o,P),i({title:"镜像更新成功",description:`正在滚动更新为 ${P}`}),Y(null),m()}catch(C){i({title:"更新失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}}},J=async()=>{$("delete");try{const C=vt.getState().token||"",De=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,je=await fetch(De,{method:"DELETE",headers:{Authorization:`Bearer ${C}`}});if(!je.ok)throw new Error(`HTTP ${je.status}`);i({title:"删除成功",description:`${o} 已删除`}),Y(null),setTimeout(()=>d(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(C){i({title:"删除失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},de=C=>Y({kind:"podLogs",pod:C.name}),Ce=C=>Y({kind:"podYaml",pod:C.name}),pe=C=>{M(C.name)},R=C=>{le(C.name)};if(Z)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:229:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:230:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:231:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:232:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!l)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:9",className:"p-12 text-center",children:[e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:243:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:244:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const ae=l.ready_replicas||l.readyReplicas||0,fe=l.replicas||0,Se=ae===fe&&fe>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:256:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:258:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:259:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:264:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:265:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:267:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:15",className:Se?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[Se?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:30",className:"h-3 w-3 mr-1"}):e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:73",className:"h-3 w-3 mr-1"}),ae,"/",fe]}),l?.paused&&e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:282:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:19",className:"text-slate-400",children:l.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:303:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("yaml"),children:"YAML"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:311:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:m,title:"刷新",children:e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:312:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:316:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:317:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>Y({kind:"image"}),children:[e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:318:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:320:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:323:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!Q,onClick:N,children:l?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:O,children:[e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:335:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:337:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>Y({kind:"delete"}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:338:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:346:9",clusterCode:t,namespace:s,deployment:l,pods:b,replicaSets:f,revisions:_,onRefresh:m,onShowPodLogs:de,onShowPodTerminal:pe,onShowPodYaml:Ce,onShowPodFileBrowser:R}):a==="yaml"?e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:m,onClose:()=>c("view")}):e.jsx(jn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:373:9",clusterCode:t,namespace:s,deploymentName:o,manifest:g,onSaved:()=>{k(),m()},onCancel:()=>c("view")}),U?.kind==="yaml"&&e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:385:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>Y(null),onSaved:m}),e.jsx(Sn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:396:7",modal:U,deployment:l,namespace:s,deploymentName:o,newImage:P,setNewImage:z,scaleValue:x,setScaleValue:H,actionLoading:Q,onClose:()=>Y(null),onUpdateImage:B,onScaleTo:r,onDelete:J}),U?.kind==="cicd"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:414:9",title:"CI/CD Webhook",onClose:()=>Y(null),children:e.jsx(Nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:415:11",clusterCode:t,namespace:s,deploymentName:o})}),U?.kind==="podLogs"&&e.jsx(fn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:421:9",clusterCode:t,namespace:s,podName:U.pod,containers:(b.find(C=>C.name===U.pod)?.containers||[]).map(C=>C.name).filter(Boolean),onClose:()=>Y(null)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:7",open:!!G,onOpenChange:C=>{C||M(null)},clusterId:ke,namespace:s,podName:G||"",containers:(b.find(C=>C.name===G)?.containers||[]).map(C=>C.name).filter(Boolean)}),e.jsx(Cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:440:7",open:!!ee,onOpenChange:C=>{C||le(null)},clusterCode:t,namespace:s,podName:ee||"",containers:(b.find(C=>C.name===ee)?.containers||[]).map(C=>C.name).filter(Boolean)})]})}function Gn(){const t=Ns(),s=Xt(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",c=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",d=i=>{i!==c&&s(`/kubernetes/${o}/namespace/${a}/workload/${i}/Deployment/${n}`,{replace:!0})};return e.jsx(En,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:c,onBack:()=>s(-1),onModeChange:d})}export{Gn as default};