@blade-hq/agent-kit 0.0.0-placeholder.0 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +66 -3
  2. package/dist/AskUserQuestionBlock-CjvG_pUY.d.ts +116 -0
  3. package/dist/SkillStatusBar-DItrW2vv.d.ts +203 -0
  4. package/dist/blade-client-nOsdVlb1.d.ts +1498 -0
  5. package/dist/client/index.d.ts +8036 -0
  6. package/dist/client/index.js +1057 -0
  7. package/dist/client/index.js.map +1 -0
  8. package/dist/licenses-Cxl1xGVy.d.ts +16 -0
  9. package/dist/projection-DIfyh6RK.d.ts +85 -0
  10. package/dist/react/api/licenses.d.ts +7 -0
  11. package/dist/react/api/licenses.js +1477 -0
  12. package/dist/react/api/licenses.js.map +1 -0
  13. package/dist/react/api/vibe-coding.d.ts +55 -0
  14. package/dist/react/api/vibe-coding.js +1503 -0
  15. package/dist/react/api/vibe-coding.js.map +1 -0
  16. package/dist/react/cards/register.d.ts +2 -0
  17. package/dist/react/cards/register.js +4367 -0
  18. package/dist/react/cards/register.js.map +1 -0
  19. package/dist/react/components/chat/index.d.ts +128 -0
  20. package/dist/react/components/chat/index.js +11389 -0
  21. package/dist/react/components/chat/index.js.map +1 -0
  22. package/dist/react/components/plan/index.d.ts +111 -0
  23. package/dist/react/components/plan/index.js +3490 -0
  24. package/dist/react/components/plan/index.js.map +1 -0
  25. package/dist/react/components/session/index.d.ts +53 -0
  26. package/dist/react/components/session/index.js +2175 -0
  27. package/dist/react/components/session/index.js.map +1 -0
  28. package/dist/react/components/workspace/index.d.ts +35 -0
  29. package/dist/react/components/workspace/index.js +2886 -0
  30. package/dist/react/components/workspace/index.js.map +1 -0
  31. package/dist/react/devtools/bridge-devtools/index.d.ts +36 -0
  32. package/dist/react/devtools/bridge-devtools/index.js +692 -0
  33. package/dist/react/devtools/bridge-devtools/index.js.map +1 -0
  34. package/dist/react/index.d.ts +1283 -0
  35. package/dist/react/index.js +14299 -0
  36. package/dist/react/index.js.map +1 -0
  37. package/dist/session-CDeiO81j.d.ts +128 -0
  38. package/package.json +73 -7
  39. package/index.js +0 -1
@@ -0,0 +1,4367 @@
1
+ // src/react/lib/card-registry.ts
2
+ var CardComponentRegistry = class {
3
+ components;
4
+ constructor(initial) {
5
+ if (initial instanceof Map) {
6
+ this.components = new Map(initial);
7
+ } else if (initial) {
8
+ this.components = new Map(Object.entries(initial));
9
+ } else {
10
+ this.components = /* @__PURE__ */ new Map();
11
+ }
12
+ }
13
+ register(type, component) {
14
+ this.components.set(type, component);
15
+ }
16
+ get(type) {
17
+ return this.components.get(type);
18
+ }
19
+ has(type) {
20
+ return this.components.has(type);
21
+ }
22
+ keys() {
23
+ return Array.from(this.components.keys());
24
+ }
25
+ clear() {
26
+ this.components.clear();
27
+ }
28
+ get size() {
29
+ return this.components.size;
30
+ }
31
+ };
32
+ var cardRegistry = new CardComponentRegistry();
33
+
34
+ // src/react/components/card/cards/attraction-card.tsx
35
+ import { Clock, Info, Star, Ticket } from "lucide-react";
36
+ import { jsx, jsxs } from "react/jsx-runtime";
37
+ function AttractionCard({ card }) {
38
+ const payload = card.payload;
39
+ if (!payload || !Array.isArray(payload.attractions)) {
40
+ return /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx("p", { className: "text-red-400 text-sm", children: "\u666F\u70B9\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
41
+ }
42
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4", children: [
43
+ card.title && /* @__PURE__ */ jsx("h3", { className: "font-semibold text-lg text-zinc-100 mb-4", children: card.title }),
44
+ /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payload.attractions.map((attr, index) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-white/10 p-3", children: [
45
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-2", children: [
46
+ /* @__PURE__ */ jsxs("div", { children: [
47
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
48
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-200", children: attr.name }),
49
+ /* @__PURE__ */ jsx("span", { className: "px-1.5 py-0.5 bg-sky-500/20 text-sky-400 text-xs rounded", children: attr.category })
50
+ ] }),
51
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 text-sm text-zinc-400 mt-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
52
+ /* @__PURE__ */ jsx(Star, { className: "w-3 h-3 text-amber-400 fill-amber-400" }),
53
+ /* @__PURE__ */ jsx("span", { children: attr.rating }),
54
+ /* @__PURE__ */ jsxs("span", { className: "text-xs", children: [
55
+ "(",
56
+ attr.reviewCount,
57
+ "\u8BC4\u4EF7)"
58
+ ] })
59
+ ] }) })
60
+ ] }),
61
+ /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-lg font-bold text-orange-400", children: [
62
+ /* @__PURE__ */ jsx(Ticket, { className: "w-4 h-4" }),
63
+ "\xA5",
64
+ attr.ticketPrice
65
+ ] }) })
66
+ ] }),
67
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-sm text-zinc-400 mb-2", children: [
68
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
69
+ /* @__PURE__ */ jsx(Clock, { className: "w-3 h-3" }),
70
+ attr.openTime
71
+ ] }),
72
+ /* @__PURE__ */ jsxs("span", { children: [
73
+ "\u6E38\u73A9\u7EA6",
74
+ attr.duration
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: attr.highlights.map((h, i) => /* @__PURE__ */ jsx(
78
+ "span",
79
+ {
80
+ className: "px-2 py-0.5 bg-white/5 text-zinc-400 text-xs rounded",
81
+ children: h
82
+ },
83
+ i
84
+ )) }),
85
+ attr.tips && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-1 text-xs text-zinc-400 bg-white/5 p-2 rounded", children: [
86
+ /* @__PURE__ */ jsx(Info, { className: "w-3 h-3 mt-0.5 flex-shrink-0" }),
87
+ attr.tips
88
+ ] })
89
+ ] }, index)) })
90
+ ] });
91
+ }
92
+
93
+ // src/react/components/card/cards/cite-card.tsx
94
+ import { ChevronRight } from "lucide-react";
95
+ import { useState } from "react";
96
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
+ function CitationCard({ card }) {
98
+ const payload = card.payload;
99
+ const { citations = [] } = payload || {};
100
+ const [isOpen, setIsOpen] = useState(false);
101
+ if (citations.length === 0) return null;
102
+ return /* @__PURE__ */ jsx2("div", { className: "mt-6 mb-4", children: /* @__PURE__ */ jsxs2("div", { className: "border-t border-white/10 pt-4", children: [
103
+ /* @__PURE__ */ jsxs2(
104
+ "button",
105
+ {
106
+ type: "button",
107
+ onClick: () => setIsOpen(!isOpen),
108
+ className: "flex items-center gap-2 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",
109
+ children: [
110
+ /* @__PURE__ */ jsx2(
111
+ ChevronRight,
112
+ {
113
+ className: `h-4 w-4 transition-transform duration-200 ${isOpen ? "rotate-90" : ""}`
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsxs2("span", { children: [
117
+ citations.length,
118
+ " \u4E2A\u5F15\u7528\u6765\u6E90"
119
+ ] })
120
+ ]
121
+ }
122
+ ),
123
+ isOpen && /* @__PURE__ */ jsx2("div", { className: "mt-4 space-y-0", children: citations.map((citation, index) => /* @__PURE__ */ jsxs2("div", { id: `cite-${citation.id}`, children: [
124
+ index > 0 && /* @__PURE__ */ jsx2("hr", { className: "my-3 border-white/5" }),
125
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-3 py-2", children: [
126
+ /* @__PURE__ */ jsxs2("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-xs text-zinc-500", children: [
127
+ "[",
128
+ citation.id,
129
+ "]"
130
+ ] }),
131
+ /* @__PURE__ */ jsxs2("div", { className: "flex-1 space-y-1", children: [
132
+ /* @__PURE__ */ jsx2("p", { className: "text-sm font-medium leading-relaxed text-zinc-200", children: citation.title }),
133
+ /* @__PURE__ */ jsx2("p", { className: "text-sm text-zinc-400 leading-relaxed", children: citation.content })
134
+ ] })
135
+ ] })
136
+ ] }, citation.id)) })
137
+ ] }) });
138
+ }
139
+
140
+ // src/react/components/card/cards/comprehensive-analysis-card.tsx
141
+ import { Shield, Target, TrendingUp, Trophy } from "lucide-react";
142
+ import { useMemo } from "react";
143
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
144
+ var COLOR_PALETTE = [
145
+ { primary: "#3b82f6", bg: "bg-blue-500", light: "bg-blue-900", border: "border-blue-500" },
146
+ { primary: "#ef4444", bg: "bg-red-500", light: "bg-red-900", border: "border-red-500" },
147
+ { primary: "#10b981", bg: "bg-green-500", light: "bg-green-900", border: "border-green-500" },
148
+ { primary: "#f59e0b", bg: "bg-amber-500", light: "bg-amber-900", border: "border-amber-500" },
149
+ { primary: "#8b5cf6", bg: "bg-purple-500", light: "bg-purple-900", border: "border-purple-500" },
150
+ { primary: "#ec4899", bg: "bg-pink-500", light: "bg-pink-900", border: "border-pink-500" },
151
+ { primary: "#06b6d4", bg: "bg-cyan-500", light: "bg-cyan-900", border: "border-cyan-500" }
152
+ ];
153
+ var ALT_COLOR_PALETTE = [
154
+ { bg: "bg-sky-600", light: "bg-sky-900" },
155
+ { bg: "bg-sky-800", light: "bg-sky-900" },
156
+ { bg: "bg-sky-500", light: "bg-sky-950" },
157
+ { bg: "bg-sky-700", light: "bg-sky-900" },
158
+ { bg: "bg-sky-400", light: "bg-sky-950" }
159
+ ];
160
+ var getPlanColor = (index) => COLOR_PALETTE[index % COLOR_PALETTE.length];
161
+ var getAltPlanColor = (index) => ALT_COLOR_PALETTE[index % ALT_COLOR_PALETTE.length];
162
+ var levelColors = {
163
+ low: "text-sky-300",
164
+ medium: "text-sky-500",
165
+ high: "text-sky-400"
166
+ };
167
+ var getRiskLabel = (level) => {
168
+ switch (level) {
169
+ case "low":
170
+ return "\u4F4E";
171
+ case "medium":
172
+ return "\u4E2D";
173
+ case "high":
174
+ return "\u9AD8";
175
+ }
176
+ };
177
+ function normalizePlan(p) {
178
+ const effRatio = p.efficiencyRatio ?? p.efficiency ?? 0;
179
+ const feasNum = typeof p.feasibility === "number" ? p.feasibility : p.feasibility === "high" ? 90 : p.feasibility === "medium" ? 60 : 30;
180
+ return {
181
+ ...p,
182
+ planType: p.planType ?? p.name ?? "\u672A\u547D\u540D\u65B9\u6848",
183
+ efficiencyRatio: effRatio,
184
+ feasibilityScore: p.feasibilityScore ?? feasNum,
185
+ survival: p.survival ?? Math.max(0, 100 - p.ourLossRate)
186
+ };
187
+ }
188
+ function ComprehensiveAnalysisCard({ card }) {
189
+ const payload = card.payload;
190
+ const title = card.title || payload?.title || "\u7EFC\u5408\u5206\u6790\u5BF9\u6BD4";
191
+ const plans = useMemo(() => (payload?.plans || []).map(normalizePlan), [payload?.plans]);
192
+ const recommendedPlan = payload?.recommendedPlan;
193
+ const alternativePlans = payload?.alternativePlans || [];
194
+ const decisionPoints = payload?.decisionPoints || [];
195
+ const analysis = payload?.analysis;
196
+ const calculatedBestPlan = useMemo(() => {
197
+ if (plans.length === 0) return null;
198
+ return plans.reduce(
199
+ (best, current) => current.costBenefit > best.costBenefit ? current : best
200
+ );
201
+ }, [plans]);
202
+ const displayRecommendedPlan = recommendedPlan || calculatedBestPlan?.planType;
203
+ const bestMetrics = useMemo(() => {
204
+ if (plans.length === 0) return {};
205
+ return {
206
+ casualty: plans.reduce(
207
+ (best, current) => current.enemyCasualtyRate > best.enemyCasualtyRate ? current : best
208
+ ).planType,
209
+ loss: plans.reduce(
210
+ (best, current) => current.ourLossRate < best.ourLossRate ? current : best
211
+ ).planType,
212
+ costBenefit: plans.reduce(
213
+ (best, current) => current.costBenefit > best.costBenefit ? current : best
214
+ ).planType,
215
+ efficiency: plans.reduce(
216
+ (best, current) => current.efficiencyRatio > best.efficiencyRatio ? current : best
217
+ ).planType
218
+ };
219
+ }, [plans]);
220
+ const radarSize = 400;
221
+ const radarCenter = radarSize / 2;
222
+ const radarRadius = radarSize / 2 - 60;
223
+ const maxCostBenefit = Math.max(100, ...plans.map((p) => p.costBenefit ?? 0));
224
+ const axes = [
225
+ { key: "enemyCasualtyRate", label: "\u76EE\u6807\u8FBE\u6210", max: 100 },
226
+ { key: "efficiencyRatio", label: "\u4F5C\u6218\u6548\u7387", max: 100 },
227
+ { key: "costBenefit", label: "\u6548\u8D39\u6BD4", max: maxCostBenefit },
228
+ { key: "survival", label: "\u751F\u5B58\u80FD\u529B", max: 100 },
229
+ { key: "feasibilityScore", label: "\u53EF\u884C\u6027", max: 100 }
230
+ ];
231
+ const angleStep = 2 * Math.PI / axes.length;
232
+ const getPoint = (axisIndex, value, max) => {
233
+ const angle = axisIndex * angleStep - Math.PI / 2;
234
+ const r = value / max * radarRadius;
235
+ return {
236
+ x: radarCenter + r * Math.cos(angle),
237
+ y: radarCenter + r * Math.sin(angle)
238
+ };
239
+ };
240
+ const generatePath = (plan) => {
241
+ const values = [
242
+ plan.enemyCasualtyRate ?? 0,
243
+ plan.efficiencyRatio ?? 0,
244
+ plan.costBenefit ?? 0,
245
+ plan.survival ?? 0,
246
+ plan.feasibilityScore ?? 0
247
+ ];
248
+ const points = values.map((value, index) => {
249
+ const max = axes[index].max;
250
+ return getPoint(index, value, max);
251
+ });
252
+ return `${points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ")} Z`;
253
+ };
254
+ return /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-white/10 bg-white/5", children: [
255
+ /* @__PURE__ */ jsx3("div", { className: "p-4 border-b border-white/10", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
256
+ /* @__PURE__ */ jsx3("h3", { className: "font-semibold text-lg text-foreground", children: title }),
257
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-4 text-sm text-muted-foreground", children: [
258
+ /* @__PURE__ */ jsxs3("span", { children: [
259
+ "\u65B9\u6848\u6570: ",
260
+ plans.length
261
+ ] }),
262
+ displayRecommendedPlan && /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-1 text-sky-400 font-semibold", children: [
263
+ /* @__PURE__ */ jsx3(Trophy, { className: "h-4 w-4" }),
264
+ "\u63A8\u8350: ",
265
+ displayRecommendedPlan
266
+ ] })
267
+ ] })
268
+ ] }) }),
269
+ /* @__PURE__ */ jsxs3("div", { className: "p-4 space-y-6", children: [
270
+ /* @__PURE__ */ jsx3("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs3("table", { className: "w-full text-sm border-collapse", children: [
271
+ /* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
272
+ /* @__PURE__ */ jsx3("th", { className: "text-left p-2 text-secondary-foreground", children: "\u6307\u6807" }),
273
+ plans.map((plan) => /* @__PURE__ */ jsx3("th", { className: "text-center p-2 text-secondary-foreground", children: plan.planType }, plan.planType)),
274
+ /* @__PURE__ */ jsx3("th", { className: "text-center p-2 text-secondary-foreground", children: "\u6700\u4F18" })
275
+ ] }) }),
276
+ /* @__PURE__ */ jsxs3("tbody", { children: [
277
+ /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
278
+ /* @__PURE__ */ jsxs3("td", { className: "p-2 flex items-center gap-2 text-secondary-foreground", children: [
279
+ /* @__PURE__ */ jsx3(Target, { className: "h-4 w-4 text-muted-foreground" }),
280
+ /* @__PURE__ */ jsx3("span", { children: "\u76EE\u6807\u8FBE\u6210\u7387" })
281
+ ] }),
282
+ plans.map((plan) => {
283
+ const isBest = plan.planType === bestMetrics.casualty;
284
+ return /* @__PURE__ */ jsx3(
285
+ "td",
286
+ {
287
+ className: `text-center p-2 ${isBest ? "bg-sky-950" : ""}`,
288
+ children: /* @__PURE__ */ jsxs3("span", { className: `font-bold ${isBest ? "text-sky-400" : "text-foreground"}`, children: [
289
+ plan.enemyCasualtyRate.toFixed(1),
290
+ "%"
291
+ ] })
292
+ },
293
+ plan.planType
294
+ );
295
+ }),
296
+ /* @__PURE__ */ jsx3("td", { className: "text-center p-2 font-semibold text-foreground", children: bestMetrics.casualty })
297
+ ] }),
298
+ /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
299
+ /* @__PURE__ */ jsxs3("td", { className: "p-2 flex items-center gap-2 text-secondary-foreground", children: [
300
+ /* @__PURE__ */ jsx3(Shield, { className: "h-4 w-4 text-muted-foreground" }),
301
+ /* @__PURE__ */ jsx3("span", { children: "\u6211\u65B9\u635F\u5931\u7387" })
302
+ ] }),
303
+ plans.map((plan) => {
304
+ const isBest = plan.planType === bestMetrics.loss;
305
+ return /* @__PURE__ */ jsx3(
306
+ "td",
307
+ {
308
+ className: `text-center p-2 ${isBest ? "bg-sky-950" : ""}`,
309
+ children: /* @__PURE__ */ jsxs3("span", { className: `font-bold ${isBest ? "text-sky-400" : "text-foreground"}`, children: [
310
+ plan.ourLossRate.toFixed(1),
311
+ "%"
312
+ ] })
313
+ },
314
+ plan.planType
315
+ );
316
+ }),
317
+ /* @__PURE__ */ jsx3("td", { className: "text-center p-2 font-semibold text-foreground", children: bestMetrics.loss })
318
+ ] }),
319
+ /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
320
+ /* @__PURE__ */ jsxs3("td", { className: "p-2 flex items-center gap-2 text-secondary-foreground", children: [
321
+ /* @__PURE__ */ jsx3(TrendingUp, { className: "h-4 w-4 text-muted-foreground" }),
322
+ /* @__PURE__ */ jsx3("span", { children: "\u6210\u672C\u6548\u76CA\u6BD4" })
323
+ ] }),
324
+ plans.map((plan) => {
325
+ const isBest = plan.planType === bestMetrics.costBenefit;
326
+ return /* @__PURE__ */ jsx3(
327
+ "td",
328
+ {
329
+ className: `text-center p-2 ${isBest ? "bg-sky-950" : ""}`,
330
+ children: /* @__PURE__ */ jsx3("span", { className: `font-bold ${isBest ? "text-sky-400" : "text-foreground"}`, children: plan.costBenefit.toFixed(2) })
331
+ },
332
+ plan.planType
333
+ );
334
+ }),
335
+ /* @__PURE__ */ jsx3("td", { className: "text-center p-2 font-semibold text-foreground", children: bestMetrics.costBenefit })
336
+ ] }),
337
+ /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
338
+ /* @__PURE__ */ jsx3("td", { className: "p-2 text-secondary-foreground", children: "\u98CE\u9669\u7B49\u7EA7" }),
339
+ plans.map((plan) => /* @__PURE__ */ jsx3("td", { className: "text-center p-2", children: /* @__PURE__ */ jsx3("span", { className: `font-semibold ${levelColors[plan.riskLevel]}`, children: getRiskLabel(plan.riskLevel) }) }, plan.planType)),
340
+ /* @__PURE__ */ jsx3("td", { className: "text-center p-2 text-muted-foreground", children: "-" })
341
+ ] }),
342
+ /* @__PURE__ */ jsxs3("tr", { className: "border-b border-white/10", children: [
343
+ /* @__PURE__ */ jsx3("td", { className: "p-2 text-secondary-foreground", children: "\u53EF\u884C\u6027" }),
344
+ plans.map((plan) => {
345
+ const fLabel = typeof plan.feasibility === "number" ? `${plan.feasibility}%` : getRiskLabel(plan.feasibility);
346
+ const fColor = typeof plan.feasibility === "number" ? "text-foreground" : levelColors[plan.feasibility];
347
+ return /* @__PURE__ */ jsx3("td", { className: "text-center p-2", children: /* @__PURE__ */ jsx3("span", { className: `font-semibold ${fColor}`, children: fLabel }) }, plan.planType);
348
+ }),
349
+ /* @__PURE__ */ jsx3("td", { className: "text-center p-2 text-muted-foreground", children: "-" })
350
+ ] })
351
+ ] })
352
+ ] }) }),
353
+ displayRecommendedPlan && /* @__PURE__ */ jsx3("div", { className: "p-4 bg-gradient-to-r from-sky-950 to-sky-900 rounded-lg border-2 border-sky-500", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
354
+ /* @__PURE__ */ jsx3(Trophy, { className: "h-6 w-6 text-sky-400 flex-shrink-0 mt-1" }),
355
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1", children: [
356
+ /* @__PURE__ */ jsxs3("h3", { className: "text-lg font-bold text-sky-300 mb-2", children: [
357
+ "\u9996\u9009\u65B9\u6848\uFF1A",
358
+ displayRecommendedPlan
359
+ ] }),
360
+ analysis && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: analysis }),
361
+ (() => {
362
+ const plan = plans.find((p) => p.planType === displayRecommendedPlan);
363
+ if (!plan) return null;
364
+ return /* @__PURE__ */ jsxs3("div", { className: "mt-3 grid grid-cols-4 gap-2 text-sm", children: [
365
+ /* @__PURE__ */ jsxs3("div", { className: "p-2 bg-muted rounded", children: [
366
+ /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "\u8FBE\u6210\u7387" }),
367
+ /* @__PURE__ */ jsxs3("div", { className: "font-bold text-sky-400", children: [
368
+ plan.enemyCasualtyRate.toFixed(1),
369
+ "%"
370
+ ] })
371
+ ] }),
372
+ /* @__PURE__ */ jsxs3("div", { className: "p-2 bg-muted rounded", children: [
373
+ /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "\u635F\u5931\u7387" }),
374
+ /* @__PURE__ */ jsxs3("div", { className: "font-bold text-sky-400", children: [
375
+ plan.ourLossRate.toFixed(1),
376
+ "%"
377
+ ] })
378
+ ] }),
379
+ /* @__PURE__ */ jsxs3("div", { className: "p-2 bg-muted rounded", children: [
380
+ /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "\u6548\u76CA\u6BD4" }),
381
+ /* @__PURE__ */ jsx3("div", { className: "font-bold text-sky-400", children: plan.costBenefit.toFixed(2) })
382
+ ] }),
383
+ /* @__PURE__ */ jsxs3("div", { className: "p-2 bg-muted rounded", children: [
384
+ /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "\u98CE\u9669" }),
385
+ /* @__PURE__ */ jsx3("div", { className: "font-bold text-sky-400", children: getRiskLabel(plan.riskLevel) })
386
+ ] })
387
+ ] });
388
+ })()
389
+ ] })
390
+ ] }) }),
391
+ alternativePlans.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
392
+ /* @__PURE__ */ jsx3("h4", { className: "text-sm font-semibold text-foreground", children: "\u5907\u9009\u65B9\u6848" }),
393
+ alternativePlans.map((alt, index) => {
394
+ const colors = getAltPlanColor(index);
395
+ return /* @__PURE__ */ jsxs3("div", { className: `p-3 rounded-lg border border-white/10 ${colors.light}`, children: [
396
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 mb-1", children: [
397
+ /* @__PURE__ */ jsx3("div", { className: `w-3 h-3 rounded ${colors.bg}` }),
398
+ /* @__PURE__ */ jsx3("span", { className: "font-semibold text-foreground", children: alt.planType ?? alt.name })
399
+ ] }),
400
+ /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: alt.reason ?? alt.description }),
401
+ alt.advantage && /* @__PURE__ */ jsxs3("p", { className: "text-xs text-sky-400 mt-1", children: [
402
+ "\u4F18\u52BF: ",
403
+ alt.advantage
404
+ ] }),
405
+ alt.disadvantage && /* @__PURE__ */ jsxs3("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
406
+ "\u52A3\u52BF: ",
407
+ alt.disadvantage
408
+ ] })
409
+ ] }, index);
410
+ })
411
+ ] }),
412
+ decisionPoints.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
413
+ /* @__PURE__ */ jsx3("h4", { className: "text-sm font-semibold text-foreground", children: "\u5173\u952E\u51B3\u7B56\u70B9" }),
414
+ decisionPoints.map((point, index) => /* @__PURE__ */ jsxs3(
415
+ "div",
416
+ {
417
+ className: "p-4 bg-card rounded-lg border border-border",
418
+ children: [
419
+ /* @__PURE__ */ jsx3("h5", { className: "font-semibold mb-2 text-foreground", children: point.title ?? point.point }),
420
+ point.description && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground mb-3", children: point.description }),
421
+ /* @__PURE__ */ jsxs3("div", { className: "space-y-1", children: [
422
+ /* @__PURE__ */ jsx3("div", { className: "text-xs font-semibold text-muted-foreground", children: "\u6743\u8861\u8003\u8651\uFF1A" }),
423
+ (point.tradeoffs ?? []).map((tradeoff, i) => /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 text-sm", children: [
424
+ /* @__PURE__ */ jsx3("span", { className: "text-muted-foreground", children: "\u2022" }),
425
+ /* @__PURE__ */ jsx3("span", { className: "text-muted-foreground", children: tradeoff })
426
+ ] }, i))
427
+ ] })
428
+ ]
429
+ },
430
+ index
431
+ ))
432
+ ] }),
433
+ /* @__PURE__ */ jsxs3("div", { className: "p-4 bg-white/5 rounded-lg", children: [
434
+ /* @__PURE__ */ jsx3("h4", { className: "text-sm font-semibold mb-3 text-foreground", children: "\u7EFC\u5408\u80FD\u529B\u96F7\u8FBE\u56FE" }),
435
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center", children: [
436
+ /* @__PURE__ */ jsxs3(
437
+ "svg",
438
+ {
439
+ width: radarSize,
440
+ height: radarSize,
441
+ viewBox: `0 0 ${radarSize} ${radarSize}`,
442
+ className: "mb-4",
443
+ role: "img",
444
+ children: [
445
+ /* @__PURE__ */ jsx3("title", { children: "\u7EFC\u5408\u80FD\u529B\u96F7\u8FBE\u56FE" }),
446
+ [0.2, 0.4, 0.6, 0.8, 1].map((scale, i) => /* @__PURE__ */ jsx3(
447
+ "circle",
448
+ {
449
+ cx: radarCenter,
450
+ cy: radarCenter,
451
+ r: radarRadius * scale,
452
+ fill: "none",
453
+ stroke: "currentColor",
454
+ strokeWidth: "1",
455
+ className: "text-muted-foreground/30"
456
+ },
457
+ i
458
+ )),
459
+ axes.map((axis, index) => {
460
+ const endPoint = getPoint(index, axis.max, axis.max);
461
+ const labelPoint = getPoint(index, axis.max * 1.2, axis.max);
462
+ return /* @__PURE__ */ jsxs3("g", { children: [
463
+ /* @__PURE__ */ jsx3(
464
+ "line",
465
+ {
466
+ x1: radarCenter,
467
+ y1: radarCenter,
468
+ x2: endPoint.x,
469
+ y2: endPoint.y,
470
+ stroke: "currentColor",
471
+ strokeWidth: "1",
472
+ className: "text-muted-foreground/30"
473
+ }
474
+ ),
475
+ /* @__PURE__ */ jsx3(
476
+ "text",
477
+ {
478
+ x: labelPoint.x,
479
+ y: labelPoint.y,
480
+ textAnchor: "middle",
481
+ dominantBaseline: "middle",
482
+ className: "text-xs font-semibold fill-zinc-300",
483
+ children: axis.label
484
+ }
485
+ )
486
+ ] }, index);
487
+ }),
488
+ plans.map((plan, index) => {
489
+ const colors = getPlanColor(index);
490
+ const path = generatePath(plan);
491
+ return /* @__PURE__ */ jsx3("g", { children: /* @__PURE__ */ jsx3(
492
+ "path",
493
+ {
494
+ d: path,
495
+ fill: colors.primary,
496
+ fillOpacity: "0.25",
497
+ stroke: colors.primary,
498
+ strokeWidth: "3",
499
+ className: "transition-all duration-300 hover:fill-opacity-30"
500
+ }
501
+ ) }, index);
502
+ }),
503
+ plans.map((plan, planIndex) => {
504
+ const colors = getPlanColor(planIndex);
505
+ const feasibilityScore = plan.feasibility === "high" ? 90 : plan.feasibility === "medium" ? 70 : 50;
506
+ const values = [
507
+ plan.enemyCasualtyRate,
508
+ plan.efficiencyRatio,
509
+ plan.costBenefit,
510
+ 100 - plan.ourLossRate,
511
+ feasibilityScore
512
+ ];
513
+ return values.map((value, axisIndex) => {
514
+ const max = axes[axisIndex].max;
515
+ const point = getPoint(axisIndex, value, max);
516
+ return /* @__PURE__ */ jsx3(
517
+ "circle",
518
+ {
519
+ cx: point.x,
520
+ cy: point.y,
521
+ r: "5",
522
+ fill: colors.primary,
523
+ stroke: "white",
524
+ strokeWidth: "2",
525
+ className: "transition-all duration-300"
526
+ },
527
+ `${planIndex}-${axisIndex}`
528
+ );
529
+ });
530
+ })
531
+ ]
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsx3("div", { className: "flex gap-6 justify-center flex-wrap", children: plans.map((plan, index) => {
535
+ const colors = getPlanColor(index);
536
+ return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
537
+ /* @__PURE__ */ jsx3(
538
+ "div",
539
+ {
540
+ className: "w-4 h-4 rounded",
541
+ style: { backgroundColor: colors.primary }
542
+ }
543
+ ),
544
+ /* @__PURE__ */ jsx3("span", { className: "text-sm font-semibold text-foreground", children: plan.planType })
545
+ ] }, index);
546
+ }) })
547
+ ] })
548
+ ] })
549
+ ] })
550
+ ] });
551
+ }
552
+
553
+ // src/react/components/card/cards/conflict-detection-card.tsx
554
+ import { AlertTriangle, MapPin } from "lucide-react";
555
+ import { memo } from "react";
556
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
557
+ var getSeverityColor = (severity) => {
558
+ if (severity >= 5) return "text-red-400";
559
+ if (severity >= 4) return "text-orange-400";
560
+ if (severity >= 3) return "text-yellow-400";
561
+ if (severity >= 2) return "text-blue-400";
562
+ return "text-gray-400";
563
+ };
564
+ var getSeverityBgColor = (severity) => {
565
+ if (severity >= 5) return "bg-red-900/30";
566
+ if (severity >= 4) return "bg-orange-900/30";
567
+ if (severity >= 3) return "bg-yellow-900/30";
568
+ if (severity >= 2) return "bg-blue-900/30";
569
+ return "bg-gray-900/30";
570
+ };
571
+ var getSeverityLabel = (severity) => {
572
+ if (severity >= 5) return "\u5371\u6025";
573
+ if (severity >= 4) return "\u4E25\u91CD";
574
+ if (severity >= 3) return "\u4E2D\u7B49";
575
+ if (severity >= 2) return "\u8F7B\u5FAE";
576
+ return "\u6700\u4F4E";
577
+ };
578
+ function ConflictDetectionCardComponent({ card }) {
579
+ const payload = card.payload;
580
+ const conflicts = payload?.conflicts || [];
581
+ const description = payload?.description;
582
+ const title = card.title || "\u51B2\u7A81\u533A\u57DF\u5C55\u793A";
583
+ const sortedConflicts = [...conflicts].sort((a, b) => (b.severity || 0) - (a.severity || 0));
584
+ return /* @__PURE__ */ jsxs4("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
585
+ /* @__PURE__ */ jsx4("div", { className: "px-6 pb-4 pt-6", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
586
+ /* @__PURE__ */ jsx4(AlertTriangle, { className: "h-5 w-5 text-amber-500" }),
587
+ /* @__PURE__ */ jsx4("span", { className: "text-lg font-semibold", children: title }),
588
+ /* @__PURE__ */ jsxs4("span", { className: "ml-auto text-sm font-normal text-[hsl(var(--muted-foreground))]", children: [
589
+ "\u68C0\u6D4B\u5230 ",
590
+ conflicts.length,
591
+ " \u4E2A\u51B2\u7A81"
592
+ ] })
593
+ ] }) }),
594
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-4 px-6 pb-6", children: [
595
+ description && /* @__PURE__ */ jsx4("p", { className: "border-l-2 border-amber-500 pl-3 text-sm text-[hsl(var(--muted-foreground))]", children: description }),
596
+ /* @__PURE__ */ jsx4("div", { className: "space-y-3", children: sortedConflicts.map((conflict) => /* @__PURE__ */ jsx4(
597
+ "div",
598
+ {
599
+ className: `rounded-lg border border-[hsl(var(--border))] p-4 ${getSeverityBgColor(conflict.severity || 1)}`,
600
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-4", children: [
601
+ /* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-2", children: [
602
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
603
+ /* @__PURE__ */ jsx4("span", { className: "font-semibold", children: conflict.name }),
604
+ /* @__PURE__ */ jsx4(
605
+ "span",
606
+ {
607
+ className: `rounded-full px-2 py-0.5 text-xs font-medium ${getSeverityColor(conflict.severity || 1)} ${getSeverityBgColor(conflict.severity || 1)}`,
608
+ children: getSeverityLabel(conflict.severity || 1)
609
+ }
610
+ ),
611
+ conflict.type && /* @__PURE__ */ jsx4("span", { className: "rounded-full bg-gray-700 px-2 py-0.5 text-xs text-gray-300", children: conflict.type })
612
+ ] }),
613
+ conflict.description && /* @__PURE__ */ jsx4("p", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: conflict.description }),
614
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
615
+ /* @__PURE__ */ jsx4(MapPin, { className: "h-3 w-3" }),
616
+ /* @__PURE__ */ jsxs4("span", { children: [
617
+ conflict.lat.toFixed(4),
618
+ ", ",
619
+ conflict.lon.toFixed(4)
620
+ ] })
621
+ ] })
622
+ ] }),
623
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center", children: [
624
+ /* @__PURE__ */ jsx4(
625
+ "div",
626
+ {
627
+ className: `text-2xl font-bold ${getSeverityColor(conflict.severity || 1)}`,
628
+ children: conflict.severity || "-"
629
+ }
630
+ ),
631
+ /* @__PURE__ */ jsx4("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u4E25\u91CD\u7A0B\u5EA6" })
632
+ ] })
633
+ ] })
634
+ },
635
+ conflict.id
636
+ )) }),
637
+ conflicts.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "py-8 text-center text-[hsl(var(--muted-foreground))]", children: [
638
+ /* @__PURE__ */ jsx4(AlertTriangle, { className: "mx-auto mb-2 h-12 w-12 opacity-50" }),
639
+ /* @__PURE__ */ jsx4("p", { children: "\u5F53\u524D\u5206\u6790\u672A\u68C0\u6D4B\u5230\u51B2\u7A81" })
640
+ ] })
641
+ ] })
642
+ ] });
643
+ }
644
+ var ConflictDetectionCard = memo(ConflictDetectionCardComponent);
645
+
646
+ // src/react/components/card/cards/counter.tsx
647
+ import { useMemo as useMemo2 } from "react";
648
+
649
+ // src/react/hooks/use-card-state.ts
650
+ import { useCallback, useEffect, useState as useState2 } from "react";
651
+
652
+ // src/react/stores/card-state-store.ts
653
+ import { create } from "zustand";
654
+
655
+ // src/react/stores/client-aware.ts
656
+ function createClientActions(set) {
657
+ return {
658
+ _client: null,
659
+ setClient: (client) => set({ _client: client })
660
+ };
661
+ }
662
+
663
+ // src/react/stores/card-state-store.ts
664
+ var useCardStateStore = create((set, get) => ({
665
+ ...createClientActions(set),
666
+ states: {},
667
+ getCardState: (cardId) => {
668
+ return get().states[cardId];
669
+ },
670
+ setCardState: (cardId, state) => {
671
+ set((prev) => ({
672
+ states: { ...prev.states, [cardId]: state }
673
+ }));
674
+ },
675
+ removeCardState: (cardId) => {
676
+ set((prev) => {
677
+ const { [cardId]: _, ...rest } = prev.states;
678
+ return { states: rest };
679
+ });
680
+ },
681
+ clearAllStates: () => {
682
+ set({ states: {} });
683
+ }
684
+ }));
685
+
686
+ // src/react/hooks/use-card-state.ts
687
+ function useCardState(cardId, initialValue) {
688
+ const getCardState = useCardStateStore((state2) => state2.getCardState);
689
+ const setCardState = useCardStateStore((state2) => state2.setCardState);
690
+ const storedValue = getCardState(cardId);
691
+ const [state, setStateInternal] = useState2(storedValue ?? initialValue);
692
+ useEffect(() => {
693
+ if (storedValue === void 0) {
694
+ setCardState(cardId, initialValue);
695
+ }
696
+ }, [cardId, initialValue, storedValue, setCardState]);
697
+ const setState = useCallback(
698
+ (value) => {
699
+ setStateInternal((prevState) => {
700
+ const newValue = typeof value === "function" ? value(prevState) : value;
701
+ setCardState(cardId, newValue);
702
+ return newValue;
703
+ });
704
+ },
705
+ [cardId, setCardState]
706
+ );
707
+ return [state, setState];
708
+ }
709
+
710
+ // src/react/components/card/cards/counter.tsx
711
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
712
+ function Counter(props) {
713
+ const payload = props.card.payload;
714
+ const cardId = useMemo2(() => `counter-${props.card.id}`, [props.card.id]);
715
+ const [count, setCount] = useCardState(cardId, payload?.initialValue || 0);
716
+ return /* @__PURE__ */ jsxs5("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4 flex flex-col", children: [
717
+ /* @__PURE__ */ jsxs5("p", { className: "text-sm text-zinc-200", children: [
718
+ "\u8BA1\u6570: ",
719
+ /* @__PURE__ */ jsx5("span", { className: "font-semibold text-sky-400", children: count })
720
+ ] }),
721
+ /* @__PURE__ */ jsxs5("div", { className: "mt-3 flex gap-2", children: [
722
+ /* @__PURE__ */ jsx5(
723
+ "button",
724
+ {
725
+ type: "button",
726
+ onClick: () => setCount(count + 1),
727
+ className: "rounded-md bg-sky-600 px-3 py-1 text-xs font-medium text-white hover:bg-sky-500 transition-colors",
728
+ children: "\u589E\u52A0"
729
+ }
730
+ ),
731
+ /* @__PURE__ */ jsx5(
732
+ "button",
733
+ {
734
+ type: "button",
735
+ onClick: () => setCount(count - 1),
736
+ className: "rounded-md bg-zinc-700 px-3 py-1 text-xs font-medium text-zinc-200 hover:bg-zinc-600 transition-colors",
737
+ children: "\u51CF\u5C11"
738
+ }
739
+ )
740
+ ] })
741
+ ] });
742
+ }
743
+
744
+ // src/react/components/card/cards/damage-effect-card.tsx
745
+ import { Download, Settings } from "lucide-react";
746
+ import { memo as memo2, useCallback as useCallback2, useMemo as useMemo3 } from "react";
747
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
748
+ var calculateComprehensiveScore = (plan, weights) => {
749
+ let score = 0;
750
+ for (const [key, value] of Object.entries(plan.metrics)) {
751
+ const weight = weights[key] || 0;
752
+ score += value * weight;
753
+ }
754
+ return score;
755
+ };
756
+ var normalizeWeights = (weights, changedKey, newValue) => {
757
+ const normalized = { ...weights };
758
+ normalized[changedKey] = newValue;
759
+ const remainingWeight = 1 - newValue;
760
+ const otherWeightsSum = Object.entries(weights).filter(([key]) => key !== changedKey).reduce((sum, [, value]) => sum + value, 0);
761
+ if (otherWeightsSum === 0) {
762
+ const otherKeys = Object.keys(weights).filter((k) => k !== changedKey);
763
+ const equalWeight = remainingWeight / otherKeys.length;
764
+ for (const key of otherKeys) {
765
+ normalized[key] = equalWeight;
766
+ }
767
+ } else {
768
+ const scaleFactor = remainingWeight / otherWeightsSum;
769
+ for (const key of Object.keys(weights)) {
770
+ if (key !== changedKey) {
771
+ normalized[key] = weights[key] * scaleFactor;
772
+ }
773
+ }
774
+ }
775
+ return normalized;
776
+ };
777
+ var getPlanColor2 = (index) => {
778
+ const colors = [
779
+ { primary: "#0284c7", bg: "bg-sky-600", light: "bg-sky-900" },
780
+ { primary: "#075985", bg: "bg-sky-800", light: "bg-sky-900" },
781
+ { primary: "#0c4a6e", bg: "bg-sky-900", light: "bg-sky-900" }
782
+ ];
783
+ return colors[index % colors.length];
784
+ };
785
+ var DamageEffectControlPanel = memo2(function DamageEffectControlPanel2({
786
+ cardId,
787
+ card
788
+ }) {
789
+ const [showLog, setShowLog] = useCardState(`${cardId}-showLog`, false);
790
+ const toggleShowLog = useCallback2(() => {
791
+ setShowLog(!showLog);
792
+ }, [showLog, setShowLog]);
793
+ const handleDownload = useCallback2(() => {
794
+ try {
795
+ const jsonContent = JSON.stringify(card, null, 2);
796
+ const blob = new Blob([jsonContent], { type: "application/json" });
797
+ const url = URL.createObjectURL(blob);
798
+ const link = document.createElement("a");
799
+ link.href = url;
800
+ link.download = `${card.title || "damage-effect"}.json`;
801
+ document.body.appendChild(link);
802
+ link.click();
803
+ document.body.removeChild(link);
804
+ URL.revokeObjectURL(url);
805
+ } catch (err) {
806
+ console.error("\u4E0B\u8F7D\u5931\u8D25:", err);
807
+ }
808
+ }, [card]);
809
+ return /* @__PURE__ */ jsxs6("div", { className: "border-t border-[hsl(var(--border))] p-4", children: [
810
+ /* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
811
+ /* @__PURE__ */ jsx6(
812
+ "button",
813
+ {
814
+ type: "button",
815
+ onClick: toggleShowLog,
816
+ className: `rounded-md px-3 py-1.5 text-sm ${showLog ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "border border-[hsl(var(--border))] text-[hsl(var(--foreground))]"}`,
817
+ children: "\u67E5\u770B\u65E5\u5FD7"
818
+ }
819
+ ),
820
+ /* @__PURE__ */ jsxs6(
821
+ "button",
822
+ {
823
+ type: "button",
824
+ onClick: handleDownload,
825
+ title: "\u4E0B\u8F7D\u6BC1\u4F24\u6548\u679C\u6570\u636E",
826
+ className: "flex items-center gap-1 rounded-md border border-[hsl(var(--border))] px-3 py-1.5 text-sm text-[hsl(var(--foreground))]",
827
+ children: [
828
+ /* @__PURE__ */ jsx6(Download, { className: "h-4 w-4" }),
829
+ "\u4E0B\u8F7D\u6570\u636E"
830
+ ]
831
+ }
832
+ )
833
+ ] }),
834
+ showLog && /* @__PURE__ */ jsxs6("div", { className: "mt-4 rounded-lg bg-[hsl(var(--muted))] p-4", children: [
835
+ /* @__PURE__ */ jsx6("h4", { className: "mb-2 text-sm font-semibold", children: "LLM\u751F\u6210\u7684\u6E90\u7801\uFF1A" }),
836
+ /* @__PURE__ */ jsx6("div", { className: "max-h-96 overflow-y-auto", children: /* @__PURE__ */ jsx6("pre", { className: "whitespace-pre-wrap text-xs", children: /* @__PURE__ */ jsx6("code", { children: JSON.stringify(card, null, 2) }) }) })
837
+ ] })
838
+ ] });
839
+ });
840
+ var MatrixView = memo2(function MatrixView2({
841
+ plans,
842
+ displayBestPlan,
843
+ weights,
844
+ metricKeys
845
+ }) {
846
+ return /* @__PURE__ */ jsxs6("div", { className: "space-y-6", children: [
847
+ /* @__PURE__ */ jsx6("h4", { className: "text-sm font-semibold", children: "\u65B9\u6848\u8BC4\u4F30\u5BF9\u6BD4" }),
848
+ /* @__PURE__ */ jsx6("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs6("table", { className: "w-full border-collapse text-sm", children: [
849
+ /* @__PURE__ */ jsx6("thead", { children: /* @__PURE__ */ jsxs6("tr", { className: "border-b-2 border-[hsl(var(--border))]", children: [
850
+ /* @__PURE__ */ jsx6("th", { className: "p-2 text-left font-semibold", children: "\u65B9\u6848" }),
851
+ metricKeys.map((key) => /* @__PURE__ */ jsx6("th", { className: "p-2 text-center font-semibold", children: key }, key)),
852
+ /* @__PURE__ */ jsx6("th", { className: "p-2 text-center font-semibold", children: "\u7EFC\u5408\u8BC4\u5206" })
853
+ ] }) }),
854
+ /* @__PURE__ */ jsx6("tbody", { children: plans.map((plan, planIndex) => {
855
+ const colors = getPlanColor2(planIndex);
856
+ const isBest = plan.name === displayBestPlan;
857
+ const comprehensiveScore = calculateComprehensiveScore(plan, weights);
858
+ return /* @__PURE__ */ jsxs6(
859
+ "tr",
860
+ {
861
+ className: `border-b border-[hsl(var(--border))] transition-all duration-300 ${isBest ? "bg-sky-950" : ""}`,
862
+ children: [
863
+ /* @__PURE__ */ jsx6("td", { className: "border-r border-[hsl(var(--border))] p-2", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
864
+ /* @__PURE__ */ jsx6("div", { className: `h-3 w-3 rounded ${colors.bg}` }),
865
+ /* @__PURE__ */ jsx6("span", { className: "font-semibold", children: plan.name }),
866
+ isBest && /* @__PURE__ */ jsx6("span", { className: "rounded-full bg-sky-600 px-2 py-0.5 text-xs text-white", children: "\u6700\u4F18" })
867
+ ] }) }),
868
+ metricKeys.map((key) => {
869
+ const value = plan.metrics[key] || 0;
870
+ return /* @__PURE__ */ jsx6("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsxs6(
871
+ "span",
872
+ {
873
+ className: "font-mono font-semibold",
874
+ style: {
875
+ color: value >= 80 ? "#0ea5e9" : value >= 65 ? "#0284c7" : "#075985"
876
+ },
877
+ children: [
878
+ value.toFixed(0),
879
+ "%"
880
+ ]
881
+ }
882
+ ) }, key);
883
+ }),
884
+ /* @__PURE__ */ jsx6("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsx6("span", { className: "text-base font-bold", style: { color: colors.primary }, children: comprehensiveScore.toFixed(1) }) })
885
+ ]
886
+ },
887
+ planIndex
888
+ );
889
+ }) })
890
+ ] }) }),
891
+ /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-2 gap-4", children: plans.map((plan, index) => {
892
+ const colors = getPlanColor2(index);
893
+ const isBest = plan.name === displayBestPlan;
894
+ const comprehensiveScore = calculateComprehensiveScore(plan, weights);
895
+ return /* @__PURE__ */ jsxs6(
896
+ "div",
897
+ {
898
+ className: `rounded-lg border p-4 transition-all duration-300 ${colors.light} ${isBest ? "border-2 border-sky-600" : "border-[hsl(var(--border))]"}`,
899
+ children: [
900
+ /* @__PURE__ */ jsx6("div", { className: "mb-2 flex items-center justify-between", children: /* @__PURE__ */ jsx6("h4", { className: "font-semibold", children: plan.name }) }),
901
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-2 text-sm", children: [
902
+ metricKeys.map((key) => /* @__PURE__ */ jsxs6("div", { className: "flex justify-between", children: [
903
+ /* @__PURE__ */ jsx6("span", { className: "text-[hsl(var(--muted-foreground))]", children: key }),
904
+ /* @__PURE__ */ jsxs6("span", { className: "font-bold", children: [
905
+ (plan.metrics[key] || 0).toFixed(0),
906
+ "%"
907
+ ] })
908
+ ] }, key)),
909
+ /* @__PURE__ */ jsxs6("div", { className: "flex justify-between border-t border-[hsl(var(--border))] pt-2", children: [
910
+ /* @__PURE__ */ jsx6("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u7EFC\u5408\u8BC4\u5206" }),
911
+ /* @__PURE__ */ jsx6("span", { className: "text-lg font-bold", style: { color: colors.primary }, children: comprehensiveScore.toFixed(1) })
912
+ ] })
913
+ ] })
914
+ ]
915
+ },
916
+ index
917
+ );
918
+ }) })
919
+ ] });
920
+ });
921
+ var WeightAdjustmentPanel = memo2(function WeightAdjustmentPanel2({
922
+ cardId,
923
+ initialWeights,
924
+ metricKeys,
925
+ onWeightChange
926
+ }) {
927
+ const [weights, setWeights] = useCardState(
928
+ `${cardId}-weights`,
929
+ initialWeights
930
+ );
931
+ const weightSum = useMemo3(() => {
932
+ return Object.values(weights).reduce((sum, w) => sum + w, 0);
933
+ }, [weights]);
934
+ const handleWeightChange = useCallback2(
935
+ (key, newValue) => {
936
+ const normalized = normalizeWeights(weights, key, newValue);
937
+ setWeights(normalized);
938
+ onWeightChange(normalized);
939
+ },
940
+ [weights, setWeights, onWeightChange]
941
+ );
942
+ return /* @__PURE__ */ jsxs6("div", { className: "space-y-4 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/30 p-4", children: [
943
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs6("h4", { className: "flex items-center gap-2 text-sm font-bold", children: [
944
+ /* @__PURE__ */ jsx6(Settings, { className: "h-4 w-4" }),
945
+ "\u6743\u91CD\u8C03\u6574",
946
+ /* @__PURE__ */ jsxs6("span", { className: "ml-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
947
+ "(\u603B\u548C: ",
948
+ weightSum.toFixed(3),
949
+ ")"
950
+ ] })
951
+ ] }) }),
952
+ /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: metricKeys.map((key) => {
953
+ const weight = weights[key] || 0;
954
+ const initialWeight = initialWeights[key] || 0;
955
+ const hasChanged = Math.abs(weight - initialWeight) > 1e-3;
956
+ return /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
957
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
958
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
959
+ /* @__PURE__ */ jsx6("span", { className: "text-sm font-medium", children: key }),
960
+ hasChanged && /* @__PURE__ */ jsxs6("span", { className: "text-xs text-sky-400", children: [
961
+ "(",
962
+ initialWeight.toFixed(2),
963
+ " \u2192 ",
964
+ weight.toFixed(2),
965
+ ")"
966
+ ] })
967
+ ] }),
968
+ /* @__PURE__ */ jsx6("span", { className: "font-mono text-sm font-bold", children: weight.toFixed(2) })
969
+ ] }),
970
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
971
+ /* @__PURE__ */ jsx6("span", { className: "w-8 text-right text-xs text-[hsl(var(--muted-foreground))]", children: "0" }),
972
+ /* @__PURE__ */ jsx6(
973
+ "input",
974
+ {
975
+ type: "range",
976
+ value: weight * 100,
977
+ onChange: (e) => handleWeightChange(key, Number(e.target.value) / 100),
978
+ min: 0,
979
+ max: 100,
980
+ step: 1,
981
+ className: "flex-1"
982
+ }
983
+ ),
984
+ /* @__PURE__ */ jsx6("span", { className: "w-8 text-xs text-[hsl(var(--muted-foreground))]", children: "1" })
985
+ ] })
986
+ ] }, key);
987
+ }) })
988
+ ] });
989
+ });
990
+ function DamageEffectCardComponent({ card }) {
991
+ const payload = card.payload;
992
+ const title = card.title || payload?.title || "\u6BC1\u4F24\u6548\u679C\u8BC4\u4F30\u5206\u6790";
993
+ const cardId = useMemo3(() => {
994
+ return `damage-effect-card-${card.id || "default"}`;
995
+ }, [card.id]);
996
+ const plans = useMemo3(() => payload?.plans || [], [payload?.plans]);
997
+ const initialWeights = useMemo3(() => payload?.weights || {}, [payload?.weights]);
998
+ const metricKeys = useMemo3(() => {
999
+ if (plans.length === 0) return [];
1000
+ return Object.keys(plans[0].metrics);
1001
+ }, [plans]);
1002
+ const [currentWeights, setCurrentWeights] = useCardState(
1003
+ `${cardId}-current-weights`,
1004
+ initialWeights
1005
+ );
1006
+ const calculatedBestPlan = useMemo3(() => {
1007
+ if (plans.length === 0) return null;
1008
+ const plansWithScores = plans.map((plan) => ({
1009
+ plan,
1010
+ score: calculateComprehensiveScore(plan, currentWeights)
1011
+ }));
1012
+ return plansWithScores.reduce(
1013
+ (best, current) => current.score > best.score ? current : best
1014
+ ).plan;
1015
+ }, [plans, currentWeights]);
1016
+ const displayBestPlan = calculatedBestPlan?.name;
1017
+ const handleWeightChange = useCallback2(
1018
+ (newWeights) => {
1019
+ setCurrentWeights(newWeights);
1020
+ },
1021
+ [setCurrentWeights]
1022
+ );
1023
+ return /* @__PURE__ */ jsxs6("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
1024
+ /* @__PURE__ */ jsx6("div", { className: "px-6 pb-4 pt-6", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
1025
+ /* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold", children: title }),
1026
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
1027
+ /* @__PURE__ */ jsxs6("span", { children: [
1028
+ "\u65B9\u6848\u6570: ",
1029
+ plans.length
1030
+ ] }),
1031
+ displayBestPlan && /* @__PURE__ */ jsxs6("span", { className: "font-semibold text-sky-400", children: [
1032
+ "\u6700\u4F18: ",
1033
+ displayBestPlan
1034
+ ] })
1035
+ ] })
1036
+ ] }) }),
1037
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-6 px-6 pb-6", children: [
1038
+ /* @__PURE__ */ jsx6(
1039
+ MatrixView,
1040
+ {
1041
+ plans,
1042
+ displayBestPlan,
1043
+ weights: currentWeights,
1044
+ metricKeys
1045
+ }
1046
+ ),
1047
+ /* @__PURE__ */ jsx6("div", { className: "border-t border-[hsl(var(--border))] pt-6", children: /* @__PURE__ */ jsx6(
1048
+ WeightAdjustmentPanel,
1049
+ {
1050
+ cardId,
1051
+ initialWeights,
1052
+ metricKeys,
1053
+ onWeightChange: handleWeightChange
1054
+ }
1055
+ ) })
1056
+ ] }),
1057
+ /* @__PURE__ */ jsx6(DamageEffectControlPanel, { cardId, card })
1058
+ ] });
1059
+ }
1060
+ var DamageEffectCard = memo2(DamageEffectCardComponent);
1061
+
1062
+ // src/react/components/card/cards/destination-card.tsx
1063
+ import { MapPin as MapPin2, Star as Star2, Wallet } from "lucide-react";
1064
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1065
+ function DestinationCard({ card }) {
1066
+ const payload = card.payload;
1067
+ if (!payload || !Array.isArray(payload.destinations)) {
1068
+ return /* @__PURE__ */ jsx7("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx7("p", { className: "text-red-400 text-sm", children: "\u76EE\u7684\u5730\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
1069
+ }
1070
+ return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4", children: [
1071
+ card.title && /* @__PURE__ */ jsx7("h3", { className: "font-semibold text-lg text-zinc-100 mb-4", children: card.title }),
1072
+ /* @__PURE__ */ jsx7("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-3", children: payload.destinations.map((dest, index) => /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border border-white/10 p-3", children: [
1073
+ /* @__PURE__ */ jsxs7("div", { className: "flex justify-between items-start mb-2", children: [
1074
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
1075
+ /* @__PURE__ */ jsx7(MapPin2, { className: "w-4 h-4 text-sky-400" }),
1076
+ /* @__PURE__ */ jsx7("span", { className: "font-medium text-zinc-200", children: dest.name }),
1077
+ /* @__PURE__ */ jsx7("span", { className: "text-xs text-zinc-500", children: dest.country })
1078
+ ] }),
1079
+ dest.rating != null && /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
1080
+ /* @__PURE__ */ jsx7(Star2, { className: "w-3 h-3 text-amber-400 fill-amber-400" }),
1081
+ /* @__PURE__ */ jsx7("span", { className: "text-sm text-zinc-300", children: dest.rating })
1082
+ ] })
1083
+ ] }),
1084
+ dest.description && /* @__PURE__ */ jsx7("p", { className: "text-xs text-zinc-400 mb-2", children: dest.description }),
1085
+ /* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-1 mb-2", children: (dest.highlights ?? []).map((h, i) => /* @__PURE__ */ jsx7(
1086
+ "span",
1087
+ {
1088
+ className: "px-2 py-0.5 bg-white/5 text-zinc-400 text-xs rounded",
1089
+ children: h
1090
+ },
1091
+ i
1092
+ )) }),
1093
+ /* @__PURE__ */ jsxs7("div", { className: "flex justify-between text-sm text-zinc-400", children: [
1094
+ dest.bestSeason && /* @__PURE__ */ jsxs7("span", { children: [
1095
+ "\u6700\u4F73\u5B63\u8282: ",
1096
+ dest.bestSeason
1097
+ ] }),
1098
+ (dest.avgBudget || dest.budget) && /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
1099
+ /* @__PURE__ */ jsx7(Wallet, { className: "w-3 h-3" }),
1100
+ /* @__PURE__ */ jsx7("span", { children: dest.avgBudget ? `\u7EA6\xA5${dest.avgBudget}` : dest.budget })
1101
+ ] })
1102
+ ] })
1103
+ ] }, index)) })
1104
+ ] });
1105
+ }
1106
+
1107
+ // src/react/components/card/cards/diff-card.tsx
1108
+ import { useState as useState3 } from "react";
1109
+
1110
+ // src/react/lib/utils.ts
1111
+ import { clsx } from "clsx";
1112
+ import { twMerge } from "tailwind-merge";
1113
+ function cn(...inputs) {
1114
+ return twMerge(clsx(inputs));
1115
+ }
1116
+
1117
+ // src/react/components/card/cards/diff-card.tsx
1118
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1119
+ function computeDiff(oldText, newText) {
1120
+ const oldLines = oldText.split("\n");
1121
+ const newLines = newText.split("\n");
1122
+ const m = oldLines.length;
1123
+ const n = newLines.length;
1124
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
1125
+ for (let i2 = 1; i2 <= m; i2++) {
1126
+ for (let j2 = 1; j2 <= n; j2++) {
1127
+ if (oldLines[i2 - 1] === newLines[j2 - 1]) {
1128
+ dp[i2][j2] = dp[i2 - 1][j2 - 1] + 1;
1129
+ } else {
1130
+ dp[i2][j2] = Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
1131
+ }
1132
+ }
1133
+ }
1134
+ const result = [];
1135
+ let i = m;
1136
+ let j = n;
1137
+ while (i > 0 || j > 0) {
1138
+ if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {
1139
+ result.push({ type: "unchanged", value: oldLines[i - 1] });
1140
+ i--;
1141
+ j--;
1142
+ } else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
1143
+ result.push({ type: "added", value: newLines[j - 1] });
1144
+ j--;
1145
+ } else if (i > 0) {
1146
+ result.push({ type: "removed", value: oldLines[i - 1] });
1147
+ i--;
1148
+ }
1149
+ }
1150
+ result.reverse();
1151
+ return result;
1152
+ }
1153
+ function DiffCard({ card }) {
1154
+ const [splitView, setSplitView] = useState3(true);
1155
+ const payload = card.payload;
1156
+ const {
1157
+ oldContent = "",
1158
+ newContent = "",
1159
+ oldTitle = "\u539F\u59CB",
1160
+ newTitle = "\u4FEE\u6539"
1161
+ } = payload || {};
1162
+ const changes = computeDiff(oldContent, newContent);
1163
+ const leftLines = [];
1164
+ const rightLines = [];
1165
+ let oldLineNum = 0;
1166
+ let newLineNum = 0;
1167
+ for (const change of changes) {
1168
+ if (change.type === "unchanged") {
1169
+ oldLineNum++;
1170
+ newLineNum++;
1171
+ leftLines.push({ num: oldLineNum, text: change.value, type: "unchanged" });
1172
+ rightLines.push({ num: newLineNum, text: change.value, type: "unchanged" });
1173
+ } else if (change.type === "removed") {
1174
+ oldLineNum++;
1175
+ leftLines.push({ num: oldLineNum, text: change.value, type: "removed" });
1176
+ rightLines.push({ num: null, text: "", type: "unchanged" });
1177
+ } else {
1178
+ newLineNum++;
1179
+ leftLines.push({ num: null, text: "", type: "unchanged" });
1180
+ rightLines.push({ num: newLineNum, text: change.value, type: "added" });
1181
+ }
1182
+ }
1183
+ return /* @__PURE__ */ jsxs8("div", { className: "rounded-lg border border-white/10 bg-white/5", children: [
1184
+ /* @__PURE__ */ jsxs8("div", { className: "p-3 border-b border-white/10 flex items-center justify-between", children: [
1185
+ /* @__PURE__ */ jsx8("h3", { className: "font-semibold text-foreground", children: card.title || "Diff Viewer" }),
1186
+ /* @__PURE__ */ jsx8(
1187
+ "button",
1188
+ {
1189
+ type: "button",
1190
+ onClick: () => setSplitView(!splitView),
1191
+ className: "px-3 py-1 text-sm rounded border border-white/10 text-secondary-foreground hover:bg-white/10 transition-colors",
1192
+ children: splitView ? "\u5355\u680F\u5BF9\u6BD4" : "\u53CC\u680F\u5BF9\u6BD4"
1193
+ }
1194
+ )
1195
+ ] }),
1196
+ /* @__PURE__ */ jsx8("div", { className: "overflow-auto", children: splitView ? (
1197
+ /* Split (side-by-side) view */
1198
+ /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-2 divide-x divide-white/10", children: [
1199
+ /* @__PURE__ */ jsx8("div", { className: "px-3 py-1.5 text-xs font-semibold text-muted-foreground border-b border-white/10 bg-muted", children: oldTitle }),
1200
+ /* @__PURE__ */ jsx8("div", { className: "px-3 py-1.5 text-xs font-semibold text-muted-foreground border-b border-white/10 bg-muted", children: newTitle }),
1201
+ /* @__PURE__ */ jsx8("pre", { className: "p-0 font-mono text-xs leading-5 overflow-x-auto", children: leftLines.map((line, i) => /* @__PURE__ */ jsxs8(
1202
+ "div",
1203
+ {
1204
+ className: cn(
1205
+ "flex px-2",
1206
+ line.type === "removed" && "bg-red-500/15"
1207
+ ),
1208
+ children: [
1209
+ /* @__PURE__ */ jsx8("span", { className: "w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/60", children: line.num ?? "" }),
1210
+ /* @__PURE__ */ jsx8(
1211
+ "span",
1212
+ {
1213
+ className: cn(
1214
+ "flex-1 whitespace-pre",
1215
+ line.type === "removed" && "text-red-400",
1216
+ line.type === "unchanged" && "text-secondary-foreground"
1217
+ ),
1218
+ children: line.type === "removed" ? `- ${line.text}` : ` ${line.text}`
1219
+ }
1220
+ )
1221
+ ]
1222
+ },
1223
+ i
1224
+ )) }),
1225
+ /* @__PURE__ */ jsx8("pre", { className: "p-0 font-mono text-xs leading-5 overflow-x-auto", children: rightLines.map((line, i) => /* @__PURE__ */ jsxs8(
1226
+ "div",
1227
+ {
1228
+ className: cn(
1229
+ "flex px-2",
1230
+ line.type === "added" && "bg-emerald-500/15"
1231
+ ),
1232
+ children: [
1233
+ /* @__PURE__ */ jsx8("span", { className: "w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/60", children: line.num ?? "" }),
1234
+ /* @__PURE__ */ jsx8(
1235
+ "span",
1236
+ {
1237
+ className: cn(
1238
+ "flex-1 whitespace-pre",
1239
+ line.type === "added" && "text-emerald-400",
1240
+ line.type === "unchanged" && "text-secondary-foreground"
1241
+ ),
1242
+ children: line.type === "added" ? `+ ${line.text}` : ` ${line.text}`
1243
+ }
1244
+ )
1245
+ ]
1246
+ },
1247
+ i
1248
+ )) })
1249
+ ] })
1250
+ ) : (
1251
+ /* Unified view */
1252
+ /* @__PURE__ */ jsx8("pre", { className: "p-0 font-mono text-xs leading-5 overflow-x-auto", children: changes.map((change, i) => {
1253
+ const prefix = change.type === "added" ? "+ " : change.type === "removed" ? "- " : " ";
1254
+ return /* @__PURE__ */ jsx8(
1255
+ "div",
1256
+ {
1257
+ className: cn(
1258
+ "px-2",
1259
+ change.type === "added" && "bg-emerald-500/15",
1260
+ change.type === "removed" && "bg-red-500/15"
1261
+ ),
1262
+ children: /* @__PURE__ */ jsxs8(
1263
+ "span",
1264
+ {
1265
+ className: cn(
1266
+ "whitespace-pre",
1267
+ change.type === "added" && "text-emerald-400",
1268
+ change.type === "removed" && "text-red-400",
1269
+ change.type === "unchanged" && "text-secondary-foreground"
1270
+ ),
1271
+ children: [
1272
+ prefix,
1273
+ change.value
1274
+ ]
1275
+ }
1276
+ )
1277
+ },
1278
+ i
1279
+ );
1280
+ }) })
1281
+ ) })
1282
+ ] });
1283
+ }
1284
+
1285
+ // src/react/components/card/cards/execution-order-card.tsx
1286
+ import { Activity, Calendar, Clock as Clock2, Users } from "lucide-react";
1287
+ import { useMemo as useMemo4, useState as useState4 } from "react";
1288
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1289
+ var getPlatformColor = (index) => {
1290
+ const colors = [
1291
+ "bg-blue-500",
1292
+ "bg-green-500",
1293
+ "bg-purple-500",
1294
+ "bg-orange-500",
1295
+ "bg-pink-500",
1296
+ "bg-indigo-500",
1297
+ "bg-yellow-500",
1298
+ "bg-red-500"
1299
+ ];
1300
+ return colors[index % colors.length];
1301
+ };
1302
+ function ExecutionOrderCard({ card }) {
1303
+ const data = card.payload || card.data;
1304
+ const [activeTab, setActiveTab] = useState4("gantt");
1305
+ if (!data || !Array.isArray(data)) {
1306
+ return /* @__PURE__ */ jsx9("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx9("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6267\u884C\u6570\u636E\u683C\u5F0F\u65E0\u6548" }) });
1307
+ }
1308
+ const stats = useMemo4(() => {
1309
+ const platforms = /* @__PURE__ */ new Map();
1310
+ let earliestStart = Number.POSITIVE_INFINITY;
1311
+ let latestEnd = Number.NEGATIVE_INFINITY;
1312
+ for (const task of data) {
1313
+ earliestStart = Math.min(earliestStart, task.start_time);
1314
+ latestEnd = Math.max(latestEnd, task.end_time);
1315
+ if (!platforms.has(task.platform)) {
1316
+ platforms.set(task.platform, { count: 0, totalTime: 0, tasks: [] });
1317
+ }
1318
+ const platformData = platforms.get(task.platform);
1319
+ platformData.count++;
1320
+ platformData.totalTime += task.end_time - task.start_time;
1321
+ platformData.tasks.push(task.task_id);
1322
+ }
1323
+ const parallelGroups = [];
1324
+ for (let i = 0; i < data.length; i++) {
1325
+ const task1 = data[i];
1326
+ const group = [task1.task_id];
1327
+ for (let j = 0; j < data.length; j++) {
1328
+ if (i !== j) {
1329
+ const task2 = data[j];
1330
+ if (task1.start_time < task2.end_time && task2.start_time < task1.end_time) {
1331
+ group.push(task2.task_id);
1332
+ }
1333
+ }
1334
+ }
1335
+ if (group.length > 1) {
1336
+ const sortedGroup = [...new Set(group)].sort();
1337
+ const exists = parallelGroups.some(
1338
+ (g) => g.length === sortedGroup.length && g.every((v, idx) => v === sortedGroup[idx])
1339
+ );
1340
+ if (!exists) {
1341
+ parallelGroups.push(sortedGroup);
1342
+ }
1343
+ }
1344
+ }
1345
+ return {
1346
+ total: data.length,
1347
+ platforms: Array.from(platforms.entries()).map(([name, info]) => ({ name, ...info })),
1348
+ timeRange: {
1349
+ start: earliestStart,
1350
+ end: latestEnd,
1351
+ duration: latestEnd - earliestStart
1352
+ },
1353
+ parallelGroups
1354
+ };
1355
+ }, [data]);
1356
+ const ganttData = useMemo4(() => {
1357
+ const minTime = stats.timeRange.start;
1358
+ const totalDuration = stats.timeRange.duration;
1359
+ return data.map((task) => ({
1360
+ ...task,
1361
+ duration: task.end_time - task.start_time,
1362
+ startPercent: (task.start_time - minTime) / totalDuration * 100,
1363
+ widthPercent: (task.end_time - task.start_time) / totalDuration * 100
1364
+ }));
1365
+ }, [data, stats]);
1366
+ const tasksByPlatform = useMemo4(() => {
1367
+ const grouped = /* @__PURE__ */ new Map();
1368
+ for (const task of ganttData) {
1369
+ if (!grouped.has(task.platform)) {
1370
+ grouped.set(task.platform, []);
1371
+ }
1372
+ grouped.get(task.platform).push(task);
1373
+ }
1374
+ return Array.from(grouped.entries());
1375
+ }, [ganttData]);
1376
+ return /* @__PURE__ */ jsxs9("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
1377
+ /* @__PURE__ */ jsx9("div", { className: "px-6 pt-6", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
1378
+ /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-2 text-lg font-semibold", children: [
1379
+ /* @__PURE__ */ jsx9(Activity, { className: "h-5 w-5" }),
1380
+ "\u4EFB\u52A1\u6267\u884C\u987A\u5E8F"
1381
+ ] }),
1382
+ /* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
1383
+ /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-1 rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
1384
+ /* @__PURE__ */ jsx9(Clock2, { className: "h-3 w-3" }),
1385
+ "\u603B\u4EFB\u52A1: ",
1386
+ stats.total
1387
+ ] }),
1388
+ /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-1 rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
1389
+ /* @__PURE__ */ jsx9(Calendar, { className: "h-3 w-3" }),
1390
+ "\u65F6\u95F4\u8DE8\u5EA6: ",
1391
+ stats.timeRange.duration
1392
+ ] })
1393
+ ] })
1394
+ ] }) }),
1395
+ /* @__PURE__ */ jsxs9("div", { className: "px-6 pb-6 pt-4", children: [
1396
+ /* @__PURE__ */ jsx9("div", { className: "mb-4 grid w-full grid-cols-3 rounded-lg bg-[hsl(var(--muted))] p-1", children: ["gantt", "timeline", "platforms"].map((tab) => /* @__PURE__ */ jsx9(
1397
+ "button",
1398
+ {
1399
+ type: "button",
1400
+ onClick: () => setActiveTab(tab),
1401
+ className: `rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${activeTab === tab ? "bg-[hsl(var(--background))] text-[hsl(var(--foreground))] shadow-sm" : "text-[hsl(var(--muted-foreground))]"}`,
1402
+ children: tab === "gantt" ? "\u7518\u7279\u56FE" : tab === "timeline" ? "\u65F6\u95F4\u7EBF" : "\u5E73\u53F0\u5206\u914D"
1403
+ },
1404
+ tab
1405
+ )) }),
1406
+ activeTab === "gantt" && /* @__PURE__ */ jsxs9("div", { className: "space-y-4", children: [
1407
+ /* @__PURE__ */ jsxs9("div", { className: "mb-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
1408
+ "\u65F6\u95F4\u8303\u56F4: ",
1409
+ stats.timeRange.start,
1410
+ " - ",
1411
+ stats.timeRange.end
1412
+ ] }),
1413
+ /* @__PURE__ */ jsx9("div", { className: "max-h-[400px] space-y-2 overflow-y-auto", children: tasksByPlatform.map(([platform, tasks], platformIndex) => /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
1414
+ /* @__PURE__ */ jsx9("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: platform }),
1415
+ /* @__PURE__ */ jsx9("div", { className: "relative h-8 rounded bg-[hsl(var(--secondary))]", children: tasks.map((task) => /* @__PURE__ */ jsx9(
1416
+ "div",
1417
+ {
1418
+ className: `absolute top-1 flex h-6 items-center justify-center overflow-hidden rounded text-xs text-white ${getPlatformColor(platformIndex)}`,
1419
+ style: {
1420
+ left: `${task.startPercent}%`,
1421
+ width: `${task.widthPercent}%`,
1422
+ minWidth: "40px"
1423
+ },
1424
+ title: `${task.task_id}: ${task.start_time}-${task.end_time}`,
1425
+ children: /* @__PURE__ */ jsx9("span", { className: "truncate px-1", children: task.task_id })
1426
+ },
1427
+ task.task_id
1428
+ )) })
1429
+ ] }, platform)) }),
1430
+ stats.parallelGroups.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "mt-4 rounded bg-[hsl(var(--secondary))] p-3", children: [
1431
+ /* @__PURE__ */ jsx9("h4", { className: "mb-2 text-sm font-medium", children: "\u5E76\u884C\u6267\u884C\u7EC4" }),
1432
+ /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
1433
+ stats.parallelGroups.slice(0, 5).map((group, idx) => /* @__PURE__ */ jsxs9("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
1434
+ idx + 1,
1435
+ ". ",
1436
+ group.join(", ")
1437
+ ] }, idx)),
1438
+ stats.parallelGroups.length > 5 && /* @__PURE__ */ jsxs9("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
1439
+ "\u8FD8\u6709 ",
1440
+ stats.parallelGroups.length - 5,
1441
+ " \u4E2A\u5E76\u884C\u7EC4..."
1442
+ ] })
1443
+ ] })
1444
+ ] })
1445
+ ] }),
1446
+ activeTab === "timeline" && /* @__PURE__ */ jsx9("div", { className: "max-h-[450px] space-y-2 overflow-y-auto", children: data.map((task) => /* @__PURE__ */ jsxs9(
1447
+ "div",
1448
+ {
1449
+ className: "flex items-center justify-between rounded-lg border border-[hsl(var(--border))] p-3",
1450
+ children: [
1451
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
1452
+ /* @__PURE__ */ jsxs9("span", { className: "flex min-w-[40px] items-center justify-center rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
1453
+ "#",
1454
+ task.sequence
1455
+ ] }),
1456
+ /* @__PURE__ */ jsxs9("div", { children: [
1457
+ /* @__PURE__ */ jsx9("div", { className: "text-sm font-medium", children: task.task_id }),
1458
+ /* @__PURE__ */ jsxs9("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
1459
+ "\u5E73\u53F0: ",
1460
+ task.platform
1461
+ ] })
1462
+ ] })
1463
+ ] }),
1464
+ /* @__PURE__ */ jsxs9("div", { className: "text-right", children: [
1465
+ /* @__PURE__ */ jsxs9("div", { className: "text-sm", children: [
1466
+ task.start_time,
1467
+ " - ",
1468
+ task.end_time
1469
+ ] }),
1470
+ /* @__PURE__ */ jsxs9("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
1471
+ "\u65F6\u957F: ",
1472
+ task.end_time - task.start_time
1473
+ ] })
1474
+ ] })
1475
+ ]
1476
+ },
1477
+ task.task_id
1478
+ )) }),
1479
+ activeTab === "platforms" && /* @__PURE__ */ jsx9("div", { className: "max-h-[450px] space-y-3 overflow-y-auto", children: stats.platforms.map((platform, index) => /* @__PURE__ */ jsxs9(
1480
+ "div",
1481
+ {
1482
+ className: "rounded-lg border border-[hsl(var(--border))] p-4",
1483
+ children: [
1484
+ /* @__PURE__ */ jsxs9("div", { className: "mb-2 flex items-start justify-between", children: [
1485
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1486
+ /* @__PURE__ */ jsx9(Users, { className: "h-4 w-4" }),
1487
+ /* @__PURE__ */ jsx9("span", { className: "font-medium", children: platform.name })
1488
+ ] }),
1489
+ /* @__PURE__ */ jsxs9(
1490
+ "span",
1491
+ {
1492
+ className: `rounded-full px-2 py-0.5 text-xs text-white ${getPlatformColor(index)}`,
1493
+ children: [
1494
+ platform.count,
1495
+ " \u4E2A\u4EFB\u52A1"
1496
+ ]
1497
+ }
1498
+ )
1499
+ ] }),
1500
+ /* @__PURE__ */ jsxs9("div", { className: "space-y-1 text-sm", children: [
1501
+ /* @__PURE__ */ jsxs9("div", { className: "text-[hsl(var(--muted-foreground))]", children: [
1502
+ "\u603B\u6267\u884C\u65F6\u95F4: ",
1503
+ platform.totalTime
1504
+ ] }),
1505
+ /* @__PURE__ */ jsxs9("div", { className: "text-[hsl(var(--muted-foreground))]", children: [
1506
+ "\u5206\u914D\u4EFB\u52A1: ",
1507
+ platform.tasks.slice(0, 3).join(", "),
1508
+ platform.tasks.length > 3 && ` ... +${platform.tasks.length - 3}`
1509
+ ] })
1510
+ ] })
1511
+ ]
1512
+ },
1513
+ platform.name
1514
+ )) })
1515
+ ] })
1516
+ ] });
1517
+ }
1518
+
1519
+ // src/react/components/card/cards/experience-card-with-options.tsx
1520
+ import { memo as memo3, useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo5, useRef } from "react";
1521
+ import { Check } from "lucide-react";
1522
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1523
+ var sectionColors = [
1524
+ {
1525
+ bg: "border-l-blue-500/50 bg-blue-950/20",
1526
+ title: "text-blue-400",
1527
+ bullet: "text-blue-500"
1528
+ },
1529
+ {
1530
+ bg: "border-l-amber-500/50 bg-amber-950/20",
1531
+ title: "text-amber-400",
1532
+ bullet: "text-amber-500"
1533
+ },
1534
+ {
1535
+ bg: "border-l-emerald-500/50 bg-emerald-950/20",
1536
+ title: "text-emerald-400",
1537
+ bullet: "text-emerald-500"
1538
+ },
1539
+ {
1540
+ bg: "border-l-purple-500/50 bg-purple-950/20",
1541
+ title: "text-purple-400",
1542
+ bullet: "text-purple-500"
1543
+ }
1544
+ ];
1545
+ function ExperienceCardWithOptionsInner({ card, sendMessage }) {
1546
+ const payload = card.payload;
1547
+ const cardId = useMemo5(() => `experience-card-${card.id}`, [card.id]);
1548
+ const [selectedOption, setSelectedOption] = useCardState(
1549
+ `${cardId}-selectedOption`,
1550
+ null
1551
+ );
1552
+ const [isSending, setIsSending] = useCardState(`${cardId}-isSending`, false);
1553
+ const [showProcessing, setShowProcessing] = useCardState(
1554
+ `${cardId}-showProcessing`,
1555
+ false
1556
+ );
1557
+ const sendMessageRef = useRef(sendMessage);
1558
+ sendMessageRef.current = sendMessage;
1559
+ const processingTimerRef = useRef(null);
1560
+ const handleOptionClick = useCallback3(
1561
+ async (option) => {
1562
+ if (selectedOption || isSending) return;
1563
+ setSelectedOption(option.value);
1564
+ setIsSending(true);
1565
+ setShowProcessing(true);
1566
+ if (processingTimerRef.current) {
1567
+ clearTimeout(processingTimerRef.current);
1568
+ }
1569
+ processingTimerRef.current = setTimeout(() => {
1570
+ setShowProcessing(false);
1571
+ }, 5e3);
1572
+ const currentSendMessage = sendMessageRef.current;
1573
+ if (currentSendMessage) {
1574
+ try {
1575
+ await currentSendMessage(option.label);
1576
+ setIsSending(false);
1577
+ } catch (error) {
1578
+ console.error("\u53D1\u9001\u9009\u9879\u5931\u8D25:", error);
1579
+ setSelectedOption(null);
1580
+ setIsSending(false);
1581
+ setShowProcessing(false);
1582
+ if (processingTimerRef.current) {
1583
+ clearTimeout(processingTimerRef.current);
1584
+ }
1585
+ }
1586
+ } else {
1587
+ console.warn("sendMessage \u51FD\u6570\u672A\u63D0\u4F9B\uFF0C\u65E0\u6CD5\u53D1\u9001\u7528\u6237\u9009\u62E9");
1588
+ setIsSending(false);
1589
+ setShowProcessing(false);
1590
+ if (processingTimerRef.current) {
1591
+ clearTimeout(processingTimerRef.current);
1592
+ }
1593
+ }
1594
+ },
1595
+ [selectedOption, isSending, setSelectedOption, setIsSending, setShowProcessing]
1596
+ );
1597
+ useEffect2(() => {
1598
+ return () => {
1599
+ if (processingTimerRef.current) {
1600
+ clearTimeout(processingTimerRef.current);
1601
+ }
1602
+ };
1603
+ }, []);
1604
+ if (!payload?.header?.strategy_name || !payload?.sections) {
1605
+ return /* @__PURE__ */ jsx10("div", { className: "w-full rounded-lg border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx10("p", { className: "text-red-400", children: "\u7ECF\u9A8C\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
1606
+ }
1607
+ return /* @__PURE__ */ jsxs10("div", { className: "w-full overflow-hidden rounded-lg border-2 border-[hsl(var(--primary)/0.3)] shadow-lg transition-shadow duration-300 hover:shadow-xl", children: [
1608
+ /* @__PURE__ */ jsx10("div", { className: "border-b-2 border-[hsl(var(--primary)/0.2)] bg-gradient-to-br from-[hsl(var(--primary)/0.15)] via-[hsl(var(--primary)/0.1)] to-[hsl(var(--primary)/0.05)] px-6 pb-4 pt-5", children: /* @__PURE__ */ jsxs10("h3", { className: "bg-gradient-to-r from-[hsl(var(--primary))] via-[hsl(var(--primary)/0.8)] to-[hsl(var(--primary)/0.6)] bg-clip-text text-center text-lg font-bold text-transparent", children: [
1609
+ "\u654C\u65B9\u7B56\u7565\uFF1A",
1610
+ payload.header.strategy_name
1611
+ ] }) }),
1612
+ payload.sections.map((section, sectionIndex) => {
1613
+ const colors = sectionColors[sectionIndex % sectionColors.length];
1614
+ const isLast = sectionIndex === payload.sections.length - 1 && !payload.learning_options;
1615
+ return /* @__PURE__ */ jsxs10(
1616
+ "div",
1617
+ {
1618
+ className: `border-l-4 p-4 transition-colors duration-200 ${colors.bg} ${!isLast ? "border-b border-[hsl(var(--border)/0.5)]" : ""}`,
1619
+ children: [
1620
+ /* @__PURE__ */ jsxs10(
1621
+ "h3",
1622
+ {
1623
+ className: `mb-3 flex items-center gap-2 text-base font-bold ${colors.title}`,
1624
+ children: [
1625
+ /* @__PURE__ */ jsx10("span", { className: "inline-block h-1.5 w-1.5 rounded-full bg-current" }),
1626
+ section.title
1627
+ ]
1628
+ }
1629
+ ),
1630
+ /* @__PURE__ */ jsx10("ul", { className: "space-y-2", children: section.items.map((item, itemIndex) => /* @__PURE__ */ jsxs10("li", { className: "group flex items-start gap-2.5 text-sm", children: [
1631
+ /* @__PURE__ */ jsx10(
1632
+ "span",
1633
+ {
1634
+ className: `mt-0.5 font-bold transition-transform duration-200 group-hover:scale-125 ${colors.bullet}`,
1635
+ children: "\u25B8"
1636
+ }
1637
+ ),
1638
+ /* @__PURE__ */ jsx10("span", { className: "flex-1 leading-relaxed text-[hsl(var(--foreground)/0.9)]", children: item })
1639
+ ] }, itemIndex)) })
1640
+ ]
1641
+ },
1642
+ sectionIndex
1643
+ );
1644
+ }),
1645
+ payload.learning_options && /* @__PURE__ */ jsxs10("div", { className: "border-t-2 border-[hsl(var(--primary)/0.1)] bg-gradient-to-br from-[hsl(var(--muted)/0.4)] via-[hsl(var(--muted)/0.3)] to-[hsl(var(--muted)/0.2)] p-5", children: [
1646
+ /* @__PURE__ */ jsxs10("div", { className: "mb-4 flex items-start gap-2 rounded-lg border-l-4 border-[hsl(var(--primary)/0.4)] bg-[hsl(var(--primary)/0.05)] p-3 text-sm font-semibold text-[hsl(var(--foreground))]", children: [
1647
+ /* @__PURE__ */ jsx10("span", { className: "mt-1.5 inline-block h-1.5 w-1.5 rounded-full bg-[hsl(var(--primary))]" }),
1648
+ /* @__PURE__ */ jsx10("span", { className: "flex-1", children: payload.learning_options.question })
1649
+ ] }),
1650
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-3", children: payload.learning_options.options.map((option, index) => {
1651
+ const isSelected = selectedOption === option.value;
1652
+ const isDisabled = selectedOption !== null && !isSelected;
1653
+ return /* @__PURE__ */ jsx10(
1654
+ "button",
1655
+ {
1656
+ type: "button",
1657
+ className: `
1658
+ block w-full transform rounded-xl border-2 px-4 py-3
1659
+ text-left transition-all duration-300
1660
+ hover:scale-[1.02] active:scale-[0.98]
1661
+ ${isSelected ? "border-[hsl(var(--primary))] bg-gradient-to-br from-[hsl(var(--primary))] to-[hsl(var(--primary)/0.8)] text-[hsl(var(--primary-foreground))] shadow-lg" : "border-[hsl(var(--border)/0.6)] bg-[hsl(var(--card)/0.8)] backdrop-blur-sm hover:border-[hsl(var(--primary)/0.3)] hover:bg-[hsl(var(--accent)/0.5)] hover:shadow-md"}
1662
+ ${isDisabled ? "cursor-not-allowed opacity-50 hover:scale-100" : "cursor-pointer"}
1663
+ `,
1664
+ onClick: () => handleOptionClick(option),
1665
+ disabled: isDisabled || isSending,
1666
+ children: /* @__PURE__ */ jsxs10("div", { className: "flex w-full items-start gap-3", children: [
1667
+ /* @__PURE__ */ jsx10("div", { className: "mt-0.5 flex-shrink-0", children: isSelected ? /* @__PURE__ */ jsx10("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-[hsl(var(--primary-foreground)/0.2)]", children: /* @__PURE__ */ jsx10(Check, { className: "h-3.5 w-3.5" }) }) : /* @__PURE__ */ jsx10("div", { className: "h-5 w-5 rounded-full border-2 border-current opacity-60 transition-opacity hover:opacity-100" }) }),
1668
+ /* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
1669
+ /* @__PURE__ */ jsx10(
1670
+ "div",
1671
+ {
1672
+ className: `break-words text-sm font-semibold whitespace-normal ${isSelected ? "" : "text-[hsl(var(--foreground))]"}`,
1673
+ children: option.label
1674
+ }
1675
+ ),
1676
+ option.description && /* @__PURE__ */ jsx10(
1677
+ "div",
1678
+ {
1679
+ className: `mt-1.5 break-words text-xs leading-relaxed whitespace-normal ${isSelected ? "opacity-90" : "text-[hsl(var(--muted-foreground))]"}`,
1680
+ children: option.description
1681
+ }
1682
+ )
1683
+ ] })
1684
+ ] })
1685
+ },
1686
+ index
1687
+ );
1688
+ }) }),
1689
+ !selectedOption && /* @__PURE__ */ jsx10("div", { className: "mt-3 rounded-lg border border-[hsl(var(--border)/0.3)] bg-[hsl(var(--muted)/0.3)] px-3 py-2 text-center text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BF7\u9009\u62E9\u60A8\u7684\u51B3\u7B56" }),
1690
+ showProcessing && /* @__PURE__ */ jsx10("div", { className: "mt-3 animate-pulse rounded-lg border border-[hsl(var(--primary)/0.3)] bg-[hsl(var(--primary)/0.1)] px-3 py-2 text-center text-xs font-medium text-[hsl(var(--primary))]", children: "\u5DF2\u9009\u62E9\uFF0C\u6B63\u5728\u5904\u7406..." })
1691
+ ] })
1692
+ ] });
1693
+ }
1694
+ function cardPropsAreEqual(prevProps, nextProps) {
1695
+ const prevCard = prevProps.card;
1696
+ const nextCard = nextProps.card;
1697
+ return prevCard.id === nextCard.id && prevCard.type === nextCard.type && prevCard.title === nextCard.title && JSON.stringify(prevCard.payload) === JSON.stringify(nextCard.payload);
1698
+ }
1699
+ var ExperienceCardWithOptions = memo3(ExperienceCardWithOptionsInner, cardPropsAreEqual);
1700
+ ExperienceCardWithOptions.displayName = "ExperienceCardWithOptions";
1701
+
1702
+ // src/react/components/card/cards/flight-card.tsx
1703
+ import { Clock as Clock3, Plane } from "lucide-react";
1704
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1705
+ function FlightCard({ card }) {
1706
+ const payload = card.payload;
1707
+ if (!payload || !Array.isArray(payload.flights)) {
1708
+ return /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx11("p", { className: "text-red-400 text-sm", children: "\u822A\u73ED\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
1709
+ }
1710
+ return /* @__PURE__ */ jsxs11("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4", children: [
1711
+ card.title && /* @__PURE__ */ jsx11("h3", { className: "font-semibold text-lg text-zinc-100 mb-4", children: card.title }),
1712
+ /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: payload.flights.map((flight, index) => /* @__PURE__ */ jsxs11("div", { className: "rounded-lg border border-white/10 p-3", children: [
1713
+ /* @__PURE__ */ jsxs11("div", { className: "flex justify-between items-center mb-2", children: [
1714
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
1715
+ /* @__PURE__ */ jsx11(Plane, { className: "w-4 h-4 text-sky-400" }),
1716
+ /* @__PURE__ */ jsx11("span", { className: "font-medium text-zinc-200", children: flight.flightNo }),
1717
+ /* @__PURE__ */ jsx11("span", { className: "text-sm text-zinc-400", children: flight.airline })
1718
+ ] }),
1719
+ /* @__PURE__ */ jsxs11("div", { className: "text-right", children: [
1720
+ /* @__PURE__ */ jsxs11("span", { className: "text-lg font-bold text-orange-400", children: [
1721
+ "\xA5",
1722
+ flight.price
1723
+ ] }),
1724
+ flight.discount && /* @__PURE__ */ jsx11("span", { className: "ml-2 text-xs text-orange-400", children: flight.discount })
1725
+ ] })
1726
+ ] }),
1727
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1728
+ /* @__PURE__ */ jsxs11("div", { className: "text-center", children: [
1729
+ /* @__PURE__ */ jsx11("div", { className: "text-lg font-medium text-zinc-100", children: flight.departure.time }),
1730
+ /* @__PURE__ */ jsx11("div", { className: "text-sm text-zinc-400", children: flight.departure.city }),
1731
+ /* @__PURE__ */ jsx11("div", { className: "text-xs text-zinc-500", children: flight.departure.airport })
1732
+ ] }),
1733
+ /* @__PURE__ */ jsxs11("div", { className: "flex-1 flex flex-col items-center px-4", children: [
1734
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 text-xs text-zinc-400", children: [
1735
+ /* @__PURE__ */ jsx11(Clock3, { className: "w-3 h-3" }),
1736
+ flight.duration
1737
+ ] }),
1738
+ /* @__PURE__ */ jsx11("div", { className: "w-full h-px bg-white/10 my-1 relative", children: /* @__PURE__ */ jsx11("div", { className: "absolute right-0 top-1/2 -translate-y-1/2 w-0 h-0 border-t-4 border-t-transparent border-b-4 border-b-transparent border-l-4 border-l-zinc-500" }) })
1739
+ ] }),
1740
+ /* @__PURE__ */ jsxs11("div", { className: "text-center", children: [
1741
+ /* @__PURE__ */ jsx11("div", { className: "text-lg font-medium text-zinc-100", children: flight.arrival.time }),
1742
+ /* @__PURE__ */ jsx11("div", { className: "text-sm text-zinc-400", children: flight.arrival.city }),
1743
+ /* @__PURE__ */ jsx11("div", { className: "text-xs text-zinc-500", children: flight.arrival.airport })
1744
+ ] })
1745
+ ] })
1746
+ ] }, index)) })
1747
+ ] });
1748
+ }
1749
+
1750
+ // src/react/components/card/cards/hotel-card.tsx
1751
+ import { MapPin as MapPin3, Star as Star3 } from "lucide-react";
1752
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1753
+ function HotelCard({ card }) {
1754
+ const payload = card.payload;
1755
+ if (!payload || !Array.isArray(payload.hotels)) {
1756
+ return /* @__PURE__ */ jsx12("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx12("p", { className: "text-red-400 text-sm", children: "\u9152\u5E97\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
1757
+ }
1758
+ return /* @__PURE__ */ jsxs12("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4", children: [
1759
+ card.title && /* @__PURE__ */ jsx12("h3", { className: "font-semibold text-lg text-zinc-100 mb-4", children: card.title }),
1760
+ /* @__PURE__ */ jsx12("div", { className: "space-y-3", children: payload.hotels.map((hotel, index) => /* @__PURE__ */ jsxs12("div", { className: "rounded-lg border border-white/10 p-3", children: [
1761
+ /* @__PURE__ */ jsxs12("div", { className: "flex justify-between items-start mb-2", children: [
1762
+ /* @__PURE__ */ jsxs12("div", { children: [
1763
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
1764
+ /* @__PURE__ */ jsx12("span", { className: "font-medium text-zinc-200", children: hotel.name }),
1765
+ /* @__PURE__ */ jsxs12("span", { className: "px-1.5 py-0.5 bg-amber-500/20 text-amber-400 text-xs rounded", children: [
1766
+ hotel.star,
1767
+ "\u661F"
1768
+ ] })
1769
+ ] }),
1770
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1 text-sm text-zinc-400 mt-1", children: [
1771
+ /* @__PURE__ */ jsx12(MapPin3, { className: "w-3 h-3" }),
1772
+ hotel.location
1773
+ ] })
1774
+ ] }),
1775
+ /* @__PURE__ */ jsxs12("div", { className: "text-right", children: [
1776
+ /* @__PURE__ */ jsxs12("div", { className: "text-lg font-bold text-orange-400", children: [
1777
+ "\xA5",
1778
+ hotel.pricePerNight,
1779
+ /* @__PURE__ */ jsx12("span", { className: "text-xs font-normal text-zinc-500", children: "/\u665A" })
1780
+ ] }),
1781
+ hotel.breakfast && /* @__PURE__ */ jsx12("span", { className: "text-xs text-emerald-400", children: hotel.breakfast })
1782
+ ] })
1783
+ ] }),
1784
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 mb-2", children: [
1785
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
1786
+ /* @__PURE__ */ jsx12(Star3, { className: "w-3 h-3 text-amber-400 fill-amber-400" }),
1787
+ /* @__PURE__ */ jsx12("span", { className: "text-sm font-medium text-zinc-200", children: hotel.rating })
1788
+ ] }),
1789
+ /* @__PURE__ */ jsxs12("span", { className: "text-xs text-zinc-500", children: [
1790
+ "(",
1791
+ hotel.reviewCount,
1792
+ "\u6761\u8BC4\u4EF7)"
1793
+ ] })
1794
+ ] }),
1795
+ /* @__PURE__ */ jsx12("div", { className: "flex flex-wrap gap-1", children: hotel.facilities.map((f, i) => /* @__PURE__ */ jsx12(
1796
+ "span",
1797
+ {
1798
+ className: "px-2 py-0.5 bg-white/5 text-zinc-400 text-xs rounded",
1799
+ children: f
1800
+ },
1801
+ i
1802
+ )) })
1803
+ ] }, index)) })
1804
+ ] });
1805
+ }
1806
+
1807
+ // src/react/components/card/cards/kill-chain-card.tsx
1808
+ import {
1809
+ AlertTriangle as AlertTriangle2,
1810
+ ChevronDown,
1811
+ ChevronRight as ChevronRight2,
1812
+ Clock as Clock4,
1813
+ Crosshair,
1814
+ FileCheck,
1815
+ MapPin as MapPin4,
1816
+ Radio,
1817
+ Search,
1818
+ Target as Target2,
1819
+ Zap
1820
+ } from "lucide-react";
1821
+ import { Fragment, useState as useState5 } from "react";
1822
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1823
+ var getPriorityColor = (priority) => {
1824
+ switch (priority) {
1825
+ case 1:
1826
+ return "bg-red-600 text-white animate-pulse";
1827
+ case 2:
1828
+ return "bg-orange-500 text-white";
1829
+ case 3:
1830
+ return "bg-yellow-500 text-yellow-50";
1831
+ case 4:
1832
+ return "bg-sky-600 text-white";
1833
+ case 5:
1834
+ return "bg-zinc-600 text-zinc-200";
1835
+ default:
1836
+ return "bg-zinc-700 text-zinc-300";
1837
+ }
1838
+ };
1839
+ var getPhaseIcon = (phase) => {
1840
+ switch (phase.toLowerCase()) {
1841
+ case "find":
1842
+ return Search;
1843
+ case "fix":
1844
+ return MapPin4;
1845
+ case "track":
1846
+ return Radio;
1847
+ case "target":
1848
+ return Crosshair;
1849
+ case "engage":
1850
+ return Zap;
1851
+ case "assess":
1852
+ return FileCheck;
1853
+ default:
1854
+ return Target2;
1855
+ }
1856
+ };
1857
+ var getChineseName = (phase) => {
1858
+ const names = {
1859
+ find: "\u53D1\u73B0",
1860
+ fix: "\u5B9A\u4F4D",
1861
+ track: "\u8DDF\u8E2A",
1862
+ target: "\u7784\u51C6",
1863
+ engage: "\u6253\u51FB",
1864
+ assess: "\u8BC4\u4F30"
1865
+ };
1866
+ return names[phase.toLowerCase()] || phase;
1867
+ };
1868
+ var getEngagementModeName = (mode) => {
1869
+ const modes = {
1870
+ salvo: "\u9F50\u5C04\u6253\u51FB",
1871
+ sequential: "\u987A\u5E8F\u6253\u51FB",
1872
+ saturation: "\u9971\u548C\u6253\u51FB"
1873
+ };
1874
+ return modes[mode] || mode;
1875
+ };
1876
+ var formatTime = (time) => {
1877
+ if (!time) return "--";
1878
+ if (time === "ASAP" || time === "\u7ACB\u5373") return time;
1879
+ try {
1880
+ const date = new Date(time);
1881
+ if (Number.isNaN(date.getTime())) return time;
1882
+ return date.toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" });
1883
+ } catch {
1884
+ return time;
1885
+ }
1886
+ };
1887
+ var renderPhaseDetails = (phaseName, phase) => {
1888
+ const details = [];
1889
+ switch (phaseName.toLowerCase()) {
1890
+ case "find":
1891
+ if ("primary_method" in phase && phase.primary_method) {
1892
+ details.push(
1893
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
1894
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
1895
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u5E73\u53F0:" }),
1896
+ /* @__PURE__ */ jsx13("span", { children: phase.primary_method.platform })
1897
+ ] }),
1898
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
1899
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u80FD\u529B:" }),
1900
+ /* @__PURE__ */ jsx13("span", { children: phase.primary_method.capability })
1901
+ ] }),
1902
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
1903
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u8986\u76D6:" }),
1904
+ /* @__PURE__ */ jsx13("span", { children: phase.primary_method.coverage })
1905
+ ] })
1906
+ ] }, "primary")
1907
+ );
1908
+ }
1909
+ if ("estimated_time" in phase && phase.estimated_time) {
1910
+ details.push(
1911
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1912
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u9884\u8BA1\u8017\u65F6:" }),
1913
+ /* @__PURE__ */ jsxs13("span", { children: [
1914
+ phase.estimated_time,
1915
+ "\u5206\u949F"
1916
+ ] }),
1917
+ "confidence_level" in phase && phase.confidence_level !== void 0 && /* @__PURE__ */ jsxs13(Fragment2, { children: [
1918
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-400", children: "| \u7F6E\u4FE1\u5EA6:" }),
1919
+ /* @__PURE__ */ jsxs13("span", { children: [
1920
+ phase.confidence_level,
1921
+ "%"
1922
+ ] })
1923
+ ] })
1924
+ ] }, "time")
1925
+ );
1926
+ }
1927
+ if ("backup_method" in phase && phase.backup_method) {
1928
+ details.push(
1929
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
1930
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u5907\u7528\u65B9\u6848:" }),
1931
+ /* @__PURE__ */ jsxs13("span", { children: [
1932
+ phase.backup_method.platform,
1933
+ " (",
1934
+ phase.backup_method.capability,
1935
+ ")",
1936
+ phase.backup_method.trigger_condition && ` - ${phase.backup_method.trigger_condition}`
1937
+ ] })
1938
+ ] }, "backup")
1939
+ );
1940
+ }
1941
+ break;
1942
+ case "fix":
1943
+ if ("accuracy_requirement" in phase && phase.accuracy_requirement) {
1944
+ details.push(
1945
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1946
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u7CBE\u5EA6\u8981\u6C42:" }),
1947
+ /* @__PURE__ */ jsx13("span", { children: phase.accuracy_requirement })
1948
+ ] }, "accuracy")
1949
+ );
1950
+ }
1951
+ if ("positioning_method" in phase && phase.positioning_method) {
1952
+ details.push(
1953
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
1954
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u5B9A\u4F4D\u65B9\u6CD5:" }),
1955
+ /* @__PURE__ */ jsxs13("span", { children: [
1956
+ phase.positioning_method.primary,
1957
+ phase.positioning_method.secondary && ` / ${phase.positioning_method.secondary}`
1958
+ ] })
1959
+ ] }, "method")
1960
+ );
1961
+ }
1962
+ if ("update_frequency" in phase && phase.update_frequency) {
1963
+ details.push(
1964
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1965
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u66F4\u65B0\u9891\u7387:" }),
1966
+ /* @__PURE__ */ jsxs13("span", { children: [
1967
+ phase.update_frequency,
1968
+ "\u79D2"
1969
+ ] })
1970
+ ] }, "freq")
1971
+ );
1972
+ }
1973
+ if ("coordinate_system" in phase && phase.coordinate_system) {
1974
+ details.push(
1975
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1976
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u5750\u6807\u7CFB\u7EDF:" }),
1977
+ /* @__PURE__ */ jsx13("span", { children: phase.coordinate_system })
1978
+ ] }, "coord")
1979
+ );
1980
+ }
1981
+ break;
1982
+ case "track":
1983
+ if ("tracking_platform" in phase && phase.tracking_platform) {
1984
+ details.push(
1985
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1986
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u8DDF\u8E2A\u5E73\u53F0:" }),
1987
+ /* @__PURE__ */ jsx13("span", { children: phase.tracking_platform })
1988
+ ] }, "platform")
1989
+ );
1990
+ }
1991
+ if ("tracking_mode" in phase && phase.tracking_mode) {
1992
+ details.push(
1993
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1994
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u8DDF\u8E2A\u6A21\u5F0F:" }),
1995
+ /* @__PURE__ */ jsx13("span", { children: phase.tracking_mode === "continuous" ? "\u8FDE\u7EED\u8DDF\u8E2A" : "\u95F4\u6B47\u8DDF\u8E2A" })
1996
+ ] }, "mode")
1997
+ );
1998
+ }
1999
+ if ("handover_procedure" in phase && phase.handover_procedure) {
2000
+ details.push(
2001
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2002
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u4EA4\u63A5\u7A0B\u5E8F:" }),
2003
+ /* @__PURE__ */ jsxs13("span", { children: [
2004
+ phase.handover_procedure.from_unit,
2005
+ " \u2192 ",
2006
+ phase.handover_procedure.to_unit,
2007
+ phase.handover_procedure.handover_criteria && ` (${phase.handover_procedure.handover_criteria})`
2008
+ ] })
2009
+ ] }, "handover")
2010
+ );
2011
+ }
2012
+ if ("track_quality_metrics" in phase && phase.track_quality_metrics) {
2013
+ details.push(
2014
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2015
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u8D28\u91CF\u6307\u6807:" }),
2016
+ /* @__PURE__ */ jsxs13("span", { children: [
2017
+ "\u66F4\u65B0\u7387",
2018
+ phase.track_quality_metrics.update_rate,
2019
+ "Hz | \u7CBE\u5EA6",
2020
+ phase.track_quality_metrics.accuracy,
2021
+ " | \u5EF6\u8FDF",
2022
+ phase.track_quality_metrics.latency,
2023
+ "\u79D2"
2024
+ ] })
2025
+ ] }, "quality")
2026
+ );
2027
+ }
2028
+ break;
2029
+ case "target":
2030
+ if ("engagement_criteria" in phase && phase.engagement_criteria?.length) {
2031
+ details.push(
2032
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
2033
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u5F00\u706B\u6761\u4EF6:" }),
2034
+ /* @__PURE__ */ jsx13("div", { className: "pl-4", children: phase.engagement_criteria.map((c, i) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2035
+ /* @__PURE__ */ jsx13("span", { className: "text-emerald-400", children: "\u2713" }),
2036
+ /* @__PURE__ */ jsx13("span", { children: c })
2037
+ ] }, i)) })
2038
+ ] }, "criteria")
2039
+ );
2040
+ }
2041
+ if ("authorization_level" in phase && phase.authorization_level) {
2042
+ details.push(
2043
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2044
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6388\u6743\u5C42\u7EA7:" }),
2045
+ /* @__PURE__ */ jsx13("span", { children: phase.authorization_level })
2046
+ ] }, "auth")
2047
+ );
2048
+ }
2049
+ if ("roe_compliance" in phase && phase.roe_compliance) {
2050
+ details.push(
2051
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
2052
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "ROE\u5408\u89C4:" }),
2053
+ phase.roe_compliance.checks?.length > 0 && /* @__PURE__ */ jsx13("div", { className: "pl-4", children: phase.roe_compliance.checks.map((check, i) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2054
+ /* @__PURE__ */ jsx13("span", { className: phase.roe_compliance.verified ? "text-emerald-400" : "text-amber-400", children: phase.roe_compliance.verified ? "\u2713" : "\u25CB" }),
2055
+ /* @__PURE__ */ jsx13("span", { children: check })
2056
+ ] }, i)) })
2057
+ ] }, "roe")
2058
+ );
2059
+ }
2060
+ if ("targeting_solution" in phase && phase.targeting_solution) {
2061
+ details.push(
2062
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2063
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u7784\u51C6\u65B9\u6848:" }),
2064
+ /* @__PURE__ */ jsxs13("span", { children: [
2065
+ phase.targeting_solution.method,
2066
+ " (",
2067
+ phase.targeting_solution.accuracy,
2068
+ ")",
2069
+ phase.targeting_solution.computed_at && ` - ${new Date(phase.targeting_solution.computed_at).toLocaleTimeString("zh-CN")}`
2070
+ ] })
2071
+ ] }, "solution")
2072
+ );
2073
+ }
2074
+ break;
2075
+ case "engage":
2076
+ if ("strike_platform" in phase && phase.strike_platform) {
2077
+ details.push(
2078
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2079
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6267\u884C\u5355\u4F4D:" }),
2080
+ /* @__PURE__ */ jsxs13("span", { children: [
2081
+ phase.strike_platform.unit,
2082
+ " / ",
2083
+ phase.strike_platform.callsign,
2084
+ phase.strike_platform.location && ` @ ${phase.strike_platform.location}`
2085
+ ] })
2086
+ ] }, "platform")
2087
+ );
2088
+ }
2089
+ if ("weapon_selection" in phase && phase.weapon_selection) {
2090
+ details.push(
2091
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2092
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6B66\u5668\u9009\u62E9:" }),
2093
+ /* @__PURE__ */ jsxs13("span", { children: [
2094
+ phase.weapon_selection.type,
2095
+ " \xD7 ",
2096
+ phase.weapon_selection.quantity,
2097
+ phase.weapon_selection.fuze_setting && ` (${phase.weapon_selection.fuze_setting})`
2098
+ ] })
2099
+ ] }, "weapon")
2100
+ );
2101
+ }
2102
+ if ("engagement_mode" in phase && phase.engagement_mode) {
2103
+ details.push(
2104
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2105
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6253\u51FB\u65B9\u5F0F:" }),
2106
+ /* @__PURE__ */ jsx13("span", { children: getEngagementModeName(phase.engagement_mode) })
2107
+ ] }, "mode")
2108
+ );
2109
+ }
2110
+ if ("tot" in phase && phase.tot) {
2111
+ details.push(
2112
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2113
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u76EE\u6807\u65F6\u95F4:" }),
2114
+ /* @__PURE__ */ jsx13("span", { children: formatTime(phase.tot) })
2115
+ ] }, "tot")
2116
+ );
2117
+ }
2118
+ if ("execution_window" in phase && phase.execution_window) {
2119
+ details.push(
2120
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2121
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6267\u884C\u7A97\u53E3:" }),
2122
+ /* @__PURE__ */ jsxs13("span", { children: [
2123
+ formatTime(phase.execution_window.start),
2124
+ " - ",
2125
+ formatTime(phase.execution_window.end)
2126
+ ] })
2127
+ ] }, "window")
2128
+ );
2129
+ }
2130
+ break;
2131
+ case "assess":
2132
+ if ("bda_methods" in phase && phase.bda_methods) {
2133
+ details.push(
2134
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2135
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "BDA\u65B9\u6CD5:" }),
2136
+ /* @__PURE__ */ jsxs13("span", { children: [
2137
+ phase.bda_methods.primary,
2138
+ phase.bda_methods.secondary?.length > 0 && ` + ${phase.bda_methods.secondary.join(" + ")}`
2139
+ ] })
2140
+ ] }, "methods")
2141
+ );
2142
+ }
2143
+ if ("assessment_timeline" in phase && phase.assessment_timeline) {
2144
+ details.push(
2145
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2146
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u8BC4\u4F30\u65F6\u9650:" }),
2147
+ /* @__PURE__ */ jsxs13("span", { children: [
2148
+ "\u521D\u6B65",
2149
+ phase.assessment_timeline.initial,
2150
+ "\u5206\u949F | \u8BE6\u7EC6",
2151
+ phase.assessment_timeline.detailed,
2152
+ "\u5C0F\u65F6"
2153
+ ] })
2154
+ ] }, "timeline")
2155
+ );
2156
+ }
2157
+ if ("success_indicators" in phase && phase.success_indicators?.length) {
2158
+ details.push(
2159
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2160
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6210\u529F\u6307\u6807:" }),
2161
+ /* @__PURE__ */ jsx13("span", { children: phase.success_indicators.join(" | ") })
2162
+ ] }, "indicators")
2163
+ );
2164
+ }
2165
+ if ("damage_categories" in phase && phase.damage_categories) {
2166
+ details.push(
2167
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2", children: [
2168
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-500", children: "\u6BC1\u4F24\u5206\u7C7B:" }),
2169
+ /* @__PURE__ */ jsx13("span", { children: "\u7269\u7406\u6BC1\u4F24 | \u529F\u80FD\u6BC1\u4F24 | \u7CFB\u7EDF\u6BC1\u4F24" })
2170
+ ] }, "damage")
2171
+ );
2172
+ }
2173
+ break;
2174
+ }
2175
+ return details.length > 0 ? details : /* @__PURE__ */ jsx13("div", { className: "text-zinc-500", children: "\u6682\u65E0\u89C4\u5212\u4FE1\u606F" });
2176
+ };
2177
+ function RiskMatrix({ risks = [] }) {
2178
+ const matrix = [
2179
+ ["\u4F4E", "\u4E2D", "\u9AD8"],
2180
+ ["\u4F4E", "\u4F4E", "\u4E2D"],
2181
+ ["\u4F4E", "\u4F4E", "\u4F4E"]
2182
+ ];
2183
+ const getRiskPosition = (risk) => {
2184
+ const probMap = { high: 2, medium: 1, low: 0 };
2185
+ const impactMap = { high: 0, medium: 1, low: 2 };
2186
+ return { x: probMap[risk.probability] || 0, y: impactMap[risk.impact] || 2 };
2187
+ };
2188
+ const riskPositions = risks.map((r, i) => ({ ...getRiskPosition(r), id: i + 1 }));
2189
+ const getCellColor = (cell) => {
2190
+ switch (cell) {
2191
+ case "\u9AD8":
2192
+ return "bg-orange-600 text-white";
2193
+ case "\u4E2D":
2194
+ return "bg-yellow-600 text-white";
2195
+ case "\u4F4E":
2196
+ return "bg-emerald-600 text-white";
2197
+ default:
2198
+ return "bg-zinc-700";
2199
+ }
2200
+ };
2201
+ return /* @__PURE__ */ jsxs13("div", { className: "flex gap-4", children: [
2202
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-col", children: [
2203
+ /* @__PURE__ */ jsx13("div", { className: "text-xs text-zinc-500 mb-1", children: "\u5F71\u54CD" }),
2204
+ /* @__PURE__ */ jsx13("div", { className: "grid grid-cols-3 gap-1", children: matrix.map((row, y) => /* @__PURE__ */ jsx13(Fragment, { children: row.map((cell, x) => /* @__PURE__ */ jsxs13(
2205
+ "div",
2206
+ {
2207
+ className: cn(
2208
+ "relative w-8 h-8 flex items-center justify-center text-xs font-semibold rounded",
2209
+ getCellColor(cell)
2210
+ ),
2211
+ children: [
2212
+ cell,
2213
+ riskPositions.filter((p) => p.x === x && p.y === y).map((p) => /* @__PURE__ */ jsx13("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx13("span", { className: "text-xs font-bold text-zinc-100 bg-zinc-900/80 rounded-full w-4 h-4 flex items-center justify-center", children: p.id }) }, p.id))
2214
+ ]
2215
+ },
2216
+ `${x}-${y}`
2217
+ )) }, y)) }),
2218
+ /* @__PURE__ */ jsx13("div", { className: "text-xs text-zinc-500 mt-1 text-center", children: "\u6982\u7387 \u2192" })
2219
+ ] }),
2220
+ /* @__PURE__ */ jsx13("div", { className: "flex-1 space-y-1", children: risks.map((risk, i) => /* @__PURE__ */ jsxs13("div", { className: "text-xs", children: [
2221
+ /* @__PURE__ */ jsxs13("span", { className: "font-medium", children: [
2222
+ i + 1,
2223
+ "."
2224
+ ] }),
2225
+ " ",
2226
+ risk.description
2227
+ ] }, i)) })
2228
+ ] });
2229
+ }
2230
+ function KillChainPhaseCard({
2231
+ name,
2232
+ phase,
2233
+ expanded,
2234
+ onToggle
2235
+ }) {
2236
+ const Icon = getPhaseIcon(name);
2237
+ return /* @__PURE__ */ jsxs13("div", { className: "border border-white/10 rounded-lg p-3 mb-2 bg-white/5", children: [
2238
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "flex w-full items-center justify-between cursor-pointer", onClick: onToggle, children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2239
+ expanded ? /* @__PURE__ */ jsx13(ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx13(ChevronRight2, { className: "w-4 h-4" }),
2240
+ /* @__PURE__ */ jsx13(Icon, { className: "w-5 h-5 text-zinc-400" }),
2241
+ /* @__PURE__ */ jsxs13("span", { className: "font-medium capitalize", children: [
2242
+ name.toUpperCase(),
2243
+ " (",
2244
+ getChineseName(name),
2245
+ ")"
2246
+ ] })
2247
+ ] }) }),
2248
+ expanded && /* @__PURE__ */ jsx13("div", { className: "mt-3 pl-10 text-sm space-y-2", children: renderPhaseDetails(name, phase) })
2249
+ ] });
2250
+ }
2251
+ function KillChainCard({ card }) {
2252
+ const payload = card.payload;
2253
+ const [expandedPhases, setExpandedPhases] = useState5(/* @__PURE__ */ new Set());
2254
+ const [showRestrike, setShowRestrike] = useState5(false);
2255
+ const [showRisk, setShowRisk] = useState5(false);
2256
+ if (!payload?.kill_chain) {
2257
+ return /* @__PURE__ */ jsx13("div", { className: "border border-red-500/50 rounded-md p-4 bg-red-500/10", children: /* @__PURE__ */ jsx13("p", { className: "text-red-400 text-sm", children: "\u6740\u4F24\u94FE\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u7F3A\u5C11\u5FC5\u8981\u7684 kill_chain \u6570\u636E" }) });
2258
+ }
2259
+ const togglePhase = (phase) => {
2260
+ setExpandedPhases((prev) => {
2261
+ const next = new Set(prev);
2262
+ if (next.has(phase)) {
2263
+ next.delete(phase);
2264
+ } else {
2265
+ next.add(phase);
2266
+ }
2267
+ return next;
2268
+ });
2269
+ };
2270
+ return /* @__PURE__ */ jsxs13("div", { className: "border border-white/10 rounded-lg shadow-lg bg-white/5", children: [
2271
+ /* @__PURE__ */ jsxs13(
2272
+ "div",
2273
+ {
2274
+ className: cn(
2275
+ "p-4 border-b border-white/10 flex items-center justify-between",
2276
+ payload.metadata?.priority === 1 && "bg-red-500/5"
2277
+ ),
2278
+ children: [
2279
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2280
+ /* @__PURE__ */ jsx13(Target2, { className: "w-6 h-6 text-zinc-200" }),
2281
+ /* @__PURE__ */ jsxs13("div", { children: [
2282
+ /* @__PURE__ */ jsxs13("h3", { className: "font-bold text-lg flex items-center gap-2 text-zinc-100", children: [
2283
+ payload.metadata?.target_id || "TGT-UNKNOWN",
2284
+ /* @__PURE__ */ jsx13("span", { className: "text-zinc-600", children: "|" }),
2285
+ payload.metadata?.target_name || card.title || "\u672A\u77E5\u76EE\u6807"
2286
+ ] }),
2287
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 mt-1", children: [
2288
+ payload.metadata?.target_type && /* @__PURE__ */ jsx13(
2289
+ "span",
2290
+ {
2291
+ className: cn(
2292
+ "px-2 py-0.5 rounded text-xs",
2293
+ payload.metadata.target_type === "fixed" ? "bg-zinc-700 text-zinc-300" : payload.metadata.target_type === "mobile" ? "bg-sky-500/20 text-sky-400" : "bg-amber-500/20 text-amber-400"
2294
+ ),
2295
+ children: payload.metadata.target_type === "fixed" ? "\u56FA\u5B9A\u76EE\u6807" : payload.metadata.target_type === "mobile" ? "\u79FB\u52A8\u76EE\u6807" : "\u65F6\u654F\u76EE\u6807"
2296
+ }
2297
+ ),
2298
+ payload.metadata?.priority && /* @__PURE__ */ jsxs13(
2299
+ "span",
2300
+ {
2301
+ className: cn(
2302
+ "px-2 py-0.5 rounded text-xs font-bold",
2303
+ getPriorityColor(payload.metadata.priority)
2304
+ ),
2305
+ children: [
2306
+ "P",
2307
+ payload.metadata.priority
2308
+ ]
2309
+ }
2310
+ ),
2311
+ payload.metadata?.classification && /* @__PURE__ */ jsx13("span", { className: "px-2 py-0.5 bg-zinc-200 text-zinc-900 rounded text-xs", children: payload.metadata.classification })
2312
+ ] })
2313
+ ] })
2314
+ ] }),
2315
+ /* @__PURE__ */ jsxs13("div", { className: "text-right", children: [
2316
+ payload.metadata?.created_at && /* @__PURE__ */ jsxs13("div", { className: "text-xs text-zinc-500", children: [
2317
+ /* @__PURE__ */ jsx13(Clock4, { className: "w-3 h-3 inline mr-1" }),
2318
+ "\u521B\u5EFA: ",
2319
+ new Date(payload.metadata.created_at).toLocaleString("zh-CN")
2320
+ ] }),
2321
+ payload.metadata?.updated_at && /* @__PURE__ */ jsxs13("div", { className: "text-xs text-zinc-500", children: [
2322
+ "\u66F4\u65B0: ",
2323
+ new Date(payload.metadata.updated_at).toLocaleString("zh-CN")
2324
+ ] })
2325
+ ] })
2326
+ ]
2327
+ }
2328
+ ),
2329
+ /* @__PURE__ */ jsxs13("div", { className: "p-4", children: [
2330
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-between mb-4", children: /* @__PURE__ */ jsx13("h4", { className: "font-semibold text-base text-zinc-200", children: "F2T2EA \u6740\u4F24\u94FE\u89C4\u5212" }) }),
2331
+ /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: Object.entries(payload.kill_chain).map(([name, phase]) => /* @__PURE__ */ jsx13(
2332
+ KillChainPhaseCard,
2333
+ {
2334
+ name,
2335
+ phase,
2336
+ expanded: expandedPhases.has(name),
2337
+ onToggle: () => togglePhase(name)
2338
+ },
2339
+ name
2340
+ )) })
2341
+ ] }),
2342
+ payload.restrike_plan && /* @__PURE__ */ jsxs13("div", { className: "border-t border-white/10 p-4", children: [
2343
+ /* @__PURE__ */ jsxs13(
2344
+ "button",
2345
+ {
2346
+ type: "button",
2347
+ className: "flex w-full items-center justify-between cursor-pointer",
2348
+ onClick: () => setShowRestrike(!showRestrike),
2349
+ children: [
2350
+ /* @__PURE__ */ jsxs13("h4", { className: "font-semibold text-base flex items-center gap-2 text-zinc-200", children: [
2351
+ /* @__PURE__ */ jsx13(Zap, { className: "w-4 h-4" }),
2352
+ "\u518D\u653B\u51FB\u8BA1\u5212"
2353
+ ] }),
2354
+ showRestrike ? /* @__PURE__ */ jsx13(ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx13(ChevronRight2, { className: "w-4 h-4" })
2355
+ ]
2356
+ }
2357
+ ),
2358
+ showRestrike && /* @__PURE__ */ jsxs13("div", { className: "mt-3 space-y-3 text-sm", children: [
2359
+ payload.restrike_plan.trigger_conditions && /* @__PURE__ */ jsxs13("div", { children: [
2360
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u89E6\u53D1\u6761\u4EF6:" }),
2361
+ /* @__PURE__ */ jsx13("ul", { className: "mt-1 ml-4 list-disc", children: payload.restrike_plan.trigger_conditions.map((c, i) => /* @__PURE__ */ jsx13("li", { children: c }, i)) })
2362
+ ] }),
2363
+ payload.restrike_plan.reserved_resources && /* @__PURE__ */ jsxs13("div", { children: [
2364
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u9884\u7559\u8D44\u6E90:" }),
2365
+ /* @__PURE__ */ jsxs13("div", { className: "mt-1 ml-4", children: [
2366
+ /* @__PURE__ */ jsxs13("div", { children: [
2367
+ "\u5E73\u53F0: ",
2368
+ payload.restrike_plan.reserved_resources.platform
2369
+ ] }),
2370
+ payload.restrike_plan.reserved_resources.weapons.map((w, i) => /* @__PURE__ */ jsxs13("div", { children: [
2371
+ "\u6B66\u5668: ",
2372
+ w.type,
2373
+ " \xD7 ",
2374
+ w.quantity
2375
+ ] }, i))
2376
+ ] })
2377
+ ] }),
2378
+ payload.restrike_plan.execution_method && /* @__PURE__ */ jsxs13("div", { children: [
2379
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u6267\u884C\u65B9\u5F0F:" }),
2380
+ /* @__PURE__ */ jsx13("span", { className: "ml-2", children: payload.restrike_plan.execution_method })
2381
+ ] }),
2382
+ payload.restrike_plan.decision_authority && /* @__PURE__ */ jsxs13("div", { children: [
2383
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u51B3\u7B56\u6743\u9650:" }),
2384
+ /* @__PURE__ */ jsx13("span", { className: "ml-2", children: payload.restrike_plan.decision_authority })
2385
+ ] })
2386
+ ] })
2387
+ ] }),
2388
+ payload.risk_management && /* @__PURE__ */ jsxs13("div", { className: "border-t border-white/10 p-4", children: [
2389
+ /* @__PURE__ */ jsxs13(
2390
+ "button",
2391
+ {
2392
+ type: "button",
2393
+ className: "flex w-full items-center justify-between cursor-pointer",
2394
+ onClick: () => setShowRisk(!showRisk),
2395
+ children: [
2396
+ /* @__PURE__ */ jsxs13("h4", { className: "font-semibold text-base flex items-center gap-2 text-zinc-200", children: [
2397
+ /* @__PURE__ */ jsx13(AlertTriangle2, { className: "w-4 h-4 text-amber-400" }),
2398
+ "\u98CE\u9669\u4E0E\u9650\u5236"
2399
+ ] }),
2400
+ showRisk ? /* @__PURE__ */ jsx13(ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx13(ChevronRight2, { className: "w-4 h-4" })
2401
+ ]
2402
+ }
2403
+ ),
2404
+ showRisk && /* @__PURE__ */ jsxs13("div", { className: "mt-3 space-y-3 text-sm", children: [
2405
+ payload.risk_management.identified_risks && payload.risk_management.identified_risks.length > 0 && /* @__PURE__ */ jsxs13("div", { children: [
2406
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u98CE\u9669\u8BC4\u4F30\u77E9\u9635:" }),
2407
+ /* @__PURE__ */ jsx13("div", { className: "mt-2", children: /* @__PURE__ */ jsx13(RiskMatrix, { risks: payload.risk_management.identified_risks }) })
2408
+ ] }),
2409
+ payload.risk_management.constraints && /* @__PURE__ */ jsxs13("div", { children: [
2410
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u9650\u5236\u6761\u4EF6:" }),
2411
+ /* @__PURE__ */ jsxs13("ul", { className: "mt-1 ml-4 list-disc", children: [
2412
+ payload.risk_management.constraints.weather_limits && /* @__PURE__ */ jsxs13("li", { children: [
2413
+ "\u5929\u6C14: ",
2414
+ payload.risk_management.constraints.weather_limits
2415
+ ] }),
2416
+ payload.risk_management.constraints.roe_restrictions?.map((r, i) => /* @__PURE__ */ jsxs13("li", { children: [
2417
+ "ROE: ",
2418
+ r
2419
+ ] }, i)),
2420
+ payload.risk_management.constraints.time_constraints && /* @__PURE__ */ jsxs13("li", { children: [
2421
+ "\u65F6\u95F4: ",
2422
+ payload.risk_management.constraints.time_constraints
2423
+ ] }),
2424
+ payload.risk_management.constraints.resource_limitations?.map((r, i) => /* @__PURE__ */ jsxs13("li", { children: [
2425
+ "\u8D44\u6E90: ",
2426
+ r
2427
+ ] }, i))
2428
+ ] })
2429
+ ] }),
2430
+ payload.risk_management.contingency_plans && payload.risk_management.contingency_plans.length > 0 && /* @__PURE__ */ jsxs13("div", { children: [
2431
+ /* @__PURE__ */ jsx13("span", { className: "font-medium text-zinc-500", children: "\u5E94\u6025\u9884\u6848:" }),
2432
+ /* @__PURE__ */ jsx13("div", { className: "mt-1 ml-4", children: payload.risk_management.contingency_plans.map((plan, i) => /* @__PURE__ */ jsxs13("div", { className: "mb-1", children: [
2433
+ /* @__PURE__ */ jsxs13("strong", { children: [
2434
+ plan.scenario,
2435
+ ":"
2436
+ ] }),
2437
+ " ",
2438
+ plan.response,
2439
+ plan.trigger && ` (\u89E6\u53D1: ${plan.trigger})`
2440
+ ] }, i)) })
2441
+ ] })
2442
+ ] })
2443
+ ] }),
2444
+ /* @__PURE__ */ jsxs13("div", { className: "border-t border-white/10 p-3 flex items-center justify-center gap-3 text-sm", children: [
2445
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "text-sky-400 hover:text-sky-300", children: "[\u89C4\u5212\u8BE6\u60C5]" }),
2446
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "text-sky-400 hover:text-sky-300", children: "[\u5BFC\u51FA\u8BA1\u5212]" }),
2447
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "text-sky-400 hover:text-sky-300", children: "[\u4FEE\u6539\u65B9\u6848]" }),
2448
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "text-sky-400 hover:text-sky-300", children: "[\u63D0\u4EA4\u5BA1\u6279]" })
2449
+ ] })
2450
+ ] });
2451
+ }
2452
+
2453
+ // src/react/components/card/cards/map-card.tsx
2454
+ import { MapPin as MapPin5, Navigation } from "lucide-react";
2455
+ import { useMemo as useMemo6 } from "react";
2456
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
2457
+ var sideLabel = {
2458
+ red: "\u7EA2\u65B9",
2459
+ blue: "\u84DD\u65B9",
2460
+ neutral: "\u4E2D\u7ACB"
2461
+ };
2462
+ var sideColor = {
2463
+ red: "text-red-400",
2464
+ blue: "text-sky-400",
2465
+ neutral: "text-zinc-400"
2466
+ };
2467
+ var sideDot = {
2468
+ red: "bg-red-500",
2469
+ blue: "bg-sky-500",
2470
+ neutral: "bg-zinc-500"
2471
+ };
2472
+ var typeLabel = {
2473
+ plane: "\u98DE\u673A",
2474
+ ship: "\u8230\u8239",
2475
+ ground: "\u5730\u9762",
2476
+ missile: "\u5BFC\u5F39",
2477
+ radar: "\u96F7\u8FBE",
2478
+ base: "\u57FA\u5730"
2479
+ };
2480
+ function MapCard({ card }) {
2481
+ const payload = card.payload;
2482
+ const title = card.title || "\u6218\u672F\u5730\u56FE";
2483
+ const focusPoint = payload?.focusPoint || { lat: 0, lon: 0 };
2484
+ const zoomLevel = payload?.zoomLevel || 8;
2485
+ const units = payload?.units || [];
2486
+ const regions = payload?.regions || [];
2487
+ const strikes = payload?.strikes || [];
2488
+ const unitsByGroup = useMemo6(() => {
2489
+ const groups = { red: [], blue: [], neutral: [] };
2490
+ for (const unit of units) {
2491
+ const side = unit.side || "neutral";
2492
+ if (!groups[side]) groups[side] = [];
2493
+ groups[side].push(unit);
2494
+ }
2495
+ return groups;
2496
+ }, [units]);
2497
+ return /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border border-white/10 bg-white/5", children: [
2498
+ /* @__PURE__ */ jsx14("div", { className: "p-4 border-b border-white/10", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
2499
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
2500
+ /* @__PURE__ */ jsx14(MapPin5, { className: "w-5 h-5 text-sky-400" }),
2501
+ /* @__PURE__ */ jsx14("h3", { className: "font-semibold text-lg text-zinc-100", children: title })
2502
+ ] }),
2503
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-4 text-sm text-zinc-400", children: [
2504
+ /* @__PURE__ */ jsxs14("span", { children: [
2505
+ "\u5355\u4F4D\u6570: ",
2506
+ units.length
2507
+ ] }),
2508
+ /* @__PURE__ */ jsxs14("span", { children: [
2509
+ "\u4E2D\u5FC3\u70B9: ",
2510
+ focusPoint.lat.toFixed(2),
2511
+ ", ",
2512
+ focusPoint.lon.toFixed(2)
2513
+ ] }),
2514
+ /* @__PURE__ */ jsxs14("span", { children: [
2515
+ "\u7F29\u653E: ",
2516
+ zoomLevel
2517
+ ] })
2518
+ ] })
2519
+ ] }) }),
2520
+ /* @__PURE__ */ jsxs14("div", { className: "p-4 space-y-4", children: [
2521
+ units.length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
2522
+ /* @__PURE__ */ jsx14("h4", { className: "text-sm font-semibold text-zinc-200 mb-2", children: "\u4F5C\u6218\u5355\u4F4D" }),
2523
+ /* @__PURE__ */ jsx14("div", { className: "flex gap-4 mb-3 text-sm", children: ["blue", "red", "neutral"].map((side) => {
2524
+ const count = unitsByGroup[side]?.length || 0;
2525
+ if (count === 0) return null;
2526
+ return /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
2527
+ /* @__PURE__ */ jsx14("div", { className: cn("w-3 h-3 rounded", sideDot[side]) }),
2528
+ /* @__PURE__ */ jsxs14("span", { className: "text-zinc-300", children: [
2529
+ sideLabel[side],
2530
+ ": ",
2531
+ count
2532
+ ] })
2533
+ ] }, side);
2534
+ }) }),
2535
+ /* @__PURE__ */ jsx14("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs14("table", { className: "w-full text-sm border-collapse", children: [
2536
+ /* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsxs14("tr", { className: "border-b border-white/10", children: [
2537
+ /* @__PURE__ */ jsx14("th", { className: "text-left p-2 text-zinc-400", children: "\u540D\u79F0" }),
2538
+ /* @__PURE__ */ jsx14("th", { className: "text-left p-2 text-zinc-400", children: "\u7C7B\u578B" }),
2539
+ /* @__PURE__ */ jsx14("th", { className: "text-left p-2 text-zinc-400", children: "\u9635\u8425" }),
2540
+ /* @__PURE__ */ jsx14("th", { className: "text-right p-2 text-zinc-400", children: "\u7EAC\u5EA6" }),
2541
+ /* @__PURE__ */ jsx14("th", { className: "text-right p-2 text-zinc-400", children: "\u7ECF\u5EA6" })
2542
+ ] }) }),
2543
+ /* @__PURE__ */ jsx14("tbody", { children: units.map((unit, i) => /* @__PURE__ */ jsxs14("tr", { className: "border-b border-white/5", children: [
2544
+ /* @__PURE__ */ jsx14("td", { className: "p-2 text-zinc-200", children: unit.name }),
2545
+ /* @__PURE__ */ jsx14("td", { className: "p-2 text-zinc-300", children: typeLabel[unit.type] || unit.type }),
2546
+ /* @__PURE__ */ jsx14("td", { className: cn("p-2 font-medium", sideColor[unit.side]), children: sideLabel[unit.side] || unit.side }),
2547
+ /* @__PURE__ */ jsx14("td", { className: "p-2 text-right text-zinc-300 font-mono text-xs", children: unit.lat.toFixed(3) }),
2548
+ /* @__PURE__ */ jsx14("td", { className: "p-2 text-right text-zinc-300 font-mono text-xs", children: unit.lon.toFixed(3) })
2549
+ ] }, i)) })
2550
+ ] }) })
2551
+ ] }),
2552
+ regions.length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
2553
+ /* @__PURE__ */ jsx14("h4", { className: "text-sm font-semibold text-zinc-200 mb-2", children: "\u533A\u57DF" }),
2554
+ /* @__PURE__ */ jsx14("div", { className: "space-y-2", children: regions.map((region, i) => /* @__PURE__ */ jsxs14(
2555
+ "div",
2556
+ {
2557
+ className: "rounded border border-white/10 p-3 bg-white/5",
2558
+ children: [
2559
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 mb-1", children: [
2560
+ /* @__PURE__ */ jsx14("div", { className: "w-3 h-3 rounded bg-sky-500/50 border border-sky-500" }),
2561
+ /* @__PURE__ */ jsx14("span", { className: "font-medium text-zinc-200", children: region.label || `\u533A\u57DF ${i + 1}` }),
2562
+ /* @__PURE__ */ jsxs14("span", { className: "text-xs text-zinc-500", children: [
2563
+ "(",
2564
+ region.points.length,
2565
+ " \u4E2A\u9876\u70B9)"
2566
+ ] })
2567
+ ] }),
2568
+ /* @__PURE__ */ jsx14("div", { className: "text-xs text-zinc-400 font-mono", children: region.points.map((p) => `(${p.lat.toFixed(2)}, ${p.lon.toFixed(2)})`).join(" \u2192 ") })
2569
+ ]
2570
+ },
2571
+ i
2572
+ )) })
2573
+ ] }),
2574
+ strikes.length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
2575
+ /* @__PURE__ */ jsx14("h4", { className: "text-sm font-semibold text-zinc-200 mb-2", children: "\u6253\u51FB\u7EBF\u8DEF" }),
2576
+ /* @__PURE__ */ jsx14("div", { className: "space-y-2", children: strikes.map((strike, i) => {
2577
+ const color = strike.color || "red";
2578
+ return /* @__PURE__ */ jsxs14(
2579
+ "div",
2580
+ {
2581
+ className: "rounded border border-white/10 p-3 bg-white/5 flex items-center gap-3",
2582
+ children: [
2583
+ /* @__PURE__ */ jsx14(
2584
+ Navigation,
2585
+ {
2586
+ className: cn(
2587
+ "w-4 h-4 flex-shrink-0",
2588
+ color === "red" ? "text-red-400" : "text-sky-400"
2589
+ )
2590
+ }
2591
+ ),
2592
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1 text-sm", children: [
2593
+ /* @__PURE__ */ jsx14("span", { className: "font-medium text-zinc-200", children: strike.label || `\u6253\u51FB ${i + 1}` }),
2594
+ /* @__PURE__ */ jsx14("span", { className: "text-zinc-500 mx-2", children: "|" }),
2595
+ /* @__PURE__ */ jsxs14("span", { className: "text-zinc-400 font-mono text-xs", children: [
2596
+ "(",
2597
+ strike.from.lat.toFixed(3),
2598
+ ", ",
2599
+ strike.from.lon.toFixed(3),
2600
+ ")"
2601
+ ] }),
2602
+ /* @__PURE__ */ jsx14("span", { className: "text-zinc-500 mx-1", children: "\u2192" }),
2603
+ /* @__PURE__ */ jsxs14("span", { className: "text-zinc-400 font-mono text-xs", children: [
2604
+ "(",
2605
+ strike.to.lat.toFixed(3),
2606
+ ", ",
2607
+ strike.to.lon.toFixed(3),
2608
+ ")"
2609
+ ] })
2610
+ ] }),
2611
+ /* @__PURE__ */ jsx14(
2612
+ "span",
2613
+ {
2614
+ className: cn(
2615
+ "text-xs px-2 py-0.5 rounded",
2616
+ color === "red" ? "bg-red-500/20 text-red-400" : "bg-sky-500/20 text-sky-400"
2617
+ ),
2618
+ children: color === "red" ? "\u7EA2\u65B9" : "\u84DD\u65B9"
2619
+ }
2620
+ )
2621
+ ]
2622
+ },
2623
+ i
2624
+ );
2625
+ }) })
2626
+ ] }),
2627
+ units.length === 0 && regions.length === 0 && strikes.length === 0 && /* @__PURE__ */ jsx14("div", { className: "text-center text-zinc-500 py-8", children: "\u6682\u65E0\u5730\u56FE\u6570\u636E" })
2628
+ ] })
2629
+ ] });
2630
+ }
2631
+
2632
+ // src/react/components/card/cards/order-status-card.tsx
2633
+ import { AlertCircle, CheckCircle, Clock as Clock5, Package, Truck } from "lucide-react";
2634
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
2635
+ var statusConfig = {
2636
+ pending: {
2637
+ text: "\u5F85\u786E\u8BA4",
2638
+ color: "bg-yellow-500/10 text-yellow-400",
2639
+ icon: Clock5,
2640
+ description: "\u8BA2\u5355\u5DF2\u63D0\u4EA4\uFF0C\u7B49\u5F85\u786E\u8BA4"
2641
+ },
2642
+ confirmed: {
2643
+ text: "\u5DF2\u786E\u8BA4",
2644
+ color: "bg-blue-500/10 text-blue-400",
2645
+ icon: CheckCircle,
2646
+ description: "\u8BA2\u5355\u5DF2\u786E\u8BA4\uFF0C\u51C6\u5907\u53D1\u8D27"
2647
+ },
2648
+ shipped: {
2649
+ text: "\u5DF2\u53D1\u8D27",
2650
+ color: "bg-purple-500/10 text-purple-400",
2651
+ icon: Package,
2652
+ description: "\u5546\u54C1\u5DF2\u53D1\u51FA"
2653
+ },
2654
+ delivering: {
2655
+ text: "\u914D\u9001\u4E2D",
2656
+ color: "bg-indigo-500/10 text-indigo-400",
2657
+ icon: Truck,
2658
+ description: "\u5546\u54C1\u6B63\u5728\u914D\u9001\u9014\u4E2D"
2659
+ },
2660
+ delivered: {
2661
+ text: "\u5DF2\u9001\u8FBE",
2662
+ color: "bg-green-500/10 text-green-400",
2663
+ icon: CheckCircle,
2664
+ description: "\u8BA2\u5355\u5DF2\u5B8C\u6210"
2665
+ },
2666
+ cancelled: {
2667
+ text: "\u5DF2\u53D6\u6D88",
2668
+ color: "bg-red-500/10 text-red-400",
2669
+ icon: AlertCircle,
2670
+ description: "\u8BA2\u5355\u5DF2\u53D6\u6D88"
2671
+ }
2672
+ };
2673
+ var logisticsStatusConfig = {
2674
+ picked_up: "\u5DF2\u63FD\u6536",
2675
+ in_transit: "\u8FD0\u8F93\u4E2D",
2676
+ out_for_delivery: "\u6D3E\u9001\u4E2D",
2677
+ delivered: "\u5DF2\u9001\u8FBE"
2678
+ };
2679
+ function OrderStatusCard({ card }) {
2680
+ const payload = card.payload;
2681
+ if (!payload || !payload.orderId) {
2682
+ return /* @__PURE__ */ jsx15("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx15("p", { className: "text-sm text-red-400", children: "\u8BA2\u5355\u72B6\u6001\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u9700\u8981 orderId" }) });
2683
+ }
2684
+ const currentStatus = statusConfig[payload.status] ?? statusConfig.pending;
2685
+ const StatusIcon = currentStatus.icon;
2686
+ return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 shadow-sm", children: [
2687
+ /* @__PURE__ */ jsxs15("div", { className: "mb-4 flex items-start justify-between", children: [
2688
+ /* @__PURE__ */ jsxs15("div", { children: [
2689
+ card.title && /* @__PURE__ */ jsx15("h3", { className: "mb-1 text-lg font-semibold text-[hsl(var(--foreground))]", children: card.title }),
2690
+ /* @__PURE__ */ jsxs15("p", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: [
2691
+ "\u8BA2\u5355\u53F7: ",
2692
+ payload.orderId
2693
+ ] })
2694
+ ] }),
2695
+ /* @__PURE__ */ jsxs15(
2696
+ "div",
2697
+ {
2698
+ className: cn(
2699
+ "flex items-center gap-1 rounded-full px-3 py-1 text-sm font-medium",
2700
+ currentStatus.color
2701
+ ),
2702
+ children: [
2703
+ /* @__PURE__ */ jsx15(StatusIcon, { className: "h-4 w-4" }),
2704
+ currentStatus.text
2705
+ ]
2706
+ }
2707
+ )
2708
+ ] }),
2709
+ /* @__PURE__ */ jsxs15("div", { className: "mb-4 grid grid-cols-2 gap-4 rounded-md bg-[hsl(var(--muted)/0.3)] p-3", children: [
2710
+ /* @__PURE__ */ jsxs15("div", { children: [
2711
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u5355\u65F6\u95F4" }),
2712
+ /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium", children: payload.orderDate })
2713
+ ] }),
2714
+ /* @__PURE__ */ jsxs15("div", { children: [
2715
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BA2\u5355\u91D1\u989D" }),
2716
+ /* @__PURE__ */ jsxs15("p", { className: "text-sm font-medium", children: [
2717
+ "\xA5",
2718
+ payload.totalAmount
2719
+ ] })
2720
+ ] }),
2721
+ /* @__PURE__ */ jsxs15("div", { children: [
2722
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u5546\u54C1\u6570\u91CF" }),
2723
+ /* @__PURE__ */ jsxs15("p", { className: "text-sm font-medium", children: [
2724
+ payload.itemCount,
2725
+ " \u4EF6"
2726
+ ] })
2727
+ ] }),
2728
+ /* @__PURE__ */ jsxs15("div", { children: [
2729
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u8D2D\u4E70\u5E73\u53F0" }),
2730
+ /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium", children: payload.platform })
2731
+ ] })
2732
+ ] }),
2733
+ /* @__PURE__ */ jsxs15("div", { className: "mb-4", children: [
2734
+ /* @__PURE__ */ jsx15("p", { className: "text-sm text-[hsl(var(--foreground))]", children: currentStatus.description }),
2735
+ payload.nextAction && /* @__PURE__ */ jsxs15("p", { className: "mt-1 text-sm text-[hsl(var(--primary))]", children: [
2736
+ "\u4E0B\u4E00\u6B65: ",
2737
+ payload.nextAction
2738
+ ] })
2739
+ ] }),
2740
+ payload.logistics && /* @__PURE__ */ jsxs15("div", { className: "mb-4 border-t border-[hsl(var(--border))] pt-4", children: [
2741
+ /* @__PURE__ */ jsxs15("h4", { className: "mb-3 flex items-center gap-2 text-sm font-medium", children: [
2742
+ /* @__PURE__ */ jsx15(Truck, { className: "h-4 w-4" }),
2743
+ "\u7269\u6D41\u4FE1\u606F"
2744
+ ] }),
2745
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2 text-sm", children: [
2746
+ /* @__PURE__ */ jsxs15("div", { className: "flex justify-between", children: [
2747
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u8FD0\u5355\u53F7:" }),
2748
+ /* @__PURE__ */ jsx15("span", { className: "font-mono", children: payload.logistics.trackingNumber })
2749
+ ] }),
2750
+ /* @__PURE__ */ jsxs15("div", { className: "flex justify-between", children: [
2751
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u627F\u8FD0\u5546:" }),
2752
+ /* @__PURE__ */ jsx15("span", { children: payload.logistics.carrier })
2753
+ ] }),
2754
+ /* @__PURE__ */ jsxs15("div", { className: "flex justify-between", children: [
2755
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u72B6\u6001:" }),
2756
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--primary))]", children: logisticsStatusConfig[payload.logistics.status] })
2757
+ ] }),
2758
+ payload.logistics.currentLocation && /* @__PURE__ */ jsxs15("div", { className: "flex justify-between", children: [
2759
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u5F53\u524D\u4F4D\u7F6E:" }),
2760
+ /* @__PURE__ */ jsx15("span", { children: payload.logistics.currentLocation })
2761
+ ] }),
2762
+ payload.logistics.estimatedDelivery && /* @__PURE__ */ jsxs15("div", { className: "flex justify-between", children: [
2763
+ /* @__PURE__ */ jsx15("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u9884\u8BA1\u9001\u8FBE:" }),
2764
+ /* @__PURE__ */ jsx15("span", { className: "text-green-400", children: payload.logistics.estimatedDelivery })
2765
+ ] }),
2766
+ payload.logistics.lastUpdate && /* @__PURE__ */ jsxs15("div", { className: "mt-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
2767
+ "\u6700\u540E\u66F4\u65B0: ",
2768
+ payload.logistics.lastUpdate
2769
+ ] })
2770
+ ] })
2771
+ ] })
2772
+ ] });
2773
+ }
2774
+
2775
+ // src/react/components/card/cards/patch-card.tsx
2776
+ import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight3, FileEdit } from "lucide-react";
2777
+ import { useState as useState6 } from "react";
2778
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
2779
+ function getDiffLineClassName(line) {
2780
+ if (line.startsWith("+") && !line.startsWith("+++")) {
2781
+ return "bg-green-900/30 text-green-200";
2782
+ }
2783
+ if (line.startsWith("-") && !line.startsWith("---")) {
2784
+ return "bg-red-900/30 text-red-200";
2785
+ }
2786
+ if (line.startsWith("@@")) {
2787
+ return "text-blue-400 bg-blue-900/20";
2788
+ }
2789
+ if (line.startsWith("---") || line.startsWith("+++")) {
2790
+ return "font-semibold text-[hsl(var(--muted-foreground))]";
2791
+ }
2792
+ return "text-[hsl(var(--muted-foreground))]";
2793
+ }
2794
+ function getDisplayFileName(filePath) {
2795
+ const parts = filePath.split("/");
2796
+ return parts[parts.length - 1] || filePath;
2797
+ }
2798
+ function SinglePatch({
2799
+ patch,
2800
+ defaultExpanded = false
2801
+ }) {
2802
+ const [isExpanded, setIsExpanded] = useState6(defaultExpanded);
2803
+ return /* @__PURE__ */ jsxs16("div", { className: "my-2 overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))]", children: [
2804
+ /* @__PURE__ */ jsxs16(
2805
+ "button",
2806
+ {
2807
+ type: "button",
2808
+ onClick: () => setIsExpanded(!isExpanded),
2809
+ className: "flex w-full items-center justify-between px-3 py-2 hover:bg-[hsl(var(--muted))]/50",
2810
+ children: [
2811
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
2812
+ /* @__PURE__ */ jsx16(FileEdit, { className: "h-4 w-4 text-[hsl(var(--muted-foreground))]" }),
2813
+ /* @__PURE__ */ jsx16("span", { className: "text-sm font-medium", children: getDisplayFileName(patch.filePath) }),
2814
+ /* @__PURE__ */ jsxs16("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
2815
+ "(",
2816
+ patch.filePath,
2817
+ ")"
2818
+ ] })
2819
+ ] }),
2820
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
2821
+ /* @__PURE__ */ jsxs16("span", { className: "text-xs", children: [
2822
+ /* @__PURE__ */ jsxs16("span", { className: "font-medium text-green-400", children: [
2823
+ "+",
2824
+ patch.stats.additions
2825
+ ] }),
2826
+ " / ",
2827
+ /* @__PURE__ */ jsxs16("span", { className: "font-medium text-red-400", children: [
2828
+ "-",
2829
+ patch.stats.deletions
2830
+ ] })
2831
+ ] }),
2832
+ isExpanded ? /* @__PURE__ */ jsx16(ChevronDown2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx16(ChevronRight3, { className: "h-4 w-4" })
2833
+ ] })
2834
+ ]
2835
+ }
2836
+ ),
2837
+ isExpanded && /* @__PURE__ */ jsx16("div", { className: "max-h-80 overflow-auto", children: /* @__PURE__ */ jsx16("pre", { className: "overflow-x-auto whitespace-pre bg-[hsl(var(--muted))]/30 p-3 font-mono text-xs", children: patch.unifiedDiff.split("\n").map((line, lineIndex) => /* @__PURE__ */ jsx16("div", { className: getDiffLineClassName(line), children: line }, lineIndex)) }) })
2838
+ ] });
2839
+ }
2840
+ function PatchCard({ card }) {
2841
+ const payload = card.payload;
2842
+ if (!payload) {
2843
+ return /* @__PURE__ */ jsx16("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx16("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u65E0\u8865\u4E01\u6570\u636E" }) });
2844
+ }
2845
+ const patches = payload.patches || [
2846
+ {
2847
+ filePath: payload.filePath,
2848
+ unifiedDiff: payload.unifiedDiff,
2849
+ stats: payload.stats
2850
+ }
2851
+ ];
2852
+ return /* @__PURE__ */ jsx16("div", { className: "space-y-2", children: patches.map((patch, index) => /* @__PURE__ */ jsx16(SinglePatch, { patch }, `${patch.filePath}-${index}`)) });
2853
+ }
2854
+
2855
+ // src/react/components/card/cards/product-recommendation-card.tsx
2856
+ import { Star as Star4 } from "lucide-react";
2857
+ import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
2858
+ function RatingStars({ rating }) {
2859
+ if (!rating) return null;
2860
+ return /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
2861
+ [...Array(5)].map((_, i) => /* @__PURE__ */ jsx17(
2862
+ Star4,
2863
+ {
2864
+ className: cn(
2865
+ "h-3 w-3",
2866
+ i < Math.floor(rating) ? "fill-yellow-400 text-yellow-400" : "text-[hsl(var(--muted-foreground)/0.3)]"
2867
+ )
2868
+ },
2869
+ i
2870
+ )),
2871
+ /* @__PURE__ */ jsx17("span", { className: "ml-1 text-xs text-[hsl(var(--muted-foreground))]", children: rating })
2872
+ ] });
2873
+ }
2874
+ function ProductRecommendationCard({ card }) {
2875
+ const payload = card.payload;
2876
+ if (!payload || !Array.isArray(payload.products)) {
2877
+ return /* @__PURE__ */ jsx17("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx17("p", { className: "text-sm text-red-400", children: "\u5546\u54C1\u63A8\u8350\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u9700\u8981 products \u6570\u7EC4" }) });
2878
+ }
2879
+ return /* @__PURE__ */ jsxs17("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 shadow-sm", children: [
2880
+ /* @__PURE__ */ jsxs17("div", { className: "mb-4 flex items-center justify-between", children: [
2881
+ card.title && /* @__PURE__ */ jsx17("h3", { className: "text-lg font-semibold text-[hsl(var(--foreground))]", children: card.title }),
2882
+ payload.category && /* @__PURE__ */ jsx17("span", { className: "rounded-full bg-[hsl(var(--secondary))] px-2 py-1 text-xs text-[hsl(var(--secondary-foreground))]", children: payload.category })
2883
+ ] }),
2884
+ payload.totalCount && /* @__PURE__ */ jsxs17("p", { className: "mb-3 text-sm text-[hsl(var(--muted-foreground))]", children: [
2885
+ "\u5171\u627E\u5230 ",
2886
+ payload.totalCount,
2887
+ " \u4E2A\u76F8\u5173\u5546\u54C1\uFF0C\u663E\u793A\u524D ",
2888
+ payload.products.length,
2889
+ " \u4E2A"
2890
+ ] }),
2891
+ /* @__PURE__ */ jsx17("div", { className: "mb-4 grid grid-cols-1 gap-4 md:grid-cols-2", children: payload.products.map((product, index) => /* @__PURE__ */ jsx17(
2892
+ "div",
2893
+ {
2894
+ className: "rounded-lg border border-[hsl(var(--border))] p-3 transition-shadow hover:shadow-md",
2895
+ children: /* @__PURE__ */ jsxs17("div", { className: "flex gap-3", children: [
2896
+ product.imageUrl && /* @__PURE__ */ jsx17("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx17(
2897
+ "img",
2898
+ {
2899
+ src: product.imageUrl,
2900
+ alt: product.name,
2901
+ className: "h-16 w-16 rounded border border-[hsl(var(--border))] object-cover"
2902
+ }
2903
+ ) }),
2904
+ /* @__PURE__ */ jsxs17("div", { className: "min-w-0 flex-1", children: [
2905
+ /* @__PURE__ */ jsx17("h4", { className: "mb-1 line-clamp-2 text-sm font-medium text-[hsl(var(--foreground))]", children: product.name }),
2906
+ product.rating && /* @__PURE__ */ jsxs17("div", { className: "mb-2 flex items-center gap-2", children: [
2907
+ /* @__PURE__ */ jsx17(RatingStars, { rating: product.rating }),
2908
+ product.reviewCount && /* @__PURE__ */ jsxs17("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
2909
+ "(",
2910
+ product.reviewCount,
2911
+ "\u8BC4\u4EF7)"
2912
+ ] })
2913
+ ] }),
2914
+ product.features && /* @__PURE__ */ jsx17("div", { className: "mb-2 flex flex-wrap gap-1", children: product.features.slice(0, 2).map((feature, index2) => /* @__PURE__ */ jsx17(
2915
+ "span",
2916
+ {
2917
+ className: "rounded bg-[hsl(var(--primary)/0.1)] px-1 py-0.5 text-xs text-[hsl(var(--primary))]",
2918
+ children: feature
2919
+ },
2920
+ index2
2921
+ )) }),
2922
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-end justify-between", children: [
2923
+ /* @__PURE__ */ jsxs17("div", { children: [
2924
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
2925
+ /* @__PURE__ */ jsxs17("span", { className: "text-lg font-bold text-red-400", children: [
2926
+ "\xA5",
2927
+ product.price
2928
+ ] }),
2929
+ product.originalPrice && product.originalPrice > product.price && /* @__PURE__ */ jsxs17("span", { className: "text-sm text-[hsl(var(--muted-foreground))] line-through", children: [
2930
+ "\xA5",
2931
+ product.originalPrice
2932
+ ] })
2933
+ ] }),
2934
+ product.discount && /* @__PURE__ */ jsx17("span", { className: "text-xs font-medium text-red-400", children: product.discount })
2935
+ ] }),
2936
+ /* @__PURE__ */ jsx17("div", { className: "text-right", children: /* @__PURE__ */ jsx17("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: product.platform }) })
2937
+ ] })
2938
+ ] })
2939
+ ] })
2940
+ },
2941
+ product.id ?? `product-${index}`
2942
+ )) })
2943
+ ] });
2944
+ }
2945
+
2946
+ // src/react/components/card/cards/reflection-optimization-card.tsx
2947
+ import { AlertCircle as AlertCircle2, ArrowRight, ChevronDown as ChevronDown3, ChevronUp, Lightbulb, TrendingUp as TrendingUp2 } from "lucide-react";
2948
+ import { useState as useState7 } from "react";
2949
+ import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
2950
+ var getRiskLevelColor = (level) => {
2951
+ switch (level) {
2952
+ case "low":
2953
+ return "bg-green-900 text-green-200";
2954
+ case "medium":
2955
+ return "bg-yellow-900 text-yellow-200";
2956
+ case "high":
2957
+ return "bg-red-900 text-red-200";
2958
+ }
2959
+ };
2960
+ var getRiskLevelText = (level) => {
2961
+ switch (level) {
2962
+ case "low":
2963
+ return "\u4F4E";
2964
+ case "medium":
2965
+ return "\u4E2D";
2966
+ case "high":
2967
+ return "\u9AD8";
2968
+ }
2969
+ };
2970
+ function MetricsComparison({
2971
+ before,
2972
+ after
2973
+ }) {
2974
+ const getDelta = (beforeVal, afterVal, isLower = false) => {
2975
+ const delta = afterVal - beforeVal;
2976
+ const isImprovement = isLower ? delta < 0 : delta > 0;
2977
+ return {
2978
+ value: Math.abs(delta).toFixed(1),
2979
+ isImprovement,
2980
+ color: isImprovement ? "text-green-400" : "text-red-400"
2981
+ };
2982
+ };
2983
+ const achievementDelta = getDelta(before.achievementRate, after.achievementRate);
2984
+ const lossDelta = getDelta(before.lossRate, after.lossRate, true);
2985
+ const costBenefitDelta = getDelta(before.costBenefit, after.costBenefit);
2986
+ return /* @__PURE__ */ jsxs18("div", { className: "mt-4 grid grid-cols-2 gap-4", children: [
2987
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-3", children: [
2988
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: "\u4F18\u5316\u524D" }),
2989
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2 text-sm", children: [
2990
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between", children: [
2991
+ /* @__PURE__ */ jsx18("span", { children: "\u76EE\u6807\u8FBE\u6210\u7387:" }),
2992
+ /* @__PURE__ */ jsxs18("span", { className: "font-medium", children: [
2993
+ before.achievementRate,
2994
+ "%"
2995
+ ] })
2996
+ ] }),
2997
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between", children: [
2998
+ /* @__PURE__ */ jsx18("span", { children: "\u6211\u65B9\u635F\u5931\u7387:" }),
2999
+ /* @__PURE__ */ jsxs18("span", { className: "font-medium", children: [
3000
+ before.lossRate,
3001
+ "%"
3002
+ ] })
3003
+ ] }),
3004
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between", children: [
3005
+ /* @__PURE__ */ jsx18("span", { children: "\u6210\u672C\u6548\u76CA\u6BD4:" }),
3006
+ /* @__PURE__ */ jsx18("span", { className: "font-medium", children: before.costBenefit.toFixed(1) })
3007
+ ] }),
3008
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between", children: [
3009
+ /* @__PURE__ */ jsx18("span", { children: "\u98CE\u9669\u7B49\u7EA7:" }),
3010
+ /* @__PURE__ */ jsx18(
3011
+ "span",
3012
+ {
3013
+ className: `rounded-full px-2 py-0.5 text-xs ${getRiskLevelColor(before.riskLevel)}`,
3014
+ children: getRiskLevelText(before.riskLevel)
3015
+ }
3016
+ )
3017
+ ] })
3018
+ ] })
3019
+ ] }),
3020
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-3", children: [
3021
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: "\u4F18\u5316\u540E\uFF08\u9884\u671F\uFF09" }),
3022
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2 text-sm", children: [
3023
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
3024
+ /* @__PURE__ */ jsx18("span", { children: "\u76EE\u6807\u8FBE\u6210\u7387:" }),
3025
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
3026
+ /* @__PURE__ */ jsxs18("span", { className: "font-medium", children: [
3027
+ after.achievementRate,
3028
+ "%"
3029
+ ] }),
3030
+ achievementDelta.value !== "0.0" && /* @__PURE__ */ jsxs18("span", { className: `text-xs ${achievementDelta.color}`, children: [
3031
+ achievementDelta.isImprovement ? "+" : "-",
3032
+ achievementDelta.value,
3033
+ "%"
3034
+ ] })
3035
+ ] })
3036
+ ] }),
3037
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
3038
+ /* @__PURE__ */ jsx18("span", { children: "\u6211\u65B9\u635F\u5931\u7387:" }),
3039
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
3040
+ /* @__PURE__ */ jsxs18("span", { className: "font-medium", children: [
3041
+ after.lossRate,
3042
+ "%"
3043
+ ] }),
3044
+ lossDelta.value !== "0.0" && /* @__PURE__ */ jsxs18("span", { className: `text-xs ${lossDelta.color}`, children: [
3045
+ lossDelta.isImprovement ? "-" : "+",
3046
+ lossDelta.value,
3047
+ "%"
3048
+ ] })
3049
+ ] })
3050
+ ] }),
3051
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
3052
+ /* @__PURE__ */ jsx18("span", { children: "\u6210\u672C\u6548\u76CA\u6BD4:" }),
3053
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
3054
+ /* @__PURE__ */ jsx18("span", { className: "font-medium", children: after.costBenefit.toFixed(1) }),
3055
+ costBenefitDelta.value !== "0.0" && /* @__PURE__ */ jsxs18("span", { className: `text-xs ${costBenefitDelta.color}`, children: [
3056
+ costBenefitDelta.isImprovement ? "+" : "-",
3057
+ costBenefitDelta.value
3058
+ ] })
3059
+ ] })
3060
+ ] }),
3061
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between", children: [
3062
+ /* @__PURE__ */ jsx18("span", { children: "\u98CE\u9669\u7B49\u7EA7:" }),
3063
+ /* @__PURE__ */ jsx18(
3064
+ "span",
3065
+ {
3066
+ className: `rounded-full px-2 py-0.5 text-xs ${getRiskLevelColor(after.riskLevel)}`,
3067
+ children: getRiskLevelText(after.riskLevel)
3068
+ }
3069
+ )
3070
+ ] })
3071
+ ] })
3072
+ ] })
3073
+ ] });
3074
+ }
3075
+ function PlanOptimizationSection({ plan }) {
3076
+ const [isOpen, setIsOpen] = useState7(false);
3077
+ return /* @__PURE__ */ jsxs18("div", { className: "rounded-lg border border-[hsl(var(--border))] p-4 transition-colors hover:bg-[hsl(var(--accent))]/50", children: [
3078
+ /* @__PURE__ */ jsxs18(
3079
+ "button",
3080
+ {
3081
+ type: "button",
3082
+ onClick: () => setIsOpen(!isOpen),
3083
+ className: "flex w-full items-center justify-between",
3084
+ children: [
3085
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-3", children: [
3086
+ /* @__PURE__ */ jsx18("div", { className: "text-lg font-semibold", children: plan.planType }),
3087
+ /* @__PURE__ */ jsxs18("span", { className: "rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
3088
+ plan.problems.length,
3089
+ " \u4E2A\u95EE\u9898"
3090
+ ] }),
3091
+ /* @__PURE__ */ jsxs18("span", { className: "rounded-full border border-[hsl(var(--border))] bg-sky-950 px-2 py-0.5 text-xs", children: [
3092
+ plan.improvements.length,
3093
+ " \u9879\u6539\u8FDB"
3094
+ ] })
3095
+ ] }),
3096
+ isOpen ? /* @__PURE__ */ jsx18(ChevronUp, { className: "h-5 w-5 text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx18(ChevronDown3, { className: "h-5 w-5 text-[hsl(var(--muted-foreground))]" })
3097
+ ]
3098
+ }
3099
+ ),
3100
+ isOpen && /* @__PURE__ */ jsxs18("div", { className: "mt-4 space-y-4", children: [
3101
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-3", children: [
3102
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
3103
+ /* @__PURE__ */ jsx18(AlertCircle2, { className: "h-4 w-4 text-orange-500" }),
3104
+ /* @__PURE__ */ jsx18("span", { children: "\u95EE\u9898\u8BC6\u522B\u4E0E\u6839\u56E0\u5206\u6790" })
3105
+ ] }),
3106
+ /* @__PURE__ */ jsx18("div", { className: "space-y-2 pl-6", children: plan.problems.map((problem, idx) => /* @__PURE__ */ jsxs18(
3107
+ "div",
3108
+ {
3109
+ className: "space-y-1 border-l-2 border-orange-400 py-2 pl-3",
3110
+ children: [
3111
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-orange-400", children: problem.category }),
3112
+ /* @__PURE__ */ jsx18("div", { className: "break-words text-sm text-[hsl(var(--muted-foreground))]", children: problem.description }),
3113
+ /* @__PURE__ */ jsxs18("div", { className: "break-words text-xs italic text-[hsl(var(--muted-foreground))]", children: [
3114
+ "\u6839\u672C\u539F\u56E0\uFF1A",
3115
+ problem.rootCause
3116
+ ] })
3117
+ ]
3118
+ },
3119
+ idx
3120
+ )) })
3121
+ ] }),
3122
+ /* @__PURE__ */ jsx18("div", { className: "border-t border-[hsl(var(--border))]" }),
3123
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-3", children: [
3124
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
3125
+ /* @__PURE__ */ jsx18(Lightbulb, { className: "h-4 w-4 text-sky-500" }),
3126
+ /* @__PURE__ */ jsx18("span", { children: "\u9488\u5BF9\u6027\u6539\u8FDB\u5EFA\u8BAE" })
3127
+ ] }),
3128
+ /* @__PURE__ */ jsx18("div", { className: "space-y-2 pl-6", children: plan.improvements.map((improvement, idx) => /* @__PURE__ */ jsxs18(
3129
+ "div",
3130
+ {
3131
+ className: "space-y-1 border-l-2 border-sky-400 py-2 pl-3",
3132
+ children: [
3133
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-sky-400", children: improvement.category }),
3134
+ /* @__PURE__ */ jsx18("div", { className: "break-words text-sm text-[hsl(var(--muted-foreground))]", children: improvement.description }),
3135
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1 text-xs text-green-400", children: [
3136
+ /* @__PURE__ */ jsx18(TrendingUp2, { className: "h-3 w-3 shrink-0" }),
3137
+ /* @__PURE__ */ jsxs18("span", { className: "break-words", children: [
3138
+ "\u9884\u671F\u6548\u679C\uFF1A",
3139
+ improvement.expectedEffect
3140
+ ] })
3141
+ ] })
3142
+ ]
3143
+ },
3144
+ idx
3145
+ )) })
3146
+ ] }),
3147
+ /* @__PURE__ */ jsx18("div", { className: "border-t border-[hsl(var(--border))]" }),
3148
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-3", children: [
3149
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
3150
+ /* @__PURE__ */ jsx18(ArrowRight, { className: "h-4 w-4 text-purple-500" }),
3151
+ /* @__PURE__ */ jsx18("span", { children: "\u4F18\u5316\u524D\u540E\u5BF9\u6BD4" })
3152
+ ] }),
3153
+ /* @__PURE__ */ jsx18(
3154
+ MetricsComparison,
3155
+ {
3156
+ before: plan.beforeOptimization,
3157
+ after: plan.afterOptimization
3158
+ }
3159
+ )
3160
+ ] })
3161
+ ] })
3162
+ ] });
3163
+ }
3164
+ function ReflectionOptimizationCard({ card }) {
3165
+ const payload = card.payload;
3166
+ if (!payload) {
3167
+ return /* @__PURE__ */ jsxs18("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
3168
+ /* @__PURE__ */ jsx18("div", { className: "px-6 pt-6", children: /* @__PURE__ */ jsx18("h3", { className: "text-lg font-semibold", children: card.title || "\u667A\u80FD\u53CD\u601D\u4E0E\u65B9\u6848\u4F18\u5316" }) }),
3169
+ /* @__PURE__ */ jsx18("div", { className: "px-6 pb-6 pt-4", children: /* @__PURE__ */ jsx18("div", { className: "text-[hsl(var(--muted-foreground))]", children: "\u65E0\u6709\u6548\u6570\u636E" }) })
3170
+ ] });
3171
+ }
3172
+ const { plans, reflectionSummary } = payload;
3173
+ return /* @__PURE__ */ jsxs18("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
3174
+ /* @__PURE__ */ jsx18("div", { className: "px-6 pt-6", children: /* @__PURE__ */ jsxs18("h3", { className: "flex items-center gap-2 text-lg font-semibold", children: [
3175
+ /* @__PURE__ */ jsx18(Lightbulb, { className: "h-5 w-5 text-yellow-500" }),
3176
+ card.title || "\u667A\u80FD\u53CD\u601D\u4E0E\u65B9\u6848\u4F18\u5316"
3177
+ ] }) }),
3178
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-6 px-6 pb-6 pt-4", children: [
3179
+ /* @__PURE__ */ jsx18("div", { className: "space-y-3", children: plans.map((plan, idx) => /* @__PURE__ */ jsx18(PlanOptimizationSection, { plan }, idx)) }),
3180
+ /* @__PURE__ */ jsx18("div", { className: "my-6 border-t border-[hsl(var(--border))]" }),
3181
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
3182
+ /* @__PURE__ */ jsx18("div", { className: "text-base font-semibold", children: "\u53CD\u601D\u603B\u7ED3" }),
3183
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
3184
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: "\u5173\u952E\u53D1\u73B0" }),
3185
+ /* @__PURE__ */ jsx18("ul", { className: "space-y-1 pl-5", children: reflectionSummary.keyFindings.map((finding, idx) => /* @__PURE__ */ jsx18(
3186
+ "li",
3187
+ {
3188
+ className: "list-disc break-words text-sm text-[hsl(var(--muted-foreground))] marker:text-orange-500",
3189
+ children: finding
3190
+ },
3191
+ idx
3192
+ )) })
3193
+ ] }),
3194
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
3195
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: "\u4F18\u5316\u7B56\u7565" }),
3196
+ /* @__PURE__ */ jsx18("div", { className: "whitespace-pre-wrap break-words rounded-md border border-sky-800 bg-sky-950 p-3 text-sm", children: reflectionSummary.optimizationStrategy })
3197
+ ] }),
3198
+ /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
3199
+ /* @__PURE__ */ jsx18("div", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: "\u540E\u7EED\u6B65\u9AA4" }),
3200
+ /* @__PURE__ */ jsx18("ol", { className: "space-y-1 pl-5", children: reflectionSummary.nextSteps.map((step, idx) => /* @__PURE__ */ jsx18(
3201
+ "li",
3202
+ {
3203
+ className: "list-decimal break-words text-sm text-[hsl(var(--muted-foreground))] marker:font-medium marker:text-sky-500",
3204
+ children: step
3205
+ },
3206
+ idx
3207
+ )) })
3208
+ ] })
3209
+ ] })
3210
+ ] })
3211
+ ] });
3212
+ }
3213
+
3214
+ // src/react/components/card/cards/resolution-modifications-card.tsx
3215
+ import { AlertCircle as AlertCircle3, CheckCircle as CheckCircle2, Clock as Clock6, MapPin as MapPin6, Navigation as Navigation2, Users as Users2 } from "lucide-react";
3216
+ import { useState as useState8 } from "react";
3217
+ import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
3218
+ var getModificationIcon = (type) => {
3219
+ switch (type) {
3220
+ case "time_adjustment":
3221
+ return /* @__PURE__ */ jsx19(Clock6, { className: "h-4 w-4" });
3222
+ case "altitude_adjustment":
3223
+ return /* @__PURE__ */ jsx19(Navigation2, { className: "h-4 w-4" });
3224
+ case "platform_replacement":
3225
+ return /* @__PURE__ */ jsx19(Users2, { className: "h-4 w-4" });
3226
+ case "route_adjustment":
3227
+ return /* @__PURE__ */ jsx19(MapPin6, { className: "h-4 w-4" });
3228
+ default:
3229
+ return /* @__PURE__ */ jsx19(AlertCircle3, { className: "h-4 w-4" });
3230
+ }
3231
+ };
3232
+ var getModificationColor = (type) => {
3233
+ switch (type) {
3234
+ case "time_adjustment":
3235
+ return "bg-blue-900 text-blue-200";
3236
+ case "altitude_adjustment":
3237
+ return "bg-green-900 text-green-200";
3238
+ case "platform_replacement":
3239
+ return "bg-purple-900 text-purple-200";
3240
+ case "route_adjustment":
3241
+ return "bg-orange-900 text-orange-200";
3242
+ default:
3243
+ return "bg-gray-900 text-gray-200";
3244
+ }
3245
+ };
3246
+ var getStatusBadge = (status) => {
3247
+ switch (status) {
3248
+ case "modified":
3249
+ return /* @__PURE__ */ jsx19("span", { className: "rounded-full bg-orange-500 px-2 py-0.5 text-xs text-white", children: "\u5DF2\u4FEE\u6539" });
3250
+ case "unchanged":
3251
+ return /* @__PURE__ */ jsx19("span", { className: "rounded-full bg-green-500 px-2 py-0.5 text-xs text-white", children: "\u672A\u53D8\u66F4" });
3252
+ case "removed":
3253
+ return /* @__PURE__ */ jsx19("span", { className: "rounded-full bg-red-500 px-2 py-0.5 text-xs text-white", children: "\u5DF2\u79FB\u9664" });
3254
+ default:
3255
+ return /* @__PURE__ */ jsx19("span", { className: "rounded-full bg-gray-500 px-2 py-0.5 text-xs text-white", children: status });
3256
+ }
3257
+ };
3258
+ var formatModificationDetail = (mod) => {
3259
+ const details = [];
3260
+ if (mod.type === "time_adjustment" && mod.original_time !== void 0 && mod.new_time !== void 0) {
3261
+ const delay = mod.new_time - mod.original_time;
3262
+ details.push(
3263
+ `\u65F6\u95F4\u8C03\u6574: ${mod.original_time} \u2192 ${mod.new_time} (${delay > 0 ? "+" : ""}${delay}s)`
3264
+ );
3265
+ }
3266
+ if (mod.type === "altitude_adjustment" && mod.original_altitude !== void 0 && mod.new_altitude !== void 0) {
3267
+ details.push(`\u9AD8\u5EA6\u8C03\u6574: ${mod.original_altitude}m \u2192 ${mod.new_altitude}m`);
3268
+ }
3269
+ if (mod.type === "platform_replacement" && mod.original_platform && mod.new_platform) {
3270
+ details.push(`\u5E73\u53F0\u66FF\u6362: ${mod.original_platform} \u2192 ${mod.new_platform}`);
3271
+ }
3272
+ if (mod.type === "route_adjustment" && mod.added_waypoints !== void 0) {
3273
+ details.push(`\u822A\u8DEF\u8C03\u6574: +${mod.added_waypoints}`);
3274
+ }
3275
+ return details.join(", ") || mod.type;
3276
+ };
3277
+ function ResolutionModificationsCard({ card }) {
3278
+ const data = card.payload || card.data;
3279
+ const [activeTab, setActiveTab] = useState8("modified");
3280
+ if (!data || !Array.isArray(data)) {
3281
+ return /* @__PURE__ */ jsx19("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx19("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6570\u636E\u683C\u5F0F\u65E0\u6548" }) });
3282
+ }
3283
+ const stats = {
3284
+ total: data.length,
3285
+ modified: data.filter((t) => t.status === "modified").length,
3286
+ unchanged: data.filter((t) => t.status === "unchanged").length,
3287
+ removed: data.filter((t) => t.status === "removed").length
3288
+ };
3289
+ const modifiedTasks = data.filter(
3290
+ (task) => task.status === "modified" && task.modifications && task.modifications.length > 0
3291
+ );
3292
+ const unchangedTasks = data.filter((task) => task.status === "unchanged");
3293
+ return /* @__PURE__ */ jsxs19("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
3294
+ /* @__PURE__ */ jsx19("div", { className: "px-6 pt-6", children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
3295
+ /* @__PURE__ */ jsx19("h3", { className: "text-lg font-semibold", children: "\u51B2\u7A81\u6D88\u89E3\u8BE6\u60C5" }),
3296
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
3297
+ /* @__PURE__ */ jsxs19("span", { className: "rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
3298
+ "\u603B\u8BA1: ",
3299
+ stats.total
3300
+ ] }),
3301
+ /* @__PURE__ */ jsxs19("span", { className: "rounded-full bg-orange-500 px-2 py-0.5 text-xs text-white", children: [
3302
+ "\u5DF2\u4FEE\u6539: ",
3303
+ stats.modified
3304
+ ] }),
3305
+ /* @__PURE__ */ jsxs19("span", { className: "rounded-full bg-green-500 px-2 py-0.5 text-xs text-white", children: [
3306
+ "\u672A\u53D8\u66F4: ",
3307
+ stats.unchanged
3308
+ ] }),
3309
+ stats.removed > 0 && /* @__PURE__ */ jsxs19("span", { className: "rounded-full bg-red-500 px-2 py-0.5 text-xs text-white", children: [
3310
+ "\u5DF2\u79FB\u9664: ",
3311
+ stats.removed
3312
+ ] })
3313
+ ] })
3314
+ ] }) }),
3315
+ /* @__PURE__ */ jsxs19("div", { className: "px-6 pb-6 pt-4", children: [
3316
+ /* @__PURE__ */ jsxs19("div", { className: "mb-4 grid w-full grid-cols-2 rounded-lg bg-[hsl(var(--muted))] p-1", children: [
3317
+ /* @__PURE__ */ jsxs19(
3318
+ "button",
3319
+ {
3320
+ type: "button",
3321
+ onClick: () => setActiveTab("modified"),
3322
+ className: `rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${activeTab === "modified" ? "bg-[hsl(var(--background))] text-[hsl(var(--foreground))] shadow-sm" : "text-[hsl(var(--muted-foreground))]"}`,
3323
+ children: [
3324
+ "\u5DF2\u4FEE\u6539\u4EFB\u52A1 (",
3325
+ modifiedTasks.length,
3326
+ ")"
3327
+ ]
3328
+ }
3329
+ ),
3330
+ /* @__PURE__ */ jsxs19(
3331
+ "button",
3332
+ {
3333
+ type: "button",
3334
+ onClick: () => setActiveTab("unchanged"),
3335
+ className: `rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${activeTab === "unchanged" ? "bg-[hsl(var(--background))] text-[hsl(var(--foreground))] shadow-sm" : "text-[hsl(var(--muted-foreground))]"}`,
3336
+ children: [
3337
+ "\u672A\u53D8\u66F4 (",
3338
+ unchangedTasks.length,
3339
+ ")"
3340
+ ]
3341
+ }
3342
+ )
3343
+ ] }),
3344
+ activeTab === "modified" && /* @__PURE__ */ jsx19("div", { className: "max-h-[500px] space-y-4 overflow-y-auto", children: modifiedTasks.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "py-8 text-center text-[hsl(var(--muted-foreground))]", children: "\u65E0\u4FEE\u6539\u4EFB\u52A1" }) : modifiedTasks.map((task) => /* @__PURE__ */ jsxs19(
3345
+ "div",
3346
+ {
3347
+ className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))]",
3348
+ children: [
3349
+ /* @__PURE__ */ jsx19("div", { className: "px-4 pb-3 pt-4", children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
3350
+ /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
3351
+ /* @__PURE__ */ jsx19("h4", { className: "text-sm font-semibold", children: task.id }),
3352
+ task.info && /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
3353
+ /* @__PURE__ */ jsx19("span", { children: task.info.target_name }),
3354
+ /* @__PURE__ */ jsx19("span", { children: "\xB7" }),
3355
+ /* @__PURE__ */ jsx19("span", { children: task.info.strike_unit })
3356
+ ] })
3357
+ ] }),
3358
+ getStatusBadge(task.status)
3359
+ ] }) }),
3360
+ /* @__PURE__ */ jsx19("div", { className: "px-4 pb-4", children: /* @__PURE__ */ jsx19("div", { className: "space-y-2", children: task.modifications?.map((mod, idx) => /* @__PURE__ */ jsxs19(
3361
+ "div",
3362
+ {
3363
+ className: `flex items-start gap-2 rounded-lg p-2 ${getModificationColor(mod.type)}`,
3364
+ children: [
3365
+ /* @__PURE__ */ jsx19("div", { className: "mt-0.5", children: getModificationIcon(mod.type) }),
3366
+ /* @__PURE__ */ jsxs19("div", { className: "flex-1 text-sm", children: [
3367
+ /* @__PURE__ */ jsx19("div", { className: "font-medium", children: formatModificationDetail(mod) }),
3368
+ /* @__PURE__ */ jsxs19("div", { className: "mt-1 text-xs opacity-80", children: [
3369
+ "\u539F\u56E0: ",
3370
+ mod.reason
3371
+ ] })
3372
+ ] })
3373
+ ]
3374
+ },
3375
+ idx
3376
+ )) }) })
3377
+ ]
3378
+ },
3379
+ task.id
3380
+ )) }),
3381
+ activeTab === "unchanged" && /* @__PURE__ */ jsx19("div", { className: "max-h-[500px] overflow-y-auto", children: unchangedTasks.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "py-8 text-center text-[hsl(var(--muted-foreground))]", children: "\u65E0\u672A\u53D8\u66F4\u4EFB\u52A1" }) : /* @__PURE__ */ jsx19("div", { className: "grid grid-cols-2 gap-2", children: unchangedTasks.map((task) => /* @__PURE__ */ jsx19(
3382
+ "div",
3383
+ {
3384
+ className: "rounded-lg border border-[hsl(var(--border))] p-3",
3385
+ children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
3386
+ /* @__PURE__ */ jsxs19("div", { children: [
3387
+ /* @__PURE__ */ jsx19("div", { className: "text-sm font-medium", children: task.id }),
3388
+ task.info && /* @__PURE__ */ jsxs19("div", { className: "mt-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
3389
+ task.info.target_name,
3390
+ " \xB7 ",
3391
+ task.info.strike_unit
3392
+ ] })
3393
+ ] }),
3394
+ /* @__PURE__ */ jsx19(CheckCircle2, { className: "h-4 w-4 text-green-500" })
3395
+ ] })
3396
+ },
3397
+ task.id
3398
+ )) }) })
3399
+ ] })
3400
+ ] });
3401
+ }
3402
+
3403
+ // src/react/components/card/cards/resolution-summary-card.tsx
3404
+ import {
3405
+ Activity as Activity2,
3406
+ AlertTriangle as AlertTriangle3,
3407
+ BarChart3,
3408
+ CheckCircle as CheckCircle3,
3409
+ Target as Target3,
3410
+ Users as Users3,
3411
+ XCircle
3412
+ } from "lucide-react";
3413
+ import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
3414
+ var getResolutionTypeLabel = (type) => {
3415
+ const labels = {
3416
+ time_adjustment: "\u65F6\u95F4\u8C03\u6574",
3417
+ altitude_adjustment: "\u9AD8\u5EA6\u8C03\u6574",
3418
+ platform_replacement: "\u5E73\u53F0\u66FF\u6362",
3419
+ route_adjustment: "\u822A\u8DEF\u8C03\u6574",
3420
+ reschedule: "\u91CD\u65B0\u6392\u7A0B"
3421
+ };
3422
+ return labels[type] || type;
3423
+ };
3424
+ function ResolutionSummaryCard({ card }) {
3425
+ const data = card.payload || card.data;
3426
+ if (!data) {
3427
+ return /* @__PURE__ */ jsx20("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx20("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6458\u8981\u6570\u636E\u683C\u5F0F\u65E0\u6548" }) });
3428
+ }
3429
+ const modificationRate = data.total_plans > 0 ? (data.modified_plans / data.total_plans * 100).toFixed(1) : "0";
3430
+ const unchangedRate = data.total_plans > 0 ? (data.unchanged_plans / data.total_plans * 100).toFixed(1) : "0";
3431
+ const actionTypes = data.resolution_actions?.reduce(
3432
+ (acc, action) => {
3433
+ const type = action.resolution_type;
3434
+ if (!acc[type]) {
3435
+ acc[type] = { count: 0, tasks: /* @__PURE__ */ new Set() };
3436
+ }
3437
+ acc[type].count++;
3438
+ for (const task of action.affected_tasks) {
3439
+ acc[type].tasks.add(task);
3440
+ }
3441
+ return acc;
3442
+ },
3443
+ {}
3444
+ );
3445
+ const resourceStats = Object.entries(data.validation?.resource_utilization || {}).map(([resource, info]) => ({
3446
+ resource,
3447
+ utilization_rate: (info.utilization_rate * 100).toFixed(1),
3448
+ task_count: info.tasks.length,
3449
+ tasks: info.tasks,
3450
+ status: info.utilization_rate > 0.8 ? "\u9AD8\u8D1F\u8F7D" : info.utilization_rate > 0.3 ? "\u6B63\u5E38" : "\u4F4E\u8D1F\u8F7D",
3451
+ color: info.utilization_rate > 0.8 ? "text-red-500" : info.utilization_rate > 0.3 ? "text-green-500" : "text-blue-500"
3452
+ })).sort((a, b) => Number.parseFloat(b.utilization_rate) - Number.parseFloat(a.utilization_rate));
3453
+ return /* @__PURE__ */ jsxs20("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
3454
+ /* @__PURE__ */ jsx20("div", { className: "px-6 pt-6", children: /* @__PURE__ */ jsxs20("h3", { className: "flex items-center gap-2 text-lg font-semibold", children: [
3455
+ /* @__PURE__ */ jsx20(BarChart3, { className: "h-5 w-5" }),
3456
+ "\u51B2\u7A81\u6D88\u89E3\u603B\u7ED3"
3457
+ ] }) }),
3458
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-6 px-6 pb-6 pt-4", children: [
3459
+ /* @__PURE__ */ jsxs20("div", { children: [
3460
+ /* @__PURE__ */ jsxs20("h4", { className: "mb-3 flex items-center gap-2 text-sm font-medium", children: [
3461
+ /* @__PURE__ */ jsx20(Activity2, { className: "h-4 w-4" }),
3462
+ "\u57FA\u7840\u7EDF\u8BA1"
3463
+ ] }),
3464
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
3465
+ /* @__PURE__ */ jsxs20("div", { className: "rounded-lg border border-[hsl(var(--border))] p-3", children: [
3466
+ /* @__PURE__ */ jsx20("div", { className: "text-2xl font-bold", children: data.total_plans }),
3467
+ /* @__PURE__ */ jsx20("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u603B\u8BA1\u65B9\u6848" })
3468
+ ] }),
3469
+ /* @__PURE__ */ jsxs20("div", { className: "rounded-lg border border-[hsl(var(--border))] p-3", children: [
3470
+ /* @__PURE__ */ jsx20("div", { className: "text-2xl font-bold text-green-500", children: data.unchanged_plans }),
3471
+ /* @__PURE__ */ jsxs20("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
3472
+ "\u672A\u53D8\u66F4 (",
3473
+ unchangedRate,
3474
+ "%)"
3475
+ ] })
3476
+ ] }),
3477
+ /* @__PURE__ */ jsxs20("div", { className: "rounded-lg border border-[hsl(var(--border))] p-3", children: [
3478
+ /* @__PURE__ */ jsx20("div", { className: "text-2xl font-bold text-orange-500", children: data.modified_plans }),
3479
+ /* @__PURE__ */ jsxs20("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
3480
+ "\u5DF2\u4FEE\u6539 (",
3481
+ modificationRate,
3482
+ "%)"
3483
+ ] })
3484
+ ] }),
3485
+ /* @__PURE__ */ jsxs20("div", { className: "rounded-lg border border-[hsl(var(--border))] p-3", children: [
3486
+ /* @__PURE__ */ jsx20("div", { className: "text-2xl font-bold text-blue-500", children: data.conflicts_resolved }),
3487
+ /* @__PURE__ */ jsx20("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u51B2\u7A81\u5DF2\u6D88\u89E3" })
3488
+ ] })
3489
+ ] })
3490
+ ] }),
3491
+ /* @__PURE__ */ jsxs20("div", { children: [
3492
+ /* @__PURE__ */ jsxs20("h4", { className: "mb-3 flex items-center gap-2 text-sm font-medium", children: [
3493
+ /* @__PURE__ */ jsx20(Target3, { className: "h-4 w-4" }),
3494
+ "\u9A8C\u8BC1\u7ED3\u679C"
3495
+ ] }),
3496
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
3497
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between rounded-lg bg-[hsl(var(--secondary))] p-3", children: [
3498
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u6240\u6709\u51B2\u7A81\u5DF2\u6D88\u89E3" }),
3499
+ data.validation?.all_conflicts_resolved ? /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-green-500", children: [
3500
+ /* @__PURE__ */ jsx20(CheckCircle3, { className: "h-4 w-4" }),
3501
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u662F" })
3502
+ ] }) : /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-red-500", children: [
3503
+ /* @__PURE__ */ jsx20(XCircle, { className: "h-4 w-4" }),
3504
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u5426" })
3505
+ ] })
3506
+ ] }),
3507
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between rounded-lg bg-[hsl(var(--secondary))] p-3", children: [
3508
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u68C0\u6D4B\u5230\u65B0\u51B2\u7A81" }),
3509
+ data.validation?.new_conflicts_detected ? /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-orange-500", children: [
3510
+ /* @__PURE__ */ jsx20(AlertTriangle3, { className: "h-4 w-4" }),
3511
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u662F" })
3512
+ ] }) : /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-green-500", children: [
3513
+ /* @__PURE__ */ jsx20(CheckCircle3, { className: "h-4 w-4" }),
3514
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: "\u5426" })
3515
+ ] })
3516
+ ] })
3517
+ ] })
3518
+ ] }),
3519
+ actionTypes && Object.keys(actionTypes).length > 0 && /* @__PURE__ */ jsxs20("div", { children: [
3520
+ /* @__PURE__ */ jsx20("h4", { className: "mb-3 text-sm font-medium", children: "\u6D88\u89E3\u52A8\u4F5C\u5206\u5E03" }),
3521
+ /* @__PURE__ */ jsx20("div", { className: "space-y-2", children: Object.entries(actionTypes).map(([type, info]) => /* @__PURE__ */ jsxs20(
3522
+ "div",
3523
+ {
3524
+ className: "flex items-center justify-between rounded bg-[hsl(var(--secondary))] p-2",
3525
+ children: [
3526
+ /* @__PURE__ */ jsx20("span", { className: "text-sm", children: getResolutionTypeLabel(type) }),
3527
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
3528
+ /* @__PURE__ */ jsxs20("span", { className: "rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
3529
+ info.count,
3530
+ " \u6B21"
3531
+ ] }),
3532
+ /* @__PURE__ */ jsxs20("span", { className: "rounded-full bg-[hsl(var(--secondary))] px-2 py-0.5 text-xs", children: [
3533
+ info.tasks.size,
3534
+ " \u4E2A\u4EFB\u52A1"
3535
+ ] })
3536
+ ] })
3537
+ ]
3538
+ },
3539
+ type
3540
+ )) })
3541
+ ] }),
3542
+ resourceStats.length > 0 && /* @__PURE__ */ jsxs20("div", { children: [
3543
+ /* @__PURE__ */ jsxs20("h4", { className: "mb-3 flex items-center gap-2 text-sm font-medium", children: [
3544
+ /* @__PURE__ */ jsx20(Users3, { className: "h-4 w-4" }),
3545
+ "\u8D44\u6E90\u5229\u7528\u7387"
3546
+ ] }),
3547
+ /* @__PURE__ */ jsxs20("div", { className: "max-h-[200px] space-y-2 overflow-y-auto", children: [
3548
+ resourceStats.slice(0, 10).map((resource) => /* @__PURE__ */ jsxs20("div", { className: "space-y-1", children: [
3549
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between text-sm", children: [
3550
+ /* @__PURE__ */ jsx20("span", { className: "font-medium", children: resource.resource }),
3551
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
3552
+ /* @__PURE__ */ jsxs20("span", { className: resource.color, children: [
3553
+ resource.utilization_rate,
3554
+ "%"
3555
+ ] }),
3556
+ /* @__PURE__ */ jsxs20("span", { className: "rounded-full border border-[hsl(var(--border))] px-2 py-0.5 text-xs", children: [
3557
+ resource.task_count,
3558
+ " \u4E2A\u4EFB\u52A1"
3559
+ ] })
3560
+ ] })
3561
+ ] }),
3562
+ /* @__PURE__ */ jsx20("div", { className: "h-2 overflow-hidden rounded-full bg-[hsl(var(--muted))]", children: /* @__PURE__ */ jsx20(
3563
+ "div",
3564
+ {
3565
+ className: "h-full rounded-full bg-sky-500 transition-all",
3566
+ style: { width: `${resource.utilization_rate}%` }
3567
+ }
3568
+ ) })
3569
+ ] }, resource.resource)),
3570
+ resourceStats.length > 10 && /* @__PURE__ */ jsxs20("div", { className: "pt-2 text-center text-xs text-[hsl(var(--muted-foreground))]", children: [
3571
+ "\u8FD8\u6709 ",
3572
+ resourceStats.length - 10,
3573
+ " \u4E2A\u8D44\u6E90..."
3574
+ ] })
3575
+ ] })
3576
+ ] }),
3577
+ /* @__PURE__ */ jsxs20("div", { className: "rounded-lg bg-[hsl(var(--secondary))] p-4", children: [
3578
+ /* @__PURE__ */ jsx20("h4", { className: "mb-2 text-sm font-medium", children: "\u6D88\u89E3\u603B\u7ED3" }),
3579
+ /* @__PURE__ */ jsxs20("div", { className: "space-y-1", children: [
3580
+ data.validation?.all_conflicts_resolved ? /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 text-sm text-green-400", children: [
3581
+ /* @__PURE__ */ jsx20(CheckCircle3, { className: "mt-0.5 h-4 w-4" }),
3582
+ /* @__PURE__ */ jsx20("span", { children: "\u6240\u6709\u51B2\u7A81\u5DF2\u6210\u529F\u6D88\u89E3\uFF0C\u65B9\u6848\u53EF\u6267\u884C" })
3583
+ ] }) : /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 text-sm text-orange-400", children: [
3584
+ /* @__PURE__ */ jsx20(AlertTriangle3, { className: "mt-0.5 h-4 w-4" }),
3585
+ /* @__PURE__ */ jsx20("span", { children: "\u90E8\u5206\u51B2\u7A81\u5C1A\u672A\u5B8C\u5168\u6D88\u89E3\uFF0C\u5EFA\u8BAE\u8FDB\u4E00\u6B65\u8C03\u6574" })
3586
+ ] }),
3587
+ data.validation?.new_conflicts_detected && /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 text-sm text-orange-400", children: [
3588
+ /* @__PURE__ */ jsx20(AlertTriangle3, { className: "mt-0.5 h-4 w-4" }),
3589
+ /* @__PURE__ */ jsx20("span", { children: "\u6D88\u89E3\u8FC7\u7A0B\u4E2D\u4EA7\u751F\u4E86\u65B0\u7684\u51B2\u7A81\uFF0C\u9700\u8981\u6CE8\u610F" })
3590
+ ] }),
3591
+ data.removed_plans > 0 && /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2 text-sm text-red-400", children: [
3592
+ /* @__PURE__ */ jsx20(AlertTriangle3, { className: "mt-0.5 h-4 w-4" }),
3593
+ /* @__PURE__ */ jsxs20("span", { children: [
3594
+ "\u6709 ",
3595
+ data.removed_plans,
3596
+ " \u4E2A\u65B9\u6848\u88AB\u79FB\u9664"
3597
+ ] })
3598
+ ] })
3599
+ ] })
3600
+ ] })
3601
+ ] })
3602
+ ] });
3603
+ }
3604
+
3605
+ // src/react/components/card/cards/restaurant-card.tsx
3606
+ import { Info as Info2, MapPin as MapPin7, Star as Star5, Utensils } from "lucide-react";
3607
+ import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
3608
+ function RestaurantCard({ card }) {
3609
+ const payload = card.payload;
3610
+ if (!payload || !Array.isArray(payload.restaurants)) {
3611
+ return /* @__PURE__ */ jsx21("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx21("p", { className: "text-red-400 text-sm", children: "\u7F8E\u98DF\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF" }) });
3612
+ }
3613
+ return /* @__PURE__ */ jsxs21("div", { className: "rounded-lg border border-white/10 bg-white/5 p-4", children: [
3614
+ card.title && /* @__PURE__ */ jsx21("h3", { className: "font-semibold text-lg text-zinc-100 mb-4", children: card.title }),
3615
+ /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: payload.restaurants.map((rest, index) => /* @__PURE__ */ jsxs21("div", { className: "rounded-lg border border-white/10 p-3", children: [
3616
+ /* @__PURE__ */ jsxs21("div", { className: "flex justify-between items-start mb-2", children: [
3617
+ /* @__PURE__ */ jsxs21("div", { children: [
3618
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
3619
+ /* @__PURE__ */ jsx21(Utensils, { className: "w-4 h-4 text-sky-400" }),
3620
+ /* @__PURE__ */ jsx21("span", { className: "font-medium text-zinc-200", children: rest.name }),
3621
+ /* @__PURE__ */ jsx21("span", { className: "px-1.5 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded", children: rest.category })
3622
+ ] }),
3623
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1 text-sm text-zinc-400 mt-1", children: [
3624
+ /* @__PURE__ */ jsx21(MapPin7, { className: "w-3 h-3" }),
3625
+ rest.location
3626
+ ] })
3627
+ ] }),
3628
+ /* @__PURE__ */ jsxs21("div", { className: "text-right", children: [
3629
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
3630
+ /* @__PURE__ */ jsx21(Star5, { className: "w-3 h-3 text-amber-400 fill-amber-400" }),
3631
+ /* @__PURE__ */ jsx21("span", { className: "font-medium text-zinc-200", children: rest.rating })
3632
+ ] }),
3633
+ (rest.avgPrice || rest.priceRange) && /* @__PURE__ */ jsx21("div", { className: "text-sm text-zinc-400", children: rest.avgPrice ? `\u4EBA\u5747\xA5${rest.avgPrice}` : rest.priceRange })
3634
+ ] })
3635
+ ] }),
3636
+ /* @__PURE__ */ jsxs21("div", { className: "mb-2", children: [
3637
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-zinc-500", children: "\u63A8\u8350\u83DC\u54C1:" }),
3638
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1 mt-1", children: (rest.specialty ?? rest.specialties ?? []).map((s, i) => /* @__PURE__ */ jsx21(
3639
+ "span",
3640
+ {
3641
+ className: "px-2 py-0.5 bg-white/5 text-zinc-400 text-xs rounded",
3642
+ children: s
3643
+ },
3644
+ i
3645
+ )) })
3646
+ ] }),
3647
+ rest.tips && /* @__PURE__ */ jsxs21("div", { className: "flex items-start gap-1 text-xs text-zinc-400 bg-white/5 p-2 rounded", children: [
3648
+ /* @__PURE__ */ jsx21(Info2, { className: "w-3 h-3 mt-0.5 flex-shrink-0" }),
3649
+ rest.tips
3650
+ ] })
3651
+ ] }, index)) })
3652
+ ] });
3653
+ }
3654
+
3655
+ // src/react/components/card/cards/shopping-list-card.tsx
3656
+ import { jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
3657
+ function ShoppingListCard({ card }) {
3658
+ const payload = card.payload;
3659
+ if (!payload || !Array.isArray(payload.items)) {
3660
+ return /* @__PURE__ */ jsx22("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-400", children: "\u8D2D\u7269\u6E05\u5355\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u9700\u8981 items \u6570\u7EC4" }) });
3661
+ }
3662
+ const currency = payload.currency || "\xA5";
3663
+ const statusMap = {
3664
+ comparing: { text: "\u6BD4\u4EF7\u4E2D", color: "bg-yellow-500/10 text-yellow-400" },
3665
+ ready: { text: "\u5F85\u8D2D\u4E70", color: "bg-green-500/10 text-green-400" },
3666
+ ordered: { text: "\u5DF2\u4E0B\u5355", color: "bg-blue-500/10 text-blue-400" }
3667
+ };
3668
+ const status = statusMap[payload.status || "ready"];
3669
+ return /* @__PURE__ */ jsxs22("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 shadow-sm", children: [
3670
+ /* @__PURE__ */ jsxs22("div", { className: "mb-4 flex items-center justify-between", children: [
3671
+ card.title && /* @__PURE__ */ jsx22("h3", { className: "text-lg font-semibold text-[hsl(var(--foreground))]", children: card.title }),
3672
+ /* @__PURE__ */ jsx22("span", { className: cn("rounded-full px-2 py-1 text-xs font-medium", status.color), children: status.text })
3673
+ ] }),
3674
+ /* @__PURE__ */ jsx22("div", { className: "mb-4 space-y-3", children: payload.items.map((item, index) => /* @__PURE__ */ jsxs22(
3675
+ "div",
3676
+ {
3677
+ className: "flex items-center gap-3 rounded-md bg-[hsl(var(--muted)/0.3)] p-3",
3678
+ children: [
3679
+ item.imageUrl && /* @__PURE__ */ jsx22(
3680
+ "img",
3681
+ {
3682
+ src: item.imageUrl,
3683
+ alt: item.name,
3684
+ className: "h-12 w-12 rounded border border-[hsl(var(--border))] object-cover"
3685
+ }
3686
+ ),
3687
+ /* @__PURE__ */ jsx22("div", { className: "flex-1", children: /* @__PURE__ */ jsxs22("div", { className: "flex items-start justify-between", children: [
3688
+ /* @__PURE__ */ jsxs22("div", { children: [
3689
+ /* @__PURE__ */ jsx22("h4", { className: "text-sm font-medium text-[hsl(var(--foreground))]", children: item.name }),
3690
+ item.platform && /* @__PURE__ */ jsxs22("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
3691
+ "\u6765\u6E90: ",
3692
+ item.platform
3693
+ ] })
3694
+ ] }),
3695
+ /* @__PURE__ */ jsxs22("div", { className: "text-right", children: [
3696
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
3697
+ /* @__PURE__ */ jsxs22("span", { className: "text-sm font-semibold text-[hsl(var(--foreground))]", children: [
3698
+ currency,
3699
+ item.price
3700
+ ] }),
3701
+ item.originalPrice && item.originalPrice > item.price && /* @__PURE__ */ jsxs22("span", { className: "text-xs text-[hsl(var(--muted-foreground))] line-through", children: [
3702
+ currency,
3703
+ item.originalPrice
3704
+ ] })
3705
+ ] }),
3706
+ /* @__PURE__ */ jsxs22("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
3707
+ "\u6570\u91CF: ",
3708
+ item.quantity
3709
+ ] })
3710
+ ] })
3711
+ ] }) })
3712
+ ]
3713
+ },
3714
+ index
3715
+ )) }),
3716
+ /* @__PURE__ */ jsxs22("div", { className: "border-t border-[hsl(var(--border))] pt-3", children: [
3717
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
3718
+ /* @__PURE__ */ jsx22("span", { className: "font-medium text-[hsl(var(--foreground))]", children: "\u603B\u8BA1" }),
3719
+ /* @__PURE__ */ jsxs22("span", { className: "text-lg font-bold text-[hsl(var(--foreground))]", children: [
3720
+ currency,
3721
+ payload.total
3722
+ ] })
3723
+ ] }),
3724
+ /* @__PURE__ */ jsxs22("div", { className: "mt-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
3725
+ "\u5171 ",
3726
+ payload.items.reduce((sum, item) => sum + item.quantity, 0),
3727
+ " \u4EF6\u5546\u54C1"
3728
+ ] })
3729
+ ] })
3730
+ ] });
3731
+ }
3732
+
3733
+ // src/react/components/card/cards/simulation-event-card.tsx
3734
+ import {
3735
+ Bomb,
3736
+ Download as Download2,
3737
+ Flag,
3738
+ Info as Info3,
3739
+ MapPin as MapPin8,
3740
+ Pause,
3741
+ Play,
3742
+ Rocket,
3743
+ Shield as Shield2,
3744
+ Target as Target4,
3745
+ Zap as Zap2
3746
+ } from "lucide-react";
3747
+ import { memo as memo4, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo7, useState as useState9 } from "react";
3748
+ import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
3749
+ var eventStyles = {
3750
+ start: { Icon: Rocket, color: "#0284c7", bg: "bg-sky-950" },
3751
+ deploy: { Icon: MapPin8, color: "#0369a1", bg: "bg-sky-950" },
3752
+ strike: { Icon: Zap2, color: "#075985", bg: "bg-sky-900" },
3753
+ hit: { Icon: Target4, color: "#0ea5e9", bg: "bg-sky-950" },
3754
+ damage: { Icon: Bomb, color: "#0c4a6e", bg: "bg-sky-900" },
3755
+ defense: { Icon: Shield2, color: "#0284c7", bg: "bg-sky-950" },
3756
+ end: { Icon: Flag, color: "#475569", bg: "bg-slate-950" },
3757
+ info: { Icon: Info3, color: "#64748b", bg: "bg-slate-950" }
3758
+ };
3759
+ var severityStyles = {
3760
+ critical: { badge: "bg-sky-900 text-white", label: "\u4E25\u91CD" },
3761
+ high: { badge: "bg-sky-700 text-white", label: "\u91CD\u8981" },
3762
+ medium: { badge: "bg-sky-600 text-white", label: "\u4E2D\u7B49" },
3763
+ low: { badge: "bg-sky-500 text-white", label: "\u4E00\u822C" },
3764
+ info: { badge: "bg-slate-500 text-white", label: "\u4FE1\u606F" }
3765
+ };
3766
+ var formatTime2 = (seconds) => {
3767
+ const mins = Math.floor(seconds / 60);
3768
+ const secs = seconds % 60;
3769
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
3770
+ };
3771
+ var showLogState = /* @__PURE__ */ new Map();
3772
+ var SimulationEventControlPanel = memo4(function SimulationEventControlPanel2({
3773
+ cardId,
3774
+ card
3775
+ }) {
3776
+ const [showLog, setShowLogInternal] = useState9(() => showLogState.get(cardId) || false);
3777
+ const setShowLog = useCallback4(
3778
+ (value) => {
3779
+ showLogState.set(cardId, value);
3780
+ setShowLogInternal(value);
3781
+ },
3782
+ [cardId]
3783
+ );
3784
+ const toggleShowLog = useCallback4(() => {
3785
+ setShowLog(!showLog);
3786
+ }, [showLog, setShowLog]);
3787
+ const handleDownload = useCallback4(() => {
3788
+ try {
3789
+ const jsonContent = JSON.stringify(card, null, 2);
3790
+ const blob = new Blob([jsonContent], { type: "application/json" });
3791
+ const url = URL.createObjectURL(blob);
3792
+ const link = document.createElement("a");
3793
+ link.href = url;
3794
+ link.download = `${card.title || "simulation-events"}.json`;
3795
+ document.body.appendChild(link);
3796
+ link.click();
3797
+ document.body.removeChild(link);
3798
+ URL.revokeObjectURL(url);
3799
+ } catch (err) {
3800
+ console.error("\u4E0B\u8F7D\u5931\u8D25:", err);
3801
+ }
3802
+ }, [card]);
3803
+ return /* @__PURE__ */ jsxs23("div", { className: "border-t border-[hsl(var(--border))] p-4", children: [
3804
+ /* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
3805
+ /* @__PURE__ */ jsx23(
3806
+ "button",
3807
+ {
3808
+ type: "button",
3809
+ onClick: toggleShowLog,
3810
+ className: `rounded-md px-3 py-1.5 text-sm ${showLog ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "border border-[hsl(var(--border))] text-[hsl(var(--foreground))]"}`,
3811
+ children: "\u67E5\u770B\u65E5\u5FD7"
3812
+ }
3813
+ ),
3814
+ /* @__PURE__ */ jsxs23(
3815
+ "button",
3816
+ {
3817
+ type: "button",
3818
+ onClick: handleDownload,
3819
+ title: "\u4E0B\u8F7D\u4E8B\u4EF6\u6570\u636E",
3820
+ className: "flex items-center gap-1 rounded-md border border-[hsl(var(--border))] px-3 py-1.5 text-sm text-[hsl(var(--foreground))]",
3821
+ children: [
3822
+ /* @__PURE__ */ jsx23(Download2, { className: "h-4 w-4" }),
3823
+ "\u4E0B\u8F7D\u6570\u636E"
3824
+ ]
3825
+ }
3826
+ )
3827
+ ] }),
3828
+ showLog && /* @__PURE__ */ jsxs23("div", { className: "mt-4 rounded-lg bg-[hsl(var(--muted))] p-4", children: [
3829
+ /* @__PURE__ */ jsx23("h4", { className: "mb-2 text-sm font-semibold", children: "LLM\u751F\u6210\u7684\u6E90\u7801\uFF1A" }),
3830
+ /* @__PURE__ */ jsx23("div", { className: "max-h-96 overflow-y-auto", children: /* @__PURE__ */ jsx23("pre", { className: "whitespace-pre-wrap text-xs", children: /* @__PURE__ */ jsx23("code", { children: JSON.stringify(card, null, 2) }) }) })
3831
+ ] })
3832
+ ] });
3833
+ });
3834
+ function SimulationEventCardComponent({ card }) {
3835
+ const payload = card.payload;
3836
+ const title = card.title || "\u4EFF\u771F\u4E8B\u4EF6\u65F6\u95F4\u7EBF";
3837
+ const [currentTime, setCurrentTime] = useState9(0);
3838
+ const [isPlaying, setIsPlaying] = useState9(false);
3839
+ const cardId = useMemo7(() => {
3840
+ return `simulation-event-card-${card.id || payload?.simulationId || "default"}`;
3841
+ }, [card.id, payload?.simulationId]);
3842
+ const planName = payload?.planName || "\u672A\u77E5\u65B9\u6848";
3843
+ const simulationId = payload?.simulationId || "\u672A\u77E5ID";
3844
+ const simulationTime = payload?.simulationTime || "\u672A\u77E5\u65F6\u95F4";
3845
+ const duration = payload?.duration || 0;
3846
+ const events = useMemo7(() => payload?.events || [], [payload?.events]);
3847
+ const togglePlayback = useCallback4(() => {
3848
+ setIsPlaying((prev) => !prev);
3849
+ }, []);
3850
+ useEffect3(() => {
3851
+ if (!isPlaying) return;
3852
+ const interval = setInterval(() => {
3853
+ setCurrentTime((prev) => {
3854
+ if (prev >= duration) {
3855
+ setIsPlaying(false);
3856
+ return duration;
3857
+ }
3858
+ return prev + 1;
3859
+ });
3860
+ }, 100);
3861
+ return () => clearInterval(interval);
3862
+ }, [isPlaying, duration]);
3863
+ const visibleEvents = useMemo7(() => {
3864
+ return events.filter((event) => event.time <= currentTime);
3865
+ }, [events, currentTime]);
3866
+ const eventStats = useMemo7(() => {
3867
+ const stats = {
3868
+ strike: 0,
3869
+ hit: 0,
3870
+ damage: 0,
3871
+ defense: 0,
3872
+ total: events.length
3873
+ };
3874
+ for (const event of events) {
3875
+ if (event.type in stats) {
3876
+ stats[event.type]++;
3877
+ }
3878
+ }
3879
+ return stats;
3880
+ }, [events]);
3881
+ return /* @__PURE__ */ jsxs23("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
3882
+ /* @__PURE__ */ jsx23("div", { className: "px-6 pb-4 pt-6", children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
3883
+ /* @__PURE__ */ jsx23("h3", { className: "text-lg font-semibold", children: title }),
3884
+ /* @__PURE__ */ jsxs23("div", { className: "flex gap-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
3885
+ /* @__PURE__ */ jsxs23("span", { children: [
3886
+ "\u65B9\u6848: ",
3887
+ planName
3888
+ ] }),
3889
+ /* @__PURE__ */ jsxs23("span", { children: [
3890
+ "\u4E8B\u4EF6\u6570: ",
3891
+ events.length
3892
+ ] }),
3893
+ /* @__PURE__ */ jsxs23("span", { children: [
3894
+ "\u65F6\u957F: ",
3895
+ formatTime2(duration)
3896
+ ] })
3897
+ ] })
3898
+ ] }) }),
3899
+ /* @__PURE__ */ jsxs23("div", { className: "space-y-4 px-6 pb-6", children: [
3900
+ /* @__PURE__ */ jsxs23("div", { className: "grid grid-cols-2 gap-4 rounded-lg bg-[hsl(var(--muted))]/50 p-4", children: [
3901
+ /* @__PURE__ */ jsxs23("div", { children: [
3902
+ /* @__PURE__ */ jsx23("div", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u4EFF\u771FID" }),
3903
+ /* @__PURE__ */ jsx23("div", { className: "font-mono text-sm", children: simulationId })
3904
+ ] }),
3905
+ /* @__PURE__ */ jsxs23("div", { children: [
3906
+ /* @__PURE__ */ jsx23("div", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u4EFF\u771F\u65F6\u95F4" }),
3907
+ /* @__PURE__ */ jsx23("div", { className: "text-sm", children: simulationTime })
3908
+ ] })
3909
+ ] }),
3910
+ /* @__PURE__ */ jsxs23("div", { className: "grid grid-cols-5 gap-2 text-center", children: [
3911
+ /* @__PURE__ */ jsxs23("div", { className: "rounded bg-sky-950 p-2", children: [
3912
+ /* @__PURE__ */ jsx23(Zap2, { className: "mx-auto h-6 w-6 text-sky-700" }),
3913
+ /* @__PURE__ */ jsx23("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6253\u51FB" }),
3914
+ /* @__PURE__ */ jsx23("div", { className: "text-lg font-bold", children: eventStats.strike })
3915
+ ] }),
3916
+ /* @__PURE__ */ jsxs23("div", { className: "rounded bg-sky-950 p-2", children: [
3917
+ /* @__PURE__ */ jsx23(Target4, { className: "mx-auto h-6 w-6 text-sky-600" }),
3918
+ /* @__PURE__ */ jsx23("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u547D\u4E2D" }),
3919
+ /* @__PURE__ */ jsx23("div", { className: "text-lg font-bold", children: eventStats.hit })
3920
+ ] }),
3921
+ /* @__PURE__ */ jsxs23("div", { className: "rounded bg-sky-900 p-2", children: [
3922
+ /* @__PURE__ */ jsx23(Bomb, { className: "mx-auto h-6 w-6 text-sky-300" }),
3923
+ /* @__PURE__ */ jsx23("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u635F\u4F24" }),
3924
+ /* @__PURE__ */ jsx23("div", { className: "text-lg font-bold", children: eventStats.damage })
3925
+ ] }),
3926
+ /* @__PURE__ */ jsxs23("div", { className: "rounded bg-sky-950 p-2", children: [
3927
+ /* @__PURE__ */ jsx23(Shield2, { className: "mx-auto h-6 w-6 text-sky-500" }),
3928
+ /* @__PURE__ */ jsx23("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u9632\u5FA1" }),
3929
+ /* @__PURE__ */ jsx23("div", { className: "text-lg font-bold", children: eventStats.defense })
3930
+ ] }),
3931
+ /* @__PURE__ */ jsxs23("div", { className: "rounded bg-slate-950 p-2", children: [
3932
+ /* @__PURE__ */ jsx23(Info3, { className: "mx-auto h-6 w-6 text-slate-600" }),
3933
+ /* @__PURE__ */ jsx23("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u603B\u8BA1" }),
3934
+ /* @__PURE__ */ jsx23("div", { className: "text-lg font-bold", children: eventStats.total })
3935
+ ] })
3936
+ ] }),
3937
+ /* @__PURE__ */ jsxs23("div", { className: "space-y-2", children: [
3938
+ /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
3939
+ /* @__PURE__ */ jsx23(
3940
+ "button",
3941
+ {
3942
+ type: "button",
3943
+ onClick: togglePlayback,
3944
+ className: "rounded-md border border-[hsl(var(--border))] p-1.5",
3945
+ children: isPlaying ? /* @__PURE__ */ jsx23(Pause, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx23(Play, { className: "h-4 w-4" })
3946
+ }
3947
+ ),
3948
+ /* @__PURE__ */ jsx23(
3949
+ "input",
3950
+ {
3951
+ type: "range",
3952
+ min: "0",
3953
+ max: duration,
3954
+ value: currentTime,
3955
+ onChange: (e) => {
3956
+ setCurrentTime(Number(e.target.value));
3957
+ setIsPlaying(false);
3958
+ },
3959
+ className: "flex-1"
3960
+ }
3961
+ ),
3962
+ /* @__PURE__ */ jsx23("span", { className: "min-w-[60px] text-right font-mono text-sm", children: formatTime2(currentTime) })
3963
+ ] }),
3964
+ /* @__PURE__ */ jsx23("div", { className: "text-center text-xs text-[hsl(var(--muted-foreground))]", children: "\u62D6\u52A8\u6ED1\u5757\u6216\u70B9\u51FB\u64AD\u653E\u6309\u94AE\u67E5\u770B\u4E8B\u4EF6\u65F6\u95F4\u7EBF" })
3965
+ ] }),
3966
+ /* @__PURE__ */ jsxs23("div", { className: "max-h-[500px] space-y-2 overflow-y-auto p-1", children: [
3967
+ visibleEvents.map((event, index) => {
3968
+ const style = eventStyles[event.type] || eventStyles.info;
3969
+ const EventIcon = style.Icon;
3970
+ const severityStyle = event.severity ? severityStyles[event.severity] : null;
3971
+ return /* @__PURE__ */ jsxs23(
3972
+ "div",
3973
+ {
3974
+ className: `flex gap-3 overflow-auto rounded-lg border border-[hsl(var(--border))] p-3 transition-all ${style.bg} ${event.time === currentTime ? "ring-2 ring-sky-500" : ""}`,
3975
+ children: [
3976
+ /* @__PURE__ */ jsx23("div", { className: "w-16 shrink-0 text-right", children: /* @__PURE__ */ jsx23("div", { className: "font-mono text-xs text-[hsl(var(--muted-foreground))]", children: formatTime2(event.time) }) }),
3977
+ /* @__PURE__ */ jsx23("div", { className: "shrink-0", children: /* @__PURE__ */ jsx23(EventIcon, { className: "h-6 w-6", style: { color: style.color } }) }),
3978
+ /* @__PURE__ */ jsxs23("div", { className: "flex-1", children: [
3979
+ /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
3980
+ /* @__PURE__ */ jsx23("div", { className: "text-sm font-semibold", children: event.title }),
3981
+ severityStyle && /* @__PURE__ */ jsx23(
3982
+ "span",
3983
+ {
3984
+ className: `rounded-full px-2 py-0.5 text-xs ${severityStyle.badge}`,
3985
+ children: severityStyle.label
3986
+ }
3987
+ )
3988
+ ] }),
3989
+ /* @__PURE__ */ jsx23("div", { className: "mt-1 text-sm text-[hsl(var(--muted-foreground))]", children: event.description })
3990
+ ] })
3991
+ ]
3992
+ },
3993
+ index
3994
+ );
3995
+ }),
3996
+ visibleEvents.length === 0 && /* @__PURE__ */ jsx23("div", { className: "py-8 text-center text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u4E8B\u4EF6" })
3997
+ ] })
3998
+ ] }),
3999
+ /* @__PURE__ */ jsx23(SimulationEventControlPanel, { cardId, card })
4000
+ ] });
4001
+ }
4002
+ var SimulationEventCard = memo4(SimulationEventCardComponent);
4003
+
4004
+ // src/react/components/card/cards/survival-effect-card.tsx
4005
+ import { memo as memo5, useCallback as useCallback5, useMemo as useMemo8 } from "react";
4006
+ import { jsx as jsx24, jsxs as jsxs24 } from "react/jsx-runtime";
4007
+ var planColors = {
4008
+ \u7A33\u5065\u578B: { primary: "#0284c7", bg: "bg-sky-600", light: "bg-sky-900" },
4009
+ \u6FC0\u8FDB\u578B: { primary: "#075985", bg: "bg-sky-800", light: "bg-sky-900" },
4010
+ \u5747\u8861\u578B: { primary: "#0ea5e9", bg: "bg-sky-500", light: "bg-sky-950" }
4011
+ };
4012
+ var riskLevelConfig = {
4013
+ low: { label: "\u4F4E", color: "text-sky-500", bg: "bg-sky-950" },
4014
+ medium: { label: "\u4E2D", color: "text-sky-600", bg: "bg-sky-900" },
4015
+ high: { label: "\u9AD8", color: "text-sky-300", bg: "bg-sky-800" }
4016
+ };
4017
+ var defaultPlanColor = { primary: "#6b7280", bg: "bg-gray-500", light: "bg-gray-900" };
4018
+ var SurvivalEffectControlPanel = memo5(function SurvivalEffectControlPanel2({
4019
+ cardId,
4020
+ card
4021
+ }) {
4022
+ const [showLog, setShowLog] = useCardState(`${cardId}-showLog`, false);
4023
+ const toggleShowLog = useCallback5(() => {
4024
+ setShowLog(!showLog);
4025
+ }, [showLog, setShowLog]);
4026
+ const handleDownload = useCallback5(() => {
4027
+ try {
4028
+ const jsonContent = JSON.stringify(card, null, 2);
4029
+ const blob = new Blob([jsonContent], { type: "application/json" });
4030
+ const url = URL.createObjectURL(blob);
4031
+ const link = document.createElement("a");
4032
+ link.href = url;
4033
+ link.download = `${card.title || "survival-effect"}.json`;
4034
+ document.body.appendChild(link);
4035
+ link.click();
4036
+ document.body.removeChild(link);
4037
+ URL.revokeObjectURL(url);
4038
+ } catch (err) {
4039
+ console.error("\u4E0B\u8F7D\u5931\u8D25:", err);
4040
+ }
4041
+ }, [card]);
4042
+ return /* @__PURE__ */ jsxs24("div", { className: "border-t border-[hsl(var(--border))] p-4", children: [
4043
+ /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
4044
+ /* @__PURE__ */ jsx24(
4045
+ "button",
4046
+ {
4047
+ type: "button",
4048
+ onClick: toggleShowLog,
4049
+ className: `rounded-md px-3 py-1.5 text-sm ${showLog ? "bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]" : "border border-[hsl(var(--border))] text-[hsl(var(--foreground))]"}`,
4050
+ children: "\u67E5\u770B\u65E5\u5FD7"
4051
+ }
4052
+ ),
4053
+ /* @__PURE__ */ jsx24(
4054
+ "button",
4055
+ {
4056
+ type: "button",
4057
+ onClick: handleDownload,
4058
+ title: "\u4E0B\u8F7D\u751F\u5B58\u6548\u679C\u6570\u636E",
4059
+ className: "rounded-md border border-[hsl(var(--border))] px-3 py-1.5 text-sm text-[hsl(var(--foreground))]",
4060
+ children: "\u4E0B\u8F7D\u6570\u636E"
4061
+ }
4062
+ )
4063
+ ] }),
4064
+ showLog && /* @__PURE__ */ jsxs24("div", { className: "mt-4 rounded-lg bg-[hsl(var(--muted))] p-4", children: [
4065
+ /* @__PURE__ */ jsx24("h4", { className: "mb-2 text-sm font-semibold", children: "LLM\u751F\u6210\u7684\u6E90\u7801\uFF1A" }),
4066
+ /* @__PURE__ */ jsx24("div", { className: "max-h-96 overflow-y-auto", children: /* @__PURE__ */ jsx24("pre", { className: "whitespace-pre-wrap text-xs", children: /* @__PURE__ */ jsx24("code", { children: JSON.stringify(card, null, 2) }) }) })
4067
+ ] })
4068
+ ] });
4069
+ });
4070
+ function SurvivalEffectCardComponent({ card }) {
4071
+ const payload = card.payload;
4072
+ const title = card.title || payload?.title || "\u751F\u5B58\u6548\u679C\u5BF9\u6BD4\u5206\u6790";
4073
+ const cardId = useMemo8(() => {
4074
+ return `survival-effect-card-${card.id || "default"}`;
4075
+ }, [card.id]);
4076
+ const plans = useMemo8(() => payload?.plans || [], [payload?.plans]);
4077
+ const bestPlan = payload?.bestPlan;
4078
+ const analysis = payload?.analysis;
4079
+ const calculatedBestPlan = useMemo8(() => {
4080
+ if (plans.length === 0) return null;
4081
+ return plans.reduce(
4082
+ (best, current) => current.lossRate < best.lossRate ? current : best
4083
+ );
4084
+ }, [plans]);
4085
+ const displayBestPlan = bestPlan || calculatedBestPlan?.planType;
4086
+ return /* @__PURE__ */ jsxs24("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]", children: [
4087
+ /* @__PURE__ */ jsx24("div", { className: "px-6 pb-4 pt-6", children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
4088
+ /* @__PURE__ */ jsx24("h3", { className: "text-lg font-semibold", children: title }),
4089
+ /* @__PURE__ */ jsxs24("div", { className: "flex gap-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
4090
+ /* @__PURE__ */ jsxs24("span", { children: [
4091
+ "\u65B9\u6848\u6570: ",
4092
+ plans.length
4093
+ ] }),
4094
+ displayBestPlan && /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-sky-400", children: [
4095
+ "\u6700\u4F18: ",
4096
+ displayBestPlan
4097
+ ] })
4098
+ ] })
4099
+ ] }) }),
4100
+ /* @__PURE__ */ jsxs24("div", { className: "space-y-6 px-6 pb-6", children: [
4101
+ /* @__PURE__ */ jsx24("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs24("table", { className: "w-full border-collapse text-sm", children: [
4102
+ /* @__PURE__ */ jsx24("thead", { children: /* @__PURE__ */ jsxs24("tr", { className: "border-b border-[hsl(var(--border))]", children: [
4103
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-left", children: "\u65B9\u6848" }),
4104
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u6467\u6BC1" }),
4105
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u53D7\u635F" }),
4106
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u635F\u5931\u7387" }),
4107
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u5BFC\u5F39" }),
4108
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u547D\u4E2D\u7387" }),
4109
+ /* @__PURE__ */ jsx24("th", { className: "p-2 text-center", children: "\u98CE\u9669" })
4110
+ ] }) }),
4111
+ /* @__PURE__ */ jsx24("tbody", { children: plans.map((plan, index) => {
4112
+ const colors = planColors[plan.planType] || defaultPlanColor;
4113
+ const isBest = plan.planType === displayBestPlan;
4114
+ const riskConfig = riskLevelConfig[plan.riskLevel];
4115
+ return /* @__PURE__ */ jsxs24(
4116
+ "tr",
4117
+ {
4118
+ className: `border-b border-[hsl(var(--border))] ${isBest ? "bg-sky-950" : ""}`,
4119
+ children: [
4120
+ /* @__PURE__ */ jsx24("td", { className: "p-2", children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
4121
+ /* @__PURE__ */ jsx24("div", { className: `h-3 w-3 rounded ${colors.bg}` }),
4122
+ /* @__PURE__ */ jsx24("span", { className: "font-semibold", children: plan.planType }),
4123
+ isBest && /* @__PURE__ */ jsx24("span", { className: "rounded-full bg-sky-600 px-2 py-0.5 text-xs text-white", children: "\u6700\u4F18" })
4124
+ ] }) }),
4125
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsx24("span", { className: "font-mono text-sky-400", children: plan.ourDestroyed }) }),
4126
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsx24("span", { className: "font-mono text-sky-500", children: plan.ourDamaged }) }),
4127
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsxs24("span", { className: "font-bold", style: { color: colors.primary }, children: [
4128
+ plan.lossRate.toFixed(1),
4129
+ "%"
4130
+ ] }) }),
4131
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
4132
+ plan.missilesFired,
4133
+ "\u679A"
4134
+ ] }) }),
4135
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsxs24("span", { className: "font-bold text-sky-400", children: [
4136
+ plan.hitRate,
4137
+ "%"
4138
+ ] }) }),
4139
+ /* @__PURE__ */ jsx24("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center gap-1", children: /* @__PURE__ */ jsx24("span", { className: riskConfig.color, children: riskConfig.label }) }) })
4140
+ ]
4141
+ },
4142
+ index
4143
+ );
4144
+ }) })
4145
+ ] }) }),
4146
+ /* @__PURE__ */ jsxs24("div", { className: "space-y-3", children: [
4147
+ /* @__PURE__ */ jsx24("h4", { className: "text-sm font-semibold", children: "\u635F\u5931\u7387\u5BF9\u6BD4\uFF08\u8D8A\u4F4E\u8D8A\u597D\uFF09" }),
4148
+ plans.map((plan, index) => {
4149
+ const colors = planColors[plan.planType] || defaultPlanColor;
4150
+ return /* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
4151
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-sm", children: [
4152
+ /* @__PURE__ */ jsx24("span", { className: "font-semibold", children: plan.planType }),
4153
+ /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
4154
+ plan.lossRate.toFixed(1),
4155
+ "%"
4156
+ ] })
4157
+ ] }),
4158
+ /* @__PURE__ */ jsx24("div", { className: "h-6 overflow-hidden rounded-full bg-[hsl(var(--muted))]", children: /* @__PURE__ */ jsx24(
4159
+ "div",
4160
+ {
4161
+ className: `flex h-full items-center justify-end pr-2 transition-all duration-500 ${colors.bg}`,
4162
+ style: { width: `${Math.min(plan.lossRate, 100)}%` },
4163
+ children: /* @__PURE__ */ jsxs24("span", { className: "text-xs font-semibold text-white", children: [
4164
+ plan.ourDestroyed + plan.ourDamaged,
4165
+ "/",
4166
+ plan.ourTotal
4167
+ ] })
4168
+ }
4169
+ ) })
4170
+ ] }, index);
4171
+ })
4172
+ ] }),
4173
+ /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-4", children: plans.map((plan, index) => {
4174
+ const colors = planColors[plan.planType] || defaultPlanColor;
4175
+ const isBest = plan.planType === displayBestPlan;
4176
+ const riskConfig = riskLevelConfig[plan.riskLevel];
4177
+ const efficiency = plan.hitRate / (plan.lossRate + 1);
4178
+ return /* @__PURE__ */ jsxs24(
4179
+ "div",
4180
+ {
4181
+ className: `rounded-lg border p-4 ${colors.light} ${isBest ? "border-sky-600" : "border-[hsl(var(--border))]"}`,
4182
+ children: [
4183
+ /* @__PURE__ */ jsxs24("div", { className: "mb-2 flex items-center justify-between", children: [
4184
+ /* @__PURE__ */ jsx24("h4", { className: "font-semibold", children: plan.planType }),
4185
+ isBest && /* @__PURE__ */ jsx24("span", { className: "text-xs text-sky-400", children: "\u2605" })
4186
+ ] }),
4187
+ /* @__PURE__ */ jsxs24("div", { className: "space-y-1 text-sm", children: [
4188
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4189
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6467\u6BC1" }),
4190
+ /* @__PURE__ */ jsxs24("span", { className: "font-bold text-sky-400", children: [
4191
+ plan.ourDestroyed,
4192
+ "\u4E2A"
4193
+ ] })
4194
+ ] }),
4195
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4196
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u53D7\u635F" }),
4197
+ /* @__PURE__ */ jsxs24("span", { className: "font-bold text-sky-500", children: [
4198
+ plan.ourDamaged,
4199
+ "\u4E2A"
4200
+ ] })
4201
+ ] }),
4202
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4203
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u603B\u8BA1" }),
4204
+ /* @__PURE__ */ jsxs24("span", { className: "font-bold", children: [
4205
+ plan.ourTotal,
4206
+ "\u4E2A"
4207
+ ] })
4208
+ ] }),
4209
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between border-t border-[hsl(var(--border))] pt-2", children: [
4210
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u635F\u5931\u7387" }),
4211
+ /* @__PURE__ */ jsxs24("span", { className: "text-lg font-bold", style: { color: colors.primary }, children: [
4212
+ plan.lossRate.toFixed(1),
4213
+ "%"
4214
+ ] })
4215
+ ] }),
4216
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4217
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u5BFC\u5F39" }),
4218
+ /* @__PURE__ */ jsxs24("span", { className: "font-bold", children: [
4219
+ plan.missilesFired,
4220
+ "\u679A"
4221
+ ] })
4222
+ ] }),
4223
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4224
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u547D\u4E2D\u7387" }),
4225
+ /* @__PURE__ */ jsxs24("span", { className: "font-bold text-sky-400", children: [
4226
+ plan.hitRate,
4227
+ "%"
4228
+ ] })
4229
+ ] }),
4230
+ /* @__PURE__ */ jsxs24("div", { className: "flex justify-between", children: [
4231
+ /* @__PURE__ */ jsx24("span", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6548\u8D39\u6BD4" }),
4232
+ /* @__PURE__ */ jsx24("span", { className: "font-bold", children: efficiency.toFixed(2) })
4233
+ ] }),
4234
+ /* @__PURE__ */ jsx24(
4235
+ "div",
4236
+ {
4237
+ className: `mt-2 flex items-center justify-center gap-1 rounded p-2 ${riskConfig.bg}`,
4238
+ children: /* @__PURE__ */ jsxs24("span", { className: `font-semibold ${riskConfig.color}`, children: [
4239
+ "\u98CE\u9669",
4240
+ riskConfig.label
4241
+ ] })
4242
+ }
4243
+ )
4244
+ ] })
4245
+ ]
4246
+ },
4247
+ index
4248
+ );
4249
+ }) }),
4250
+ /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-3 gap-4", children: Object.entries(riskLevelConfig).map(([level, config]) => {
4251
+ const count = plans.filter((p) => p.riskLevel === level).length;
4252
+ return /* @__PURE__ */ jsx24("div", { className: `rounded-lg p-3 ${config.bg}`, children: /* @__PURE__ */ jsx24("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs24("div", { children: [
4253
+ /* @__PURE__ */ jsxs24("div", { className: `text-xs ${config.color}`, children: [
4254
+ "\u98CE\u9669",
4255
+ config.label
4256
+ ] }),
4257
+ /* @__PURE__ */ jsxs24("div", { className: "text-xl font-bold", children: [
4258
+ count,
4259
+ "\u4E2A\u65B9\u6848"
4260
+ ] })
4261
+ ] }) }) }, level);
4262
+ }) }),
4263
+ analysis && /* @__PURE__ */ jsx24("div", { className: "rounded-lg border border-sky-800 bg-sky-950 p-4", children: /* @__PURE__ */ jsx24("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs24("div", { className: "flex-1", children: [
4264
+ /* @__PURE__ */ jsx24("h4", { className: "mb-1 text-sm font-semibold", children: "\u5206\u6790\u7ED3\u8BBA" }),
4265
+ /* @__PURE__ */ jsx24("p", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: analysis })
4266
+ ] }) }) })
4267
+ ] }),
4268
+ /* @__PURE__ */ jsx24(SurvivalEffectControlPanel, { cardId, card })
4269
+ ] });
4270
+ }
4271
+ var SurvivalEffectCard = memo5(SurvivalEffectCardComponent);
4272
+
4273
+ // src/react/components/card/cards/travel-itinerary-card.tsx
4274
+ import { Calendar as Calendar2, MapPin as MapPin9, Wallet as Wallet2 } from "lucide-react";
4275
+ import { jsx as jsx25, jsxs as jsxs25 } from "react/jsx-runtime";
4276
+ function TravelItineraryCard({ card }) {
4277
+ const payload = card.payload;
4278
+ if (!payload || !Array.isArray(payload.dailyPlan)) {
4279
+ return /* @__PURE__ */ jsx25("div", { className: "rounded-md border border-red-500/50 bg-red-500/10 p-4", children: /* @__PURE__ */ jsx25("p", { className: "text-sm text-red-400", children: "\u65C5\u884C\u884C\u7A0B\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u9700\u8981 dailyPlan \u6570\u7EC4" }) });
4280
+ }
4281
+ const formatCurrency = (amount, currency) => {
4282
+ if (currency === "CNY") {
4283
+ return `\xA5${amount.toLocaleString()}`;
4284
+ }
4285
+ return `${currency} ${amount.toLocaleString()}`;
4286
+ };
4287
+ return /* @__PURE__ */ jsxs25("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 shadow-sm", children: [
4288
+ card.title && /* @__PURE__ */ jsx25("h3", { className: "mb-4 text-lg font-semibold text-[hsl(var(--foreground))]", children: card.title }),
4289
+ /* @__PURE__ */ jsxs25("div", { className: "mb-4 flex flex-wrap gap-4 rounded-lg bg-[hsl(var(--secondary)/0.3)] p-3", children: [
4290
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
4291
+ /* @__PURE__ */ jsx25(MapPin9, { className: "h-4 w-4 text-[hsl(var(--primary))]" }),
4292
+ /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium", children: payload.destination })
4293
+ ] }),
4294
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
4295
+ /* @__PURE__ */ jsx25(Calendar2, { className: "h-4 w-4 text-[hsl(var(--primary))]" }),
4296
+ /* @__PURE__ */ jsxs25("span", { className: "text-sm", children: [
4297
+ payload.duration,
4298
+ " (",
4299
+ payload.startDate,
4300
+ " - ",
4301
+ payload.endDate,
4302
+ ")"
4303
+ ] })
4304
+ ] }),
4305
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
4306
+ /* @__PURE__ */ jsx25(Wallet2, { className: "h-4 w-4 text-[hsl(var(--primary))]" }),
4307
+ /* @__PURE__ */ jsxs25("span", { className: "text-sm", children: [
4308
+ "\u9884\u7B97: ",
4309
+ formatCurrency(payload.totalBudget, payload.currency)
4310
+ ] })
4311
+ ] })
4312
+ ] }),
4313
+ /* @__PURE__ */ jsx25("div", { className: "space-y-3", children: payload.dailyPlan.map((day) => /* @__PURE__ */ jsxs25(
4314
+ "div",
4315
+ {
4316
+ className: "rounded-lg border border-[hsl(var(--border))] p-3 transition-shadow hover:shadow-sm",
4317
+ children: [
4318
+ /* @__PURE__ */ jsxs25("div", { className: "mb-2 flex items-center gap-2", children: [
4319
+ /* @__PURE__ */ jsxs25("span", { className: "rounded bg-[hsl(var(--primary))] px-2 py-1 text-xs font-medium text-[hsl(var(--primary-foreground))]", children: [
4320
+ "Day ",
4321
+ day.day
4322
+ ] }),
4323
+ /* @__PURE__ */ jsx25("span", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: day.date })
4324
+ ] }),
4325
+ /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-2", children: day.activities.map((activity, index) => /* @__PURE__ */ jsx25(
4326
+ "span",
4327
+ {
4328
+ className: "rounded bg-[hsl(var(--secondary))] px-2 py-1 text-sm text-[hsl(var(--secondary-foreground))]",
4329
+ children: activity
4330
+ },
4331
+ index
4332
+ )) })
4333
+ ]
4334
+ },
4335
+ day.day
4336
+ )) })
4337
+ ] });
4338
+ }
4339
+
4340
+ // src/react/components/card/register.ts
4341
+ cardRegistry.register("kill-chain-card", KillChainCard);
4342
+ cardRegistry.register("shopping-list-card", ShoppingListCard);
4343
+ cardRegistry.register("product-recommendation-card", ProductRecommendationCard);
4344
+ cardRegistry.register("order-status-card", OrderStatusCard);
4345
+ cardRegistry.register("map-card", MapCard);
4346
+ cardRegistry.register("cite-card", CitationCard);
4347
+ cardRegistry.register("diff-card", DiffCard);
4348
+ cardRegistry.register("patch-card", PatchCard);
4349
+ cardRegistry.register("experience-card-with-options", ExperienceCardWithOptions);
4350
+ cardRegistry.register("simulation-event-card", SimulationEventCard);
4351
+ cardRegistry.register("damage-effect-card", DamageEffectCard);
4352
+ cardRegistry.register("survival-effect-card", SurvivalEffectCard);
4353
+ cardRegistry.register("comprehensive-analysis-card", ComprehensiveAnalysisCard);
4354
+ cardRegistry.register("reflection-optimization-card", ReflectionOptimizationCard);
4355
+ cardRegistry.register("counter", Counter);
4356
+ cardRegistry.register("resolution-modifications-card", ResolutionModificationsCard);
4357
+ cardRegistry.register("execution-order-card", ExecutionOrderCard);
4358
+ cardRegistry.register("resolution-summary-card", ResolutionSummaryCard);
4359
+ cardRegistry.register("gis-conflict-detection", ConflictDetectionCard);
4360
+ cardRegistry.register("travel-itinerary-card", TravelItineraryCard);
4361
+ cardRegistry.register("travel-plan", TravelItineraryCard);
4362
+ cardRegistry.register("destination-card", DestinationCard);
4363
+ cardRegistry.register("flight-card", FlightCard);
4364
+ cardRegistry.register("hotel-card", HotelCard);
4365
+ cardRegistry.register("attraction-card", AttractionCard);
4366
+ cardRegistry.register("restaurant-card", RestaurantCard);
4367
+ //# sourceMappingURL=register.js.map