rails-profiler 0.1.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.
- checksums.yaml +7 -0
- data/app/assets/builds/profiler-toolbar.js +1191 -0
- data/app/assets/builds/profiler.css +2668 -0
- data/app/assets/builds/profiler.js +2772 -0
- data/app/controllers/profiler/api/ajax_controller.rb +36 -0
- data/app/controllers/profiler/api/jobs_controller.rb +39 -0
- data/app/controllers/profiler/api/outbound_http_controller.rb +36 -0
- data/app/controllers/profiler/api/profiles_controller.rb +60 -0
- data/app/controllers/profiler/api/toolbar_controller.rb +44 -0
- data/app/controllers/profiler/application_controller.rb +19 -0
- data/app/controllers/profiler/assets_controller.rb +29 -0
- data/app/controllers/profiler/profiles_controller.rb +107 -0
- data/app/views/layouts/profiler/application.html.erb +16 -0
- data/app/views/layouts/profiler/embedded.html.erb +34 -0
- data/app/views/profiler/profiles/index.html.erb +1 -0
- data/app/views/profiler/profiles/show.html.erb +4 -0
- data/config/routes.rb +36 -0
- data/exe/profiler-mcp +8 -0
- data/lib/profiler/collectors/ajax_collector.rb +109 -0
- data/lib/profiler/collectors/base_collector.rb +92 -0
- data/lib/profiler/collectors/cache_collector.rb +96 -0
- data/lib/profiler/collectors/database_collector.rb +113 -0
- data/lib/profiler/collectors/dump_collector.rb +98 -0
- data/lib/profiler/collectors/flamegraph_collector.rb +182 -0
- data/lib/profiler/collectors/http_collector.rb +112 -0
- data/lib/profiler/collectors/job_collector.rb +50 -0
- data/lib/profiler/collectors/performance_collector.rb +103 -0
- data/lib/profiler/collectors/request_collector.rb +80 -0
- data/lib/profiler/collectors/view_collector.rb +79 -0
- data/lib/profiler/configuration.rb +81 -0
- data/lib/profiler/engine.rb +17 -0
- data/lib/profiler/instrumentation/active_job_instrumentation.rb +22 -0
- data/lib/profiler/instrumentation/net_http_instrumentation.rb +153 -0
- data/lib/profiler/instrumentation/sidekiq_middleware.rb +18 -0
- data/lib/profiler/job_profiler.rb +118 -0
- data/lib/profiler/mcp/resources/n1_patterns.rb +62 -0
- data/lib/profiler/mcp/resources/recent_jobs.rb +39 -0
- data/lib/profiler/mcp/resources/recent_requests.rb +35 -0
- data/lib/profiler/mcp/resources/slow_queries.rb +47 -0
- data/lib/profiler/mcp/server.rb +217 -0
- data/lib/profiler/mcp/tools/analyze_queries.rb +124 -0
- data/lib/profiler/mcp/tools/clear_profiles.rb +22 -0
- data/lib/profiler/mcp/tools/get_profile_ajax.rb +66 -0
- data/lib/profiler/mcp/tools/get_profile_detail.rb +326 -0
- data/lib/profiler/mcp/tools/get_profile_dumps.rb +51 -0
- data/lib/profiler/mcp/tools/get_profile_http.rb +104 -0
- data/lib/profiler/mcp/tools/query_jobs.rb +60 -0
- data/lib/profiler/mcp/tools/query_profiles.rb +66 -0
- data/lib/profiler/middleware/cors_middleware.rb +55 -0
- data/lib/profiler/middleware/profiler_middleware.rb +151 -0
- data/lib/profiler/middleware/toolbar_injector.rb +378 -0
- data/lib/profiler/models/profile.rb +182 -0
- data/lib/profiler/models/sql_query.rb +48 -0
- data/lib/profiler/models/timeline_event.rb +40 -0
- data/lib/profiler/railtie.rb +75 -0
- data/lib/profiler/storage/base_store.rb +41 -0
- data/lib/profiler/storage/blob_store.rb +46 -0
- data/lib/profiler/storage/file_store.rb +119 -0
- data/lib/profiler/storage/memory_store.rb +94 -0
- data/lib/profiler/storage/redis_store.rb +98 -0
- data/lib/profiler/storage/sqlite_store.rb +272 -0
- data/lib/profiler/tasks/profiler.rake +79 -0
- data/lib/profiler/version.rb +5 -0
- data/lib/profiler.rb +68 -0
- metadata +194 -0
|
@@ -0,0 +1,1191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// node_modules/preact/dist/preact.module.js
|
|
4
|
+
var n;
|
|
5
|
+
var l;
|
|
6
|
+
var u;
|
|
7
|
+
var t;
|
|
8
|
+
var i;
|
|
9
|
+
var r;
|
|
10
|
+
var o;
|
|
11
|
+
var e;
|
|
12
|
+
var f;
|
|
13
|
+
var c;
|
|
14
|
+
var s;
|
|
15
|
+
var a;
|
|
16
|
+
var h;
|
|
17
|
+
var p = {};
|
|
18
|
+
var v = [];
|
|
19
|
+
var y = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
20
|
+
var d = Array.isArray;
|
|
21
|
+
function w(n2, l3) {
|
|
22
|
+
for (var u4 in l3) n2[u4] = l3[u4];
|
|
23
|
+
return n2;
|
|
24
|
+
}
|
|
25
|
+
function g(n2) {
|
|
26
|
+
n2 && n2.parentNode && n2.parentNode.removeChild(n2);
|
|
27
|
+
}
|
|
28
|
+
function _(l3, u4, t3) {
|
|
29
|
+
var i3, r3, o3, e3 = {};
|
|
30
|
+
for (o3 in u4) "key" == o3 ? i3 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : e3[o3] = u4[o3];
|
|
31
|
+
if (arguments.length > 2 && (e3.children = arguments.length > 3 ? n.call(arguments, 2) : t3), "function" == typeof l3 && null != l3.defaultProps) for (o3 in l3.defaultProps) void 0 === e3[o3] && (e3[o3] = l3.defaultProps[o3]);
|
|
32
|
+
return m(l3, e3, i3, r3, null);
|
|
33
|
+
}
|
|
34
|
+
function m(n2, t3, i3, r3, o3) {
|
|
35
|
+
var e3 = { type: n2, props: t3, key: i3, ref: r3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o3 ? ++u : o3, __i: -1, __u: 0 };
|
|
36
|
+
return null == o3 && null != l.vnode && l.vnode(e3), e3;
|
|
37
|
+
}
|
|
38
|
+
function k(n2) {
|
|
39
|
+
return n2.children;
|
|
40
|
+
}
|
|
41
|
+
function x(n2, l3) {
|
|
42
|
+
this.props = n2, this.context = l3;
|
|
43
|
+
}
|
|
44
|
+
function S(n2, l3) {
|
|
45
|
+
if (null == l3) return n2.__ ? S(n2.__, n2.__i + 1) : null;
|
|
46
|
+
for (var u4; l3 < n2.__k.length; l3++) if (null != (u4 = n2.__k[l3]) && null != u4.__e) return u4.__e;
|
|
47
|
+
return "function" == typeof n2.type ? S(n2) : null;
|
|
48
|
+
}
|
|
49
|
+
function C(n2) {
|
|
50
|
+
if (n2.__P && n2.__d) {
|
|
51
|
+
var u4 = n2.__v, t3 = u4.__e, i3 = [], r3 = [], o3 = w({}, u4);
|
|
52
|
+
o3.__v = u4.__v + 1, l.vnode && l.vnode(o3), z(n2.__P, o3, u4, n2.__n, n2.__P.namespaceURI, 32 & u4.__u ? [t3] : null, i3, null == t3 ? S(u4) : t3, !!(32 & u4.__u), r3), o3.__v = u4.__v, o3.__.__k[o3.__i] = o3, V(i3, o3, r3), u4.__e = u4.__ = null, o3.__e != t3 && M(o3);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function M(n2) {
|
|
56
|
+
if (null != (n2 = n2.__) && null != n2.__c) return n2.__e = n2.__c.base = null, n2.__k.some(function(l3) {
|
|
57
|
+
if (null != l3 && null != l3.__e) return n2.__e = n2.__c.base = l3.__e;
|
|
58
|
+
}), M(n2);
|
|
59
|
+
}
|
|
60
|
+
function $(n2) {
|
|
61
|
+
(!n2.__d && (n2.__d = true) && i.push(n2) && !I.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(I);
|
|
62
|
+
}
|
|
63
|
+
function I() {
|
|
64
|
+
try {
|
|
65
|
+
for (var n2, l3 = 1; i.length; ) i.length > l3 && i.sort(e), n2 = i.shift(), l3 = i.length, C(n2);
|
|
66
|
+
} finally {
|
|
67
|
+
i.length = I.__r = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function P(n2, l3, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
|
|
71
|
+
var a3, h3, y3, d3, w3, g2, _2, m3 = t3 && t3.__k || v, b = l3.length;
|
|
72
|
+
for (f4 = A(u4, l3, m3, f4, b), a3 = 0; a3 < b; a3++) null != (y3 = u4.__k[a3]) && (h3 = -1 != y3.__i && m3[y3.__i] || p, y3.__i = a3, g2 = z(n2, y3, h3, i3, r3, o3, e3, f4, c3, s3), d3 = y3.__e, y3.ref && h3.ref != y3.ref && (h3.ref && D(h3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), (_2 = !!(4 & y3.__u)) || h3.__k === y3.__k ? f4 = H(y3, f4, n2, _2) : "function" == typeof y3.type && void 0 !== g2 ? f4 = g2 : d3 && (f4 = d3.nextSibling), y3.__u &= -7);
|
|
73
|
+
return u4.__e = w3, f4;
|
|
74
|
+
}
|
|
75
|
+
function A(n2, l3, u4, t3, i3) {
|
|
76
|
+
var r3, o3, e3, f4, c3, s3 = u4.length, a3 = s3, h3 = 0;
|
|
77
|
+
for (n2.__k = new Array(i3), r3 = 0; r3 < i3; r3++) null != (o3 = l3[r3]) && "boolean" != typeof o3 && "function" != typeof o3 ? ("string" == typeof o3 || "number" == typeof o3 || "bigint" == typeof o3 || o3.constructor == String ? o3 = n2.__k[r3] = m(null, o3, null, null, null) : d(o3) ? o3 = n2.__k[r3] = m(k, { children: o3 }, null, null, null) : void 0 === o3.constructor && o3.__b > 0 ? o3 = n2.__k[r3] = m(o3.type, o3.props, o3.key, o3.ref ? o3.ref : null, o3.__v) : n2.__k[r3] = o3, f4 = r3 + h3, o3.__ = n2, o3.__b = n2.__b + 1, e3 = null, -1 != (c3 = o3.__i = T(o3, u4, f4, a3)) && (a3--, (e3 = u4[c3]) && (e3.__u |= 2)), null == e3 || null == e3.__v ? (-1 == c3 && (i3 > s3 ? h3-- : i3 < s3 && h3++), "function" != typeof o3.type && (o3.__u |= 4)) : c3 != f4 && (c3 == f4 - 1 ? h3-- : c3 == f4 + 1 ? h3++ : (c3 > f4 ? h3-- : h3++, o3.__u |= 4))) : n2.__k[r3] = null;
|
|
78
|
+
if (a3) for (r3 = 0; r3 < s3; r3++) null != (e3 = u4[r3]) && 0 == (2 & e3.__u) && (e3.__e == t3 && (t3 = S(e3)), E(e3, e3));
|
|
79
|
+
return t3;
|
|
80
|
+
}
|
|
81
|
+
function H(n2, l3, u4, t3) {
|
|
82
|
+
var i3, r3;
|
|
83
|
+
if ("function" == typeof n2.type) {
|
|
84
|
+
for (i3 = n2.__k, r3 = 0; i3 && r3 < i3.length; r3++) i3[r3] && (i3[r3].__ = n2, l3 = H(i3[r3], l3, u4, t3));
|
|
85
|
+
return l3;
|
|
86
|
+
}
|
|
87
|
+
n2.__e != l3 && (t3 && (l3 && n2.type && !l3.parentNode && (l3 = S(n2)), u4.insertBefore(n2.__e, l3 || null)), l3 = n2.__e);
|
|
88
|
+
do {
|
|
89
|
+
l3 = l3 && l3.nextSibling;
|
|
90
|
+
} while (null != l3 && 8 == l3.nodeType);
|
|
91
|
+
return l3;
|
|
92
|
+
}
|
|
93
|
+
function T(n2, l3, u4, t3) {
|
|
94
|
+
var i3, r3, o3, e3 = n2.key, f4 = n2.type, c3 = l3[u4], s3 = null != c3 && 0 == (2 & c3.__u);
|
|
95
|
+
if (null === c3 && null == e3 || s3 && e3 == c3.key && f4 == c3.type) return u4;
|
|
96
|
+
if (t3 > (s3 ? 1 : 0)) {
|
|
97
|
+
for (i3 = u4 - 1, r3 = u4 + 1; i3 >= 0 || r3 < l3.length; ) if (null != (c3 = l3[o3 = i3 >= 0 ? i3-- : r3++]) && 0 == (2 & c3.__u) && e3 == c3.key && f4 == c3.type) return o3;
|
|
98
|
+
}
|
|
99
|
+
return -1;
|
|
100
|
+
}
|
|
101
|
+
function j(n2, l3, u4) {
|
|
102
|
+
"-" == l3[0] ? n2.setProperty(l3, null == u4 ? "" : u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || y.test(l3) ? u4 : u4 + "px";
|
|
103
|
+
}
|
|
104
|
+
function F(n2, l3, u4, t3, i3) {
|
|
105
|
+
var r3, o3;
|
|
106
|
+
n: if ("style" == l3) if ("string" == typeof u4) n2.style.cssText = u4;
|
|
107
|
+
else {
|
|
108
|
+
if ("string" == typeof t3 && (n2.style.cssText = t3 = ""), t3) for (l3 in t3) u4 && l3 in u4 || j(n2.style, l3, "");
|
|
109
|
+
if (u4) for (l3 in u4) t3 && u4[l3] == t3[l3] || j(n2.style, l3, u4[l3]);
|
|
110
|
+
}
|
|
111
|
+
else if ("o" == l3[0] && "n" == l3[1]) r3 = l3 != (l3 = l3.replace(f, "$1")), o3 = l3.toLowerCase(), l3 = o3 in n2 || "onFocusOut" == l3 || "onFocusIn" == l3 ? o3.slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u4, u4 ? t3 ? u4.u = t3.u : (u4.u = c, n2.addEventListener(l3, r3 ? a : s, r3)) : n2.removeEventListener(l3, r3 ? a : s, r3);
|
|
112
|
+
else {
|
|
113
|
+
if ("http://www.w3.org/2000/svg" == i3) l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
114
|
+
else if ("width" != l3 && "height" != l3 && "href" != l3 && "list" != l3 && "form" != l3 && "tabIndex" != l3 && "download" != l3 && "rowSpan" != l3 && "colSpan" != l3 && "role" != l3 && "popover" != l3 && l3 in n2) try {
|
|
115
|
+
n2[l3] = null == u4 ? "" : u4;
|
|
116
|
+
break n;
|
|
117
|
+
} catch (n3) {
|
|
118
|
+
}
|
|
119
|
+
"function" == typeof u4 || (null == u4 || false === u4 && "-" != l3[4] ? n2.removeAttribute(l3) : n2.setAttribute(l3, "popover" == l3 && 1 == u4 ? "" : u4));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function O(n2) {
|
|
123
|
+
return function(u4) {
|
|
124
|
+
if (this.l) {
|
|
125
|
+
var t3 = this.l[u4.type + n2];
|
|
126
|
+
if (null == u4.t) u4.t = c++;
|
|
127
|
+
else if (u4.t < t3.u) return;
|
|
128
|
+
return t3(l.event ? l.event(u4) : u4);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function z(n2, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
|
|
133
|
+
var a3, h3, p3, y3, _2, m3, b, S2, C3, M2, $2, I2, A3, H2, L, T3 = u4.type;
|
|
134
|
+
if (void 0 !== u4.constructor) return null;
|
|
135
|
+
128 & t3.__u && (c3 = !!(32 & t3.__u), o3 = [f4 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
|
|
136
|
+
n: if ("function" == typeof T3) try {
|
|
137
|
+
if (S2 = u4.props, C3 = T3.prototype && T3.prototype.render, M2 = (a3 = T3.contextType) && i3[a3.__c], $2 = a3 ? M2 ? M2.props.value : a3.__ : i3, t3.__c ? b = (h3 = u4.__c = t3.__c).__ = h3.__E : (C3 ? u4.__c = h3 = new T3(S2, $2) : (u4.__c = h3 = new x(S2, $2), h3.constructor = T3, h3.render = G), M2 && M2.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), C3 && null == h3.__s && (h3.__s = h3.state), C3 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = w({}, h3.__s)), w(h3.__s, T3.getDerivedStateFromProps(S2, h3.__s))), y3 = h3.props, _2 = h3.state, h3.__v = u4, p3) C3 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), C3 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
|
|
138
|
+
else {
|
|
139
|
+
if (C3 && null == T3.getDerivedStateFromProps && S2 !== y3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(S2, $2), u4.__v == t3.__v || !h3.__e && null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(S2, h3.__s, $2)) {
|
|
140
|
+
u4.__v != t3.__v && (h3.props = S2, h3.state = h3.__s, h3.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.some(function(n3) {
|
|
141
|
+
n3 && (n3.__ = u4);
|
|
142
|
+
}), v.push.apply(h3.__h, h3._sb), h3._sb = [], h3.__h.length && e3.push(h3);
|
|
143
|
+
break n;
|
|
144
|
+
}
|
|
145
|
+
null != h3.componentWillUpdate && h3.componentWillUpdate(S2, h3.__s, $2), C3 && null != h3.componentDidUpdate && h3.__h.push(function() {
|
|
146
|
+
h3.componentDidUpdate(y3, _2, m3);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (h3.context = $2, h3.props = S2, h3.__P = n2, h3.__e = false, I2 = l.__r, A3 = 0, C3) h3.state = h3.__s, h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), v.push.apply(h3.__h, h3._sb), h3._sb = [];
|
|
150
|
+
else do {
|
|
151
|
+
h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
|
|
152
|
+
} while (h3.__d && ++A3 < 25);
|
|
153
|
+
h3.state = h3.__s, null != h3.getChildContext && (i3 = w(w({}, i3), h3.getChildContext())), C3 && !p3 && null != h3.getSnapshotBeforeUpdate && (m3 = h3.getSnapshotBeforeUpdate(y3, _2)), H2 = null != a3 && a3.type === k && null == a3.key ? q(a3.props.children) : a3, f4 = P(n2, d(H2) ? H2 : [H2], u4, t3, i3, r3, o3, e3, f4, c3, s3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && e3.push(h3), b && (h3.__E = h3.__ = null);
|
|
154
|
+
} catch (n3) {
|
|
155
|
+
if (u4.__v = null, c3 || null != o3) if (n3.then) {
|
|
156
|
+
for (u4.__u |= c3 ? 160 : 128; f4 && 8 == f4.nodeType && f4.nextSibling; ) f4 = f4.nextSibling;
|
|
157
|
+
o3[o3.indexOf(f4)] = null, u4.__e = f4;
|
|
158
|
+
} else {
|
|
159
|
+
for (L = o3.length; L--; ) g(o3[L]);
|
|
160
|
+
N(u4);
|
|
161
|
+
}
|
|
162
|
+
else u4.__e = t3.__e, u4.__k = t3.__k, n3.then || N(u4);
|
|
163
|
+
l.__e(n3, u4, t3);
|
|
164
|
+
}
|
|
165
|
+
else null == o3 && u4.__v == t3.__v ? (u4.__k = t3.__k, u4.__e = t3.__e) : f4 = u4.__e = B(t3.__e, u4, t3, i3, r3, o3, e3, c3, s3);
|
|
166
|
+
return (a3 = l.diffed) && a3(u4), 128 & u4.__u ? void 0 : f4;
|
|
167
|
+
}
|
|
168
|
+
function N(n2) {
|
|
169
|
+
n2 && (n2.__c && (n2.__c.__e = true), n2.__k && n2.__k.some(N));
|
|
170
|
+
}
|
|
171
|
+
function V(n2, u4, t3) {
|
|
172
|
+
for (var i3 = 0; i3 < t3.length; i3++) D(t3[i3], t3[++i3], t3[++i3]);
|
|
173
|
+
l.__c && l.__c(u4, n2), n2.some(function(u5) {
|
|
174
|
+
try {
|
|
175
|
+
n2 = u5.__h, u5.__h = [], n2.some(function(n3) {
|
|
176
|
+
n3.call(u5);
|
|
177
|
+
});
|
|
178
|
+
} catch (n3) {
|
|
179
|
+
l.__e(n3, u5.__v);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function q(n2) {
|
|
184
|
+
return "object" != typeof n2 || null == n2 || n2.__b > 0 ? n2 : d(n2) ? n2.map(q) : w({}, n2);
|
|
185
|
+
}
|
|
186
|
+
function B(u4, t3, i3, r3, o3, e3, f4, c3, s3) {
|
|
187
|
+
var a3, h3, v3, y3, w3, _2, m3, b = i3.props || p, k3 = t3.props, x2 = t3.type;
|
|
188
|
+
if ("svg" == x2 ? o3 = "http://www.w3.org/2000/svg" : "math" == x2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != e3) {
|
|
189
|
+
for (a3 = 0; a3 < e3.length; a3++) if ((w3 = e3[a3]) && "setAttribute" in w3 == !!x2 && (x2 ? w3.localName == x2 : 3 == w3.nodeType)) {
|
|
190
|
+
u4 = w3, e3[a3] = null;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (null == u4) {
|
|
195
|
+
if (null == x2) return document.createTextNode(k3);
|
|
196
|
+
u4 = document.createElementNS(o3, x2, k3.is && k3), c3 && (l.__m && l.__m(t3, e3), c3 = false), e3 = null;
|
|
197
|
+
}
|
|
198
|
+
if (null == x2) b === k3 || c3 && u4.data == k3 || (u4.data = k3);
|
|
199
|
+
else {
|
|
200
|
+
if (e3 = e3 && n.call(u4.childNodes), !c3 && null != e3) for (b = {}, a3 = 0; a3 < u4.attributes.length; a3++) b[(w3 = u4.attributes[a3]).name] = w3.value;
|
|
201
|
+
for (a3 in b) w3 = b[a3], "dangerouslySetInnerHTML" == a3 ? v3 = w3 : "children" == a3 || a3 in k3 || "value" == a3 && "defaultValue" in k3 || "checked" == a3 && "defaultChecked" in k3 || F(u4, a3, null, w3, o3);
|
|
202
|
+
for (a3 in k3) w3 = k3[a3], "children" == a3 ? y3 = w3 : "dangerouslySetInnerHTML" == a3 ? h3 = w3 : "value" == a3 ? _2 = w3 : "checked" == a3 ? m3 = w3 : c3 && "function" != typeof w3 || b[a3] === w3 || F(u4, a3, w3, b[a3], o3);
|
|
203
|
+
if (h3) c3 || v3 && (h3.__html == v3.__html || h3.__html == u4.innerHTML) || (u4.innerHTML = h3.__html), t3.__k = [];
|
|
204
|
+
else if (v3 && (u4.innerHTML = ""), P("template" == t3.type ? u4.content : u4, d(y3) ? y3 : [y3], t3, i3, r3, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o3, e3, f4, e3 ? e3[0] : i3.__k && S(i3, 0), c3, s3), null != e3) for (a3 = e3.length; a3--; ) g(e3[a3]);
|
|
205
|
+
c3 || (a3 = "value", "progress" == x2 && null == _2 ? u4.removeAttribute("value") : null != _2 && (_2 !== u4[a3] || "progress" == x2 && !_2 || "option" == x2 && _2 != b[a3]) && F(u4, a3, _2, b[a3], o3), a3 = "checked", null != m3 && m3 != u4[a3] && F(u4, a3, m3, b[a3], o3));
|
|
206
|
+
}
|
|
207
|
+
return u4;
|
|
208
|
+
}
|
|
209
|
+
function D(n2, u4, t3) {
|
|
210
|
+
try {
|
|
211
|
+
if ("function" == typeof n2) {
|
|
212
|
+
var i3 = "function" == typeof n2.__u;
|
|
213
|
+
i3 && n2.__u(), i3 && null == u4 || (n2.__u = n2(u4));
|
|
214
|
+
} else n2.current = u4;
|
|
215
|
+
} catch (n3) {
|
|
216
|
+
l.__e(n3, t3);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function E(n2, u4, t3) {
|
|
220
|
+
var i3, r3;
|
|
221
|
+
if (l.unmount && l.unmount(n2), (i3 = n2.ref) && (i3.current && i3.current != n2.__e || D(i3, null, u4)), null != (i3 = n2.__c)) {
|
|
222
|
+
if (i3.componentWillUnmount) try {
|
|
223
|
+
i3.componentWillUnmount();
|
|
224
|
+
} catch (n3) {
|
|
225
|
+
l.__e(n3, u4);
|
|
226
|
+
}
|
|
227
|
+
i3.base = i3.__P = null;
|
|
228
|
+
}
|
|
229
|
+
if (i3 = n2.__k) for (r3 = 0; r3 < i3.length; r3++) i3[r3] && E(i3[r3], u4, t3 || "function" != typeof n2.type);
|
|
230
|
+
t3 || g(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
231
|
+
}
|
|
232
|
+
function G(n2, l3, u4) {
|
|
233
|
+
return this.constructor(n2, u4);
|
|
234
|
+
}
|
|
235
|
+
function J(u4, t3, i3) {
|
|
236
|
+
var r3, o3, e3, f4;
|
|
237
|
+
t3 == document && (t3 = document.documentElement), l.__ && l.__(u4, t3), o3 = (r3 = "function" == typeof i3) ? null : i3 && i3.__k || t3.__k, e3 = [], f4 = [], z(t3, u4 = (!r3 && i3 || t3).__k = _(k, null, [u4]), o3 || p, p, t3.namespaceURI, !r3 && i3 ? [i3] : o3 ? null : t3.firstChild ? n.call(t3.childNodes) : null, e3, !r3 && i3 ? i3 : o3 ? o3.__e : t3.firstChild, r3, f4), V(e3, u4, f4);
|
|
238
|
+
}
|
|
239
|
+
n = v.slice, l = { __e: function(n2, l3, u4, t3) {
|
|
240
|
+
for (var i3, r3, o3; l3 = l3.__; ) if ((i3 = l3.__c) && !i3.__) try {
|
|
241
|
+
if ((r3 = i3.constructor) && null != r3.getDerivedStateFromError && (i3.setState(r3.getDerivedStateFromError(n2)), o3 = i3.__d), null != i3.componentDidCatch && (i3.componentDidCatch(n2, t3 || {}), o3 = i3.__d), o3) return i3.__E = i3;
|
|
242
|
+
} catch (l4) {
|
|
243
|
+
n2 = l4;
|
|
244
|
+
}
|
|
245
|
+
throw n2;
|
|
246
|
+
} }, u = 0, t = function(n2) {
|
|
247
|
+
return null != n2 && void 0 === n2.constructor;
|
|
248
|
+
}, x.prototype.setState = function(n2, l3) {
|
|
249
|
+
var u4;
|
|
250
|
+
u4 = null != this.__s && this.__s != this.state ? this.__s : this.__s = w({}, this.state), "function" == typeof n2 && (n2 = n2(w({}, u4), this.props)), n2 && w(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), $(this));
|
|
251
|
+
}, x.prototype.forceUpdate = function(n2) {
|
|
252
|
+
this.__v && (this.__e = true, n2 && this.__h.push(n2), $(this));
|
|
253
|
+
}, x.prototype.render = k, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l3) {
|
|
254
|
+
return n2.__v.__b - l3.__v.__b;
|
|
255
|
+
}, I.__r = 0, f = /(PointerCapture)$|Capture$/i, c = 0, s = O(false), a = O(true), h = 0;
|
|
256
|
+
|
|
257
|
+
// node_modules/preact/hooks/dist/hooks.module.js
|
|
258
|
+
var t2;
|
|
259
|
+
var r2;
|
|
260
|
+
var u2;
|
|
261
|
+
var i2;
|
|
262
|
+
var o2 = 0;
|
|
263
|
+
var f2 = [];
|
|
264
|
+
var c2 = l;
|
|
265
|
+
var e2 = c2.__b;
|
|
266
|
+
var a2 = c2.__r;
|
|
267
|
+
var v2 = c2.diffed;
|
|
268
|
+
var l2 = c2.__c;
|
|
269
|
+
var m2 = c2.unmount;
|
|
270
|
+
var s2 = c2.__;
|
|
271
|
+
function p2(n2, t3) {
|
|
272
|
+
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
273
|
+
var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
274
|
+
return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
|
|
275
|
+
}
|
|
276
|
+
function d2(n2) {
|
|
277
|
+
return o2 = 1, h2(D2, n2);
|
|
278
|
+
}
|
|
279
|
+
function h2(n2, u4, i3) {
|
|
280
|
+
var o3 = p2(t2++, 2);
|
|
281
|
+
if (o3.t = n2, !o3.__c && (o3.__ = [i3 ? i3(u4) : D2(void 0, u4), function(n3) {
|
|
282
|
+
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
283
|
+
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
284
|
+
}], o3.__c = r2, !r2.__f)) {
|
|
285
|
+
var f4 = function(n3, t3, r3) {
|
|
286
|
+
if (!o3.__c.__H) return true;
|
|
287
|
+
var u5 = o3.__c.__H.__.filter(function(n4) {
|
|
288
|
+
return n4.__c;
|
|
289
|
+
});
|
|
290
|
+
if (u5.every(function(n4) {
|
|
291
|
+
return !n4.__N;
|
|
292
|
+
})) return !c3 || c3.call(this, n3, t3, r3);
|
|
293
|
+
var i4 = o3.__c.props !== n3;
|
|
294
|
+
return u5.some(function(n4) {
|
|
295
|
+
if (n4.__N) {
|
|
296
|
+
var t4 = n4.__[0];
|
|
297
|
+
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i4 = true);
|
|
298
|
+
}
|
|
299
|
+
}), c3 && c3.call(this, n3, t3, r3) || i4;
|
|
300
|
+
};
|
|
301
|
+
r2.__f = true;
|
|
302
|
+
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
303
|
+
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
304
|
+
if (this.__e) {
|
|
305
|
+
var u5 = c3;
|
|
306
|
+
c3 = void 0, f4(n3, t3, r3), c3 = u5;
|
|
307
|
+
}
|
|
308
|
+
e3 && e3.call(this, n3, t3, r3);
|
|
309
|
+
}, r2.shouldComponentUpdate = f4;
|
|
310
|
+
}
|
|
311
|
+
return o3.__N || o3.__;
|
|
312
|
+
}
|
|
313
|
+
function y2(n2, u4) {
|
|
314
|
+
var i3 = p2(t2++, 3);
|
|
315
|
+
!c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__H.__h.push(i3));
|
|
316
|
+
}
|
|
317
|
+
function A2(n2) {
|
|
318
|
+
return o2 = 5, T2(function() {
|
|
319
|
+
return { current: n2 };
|
|
320
|
+
}, []);
|
|
321
|
+
}
|
|
322
|
+
function T2(n2, r3) {
|
|
323
|
+
var u4 = p2(t2++, 7);
|
|
324
|
+
return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
|
|
325
|
+
}
|
|
326
|
+
function j2() {
|
|
327
|
+
for (var n2; n2 = f2.shift(); ) {
|
|
328
|
+
var t3 = n2.__H;
|
|
329
|
+
if (n2.__P && t3) try {
|
|
330
|
+
t3.__h.some(z2), t3.__h.some(B2), t3.__h = [];
|
|
331
|
+
} catch (r3) {
|
|
332
|
+
t3.__h = [], c2.__e(r3, n2.__v);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
c2.__b = function(n2) {
|
|
337
|
+
r2 = null, e2 && e2(n2);
|
|
338
|
+
}, c2.__ = function(n2, t3) {
|
|
339
|
+
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
340
|
+
}, c2.__r = function(n2) {
|
|
341
|
+
a2 && a2(n2), t2 = 0;
|
|
342
|
+
var i3 = (r2 = n2.__c).__H;
|
|
343
|
+
i3 && (u2 === r2 ? (i3.__h = [], r2.__h = [], i3.__.some(function(n3) {
|
|
344
|
+
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
345
|
+
})) : (i3.__h.some(z2), i3.__h.some(B2), i3.__h = [], t2 = 0)), u2 = r2;
|
|
346
|
+
}, c2.diffed = function(n2) {
|
|
347
|
+
v2 && v2(n2);
|
|
348
|
+
var t3 = n2.__c;
|
|
349
|
+
t3 && t3.__H && (t3.__H.__h.length && (1 !== f2.push(t3) && i2 === c2.requestAnimationFrame || ((i2 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.some(function(n3) {
|
|
350
|
+
n3.u && (n3.__H = n3.u), n3.u = void 0;
|
|
351
|
+
})), u2 = r2 = null;
|
|
352
|
+
}, c2.__c = function(n2, t3) {
|
|
353
|
+
t3.some(function(n3) {
|
|
354
|
+
try {
|
|
355
|
+
n3.__h.some(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
356
|
+
return !n4.__ || B2(n4);
|
|
357
|
+
});
|
|
358
|
+
} catch (r3) {
|
|
359
|
+
t3.some(function(n4) {
|
|
360
|
+
n4.__h && (n4.__h = []);
|
|
361
|
+
}), t3 = [], c2.__e(r3, n3.__v);
|
|
362
|
+
}
|
|
363
|
+
}), l2 && l2(n2, t3);
|
|
364
|
+
}, c2.unmount = function(n2) {
|
|
365
|
+
m2 && m2(n2);
|
|
366
|
+
var t3, r3 = n2.__c;
|
|
367
|
+
r3 && r3.__H && (r3.__H.__.some(function(n3) {
|
|
368
|
+
try {
|
|
369
|
+
z2(n3);
|
|
370
|
+
} catch (n4) {
|
|
371
|
+
t3 = n4;
|
|
372
|
+
}
|
|
373
|
+
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
374
|
+
};
|
|
375
|
+
var k2 = "function" == typeof requestAnimationFrame;
|
|
376
|
+
function w2(n2) {
|
|
377
|
+
var t3, r3 = function() {
|
|
378
|
+
clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
379
|
+
}, u4 = setTimeout(r3, 35);
|
|
380
|
+
k2 && (t3 = requestAnimationFrame(r3));
|
|
381
|
+
}
|
|
382
|
+
function z2(n2) {
|
|
383
|
+
var t3 = r2, u4 = n2.__c;
|
|
384
|
+
"function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
|
|
385
|
+
}
|
|
386
|
+
function B2(n2) {
|
|
387
|
+
var t3 = r2;
|
|
388
|
+
n2.__c = n2.__(), r2 = t3;
|
|
389
|
+
}
|
|
390
|
+
function C2(n2, t3) {
|
|
391
|
+
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
392
|
+
return t4 !== n2[r3];
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function D2(n2, t3) {
|
|
396
|
+
return "function" == typeof t3 ? t3(n2) : t3;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
400
|
+
var f3 = 0;
|
|
401
|
+
function u3(e3, t3, n2, o3, i3, u4) {
|
|
402
|
+
t3 || (t3 = {});
|
|
403
|
+
var a3, c3, p3 = t3;
|
|
404
|
+
if ("ref" in p3) for (c3 in p3 = {}, t3) "ref" == c3 ? a3 = t3[c3] : p3[c3] = t3[c3];
|
|
405
|
+
var l3 = { type: e3, props: p3, key: n2, ref: a3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f3, __i: -1, __u: 0, __source: i3, __self: u4 };
|
|
406
|
+
if ("function" == typeof e3 && (a3 = e3.defaultProps)) for (c3 in a3) void 0 === p3[c3] && (p3[c3] = a3[c3]);
|
|
407
|
+
return l.vnode && l.vnode(l3), l3;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// app/assets/typescript/profiler/components/toolbar/ToolbarItem.tsx
|
|
411
|
+
function ToolbarItem({ children, panel, href, className, panelLarge }) {
|
|
412
|
+
const [visible, setVisible] = d2(false);
|
|
413
|
+
const panelRef = A2(null);
|
|
414
|
+
const showTimer = A2(null);
|
|
415
|
+
const hideTimer = A2(null);
|
|
416
|
+
const show = () => {
|
|
417
|
+
if (hideTimer.current) {
|
|
418
|
+
clearTimeout(hideTimer.current);
|
|
419
|
+
hideTimer.current = null;
|
|
420
|
+
}
|
|
421
|
+
showTimer.current = setTimeout(() => setVisible(true), 100);
|
|
422
|
+
};
|
|
423
|
+
const hide = () => {
|
|
424
|
+
if (showTimer.current) {
|
|
425
|
+
clearTimeout(showTimer.current);
|
|
426
|
+
showTimer.current = null;
|
|
427
|
+
}
|
|
428
|
+
hideTimer.current = setTimeout(() => setVisible(false), 150);
|
|
429
|
+
};
|
|
430
|
+
y2(() => {
|
|
431
|
+
if (visible && panelRef.current) {
|
|
432
|
+
const el = panelRef.current;
|
|
433
|
+
el.style.left = "50%";
|
|
434
|
+
el.style.right = "auto";
|
|
435
|
+
el.style.transform = "translateX(-50%)";
|
|
436
|
+
const rect = el.getBoundingClientRect();
|
|
437
|
+
if (rect.left < 8) {
|
|
438
|
+
el.style.left = "0";
|
|
439
|
+
el.style.transform = "none";
|
|
440
|
+
} else if (rect.right > window.innerWidth - 8) {
|
|
441
|
+
el.style.left = "auto";
|
|
442
|
+
el.style.right = "0";
|
|
443
|
+
el.style.transform = "none";
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}, [visible]);
|
|
447
|
+
const cls = [
|
|
448
|
+
"profiler-toolbar-item",
|
|
449
|
+
panel ? "profiler-toolbar-hoverable" : "",
|
|
450
|
+
className || ""
|
|
451
|
+
].filter(Boolean).join(" ");
|
|
452
|
+
const panelEl = panel ? /* @__PURE__ */ u3(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
ref: panelRef,
|
|
456
|
+
class: `profiler-toolbar-panel${panelLarge ? " profiler-toolbar-panel-large" : ""}`,
|
|
457
|
+
style: { display: visible ? "block" : "none" },
|
|
458
|
+
onMouseEnter: show,
|
|
459
|
+
onMouseLeave: hide,
|
|
460
|
+
children: panel
|
|
461
|
+
}
|
|
462
|
+
) : null;
|
|
463
|
+
if (href) {
|
|
464
|
+
return /* @__PURE__ */ u3("a", { href, class: cls, onMouseEnter: show, onMouseLeave: hide, children: [
|
|
465
|
+
children,
|
|
466
|
+
panelEl
|
|
467
|
+
] });
|
|
468
|
+
}
|
|
469
|
+
return /* @__PURE__ */ u3("span", { class: cls, onMouseEnter: show, onMouseLeave: hide, children: [
|
|
470
|
+
children,
|
|
471
|
+
panelEl
|
|
472
|
+
] });
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// app/assets/typescript/profiler/components/toolbar/panels/RequestPanel.tsx
|
|
476
|
+
function statusClass(status) {
|
|
477
|
+
if (status >= 200 && status < 300) return "profiler-text--success";
|
|
478
|
+
if (status >= 300 && status < 400) return "profiler-text--warning";
|
|
479
|
+
if (status >= 400) return "profiler-text--error";
|
|
480
|
+
return "";
|
|
481
|
+
}
|
|
482
|
+
function RequestPanel({ profile, requestData }) {
|
|
483
|
+
const cls = statusClass(profile.status);
|
|
484
|
+
const headers = requestData.headers;
|
|
485
|
+
const responseBody = requestData.response_body;
|
|
486
|
+
const responseBodyEncoding = requestData.response_body_encoding;
|
|
487
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
488
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
489
|
+
"Request & Response",
|
|
490
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: profile.path })
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
493
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Request" }),
|
|
494
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
495
|
+
/* @__PURE__ */ u3("span", { children: "Method" }),
|
|
496
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--accent", children: profile.method })
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
499
|
+
/* @__PURE__ */ u3("span", { children: "Path" }),
|
|
500
|
+
/* @__PURE__ */ u3("strong", { children: profile.path })
|
|
501
|
+
] }),
|
|
502
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
503
|
+
/* @__PURE__ */ u3("span", { children: "Status" }),
|
|
504
|
+
/* @__PURE__ */ u3("strong", { class: cls, children: profile.status })
|
|
505
|
+
] }),
|
|
506
|
+
profile.params && Object.keys(profile.params).length > 0 && /* @__PURE__ */ u3(k, { children: [
|
|
507
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Parameters" }),
|
|
508
|
+
Object.entries(profile.params).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
509
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
510
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 40) })
|
|
511
|
+
] }, key))
|
|
512
|
+
] }),
|
|
513
|
+
headers && Object.keys(headers).length > 0 && /* @__PURE__ */ u3(k, { children: [
|
|
514
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Headers" }),
|
|
515
|
+
Object.entries(headers).slice(0, 5).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
516
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
517
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 50) })
|
|
518
|
+
] }, key))
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response" }),
|
|
521
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
522
|
+
/* @__PURE__ */ u3("span", { children: "Content-Type" }),
|
|
523
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: profile.response_headers?.["content-type"] || "N/A" })
|
|
524
|
+
] }),
|
|
525
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
526
|
+
/* @__PURE__ */ u3("span", { children: "Cache-Control" }),
|
|
527
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: profile.response_headers?.["cache-control"] || "N/A" })
|
|
528
|
+
] }),
|
|
529
|
+
profile.response_headers && Object.entries(profile.response_headers).filter(([k3]) => !["content-type", "cache-control"].includes(k3)).slice(0, 8).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
530
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
531
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 60) })
|
|
532
|
+
] }, key)),
|
|
533
|
+
responseBody && responseBodyEncoding !== "base64" && /* @__PURE__ */ u3(k, { children: [
|
|
534
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response Body" }),
|
|
535
|
+
/* @__PURE__ */ u3("pre", { style: "margin:0;padding:6px 0;font-size:10px;line-height:1.5;white-space:pre-wrap;word-break:break-all;color:var(--pf-text,#eef2f7);max-height:120px;overflow:hidden;", children: [
|
|
536
|
+
responseBody.substring(0, 300),
|
|
537
|
+
responseBody.length > 300 ? "\u2026" : ""
|
|
538
|
+
] })
|
|
539
|
+
] }),
|
|
540
|
+
responseBody && responseBodyEncoding === "base64" && /* @__PURE__ */ u3(k, { children: [
|
|
541
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response Body" }),
|
|
542
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: "[binary]" }) })
|
|
543
|
+
] })
|
|
544
|
+
] })
|
|
545
|
+
] });
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// app/assets/typescript/profiler/components/toolbar/panels/DatabasePanel.tsx
|
|
549
|
+
function DatabasePanel({ dbData }) {
|
|
550
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
551
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
552
|
+
"Database",
|
|
553
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
554
|
+
dbData.total_queries,
|
|
555
|
+
" queries \xB7 ",
|
|
556
|
+
dbData.total_duration.toFixed(2),
|
|
557
|
+
" ms"
|
|
558
|
+
] })
|
|
559
|
+
] }),
|
|
560
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
561
|
+
dbData.queries.slice(0, 10).map((query, index) => /* @__PURE__ */ u3(
|
|
562
|
+
"div",
|
|
563
|
+
{
|
|
564
|
+
class: `profiler-toolbar-panel-query${query.slow ? " profiler-toolbar-panel-query-slow" : ""}`,
|
|
565
|
+
children: [
|
|
566
|
+
/* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--between profiler-mb-1", children: [
|
|
567
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
|
|
568
|
+
"#",
|
|
569
|
+
index + 1,
|
|
570
|
+
" ",
|
|
571
|
+
query.name
|
|
572
|
+
] }),
|
|
573
|
+
/* @__PURE__ */ u3("span", { class: `${query.slow ? "profiler-text--error" : "profiler-text--success"} profiler-text--xs`, children: [
|
|
574
|
+
query.duration.toFixed(2),
|
|
575
|
+
" ms"
|
|
576
|
+
] })
|
|
577
|
+
] }),
|
|
578
|
+
/* @__PURE__ */ u3("code", { children: query.sql })
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
index
|
|
582
|
+
)),
|
|
583
|
+
dbData.total_queries > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
584
|
+
"+ ",
|
|
585
|
+
dbData.total_queries - 10,
|
|
586
|
+
" more queries"
|
|
587
|
+
] })
|
|
588
|
+
] })
|
|
589
|
+
] });
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// app/assets/typescript/profiler/components/toolbar/panels/AjaxPanel.tsx
|
|
593
|
+
function methodBadgeClass(method) {
|
|
594
|
+
const map = {
|
|
595
|
+
GET: "badge-info",
|
|
596
|
+
POST: "badge-success",
|
|
597
|
+
PUT: "badge-warning",
|
|
598
|
+
PATCH: "badge-warning",
|
|
599
|
+
DELETE: "badge-error"
|
|
600
|
+
};
|
|
601
|
+
return map[method] || "";
|
|
602
|
+
}
|
|
603
|
+
function AjaxPanel({ ajaxData }) {
|
|
604
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
605
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
606
|
+
"AJAX",
|
|
607
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
608
|
+
ajaxData.total_requests,
|
|
609
|
+
" requests \xB7 ",
|
|
610
|
+
ajaxData.total_duration.toFixed(2),
|
|
611
|
+
" ms"
|
|
612
|
+
] })
|
|
613
|
+
] }),
|
|
614
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
615
|
+
ajaxData.requests.slice(0, 10).map((req, index) => {
|
|
616
|
+
const statusCls = req.status >= 200 && req.status < 300 ? "profiler-ajax-card--success" : "profiler-ajax-card--error";
|
|
617
|
+
return /* @__PURE__ */ u3("div", { class: `profiler-ajax-card ${statusCls}`, children: /* @__PURE__ */ u3("div", { class: "profiler-ajax-card__row", children: [
|
|
618
|
+
/* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
|
|
619
|
+
/* @__PURE__ */ u3("span", { class: `badge ${methodBadgeClass(req.method)}`, children: req.method }),
|
|
620
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--truncate", children: req.path })
|
|
621
|
+
] }),
|
|
622
|
+
/* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
|
|
623
|
+
/* @__PURE__ */ u3("span", { class: `profiler-text--xs ${req.status >= 200 && req.status < 300 ? "profiler-text--success" : "profiler-text--error"}`, children: req.status }),
|
|
624
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
|
|
625
|
+
req.duration.toFixed(2),
|
|
626
|
+
" ms"
|
|
627
|
+
] })
|
|
628
|
+
] })
|
|
629
|
+
] }) }, index);
|
|
630
|
+
}),
|
|
631
|
+
ajaxData.total_requests > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
632
|
+
"+ ",
|
|
633
|
+
ajaxData.total_requests - 10,
|
|
634
|
+
" more"
|
|
635
|
+
] })
|
|
636
|
+
] })
|
|
637
|
+
] });
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// app/assets/typescript/profiler/components/toolbar/panels/EventsPanel.tsx
|
|
641
|
+
function EventsPanel({ perfData }) {
|
|
642
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
643
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Events" }),
|
|
644
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: perfData.events.slice(0, 8).map((event, index) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
645
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: event.name }),
|
|
646
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--accent", children: [
|
|
647
|
+
event.duration.toFixed(2),
|
|
648
|
+
" ms"
|
|
649
|
+
] })
|
|
650
|
+
] }, index)) })
|
|
651
|
+
] });
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// app/assets/typescript/profiler/components/toolbar/panels/ViewsPanel.tsx
|
|
655
|
+
function ViewsPanel({ viewData }) {
|
|
656
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
657
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
658
|
+
"Views",
|
|
659
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
660
|
+
viewData.total_duration.toFixed(2),
|
|
661
|
+
" ms"
|
|
662
|
+
] })
|
|
663
|
+
] }),
|
|
664
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
665
|
+
viewData.views && viewData.views.length > 0 && /* @__PURE__ */ u3(k, { children: [
|
|
666
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Templates" }),
|
|
667
|
+
viewData.views.map((view, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
668
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: view.identifier }),
|
|
669
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: [
|
|
670
|
+
view.duration.toFixed(2),
|
|
671
|
+
" ms"
|
|
672
|
+
] })
|
|
673
|
+
] }, i3))
|
|
674
|
+
] }),
|
|
675
|
+
viewData.partials && viewData.partials.length > 0 && /* @__PURE__ */ u3(k, { children: [
|
|
676
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Partials" }),
|
|
677
|
+
viewData.partials.map((partial, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
678
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs", children: partial.identifier }),
|
|
679
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: [
|
|
680
|
+
partial.duration.toFixed(2),
|
|
681
|
+
" ms"
|
|
682
|
+
] })
|
|
683
|
+
] }, i3))
|
|
684
|
+
] })
|
|
685
|
+
] })
|
|
686
|
+
] });
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// app/assets/typescript/profiler/components/toolbar/panels/CachePanel.tsx
|
|
690
|
+
function CachePanel({ cacheData }) {
|
|
691
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
692
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
693
|
+
"Cache",
|
|
694
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
695
|
+
"Hit rate: ",
|
|
696
|
+
cacheData.hit_rate,
|
|
697
|
+
"%"
|
|
698
|
+
] })
|
|
699
|
+
] }),
|
|
700
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
701
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
702
|
+
/* @__PURE__ */ u3("span", { children: "Reads" }),
|
|
703
|
+
/* @__PURE__ */ u3("strong", { children: cacheData.total_reads })
|
|
704
|
+
] }),
|
|
705
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
706
|
+
/* @__PURE__ */ u3("span", { children: "Writes" }),
|
|
707
|
+
/* @__PURE__ */ u3("strong", { children: cacheData.total_writes })
|
|
708
|
+
] }),
|
|
709
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
710
|
+
/* @__PURE__ */ u3("span", { children: "Hits" }),
|
|
711
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: cacheData.hits })
|
|
712
|
+
] }),
|
|
713
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
714
|
+
/* @__PURE__ */ u3("span", { children: "Misses" }),
|
|
715
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--error", children: cacheData.misses })
|
|
716
|
+
] })
|
|
717
|
+
] })
|
|
718
|
+
] });
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// app/assets/typescript/profiler/components/toolbar/panels/DumpsPanel.tsx
|
|
722
|
+
function DumpsPanel({ dumpData }) {
|
|
723
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
724
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
725
|
+
"Dumps (",
|
|
726
|
+
dumpData.count,
|
|
727
|
+
")"
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
730
|
+
dumpData.dumps.slice(0, 5).map((dump, index) => /* @__PURE__ */ u3("div", { class: "profiler-dump-card", children: [
|
|
731
|
+
/* @__PURE__ */ u3("div", { class: "profiler-dump-card__header", children: [
|
|
732
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
|
|
733
|
+
"#",
|
|
734
|
+
index + 1,
|
|
735
|
+
dump.label && /* @__PURE__ */ u3(k, { children: [
|
|
736
|
+
" \xB7 ",
|
|
737
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--warning", children: dump.label })
|
|
738
|
+
] })
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", children: [
|
|
741
|
+
dump.file.split("/").pop(),
|
|
742
|
+
":",
|
|
743
|
+
dump.line
|
|
744
|
+
] })
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ u3(
|
|
747
|
+
"pre",
|
|
748
|
+
{
|
|
749
|
+
class: "profiler-text--xs profiler-text--truncate profiler-text--warning",
|
|
750
|
+
style: { margin: 0, background: "none", border: "none", padding: 0 },
|
|
751
|
+
children: (dump.formatted.split("\n")[0] || dump.formatted).trim()
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
] }, index)),
|
|
755
|
+
dumpData.count > 5 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
756
|
+
"+ ",
|
|
757
|
+
dumpData.count - 5,
|
|
758
|
+
" more dumps"
|
|
759
|
+
] })
|
|
760
|
+
] })
|
|
761
|
+
] });
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// app/assets/typescript/profiler/components/toolbar/panels/HttpPanel.tsx
|
|
765
|
+
function methodBadgeClass2(method) {
|
|
766
|
+
const map = {
|
|
767
|
+
GET: "badge-info",
|
|
768
|
+
POST: "badge-success",
|
|
769
|
+
PUT: "badge-warning",
|
|
770
|
+
PATCH: "badge-warning",
|
|
771
|
+
DELETE: "badge-error"
|
|
772
|
+
};
|
|
773
|
+
return map[method] || "";
|
|
774
|
+
}
|
|
775
|
+
function HttpPanel({ httpData }) {
|
|
776
|
+
const threshold = 500;
|
|
777
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
778
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
779
|
+
"Outbound HTTP",
|
|
780
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
781
|
+
httpData.total_requests,
|
|
782
|
+
" requests \xB7 ",
|
|
783
|
+
httpData.total_duration.toFixed(2),
|
|
784
|
+
" ms"
|
|
785
|
+
] })
|
|
786
|
+
] }),
|
|
787
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
788
|
+
httpData.requests.slice(0, 10).map((req, index) => {
|
|
789
|
+
const isError = req.status >= 400 || req.status === 0;
|
|
790
|
+
const isSlow = req.duration >= threshold;
|
|
791
|
+
const statusCls = isError ? "profiler-ajax-card--error" : isSlow ? "profiler-ajax-card--warning" : "profiler-ajax-card--success";
|
|
792
|
+
const host = (() => {
|
|
793
|
+
try {
|
|
794
|
+
return new URL(req.url).host;
|
|
795
|
+
} catch {
|
|
796
|
+
return req.url;
|
|
797
|
+
}
|
|
798
|
+
})();
|
|
799
|
+
return /* @__PURE__ */ u3("div", { class: `profiler-ajax-card ${statusCls}`, children: /* @__PURE__ */ u3("div", { class: "profiler-ajax-card__row", children: [
|
|
800
|
+
/* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
|
|
801
|
+
/* @__PURE__ */ u3("span", { class: `badge ${methodBadgeClass2(req.method)}`, children: req.method }),
|
|
802
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--truncate", children: host })
|
|
803
|
+
] }),
|
|
804
|
+
/* @__PURE__ */ u3("div", { class: "profiler-flex profiler-flex--gap-2", children: [
|
|
805
|
+
/* @__PURE__ */ u3("span", { class: `profiler-text--xs ${isError ? "profiler-text--error" : "profiler-text--success"}`, children: req.status === 0 ? "ERR" : req.status }),
|
|
806
|
+
/* @__PURE__ */ u3("span", { class: `profiler-text--xs ${isSlow ? "profiler-text--error" : "profiler-text--muted"}`, children: [
|
|
807
|
+
req.duration.toFixed(2),
|
|
808
|
+
" ms"
|
|
809
|
+
] })
|
|
810
|
+
] })
|
|
811
|
+
] }) }, index);
|
|
812
|
+
}),
|
|
813
|
+
httpData.total_requests > 10 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
814
|
+
"+ ",
|
|
815
|
+
httpData.total_requests - 10,
|
|
816
|
+
" more"
|
|
817
|
+
] })
|
|
818
|
+
] })
|
|
819
|
+
] });
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// app/assets/typescript/profiler/components/toolbar/panels/LogsPanel.tsx
|
|
823
|
+
function levelColor(level) {
|
|
824
|
+
switch (level) {
|
|
825
|
+
case "ERROR":
|
|
826
|
+
case "FATAL":
|
|
827
|
+
return "var(--profiler-error, #ef4444)";
|
|
828
|
+
case "WARN":
|
|
829
|
+
return "var(--profiler-warning, #f59e0b)";
|
|
830
|
+
case "INFO":
|
|
831
|
+
return "var(--profiler-success, #22c55e)";
|
|
832
|
+
default:
|
|
833
|
+
return "var(--profiler-muted, #6b7280)";
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function LogsPanel({ logData }) {
|
|
837
|
+
const recent = logData.logs.slice(-5).reverse();
|
|
838
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
839
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
840
|
+
"Logs (",
|
|
841
|
+
logData.count,
|
|
842
|
+
")",
|
|
843
|
+
logData.errors > 0 && /* @__PURE__ */ u3("span", { style: "color:var(--profiler-error,#ef4444);margin-left:8px;", children: [
|
|
844
|
+
logData.errors,
|
|
845
|
+
" error",
|
|
846
|
+
logData.errors !== 1 ? "s" : ""
|
|
847
|
+
] }),
|
|
848
|
+
logData.warnings > 0 && logData.errors === 0 && /* @__PURE__ */ u3("span", { style: "color:var(--profiler-warning,#f59e0b);margin-left:8px;", children: [
|
|
849
|
+
logData.warnings,
|
|
850
|
+
" warning",
|
|
851
|
+
logData.warnings !== 1 ? "s" : ""
|
|
852
|
+
] })
|
|
853
|
+
] }),
|
|
854
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
855
|
+
recent.map((entry, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", style: "align-items:flex-start;gap:6px;", children: [
|
|
856
|
+
/* @__PURE__ */ u3(
|
|
857
|
+
"span",
|
|
858
|
+
{
|
|
859
|
+
class: "profiler-text--xs",
|
|
860
|
+
style: `color:${levelColor(entry.level)};font-weight:600;min-width:40px;`,
|
|
861
|
+
children: entry.level
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
/* @__PURE__ */ u3(
|
|
865
|
+
"span",
|
|
866
|
+
{
|
|
867
|
+
class: "profiler-text--xs profiler-text--truncate",
|
|
868
|
+
style: "flex:1;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",
|
|
869
|
+
children: entry.message
|
|
870
|
+
}
|
|
871
|
+
)
|
|
872
|
+
] }, i3)),
|
|
873
|
+
logData.count > 5 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
874
|
+
"+ ",
|
|
875
|
+
logData.count - 5,
|
|
876
|
+
" more messages"
|
|
877
|
+
] })
|
|
878
|
+
] })
|
|
879
|
+
] });
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// app/assets/typescript/profiler/components/toolbar/panels/ExceptionPanel.tsx
|
|
883
|
+
function ExceptionPanel({ exceptionData }) {
|
|
884
|
+
const firstAppFrame = exceptionData.backtrace?.find((f4) => f4.app_frame);
|
|
885
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
886
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", style: "color:var(--profiler-error,#ef4444);", children: [
|
|
887
|
+
"\u{1F4A5} ",
|
|
888
|
+
exceptionData.exception_class
|
|
889
|
+
] }),
|
|
890
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", style: "flex-direction:column;align-items:flex-start;gap:4px;", children: [
|
|
891
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs", style: "max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", children: exceptionData.message }),
|
|
892
|
+
firstAppFrame && /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--muted", style: "max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", children: firstAppFrame.location })
|
|
893
|
+
] }) })
|
|
894
|
+
] });
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// app/assets/typescript/profiler/components/toolbar/ToolbarApp.tsx
|
|
898
|
+
function statusClass2(status) {
|
|
899
|
+
if (status >= 200 && status < 300) return "profiler-text--success";
|
|
900
|
+
if (status >= 300 && status < 400) return "profiler-text--warning";
|
|
901
|
+
if (status >= 400) return "profiler-text--error";
|
|
902
|
+
return "";
|
|
903
|
+
}
|
|
904
|
+
function durationClass(duration) {
|
|
905
|
+
if (duration < 100) return "profiler-text--success";
|
|
906
|
+
if (duration < 500) return "profiler-text--warning";
|
|
907
|
+
return "profiler-text--error";
|
|
908
|
+
}
|
|
909
|
+
function formatTime(iso) {
|
|
910
|
+
return new Date(iso).toLocaleTimeString("en", {
|
|
911
|
+
hour12: false,
|
|
912
|
+
hour: "2-digit",
|
|
913
|
+
minute: "2-digit",
|
|
914
|
+
second: "2-digit"
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function ToolbarApp({ profile, token }) {
|
|
918
|
+
const cd = profile.collectors_data || {};
|
|
919
|
+
const requestData = cd["request"];
|
|
920
|
+
const dbData = cd["database"];
|
|
921
|
+
const ajaxData = cd["ajax"];
|
|
922
|
+
const perfData = cd["performance"];
|
|
923
|
+
const viewData = cd["view"];
|
|
924
|
+
const cacheData = cd["cache"];
|
|
925
|
+
const dumpData = cd["dump"];
|
|
926
|
+
const httpData = cd["http"];
|
|
927
|
+
const logData = cd["logs"];
|
|
928
|
+
const exceptionData = cd["exception"];
|
|
929
|
+
const reqClass = statusClass2(profile.status);
|
|
930
|
+
const durClass = durationClass(profile.duration);
|
|
931
|
+
const dbClass = (dbData?.slow_queries ?? 0) > 0 ? "profiler-text--error" : "profiler-text--success";
|
|
932
|
+
const ajaxClass = (ajaxData?.total_requests ?? 0) > 20 ? "profiler-text--error" : "profiler-text--success";
|
|
933
|
+
const cacheClass = (cacheData?.hit_rate ?? 0) > 80 ? "profiler-text--success" : "profiler-text--warning";
|
|
934
|
+
return /* @__PURE__ */ u3("div", { class: "profiler-toolbar-container", children: [
|
|
935
|
+
requestData && /* @__PURE__ */ u3(k, { children: [
|
|
936
|
+
/* @__PURE__ */ u3(
|
|
937
|
+
ToolbarItem,
|
|
938
|
+
{
|
|
939
|
+
href: `/_profiler/profiles/${token}?tab=request`,
|
|
940
|
+
className: reqClass,
|
|
941
|
+
panelLarge: true,
|
|
942
|
+
panel: /* @__PURE__ */ u3(RequestPanel, { profile, requestData }),
|
|
943
|
+
children: [
|
|
944
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: profile.method }),
|
|
945
|
+
/* @__PURE__ */ u3("span", { children: profile.status })
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ u3(
|
|
950
|
+
ToolbarItem,
|
|
951
|
+
{
|
|
952
|
+
href: `/_profiler/profiles/${token}?tab=request`,
|
|
953
|
+
className: durClass,
|
|
954
|
+
panel: /* @__PURE__ */ u3(k, { children: [
|
|
955
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Performance" }),
|
|
956
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
957
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
958
|
+
/* @__PURE__ */ u3("span", { children: "Duration" }),
|
|
959
|
+
/* @__PURE__ */ u3("strong", { class: durClass, children: [
|
|
960
|
+
profile.duration.toFixed(2),
|
|
961
|
+
" ms"
|
|
962
|
+
] })
|
|
963
|
+
] }),
|
|
964
|
+
profile.memory && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
965
|
+
/* @__PURE__ */ u3("span", { children: "Memory" }),
|
|
966
|
+
/* @__PURE__ */ u3("strong", { children: [
|
|
967
|
+
(profile.memory / 1024 / 1024).toFixed(2),
|
|
968
|
+
" MB"
|
|
969
|
+
] })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
972
|
+
/* @__PURE__ */ u3("span", { children: "Started" }),
|
|
973
|
+
/* @__PURE__ */ u3("strong", { children: formatTime(profile.started_at) })
|
|
974
|
+
] })
|
|
975
|
+
] })
|
|
976
|
+
] }),
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ u3("span", { class: durClass, children: profile.duration.toFixed(2) }),
|
|
979
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "ms" })
|
|
980
|
+
]
|
|
981
|
+
}
|
|
982
|
+
)
|
|
983
|
+
] }),
|
|
984
|
+
dbData?.total_queries !== void 0 && /* @__PURE__ */ u3(
|
|
985
|
+
ToolbarItem,
|
|
986
|
+
{
|
|
987
|
+
href: `/_profiler/profiles/${token}?tab=database`,
|
|
988
|
+
className: dbClass,
|
|
989
|
+
panelLarge: true,
|
|
990
|
+
panel: /* @__PURE__ */ u3(DatabasePanel, { dbData }),
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "DB" }),
|
|
993
|
+
/* @__PURE__ */ u3("span", { children: dbData.total_queries }),
|
|
994
|
+
(dbData.slow_queries ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
|
|
995
|
+
"\u25B2 ",
|
|
996
|
+
dbData.slow_queries
|
|
997
|
+
] }),
|
|
998
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
|
|
999
|
+
dbData.total_duration.toFixed(1),
|
|
1000
|
+
"ms"
|
|
1001
|
+
] })
|
|
1002
|
+
]
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
ajaxData && ajaxData.total_requests > 0 && /* @__PURE__ */ u3(
|
|
1006
|
+
ToolbarItem,
|
|
1007
|
+
{
|
|
1008
|
+
href: `/_profiler/profiles/${token}?tab=ajax`,
|
|
1009
|
+
className: ajaxClass,
|
|
1010
|
+
panelLarge: true,
|
|
1011
|
+
panel: /* @__PURE__ */ u3(AjaxPanel, { ajaxData }),
|
|
1012
|
+
children: [
|
|
1013
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "XHR" }),
|
|
1014
|
+
/* @__PURE__ */ u3("span", { children: ajaxData.total_requests }),
|
|
1015
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
|
|
1016
|
+
ajaxData.total_duration.toFixed(1),
|
|
1017
|
+
"ms"
|
|
1018
|
+
] })
|
|
1019
|
+
]
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
perfData?.events && perfData.total_events > 0 && /* @__PURE__ */ u3(
|
|
1023
|
+
ToolbarItem,
|
|
1024
|
+
{
|
|
1025
|
+
href: `/_profiler/profiles/${token}?tab=timeline`,
|
|
1026
|
+
panel: /* @__PURE__ */ u3(EventsPanel, { perfData }),
|
|
1027
|
+
children: [
|
|
1028
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "EVT" }),
|
|
1029
|
+
/* @__PURE__ */ u3("span", { children: perfData.total_events })
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
viewData?.total_views !== void 0 && /* @__PURE__ */ u3(
|
|
1034
|
+
ToolbarItem,
|
|
1035
|
+
{
|
|
1036
|
+
href: `/_profiler/profiles/${token}?tab=views`,
|
|
1037
|
+
panel: /* @__PURE__ */ u3(ViewsPanel, { viewData }),
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "VIEW" }),
|
|
1040
|
+
/* @__PURE__ */ u3("span", { children: viewData.total_views }),
|
|
1041
|
+
viewData.total_partials > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
|
|
1042
|
+
"+",
|
|
1043
|
+
viewData.total_partials,
|
|
1044
|
+
"p"
|
|
1045
|
+
] })
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
cacheData && cacheData.total_reads > 0 && /* @__PURE__ */ u3(
|
|
1050
|
+
ToolbarItem,
|
|
1051
|
+
{
|
|
1052
|
+
href: `/_profiler/profiles/${token}?tab=cache`,
|
|
1053
|
+
className: cacheClass,
|
|
1054
|
+
panel: /* @__PURE__ */ u3(CachePanel, { cacheData }),
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "CACHE" }),
|
|
1057
|
+
/* @__PURE__ */ u3("span", { class: cacheClass, children: [
|
|
1058
|
+
cacheData.hit_rate,
|
|
1059
|
+
"%"
|
|
1060
|
+
] })
|
|
1061
|
+
]
|
|
1062
|
+
}
|
|
1063
|
+
),
|
|
1064
|
+
httpData && httpData.total_requests > 0 && /* @__PURE__ */ u3(
|
|
1065
|
+
ToolbarItem,
|
|
1066
|
+
{
|
|
1067
|
+
href: `/_profiler/profiles/${token}?tab=http`,
|
|
1068
|
+
className: httpData.error_requests > 0 || httpData.slow_requests > 0 ? "profiler-text--error" : "profiler-text--success",
|
|
1069
|
+
panelLarge: true,
|
|
1070
|
+
panel: /* @__PURE__ */ u3(HttpPanel, { httpData }),
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "HTTP" }),
|
|
1073
|
+
/* @__PURE__ */ u3("span", { children: httpData.total_requests }),
|
|
1074
|
+
httpData.slow_requests > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
|
|
1075
|
+
"\u25B2 ",
|
|
1076
|
+
httpData.slow_requests
|
|
1077
|
+
] }),
|
|
1078
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
|
|
1079
|
+
httpData.total_duration.toFixed(1),
|
|
1080
|
+
"ms"
|
|
1081
|
+
] })
|
|
1082
|
+
]
|
|
1083
|
+
}
|
|
1084
|
+
),
|
|
1085
|
+
dumpData && dumpData.count > 0 && /* @__PURE__ */ u3(
|
|
1086
|
+
ToolbarItem,
|
|
1087
|
+
{
|
|
1088
|
+
href: `/_profiler/profiles/${token}?tab=dump`,
|
|
1089
|
+
className: "profiler-text--warning",
|
|
1090
|
+
panelLarge: true,
|
|
1091
|
+
panel: /* @__PURE__ */ u3(DumpsPanel, { dumpData }),
|
|
1092
|
+
children: [
|
|
1093
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "DUMP" }),
|
|
1094
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--warning", children: dumpData.count })
|
|
1095
|
+
]
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
logData && logData.count > 0 && /* @__PURE__ */ u3(
|
|
1099
|
+
ToolbarItem,
|
|
1100
|
+
{
|
|
1101
|
+
href: `/_profiler/profiles/${token}?tab=logs`,
|
|
1102
|
+
className: logData.errors > 0 ? "profiler-text--error" : logData.warnings > 0 ? "profiler-text--warning" : "profiler-text--muted",
|
|
1103
|
+
panelLarge: true,
|
|
1104
|
+
panel: /* @__PURE__ */ u3(LogsPanel, { logData }),
|
|
1105
|
+
children: [
|
|
1106
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "LOG" }),
|
|
1107
|
+
/* @__PURE__ */ u3("span", { class: logData.errors > 0 ? "profiler-text--error" : logData.warnings > 0 ? "profiler-text--warning" : "", children: logData.errors > 0 ? logData.errors : logData.warnings > 0 ? logData.warnings : logData.count })
|
|
1108
|
+
]
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
exceptionData && exceptionData.exception_class && /* @__PURE__ */ u3(
|
|
1112
|
+
ToolbarItem,
|
|
1113
|
+
{
|
|
1114
|
+
href: `/_profiler/profiles/${token}?tab=exception`,
|
|
1115
|
+
className: "profiler-text--error",
|
|
1116
|
+
panelLarge: true,
|
|
1117
|
+
panel: /* @__PURE__ */ u3(ExceptionPanel, { exceptionData }),
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: "\u{1F4A5}" }),
|
|
1120
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: exceptionData.exception_class.split("::").pop() })
|
|
1121
|
+
]
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
/* @__PURE__ */ u3("a", { href: "/_profiler", class: "profiler-toolbar-item", children: "\u2B21 Profiler" })
|
|
1125
|
+
] });
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// app/assets/typescript/profiler/toolbar-bundle.tsx
|
|
1129
|
+
function applyTheme(el) {
|
|
1130
|
+
const stored = localStorage.getItem("profiler-theme");
|
|
1131
|
+
const theme = stored === "light" ? "light" : stored === "dark" ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
|
|
1132
|
+
el.setAttribute("data-theme", theme);
|
|
1133
|
+
}
|
|
1134
|
+
function mountToolbar() {
|
|
1135
|
+
const el = document.getElementById("profiler-toolbar");
|
|
1136
|
+
if (!el) return;
|
|
1137
|
+
const token = el.dataset.token;
|
|
1138
|
+
if (!token) return;
|
|
1139
|
+
applyTheme(el);
|
|
1140
|
+
window.addEventListener("storage", (e3) => {
|
|
1141
|
+
if (e3.key === "profiler-theme") applyTheme(el);
|
|
1142
|
+
});
|
|
1143
|
+
window.addEventListener("profiler:theme-change", ((e3) => {
|
|
1144
|
+
if (e3.detail?.theme) el.setAttribute("data-theme", e3.detail.theme);
|
|
1145
|
+
}));
|
|
1146
|
+
const renderToolbar = (profile) => {
|
|
1147
|
+
J(/* @__PURE__ */ u3(ToolbarApp, { profile, token }), el);
|
|
1148
|
+
applyTheme(el);
|
|
1149
|
+
};
|
|
1150
|
+
const loadAndRender = () => {
|
|
1151
|
+
fetch(`/_profiler/api/toolbar/${token}`).then((res) => res.json()).then((data) => {
|
|
1152
|
+
if (data.profile) renderToolbar(data.profile);
|
|
1153
|
+
}).catch((err) => console.debug("Profiler toolbar load failed:", err));
|
|
1154
|
+
};
|
|
1155
|
+
window.__PROFILER_REFRESH_TOOLBAR__ = loadAndRender;
|
|
1156
|
+
loadAndRender();
|
|
1157
|
+
document.addEventListener("keydown", (e3) => {
|
|
1158
|
+
if (e3.altKey && e3.key === "p") {
|
|
1159
|
+
e3.preventDefault();
|
|
1160
|
+
const hidden2 = el.dataset.hidden === "true";
|
|
1161
|
+
if (hidden2) {
|
|
1162
|
+
el.dataset.hidden = "false";
|
|
1163
|
+
el.style.transform = "translateY(0)";
|
|
1164
|
+
el.style.opacity = "1";
|
|
1165
|
+
localStorage.setItem("profiler-toolbar-hidden", "false");
|
|
1166
|
+
} else {
|
|
1167
|
+
el.dataset.hidden = "true";
|
|
1168
|
+
el.style.transform = "translateY(100%)";
|
|
1169
|
+
el.style.opacity = "0";
|
|
1170
|
+
localStorage.setItem("profiler-toolbar-hidden", "true");
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
if (e3.key === "Escape") {
|
|
1174
|
+
el.dataset.hidden = "true";
|
|
1175
|
+
el.style.transform = "translateY(100%)";
|
|
1176
|
+
el.style.opacity = "0";
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
const hidden = localStorage.getItem("profiler-toolbar-hidden") === "true";
|
|
1180
|
+
if (hidden) {
|
|
1181
|
+
el.dataset.hidden = "true";
|
|
1182
|
+
el.style.transform = "translateY(100%)";
|
|
1183
|
+
el.style.opacity = "0";
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (document.readyState === "loading") {
|
|
1187
|
+
document.addEventListener("DOMContentLoaded", mountToolbar);
|
|
1188
|
+
} else {
|
|
1189
|
+
mountToolbar();
|
|
1190
|
+
}
|
|
1191
|
+
})();
|