fix(frontend): 修复 manualChunks 循环依赖导致生产白屏

仅拆分 codemirror/xterm/icons 独立库,避免 vendor-charts 与 vendor-react 循环引用。
This commit is contained in:
Logan.Li committed 2026-06-26 14:03:51 +08:00
1 parent d0cf71b05a
commit bdf1f41464
219 files changed
+357 -414

No files matched your search

@@ -1,4 +1,4 @@
import{j as s,a4 as b,aP as f,L as v,a5 as w,Q as g,H as C,B as A,r as l,D as M,a as U,b as B,c as J,d as E,O as L,T as R,S as G,C as H}from"./index-BTQygws6.js";import{C as z,b as $,c as D,a as F}from"./card-D0oz3NII.js";import{B as y}from"./badge-BsIZhz7S.js";import{a as K}from"./alert-BgGvEFrj.js";import{a as Q}from"./ai-BNXuq6Dq.js";import{S}from"./sparkles-Bd2inR9e.js";import{T as P}from"./trending-up-CwtABPES.js";import{F as X}from"./file-text-B8e3PkIb.js";import{P as _}from"./play-BAPO-6Xq.js";import{C as q}from"./copy-DRb4X68n.js";import{C as W}from"./circle-x-CYoA2i-_.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash
import{j as s,r as l}from"./vendor-codemirror-C7mXSpXt.js";import{C as b,b as v,c as w,a as C}from"./card-B1TdHH8z.js";import{B as y}from"./badge-IN84WXM6.js";import{q as z,B as A,D as O,a as U,b as B,c as J,d as E}from"./index-BZzvNKfa.js";import{a as L}from"./alert-0ZkysSZO.js";import{a as G}from"./ai-A_FvqFr_.js";import{ay as R,av as g,L as $,ab as D,aa as F,y as f,F as H,r as S,z as P,w as K,aC as q,l as _,h as X,b as Q,a as W}from"./vendor-icons-DIDdqO_o.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash
# CPU 高负载诊断脚本 - ${t}
echo "===== CPU TOP 10 进程 ====="
ps aux --sort=-%cpu | head -11
@@ -37,7 +37,7 @@ ss -tlnp | grep -E ':(80|443|8080|3306|6379|9090)'
echo ""
echo "===== 重启失败服务 ====="
systemctl reset-failed
`,similarCases:0,confidence:0}:{rootCause:`检测到 ${t} 触发告警「${e.name}」,当前指标值 ${e.currentValue} 超过阈值 ${e.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,impact:a?"该告警级别为严重,可能影响业务正常运行,建议优先处理。":"该告警需要关注,持续恶化可能影响系统稳定性。",recommendations:[`查看 ${t} 的监控仪表盘,确认指标趋势`,"检查对应时间段的系统日志和应用日志","关联同时间段的其他告警,排查是否有连锁反应","若确认误报,调整告警规则阈值或持续时间"],similarCases:0,confidence:0}}function Z(e){const c=e.rule?.expression||"",t=c.match(/([\w_]+)\s*[><=!]+\s*([\d.]+)/),a=t?t[1]:c||"unknown",n=t?t[2]+"%":"-",r=e.value??0,d=a.includes("usage")||a.includes("cpu")||a.includes("disk")||a.includes("mem")?r.toFixed(1)+"%":r.toFixed(2),x=e.resolved_at?new Date(e.resolved_at):new Date,i=new Date(e.started_at),p=Math.max(1,Math.round((x.getTime()-i.getTime())/6e4)),h=p>=60?`${Math.floor(p/60)}小时${p%60}分钟`:`${p}分钟`,u=i.toLocaleString("zh-CN",{hour12:!1});return{id:String(e.id),name:e.rule_name||e.rule?.name||"未知告警",severity:e.severity==="critical"?"critical":e.severity==="warning"?"warning":"info",status:e.status==="firing"?"active":"resolved",source:e.target||"未知目标",metric:a,threshold:n,currentValue:d,duration:h,startedAt:u,description:e.message&&e.message!==`告警事件 ${e.id}`?e.message:e.rule?.description||`${e.rule_name||"告警"}: ${e.target} 当前值 ${d}`}}function ss(e){switch(e){case"critical":return"bg-red-500/10 text-red-400 border-red-500/30";case"warning":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-blue-500/10 text-blue-400 border-blue-500/30"}}function es({selectedAlert:e,isAnalyzing:c,analysis:t,onAutoFix:a}){return s.jsxs(z,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:18:5",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:19:7",className:"border-b border-slate-700 pb-3",children:s.jsxs(D,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:20:9",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:21:11",className:"h-5 w-5 text-purple-400"}),"AI 分析结果"]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:25:7",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:26:9",className:"p-4",children:e?c?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:33:13",className:"flex flex-col items-center justify-center h-64",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:34:15",className:"h-8 w-8 animate-spin text-purple-400 mb-4"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:35:15",className:"text-slate-400",children:"AI正在分析告警根因..."}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:36:15",className:"text-xs text-slate-500 mt-2",children:"正在关联日志、指标和历史案例"})]}):t?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:39:13",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:41:15",className:"flex items-center justify-between p-3 bg-purple-500/10 rounded-lg border border-purple-500/30",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:42:17",className:"flex items-center gap-2",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:43:19",className:"h-5 w-5 text-purple-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:44:19",className:"text-slate-300",children:"分析置信度"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:46:17",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:47:19",className:"w-32 h-2 bg-slate-700 rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:48:21",className:"h-full bg-gradient-to-r from-purple-500 to-pink-500",style:{width:`${t.confidence}%`}})}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:53:19",className:"text-purple-400 font-bold",children:[t.confidence,"%"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:58:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:59:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(w,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:60:19",className:"h-4 w-4 text-red-400"}),"根因分析"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:63:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",childre Line truncated
`,similarCases:0,confidence:0}:{rootCause:`检测到 ${t} 触发告警「${e.name}」,当前指标值 ${e.currentValue} 超过阈值 ${e.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,impact:a?"该告警级别为严重,可能影响业务正常运行,建议优先处理。":"该告警需要关注,持续恶化可能影响系统稳定性。",recommendations:[`查看 ${t} 的监控仪表盘,确认指标趋势`,"检查对应时间段的系统日志和应用日志","关联同时间段的其他告警,排查是否有连锁反应","若确认误报,调整告警规则阈值或持续时间"],similarCases:0,confidence:0}}function Z(e){const c=e.rule?.expression||"",t=c.match(/([\w_]+)\s*[><=!]+\s*([\d.]+)/),a=t?t[1]:c||"unknown",n=t?t[2]+"%":"-",r=e.value??0,d=a.includes("usage")||a.includes("cpu")||a.includes("disk")||a.includes("mem")?r.toFixed(1)+"%":r.toFixed(2),x=e.resolved_at?new Date(e.resolved_at):new Date,i=new Date(e.started_at),p=Math.max(1,Math.round((x.getTime()-i.getTime())/6e4)),h=p>=60?`${Math.floor(p/60)}小时${p%60}分钟`:`${p}分钟`,u=i.toLocaleString("zh-CN",{hour12:!1});return{id:String(e.id),name:e.rule_name||e.rule?.name||"未知告警",severity:e.severity==="critical"?"critical":e.severity==="warning"?"warning":"info",status:e.status==="firing"?"active":"resolved",source:e.target||"未知目标",metric:a,threshold:n,currentValue:d,duration:h,startedAt:u,description:e.message&&e.message!==`告警事件 ${e.id}`?e.message:e.rule?.description||`${e.rule_name||"告警"}: ${e.target} 当前值 ${d}`}}function ss(e){switch(e){case"critical":return"bg-red-500/10 text-red-400 border-red-500/30";case"warning":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-blue-500/10 text-blue-400 border-blue-500/30"}}function es({selectedAlert:e,isAnalyzing:c,analysis:t,onAutoFix:a}){return s.jsxs(b,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:18:5",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:19:7",className:"border-b border-slate-700 pb-3",children:s.jsxs(w,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:20:9",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:21:11",className:"h-5 w-5 text-purple-400"}),"AI 分析结果"]})}),s.jsx(z,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:25:7",className:"flex-1",children:s.jsx(C,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:26:9",className:"p-4",children:e?c?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:33:13",className:"flex flex-col items-center justify-center h-64",children:[s.jsx($,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:34:15",className:"h-8 w-8 animate-spin text-purple-400 mb-4"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:35:15",className:"text-slate-400",children:"AI正在分析告警根因..."}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:36:15",className:"text-xs text-slate-500 mt-2",children:"正在关联日志、指标和历史案例"})]}):t?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:39:13",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:41:15",className:"flex items-center justify-between p-3 bg-purple-500/10 rounded-lg border border-purple-500/30",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:42:17",className:"flex items-center gap-2",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:43:19",className:"h-5 w-5 text-purple-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:44:19",className:"text-slate-300",children:"分析置信度"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:46:17",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:47:19",className:"w-32 h-2 bg-slate-700 rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:48:21",className:"h-full bg-gradient-to-r from-purple-500 to-pink-500",style:{width:`${t.confidence}%`}})}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:53:19",className:"text-purple-400 font-bold",children:[t.confidence,"%"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:58:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:59:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(D,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:60:19",className:"h-4 w-4 text-red-400"}),"根因分析"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:63:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",childre Line truncated
告警名称:${o.name}
严重程度:${o.severity}
@@ -54,4 +54,4 @@ systemctl reset-failed
"auto_fix_script": "#!/bin/bash\\n...\\n(可选的自动修复脚本,无则 null)",
"similar_cases": 数字(类似案例数预估),
"confidence": 数字(0-100 置信度)
}`,N=await Q.chat([{role:"user",content:V}]),I=N?.content||N?.message?.content||"";i(I?as(I,m):m)}catch{i(m)}finally{d(!1)}},k=()=>{h(!0)},O=o=>{switch(o){case"critical":return s.jsx(W,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:127:16",className:"h-4 w-4 text-red-400"});case"warning":return s.jsx(w,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:129:16",className:"h-4 w-4 text-amber-400"});default:return s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:131:16",className:"h-4 w-4 text-blue-400"})}};return s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:136:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:138:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:139:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:140:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center",children:s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:141:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:143:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:144:13",className:"text-2xl font-bold text-slate-100",children:"AI 告警智能分析"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:145:13",className:"text-sm text-slate-500",children:"基于大模型的告警根因分析和自动修复建议"})]})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:148:9",className:"flex items-center gap-2",children:s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:149:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:150:13",className:"h-3 w-3 mr-1"}),"AI 引擎运行中"]})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:156:7",className:"grid grid-cols-2 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs(z,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:158:9",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:159:11",className:"border-b border-slate-700 pb-3",children:s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:160:13",className:"flex items-center justify-between",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:161:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:162:17",className:"h-5 w-5 text-amber-400"}),"活跃告警"]}),s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:165:15",className:"bg-red-500/10 text-red-400 border-red-500/30",children:[e.filter(o=>o.status==="active").length," 个活跃"]})]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:170:11",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:171:13",className:"p-4 space-y-3",children:t?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:173:17",className:"flex flex-col items-center justify-center h-32",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:174:19",className:"h-6 w-6 animate-spin text-slate-500 mb-2"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:175:19",className:"text-sm text-slate-500",children:"加载告警数据..."})]}):e.length===0?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:178:17",className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:179:19",className:"h-8 w-8 mb-2 opacity-50"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:180:19",className:"text-sm",children:"暂无告警事件"})]}):e.map(o=>s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:184:17",className:`p-4 rounded-lg border cursor-pointer transition-all ${n?.id===o.id?"border-purple-500 bg-purple-500/10":"border-slate-700 bg-slate-800/50 hover:border-slate-600"}`,onClick:()=>T(o),children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:193:19",className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:194:21",className:"flex items-center gap-2",children:[O(o.severity),s.jsx("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:196:23",className:"font-medium text-slate-100",children:o.name})]}),s.jsx(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:198:21",variant:"outline",className:ss(o.severity),children:o.severity==="critical"?"严重":o.severity==="warning"?"警告":"提示"})]}),s.jsx("div",{"code-path":"src Line truncated
}`,N=await G.chat([{role:"user",content:M}]),I=N?.content||N?.message?.content||"";i(I?as(I,m):m)}catch{i(m)}finally{d(!1)}},k=()=>{h(!0)},V=o=>{switch(o){case"critical":return s.jsx(W,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:127:16",className:"h-4 w-4 text-red-400"});case"warning":return s.jsx(D,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:129:16",className:"h-4 w-4 text-amber-400"});default:return s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:131:16",className:"h-4 w-4 text-blue-400"})}};return s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:136:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:138:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:139:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:140:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center",children:s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:141:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:143:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:144:13",className:"text-2xl font-bold text-slate-100",children:"AI 告警智能分析"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:145:13",className:"text-sm text-slate-500",children:"基于大模型的告警根因分析和自动修复建议"})]})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:148:9",className:"flex items-center gap-2",children:s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:149:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:150:13",className:"h-3 w-3 mr-1"}),"AI 引擎运行中"]})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:156:7",className:"grid grid-cols-2 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs(b,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:158:9",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:159:11",className:"border-b border-slate-700 pb-3",children:s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:160:13",className:"flex items-center justify-between",children:[s.jsxs(w,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:161:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(_,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:162:17",className:"h-5 w-5 text-amber-400"}),"活跃告警"]}),s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:165:15",className:"bg-red-500/10 text-red-400 border-red-500/30",children:[e.filter(o=>o.status==="active").length," 个活跃"]})]})}),s.jsx(z,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:170:11",className:"flex-1",children:s.jsx(C,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:171:13",className:"p-4 space-y-3",children:t?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:173:17",className:"flex flex-col items-center justify-center h-32",children:[s.jsx($,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:174:19",className:"h-6 w-6 animate-spin text-slate-500 mb-2"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:175:19",className:"text-sm text-slate-500",children:"加载告警数据..."})]}):e.length===0?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:178:17",className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:179:19",className:"h-8 w-8 mb-2 opacity-50"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:180:19",className:"text-sm",children:"暂无告警事件"})]}):e.map(o=>s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:184:17",className:`p-4 rounded-lg border cursor-pointer transition-all ${n?.id===o.id?"border-purple-500 bg-purple-500/10":"border-slate-700 bg-slate-800/50 hover:border-slate-600"}`,onClick:()=>T(o),children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:193:19",className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:194:21",className:"flex items-center gap-2",children:[V(o.severity),s.jsx("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:196:23",className:"font-medium text-slate-100",children:o.name})]}),s.jsx(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:198:21",variant:"outline",className:ss(o.severity),children:o.severity==="critical"?"严重":o.severity==="warning"?"警告":"提示"})]}),s.jsx("div",{"code-path":"src Line truncated
@@ -0,0 +1,19 @@
import{r as x,j as s,b as _s}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,b as T,c as Z,a as q}from"./card-B1TdHH8z.js";import{a8 as ks,$ as Es,W as H,m as ds,B as N,q as Ls,D as Rs,a as Ms,b as Ps,c as Ds,d as Ts,e as qs,t as w}from"./index-BZzvNKfa.js";import{I as C}from"./input-D7JNe8Xd.js";import{B as k}from"./badge-IN84WXM6.js";import{L as y}from"./label-Bj0mNUAM.js";import{S as ss,a as ts,b as es,c as as,d as ns}from"./select-BFGszUub.js";import{S as Us}from"./switch-Ds1Doipu.js";import{d as U}from"./dashboard-Bvsa0TzO.js";import{a as Bs}from"./alert-0ZkysSZO.js";import{a as Fs}from"./agent-BC9_VpeZ.js";import{a as $}from"./ai-A_FvqFr_.js";import{av as zs,C as Hs,p as os,l as ms,A as xs,F as hs,aa as Vs,L as E,r as Ks,b3 as cs,aD as Gs,aj as Ws,U as Qs,b4 as Js,at as Xs,aR as Ys}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function Zs(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function I(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,I]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,st(o,...n)]}function st(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var tt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=tt.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},F={};var rs;function et(){if(rs)return F;rs=1;var e=_s();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var I=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:I,F}var is;function at(){return is||(is=1,B.exports=et()),B.exports}var nt=at();function ot(){return nt.useSyncExternalStore(ct,()=>!0,()=>!1)}function ct(){return()=>{}}var K="Avatar",[rt]=Zs(K),[it,us]=rt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(it,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",pt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=lt(r,a),l=Es(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});pt.displayName=fs;var gs="AvatarFallback",vs=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});vs.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lt(e,{referrerPolicy:n,crossOrigin:i}){const r=ot(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),I=l("error");return a.addEventListener("load",g),a.addEventListener("error",I),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=i),()=>{a.removeEventListener("load",g),a.removeEventListener("error",I)}},[a,i,n]),d}var dt=As,mt=vs;function xt({className:e,...n}){return s.jsx(dt,{"code-path":"src/components/ui/avatar.tsx:11:5","data-slot":"avatar",className:ds("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...n})}function ht({className:e,...n}){return s.jsx(mt,{"code-path":"src/components/ui/avatar.tsx:40:5","data-slot":"avatar-fallback",className:ds("bgLine truncated
${i.join(`
`)}`}async function ls(){const e=await Fs.getLatest(),n=Array.isArray(e)?e:e?.list||[];if(!n.length)return"(当前无 Agent 上报数据,可能未部署监控 Agent)";const i=n.slice(0,20).map((a,d)=>{const m=a.cpu_usage??"-",l=a.mem_usage??"-";return`${d+1}. ${a.hostname||"-"} | CPU:${m}% | 内存:${l}% (${a.mem_used??"-"}/${a.mem_total??"-"}GB) | 核数:${a.cpu_cores??"-"} | 上报:${(a.report_time||"").slice(0,16)}`}),r=n.filter(a=>(a.cpu_usage??0)>=80||(a.mem_usage??0)>=80),o=r.length?`
⚠️ 高负载主机 ${r.length} 台:${r.map(a=>`${a.hostname}(CPU${a.cpu_usage}%/MEM${a.mem_usage}%)`).join("、")}`:"";return`Agent 监控的 ${n.length} 台主机实时指标:
${i.join(`
`)}${o}`}async function ft(){const[e,n,i]=await Promise.all([U.getStats().catch(()=>null),U.getAlerts(10).catch(()=>null),U.getReleases(10).catch(()=>null)]),r=e||{},o=r.server_stats||{},a=r.kubernetes_stats||{},d=r.alert_stats||{},m=r.pipeline_stats||{},l=r.cost_stats||{},g=`服务器:${o.total??0}(运行${o.running??0}) | Kubernetes集群:${a.total??0} 节点:${a.total_nodes??0} Pod:${a.total_pods??0} | 告警:${d.total??0}(firing ${d.firing??0}) | 流水线:${m.total??0}(成功率${m.success_rate??0}%) | 本月成本:¥${l.month_cost??0}`,I=Array.isArray(n)?n:n?.list||[],h=Array.isArray(i)?i:i?.list||[],u=I.slice(0,10).map((p,A)=>`${A+1}.[${p.severity||"?"}|${p.status||"?"}] ${p.rule_name||"-"} → ${p.target||"-"}`),c=h.slice(0,10).map((p,A)=>`${A+1}.${p.app_name||"-"} ${p.version||""} [${p.environment||"-"}/${p.status||"-"}] by ${p.author||"-"}`);return`平台概览:${g}
最近告警:
${u.join(`
`)||"(无)"}
最近发布:
${c.join(`
`)||"(无)"}`}const gt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:At},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:ft},{id:"optimize",name:"资源优化建议",icon:Vs,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function vt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function Rt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,I]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ut),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const v=Math.random()*16|0;return(t==="x"?v:v&3|8).toString(16)})},[Q,Is]=x.useState(()=>W()),J=x.useRef(null),js=()=>J.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const v=(await $.getHistory(Q))?.list||[];n(v.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const v=z.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:v?.defaultEndpoint||f.endpoint,model:v?.models[0]||f.model}))},Ss=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){w.error("请填写 API Key");return}I(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),w.success("配置已保存"),l(!1)}catch(t){w.error(t instanceof Error?t.message:"保存失败")}finally{I(!1)}},ys=async()=>{u(!0);try{await $.testConnection(),w.success("LLM 服务连接成功")}catch(t){w.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},X=async t=>{const v={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,v,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const M=new AbortController;d.current=M;let P=!1;try{const _=[...e,v].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(S=>S.map(b=>b.id===f?{...b,content:b.content+O}:b))},M.signal,Q)}catch(_){if(M.signal.aborted)n(O=>O.map(S=>S.id===f?{...S,content:S.content||"(已停止生成)",isStopped:!0}:S));else{const O=_ instanceof Error?_.message:"对话失败";n(S=>S.map(b=>b.id===f?{...b,content:P?b.content+`
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},Y=async()=>{const t=i.trim();!t||o||(r(""),await X(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let v="";try{v=await t.contextLoader()}catch{v="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
【平台实时数据】
${v}`;await X(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();Is(t),n([]),r(""),w.success("已开始新对话")},R=z.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(zs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(os,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:gt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx("s Line truncated
@@ -1,19 +0,0 @@
import{i as _s,r as x,j as s,aO as ks,ba as Es,aF as Ls,aB as H,$ as ds,aP as Rs,B as N,z as Z,T as ms,A as xs,L as k,H as Ms,bb as ss,a4 as Ps,U as Ds,D as Ts,a as qs,b as Us,c as Bs,d as zs,e as Fs,t as w}from"./index-BTQygws6.js";import{C as D,b as T,c as ts,a as q}from"./card-D0oz3NII.js";import{I as C}from"./input-C6mE-wO9.js";import{B as E}from"./badge-BsIZhz7S.js";import{L as y}from"./label-8e-EC7mH.js";import{S as es,a as as,b as ns,c as os,d as cs}from"./select-pPlmgAjn.js";import{S as Hs}from"./switch-8l7ThrsD.js";import{d as U}from"./dashboard-DIS6joUE.js";import{a as Vs}from"./alert-BgGvEFrj.js";import{a as Ks}from"./agent-Bb56k6oq.js";import{a as $}from"./ai-BNXuq6Dq.js";import{C as Gs}from"./circle-check-DMxKs2Ba.js";import{F as hs}from"./file-text-B8e3PkIb.js";import{T as Ws}from"./trending-up-CwtABPES.js";import{R as Qs}from"./rotate-cw-ClBTsHWn.js";import{M as Js}from"./message-square-C0PKhW_h.js";import{S as Xs}from"./square-DFlNutLQ.js";import{W as Ys}from"./wifi-lPn3W9ZW.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Zs=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],st=_s("send",Zs);function tt(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function v(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,v]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,et(o,...n)]}function et(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var at=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=at.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},z={};var rs;function nt(){if(rs)return z;rs=1;var e=Es();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return z.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,z}var is;function ot(){return is||(is=1,B.exports=nt()),B.exports}var ct=ot();function rt(){return ct.useSyncExternalStore(it,()=>!0,()=>!1)}function it(){return()=>{}}var K="Avatar",[pt]=tt(K),[lt,us]=pt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(lt,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",dt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=mt(r,a),l=Ls(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});dt.displayName=fs;var gs="AvatarFallback",Is=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});Is.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function mt(e,{referrerPolicy:n,crossOrigin:i}){const r=rt(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),v=l("error");return a.addEventListener("load",g),a.addEventListener("error",v),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=iLine truncated
${i.join(`
`)}`}async function ls(){const e=await Ks.getLatest(),n=Array.isArray(e)?e:e?.list||[];if(!n.length)return"(当前无 Agent 上报数据,可能未部署监控 Agent)";const i=n.slice(0,20).map((a,d)=>{const m=a.cpu_usage??"-",l=a.mem_usage??"-";return`${d+1}. ${a.hostname||"-"} | CPU:${m}% | 内存:${l}% (${a.mem_used??"-"}/${a.mem_total??"-"}GB) | 核数:${a.cpu_cores??"-"} | 上报:${(a.report_time||"").slice(0,16)}`}),r=n.filter(a=>(a.cpu_usage??0)>=80||(a.mem_usage??0)>=80),o=r.length?`
⚠️ 高负载主机 ${r.length} 台:${r.map(a=>`${a.hostname}(CPU${a.cpu_usage}%/MEM${a.mem_usage}%)`).join("、")}`:"";return`Agent 监控的 ${n.length} 台主机实时指标:
${i.join(`
`)}${o}`}async function It(){const[e,n,i]=await Promise.all([U.getStats().catch(()=>null),U.getAlerts(10).catch(()=>null),U.getReleases(10).catch(()=>null)]),r=e||{},o=r.server_stats||{},a=r.kubernetes_stats||{},d=r.alert_stats||{},m=r.pipeline_stats||{},l=r.cost_stats||{},g=`服务器:${o.total??0}(运行${o.running??0}) | Kubernetes集群:${a.total??0} 节点:${a.total_nodes??0} Pod:${a.total_pods??0} | 告警:${d.total??0}(firing ${d.firing??0}) | 流水线:${m.total??0}(成功率${m.success_rate??0}%) | 本月成本:¥${l.month_cost??0}`,v=Array.isArray(n)?n:n?.list||[],h=Array.isArray(i)?i:i?.list||[],u=v.slice(0,10).map((p,A)=>`${A+1}.[${p.severity||"?"}|${p.status||"?"}] ${p.rule_name||"-"} → ${p.target||"-"}`),c=h.slice(0,10).map((p,A)=>`${A+1}.${p.app_name||"-"} ${p.version||""} [${p.environment||"-"}/${p.status||"-"}] by ${p.author||"-"}`);return`平台概览:${g}
最近告警:
${u.join(`
`)||"(无)"}
最近发布:
${c.join(`
`)||"(无)"}`}const vt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:gt},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:It},{id:"optimize",name:"资源优化建议",icon:Ws,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function jt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function zt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,v]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ft),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const I=Math.random()*16|0;return(t==="x"?I:I&3|8).toString(16)})},[Q,vs]=x.useState(()=>W()),J=x.useRef(null),js=()=>J.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const I=(await $.getHistory(Q))?.list||[];n(I.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const I=F.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:I?.defaultEndpoint||f.endpoint,model:I?.models[0]||f.model}))},Ss=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){w.error("请填写 API Key");return}v(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),w.success("配置已保存"),l(!1)}catch(t){w.error(t instanceof Error?t.message:"保存失败")}finally{v(!1)}},ys=async()=>{u(!0);try{await $.testConnection(),w.success("LLM 服务连接成功")}catch(t){w.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},X=async t=>{const I={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,I,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const M=new AbortController;d.current=M;let P=!1;try{const _=[...e,I].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(S=>S.map(b=>b.id===f?{...b,content:b.content+O}:b))},M.signal,Q)}catch(_){if(M.signal.aborted)n(O=>O.map(S=>S.id===f?{...S,content:S.content||"(已停止生成)",isStopped:!0}:S));else{const O=_ instanceof Error?_.message:"对话失败";n(S=>S.map(b=>b.id===f?{...b,content:P?b.content+`
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},Y=async()=>{const t=i.trim();!t||o||(r(""),await X(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let I="";try{I=await t.contextLoader()}catch{I="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
【平台实时数据】
${I}`;await X(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();vs(t),n([]),r(""),w.success("已开始新对话")},R=F.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(Rs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Gs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:vt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx(" Line truncated
@@ -0,0 +1 @@
import{j as e,r as g}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,b as B,c as K,a as z}from"./card-B1TdHH8z.js";import{S as Z}from"./stat-strip-D5jCLXat.js";import{B as q}from"./index-BZzvNKfa.js";import{B as G}from"./badge-IN84WXM6.js";import{T as J,a as Q,b as D,c as $}from"./tabs-Dx4dxq7o.js";import{S as ee,a as se,b as te,c as ae,d as M}from"./select-BFGszUub.js";import{d as ce}from"./dashboard-Bvsa0TzO.js";import{s as ie}from"./server-CxtAvlnp.js";import{a as H}from"./alert-0ZkysSZO.js";import{H as X,L as _,D as ne,a4 as Y,av as re,aw as oe,A as le,ax as de,u as pe,l as L,aa as W,ay as me,g as xe,az as he,N as ye,s as ve,aA as Ae}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function ue({forecasts:c,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):c.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:c.map((a,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:a.resource})]}),e.jsx(G,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:a.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":a.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:a.daysUntilThreshold<=7?"紧急":a.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:a.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[a.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${a.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,a.predictedUsage-a.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",Line truncated
@@ -1 +0,0 @@
import{i as G,j as e,L as U,E as q,r as g,aP as J,B as Q,A as ee,K as se,T as $,p as te,N as ce}from"./index-BTQygws6.js";import{C as F,b as K,c as B,a as H}from"./card-D0oz3NII.js";import{S as ae}from"./stat-strip-M_Ng3raR.js";import{B as Z}from"./badge-BsIZhz7S.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-CH1b5gPd.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-pPlmgAjn.js";import{d as pe}from"./dashboard-DIS6joUE.js";import{s as me}from"./server-C0cSEEX-.js";import{a as z}from"./alert-BgGvEFrj.js";import{H as X}from"./hard-drive-zBn-z9Ht.js";import{Z as Y}from"./zap-72OjNvOL.js";import{C as xe}from"./calendar-DRDZJOlv.js";import{T as W}from"./trending-up-CwtABPES.js";import{S as he}from"./sparkles-Bd2inR9e.js";import{M as ye}from"./memory-stick-CZtVAQ-V.js";import{M as ve}from"./minus-B61YKf1a.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=G("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=G("trending-down",be);function Pe({forecasts:a,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(H,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(U,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:a.map((c,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(q,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:c.resource})]}),e.jsx(Z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:c.daysUntilThreshold<=7?"紧急":c.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:c.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[c.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${c.currentUsage}%`}})Line truncated
@@ -1 +0,0 @@
import{i as Oe,j as e,I as at,T as Le,a5 as lt,Q as ze,U as it,al as mt,D as K,a as J,b as V,c as H,d as U,e as ie,B as m,O as Me,o as dt,r as a,t as d,f as Ge,C as pt,P as xt,au as ht}from"./index-BTQygws6.js";import{I as _}from"./input-C6mE-wO9.js";import{B as A}from"./badge-BsIZhz7S.js";import{C as W,a as Q,b as Te,c as _e}from"./card-D0oz3NII.js";import{S as ut}from"./stat-strip-M_Ng3raR.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-pPlmgAjn.js";import{T as gt,a as jt,b as F,c as P}from"./tabs-CH1b5gPd.js";import{S as $e}from"./switch-8l7ThrsD.js";import{a as R}from"./alert-BgGvEFrj.js";import{a as E}from"./alert-center-Bpw1a6Eu.js";import{u as qe,q as ae,b as Ie,a as Ct}from"./unwrap-Bv0ReG-f.js";import{u as $}from"./useMutation-C9fIiouP.js";import{a as Ce}from"./agent-Bb56k6oq.js";import{Z as ft}from"./zap-72OjNvOL.js";import{L as j}from"./label-8e-EC7mH.js";import{A as vt}from"./AlertRuleDialog-CkgDI_88.js";import{T as At}from"./textarea-DDxE7TMs.js";import{R as te}from"./refresh-cw-e9vbQhCy.js";import{P as re}from"./plus-DOS6OUrq.js";import{C as yt}from"./calendar-DRDZJOlv.js";import{S as Nt}from"./square-pen-DYung4SK.js";import{T as wt}from"./trash-2-5oUve9eW.js";import{S as bt}from"./search-BDsFve6h.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";import"./message-square-C0PKhW_h.js";import"./phone-DFQ2ZxxE.js";const St=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Dt=Oe("repeat",St);const kt=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],le=Oe("volume-x",kt);function Tt(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(lt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(at,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function _t(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ft,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(it,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ze,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",Line truncated
@@ -0,0 +1 @@
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{G as ct,D as Q,a as J,b as V,c as U,d as Y,e as ie,B as m,t as d,f as Oe}from"./index-BZzvNKfa.js";import{I as _}from"./input-D7JNe8Xd.js";import{B as A}from"./badge-IN84WXM6.js";import{C as W,a as K,b as Te,c as _e}from"./card-B1TdHH8z.js";import{S as at}from"./stat-strip-D5jCLXat.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-BFGszUub.js";import{T as lt,a as it,b as F,c as B}from"./tabs-Dx4dxq7o.js";import{S as Le}from"./switch-Ds1Doipu.js";import{a as R}from"./alert-0ZkysSZO.js";import{a as E}from"./alert-center-5DJQkdLR.js";import{u as ze,q as ae,b as Ge,a as mt}from"./unwrap-CDkLoNKa.js";import{u as $}from"./useMutation-DvUJDXfD.js";import{a as Ce}from"./agent-BC9_VpeZ.js";import{I as dt,l as Me,ab as pt,aX as le,y as $e,U as xt,a4 as ht,w as Ie,f as ut,R as te,P as re,b as gt,aY as jt,aw as Ct,aI as ft,T as vt,S as At,x as Nt,ar as yt}from"./vendor-icons-DIDdqO_o.js";import{L as j}from"./label-Bj0mNUAM.js";import{A as wt}from"./AlertRuleDialog-t8tfEJBV.js";import{T as bt}from"./textarea-BL_Am_oZ.js";import"./index-CYARH0Cq.js";function St(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(pt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(dt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function Dt(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ht,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(xt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx($e,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function kt(t){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信",webhook:"Webhook"}[t]||t}function Tt(t){return{firing:t.filter(s=>s.status==="firing").length,critical:t.filter(s=>s.severity==="critical"&&s.status==="firing").length,warning:t.filter(s=>s.severity==="warning"&&s.status==="firing").length,resolved:t.filter(s=>s.status==="resolved").length}}function _t(){return ze({queryKey:ae.agentAlertRules(),queryFn:async()=>{const t=await Ce.listRules();return Ge(t).map(n=>({id:n.id,name:String(n.name||""),description:`${n.metric} ${n.operator} ${n.threshold}%`,enabled:!!n.enabled,severity:"warning",type:String(n.metric||""),hostname:String(n.hostname||"全部主机"),threshold:Number(n.threshold||0)}))},staleTime:3e4})}function Rt(Line truncated
@@ -1 +0,0 @@
import{f as _,r as l,j as e,L as O,B as A,Q as W,J as Y,T as z,z as $,t as E,D as ee,a as te,b as se,c as oe,d as ae,e as ne,C as re}from"./index-BTQygws6.js";import{C as w,a as M,b as ce,c as le,d as ie}from"./card-D0oz3NII.js";import{T as me,a as de,b as H,c as I}from"./tabs-CH1b5gPd.js";import{a as g}from"./alert-BgGvEFrj.js";import{I as J}from"./input-C6mE-wO9.js";import{B as f}from"./badge-BsIZhz7S.js";import{T as X,a as V,b as R,c as i,d as q,e as c}from"./table-Dh5trM9F.js";import{S as xe}from"./search-BDsFve6h.js";import{S as B}from"./switch-8l7ThrsD.js";import{C as G}from"./checkbox-D73wKf04.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-CkgDI_88.js";import{T as P}from"./trash-2-5oUve9eW.js";import{L as D}from"./label-8e-EC7mH.js";import{T as be}from"./textarea-DDxE7TMs.js";import{P as U}from"./plus-DOS6OUrq.js";import{R as Ae,C as je,X as ue,Y as Ne,T as ve}from"./generateCategoricalChart-B4pnCJMD.js";import{A as fe,a as Q}from"./AreaChart-qozZsHkf.js";import"./index-WFeZT6kc.js";import"./message-square-C0PKhW_h.js";import"./phone-DFQ2ZxxE.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(xe,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(J,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7"Line truncated
@@ -0,0 +1 @@
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as w,a as M,b as ee,c as te,d as se}from"./card-B1TdHH8z.js";import{f as _,B as A,t as E,D as oe,a as ae,b as ne,c as re,d as ce,e as le}from"./index-BZzvNKfa.js";import{T as ie,a as me,b as H,c as I}from"./tabs-Dx4dxq7o.js";import{a as g}from"./alert-0ZkysSZO.js";import{I as Y}from"./input-D7JNe8Xd.js";import{B as f}from"./badge-IN84WXM6.js";import{T as $,a as Q,b as R,c as i,d as X,e as c}from"./table-CQE_AU2l.js";import{S as de,L as O,y as J,t as V,l as z,T as B,p as q,P as U,b as xe}from"./vendor-icons-DIDdqO_o.js";import{S as P}from"./switch-Ds1Doipu.js";import{C as G}from"./checkbox-DjjvQsNy.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-t8tfEJBV.js";import{L as D}from"./label-Bj0mNUAM.js";import{T as be}from"./textarea-BL_Am_oZ.js";import{R as Ae,A as je,C as ue,X as Ne,Y as ve,T as fe,a as W}from"./AreaChart-B36pk06p.js";import"./index-CYARH0Cq.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(V,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(de,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertEventsTab.tsx:133:9",className:Line truncated
@@ -1,4 +1,4 @@
import{j as e,J as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}from"./index-BTQygws6.js";import{I as x}from"./input-C6mE-wO9.js";import{L as n}from"./label-8e-EC7mH.js";import{T as E}from"./textarea-DDxE7TMs.js";import{S as P}from"./switch-8l7ThrsD.js";import{a as A}from"./alert-BgGvEFrj.js";import{M as T}from"./message-square-C0PKhW_h.js";import{P as I,M as B}from"./phone-DFQ2ZxxE.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const M=[{key:"dingtalk",label:"钉钉",placeholder:`{
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{D as R,a as v,b as w,c as k,d as S,e as _,B as g}from"./index-BZzvNKfa.js";import{I as x}from"./input-D7JNe8Xd.js";import{L as n}from"./label-Bj0mNUAM.js";import{T as C}from"./textarea-BL_Am_oZ.js";import{S as L}from"./switch-Ds1Doipu.js";import{a as A}from"./alert-0ZkysSZO.js";import{t as E,aj as P,ak as T,al as I,L as B}from"./vendor-icons-DIDdqO_o.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const z=[{key:"dingtalk",label:"钉钉",placeholder:`{
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=***",
"secret": "SECxxx"
}`},{key:"wechat",label:"企业微信",placeholder:`{
@@ -11,4 +11,4 @@ import{j as e,J as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}f
"sign": "AIOps"
}`},{key:"webhook",label:"Webhook",placeholder:`{
"url": "https://example.com/alert"
}`}];function y(o){return M.find(r=>r.key===o)?.label||o}function j(o){switch(o){case"email":return B;case"sms":return I;case"dingtalk":case"wechat":return T;default:return R}}function U(o,r){const a=D(o.notify_channels);return a.length===0?e.jsx("span",{"code-path":"src/components/monitor/alertShared.tsx:76:33",className:"text-xs text-slate-600",children:"--"}):e.jsx("div",{"code-path":"src/components/monitor/alertShared.tsx:78:5",className:"flex flex-wrap gap-1",children:a.map(c=>{const i=H(c,r);if(!i)return null;const t=j(i.type);return e.jsxs("span",{"code-path":"src/components/monitor/alertShared.tsx:84:11",title:`${i.name} (${y(i.type)})`,className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:[e.jsx(t,{"code-path":"src/components/monitor/alertShared.tsx:89:13",className:"h-3 w-3 text-slate-400"}),i.name]},c)})})}const b={name:"",description:"",type:"metric",source:"prometheus",expression:"",severity:"warning",duration:300,notify_channels:[]};function Z({open:o,onOpenChange:r,editingRule:a,notifyChannels:c,onSaved:i}){const[t,l]=d.useState({...b}),[h,u]=d.useState(!1);d.useEffect(()=>{o&&l(a?{name:a.name||"",description:a.description||"",type:a.type||"metric",source:a.source||"prometheus",expression:a.expression||"",severity:a.severity||"warning",duration:a.duration||300,notify_channels:D(a.notify_channels)}:{...b})},[o,a]);const f=s=>{l(m=>({...m,notify_channels:m.notify_channels.includes(s)?m.notify_channels.filter(p=>p!==s):[...m.notify_channels,s]}))},N=async()=>{if(!(!t.name.trim()||!t.expression.trim())){u(!0);try{const s={name:t.name.trim(),description:t.description.trim(),type:t.type,source:t.source,expression:t.expression.trim(),severity:t.severity,duration:Number(t.duration)||0,notify_channels:t.notify_channels};a?await A.updateRule(a.id,s):await A.createRule(s),r(!1),i()}catch(s){console.error("Failed to save rule:",s)}finally{u(!1)}}};return e.jsx(v,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:103:5",open:o,onOpenChange:r,children:e.jsxs(w,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:104:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(k,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:105:9",children:[e.jsx(S,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:106:11",className:"text-slate-100",children:a?"编辑告警规则":"新建告警规则"}),e.jsx(_,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:109:11",className:"text-slate-500",children:a?"修改告警规则的触发条件和通知方式":"配置监控指标的告警触发条件"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:114:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:115:11",className:"space-y-1.5",children:[e.jsxs(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:13",className:"text-slate-300",children:["规则名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:52",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:117:13",value:t.name,onChange:s=>l({...t,name:s.target.value}),placeholder:"如:CPU 使用率告警",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:125:11",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:126:13",className:"text-slate-300",children:"描述"}),e.jsx(E,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:127:13",value:t.description,onChange:s=>l({...t,description:s.target.value}),placeholder:"规则说明",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 resize-none"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:136:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:137:13",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:138:15",className:"text-slate-300",children:"规则类型"}),e.jsxs("select",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:139:15",value:t.type,onChange:s=>l({...t,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:144:17",value:"metric",children:"指标监控"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:145:17",value:"log",children:"日志告警"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:146:17",value:"event",children:"事件告警"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:149:13",className:"space-y-1.5",chi Line truncated
}`}];function j(o){return z.find(r=>r.key===o)?.label||o}function y(o){switch(o){case"email":return I;case"sms":return T;case"dingtalk":case"wechat":return P;default:return E}}function U(o,r){const a=D(o.notify_channels);return a.length===0?e.jsx("span",{"code-path":"src/components/monitor/alertShared.tsx:76:33",className:"text-xs text-slate-600",children:"--"}):e.jsx("div",{"code-path":"src/components/monitor/alertShared.tsx:78:5",className:"flex flex-wrap gap-1",children:a.map(c=>{const i=H(c,r);if(!i)return null;const t=y(i.type);return e.jsxs("span",{"code-path":"src/components/monitor/alertShared.tsx:84:11",title:`${i.name} (${j(i.type)})`,className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:[e.jsx(t,{"code-path":"src/components/monitor/alertShared.tsx:89:13",className:"h-3 w-3 text-slate-400"}),i.name]},c)})})}const b={name:"",description:"",type:"metric",source:"prometheus",expression:"",severity:"warning",duration:300,notify_channels:[]};function Z({open:o,onOpenChange:r,editingRule:a,notifyChannels:c,onSaved:i}){const[t,l]=d.useState({...b}),[h,u]=d.useState(!1);d.useEffect(()=>{o&&l(a?{name:a.name||"",description:a.description||"",type:a.type||"metric",source:a.source||"prometheus",expression:a.expression||"",severity:a.severity||"warning",duration:a.duration||300,notify_channels:D(a.notify_channels)}:{...b})},[o,a]);const f=s=>{l(m=>({...m,notify_channels:m.notify_channels.includes(s)?m.notify_channels.filter(p=>p!==s):[...m.notify_channels,s]}))},N=async()=>{if(!(!t.name.trim()||!t.expression.trim())){u(!0);try{const s={name:t.name.trim(),description:t.description.trim(),type:t.type,source:t.source,expression:t.expression.trim(),severity:t.severity,duration:Number(t.duration)||0,notify_channels:t.notify_channels};a?await A.updateRule(a.id,s):await A.createRule(s),r(!1),i()}catch(s){console.error("Failed to save rule:",s)}finally{u(!1)}}};return e.jsx(R,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:103:5",open:o,onOpenChange:r,children:e.jsxs(v,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:104:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(w,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:105:9",children:[e.jsx(k,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:106:11",className:"text-slate-100",children:a?"编辑告警规则":"新建告警规则"}),e.jsx(S,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:109:11",className:"text-slate-500",children:a?"修改告警规则的触发条件和通知方式":"配置监控指标的告警触发条件"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:114:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:115:11",className:"space-y-1.5",children:[e.jsxs(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:13",className:"text-slate-300",children:["规则名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:52",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:117:13",value:t.name,onChange:s=>l({...t,name:s.target.value}),placeholder:"如:CPU 使用率告警",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:125:11",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:126:13",className:"text-slate-300",children:"描述"}),e.jsx(C,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:127:13",value:t.description,onChange:s=>l({...t,description:s.target.value}),placeholder:"规则说明",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 resize-none"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:136:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:137:13",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:138:15",className:"text-slate-300",children:"规则类型"}),e.jsxs("select",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:139:15",value:t.type,onChange:s=>l({...t,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:144:17",value:"metric",children:"指标监控"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:145:17",value:"log",children:"日志告警"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:146:17",value:"event",children:"事件告警"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:149:13",className:"space-y-1.5",chi Line truncated
@@ -1 +0,0 @@
import{j as e}from"./index-BTQygws6.js";import{A as t}from"./ApprovalCategoryPage-Bn7tBKnm.js";import"./card-D0oz3NII.js";import"./input-C6mE-wO9.js";import"./badge-BsIZhz7S.js";import"./label-8e-EC7mH.js";import"./table-Dh5trM9F.js";import"./select-pPlmgAjn.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";import"./approval-DHBTR1U2.js";import"./plus-DOS6OUrq.js";import"./search-BDsFve6h.js";import"./refresh-cw-e9vbQhCy.js";import"./file-text-B8e3PkIb.js";import"./circle-x-CYoA2i-_.js";import"./play-BAPO-6Xq.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function v(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{v as ApprovalAppPage};
@@ -0,0 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as t}from"./ApprovalCategoryPage-Bzsd7R5T.js";import"./card-B1TdHH8z.js";import"./index-BZzvNKfa.js";import"./vendor-icons-DIDdqO_o.js";import"./input-D7JNe8Xd.js";import"./badge-IN84WXM6.js";import"./label-Bj0mNUAM.js";import"./table-CQE_AU2l.js";import"./select-BFGszUub.js";import"./index-CYARH0Cq.js";import"./approval-D08dbtmC.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function g(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{g as ApprovalAppPage};
@@ -1 +0,0 @@
import{r as c,j as e,B as x,L as H,X as I,O as B,P as de,D as M,a as W,b as Y,c as Z,d as ee,C as xe,Q as ne,t as l,U as he,o as ie}from"./index-BTQygws6.js";import{C as ve,a as me}from"./card-D0oz3NII.js";import{I as q}from"./input-C6mE-wO9.js";import{B as z}from"./badge-BsIZhz7S.js";import{L as ye}from"./label-8e-EC7mH.js";import{T as ue,a as Ce,b as J,c as N,d as je,e as f}from"./table-Dh5trM9F.js";import{S as U,a as X,b as K,c as Q,d as w}from"./select-pPlmgAjn.js";import{b as h}from"./approval-DHBTR1U2.js";import{P as Pe}from"./plus-DOS6OUrq.js";import{S as Ae}from"./search-BDsFve6h.js";import{R as be}from"./refresh-cw-e9vbQhCy.js";import{F as Ne}from"./file-text-B8e3PkIb.js";import{C as fe}from"./circle-x-CYoA2i-_.js";import{P as we}from"./play-BAPO-6Xq.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(fe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function G(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function qe({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),O=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{O()},[O]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},R=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:R,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translLine truncated
@@ -0,0 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as de,a as xe}from"./card-B1TdHH8z.js";import{B as x,D as Q,a as W,b as Y,c as Z,d as ee,t as l}from"./index-BZzvNKfa.js";import{I as H}from"./input-D7JNe8Xd.js";import{B as z}from"./badge-IN84WXM6.js";import{L as ne}from"./label-Bj0mNUAM.js";import{T as he,a as ie,b as q,c as N,d as ve,e as f}from"./table-CQE_AU2l.js";import{S as J,a as U,b as X,c as K,d as w}from"./select-BFGszUub.js";import{b as h}from"./approval-D08dbtmC.js";import{P as me,S as ye,R as ue,L as G,F as Ce,X as I,w as B,x as je,b as Pe,a as Ae,y as be,U as Ne,z as fe,f as we}from"./vendor-icons-DIDdqO_o.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(be,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function M(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function Re({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),R=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{R()},[R]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},O=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:O,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(me,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(ye,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:168:11",placeholdeLine truncated
@@ -0,0 +1 @@
import{j as e,r as v}from"./vendor-codemirror-C7mXSpXt.js";import{m as b,B as i,D as M,a as V,b as q,c as H,d as Q,e as G,t as T}from"./index-BZzvNKfa.js";import{C as u,a as j,b as ye,c as Ne,d as we}from"./card-B1TdHH8z.js";import{B as C}from"./badge-IN84WXM6.js";import{T as pe}from"./textarea-BL_Am_oZ.js";import{b as k}from"./approval-D08dbtmC.js";import{I as le}from"./input-D7JNe8Xd.js";import{h as fe,aQ as Te,F as _,C as D,a as F,L as $,S as De,x as Fe,af as Ce,J as oe,aI as Pe,ae as Se,b as ce,P as ke}from"./vendor-icons-DIDdqO_o.js";import{L as _e}from"./label-Bj0mNUAM.js";import{S as Le,a as Oe,b as Ie,c as $e,d as Re}from"./select-BFGszUub.js";import"./index-CYARH0Cq.js";function ze(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}function I(a){if(!a)return[];const r=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return r?Array.isArray(r.fields)?r.fields:[]:[]}function Be(a,r){if(!a)return null;let s;try{s=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!s||typeof s!="object")return null;const o=I(r?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(s).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const R=[{value:"server_apply",label:"云服务器申请",icon:fe,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Te,color:"var(--dg-blue)"}],Y=a=>R.find(r=>r.value===a)?.label||a||"通用审批",L=a=>R.find(r=>r.value===a)?.color||"var(--dg-text-secondary)",Ee=a=>R.find(r=>r.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const r=ze(a.steps),s=a.current_step??0,o=r.length,n=r.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:r,currentIndex:s,total:o,completed:n,percentage:m}}function X(a){const{steps:r,currentIndex:s}=U(a);return r.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:r.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===s,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<r.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function Me(a){const r={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(--dg-blue)]/10",dot:"bg-[var(--dg-blue)]"},completed:{label:"已完成",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",dot:"bg-[var(--dg-text-secondary)]"}},s=r[a]||r.pending;return e.jsxs(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:64:5",variant:"outline",className:s.className,children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:65:7",clLine truncated
@@ -1 +0,0 @@
import{i as ye,S as Ne,j as e,$ as b,L as $,B as i,P as we,V as oe,D as M,a as J,b as q,c as H,d as G,C as pe,e as Q,r as v,t as T}from"./index-BTQygws6.js";import{C as u,a as j,b as fe,c as Te,d as De}from"./card-D0oz3NII.js";import{B as C}from"./badge-BsIZhz7S.js";import{T as le}from"./textarea-DDxE7TMs.js";import{b as k}from"./approval-DHBTR1U2.js";import{I as ce}from"./input-C6mE-wO9.js";import{F as _}from"./file-text-B8e3PkIb.js";import{C as D}from"./circle-check-DMxKs2Ba.js";import{C as F}from"./circle-x-CYoA2i-_.js";import{S as Fe}from"./search-BDsFve6h.js";import{F as Ce}from"./funnel-61tqn0Og.js";import{S as Pe}from"./square-pen-DYung4SK.js";import{A as Se}from"./arrow-right-QQqkjfZb.js";import{L as ke}from"./label-8e-EC7mH.js";import{S as _e,a as Le,b as Oe,c as Ie,d as $e}from"./select-pPlmgAjn.js";import{P as ze}from"./plus-DOS6OUrq.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Re=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Be=ye("git-commit-horizontal",Re);function Ee(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}return[]}function I(a){if(!a)return[];const s=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return s?Array.isArray(s.fields)?s.fields:[]:[]}function Ve(a,s){if(!a)return null;let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!r||typeof r!="object")return null;const o=I(s?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(r).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const z=[{value:"server_apply",label:"云服务器申请",icon:Ne,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Be,color:"var(--dg-blue)"}],Y=a=>z.find(s=>s.value===a)?.label||a||"通用审批",L=a=>z.find(s=>s.value===a)?.color||"var(--dg-text-secondary)",Me=a=>z.find(s=>s.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const s=Ee(a.steps),r=a.current_step??0,o=s.length,n=s.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:s,currentIndex:r,total:o,completed:n,percentage:m}}function X(a){const{steps:s,currentIndex:r}=U(a);return s.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:s.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===r,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<s.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function qe(a){const s={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(--Line truncated
@@ -0,0 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-Bzsd7R5T.js";import"./card-B1TdHH8z.js";import"./index-BZzvNKfa.js";import"./vendor-icons-DIDdqO_o.js";import"./input-D7JNe8Xd.js";import"./badge-IN84WXM6.js";import"./label-Bj0mNUAM.js";import"./table-CQE_AU2l.js";import"./select-BFGszUub.js";import"./index-CYARH0Cq.js";import"./approval-D08dbtmC.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function P(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{P as ApprovalPermissionPage};
@@ -1 +0,0 @@
import{j as e}from"./index-BTQygws6.js";import{A as r}from"./ApprovalCategoryPage-Bn7tBKnm.js";import"./card-D0oz3NII.js";import"./input-C6mE-wO9.js";import"./badge-BsIZhz7S.js";import"./label-8e-EC7mH.js";import"./table-Dh5trM9F.js";import"./select-pPlmgAjn.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";import"./approval-DHBTR1U2.js";import"./plus-DOS6OUrq.js";import"./search-BDsFve6h.js";import"./refresh-cw-e9vbQhCy.js";import"./file-text-B8e3PkIb.js";import"./circle-x-CYoA2i-_.js";import"./play-BAPO-6Xq.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{b as ApprovalPermissionPage};
@@ -1 +0,0 @@
import{j as e}from"./index-BTQygws6.js";import{A as r}from"./ApprovalCategoryPage-Bn7tBKnm.js";import"./card-D0oz3NII.js";import"./input-C6mE-wO9.js";import"./badge-BsIZhz7S.js";import"./label-8e-EC7mH.js";import"./table-Dh5trM9F.js";import"./select-pPlmgAjn.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";import"./approval-DHBTR1U2.js";import"./plus-DOS6OUrq.js";import"./search-BDsFve6h.js";import"./refresh-cw-e9vbQhCy.js";import"./file-text-B8e3PkIb.js";import"./circle-x-CYoA2i-_.js";import"./play-BAPO-6Xq.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function x(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{x as ApprovalResourcePage};
@@ -0,0 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-Bzsd7R5T.js";import"./card-B1TdHH8z.js";import"./index-BZzvNKfa.js";import"./vendor-icons-DIDdqO_o.js";import"./input-D7JNe8Xd.js";import"./badge-IN84WXM6.js";import"./label-Bj0mNUAM.js";import"./table-CQE_AU2l.js";import"./select-BFGszUub.js";import"./index-CYARH0Cq.js";import"./approval-D08dbtmC.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{b as ApprovalResourcePage};
@@ -0,0 +1 @@
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as Q}from"./card-B1TdHH8z.js";import{f as V,u as X,t as C,B as $}from"./index-BZzvNKfa.js";import{a as S}from"./approval-D08dbtmC.js";import{L as D,P as R,J as H,K as z,O as Z,Q as Y,z as J,c as ee,T as F,X as G,j as q,V as se,W as ae,Y as te,y as re}from"./vendor-icons-DIDdqO_o.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:se,audit:q,execute:J},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:y,onClear:A,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:A,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(re,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const y=!!i,[A,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({name:s.name,step_type:s.step_type==="serial"||s.step_type==="parallel"?"audit":s.step_type,approver_ids:T(s.approver_ids)}))):h([{name:"提交申请",Line truncated
@@ -1 +0,0 @@
import{f as Q,r as p,u as V,t as C,j as e,L as R,B as $,V as X,W as Y,X as z,v as J,Y as H,Q as K}from"./index-BTQygws6.js";import{C as Z,a as ee}from"./card-D0oz3NII.js";import{a as S}from"./approval-DHBTR1U2.js";import{P as F}from"./plus-DOS6OUrq.js";import{S as D}from"./star-LL2nQvPd.js";import{C as se}from"./chevron-up-Z8QjN8G2.js";import{P as G}from"./play-BAPO-6Xq.js";import{P as ae}from"./pen-B5_8qwiI.js";import{T as q}from"./trash-2-5oUve9eW.js";import{A as te,a as re}from"./arrow-up-CcBQTWpn.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},O={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:H,audit:J,execute:G},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:A,onClear:y,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:A,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:y,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(K,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const A=!!i,[y,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({nLine truncated
@@ -0,0 +1,61 @@
import{au as ee}from"./index-BZzvNKfa.js";import{d as ti,g as ue,r as N,a as T}from"./vendor-codemirror-C7mXSpXt.js";var Wa,vh;function Re(){if(vh)return Wa;vh=1;var e=Array.isArray;return Wa=e,Wa}var Ua,yh;function Zg(){if(yh)return Ua;yh=1;var e=typeof ti=="object"&&ti&&ti.Object===Object&&ti;return Ua=e,Ua}var Ha,mh;function ot(){if(mh)return Ha;mh=1;var e=Zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ha=r,Ha}var Ga,gh;function Gn(){if(gh)return Ga;gh=1;var e=ot(),t=e.Symbol;return Ga=t,Ga}var Ka,bh;function sw(){if(bh)return Ka;bh=1;var e=Gn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Ka=a,Ka}var Va,xh;function lw(){if(xh)return Va;xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Va=r,Va}var Xa,wh;function xt(){if(wh)return Xa;wh=1;var e=Gn(),t=sw(),r=lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return Xa=o,Xa}var Ya,Oh;function wt(){if(Oh)return Ya;Oh=1;function e(t){return t!=null&&typeof t=="object"}return Ya=e,Ya}var Za,_h;function Nr(){if(_h)return Za;_h=1;var e=xt(),t=wt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Za=n,Za}var Ja,Sh;function uf(){if(Sh)return Ja;Sh=1;var e=Re(),t=Nr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ja=i,Ja}var Qa,Ah;function Ct(){if(Ah)return Qa;Ah=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Qa=e,Qa}var eo,Ph;function cf(){if(Ph)return eo;Ph=1;var e=xt(),t=Ct(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return eo=o,eo}var to,Th;function fw(){if(Th)return to;Th=1;var e=ot(),t=e["__core-js_shared__"];return to=t,to}var ro,Eh;function hw(){if(Eh)return ro;Eh=1;var e=fw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return ro=r,ro}var no,jh;function Jg(){if(jh)return no;jh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return no=r,no}var io,Mh;function pw(){if(Mh)return io;Mh=1;var e=cf(),t=hw(),r=Ct(),n=Jg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return io=l,io}var ao,Ch;function dw(){if(Ch)return ao;Ch=1;function e(t,r){return t?.[r]}return ao=e,ao}var oo,$h;function Qt(){if($h)return oo;$h=1;var e=pw(),t=dw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return oo=r,oo}var uo,Ih;function ha(){if(Ih)return uo;Ih=1;var e=Qt(),t=e(Object,"create");return uo=t,uo}var co,Rh;function vw(){if(Rh)return co;Rh=1;var e=ha();function t(){this.__data__=e?e(null):{},this.size=0}return co=t,co}var so,kh;function yw(){if(kh)return so;kh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return so=e,so}var lo,Dh;function mw(){if(Dh)return lo;Dh=1;var e=ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return lo=i,lo}var fo,Nh;function gw(){if(Nh)return fo;Nh=1;var e=ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return fo=n,fo}var ho,qh;function bw(){if(qh)return ho;qh=1;var e=ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ho=r,ho}var po,Bh;function xw(){if(Bh)return po;Bh=1;var e=vw(),t=yw(),r=mw(),n=gw(),i=bw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,po=a,po}var vo,Lh;function ww(){if(Lh)return vo;Lh=1;function e(){this.__data__=[],this.size=0}return vo=e,vo}var yo,Fh;function sf(){if(Fh)return yo;Fh=1;function e(t,r){return t===r||t!==t&&r!==r}return yo=e,yo}var mo,zh;function pa(){if(zh)return mo;zh=1;var e=sf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return mo=t,mo}var go,Wh;function Ow(){if(Wh)return go;Wh=1;var e=pa(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)retLine truncated
A`).concat(o,",").concat(o,",0,1,1,").concat(2*u,",").concat(a,`
H`).concat(ze,"M").concat(2*u,",").concat(a,`
A`).concat(o,",").concat(o,",0,1,1,").concat(u,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return T.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(ze/8,"h").concat(ze,"v").concat(ze*3/4,"h").concat(-ze,"z"),className:"recharts-legend-icon"});if(T.isValidElement(n.legendIcon)){var s=d1({},n);return delete s.legendIcon,T.cloneElement(n.legendIcon,s)}return T.createElement(bf,{fill:c,cx:a,cy:a,size:ze,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,u=i.layout,c=i.formatter,s=i.inactiveColor,f={x:0,y:0,width:ze,height:ze},l={display:u==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(d,m){var v=d.formatter||c,p=ee(fn(fn({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",d.inactive));if(d.type==="none")return null;var b=V(d.value)?null:d.value;dt(!V(d.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var x=d.inactive?s:d.color;return T.createElement("li",tl({className:p,style:l,key:"legend-item-".concat(m)},mi(n.props,d,m)),T.createElement(Vs,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),T.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(b,d,m):b))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);fn(xf,"displayName","Legend");fn(xf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var au,Fp;function _1(){if(Fp)return au;Fp=1;var e=da();function t(){this.__data__=new e,this.size=0}return au=t,au}var ou,zp;function S1(){if(zp)return ou;zp=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return ou=e,ou}var uu,Wp;function A1(){if(Wp)return uu;Wp=1;function e(t){return this.__data__.get(t)}return uu=e,uu}var cu,Up;function P1(){if(Up)return cu;Up=1;function e(t){return this.__data__.has(t)}return cu=e,cu}var su,Hp;function T1(){if(Hp)return su;Hp=1;var e=da(),t=lf(),r=ff(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.length<n-1)return c.push([a,o]),this.size=++u.size,this;u=this.__data__=new r(c)}return u.set(a,o),this.size=u.size,this}return su=i,su}var lu,Gp;function Sb(){if(Gp)return lu;Gp=1;var e=da(),t=_1(),r=S1(),n=A1(),i=P1(),a=T1();function o(u){var c=this.__data__=new e(u);this.size=c.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,lu=o,lu}var fu,Kp;function E1(){if(Kp)return fu;Kp=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return fu=t,fu}var hu,Vp;function j1(){if(Vp)return hu;Vp=1;function e(t){return this.__data__.has(t)}return hu=e,hu}var pu,Xp;function Ab(){if(Xp)return pu;Xp=1;var e=ff(),t=E1(),r=j1();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new e;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,pu=n,pu}var du,Yp;function Pb(){if(Yp)return du;Yp=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(t[n],n,t))return!0;return!1}return du=e,du}var vu,Zp;function Tb(){if(Zp)return vu;Zp=1;function e(t,r){return t.has(r)}return vu=e,vu}var yu,Jp;function Eb(){if(Jp)return yu;Jp=1;var e=Ab(),t=Pb(),r=Tb(),n=1,i=2;function a(o,u,c,s,f,l){var h=c&n,d=o.length,m=u.length;if(d!=m&&!(h&&m>d))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var b=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++b<d;){var O=o[b],y=u[b];if(s)var g=h?s(y,O,b,u,o,l):s(O,y,b,o,u,l);if(g!==void 0){if(g)continue;x=!1;break}if(w){if(!t(u,function(_,S){if(!r(w,S)&&(O===_||f(O,_,c,s,l)))return w.push(S)})){x=!1;break}}else if(!(O===y||f(O,y,c,s,l))){x=!1;break}}return l.delete(o),l.delete(u),x}return yu=a,yu}var mu,Qp;function M1(){if(Qp)return mu;Qp=1;var e=ot(),t=e.Uint8Array;return mu=t,mu}var gu,ed;function C1(){if(ed)return gu;ed=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i,a){n[++r]=[a,i]}),n}return gu=e,gu}var bu,td;function wf(){if(td)return bu;td=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i){n[++r]=i}),n}return bu=e,bu}var xu,rd;function $1(){if(rd)return xu;rd=1;var e=Gn(),t=M1(),r=sf(),n=Eb(),i=C1(),a=wf(),o=1,u=2,c="[object Boolean]",s="[object Date]",f="[object Error]",l="[object Map]",h="[object Number]",d="[object RegExp]",m="[object Set]",v="[object String]",p="[object Symbol]",b="[object ArrayBuffer]",x="[object DataView]",w=e?e.prototype:void 0,O=w?w.valueOf:void 0;function y(g,_,S,P,M,A,E){switch(S){case x:if(g.byteLength!=_.byteLength||g.byteOffset!=_.byteOffset)re Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y_(e,t){if(e){if(typeof e=="string")return Cv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cv(e,t)}}function Cv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Z_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function J_(e){if(Array.isArray(e))return e}function $v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$v(Object(r),!0).forEach(function(n){Q_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$v(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Q_(e,t,r){return t=eS(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eS(e){var t=tS(e,"string");return hn(t)=="symbol"?t:t+""}function tS(e,t){if(hn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rS(e){return Array.isArray(e)&&we(e[0])&&we(e[1])?e.join(" ~ "):e}var nS=function(t){var r=t.separator,n=r===void 0?" : ":r,i=t.contentStyle,a=i===void 0?{}:i,o=t.itemStyle,u=o===void 0?{}:o,c=t.labelStyle,s=c===void 0?{}:c,f=t.payload,l=t.formatter,h=t.itemSorter,d=t.wrapperClassName,m=t.labelClassName,v=t.label,p=t.labelFormatter,b=t.accessibilityLayer,x=b===void 0?!1:b,w=function(){if(f&&f.length){var E={padding:0,margin:0},j=(h?Tf(f,h):f).map(function(I,C){if(I.type==="none")return null;var R=Wc({display:"block",paddingTop:4,paddingBottom:4,color:I.color||"#000"},u),D=I.formatter||l||rS,B=I.value,L=I.name,U=B,G=L;if(D&&U!=null&&G!=null){var z=D(B,L,I,C,f);if(Array.isArray(z)){var K=V_(z,2);U=K[0],G=K[1]}else U=z}return T.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(C),style:R},we(G)?T.createElement("span",{className:"recharts-tooltip-item-name"},G):null,we(G)?T.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,T.createElement("span",{className:"recharts-tooltip-item-value"},U),T.createElement("span",{className:"recharts-tooltip-item-unit"},I.unit||""))});return T.createElement("ul",{className:"recharts-tooltip-item-list",style:E},j)}return null},O=Wc({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),y=Wc({margin:0},s),g=!J(v),_=g?v:"",S=ee("recharts-default-tooltip",d),P=ee("recharts-tooltip-label",m);g&&p&&f!==void 0&&f!==null&&(_=p(v,f));var M=x?{role:"status","aria-live":"assertive"}:{};return T.createElement("div",il({className:S,style:O},M),T.createElement("p",{className:P,style:y},T.isValidElement(_)?_:"".concat(_)),w())};function pn(e){"@babel/helpers - typeof";return pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pn(e)}function ni(e,t,r){return t=iS(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iS(e){var t=aS(e,"string");return pn(t)=="symbol"?t:t+""}function aS(e,t){if(pn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gr="recharts-tooltip-wrapper",oS={visibility:"hidden"};function uS(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return ee(Gr,ni(ni(ni(ni({},"".concat(Gr,"-right"),q(r)&&t&&q(t.x)&&r>=t.x),"".concat(Gr,"-left"),q(r)&&t&&q(t.x)&&r<t.x),"".concat(Gr,"-bottom"),q(n)&&t&&q(t.y)&&n>=t.y),"".concat(Gr,"-top"),q(n)&&t&&q(t.y)&&n<t.y))}function Iv(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,i=e.offsetTopLeft,a=e.position,o=e.reverseDirection,u=e.tooltipDimension,c=e.viewBox,s=e.viewBoxDimension;if(a&&q(a[n]))return a[n];var f=r[n]-u-i,l=r[n]+i;if(t[n])return o[n]?f:l;if(o[n]){var h=f,d=c[n];return h<d?Math.max(l,c[n]):Math.max(f,c[n])}var m=l+u,v=c[n]+s;return m>v?Math.max(f,c[n]):Math.max(l,c[n])}function cS(e){ Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FS(e,t){if(e){if(typeof e=="string")return Gv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gv(e,t)}}function Gv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function WS(e){if(Array.isArray(e))return e}var uN=N.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,i=n===void 0?{width:-1,height:-1}:n,a=e.width,o=a===void 0?"100%":a,u=e.height,c=u===void 0?"100%":u,s=e.minWidth,f=s===void 0?0:s,l=e.minHeight,h=e.maxHeight,d=e.children,m=e.debounce,v=m===void 0?0:m,p=e.id,b=e.className,x=e.onResize,w=e.style,O=w===void 0?{}:w,y=N.useRef(null),g=N.useRef();g.current=x,N.useImperativeHandle(t,function(){return Object.defineProperty(y.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),y.current},configurable:!0})});var _=N.useState({containerWidth:i.width,containerHeight:i.height}),S=BS(_,2),P=S[0],M=S[1],A=N.useCallback(function(j,I){M(function(C){var R=Math.round(j),D=Math.round(I);return C.containerWidth===R&&C.containerHeight===D?C:{containerWidth:R,containerHeight:D}})},[]);N.useEffect(function(){var j=function(L){var U,G=L[0].contentRect,z=G.width,K=G.height;A(z,K),(U=g.current)===null||U===void 0||U.call(g,z,K)};v>0&&(j=Yb(j,v,{trailing:!0,leading:!1}));var I=new ResizeObserver(j),C=y.current.getBoundingClientRect(),R=C.width,D=C.height;return A(R,D),I.observe(y.current),function(){I.disconnect()}},[A,v]);var E=N.useMemo(function(){var j=P.containerWidth,I=P.containerHeight;if(j<0||I<0)return null;dt(zt(o)||zt(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),dt(!r||r>0,"The aspect(%s) must be greater than zero.",r);var C=zt(o)?j:o,R=zt(c)?I:c;r&&r>0&&(C?R=C/r:R&&(C=R*r),h&&R>h&&(R=h)),dt(C>0||R>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,C,R,o,c,f,l,r);var D=!Array.isArray(d)&&pt(d.type).endsWith("Chart");return T.Children.map(d,function(B){return T.isValidElement(B)?N.cloneElement(B,ii({width:C,height:R},D?{style:ii({height:"100%",width:"100%",maxHeight:R,maxWidth:C},B.props.style)}:{})):B})},[r,d,c,h,l,f,P,o]);return T.createElement("div",{id:p?"".concat(p):void 0,className:ee("recharts-responsive-container",b),style:ii(ii({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:y},E)}),Zb=function(t){return null};Zb.displayName="Cell";function vn(e){"@babel/helpers - typeof";return vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vn(e)}function Kv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kv(Object(r),!0).forEach(function(n){US(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kv(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function US(e,t,r){return t=HS(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function HS(e){var t=GS(e,"string");return vn(t)=="symbol"?t:t+""}function GS(e,t){if(vn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(vn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ar={widthCache:{},cacheCount:0},KS=2e3,VS={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Vv="recharts_measurement_span";function XS(e){var t=cl({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var an=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Fr.isSsr)return{width:0,height:0};var n=XS(r),i=JSON.stringify({text:t,copyStyle:n});if(ar.widthCache[i])return ar.widthCache[i];try{var a=document.getElementById(Vv);a||(a=document.createElement("span"),a.setAttribute("id",Vv),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=cl(cl({},VS),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return ar.widthCache[i]=c,++ar.cacheCount>KS&&(ar.cacheCount=0,ar.widthCache={}),c}catch{return{width:0,height:0}}},YS=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function yn(e){"@babel/helpers - typeof";return yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yn(e)}function Ti(e,t){return eA(e)||QS(e,t)||JS(e,t)||ZS()}function ZS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JS(e,t){if(e){if(typeof e=="string")return Xv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xv(e,t)}}function Xv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function QS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function eA(e){if(Array.isArray(e))return e}function tA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yv(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,nA(n.key),n)}}function rA(e,t,r){return t&&Yv(e.prototype,t),r&&Yv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nA(e){var t=iA(e,"string");return yn(t)=="symbol"?t:t+""}function iA(e,t){if(yn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(yn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Zv=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Jv=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,aA=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,oA=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Jb={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},uA=Object.keys(Jb),cr="NaN";function cA(e,t){return e*Jb[t]}var ai=(function(){function e(t,r){tA(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!aA.test(r)&&(this.num=NaN,this.unit=""),uA.includes(r)&&(this.num=cA(t,r),this.unit="px")}return rA(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,i=(n=oA.exec(r))!==null&&n!==void 0?n:[],a=Ti(i,3),o=a[1],u=a[2];return new e(parseFloat(o),u??"")}}])})();function Qb(e){if(e.includes(cr))return cr;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=Zv.exec(t))!==null&&r!==void 0?r:[],i=Ti(n,4),a=i[1],o=i[2],u=i[3],c=ai.parse(a??""),s=ai.parse(u??""),f=o==="*"?c.multiply(s):c.divide(s);if(f.isNaN())return cr;t=t.replace(Zv,f.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var l,h=(l=Jv.exec(t))!==null&&l!==void 0?l:[],d=Ti(h,4),m=d[1],v=d[2],p=d[3],b=ai.parse(m??""),x=ai.parse(p??""),w=v==="+"?b.add(x):b.subtract(x);if(w.isNaN())return cr;t=t.replace(Jv,w.toString())}return t}var Qv=/\(([^()]*)\)/;function sA(e){for(var t=e;t.includes("(");){var r=Qv.exec(t),n=Ti(r,2),i=n[1];t=t.replace(Qv,Qb(i))}return t}function lA(e){var t=e.replace(/\s+/g,"");return t=sA(t),t=Qb(t),t}function fA(e){try{return lA(e)}catch{return cr}}function Yc(e){var t=fA(e.slice(5,-1));return t===cr?"":t}var hA=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],pA=["dx","dy","angle","className","breakAll"];function sl(){return sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sl.apply(this,arguments)}function ey(e,t){if(e==null)return{};var r=dA(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function dA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ty(e,t){return gA(e)||mA(e,t)||yA(e,t)||vA()}function vA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yA(e,t){if(e){if(typeof e=="string")return ry(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ry(e,t)}}function ry(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mA(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function gA(e){if(Array.isArray(e))return e}var e0=/[ \f\n\r\t\v\u2028\u2029]+/,t0=function(t){var r=t.children,n=t.breakAll,i=t.style;try{var a=[];J(r)||(n?a=r.toString().split(""):a=r.toString().split(e0));var o=a.map(function(c){return{word:c,width:an(c,i).width}}),u=n?0:an(" ",i).width;return{wordsWithComputedWidth:o,spaceWidth:u}}catch{return null}},bA=function(t,r,n,i,a){var o=t.maxLines,u=t.children,c=t.style,s=t.breakAll,f=q(o),l=u,h=function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return C.reduce(function(R,D){var B=D.word,L=D.width,U=R[R.length-1];if(U&&(i==null||a||U.width+L+n<Number(i)))U.words.push(B),U.width+=L+n;else{var G={words:[B],width:L};R.push(G)}return R},[])},d=h(r),m=function(C){return C.reduce(function(R,D){return R.width>D.width?R:D})};if(!f)return d;for(var v="…",p=function(C){var R=l.slice(0,C),D=t0({breakAll:s,style:c,children:R+v}).wordsWithComputedWidth,B=h(D),L=B.length>o||m(B).width>Number(i);return[L,B]},b=0,x=l.length-1,w=0,O;b<=x&&w<=l.length-1;){var y=Math.floor((b+x)/2),g=y-1,_=p(g),S=ty(_,2),P=S[0],M=S[1],A=p(y),E=ty(A,1),j=E[0];if(!P&&!j&&(b=y+1),P&&j&&(x=y-1),!P&&j){O=M;break}w++}return O||d},ny=function(t){var r=J(t)?[]:t.toString().split(e0);return[{words:r}]},xA=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!Fr.isSsr){var c,s,f=t0({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return ny(i);return bA({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return ny(i)},iy="#808080",Ei=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,d=h===void 0?"start":h,m=t.verticalAnchor,v=m===void 0?"end":m,p=t.fill,b=p===void 0?iy:p,x=ey(t,hA),w=N.useMemo(function(){return xA({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:l,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,l,x.style,x.width]),O=x.dx,y=x.dy,g=x.angle,_=x.className,S=x.breakAll,P=ey(x,pA);if(!we(n)||!we(a))return null;var M=n+(q(O)?O:0),A=a+(q(y)?y:0),E;switch(v){case"start":E=Yc("calc(".concat(s,")"));break;case"middle":E=Yc("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=Yc("calc(".concat(w.length-1," * -").concat(u,")"));break}var j=[];if(l){var I=w[0].width,C=x.width;j.push("scale(".concat((q(C)?C/I:1)/I,")"))}return g&&j.push("rotate(".concat(g,", ").concat(M,", ").concat(A,")")),j.length&&(P.transform=j.join(" ")),T.createElement("text",sl({},Z(P,!0),{x:M,y:A,className:ee("recharts-text",_),textAnchor:d,fill:b.includes("url")?iy:b}),w.map(function(R,D){var B=R.words.join(S?"":" ");return T.createElement("tspan",{x:M,dy:D===0?E:u,key:"".concat(B,"-").concat(D)},B)}))};function jt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wA(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function jf(e){let t,r,n;e.length!==2?(t=jt,r=(u,c)=>jt(e(u),c),n=(u,c)=>e(u)-c):(t=e===jt||e===wA?e:OA,r=e,n=e);function i(u,c,s=0,f=u.length){if(s<f){if(t(c,c)!==0)return f;do{const l=s+f>>>1;r(u[l],c)<0?s=l+1:f=l}while(s<f)}return s}function a(u,c,s=0,f=u.length){if(s<f){if(t(c,c)!==0)return f;do{const l=s+f>>>1;r(u[l],c)<=0?s=l+1:f=l}while(s<f)}return s}function o(u,c,s=0,f=u.length){const l=i(u,c,s,f-1);return l>s&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function OA(){return 0}function r0(e){return e===null?NaN:+e}function*_A(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const SA=jf(jt),Xn=SA.right;jf(r0).center;class ay extends Map{constructor(t,r=TA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(oy(this,t))}has(t){return super.has(oy(this,t))}set(t,r){return super.set(AA(this,t),r)}delete(t){return super.delete(PA(this,t))}}function oy({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function AA({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fE(e,t){if(e){if(typeof e=="string")return ml(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ml(e,t)}}function hE(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function pE(e){if(Array.isArray(e))return ml(e)}function ml(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var dE=function(t){return t},F0={},z0=function(t){return t===F0},Qy=function(t){return function r(){return arguments.length===0||arguments.length===1&&z0(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},vE=function e(t,r){return t===1?r:Qy(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.filter(function(u){return u!==F0}).length;return o>=t?r.apply(void 0,i):e(t-o,Qy(function(){for(var u=arguments.length,c=new Array(u),s=0;s<u;s++)c[s]=arguments[s];var f=i.map(function(l){return z0(l)?c.shift():l});return r.apply(void 0,sE(f).concat(c))}))})},Ca=function(t){return vE(t.length,t)},gl=function(t,r){for(var n=[],i=t;i<r;++i)n[i-t]=i;return n},yE=Ca(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),mE=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return dE;var i=r.reverse(),a=i[0],o=i.slice(1);return function(){return o.reduce(function(u,c){return c(u)},a.apply(void 0,arguments))}},bl=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},W0=function(t){var r=null,n=null;return function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r&&a.every(function(u,c){return u===r[c]})||(r=a,n=t.apply(void 0,a)),n}};function gE(e){var t;return e===0?t=1:t=Math.floor(new ie(e).abs().log(10).toNumber())+1,t}function bE(e,t,r){for(var n=new ie(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var xE=Ca(function(e,t,r){var n=+e,i=+t;return n+r*(i-n)}),wE=Ca(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),OE=Ca(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const $a={rangeStep:bE,getDigitCount:gE,interpolateNumber:xE,uninterpolateNumber:wE,uninterpolateTruncation:OE};function xl(e){return AE(e)||SE(e)||U0(e)||_E()}function _E(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SE(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function AE(e){if(Array.isArray(e))return wl(e)}function Sn(e,t){return EE(e)||TE(e,t)||U0(e,t)||PE()}function PE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U0(e,t){if(e){if(typeof e=="string")return wl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wl(e,t)}}function wl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function TE(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function EE(e){if(Array.isArray(e))return e}function H0(e){var t=Sn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function G0(e,t,r){if(e.lte(0))return new ie(0);var n=$a.getDigitCount(e.toNumber()),i=new ie(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ie(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ie(Math.ceil(c))}function jE(e,t,r){var n=1,i=new ie(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ie(10).pow($a.getDigitCount(e)-1),i=new ie(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ie(Math.floor(e)))}else e===0?i=new ie(Math.floor((t-1)/2)):r||(i=new ie(Math.floor(e)));var o=Math.floor((t-1)/2),u=mE(yE(function(c){return i.add(new ie(c-o).mul(n)).toNumber()}),gl);return u(0,t)}function K0(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ie(0),tickMin:new ie(0),tickMax:new ie(0)};var a=G0(new ie(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ie(0):(o=new ie(e).add(t).div(2),o=o.sub(new ie(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ie(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?K0(e,t,r,n,i+1):(s<r&&(c=t>0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ie(u).mul(a)),tickMax:o.add(new ie(c).mul(a))})}function ME(e){var t=Sn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=H0([r,n]),c=Sn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(xl(gl(0,i-1).map(function(){return 1/0}))):[].concat(xl(gl(0,i-1).map(function(){return-1/0})),[f]);return r>n?bl(l):l}if(s===f)return jE(s,i,a);var h=K0(s,f,o,a),d=h.step,m=h.tickMin,v=h.tickMax,p=$a.rangeStep(m,v.add(new ie(.1).mul(d)),d);return r>n?bl(p):p}function CE(e,t){var r=Sn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=H0([n,i]),u=Sn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=G0(new ie(s).sub(c).div(f-1),a,0),h=[].concat(xl($a.rangeStep(new ie(c),new ie(s).sub(new ie(.99).mul(l)),l)),[s]);return n>i?bl(h):h}var $E=W0(ME),IE=W0(CE),RE="Invariant failed";function Zt(e,t){throw new Error(RE)}var kE=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function Li(){return Li=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Li.apply(this,arguments)}function DE(e,t){return LE(e)||BE(e,t)||qE(e,t)||NE()}function NE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qE(e,t){if(e){if(typeof e=="string")return em(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return em(e,t)}}function em(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function BE(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function LE(e){if(Array.isArray(e))return e}function FE(e,t){if(e==null)return{};var r=zE(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zE(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function WE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y0(n.key),n)}}function HE(e,t,r){return t&&UE(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function GE(e,t,r){return t=Fi(t),KE(e,V0()?Reflect.construct(t,r||[],Fi(e).constructor):t.apply(e,r))}function KE(e,t){if(t&&(_r(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VE(e)}function VE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V0(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(V0=function(){return!!e})()}function Fi(e){return Fi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fi(e)}function XE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ol(e,t)}function Ol(e,t){return Ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ol(e,t)}function X0(e,t,r){return t=Y0(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y0(e){var t=YE(e,"string");return _r(t)=="symbol"?t:t+""}function YE(e,t){if(_r(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(_r(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ia=(function(e){function t(){return WE(this,t),GE(this,t,arguments)}return XE(t,e),HE(t,[{key:"render",value:function(){var n=this.props,i=n.offset,a=n.layout,o=n.width,u=n.dataKey,c=n.data,s=n.dataPointFormatter,f=n.xAxis,l=n.yAxis,h=FE(n,kE),d=Z(h,!1);this.props.direction==="x"&&f.type!=="number"&&Zt();var m=c.map(function(v){var p=s(v,u),b=p.x,x=p.y,w=p.value,O=p.errorVal;if(!O)return null;var y=[],g,_;if(Array.isArray(O)){var S=DE(O,2);g=S[0],_=S[1]}else g=_=O;if(a==="vertical"){var P=f.scale,M=x+i,A=M+o,E=M-o,j=P(w-g),I=P(w+_);y.push({x1:I,y1:A,x2:I,y2:E}),y.push({x1:j,y1:M,x2:I,y2:M}),y.push({x1:j,y1:A,x2:j,y2:E})}else if(a==="horizontal"){var C=l.scale,R=b+i,D=R-o,B=R+o,L=C(w-g),U=C(w+_);y.push({x1:D,y1:U,x2:B,y2:U}),y.push({x1:R,y1:L,x2:R,y2:U}),y.push({x1:D,y1:L,x2:B,y2:L})}return T.createElement(fe,Li({className:"recharts-errorBar",key:"bar-".concat(y.map(function(G){return"".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))},d),y.map(function(G){return T.createElement("line",Li({},G,{key:"line-".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))}))});return T.createElement(fe,{className:"recharts-errorBars"},m)}}])})(T.Component);X0(Ia,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});X0(Ia,"displayName","ErrorBar");function An(e){"@babel/helpers - typeof";return An=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},An(e)}function tm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Bt(e){for(var t=1;t<argumen Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tj(e,t){if(e){if(typeof e=="string")return _l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _l(e,t)}}function rj(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nj(e){if(Array.isArray(e))return _l(e)}function _l(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nm(Object(r),!0).forEach(function(n){dr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dr(e,t,r){return t=ij(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ij(e){var t=aj(e,"string");return Pn(t)=="symbol"?t:t+""}function aj(e,t){if(Pn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Pn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Be(e,t,r){return J(e)||J(t)?r:we(t)?He(e,t,r):V(t)?t(e):r}function un(e,t,r,n){var i=nE(e,function(u){return Be(u,t)});if(r==="number"){var a=i.filter(function(u){return q(u)||parseFloat(u)});return a.length?[Ma(a),Tt(a)]:[1/0,-1/0]}var o=n?i.filter(function(u){return!J(u)}):i;return o.map(function(u){return we(u)||u instanceof Date?u:""})}var oj=function(t){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s<u;s++){var f=s>0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,d=void 0;if(Ze(l-f)!==Ze(h-l)){var m=[];if(Ze(h-l)===Ze(c[1]-c[0])){d=h;var v=l+c[1]-c[0];m[0]=Math.min(v,(v+f)/2),m[1]=Math.max(v,(v+f)/2)}else{d=f;var p=h+c[1]-c[0];m[0]=Math.min(l,(p+l)/2),m[1]=Math.max(l,(p+l)/2)}var b=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(t>b[0]&&t<=b[1]||t>=m[0]&&t<=m[1]){o=i[s].index;break}}else{var x=Math.min(f,h),w=Math.max(f,h);if(t>(x+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O<u;O++)if(O===0&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O>0&&O<u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},Qf=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?pe(pe({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},uj=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c<s;c++)for(var f=a[u[c]].stackGroups,l=Object.keys(f),h=0,d=l.length;h<d;h++){var m=f[l[h]],v=m.items,p=m.cateAxisId,b=v.filter(function(_){return pt(_.type).indexOf("Bar")>=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?pe(pe({},x),b[0].props):b[0].props,O=w.barSize,y=w[p];o[y]||(o[y]=[]);var g=J(O)?r:O;o[y].push({item:b[0],stackList:b.slice(1),barSize:J(g)?void 0:Je(g,n,0)})}}return o},cj=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=Je(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,d=i/c,m=o.reduce(function(O,y){return O+y.barSize||0},0);m+=(c-1)*s,m>=i&&(m-=(c-1)*s,s=0),m>=i&&d>0&&(h=!0,d*=.9,m=c*d);var v=(i-m)/2>>0,p={offset:v-s,size:0};f=o.reduce(function(O,y){var g={item:y.item,position:{offset:p.offset+p.size+s,size:h?d:y.barSize}},_=[].concat(rm(O),[g]);return p=_[_.length-1].position,y.stackList&&y.stackList.length&&y.stackList.forEach(function(S){_.push({item:S,position:p})}),_},l)}else{var b=Je(n,i,0,!0);i-2*b-(c-1)*s<=0&&(s=0);var x=(i-2*b-(c-1)*s)/c;x>1&&(x>>=0);var w=u===+u?Math.min(x,u):x;f=o.reduce(function(O,y,g){var _=[].concat(rm(O),[{item:y.item,position:{offset:b+(x+s)*g+(x-w)/2,size:w}}]);return y.stackList&&y.stackList.length&&y.stackList.forEach(function(S){_.push({item:S,position:_[_.length-1].position})}),_},l)}return f},sj=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.ri Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pj(e,t){if(e){if(typeof e=="string")return fm(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fm(e,t)}}function fm(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Tj(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function Ej(e){if(Array.isArray(e))return e}var Wi=Math.PI/180,jj=function(t){return t*180/Math.PI},Pe=function(t,r,n,i){return{x:t+Math.cos(-Wi*i)*n,y:r+Math.sin(-Wi*i)*n}},Mj=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},cN=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=Je(t.cx,o,o/2),l=Je(t.cy,u,u/2),h=Mj(o,u,n),d=Je(t.innerRadius,h,0),m=Je(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(p,b){var x=r[b],w=x.domain,O=x.reversed,y;if(J(x.range))i==="angleAxis"?y=[c,s]:i==="radiusAxis"&&(y=[d,m]),O&&(y=[y[1],y[0]]);else{y=x.range;var g=y,_=Sj(g,2);c=_[0],s=_[1]}var S=rx(x,a),P=S.realScaleType,M=S.scale;M.domain(w).range(y),nx(M);var A=ix(M,st(st({},x),{},{realScaleType:P})),E=st(st(st({},x),A),{},{range:y,radius:m,realScaleType:P,scale:M,cx:f,cy:l,innerRadius:d,outerRadius:m,startAngle:c,endAngle:s});return st(st({},p),{},ux({},b,E))},{})},Cj=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},$j=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=Cj({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:jj(s),angleInRadian:s}},Ij=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},Rj=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},hm=function(t,r){var n=t.x,i=t.y,a=$j({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(o<c||o>s)return!1;if(o===0)return!0;var f=Ij(r),l=f.startAngle,h=f.endAngle,d=u,m;if(l<=h){for(;d>h;)d-=360;for(;d<l;)d+=360;m=d>=l&&d<=h}else{for(;d>l;)d-=360;for(;d<h;)d+=360;m=d>=h&&d<=l}return m?st(st({},r),{},{radius:o,angle:Rj(d,r)}):null},sN=function(t){return!N.isValidElement(t)&&!V(t)&&typeof t!="boolean"?t.className:""};function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}var kj=["offset"];function Dj(e){return Lj(e)||Bj(e)||qj(e)||Nj()}function Nj(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qj(e,t){if(e){if(typeof e=="string")return Al(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Al(e,t)}}function Bj(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lj(e){if(Array.isArray(e))return Al(e)}function Al(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Fj(e,t){if(e==null)return{};var r=zj(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zj(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pm(Object(r),!0).forEach(function(n){Wj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wj(e,t,r){return t=Uj(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Uj(e){var t=Hj(e,"string");return En(t)=="symbol"?t:t+""}function Hj(e,t){if(En(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(En(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jn.apply(this,arguments)}var Gj=function(t){var r=t.value,n=t.formatter,i=J(t.children)?r:t.children;return V(n)?n(i):i},Kj=function(t,r){var n=Ze(r-t),i=Math.min(Math.abs(r-t),360);return n*i},Vj=function(t,r,n){var i=t.position,a=t.viewBox,o=t.offset,u=t.className,c=a,s=c.cx,f=c.cy,l=c.innerRadius,h=c.outerRadius,d=c.startAngle,m=c.endAngle,v=c.clockWise,p=(l+h)/2,b=Kj(d,m),x=b>=0?1:-1,w,O;i==="insideStart"?(w=d+x*o,O=v):i==="insideEnd"?(w=m-x*o,O=!v):i==="end"&&(w=m+x*o,O=v),O=b<=0?O:!O;var y=Pe(s,f,p,w),g=Pe(s,f,p,w+(O?1:-1)*359),_="M".concat(y.x,",").concat(y.y,`
A`).concat(p,",").concat(p,",0,1,").concat(O?0:1,`,
`).concat(g.x,",").concat(g.y),S=J(t.id)?Kn("recharts-radial-line-"):t.id;return T.createElement("text",jn({},n,{dominantBaseline:"central",className:ee("recharts-radial-bar-label",u)}),T.createElement("defs",null,T.createElement("path",{id:S,d:_})),T.createElement("textPath",{xlinkHref:"#".concat(S)},r))},Xj=function(t){var r=t.viewBox,n=t.offset,i=t.position,a=r,o=a.cx,u=a.cy,c=a.innerRadius,s=a.outerRadius,f=a.startAngle,l=a.endAngle,h=(f+l)/2;if(i==="outside"){var d=Pe(o,u,s+n,h),m=d.x,v=d.y;return{x:m,y:v,textAnchor:m>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var p=(c+s)/2,b=Pe(o,u,p,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},Yj=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,d=l>0?"end":"start",m=l>0?"start":"end",v=s>=0?1:-1,p=v*i,b=v>0?"end":"start",x=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:d};return xe(xe({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:m};return xe(xe({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var y={x:u-p,y:c+f/2,textAnchor:b,verticalAnchor:"middle"};return xe(xe({},y),n?{width:Math.max(y.x-n.x,0),height:f}:{})}if(a==="right"){var g={x:u+s+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"};return xe(xe({},g),n?{width:Math.max(n.x+n.width-g.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?xe({x:u+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?xe({x:u+s-p,y:c+f/2,textAnchor:b,verticalAnchor:"middle"},_):a==="insideTop"?xe({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:m},_):a==="insideBottom"?xe({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:d},_):a==="insideTopLeft"?xe({x:u+p,y:c+h,textAnchor:x,verticalAnchor:m},_):a==="insideTopRight"?xe({x:u+s-p,y:c+h,textAnchor:b,verticalAnchor:m},_):a==="insideBottomLeft"?xe({x:u+p,y:c+f-h,textAnchor:x,verticalAnchor:d},_):a==="insideBottomRight"?xe({x:u+s-p,y:c+f-h,textAnchor:b,verticalAnchor:d},_):qr(a)&&(q(a.x)||zt(a.x))&&(q(a.y)||zt(a.y))?xe({x:u+Je(a.x,s),y:c+Je(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):xe({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},Zj=function(t){return"cx"in t&&q(t.cx)};function Ee(e){var t=e.offset,r=t===void 0?5:t,n=Fj(e,kj),i=xe({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||J(u)&&J(c)&&!N.isValidElement(s)&&!V(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var d;if(V(s)){if(d=N.createElement(s,i),N.isValidElement(d))return d}else d=Gj(i);var m=Zj(a),v=Z(i,!0);if(m&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Vj(i,d,v);var p=m?Xj(i):Yj(i);return T.createElement(Ei,jn({className:ee("recharts-label",l)},v,p,{breakAll:h}),d)}Ee.displayName="Label";var cx=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,d=t.top,m=t.left,v=t.width,p=t.height,b=t.clockWise,x=t.labelViewBox;if(x)return x;if(q(v)&&q(p)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:p};if(q(d)&&q(m))return{x:d,y:m,width:v,height:p}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:b}:t.viewBox?t.viewBox:{}},Jj=function(t,r){return t?t===!0?T.createElement(Ee,{key:"label-implicit",viewBox:r}):we(t)?T.createElement(Ee,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Ee?N.cloneElement(t,{key:"label-implicit",viewBox:r}):T.createElement(Ee,{key:"label-implicit",content:t,viewBox:r}):V(t)?T.createElement(Ee,{key:"label-implicit",content:t,viewBox:r}):qr(t)?T.createElement(Ee,jn({viewBox:r},t,{key:"label-implicit"})):null:null},Qj=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=cx(t),o=Qe(i,Ee).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=Jj(t.label,r||a);return[u].concat(Dj(o))};Ee.parseViewBox=cx;Ee.renderCallByParent=Qj;var ds,dm;function eM(){if(dm)return ds;dm=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return ds=e,ds}var tM=eM();const rM=ue(tM);function Mn(e){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mn(e)}var nM=["valueAccessor"],iM=["data","dataKey","clockWise","id","textBreakAll"];function aM(e){return sM(e)||cM(e)|| Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uM(e,t){if(e){if(typeof e=="string")return Pl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pl(e,t)}}function cM(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sM(e){if(Array.isArray(e))return Pl(e)}function Pl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ui(){return Ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ui.apply(this,arguments)}function vm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ym(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vm(Object(r),!0).forEach(function(n){lM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lM(e,t,r){return t=fM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fM(e){var t=hM(e,"string");return Mn(t)=="symbol"?t:t+""}function hM(e,t){if(Mn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mm(e,t){if(e==null)return{};var r=pM(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pM(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var dM=function(t){return Array.isArray(t.value)?rM(t.value):t.value};function Mt(e){var t=e.valueAccessor,r=t===void 0?dM:t,n=mm(e,nM),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=mm(n,iM);return!i||!i.length?null:T.createElement(fe,{className:"recharts-label-list"},i.map(function(f,l){var h=J(a)?r(f,l):Be(f&&f.payload,a),d=J(u)?{}:{id:"".concat(u,"-").concat(l)};return T.createElement(Ee,Ui({},Z(f,!0),s,d,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:Ee.parseViewBox(J(o)?f:ym(ym({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}Mt.displayName="LabelList";function vM(e,t){return e?e===!0?T.createElement(Mt,{key:"labelList-implicit",data:t}):T.isValidElement(e)||V(e)?T.createElement(Mt,{key:"labelList-implicit",data:t,content:e}):qr(e)?T.createElement(Mt,Ui({data:t},e,{key:"labelList-implicit"})):null:null}function yM(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Qe(n,Mt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=vM(e.label,t);return[a].concat(aM(i))}Mt.renderCallByParent=yM;function Cn(e){"@babel/helpers - typeof";return Cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cn(e)}function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tl.apply(this,arguments)}function gm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gm(Object(r),!0).forEach(function(n){mM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mM(e,t,r){return t=gM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gM(e){var t=bM(e,"string");return Cn(t)=="symbol"?t:t+""}function bM(e,t){if(Cn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Cn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xM=function(t,r){var n=Ze( Line truncated
A `).concat(a,",").concat(a,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o>s),`,
`).concat(l.x,",").concat(l.y,`
`);if(i>0){var d=Pe(r,n,i,o),m=Pe(r,n,i,s);h+="L ".concat(m.x,",").concat(m.y,`
A `).concat(i,",").concat(i,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o<=s),`,
`).concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},wM=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=Ze(f-s),h=li({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),d=h.circleTangency,m=h.lineTangency,v=h.theta,p=li({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),b=p.circleTangency,x=p.lineTangency,w=p.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(m.x,",").concat(m.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):sx({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var y="M ".concat(m.x,",").concat(m.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(d.x,",").concat(d.y,`
A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(l<0),",").concat(b.x,",").concat(b.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(x.x,",").concat(x.y,`
`);if(i>0){var g=li({cx:r,cy:n,radius:i,angle:s,sign:l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=g.circleTangency,S=g.lineTangency,P=g.theta,M=li({cx:r,cy:n,radius:i,angle:f,sign:-l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),A=M.circleTangency,E=M.lineTangency,j=M.theta,I=c?Math.abs(s-f):Math.abs(s-f)-P-j;if(I<0&&o===0)return"".concat(y,"L").concat(r,",").concat(n,"Z");y+="L".concat(E.x,",").concat(E.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,`
A`).concat(i,",").concat(i,",0,").concat(+(I>180),",").concat(+(l>0),",").concat(_.x,",").concat(_.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(S.x,",").concat(S.y,"Z")}else y+="L".concat(r,",").concat(n,"Z");return y},OM={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},lx=function(t){var r=bm(bm({},OM),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o<a||f===l)return null;var d=ee("recharts-sector",h),m=o-a,v=Je(u,m,0,!0),p;return v>0&&Math.abs(f-l)<360?p=wM({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,m/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):p=sx({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),T.createElement("path",Tl({},Z(r,!0),{className:d,d:p,role:"img"}))};function $n(e){"@babel/helpers - typeof";return $n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$n(e)}function El(){return El=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},El.apply(this,arguments)}function xm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xm(Object(r),!0).forEach(function(n){_M(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _M(e,t,r){return t=SM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SM(e){var t=AM(e,"string");return $n(t)=="symbol"?t:t+""}function AM(e,t){if($n(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($n(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Om={curveBasisClosed:WO,curveBasisOpen:UO,curveBasis:zO,curveBumpX:EO,curveBumpY:jO,curveLinearClosed:HO,curveLinear:ba,curveMonotoneX:GO,curveMonotoneY:KO,curveNatural:VO,curveStep:XO,curveStepAfter:ZO,curveStepBefore:YO},fi=function(t){return t.x===+t.x&&t.y===+t.y},Zr=function(t){return t.x},Jr=function(t){return t.y},PM=function(t,r){if(V(t))return t;var n="curve".concat(ma(t));return(n==="curveMonotone"||n==="curveBump")&&r?Om["".concat(n).concat(r==="vertical"?"Y":"X")]:Om[n]||ba},TM=function(t){var r=t.type,n=r===void 0?"linear":r,i=t.points,a=i===void 0?[]:i,o=t.baseLine,u=t.layout,c=t.connectNulls,s=c===void 0?!1:c,f=PM(n,u),l=s?a.filter(function(v){return fi(v)}):a,h;if(Array.isArray(o)){var d=s?o.filter(function(v){return fi(v)}):o,m=l.map(function(v,p){return wm(wm({},v),{},{base:d[p]})});return u==="vertical"?h=ri().y(Jr).x1(Zr).x0(function(v){return v.base.x}):h=ri().x(Zr).y1(Jr).y0(function(v){return v.base.y}),h.defined(fi).curve(f),h(m)}return u==="vertical"&&q(o)?h=ri().y(Jr).x1(Zr).x0(o):q(o)?h=ri().x(Zr).y1(Jr).y0(o):h=lb().x(Zr).y(Jr),h.defined(fi).curve(f),h(l)},cn=function(t){var r=t.className,n=t.points,i=t.path,a=t.pathRef;if((!n||!n.length)&&!i)return null;var o=n&&n.length?TM(t):i;return N.createElement("path",El({},Z(t,!1),yi(t),{className:ee("recharts-curve",r),d:o,ref:a}))},vs={exports:{}},ys,_m;function EM(){if(_m)return ys;_m=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ys=e,ys}var ms,Sm;function jM(){if(Sm)return ms;Sm=1;var e=EM();function t(){}function r(){}return r.resetWarningCache=t,ms=function(){function n(o,u,c,s,f,l){if(l!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}n.isRequired=n;function i(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:r,resetWarningCache:t};return a.PropTypes=a,a},ms}var Am;function MM(){return Am||(Am=1,vs.exports=jM()()),vs.exports}var CM=MM();const ne=ue(CM),{getOwnPropertyNames:$M,getOwnPropertySymbols:IM}=Object,{hasOwnProperty:RM}=Object.prototype;function gs(e,t){return function(n,i,a){return e(n,i,a)&&t(n,i,a)}}function hi(e){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,i);const{cache:a}=i,o=a.get(r),u=a.get(n);if(o&&u)return o===n&&u===r;a.set(r,n),a.set(n,r);const c=e(r,n,i);return a.delete(r),a.delete(n),c}}function kM(e){return e?.[S Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xC(e,t){if(e){if(typeof e=="string")return $m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $m(e,t)}}function $m(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OC(e){if(Array.isArray(e))return e}function _C(){var e={},t=function(){return null},r=!1,n=function i(a){if(!r){if(Array.isArray(a)){if(!a.length)return;var o=a,u=gC(o),c=u[0],s=u.slice(1);if(typeof c=="number"){Cm(i.bind(null,s),c);return}i(c),Cm(i.bind(null,s));return}jl(a)==="object"&&(e=a,t(e)),typeof a=="function"&&a()}};return{stop:function(){r=!0},start:function(a){r=!1,n(a)},subscribe:function(a){return t=a,function(){t=function(){return null}}}}}function In(e){"@babel/helpers - typeof";return In=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},In(e)}function Im(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Rm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Im(Object(r),!0).forEach(function(n){hx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Im(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hx(e,t,r){return t=SC(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SC(e){var t=AC(e,"string");return In(t)==="symbol"?t:String(t)}function AC(e,t){if(In(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(In(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var PC=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,i){return n.filter(function(a){return i.includes(a)})})},TC=function(t){return t},EC=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},sn=function(t,r){return Object.keys(r).reduce(function(n,i){return Rm(Rm({},n),{},hx({},i,t(i,r[i])))},{})},km=function(t,r,n){return t.map(function(i){return"".concat(EC(i)," ").concat(r,"ms ").concat(n)}).join(",")};function jC(e,t){return $C(e)||CC(e,t)||px(e,t)||MC()}function MC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function $C(e){if(Array.isArray(e))return e}function IC(e){return DC(e)||kC(e)||px(e)||RC()}function RC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function px(e,t){if(e){if(typeof e=="string")return Ml(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ml(e,t)}}function kC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function DC(e){if(Array.isArray(e))return Ml(e)}function Ml(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Gi=1e-4,dx=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},vx=function(t,r){return t.map(function(n,i){return n*Math.pow(r,i)}).reduce(function(n,i){return n+i})},Dm=function(t,r){return function(n){var i=dx(t,r);return vx(i,n)}},NC=function(t,r){return function(n){var i=dx(t,r),a=[].concat(IC(i.map(function(o,u){return o*u}).slice(1)),[0]);return vx(a,n)}},Nm=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0],a=r[1],o=r[2],u=r[3];if(r.length===1)switch(r[0]){case"linear":i=0,a=0,o=1,u=1;break;case"ease":i=.25,a=.1,o=.25,u=1;break;case"ease-in":i=.42,a=0,o=1,u=1;break;case"ease-out":i=.42,a=0,o=.58,u=1;break;case"ease-in-out":i=0,a=0,o=.58,u=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var s=c[1].split(")")[0].split(",").map(function(p){return parseFloat(p)}),f=jC(s,4);i=f[0],a=f[1],o=f[2],u=f[3]}}}var l=Dm(i,o),h=Dm(a,u),d=NC(i,o),m=function(b){return b>1?1:b<0?0:b},v=function(b){for(var x=b>1?1:b,w=x,O=0;O<8;++O){var y=l(w)-x,g=d(w);if(Math.abs(y-x)<Gi||g<Gi)return h(w);w=m(w-y/g)}return h(w)};return v.isStepper=!1,v},qC=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var d=-(f-l)*n,m=h*a,v=h+(d-m)*u/1e3,p=h*u/1e3+f;return Math.abs(p-l)<Gi&&Math.abs(v)<Gi?[l,0]:[p,v]};return c.isStepper=!0,c.dt=u,c},BC=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Nm(i);case"spring":return qC();default:if(i.split("(")[0]==="cubic-bezier")return Nm(i)}return typeof i=="function"?i:null};function Rn(e){"@babel/helpers - typeof";return Rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(e)}function qm(e){return zC(e)||FC(e)||yx(e)||LC()}function LC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zC(e){if(Array.isArray(e))return $l(e)}function Bm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bm(Object(r),!0).forEach(function(n){Cl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cl(e,t,r){return t=WC(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function WC(e){var t=UC(e,"string");return Rn(t)==="symbol"?t:String(t)}function UC(e,t){if(Rn(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rn(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HC(e,t){return VC(e)||KC(e,t)||yx(e,t)||GC()}function GC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yx(e,t){if(e){if(typeof e=="string")return $l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $l(e,t)}}function $l(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function KC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function VC(e){if(Array.isArray(e))return e}var Ki=function(t,r,n){return t+(r-t)*n},Il=function(t){var r=t.from,n=t.to;return r!==n},XC=function e(t,r,n){var i=sn(function(a,o){if(Il(o)){var u=t(o.from,o.to,o.velocity),c=HC(u,2),s=c[0],f=c[1];return Ae(Ae({},o),{},{from:s,velocity:f})}return o},r);return n<1?sn(function(a,o){return Il(o)?Ae(Ae({},o),{},{velocity:Ki(o.velocity,i[a].velocity,n),from:Ki(o.from,i[a].from,n)}):o},r):e(t,i,n-1)};const YC=(function(e,t,r,n,i){var a=PC(e,t),o=a.reduce(function(p,b){return Ae(Ae({},p),{},Cl({},b,[e[b],t[b]]))},{}),u=a.reduce(function(p,b){return Ae(Ae({},p),{},Cl({},b,{from:e[b],velocity:0,to:t[b]}))},{}),c=-1,s,f,l=function(){return null},h=function(){return sn(function(b,x){return x.from},u)},d=function(){return!Object.values(u).filter(Il).length},m=function(b){s||(s=b);var x=b-s,w=x/r.dt;u=XC(r,u,w),i(Ae(Ae(Ae({},e),t),h())),s=b,d()||(c=requestAnimationFrame(l))},v=function(b){f||(f=b);var x=(b-f)/n,w=sn(function(y,g){return Ki.apply(void 0,qm(g).concat([r(x)]))},o);if(i(Ae(Ae(Ae({},e),t),w)),x<1)c=requestAnimationFrame(l);else{var O=sn(function(y,g){return Ki.apply(void 0,qm(g).concat([r(1)]))},o);i(Ae(Ae(Ae({},e),t),O))}};return l=r.isStepper?m:v,function(){return requestAnimationFrame(l),function(){cancelAnimationFrame(c)}}});function Sr(e){"@babel/helpers - typeof";return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(e)}var ZC=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function JC(e,t){if(e==null)return{};var r=QC(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function QC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function bs(e){return n$(e)||r$(e)||t$(e)||e$()}function e$(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t$(e,t){if(e){if(typeof e=="string")return Rl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Rl(e,t)}}function r$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function n$(e){if(Array.isArray(e))return Rl(e)}function Rl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Lm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ve(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lm(Object(r),!0).forEach(function(n){nn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nn(e,t,r){return t=mx(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a$(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mx(n.key),n)}}function o$(e,t,r){return t&&a$(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mx(e){var t=u$(e,"string");return Sr(t)==="symbol"?t:String(t)}function u$(e,t){if(Sr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Sr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function c$(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kl(e,t)}function kl(e,t){return kl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},kl(e,t)}function s$(e){var t=l$();return function(){var n=Vi(e),i;if(t){var a=Vi(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Dl(this,i)}}function Dl(e,t){if(t&&(Sr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nl(e)}function Nl(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l$(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vi(e){return Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vi(e)}var bt=(function(e){c$(r,e);var t=s$(r);function r(n,i){var a;i$(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,d=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(Nl(a)),a.changeStyle=a.changeStyle.bind(Nl(a)),!u||d<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),Dl(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},Dl(a);a.state={style:c?nn({},c,s):s}}else a.state={style:{}};return a}return o$(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var d={style:c?nn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(d);return}if(!(yC(i.to,f)&&i.canBegin&&i.isActive)){var m=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=m||s?l:i.to;if(this.state&&h){var p={style:c?nn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(p)}this.runAnimation(Ve(Ve({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i) Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p$(e,t){if(e){if(typeof e=="string")return Fm(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fm(e,t)}}function Fm(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function v$(e){if(Array.isArray(e))return e}function zm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zm(Object(r),!0).forEach(function(n){y$(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function y$(e,t,r){return t=m$(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m$(e){var t=g$(e,"string");return kn(t)=="symbol"?t:t+""}function g$(e,t){if(kn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(kn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Um=function(t,r,n,i,a){var o=Math.min(Math.abs(n)/2,Math.abs(i)/2),u=i>=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,d=4;h<d;h++)l[h]=a[h]>o?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`,
`).concat(t+n,",").concat(r+u*l[1])),f+="L ".concat(t+n,",").concat(r+i-u*l[2]),l[2]>0&&(f+="A ".concat(l[2],",").concat(l[2],",0,0,").concat(s,`,
`).concat(t+n-c*l[2],",").concat(r+i)),f+="L ".concat(t+c*l[3],",").concat(r+i),l[3]>0&&(f+="A ".concat(l[3],",").concat(l[3],",0,0,").concat(s,`,
`).concat(t,",").concat(r+i-u*l[3])),f+="Z"}else if(o>0&&a===+a&&a>0){var m=Math.min(o,a);f="M ".concat(t,",").concat(r+u*m,`
A `).concat(m,",").concat(m,",0,0,").concat(s,",").concat(t+c*m,",").concat(r,`
L `).concat(t+n-c*m,",").concat(r,`
A `).concat(m,",").concat(m,",0,0,").concat(s,",").concat(t+n,",").concat(r+u*m,`
L `).concat(t+n,",").concat(r+i-u*m,`
A `).concat(m,",").concat(m,",0,0,").concat(s,",").concat(t+n-c*m,",").concat(r+i,`
L `).concat(t+c*m,",").concat(r+i,`
A `).concat(m,",").concat(m,",0,0,").concat(s,",").concat(t,",").concat(r+i-u*m," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return f},b$=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,u=r.width,c=r.height;if(Math.abs(u)>0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},x$={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},eh=function(t){var r=Wm(Wm({},x$),t),n=N.useRef(),i=N.useState(-1),a=f$(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,d=r.className,m=r.animationEasing,v=r.animationDuration,p=r.animationBegin,b=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=ee("recharts-rectangle",d);return x?T.createElement(bt,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:m,isActive:x},function(O){var y=O.width,g=O.height,_=O.x,S=O.y;return T.createElement(bt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,isActive:b,easing:m},T.createElement("path",Xi({},Z(r,!0),{className:w,d:Um(_,S,y,g,h),ref:n})))}):T.createElement("path",Xi({},Z(r,!0),{className:w,d:Um(c,s,f,l,h)}))};function ql(){return ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ql.apply(this,arguments)}var th=function(t){var r=t.cx,n=t.cy,i=t.r,a=t.className,o=ee("recharts-dot",a);return r===+r&&n===+n&&i===+i?N.createElement("circle",ql({},Z(t,!1),yi(t),{className:o,cx:r,cy:n,r:i})):null};function Dn(e){"@babel/helpers - typeof";return Dn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dn(e)}var w$=["x","y","top","left","width","height","className"];function Bl(){return Bl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bl.apply(this,arguments)}function Hm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function O$(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hm(Object(r),!0).forEach(function(n){_$(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _$(e,t,r){return t=S$(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S$(e){var t=A$(e,"string");return Dn(t)=="symbol"?t:t+""}function A$(e,t){if(Dn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Dn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function P$(e,t){if(e==null)return{};var r=T$(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function T$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var E$=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},j$=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,d=h===void 0?0:h,m=t.className,v=P$(t,w$),p=O$({x:n,y:a,top:u,left:s,width:l,height:d},v);return!q(n)||!q(a)||!q(l)||!q(d)||!q(u)||!q(s)?null:T.createElement("path",Bl({},Z(p,!0),{className:ee("recharts-cross",m),d:E$(n,a,l,d,u,s)}))},xs,Gm;function M$(){if(Gm)return xs;Gm=1;var e=Ib(),t=e(Object.getPrototypeOf,Object);return xs=t,xs}var ws,Km;function C$(){if(Km)return ws;Km=1;var e=xt(),t=M$(),r=wt(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return ws=s,ws}var $$=C$();const I$=ue($$);var Os,Vm;function R$(){if(Vm)ret Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B$(e,t){if(e){if(typeof e=="string")return Xm(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xm(e,t)}}function Xm(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L$(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function F$(e){if(Array.isArray(e))return e}function Ym(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ym(Object(r),!0).forEach(function(n){z$(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ym(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function z$(e,t,r){return t=W$(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W$(e){var t=U$(e,"string");return Nn(t)=="symbol"?t:t+""}function U$(e,t){if(Nn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Nn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Jm=function(t,r,n,i,a){var o=n-i,u;return u="M ".concat(t,",").concat(r),u+="L ".concat(t+n,",").concat(r),u+="L ".concat(t+n-o/2,",").concat(r+a),u+="L ".concat(t+n-o/2-i,",").concat(r+a),u+="L ".concat(t,",").concat(r," Z"),u},H$={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},G$=function(t){var r=Zm(Zm({},H$),t),n=N.useRef(),i=N.useState(-1),a=N$(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&u(w)}catch{}},[]);var c=r.x,s=r.y,f=r.upperWidth,l=r.lowerWidth,h=r.height,d=r.className,m=r.animationEasing,v=r.animationDuration,p=r.animationBegin,b=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||h!==+h||f===0&&l===0||h===0)return null;var x=ee("recharts-trapezoid",d);return b?T.createElement(bt,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:m,isActive:b},function(w){var O=w.upperWidth,y=w.lowerWidth,g=w.height,_=w.x,S=w.y;return T.createElement(bt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,easing:m},T.createElement("path",Yi({},Z(r,!0),{className:x,d:Jm(_,S,O,y,g),ref:n})))}):T.createElement("g",null,T.createElement("path",Yi({},Z(r,!0),{className:x,d:Jm(c,s,f,l,h)})))},K$=["option","shapeType","propTransformer","activeClassName","isActive"];function qn(e){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}function V$(e,t){if(e==null)return{};var r=X$(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qm(Object(r),!0).forEach(function(n){Y$(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Y$(e,t,r){return t=Z$(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z$(e){var t=J$(e,"string");return qn(t)=="symbol"?t:t+""}function J$(e,t){if(qn(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qn(n)!="object")return n;throw new TypeError("@@toP Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IR(e,t){if(e){if(typeof e=="string")return Mg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mg(e,t)}}function Mg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function RR(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function kR(e){if(Array.isArray(e))return e}function Ul(){return Ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ul.apply(this,arguments)}var DR=function(t,r){var n;return T.isValidElement(t)?n=T.cloneElement(t,r):V(t)?n=t(r):n=T.createElement("line",Ul({},r,{className:"recharts-reference-line-line"})),n},NR=function(t,r,n,i,a,o,u,c,s){var f=a.x,l=a.y,h=a.width,d=a.height;if(n){var m=s.y,v=t.y.apply(m,{position:o});if(it(s,"discard")&&!t.y.isInRange(v))return null;var p=[{x:f+h,y:v},{x:f,y:v}];return c==="left"?p.reverse():p}if(r){var b=s.x,x=t.x.apply(b,{position:o});if(it(s,"discard")&&!t.x.isInRange(x))return null;var w=[{x,y:l+d},{x,y:l}];return u==="top"?w.reverse():w}if(i){var O=s.segment,y=O.map(function(g){return t.apply(g,{position:o})});return it(s,"discard")&&jI(y,function(g){return!t.isInRange(g)})?null:y}return null};function qR(e){var t=e.x,r=e.y,n=e.segment,i=e.xAxisId,a=e.yAxisId,o=e.shape,u=e.className,c=e.alwaysShow,s=gR(),f=Rx(i),l=kx(a),h=wR();if(!s||!h)return null;dt(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=rh({x:f.scale,y:l.scale}),m=we(t),v=we(r),p=n&&n.length===2,b=NR(d,m,v,p,h,e.position,f.orientation,l.orientation,e);if(!b)return null;var x=CR(b,2),w=x[0],O=w.x,y=w.y,g=x[1],_=g.x,S=g.y,P=it(e,"hidden")?"url(#".concat(s,")"):void 0,M=jg(jg({clipPath:P},Z(e,!0)),{},{x1:O,y1:y,x2:_,y2:S});return T.createElement(fe,{className:ee("recharts-reference-line",u)},DR(o,M),Ee.renderCallByParent(e,oR({x1:O,y1:y,x2:_,y2:S})))}var ch=(function(e){function t(){return _R(this,t),PR(this,t,arguments)}return jR(t,e),AR(t,[{key:"render",value:function(){return T.createElement(qR,this.props)}}])})(T.Component);uh(ch,"displayName","ReferenceLine");uh(ch,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function Hl(){return Hl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hl.apply(this,arguments)}function jr(e){"@babel/helpers - typeof";return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr(e)}function Cg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $g(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Cg(Object(r),!0).forEach(function(n){Na(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cg(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LR(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Bx(n.key),n)}}function FR(e,t,r){return t&&LR(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function zR(e,t,r){return t=ia(t),WR(e,qx()?Reflect.construct(t,r||[],ia(e).constructor):t.apply(e,r))}function WR(e,t){if(t&&(jr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return UR(e)}function UR(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qx(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qx=function(){return!!e})()}function ia(e){return ia=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ia(e)}function HR(e Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hD(e,t){if(e){if(typeof e=="string")return tf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tf(e,t)}}function pD(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dD(e){if(Array.isArray(e))return tf(e)}function tf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var rf=function(t,r,n,i,a){var o=Qe(t,ch),u=Qe(t,qa),c=[].concat(zg(o),zg(u)),s=Qe(t,La),f="".concat(i,"Id"),l=i[0],h=r;if(c.length&&(h=c.reduce(function(v,p){if(p.props[f]===n&&it(p.props,"extendDomain")&&q(p.props[l])){var b=p.props[l];return[Math.min(v[0],b),Math.max(v[1],b)]}return v},h)),s.length){var d="".concat(l,"1"),m="".concat(l,"2");h=s.reduce(function(v,p){if(p.props[f]===n&&it(p.props,"extendDomain")&&q(p.props[d])&&q(p.props[m])){var b=p.props[d],x=p.props[m];return[Math.min(v[0],b,x),Math.max(v[1],b,x)]}return v},h)}return a&&a.length&&(h=a.reduce(function(v,p){return q(p)?[Math.min(v[0],p),Math.max(v[1],p)]:v},h)),h},Ls={exports:{}},Wg;function vD(){return Wg||(Wg=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,s,f){this.fn=c,this.context=s,this.once=f||!1}function a(c,s,f,l,h){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new i(f,l||c,h),m=r?r+s:s;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],d]:c._events[m].push(d):(c._events[m]=d,c._eventsCount++),c}function o(c,s){--c._eventsCount===0?c._events=new n:delete c._events[s]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var s=[],f,l;if(this._eventsCount===0)return s;for(l in f=this._events)t.call(f,l)&&s.push(r?l.slice(1):l);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(f)):s},u.prototype.listeners=function(s){var f=r?r+s:s,l=this._events[f];if(!l)return[];if(l.fn)return[l.fn];for(var h=0,d=l.length,m=new Array(d);h<d;h++)m[h]=l[h].fn;return m},u.prototype.listenerCount=function(s){var f=r?r+s:s,l=this._events[f];return l?l.fn?1:l.length:0},u.prototype.emit=function(s,f,l,h,d,m){var v=r?r+s:s;if(!this._events[v])return!1;var p=this._events[v],b=arguments.length,x,w;if(p.fn){switch(p.once&&this.removeListener(s,p.fn,void 0,!0),b){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,f),!0;case 3:return p.fn.call(p.context,f,l),!0;case 4:return p.fn.call(p.context,f,l,h),!0;case 5:return p.fn.call(p.context,f,l,h,d),!0;case 6:return p.fn.call(p.context,f,l,h,d,m),!0}for(w=1,x=new Array(b-1);w<b;w++)x[w-1]=arguments[w];p.fn.apply(p.context,x)}else{var O=p.length,y;for(w=0;w<O;w++)switch(p[w].once&&this.removeListener(s,p[w].fn,void 0,!0),b){case 1:p[w].fn.call(p[w].context);break;case 2:p[w].fn.call(p[w].context,f);break;case 3:p[w].fn.call(p[w].context,f,l);break;case 4:p[w].fn.call(p[w].context,f,l,h);break;default:if(!x)for(y=1,x=new Array(b-1);y<b;y++)x[y-1]=arguments[y];p[w].fn.apply(p[w].context,x)}}return!0},u.prototype.on=function(s,f,l){return a(this,s,f,l,!1)},u.prototype.once=function(s,f,l){return a(this,s,f,l,!0)},u.prototype.removeListener=function(s,f,l,h){var d=r?r+s:s;if(!this._events[d])return this;if(!f)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===f&&(!h||m.once)&&(!l||m.context===l)&&o(this,d);else{for(var v=0,p=[],b=m.length;v<b;v++)(m[v].fn!==f||h&&!m[v].once||l&&m[v].context!==l)&&p.push(m[v]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},u.prototype.removeAllListeners=function(s){var f;return s?(f=r?r+s:s,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u})(Ls)),Ls.exports}var yD=vD();const mD=ue(yD);var Fs=new mD,zs="recharts.syncMouseEvents";function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function gD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bD(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,rw(n.key),n)}}function xD(e,t,r){return t&&bD(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ws(e,t,r){return t=rw(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rw(e){var t=wD(e,"string");return Un(t)=="symbol"?t:t+""}function wD(e Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ID(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,u=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(f){s=!0,i=f}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return u}}function RD(e){if(Array.isArray(e))return e}function Gg(e,t){if(e==null)return{};var r=kD(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kD(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function DD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ND(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ow(n.key),n)}}function qD(e,t,r){return t&&ND(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function BD(e,t,r){return t=fa(t),LD(e,iw()?Reflect.construct(t,r||[],fa(e).constructor):t.apply(e,r))}function LD(e,t){if(t&&(kr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return FD(e)}function FD(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iw(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iw=function(){return!!e})()}function fa(e){return fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fa(e)}function zD(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nf(e,t)}function nf(e,t){return nf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},nf(e,t)}function Dr(e){return HD(e)||UD(e)||aw(e)||WD()}function WD(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aw(e,t){if(e){if(typeof e=="string")return af(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return af(e,t)}}function UD(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function HD(e){if(Array.isArray(e))return af(e)}function af(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kg(Object(r),!0).forEach(function(n){H(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kg(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function H(e,t,r){return t=ow(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ow(e){var t=GD(e,"string");return kr(t)=="symbol"?t:t+""}function GD(e,t){if(kr(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(kr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var KD={xAxis:["bottom","top"],yAxis:["left","right"]},VD={width:"100%",height:"100%"},uw={x:0,y:0};function di(e){return e}var XD=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},YD=function(t,r,n,i){var a=r.find(function(f){return f&&f.index===n});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,u=i.radius;return $($($({},i),Pe(i.cx,i.cy,u,o)),{},{angle:o,radius:u})}var c=a.coordinate,s=i.angle;return $($($({},i),Pe(i.cx,i.cy,c,s)),{},{angle:s,radius:c})}return uw},Fa=function(t,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(u,c){var s=c.props.data;return s&&s.length?[].concat(Dr(u),Dr(s)):u},[]);return o.length>0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function cw(e){return e==="number"?[0,"auto"]:void 0}var of=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=Fa(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var d=l===void 0?u:l;h=vi(d,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(Dr(c),[ox(s,h)]):c},[])},Vg=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=XD(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=oj(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=of(t,r,f,l),d=YD(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:d}}return null},ZD=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,d=ex(f,a);return n.reduce(function(m,v){var p,b=v.type.defaultProps!==void 0?$($({},v.type.defaultProps),v.props):v.props,x=b.type,w=b.dataKey,O=b.allowDataOverflow,y=b.allowDuplicatedCategory,g=b.scale,_=b.ticks,S=b.includeHidden,P=b[o];if(m[P])return m;var M=Fa(t.data,{graphicalItems:i.filter(function(z){var K,ce=o in z.props?z.props[o]:(K=z.type.defaultProps)===null||K===void 0?void 0:K[o];return ce===P}),dataStartIndex:c,dataEndIndex:s}),A=M.length,E,j,I;_D(b.domain,O,x)&&(E=Sl(b.domain,null,O),d&&(x==="number"||g!=="auto")&&(I=un(M,w,"category")));var C=cw(x);if(!E||E.length===0){var R,D=(R=b.domain)!==null&&R!==void 0?R:C;if(w){if(E=un(M,w,x),x==="category"&&d){var B=Zw(E);y&&B?(j=E,E=Ji(0,A)):y||(E=sm(D,E,v).reduce(function(z,K){return z.indexOf(K)>=0?z:[].concat(Dr(z),[K])},[]))}else if(x==="category")y?E=E.filter(function(z){return z!==""&&!J(z)}):E=sm(D,E,v).reduce(function(z,K){return z.indexOf(K)>=0||K===""||J(K)?z:[].concat(Dr(z),[K])},[]);else if(x==="number"){var L=fj(M,i.filter(function(z){var K,ce,de=o in z.props?z.props[o]:(K=z.type.defaultProps)===null||K===void 0?void 0:K[o],ke="hide"in z.props?z.props.hide:(ce=z.type.defaultProps)===null||ce===void 0?void 0:ce.hide;return de===P&&(S||!ke)}),w,a,f);L&&(E=L)}d&&(x==="number"||g!=="auto")&&(I=un(M,w,"category"))}else d?E=Ji(0,A):u&&u[P]&&u[P].hasStack&&x==="number"?E=h==="expand"?[0,1]:ax(u[P].stackGroups,c,s):E=Q0(M,i.filter(function(z){var K=o in z.props?z.props[o]:z.type.defaultProps[o],ce="hide"in z.props?z.props.hide:z.type.defau Line truncated
@@ -1 +0,0 @@
import{b as R,L as W,m as T,i as C,c as F,A as ie,d as B,e as G,h as oe,j as q,k as se,l as le,u as ue,n as K,G as ce,o as J,p as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-B4pnCJMD.js";import{a7 as p,a8 as ee,r as ve}from"./index-BTQygws6.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=(function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),CLine truncated
@@ -1 +0,0 @@
import{f as P,r as c,j as e,B as x,P as q,X as f}from"./index-BTQygws6.js";import{C as K,a as H}from"./card-D0oz3NII.js";import{I as Q}from"./input-C6mE-wO9.js";import{B as b}from"./badge-BsIZhz7S.js";import{T as U,a as X,b as O,c as p,d as $,e as n}from"./table-Dh5trM9F.js";import{a as m}from"./audit-DVfdGNwm.js";import{u as G,q as J,a as V,b as W}from"./unwrap-Bv0ReG-f.js";import{S as v}from"./search-BDsFve6h.js";import{R as Y}from"./refresh-cw-e9vbQhCy.js";import{D as Z}from"./download-BSvsFf63.js";function ee(s={page:1,page_size:50}){return G({queryKey:J.auditLogs(s),queryFn:async()=>{const a=await m.getLogs(s);return{list:W(a),total:V(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function me(){P();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Q,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Z,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(K,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:1Line truncated
@@ -0,0 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as q,a as P}from"./card-B1TdHH8z.js";import{f as K,B as x}from"./index-BZzvNKfa.js";import{I as H}from"./input-D7JNe8Xd.js";import{B as b}from"./badge-IN84WXM6.js";import{T as Q,a as U,b as O,c as p,d as X,e as n}from"./table-CQE_AU2l.js";import{a as m}from"./audit-C18l9_nL.js";import{u as $,q as G,a as J,b as V}from"./unwrap-CDkLoNKa.js";import{S as v,R as W,v as Y,x as Z,X as f}from"./vendor-icons-DIDdqO_o.js";function ee(s={page:1,page_size:50}){return $({queryKey:G.auditLogs(s),queryFn:async()=>{const a=await m.getLogs(s);return{list:V(a),total:J(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function be(){K();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(W,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(q,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(P,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:17",className:"w-8 h-8 bLine truncated
@@ -1 +0,0 @@
import{g as a,B as i,X as s,Y as t,f as e}from"./generateCategoricalChart-B4pnCJMD.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
@@ -1 +0,0 @@
import{k as E,m as D,r as c,j as e,n as k,o as j,K as H,B as P,p as N}from"./index-BTQygws6.js";import{C as L,a as M}from"./card-D0oz3NII.js";import{B as z}from"./badge-BsIZhz7S.js";import{S as f,a as v,b as S,c as w,d as x}from"./select-pPlmgAjn.js";import{T as U,a as F,b as d,c as r,d as I,e as n}from"./table-Dh5trM9F.js";import{k as p}from"./index-DSkkspoy.js";import{R as K}from"./refresh-cw-e9vbQhCy.js";import{D as G}from"./download-BSvsFf63.js";import{H as _}from"./hard-drive-zBn-z9Ht.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function ce(){const{clusterCode:$}=E(),h=D(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(K,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]}Line truncated
@@ -0,0 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as E,a as L}from"./card-B1TdHH8z.js";import{g as H,i as M,L as k,B as j}from"./index-BZzvNKfa.js";import{B as D}from"./badge-IN84WXM6.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-BFGszUub.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-CQE_AU2l.js";import{k as p}from"./index-DPhaKvWI.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapaLine truncated
@@ -1 +0,0 @@
import{j as e,r as a,B as d,a6 as _,D as R,a as W,b as Q,c as V,s as $,d as G,e as X,L as Z}from"./index-BTQygws6.js";import{I as h}from"./input-C6mE-wO9.js";import{L as u}from"./label-8e-EC7mH.js";import{C as N,a as y}from"./card-D0oz3NII.js";import{B as A}from"./badge-BsIZhz7S.js";import{c as v}from"./account-HBV_I0ZG.js";import{R as F}from"./refresh-cw-e9vbQhCy.js";import{P as S}from"./plus-DOS6OUrq.js";import{S as q}from"./search-BDsFve6h.js";import{C as J}from"./circle-check-DMxKs2Ba.js";import{C as U}from"./circle-x-CYoA2i-_.js";import{P as k}from"./pencil-BgEVXj0m.js";import{T as Y}from"./trash-2-5oUve9eW.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",colorLine truncated
@@ -0,0 +1 @@
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as R,a as W,b as Q,c as V,d as $,e as G}from"./index-BZzvNKfa.js";import{I as h}from"./input-D7JNe8Xd.js";import{L as u}from"./label-Bj0mNUAM.js";import{C as N,a as y}from"./card-B1TdHH8z.js";import{B as A}from"./badge-IN84WXM6.js";import{c as v}from"./account-DLHhQorw.js";import{R as _,P as F,S as X,ag as S,C as Z,a as q,d as k,T as J,i as U,L as Y}from"./vendor-icons-DIDdqO_o.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",color:"#006EFF",paths:[{fill:"#006EFF",d:"M685.3,188.5c-24.7-66.3-88-110.4-158.8-110.5c-84.8,0-152.2,62.8-165.3,140.8c6.5,0,13.1-2.1,21.8-2.1c8.7,0,19.6,2.1,28.3,2.1c10.Line truncated
@@ -1 +0,0 @@
import{i as ve,j as e,r as c,D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,L as R,t as p,f as Ne,J as H}from"./index-BTQygws6.js";import{I as j}from"./input-C6mE-wO9.js";import{L as r}from"./label-8e-EC7mH.js";import{C as T,a as V}from"./card-D0oz3NII.js";import{B as fe}from"./badge-BsIZhz7S.js";import{S as oe}from"./switch-8l7ThrsD.js";import{S as w,a as S,b as k,c as _,d as x}from"./select-pPlmgAjn.js";import{b as h}from"./billing-CtDdgyDv.js";import{S as be}from"./stat-strip-M_Ng3raR.js";import{R as q}from"./refresh-cw-e9vbQhCy.js";import{P as J}from"./plus-DOS6OUrq.js";import{P as G}from"./pencil-BgEVXj0m.js";import{T as K}from"./trash-2-5oUve9eW.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const De=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ye=ve("wallet",De),v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},O={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Re({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function we({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(_,{"cLine truncated
@@ -0,0 +1 @@
import{j as e,r as c}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,t as p,f as ve}from"./index-BZzvNKfa.js";import{I as j}from"./input-D7JNe8Xd.js";import{L as r}from"./label-Bj0mNUAM.js";import{C as H,a as T}from"./card-B1TdHH8z.js";import{B as Ne}from"./badge-IN84WXM6.js";import{S as oe}from"./switch-Ds1Doipu.js";import{S as R,a as w,b as S,c as k,d as x}from"./select-BFGszUub.js";import{b as h}from"./billing-Cc58vPzR.js";import{S as fe}from"./stat-strip-D5jCLXat.js";import{L as _,R as q,P as G,t as O,aB as be,d as J,T as K}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},V={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function De({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function ye({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:102:17",children:Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:104:21",value:l,children:f},l))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:109:13",children:[e.jsx(r,{"codeLine truncated
@@ -1 +0,0 @@
import{k as F,m as K,r as c,j as e,n as w,o as C,B as G,L as A,p as k,q as R,S as T,s as H,A as q,v as z,w as D}from"./index-BTQygws6.js";import{C as i,a as u}from"./card-D0oz3NII.js";import{B as M}from"./badge-BsIZhz7S.js";import{T as J,a as Q,b as x,c as n,d as V,e as a}from"./table-Dh5trM9F.js";import{k as j}from"./index-DSkkspoy.js";import{u as W}from"./use-toast-C8TQro77.js";import{R as X}from"./refresh-cw-e9vbQhCy.js";const Y={"kube-system":T,"kube-public":z,"kube-node-lease":q,default:H};function ne(){const{clusterCode:r}=F(),B=K(),{toast:E}=W(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await j.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([j.getNodes(r).catch(()=>[]),j.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(C,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(X,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold text-emerald-400",children:N.length})]}),e.jsx(RLine truncated
@@ -0,0 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as u}from"./card-B1TdHH8z.js";import{g as F,i as K,L as w,B as G}from"./index-BZzvNKfa.js";import{B as A}from"./badge-IN84WXM6.js";import{T as H,a as z,b as x,c as n,d as D,e as a}from"./table-CQE_AU2l.js";import{k as C}from"./index-DPhaKvWI.js";import{u as q}from"./use-toast-CkA38LVP.js";import{f as k,L as R,R as J,g as j,B as M,h as T,i as Q,A as V,j as W,k as X}from"./vendor-icons-DIDdqO_o.js";const Y={"kube-system":T,"kube-public":W,"kube-node-lease":V,default:Q};function oe(){const{clusterCode:r}=F(),B=K(),{toast:E}=q(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await C.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([C.getNodes(r).catch(()=>[]),C.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(J,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold tLine truncated
@@ -0,0 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as na,D as ze,a as Be,b as Ge,c as Ue,e as Qe,B as N,t as S,d as ca,f as da}from"./index-BZzvNKfa.js";import{I as p}from"./input-D7JNe8Xd.js";import{B as w}from"./badge-IN84WXM6.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-BFGszUub.js";import{u as $e,q as Ye,b as la}from"./unwrap-CDkLoNKa.js";import{u as V}from"./useMutation-DvUJDXfD.js";import{c as P}from"./credential-qfSmpSHw.js";import{F as ia,G as pa,D as ma,i as xa,j as Ze,k as ga,h as ha,ag as z,C as We,a as Xe,l as ya,aC as Re,aN as va,aO as Je,x as ea,R as Ca,P as Ve,S as ua,a4 as Da,b as ba,d as ja,T as Na}from"./vendor-icons-DIDdqO_o.js";import{L as i}from"./label-Bj0mNUAM.js";import"./index-CYARH0Cq.js";function fa(c={page_size:100}){return $e({queryKey:Ye.credentials(c),queryFn:async()=>{const d=await P.list(c);return la(d)},staleTime:3e4})}function Fa(c,d=!0){return $e({queryKey:Ye.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:ha,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ga,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:Ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:xa,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:ma,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:pa,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:ia,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(va,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>_(String(y)),children:e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:60:15",className:"h-3 w-3"})})]})]})]})},l=v;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:71:5",open:c,onOpenChangLine truncated
@@ -1 +0,0 @@
import{al as na,G as ca,E as da,s as la,v as ze,w as ia,S as pa,r as t,j as e,D as Be,a as Ge,b as Qe,c as Ue,a6 as z,T as ma,e as $e,B as N,t as S,aQ as xa,aR as Ye,P as Ze,d as ga,f as ha,C as ya}from"./index-BTQygws6.js";import{I as p}from"./input-C6mE-wO9.js";import{B as w}from"./badge-BsIZhz7S.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-pPlmgAjn.js";import{u as We,q as Xe,b as va}from"./unwrap-Bv0ReG-f.js";import{u as V}from"./useMutation-C9fIiouP.js";import{c as P}from"./credential-BnmvNrfT.js";import{F as Ca}from"./file-text-B8e3PkIb.js";import{C as Je}from"./circle-check-DMxKs2Ba.js";import{C as ea}from"./circle-x-CYoA2i-_.js";import{C as Re}from"./copy-DRb4X68n.js";import{L as i}from"./label-8e-EC7mH.js";import{R as ua}from"./refresh-cw-e9vbQhCy.js";import{P as Ve}from"./plus-DOS6OUrq.js";import{S as Da}from"./search-BDsFve6h.js";import{Z as ba}from"./zap-72OjNvOL.js";import{P as ja}from"./pencil-BgEVXj0m.js";import{T as Na}from"./trash-2-5oUve9eW.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function fa(c={page_size:100}){return We({queryKey:Xe.credentials(c),queryFn:async()=>{const d=await P.list(c);return va(d)},staleTime:3e4})}function Fa(c,d=!0){return We({queryKey:Xe.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:pa,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ia,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:la,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:da,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:ca,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:Ca,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(xa,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Ye,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(Ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",clasLine truncated
@@ -1,2 +1,2 @@
import{j as t,L as k,Q as lt,r as n,D as X,a as G,b as K,c as U,d as W,e as mt,B as p,t as l,H as Y,f as dt,C as xt,F as pt}from"./index-BTQygws6.js";import{C as ht,a as gt}from"./card-D0oz3NII.js";import{S as ut}from"./stat-strip-M_Ng3raR.js";import{I as P}from"./input-C6mE-wO9.js";import{B as C}from"./badge-BsIZhz7S.js";import{C as I}from"./checkbox-D73wKf04.js";import{s as $,c as y,t as bt}from"./automation-Bve9hYh8.js";import{C as vt}from"./circle-x-CYoA2i-_.js";import{S as B,a as z,b as O,c as R,d as J}from"./select-pPlmgAjn.js";import{T as A}from"./textarea-DDxE7TMs.js";import{L as N}from"./label-8e-EC7mH.js";import{T as yt,a as Ct,b as L,c as w,d as jt,e as f}from"./table-Dh5trM9F.js";import{H as Z}from"./history-0zIbY_Ux.js";import{R as Jt}from"./refresh-cw-e9vbQhCy.js";import{P as Nt}from"./plus-DOS6OUrq.js";import{S as ft}from"./search-BDsFve6h.js";import{T as Q}from"./trash-2-5oUve9eW.js";import{P as Dt}from"./package-open-C0BFsc9q.js";import{P as V}from"./play-BAPO-6Xq.js";import{P as Ft}from"./pause-5yiLcu-G.js";import{S as Mt}from"./square-pen-DYung4SK.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(lt,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(vt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,m]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,d]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(m({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{d(e)}).catch(()=>d(null)):d(null)):(m({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),d(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(d(x),m(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{m(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),d(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-Line truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>m({...a,content:e.target.value}),placeholder:"/scripts/backup.sh arg1 arg2",rows:4,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1 font-mono"})]})]}),t.jsxs(mt,{"code-path":"src/components/automation/CronJobFormDialog.tsx:294:9",children:[t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:295:11",variant:"outline",onClick:()=>g(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:298:11",className:"bg-blue-600 hover:bg-blue-700",onClick:H,disabled:S,children:S?"保存中...":s?"保存修改":"创建任务"})]})]})})}function Et({open:i,onOpenChange:g}){const[s,D]=n.useState([]),[a,m]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{m(!0);const d=await bt.getExecutions({task_type:"cron",page_size:50});D(d.list||[])}catch(d){console.error("Failed to load executions:",d)}finally{m(!1)}})()},[i]),t.jsx(X,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:51:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:52:7",className:"max-w-4xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] max-h-[85vh] overflow-y-auto",children:[t.jsxs(K,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:53:9",children:[t.jsx(U,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:54:11",children:"执行历史"}),t.jsx(W,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:55:11",className:"text-[var(--dg-text-secondary)]",children:"定时任务执行记录与输出日志"})]}),t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:57:9",className:"mt-4",children:a?t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:59:13",className:"flex items-center justify-center py-8",children:t.jsx(k,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:60:15",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):s.length===0?t.jsxs("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:63:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-secondary)]",children:[t.jsx(Z,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:64:15",className:"h-10 w-10 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:65:15",className:"text-sm",children:"暂无执行记录"})]}):t.jsxs(yt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ct,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:70:17",className:"border-[var(--dg-border)]",children:[t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:71:19",className:"text-[var(--dg-text-secondary)]",children:"任务"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:72:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:73:19",className:"text-[var(--dg-text-secondary)]",children:"耗时"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:74:19",className:"text-[var(--dg-text-secondary)]",children:"执行时间"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:75:19",className:"text-[var(--dg-text-secondary)]",children:"输出"})]})}),t.jsx(jt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:78:15",children:s.map(r=>t.jsxs(n.Fragment,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:80:19",children:[t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
import{j as t,r as n}from"./vendor-codemirror-C7mXSpXt.js";import{C as lt,a as dt}from"./card-B1TdHH8z.js";import{S as mt}from"./stat-strip-D5jCLXat.js";import{D as G,a as X,b as K,c as U,d as W,e as xt,B as p,t as l,f as pt}from"./index-BZzvNKfa.js";import{I as P}from"./input-D7JNe8Xd.js";import{B as C}from"./badge-IN84WXM6.js";import{C as I}from"./checkbox-DjjvQsNy.js";import{s as $,c as y,t as ht}from"./automation-CFN7qde5.js";import{L as k,a as gt,y as ut,aq as Y,r as Z,R as bt,P as vt,S as yt,T as z,aG as Ct,b as jt,o as Jt,z as B,aH as Nt,aI as ft}from"./vendor-icons-DIDdqO_o.js";import{S as O,a as R,b as A,c as V,d as J}from"./select-BFGszUub.js";import{T as q}from"./textarea-BL_Am_oZ.js";import{L as N}from"./label-Bj0mNUAM.js";import{T as Dt,a as Ft,b as L,c as w,d as Mt,e as f}from"./table-CQE_AU2l.js";import"./index-CYARH0Cq.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(ut,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(gt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const Q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,d]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,m]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(d({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{m(e)}).catch(()=>m(null)):m(null)):(d({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),m(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(m(x),d(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{d(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),m(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:157:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:158:13",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),t.jsx(P,{"code-paLine truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>d({...a,content:e.target.value}),placeholder:"/scripts/backup.sh arg1 arg2",rows:4,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1 font-mono"})]})]}),t.jsxs(xt,{"code-path":"src/components/automation/CronJobFormDialog.tsx:294:9",children:[t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:295:11",variant:"outline",onClick:()=>g(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:298:11",className:"bg-blue-600 hover:bg-blue-700",onClick:H,disabled:S,children:S?"保存中...":s?"保存修改":"创建任务"})]})]})})}function Et({open:i,onOpenChange:g}){const[s,D]=n.useState([]),[a,d]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{d(!0);const m=await ht.getExecutions({task_type:"cron",page_size:50});D(m.list||[])}catch(m){console.error("Failed to load executions:",m)}finally{d(!1)}})()},[i]),t.jsx(G,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:51:5",open:i,onOpenChange:g,children:t.jsxs(X,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:52:7",className:"max-w-4xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] max-h-[85vh] overflow-y-auto",children:[t.jsxs(K,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:53:9",children:[t.jsx(U,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:54:11",children:"执行历史"}),t.jsx(W,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:55:11",className:"text-[var(--dg-text-secondary)]",children:"定时任务执行记录与输出日志"})]}),t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:57:9",className:"mt-4",children:a?t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:59:13",className:"flex items-center justify-center py-8",children:t.jsx(k,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:60:15",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):s.length===0?t.jsxs("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:63:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-secondary)]",children:[t.jsx(Y,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:64:15",className:"h-10 w-10 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:65:15",className:"text-sm",children:"暂无执行记录"})]}):t.jsxs(Dt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ft,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:70:17",className:"border-[var(--dg-border)]",children:[t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:71:19",className:"text-[var(--dg-text-secondary)]",children:"任务"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:72:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:73:19",className:"text-[var(--dg-text-secondary)]",children:"耗时"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:74:19",className:"text-[var(--dg-text-secondary)]",children:"执行时间"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:75:19",className:"text-[var(--dg-text-secondary)]",children:"输出"})]})}),t.jsx(Mt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:78:15",children:s.map(r=>t.jsxs(n.Fragment,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:80:19",children:[t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
@@ -1,4 +0,0 @@
import{a8 as B,a7 as m,bd as tt,r as A,j as s,p as at,A as Dt,$ as u,E as Nt,m as ie,B as se,a4 as st,T as rt,v as $e,au as Fe,S as ot,s as Me,C as Ct}from"./index-BTQygws6.js";import{d as he}from"./dashboard-DIS6joUE.js";import{s as kt}from"./server-C0cSEEX-.js";import{k as Rt}from"./index-DSkkspoy.js";import{S as At}from"./stat-strip-M_Ng3raR.js";import{C as K,b as U,c as z,d as V,a as W}from"./card-D0oz3NII.js";import{B as L}from"./badge-BsIZhz7S.js";import{H as wt}from"./hard-drive-zBn-z9Ht.js";import{b as C,r as nt,s as St,t as ct,v as Ot,n as X,w as Ee,x as I,L as T,y as dt,z as Te,E as it,D as Pt,c as _t,e as ae,o as J,S as Et,A as Tt,F as Lt,d as Be,j as It,i as Q,l as $t,u as Ft,G as Mt,H as me,I as Bt,a as lt,J as Kt,K as pe,M as Ke,g as Ut,N as zt,R as Re,C as ht,X as pt,Y as mt,T as Ae,B as Vt}from"./generateCategoricalChart-B4pnCJMD.js";import{A as Wt,a as Ne}from"./AreaChart-qozZsHkf.js";import{B as qt}from"./BarChart-w5jU15cp.js";import{M as Ht}from"./memory-stick-CZtVAQ-V.js";import{A as le}from"./arrow-right-QQqkjfZb.js";import{C as Gt}from"./circle-B1H3eeGO.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ue(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var ze=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){ze(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),ze(a[0])&&r[r.length-1].push(a[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},ce=function(a,r){var e=aa(a);r&&(e=[e.reduce(function(n,c){return[].concat(Ue(n),Ue(c))},[])]);var o=e.map(function(n){return n.reduce(function(c,d,l){return"".concat(c).concat(l===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return e.length===1?"".concat(o,"Z"):o},sa=function(a,r,e){var o=ce(a,e);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(ce(r.reverse(),e).slice(1))},ra=function(a){var r=a.points,e=a.className,o=a.baseLinePoints,n=a.connectNulls,c=Xt(a,Zt);if(!r||!r.length)return null;var d=B("recharts-polygon",e);if(o&&o.length){var l=c.stroke&&c.stroke!=="none",i=sa(r,o,n);return m.createElement("g",{className:d},m.createElement("path",ee({},C(c,!0),{fill:i.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:i})),l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(r,n)})):null,l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(o,n)})):null)}var p=ce(r,n);return m.createElement("path",ee({},C(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",className:d,d:p}))},Ce,Ve;function oa(){if(Ve)return Ce;Ve=1;var t=nt(),a=St(),r=ct();function e(o,n){return o&&o.length?t(o,r(n,2),a):void 0}return Ce=e,Ce}var na=oa();const ca=tt(na);var ke,We;function da(){if(We)return ke;We=1;var t=nt(),a=ct(),r=Ot();function e(o,n){return o&&o.length?t(o,a(n,2),r):void 0}return ke=e,ke}var ia=da();const la=tt(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function qe(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function G(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?qe(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function He(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Ge(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,xt(e.key),e)}}function xa(t,a,r){return a&&Ge(t.prototype,a),r&&Ge(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,ut()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(Ke(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),q=J(D,p,M),H=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var R=E+me(h)*((O!==0?N:0)+H*S),Le=(E+R)/2,Ie=(f.innerRadius+f.outerRadius)/2,yt=[{name:q,value:O,payload:D,dataKey:y,type:b}],jt=I(f.cx,f.cy,Ie,Le);return F=g(g(g({percent:H,cornerRadius:n,name:q,tooltipPayload:yt,midAngle:Le,middleRadius:Ie,tooltipPosition:jt},D),f),{},{value:J(D,y),startAngle:E,endAngle:R,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=Ut({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:zt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const $a={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},et=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Fa(t){if(!t||t.length<2)return{pct:0,label:"暂无数据",direction:"neutral"};const a=Number(t[t.length-1].cost??0),r=Number(t[t.length-2].cost??0);if(r===0)return{pct:0,label:a>0?"新增费用":"持平",direction:"neutral"};const e=(a-r)/r*100,o=e>.05?"up":e<-.05?"down":"neutral",n=`${e>0?"+":""}${e.toFixed(1)}% 较上月`;return{pct:e,label:n,direction:o}}function Ma(t,a,r,e=24){const o=[];for(let n=e-1;n>=0;n--){const c=new Date(Date.now()-n*60*60*1e3);o.push({time:`${c.getHours().toString().padStart(2,"0")}:00`,cpu:Number(Math.max(0,Math.min(100,t+(Math.random()-.5)*15)).toFixed(1)),memory:Number(Math.max(0,Math.min(100,a+(Math.random()-.5)*10)).toFixed(1)),disk:Number(Math.max(0,Math.min(100,r+(Math.random()-.5)*5)).toFixed(1))})}return o}function Ba(t,a){if(!t||t.length===0)return[];const r={};for(const e of t){const o=e.timestamp;if(!o)continue;const c=`${new Date(o).getHours().toString().padStart(2,"0")}:00`;r[c]||(r[c]={}),e.name==="cpu"&&(r[c].cpu=Number(e.value)||0),e.name==="memory"&&(r[c].memory=Number(e.value)||0)}return Object.entries(r).sort((e,o)=>e[0].localeCompare(o[0])).map(([e,o])=>({time:e,cpu:Number((o.cpu??0).toFixed(1)),memory:Number((o.memory??0).toFixed(1)),disk:Number(a.toFixed(1))}))}function _e({active:t,payload:a,label:r}){return!t||!a?null:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:94:5",className:"chart-tooltip px-3 py-2",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:95:7",className:"text-xs font-medium mb-1.5",style:{color:"var(--dg-text-secondary)"},children:r}),a.map((e,o)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:97:9",className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:98:11",className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:99:11",style:{color:"var(--dg-text-muted)"},children:[e.name,":"]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:100:11",className:"font-medium",style:{color:"var(--dg-text-primary)"},children:typeof e.value=="number"?`${e.value}%`:e.value})]},o))]})}function Ka({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:$a[d.cloud]||et[l%et.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Fa(r);return s.jsxs(K,{"code-path":"src/components/dashboard/DashboardCharts.tsx:123:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:124:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:125:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:126:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:127:13",className:"text-[var(--dg-text-primary)]",children:"云成本概览"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:128:13",className:"text-[var(--dg-text-muted)]",children:"本月各云平台费用支出"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:130:11",className:"text-right",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:131:13",className:"text-2xl font-bold text-[var(--dg-text-primary)] tracking-tight",children:["¥",Number(n).toLocaleString()]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:134:13",className:u("text-xs Line truncated
@@ -0,0 +1,4 @@
import{a as m,g as st,r as R,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{au as K,m as u,i as ie,B as se,q as rt}from"./index-BZzvNKfa.js";import{d as he}from"./dashboard-Bvsa0TzO.js";import{s as Ct}from"./server-CxtAvlnp.js";import{k as kt}from"./index-DPhaKvWI.js";import{S as At}from"./stat-strip-D5jCLXat.js";import{C as B,b as U,c as z,d as V,a as q}from"./card-B1TdHH8z.js";import{B as L}from"./badge-IN84WXM6.js";import{g as ot,A as Rt,H as wt,az as St,D as Ot,ae as le,l as nt,j as Me,ar as Ke,aJ as Pt,h as ct,i as Be,b as _t}from"./vendor-icons-DIDdqO_o.js";import{f as C,r as dt,b as Et,c as it,d as Tt,i as J,e as Ee,p as I,L as T,g as lt,h as Te,j as ht,D as Lt,k as It,l as ae,m as Y,S as $t,n as Ft,o as Mt,q as Ue,s as Kt,t as Q,u as Bt,v as Ut,G as zt,w as me,x as Vt,y as pt,z as qt,E as pe,F as ze,H as mt,I as ut,X as Le,Y as Ie,J as Wt,K as Ht,R as Ae,A as Gt,C as xt,T as Re,a as Ne}from"./AreaChart-B36pk06p.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Jt(t,a){if(t==null)return{};var r=Xt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Xt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ve(t){return ta(t)||ea(t)||Qt(t)||Yt()}function Yt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var qe=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){qe(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),qe(a[0])&&r[r.length-1].push(a[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},ce=function(a,r){var e=aa(a);r&&(e=[e.reduce(function(n,c){return[].concat(Ve(n),Ve(c))},[])]);var o=e.map(function(n){return n.reduce(function(c,d,l){return"".concat(c).concat(l===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return e.length===1?"".concat(o,"Z"):o},sa=function(a,r,e){var o=ce(a,e);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(ce(r.reverse(),e).slice(1))},ra=function(a){var r=a.points,e=a.className,o=a.baseLinePoints,n=a.connectNulls,c=Jt(a,Zt);if(!r||!r.length)return null;var d=K("recharts-polygon",e);if(o&&o.length){var l=c.stroke&&c.stroke!=="none",i=sa(r,o,n);return m.createElement("g",{className:d},m.createElement("path",ee({},C(c,!0),{fill:i.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:i})),l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(r,n)})):null,l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(o,n)})):null)}var p=ce(r,n);return m.createElement("path",ee({},C(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",className:d,d:p}))},Ce,We;function oa(){if(We)return Ce;We=1;var t=dt(),a=Et(),r=it();function e(o,n){return o&&o.length?t(o,r(n,2),a):void 0}return Ce=e,Ce}var na=oa();const ca=st(na);var ke,He;function da(){if(He)return ke;He=1;var t=dt(),a=it(),r=Tt();function e(o,n){return o&&o.length?t(o,a(n,2),r):void 0}return ke=e,ke}var ia=da();const la=st(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function Ge(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function G(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Ge(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ge(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Ze(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Je(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,ft(e.key),e)}}function xa(t,a,r){return a&&Je(t.prototype,a),r&&Je(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,bt()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bt=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(ze(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return Y(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=Y(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=Y(D,y,0),W=Y(D,p,M),H=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var A=E+me(h)*((O!==0?N:0)+H*S),$e=(E+A)/2,Fe=(f.innerRadius+f.outerRadius)/2,Dt=[{name:W,value:O,payload:D,dataKey:y,type:b}],Nt=I(f.cx,f.cy,Fe,$e);return F=g(g(g({percent:H,cornerRadius:n,name:W,tooltipPayload:Dt,midAngle:$e,middleRadius:Fe,tooltipPosition:Nt},D),f),{},{value:Y(D,y),startAngle:E,endAngle:A,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=mt({chartName:"BarChart",GraphicalChild:ut,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Le},{axisType:"yAxis",AxisComp:Ie}],formatAxisMap:Wt}),$a=mt({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:Ht,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Fa={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},at=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Ma(t){if(!t||t.length<2)return{pct:0,label:"暂无数据",direction:"neutral"};const a=Number(t[t.length-1].cost??0),r=Number(t[t.length-2].cost??0);if(r===0)return{pct:0,label:a>0?"新增费用":"持平",direction:"neutral"};const e=(a-r)/r*100,o=e>.05?"up":e<-.05?"down":"neutral",n=`${e>0?"+":""}${e.toFixed(1)}% 较上月`;return{pct:e,label:n,direction:o}}function Ka(t,a,r,e=24){const o=[];for(let n=e-1;n>=0;n--){const c=new Date(Date.now()-n*60*60*1e3);o.push({time:`${c.getHours().toString().padStart(2,"0")}:00`,cpu:Number(Math.max(0,Math.min(100,t+(Math.random()-.5)*15)).toFixed(1)),memory:Number(Math.max(0,Math.min(100,a+(Math.random()-.5)*10)).toFixed(1)),disk:Number(Math.max(0,Math.min(100,r+(Math.random()-.5)*5)).toFixed(1))})}return o}function Ba(t,a){if(!t||t.length===0)return[];const r={};for(const e of t){const o=e.timestamp;if(!o)continue;const c=`${new Date(o).getHours().toString().padStart(2,"0")}:00`;r[c]||(r[c]={}),e.name==="cpu"&&(r[c].cpu=Number(e.value)||0),e.name==="memory"&&(r[c].memory=Number(e.value)||0)}return Object.entries(r).sort((e,o)=>e[0].localeCompare(o[0])).map(([e,o])=>({time:e,cpu:Number((o.cpu??0).toFixed(1)),memory:Number((o.memory??0).toFixed(1)),disk:Number(a.toFixed(1))}))}function _e({active:t,payload:a,label:r}){return!t||!a?null:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:94:5",className:"chart-tooltip px-3 py-2",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:95:7",className:"text-xs font-medium mb-1.5",style:{color:"var(--dg-text-secondary)"},children:r}),a.map((e,o)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:97:9",className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:98:11",className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:99:11",style:{color:"var(--dg-text-muted)"},children:[e.name,":"]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:100:11",className:"font-medium",style:{color:"var(--dg-text-primary)"},children:typeof e.value=="number"?`${e.value}%`:e.value})]},o))]})}function Ua({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:Fa[d.cloud]||at[l%at.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Ma(r);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:123:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:124:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:125:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:126:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:127:13",className:"text-[var(--dg-text-primary)]",children:"云成本概览"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:128:13",className:"text-[var(--dg-text-muted)]",children:"本月各云平台费用支出"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:130:11",className:"text-right",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:131:13",c Line truncated
@@ -1 +0,0 @@
import{i as ye,al as Me,t as n,r as d,j as e,D as ie,a as le,b as ue,c as pe,E as L,d as he,G as xe,v as ge,W as q,B as h,X as we,T as Fe,C as se,z as be,Q as Ze,e as De,f as je,a6 as Ce}from"./index-BTQygws6.js";import{T as ke,a as Se,b as ce,c as ne}from"./tabs-CH1b5gPd.js";import{B as P}from"./badge-BsIZhz7S.js";import{C as ae,b as Te,c as Ae,a as te}from"./card-D0oz3NII.js";import{u as ze,q as qe,b as Ee}from"./unwrap-Bv0ReG-f.js";import{u as O}from"./useMutation-C9fIiouP.js";import{p as z,z as T}from"./datasource-CgE8bmC1.js";import{I as x}from"./input-C6mE-wO9.js";import{L as m}from"./label-8e-EC7mH.js";import{S as j}from"./switch-8l7ThrsD.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-pPlmgAjn.js";import{C as E}from"./chevron-up-Z8QjN8G2.js";import{W as Le}from"./wrench-Ds7KM83L.js";import{P as B}from"./plus-DOS6OUrq.js";import{C as ve}from"./circle-x-CYoA2i-_.js";import{R as oe}from"./refresh-cw-e9vbQhCy.js";import{S as V}from"./star-LL2nQvPd.js";import{S as _e}from"./square-pen-DYung4SK.js";import{T as Ne}from"./trash-2-5oUve9eW.js";import{C as Ie}from"./circle-check-DMxKs2Ba.js";import"./index-WFeZT6kc.js";const Re=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],re=ye("plug",Re);function He(){return ze({queryKey:qe.promDatasources(),queryFn:async()=>{const a=await z.list();return Ee(a)},staleTime:3e4})}function fe(){const a=Me(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>z.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>z.update(l,t),onSuccess:o}),M=O({mutationFn:l=>z.delete(l),onSuccess:o}),w=O({mutationFn:l=>z.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Oe(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function Be(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Ve(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await z.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function $e(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function Ue({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Oe(p)),v(Be(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},$=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,W)=>W!==s))},H=(s,u,D)=>{v(W=>{const K=[...W];return K[s]={...K[s],[u]:D},K})},U=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Ve(t,r);try{l?(await w.mutateAsLine truncated
@@ -0,0 +1 @@
import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{T as ye,a as Me,b as ce,c as ne}from"./tabs-Dx4dxq7o.js";import{G as we,t as n,D as ie,a as le,b as ue,c as pe,d as he,B as h,e as xe,f as ge}from"./index-BZzvNKfa.js";import{B as P}from"./badge-IN84WXM6.js";import{C as se,b as Fe,c as Ze,a as ae}from"./card-B1TdHH8z.js";import{u as Ce,q as ke,b as Se}from"./unwrap-CDkLoNKa.js";import{u as O}from"./useMutation-DvUJDXfD.js";import{p as q,z as T}from"./datasource-DLQ-Yv-G.js";import{I as x}from"./input-D7JNe8Xd.js";import{L as m}from"./label-Bj0mNUAM.js";import{S as j}from"./switch-Ds1Doipu.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-BFGszUub.js";import{D as L,G as be,j as De,O as z,Q as E,a6 as Te,P as B,X as Ae,l as qe,b as te,p as je,y as ze,a as ve,R as oe,aW as re,ag as Ee,K as $,aI as _e,T as Ne,C as Le}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function Ie(){return Ce({queryKey:ke.promDatasources(),queryFn:async()=>{const a=await q.list();return Se(a)},staleTime:3e4})}function fe(){const a=we(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>q.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>q.update(l,t),onSuccess:o}),M=O({mutationFn:l=>q.delete(l),onSuccess:o}),w=O({mutationFn:l=>q.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Re(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function He(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Oe(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await q.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function Be(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function $e({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Re(p)),v(He(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},U=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,K)=>K!==s))},H=(s,u,D)=>{v(K=>{const W=[...K];return W[s]={...W[s],[u]:D},W})},V=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Oe(t,r);try{l?(await w.mutateAsync({id:l,data:s}),n.success("数据源更新成功")):(await M.mutateAsync(s),n.success("数据源创建成功")),o(!1)}catch(u){const D=u instanceof Error?u.message:"操作失败";n.error(D)}},G=async()=>{if(!t.url.trim()){n.error("请先输入 URL");return}k(!0),_(null);try{const s=await Pe({url:t.url,basic_auth:t.basic_auth,basic_auth_user:t.basic_auth_user,basic_auth_pass:t.basic_auth_pass,skip_tls_verify:t.skip_tls_verify});_(s)}catch(s){const u=s instanceof ErLine truncated
@@ -1 +0,0 @@
import{i as te,r as o,j as e,D as A,a as H,b as M,c as W,G as Y,w as Z,a6 as oe,e as ae,B as d,t as r,L as F,Q as ne,C as le,W as ce,d as de,f as re,V as pe}from"./index-BTQygws6.js";import{I as z}from"./input-C6mE-wO9.js";import{B as w}from"./badge-BsIZhz7S.js";import{T as ie,a as xe,b as O,c as B}from"./tabs-CH1b5gPd.js";import{L as _}from"./label-8e-EC7mH.js";import{S as K,a as Q,b as X,c as q,d as E}from"./select-pPlmgAjn.js";import{d as i}from"./config-CxWPmf4g.js";import{c as me}from"./credential-BnmvNrfT.js";import{P as G}from"./plus-DOS6OUrq.js";import{R as ee}from"./refresh-cw-e9vbQhCy.js";import{C as ye}from"./circle-x-CYoA2i-_.js";import{D as I}from"./download-BSvsFf63.js";import{W as he}from"./wrench-Ds7KM83L.js";import{P}from"./pencil-BgEVXj0m.js";import{T as U}from"./trash-2-5oUve9eW.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const ge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ce=te("settings-2",ge);function be({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),k=async()=>{try{const a=await me.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(k(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(K,{"code-path":"src/components/deploy/CredentiaLine truncated
@@ -0,0 +1 @@
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as A,a as H,b as J,c as K,e as te,B as d,t as r,d as oe,f as ae}from"./index-BZzvNKfa.js";import{I as z}from"./input-D7JNe8Xd.js";import{B as w}from"./badge-IN84WXM6.js";import{T as ne,a as le,b as O,c as B}from"./tabs-Dx4dxq7o.js";import{L as _}from"./label-Bj0mNUAM.js";import{S as M,a as Q,b as W,c as X,d as E}from"./select-BFGszUub.js";import{d as i}from"./config-BflmzFFv.js";import{c as ce}from"./credential-qfSmpSHw.js";import{G as Y,k as Z,ag as de,P as G,R as ee,L as k,y as re,a as pe,b as ie,v as I,Q as xe,au as me,J as ye,a6 as he,d as P,T as U}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function ge({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),F=async()=>{try{const a=await ce.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(F(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(J,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(K,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",value:String(D),onValueChange:a=>T(a==="__none"?"":a),children:[e.jsx(Q,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:116:15",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:117:17",placeholder:c?"选择凭据(API/密码Line truncated
@@ -1 +0,0 @@
import{i as Ne,r as o,f as ve,j as e,L as M,v as ae,B as a,V as D,O as fe,X as pe,Y as we,u as be,t as c}from"./index-BTQygws6.js";import{C as g,a as N}from"./card-D0oz3NII.js";import{I as h}from"./input-C6mE-wO9.js";import{B as x}from"./badge-BsIZhz7S.js";import{S as v,a as f,b as w,c as b,d as r}from"./select-pPlmgAjn.js";import{L as i}from"./label-8e-EC7mH.js";import{p as Se}from"./pipeline-CgOYDc3n.js";import{d as m}from"./config-CxWPmf4g.js";import{P as le}from"./plus-DOS6OUrq.js";import{S as ne}from"./save-w9vZ9YyU.js";import{T as ke}from"./trash-2-5oUve9eW.js";import{U as de}from"./user-plus-CTbJ7AX7.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Ie=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],re=Ne("regex",Ie);function Oe(){const[l,me]=o.useState([]),[xe,T]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[F,ye]=o.useState([]),[I,_]=o.useState([]),[p,he]=o.useState(""),[j,q]=o.useState(""),[G,H]=o.useState(!1),[J,z]=o.useState(!1),[P,O]=o.useState(""),[E,X]=o.useState(""),[C,Y]=o.useState(""),[K,Q]=o.useState("editor"),[W,Z]=o.useState(""),[Ce,U]=o.useState(null),[L,ee]=o.useState(""),[se,te]=o.useState(""),Re=ve(),R=async()=>{T(!0);try{const[s,t,d]=await Promise.all([m.getItemRoles(),Se.getPipelines({page_size:200}),be.getUsers({page_size:500})]);me(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{T(!1)}};o.useEffect(()=>{R()},[]);const $=async()=>{if(!p){_([]);return}try{const s=await m.getUserItemRoles(Number(p));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{$()},[p]);const B=o.useMemo(()=>{const s={};return l.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[l,y]),oe=(n?l.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await m.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:K,description:W}),c.success("已创建"),z(!1),O(""),X(""),Y(""),Q("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!L.trim()){c.error("正则不能为空");return}A(!0);try{await m.updateItemRole(s,{pattern:L,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await m.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await m.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!p||!j){c.error("请选择用户和角色");return}H(!0);try{await m.assignItemRole(Number(p),{user_id:Number(p),item_role_id:Number(j)}),c.success("已分配"),q(""),$()}catch(s){c.error(s?.message||"分配失败")}finally{H(!1)}},ge=async s=>{try{await m.removeItemRole(Number(p),s),c.success("已撤销"),$()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=F.find(s=>String(s.id)===p);return xe?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(M,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:J,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(-Line truncated
@@ -0,0 +1 @@
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,a as g}from"./card-B1TdHH8z.js";import{f as Ne,B as a,u as ve,t as c}from"./index-BZzvNKfa.js";import{I as h}from"./input-D7JNe8Xd.js";import{B as m}from"./badge-IN84WXM6.js";import{S as N,a as v,b as f,c as w,d as r}from"./select-BFGszUub.js";import{L as i}from"./label-Bj0mNUAM.js";import{p as fe}from"./pipeline-B15ySBmb.js";import{d as x}from"./config-BflmzFFv.js";import{L as T,j as ae,P as le,J as b,a8 as pe,$ as ne,w as we,X as de,T as be,a3 as re,V as Se}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function Je(){const[p,xe]=o.useState([]),[me,F]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[J,ye]=o.useState([]),[I,_]=o.useState([]),[l,he]=o.useState(""),[j,M]=o.useState(""),[G,X]=o.useState(!1),[q,z]=o.useState(!1),[P,H]=o.useState(""),[E,K]=o.useState(""),[C,O]=o.useState(""),[Q,W]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[$,ee]=o.useState(""),[se,te]=o.useState(""),Re=Ne(),R=async()=>{F(!0);try{const[s,t,d]=await Promise.all([x.getItemRoles(),fe.getPipelines({page_size:200}),ve.getUsers({page_size:500})]);xe(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{F(!1)}};o.useEffect(()=>{R()},[]);const L=async()=>{if(!l){_([]);return}try{const s=await x.getUserItemRoles(Number(l));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{L()},[l]);const B=o.useMemo(()=>{const s={};return p.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[p,y]),oe=(n?p.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await x.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:Q,description:Y}),c.success("已创建"),z(!1),H(""),K(""),O(""),W("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!$.trim()){c.error("正则不能为空");return}A(!0);try{await x.updateItemRole(s,{pattern:$,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await x.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await x.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!l||!j){c.error("请选择用户和角色");return}X(!0);try{await x.assignItemRole(Number(l),{user_id:Number(l),item_role_id:Number(j)}),c.success("已分配"),M(""),L()}catch(s){c.error(s?.message||"分配失败")}finally{X(!1)}},ge=async s=>{try{await x.removeItemRole(Number(l),s),c.success("已撤销"),L()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=J.find(s=>String(s.id)===l);return me?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:q,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:188:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:189:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:190:13",claLine truncated
@@ -0,0 +1,19 @@
import{j as e,r as x}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as st,o as vt,i as Kt,_ as vs,g as ks}from"./index-BZzvNKfa.js";import{C as V,a as F,b as me,c as xe}from"./card-B1TdHH8z.js";import{B as Z}from"./badge-IN84WXM6.js";import{k as de}from"./index-DPhaKvWI.js";import{u as Ae}from"./use-toast-CkA38LVP.js";import{S as Ce,e as gs,f as Ve,b as js,s as pt,Y as It,P as Ns,a as fs}from"./PodFileBrowser-B3WbiDk_.js";import{I as y}from"./input-D7JNe8Xd.js";import{Q as Xt,f as Qt,F as kt,r as Zt,H as es,L as ve,N as Pe,E as Ss,A as ts,b as ss,n as Es,k as nt,P as te,aq as Cs,s as gt,b8 as Ds,aN as ns,b9 as mt,T as ye,$ as ot,g as ws,ba as Ps,a4 as os,j as as,am as As,aD as cs,bb as Ts,z as rs,D as Ze,b2 as Hs,h as jt,aF as Ms,aE as xt,G as Bs,M as Rs,R as at,p as bt,y as yt,d as Ot,J as ht,X as ls,l as ds,a as Is,m as Os,aH as Lt,bc as Ls,ar as zs}from"./vendor-icons-DIDdqO_o.js";import{T as Ie,a as Oe,b as je,c as K,d as Le,e as X}from"./table-CQE_AU2l.js";import{L as H}from"./label-Bj0mNUAM.js";import{p as _s,R as $s,d as zt}from"./ResourceVisualEditor-BCkBgFXv.js";import{T as et}from"./textarea-BL_Am_oZ.js";import{S as $e,a as We,b as tt,c as Ge,d as ge}from"./select-BFGszUub.js";import{S as Nt}from"./switch-Ds1Doipu.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function is(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(d=>(d.type||d.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 ps({pod:t}){const s=is(t),o=[{label:"已调度",ts:s.scheduled,color:Ce.blue},{label:"已初始化",ts:s.initialized,color:Ce.orange},{label:"容器已就绪",ts:s.containersReady,color:Ce.green},{label:"容器组已就绪",ts:s.ready,color:Ce.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 d=o[n-1],l=gs(d?.ts,a.ts);return e.jsxs(x.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<o.length-1&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:54:15",className:"flex flex-col items-center mx-0.5 min-w-[30px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:55:17",className:"h-0.5 w-8 bg-[var(--dg-border)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:56:17",className:"text-[9px] text-[var(--dg-text-muted)] mt-0.5",children:l!=null?js(l):""})]})]},a.label)})})}function Ws({clusterCode:t,pods:s,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:n,expandedPod:d,setExpandedPod:l}){return s.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:17:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无容器组"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:20:5",className:"space-y-2",children:s.map(p=>{const A=is(p),i=d===p.name,j=p.node_name||p.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:()=>l(i?null:p.name),children:i?e.jsx(Xt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"hLine truncated
`):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 d="none";return n.exec?d="exec":n.httpGet?d="httpGet":n.tcpSocket&&(d="tcpSocket"),{type:d,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 ut(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(i=>i.name.trim()).map(i=>{const j={name:i.name};return i.value!=null&&(j.value=i.value),j})),t.ports.length>0&&(s.ports=t.ports.filter(i=>i.containerPort!=="").map(i=>{const j={containerPort:typeof i.containerPort=="number"?i.containerPort:Number(i.containerPort)};return i.name&&(j.name=i.name),i.protocol&&(j.protocol=i.protocol),j}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(i=>i&&i.trim()),d=a&&Object.values(a).some(i=>i&&i.trim());(n||d)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),d&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const l=ut(t.livenessProbe);l&&(s.livenessProbe=l);const p=ut(t.readinessProbe);p&&(s.readinessProbe=p);const A=ut(t.startupProbe);if(A&&(s.startupProbe=A),t.lifecycle){const i={},j=Wt(t.lifecycle.postStart);j&&(i.postStart=j);const f=Wt(t.lifecycle.preStop);f&&(i.preStop=f),Object.keys(i).length>0&&(s.lifecycle=i)}if(t.securityContext){const i=t.securityContext,j={};i.runAsUser!==""&&i.runAsUser!=null&&(j.runAsUser=Number(i.runAsUser)),i.runAsGroup!==""&&i.runAsGroup!=null&&(j.runAsGroup=Number(i.runAsGroup)),i.runAsNonRoot!=null&&(j.runAsNonRoot=i.runAsNonRoot),i.privileged!=null&&(j.privileged=i.privileged),i.readOnlyRootFilesystem!=null&&(j.readOnlyRootFilesystem=i.readOnlyRootFilesystem),i.allowPrivilegeEscalation!=null&&(j.allowPrivilegeEscalation=i.allowPrivilegeEscalation);const f=(i.capabilitiesAdd||[]).filter(Boolean),M=(i.capabilitiesDrop||[]).filter(Boolean);(f.length||M.length)&&(j.capabilities={},f.length&&(j.capabilities.add=f),M.length&&(j.capabilities.drop=M)),Object.keys(j).length>0&&(s.securityContext=j)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(i=>i.name.trim()&&i.mountPath.trim()).map(i=>{const j={name:i.name,mountPath:i.mountPath};return i.subPath&&(j.subPath=i.subPath),i.readOnly&&(j.readOnly=!0),j})),s}function Vt(t){return t.join(`
`)}function Ft(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function Js({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(H,{"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(H,{"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(H,{"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(tt,{"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(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ge,{"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(H,{"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(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(et,{"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(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(et,{"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(Zt,{"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(te,{"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,d)=>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:l=>{const p=[...o.env];p[d]={...n,name:l.target.value},s({env:p})},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:l=>{const p=[...o.env];p[d]={...n,value:l.target.value},s({env:p})},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((l,p)=>p!==d)}),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},d)),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(Pe,{"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(te,{"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,d)=>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:l=>{const p=[...o.ports];p[d]={...n,name:l.target.value},s({ports:p})},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:l=>{const p=[...o.ports];p[d]={...n,containerPort:l.target.value},s({ports:p})},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:l=>{const p=[...o.ports];p[d]={...n,protocol:l},s({ports:p})},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(tt,{"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(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
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(H,{"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:w=>a(w.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(H,{"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:A,children:[e.jsx(te,{"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((w,C)=>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:w.name,onChange:P=>i(C,{name:P.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:w.value,onChange:P=>i(C,{value:P.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:()=>j(C),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},C))]})]})]}),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(Rs,{"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(H,{"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:f,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.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:"未配置"}):l.map((w,C)=>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:w.ip,onChange:P=>M(C,{ip:P.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:w.hostnames,onChange:P=>M(C,{hostnames:P.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(C),children:e.jsx(ye,{"code-path":"src/compone Line truncated
`):""),Tt(Array.isArray(ae.searches)?ae.searches.join(`
`):"");const dt=Array.isArray(ae.options)?ae.options:[];Mt(dt.map(pe=>({name:pe.name||"",value:pe.value||""}))),j(!1)},[a]);const ms=()=>ne(g=>[...g,{key:"",value:""}]),xs=g=>ne(T=>T.filter((G,oe)=>oe!==g)),hs=(g,T)=>ne(G=>G.map((oe,le)=>le===g?{...oe,...T}:oe)),us=async()=>{A(!0);try{const g=JSON.parse(JSON.stringify(f));g.spec=g.spec||{},g.spec.template=g.spec.template||{},g.spec.template.spec=g.spec.template.spec||{};const T=g.spec.template.spec;if(g.spec.strategy={type:b},b==="RollingUpdate"&&(g.spec.strategy.rollingUpdate={maxSurge:C,maxUnavailable:z}),ee&&(g.spec.revisionHistoryLimit=Number(ee)),W&&(g.spec.progressDeadlineSeconds=Number(W)),U==="nodeName"&&Q.trim())T.nodeName=Q.trim(),delete T.nodeSelector,T.affinity&&delete T.affinity.nodeAffinity;else if(U==="nodeSelector"){const _={};for(const{key:ae,value:dt}of N){const pe=ae.trim();pe&&(_[pe]=dt)}Object.keys(_).length>0?T.nodeSelector=_:delete T.nodeSelector,T.nodeName&&delete T.nodeName,T.affinity&&delete T.affinity.nodeAffinity}else if(U==="nodeAffinity"){const _=N.filter(ae=>ae.key.trim()).map(ae=>({key:ae.key.trim(),operator:"In",values:[ae.value]}));_.length>0?(T.affinity=T.affinity||{},T.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:_}]}}):T.affinity&&delete T.affinity.nodeAffinity,delete T.nodeSelector,T.nodeName&&delete T.nodeName}const G=m.filter(_=>_.key||_.operator==="Exists").map(_=>{const ae={};return _.key&&(ae.key=_.key),_.operator&&(ae.operator=_.operator),_.value&&_.operator!=="Exists"&&(ae.value=_.value),_.effect&&(ae.effect=_.effect),_.tolerationSeconds&&_.effect==="NoExecute"&&(ae.tolerationSeconds=Number(_.tolerationSeconds)),ae});G.length>0?T.tolerations=G:delete T.tolerations,c&&(T.dnsPolicy=c),S&&(T.restartPolicy=S),B&&(T.schedulerName=B),ie&&(T.terminationGracePeriodSeconds=Number(ie)),he&&(T.serviceAccountName=he);const oe={};re&&(oe.fsGroup=Number(re)),fe&&(oe.runAsUser=Number(fe)),be&&(oe.runAsGroup=Number(be)),Se&&(oe.runAsNonRoot=!0),Object.keys(oe).length>0?T.securityContext=oe:delete T.securityContext,rt?T.hostNetwork=!0:delete T.hostNetwork,lt?T.hostIPC=!0:delete T.hostIPC,we?T.hostPID=!0:delete T.hostPID,St?T.shareProcessNamespace=!0:delete T.shareProcessNamespace;const le=Ct.filter(_=>_.ip.trim()).map(_=>({ip:_.ip.trim(),hostnames:_.hostnames.split(/[,\s]+/).map(ae=>ae.trim()).filter(Boolean)})).filter(_=>_.hostnames.length>0);le.length>0?T.hostAliases=le:delete T.hostAliases;const ke={},ze=wt.split(`
`).map(_=>_.trim()).filter(Boolean);ze.length>0&&(ke.nameservers=ze);const Ue=At.split(`
`).map(_=>_.trim()).filter(Boolean);Ue.length>0&&(ke.searches=Ue);const Ee=Ht.filter(_=>_.name.trim()).map(_=>{const ae={name:_.name.trim()};return _.value.trim()&&(ae.value=_.value.trim()),ae});Ee.length>0&&(ke.options=Ee),Object.keys(ke).length>0?T.dnsConfig=ke:delete T.dnsConfig,await ct(t,s,o,g),l({title:"高级设置已保存",description:`${o} 更新已提交`}),n(g)}catch(g){l({title:"保存失败",description:g?.message||String(g),variant:"destructive"})}finally{A(!1)}};return i?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(ve,{"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:()=>w("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:()=>w("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(H,{"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:C,onChange:g=>P(g.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(H,{"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:z,onChange:g=>O(g.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(ss,{"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(H,{"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:"numbe Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(os,{"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(H,{"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:["(",Y.ports.length," 个端口)"]})]}),Y.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:c=>Q(k,"name",c.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:c=>Q(k,"protocol",c.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:c=>Q(k,"port",c.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:c=>Q(k,"targetPort",c.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),Y.type==="NodePort"&&e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:c=>Q(k,"nodePort",c.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:()=>se(k),disabled:Y.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:()=>q(),children:[e.jsx(te,{"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(w).length>0?Object.entries(w).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:()=>ee(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:ne,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/ku Line truncated
-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"}'`,p=A=>{navigator.clipboard.writeText(A).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(H,{"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:d}),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:()=>p(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(H,{"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:l}),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:()=>p(l),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 Qe({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(ls,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function dn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:d}=Ae(),[l,p]=x.useState(""),[A,i]=x.useState(200),[j,f]=x.useState(a[0]||""),[M,b]=x.useState(!1),[w,C]=x.useState(!1),P=async()=>{b(!0);try{const O=await de.getPodLogs(t,s,o,A,j||void 0);p(O?.data?.logs||O?.logs||O||"无日志")}catch{p("获取日志失败")}finally{b(!1)}};x.useEffect(()=>{P()},[j,A]);const z=async()=>{C(!0);const O=vt.getState().token||"",ee="",Y=j?`&container=${encodeURIComponent(j)}`:"",W=`${ee}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${A}&stream=true${Y}`;try{const U=(await fetch(W,{headers:{Authorization:`Bearer ${O}`}})).body?.getReader();if(!U)return;const q=new TextDecoder;let Q="";for(;;){const{done:se,value:r}=await U.read();if(se)break;Q+=q.decode(r,{stream:!0}),p(Q)}}catch{d({title:"流式日志连接中断",variant:"destructive"})}finally{C(!1)}};return e.jsx("div",{"code-path":"src/components/ku Line truncated
@@ -1,20 +0,0 @@
import{i as Ve,j as e,r as x,B as h,W as Ut,o as Kt,H as Xt,L as he,N as Ee,A as Qt,C as Zt,R as ys,f as st,w as nt,aQ as es,p as vs,v as ts,E as Ze,S as kt,G as ks,M as gs,z as bt,Q as yt,V as it,a2 as gt,X as ss,T as ns,m as os,be as js,au as Ns,k as fs}from"./index-BTQygws6.js";import{C as F,a as Y,b as ie,c as pe}from"./card-D0oz3NII.js";import{B as te}from"./badge-BsIZhz7S.js";import{k as ee}from"./index-DSkkspoy.js";import{u as De}from"./use-toast-C8TQro77.js";import{S as Se,e as Ss,f as Fe,b as Cs,s as pt,Y as Bt,P as ws,a as Es}from"./PodFileBrowser-BYnKz8ea.js";import{I as b}from"./input-C6mE-wO9.js";import{F as jt}from"./file-text-B8e3PkIb.js";import{H as as}from"./hard-drive-zBn-z9Ht.js";import{T as Ie,a as Be,b as ke,c as K,d as Oe,e as X}from"./table-Dh5trM9F.js";import{E as vt}from"./external-link-DUvuGx7K.js";import{P as re}from"./plus-DOS6OUrq.js";import{H as Ds}from"./history-0zIbY_Ux.js";import{M as Nt}from"./minus-B61YKf1a.js";import{L as A}from"./label-8e-EC7mH.js";import{T as be}from"./trash-2-5oUve9eW.js";import{S as ot}from"./save-w9vZ9YyU.js";import{T as et}from"./textarea-DDxE7TMs.js";import{S as $e,a as We,b as tt,c as Ge,d as ye}from"./select-pPlmgAjn.js";import{S as ft}from"./switch-8l7ThrsD.js";import{Z as rs}from"./zap-72OjNvOL.js";import{F as Ps}from"./folder-open-B72Redy5.js";import{R as cs}from"./rotate-cw-ClBTsHWn.js";import{P as ls}from"./play-BAPO-6Xq.js";import{D as As}from"./disc-vNDYYr0z.js";import{a as Ts,F as mt}from"./folder-CQ5eyfNi.js";import{R as at}from"./refresh-cw-e9vbQhCy.js";import{C as Hs}from"./circle-x-CYoA2i-_.js";import{A as Ms}from"./arrow-left-C7utsRsB.js";import{P as Ot}from"./pause-5yiLcu-G.js";import"./copy-DRb4X68n.js";import"./sparkles-Bd2inR9e.js";import"./xterm-DSqgeKvr.js";import"./box-CHjdSJYg.js";import"./minimize-2-DBp9LGa2.js";import"./upload-DAFoufx2.js";import"./download-BSvsFf63.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Rs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Is=Ve("hash",Rs);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Ve("heart",Bs);const zs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ls=Ve("image",zs);const _s=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],$s=Ve("key-round",_s);const Ws=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],zt=Ve("tags",Ws);function ds(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(l=>(l.type||l.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 Re({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 is({pod:t}){const s=ds(t),o=[{label:"已调度",ts:s.scheduled,color:Se.blue},{label:"已初始化",ts:s.initialized,color:Se.orange},{label:"容器已就绪",ts:s.containersReady,color:Se.green},{label:"容器组已就绪",ts:s.ready,color:Se.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 l=o[n-1],d=Ss(l?.ts,a.ts);return e.jsxs(x.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/componeLine truncated
`):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 l="none";return n.exec?l="exec":n.httpGet?l="httpGet":n.tcpSocket&&(l="tcpSocket"),{type:l,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 ut(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 $t(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 Wt(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(c=>c.name.trim()).map(c=>{const g={name:c.name};return c.value!=null&&(g.value=c.value),g})),t.ports.length>0&&(s.ports=t.ports.filter(c=>c.containerPort!=="").map(c=>{const g={containerPort:typeof c.containerPort=="number"?c.containerPort:Number(c.containerPort)};return c.name&&(g.name=c.name),c.protocol&&(g.protocol=c.protocol),g}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(c=>c&&c.trim()),l=a&&Object.values(a).some(c=>c&&c.trim());(n||l)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),l&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ut(t.livenessProbe);d&&(s.livenessProbe=d);const m=ut(t.readinessProbe);m&&(s.readinessProbe=m);const w=ut(t.startupProbe);if(w&&(s.startupProbe=w),t.lifecycle){const c={},g=$t(t.lifecycle.postStart);g&&(c.postStart=g);const N=$t(t.lifecycle.preStop);N&&(c.preStop=N),Object.keys(c).length>0&&(s.lifecycle=c)}if(t.securityContext){const c=t.securityContext,g={};c.runAsUser!==""&&c.runAsUser!=null&&(g.runAsUser=Number(c.runAsUser)),c.runAsGroup!==""&&c.runAsGroup!=null&&(g.runAsGroup=Number(c.runAsGroup)),c.runAsNonRoot!=null&&(g.runAsNonRoot=c.runAsNonRoot),c.privileged!=null&&(g.privileged=c.privileged),c.readOnlyRootFilesystem!=null&&(g.readOnlyRootFilesystem=c.readOnlyRootFilesystem),c.allowPrivilegeEscalation!=null&&(g.allowPrivilegeEscalation=c.allowPrivilegeEscalation);const N=(c.capabilitiesAdd||[]).filter(Boolean),H=(c.capabilitiesDrop||[]).filter(Boolean);(N.length||H.length)&&(g.capabilities={},N.length&&(g.capabilities.add=N),H.length&&(g.capabilities.drop=H)),Object.keys(g).length>0&&(s.securityContext=g)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(c=>c.name.trim()&&c.mountPath.trim()).map(c=>{const g={name:c.name,mountPath:c.mountPath};return c.subPath&&(g.subPath=c.subPath),c.readOnly&&(g.readOnly=!0),g})),s}function Gt(t){return t.join(`
`)}function Vt(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function Ks({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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(b,{"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(A,{"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(tt,{"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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ye,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Gt(o.command),placeholder:`/bin/sh
-c`,onChange:n=>s({command:Vt(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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Gt(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:n=>s({args:Vt(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(Xt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(h,{"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(re,{"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,l)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const m=[...o.env];m[l]={...n,name:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const m=[...o.env];m[l]={...n,value:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"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,m)=>m!==l)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},l)),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(Ee,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(h,{"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(re,{"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,l)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const m=[...o.ports];m[l]={...n,name:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const m=[...o.ports];m[l]={...n,containerPort:d.target.value},s({ports:m})},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 m=[...o.ports];m[l]={...n,protocol:d},s({ports:m})},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(tt,{"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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
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(A,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(h,{"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:w,children:[e.jsx(re,{"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,S)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:D=>c(S,{name:D.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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:D=>c(S,{value:D.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"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:()=>g(S),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},S))]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(pe,{"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(gs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(Y,{"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(A,{"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(h,{"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:N,children:[e.jsx(re,{"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,S)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:D=>H(S,{ip:D.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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:D=>H(S,{hostnames:D.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(h,{"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:()=>y(S),children:e.jsx(be,{"code-path":"src/compone Line truncated
`):""),Ht(Array.isArray(R.searches)?R.searches.join(`
`):"");const xe=Array.isArray(R.options)?R.options:[];Rt(xe.map(le=>({name:le.name||"",value:le.value||""}))),g(!1)},[a]);const ps=()=>P(C=>[...C,{key:"",value:""}]),ms=C=>P(T=>T.filter((se,ve)=>ve!==C)),xs=(C,T)=>P(se=>se.map((ve,Ae)=>Ae===C?{...ve,...T}:ve)),hs=async()=>{w(!0);try{const C=JSON.parse(JSON.stringify(N));C.spec=C.spec||{},C.spec.template=C.spec.template||{},C.spec.template.spec=C.spec.template.spec||{};const T=C.spec.template.spec;if(C.spec.strategy={type:y},y==="RollingUpdate"&&(C.spec.strategy.rollingUpdate={maxSurge:S,maxUnavailable:z}),ne&&(C.spec.revisionHistoryLimit=Number(ne)),L&&(C.spec.progressDeadlineSeconds=Number(L)),U==="nodeName"&&Z.trim())T.nodeName=Z.trim(),delete T.nodeSelector,T.affinity&&delete T.affinity.nodeAffinity;else if(U==="nodeSelector"){const R={};for(const{key:xe,value:le}of p){const Le=xe.trim();Le&&(R[Le]=le)}Object.keys(R).length>0?T.nodeSelector=R:delete T.nodeSelector,T.nodeName&&delete T.nodeName,T.affinity&&delete T.affinity.nodeAffinity}else if(U==="nodeAffinity"){const R=p.filter(xe=>xe.key.trim()).map(xe=>({key:xe.key.trim(),operator:"In",values:[xe.value]}));R.length>0?(T.affinity=T.affinity||{},T.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:R}]}}):T.affinity&&delete T.affinity.nodeAffinity,delete T.nodeSelector,T.nodeName&&delete T.nodeName}const se=i.filter(R=>R.key||R.operator==="Exists").map(R=>{const xe={};return R.key&&(xe.key=R.key),R.operator&&(xe.operator=R.operator),R.value&&R.operator!=="Exists"&&(xe.value=R.value),R.effect&&(xe.effect=R.effect),R.tolerationSeconds&&R.effect==="NoExecute"&&(xe.tolerationSeconds=Number(R.tolerationSeconds)),xe});se.length>0?T.tolerations=se:delete T.tolerations,v&&(T.dnsPolicy=v),W&&(T.restartPolicy=W),ue&&(T.schedulerName=ue),me&&(T.terminationGracePeriodSeconds=Number(me)),ce&&(T.serviceAccountName=ce);const ve={};ae&&(ve.fsGroup=Number(ae)),je&&(ve.runAsUser=Number(je)),de&&(ve.runAsGroup=Number(de)),Ne&&(ve.runAsNonRoot=!0),Object.keys(ve).length>0?T.securityContext=ve:delete T.securityContext,rt?T.hostNetwork=!0:delete T.hostNetwork,ct?T.hostIPC=!0:delete T.hostIPC,we?T.hostPID=!0:delete T.hostPID,Ct?T.shareProcessNamespace=!0:delete T.shareProcessNamespace;const Ae=Et.filter(R=>R.ip.trim()).map(R=>({ip:R.ip.trim(),hostnames:R.hostnames.split(/[,\s]+/).map(xe=>xe.trim()).filter(Boolean)})).filter(R=>R.hostnames.length>0);Ae.length>0?T.hostAliases=Ae:delete T.hostAliases;const Te={},ze=Pt.split(`
`).map(R=>R.trim()).filter(Boolean);ze.length>0&&(Te.nameservers=ze);const qe=Tt.split(`
`).map(R=>R.trim()).filter(Boolean);qe.length>0&&(Te.searches=qe);const fe=Mt.filter(R=>R.name.trim()).map(R=>{const xe={name:R.name.trim()};return R.value.trim()&&(xe.value=R.value.trim()),xe});fe.length>0&&(Te.options=fe),Object.keys(Te).length>0?T.dnsConfig=Te:delete T.dnsConfig;const lt=JSON.stringify(C,null,2);await ee.updateResourceYaml(t,s,"deployments",o,lt),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(C){d({title:"保存失败",description:C?.message||String(C),variant:"destructive"})}finally{w(!1)}};return c?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(he,{"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(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(pe,{"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(Y,{"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:y==="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:y==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),y==="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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:S,onChange:C=>D(C.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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:C=>B(C.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(Y,{"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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(b,{"code-path":"src/c Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:422:23",className:"h-2.5 w-2.5"}),i.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"text-slate-500 text-[9px]",children:[i.protocol," ",i.port,":",i.targetPort]})]},i.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:431:15",className:"space-y-2",children:[e.jsxs(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:432:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((i,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:21",value:i.name,onChange:v=>Z(k,"name",v.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:442:21",value:i.protocol,onChange:v=>Z(k,"protocol",v.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:444:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:445:23",value:"UDP",children:"UDP"})]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:448:21",value:i.port,onChange:v=>Z(k,"port",v.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:451:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:452:21",value:i.targetPort,onChange:v=>Z(k,"targetPort",v.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(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:457:23",value:i.nodePort,onChange:v=>Z(k,"nodePort",v.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(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:462:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>oe(k),disabled:q.ports.length<=1,children:e.jsx(Nt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:23",className:"h-3 w-3"})})]},k)),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>V(),children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:476: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:477:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([i,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[i,"=",k]},i)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:483:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:487:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:488:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ne(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:P,children:"创建"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:497:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:498:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kub Line truncated
${g?"border-blue-500 text-blue-400":c.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(N,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:15",className:"h-3.5 w-3.5"}),c.label,c.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:55:17",className:`text-[9px] px-1 py-0.5 rounded ${g?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:c.badge})]},c.key)})}),d==="basic"?e.jsx(Us,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:66:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="containers"?e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:76:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="storage"?e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:86:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="advanced"?e.jsx(an,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:96:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="service"?e.jsx(cn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:106:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):null]})}function dn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=De(),n=gt(w=>w.token)||localStorage.getItem("token")||"",l=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${l}' \\
-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"}'`,m=w=>{navigator.clipboard.writeText(w).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(A,{"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:l}),e.jsx(h,{"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:()=>m(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(A,{"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(h,{"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:()=>m(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 Qe({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(h,{"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(ss,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function pn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:l}=De(),[d,m]=x.useState(""),[w,c]=x.useState(200),[g,N]=x.useState(a[0]||""),[H,y]=x.useState(!1),[E,S]=x.useState(!1),D=async()=>{y(!0);try{const B=await ee.getPodLogs(t,s,o,w,g||void 0);m(B?.data?.logs||B?.logs||B||"无日志")}catch{m("获取日志失败")}finally{y(!1)}};x.useEffect(()=>{D()},[g,w]);const z=async()=>{S(!0);const B=gt.getState().token||"",ne="",q=g?`&container=${encodeURIComponent(g)}`:"",L=`${ne}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${w}&stream=true${q}`;try{const U=(await fetch(L,{headers:{Authorization:`Bearer ${B}`}})).body?.getReader();if(!U)return;const V=new TextDecoder;let Z="";for(;;){const{done:oe,value:r}=await U.read();if(oe)break;Z+=V.decode(r,{stream:!0}),m(Z)}}catch{l({title:"流式日志连接中断",variant:"destructive"})}finally{S(!1)}};return e.jsx("div",{"code-path":"src/components/ku Line truncated
@@ -0,0 +1 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as m,D as U,a as A,b as H,c as X,d as q,e as J}from"./index-BZzvNKfa.js";import{I as l}from"./input-D7JNe8Xd.js";import{L as d}from"./label-Bj0mNUAM.js";import{C as j,a as M}from"./card-B1TdHH8z.js";import{B as h}from"./badge-IN84WXM6.js";import{c as u}from"./account-DLHhQorw.js";import{R as E,P as L,S as K,G as k,C as P,a as V,b as W,c as O,T as Y,L as Z}from"./vendor-icons-DIDdqO_o.js";function le(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const c=o=>o?o.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(c){console.error("删除域名失败:",c)}},w=i.filter(s=>{const c=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),o=D==="all"||s.status===D;return c&&o});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(K,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:200:11",value:"pending",children:"待审核"})]})]}),N?e.jsx(j,{"code-path":"src/components/cloud/DomaiLine truncated
@@ -1 +0,0 @@
import{r as n,j as e,B as m,G as E,C as U,D as A,a as H,b as X,c as q,d as J,e as K,L as V}from"./index-BTQygws6.js";import{I as l}from"./input-C6mE-wO9.js";import{L as d}from"./label-8e-EC7mH.js";import{C as j,a as M}from"./card-D0oz3NII.js";import{B as h}from"./badge-BsIZhz7S.js";import{c as u}from"./account-HBV_I0ZG.js";import{R as L}from"./refresh-cw-e9vbQhCy.js";import{P as k}from"./plus-DOS6OUrq.js";import{S as W}from"./search-BDsFve6h.js";import{C as P}from"./circle-check-DMxKs2Ba.js";import{C as Y}from"./circle-x-CYoA2i-_.js";import{P as O}from"./pen-B5_8qwiI.js";import{T as Z}from"./trash-2-5oUve9eW.js";function xe(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const o=c=>c?c.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:o(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:o(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(o){console.error("删除域名失败:",o)}},C=i.filter(s=>{const o=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),c=D==="all"||s.status===D;return o&&c});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(W,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("optLine truncated
@@ -1 +0,0 @@
import{k as he,m as ue,r as n,j as e,n as J,o as q,J as be,B as ge,A as ve,T as E,I as Q,S as ke}from"./index-BTQygws6.js";import{C as x,a as p}from"./card-D0oz3NII.js";import{B as g}from"./badge-BsIZhz7S.js";import{S as N,a as f,b as y,c as w,d as o}from"./select-pPlmgAjn.js";import{T as Ee,a as je,b as L,c as h,d as Pe,e as d}from"./table-Dh5trM9F.js";import{k as S}from"./index-DSkkspoy.js";import{R as Ne}from"./refresh-cw-e9vbQhCy.js";import{L as Z}from"./layers-dRuVhMxP.js";import{R as W,C as D,X as K,Y as M,T as V,B as I,a as ee}from"./generateCategoricalChart-B4pnCJMD.js";import{B as O}from"./BarChart-w5jU15cp.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const se=["#EF4444","#F59E0B","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16","#06B6D4"];function Fe(){const{clusterCode:te}=he(),H=ue(),[C,U]=n.useState(!1),[m,X]=n.useState([]),[ne,ae]=n.useState([]),[ce,re]=n.useState([]),[i,oe]=n.useState("all"),[j,le]=n.useState("all"),[T,xe]=n.useState("0"),[c,Y]=n.useState(te||""),[r,G]=n.useState(null),[u,B]=n.useState(""),[b,R]=n.useState(""),[pe,de]=n.useState(null);n.useEffect(()=>{S.getClusters().then(s=>{const t=s?.list||[];if(ae(t),!c&&t.length>0){const a=t[0].code||String(t[0].id);Y(a),H(`/kubernetes/${a}/events`,{replace:!0})}}).catch(()=>{})},[]),n.useEffect(()=>{c&&S.getNamespaces(c).then(s=>{re(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[c]);const _=n.useCallback(async()=>{if(c){U(!0);try{const s=i==="all"?void 0:i,t=j==="all"?void 0:j,a=await S.getEvents(c,s,t);X(Array.isArray(a)?a:a?.list||[])}catch{X([])}finally{U(!1)}}},[c,i,j]),A=n.useCallback(async()=>{if(c)try{const s=i==="all"?void 0:i,t=parseInt(T)||void 0,a=await S.getEventsSummary(c,s,t);G(a||null)}catch{G(null)}},[c,i,T]);n.useEffect(()=>{_()},[_]),n.useEffect(()=>{A()},[A]);const v=n.useMemo(()=>{let s=m;return u&&(s=s.filter(t=>t.reason===u)),b&&(s=s.filter(t=>(t.object||"").startsWith(b+"/"))),s},[m,u,b]),me=n.useMemo(()=>m.filter(s=>s.type==="Warning").length,[m]),ie=n.useMemo(()=>m.filter(s=>s.type==="Normal").length,[m]),k=n.useMemo(()=>(r?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[r]),z=n.useMemo(()=>(r?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[r]),$=n.useMemo(()=>(r?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[r]),F=s=>s?s.replace("T"," ").substring(0,19):"-",P=s=>{if(!s)return"";const t=Date.now()-new Date(s).getTime();if(t<0)return"";const a=Math.floor(t/6e4);if(a<1)return"刚刚";if(a<60)return`${a}分钟前`;const l=Math.floor(a/60);return l<24?`${l}小时前`:`${Math.floor(l/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:134:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:136:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:137:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),c&&e.jsxs(e.Fragment,{children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:29",className:"h-3 w-3"}),e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:65",to:`/kubernetes/${c}`,className:"hover:text-slate-300",children:c})]}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:139:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:139:45",className:"text-slate-300",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:143:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:144:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(be,{"code-path":"src/components/kubernetes/EventsPage.tsx:145:11",className:"h-5 w-5 text-yellow-400"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:147:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:148:11",value:c,onValueChange:s=>{Y(s),H(`/kubernetes/${s}/events`)},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:150:13",className:"bg-slate-800 border-slate-700",children:ne.map(s=>e.jsx(o,{"code-path":"src/components/kubernetes/EventsPage.tsx:151:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:154:11",value:i,onValueChange:s=>{oe(s),B(""),R("")},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:155:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",chLine truncated
@@ -0,0 +1 @@
import{r as s,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as W}from"./card-B1TdHH8z.js";import{g as ce,i as oe,L as q,B as de}from"./index-BZzvNKfa.js";import{S,a as C,b as T,c as _,d as x}from"./select-BFGszUub.js";import{T as xe,a as le,b as L,c as v,d as me,e as i}from"./table-CQE_AU2l.js";import{k as $}from"./index-DPhaKvWI.js";import{f as G,t as pe,R as J,X as O,l as ie}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function F({title:b,items:m,selected:p,onSelect:N,emptyText:l}){const f=Math.max(...m.map(d=>d.count),1);return e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:28:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:29:7",className:"p-4",children:[e.jsx("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:30:9",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3",children:b}),m.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:32:11",className:"text-xs text-[var(--dg-text-muted)] py-6 text-center",children:l||"暂无数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:34:11",className:"space-y-1.5 max-h-[220px] overflow-y-auto pr-1",children:m.map(d=>{const k=p===d.name;return e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:38:17",type:"button",className:`w-full flex items-center gap-2 rounded px-2 py-1.5 text-left transition-colors ${k?"bg-[var(--dg-bg-tertiary)]":"hover:bg-[var(--dg-bg-tertiary)]/60"}`,onClick:()=>N?.(k?"":d.name),children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:46:19",className:"w-[88px] shrink-0 truncate text-xs text-[var(--dg-text-secondary)]",title:d.name,children:d.name}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:49:19",className:"flex-1 h-1.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:50:21",className:`h-full rounded-full ${k?"bg-[var(--dg-accent)]":"bg-[var(--dg-text-muted)]/50"}`,style:{width:`${d.count/f*100}%`}})}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:55:19",className:"w-8 text-right text-xs tabular-nums text-[var(--dg-text-muted)]",children:d.count})]},d.name)})})]})})}function R({label:b,value:m,hint:p}){return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:68:5",className:"px-4 py-3 border-r border-[var(--dg-border)] last:border-r-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:69:7",className:"text-xs text-[var(--dg-text-muted)]",children:b}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:70:7",className:"text-xl font-semibold tabular-nums text-[var(--dg-text-primary)] mt-0.5",children:m}),p&&e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:71:16",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:p})]})}function Pe(){const{clusterCode:b}=ce(),m=oe(),[p,N]=s.useState(!1),[l,f]=s.useState([]),[d,k]=s.useState([]),[Q,Y]=s.useState([]),[u,Z]=s.useState("all"),[y,ee]=s.useState("all"),[E,te]=s.useState("0"),[r,H]=s.useState(b||""),[o,U]=s.useState(null),[g,A]=s.useState(""),[h,D]=s.useState(""),[se,ne]=s.useState(null);s.useEffect(()=>{$.getClusters().then(t=>{const a=t?.list||[];if(k(a),!r&&a.length>0){const n=a[0].code||String(a[0].id);H(n),m(`/kubernetes/${n}/events`,{replace:!0})}}).catch(()=>{})},[]),s.useEffect(()=>{r&&$.getNamespaces(r).then(t=>{Y(Array.isArray(t)?t:t?.list||t?.data||[])}).catch(()=>{})},[r]);const V=s.useCallback(async()=>{if(r){N(!0);try{const t=u==="all"?void 0:u,a=y==="all"?void 0:y,n=await $.getEvents(r,t,a);f(Array.isArray(n)?n:n?.list||[])}catch{f([])}finally{N(!1)}}},[r,u,y]),B=s.useCallback(async()=>{if(r)try{const t=u==="all"?void 0:u,a=parseInt(E)||void 0,n=await $.getEventsSummary(r,t,a);U(n||null)}catch{U(null)}},[r,u,E]);s.useEffect(()=>{V()},[V]),s.useEffect(()=>{B()},[B]);const j=s.useMemo(()=>{let t=l;const a=parseInt(E,10);if(a>0){const n=Date.now()-a*3600*1e3;t=t.filter(c=>{const P=c.last_time||c.lastTime||c.last_timestamp;return!P||new Date(P).getTime()>=n})}return g&&(t=t.filter(n=>n.reason===g)),h&&(t=t.filter(n=>(n.object||"").startsWith(`${h}/`))),t},[l,g,h,E]),ae=s.useMemo(()=>l.filter(t=>t.type==="Warning").length,[l]),re=s.useMemo(()=>l.filter(t=>t.type==="Normal").length,[l]),I=s.useMemo(()=>(o?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[o]),z=s.useMemo(()=>(o?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[o]),X=s.useMemo(()=>(o?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[o]),K=t=>t?t.replace("T"," ").substring(0,19):"-",w=t=>{if(!t)return"";const a=Date.now()-new Date(t).getTime();if(a<0)return"";const n=Math.floor(a/6e4);if(n<1)return"刚刚";if(n<60)return`${n}分钟前`;const c=Math.floor(n/60);return c<24?`${c}小时前`:`${Math.floor(c/Line truncated
@@ -0,0 +1,3 @@
import{j as a,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{B as D,o as za,D as oa,a as ra,b as na,c as da,d as ka,t as u,f as Ja,i as Qa,e as Na}from"./index-BZzvNKfa.js";import{I as X}from"./input-D7JNe8Xd.js";import{B as M}from"./badge-IN84WXM6.js";import{C as U,b as ya,c as Ga,a as H}from"./card-B1TdHH8z.js";import{S as xa,a as pa,b as ba,c as ua,d as B}from"./select-BFGszUub.js";import{L}from"./label-Bj0mNUAM.js";import{s as Wa}from"./server-CxtAvlnp.js";import{d as ga}from"./grafana-DTc3taUi.js";import{z as Xa,p as as}from"./datasource-DLQ-Yv-G.js";import{a as fa}from"./agent-BC9_VpeZ.js";import{aa as ss,A as Y,R as ca,L as aa,l as va,h as Q,aR as _a,aM as $a,W as Za,Y as Fa,k as es,a4 as ta,g as Ta,r as ja,w as ts,aC as os,j as rs,v as ns,p as ds,z as cs,an as hs,ao as ms,_ as Ia,ar as is,aG as Pa,T as ls,I as xs,aS as ps,u as Ba,D as Ma,E as Oa,P as Aa}from"./vendor-icons-DIDdqO_o.js";import{z as bs,p as Sa}from"./metrics-C3xB-WfN.js";import{S as Ea}from"./stat-strip-D5jCLXat.js";import{T as Ua,a as Ha,b as R,c as K}from"./tabs-Dx4dxq7o.js";import{C as Da}from"./checkbox-DjjvQsNy.js";import"./index-CYARH0Cq.js";function us(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function gs({panel:s}){const r=us();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(ss,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:70:11",className:"flex justify-between text-xs text-muted-foreground px-2 pt-2",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:71:13",children:r[0].time}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:72:13",children:r[r.length-1].time})]})]})}}const fs=({dsUrl:s,dsUsername:r,dsPassword:e})=>{const[c,i]=o.useState(!1),[x,b]=o.useState(!1),[g,N]=o.useState([]),[w,m]=o.useState(""),[P,y]=o.useState(""),[z,v]=o.useState("cpu_usage"),[h,A]=o.useState("desc");o.useEffect(()=>{s&&r&&e&&W(s,r,e)},[s,r,e]);const W=async(n,l,S)=>{b(!0),y("");try{const j=await bs.connect(n,l,S);N(j.hosts||[]),m(j.version||""),i(!0)}catch(j){i(!1),y(j.message||"连接失败")}finally{b(!1)}},Z=()=>{s&&r&&e&&W(s,r,e)Line truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:I,disabled:y,className:"w-full bg-blue-600 hover:bg-blue-700 text-white",children:y?a.jsxs(a.Fragment,{children:[a.jsx(aa,{"code-path":"src/components/agent/AgentWizard.tsx:352:23",className:"h-4 w-4 mr-2 animate-spin"}),"SSH 连接中,正在安装..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:357:23",className:"h-4 w-4 mr-2"}),n?"连接并安装 Agent(凭据将自动保存)":"一键安装 Agent"]})})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:363:15",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:364:17",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:365:17",children:["系统将通过 SSH 连接 ",e.ip,",执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。"]})]})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:373:11",value:"manual",className:"mt-4 space-y-4",children:[a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:374:13",className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:ha.map(d=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:376:17",className:"rounded-lg bg-slate-950 border border-slate-800 overflow-hidden",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:377:19",className:"flex items-center gap-2 px-4 py-2.5 bg-slate-800/50",children:[a.jsx(d.icon,{"code-path":"src/components/agent/AgentWizard.tsx:378:21",className:"h-4 w-4 text-blue-400"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:379:21",className:"text-sm font-medium text-slate-200",children:d.title})]}),a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:381:19",className:"p-3 space-y-1",children:d.commands.map((_,sa)=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:383:23",className:"flex items-start gap-2",children:[a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:384:25",className:"text-slate-600 font-mono text-xs select-none mt-0.5",children:"$"}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:385:25",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all flex-1",children:_})]},sa))})]},d.title))}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:394:13",className:"text-xs text-slate-500",children:"完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。"})]})]})]})})}const zs=[{id:"agent",label:"Agent 主机",icon:a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:51:43",className:"w-3.5 h-3.5"})},{id:"zabbix",label:"Zabbix",icon:a.jsx(Y,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:52:42",className:"w-3.5 h-3.5"})},{id:"prometheus",label:"Prometheus",icon:a.jsx(Y,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:53:50",className:"w-3.5 h-3.5"})},{id:"dashboard",label:"自定义",icon:a.jsx(Ia,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],ks=()=>{const s=Ja(),r=Qa(),[e,c]=o.useState([]),[i,x]=o.useState(!0),[b,g]=o.useState("cpu_usage"),[N,w]=o.useState("desc"),[m,P]=o.useState(1),[y,z]=o.useState(10),[v,h]=o.useState(new Set),[A,W]=o.useState(!1),[Z,F]=o.useState(null),[T,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,I]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),I(new Set(ea));try{await fa.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}catch{u.error("提交失败"),I(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(As(await fa.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice( Line truncated
@@ -1,3 +0,0 @@
import{i as Ya,j as a,r as o,A as J,B as D,L as aa,T as Na,S as Q,w as Qa,p as za,a2 as ka,D as oa,a as ra,b as na,c as da,d as Wa,H as xa,O as Xa,v as as,z as ss,t as u,_ as _a,f as es,m as ts,au as os,I as rs,e as va,K as $a,E as Za}from"./index-BTQygws6.js";import{I as X}from"./input-C6mE-wO9.js";import{B}from"./badge-BsIZhz7S.js";import{C as U,b as ya,c as Ga,a as H}from"./card-D0oz3NII.js";import{S as pa,a as ba,b as ua,c as ga,d as I}from"./select-pPlmgAjn.js";import{L}from"./label-8e-EC7mH.js";import{s as Ta}from"./server-C0cSEEX-.js";import{d as fa}from"./grafana-DTc3taUi.js";import{z as ns,p as ds}from"./datasource-CgE8bmC1.js";import{a as ja}from"./agent-Bb56k6oq.js";import{T as cs}from"./trending-up-CwtABPES.js";import{z as hs,p as Pa}from"./metrics-CFR1r9Ln.js";import{R as ca}from"./refresh-cw-e9vbQhCy.js";import{W as Fa}from"./wifi-lPn3W9ZW.js";import{A as Ma}from"./arrow-up-down-BEEVzjHo.js";import{A as Ia,a as Ba}from"./arrow-up-CcBQTWpn.js";import{S as Oa}from"./stat-strip-M_Ng3raR.js";import{T as Ea,a as Ua,b as R,c as K}from"./tabs-CH1b5gPd.js";import{Z as ta}from"./zap-72OjNvOL.js";import{C as ms}from"./copy-DRb4X68n.js";import{D as is}from"./download-BSvsFf63.js";import{P as ls}from"./play-BAPO-6Xq.js";import{C as Da}from"./checkbox-D73wKf04.js";import{M as xs,a as ps}from"./minimize-2-DBp9LGa2.js";import{P as Aa}from"./package-open-C0BFsc9q.js";import{T as bs}from"./trash-2-5oUve9eW.js";import{E as Ha}from"./external-link-DUvuGx7K.js";import{P as Sa}from"./plus-DOS6OUrq.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const us=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],gs=Ya("wifi-off",us);function fs(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function js({panel:s}){const r=fs();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(cs,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"codeLine truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:M,disabled:y,className:"w-full bg-blue-600 hover:bg-blue-700 text-white",children:y?a.jsxs(a.Fragment,{children:[a.jsx(aa,{"code-path":"src/components/agent/AgentWizard.tsx:352:23",className:"h-4 w-4 mr-2 animate-spin"}),"SSH 连接中,正在安装..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:357:23",className:"h-4 w-4 mr-2"}),n?"连接并安装 Agent(凭据将自动保存)":"一键安装 Agent"]})})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:363:15",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(xa,{"code-path":"src/components/agent/AgentWizard.tsx:364:17",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:365:17",children:["系统将通过 SSH 连接 ",e.ip,",执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。"]})]})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:373:11",value:"manual",className:"mt-4 space-y-4",children:[a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:374:13",className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:ha.map(d=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:376:17",className:"rounded-lg bg-slate-950 border border-slate-800 overflow-hidden",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:377:19",className:"flex items-center gap-2 px-4 py-2.5 bg-slate-800/50",children:[a.jsx(d.icon,{"code-path":"src/components/agent/AgentWizard.tsx:378:21",className:"h-4 w-4 text-blue-400"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:379:21",className:"text-sm font-medium text-slate-200",children:d.title})]}),a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:381:19",className:"p-3 space-y-1",children:d.commands.map((_,sa)=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:383:23",className:"flex items-start gap-2",children:[a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:384:25",className:"text-slate-600 font-mono text-xs select-none mt-0.5",children:"$"}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:385:25",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all flex-1",children:_})]},sa))})]},d.title))}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:394:13",className:"text-xs text-slate-500",children:"完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。"})]})]})]})})}const Ws=[{id:"agent",label:"Agent 主机",icon:a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:51:43",className:"w-3.5 h-3.5"})},{id:"zabbix",label:"Zabbix",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:52:42",className:"w-3.5 h-3.5"})},{id:"prometheus",label:"Prometheus",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:53:50",className:"w-3.5 h-3.5"})},{id:"dashboard",label:"自定义",icon:a.jsx(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],_s=()=>{const s=es(),r=ts(),[e,c]=o.useState([]),[i,x]=o.useState(!0),[b,g]=o.useState("cpu_usage"),[N,w]=o.useState("desc"),[m,P]=o.useState(1),[y,z]=o.useState(10),[v,h]=o.useState(new Set),[A,W]=o.useState(!1),[Z,T]=o.useState(null),[F,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,M]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),M(new Set(ea));try{await ja.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),M(new Set)},3e4)}catch{u.error("提交失败"),M(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(Cs(await ja.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice( Line truncated
@@ -1 +0,0 @@
import{i as St,j as t,N as st,f as qt,al as wt,r as H,B as L,Q as Kt,C as ot,D as Pt,a as Ct,b as kt,c as Dt,d as Tt,e as Lt,t as Ot,A as Ft,bc as Rt,L as zt,S as Q,_ as Gt,I as Wt,p as Ut}from"./index-BTQygws6.js";import{a as E}from"./agent-Bb56k6oq.js";import{u as ct,q as K,b as pt}from"./unwrap-Bv0ReG-f.js";import{C,a as k}from"./card-D0oz3NII.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-pPlmgAjn.js";import{c as q,T as Qt,a as Vt,b as Xt}from"./tabs-CH1b5gPd.js";import{B as V}from"./badge-BsIZhz7S.js";import{R as mt,C as gt,X as ut,Y as bt,T as jt,q as $t}from"./generateCategoricalChart-B4pnCJMD.js";import{A as vt,a as at}from"./AreaChart-qozZsHkf.js";import{R as At}from"./refresh-cw-e9vbQhCy.js";import{P as Jt}from"./plus-DOS6OUrq.js";import{C as ht}from"./circle-x-CYoA2i-_.js";import{S as Yt}from"./square-pen-DYung4SK.js";import{T as Zt}from"./trash-2-5oUve9eW.js";import{H as G}from"./hard-drive-zBn-z9Ht.js";import{D as lt}from"./disc-vNDYYr0z.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const te=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],ee=St("heart-pulse",te);const se=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_t=St("list",se);function oe(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ae(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await E.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function re(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await E.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function ce(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await E.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],Mt=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((S,F)=>S+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ie(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],S=[],F=[],o=[],B=[],X=[],W=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),B.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),W.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);S.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.bLine truncated
@@ -0,0 +1 @@
import{j as t,r as H}from"./vendor-codemirror-C7mXSpXt.js";import{f as Et,G as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,as as Kt}from"./index-BZzvNKfa.js";import{a as B}from"./agent-BC9_VpeZ.js";import{u as ct,q as K,b as pt}from"./unwrap-CDkLoNKa.js";import{C,a as k}from"./card-B1TdHH8z.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-BFGszUub.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-Dx4dxq7o.js";import{B as Q}from"./badge-IN84WXM6.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-B36pk06p.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aI as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b0 as _t,I as Jt,b1 as Yt,g as Zt,b2 as lt}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await B.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await B.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await B.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await B.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((M,F)=>M+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],E=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),E.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(E,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=nuLine truncated
@@ -0,0 +1 @@
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{i as a}from"./index-BZzvNKfa.js";import{k as i}from"./index-DPhaKvWI.js";import{L as u}from"./vendor-icons-DIDdqO_o.js";function x({target:r}){const e=a();return n.useEffect(()=>{i.getClusters().then(c=>{const t=c?.list||[];if(t.length>0){const o=t[0].code||String(t[0].id);e(`/kubernetes/${o}/${r}`,{replace:!0})}else e("/kubernetes",{replace:!0})}).catch(()=>e("/kubernetes",{replace:!0}))},[e,r]),s.jsxs("div",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:30:5",className:"flex flex-col items-center justify-center py-24 text-slate-500 gap-2",children:[s.jsx(u,{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:31:7",className:"h-6 w-6 animate-spin"}),s.jsx("span",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:32:7",className:"text-sm",children:"正在跳转..."})]})}export{x as default};
@@ -0,0 +1,10 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as T,M as ae,J as _e,v as Re,r as ce,R as Pe,s as $,w as J,N as Te,x as H,P as Ee,y as Ae,m as E,D as oe,a as le,b as Me,c as ue,d as de,e as Ie,t as I,o as Fe,a9 as Ge,aa as Oe,ab as Be,ac as Le,ad as Q,ae as F}from"./index-BZzvNKfa.js";import{C as G,b as U,c as z,d as ie,a as O}from"./card-B1TdHH8z.js";import{I as L}from"./input-D7JNe8Xd.js";import{B as y}from"./badge-IN84WXM6.js";import{k as w}from"./index-DPhaKvWI.js";import{T as Ue,a as ze,b as A,c as M}from"./tabs-Dx4dxq7o.js";import{i as xe,a as pe,aJ as $e,r as We,L as Ve,an as qe,ao as He,X as Je,R as q,P as Xe,S as Ye,aP as Ze,x as Qe,p as et,k as tt,v as st,T as rt,l as nt,y as at}from"./vendor-icons-DIDdqO_o.js";import{R as ct,A as ot,C as lt,X as ut,Y as dt,T as it,a as ee}from"./AreaChart-B36pk06p.js";import{T as te}from"./textarea-BL_Am_oZ.js";import{L as P}from"./label-Bj0mNUAM.js";import{u as xt}from"./index-CYARH0Cq.js";import{x as pt,a as mt}from"./vendor-xterm-20M9KZE1.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(ie,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ue,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(ze,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:["Service (",k.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:123:13",value:"ingresses",className:"data-[state=active]:bg-slate-700",children:["Ingress (",b.length,")"]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tLine truncated
kind: Config
clusters:
- cluster:
server: https://10.0.0.1:6443
...`,rows:10,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"}),!b&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:243:17",className:"text-xs text-[var(--dg-text-muted)]",children:"粘贴 kubeconfig 内容后将自动解析 API Server 地址"})]})]}),e.jsxs(Ie,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:250:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:251:11",variant:"outline",onClick:()=>{x(!1)},className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:"取消"}),e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:258:11",onClick:j,disabled:D,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:d?"保存中...":r?"保存":"添加"})]})]})})}function Rt({open:a,onOpenChange:x,clusterId:r,clusterName:g}){const s=n.useRef(null),u=n.useRef(null),d=n.useRef(null),K=n.useRef(null),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");return n.useEffect(()=>{a||f(!1)},[a]),n.useEffect(()=>{if(!a||!r)return;const t=new pt.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),i=new mt.FitAddon;t.loadAddon(i),u.current=t,K.current=i;const j=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,D=Fe.getState().token||"",o=`${j.replace(/^http/,"ws").replace("/api/v1","")}/ws/kubectl?token=${encodeURIComponent(D)}&id=${r}`,l=new WebSocket(o);return d.current=l,t.onData(N=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({status:0,data:N}))}),l.onmessage=N=>{try{const _=JSON.parse(N.data);_.status===0&&typeof _.data=="string"&&t.write(_.data)}catch{typeof N.data=="string"&&t.write(N.data)}},l.onopen=()=>{C(!0),p(""),s.current&&(t.open(s.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}),setTimeout(()=>{try{t.focus()}catch{}},150))},l.onclose=()=>{C(!1),t.write(`\r
\x1B[31m[连接已断开]\x1B[0m\r
`)},l.onerror=()=>{p("WebSocket 连接失败"),t.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)},()=>{try{(l.readyState===WebSocket.OPEN||l.readyState===WebSocket.CONNECTING)&&l.close(),t.dispose()}catch{}u.current=null,d.current=null,C(!1)}},[a,r]),n.useEffect(()=>{if(!a)return;const t=s.current;if(!t)return;let i;const m=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(K.current&&u.current&&d.current)try{K.current.fit(),u.current.focus();const{cols:j,rows:D}=u.current;d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({status:1,cols:j,rows:D}))}catch{}},60)});return m.observe(t),()=>{clearTimeout(i),m.disconnect()}},[a]),e.jsx(oe,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:161:5",open:a,onOpenChange:x,children:e.jsxs(le,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:162:7",showCloseButton:!1,onOpenAutoFocus:t=>t.preventDefault(),className:E("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",b?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:b?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(ue,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:174:9",className:"sr-only",children:["kubectl — ",g]}),e.jsx(de,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:175:9",className:"sr-only",children:"Kubernetes 集群命令行终端"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:178:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:179:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:180:13",className:E("w-2 h-2 rounded-full",k?"bg-emerald-400":h?"bg-red-400":"bg-yellow-400")}),e.jsx(We,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:181:13",className:"h-4 w-4 text-blue-400"}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:182:13",className:"text-[var(--dg-text-primary)] font-medium",children:["kubectl — ",g]}),!k&&!h&&e.jsx(Ve,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:183:38",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:185:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:186:13",onClick:()=>f(!b),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:b?e.jsx(qe,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:29",className:"h-4 w-4"}):e.jsx(He,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:192:13",onClick:()=>x(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Je,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:196:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:202:9",ref:s,className:"bg-[#0f172a]",style:{height:b?"calc(100vh - 49px)":"480px"}})]})})}function $t(){const[a,x]=n.useState([]),[r,g]=n.useState(!0),[s,u]=n.useState(null),[d,K]=n.useState(""),[k,C]=n.useState(!1),[b,f]=n.useState(null),[h,p]=n.useState(null),[t,i]=n.useState(!1),[m,j]=n.useState(null),[D,o]=n.useState(!1),l=async()=>{try{g(!0);const c=await w.getClusters();x(c?.list||[])}catch(c){console.error("加载集群列表失败:",c),x([])}finally{g(!1)}};n.useEffect(()=>{l()},[]);const[,N]=n.useState(null),_=()=>{l().then(()=>{b||setTimeout(async()=>{const v=(await w.getClusters())?.list||[];v.length>0&&B(v[v.length-1].id,!0)},500)})},V=async c=>{try{await w.deleteCluster(c),l()}catch(v){console.error("删除集群失败:",v)}},B=async(c,v)=>{try{v||I.info("正在同步集群资源...");const R=await w.syncCluster(c);v||I.success(R?.message||"同步完成"),l()}catch(R){v||I.error(R?.message||"同步失败")}},ye=async()=>{if(!m)return;const c=m.code||String(m.id);try{o(!0),I.info(`正在导出 ${m.name} 所有命名空间的资源...`),await w.exportAllResources(c),I.success("导出完成,已开始下载"),j(null)}catch(v){I.error(v?.message||"导出失败")}finally{o(!1)}},Y=a.filter(c=>(c.name||"").toLowerCase().includes(d.toLowerCase())||(c.version||"").includes(d)),we=c=>{switch(c){case"healthy":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:136:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(at,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:137:13",className:"h-3 w-3 mr-1"}),"健康"]});case"warning":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:143:11",variant:"outline",className:"border-amber-500/30 text-amb Line truncated
@@ -1,10 +0,0 @@
import{r as n,j as e,s as ae,B as T,aq as ce,ao as _e,ac as Re,a9 as oe,ar as Pe,ab as $,ad as X,as as Te,ae as H,aa as Ee,af as Ae,$ as E,D as le,a as ue,b as Me,c as de,d as ie,e as Ie,t as I,a2 as Fe,H as Ge,L as Oe,X as Be,aS as Le,aT as Ue,aU as ze,aV as $e,aW as Z,aX as F,P as We,z as Ve,w as qe,T as He,Q as Xe}from"./index-BTQygws6.js";import{C as G,b as U,c as z,d as xe,a as O}from"./card-D0oz3NII.js";import{I as L}from"./input-C6mE-wO9.js";import{B as y}from"./badge-BsIZhz7S.js";import{k as w}from"./index-DSkkspoy.js";import{T as Ye,a as Je,b as A,c as M}from"./tabs-CH1b5gPd.js";import{C as pe}from"./circle-x-CYoA2i-_.js";import{R as Qe,C as Ze,X as et,Y as tt,T as st}from"./generateCategoricalChart-B4pnCJMD.js";import{A as rt,a as ee}from"./AreaChart-qozZsHkf.js";import{T as te}from"./textarea-DDxE7TMs.js";import{L as P}from"./label-8e-EC7mH.js";import{u as nt}from"./index-WFeZT6kc.js";import{C as at}from"./circle-B1H3eeGO.js";import{x as ct,a as ot}from"./xterm-DSqgeKvr.js";import{M as lt,a as ut}from"./minimize-2-DBp9LGa2.js";import{R as q}from"./refresh-cw-e9vbQhCy.js";import{P as dt}from"./plus-DOS6OUrq.js";import{S as it}from"./search-BDsFve6h.js";import{E as xt}from"./ellipsis-ClGZZTS8.js";import{D as pt}from"./download-BSvsFf63.js";import{T as mt}from"./trash-2-5oUve9eW.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ye,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(Je,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:[Line truncated
kind: Config
clusters:
- cluster:
server: https://10.0.0.1:6443
...`,rows:10,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"}),!b&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:243:17",className:"text-xs text-[var(--dg-text-muted)]",children:"粘贴 kubeconfig 内容后将自动解析 API Server 地址"})]})]}),e.jsxs(Ie,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:250:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:251:11",variant:"outline",onClick:()=>{x(!1)},className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:"取消"}),e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:258:11",onClick:j,disabled:D,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:d?"保存中...":r?"保存":"添加"})]})]})})}function Rt({open:a,onOpenChange:x,clusterId:r,clusterName:g}){const s=n.useRef(null),u=n.useRef(null),d=n.useRef(null),K=n.useRef(null),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");return n.useEffect(()=>{a||f(!1)},[a]),n.useEffect(()=>{if(!a||!r)return;const t=new ct.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),i=new ot.FitAddon;t.loadAddon(i),u.current=t,K.current=i;const j=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,D=Fe.getState().token||"",o=`${j.replace(/^http/,"ws").replace("/api/v1","")}/ws/kubectl?token=${encodeURIComponent(D)}&id=${r}`,l=new WebSocket(o);return d.current=l,t.onData(N=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({status:0,data:N}))}),l.onmessage=N=>{try{const _=JSON.parse(N.data);_.status===0&&typeof _.data=="string"&&t.write(_.data)}catch{typeof N.data=="string"&&t.write(N.data)}},l.onopen=()=>{C(!0),p(""),s.current&&(t.open(s.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}),setTimeout(()=>{try{t.focus()}catch{}},150))},l.onclose=()=>{C(!1),t.write(`\r
\x1B[31m[连接已断开]\x1B[0m\r
`)},l.onerror=()=>{p("WebSocket 连接失败"),t.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)},()=>{try{(l.readyState===WebSocket.OPEN||l.readyState===WebSocket.CONNECTING)&&l.close(),t.dispose()}catch{}u.current=null,d.current=null,C(!1)}},[a,r]),n.useEffect(()=>{if(!a)return;const t=s.current;if(!t)return;let i;const m=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(K.current&&u.current&&d.current)try{K.current.fit(),u.current.focus();const{cols:j,rows:D}=u.current;d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({status:1,cols:j,rows:D}))}catch{}},60)});return m.observe(t),()=>{clearTimeout(i),m.disconnect()}},[a]),e.jsx(le,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:161:5",open:a,onOpenChange:x,children:e.jsxs(ue,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:162:7",showCloseButton:!1,onOpenAutoFocus:t=>t.preventDefault(),className:E("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",b?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:b?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:174:9",className:"sr-only",children:["kubectl — ",g]}),e.jsx(ie,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:175:9",className:"sr-only",children:"Kubernetes 集群命令行终端"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:178:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:179:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:180:13",className:E("w-2 h-2 rounded-full",k?"bg-emerald-400":h?"bg-red-400":"bg-yellow-400")}),e.jsx(Ge,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:181:13",className:"h-4 w-4 text-blue-400"}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:182:13",className:"text-[var(--dg-text-primary)] font-medium",children:["kubectl — ",g]}),!k&&!h&&e.jsx(Oe,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:183:38",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:185:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:186:13",onClick:()=>f(!b),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:b?e.jsx(lt,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:29",className:"h-4 w-4"}):e.jsx(ut,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:192:13",onClick:()=>x(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:196:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:202:9",ref:s,className:"bg-[#0f172a]",style:{height:b?"calc(100vh - 49px)":"480px"}})]})})}function Qt(){const[a,x]=n.useState([]),[r,g]=n.useState(!0),[s,u]=n.useState(null),[d,K]=n.useState(""),[k,C]=n.useState(!1),[b,f]=n.useState(null),[h,p]=n.useState(null),[t,i]=n.useState(!1),[m,j]=n.useState(null),[D,o]=n.useState(!1),l=async()=>{try{g(!0);const c=await w.getClusters();x(c?.list||[])}catch(c){console.error("加载集群列表失败:",c),x([])}finally{g(!1)}};n.useEffect(()=>{l()},[]);const[,N]=n.useState(null),_=()=>{l().then(()=>{b||setTimeout(async()=>{const v=(await w.getClusters())?.list||[];v.length>0&&B(v[v.length-1].id,!0)},500)})},V=async c=>{try{await w.deleteCluster(c),l()}catch(v){console.error("删除集群失败:",v)}},B=async(c,v)=>{try{v||I.info("正在同步集群资源...");const R=await w.syncCluster(c);v||I.success(R?.message||"同步完成"),l()}catch(R){v||I.error(R?.message||"同步失败")}},ye=async()=>{if(!m)return;const c=m.code||String(m.id);try{o(!0),I.info(`正在导出 ${m.name} 所有命名空间的资源...`),await w.exportAllResources(c),I.success("导出完成,已开始下载"),j(null)}catch(v){I.error(v?.message||"导出失败")}finally{o(!1)}},J=a.filter(c=>(c.name||"").toLowerCase().includes(d.toLowerCase())||(c.version||"").includes(d)),we=c=>{switch(c){case"healthy":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:136:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:137:13",className:"h-3 w-3 mr-1"}),"健康"]});case"warning":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:143:11",variant:"outline",className:"border-amber-500/30 text-amb Line truncated
@@ -1 +0,0 @@
import{r as t,j as e,B as F,L as w,S as I}from"./index-BTQygws6.js";import{C as A,a as P}from"./card-D0oz3NII.js";import{I as V}from"./input-C6mE-wO9.js";import{B as l}from"./badge-BsIZhz7S.js";import{S as y,a as S,b as C,c as B,d as x}from"./select-pPlmgAjn.js";import{T as H,a as U,b as u,c as o,d as W,e as n}from"./table-Dh5trM9F.js";import{k as T}from"./index-DSkkspoy.js";import{R as z}from"./refresh-cw-e9vbQhCy.js";import{S as G}from"./search-BDsFve6h.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function ne(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await T.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await T.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(B,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(F,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(G,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(V,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(B,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(A,{"code-path":"srLine truncated
@@ -0,0 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,a as I}from"./card-B1TdHH8z.js";import{B as A}from"./index-BZzvNKfa.js";import{I as P}from"./input-D7JNe8Xd.js";import{B as l}from"./badge-IN84WXM6.js";import{S as w,a as y,b as C,c as S,d as x}from"./select-BFGszUub.js";import{T as V,a as H,b as u,c as o,d as U,e as n}from"./table-CQE_AU2l.js";import{k as B}from"./index-DPhaKvWI.js";import{L as T,R as W,S as z,h as G}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function te(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await B.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await B.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(W,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(F,{"code-path":"src/components/kuberneLine truncated
@@ -0,0 +1 @@
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{C as N,a as v}from"./card-B1TdHH8z.js";import{B as h}from"./index-BZzvNKfa.js";import{I as _}from"./input-D7JNe8Xd.js";import{B as i}from"./badge-IN84WXM6.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-CQE_AU2l.js";import{l as S}from"./terminal-BOHXwzFP.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-DIDdqO_o.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.Line truncated
@@ -1 +0,0 @@
import{r as n,j as s,B as h,Z as N,G as v,_}from"./index-BTQygws6.js";import{C as y,a as C}from"./card-D0oz3NII.js";import{I as w}from"./input-C6mE-wO9.js";import{B as i}from"./badge-BsIZhz7S.js";import{T as S,a as k,b as L,c as o,d as B,e as c}from"./table-Dh5trM9F.js";import{l as I}from"./terminal-D0xu_OgS.js";import{S as A}from"./search-BDsFve6h.js";import{R}from"./refresh-cw-e9vbQhCy.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await I.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(y,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(S,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:179:21",className:"Line truncated
@@ -0,0 +1 @@
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as u,a as b}from"./card-B1TdHH8z.js";import{S as I,a as z,b as P,c as B,d as V}from"./select-BFGszUub.js";import{B as q}from"./index-BZzvNKfa.js";import{I as F}from"./input-D7JNe8Xd.js";import{m as M}from"./metrics-C3xB-WfN.js";import{S as H,af as K,u as G,A as y,P as Q,D as U,N as W,H as v,g as J}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const N={cpu:{label:"CPU",icon:e.jsx(J,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(W,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function ce(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),D=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),D()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const L=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),R=L.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),d={};k.forEach(s=>{d[s.timestamp]||(d[s.timestamp]={}),d[s.timestamp][s.metric_name]=s.value});const p=Object.keys(d).map(Number).sort((s,t)=>s-t),$=Math.max(1,...Object.values(d).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(I,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:168:15",className:"space-y-4 max-h-[60vh] overflow-y-auto",children:OLine truncated
@@ -1 +0,0 @@
import{r as l,j as e,B as I,K as z,A as y,E as P,N as B,p as F}from"./index-BTQygws6.js";import{C as u,a as b}from"./card-D0oz3NII.js";import{S as K,a as V,b as q,c as H,d as G}from"./select-pPlmgAjn.js";import{I as Q}from"./input-C6mE-wO9.js";import{m as M}from"./metrics-CFR1r9Ln.js";import{S as U}from"./search-BDsFve6h.js";import{F as W}from"./funnel-61tqn0Og.js";import{P as J}from"./plus-DOS6OUrq.js";import{H as v}from"./hard-drive-zBn-z9Ht.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const N={cpu:{label:"CPU",icon:e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function xe(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),L=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),L()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const R=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),$=R.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),p={};k.forEach(s=>{p[s.timestamp]||(p[s.timestamp]={}),p[s.timestamp][s.metric_name]=s.value});const d=Object.keys(p).map(Number).sort((s,t)=>s-t),D=Math.max(1,...Object.values(p).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(K,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(Q,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(I,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetrLine truncated
@@ -0,0 +1 @@
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as K,j as ue,B as w,a as X,b as J,c as W,d as Y,e as Z,f as Ne,t as C,m as ve}from"./index-BZzvNKfa.js";import{HostMonitor as je}from"./HostMonitor-DxZLoQLB.js";import{C as h,a as M}from"./card-B1TdHH8z.js";import{B as u}from"./badge-IN84WXM6.js";import{m as be,s as $}from"./metrics-C3xB-WfN.js";import{L as O,A as R,D as B,h as ee,aJ as Se,aK as z,H as ye,aL as te,P as se,T as ae,G as I,aM as fe,R as we,b as Pe,a as Ce,C as _e,g as Te}from"./vendor-icons-DIDdqO_o.js";import{I as y}from"./input-D7JNe8Xd.js";import{L as j}from"./label-Bj0mNUAM.js";import{S as re,a as oe,b as ce,c as de,d as A}from"./select-BFGszUub.js";import{T as ie,a as ne,b as q,c as l,d as xe,e as p}from"./table-CQE_AU2l.js";import{S as De}from"./switch-Ds1Doipu.js";import{s as L}from"./site-B4364hqV.js";import"./agent-BC9_VpeZ.js";import"./unwrap-CDkLoNKa.js";import"./tabs-Dx4dxq7o.js";import"./AreaChart-B36pk06p.js";import"./index-CYARH0Cq.js";function Fe(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function E(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function F(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function ke(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function Le(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function Ie(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await be.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Redis / MySQL 连接信息后启用采集"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:125:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:126:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:127:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:128:13",className:"h-4 w-4 text-red-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:129:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"Redis 监控"}),x&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:131:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[x.name," (",x.ip,")"]})]}),x?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:139:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,Line truncated
@@ -1 +0,0 @@
import{i as X,r as i,j as e,L as O,A as R,E as A,S as K,D as W,x as Ne,B as w,a as Y,b as Z,c as J,d as ee,e as te,f as ve,G as L,C as je,t as C,p as be,$ as Se}from"./index-BTQygws6.js";import{HostMonitor as ye}from"./HostMonitor-Bk7m0jON.js";import{C as h,a as M}from"./card-D0oz3NII.js";import{B as u}from"./badge-BsIZhz7S.js";import{m as fe,s as I}from"./metrics-CFR1r9Ln.js";import{C as we}from"./circle-B1H3eeGO.js";import{I as y}from"./input-C6mE-wO9.js";import{L as j}from"./label-8e-EC7mH.js";import{S as se,a as ae,b as re,c as oe,d as B}from"./select-pPlmgAjn.js";import{T as ce,a as de,b as $,c as l,d as ie,e as p}from"./table-Dh5trM9F.js";import{H as Pe}from"./hard-drive-zBn-z9Ht.js";import{P as ne}from"./plus-DOS6OUrq.js";import{T as xe}from"./trash-2-5oUve9eW.js";import{S as Ce}from"./switch-8l7ThrsD.js";import{s as q}from"./site-DwJsZTdz.js";import{A as _e}from"./arrow-up-down-BEEVzjHo.js";import{R as Te}from"./refresh-cw-e9vbQhCy.js";import{C as ke}from"./circle-x-CYoA2i-_.js";import{C as De}from"./circle-check-DMxKs2Ba.js";import"./agent-Bb56k6oq.js";import"./unwrap-Bv0ReG-f.js";import"./tabs-CH1b5gPd.js";import"./generateCategoricalChart-B4pnCJMD.js";import"./AreaChart-qozZsHkf.js";import"./square-pen-DYung4SK.js";import"./disc-vNDYYr0z.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Fe=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],le=X("radio",Fe);const qe=[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]],E=X("router",qe);function Le(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function U(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function D(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function Ie(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function $e(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function He(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await fe.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(A,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Line truncated
@@ -0,0 +1 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as p,a as l}from"./card-B1TdHH8z.js";import{g as Z,i as ee,L as A,B as m,D as L,j as se,a as O,b as B,c as E,e as R,t as q}from"./index-BZzvNKfa.js";import{B as H}from"./badge-IN84WXM6.js";import{I as $}from"./input-D7JNe8Xd.js";import{L as ae}from"./label-Bj0mNUAM.js";import{T as te,a as ne,b as i,c,d as ce,e as a}from"./table-CQE_AU2l.js";import{k as j}from"./index-DPhaKvWI.js";import{f as z,B as P,L as N,R as re,P as me,k as oe,A as pe,N as le,j as I,C as xe,l as Q,T as de}from"./vendor-icons-DIDdqO_o.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function fe(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await j.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await j.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){q.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await j.deleteNamespace(t,g),h(null),await x()}catch(s){q.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(me,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:144:17",className:"space-y-2",children:[e.jsx(ae,{"code-path":Line truncated
@@ -1 +0,0 @@
import{k as Z,m as ee,r as n,j as e,n as A,o as O,q as j,B as m,L as i,D as L,x as se,a as E,b as B,c as q,e as R,w as ae,A as te,N as ne,v as H,T as $,t as z}from"./index-BTQygws6.js";import{C as p,a as l}from"./card-D0oz3NII.js";import{B as I}from"./badge-BsIZhz7S.js";import{I as Q}from"./input-C6mE-wO9.js";import{L as ce}from"./label-8e-EC7mH.js";import{T as re,a as me,b as N,c,d as oe,e as a}from"./table-Dh5trM9F.js";import{k as P}from"./index-DSkkspoy.js";import{R as pe}from"./refresh-cw-e9vbQhCy.js";import{P as le}from"./plus-DOS6OUrq.js";import{C as xe}from"./circle-check-DMxKs2Ba.js";import{T as de}from"./trash-2-5oUve9eW.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function ve(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await P.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await P.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){z.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await P.deleteNamespace(t,g),h(null),await x()}catch(s){z.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(pe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(le,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:14Line truncated
@@ -1 +0,0 @@
import{k as g,r,j as s,n as l,o as i,s as h,q as b,w as N,C as f,N as u,v as w,A as k}from"./index-BTQygws6.js";import{k as n}from"./index-DSkkspoy.js";import{F as P}from"./file-text-B8e3PkIb.js";const j=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:P,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:k,desc:"水平自动伸缩策略"}];function S(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([n.getNamespaceDeployments(t,a),n.getNamespacePods(t,a),n.getNamespaceServices(t,a),n.getNamespaceIngresses(t,a),n.getNamespaceConfigMaps(t,a),n.getNamespaceSecrets(t,a),n.getHPAs(t,a),n.getCronJobs(t,a)]),c=o=>Array.isArray(o)?o:o?.list||o?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:j.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{S as default};
@@ -0,0 +1 @@
import{r,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{g,L as l}from"./index-BZzvNKfa.js";import{k as o}from"./index-DPhaKvWI.js";import{f as i,i as h,B as b,k as N,b as f,N as u,F as k,j as w,A as j}from"./vendor-icons-DIDdqO_o.js";const P=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:k,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:j,desc:"水平自动伸缩策略"}];function A(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([o.getNamespaceDeployments(t,a),o.getNamespacePods(t,a),o.getNamespaceServices(t,a),o.getNamespaceIngresses(t,a),o.getNamespaceConfigMaps(t,a),o.getNamespaceSecrets(t,a),o.getHPAs(t,a),o.getCronJobs(t,a)]),c=n=>Array.isArray(n)?n:n?.list||n?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{A as default};
@@ -0,0 +1 @@
import{r as u,j as e,R as le,y as pe,o as xe}from"./vendor-codemirror-C7mXSpXt.js";import{C as ue,a as ie}from"./card-B1TdHH8z.js";import{B as p,g as de,k as he,i as be,L as I}from"./index-BZzvNKfa.js";import{I as ge}from"./input-D7JNe8Xd.js";import{B as m}from"./badge-IN84WXM6.js";import{S as U,a as J,b as G,c as X,d as q}from"./select-BFGszUub.js";import{T as Ne,a as ke,b as i,c as je,d as Re,e as t}from"./table-CQE_AU2l.js";import{Y as Pe,P as ve,a as fe}from"./PodFileBrowser-B3WbiDk_.js";import{R as we}from"./ResourceVisualEditor-BCkBgFXv.js";import{u as Z}from"./use-toast-CkA38LVP.js";import{k as l}from"./index-DPhaKvWI.js";import{ah as B,X as Ce,L as E,j as w,B as C,b as Se,A as ye,F as Ye,N as K,k as $e,f as _,R as De,v as Q,P as Ae,S as Ie,o as N,d as M,r as _e,H as Le}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";import"./label-Bj0mNUAM.js";import"./textarea-BL_Am_oZ.js";function Be({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=Z(),[n,x]=u.useState(""),[h,k]=u.useState(!1),S=async()=>{if(!n.trim()){r({title:"请输入 YAML",variant:"destructive"});return}k(!0);try{await l.applyYAML(s,n),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(b){r({title:"导入失败",description:b.message,variant:"destructive"})}finally{k(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:40:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:11",className:"flex items-center gap-2",children:[e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:49:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Ce,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:9",className:"flex-1 overflow-auto p-4",children:e.jsx(le,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:55:11",value:n,height:"420px",theme:xe,extensions:[pe()],onChange:x,placeholder:"粘贴 YAML 内容...",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},style:{fontSize:"12px"}})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:66:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:67:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:68:11",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:h,children:[h?e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const W=["services","ingresses","configmaps","secrets","pvcs"],R=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:36:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:37:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),L={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",iLine truncated
@@ -1,3 +0,0 @@
import{r as g,E as xe,o as te,N as Q,v as T,j as e,B as i,X as he,L as A,k as be,y as ge,m as Ne,q as O,C as ne,A as le,w as de,n as se,F as M,H as ke}from"./index-BTQygws6.js";import{C as ve,a as Re}from"./card-D0oz3NII.js";import{I as P}from"./input-C6mE-wO9.js";import{B as E}from"./badge-BsIZhz7S.js";import{S as I,a as F,b as H,c as J,d as $}from"./select-pPlmgAjn.js";import{T as je,a as Pe,b as C,c as ye,d as fe,e as a}from"./table-Dh5trM9F.js";import{c as re,R as Ee,y as Ve,o as we,Y as Ce,P as Se,a as ze}from"./PodFileBrowser-BYnKz8ea.js";import{L as _}from"./label-8e-EC7mH.js";import{T as _e}from"./textarea-DDxE7TMs.js";import{u as ie}from"./use-toast-C8TQro77.js";import{k as f}from"./index-DSkkspoy.js";import{F as ce}from"./file-text-B8e3PkIb.js";import{S as W}from"./save-w9vZ9YyU.js";import{P as G}from"./plus-DOS6OUrq.js";import{T as U}from"./trash-2-5oUve9eW.js";import{R as $e}from"./refresh-cw-e9vbQhCy.js";import{D as oe}from"./download-BSvsFf63.js";import{S as Me}from"./search-BDsFve6h.js";import{P as B}from"./pencil-BgEVXj0m.js";import{H as Ye}from"./hard-drive-zBn-z9Ht.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";import"./copy-DRb4X68n.js";import"./sparkles-Bd2inR9e.js";import"./xterm-DSqgeKvr.js";import"./box-CHjdSJYg.js";import"./rotate-cw-ClBTsHWn.js";import"./minimize-2-DBp9LGa2.js";import"./arrow-left-C7utsRsB.js";import"./upload-DAFoufx2.js";import"./folder-CQ5eyfNi.js";function Te(s){try{return JSON.parse(s)}catch{}try{const t=s.split(`
`).filter(o=>!o.trim().startsWith("#"));return JSON.parse(t.join(`
`))}catch{return null}}function Ae({clusterCode:s,namespace:t,resource:o,name:d,onClose:r,onSaved:x}){const{toast:v}=ie(),[w,V]=g.useState(!0),[R,m]=g.useState(!1),[u,b]=g.useState(""),[l,h]=g.useState(null),[N,j]=g.useState("visual"),[n,k]=g.useState(""),p=g.useCallback(async()=>{V(!0);try{const S=await f.getResourceYaml(s,t,o,d),L=re(S);b(S),k(L);const ee=Te(L);h(ee),ee||(j("yaml"),v({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(S){v({title:"加载失败",description:S.message,variant:"destructive"})}finally{V(!1)}},[s,t,o,d]);g.useEffect(()=>{p()},[p]);const y=async S=>{m(!0);try{const L=q(S);await f.updateResourceYaml(s,t,o,d,L),v({title:"保存成功",description:`${o}/${d} 已更新`}),x?.(),r()}catch(L){v({title:"保存失败",description:L.message,variant:"destructive"})}finally{m(!1)}},Z=async()=>{m(!0);try{await f.updateResourceYaml(s,t,o,d,n),v({title:"YAML 已应用",description:`${o}/${d} 更新成功`}),x?.(),r()}catch(S){v({title:"保存失败",description:S.message,variant:"destructive"})}finally{m(!1)}};function q(S){return JSON.stringify(S,null,2)}const X={configmaps:{title:"ConfigMap",icon:ce,color:"text-blue-400"},secrets:{title:"Secret",icon:T,color:"text-amber-400"},services:{title:"Service",icon:Q,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:te,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:xe,color:"text-emerald-400"}},Y=X[o]||X.configmaps,D=Y.icon;return e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:114:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:r,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:115:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl",onClick:S=>S.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:117:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:118:11",className:"flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:119:13",className:`h-5 w-5 ${Y.color}`}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:120:13",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:121:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:[Y.title," 编辑器"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:122:15",className:"text-xs text-[var(--dg-text-muted)]",children:[d," · ",t," · ",s]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:125:11",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:127:13",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:128:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${N==="visual"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>l&&j("visual"),disabled:!l,children:"可视化编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:133:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${N==="yaml"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>j("yaml"),children:"YAML 编辑"})]}),e.jsx(i,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)]",onClick:r,children:e.jsx(he,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:119",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:143:9",className:"flex-1 overflow-auto p-4",children:w?e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:145:13",className:"flex items-center justify-center h-full py-20",children:e.jsx(A,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:145:76",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):N==="yaml"?e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:147:13",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:148:15",className:"text-xs text-amber-400/80",children:"⚠️ YAML 编辑模式 — 修改后点击保存。已自动清理只读字段(status/managedFields/uid)"}),e.jsx(Ee,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:149:15",value:n,height:"550px",theme:we,exten Line truncated
@@ -1 +0,0 @@
import{k as R,m as M,r as p,j as e,n as g,o as k,S,B as q,L as j,T as P,I as B,A as F,N as L,w as U}from"./index-BTQygws6.js";import{C as c,a as o}from"./card-D0oz3NII.js";import{B as l}from"./badge-BsIZhz7S.js";import{T as A,a as E,b as D,c as n,d as I,e as r}from"./table-Dh5trM9F.js";import{k as z}from"./index-DSkkspoy.js";import{R as H}from"./refresh-cw-e9vbQhCy.js";import{C as f}from"./circle-check-DMxKs2Ba.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await z.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(S,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",oLine truncated
@@ -0,0 +1 @@
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as c,a as o}from"./card-B1TdHH8z.js";import{g as R,i as M,L as g,B as q}from"./index-BZzvNKfa.js";import{B as l}from"./badge-IN84WXM6.js";import{T as B,a as L,b as k,c as n,d as S,e as r}from"./table-CQE_AU2l.js";import{k as F}from"./index-DPhaKvWI.js";import{f as j,h as U,L as P,R as A,l as D,I as E,A as I,C as f,N as z,k as H}from"./vendor-icons-DIDdqO_o.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await F.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(U,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-Line truncated
@@ -1 +0,0 @@
import{i as W,k as Ze,r as i,f as Ke,t as m,j as e,L as q,V,B as p,v as Pe,W as Ee,o as ve,C as ue,O as Xe,X as Qe,Y as es,w as ss,F as ts,H as os,S as ns,D as cs,a as ds,b as is,c as rs}from"./index-BTQygws6.js";import{C as P,a as E}from"./card-D0oz3NII.js";import{I as v}from"./input-C6mE-wO9.js";import{B as j}from"./badge-BsIZhz7S.js";import{T as as,a as ps,b as k,c as C}from"./tabs-CH1b5gPd.js";import{S as $,a as R,b as O,c as I,d as h}from"./select-pPlmgAjn.js";import{T as ls}from"./textarea-DDxE7TMs.js";import{S as G}from"./switch-8l7ThrsD.js";import{L as y}from"./label-8e-EC7mH.js";import{p as g}from"./pipeline-CgOYDc3n.js";import{d as xs}from"./config-CxWPmf4g.js";import{S as ms}from"./save-w9vZ9YyU.js";import{P as hs}from"./play-BAPO-6Xq.js";import{P as D}from"./plus-DOS6OUrq.js";import{C as ys}from"./chevron-up-Z8QjN8G2.js";import{T as S}from"./trash-2-5oUve9eW.js";import{C as Ne}from"./circle-stop-CJ1jBDRa.js";import{F as gs}from"./file-text-B8e3PkIb.js";import{U as js}from"./user-plus-CTbJ7AX7.js";import{Z as Ps}from"./zap-72OjNvOL.js";import{W as we}from"./wrench-Ds7KM83L.js";import"./index-WFeZT6kc.js";const Es=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],vs=W("flask-conical",Es);const us=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],be=W("hand",us);const Ns=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],bs=W("scroll-text",Ns);const fs=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],fe=W("webhook",fs),ws={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},ke={GitBranch:V,Wrench:we,Server:ns,FlaskConical:vs,Zap:Ps,Terminal:os,FileCode:ts,Container:ss};function ks(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Cs({task:r,selected:d,onSelect:c,onDelete:u}){const a=ke[r.icon]||we;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),u()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function Ss({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(v,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",cLine truncated
@@ -0,0 +1 @@
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as P,a as E}from"./card-B1TdHH8z.js";import{g as Qe,f as Xe,t as m,B as p,D as Ye,a as Ze,b as qe,c as es}from"./index-BZzvNKfa.js";import{I as u}from"./input-D7JNe8Xd.js";import{B as j}from"./badge-IN84WXM6.js";import{T as ss,a as ts,b as C,c as k}from"./tabs-Dx4dxq7o.js";import{S as $,a as O,b as V,c as B,d as h}from"./select-BFGszUub.js";import{T as os}from"./textarea-BL_Am_oZ.js";import{S as G}from"./switch-Ds1Doipu.js";import{L as y}from"./label-Bj0mNUAM.js";import{p as g}from"./pipeline-B15ySBmb.js";import{d as ns}from"./config-BflmzFFv.js";import{L as H,J as R,$ as cs,z as ds,j as je,P as D,Q as Pe,f as Ee,O as is,T as S,b as ue,a0 as ve,a1 as Ne,w as rs,X as as,a2 as be,F as ps,a3 as ls,V as xs,k as ms,o as hs,r as ys,a4 as gs,a5 as js,h as Ps,a6 as fe,a7 as Es}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const us={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},we={GitBranch:R,Wrench:fe,Server:Ps,FlaskConical:js,Zap:gs,Terminal:ys,FileCode:hs,Container:ms};function vs(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Ns({task:r,selected:d,onSelect:c,onDelete:v}){const a=we[r.icon]||fe;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),v()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function bs({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",children:"类型"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:11",value:r.type,onValueChange:c=>d({...r,type:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:128"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:28",value:"build",children:"构建"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:69",value:"deploy",children:"部署"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:111",value:"test",children:"测试"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:151",value:"custom",children:"自定义"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:106:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:106:36",className:"text-xs",children:"图标"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:11",value:r.icon,onValueChange:c=>d({...r,icon:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:128"})}),e.jsx(B,{"code-path":"src/components/deploy/PipLine truncated
@@ -1 +0,0 @@
import{i as Me,al as Ge,j as e,L as H,Q as ae,V as U,w as le,au as Y,av as Ee,r as o,B as v,D as Be,a as Le,b as Te,c as Fe,C as Z,t as N,m as We,N as he,S as ye,G as ue,W as Oe,o as de,f as Qe}from"./index-BTQygws6.js";import{I as f}from"./input-C6mE-wO9.js";import{p as T}from"./pipeline-CgOYDc3n.js";import{u as Je,q as Ie,b as Ke}from"./unwrap-Bv0ReG-f.js";import{u as ce}from"./useMutation-C9fIiouP.js";import{C as He,a as Ue}from"./card-D0oz3NII.js";import{B as D}from"./badge-BsIZhz7S.js";import{C as ee}from"./circle-x-CYoA2i-_.js";import{B as Xe}from"./box-CHjdSJYg.js";import{C as me}from"./circle-stop-CJ1jBDRa.js";import{F as _e}from"./file-text-B8e3PkIb.js";import{A as K}from"./arrow-right-QQqkjfZb.js";import{P as Ye}from"./play-BAPO-6Xq.js";import{H as Ze}from"./history-0zIbY_Ux.js";import{T as $e}from"./trash-2-5oUve9eW.js";import{T as ea}from"./textarea-DDxE7TMs.js";import{L as h}from"./label-8e-EC7mH.js";import{S as se,a as te,b as oe,c as re,d as L}from"./select-pPlmgAjn.js";import{d as aa}from"./config-CxWPmf4g.js";import{c as na}from"./credential-BnmvNrfT.js";import{T as sa}from"./tag-CNIwF8sk.js";import{P as xe}from"./plus-DOS6OUrq.js";import{S as ta}from"./search-BDsFve6h.js";import{L as oa}from"./layers-dRuVhMxP.js";import{C as ra}from"./code-BxEc8JAj.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const ia=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],la=Me("package",ia);const pa=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ca=Me("workflow",pa);function da(n={page:1,page_size:100}){return Je({queryKey:Ie.pipelines(n),queryFn:async()=>{const p=await T.getPipelines(n);return Ke(p)},staleTime:2e4})}function ma(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>T.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>T.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>T.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function xa(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function ga(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const ie=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:Xe,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:le,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Y,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Ee,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ha(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function ya({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const l=await T.getQueue(d);P(l?.data||l)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const l=setInterval(y,1e4);return()=>clearInterval(l)},[d]);const M=async l=>{try{await T.removeFromQueue(d,l),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2Line truncated
@@ -0,0 +1 @@
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as Ge,B as v,D as Me,a as Ee,b as Be,c as Te,t as N,i as Oe,f as Qe}from"./index-BZzvNKfa.js";import{I as f}from"./input-D7JNe8Xd.js";import{p as L}from"./pipeline-B15ySBmb.js";import{u as Ve,q as We,b as Je}from"./unwrap-CDkLoNKa.js";import{u as ce}from"./useMutation-DvUJDXfD.js";import{C as Ke,a as Ie}from"./card-B1TdHH8z.js";import{B as D}from"./badge-IN84WXM6.js";import{L as H,a as Y,y as ae,J as U,ad as He,k as ie,ar as Z,as as Le,a2 as de,F as _e,b as ee,ae as I,aT as Ue,N as he,h as ye,G as ue,z as Xe,aq as Ye,Q as Ze,f as me,T as Fe,q as ea,P as xe,S as aa,aU as na,ac as sa,aV as ta}from"./vendor-icons-DIDdqO_o.js";import{T as oa}from"./textarea-BL_Am_oZ.js";import{L as h}from"./label-Bj0mNUAM.js";import{S as se,a as te,b as oe,c as re,d as T}from"./select-BFGszUub.js";import{d as ra}from"./config-BflmzFFv.js";import{c as la}from"./credential-qfSmpSHw.js";import"./index-CYARH0Cq.js";function ia(n={page:1,page_size:100}){return Ve({queryKey:We.pipelines(n),queryFn:async()=>{const p=await L.getPipelines(n);return Je(p)},staleTime:2e4})}function pa(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>L.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>L.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>L.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function ca(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function da(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const le=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:He,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:ie,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Z,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Le,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ma(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function xa({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const i=await L.getQueue(d);P(i?.data||i)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const i=setInterval(y,1e4);return()=>clearInterval(i)},[d]);const M=async i=>{try{await L.removeFromQueue(d,i),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2,t=p?.pending_runs||[];return b&&!p||w===0&&u===0?null:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:69:5",className:"px-4 py-2 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:70:7",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:71:9",className:"text-[var(--dg-text-secondary)]",children:"构建执行状态"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:72:9",className:"font-bold text-[var(--dg-text-primary)]",children:[w,"/",R]}),u>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:74:11",className:"text-[var(--dg-text-secondary)] ml-2",children:["构建队列 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PLine truncated
@@ -0,0 +1,3 @@
import{r as n,j as e,a as me}from"./vendor-codemirror-C7mXSpXt.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-BZzvNKfa.js";import{B as A}from"./badge-IN84WXM6.js";import{C as je,b as Ne,c as ve,a as we}from"./card-B1TdHH8z.js";import{p as C}from"./pipeline-B15ySBmb.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-DIDdqO_o.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."})Line truncated
${g?"ring-1 ring-offset-0 scale-[1.02]":"hover:brightness-110"}`,style:{backgroundColor:U,borderColor:M,color:D,borderRadius:xe},children:[pe,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:393:17",children:t.label})]}),!Y&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:396:17",className:"flex items-center justify-center w-5 h-5 -mx-px z-10",children:e.jsx(ee,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:397:19",className:"h-3.5 w-3.5",style:{color:D+"99"}})})]},t.key)}),a&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:404:11",className:"ml-auto text-[10px] text-[var(--dg-text-secondary)] opacity-40 shrink-0 pl-3 whitespace-nowrap",children:i?j.find(t=>t.key===i)?.label:"全阶段"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:411:7",className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:413:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden mb-4",children:L&&c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:415:13",className:"text-center py-12",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:416:15",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-text-muted)]"}),"加载中..."]}):c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:420:13",className:"text-center py-12 border border-dashed border-[var(--dg-border)] rounded-lg m-4",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:421:15",className:"w-10 h-10 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:422:15",className:"text-[var(--dg-text-secondary)]",children:'暂无执行记录,点击"立即执行"触发构建'})]}):e.jsxs("table",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:425:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:426:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:427:17",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:428:19",className:"px-2 py-2.5 w-10",children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:429:21",type:"checkbox",checked:y.size===c.length&&c.length>0,onChange:de,className:"rounded"})}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:432:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-16",children:"构建"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:433:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-20",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:434:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:435:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"用户"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:436:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:437:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:438:19",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)] w-32",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:441:15",children:c.map(t=>{const d=He[t.status]||te;return e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:445:21",className:`border-b border-[var(--dg-border)] cursor-pointer transition-colors
${a?.id===t.id?"bg-[var(--dg-blue)]/10":"hover:bg-[var(--dg-bg-tertiary)]/50"}`,onClick:()=>{P(t)},children:[e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:449:23",className:"px-2 py-2.5",onClick:l=>l.stopPropagation(),children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:450:25",type:"checkbox",checked:y.has(t.id),onChange:()=>ie(t.id),className:"rounded"})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:453:23",className:"px-3 py-2.5 font-mono font-semibold text-[var(--dg-text-primary)]",children:["#",t.build_number]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:456:23",className:"px-3 py-2.5",children:e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:457:25",className:`text-xs ${Ge[t.status]||""} flex items-center gap-1 w-fit`,children:[e.jsx(d,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:458:27",className:`w-3 h-3 ${t.status==="running"?"animate-spin":""}`}),t.status==="success"?"成功":t.status==="failed"?"失败":t.status==="running"?"执行中":t.status==="cancelled"?"已取消":"待执行"]})}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:466:23",className:"px-3 py-2.5",children:e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:467:25",variant:"outline",className:"text-xs",children:K(t)})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:469:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] flex items-center gap-1",children:[e.jsx(Ue,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:470:25",className:"w-3 h-3"}),t.triggered_by||"admin"]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:473:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] font-mono text-xs",children:t.status==="running"?e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:475:27",className:"flex items-center gap-1 text-blue-400",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:476:29",className:"w-3 h-3 animate-spin"}),"执行中..."]}):qe(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:480:23",className:"px-3 py-2.5 text-[var(--dg-text-muted)] text-xs hidden md:table-cell",children:Xe(t.created_at)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:483:23",className:"px-3 py-2.5 text-right",onClick:l=>l.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:484:25",className:"flex justify-end gap-1",children:[e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:485:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>P(t),children:"日志"}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:489:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{oe({id:t.id,buildNumber:t.build_number}),H(!0)},children:[e.jsx(J,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:491:29",className:"w-3.5 h-3.5 mr-1"}),"浏览"]}),t.status==="running"&&e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:494:29",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>ce(t.id),children:e.jsx(Me,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:496:31",className:"w-3.5 h-3.5"})})]})})]},t.id)})})]})}),a&&e.jsxs(je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:511:11",className:"flex-1 flex flex-col min-h-0 border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsxs(Ne,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:512:13",className:"py-3 px-4 flex flex-row items-center justify-between border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:513:15",className:"flex items-center gap-3",children:[e.jsxs(ve,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:514:17",className:"text-sm font-mono",children:[o?.name||`#${s}`," #",a.build_number]}),a.status==="running"&&e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:518:19",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:519:21",className:"w-3 h-3 animate-spin mr-1"}),"实时"]}),i&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:523:19",className:"text-xs border-[var(--dg-border)]",variant:"outline",children:j.find(t=>t.key===i)?.label||i})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:528:15",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:529:17",children:["触发: ",K(a)," (",a.triggered_by||"admin",")"]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:530:17",className:"opacity-40",children:"|"}),e.jsxs("span",{"code-path Line truncated
@@ -1,3 +0,0 @@
import{r as n,j as e,D as me,a as he,$ as ue,c as ge,d as ye,X as be,at as fe,o as ee,a2 as De,k as je,t as S,B as E,V as Ne,w as ve,au as we,av as Re,L as C,a5 as Pe,C as te,U as Be,a7 as Fe}from"./index-BTQygws6.js";import{B as A}from"./badge-BsIZhz7S.js";import{C as ke,b as Se,c as Ce,a as $e}from"./card-D0oz3NII.js";import{p as $}from"./pipeline-CgOYDc3n.js";import{F as H}from"./folder-open-B72Redy5.js";import{M as ze,a as _e}from"./minimize-2-DBp9LGa2.js";import{A as Ee}from"./arrow-left-C7utsRsB.js";import{F as Ae}from"./file-text-B8e3PkIb.js";import{D as Le}from"./download-BSvsFf63.js";import{H as Z}from"./history-0zIbY_Ux.js";import{T as Te}from"./trash-2-5oUve9eW.js";import{R as Ie}from"./refresh-cw-e9vbQhCy.js";import{P as Oe}from"./play-BAPO-6Xq.js";import{B as Me}from"./box-CHjdSJYg.js";import{C as T}from"./circle-check-DMxKs2Ba.js";import{C as G}from"./circle-x-CYoA2i-_.js";import{S as Ue}from"./square-DFlNutLQ.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function He({open:s,onOpenChange:o,runId:u,buildNumber:r}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async c=>{if(u){B(!0),L("");try{const m=await $.listRunFiles(u,c||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async c=>{const m=De.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(c.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((c,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(me,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ue("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ge,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",r]}),e.jsx(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(H,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",r," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(ze,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(_e,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((c,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(c),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",childLine truncated
${g?"ring-1 ring-offset-0 scale-[1.02]":"hover:brightness-110"}`,style:{backgroundColor:M,borderColor:U,color:D,borderRadius:xe},children:[de,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:393:17",children:t.label})]}),!Y&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:396:17",className:"flex items-center justify-center w-5 h-5 -mx-px z-10",children:e.jsx(ee,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:397:19",className:"h-3.5 w-3.5",style:{color:D+"99"}})})]},t.key)}),a&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:404:11",className:"ml-auto text-[10px] text-[var(--dg-text-secondary)] opacity-40 shrink-0 pl-3 whitespace-nowrap",children:i?j.find(t=>t.key===i)?.label:"全阶段"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:411:7",className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:413:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden mb-4",children:L&&r.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:415:13",className:"text-center py-12",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:416:15",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-text-muted)]"}),"加载中..."]}):r.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:420:13",className:"text-center py-12 border border-dashed border-[var(--dg-border)] rounded-lg m-4",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:421:15",className:"w-10 h-10 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:422:15",className:"text-[var(--dg-text-secondary)]",children:'暂无执行记录,点击"立即执行"触发构建'})]}):e.jsxs("table",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:425:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:426:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:427:17",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:428:19",className:"px-2 py-2.5 w-10",children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:429:21",type:"checkbox",checked:y.size===r.length&&r.length>0,onChange:pe,className:"rounded"})}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:432:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-16",children:"构建"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:433:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-20",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:434:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:435:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"用户"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:436:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:437:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:438:19",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)] w-32",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:441:15",children:r.map(t=>{const p=Je[t.status]||te;return e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:445:21",className:`border-b border-[var(--dg-border)] cursor-pointer transition-colors
${a?.id===t.id?"bg-[var(--dg-blue)]/10":"hover:bg-[var(--dg-bg-tertiary)]/50"}`,onClick:()=>{P(t)},children:[e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:449:23",className:"px-2 py-2.5",onClick:l=>l.stopPropagation(),children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:450:25",type:"checkbox",checked:y.has(t.id),onChange:()=>ie(t.id),className:"rounded"})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:453:23",className:"px-3 py-2.5 font-mono font-semibold text-[var(--dg-text-primary)]",children:["#",t.build_number]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:456:23",className:"px-3 py-2.5",children:e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:457:25",className:`text-xs ${Ge[t.status]||""} flex items-center gap-1 w-fit`,children:[e.jsx(p,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:458:27",className:`w-3 h-3 ${t.status==="running"?"animate-spin":""}`}),t.status==="success"?"成功":t.status==="failed"?"失败":t.status==="running"?"执行中":t.status==="cancelled"?"已取消":"待执行"]})}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:466:23",className:"px-3 py-2.5",children:e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:467:25",variant:"outline",className:"text-xs",children:q(t)})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:469:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] flex items-center gap-1",children:[e.jsx(Be,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:470:25",className:"w-3 h-3"}),t.triggered_by||"admin"]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:473:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] font-mono text-xs",children:t.status==="running"?e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:475:27",className:"flex items-center gap-1 text-blue-400",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:476:29",className:"w-3 h-3 animate-spin"}),"执行中..."]}):Ve(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:480:23",className:"px-3 py-2.5 text-[var(--dg-text-muted)] text-xs hidden md:table-cell",children:Xe(t.created_at)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:483:23",className:"px-3 py-2.5 text-right",onClick:l=>l.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:484:25",className:"flex justify-end gap-1",children:[e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:485:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>P(t),children:"日志"}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:489:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{oe({id:t.id,buildNumber:t.build_number}),J(!0)},children:[e.jsx(H,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:491:29",className:"w-3.5 h-3.5 mr-1"}),"浏览"]}),t.status==="running"&&e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:494:29",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>re(t.id),children:e.jsx(Ue,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:496:31",className:"w-3.5 h-3.5"})})]})})]},t.id)})})]})}),a&&e.jsxs(ke,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:511:11",className:"flex-1 flex flex-col min-h-0 border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsxs(Se,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:512:13",className:"py-3 px-4 flex flex-row items-center justify-between border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:513:15",className:"flex items-center gap-3",children:[e.jsxs(Ce,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:514:17",className:"text-sm font-mono",children:[o?.name||`#${s}`," #",a.build_number]}),a.status==="running"&&e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:518:19",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-xs",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:519:21",className:"w-3 h-3 animate-spin mr-1"}),"实时"]}),i&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:523:19",className:"text-xs border-[var(--dg-border)]",variant:"outline",children:j.find(t=>t.key===i)?.label||i})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:528:15",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:529:17",children:["触发: ",q(a)," (",a.triggered_by||"admin",")"]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:530:17",className:"opacity-40",children:"|"}),e.jsxs("span",{"code-path Line truncated
@@ -0,0 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as k,a as L,b as E,c as I,d as T,e as B}from"./index-BZzvNKfa.js";import{I as m}from"./input-D7JNe8Xd.js";import{L as r}from"./label-Bj0mNUAM.js";import{B as j}from"./badge-IN84WXM6.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-BFGszUub.js";import{p as x}from"./platform-CzAVQ8Rt.js";import{S as K,P as U,L as O,e as V,E as W,d as Y,T as Z,C as $,a as ee}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function ie(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:174:19",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(V,{"Line truncated
@@ -1 +0,0 @@
import{r as t,j as e,B as d,L as k,g as L,D as E,a as I,b as T,c as B,d as O,e as V}from"./index-BTQygws6.js";import{I as m}from"./input-C6mE-wO9.js";import{L as r}from"./label-8e-EC7mH.js";import{B as j}from"./badge-BsIZhz7S.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-pPlmgAjn.js";import{p as x}from"./platform-2GgNsjLE.js";import{S as K}from"./search-BDsFve6h.js";import{P as U}from"./plus-DOS6OUrq.js";import{E as W}from"./external-link-DUvuGx7K.js";import{P as Y}from"./pencil-BgEVXj0m.js";import{T as Z}from"./trash-2-5oUve9eW.js";import{C as $}from"./circle-check-DMxKs2Ba.js";import{C as ee}from"./circle-x-CYoA2i-_.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function je(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(L,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex itemsLine truncated
@@ -0,0 +1,14 @@
import{r as m,y as ne,E as U,j as e,R as G,o as K}from"./vendor-codemirror-C7mXSpXt.js";import{B as v,D as oe,a as ae,m as H,c as ce,d as ie}from"./index-BZzvNKfa.js";import{u as re}from"./use-toast-CkA38LVP.js";import{k as D}from"./index-DPhaKvWI.js";import{w as J,aC as q,ay as I,L as M,$ as X,X as _,r as le,ad as de,aD as me,an as ue,ao as xe,H as he,m as pe,f as fe,ah as be,R as we,aE as ke,aF as ge,v as ve}from"./vendor-icons-DIDdqO_o.js";import{S as Z,a as Q,b as ee,c as te,d as se}from"./select-BFGszUub.js";import{x as je,a as Ne}from"./vendor-xterm-20M9KZE1.js";import{B as Pe}from"./badge-IN84WXM6.js";function W(a){if(!a)return"";const d=a.replace(/\r\n/g,`
`).split(`
`),c=[];let r=0;const k=new Set(["uid","resourceVersion","creationTimestamp","generation","selfLink","clusterName","managedFields","generateName"]),A=new Set(["managedFields","ownerReferences"]),R={dnsPolicy:["ClusterFirst"],restartPolicy:["Always"],schedulerName:["default-scheduler"],terminationGracePeriodSeconds:["30"],serviceAccountName:["default"],enableServiceLinks:["true"],progressDeadlineSeconds:["600"],revisionHistoryLimit:["10"]},F={imagePullPolicy:["Always","IfNotPresent"],terminationMessagePath:["/dev/termination-log"],terminationMessagePolicy:["File"]},$=new Set(["kubectl.kubernetes.io/last-applied-configuration","deployment.kubernetes.io/revision","kubectl.kubernetes.io/restartedAt","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions"]),x=["kube-api-access-","default-token-","kube-"];let b=!1,y=!1,E=!1,Y=!1,w=!1,T=!1,j=!1,C=!1,N=0;function p(u){return u.length-u.trimStart().length}function P(u){const s=u.trimStart().match(/^([a-zA-Z_][a-zA-Z0-9_./-]*)\s*:/);return s?s[1]:null}function V(u){const s=u.trim().split(":").slice(1).join(":").trim();return s!==""&&!/^[>|]/.test(s)}function B(u){for(r++;r<d.length;){const s=d[r],i=s.trimStart();if(i===""||i.startsWith("#")){r++;continue}if(p(s)<=u)break;r++}}function f(u){const s=P(u);return s?x.some(i=>s.startsWith(i)):!1}for(;r<d.length;){const u=d[r],s=u.trimStart(),i=p(u),o=P(u);if(s===""||s.startsWith("#")){c.push(u),r++;continue}if(i===0&&o==="status"){B(0);continue}if(i===0&&o==="metadata"){b=!0,c.push(u),r++;continue}if(i===0&&o!=="metadata"&&(b=!1,y=!1),i===0&&o==="spec"){E=!0,c.push(u),r++;continue}if(i===0&&o!=="spec"&&(E=!1,Y=!1,w=!1,T=!1,C=!1),b){if(i===2&&o==="annotations"){y=!0,c.push(u),r++;continue}if(i<=2&&o!=="annotations"&&(y=!1),i>=2&&i<=4&&s.startsWith("pod-template-hash")&&s.includes(":")){r++;continue}if(i===2&&o&&k.has(o)){V(u)?r++:B(2);continue}if(i===2&&o&&A.has(o)){B(2);continue}if(y&&i>2&&o&&$.has(o)){if(V(u))r++;else{const l=s.split(":").slice(1).join(":").trim();/^[>|]/.test(l)?B(i):r++}continue}}if(E){if(i===2&&o==="template"){c.push(u),r++;continue}if(i===2&&o&&R[o]){const h=s.split(":").slice(1).join(":").trim();if(R[o].includes(h)){r++;continue}}if(i===2&&o==="nodeName"){r++;continue}if(i===2&&o==="spec"){Y=!0,N=i,c.push(u),r++;continue}}if(Y&&i>N){if(o==="containers"){w=!0,T=!1,c.push(u),r++;continue}if(o==="initContainers"){T=!0,w=!1,c.push(u),r++;continue}if(o==="volumes"){C=!0,c.push(u),r++;continue}if(o&&R[o]){const h=s.split(":").slice(1).join(":").trim();if(R[o].includes(h)){r++;continue}}if(o==="nodeName"){r++;continue}if(o==="serviceAccount"&&s.endsWith(":")){V(u)?r++:B(i);continue}}if((w||T)&&i>=6){if(o&&F[o]){const h=s.split(":").slice(1).join(":").trim();if(F[o].includes(h)){r++;continue}}if(o==="volumeMounts"&&(j=!0),j&&s.startsWith("- name:")){let h=[u],l=r+1,t=!1;for(;l<d.length;){const n=d[l].trimStart();if(n===""||n.startsWith("#")){h.push(d[l]),l++;continue}if(p(d[l])<=i)break;Se(n)&&(t=!0),h.push(d[l]),l++}if(t){r=l;continue}j=!1}}if(C&&i>=4&&s.startsWith("- name:")&&f(s)){const h=i;for(r++;r<d.length;){const l=d[r],t=l.trimStart();if(t===""||t.startsWith("#")){r++;continue}if(p(l)<=h)break;r++}continue}if(s===""&&c.length>0&&c[c.length-1].trim()===""){r++;continue}c.push(u),r++}return c.join(`
`).replace(/\n{3,}/g,`
`).trimEnd()+`
`}function Se(a){return a.includes("mountPath:")&&(a.includes("/var/run/secrets/kubernetes.io")||a.includes("/var/run/secrets/sa"))}const O={green:"#10b981",orange:"#f59e0b",red:"#ef4444",blue:"#326CE5"};function Re(a){if(!a)return"#64748b";const d=a.toLowerCase();return["running","available","ready","active","completed","succeeded"].includes(d)?O.green:["pending","updating","progressing","containercreating"].includes(d)?O.orange:["failed","error","crashloopbackoff","imagepullbackoff","errimageneverpull"].includes(d)?O.red:O.blue}function $e(a){if(!a)return"-";const d=new Date(a);if(isNaN(d.getTime()))return a;const c=r=>String(r).padStart(2,"0");return`${d.getFullYear()}-${c(d.getMonth()+1)}-${c(d.getDate())} ${c(d.getHours())}:${c(d.getMinutes())}:${c(d.getSeconds())}`}function ze(a,d){if(!a||!d)return null;const c=new Date(a).getTime(),r=new Date(d).getTime();return isNaN(c)||isNaN(r)||r<c?null:Math.max(0,Math.round((r-c)/1e3))}function De(a){if(a==null)return"-";if(a<60)return`${a}s`;if(a<3600)return`${Math.floor(a/60)}m${a%60}s`;const d=Math.floor(a/3600),c=Math.floor(a%3600/60);return`${d}h${c}m`}function Me({clusterCode:a,namespace:d,resource:c,name:r,onClose:k,onSaved:A,cleanBeforeEdit:R=!1,autoEdit:F=!1,inline:$=!1,initialYaml:x}){const{toast:b}=re(),[y,E]=m.useState(x||""),[Y,w]=m.useState(""),[T,j]=m.useState(!x),[C,N]=m.useState(!1),[p,P]=m.useState(F),[V,B]=m.useState(!1),f=R||F,z=async()=>{if(x){E(x),w(f?W(x):x),j(!1);return}j(!0);try{const n=await D.getResourceYaml(a,d,c,r);E(n),w(f?W(n):n)}catch(n){b({title:"获取YAML失败",description:n.message,variant:"destructive"});const g=`# Error: ${n.message}`;E(g),w(g)}finally{j(!1)}},u=()=>{const n=f?W(y):y;w(n),P(!0),f&&b({title:"已清理只读字段",description:"已剥离 status / managedFields / uid 等"})},[s,i]=m.useState(!1),o=async()=>{N(!0);try{await D.updateResourceYaml(a,d,c,r,Y),b({title:"YAML已应用",description:`${c}/${r} 更新成功`}),P(!1),E(Y),A?.()}catch(n){b({title:"保存失败",description:n.message,variant:"destructive"})}finally{N(!1)}},h=async()=>{const n=p?Y:y;await navigator.clipboard.writeText(n),B(!0),setTimeout(()=>B(!1),2e3)};m.useEffect(()=>{z()},[]);const l=p?Y:f&&!s?W(y):y,t=m.useMemo(()=>[ne(),U.lineWrapping,...p?[]:[U.editable.of(!1)]],[p]);return $?e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:113:7",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:114:9",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/YamlViewer.tsx:115:11",className:"text-xs text-slate-500",children:[e.jsxs("code",{"code-path":"src/components/kubernetes/YamlViewer.tsx:116:13",className:"text-slate-400",children:[c,"/",r]})," · ",d," · ",a]}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:118:11",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:119:13",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:h,children:[V?e.jsx(J,{"code-path":"src/components/kubernetes/YamlViewer.tsx:120:25",className:"h-3 w-3 mr-1 text-emerald-400"}):e.jsx(q,{"code-path":"src/components/kubernetes/YamlViewer.tsx:120:79",className:"h-3 w-3 mr-1"}),V?"已复制":"复制"]}),f&&!p&&e.jsxs(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:124:15",variant:"outline",size:"sm",className:`h-7 text-xs ${s?"border-slate-700 text-slate-500":"border-emerald-700/50 text-emerald-400"}`,onClick:()=>i(n=>!n),title:"切换 精简/原始 视图",children:[e.jsx(I,{"code-path":"src/components/kubernetes/YamlViewer.tsx:126:17",className:"h-3 w-3 mr-1"}),s?"原始":"精简"]}),p?e.jsxs(e.Fragment,{children:[e.jsx(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:144:17",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{P(!1),z()},children:"取消"}),e.jsxs(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:147:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:o,disabled:C,children:[C?e.jsx(M,{"code-path":"src/components/kubernetes/YamlViewer.tsx:148:29",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(X,{"code-path":"src/components/kubernetes/YamlViewer.tsx:148:81",className:"h-3 w-3 mr-1"}),"保存"]})]}):e.jsxs(e.Fragment,{children:[f&&e.jsxs(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:132:19",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:u,title:"清理 status / managedFields 等只读字段后编辑",children:[e.jsx(I,{"code-path":"src/components/kubernetes/YamlViewer.tsx:133:19",className:"h-3 w-3 mr-1 text-amber-400"}),"编辑"]}),!f&&e.jsx(v,{"code-path":"src/components/kubernetes/YamlViewer.tsx:137:19",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>P(!0),children:"编辑"})]})]})]}),e.jsx("div",{"code-path":"src/components/kub Line truncated
\x1B[33m⚠ bash 不可用,请切换 /bin/sh 后重连。\x1B[0m`),Y.current=!0;return}s.write(t.includes("\x1B")?t:`\r
\x1B[31m${t}\x1B[0m\r
`)}}catch{typeof h.data=="string"&&s.write(h.data)}},o.onclose=h=>{T(l=>l==="error"?l:"closed"),Y.current||s.write(`\r
\x1B[33m[连接已关闭]\x1B[0m\r
`)},o.onerror=h=>{console.error("[PodExec:connect] WS error event fired, readyState=",o.readyState,"type=",h.type),T("error"),s.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)}},[c,r,k,N,P]);m.useEffect(()=>{if(!a)return;if(!c){console.error("[PodExec:initEffect] ABORT: clusterId is falsy:",c);return}if(!k){console.error("[PodExec:initEffect] ABORT: podName is falsy:",k);return}let s=!1,i=0;const o=performance.now(),h=()=>{if(s)return;const l=$.current;if(!l){i++,i<20?requestAnimationFrame(h):console.error("[PodExec:tryInit] FAILED: containerRef still null after 20 retries (",Math.round(performance.now()-o),"ms)");return}const t=new je.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,scrollback:5e3,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),n=new Ne.FitAddon;t.loadAddon(n),x.current=t,y.current=n,t.onData(g=>{b.current&&b.current.readyState===WebSocket.OPEN?b.current.send(JSON.stringify({status:0,data:g})):console.warn("[PodExec:term] TX dropped — WS not open, readyState=",b.current?.readyState)}),t.open(l),requestAnimationFrame(()=>{try{n.fit()}catch{}}),E.current=!0,B()};return requestAnimationFrame(h),()=>{s=!0}},[a,c,k]),m.useEffect(()=>{if(!a){try{b.current?.close()}catch{}try{x.current?.dispose()}catch{}x.current=null,b.current=null,y.current=null,E.current=!1,T("idle")}},[a]),m.useEffect(()=>{a&&x.current&&E.current&&B()},[N,P]),m.useEffect(()=>{if(!a)return;const s=$.current;if(!s)return;let i;const o=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(y.current&&x.current)try{y.current.fit(),x.current.focus();const{cols:h,rows:l}=x.current;b.current?.readyState===WebSocket.OPEN&&b.current.send(JSON.stringify({status:1,cols:h,rows:l}))}catch{}},60)});return o.observe(s),()=>{clearTimeout(i),o.disconnect()}},[a,j]);const f=w==="connected"?"bg-emerald-400":w==="error"?"bg-red-400":w==="closed"?"bg-slate-500":"bg-amber-400",z=w==="connected"?"已连接":w==="connecting"?"连接中":w==="error"?"连接错误":w==="closed"?"已断开":"空闲",u=m.useCallback(()=>{try{x.current?.focus()}catch{}},[]);return e.jsx(oe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:279:5",open:a,onOpenChange:d,children:e.jsxs(ae,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:280:7",showCloseButton:!1,className:H("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",j?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:j?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:289:9",className:"sr-only",children:["exec — ",k]}),e.jsx(ie,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:290:9",className:"sr-only",children:"进入 Pod 容器执行命令"}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:293:9",className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-[var(--dg-border)] flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:294:11",className:"flex items-center gap-2 text-sm min-w-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:295:13",className:H("w-2 h-2 rounded-full shrink-0",f),title:z}),e.jsx(le,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:296:13",className:"h-4 w-4 text-blue-400 shrink-0"}),e.jsxs("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:297:13",className:"text-[var(--dg-text-primary)] font-medium truncate",children:["exec — ",k]}),w==="connecting"&&e.jsx(M,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:298:44",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:299:13",className:"text-xs text-[var(--dg-text-muted)]",children:z})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:301:11",className:"flex items-center gap-2",children:[A.length>0&&e.jsxs(Z,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:303:15",value:N,onValueChange:p,children:[e.jsxs(Q,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:304:17",className:"h-8 w-[150px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:[e.jsx(de,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:305:19",className:"h-3 w-3 mr-1 text-[var(--dg-text-muted)]"}),e.jsx(ee,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:306:19",placeholder:"容器"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:17",children:A.map(s=>e.jsx(se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:55",value:s,children:s},s))} Line truncated
@@ -1,25 +0,0 @@
import{r as H,j as y,B as le,O as gl,L as St,X as Zs,D as Iu,a as Wu,$ as xl,c as Fu,d as Vu,H as Hu,o as zu}from"./index-BTQygws6.js";import{u as Ah}from"./use-toast-C8TQro77.js";import{k as wt}from"./index-DSkkspoy.js";import{C as bl}from"./copy-DRb4X68n.js";import{S as xs}from"./sparkles-Bd2inR9e.js";import{S as yl}from"./save-w9vZ9YyU.js";import{S as kl,a as wl,b as vl,c as Sl,d as Ol}from"./select-pPlmgAjn.js";import{x as Qu,a as $u}from"./xterm-DSqgeKvr.js";import{B as ju}from"./box-CHjdSJYg.js";import{R as qu}from"./rotate-cw-ClBTsHWn.js";import{M as Xu,a as Uu}from"./minimize-2-DBp9LGa2.js";import{B as Yu}from"./badge-BsIZhz7S.js";import{H as _u}from"./hard-drive-zBn-z9Ht.js";import{A as Ku}from"./arrow-left-C7utsRsB.js";import{U as Gu}from"./upload-DAFoufx2.js";import{R as Ju}from"./refresh-cw-e9vbQhCy.js";import{F as Zu,a as ed}from"./folder-CQ5eyfNi.js";import{D as td}from"./download-BSvsFf63.js";function Tr(){return Tr=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},Tr.apply(null,arguments)}function id(s,e){if(s==null)return{};var t={};for(var i in s)if({}.hasOwnProperty.call(s,i)){if(e.indexOf(i)!==-1)continue;t[i]=s[i]}return t}function bs(s){if(!s)return"";const e=s.replace(/\r\n/g,`
`).split(`
`),t=[];let i=0;const n=new Set(["uid","resourceVersion","creationTimestamp","generation","selfLink","clusterName","managedFields","generateName"]),r=new Set(["managedFields","ownerReferences"]),o={dnsPolicy:["ClusterFirst"],restartPolicy:["Always"],schedulerName:["default-scheduler"],terminationGracePeriodSeconds:["30"],serviceAccountName:["default"],enableServiceLinks:["true"],progressDeadlineSeconds:["600"],revisionHistoryLimit:["10"]},l={imagePullPolicy:["Always","IfNotPresent"],terminationMessagePath:["/dev/termination-log"],terminationMessagePolicy:["File"]},a=new Set(["kubectl.kubernetes.io/last-applied-configuration","deployment.kubernetes.io/revision","kubectl.kubernetes.io/restartedAt","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions"]),h=["kube-api-access-","default-token-","kube-"];let c=!1,f=!1,u=!1,d=!1,p=!1,m=!1,g=!1,x=!1,k=0;function w(N){return N.length-N.trimStart().length}function T(N){const P=N.trimStart().match(/^([a-zA-Z_][a-zA-Z0-9_./-]*)\s*:/);return P?P[1]:null}function S(N){const P=N.trim().split(":").slice(1).join(":").trim();return P!==""&&!/^[>|]/.test(P)}function A(N){for(i++;i<e.length;){const P=e[i],D=P.trimStart();if(D===""||D.startsWith("#")){i++;continue}if(w(P)<=N)break;i++}}function O(N){const P=T(N);return P?h.some(D=>P.startsWith(D)):!1}for(;i<e.length;){const N=e[i],P=N.trimStart(),D=w(N),M=T(N);if(P===""||P.startsWith("#")){t.push(N),i++;continue}if(D===0&&M==="status"){A(0);continue}if(D===0&&M==="metadata"){c=!0,t.push(N),i++;continue}if(D===0&&M!=="metadata"&&(c=!1,f=!1),D===0&&M==="spec"){u=!0,t.push(N),i++;continue}if(D===0&&M!=="spec"&&(u=!1,d=!1,p=!1,m=!1,x=!1),c){if(D===2&&M==="annotations"){f=!0,t.push(N),i++;continue}if(D<=2&&M!=="annotations"&&(f=!1),D>=2&&D<=4&&P.startsWith("pod-template-hash")&&P.includes(":")){i++;continue}if(D===2&&M&&n.has(M)){S(N)?i++:A(2);continue}if(D===2&&M&&r.has(M)){A(2);continue}if(f&&D>2&&M&&a.has(M)){if(S(N))i++;else{const R=P.split(":").slice(1).join(":").trim();/^[>|]/.test(R)?A(D):i++}continue}}if(u){if(D===2&&M==="template"){t.push(N),i++;continue}if(D===2&&M&&o[M]){const F=P.split(":").slice(1).join(":").trim();if(o[M].includes(F)){i++;continue}}if(D===2&&M==="nodeName"){i++;continue}if(D===2&&M==="spec"){d=!0,k=D,t.push(N),i++;continue}}if(d&&D>k){if(M==="containers"){p=!0,m=!1,t.push(N),i++;continue}if(M==="initContainers"){m=!0,p=!1,t.push(N),i++;continue}if(M==="volumes"){x=!0,t.push(N),i++;continue}if(M&&o[M]){const F=P.split(":").slice(1).join(":").trim();if(o[M].includes(F)){i++;continue}}if(M==="nodeName"){i++;continue}if(M==="serviceAccount"&&P.endsWith(":")){S(N)?i++:A(D);continue}}if((p||m)&&D>=6){if(M&&l[M]){const F=P.split(":").slice(1).join(":").trim();if(l[M].includes(F)){i++;continue}}if(M==="volumeMounts"&&(g=!0),g&&P.startsWith("- name:")){let F=[N],R=i+1,C=!1;for(;R<e.length;){const B=e[R].trimStart();if(B===""||B.startsWith("#")){F.push(e[R]),R++;continue}if(w(e[R])<=D)break;sd(B)&&(C=!0),F.push(e[R]),R++}if(C){i=R;continue}g=!1}}if(x&&D>=4&&P.startsWith("- name:")&&O(P)){const F=D;for(i++;i<e.length;){const R=e[i],C=R.trimStart();if(C===""||C.startsWith("#")){i++;continue}if(w(R)<=F)break;i++}continue}if(P===""&&t.length>0&&t[t.length-1].trim()===""){i++;continue}t.push(N),i++}return t.join(`
`).replace(/\n{3,}/g,`
`).trimEnd()+`
`}function sd(s){return s.includes("mountPath:")&&(s.includes("/var/run/secrets/kubernetes.io")||s.includes("/var/run/secrets/sa"))}const ys={green:"#10b981",orange:"#f59e0b",red:"#ef4444",blue:"#326CE5"};function Ey(s){if(!s)return"#64748b";const e=s.toLowerCase();return["running","available","ready","active","completed","succeeded"].includes(e)?ys.green:["pending","updating","progressing","containercreating"].includes(e)?ys.orange:["failed","error","crashloopbackoff","imagepullbackoff","errimageneverpull"].includes(e)?ys.red:ys.blue}function Ly(s){if(!s)return"-";const e=new Date(s);if(isNaN(e.getTime()))return s;const t=i=>String(i).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function Ny(s,e){if(!s||!e)return null;const t=new Date(s).getTime(),i=new Date(e).getTime();return isNaN(t)||isNaN(i)||i<t?null:Math.max(0,Math.round((i-t)/1e3))}function Iy(s){if(s==null)return"-";if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m${s%60}s`;const e=Math.floor(s/3600),t=Math.floor(s%3600/60);return`${e}h${t}m`}let Dr=[],Mh=[];(()=>{let s="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<s.length;e++)(e%2?Mh:Dr).push(t=t+s[e])})();function nd(s){if(s<768)return!1;for(let e=0,t=Dr.length;;){let i=e+t>>1;if(s<Dr[i])t=i;else if(s>=Mh[i])e=i+1;else return!0;if(e==t)return!1}}function Cl(s){return s>=127462&&s<=127487}const Al=8205;function rd(s,e,t=!0,i=!0){return(t?Ph:od)(s,e,i)}function Ph(s,e,t){if(e==s.length)return e;e&&Th(s.charCodeAt(e))&&Dh(s.charCodeAt(e-1))&&e--;let i=_n(s,e);for(e+=Ml(i);e<s.length;){let n=_n(s,e);if(i==Al||n==Al||t&&nd(n))e+=Ml(n),i=n;else if(Cl(n)){let r=0,o=e-2;for(;o>=0&&Cl(_n(s,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function od(s,e,t){for(;e>0;){let i=Ph(s,e-2,t);if(i<e)return i;e--}return 0}function _n(s,e){let t=s.charCodeAt(e);if(!Dh(t)||e+1==s.length)return t;let i=s.charCodeAt(e+1);return Th(i)?(t-55296<<10)+(i-56320)+65536:t}function Th(s){return s>=56320&&s<57344}function Dh(s){return s>=55296&&s<56320}function Ml(s){return s<65536?1:2}class Y{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=xi(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),tt.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=xi(this,e,t);let i=[];return this.decompose(e,t,i,0),tt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Wi(this),r=new Wi(e);for(let o=t,l=t;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new Wi(this,e)}iterRange(e,t=this.length){return new Rh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Y.empty:e.length<=32?new ne(e):tt.from(ne.split(e,[]))}}class ne extends Y{c Line truncated
`){[e,t]=xi(this,e,t);let n="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(n+=i),e<a&&t>r&&(n+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)i.push(r),n+=r.length+1,i.length==32&&(t.push(new ne(i,n)),i=[],n=-1);return n>-1&&t.push(new ne(i,n)),t}}class tt extends Y{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let r=0;;r++){let o=this.children[r],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=xi(this,e,t),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[n]=a,new tt(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
`){[e,t]=xi(this,e,t);let n="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(n+=i),e<a&&t>o&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tt))return 0;let i=0,[n,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==o||r==l)return i;let a=this.children[n],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ne(d,t)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof tt)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ne&&a&&(p=c[c.length-1])instanceof ne&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ne(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:tt.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new tt(l,t)}}Y.empty=new ne([""],0);function ld(s){let e=-1;for(let t of s)e+=t.length+1;return e}function js(s,e,t=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let l=s[r],a=n+l.length;a>=t&&(a>i&&(l=l.slice(0,i-n)),n<t&&(l=l.slice(t-n)),o?(e[e.length-1]+=l,o=!1):e.push(l)),n=a+1}return e}function Pl(s,e,t){return js(s,[""],e,t)}class Wi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ne?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof ne?n.text.length:n.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(n instanceof ne){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ne?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Rh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Wi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Bh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Y.prototype[Symbol.iterator]=function(){return this.iter()},Wi.prototype[Symbol.iterator]=Rh.prototype[Symbol.iterator]=Bh.prototype[Symbol.iterator]=function(){return this});class ad{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}}function xi(s,e,t){return e=Math.max(0,Math.min(s.length,e)),[e,Math.max(e,Math.min(s.length,t))]}function fe(s,e,t=!0,i=!0){return rd(s,e,t,i)}function hd(s){return s>=56320&&s<57344}function cd(s){return s>=55296&&s<56320}function Ce(s,e){let t=s.charCodeAt(e);if(!cd(t)||e+1==s.length)return t;let i=s.charCodeAt(e+1);return hd(i)?(t-55296<<10)+(i-56320)+65536:t}function Ro(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function it(s){return s<65536?1:2}const Rr=/\r\n?|\n/;var Se=(function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s})(Se||(Se={}));class lt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,n,r),n+=r):n+=o,i+=r}}iterChangedRanges(e,t=!1){Br(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new lt(e)}composeDesc(e){return this.empty?e:e.empty?this:Eh(this,e)}mapDesc(e,t=!1){return e.empty?this:Er(this,e,t)}mapPos(e,t=-1,i=Se.Simple){let n=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>e)return r+(e-n);r+=l}else{if(i!=Se.Simple&&h>=e&&(i==Se.TrackDel&&n<e&&h>e||i==Se.TrackBefore&&n<e||i==Se.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?r:r+a;r+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return r}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let r=this.sections[i++],o=this.sections[i++],l=n+r;if(o>=0&&n<=t&&l>=e)return n<e&&l>t?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new lt(e)}static create(e){return new lt(e)}}class ae extends lt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Br(this,(t,i,n,r,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return Er(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,r=0;n<t.length;n+=2){let o=t[n],l=t[n+1];if(l>=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(Y.empty);i.push(o?e.slice(r,r+o):Y.empty)}r+=o}return new ae(t,i)}compose(e){return this.empty?e:e.empty?this:Eh(this,e,!0)}map(e,t=!1){return e.empty?this:Er(this,e,t,!0)}iterChanges(e,t=!1){Br(this,e,t)}get desc(){return lt.cr Line truncated
`}get readOnly(){return this.facet(zh)}phrase(e,...t){for(let i of this.facet(U.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let r of this.facet(Ih))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return wd(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=fe(t,o,!1);if(r(t.slice(a,o))!=ee.Word)break;o=a}for(;l<n;){let a=fe(t,l);if(r(t.slice(l,a))!=ee.Word)break;l=a}return o==l?null:v.range(o+i,l+i)}}U.allowMultipleSelections=Ir;U.tabSize=I.define({combine:s=>s.length?s[0]:4});U.lineSeparator=Wh;U.readOnly=zh;U.phrases=I.define({compare(s,e){let t=Object.keys(s),i=Object.keys(e);return t.length==i.length&&t.every(n=>s[n]==e[n])}});U.languageData=Ih;U.changeFilter=Fh;U.transactionFilter=Vh;U.transactionExtender=Hh;Dn.reconfigure=$.define();function ht(s,e,t={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let n in e)i[n]===void 0&&(i[n]=e[n]);return i}class Mt{eq(e){return this==e}range(e,t=e){return Vr.create(e,t,this)}}Mt.prototype.startSide=Mt.prototype.endSide=0;Mt.prototype.point=!1;Mt.prototype.mapMode=Se.TrackDel;function Lo(s,e){return s==e||s.constructor==e.constructor&&s.eq(e)}let Vr=class jh{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new jh(e,t,i)}};function Hr(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}class No{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,n){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(n(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let i=[],n=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+e,f=this.to[a]+e,u,d;if(c==f){let p=t.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=t.mapPos(c,h.endSide),d<u)))continue}else if(u=t.mapPos(c,h.startSide),d=t.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),n.push(u-o),r.push(d-o))}return{mapped:i.length?new No(n,r,i,l):null,pos:o}}}class X{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new X(e,t,i,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Hr)),this.isEmpty)return t.length?X.of(t):this;let l=new qh(this,null,-1).goto(0),a=0,h=[],c=new mt;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||n>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||n>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(Vr.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?X.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],n=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)n=Math.max(n,a.maxPoint),t.push(a),i.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(n=Math.max(n,c.maxPoint),t.push(c),i.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new X(i,t,r||X.empty,n)}between(e,t,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let r=this.chunkPos[n],o=this.chunk[n];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Ui.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ui.from(e).goto(t)}static compare(e,t,i,n,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t Line truncated
`)}static newName(){let e=Ll[El]||1;return Ll[El]=e+1,$r+e.toString(36)}static mount(e,t,i){let n=e[jr],r=i&&i.nonce;n?r&&n.setNonce(r):n=new Sd(e,r),n.mount(Array.isArray(t)?t:[t],e)}}let Nl=new Map;class Sd{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let r=Nl.get(i);if(r)return e[jr]=r;this.sheet=new n.CSSStyleSheet,Nl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[jr]=this}mount(e,t){let i=this.sheet,n=0,r=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<r&&a>-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h<l.rules.length;h++)i.insertRule(l.rules[h],n++)}else{for(;r<a;)n+=this.modules[r++].rules.length;n+=l.rules.length,r++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Tt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Od=typeof navigator<"u"&&/Mac/.test(navigator.platform),Cd=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var me=0;me<10;me++)Tt[48+me]=Tt[96+me]=String(me);for(var me=1;me<=24;me++)Tt[me+111]="F"+me;for(var me=65;me<=90;me++)Tt[me]=String.fromCharCode(me+32),Yi[me]=String.fromCharCode(me);for(var Gn in Tt)Yi.hasOwnProperty(Gn)||(Yi[Gn]=Tt[Gn]);function Ad(s){var e=Od&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||Cd&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",t=!e&&s.key||(s.shiftKey?Yi:Tt)[s.keyCode]||s.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function _(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}e++}for(;e<arguments.length;e++)Xh(s,arguments[e]);return s}function Xh(s,e){if(typeof e=="string")s.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)s.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Xh(s,e[t]);else throw new RangeError("Unsupported child node: "+e)}let ve=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},qr=typeof document<"u"?document:{documentElement:{style:{}}};const Xr=/Edge\/(\d+)/.exec(ve.userAgent),Uh=/MSIE \d/.test(ve.userAgent),Ur=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ve.userAgent),Rn=!!(Uh||Ur||Xr),Il=!Rn&&/gecko\/(\d+)/i.test(ve.userAgent),Jn=!Rn&&/Chrome\/(\d+)/.exec(ve.userAgent),Wl="webkitFontSmoothing"in qr.documentElement.style,Yr=!Rn&&/Apple Computer/.test(ve.vendor),Fl=Yr&&(/Mobile\/\w+/.test(ve.userAgent)||ve.maxTouchPoints>2);var W={mac:Fl||/Mac/.test(ve.platform),windows:/Win/.test(ve.platform),linux:/Linux|X11/.test(ve.platform),ie:Rn,ie_version:Uh?qr.documentMode||6:Ur?+Ur[1]:Xr?+Xr[1]:0,gecko:Il,gecko_version:Il?+(/Firefox\/(\d+)/.exec(ve.userAgent)||[0,0])[1]:0,chrome:!!Jn,chrome_version:Jn?+Jn[1]:0,ios:Fl,android:/Android\b/.test(ve.userAgent),webkit:Wl,webkit_version:Wl?+(/\bAppleWebKit\/(\d+)/.exec(ve.userAgent)||[0,0])[1]:0,safari:Yr,safari_version:Yr?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ve.userAgent)||[0,0])[1]:0,tabSize:qr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Io(s,e){for(let t in s)t=="class"&&e.class?e.class+=" "+s.class:t=="style"&&e.style?e.style+=";"+s.style:e[t]=s[t];return e}const sn=Object.create(null);function Wo(s,e,t){if(s==e)return!0;s||(s=sn),e||(e=sn);let i=Object.keys(s),n=Object.keys(e);if(i.length-0!=n.length-0)return!1;for(let r of i)if(r!=t&&(n.indexOf(r)==-1||s[r]!==e[r]))return!1;return!0}function Md(s,e){for(let t=s.attributes.length-1;t>=0;t--){let i=s.attributes[t].name;e[i]==null&&s.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?s.style.cssText=i:s.getAttribute(t)!=i&&s.setAttribute(t,i)}}function Vl(s,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?s.style.cssText=t[n]:s.setAttribute(n,t[n]));return i}function Pd(s){let e=Object.create(null);for(let t=0;t<s.attributes.length;t++){let i=s.attributes[t];e[i.name]=i.value}return e}class ct{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ge=(function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s})(ge||(ge={}));class z extends Mt{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return nLine truncated
`,n=s.state.doc.line(n.number+(t?1:-1)),r=s.bidiSpans(n),h=s.visualLineSide(n,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function mp(s,e,t){let i=s.state.charCategorizer(e),n=i(t);return r=>{let o=i(r);return n==ee.Space&&(n=o),n==o}}function gp(s,e,t,i){let n=e.head,r=t?1:-1;if(n==(t?s.state.doc.length:0))return v.cursor(n,e.assoc);let o=e.goalColumn,l,a=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),c=s.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,s.defaultCharacterWidth*(n-p.from))),l=(r<0?p.top:p.bottom)+c}let f=a.left+o,u=s.viewState.heightOracle.textHeight>>1,d=i??u;for(let p=0;;p+=u){let m=l+(d+p)*r,g=io(s,{x:f,y:m},!1,r);if(t?m>a.bottom:m<a.top)return v.cursor(g.pos,g.assoc);let x=s.coordsAtPos(g.pos,g.assoc),k=x?(x.top+x.bottom)/2:0;if(!x||(t?k>l:k<l))return v.cursor(g.pos,g.assoc,void 0,o)}}function Qi(s,e,t){for(;;){let i=0;for(let n of s)n.between(e-1,e+1,(r,o,l)=>{if(e>r&&e<o){let a=i||t||(e-r<o-e?-1:1);e=a<0?r:o,i=a}});if(!i)return e}}function vc(s,e){let t=null;for(let i=0;i<e.ranges.length;i++){let n=e.ranges[i],r=null;if(n.empty){let o=Qi(s,n.from,0);o!=n.from&&(r=v.cursor(o,-1))}else{let o=Qi(s,n.from,-1),l=Qi(s,n.to,1);(o!=n.from||l!=n.to)&&(r=v.range(n.from==n.anchor?o:l,n.from==n.head?o:l))}r&&(t||(t=e.ranges.slice()),t[i]=r)}return t?v.create(t,e.mainIndex):e}function sr(s,e,t){let i=Qi(s.state.facet(fs).map(n=>n(s)),t.from,e.head>t.from?-1:1);return i==t.from?t:v.cursor(i,i<t.from?1:-1)}class st{constructor(e,t){this.pos=e,this.assoc=t}}function io(s,e,t,i){let n=s.contentDOM.getBoundingClientRect(),r=n.top+s.viewState.paddingTop,{x:o,y:l}=e,a=l-r,h;for(;;){if(a<0)return new st(0,1);if(a>s.viewState.docHeight)return new st(s.state.doc.length,-1);if(h=s.elementAtHeight(a),i==null)break;if(h.type==ge.Text){if(i<0?h.to<s.viewport.from:h.from>s.viewport.to)break;let u=s.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let f=s.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(s.viewport.from>=h.to||s.viewport.to<=h.from){if(t)return null;if(h.type==ge.Text){let f=dp(s,n,h,o,l);return new st(f,f==h.from?1:-1)}}if(h.type!=ge.Text)return a<(h.top+h.bottom)/2?new st(h.from,1):new st(h.to,-1);let c=s.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=s.docView.lineAt(h.from,-2)),new xp(s,o,l,s.textDirectionAt(h.from)).scanTile(c,h.from)}class xp{constructor(e,t,i,n){this.view=e,this.x=t,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[nt.find(n,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[nt.find(n,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:n}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<t)}scan(e,t,i=!1){let n=0,r=e.length-1,o=new Set,l=this.bidiIn(e[0],e[r]),a,h,c=-1,f=1e9,u;e:for(;n<r;){let p=r-n,m=n+r>>1;t:if(o.has(m)){let x=n+Math.floor(Math.random()*p);for(let k=0;k<p;k++){if(!o.has(x)){m=x;break t}x++,x==r&&(x=n)}break e}o.add(m);let g=t(m);if(g)for(let x=0;x<g.length;x++){let k=g[x],w=0;if(!(k.width==0&&g.length>1)){if(k.bottom<this.y)(!a||a.bottom<k.bottom)&&(a=k),w=1;else if(k.top>this.y)(!h||h.top>k.top)&&(h=k),w=-1;else{let T=k.left>this.x?this.x-k.left:k.right<this.x?this.x-k.right:0,S=Math.abs(T);S<f&&(c=m,f=S,u=k),T&&(w=T<0==(this.baseDir==J.LTR)?-1:1)}w==-1&&(!l||this.baseDirAt(e[m],1))?r=m:w==1&&(!l||this.baseDirAt(e[m+1],-1))&&(n=m+1)}}}if(!u){if(!h&&!a)return{i:e[0],after:!1};let p=a&&(!h||this.y-a.bottom<h.top-this.y)?a:h;return this.y=(p.top+p.bottom)/2,this.scan(e,t,!0)}if(f&&!i){let{top:p,bottom:m}=u;if(a&&a.bottom>(p+p+m)/3)return this.y=a.bottom-1,this.scan(e,t,!0);if(h&&h.top<(p+m+m)/3)return this.y=h.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[c],1):this.baseDir)==J.LTR;return{i:c,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let i=[];for(let r=0;r<e.length;r=fe(e.text,r))i.push(t+r);i.push(t+e.length);let n=this.scan(i,r=>{let o=i[r]-t,l=i[r+1]-t;return Ji(e.dom,o,l).getClientRects()});return n.after?new st(i[n.i+1],-1):new st(i[n.i],1)}scanTile(e,t){if(!e.length)return new st(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l<e.children.length;l++)i.push(a+=e.children[l].length);let n=this.scan(i,l=>{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Ji(a.dom,0,a.length)).getClientRects()}),r=e.children[n.i],o=i[n.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):n.after?new st(i[n.i+1],-1):new st(o,1)}}const ii="￿";class bp{constructor(e,t){this.points=e,this.vi Line truncated
`&&s.lineWrapping&&(i&&(i=v.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:Y.of([" "])}),t)return jo(s,t,i,o);if(i&&!an(i,r)){let l=!1,a="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(l=!0),a=s.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=vc(n.facet(fs).map(h=>h(s)),i))),s.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function jo(s,e,t,i=-1){if(W.ios&&s.inputState.flushIOSKey(e))return!0;let n=s.state.selection.main;if(W.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&s.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ui(s.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&ui(s.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&ui(s.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let o,l=()=>o||(o=vp(s,e,t));return s.state.facet(cc).some(a=>a(s,e.from,e.to,r,l))||s.dispatch(l()),!0}function vp(s,e,t){let i,n=s.state,r=n.selection.main,o=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let a=e.from<r.from?-1:1,h=a<0?r.from:r.to,c=Qi(n.facet(fs).map(f=>f(s)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:v.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&s.inputState.composing<0){let a=r.from<e.from?n.sliceDoc(r.from,e.from):"",h=r.to>e.to?n.sliceDoc(e.to,r.to):"";i=n.replaceSelection(s.state.toText(a+e.insert.sliceString(0,void 0,s.state.lineBreak)+h))}else{let a=n.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(s.inputState.composing>=0||s.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=s.state.sliceDoc(e.from,e.to),f,u=t&&wc(s,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=s.state.doc.lineAt(r.head);let d=r.to-e.to;i=n.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(s.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let x=n.changes({from:g,to:m,insert:e.insert}),k=p.to-r.to;return{changes:x,range:h?v.range(Math.max(0,h.anchor+k),Math.max(0,h.head+k)):p.map(x)}})}else i={changes:a,selection:h&&n.selection.replaceRange(h)}}let l="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,l+=".compose",s.inputState.compositionFirstChange&&(l+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:l,scrollIntoView:!0})}function Cc(s,e,t,i){let n=Math.min(s.length,e.length),r=0;for(;r<n&&s.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==n&&s.length==e.length)return null;let o=s.length,l=e.length;for(;o>0&&l>0&&s.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o<r&&s.length<e.length){let a=t<=r&&t>=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l<r){let a=t<=r&&t>=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Sp(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return t&&(e.push(new Ul(t,i)),(n!=t||r!=i)&&e.push(new Ul(n,r))),e}function Op(s,e){if(s.length==0)return null;let t=s[0].pos,i=s.length==2?s[1].pos:t;return t>-1&&i>-1?v.single(t+e,i+e):null}function an(s,e){return e.head==s.main.head&&e.anchor==s.main.anchor}class Cp{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&Hp(e.contentDOM.ownerDocument)}handleEvent(e){!Ep(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Ap(e),i=this.handlers,n=this.view.contentDOM; Line truncated
`))};if((W.mac||W.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:Y.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);jo(e,f,v.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);r=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||r||new DOMRect,n.push(r)}t.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;n.push(z.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:mc.of(z.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let n=Ki(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(n&&o>=n.to)if(n.from==r&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,t+=c,this.to+=c;return}else n=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class L{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureReque Line truncated
--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,ao),Om={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let or=null;function Cm(){var s;if(or==null&&typeof document<"u"&&document.body){let e=document.body.style;or=((s=e.tabSize)!==null&&s!==void 0?s:e.MozTabSize)!=null}return or||!1}const Ys=I.define({combine(s){let e=ht(s,{render:null,specialChars:Sm,addSpecialChars:null});return(e.replaceTabs=!Cm())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ao)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ao)),e}});function Am(s={}){return[Ys.of(s),Mm()]}let ma=null;function Mm(){return ma||(ma=se.fromClass(class{constructor(s){this.view=s,this.decorations=z.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(Ys)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new vm({regexp:s.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,r=Ce(e[0],0);if(r==9){let o=n.lineAt(i),l=t.state.tabSize,a=Ci(o.text,l,i-o.from);return z.replace({widget:new Rm((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=z.replace({widget:new Dm(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let e=s.state.facet(Ys);s.startState.facet(Ys)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const Pm="•";function Tm(s){return s>=32?Pm:s==10?"␤":String.fromCharCode(9216+s)}class Dm extends ct{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Tm(this.code),i=e.state.phrase("Control character")+" "+(Om[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Rm extends ct{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Bm(){return Lm}const Em=z.line({class:"cm-activeLine"}),Lm=se.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=-1,t=[];for(let i of s.state.selection.ranges){let n=s.lineBlockAt(i.head);n.from>e&&(t.push(Em.range(n.from)),e=n.from)}return z.set(t)}},{decorations:s=>s.decorations});class Nm extends ct{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Hi(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=Gi(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}}function Im(s){let e=se.fromClass(class{constructor(t){this.view=t,this.placeholder=s?z.set([z.widget({widget:new Nm(s),side:1}).range(0)]):z.none}get decorations(){return this.view.state.doc.length?z.none:this.placeholder}},{decorations:t=>t.decorations});return typeof s=="string"?[e,L.contentAttributes.of({"aria-placeholder":s})]:e}const ho=2e3;function Wm(s,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),r=[];if(e.off>ho||t.off>ho||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=n;a++){let h=s.doc.line(a);h.length<=l&&r.push(v.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=n;a++){let h=s.doc.line(a),c=Qr(h.text,o,s.tabSize,!0);if(c<0)r.push(v.cursor(h.to));else{let f=Qr(h.text,l,s.tabSize);r.push(v.range(h.from+c,h.from+f))}}}return r}function Fm(s,e){let t=s.coordsAtPos(s.viewport.from);return t?Math.round(Math.abs((t.left-e)/s.defaultCharacterWidth)):-1}function ga(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1),i=s.state.doc.lineAt(t),n=t-i.from,r=n>ho?-1:n==i.length?Fm(s,e.clientX):Ci(i.text,s.state.tabSize,t-i.from);return{line:i.number,col:r,off:n}}function Vm(s,e){let t=ga(s,e),i=s.s Line truncated
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Jx(this):new _x(this)}getCursor(e,t=0,i){let n=e.doc?e:U.create({doc:e});return i==null&&(i=n.doc.length),this.regexp?ni(this,n,t,i):si(this,n,t,i)}}class lu{constructor(e){this.spec=e}}function Ux(s,e,t){return(i,n,r,o)=>{if(t&&!t(i,n,r,o))return!1;let l=i>=o&&n<=o+r.length?r.slice(i-o,n-o):e.doc.sliceString(i,n);return s(l,e,i,n)}}function si(s,e,t,i){let n;return s.wholeWord&&(n=Yx(e.doc,e.charCategorizer(e.selection.main.head))),s.test&&(n=Ux(s.test,e,n)),new Si(e.doc,s.unquoted,t,i,s.caseSensitive?void 0:r=>r.toLowerCase(),n)}function Yx(s,e){return(t,i,n,r)=>((r>t||r+n.length<i)&&(r=Math.max(0,t-2),n=s.sliceString(r,Math.min(s.length,i+2))),(e(kn(n,t-r))!=ee.Word||e(wn(n,t-r))!=ee.Word)&&(e(wn(n,i-r))!=ee.Word||e(kn(n,i-r))!=ee.Word))}class _x extends lu{constructor(e){super(e)}nextMatch(e,t,i){let n=si(this.spec,e,i,e.doc.length).nextOverlapping();if(n.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);n=si(this.spec,e,0,r).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==i?null:n.value}prevMatchInRange(e,t,i){for(let n=i;;){let r=Math.max(t,n-1e4-this.spec.unquoted.length),o=si(this.spec,e,r,n),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;n-=1e4}}prevMatch(e,t,i){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=i)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=si(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let r=si(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}function Kx(s,e,t){return(i,n,r)=>(!t||t(i,n,r))&&s(r[0],e,i,n)}function ni(s,e,t,i){let n;return s.wholeWord&&(n=Gx(e.charCategorizer(e.selection.main.head))),s.test&&(n=Kx(s.test,e,n)),new nu(e.doc,s.search,{ignoreCase:!s.caseSensitive,test:n},t,i)}function kn(s,e){return s.slice(fe(s,e,!1),e)}function wn(s,e){return s.slice(e,fe(s,e))}function Gx(s){return(e,t,i)=>!i[0].length||(s(kn(i.input,i.index))!=ee.Word||s(wn(i.input,i.index))!=ee.Word)&&(s(wn(i.input,i.index+i[0].length))!=ee.Word||s(kn(i.input,i.index+i[0].length))!=ee.Word)}class Jx extends lu{nextMatch(e,t,i){let n=ni(this.spec,e,i,e.doc.length).next();return n.done&&(n=ni(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let r=Math.max(t,i-n*1e4),o=ni(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let n=i.length;n>0;n--){let r=+i.slice(0,n);if(r>0&&r<e.match.length)return e.match[r]+i.slice(n)}return t})}matchAll(e,t){let i=ni(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let r=ni(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const ss=$.define(),ol=$.define(),At=ye.define({create(s){return new kr(So(s).create(),null)},update(s,e){for(let t of e.effects)t.is(ss)?s=new kr(t.value.create(),s.panel):t.is(ol)&&(s=new kr(s.query,t.value?ll:null));return s},provide:s=>Zi.from(s,e=>e.panel)});class kr{constructor(e,t){this.query=e,this.panel=t}}const Zx=z.mark({class:"cm-searchMatch"}),eb=z.mark({class:"cm-searchMatch cm-searchMatch-selected"}),tb=se.fromClass(class{constructor(s){this.view=s,this.decorations=this.highlight(s.state.field(At))}update(s){let e=s.state.field(At);(e!=s.startState.field(At)||s.docChanged||s.selectionSet||s.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:s,panel:e}){if(!e||!s.spec.valid)return z.none;let{view:t}=this,i=new mt;for(let n=0,r=t.visibleRanges,o=r.length;n<o;n++){let{from:l,to:a}=r[n];for(;n<o-1&&a>r[n+1].from-500;)a=r[++n].to;s.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?eb:Zx)})}return i.finish()}},{decorations:s=>s.decorations});function ms(s){return e=>{let t=e.state.field(At,!1);return t&&t.query.spec.valid?s(e,t):cu(e)}}const vn=ms((s,{query:e})=>{let{to:t}=s.state.selection.main,i=e.nextMatch(s.state,t,t);if(!i)return!1;let n=v.single(i.from,i.to),r=s.state.facet(Mi);return s.dispatch({selection:n,effects:[al(s,i),r.scrollToMatch(n.main,s)],userEvent:"select.search"}),hu(s),!0}),Sn=ms((s,{query:e})=>{let{state:t}=s,{from:i}=t.selection.main,n=e.prevMatch(t,i,i);if(!n)return Line truncated
\x1B[33m⚠ bash 不可用,请切换 /bin/sh 后重连。\x1B[0m`),d.current=!0;return}P.write(C.includes("\x1B")?C:`\r
\x1B[31m${C}\x1B[0m\r
`)}}catch{typeof F.data=="string"&&P.write(F.data)}},M.onclose=F=>{m(R=>R==="error"?R:"closed"),d.current||P.write(`\r
\x1B[33m[连接已关闭]\x1B[0m\r
`)},M.onerror=F=>{console.error("[PodExec:connect] WS error event fired, readyState=",M.readyState,"type=",F.type),m("error"),P.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)}},[t,i,n,k,T]);H.useEffect(()=>{if(!s)return;if(!t){console.error("[PodExec:initEffect] ABORT: clusterId is falsy:",t);return}if(!n){console.error("[PodExec:initEffect] ABORT: podName is falsy:",n);return}let P=!1,D=0;const M=performance.now(),F=()=>{if(P)return;const R=a.current;if(!R){D++,D<20?requestAnimationFrame(F):console.error("[PodExec:tryInit] FAILED: containerRef still null after 20 retries (",Math.round(performance.now()-M),"ms)");return}const C=new Qu.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,scrollback:5e3,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),B=new $u.FitAddon;C.loadAddon(B),h.current=C,f.current=B,C.onData(j=>{c.current&&c.current.readyState===WebSocket.OPEN?c.current.send(JSON.stringify({status:0,data:j})):console.warn("[PodExec:term] TX dropped — WS not open, readyState=",c.current?.readyState)}),C.open(R),requestAnimationFrame(()=>{try{B.fit()}catch{}}),u.current=!0,A()};return requestAnimationFrame(F),()=>{P=!0}},[s,t,n]),H.useEffect(()=>{if(!s){try{c.current?.close()}catch{}try{h.current?.dispose()}catch{}h.current=null,c.current=null,f.current=null,u.current=!1,m("idle")}},[s]),H.useEffect(()=>{s&&h.current&&u.current&&A()},[k,T]),H.useEffect(()=>{if(!s)return;const P=a.current;if(!P)return;let D;const M=new ResizeObserver(()=>{clearTimeout(D),D=setTimeout(()=>{if(f.current&&h.current)try{f.current.fit(),h.current.focus();const{cols:F,rows:R}=h.current;c.current?.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({status:1,cols:F,rows:R}))}catch{}},60)});return M.observe(P),()=>{clearTimeout(D),M.disconnect()}},[s,g]);const O=p==="connected"?"bg-emerald-400":p==="error"?"bg-red-400":p==="closed"?"bg-slate-500":"bg-amber-400",V=p==="connected"?"已连接":p==="connecting"?"连接中":p==="error"?"连接错误":p==="closed"?"已断开":"空闲",N=H.useCallback(()=>{try{h.current?.focus()}catch{}},[]);return y.jsx(Iu,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:279:5",open:s,onOpenChange:e,children:y.jsxs(Wu,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:280:7",showCloseButton:!1,className:xl("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",g?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:g?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[y.jsxs(Fu,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:289:9",className:"sr-only",children:["exec — ",n]}),y.jsx(Vu,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:290:9",className:"sr-only",children:"进入 Pod 容器执行命令"}),y.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:293:9",className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-[var(--dg-border)] flex-wrap",children:[y.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:294:11",className:"flex items-center gap-2 text-sm min-w-0",children:[y.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:295:13",className:xl("w-2 h-2 rounded-full shrink-0",O),title:V}),y.jsx(Hu,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:296:13",className:"h-4 w-4 text-blue-400 shrink-0"}),y.jsxs("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:297:13",className:"text-[var(--dg-text-primary)] font-medium truncate",children:["exec — ",n]}),p==="connecting"&&y.jsx(St,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:298:44",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"}),y.jsx("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:299:13",className:"text-xs text-[var(--dg-text-muted)]",children:V})]}),y.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:301:11",className:"flex items-center gap-2",children:[r.length>0&&y.jsxs(kl,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:303:15",value:k,onValueChange:w,children:[y.jsxs(wl,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:304:17",className:"h-8 w-[150px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:[y.jsx(ju,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:305:19",className:"h-3 w-3 mr-1 text-[var(--dg-text-muted)]"}),y.jsx(vl,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:306:19",placeholder:"容器"})]}),y.jsx(Sl,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:17",children:r.map(P=>y.jsx(Ol,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:55",value:P,children:P} Line truncated
@@ -1 +0,0 @@
import{k as H,m as U,r as c,j as e,n as N,o as f,A as V,B as W,p as F}from"./index-BTQygws6.js";import{C as i,a as x}from"./card-D0oz3NII.js";import{B as L}from"./badge-BsIZhz7S.js";import{S as v,a as C,b as y,c as S,d as P}from"./select-pPlmgAjn.js";import{T as z,a as D,b as u,c as d,d as G,e as n}from"./table-Dh5trM9F.js";import{k as b}from"./index-DSkkspoy.js";import{R as K}from"./refresh-cw-e9vbQhCy.js";import{H as q}from"./hard-drive-zBn-z9Ht.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function ce(){const{clusterCode:w}=H(),g=U(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(V,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(K,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"srcLine truncated
@@ -0,0 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as x}from"./card-B1TdHH8z.js";import{g as H,i as L,L as N,B as U}from"./index-BZzvNKfa.js";import{B as V}from"./badge-IN84WXM6.js";import{S as f,a as v,b as C,c as y,d as P}from"./select-BFGszUub.js";import{T as W,a as F,b as u,c as d,d as z,e as n}from"./table-CQE_AU2l.js";import{k as b}from"./index-DPhaKvWI.js";import{f as S,A as D,R as G,g as K,H as q}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:w}=H(),g=L(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(G,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"src/components/kubernetes/PLine truncated
@@ -0,0 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-BZzvNKfa.js";import{I as j}from"./input-D7JNe8Xd.js";import{L as i}from"./label-Bj0mNUAM.js";import{B as O}from"./badge-IN84WXM6.js";import{C as A}from"./checkbox-DjjvQsNy.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-CQE_AU2l.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-BFGszUub.js";import{r as M}from"./region-DkjCXE-W.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:222:11",className:"flex items-center gap-2",chilLine truncated
@@ -1 +0,0 @@
import{f as ee,r as t,j as e,B as u,L as O,M as se,D as oe,a as ae,b as te,c as ce,d as ne,e as re,t as N}from"./index-BTQygws6.js";import{I as j}from"./input-C6mE-wO9.js";import{L as i}from"./label-8e-EC7mH.js";import{B as A}from"./badge-BsIZhz7S.js";import{C as V}from"./checkbox-D73wKf04.js";import{T as le,a as de,b as H,c as r,d as ie,e as l}from"./table-Dh5trM9F.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-pPlmgAjn.js";import{r as M}from"./region-CWnyU1Ly.js";import{S as pe}from"./search-BDsFve6h.js";import{P as ge}from"./plus-DOS6OUrq.js";import{T as $}from"./trash-2-5oUve9eW.js";import{C as xe}from"./circle-check-DMxKs2Ba.js";import{C as he}from"./circle-x-CYoA2i-_.js";import{P as me}from"./pencil-BgEVXj0m.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function Ie(){const D=ee(),[T,L]=t.useState([]),[F,P]=t.useState(!0),[f,Q]=t.useState(""),[b,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,I]=t.useState(null),[B,z]=t.useState(!1),[o,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{P(!0);try{const a=(await M.list())?.list||[];L(a)}catch{L([])}finally{P(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const a=s.name?.toLowerCase().includes(f.toLowerCase())||s.code?.toLowerCase().includes(f.toLowerCase()),v=b==="all"||s.provider===b;return a&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(a=>a.includes(s)?a.filter(v=>v!==s):[...a,s])},J=()=>{I(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{I(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!o.name.trim()||!o.code.trim())){z(!0);try{g?await M.update(g.id,o):await M.create(o),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const a=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${a?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(a){console.error("批量删除失败:",a),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:f,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:b,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,a])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:a},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(ge,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slLine truncated
@@ -0,0 +1 @@
import{r as v,j as e,R as K,y as Q,o as Z}from"./vendor-codemirror-C7mXSpXt.js";import{_ as U,B as R}from"./index-BZzvNKfa.js";import{I as k}from"./input-D7JNe8Xd.js";import{L as w}from"./label-Bj0mNUAM.js";import{T as ee}from"./textarea-BL_Am_oZ.js";import{S as D,a as B,b as G,c as W,d as T}from"./select-BFGszUub.js";import{u as se}from"./use-toast-CkA38LVP.js";import{k as Y}from"./index-DPhaKvWI.js";import{c as A}from"./PodFileBrowser-B3WbiDk_.js";import{D as te,f as re,N as oe,j as ae,F as ce,X as ne,L as _,$ as O,P as z,T as L}from"./vendor-icons-DIDdqO_o.js";function de(r,i,o){switch(r){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:o,namespace:i},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:o,namespace:i},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:o,namespace:i},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:o,namespace:i},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:o,namespace:i},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:o,namespace:i}}}}async function J(r){if(!r?.trim())return null;try{return JSON.parse(r)}catch{}try{const o=(await U(()=>import("./js-yaml-37NdyH6G.js"),[])).load(r);return o&&typeof o=="object"?o:null}catch{return null}}async function H(r){return(await U(()=>import("./js-yaml-37NdyH6G.js"),[])).dump(r,{lineWidth:120,noRefs:!0})}async function ie(r){const i=JSON.parse(JSON.stringify(r));delete i.status,i.metadata&&(delete i.metadata.managedFields,delete i.metadata.resourceVersion,delete i.metadata.uid,delete i.metadata.creationTimestamp,delete i.metadata.generation);const o=await H(i);return A(o)}function Ne({clusterCode:r,namespace:i,resource:o,name:V,onClose:g,onSaved:N,isCreate:b=!1}){const{toast:l}=se(),[f,p]=v.useState(!0),[h,y]=v.useState(!1),[S,a]=v.useState(""),[t,x]=v.useState(null),[j,C]=v.useState("visual"),[u,c]=v.useState(""),m=v.useCallback(async()=>{p(!0);try{if(b){const q=de(o,i,V||"");x(q),c(JSON.stringify(q,null,2)),a("");return}const E=await Y.getResourceYaml(r,i,o,V),M=A(E);a(E),c(M);const I=await J(M);x(I),I||(C("yaml"),l({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(E){l({title:"加载失败",description:E.message,variant:"destructive"})}finally{p(!1)}},[r,i,o,V,b]);v.useEffect(()=>{m()},[m]);const s=async E=>{y(!0);try{const M=await ie(E),I=E?.metadata?.name||V;if(b){if(!I?.trim()){l({title:"请填写名称",variant:"destructive"});return}await Y.applyYAML(r,M),l({title:"创建成功",description:`${o}/${I}`})}else await Y.updateResourceYaml(r,i,o,V,M),l({title:"保存成功",description:`${o}/${V} 已更新`});N?.(),g()}catch(M){l({title:b?"创建失败":"保存失败",description:M.message,variant:"destructive"})}finally{y(!1)}},n=async()=>{y(!0);try{const E=A(u);b?(await Y.applyYAML(r,E),l({title:"创建成功",description:"YAML 已应用"})):(await Y.updateResourceYaml(r,i,o,V,E),l({title:"YAML 已应用",description:`${o}/${V} 更新成功`})),N?.(),g()}catch(E){l({title:"保存失败",description:E.message,variant:"destructive"})}finally{y(!1)}},d=async()=>{const E=await J(u);if(!E){l({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}x(E),C("visual")},P=async()=>{if(t){const E=await H(t);c(A(E))}C("yaml")},F={configmaps:{title:"ConfigMap",icon:ce,color:"text-blue-400"},secrets:{title:"Secret",icon:ae,color:"text-amber-400"},services:{title:"Service",icon:oe,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:re,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:te,color:"text-emerald-400"}},$=F[o]||F.configmaps,X=$.icon;return e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:135:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:136:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl",onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:139:11",className:"flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:140:13",className:`h-5 w-5 ${$.color}`}),e.jsxs("div",{"code-path":"src/cLine truncated
@@ -1,4 +1,4 @@
import{j as t,Q as Z,L as $,C as Lt,D as P,a as B,b as O,c as A,d as I,e as V,B as p,F as tt,a4 as et,P as _t,R as ot,H as zt,f as $t,r as i,t as l}from"./index-BTQygws6.js";import{I as D}from"./input-C6mE-wO9.js";import{S as st,a as at,b as ct,c as nt,d as z}from"./select-pPlmgAjn.js";import{T as Pt,a as Bt,b as J,c as K}from"./tabs-CH1b5gPd.js";import{C as rt}from"./checkbox-D73wKf04.js";import{s as j,t as Ot}from"./automation-Bve9hYh8.js";import{B as N}from"./badge-BsIZhz7S.js";import{C as At}from"./circle-x-CYoA2i-_.js";import{L as b}from"./label-8e-EC7mH.js";import{T as It}from"./textarea-DDxE7TMs.js";import{S as it}from"./square-pen-DYung4SK.js";import{C as pt,b as Vt,c as Rt,d as Ht,a as lt}from"./card-D0oz3NII.js";import{P as Qt}from"./play-BAPO-6Xq.js";import{C as qt}from"./copy-DRb4X68n.js";import{T as mt}from"./trash-2-5oUve9eW.js";import{S as Ut}from"./search-BDsFve6h.js";import{P as Xt}from"./plus-DOS6OUrq.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash
import{j as t,r as i}from"./vendor-codemirror-C7mXSpXt.js";import{D as $,a as B,b as P,c as I,d as O,e as A,B as p,q as Z,f as Lt,t as l}from"./index-BZzvNKfa.js";import{I as D}from"./input-D7JNe8Xd.js";import{S as tt,a as et,b as ot,c as st,d as z}from"./select-BFGszUub.js";import{T as _t,a as zt,b as J,c as K}from"./tabs-Dx4dxq7o.js";import{C as at}from"./checkbox-DjjvQsNy.js";import{s as j,t as $t}from"./automation-CFN7qde5.js";import{B as N}from"./badge-IN84WXM6.js";import{a as Bt,y as ct,L as V,b as Pt,o as nt,aI as rt,x as It,z as Ot,aC as At,T as it,n as pt,r as Vt,S as qt,P as Rt}from"./vendor-icons-DIDdqO_o.js";import{L as v}from"./label-Bj0mNUAM.js";import{T as Ht}from"./textarea-BL_Am_oZ.js";import{C as lt,b as Qt,c as Ut,d as Xt,a as mt}from"./card-B1TdHH8z.js";import"./index-CYARH0Cq.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash
# 系统巡检脚本
echo "===== 系统信息 ====="
uname -a
@@ -14,4 +14,4 @@ import platform, socket
print("主机名:", socket.gethostname())
print("系统:", platform.platform())
print("Python:", platform.python_version())
`}],W={shell:"border-green-500/30 text-green-500 bg-green-500/10",bash:"border-green-500/30 text-green-500 bg-green-500/10",python:"border-blue-500/30 text-blue-500 bg-blue-500/10",powershell:"border-cyan-500/30 text-cyan-500 bg-cyan-500/10",yaml:"border-purple-500/30 text-purple-500 bg-purple-500/10"},dt=o=>t.jsx(N,{"code-path":"src/components/automation/script-helpers.tsx:66:3",variant:"outline",className:W[o]||W.shell,children:(o||"shell").toUpperCase()}),Y=()=>`sc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;function xt(o){switch(o){case"pending":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:78:14",variant:"outline",className:"gap-1",children:[t.jsx(Lt,{"code-path":"src/components/automation/script-helpers.tsx:78:57",className:"w-3 h-3"}),"等待中"]});case"running":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:80:14",variant:"default",className:"bg-blue-500 gap-1",children:[t.jsx($,{"code-path":"src/components/automation/script-helpers.tsx:80:69",className:"w-3 h-3 animate-spin"}),"执行中"]});case"success":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:82:14",variant:"default",className:"bg-green-600 gap-1",children:[t.jsx(Z,{"code-path":"src/components/automation/script-helpers.tsx:82:70",className:"w-3 h-3"}),"成功"]});case"failed":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:84:14",variant:"destructive",className:"gap-1",children:[t.jsx(At,{"code-path":"src/components/automation/script-helpers.tsx:84:61",className:"w-3 h-3"}),"失败"]});default:return t.jsx(N,{"code-path":"src/components/automation/script-helpers.tsx:86:14",variant:"secondary",children:o||"未知"})}}const Jt=o=>{if(!o)return"-";const a=new Date(o);return Number.isNaN(a.getTime())?"-":a.toLocaleString("zh-CN",{hour12:!1})},Kt=({open:o,onOpenChange:a,editingId:s,editingCode:n,formData:m,setFormData:x,onTypeChange:f,onSave:C})=>t.jsx(P,{"code-path":"src/components/automation/ScriptFormDialog.tsx:38:5",open:o,onOpenChange:a,children:t.jsxs(B,{"code-path":"src/components/automation/ScriptFormDialog.tsx:39:7",className:"max-w-4xl max-h-[90vh]",children:[t.jsxs(O,{"code-path":"src/components/automation/ScriptFormDialog.tsx:40:9",children:[t.jsx(A,{"code-path":"src/components/automation/ScriptFormDialog.tsx:41:11",children:s!==null?"编辑脚本":"新建脚本"}),t.jsx(I,{"code-path":"src/components/automation/ScriptFormDialog.tsx:42:11",children:"编写运维脚本,支持 Shell / Python / PowerShell"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:44:9",className:"space-y-4 overflow-y-auto max-h-[60vh] pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:45:11",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:46:13",children:[t.jsx(b,{"code-path":"src/components/automation/ScriptFormDialog.tsx:47:15",children:"名称"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:48:15",value:m.name,onChange:r=>x({...m,name:r.target.value}),placeholder:"如:系统巡检脚本"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:54:13",children:[t.jsx(b,{"code-path":"src/components/automation/ScriptFormDialog.tsx:55:15",children:"类型"}),t.jsxs(st,{"code-path":"src/components/automation/ScriptFormDialog.tsx:56:15",value:m.type,onValueChange:f,children:[t.jsx(at,{"code-path":"src/components/automation/ScriptFormDialog.tsx:57:17",children:t.jsx(ct,{"code-path":"src/components/automation/ScriptFormDialog.tsx:57:32"})}),t.jsx(nt,{"code-path":"src/components/automation/ScriptFormDialog.tsx:58:17",children:w.map(r=>t.jsx(z,{"code-path":"src/components/automation/ScriptFormDialog.tsx:60:21",value:r.value,children:r.label},r.value))})]})]})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:66:11",children:[t.jsx(b,{"code-path":"src/components/automation/ScriptFormDialog.tsx:67:13",children:"描述"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:68:13",value:m.description,onChange:r=>x({...m,description:r.target.value}),placeholder:"脚本用途说明"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:74:11",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:75:13",children:[t.jsx(b,{"code-path":"src/components/automation/ScriptFormDialog.tsx:76:15",children:"超时(秒)"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:77:15",type:"number",value:m.timeout,onChange:r=>x({...m,timeout:Number(r.target.value)}),placeholder:"300"})]}),s!==null&&t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:85:15",children:[t.jsx(b,{"code-path":"src/components/automation/ScriptFormDialog.tsx:86:17",children:"编码"}),t.jsx(D,{"code-path":"src/compone Line truncated
`}],W={shell:"border-green-500/30 text-green-500 bg-green-500/10",bash:"border-green-500/30 text-green-500 bg-green-500/10",python:"border-blue-500/30 text-blue-500 bg-blue-500/10",powershell:"border-cyan-500/30 text-cyan-500 bg-cyan-500/10",yaml:"border-purple-500/30 text-purple-500 bg-purple-500/10"},dt=o=>t.jsx(N,{"code-path":"src/components/automation/script-helpers.tsx:66:3",variant:"outline",className:W[o]||W.shell,children:(o||"shell").toUpperCase()}),Y=()=>`sc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`;function xt(o){switch(o){case"pending":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:78:14",variant:"outline",className:"gap-1",children:[t.jsx(Pt,{"code-path":"src/components/automation/script-helpers.tsx:78:57",className:"w-3 h-3"}),"等待中"]});case"running":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:80:14",variant:"default",className:"bg-blue-500 gap-1",children:[t.jsx(V,{"code-path":"src/components/automation/script-helpers.tsx:80:69",className:"w-3 h-3 animate-spin"}),"执行中"]});case"success":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:82:14",variant:"default",className:"bg-green-600 gap-1",children:[t.jsx(ct,{"code-path":"src/components/automation/script-helpers.tsx:82:70",className:"w-3 h-3"}),"成功"]});case"failed":return t.jsxs(N,{"code-path":"src/components/automation/script-helpers.tsx:84:14",variant:"destructive",className:"gap-1",children:[t.jsx(Bt,{"code-path":"src/components/automation/script-helpers.tsx:84:61",className:"w-3 h-3"}),"失败"]});default:return t.jsx(N,{"code-path":"src/components/automation/script-helpers.tsx:86:14",variant:"secondary",children:o||"未知"})}}const Jt=o=>{if(!o)return"-";const a=new Date(o);return Number.isNaN(a.getTime())?"-":a.toLocaleString("zh-CN",{hour12:!1})},Kt=({open:o,onOpenChange:a,editingId:s,editingCode:n,formData:m,setFormData:x,onTypeChange:f,onSave:y})=>t.jsx($,{"code-path":"src/components/automation/ScriptFormDialog.tsx:38:5",open:o,onOpenChange:a,children:t.jsxs(B,{"code-path":"src/components/automation/ScriptFormDialog.tsx:39:7",className:"max-w-4xl max-h-[90vh]",children:[t.jsxs(P,{"code-path":"src/components/automation/ScriptFormDialog.tsx:40:9",children:[t.jsx(I,{"code-path":"src/components/automation/ScriptFormDialog.tsx:41:11",children:s!==null?"编辑脚本":"新建脚本"}),t.jsx(O,{"code-path":"src/components/automation/ScriptFormDialog.tsx:42:11",children:"编写运维脚本,支持 Shell / Python / PowerShell"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:44:9",className:"space-y-4 overflow-y-auto max-h-[60vh] pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:45:11",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:46:13",children:[t.jsx(v,{"code-path":"src/components/automation/ScriptFormDialog.tsx:47:15",children:"名称"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:48:15",value:m.name,onChange:r=>x({...m,name:r.target.value}),placeholder:"如:系统巡检脚本"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:54:13",children:[t.jsx(v,{"code-path":"src/components/automation/ScriptFormDialog.tsx:55:15",children:"类型"}),t.jsxs(tt,{"code-path":"src/components/automation/ScriptFormDialog.tsx:56:15",value:m.type,onValueChange:f,children:[t.jsx(et,{"code-path":"src/components/automation/ScriptFormDialog.tsx:57:17",children:t.jsx(ot,{"code-path":"src/components/automation/ScriptFormDialog.tsx:57:32"})}),t.jsx(st,{"code-path":"src/components/automation/ScriptFormDialog.tsx:58:17",children:w.map(r=>t.jsx(z,{"code-path":"src/components/automation/ScriptFormDialog.tsx:60:21",value:r.value,children:r.label},r.value))})]})]})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:66:11",children:[t.jsx(v,{"code-path":"src/components/automation/ScriptFormDialog.tsx:67:13",children:"描述"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:68:13",value:m.description,onChange:r=>x({...m,description:r.target.value}),placeholder:"脚本用途说明"})]}),t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:74:11",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:75:13",children:[t.jsx(v,{"code-path":"src/components/automation/ScriptFormDialog.tsx:76:15",children:"超时(秒)"}),t.jsx(D,{"code-path":"src/components/automation/ScriptFormDialog.tsx:77:15",type:"number",value:m.timeout,onChange:r=>x({...m,timeout:Number(r.target.value)}),placeholder:"300"})]}),s!==null&&t.jsxs("div",{"code-path":"src/components/automation/ScriptFormDialog.tsx:85:15",children:[t.jsx(v,{"code-path":"src/components/automation/ScriptFormDialog.tsx:86:17",children:"编码"}),t.jsx(D,{"code-path":"src/compon Line truncated
@@ -1,11 +1,11 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BtOQNd6b.js","assets/index-BTQygws6.js","assets/index-gdjfqXlA.css","assets/dashboard-DIS6joUE.js","assets/server-C0cSEEX-.js","assets/region-CWnyU1Ly.js","assets/index-DSkkspoy.js","assets/pipeline-CgOYDc3n.js","assets/config-CxWPmf4g.js","assets/credential-BnmvNrfT.js","assets/automation-Bve9hYh8.js","assets/alert-BgGvEFrj.js","assets/alert-center-Bpw1a6Eu.js","assets/site-DwJsZTdz.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-CgE8bmC1.js","assets/metrics-CFR1r9Ln.js","assets/agent-Bb56k6oq.js","assets/account-HBV_I0ZG.js","assets/platform-2GgNsjLE.js","assets/billing-CtDdgyDv.js","assets/audit-DVfdGNwm.js","assets/terminal-D0xu_OgS.js","assets/approval-DHBTR1U2.js","assets/ai-BNXuq6Dq.js"])))=>i.map(i=>d[i]);
import{i as Ke,al as vr,j as e,r as o,be as Or,D as _e,a as Me,b as Qe,c as Te,d as Re,s as hr,a6 as Oe,M as We,Q as nr,O as he,o as Fe,B as j,a5 as ze,S as He,e as Je,a2 as gr,$ as ie,X as be,v as ur,t as G,L as Ue,at as zr,ac as Lr,a9 as Hr,ap as Ur,ab as Xe,ae as Dr,aa as Vr,ad as Wr,aB as qr,W as Gr,b9 as br,N as Kr,H as dr,aS as Sr,aT as jr,aU as yr,aV as Nr,aW as qe,aX as ge,f as Qr}from"./index-BTQygws6.js";import{C as ke,a as Ee}from"./card-D0oz3NII.js";import{I as W}from"./input-C6mE-wO9.js";import{C as ue}from"./checkbox-D73wKf04.js";import{b as Le,e as Y,T as Jr,a as Xr,c as ne,d as Zr}from"./table-Dh5trM9F.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-pPlmgAjn.js";import{u as Yr,q as fr,a as es,b as rs}from"./unwrap-Bv0ReG-f.js";import{u as $e}from"./useMutation-C9fIiouP.js";import{s as ee}from"./server-C0cSEEX-.js";import{S as ss}from"./stat-strip-M_Ng3raR.js";import{B as O}from"./badge-BsIZhz7S.js";import{c as Ne}from"./account-HBV_I0ZG.js";import{R as de}from"./refresh-cw-e9vbQhCy.js";import{S as wr}from"./search-BDsFve6h.js";import{x as ts,a as os}from"./xterm-DSqgeKvr.js";import{m as as,a as cs,f as ns}from"./xterm-utils-slbfdUHf.js";import{c as Ze,s as ds}from"./credential-BnmvNrfT.js";import{M as Cr,a as Ir}from"./minimize-2-DBp9LGa2.js";import{F as Fr}from"./folder-open-B72Redy5.js";import{U as Ye}from"./upload-DAFoufx2.js";import{F as lr,a as ls}from"./folder-CQ5eyfNi.js";import{A as ps}from"./arrow-left-C7utsRsB.js";import{D as er}from"./download-BSvsFf63.js";import{T as rr}from"./trash-2-5oUve9eW.js";import{r as ms}from"./region-CWnyU1Ly.js";import{L as V}from"./label-8e-EC7mH.js";import{T as pr}from"./textarea-DDxE7TMs.js";import{S as xs}from"./save-w9vZ9YyU.js";import{H as is}from"./hard-drive-zBn-z9Ht.js";import{E as vs}from"./ellipsis-ClGZZTS8.js";import{S as hs}from"./square-pen-DYung4SK.js";import{P as gs}from"./plus-DOS6OUrq.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const us=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],sr=Ke("chevron-left",us);const bs=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Ge=Ke("file-spreadsheet",bs);const Ss=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],js=Ke("folder-plus",Ss);function ys(r={page:1,page_size:100}){return Yr({queryKey:fr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:rs(p),total:es(p)}},staleTime:3e4})}function Ns(){const r=vr(),p=()=>r.invalidateQueries({queryKey:["servers"]}),c=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),a=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:c,updateMutation:t,deleteMutation:a,batchDeleteMutation:v,invalidate:p}}function fs({servers:r}){const p=r.filter(a=>a.status==="running").length,c=r.filter(a=>a.status==="maintenance").length,t=r.filter(a=>a.status==="stopped").length;return e.jsx(ss,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:c,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const ws=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Cs({open:r,onClose:p}){const[c,t]=o.useState([]),[a,v]=o.useState(1),[u,g]=o.useState(""),[x,M]=o.useState(null),[S,E]=o.useState([]),[n,N]=o.useState([]),[f,T]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[z,y]=o.useState(!1),[L,m]=o.useState([]),[b,R]=o.useState(!1),[F,A]=o.useState(null),[Z,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await Ne.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),Or(async()=>{const{credentialApi:s}=await import("./index-BtOQNd6b.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])).then(({credentialApi:s})=>{s.list().then(_=>l(_?.list||[])).catch(()=>l([]))}))},[r]);const B=c.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await Ne.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await Ne.synLine truncated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Cplrtzsr.js","assets/index-BZzvNKfa.js","assets/vendor-codemirror-C7mXSpXt.js","assets/vendor-icons-DIDdqO_o.js","assets/index-7YeEJX-w.css","assets/dashboard-Bvsa0TzO.js","assets/server-CxtAvlnp.js","assets/region-DkjCXE-W.js","assets/index-DPhaKvWI.js","assets/pipeline-B15ySBmb.js","assets/config-BflmzFFv.js","assets/credential-qfSmpSHw.js","assets/automation-CFN7qde5.js","assets/alert-0ZkysSZO.js","assets/alert-center-5DJQkdLR.js","assets/site-B4364hqV.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-DLQ-Yv-G.js","assets/metrics-C3xB-WfN.js","assets/agent-BC9_VpeZ.js","assets/account-DLHhQorw.js","assets/platform-CzAVQ8Rt.js","assets/billing-Cc58vPzR.js","assets/audit-C18l9_nL.js","assets/terminal-BOHXwzFP.js","assets/approval-D08dbtmC.js","assets/ai-A_FvqFr_.js"])))=>i.map(i=>d[i]);
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as ir,_ as $r,D as Te,a as _e,b as Ke,c as Re,d as Me,B as j,e as Qe,o as vr,m as ie,t as G,v as Or,r as Lr,K as zr,s as Je,x as Hr,P as Ur,w as Dr,W as Vr,at as hr,a9 as gr,aa as ur,ab as br,ac as Sr,ad as qe,ae as he,f as Wr}from"./index-BZzvNKfa.js";import{C as Fe,a as ke}from"./card-B1TdHH8z.js";import{I as W}from"./input-D7JNe8Xd.js";import{C as ge}from"./checkbox-DjjvQsNy.js";import{b as Oe,e as Z,T as qr,a as Gr,c as ne,d as Kr}from"./table-CQE_AU2l.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-BFGszUub.js";import{u as Qr,q as jr,a as Jr,b as Xr}from"./unwrap-CDkLoNKa.js";import{u as $e}from"./useMutation-DvUJDXfD.js";import{s as ee}from"./server-CxtAvlnp.js";import{S as Yr}from"./stat-strip-D5jCLXat.js";import{B as O}from"./badge-IN84WXM6.js";import{c as ye}from"./account-DLHhQorw.js";import{i as Nr,ag as Le,M as We,y as ar,w as ue,f as Ee,R as de,S as yr,ab as ze,h as He,b5 as Xe,an as fr,ao as wr,X as be,j as Cr,am as Ir,L as Ue,ah as Ye,b6 as Zr,ap as es,aE as nr,m as rs,aF as ss,v as Ze,T as er,b7 as Ge,Q as ts,$ as os,N as cs,H as as,r as dr,aP as ns,aI as ds,P as ls}from"./vendor-icons-DIDdqO_o.js";import{x as ps,a as ms}from"./vendor-xterm-20M9KZE1.js";import{m as xs,a as is,f as vs}from"./xterm-utils-slbfdUHf.js";import{c as rr,s as hs}from"./credential-qfSmpSHw.js";import{r as gs}from"./region-DkjCXE-W.js";import{L as V}from"./label-Bj0mNUAM.js";import{T as lr}from"./textarea-BL_Am_oZ.js";import"./index-CYARH0Cq.js";function us(r={page:1,page_size:100}){return Qr({queryKey:jr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:Xr(p),total:Jr(p)}},staleTime:3e4})}function bs(){const r=ir(),p=()=>r.invalidateQueries({queryKey:["servers"]}),a=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),c=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:a,updateMutation:t,deleteMutation:c,batchDeleteMutation:v,invalidate:p}}function Ss({servers:r}){const p=r.filter(c=>c.status==="running").length,a=r.filter(c=>c.status==="maintenance").length,t=r.filter(c=>c.status==="stopped").length;return e.jsx(Yr,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:a,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const js=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Ns({open:r,onClose:p}){const[a,t]=o.useState([]),[c,v]=o.useState(1),[u,g]=o.useState(""),[x,_]=o.useState(null),[S,E]=o.useState([]),[n,y]=o.useState([]),[f,R]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[L,N]=o.useState(!1),[z,m]=o.useState([]),[b,M]=o.useState(!1),[F,A]=o.useState(null),[Y,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await ye.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),$r(async()=>{const{credentialApi:s}=await import("./index-Cplrtzsr.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({credentialApi:s})=>{s.list().then(T=>l(T?.list||[])).catch(()=>l([]))}))},[r]);const B=a.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await ye.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await ye.syncRegions(s);const T=await X(s);E(T)}catch(T){throw console.error("同步区域失败:",T),T}finally{i(!1)}},[X]),P=o.useCallback(async()=>{if(!x)return;const s=await X(x.id);if(E(s),s.length===0)try{await K(x.id)}catch{}},[x,X,K]),me=o.useCallback(async()=>{if(!(!x||n.length===0)){N(!0),m([]),C([]),D([]);try{const s=await ye.discoverInstances(x.id,n);C(s?.list||[]),m(s?.errors||[])}catch(s){console.error("发现主机失败:",s),m([s?.message||"发现主机失败"])}finally{N(!1)}}},[x,n]),se=async()=>{if(!(!x||I.length===0)){M(!0);try{const s=h.filter(ce=>I.includes(ce.instance_id)),T=await ye.importInstances(x.id,s,{default_port:Number(Y)||22,credential_id:$?Number($):void 0});A(T||{imported:0,skipped:0})}catch(s){console.error("导入失败:",s)}finally{M(!1)}}},H=()=>{c===2&&x&&c<4?(v(3),P()):c<4&&v(c+1)},Se=()=>{c>1&&v(c-1)},Be=()=>{n.length===S.length&&S.length>0?y([]):y(S.map(s=>s.code))},Ve=s=>{D(T=>T.includes(s)?T.filter(ce=>ce!==s):[...T,s])},Pe=()=>{I.length===h.length&&h.length>0?D([]):D(h.map(s=>s.instance_id))},je=()=>{p(),v(1),g(""),_(null),y([]),E([]),C([]),D([]),R(""),m([]),A(null),q("22"),Q("")},oLine truncated
\x1B[31m[连接已关闭]\x1B[0m\r
`)},F.onerror=()=>{y.write(`\r
`)},F.onerror=()=>{N.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)},()=>{try{F.close(),y.dispose()}catch{}g.current=null,x.current=null,E(!1)}},[r,c,I]),o.useEffect(()=>{if(!r||!I)return;let y,L=0;const m=()=>{const b=u.current,R=M.current,F=g.current,A=x.current;if(!b||!R||!F){L++<30&&requestAnimationFrame(m);return}y=cs(b,R,F,A);try{ns(R,F,A)}catch{}};return m(),()=>y?.()},[r,I,n]),e.jsx(_e,{"code-path":"src/components/server/TerminalDialog.tsx:184:5",open:r,onOpenChange:p,children:e.jsxs(Me,{"code-path":"src/components/server/TerminalDialog.tsx:185:7",showCloseButton:!1,className:ie("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",n?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:n?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsxs(Te,{"code-path":"src/components/server/TerminalDialog.tsx:197:9",className:"sr-only",children:["终端 - ",t]}),e.jsx(Re,{"code-path":"src/components/server/TerminalDialog.tsx:198:9",className:"sr-only",children:"SSH 终端连接"}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:200:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:201:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/server/TerminalDialog.tsx:202:13",className:ie("w-2 h-2 rounded-full",S?"bg-emerald-400":"bg-red-400")}),e.jsx("span",{"code-path":"src/components/server/TerminalDialog.tsx:203:13",className:"text-[var(--dg-text-primary)] font-medium",children:t}),e.jsxs("span",{"code-path":"src/components/server/TerminalDialog.tsx:204:13",className:"text-[var(--dg-text-muted)]",children:["(",a,")"]})]}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:206:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/server/TerminalDialog.tsx:207:13",onClick:()=>N(!n),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:n?e.jsx(Cr,{"code-path":"src/components/server/TerminalDialog.tsx:211:29",className:"h-4 w-4"}):e.jsx(Ir,{"code-path":"src/components/server/TerminalDialog.tsx:211:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/server/TerminalDialog.tsx:213:13",onClick:()=>p(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(be,{"code-path":"src/components/server/TerminalDialog.tsx:217:15",className:"h-4 w-4"})})]})]}),!I&&e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:223:11",className:"p-6 flex flex-col items-center justify-center gap-4",style:{height:"480px"},children:[e.jsx(ur,{"code-path":"src/components/server/TerminalDialog.tsx:224:13",className:"h-12 w-12 text-amber-400"}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:225:13",className:"text-center",children:[e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:226:15",className:"text-[var(--dg-text-primary)] font-medium mb-1",children:"服务器未配置认证凭据"}),e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:227:15",className:"text-sm text-[var(--dg-text-muted)]",children:"请选择一个凭据用于 SSH 连接"})]}),f.length===0?e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:230:15",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无可用凭据,请先去「凭证配置」添加"}):e.jsxs("select",{"code-path":"src/components/server/TerminalDialog.tsx:232:15",value:w,onChange:y=>i(y.target.value),className:"w-64 px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-sm",children:[e.jsx("option",{"code-path":"src/components/server/TerminalDialog.tsx:237:17",value:"",children:"-- 选择凭据 --"}),f.map(y=>e.jsxs("option",{"code-path":"src/components/server/TerminalDialog.tsx:239:19",value:String(y.id),children:[y.type==="ssh_key"?"🔑":"🔒"," ",y.name]},y.id))]}),e.jsx(j,{"code-path":"src/components/server/TerminalDialog.tsx:245:13",onClick:z,disabled:!w||h,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:h?"关联中...":"确认连接"})]}),I&&e.jsx("div",{"code-path":"src/components/server/TerminalDialog.tsx:256:11",ref:u,className:"xterm-terminal-host",style:{height:n?"calc(100vh - 49px)":"520px"}})]})})}const Fs=r=>r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(2)} MB`;function ks({open:r,onOpenChange:p,serverId:c,serverName:t}){const[a,v]=o.useState([]),[u,g]=o.useState([]),[x,M]=o.useState("/"),[S,E]=o.useState(!1),[n,N]=o.useState(""),[f,T]=o.useState(!1),[w,i]=o.useState(!1),h=o.useRef(null),C=o.useCallback(async m=>{if(c){E(!0),N("");try{const b=await ee.listFiles(c,m),R=b?.data||b;v(R.items||[]),g(R.breadcrumbs||[]),M(R.path||m)}catch(b){N(b?.message||"加载目录失败"),v([ Line truncated
`)},()=>{try{F.close(),N.dispose()}catch{}g.current=null,x.current=null,E(!1)}},[r,a,I]),o.useEffect(()=>{if(!r||!I)return;let N,z=0;const m=()=>{const b=u.current,M=_.current,F=g.current,A=x.current;if(!b||!M||!F){z++<30&&requestAnimationFrame(m);return}N=is(b,M,F,A);try{vs(M,F,A)}catch{}};return m(),()=>N?.()},[r,I,n]),e.jsx(Te,{"code-path":"src/components/server/TerminalDialog.tsx:184:5",open:r,onOpenChange:p,children:e.jsxs(_e,{"code-path":"src/components/server/TerminalDialog.tsx:185:7",showCloseButton:!1,className:ie("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",n?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:n?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsxs(Re,{"code-path":"src/components/server/TerminalDialog.tsx:197:9",className:"sr-only",children:["终端 - ",t]}),e.jsx(Me,{"code-path":"src/components/server/TerminalDialog.tsx:198:9",className:"sr-only",children:"SSH 终端连接"}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:200:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:201:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/server/TerminalDialog.tsx:202:13",className:ie("w-2 h-2 rounded-full",S?"bg-emerald-400":"bg-red-400")}),e.jsx("span",{"code-path":"src/components/server/TerminalDialog.tsx:203:13",className:"text-[var(--dg-text-primary)] font-medium",children:t}),e.jsxs("span",{"code-path":"src/components/server/TerminalDialog.tsx:204:13",className:"text-[var(--dg-text-muted)]",children:["(",c,")"]})]}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:206:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/server/TerminalDialog.tsx:207:13",onClick:()=>y(!n),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:n?e.jsx(fr,{"code-path":"src/components/server/TerminalDialog.tsx:211:29",className:"h-4 w-4"}):e.jsx(wr,{"code-path":"src/components/server/TerminalDialog.tsx:211:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/server/TerminalDialog.tsx:213:13",onClick:()=>p(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(be,{"code-path":"src/components/server/TerminalDialog.tsx:217:15",className:"h-4 w-4"})})]})]}),!I&&e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:223:11",className:"p-6 flex flex-col items-center justify-center gap-4",style:{height:"480px"},children:[e.jsx(Cr,{"code-path":"src/components/server/TerminalDialog.tsx:224:13",className:"h-12 w-12 text-amber-400"}),e.jsxs("div",{"code-path":"src/components/server/TerminalDialog.tsx:225:13",className:"text-center",children:[e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:226:15",className:"text-[var(--dg-text-primary)] font-medium mb-1",children:"服务器未配置认证凭据"}),e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:227:15",className:"text-sm text-[var(--dg-text-muted)]",children:"请选择一个凭据用于 SSH 连接"})]}),f.length===0?e.jsx("p",{"code-path":"src/components/server/TerminalDialog.tsx:230:15",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无可用凭据,请先去「凭证配置」添加"}):e.jsxs("select",{"code-path":"src/components/server/TerminalDialog.tsx:232:15",value:w,onChange:N=>i(N.target.value),className:"w-64 px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-sm",children:[e.jsx("option",{"code-path":"src/components/server/TerminalDialog.tsx:237:17",value:"",children:"-- 选择凭据 --"}),f.map(N=>e.jsxs("option",{"code-path":"src/components/server/TerminalDialog.tsx:239:19",value:String(N.id),children:[N.type==="ssh_key"?"🔑":"🔒"," ",N.name]},N.id))]}),e.jsx(j,{"code-path":"src/components/server/TerminalDialog.tsx:245:13",onClick:L,disabled:!w||h,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:h?"关联中...":"确认连接"})]}),I&&e.jsx("div",{"code-path":"src/components/server/TerminalDialog.tsx:256:11",ref:u,className:"xterm-terminal-host",style:{height:n?"calc(100vh - 49px)":"520px"}})]})})}const fs=r=>r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(2)} MB`;function ws({open:r,onOpenChange:p,serverId:a,serverName:t}){const[c,v]=o.useState([]),[u,g]=o.useState([]),[x,_]=o.useState("/"),[S,E]=o.useState(!1),[n,y]=o.useState(""),[f,R]=o.useState(!1),[w,i]=o.useState(!1),h=o.useRef(null),C=o.useCallback(async m=>{if(a){E(!0),y("");try{const b=await ee.listFiles(a,m),M=b?.data||b;v(M.items||[]),g(M.breadcrumbs||[]),_(M.path||m)}catch(b){y(b?.message||"加载目录失败"),v([ Line truncated
`).replace(/\r/g,`
`).split(`
`).filter(a=>a.trim());if(p.length<2)return[];const c=mr(p[0]).map(a=>a.toLowerCase()),t=[];for(let a=1;a<p.length;a++){const v=mr(p[a]),u={};c.forEach((g,x)=>{u[g]=v[x]??""}),t.push(u)}return t}function _s(r){return/^(\d{1,3}\.){3}\d{1,3}$/.test(r)&&r.split(".").every(p=>Number(p)>=0&&Number(p)<=255)}function Ms(){const r=["hostname,ip,port","web-01,192.168.1.10,22","db-01,192.168.1.20,22","cache-01,192.168.1.30,2222"].join(`
`),p=new Blob(["\uFEFF"+r],{type:"text/csv;charset=utf-8;"}),c=URL.createObjectURL(p),t=document.createElement("a");t.href=c,t.download="servers-template.csv",t.click(),URL.revokeObjectURL(c)}function Ts({open:r,onClose:p}){const[c,t]=o.useState(1),[a,v]=o.useState(""),[,u]=o.useState("password"),[g,x]=o.useState(null),[M,S]=o.useState(!1),[E,n]=o.useState([]),[N,f]=o.useState([]),[T,w]=o.useState(!1),[i,h]=o.useState([]),[C,I]=o.useState(""),[D,z]=o.useState("22");o.useEffect(()=>{if(!r)return;let l=!1;return(async()=>{try{const[$,Q]=await Promise.all([ms.list(),Ze.list()]);if(l)return;const J=$?.list??[];f(J.map(B=>({id:String(B.id??""),name:B.name??"",code:B.code??""}))),h(Q?.list??[])}catch{l||(f([]),h([]))}})(),()=>{l=!0}},[r]);const y=async()=>{if(c===2&&g){S(!0);try{const l=await g.text(),$=Es(l);if($.length===0){G.error("文件无有效数据,请使用模板格式(首行为表头)"),S(!1);return}const Q=new Set,J=$.map((B,X)=>{const K=(B.hostname??"").trim(),P=(B.ip??"").trim(),me={row:X+2,hostname:K,ip:P,port:Number(B.port)||22,username:(B.username??"").trim()||"root",os:B.os??"",cpu:Number(B.cpu)||0,memory:Number(B.memory)||0,disk:Number(B.disk)||0,tags:B.tags??"",status:"valid",message:"有效"},se=[];K||se.push("主机名缺失"),P?_s(P)||se.push("IP格式错误"):se.push("IP缺失");const H=`${K}|${P}`;return K&&P&&Q.has(H)?se.push("重复行"):Q.add(H),se.length>0&&(me.status="error",me.message=se.join("、")),me});n(J),t(c+1)}catch{G.error("文件解析失败,请确认是 CSV 格式")}finally{S(!1)}}else t(c+1)},L=()=>{c>1&&t(c-1)},m=l=>{l.target.files&&l.target.files[0]&&x(l.target.files[0])},b=()=>{t(1),v(""),z("22"),I(""),x(null),n([])},R=async()=>{const l=E.filter($=>$.status==="valid");if(l.length!==0){w(!0);try{const $=l.map(P=>({hostname:P.hostname,ip:P.ip,port:P.port,username:P.username,os:P.os,cpu:P.cpu,memory:P.memory,disk:P.disk,tags:P.tags})),J=await ee.batchCreate({servers:$,region_id:a||void 0,credential_id:C?Number(C):void 0,default_port:Number(D)||22})??{},B=J.success??0,X=J.skipped??0,K=J.failed??0;G.success(`导入完成:成功 ${B},跳过 ${X},失败 ${K}`),b(),p()}catch($){G.error($?.message||"导入失败,请重试")}finally{w(!1)}}},F=()=>{p(),b()},A=E.filter(l=>l.status==="valid").length,Z=E.filter(l=>l.status==="warning").length,q=E.filter(l=>l.status==="error").length,re=[{id:1,title:"配置"},{id:2,title:"上传"},{id:3,title:"确认"}];return e.jsx(_e,{"code-path":"src/components/server/ExcelServerImport.tsx:278:5",open:r,onOpenChange:F,children:e.jsxs(Me,{"code-path":"src/components/server/ExcelServerImport.tsx:279:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Qe,{"code-path":"src/components/server/ExcelServerImport.tsx:280:9",children:[e.jsx(Te,{"code-path":"src/components/server/ExcelServerImport.tsx:281:11",className:"text-xl",children:"CSV 批量导入服务器"}),e.jsx(Re,{"code-path":"src/components/server/ExcelServerImport.tsx:282:11",className:"sr-only",children:"通过 CSV 文件批量导入服务器资产"})]}),e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:286:9",className:"flex items-center justify-center mb-6",children:re.map((l,$)=>e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:288:13",className:"flex items-center",children:[e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:289:15",className:`flex items-center justify-center w-8 h-8 rounded-full ${c===l.id?"bg-blue-600 text-white":c>l.id?"bg-emerald-600 text-white":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:c>l.id?e.jsx(he,{"code-path":"src/components/server/ExcelServerImport.tsx:296:32",className:"h-4 w-4"}):l.id}),e.jsx("span",{"code-path":"src/components/server/ExcelServerImport.tsx:298:15",className:`ml-2 text-sm ${c===l.id?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-muted)]"}`,children:l.title}),$<re.length-1&&e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:302:17",className:"w-12 h-0.5 bg-[var(--dg-border)] mx-3"})]},l.id))}),c===1&&e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:310:11",className:"space-y-6",children:[e.jsx(ke,{"code-path":"src/components/server/ExcelServerImport.tsx:312:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(Ee,{"code-path":"src/components/server/ExcelServerImport.tsx:313:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:314:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:315:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:316:21",className:"w-10 h-10 rounded-lg bg-emerald-500/20 flex items-center justify-center",children:e.jsx(Ge,{"code-path":"src/components/server/ExcelServerImport.tsx:317:2 Line truncated
`),le=new Blob(["\uFEFF"+Ae],{type:"text/csv;charset=utf-8;"}),ce=URL.createObjectURL(le),xe=document.createElement("a");xe.href=ce,xe.download=`servers_${new Date().toISOString().slice(0,10)}.csv`,xe.click(),URL.revokeObjectURL(ce),G.success(`已导出 ${H.length} 台服务器`)},cr=8;return e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:361:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:363:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:364:9",children:[e.jsx("h1",{"code-path":"src/components/server/ServerManager.tsx:365:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"服务器管理"}),e.jsx("p",{"code-path":"src/components/server/ServerManager.tsx:366:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"管理云平台服务器资产"})]}),e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:368:9",className:"flex items-center gap-2",children:[e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:369:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",onClick:()=>X(),children:[e.jsx(de,{"code-path":"src/components/server/ServerManager.tsx:374:13",className:ie("h-4 w-4 mr-2",B&&"animate-spin")}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:377:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",onClick:$r,children:[e.jsx(er,{"code-path":"src/components/server/ServerManager.tsx:382:13",className:"h-4 w-4 mr-2"}),"导出"]}),c("server:create")&&e.jsxs(Sr,{"code-path":"src/components/server/ServerManager.tsx:386:11",children:[e.jsx(jr,{"code-path":"src/components/server/ServerManager.tsx:387:13",asChild:!0,children:e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:388:15",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(Ye,{"code-path":"src/components/server/ServerManager.tsx:389:17",className:"h-4 w-4 mr-2"}),"批量导入"]})}),e.jsxs(yr,{"code-path":"src/components/server/ServerManager.tsx:393:13",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Nr,{"code-path":"src/components/server/ServerManager.tsx:394:15",children:"选择导入方式"}),e.jsx(qe,{"code-path":"src/components/server/ServerManager.tsx:395:15",className:"bg-[var(--dg-border)]"}),e.jsxs(ge,{"code-path":"src/components/server/ServerManager.tsx:396:15",className:"hover:bg-[var(--dg-bg-hover)] cursor-pointer focus:bg-[var(--dg-bg-hover)] focus:text-[var(--dg-text-primary)]",onClick:()=>S(!0),children:[e.jsx(hr,{"code-path":"src/components/server/ServerManager.tsx:400:17",className:"h-4 w-4 mr-2 text-[var(--dg-blue)]"}),"云主机导入",e.jsx("span",{"code-path":"src/components/server/ServerManager.tsx:402:17",className:"ml-2 text-xs text-[var(--dg-text-muted)]",children:"从云平台同步"})]}),e.jsxs(ge,{"code-path":"src/components/server/ServerManager.tsx:404:15",className:"hover:bg-[var(--dg-bg-hover)] cursor-pointer focus:bg-[var(--dg-bg-hover)] focus:text-[var(--dg-text-primary)]",onClick:()=>n(!0),children:[e.jsx(Ge,{"code-path":"src/components/server/ServerManager.tsx:408:17",className:"h-4 w-4 mr-2 text-emerald-400"}),"CSV导入",e.jsx("span",{"code-path":"src/components/server/ServerManager.tsx:410:17",className:"ml-2 text-xs text-[var(--dg-text-muted)]",children:"hostname + IP 即可"})]})]})]}),c("server:create")&&e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:416:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:Br,children:[e.jsx(gs,{"code-path":"src/components/server/ServerManager.tsx:420:15",className:"h-4 w-4 mr-2"}),"添加服务器"]})]})]}),e.jsx(fs,{"code-path":"src/components/server/ServerManager.tsx:428:7",servers:H}),e.jsx(ke,{"code-path":"src/components/server/ServerManager.tsx:431:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(Ee,{"code-path":"src/components/server/ServerManager.tsx:432:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:434:11",className:"flex items-center justify-between flex-wrap gap-4 p-4",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:435:13",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:436:15",className:"relative w-64",children:[e.jsx(wr,{"code-path":"src/components/server/ServerManager.tsx:437:17",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/ Line truncated
`).filter(c=>c.trim());if(p.length<2)return[];const a=pr(p[0]).map(c=>c.toLowerCase()),t=[];for(let c=1;c<p.length;c++){const v=pr(p[c]),u={};a.forEach((g,x)=>{u[g]=v[x]??""}),t.push(u)}return t}function Is(r){return/^(\d{1,3}\.){3}\d{1,3}$/.test(r)&&r.split(".").every(p=>Number(p)>=0&&Number(p)<=255)}function Fs(){const r=["hostname,ip,port","web-01,192.168.1.10,22","db-01,192.168.1.20,22","cache-01,192.168.1.30,2222"].join(`
`),p=new Blob(["\uFEFF"+r],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(p),t=document.createElement("a");t.href=a,t.download="servers-template.csv",t.click(),URL.revokeObjectURL(a)}function ks({open:r,onClose:p}){const[a,t]=o.useState(1),[c,v]=o.useState(""),[,u]=o.useState("password"),[g,x]=o.useState(null),[_,S]=o.useState(!1),[E,n]=o.useState([]),[y,f]=o.useState([]),[R,w]=o.useState(!1),[i,h]=o.useState([]),[C,I]=o.useState(""),[D,L]=o.useState("22");o.useEffect(()=>{if(!r)return;let l=!1;return(async()=>{try{const[$,Q]=await Promise.all([gs.list(),rr.list()]);if(l)return;const J=$?.list??[];f(J.map(B=>({id:String(B.id??""),name:B.name??"",code:B.code??""}))),h(Q?.list??[])}catch{l||(f([]),h([]))}})(),()=>{l=!0}},[r]);const N=async()=>{if(a===2&&g){S(!0);try{const l=await g.text(),$=Cs(l);if($.length===0){G.error("文件无有效数据,请使用模板格式(首行为表头)"),S(!1);return}const Q=new Set,J=$.map((B,X)=>{const K=(B.hostname??"").trim(),P=(B.ip??"").trim(),me={row:X+2,hostname:K,ip:P,port:Number(B.port)||22,username:(B.username??"").trim()||"root",os:B.os??"",cpu:Number(B.cpu)||0,memory:Number(B.memory)||0,disk:Number(B.disk)||0,tags:B.tags??"",status:"valid",message:"有效"},se=[];K||se.push("主机名缺失"),P?Is(P)||se.push("IP格式错误"):se.push("IP缺失");const H=`${K}|${P}`;return K&&P&&Q.has(H)?se.push("重复行"):Q.add(H),se.length>0&&(me.status="error",me.message=se.join("、")),me});n(J),t(a+1)}catch{G.error("文件解析失败,请确认是 CSV 格式")}finally{S(!1)}}else t(a+1)},z=()=>{a>1&&t(a-1)},m=l=>{l.target.files&&l.target.files[0]&&x(l.target.files[0])},b=()=>{t(1),v(""),L("22"),I(""),x(null),n([])},M=async()=>{const l=E.filter($=>$.status==="valid");if(l.length!==0){w(!0);try{const $=l.map(P=>({hostname:P.hostname,ip:P.ip,port:P.port,username:P.username,os:P.os,cpu:P.cpu,memory:P.memory,disk:P.disk,tags:P.tags})),J=await ee.batchCreate({servers:$,region_id:c||void 0,credential_id:C?Number(C):void 0,default_port:Number(D)||22})??{},B=J.success??0,X=J.skipped??0,K=J.failed??0;G.success(`导入完成:成功 ${B},跳过 ${X},失败 ${K}`),b(),p()}catch($){G.error($?.message||"导入失败,请重试")}finally{w(!1)}}},F=()=>{p(),b()},A=E.filter(l=>l.status==="valid").length,Y=E.filter(l=>l.status==="warning").length,q=E.filter(l=>l.status==="error").length,re=[{id:1,title:"配置"},{id:2,title:"上传"},{id:3,title:"确认"}];return e.jsx(Te,{"code-path":"src/components/server/ExcelServerImport.tsx:278:5",open:r,onOpenChange:F,children:e.jsxs(_e,{"code-path":"src/components/server/ExcelServerImport.tsx:279:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Ke,{"code-path":"src/components/server/ExcelServerImport.tsx:280:9",children:[e.jsx(Re,{"code-path":"src/components/server/ExcelServerImport.tsx:281:11",className:"text-xl",children:"CSV 批量导入服务器"}),e.jsx(Me,{"code-path":"src/components/server/ExcelServerImport.tsx:282:11",className:"sr-only",children:"通过 CSV 文件批量导入服务器资产"})]}),e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:286:9",className:"flex items-center justify-center mb-6",children:re.map((l,$)=>e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:288:13",className:"flex items-center",children:[e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:289:15",className:`flex items-center justify-center w-8 h-8 rounded-full ${a===l.id?"bg-blue-600 text-white":a>l.id?"bg-emerald-600 text-white":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:a>l.id?e.jsx(ue,{"code-path":"src/components/server/ExcelServerImport.tsx:296:32",className:"h-4 w-4"}):l.id}),e.jsx("span",{"code-path":"src/components/server/ExcelServerImport.tsx:298:15",className:`ml-2 text-sm ${a===l.id?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-muted)]"}`,children:l.title}),$<re.length-1&&e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:302:17",className:"w-12 h-0.5 bg-[var(--dg-border)] mx-3"})]},l.id))}),a===1&&e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:310:11",className:"space-y-6",children:[e.jsx(Fe,{"code-path":"src/components/server/ExcelServerImport.tsx:312:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(ke,{"code-path":"src/components/server/ExcelServerImport.tsx:313:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:314:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/ExcelServerImport.tsx:315:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/ExcelServerImport.tsx:316:21",className:"w-10 h-10 rounded-lg bg-emerald-500/20 flex items-center justify-center",children:e.jsx(Ge,{"code-path":"src/components/server/ExcelServerImport.tsx:317:2 Line truncated
`),le=new Blob(["\uFEFF"+Ae],{type:"text/csv;charset=utf-8;"}),ae=URL.createObjectURL(le),xe=document.createElement("a");xe.href=ae,xe.download=`servers_${new Date().toISOString().slice(0,10)}.csv`,xe.click(),URL.revokeObjectURL(ae),G.success(`已导出 ${H.length} 台服务器`)},cr=8;return e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:361:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:363:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:364:9",children:[e.jsx("h1",{"code-path":"src/components/server/ServerManager.tsx:365:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"服务器管理"}),e.jsx("p",{"code-path":"src/components/server/ServerManager.tsx:366:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"管理云平台服务器资产"})]}),e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:368:9",className:"flex items-center gap-2",children:[e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:369:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",onClick:()=>X(),children:[e.jsx(de,{"code-path":"src/components/server/ServerManager.tsx:374:13",className:ie("h-4 w-4 mr-2",B&&"animate-spin")}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:377:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",onClick:Ar,children:[e.jsx(Ze,{"code-path":"src/components/server/ServerManager.tsx:382:13",className:"h-4 w-4 mr-2"}),"导出"]}),a("server:create")&&e.jsxs(gr,{"code-path":"src/components/server/ServerManager.tsx:386:11",children:[e.jsx(ur,{"code-path":"src/components/server/ServerManager.tsx:387:13",asChild:!0,children:e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:388:15",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(Ye,{"code-path":"src/components/server/ServerManager.tsx:389:17",className:"h-4 w-4 mr-2"}),"批量导入"]})}),e.jsxs(br,{"code-path":"src/components/server/ServerManager.tsx:393:13",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Sr,{"code-path":"src/components/server/ServerManager.tsx:394:15",children:"选择导入方式"}),e.jsx(qe,{"code-path":"src/components/server/ServerManager.tsx:395:15",className:"bg-[var(--dg-border)]"}),e.jsxs(he,{"code-path":"src/components/server/ServerManager.tsx:396:15",className:"hover:bg-[var(--dg-bg-hover)] cursor-pointer focus:bg-[var(--dg-bg-hover)] focus:text-[var(--dg-text-primary)]",onClick:()=>S(!0),children:[e.jsx(Nr,{"code-path":"src/components/server/ServerManager.tsx:400:17",className:"h-4 w-4 mr-2 text-[var(--dg-blue)]"}),"云主机导入",e.jsx("span",{"code-path":"src/components/server/ServerManager.tsx:402:17",className:"ml-2 text-xs text-[var(--dg-text-muted)]",children:"从云平台同步"})]}),e.jsxs(he,{"code-path":"src/components/server/ServerManager.tsx:404:15",className:"hover:bg-[var(--dg-bg-hover)] cursor-pointer focus:bg-[var(--dg-bg-hover)] focus:text-[var(--dg-text-primary)]",onClick:()=>n(!0),children:[e.jsx(Ge,{"code-path":"src/components/server/ServerManager.tsx:408:17",className:"h-4 w-4 mr-2 text-emerald-400"}),"CSV导入",e.jsx("span",{"code-path":"src/components/server/ServerManager.tsx:410:17",className:"ml-2 text-xs text-[var(--dg-text-muted)]",children:"hostname + IP 即可"})]})]})]}),a("server:create")&&e.jsxs(j,{"code-path":"src/components/server/ServerManager.tsx:416:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:Mr,children:[e.jsx(ls,{"code-path":"src/components/server/ServerManager.tsx:420:15",className:"h-4 w-4 mr-2"}),"添加服务器"]})]})]}),e.jsx(Ss,{"code-path":"src/components/server/ServerManager.tsx:428:7",servers:H}),e.jsx(Fe,{"code-path":"src/components/server/ServerManager.tsx:431:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(ke,{"code-path":"src/components/server/ServerManager.tsx:432:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:434:11",className:"flex items-center justify-between flex-wrap gap-4 p-4",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:435:13",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/server/ServerManager.tsx:436:15",className:"relative w-64",children:[e.jsx(yr,{"code-path":"src/components/server/ServerManager.tsx:437:17",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/ Line truncated
@@ -1,2 +0,0 @@
import{r as o,u as q,j as s,D as Z,a as ss,b as es,c as ts,U as le,d as as,e as rs,B as x,a6 as Ks,Q as Qs,N as Ws,L as Ns,b9 as ve,P as de,v as qs,f as Js,aQ as Xs,t as V,av as fe,W as De,Y as pe,x as Bs,z as ie,l as $,y as Le}from"./index-BTQygws6.js";import{T as Te,a as Ue,b as Vs,c as Hs}from"./tabs-CH1b5gPd.js";import{B as cs}from"./badge-BsIZhz7S.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-D0oz3NII.js";import{I as f}from"./input-C6mE-wO9.js";import{T as As,a as Ps,b as J,c as M,d as zs,e as w}from"./table-Dh5trM9F.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-pPlmgAjn.js";import{S as vs}from"./square-pen-DYung4SK.js";import{U as Gs}from"./upload-DAFoufx2.js";import{D as xe}from"./download-BSvsFf63.js";import{C as Ys}from"./circle-x-CYoA2i-_.js";import{R as Zs}from"./refresh-cw-e9vbQhCy.js";import{S as we}from"./search-BDsFve6h.js";import{P as se}from"./plus-DOS6OUrq.js";import{M as Ce,P as Me}from"./phone-DFQ2ZxxE.js";import{T as ee}from"./trash-2-5oUve9eW.js";import{T as ke}from"./textarea-DDxE7TMs.js";import{L as Ts}from"./label-8e-EC7mH.js";import{C as Ie}from"./checkbox-D73wKf04.js";import{S as bs}from"./switch-8l7ThrsD.js";import{U as Re}from"./user-plus-CTbJ7AX7.js";import{H as _e}from"./history-0zIbY_Ux.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(le,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,Line truncated
`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;g<c.length;g++){const ms=c[g].split(",").map(Fs=>Fs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),z(null)},os.readAsText(E,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const l=await q.batchImport({users:j,skip_existing:!0});z(l),await X()}catch(l){z({code:500,message:l?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(Te,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Ue,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(pe,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(ze,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:ls,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:K,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:G,setImportResult:z,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{Lt as SystemManager};
@@ -0,0 +1,2 @@
import{r as o,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Ks,t as V,j as Bs,l as $,k as fe}from"./index-BZzvNKfa.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-Dx4dxq7o.js";import{B as cs}from"./badge-IN84WXM6.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-B1TdHH8z.js";import{I as f}from"./input-D7JNe8Xd.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-CQE_AU2l.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-BFGszUub.js";import{U as re,ag as Qs,aI as vs,ah as Gs,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aN as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-DIDdqO_o.js";import{T as Re}from"./textarea-BL_Am_oZ.js";import{L as Ts}from"./label-Bj0mNUAM.js";import{C as _e}from"./checkbox-DjjvQsNy.js";import{S as bs}from"./switch-Ds1Doipu.js";import"./index-CYARH0Cq.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800Line truncated
`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;g<c.length;g++){const ms=c[g].split(",").map(Fs=>Fs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),E(null)},os.readAsText(z,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const r=await q.batchImport({users:j,skip_existing:!0});E(r),await X()}catch(r){E({code:500,message:r?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(De,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(se,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(Ee,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:rs,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:K,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:G,setImportResult:E,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{yt as SystemManager};
@@ -1,3 +1,3 @@
import{i as F,al as le,r as n,a2 as ce,j as e,D as J,a as Q,$ as X,c as V,d as G,_ as E,L as Y,X as de,f as me,B as H,A as Z,P as pe,b as xe}from"./index-BTQygws6.js";import{C as I,a as O}from"./card-D0oz3NII.js";import{I as $}from"./input-C6mE-wO9.js";import{T as q,a as K,b as T,c as d,d as W,e as m}from"./table-Dh5trM9F.js";import{x as ee,a as se}from"./xterm-DSqgeKvr.js";import{B as L}from"./badge-BsIZhz7S.js";import{m as he,a as ue}from"./xterm-utils-slbfdUHf.js";import{M as ge,a as ye}from"./minimize-2-DBp9LGa2.js";import{u as te,q as ae,b as ne}from"./unwrap-Bv0ReG-f.js";import{u as z}from"./useMutation-C9fIiouP.js";import{t as R,s as fe}from"./terminal-D0xu_OgS.js";import{S as _}from"./search-BDsFve6h.js";import{R as U}from"./refresh-cw-e9vbQhCy.js";import{P as ve}from"./play-BAPO-6Xq.js";import{D as je}from"./download-BSvsFf63.js";const Se=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],be=F("octagon-x",Se);const Ne=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],Pe=F("timer-off",Ne);const we=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ce=F("timer",we);function re(s={page:1,page_size:100}){return te({queryKey:ae.terminalSessions(s),queryFn:async()=>{const r=await R.list(s);return ne(r)}})}function Ae(){const s=le(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=z({mutationFn:p=>R.kill(p),onSuccess:r}),c=z({mutationFn:p=>R.delete(p),onSuccess:r}),l=z({mutationFn:p=>R.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function De(s={page:1,page_size:200}){return te({queryKey:ae.sessionCommands(s),queryFn:async()=>{const r=await fe.list(s);return ne(r)}})}function He({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[v,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[y,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new ee.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new se.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=ce.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),k=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(k);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),he(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=M=>{try{const C=JSON.parse(M.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=M=>{N||g(`连接失败 (code=${M.code}): ${M.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const w=setTimeout(()=>{N||(g("连接超时 — 请确认已登录且有活跃会话"),S.close())},5e3);return()=>{clearTimeout(w),S.close(),h.dispose(),p.current=null,f.current=null,u.current=null,a(!1)}},[s,i]),n.useEffect(()=>{if(!s)return;let h,o=0;const j=()=>{const D=l.current,k=f.current,S=p.current;if(!D||!k||!S){o++<30&&requestAnimationFrame(j);return}h=ue(D,k,S)};return j(),()=>h?.()},[s,i,y]);const A=h=>h?new Date(h).toLocaleString():"--";return e.jsx(J,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(Q,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:X("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",y?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:y?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(V,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(G,{"code-path":"src/components/system/LiveMonitorDialog.tsx:198:9",className:"sr-only",children:"审计在线 WebSSH 会话"}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:201:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:202:11",className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[e.jsx(E,{"code-path":"src/components/system/LiveMonitorDialog.tsx:203:13",className:"h-4 w-4 text-emerald-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:204:13",className:"text-[var(--dg-text-primary)] font-medium",children:"终端实时监控"}),t&&e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:206:15",className:"text-[var(--dg-text-muted)] truncate",children:[t.username," · ",t.server_name," (",t.server_ip,") · ",A(t.start_time)]}),v&&e.jsx(L,{"code-path":"src/components/system/LiveMonitorDialog.tsx:211:15",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10 text-xs",children:"● 在线"}),!v&&!x&&e.jsxs(L,{"code-path":"src/components/system/LiveMonitorDialog.tsx:216:15",variant:"outline",className:"border-yellow-500/30 text-yellow-400 bg-yellow-500/10 text-xs",children:[e.jsx(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),x&&e.jsx(L,{"code-path":"src/components/system/LiveMonitorDialog.tsx:222:15",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 text-xs",children:"连接失败"})]}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:227:11",className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:228:13",type:"button",onClick:()=>b(!y),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:y?"退出全屏":"全屏",children:y?e.jsx(ge,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(ye,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:236:13",type:"button",onClick:()=>r(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(de,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),x&&e.jsx("p",{"code-path":"src/components/system/LiveMonitorDialog.tsx:247:11",className:"text-sm text-red-400 px-4 py-2 border-b border-[var(--dg-border)]",children:x}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:l,className:"xterm-terminal-host",style:{height:y?"calc(100vh - 49px)":"520px"}})]})})}function ie(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const r=Math.floor(s/60),i=s%60;if(r<60)return`${r}分${i>0?`${i}秒`:""}`;const c=Math.floor(r/60),l=r%60;return`${c}时${l>0?`${l}分`:""}`}function ke(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function oe(s){return s==="active"?e.jsxs(L,{"code-path":"src/pages/terminal-audit/helpers.tsx:26:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/helpers.tsx:27:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(L,{"code-path":"src/pages/terminal-audit/helpers.tsx:34:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(L,{"code-path":"src/pages/terminal-audit/helpers.tsx:40:5",variant:"outline",cla Line truncated
`).filter(N=>N.trim()),o=[];for(const N of h)try{const w=JSON.parse(N);Array.isArray(w)&&w.length>=3&&o.push({time:w[0],eventType:w[1],data:w[2]})}catch{}if(o.length===0){t.write(A),g(100),u(!1);return}u(!1);const j=o[o.length-1].time;let D=0,k=0;const S=()=>{if(y||D>=o.length){g(100);return}const N=o[D],w=(N.time-k)*1e3;k=N.time,D++;const M=Math.min(w,2e3);p.current=setTimeout(()=>{y||(t.write(N.data),g(Math.round(N.time/j*100)),S())},M)};S()}).catch(b=>{y||(console.error("[Replay] Load failed:",b),a("Failed to load recording data"),u(!1))}),()=>{y=!0,p.current&&clearTimeout(p.current);try{t.dispose()}catch{}l.current=null}},[s,i]),e.jsx(J,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(Q,{"code-path":"src/components/system/ReplayDialog.tsx:154:7",showOverlay:!1,className:"bg-slate-900 border-slate-800 p-0 gap-0",style:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(xe,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(V,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",x>0&&x<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[x,"%"]})]}),e.jsx(G,{"code-path":"src/components/system/ReplayDialog.tsx:162:11",className:"text-slate-500 sr-only",children:"Replay recorded terminal output"})]}),e.jsxs("div",{"code-path":"src/components/system/ReplayDialog.tsx:164:9",className:"relative bg-[#0a0e14]",style:{height:"460px"},children:[f&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:166:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx(Y,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),v&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:171:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx("p",{"code-path":"src/components/system/ReplayDialog.tsx:172:15",className:"text-red-400 text-sm",children:v})}),x>0&&x<100&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:176:13",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-slate-800 z-10",children:e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:177:15",className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${x}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function _e(){const{data:s=[],isLoading:r,refetch:i}=re({page:1,page_size:100,status:"closed"}),[c,l]=n.useState(""),[p,f]=n.useState(null),[u,v]=n.useState(!1),a=s.filter(t=>{const P=c.toLowerCase();return!P||(t.username||"").toLowerCase().includes(P)||(t.server_name||"").toLowerCase().includes(P)||(t.server_ip||"").toLowerCase().includes(P)}),x=t=>{f(t),v(!0)},g=async t=>{try{await R.download(t)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:57:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:58:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:59:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>l(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:67:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>i(),children:[e.jsx(U,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:72:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(I,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(O,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:78:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:79:11",className:"border-t border-slate-800",children:r?e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:81:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:82:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:85:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children: Line truncated
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as oe,o as le,D as U,a as J,m as Q,c as X,d as G,f as ce,B as H,b as de}from"./index-BZzvNKfa.js";import{C as z,a as E}from"./card-B1TdHH8z.js";import{I as $}from"./input-D7JNe8Xd.js";import{T as I,a as O,b as T,c as d,d as q,e as m}from"./table-CQE_AU2l.js";import{x as Z,a as V}from"./vendor-xterm-20M9KZE1.js";import{B as k}from"./badge-IN84WXM6.js";import{m as me,a as pe}from"./xterm-utils-slbfdUHf.js";import{_ as K,L as Y,an as xe,ao as he,X as ue,S as _,R as W,aZ as ge,a_ as ve,A as ee,a$ as fe,x as ye,z as je,v as Se}from"./vendor-icons-DIDdqO_o.js";import{u as se,q as te,b as ae}from"./unwrap-CDkLoNKa.js";import{u as B}from"./useMutation-DvUJDXfD.js";import{t as L,s as be}from"./terminal-BOHXwzFP.js";function ne(s={page:1,page_size:100}){return se({queryKey:te.terminalSessions(s),queryFn:async()=>{const r=await L.list(s);return ae(r)}})}function Ne(){const s=oe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=B({mutationFn:p=>L.kill(p),onSuccess:r}),c=B({mutationFn:p=>L.delete(p),onSuccess:r}),l=B({mutationFn:p=>L.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function Pe(s={page:1,page_size:200}){return se({queryKey:te.sessionCommands(s),queryFn:async()=>{const r=await be.list(s);return ae(r)}})}function we({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[y,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[v,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new V.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=le.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(M);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),me(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=R=>{try{const C=JSON.parse(R.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=R=>{N||g(`连接失败 (code=${R.code}): ${R.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const w=setTimeout(()=>{N||(g("连接超时 — 请确认已登录且有活跃会话"),S.close())},5e3);return()=>{clearTimeout(w),S.close(),h.dispose(),p.current=null,f.current=null,u.current=null,a(!1)}},[s,i]),n.useEffect(()=>{if(!s)return;let h,o=0;const j=()=>{const D=l.current,M=f.current,S=p.current;if(!D||!M||!S){o++<30&&requestAnimationFrame(j);return}h=pe(D,M,S)};return j(),()=>h?.()},[s,i,v]);const A=h=>h?new Date(h).toLocaleString():"--";return e.jsx(U,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:Q("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",v?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:v?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(X,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(G,{"code-path":"src/components/system/LiveMonitorDialog.tsx:198:9",className:"sr-only",children:"审计在线 WebSSH 会话"}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:201:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:202:11",className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[e.jsx(K,{"code-path":"src/components/system/LiveMonitorDialog.tsx:203:13",className:"h-4 w-4 text-emerald-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:204:13",className:"text-[var(--dg-text-primary)] font-medium",children:"终端实时监控"}),t&&e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:206:15",className:"text-[var(--dg-text-muted)] truncate",children:[t.username," · ",t.server_name," (",t.server_ip,") · ",A(t.start_time)]}),y&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:211:15",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10 text-xs",children:"● 在线"}),!y&&!x&&e.jsxs(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:216:15",variant:"outline",className:"border-yellow-500/30 text-yellow-400 bg-yellow-500/10 text-xs",children:[e.jsx(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),x&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:222:15",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 text-xs",children:"连接失败"})]}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:227:11",className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:228:13",type:"button",onClick:()=>b(!v),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:v?"退出全屏":"全屏",children:v?e.jsx(xe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(he,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:236:13",type:"button",onClick:()=>r(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(ue,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),x&&e.jsx("p",{"code-path":"src/components/system/LiveMonitorDialog.tsx:247:11",className:"text-sm text-red-400 px-4 py-2 border-b border-[var(--dg-border)]",children:x}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:l,className:"xterm-terminal-host",style:{height:v?"calc(100vh - 49px)":"520px"}})]})})}function re(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const r=Math.floor(s/60),i=s%60;if(r<60)return`${r}分${i>0?`${i}秒`:""}`;const c=Math.floor(r/60),l=r%60;return`${c}时${l>0?`${l}分`:""}`}function Ce(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function ie(s){return s==="active"?e.jsxs(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:26:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/helpers.tsx:27:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:34:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:40:5",variant:"outline",cla Line truncated
`).filter(N=>N.trim()),o=[];for(const N of h)try{const w=JSON.parse(N);Array.isArray(w)&&w.length>=3&&o.push({time:w[0],eventType:w[1],data:w[2]})}catch{}if(o.length===0){t.write(A),g(100),u(!1);return}u(!1);const j=o[o.length-1].time;let D=0,M=0;const S=()=>{if(v||D>=o.length){g(100);return}const N=o[D],w=(N.time-M)*1e3;M=N.time,D++;const R=Math.min(w,2e3);p.current=setTimeout(()=>{v||(t.write(N.data),g(Math.round(N.time/j*100)),S())},R)};S()}).catch(b=>{v||(console.error("[Replay] Load failed:",b),a("Failed to load recording data"),u(!1))}),()=>{v=!0,p.current&&clearTimeout(p.current);try{t.dispose()}catch{}l.current=null}},[s,i]),e.jsx(U,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/ReplayDialog.tsx:154:7",showOverlay:!1,className:"bg-slate-900 border-slate-800 p-0 gap-0",style:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(X,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",x>0&&x<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[x,"%"]})]}),e.jsx(G,{"code-path":"src/components/system/ReplayDialog.tsx:162:11",className:"text-slate-500 sr-only",children:"Replay recorded terminal output"})]}),e.jsxs("div",{"code-path":"src/components/system/ReplayDialog.tsx:164:9",className:"relative bg-[#0a0e14]",style:{height:"460px"},children:[f&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:166:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx(Y,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),y&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:171:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx("p",{"code-path":"src/components/system/ReplayDialog.tsx:172:15",className:"text-red-400 text-sm",children:y})}),x>0&&x<100&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:176:13",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-slate-800 z-10",children:e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:177:15",className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${x}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function Re(){const{data:s=[],isLoading:r,refetch:i}=ne({page:1,page_size:100,status:"closed"}),[c,l]=n.useState(""),[p,f]=n.useState(null),[u,y]=n.useState(!1),a=s.filter(t=>{const P=c.toLowerCase();return!P||(t.username||"").toLowerCase().includes(P)||(t.server_name||"").toLowerCase().includes(P)||(t.server_ip||"").toLowerCase().includes(P)}),x=t=>{f(t),y(!0)},g=async t=>{try{await L.download(t)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:57:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:58:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:59:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>l(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:67:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>i(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:72:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:78:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:79:11",className:"border-t border-slate-800",children:r?e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:81:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:82:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:85:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children: Line truncated
@@ -0,0 +1 @@
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{C as oe,a as ne,b as Fe,c as He,d as Je}from"./card-B1TdHH8z.js";import{g as Ge,f as Ke,B as v,D as Te,a as je,b as Ve,c as Ne,d as ve,e as Ze,t as j}from"./index-BZzvNKfa.js";import{I as Se}from"./input-D7JNe8Xd.js";import{L as ae}from"./label-Bj0mNUAM.js";import{B as Ce}from"./badge-IN84WXM6.js";import{S as ce,a as re,b as le,c as ie,d as q}from"./select-BFGszUub.js";import{T as qe}from"./textarea-BL_Am_oZ.js";import{k as _}from"./index-DPhaKvWI.js";import{h as Ee,ad as es,a4 as ss,D as ts,N as os,B as ns,i as pe,G as as,d as _e,L as $e,R as cs,P as rs,ai as Me,$ as ls,n as is,S as ds,T as ps}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const de={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},ms=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function M(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(as,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(pe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(ns,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(os,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(ts,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(ss,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(es,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function us(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(p,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let p=f.filter(g=>g.name===c);p.length===0&&(p=f.filter(g=>g.namespace===o.namespace)),p.length===0&&(p=[f[0]]),p.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),H=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:H[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,image:o.image}})}),f.length>0&&T.length>0&&f.forEach(o=>{const i=`service-${o.id}`;let c=[];try{const p=typeof o.selector=="string"?JSON.parse(o.selector||"{}"):o.selector||{},g=Object.entries(p);g.length>0&&(c=T.filter(P=>{let W={};try{W=typeof P.labels=="string"?JSON.parse(P.labels||"{}"):P.labels||{}}catch{}return g.every(([se,G])=>W[se]===G)}))}catch{}c.length===0&&(c=T.filter(p=>p.name===o.nameLine truncated
@@ -1 +0,0 @@
import{i as Ue,j as e,S as Te,E as Fe,N as Je,q as Ge,s as de,G as Ke,k as qe,f as Ze,r as p,B as v,L as je,R as es,D as Ve,a as Ne,b as ve,c as Se,d as Ce,e as ss,t as j}from"./index-BTQygws6.js";import{C as oe,a as ne,b as ts,c as os,d as ns}from"./card-D0oz3NII.js";import{I as Ee}from"./input-C6mE-wO9.js";import{L as ae}from"./label-8e-EC7mH.js";import{B as _e}from"./badge-BsIZhz7S.js";import{S as ce,a as re,b as le,c as ie,d as Z}from"./select-pPlmgAjn.js";import{T as as}from"./textarea-DDxE7TMs.js";import{k as _}from"./index-DSkkspoy.js";import{B as cs}from"./box-CHjdSJYg.js";import{Z as rs}from"./zap-72OjNvOL.js";import{P as Me}from"./pencil-BgEVXj0m.js";import{R as ls}from"./refresh-cw-e9vbQhCy.js";import{P as is}from"./plus-DOS6OUrq.js";import{S as ps}from"./save-w9vZ9YyU.js";import{S as ds}from"./search-BDsFve6h.js";import{T as ms}from"./trash-2-5oUve9eW.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const us=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],$e=Ue("link-2",us),pe={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},xs=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function $(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Te,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(Ke,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(de,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(Ge,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(Je,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(Fe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(rs,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(cs,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Te,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function hs(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(d,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let d=f.filter(g=>g.name===c);d.length===0&&(d=f.filter(g=>g.namespace===o.namespace)),d.length===0&&(d=[f[0]]),d.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),F=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:F[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,imageLine truncated
@@ -0,0 +1 @@
import{r,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{t as y,B as w,D as z,a as Q,b as H,c as J,d as G,p as S,q as le}from"./index-BZzvNKfa.js";import{I as he}from"./input-D7JNe8Xd.js";import{B as j}from"./badge-IN84WXM6.js";import{C as M,a as N,b,c as C}from"./card-B1TdHH8z.js";import{S as ge}from"./stat-strip-D5jCLXat.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-BFGszUub.js";import{T as ue,a as Te,b as F,c as O}from"./tabs-Dx4dxq7o.js";import{L as s}from"./label-Bj0mNUAM.js";import{t as k}from"./trace-L8uY5gM3.js";import{S as je,R as Me,x as Ne,u as fe,aa as ve,J as ye,b as we,a as Se,y as be,Q as Ce,f as De,ab as Ie,ac as Le,ad as Re,a4 as Fe,h as Oe,ae as ke}from"./vendor-icons-DIDdqO_o.js";import"./index-CYARH0Cq.js";const Ke=()=>{const[B,K]=r.useState([]),[p,U]=r.useState([]),[X,E]=r.useState(!1),[f,Z]=r.useState(""),[l,W]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,$]=r.useState(!1),[se,A]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{E(!0);try{const a=await k.getTraces({timeRange:g,service:l,status:h});K(a.data||[])}catch{y.error("获取链路数据失败")}finally{E(!1)}},ne=async()=>{try{const a=await k.getServices(g);U(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await k.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Se,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},de=a=>{switch(a){case"client":return e.jsx(ke,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},ie=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=B.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&i&&c}),pe=Array.from(new Set(B.map(a=>a.serviceName))),xe=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else i.push(u)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,u]=r.useState(!0),x=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),A(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Ce,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(De,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:230:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:232:11",className:"flex items-center gap-2 flex-1 min-w-0",children:[de(a.kind),e.jsx("span",{"code-path":"src/components/monitoLine truncated
@@ -1 +0,0 @@
import{r,t as y,j as e,B as w,P as le,K as he,D as Q,a as q,b as H,c as K,V as ge,d as Z,a3 as S,a4 as ue,C as Te,Q as je,W as Me,o as Ne,a5 as fe,S as ve}from"./index-BTQygws6.js";import{I as ye}from"./input-C6mE-wO9.js";import{B as j}from"./badge-BsIZhz7S.js";import{C as M,a as N,b,c as C}from"./card-D0oz3NII.js";import{S as we}from"./stat-strip-M_Ng3raR.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-pPlmgAjn.js";import{T as Se,a as be,b as B,c as F}from"./tabs-CH1b5gPd.js";import{L as s}from"./label-8e-EC7mH.js";import{t as O}from"./trace-L8uY5gM3.js";import{S as Ce}from"./search-BDsFve6h.js";import{R as De}from"./refresh-cw-e9vbQhCy.js";import{T as Ie}from"./trending-up-CwtABPES.js";import{C as Le}from"./circle-x-CYoA2i-_.js";import{C as Re}from"./code-BxEc8JAj.js";import{B as Be}from"./box-CHjdSJYg.js";import{Z as Fe}from"./zap-72OjNvOL.js";import{A as Oe}from"./arrow-right-QQqkjfZb.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const ea=()=>{const[k,G]=r.useState([]),[p,J]=r.useState([]),[U,A]=r.useState(!1),[f,W]=r.useState(""),[l,X]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,E]=r.useState(!1),[se,$]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{A(!0);try{const a=await O.getTraces({timeRange:g,service:l,status:h});G(a.data||[])}catch{y.error("获取链路数据失败")}finally{A(!1)}},ne=async()=>{try{const a=await O.getServices(g);J(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await O.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(je,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(Te,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},ie=a=>{switch(a){case"client":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},de=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},i=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=k.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),d=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&d&&c}),pe=Array.from(new Set(k.map(a=>a.serviceName))),xe=a=>{const t=new Map,d=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else d.push(u)}),d},z=({span:a,level:t,totalDuration:d})=>{const[c,u]=r.useState(!0),x=d>0?a.duration/d*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),$(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Me,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(Ne,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:23Line truncated
@@ -1 +0,0 @@
import{i as R,f as F,r as o,j as e,B as t,L as I,Y as w,v as O,D as T,a as _,b as A,c as H,t as a}from"./index-BTQygws6.js";import{I as u}from"./input-C6mE-wO9.js";import{B as $}from"./badge-BsIZhz7S.js";import{L as y}from"./label-8e-EC7mH.js";import{d as n}from"./config-CxWPmf4g.js";import{R as q}from"./refresh-cw-e9vbQhCy.js";import{P as K}from"./plus-DOS6OUrq.js";import{P as X}from"./pencil-BgEVXj0m.js";import{T as Y}from"./trash-2-5oUve9eW.js";import{U as J}from"./user-plus-CTbJ7AX7.js";const Q=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],V=R("user-x",Q);function de(){const g=F(),[G,k]=o.useState([]),[C,M]=o.useState(!0),[S,D]=o.useState({}),[z,p]=o.useState(!1),[l,U]=o.useState(null),[i,m]=o.useState(""),[x,h]=o.useState(""),[j,v]=o.useState(!1),[f,N]=o.useState({}),c=async()=>{M(!0);try{const s=await n.getGroups();k(s?.list||[])}catch{a.error("加载失败")}finally{M(!1)}};o.useEffect(()=>{c()},[]);const E=async()=>{if(!i.trim()){a.error("请输入组名");return}v(!0);try{l?await n.updateGroup(l,{name:i,description:x}):await n.createGroup({name:i,description:x}),a.success(l?"已更新":"已创建"),p(!1),c()}catch{a.error("操作失败")}finally{v(!1)}},L=async s=>{if(await g({title:"删除用户组",description:`确定删除「${s.name}」?所有成员和流水线授权将同时移除。`,variant:"destructive"}))try{await n.deleteGroup(s.id),a.success("已删除"),c()}catch{a.error("删除失败")}},b=async s=>{const r=(f[s]||"").trim();if(!r){a.error("输入用户名");return}try{await n.addGroupMember(s,{username:r}),a.success("已添加"),c(),N(d=>({...d,[s]:""}))}catch{a.error("添加失败")}},P=async(s,r,d)=>{if(await g({title:"移除成员",description:`确定从组中移除「${d}」?`}))try{await n.removeGroupMember(s,r),a.success("已移除"),c()}catch{a.error("移除失败")}},B=s=>D(r=>({...r,[s]:!r[s]}));return e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:83:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/UserGroupsManager.tsx:84:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"用户组管理"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"创建用户组,将组授权给流水线,组内成员自动获得流水线权限"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:87:9",className:"flex items-center gap-2",children:[e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:11",variant:"outline",size:"sm",onClick:c,children:[e.jsx(q,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:68",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:89:11",size:"sm",onClick:()=>{U(null),m(""),h(""),p(!0)},children:[e.jsx(K,{"code-path":"src/components/deploy/UserGroupsManager.tsx:90:13",className:"w-4 h-4 mr-1"}),"新建用户组"]})]})]}),C?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:9",className:"flex justify-center py-12",children:e.jsx(I,{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:52",className:"w-6 h-6 animate-spin text-[var(--dg-text-secondary)]"})}):G.length===0?e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:98:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:99:11",className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:100:11",children:"暂无用户组,点击「新建用户组」创建"})]}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:103:9",className:"space-y-3",children:G.map(s=>e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:105:13",className:"border border-[var(--dg-border)] rounded-lg bg-[var(--dg-bg-secondary)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:106:15",className:"flex items-center justify-between p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:107:17",className:"flex items-center gap-3",style:{cursor:"pointer"},onClick:()=>B(s.id),children:[e.jsx(O,{"code-path":"src/components/deploy/UserGroupsManager.tsx:108:19",className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:109:19",children:[e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:110:21",className:"font-medium text-[Line truncated
Loaded 100 of 219 files, more files were not shown because too many files have changed in this diff. Show more