@vitalens/panel 0.1.0 → 0.1.1

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.
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { computed as R, shallowRef as We, ref as x, watch as B, onBeforeUnmount as Le, defineComponent as Xe, onMounted as Ke, nextTick as Qe, onErrorCaptured as Ze, openBlock as p, createElementBlock as f, createElementVNode as l, toDisplayString as w, Fragment as O, unref as D, createCommentVNode as H, renderList as z, withDirectives as et, vModelText as tt, normalizeClass as we, createTextVNode as nt } from "vue";
2
- import { LineChart as at } from "echarts/charts";
3
- import { GridComponent as st, TooltipComponent as rt, LegendComponent as lt } from "echarts/components";
4
- import { use as ot, init as it } from "echarts/core";
5
- import { CanvasRenderer as ut } from "echarts/renderers";
6
- const Ie = 60 * 1e3, $e = 60 * Ie, ct = 2 * $e, pt = 1e3, ft = 5, dt = /* @__PURE__ */ new Set([
1
+ import { computed as T, shallowRef as lt, ref as D, watch as j, onBeforeUnmount as xe, defineComponent as it, onMounted as ut, nextTick as ct, onErrorCaptured as pt, openBlock as p, createElementBlock as f, createElementVNode as s, toDisplayString as h, Fragment as U, normalizeClass as B, unref as F, createTextVNode as Me, createCommentVNode as W, createStaticVNode as ft, renderList as H, withDirectives as dt, vModelText as _t } from "vue";
2
+ import { LineChart as mt } from "echarts/charts";
3
+ import { GridComponent as vt, TooltipComponent as ht, LegendComponent as yt } from "echarts/components";
4
+ import { use as bt, init as gt } from "echarts/core";
5
+ import { CanvasRenderer as kt } from "echarts/renderers";
6
+ const Ne = 60 * 1e3, Pe = 60 * Ne, Tt = 2 * Pe, wt = 1e3, Ct = 5, Rt = /* @__PURE__ */ new Set([
7
7
  "error",
8
8
  "request",
9
9
  "longTask",
10
10
  "event",
11
11
  "exposure"
12
12
  ]);
13
- function W(n, u) {
14
- var v;
15
- const o = n.filter((C) => Number.isFinite(C)).sort((C, M) => C - M);
16
- if (o.length === 0) return null;
17
- const s = Math.min(o.length - 1, Math.max(0, Math.ceil(o.length * u) - 1));
18
- return (v = o[s]) != null ? v : null;
13
+ function Z(a, o) {
14
+ var b;
15
+ const r = a.filter((C) => Number.isFinite(C)).sort((C, I) => C - I);
16
+ if (r.length === 0) return null;
17
+ const l = Math.min(r.length - 1, Math.max(0, Math.ceil(r.length * o) - 1));
18
+ return (b = r[l]) != null ? b : null;
19
19
  }
20
- function mt() {
20
+ function St() {
21
21
  return {
22
22
  vital: 0,
23
23
  error: 0,
@@ -29,397 +29,434 @@ function mt() {
29
29
  exposure: 0
30
30
  };
31
31
  }
32
- function re(n) {
33
- return n < 10 ? `0${n}` : String(n);
32
+ function ue(a) {
33
+ return a < 10 ? `0${a}` : String(a);
34
34
  }
35
- function _t(n, u) {
36
- const o = new Date(n), s = re(o.getMonth() + 1), v = re(o.getDate()), C = re(o.getHours());
37
- return u === "hour" ? `${s}-${v} ${C}:00` : `${C}:${re(o.getMinutes())}`;
35
+ function Lt(a, o) {
36
+ const r = new Date(a), l = ue(r.getMonth() + 1), b = ue(r.getDate()), C = ue(r.getHours());
37
+ return o === "hour" ? `${l}-${b} ${C}:00` : `${C}:${ue(r.getMinutes())}`;
38
38
  }
39
- function yt(n) {
40
- let u = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY;
41
- for (const s of n)
42
- Number.isFinite(s.timestamp) && (s.timestamp < u && (u = s.timestamp), s.timestamp > o && (o = s.timestamp));
43
- return !Number.isFinite(u) || !Number.isFinite(o) ? "minute" : o - u >= ct ? "hour" : "minute";
39
+ function $t(a) {
40
+ let o = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
41
+ for (const l of a)
42
+ Number.isFinite(l.timestamp) && (l.timestamp < o && (o = l.timestamp), l.timestamp > r && (r = l.timestamp));
43
+ return !Number.isFinite(o) || !Number.isFinite(r) ? "minute" : r - o >= Tt ? "hour" : "minute";
44
44
  }
45
- function fe(n, u) {
46
- return Array.from(n, ([o, s]) => {
47
- const v = {
48
- key: o,
49
- label: s.label,
50
- count: s.count
45
+ function ve(a, o) {
46
+ return Array.from(a, ([r, l]) => {
47
+ const b = {
48
+ key: r,
49
+ label: l.label,
50
+ count: l.count
51
51
  };
52
- return s.totalDuration > 0 && s.count > 0 && (v.avgDurationMs = s.totalDuration / s.count), v;
53
- }).sort((o, s) => s.count - o.count || o.label.localeCompare(s.label)).slice(0, u);
52
+ return l.totalDuration > 0 && l.count > 0 && (b.avgDurationMs = l.totalDuration / l.count), b;
53
+ }).sort((r, l) => l.count - r.count || r.label.localeCompare(l.label)).slice(0, o);
54
54
  }
55
- function de(n) {
56
- return n.type !== "error" ? 1 : n.count && n.count > 0 ? n.count : 1;
55
+ function he(a) {
56
+ return a.type !== "error" ? 1 : a.count && a.count > 0 ? a.count : 1;
57
57
  }
58
- function vt(n) {
59
- var U;
60
- const u = Math.max(1, Math.trunc((U = n.topLimit) != null ? U : ft)), o = R(() => {
61
- const m = mt(), d = {
58
+ function Mt(a) {
59
+ var P;
60
+ const o = Math.max(1, Math.trunc((P = a.topLimit) != null ? P : Ct)), r = T(() => {
61
+ const v = St(), _ = {
62
62
  LCP: [],
63
63
  INP: [],
64
64
  CLS: [],
65
65
  FCP: [],
66
66
  TTFB: []
67
67
  };
68
- let c = 0, _ = 0, b = 0, k = 0;
69
- for (const g of n.records())
70
- switch (m[g.type] += 1, k += 1, g.type) {
68
+ let d = 0, y = 0, g = 0, m = 0;
69
+ for (const w of a.records())
70
+ switch (v[w.type] += 1, m += 1, w.type) {
71
71
  case "vital":
72
- d[g.name].push(g.value);
72
+ _[w.name].push(w.value);
73
73
  break;
74
74
  case "error":
75
- c += de(g);
75
+ d += he(w);
76
76
  break;
77
77
  case "request":
78
- g.durationMs > pt && (_ += 1);
78
+ w.durationMs > wt && (y += 1);
79
79
  break;
80
80
  case "longTask":
81
- b += 1;
81
+ g += 1;
82
82
  break;
83
83
  }
84
84
  const S = {
85
- LCP: W(d.LCP, 0.75),
86
- INP: W(d.INP, 0.75),
87
- CLS: W(d.CLS, 0.75),
88
- FCP: W(d.FCP, 0.75),
89
- TTFB: W(d.TTFB, 0.75)
85
+ LCP: Z(_.LCP, 0.75),
86
+ INP: Z(_.INP, 0.75),
87
+ CLS: Z(_.CLS, 0.75),
88
+ FCP: Z(_.FCP, 0.75),
89
+ TTFB: Z(_.TTFB, 0.75)
90
90
  };
91
91
  return {
92
- total: k,
92
+ total: m,
93
93
  vitals: S,
94
- errors: c,
95
- slowRequests: _,
96
- longTasks: b,
97
- byType: m
94
+ errors: d,
95
+ slowRequests: y,
96
+ longTasks: g,
97
+ byType: v
98
98
  };
99
- }), s = R(() => {
100
- const m = n.records().filter((k) => dt.has(k.type)), d = yt(m), c = d === "hour" ? $e : Ie, _ = /* @__PURE__ */ new Map();
101
- for (const k of m) {
102
- if (!Number.isFinite(k.timestamp)) continue;
103
- const S = Math.floor(k.timestamp / c) * c;
104
- let g = _.get(S);
105
- switch (g || (g = {
99
+ }), l = T(() => {
100
+ const v = a.records().filter((m) => Rt.has(m.type)), _ = $t(v), d = _ === "hour" ? Pe : Ne, y = /* @__PURE__ */ new Map();
101
+ for (const m of v) {
102
+ if (!Number.isFinite(m.timestamp)) continue;
103
+ const S = Math.floor(m.timestamp / d) * d;
104
+ let w = y.get(S);
105
+ switch (w || (w = {
106
106
  bucket: S,
107
- label: _t(S, d),
107
+ label: Lt(S, _),
108
108
  errors: 0,
109
109
  requests: 0,
110
110
  longTasks: 0,
111
111
  events: 0
112
- }, _.set(S, g)), k.type) {
112
+ }, y.set(S, w)), m.type) {
113
113
  case "error":
114
- g.errors += de(k);
114
+ w.errors += he(m);
115
115
  break;
116
116
  case "request":
117
- g.requests += 1;
117
+ w.requests += 1;
118
118
  break;
119
119
  case "longTask":
120
- g.longTasks += 1;
120
+ w.longTasks += 1;
121
121
  break;
122
122
  case "event":
123
123
  case "exposure":
124
- g.events += 1;
124
+ w.events += 1;
125
125
  break;
126
126
  }
127
127
  }
128
- const b = Array.from(_.values()).sort((k, S) => k.bucket - S.bucket);
129
- return { granularity: d, points: b };
130
- }), v = R(() => s.value.points), C = R(() => s.value.granularity), M = R(() => {
131
- var d;
132
- const m = /* @__PURE__ */ new Map();
133
- for (const c of n.records()) {
134
- if (c.type !== "route") continue;
135
- const _ = c.to.path || c.to.fullPath || "(未知路由)", b = (d = m.get(_)) != null ? d : { label: _, count: 0, totalDuration: 0 };
136
- b.count += 1, b.totalDuration += Number.isFinite(c.durationMs) ? c.durationMs : 0, m.set(_, b);
128
+ const g = Array.from(y.values()).sort((m, S) => m.bucket - S.bucket);
129
+ return { granularity: _, points: g };
130
+ }), b = T(() => l.value.points), C = T(() => l.value.granularity), I = T(() => {
131
+ var _;
132
+ const v = /* @__PURE__ */ new Map();
133
+ for (const d of a.records()) {
134
+ if (d.type !== "route") continue;
135
+ const y = d.to.path || d.to.fullPath || "(未知路由)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
136
+ g.count += 1, g.totalDuration += Number.isFinite(d.durationMs) ? d.durationMs : 0, v.set(y, g);
137
137
  }
138
- return fe(m, u);
139
- }), T = R(() => {
140
- var d;
141
- const m = /* @__PURE__ */ new Map();
142
- for (const c of n.records()) {
143
- if (c.type !== "error") continue;
144
- const _ = c.fingerprint || c.message, b = c.message || c.name || "(未知错误)", k = (d = m.get(_)) != null ? d : { label: b, count: 0, totalDuration: 0 };
145
- k.count += de(c), m.set(_, k);
138
+ return ve(v, o);
139
+ }), R = T(() => {
140
+ var _;
141
+ const v = /* @__PURE__ */ new Map();
142
+ for (const d of a.records()) {
143
+ if (d.type !== "error") continue;
144
+ const y = d.fingerprint || d.message, g = d.message || d.name || "(未知错误)", m = (_ = v.get(y)) != null ? _ : { label: g, count: 0, totalDuration: 0 };
145
+ m.count += he(d), v.set(y, m);
146
146
  }
147
- return fe(m, u);
148
- }), I = R(() => {
149
- var d;
150
- const m = /* @__PURE__ */ new Map();
151
- for (const c of n.records()) {
152
- if (c.type !== "event" && c.type !== "exposure") continue;
153
- const _ = c.name || "(未命名事件)", b = (d = m.get(_)) != null ? d : { label: _, count: 0, totalDuration: 0 };
154
- b.count += 1, m.set(_, b);
147
+ return ve(v, o);
148
+ }), $ = T(() => {
149
+ var _;
150
+ const v = /* @__PURE__ */ new Map();
151
+ for (const d of a.records()) {
152
+ if (d.type !== "event" && d.type !== "exposure") continue;
153
+ const y = d.name || "(未命名事件)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
154
+ g.count += 1, v.set(y, g);
155
155
  }
156
- return fe(m, u);
156
+ return ve(v, o);
157
157
  });
158
158
  return {
159
- overview: o,
160
- trend: v,
159
+ overview: r,
160
+ trend: b,
161
161
  trendGranularity: C,
162
- topRoutes: M,
163
- topErrors: T,
164
- topEvents: I
162
+ topRoutes: I,
163
+ topErrors: R,
164
+ topEvents: $
165
165
  };
166
166
  }
167
- const me = 5e3, Re = 1e3, Se = 1e3, bt = 1e3;
168
- function X(n) {
169
- return n instanceof Error ? n.message : String(n);
167
+ const ye = 5e3, Ee = 1e3, Ie = 1e3, Et = 1e3;
168
+ function ee(a) {
169
+ return a instanceof Error ? a.message : String(a);
170
170
  }
171
- function ht(n, u) {
172
- return n.timestamp !== u.timestamp ? u.timestamp - n.timestamp : n.id === u.id ? 0 : n.id < u.id ? -1 : 1;
171
+ function It(a, o) {
172
+ return a.timestamp !== o.timestamp ? o.timestamp - a.timestamp : a.id === o.id ? 0 : a.id < o.id ? -1 : 1;
173
173
  }
174
- function kt(n) {
175
- const u = n.replace(/[^\w-]+/g, "-") || "export", o = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
176
- return `vitalens-${u}-${o}.json`;
174
+ function xt(a) {
175
+ const o = a.replace(/[^\w-]+/g, "-") || "export", r = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
176
+ return `vitalens-${o}-${r}.json`;
177
177
  }
178
- function gt(n, u) {
178
+ function Nt(a, o) {
179
179
  try {
180
180
  if (typeof document == "undefined" || typeof URL == "undefined" || typeof URL.createObjectURL != "function") return;
181
- const o = URL.createObjectURL(n), s = document.createElement("a");
182
- s.href = o, s.download = kt(u), s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), setTimeout(() => {
181
+ const r = URL.createObjectURL(a), l = document.createElement("a");
182
+ l.href = r, l.download = xt(o), l.rel = "noopener", document.body.appendChild(l), l.click(), l.remove(), setTimeout(() => {
183
183
  try {
184
- typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(o);
184
+ typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(r);
185
185
  } catch {
186
186
  }
187
187
  }, 0);
188
188
  } catch {
189
189
  }
190
190
  }
191
- function Ct(n) {
192
- const u = We([]), o = x(!1), s = x(""), v = x(!0);
193
- let C = [], M = [], T = /* @__PURE__ */ new Map(), I = [], U = !1, m = 0, d, c, _ = !1;
194
- function b() {
195
- const r = n.appId(), i = /* @__PURE__ */ new Map(), h = (F) => {
196
- for (const E of F)
197
- r && E.appId !== r || Number.isFinite(E.timestamp) && i.set(E.id, E);
191
+ function Pt(a) {
192
+ const o = lt([]), r = D(!1), l = D(""), b = D(!0);
193
+ let C = [], I = [], R = /* @__PURE__ */ new Map(), $ = [], P = !1, v = 0, _, d, y = !1;
194
+ function g() {
195
+ const i = a.appId(), u = /* @__PURE__ */ new Map(), k = (A) => {
196
+ for (const x of A)
197
+ i && x.appId !== i || Number.isFinite(x.timestamp) && u.set(x.id, x);
198
198
  };
199
- h(C), h(M), h(Array.from(T.values()));
200
- const $ = Array.from(i.values()).sort(ht);
201
- u.value = $.length > me ? $.slice(0, me) : $;
199
+ k(C), k(I), k(Array.from(R.values()));
200
+ const M = Array.from(u.values()).sort(It);
201
+ o.value = M.length > ye ? M.slice(0, ye) : M;
202
202
  }
203
- function k() {
204
- if (T.size <= Re) return;
205
- const r = T.size - Re;
206
- let i = 0;
207
- for (const h of T.keys())
208
- if (T.delete(h), i += 1, i >= r) break;
203
+ function m() {
204
+ if (R.size <= Ee) return;
205
+ const i = R.size - Ee;
206
+ let u = 0;
207
+ for (const k of R.keys())
208
+ if (R.delete(k), u += 1, u >= i) break;
209
209
  }
210
210
  function S() {
211
- if (I.length !== 0) {
212
- for (const r of I)
213
- T.delete(r.id), T.set(r.id, r);
214
- I = [], k(), b();
211
+ if ($.length !== 0) {
212
+ for (const i of $)
213
+ R.delete(i.id), R.set(i.id, i);
214
+ $ = [], m(), g();
215
215
  }
216
216
  }
217
- function g() {
218
- !v.value || U || typeof document != "undefined" && document.visibilityState === "hidden" || S();
217
+ function w() {
218
+ !b.value || P || typeof document != "undefined" && document.visibilityState === "hidden" || S();
219
219
  }
220
- function le(r) {
221
- if (r.length === 0) return;
222
- const i = I.concat(r);
223
- I = i.length > Se ? i.slice(i.length - Se) : i;
220
+ function ce(i) {
221
+ if (i.length === 0) return;
222
+ const u = $.concat(i);
223
+ $ = u.length > Ie ? u.slice(u.length - Ie) : u;
224
224
  }
225
- function K() {
226
- typeof document != "undefined" && document.visibilityState === "visible" && g();
225
+ function te() {
226
+ typeof document != "undefined" && document.visibilityState === "visible" && w();
227
227
  }
228
- function Q() {
229
- const r = n.perf();
230
- if (!(!r || d || !v.value)) {
228
+ function ne() {
229
+ const i = a.perf();
230
+ if (!(!i || _ || !b.value)) {
231
231
  try {
232
- d = r.subscribe((i) => {
233
- le(i);
232
+ _ = i.subscribe((u) => {
233
+ ce(u);
234
234
  });
235
- } catch (i) {
236
- s.value = `订阅实时数据失败:${X(i)}`;
235
+ } catch (u) {
236
+ l.value = `订阅实时数据失败:${ee(u)}`;
237
237
  return;
238
238
  }
239
- c = setInterval(g, bt), typeof document != "undefined" && !_ && (document.addEventListener("visibilitychange", K), _ = !0);
239
+ d = setInterval(w, Et), typeof document != "undefined" && !y && (document.addEventListener("visibilitychange", te), y = !0);
240
240
  }
241
241
  }
242
- function P() {
243
- if (d) {
242
+ function O() {
243
+ if (_) {
244
244
  try {
245
- d();
245
+ _();
246
246
  } catch {
247
247
  }
248
- d = void 0;
248
+ _ = void 0;
249
249
  }
250
- c !== void 0 && (clearInterval(c), c = void 0), typeof document != "undefined" && _ && (document.removeEventListener("visibilitychange", K), _ = !1);
250
+ d !== void 0 && (clearInterval(d), d = void 0), typeof document != "undefined" && y && (document.removeEventListener("visibilitychange", te), y = !1);
251
251
  }
252
- async function N() {
253
- const r = ++m;
254
- o.value = !0;
252
+ async function q() {
253
+ const i = ++v;
254
+ r.value = !0;
255
255
  try {
256
- const i = n.perf();
257
- if (!i) {
258
- if (r !== m) return;
259
- C = [], s.value = "";
256
+ const u = a.perf();
257
+ if (!u) {
258
+ if (i !== v) return;
259
+ C = [], l.value = "";
260
260
  return;
261
261
  }
262
- const h = { order: "desc", limit: me }, $ = await i.query(h);
263
- if (r !== m) return;
264
- C = $, s.value = "";
265
- } catch (i) {
266
- if (r !== m) return;
267
- s.value = `读取本地数据失败:${X(i)}`;
262
+ const k = { order: "desc", limit: ye }, M = await u.query(k);
263
+ if (i !== v) return;
264
+ C = M, l.value = "";
265
+ } catch (u) {
266
+ if (i !== v) return;
267
+ l.value = `读取本地数据失败:${ee(u)}`;
268
268
  } finally {
269
- r === m && (o.value = !1, b());
269
+ i === v && (r.value = !1, g());
270
270
  }
271
271
  }
272
- function L(r) {
273
- if (r !== v.value) {
274
- if (!r) {
275
- S(), v.value = !1, P();
272
+ function L(i) {
273
+ if (i !== b.value) {
274
+ if (!i) {
275
+ S(), b.value = !1, O();
276
276
  return;
277
277
  }
278
- v.value = !0, n.perf() && (Q(), N());
278
+ b.value = !0, a.perf() && (ne(), q());
279
279
  }
280
280
  }
281
- async function V(r) {
282
- const i = n.perf();
283
- if (!i)
284
- return s.value = "缺少 perf 实例,无法导入", 0;
285
- U = !0, o.value = !0;
281
+ async function G(i) {
282
+ const u = a.perf();
283
+ if (!u)
284
+ return l.value = "缺少 perf 实例,无法导入", 0;
285
+ P = !0, r.value = !0;
286
286
  try {
287
- const h = await i.importAll(r);
288
- return await N(), h;
289
- } catch (h) {
290
- return s.value = `导入失败:${X(h)}`, 0;
287
+ const k = await u.importAll(i);
288
+ return await q(), k;
289
+ } catch (k) {
290
+ return l.value = `导入失败:${ee(k)}`, 0;
291
291
  } finally {
292
- U = !1, o.value = !1;
292
+ P = !1, r.value = !1;
293
293
  }
294
294
  }
295
- async function q() {
296
- var r, i, h, $;
295
+ async function V() {
296
+ var i, u, k, M;
297
297
  try {
298
- const F = n.perf();
299
- let E;
300
- if (F)
301
- E = await F.exportAll();
298
+ const A = a.perf();
299
+ let x;
300
+ if (A)
301
+ x = await A.exportAll();
302
302
  else {
303
- const ie = {
303
+ const fe = {
304
304
  formatVersion: 1,
305
- appId: (r = n.appId()) != null ? r : "",
305
+ appId: (i = a.appId()) != null ? i : "",
306
306
  exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
307
- records: u.value
307
+ records: o.value
308
308
  };
309
- E = new Blob([JSON.stringify(ie, null, 2)], { type: "application/json" });
309
+ x = new Blob([JSON.stringify(fe, null, 2)], { type: "application/json" });
310
310
  }
311
- const oe = ($ = (h = n.appId()) != null ? h : (i = n.perf()) == null ? void 0 : i.config.appId) != null ? $ : "export";
312
- return gt(E, oe), E;
313
- } catch (F) {
314
- return s.value = `导出失败:${X(F)}`, null;
311
+ const pe = (M = (k = a.appId()) != null ? k : (u = a.perf()) == null ? void 0 : u.config.appId) != null ? M : "export";
312
+ return Nt(x, pe), x;
313
+ } catch (A) {
314
+ return l.value = `导出失败:${ee(A)}`, null;
315
315
  }
316
316
  }
317
- async function Z() {
318
- const r = n.perf();
319
- if (!r)
320
- return s.value = "缺少 perf 实例,无法清空", !1;
321
- o.value = !0;
317
+ async function ae() {
318
+ const i = a.perf();
319
+ if (!i)
320
+ return l.value = "缺少 perf 实例,无法清空", !1;
321
+ r.value = !0;
322
322
  try {
323
- return await r.clear(), C = [], T = /* @__PURE__ */ new Map(), I = [], s.value = "", b(), !0;
324
- } catch (i) {
325
- return s.value = `清空失败:${X(i)}`, !1;
323
+ return await i.clear(), C = [], R = /* @__PURE__ */ new Map(), $ = [], l.value = "", g(), !0;
324
+ } catch (u) {
325
+ return l.value = `清空失败:${ee(u)}`, !1;
326
326
  } finally {
327
- o.value = !1;
327
+ r.value = !1;
328
328
  }
329
329
  }
330
- return B(
331
- () => n.perf(),
332
- (r, i) => {
333
- r !== i && (P(), I = [], T = /* @__PURE__ */ new Map(), r ? (v.value && Q(), N()) : (C = [], b()));
330
+ return j(
331
+ () => a.perf(),
332
+ (i, u) => {
333
+ i !== u && (O(), $ = [], R = /* @__PURE__ */ new Map(), i ? (b.value && ne(), q()) : (C = [], g()));
334
334
  },
335
335
  { immediate: !0 }
336
- ), B(
337
- () => n.records(),
338
- (r) => {
339
- M = r != null ? r : [], b();
336
+ ), j(
337
+ () => a.records(),
338
+ (i) => {
339
+ I = i != null ? i : [], g();
340
340
  },
341
341
  { immediate: !0 }
342
- ), B(
343
- () => n.appId(),
342
+ ), j(
343
+ () => a.appId(),
344
344
  () => {
345
- b();
345
+ g();
346
346
  }
347
- ), Le(() => {
348
- P(), I = [], T = /* @__PURE__ */ new Map(), C = [], M = [];
347
+ ), xe(() => {
348
+ O(), $ = [], R = /* @__PURE__ */ new Map(), C = [], I = [];
349
349
  }), {
350
- records: u,
351
- loading: o,
352
- error: s,
353
- realtime: v,
354
- refresh: N,
355
- importFile: V,
356
- exportFile: q,
357
- clearLocal: Z,
350
+ records: o,
351
+ loading: r,
352
+ error: l,
353
+ realtime: b,
354
+ refresh: q,
355
+ importFile: G,
356
+ exportFile: V,
357
+ clearLocal: ae,
358
358
  setRealtime: L
359
359
  };
360
360
  }
361
- const Tt = {
361
+ const Ft = 1e3, Ot = 1e3, At = 2e3, Fe = {
362
+ LCP: { good: 2500, warn: 4e3, unit: "ms", hint: "≤2500ms 良好 / ≤4000ms 预警" },
363
+ INP: { good: 200, warn: 500, unit: "ms", hint: "≤200ms 良好 / ≤500ms 预警" },
364
+ CLS: { good: 0.1, warn: 0.25, unit: "", hint: "≤0.1 良好 / ≤0.25 预警" },
365
+ FCP: { good: 1800, warn: 3e3, unit: "ms", hint: "≤1800ms 良好 / ≤3000ms 预警" },
366
+ TTFB: { good: 800, warn: 1800, unit: "ms", hint: "≤800ms 良好 / ≤1800ms 预警" }
367
+ };
368
+ function Dt(a, o, r) {
369
+ return a === null || !Number.isFinite(a) ? "neutral" : a <= o ? "good" : a <= r ? "warn" : "poor";
370
+ }
371
+ function qt(a, o) {
372
+ const r = Fe[a];
373
+ return Dt(o, r.good, r.warn);
374
+ }
375
+ function Ut(a) {
376
+ return a === void 0 || !Number.isFinite(a) ? "neutral" : a >= 400 ? "poor" : "good";
377
+ }
378
+ function Vt(a) {
379
+ return !a.success || a.status !== void 0 && Number.isFinite(a.status) && a.status >= 400 ? "poor" : a.durationMs >= Ft ? "warn" : "good";
380
+ }
381
+ function zt(a) {
382
+ return a.durationMs >= Ot ? "warn" : "good";
383
+ }
384
+ function Bt(a) {
385
+ var o;
386
+ return a.failed ? "poor" : ((o = a.durationMs) != null ? o : 0) >= At ? "warn" : "good";
387
+ }
388
+ const Ht = {
362
389
  class: "perf-panel",
363
390
  "aria-label": "性能面板"
364
- }, wt = {
391
+ }, jt = {
365
392
  key: 0,
366
393
  class: "perf-panel__fallback",
367
394
  role: "alert"
368
- }, Rt = { class: "perf-panel__fallback-text" }, St = { class: "perf-panel__header" }, Lt = { class: "perf-panel__actions" }, It = ["disabled"], $t = ["disabled"], Mt = ["disabled"], Et = { class: "perf-panel__switch" }, Pt = ["checked", "disabled"], xt = {
395
+ }, Gt = { class: "perf-panel__fallback-text" }, Wt = { class: "perf-panel__header" }, Yt = { class: "perf-panel__heading" }, Qt = { class: "perf-panel__title-row" }, Jt = { class: "perf-panel__subtitle" }, Xt = ["data-realtime"], Kt = { class: "perf-panel__subtitle-item" }, Zt = { class: "perf-panel__subtitle-item" }, en = {
396
+ key: 0,
397
+ class: "perf-panel__subtitle-item perf-panel__subtitle-item--loading"
398
+ }, tn = { class: "perf-panel__actions" }, nn = {
399
+ class: "perf-panel__action-group",
400
+ role: "group",
401
+ "aria-label": "刷新与导出"
402
+ }, an = ["disabled"], sn = {
403
+ class: "perf-panel__action-group",
404
+ role: "group",
405
+ "aria-label": "导入与清空"
406
+ }, rn = ["disabled"], on = ["disabled"], ln = { class: "perf-panel__switch" }, un = ["checked", "disabled"], cn = {
369
407
  key: 0,
370
- class: "perf-panel__status",
371
- role: "status"
372
- }, Nt = {
373
- key: 1,
374
408
  class: "perf-panel__notice",
375
409
  role: "alert"
376
- }, Ft = {
377
- key: 2,
410
+ }, pn = {
411
+ key: 1,
378
412
  class: "perf-panel__empty"
379
- }, At = {
380
- key: 3,
413
+ }, fn = {
414
+ key: 2,
381
415
  class: "perf-panel__empty"
382
- }, Ot = {
416
+ }, dn = {
383
417
  class: "perf-panel__section",
384
418
  "aria-label": "概览"
385
- }, Dt = { class: "perf-panel__overview" }, Ut = ["data-metric"], qt = { class: "perf-panel__card-label" }, zt = { class: "perf-panel__card-value" }, Bt = {
419
+ }, _n = { class: "perf-panel__overview" }, mn = ["data-metric", "data-tone"], vn = { class: "perf-panel__card-head" }, hn = { class: "perf-panel__card-label" }, yn = { class: "perf-panel__card-body" }, bn = { class: "perf-panel__card-value" }, gn = {
386
420
  key: 0,
387
421
  class: "perf-panel__card-unit"
388
- }, Vt = {
422
+ }, kn = { class: "perf-panel__card-hint" }, Tn = {
389
423
  class: "perf-panel__section",
390
424
  "aria-label": "趋势"
391
- }, Ht = { class: "perf-panel__section-head" }, Gt = { class: "perf-panel__section-meta" }, jt = { class: "perf-panel__chart-wrap" }, Yt = {
425
+ }, wn = { class: "perf-panel__section-head" }, Cn = { class: "perf-panel__section-title-group" }, Rn = { class: "perf-panel__section-meta" }, Sn = { class: "perf-panel__section-meta" }, Ln = { class: "perf-panel__chart-wrap" }, $n = {
392
426
  key: 0,
393
427
  class: "perf-panel__chart-empty"
394
- }, Jt = {
428
+ }, Mn = {
395
429
  key: 0,
396
430
  class: "perf-panel__notice"
397
- }, Wt = {
431
+ }, En = {
398
432
  class: "perf-panel__section",
399
433
  "aria-label": "Top 排行"
400
- }, Xt = { class: "perf-panel__top-grid" }, Kt = { class: "perf-panel__top-title" }, Qt = {
434
+ }, In = { class: "perf-panel__top-grid" }, xn = { class: "perf-panel__top-title" }, Nn = {
401
435
  key: 0,
402
436
  class: "perf-panel__top-list"
403
- }, Zt = ["title"], en = { class: "perf-panel__top-count" }, tn = {
437
+ }, Pn = ["title"], Fn = { class: "perf-panel__top-count" }, On = {
404
438
  key: 1,
405
439
  class: "perf-panel__top-empty"
406
- }, nn = {
407
- class: "perf-panel__section perf-panel__details",
440
+ }, An = {
441
+ class: "perf-panel__section",
408
442
  "aria-label": "明细"
409
- }, an = { class: "perf-panel__details-head" }, sn = {
443
+ }, Dn = { class: "perf-panel__details-head" }, qn = { class: "perf-panel__section-title-group" }, Un = { class: "perf-panel__section-meta" }, Vn = {
410
444
  class: "perf-panel__tabs",
411
445
  role: "tablist",
412
446
  "aria-label": "明细分类"
413
- }, rn = ["aria-selected", "data-tab", "onClick"], ln = { class: "perf-panel__tab-count" }, on = { class: "perf-panel__table-wrap" }, un = {
447
+ }, zn = ["aria-selected", "data-tab", "onClick"], Bn = { class: "perf-panel__tab-count" }, Hn = { class: "perf-panel__table-wrap" }, jn = {
414
448
  key: 0,
415
449
  class: "perf-panel__table"
416
- }, cn = {
450
+ }, Gn = ["data-column"], Wn = ["data-column", "data-tone", "title"], Yn = {
417
451
  key: 1,
418
- class: "perf-panel__empty"
419
- }, pn = {
452
+ class: "perf-panel__cell-text"
453
+ }, Qn = {
454
+ key: 1,
455
+ class: "perf-panel__empty perf-panel__empty--inline"
456
+ }, Jn = {
420
457
  key: 0,
421
458
  class: "perf-panel__pagination"
422
- }, fn = ["disabled"], dn = ["disabled"], _e = 20, mn = /* @__PURE__ */ Xe({
459
+ }, Xn = { class: "perf-panel__pagination-info" }, Kn = { class: "perf-panel__pagination-actions" }, Zn = ["disabled"], ea = ["disabled"], be = 20, ta = /* @__PURE__ */ it({
423
460
  name: "PerfPanel",
424
461
  __name: "PerfPanel",
425
462
  props: {
@@ -427,15 +464,15 @@ const Tt = {
427
464
  records: { default: () => [] },
428
465
  appId: {}
429
466
  },
430
- setup(n) {
431
- const u = n;
432
- ot([at, st, rt, lt, ut]);
433
- const o = ["#d54941", "#3f6ad8", "#c87f2c", "#2f8f6b"], s = [
467
+ setup(a) {
468
+ const o = a;
469
+ bt([mt, vt, ht, yt, kt]);
470
+ const r = ["#d54941", "#3f6ad8", "#c87f2c", "#2f8f6b"], l = [
434
471
  "--perf-panel-chart-error",
435
472
  "--perf-panel-chart-request",
436
473
  "--perf-panel-chart-long-task",
437
474
  "--perf-panel-chart-event"
438
- ], v = {
475
+ ], b = {
439
476
  error: ["error"],
440
477
  request: ["request"],
441
478
  route: ["route"],
@@ -447,9 +484,11 @@ const Tt = {
447
484
  label: "错误",
448
485
  columns: [
449
486
  { key: "time", label: "时间" },
450
- { key: "source", label: "来源" },
487
+ { key: "source", label: "来源", kind: "chip" },
451
488
  { key: "name", label: "名称" },
452
- { key: "message", label: "消息" }
489
+ { key: "message", label: "消息" },
490
+ { key: "route", label: "路由" },
491
+ { key: "component", label: "组件" }
453
492
  ]
454
493
  },
455
494
  {
@@ -457,10 +496,12 @@ const Tt = {
457
496
  label: "请求",
458
497
  columns: [
459
498
  { key: "time", label: "时间" },
460
- { key: "method", label: "方法" },
461
- { key: "url", label: "URL" },
462
- { key: "status", label: "状态" },
463
- { key: "duration", label: "耗时" }
499
+ { key: "method", label: "方法", kind: "chip" },
500
+ { key: "url", label: "URL", kind: "mono" },
501
+ { key: "query", label: "Query", kind: "mono" },
502
+ { key: "status", label: "状态", kind: "chip" },
503
+ { key: "duration", label: "耗时" },
504
+ { key: "result", label: "结果", kind: "chip" }
464
505
  ]
465
506
  },
466
507
  {
@@ -470,7 +511,7 @@ const Tt = {
470
511
  { key: "time", label: "时间" },
471
512
  { key: "from", label: "来源" },
472
513
  { key: "to", label: "目标" },
473
- { key: "navigation", label: "类型" },
514
+ { key: "navigation", label: "类型", kind: "chip" },
474
515
  { key: "duration", label: "耗时" }
475
516
  ]
476
517
  },
@@ -479,11 +520,10 @@ const Tt = {
479
520
  label: "资源",
480
521
  columns: [
481
522
  { key: "time", label: "时间" },
482
- { key: "url", label: "URL" },
523
+ { key: "url", label: "URL", kind: "mono" },
483
524
  { key: "initiator", label: "发起方" },
484
- { key: "status", label: "状态" },
485
525
  { key: "duration", label: "耗时" },
486
- { key: "result", label: "结果" }
526
+ { key: "result", label: "结果", kind: "chip" }
487
527
  ]
488
528
  },
489
529
  {
@@ -491,193 +531,261 @@ const Tt = {
491
531
  label: "埋点",
492
532
  columns: [
493
533
  { key: "time", label: "时间" },
494
- { key: "kind", label: "类型" },
534
+ { key: "kind", label: "类型", kind: "chip" },
495
535
  { key: "name", label: "名称" },
496
- { key: "source", label: "来源" },
497
- { key: "props", label: "属性" }
536
+ { key: "source", label: "来源", kind: "chip" },
537
+ { key: "route", label: "路由" },
538
+ { key: "props", label: "属性", kind: "mono" }
498
539
  ]
499
540
  }
500
541
  ], {
501
- records: M,
502
- loading: T,
503
- error: I,
504
- realtime: U,
505
- refresh: m,
506
- importFile: d,
507
- exportFile: c,
508
- clearLocal: _,
509
- setRealtime: b
510
- } = Ct({
511
- perf: () => u.perf,
512
- records: () => u.records,
513
- appId: () => u.appId
514
- }), { overview: k, trend: S, trendGranularity: g, topRoutes: le, topErrors: K, topEvents: Q } = vt({
515
- records: () => M.value
516
- }), P = x("error"), N = x(""), L = x(1), V = x(""), q = x(""), Z = x(null), r = x(null);
517
- let i = null, h = null, $ = !1;
518
- const F = R(() => M.value.length), E = R(() => {
519
- const e = k.value.vitals;
542
+ records: I,
543
+ loading: R,
544
+ error: $,
545
+ realtime: P,
546
+ refresh: v,
547
+ importFile: _,
548
+ exportFile: d,
549
+ clearLocal: y,
550
+ setRealtime: g
551
+ } = Pt({
552
+ perf: () => o.perf,
553
+ records: () => o.records,
554
+ appId: () => o.appId
555
+ }), { overview: m, trend: S, trendGranularity: w, topRoutes: ce, topErrors: te, topEvents: ne } = Mt({
556
+ records: () => I.value
557
+ }), O = D("error"), q = D(""), L = D(1), G = D(""), V = D(""), ae = D(null), i = D(null);
558
+ let u = null, k = null, M = !1;
559
+ const A = T(() => I.value.length), x = T(() => o.perf ? "本地数据" : "注入数据"), pe = T(() => o.perf ? P.value ? "实时已开启" : "实时已暂停" : "实时不可用"), fe = T(() => o.perf && P.value ? "perf-panel__dot--good" : "perf-panel__dot--neutral");
560
+ function Y(e, n) {
561
+ const t = Fe[e];
562
+ return {
563
+ key: e,
564
+ label: `${e} p75`,
565
+ value: Ve(e, n),
566
+ unit: t.unit,
567
+ tone: qt(e, n),
568
+ hint: t.hint
569
+ };
570
+ }
571
+ const Oe = T(() => {
572
+ const e = m.value.vitals, n = m.value.byType.request, t = m.value.total === 0 ? "neutral" : m.value.errors > 0 ? "poor" : "good", c = n === 0 ? "neutral" : m.value.slowRequests > 0 ? "warn" : "good", z = m.value.longTasks > 0 ? "warn" : "neutral";
520
573
  return [
521
- { key: "LCP", label: "LCP p75", value: j("LCP", e.LCP), unit: "ms" },
522
- { key: "INP", label: "INP p75", value: j("INP", e.INP), unit: "ms" },
523
- { key: "CLS", label: "CLS p75", value: j("CLS", e.CLS), unit: "" },
524
- { key: "FCP", label: "FCP p75", value: j("FCP", e.FCP), unit: "ms" },
525
- { key: "TTFB", label: "TTFB p75", value: j("TTFB", e.TTFB), unit: "ms" },
526
- { key: "errors", label: "错误数", value: String(k.value.errors), unit: "条" },
527
- { key: "slowRequests", label: "慢请求", value: String(k.value.slowRequests), unit: "条" },
528
- { key: "longTasks", label: "长任务", value: String(k.value.longTasks), unit: "个" }
574
+ Y("LCP", e.LCP),
575
+ Y("INP", e.INP),
576
+ Y("CLS", e.CLS),
577
+ Y("FCP", e.FCP),
578
+ Y("TTFB", e.TTFB),
579
+ {
580
+ key: "errors",
581
+ label: "错误数",
582
+ value: String(m.value.errors),
583
+ unit: "条",
584
+ tone: t,
585
+ hint: ">0 标红"
586
+ },
587
+ {
588
+ key: "slowRequests",
589
+ label: "慢请求",
590
+ value: String(m.value.slowRequests),
591
+ unit: "条",
592
+ tone: c,
593
+ hint: "≥1000ms 标橙"
594
+ },
595
+ {
596
+ key: "longTasks",
597
+ label: "长任务",
598
+ value: String(m.value.longTasks),
599
+ unit: "个",
600
+ tone: z,
601
+ hint: "≥50ms 标橙"
602
+ }
529
603
  ];
530
- }), oe = R(() => [
531
- { key: "routes", title: "Top 路由", items: le.value },
532
- { key: "errors", title: "Top 错误", items: K.value },
533
- { key: "events", title: "Top 埋点", items: Q.value }
534
- ]), ie = R(() => v[P.value]), Me = R(() => {
535
- const e = ie.value, t = N.value.trim().toLowerCase();
536
- return M.value.filter((a) => e.includes(a.type) ? t.length === 0 ? !0 : Pe(a).toLowerCase().includes(t) : !1);
537
- }), ye = R(() => Me.value.map(xe)), ue = R(() => ye.value.length), ee = R(() => Math.max(1, Math.ceil(ue.value / _e))), ve = R(() => {
538
- const e = (L.value - 1) * _e;
539
- return ye.value.slice(e, e + _e);
540
- }), be = R(
604
+ }), Ae = T(() => [
605
+ { key: "routes", title: "Top 路由", items: ce.value },
606
+ { key: "errors", title: "Top 错误", items: te.value },
607
+ { key: "events", title: "Top 埋点", items: ne.value }
608
+ ]), De = T(() => b[O.value]), qe = T(() => {
609
+ const e = De.value, n = q.value.trim().toLowerCase();
610
+ return I.value.filter((t) => e.includes(t.type) ? n.length === 0 ? !0 : ze(t).toLowerCase().includes(n) : !1);
611
+ }), ge = T(() => qe.value.map(Be)), se = T(() => ge.value.length), re = T(() => Math.max(1, Math.ceil(se.value / be))), ke = T(() => {
612
+ const e = (L.value - 1) * be;
613
+ return ge.value.slice(e, e + be);
614
+ }), Te = T(
541
615
  () => {
542
- var e, t;
543
- return (t = (e = C.find((a) => a.tab === P.value)) == null ? void 0 : e.columns) != null ? t : [];
616
+ var e, n;
617
+ return (n = (e = C.find((t) => t.tab === O.value)) == null ? void 0 : e.columns) != null ? n : [];
544
618
  }
545
619
  );
546
- function te(e) {
620
+ function oe(e) {
547
621
  return e instanceof Error ? e.message : String(e);
548
622
  }
549
- function G(e) {
623
+ function Q(e) {
550
624
  return e < 10 ? `0${e}` : String(e);
551
625
  }
552
- function Ee(e) {
626
+ function Ue(e) {
553
627
  if (!Number.isFinite(e)) return "—";
554
- const t = new Date(e), a = G(t.getMonth() + 1), y = G(t.getDate());
555
- return `${a}-${y} ${G(t.getHours())}:${G(t.getMinutes())}:${G(t.getSeconds())}`;
628
+ const n = new Date(e), t = Q(n.getMonth() + 1), c = Q(n.getDate());
629
+ return `${t}-${c} ${Q(n.getHours())}:${Q(n.getMinutes())}:${Q(n.getSeconds())}`;
556
630
  }
557
- function ne(e) {
631
+ function le(e) {
558
632
  return Number.isFinite(e) ? e >= 1e3 ? `${(e / 1e3).toFixed(2)} s` : `${Math.round(e)} ms` : "—";
559
633
  }
560
- function j(e, t) {
561
- return t === null || !Number.isFinite(t) ? "—" : e === "CLS" ? t.toFixed(3) : String(Math.round(t));
634
+ function Ve(e, n) {
635
+ return n === null || !Number.isFinite(n) ? "—" : e === "CLS" ? n.toFixed(3) : String(Math.round(n));
562
636
  }
563
- function ae(e) {
637
+ function N(e) {
564
638
  return e && (e.path || e.fullPath || e.name) || "—";
565
639
  }
566
- function se(e) {
640
+ function we(e) {
641
+ if (!e) return "—";
642
+ const n = Object.entries(e);
643
+ return n.length === 0 ? "—" : n.map(([t, c]) => `${t}=${c}`).join("&");
644
+ }
645
+ function ie(e) {
567
646
  if (!e) return "—";
568
647
  try {
569
- const t = JSON.stringify(e);
570
- return typeof t != "string" ? "—" : t.length > 200 ? `${t.slice(0, 197)}...` : t;
648
+ const n = JSON.stringify(e);
649
+ return typeof n == "string" ? n : "—";
571
650
  } catch {
572
651
  return "[无法序列化]";
573
652
  }
574
653
  }
575
- function Pe(e) {
576
- var t, a, y, A, Y, J, Te;
654
+ function ze(e) {
655
+ var n, t, c, z, J, X, K, E;
577
656
  switch (e.type) {
578
657
  case "vital":
579
658
  return `${e.name} ${e.value}`;
580
659
  case "error":
581
- return `${e.message} ${(t = e.name) != null ? t : ""} ${e.source} ${e.fingerprint} ${(a = e.stack) != null ? a : ""}`;
660
+ return `${e.message} ${(n = e.name) != null ? n : ""} ${e.source} ${e.fingerprint} ${(t = e.component) != null ? t : ""} ${(c = e.stack) != null ? c : ""} ${N(e.route)}`;
582
661
  case "request":
583
- return `${e.method} ${e.url} ${(y = e.status) != null ? y : ""}`;
662
+ return `${e.method} ${e.url} ${we(e.query)} ${(z = e.status) != null ? z : ""}`;
584
663
  case "route":
585
- return `${ae(e.to)} ${ae(e.from)}`;
664
+ return `${N(e.to)} ${N(e.from)}`;
586
665
  case "resource":
587
- return `${e.url} ${(A = e.initiatorType) != null ? A : ""}`;
666
+ return `${e.url} ${(J = e.initiatorType) != null ? J : ""}`;
588
667
  case "longTask":
589
- return `${(Y = e.name) != null ? Y : ""} ${e.durationMs}`;
668
+ return `${(X = e.name) != null ? X : ""} ${e.durationMs}`;
590
669
  case "event":
591
- return `${e.name} ${(J = e.source) != null ? J : ""} ${se(e.props)}`;
670
+ return `${e.name} ${(K = e.source) != null ? K : ""} ${N(e.route)} ${ie(e.props)}`;
592
671
  case "exposure":
593
- return `${e.name} ${(Te = e.target) != null ? Te : ""} ${se(e.props)}`;
672
+ return `${e.name} ${(E = e.target) != null ? E : ""} ${N(e.route)} ${ie(e.props)}`;
594
673
  }
595
674
  }
596
- function xe(e) {
597
- var a, y, A, Y, J;
598
- const t = Ee(e.timestamp);
675
+ function Be(e) {
676
+ var t, c, z, J, X, K;
677
+ const n = Ue(e.timestamp);
599
678
  switch (e.type) {
600
679
  case "error":
601
680
  return {
602
681
  id: e.id,
603
682
  timestamp: e.timestamp,
604
683
  cells: {
605
- time: t,
684
+ time: n,
606
685
  source: e.source,
607
- name: (a = e.name) != null ? a : "—",
608
- message: e.message
609
- }
686
+ name: (t = e.name) != null ? t : "—",
687
+ message: e.message,
688
+ route: N(e.route),
689
+ component: (c = e.component) != null ? c : "—"
690
+ },
691
+ tones: { message: "poor", name: "poor" },
692
+ rowTone: "poor"
610
693
  };
611
- case "request":
694
+ case "request": {
695
+ const E = Vt(e);
612
696
  return {
613
697
  id: e.id,
614
698
  timestamp: e.timestamp,
615
699
  cells: {
616
- time: t,
700
+ time: n,
617
701
  method: e.method,
618
702
  url: e.url,
703
+ query: we(e.query),
619
704
  status: e.status === void 0 ? "—" : String(e.status),
620
- duration: ne(e.durationMs)
621
- }
705
+ duration: le(e.durationMs),
706
+ result: e.success ? "成功" : "失败"
707
+ },
708
+ tones: {
709
+ status: Ut(e.status),
710
+ duration: E,
711
+ result: e.success ? "good" : "poor"
712
+ },
713
+ rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
622
714
  };
623
- case "route":
715
+ }
716
+ case "route": {
717
+ const E = zt(e);
624
718
  return {
625
719
  id: e.id,
626
720
  timestamp: e.timestamp,
627
721
  cells: {
628
- time: t,
629
- from: ae(e.from),
630
- to: ae(e.to),
722
+ time: n,
723
+ from: N(e.from),
724
+ to: N(e.to),
631
725
  navigation: e.navigation === "initial" ? "首次" : "SPA",
632
- duration: ne(e.durationMs)
633
- }
726
+ duration: le(e.durationMs)
727
+ },
728
+ tones: { duration: E },
729
+ rowTone: E === "warn" ? "warn" : void 0
634
730
  };
635
- case "resource":
731
+ }
732
+ case "resource": {
733
+ const E = Bt(e);
636
734
  return {
637
735
  id: e.id,
638
736
  timestamp: e.timestamp,
639
737
  cells: {
640
- time: t,
738
+ time: n,
641
739
  url: e.url,
642
- initiator: (y = e.initiatorType) != null ? y : "—",
643
- status: e.status === void 0 ? "—" : String(e.status),
644
- duration: e.durationMs === void 0 ? "—" : ne(e.durationMs),
740
+ initiator: (z = e.initiatorType) != null ? z : "—",
741
+ duration: e.durationMs === void 0 ? "—" : le(e.durationMs),
645
742
  result: e.failed ? "失败" : "成功"
646
- }
743
+ },
744
+ tones: {
745
+ duration: E,
746
+ result: e.failed ? "poor" : "good"
747
+ },
748
+ rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
647
749
  };
750
+ }
648
751
  case "event":
649
752
  return {
650
753
  id: e.id,
651
754
  timestamp: e.timestamp,
652
755
  cells: {
653
- time: t,
756
+ time: n,
654
757
  kind: "事件",
655
758
  name: e.name,
656
- source: (A = e.source) != null ? A : "manual",
657
- props: se(e.props)
658
- }
759
+ source: (J = e.source) != null ? J : "manual",
760
+ route: N(e.route),
761
+ props: ie(e.props)
762
+ },
763
+ tones: { kind: "neutral", source: "neutral" }
659
764
  };
660
765
  case "exposure":
661
766
  return {
662
767
  id: e.id,
663
768
  timestamp: e.timestamp,
664
769
  cells: {
665
- time: t,
770
+ time: n,
666
771
  kind: "曝光",
667
772
  name: e.name,
668
773
  source: "exposure",
669
- props: se(e.props)
670
- }
774
+ route: N(e.route),
775
+ props: ie(e.props)
776
+ },
777
+ tones: { kind: "neutral", source: "neutral" }
671
778
  };
672
779
  case "vital":
673
780
  return {
674
781
  id: e.id,
675
782
  timestamp: e.timestamp,
676
783
  cells: {
677
- time: t,
784
+ time: n,
678
785
  kind: "Vital",
679
786
  name: e.name,
680
- source: (Y = e.rating) != null ? Y : "—",
787
+ source: (X = e.rating) != null ? X : "—",
788
+ route: N(e.route),
681
789
  props: String(e.value)
682
790
  }
683
791
  };
@@ -686,64 +794,83 @@ const Tt = {
686
794
  id: e.id,
687
795
  timestamp: e.timestamp,
688
796
  cells: {
689
- time: t,
797
+ time: n,
690
798
  kind: "长任务",
691
- name: (J = e.name) != null ? J : "—",
799
+ name: (K = e.name) != null ? K : "—",
692
800
  source: "longTask",
693
- props: ne(e.durationMs)
801
+ route: N(e.route),
802
+ props: le(e.durationMs)
694
803
  }
695
804
  };
696
805
  }
697
806
  }
698
- function Ne(e) {
699
- const t = v[e];
700
- let a = 0;
701
- for (const y of M.value)
702
- t.includes(y.type) && (a += 1);
703
- return a;
807
+ function de(e, n) {
808
+ var t;
809
+ return (t = e.cells[n.key]) != null ? t : "—";
704
810
  }
705
- function Fe(e) {
706
- return `perf-panel__cell--${e.key}`;
811
+ function Ce(e, n) {
812
+ var t;
813
+ return (t = e.tones) == null ? void 0 : t[n.key];
707
814
  }
708
- function Ae(e) {
709
- P.value = e;
815
+ function He(e, n) {
816
+ var t, c;
817
+ return (c = (t = e.tones) == null ? void 0 : t[n.key]) != null ? c : "neutral";
710
818
  }
711
- function Oe() {
819
+ function je(e, n) {
820
+ const t = [`perf-panel__cell--${n.key}`];
821
+ n.kind === "mono" && t.push("perf-panel__cell--mono"), n.kind === "chip" && t.push("perf-panel__cell--chip");
822
+ const c = Ce(e, n);
823
+ return c && t.push(`perf-panel__tone--${c}`), t;
824
+ }
825
+ function Ge(e) {
826
+ return e.rowTone ? [`perf-panel__row--${e.rowTone}`] : [];
827
+ }
828
+ function We(e) {
829
+ const n = b[e];
830
+ let t = 0;
831
+ for (const c of I.value)
832
+ n.includes(c.type) && (t += 1);
833
+ return t;
834
+ }
835
+ function Ye(e) {
836
+ O.value = e;
837
+ }
838
+ function Qe() {
712
839
  L.value > 1 && (L.value -= 1);
713
840
  }
714
- function De() {
715
- L.value < ee.value && (L.value += 1);
841
+ function Je() {
842
+ L.value < re.value && (L.value += 1);
716
843
  }
717
- function Ue() {
718
- V.value = "";
844
+ function Xe() {
845
+ G.value = "";
719
846
  }
720
- async function qe() {
721
- await m();
847
+ async function Ke() {
848
+ await v();
722
849
  }
723
- async function ze() {
724
- await c();
850
+ async function Ze() {
851
+ await d();
725
852
  }
726
- function Be() {
853
+ function et() {
727
854
  var e;
728
- if (u.perf)
855
+ if (o.perf)
729
856
  try {
730
- (e = Z.value) == null || e.click();
857
+ (e = ae.value) == null || e.click();
731
858
  } catch {
732
859
  }
733
860
  }
734
- async function Ve(e) {
735
- var y;
736
- const t = e.target;
737
- if (!(t instanceof HTMLInputElement)) return;
738
- const a = (y = t.files) == null ? void 0 : y[0];
861
+ async function tt(e) {
862
+ var c;
863
+ const n = e.target;
864
+ if (!(n instanceof HTMLInputElement)) return;
865
+ const t = (c = n.files) == null ? void 0 : c[0];
739
866
  try {
740
- t.value = "";
867
+ n.value = "";
741
868
  } catch {
742
869
  }
743
- a && await d(a);
870
+ t && await _(t);
744
871
  }
745
- async function He() {
746
- if (u.perf) {
872
+ async function nt() {
873
+ if (o.perf) {
747
874
  if (typeof window != "undefined") {
748
875
  let e = !1;
749
876
  try {
@@ -753,33 +880,33 @@ const Tt = {
753
880
  }
754
881
  if (!e) return;
755
882
  }
756
- await _();
883
+ await y();
757
884
  }
758
885
  }
759
- function Ge(e) {
760
- const t = e.target;
761
- t instanceof HTMLInputElement && b(t.checked);
886
+ function at(e) {
887
+ const n = e.target;
888
+ n instanceof HTMLInputElement && g(n.checked);
762
889
  }
763
- function je(e) {
764
- if (!e) return [...o];
890
+ function st(e) {
891
+ if (!e) return [...r];
765
892
  try {
766
- const t = getComputedStyle(e);
767
- return s.map((a, y) => t.getPropertyValue(a).trim() || o[y] || "#8f959e");
893
+ const n = getComputedStyle(e);
894
+ return l.map((t, c) => n.getPropertyValue(t).trim() || r[c] || "#8f959e");
768
895
  } catch {
769
- return [...o];
896
+ return [...r];
770
897
  }
771
898
  }
772
- function Ye(e, t) {
899
+ function rt(e, n) {
773
900
  return {
774
901
  animation: !1,
775
- color: je(t),
902
+ color: st(n),
776
903
  grid: { top: 36, right: 16, bottom: 8, left: 8, containLabel: !0 },
777
904
  legend: { top: 0, icon: "circle", itemWidth: 8, itemHeight: 8, textStyle: { fontSize: 12 } },
778
905
  tooltip: { trigger: "axis" },
779
906
  xAxis: {
780
907
  type: "category",
781
908
  boundaryGap: !1,
782
- data: e.map((a) => a.label),
909
+ data: e.map((t) => t.label),
783
910
  axisLabel: { hideOverlap: !0 }
784
911
  },
785
912
  yAxis: {
@@ -788,292 +915,352 @@ const Tt = {
788
915
  splitLine: { lineStyle: { type: "dashed" } }
789
916
  },
790
917
  series: [
791
- { name: "错误", type: "line", symbol: "circle", symbolSize: 5, data: e.map((a) => a.errors) },
792
- { name: "请求", type: "line", symbol: "circle", symbolSize: 5, data: e.map((a) => a.requests) },
793
- { name: "长任务", type: "line", symbol: "circle", symbolSize: 5, data: e.map((a) => a.longTasks) },
794
- { name: "埋点", type: "line", symbol: "circle", symbolSize: 5, data: e.map((a) => a.events) }
918
+ { name: "错误", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.errors) },
919
+ { name: "请求", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.requests) },
920
+ { name: "长任务", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.longTasks) },
921
+ { name: "埋点", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.events) }
795
922
  ]
796
923
  };
797
924
  }
798
- function he() {
799
- if (i)
925
+ function Re() {
926
+ if (u)
800
927
  try {
801
- i.setOption(Ye(S.value, r.value), !0), q.value = "";
928
+ u.setOption(rt(S.value, i.value), !0), V.value = "";
802
929
  } catch (e) {
803
- q.value = `图表渲染失败:${te(e)}`;
930
+ V.value = `图表渲染失败:${oe(e)}`;
804
931
  }
805
932
  }
806
- function Je() {
807
- if (i) return;
808
- const e = r.value;
933
+ function ot() {
934
+ if (u) return;
935
+ const e = i.value;
809
936
  if (!(!e || typeof window == "undefined") && !(e.clientWidth <= 0 || e.clientHeight <= 0))
810
937
  try {
811
- i = it(e), he();
812
- } catch (t) {
813
- i = null, q.value = `图表初始化失败:${te(t)}`;
938
+ u = gt(e), Re();
939
+ } catch (n) {
940
+ u = null, V.value = `图表初始化失败:${oe(n)}`;
814
941
  }
815
942
  }
816
- function ce() {
817
- Je(), he();
943
+ function _e() {
944
+ ot(), Re();
818
945
  }
819
- function pe() {
820
- if (r.value) {
821
- if (!i) {
822
- ce();
946
+ function me() {
947
+ if (i.value) {
948
+ if (!u) {
949
+ _e();
823
950
  return;
824
951
  }
825
952
  try {
826
- i.resize();
953
+ u.resize();
827
954
  } catch (e) {
828
- q.value = `图表尺寸更新失败:${te(e)}`;
955
+ V.value = `图表尺寸更新失败:${oe(e)}`;
829
956
  }
830
957
  }
831
958
  }
832
- function ke() {
833
- if (h || $) return;
834
- const e = r.value;
959
+ function Se() {
960
+ if (k || M) return;
961
+ const e = i.value;
835
962
  if (e) {
836
963
  if (typeof ResizeObserver != "undefined")
837
964
  try {
838
- h = new ResizeObserver(() => {
839
- pe();
840
- }), h.observe(e);
965
+ k = new ResizeObserver(() => {
966
+ me();
967
+ }), k.observe(e);
841
968
  return;
842
969
  } catch {
843
- h = null;
970
+ k = null;
844
971
  }
845
- typeof window != "undefined" && (window.addEventListener("resize", pe), $ = !0);
972
+ typeof window != "undefined" && (window.addEventListener("resize", me), M = !0);
846
973
  }
847
974
  }
848
- function ge() {
849
- h && (h.disconnect(), h = null), $ && typeof window != "undefined" && (window.removeEventListener("resize", pe), $ = !1);
975
+ function Le() {
976
+ k && (k.disconnect(), k = null), M && typeof window != "undefined" && (window.removeEventListener("resize", me), M = !1);
850
977
  }
851
- function Ce() {
852
- if (i) {
978
+ function $e() {
979
+ if (u) {
853
980
  try {
854
- i.dispose();
981
+ u.dispose();
855
982
  } catch {
856
983
  }
857
- i = null;
984
+ u = null;
858
985
  }
859
986
  }
860
- return B(P, () => {
987
+ return j(O, () => {
861
988
  L.value = 1;
862
- }), B(N, () => {
989
+ }), j(q, () => {
863
990
  L.value = 1;
864
- }), B(ee, (e) => {
991
+ }), j(re, (e) => {
865
992
  L.value > e && (L.value = e);
866
- }), B(
993
+ }), j(
867
994
  S,
868
995
  () => {
869
- if (!r.value) {
870
- Ce(), ge();
996
+ if (!i.value) {
997
+ $e(), Le();
871
998
  return;
872
999
  }
873
- ke(), ce();
1000
+ Se(), _e();
874
1001
  },
875
1002
  { flush: "post" }
876
- ), Ke(() => {
877
- ke(), Qe().then(() => {
878
- ce();
1003
+ ), ut(() => {
1004
+ Se(), ct().then(() => {
1005
+ _e();
879
1006
  });
880
- }), Le(() => {
881
- ge(), Ce();
882
- }), Ze((e) => (V.value = `面板内部错误:${te(e)}`, !1)), (e, t) => (p(), f("section", Tt, [
883
- V.value ? (p(), f("div", wt, [
884
- t[1] || (t[1] = l("p", { class: "perf-panel__fallback-title" }, "性能面板渲染失败", -1)),
885
- l("p", Rt, w(V.value), 1),
886
- l("button", {
1007
+ }), xe(() => {
1008
+ Le(), $e();
1009
+ }), pt((e) => (G.value = `面板内部错误:${oe(e)}`, !1)), (e, n) => (p(), f("section", Ht, [
1010
+ G.value ? (p(), f("div", jt, [
1011
+ n[1] || (n[1] = s("p", { class: "perf-panel__fallback-title" }, "性能面板渲染失败", -1)),
1012
+ s("p", Gt, h(G.value), 1),
1013
+ s("button", {
887
1014
  class: "perf-panel__button",
888
1015
  type: "button",
889
- onClick: Ue
1016
+ onClick: Xe
890
1017
  }, "重试")
891
- ])) : (p(), f(O, { key: 1 }, [
892
- l("header", St, [
893
- t[3] || (t[3] = l("h2", { class: "perf-panel__title" }, "性能面板", -1)),
894
- l("div", Lt, [
895
- l("button", {
896
- class: "perf-panel__button",
897
- type: "button",
898
- "data-action": "refresh",
899
- disabled: D(T),
900
- onClick: qe
901
- }, " 刷新 ", 8, It),
902
- l("button", {
903
- class: "perf-panel__button",
904
- type: "button",
905
- "data-action": "export",
906
- onClick: ze
907
- }, "导出 JSON"),
908
- l("button", {
909
- class: "perf-panel__button",
910
- type: "button",
911
- "data-action": "import",
912
- disabled: !n.perf,
913
- onClick: Be
914
- }, " 导入 JSON ", 8, $t),
915
- l("button", {
916
- class: "perf-panel__button perf-panel__button--danger",
917
- type: "button",
918
- "data-action": "clear",
919
- disabled: !n.perf || D(T),
920
- onClick: He
921
- }, " 清空 ", 8, Mt),
922
- l("label", Et, [
923
- l("input", {
1018
+ ])) : (p(), f(U, { key: 1 }, [
1019
+ s("header", Wt, [
1020
+ s("div", Yt, [
1021
+ s("div", Qt, [
1022
+ n[2] || (n[2] = s("h2", { class: "perf-panel__title" }, "性能面板", -1)),
1023
+ s("span", {
1024
+ class: B(["perf-panel__source-chip", a.perf ? "perf-panel__source-chip--local" : "perf-panel__source-chip--injected"])
1025
+ }, h(x.value), 3)
1026
+ ]),
1027
+ s("p", Jt, [
1028
+ s("span", {
1029
+ class: "perf-panel__subtitle-item",
1030
+ "data-realtime": a.perf ? F(P) ? "on" : "off" : "unavailable"
1031
+ }, [
1032
+ s("i", {
1033
+ class: B(["perf-panel__dot", fe.value])
1034
+ }, null, 2),
1035
+ Me(" " + h(pe.value), 1)
1036
+ ], 8, Xt),
1037
+ n[3] || (n[3] = s("span", {
1038
+ class: "perf-panel__sep",
1039
+ "aria-hidden": "true"
1040
+ }, "·", -1)),
1041
+ s("span", Kt, "共 " + h(A.value) + " 条记录", 1),
1042
+ n[4] || (n[4] = s("span", {
1043
+ class: "perf-panel__sep",
1044
+ "aria-hidden": "true"
1045
+ }, "·", -1)),
1046
+ s("span", Zt, h(x.value), 1),
1047
+ F(R) ? (p(), f("span", en, "加载中…")) : W("", !0)
1048
+ ])
1049
+ ]),
1050
+ s("div", tn, [
1051
+ s("div", nn, [
1052
+ s("button", {
1053
+ class: "perf-panel__button perf-panel__button--primary",
1054
+ type: "button",
1055
+ "data-action": "refresh",
1056
+ disabled: F(R),
1057
+ onClick: Ke
1058
+ }, " 刷新 ", 8, an),
1059
+ s("button", {
1060
+ class: "perf-panel__button",
1061
+ type: "button",
1062
+ "data-action": "export",
1063
+ onClick: Ze
1064
+ }, "导出 JSON")
1065
+ ]),
1066
+ s("div", sn, [
1067
+ s("button", {
1068
+ class: "perf-panel__button",
1069
+ type: "button",
1070
+ "data-action": "import",
1071
+ disabled: !a.perf,
1072
+ onClick: et
1073
+ }, " 导入 JSON ", 8, rn),
1074
+ s("button", {
1075
+ class: "perf-panel__button perf-panel__button--danger",
1076
+ type: "button",
1077
+ "data-action": "clear",
1078
+ disabled: !a.perf || F(R),
1079
+ onClick: nt
1080
+ }, " 清空 ", 8, on)
1081
+ ]),
1082
+ s("label", ln, [
1083
+ s("input", {
924
1084
  type: "checkbox",
925
1085
  "data-action": "realtime",
926
- checked: D(U),
927
- disabled: !n.perf,
928
- onChange: Ge
929
- }, null, 40, Pt),
930
- t[2] || (t[2] = l("span", null, "实时", -1))
1086
+ checked: F(P),
1087
+ disabled: !a.perf,
1088
+ onChange: at
1089
+ }, null, 40, un),
1090
+ n[5] || (n[5] = s("span", null, "实时", -1))
931
1091
  ]),
932
- l("input", {
1092
+ s("input", {
933
1093
  ref_key: "fileInput",
934
- ref: Z,
1094
+ ref: ae,
935
1095
  class: "perf-panel__file-input",
936
1096
  type: "file",
937
1097
  accept: "application/json,.json",
938
- onChange: Ve
1098
+ onChange: tt
939
1099
  }, null, 544)
940
1100
  ])
941
1101
  ]),
942
- D(T) ? (p(), f("p", xt, "正在加载数据…")) : H("", !0),
943
- D(I) ? (p(), f("p", Nt, w(D(I)), 1)) : H("", !0),
944
- D(T) && F.value === 0 ? (p(), f("p", Ft, "加载中…")) : F.value === 0 ? (p(), f("p", At, "暂无性能数据")) : (p(), f(O, { key: 4 }, [
945
- l("section", Ot, [
946
- l("div", Dt, [
947
- (p(!0), f(O, null, z(E.value, (a) => (p(), f("article", {
948
- key: a.key,
949
- class: "perf-panel__card",
950
- "data-metric": a.key
1102
+ F($) ? (p(), f("p", cn, h(F($)), 1)) : W("", !0),
1103
+ F(R) && A.value === 0 ? (p(), f("p", pn, "加载中…")) : A.value === 0 ? (p(), f("p", fn, "暂无性能数据")) : (p(), f(U, { key: 3 }, [
1104
+ s("section", dn, [
1105
+ n[6] || (n[6] = ft('<div class="perf-panel__section-head" data-v-0a9a1651><div class="perf-panel__section-title-group" data-v-0a9a1651><h3 class="perf-panel__section-title" data-v-0a9a1651>概览</h3><span class="perf-panel__section-meta" data-v-0a9a1651>Web Vitals p75 · 按标准阈值着色</span></div><div class="perf-panel__legend" aria-label="状态图例" data-v-0a9a1651><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--good" data-v-0a9a1651></i>良好 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--warn" data-v-0a9a1651></i>需关注 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--poor" data-v-0a9a1651></i>较差 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--neutral" data-v-0a9a1651></i>无数据 </span></div></div>', 1)),
1106
+ s("div", _n, [
1107
+ (p(!0), f(U, null, H(Oe.value, (t) => (p(), f("article", {
1108
+ key: t.key,
1109
+ class: B(["perf-panel__card", `perf-panel__card--${t.tone}`]),
1110
+ "data-metric": t.key,
1111
+ "data-tone": t.tone
951
1112
  }, [
952
- l("span", qt, w(a.label), 1),
953
- l("span", zt, w(a.value), 1),
954
- a.unit ? (p(), f("span", Bt, w(a.unit), 1)) : H("", !0)
955
- ], 8, Ut))), 128))
1113
+ s("div", vn, [
1114
+ s("i", {
1115
+ class: B(["perf-panel__dot", `perf-panel__dot--${t.tone}`])
1116
+ }, null, 2),
1117
+ s("span", hn, h(t.label), 1)
1118
+ ]),
1119
+ s("div", yn, [
1120
+ s("span", bn, h(t.value), 1),
1121
+ t.unit ? (p(), f("span", gn, h(t.unit), 1)) : W("", !0)
1122
+ ]),
1123
+ s("span", kn, h(t.hint), 1)
1124
+ ], 10, mn))), 128))
956
1125
  ])
957
1126
  ]),
958
- l("section", Vt, [
959
- l("div", Ht, [
960
- t[4] || (t[4] = l("h3", { class: "perf-panel__section-title" }, "趋势", -1)),
961
- l("span", Gt, w(D(g) === "hour" ? "按小时" : "按分钟"), 1)
1127
+ s("section", Tn, [
1128
+ s("div", wn, [
1129
+ s("div", Cn, [
1130
+ n[7] || (n[7] = s("h3", { class: "perf-panel__section-title" }, "趋势", -1)),
1131
+ s("span", Rn, h(F(w) === "hour" ? "按小时聚合" : "按分钟聚合"), 1)
1132
+ ]),
1133
+ s("span", Sn, h(F(S).length) + " 个时间桶", 1)
962
1134
  ]),
963
- l("div", jt, [
964
- l("div", {
1135
+ s("div", Ln, [
1136
+ s("div", {
965
1137
  ref_key: "chartEl",
966
- ref: r,
1138
+ ref: i,
967
1139
  class: "perf-panel__chart"
968
1140
  }, null, 512),
969
- D(S).length === 0 ? (p(), f("p", Yt, "暂无趋势数据")) : H("", !0)
1141
+ F(S).length === 0 ? (p(), f("p", $n, "暂无趋势数据")) : W("", !0)
970
1142
  ]),
971
- q.value ? (p(), f("p", Jt, w(q.value), 1)) : H("", !0)
1143
+ V.value ? (p(), f("p", Mn, h(V.value), 1)) : W("", !0)
972
1144
  ]),
973
- l("section", Wt, [
974
- t[5] || (t[5] = l("h3", { class: "perf-panel__section-title" }, "Top 排行", -1)),
975
- l("div", Xt, [
976
- (p(!0), f(O, null, z(oe.value, (a) => (p(), f("div", {
977
- key: a.key,
1145
+ s("section", En, [
1146
+ n[8] || (n[8] = s("div", { class: "perf-panel__section-head" }, [
1147
+ s("h3", { class: "perf-panel__section-title" }, "Top 排行"),
1148
+ s("span", { class: "perf-panel__section-meta" }, "按出现次数排序")
1149
+ ], -1)),
1150
+ s("div", In, [
1151
+ (p(!0), f(U, null, H(Ae.value, (t) => (p(), f("div", {
1152
+ key: t.key,
978
1153
  class: "perf-panel__top"
979
1154
  }, [
980
- l("h4", Kt, w(a.title), 1),
981
- a.items.length > 0 ? (p(), f("ol", Qt, [
982
- (p(!0), f(O, null, z(a.items, (y) => (p(), f("li", {
983
- key: y.key,
1155
+ s("h4", xn, h(t.title), 1),
1156
+ t.items.length > 0 ? (p(), f("ol", Nn, [
1157
+ (p(!0), f(U, null, H(t.items, (c) => (p(), f("li", {
1158
+ key: c.key,
984
1159
  class: "perf-panel__top-item"
985
1160
  }, [
986
- l("span", {
1161
+ s("span", {
987
1162
  class: "perf-panel__top-label",
988
- title: y.label
989
- }, w(y.label), 9, Zt),
990
- l("span", en, w(y.count), 1)
1163
+ title: c.label
1164
+ }, h(c.label), 9, Pn),
1165
+ s("span", Fn, h(c.count), 1)
991
1166
  ]))), 128))
992
- ])) : (p(), f("p", tn, "暂无"))
1167
+ ])) : (p(), f("p", On, "暂无"))
993
1168
  ]))), 128))
994
1169
  ])
995
1170
  ]),
996
- l("section", nn, [
997
- l("div", an, [
998
- t[6] || (t[6] = l("h3", { class: "perf-panel__section-title" }, "明细", -1)),
999
- et(l("input", {
1000
- "onUpdate:modelValue": t[0] || (t[0] = (a) => N.value = a),
1171
+ s("section", An, [
1172
+ s("div", Dn, [
1173
+ s("div", qn, [
1174
+ n[9] || (n[9] = s("h3", { class: "perf-panel__section-title" }, "明细", -1)),
1175
+ s("span", Un, "共 " + h(se.value) + " 条", 1)
1176
+ ]),
1177
+ dt(s("input", {
1178
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => q.value = t),
1001
1179
  class: "perf-panel__search",
1002
1180
  type: "search",
1003
- placeholder: "搜索 URL / 消息 / 事件名",
1181
+ placeholder: "搜索 URL / Query / 消息 / 事件名",
1004
1182
  "aria-label": "搜索明细"
1005
1183
  }, null, 512), [
1006
- [tt, N.value]
1184
+ [_t, q.value]
1007
1185
  ])
1008
1186
  ]),
1009
- l("div", sn, [
1010
- (p(), f(O, null, z(C, (a) => l("button", {
1011
- key: a.tab,
1012
- class: we(["perf-panel__tab", { "perf-panel__tab--active": a.tab === P.value }]),
1187
+ s("div", Vn, [
1188
+ (p(), f(U, null, H(C, (t) => s("button", {
1189
+ key: t.tab,
1190
+ class: B(["perf-panel__tab", { "perf-panel__tab--active": t.tab === O.value }]),
1013
1191
  type: "button",
1014
1192
  role: "tab",
1015
- "aria-selected": a.tab === P.value,
1016
- "data-tab": a.tab,
1017
- onClick: (y) => Ae(a.tab)
1193
+ "aria-selected": t.tab === O.value,
1194
+ "data-tab": t.tab,
1195
+ onClick: (c) => Ye(t.tab)
1018
1196
  }, [
1019
- nt(w(a.label) + " ", 1),
1020
- l("span", ln, w(Ne(a.tab)), 1)
1021
- ], 10, rn)), 64))
1197
+ Me(h(t.label) + " ", 1),
1198
+ s("span", Bn, h(We(t.tab)), 1)
1199
+ ], 10, zn)), 64))
1022
1200
  ]),
1023
- l("div", on, [
1024
- ve.value.length > 0 ? (p(), f("table", un, [
1025
- l("thead", null, [
1026
- l("tr", null, [
1027
- (p(!0), f(O, null, z(be.value, (a) => (p(), f("th", {
1028
- key: a.key,
1029
- scope: "col"
1030
- }, w(a.label), 1))), 128))
1201
+ s("div", Hn, [
1202
+ ke.value.length > 0 ? (p(), f("table", jn, [
1203
+ s("thead", null, [
1204
+ s("tr", null, [
1205
+ (p(!0), f(U, null, H(Te.value, (t) => (p(), f("th", {
1206
+ key: t.key,
1207
+ scope: "col",
1208
+ "data-column": t.key
1209
+ }, h(t.label), 9, Gn))), 128))
1031
1210
  ])
1032
1211
  ]),
1033
- l("tbody", null, [
1034
- (p(!0), f(O, null, z(ve.value, (a) => (p(), f("tr", {
1035
- key: a.id
1212
+ s("tbody", null, [
1213
+ (p(!0), f(U, null, H(ke.value, (t) => (p(), f("tr", {
1214
+ key: t.id,
1215
+ class: B(Ge(t))
1036
1216
  }, [
1037
- (p(!0), f(O, null, z(be.value, (y) => {
1038
- var A;
1039
- return p(), f("td", {
1040
- key: y.key,
1041
- class: we(Fe(y))
1042
- }, w((A = a.cells[y.key]) != null ? A : ""), 3);
1043
- }), 128))
1044
- ]))), 128))
1217
+ (p(!0), f(U, null, H(Te.value, (c) => (p(), f("td", {
1218
+ key: c.key,
1219
+ class: B(je(t, c)),
1220
+ "data-column": c.key,
1221
+ "data-tone": Ce(t, c),
1222
+ title: de(t, c)
1223
+ }, [
1224
+ c.kind === "chip" ? (p(), f("span", {
1225
+ key: 0,
1226
+ class: B(["perf-panel__chip", `perf-panel__chip--${He(t, c)}`])
1227
+ }, h(de(t, c)), 3)) : (p(), f("span", Yn, h(de(t, c)), 1))
1228
+ ], 10, Wn))), 128))
1229
+ ], 2))), 128))
1045
1230
  ])
1046
- ])) : (p(), f("p", cn, "当前分类暂无数据"))
1231
+ ])) : (p(), f("p", Qn, "当前分类暂无数据"))
1047
1232
  ]),
1048
- ue.value > 0 ? (p(), f("div", pn, [
1049
- l("button", {
1050
- class: "perf-panel__button",
1051
- type: "button",
1052
- "data-action": "prev-page",
1053
- disabled: L.value <= 1,
1054
- onClick: Oe
1055
- }, " 上一页 ", 8, fn),
1056
- l("span", null, "第 " + w(L.value) + " / " + w(ee.value) + " 页,共 " + w(ue.value) + " 条", 1),
1057
- l("button", {
1058
- class: "perf-panel__button",
1059
- type: "button",
1060
- "data-action": "next-page",
1061
- disabled: L.value >= ee.value,
1062
- onClick: De
1063
- }, " 下一页 ", 8, dn)
1064
- ])) : H("", !0)
1233
+ se.value > 0 ? (p(), f("div", Jn, [
1234
+ s("span", Xn, "第 " + h(L.value) + " / " + h(re.value) + " 页,共 " + h(se.value) + " 条", 1),
1235
+ s("div", Kn, [
1236
+ s("button", {
1237
+ class: "perf-panel__button",
1238
+ type: "button",
1239
+ "data-action": "prev-page",
1240
+ disabled: L.value <= 1,
1241
+ onClick: Qe
1242
+ }, " 上一页 ", 8, Zn),
1243
+ s("button", {
1244
+ class: "perf-panel__button",
1245
+ type: "button",
1246
+ "data-action": "next-page",
1247
+ disabled: L.value >= re.value,
1248
+ onClick: Je
1249
+ }, " 下一页 ", 8, ea)
1250
+ ])
1251
+ ])) : W("", !0)
1065
1252
  ])
1066
1253
  ], 64))
1067
1254
  ], 64))
1068
1255
  ]));
1069
1256
  }
1070
- }), _n = (n, u) => {
1071
- const o = n.__vccOpts || n;
1072
- for (const [s, v] of u)
1073
- o[s] = v;
1074
- return o;
1075
- }, gn = /* @__PURE__ */ _n(mn, [["__scopeId", "data-v-33172fbd"]]);
1257
+ }), na = (a, o) => {
1258
+ const r = a.__vccOpts || a;
1259
+ for (const [l, b] of o)
1260
+ r[l] = b;
1261
+ return r;
1262
+ }, ia = /* @__PURE__ */ na(ta, [["__scopeId", "data-v-0a9a1651"]]);
1076
1263
  export {
1077
- gn as PerfPanel
1264
+ ia as PerfPanel
1078
1265
  };
1079
1266
  //# sourceMappingURL=index.js.map