sparkforensics-server 0.2.0 → 0.2.2
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/index.js +1 -1
- package/lib/static-files.js +5 -4
- package/package.json +4 -3
- package/public/assets/AutoscalingChurn-B96FKx97.js +1 -0
- package/public/assets/CacheUtilization-lKua3J1x.js +1 -0
- package/public/assets/CachingOpportunity-U0g-8HPV.js +1 -0
- package/public/assets/ColdStart-w8QYTNKo.js +1 -0
- package/public/assets/ConfigAudit-ClZp5BpV.js +1 -0
- package/public/assets/CoreUsageArea-o3kqQwyi.js +1 -0
- package/public/assets/Dashboard-Bjl-MYMm.js +1 -0
- package/public/assets/DuplicatePlanSubtree-Cm_UU3lY.js +1 -0
- package/public/assets/DurationHistogram-ltF-7M0A.js +1 -0
- package/public/assets/EmptyState-BCA3xioa.js +1 -0
- package/public/assets/ExecutorUtilization-Cn69i0uq.js +1 -0
- package/public/assets/GcPressure-CYsmU1d7.js +1 -0
- package/public/assets/ImpactEstimate-BGt-4WX5.js +1 -0
- package/public/assets/IncompleteRun-s6uQ8OLf.js +1 -0
- package/public/assets/JobFailures-DJ2dDvPA.js +1 -0
- package/public/assets/MemoryUtilization-C9G7P94X.js +1 -0
- package/public/assets/OverBroadcast-DYauoYWQ.js +1 -0
- package/public/assets/PartitionSizing-Cz_B0-uG.js +1 -0
- package/public/assets/PlanExplorer-_2oB5ouy.js +1 -0
- package/public/assets/PlanGraphRoute-Cj-GWM8W.js +1 -0
- package/public/assets/RetryWaste-D_m8ASwP.js +1 -0
- package/public/assets/RowPagination-BLsm8I6i.js +1 -0
- package/public/assets/ShuffleIO-pyDhxdaz.js +1 -0
- package/public/assets/Skew-BGLJuZZR.js +1 -0
- package/public/assets/SlowHost-ChdWVvGO.js +1 -0
- package/public/assets/SmallFiles-gTilBtjW.js +1 -0
- package/public/assets/SpeculationWaste-CVzgJnSj.js +1 -0
- package/public/assets/Spill-NGJGQaTB.js +1 -0
- package/public/assets/StageFailed-sGhki53z.js +1 -0
- package/public/assets/StageFindingGroup-AyI7BMd3.js +1 -0
- package/public/assets/StageHeader-BTzGkK8k.js +1 -0
- package/public/assets/StagePill-BlMOW_pU.js +1 -0
- package/public/assets/StageShape-DfOW93Z1.js +1 -0
- package/public/assets/StageSlowness-BMZ-K_5e.js +1 -0
- package/public/assets/Straggler-dffcAN7t.js +1 -0
- package/public/assets/TaskFailures-DGDwUK2A.js +1 -0
- package/public/assets/TinyTask-CfT8zZDr.js +1 -0
- package/public/assets/UnderBroadcast-CiOiJ0k1.js +1 -0
- package/public/assets/WidgetLeadSummary-BdUUi7L5.js +1 -0
- package/public/assets/charts-vendor-0VMaLVLN.js +59 -0
- package/public/assets/downsample-WmNM1qc9.js +1 -0
- package/public/assets/finding-anchor-DEV8JvgH.js +1 -0
- package/public/assets/impact-sort-DxaUheWV.js +1 -0
- package/public/assets/inbox-_QCYkBsP.js +1 -0
- package/public/assets/index-3vlFVNCg.js +9 -0
- package/public/assets/index-CjVklAdW.css +2 -0
- package/public/assets/parser-worker-B2bc0lWe.js +112 -0
- package/public/assets/plan-graph-vendor-B0sEms9Z.js +7 -0
- package/public/assets/plan-graph-vendor-DLioOiRN.css +1 -0
- package/public/assets/react-vendor-D2TLlSzI.js +9 -0
- package/public/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/public/assets/select-kuy1MiAo.js +1 -0
- package/public/assets/toggle-group-CUd-KWkp.js +1 -0
- package/public/assets/usePagedRows-jNUWgVTD.js +1 -0
- package/public/assets/useRecentFiles-D0OA_EOK.js +11 -0
- package/public/assets/useSortMode-BaeAA5cw.js +1 -0
- package/public/docs/404.html +3 -3
- package/public/docs/assets/{app.BgzsaTS3.js → app.APoq_UBs.js} +1 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.CvM5fuxe.js +1 -0
- package/public/docs/assets/chunks/{VPLocalSearchBox.DOq3t-On.js → VPLocalSearchBox.B3TPzlHq.js} +1 -1
- package/public/docs/assets/chunks/theme.PavXO_vz.js +2 -0
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.CWpj01WU.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.CWpj01WU.lean.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_detector-contract.md.CgzUsQ6W.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DYCDPgkh.js → contributor-guide_architecture_impact-estimation.md.CooslVJt.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.R27gQrgY.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.IbnfNrV3.js +6 -0
- package/public/docs/assets/{style.DXOMCXxn.css → style.DSixAiZE.css} +1 -1
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.js → user-guide_alternative-log-retrieval.md.B4tPGIal.js} +1 -1
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.lean.js → user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js} +1 -1
- package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +3 -0
- package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.lean.js +1 -0
- package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.js → user-guide_mcp-tools.md.Vi3RoflJ.js} +3 -3
- package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.lean.js → user-guide_mcp-tools.md.Vi3RoflJ.lean.js} +1 -1
- package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.js +1 -0
- package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.lean.js +1 -0
- package/public/docs/assets/user-guide_understanding-findings.md.DL1UDhvR.js +1 -0
- package/public/docs/assets/user-guide_understanding-findings.md.DL1UDhvR.lean.js +1 -0
- package/public/docs/contributor-guide/architecture/board-widgets.html +6 -6
- package/public/docs/contributor-guide/architecture/detector-contract.html +6 -6
- package/public/docs/contributor-guide/architecture/drill-down.html +4 -4
- package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -6
- package/public/docs/contributor-guide/architecture/index.html +4 -4
- package/public/docs/contributor-guide/architecture/overview.html +4 -4
- package/public/docs/contributor-guide/architecture/state-and-history.html +6 -6
- package/public/docs/contributor-guide/architecture/widget-rendering.html +6 -6
- package/public/docs/contributor-guide/architecture/worker-protocol.html +6 -6
- package/public/docs/contributor-guide/contributing.html +4 -4
- package/public/docs/contributor-guide/development-setup.html +4 -4
- package/public/docs/contributor-guide/testing.html +4 -4
- package/public/docs/hashmap.json +1 -1
- package/public/docs/index.html +4 -4
- package/public/docs/tuning-reference/anti-patterns.html +4 -4
- package/public/docs/tuning-reference/aqe.html +4 -4
- package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -4
- package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -4
- package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -4
- package/public/docs/tuning-reference/bottleneck-failures.html +4 -4
- package/public/docs/tuning-reference/bottleneck-gc.html +4 -4
- package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -4
- package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -4
- package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -4
- package/public/docs/tuning-reference/bottleneck-shuffle.html +4 -4
- package/public/docs/tuning-reference/bottleneck-skew.html +4 -4
- package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -4
- package/public/docs/tuning-reference/bottleneck-small-files.html +4 -4
- package/public/docs/tuning-reference/bottleneck-spill.html +4 -4
- package/public/docs/tuning-reference/bottleneck-straggler.html +4 -4
- package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +4 -4
- package/public/docs/tuning-reference/bottleneck-utilization.html +4 -4
- package/public/docs/tuning-reference/caching.html +4 -4
- package/public/docs/tuning-reference/cluster-config.html +4 -4
- package/public/docs/tuning-reference/config.html +4 -4
- package/public/docs/tuning-reference/data-formats.html +4 -4
- package/public/docs/tuning-reference/index.html +4 -4
- package/public/docs/tuning-reference/intro.html +4 -4
- package/public/docs/tuning-reference/joins.html +4 -4
- package/public/docs/tuning-reference/memory-model.html +4 -4
- package/public/docs/tuning-reference/metrics.html +4 -4
- package/public/docs/tuning-reference/partitioning.html +4 -4
- package/public/docs/tuning-reference/pyspark.html +4 -4
- package/public/docs/tuning-reference/shuffle.html +4 -4
- package/public/docs/tuning-reference/spark-architecture.html +4 -4
- package/public/docs/tuning-reference/table-formats.html +4 -4
- package/public/docs/user-guide/alternative-log-retrieval.html +6 -6
- package/public/docs/user-guide/getting-started.html +7 -7
- package/public/docs/user-guide/mcp-tools.html +8 -8
- package/public/docs/user-guide/run-comparison.html +6 -6
- package/public/docs/user-guide/understanding-findings.html +6 -6
- package/public/index.html +7 -6
- package/public/sample-runs/sample-run.ndjson.gz +0 -0
- package/vendor-core/detectors.js +149 -24
- package/vendor-core/docs-content/detection/cache.md +4 -3
- package/vendor-core/docs-content/detection/chrn.md +4 -2
- package/vendor-core/docs-content/detection/local.md +2 -3
- package/vendor-core/docs-content/detection/mem.md +3 -3
- package/vendor-core/docs-content/detection/spec.md +4 -3
- package/vendor-core/evidence-report.js +1 -1
- package/vendor-core/parser-worker.js +2 -2
- package/vendor-core/run-comparison.js +21 -2
- package/public/assets/AutoscalingChurn-CFJkiqxW.js +0 -1
- package/public/assets/CacheUtilization-kTKZBzDA.js +0 -1
- package/public/assets/CachingOpportunity-CU70EWcF.js +0 -1
- package/public/assets/ColdStart-hOI-WOvm.js +0 -1
- package/public/assets/ConfigAudit-B4oAksZY.js +0 -1
- package/public/assets/CoreUsageArea-D-dR3SQk.js +0 -1
- package/public/assets/Dashboard-MDhohsq4.js +0 -4
- package/public/assets/DuplicatePlanSubtree-54RKsfI7.js +0 -1
- package/public/assets/DurationHistogram-CviQyPNM.js +0 -1
- package/public/assets/EmptyState-v2ehFncc.js +0 -1
- package/public/assets/ExecutorUtilization-vHyFHgL6.js +0 -1
- package/public/assets/GcPressure-DINuhcno.js +0 -1
- package/public/assets/ImpactEstimate-C6GzFOY9.js +0 -1
- package/public/assets/IncompleteRun-a1kuCnU6.js +0 -1
- package/public/assets/JobFailures-CYwPfUhR.js +0 -1
- package/public/assets/MemoryUtilization-Dlfj0e_f.js +0 -1
- package/public/assets/OverBroadcast-BMu7Y8l9.js +0 -1
- package/public/assets/PartitionSizing-CvMGfSVB.js +0 -1
- package/public/assets/PlanExplorer-xYFme_Rx.js +0 -1
- package/public/assets/PlanGraphRoute-a3OGg6ET.js +0 -1
- package/public/assets/RetryWaste-JKRjOZ-J.js +0 -1
- package/public/assets/RowPagination-DypWbnic.js +0 -1
- package/public/assets/ShuffleIO-Mi8HiVu-.js +0 -1
- package/public/assets/Skew-C3iOScTC.js +0 -1
- package/public/assets/SlowHost-DKBg18v-.js +0 -1
- package/public/assets/SmallFiles-CCCB6AIu.js +0 -1
- package/public/assets/SpeculationWaste-DUNupw0_.js +0 -1
- package/public/assets/Spill-BlLdatik.js +0 -1
- package/public/assets/StageFailed-qtY7C7Yo.js +0 -1
- package/public/assets/StageFindingGroup-CoVdEZYs.js +0 -1
- package/public/assets/StageHeader-uDBLHgdg.js +0 -1
- package/public/assets/StagePill-CYCMdlIx.js +0 -1
- package/public/assets/StageShape-zs0mAjQJ.js +0 -1
- package/public/assets/StageSlowness-C7vg0u5Q.js +0 -1
- package/public/assets/Straggler-4BRGAQP4.js +0 -1
- package/public/assets/TaskFailures-CSjO23Kg.js +0 -1
- package/public/assets/TinyTask-6Zuovcn5.js +0 -1
- package/public/assets/UnderBroadcast-CePjo0ZV.js +0 -1
- package/public/assets/WidgetLeadSummary-DRNRVvn7.js +0 -1
- package/public/assets/charts-vendor-Cf1-wzeH.js +0 -59
- package/public/assets/downsample-D8XmJk6i.js +0 -1
- package/public/assets/finding-anchor-4TmpXd7j.js +0 -1
- package/public/assets/impact-sort-Cq6KOLqh.js +0 -1
- package/public/assets/inbox-DBFovbUX.js +0 -1
- package/public/assets/index-CHjV2-jB.js +0 -9
- package/public/assets/index-DMEtaP4u.css +0 -1
- package/public/assets/parser-worker-BMPPE37w.js +0 -64
- package/public/assets/plan-graph-vendor-B96a-e4N.js +0 -7
- package/public/assets/plan-graph-vendor-BnuhLJ6X.css +0 -1
- package/public/assets/react-vendor-DA6opS-q.js +0 -9
- package/public/assets/select-D5fK-za0.js +0 -1
- package/public/assets/toggle-group-lbIXRG0W.js +0 -1
- package/public/assets/usePagedRows-CFoZrPr4.js +0 -1
- package/public/assets/useRecentFiles-BPGQ6XII.js +0 -13
- package/public/assets/useSortMode-BOPpfLhJ.js +0 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.PQ5JepCp.js +0 -1
- package/public/docs/assets/chunks/theme.BP14rGBx.js +0 -2
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_detector-contract.md.BOeH4d1J.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DbqPf2OT.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.B93qJ_tT.js +0 -6
- package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.js +0 -3
- package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.lean.js +0 -1
- package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.js +0 -1
- package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.lean.js +0 -1
- package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.js +0 -1
- package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.lean.js +0 -1
- /package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.BOeH4d1J.lean.js → contributor-guide_architecture_detector-contract.md.CgzUsQ6W.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DYCDPgkh.lean.js → contributor-guide_architecture_impact-estimation.md.CooslVJt.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_widget-rendering.md.DbqPf2OT.lean.js → contributor-guide_architecture_widget-rendering.md.R27gQrgY.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.B93qJ_tT.lean.js → contributor-guide_architecture_worker-protocol.md.IbnfNrV3.lean.js} +0 -0
package/index.js
CHANGED
|
@@ -85,7 +85,7 @@ export function createServer({
|
|
|
85
85
|
await serveStatic(req, res, root);
|
|
86
86
|
}
|
|
87
87
|
} catch (err) {
|
|
88
|
-
console.error(
|
|
88
|
+
console.error('[server] %s %s failed:', req.method, req.url, err?.stack ?? err);
|
|
89
89
|
if (!res.headersSent) res.writeHead(500, { 'content-type': 'text/plain' });
|
|
90
90
|
res.end(`Internal server error: ${err.message}`);
|
|
91
91
|
}
|
package/lib/static-files.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { join,
|
|
3
|
+
import { join, resolve, sep, extname } from 'node:path';
|
|
4
4
|
|
|
5
5
|
const CONTENT_TYPES = {
|
|
6
6
|
'.html': 'text/html; charset=utf-8',
|
|
@@ -29,11 +29,12 @@ export async function serveStatic(req, res, root) {
|
|
|
29
29
|
// Any directory-style request (trailing slash, including '/' itself) seeks
|
|
30
30
|
// that directory's index.html, same as a browser navigating to it directly.
|
|
31
31
|
const relative = pathname.endsWith('/') ? `${stripped}index.html` : stripped;
|
|
32
|
-
const
|
|
32
|
+
const safeRoot = resolve(root);
|
|
33
|
+
const target = resolve(safeRoot, relative);
|
|
33
34
|
|
|
34
35
|
// Path-traversal guard: the resolved path must stay within root.
|
|
35
|
-
const rootPrefix =
|
|
36
|
-
if (target !==
|
|
36
|
+
const rootPrefix = safeRoot + sep;
|
|
37
|
+
if (target !== safeRoot && !target.startsWith(rootPrefix)) {
|
|
37
38
|
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
|
|
38
39
|
res.end('Forbidden');
|
|
39
40
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sparkforensics-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Local companion server for the SparkForensics dashboard: serves the app and proxies Spark History Server fetches to avoid browser CORS restrictions.",
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "vitest run",
|
|
38
|
+
"test:coverage": "vitest run --coverage",
|
|
38
39
|
"prepack": "node ../../scripts/vendor-core.mjs . && node scripts/copy-frontend.js"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
42
|
-
"zod": "^4.
|
|
43
|
+
"zod": "^4.6.5"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"vitest": "^
|
|
46
|
+
"vitest": "^5.0.1"
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,T as n,f as r,l as i,o as a,s as o,t as s,v as c,w as l}from"./charts-vendor-0VMaLVLN.js";import{p as u}from"./plan-graph-vendor-B0sEms9Z.js";import{T as d,w as f}from"./useRecentFiles-D0OA_EOK.js";import{A as p,D as m,O as h,i as g}from"./index-3vlFVNCg.js";import{t as _}from"./downsample-WmNM1qc9.js";import{t as v}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as y}from"./ImpactEstimate-BGt-4WX5.js";var b=e(t(),1),x=u(),S=60,C=6e4,w=220;function T(e,t,n,r,i){if(e.length===0&&t.length===0)return[];let a=Math.max(i,r-n),o=Math.max(1,Math.ceil(a/i)),s=[];for(let e=0;e<o;e++)s.push({tStart:n+e*i,adds:0,removes:0});let c=e=>Math.min(o-1,Math.max(0,Math.floor((e-n)/i)));for(let t of e)s[c(t.timestamp)].adds++;for(let e of t)s[c(e.timestamp)].removes++;return s}function E(e,t){let n=Math.max(1,t-e);return Math.max(C,Math.ceil(n/S))}function D(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function O(e){let t=D(e.reduce((e,t)=>Math.max(e,Math.abs(t.added),Math.abs(t.removed)),0));return{domain:[-t,t],ticks:[-t,-t/2,0,t/2,t]}}function k(e){return Math.abs(e.height)<1?null:(0,x.jsx)(l,{...e})}function A({finding:e}){return(0,x.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Short-lived executors: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]})]}),(0,x.jsx)(y,{finding:e}),(0,x.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,x.jsx)(m,{impactBand:e.impactBand,className:`mt-1.5`}),(0,x.jsxs)(`span`,{children:[e.recommendation,` `,(0,x.jsx)(p,{anchor:`#config-autoscale-bounds`,children:`Tuning executorIdleTimeout and the min/max bounds`}),`.`]})]})]})}var j=(0,b.memo)(function({appModel:e,activeFileId:t,catalog:l=[],defaultCollapsed:u=!0}){let p=(0,b.useMemo)(()=>{let t=e.executors.added,n=e.executors.removed;if(t.length===0&&n.length===0)return{hasEvents:!1,added:t,removed:n};let r=e.app,i=r?.startTime??0,a=r?.endTime??i,o=E(i,a),s=_(T(t,n,i,a,o)).map(e=>({t:`${Math.round((e.tStart-i)/1e3)}s`,added:e.adds,removed:-e.removes}));return{hasEvents:!0,added:t,removed:n,rows:s,yAxisScale:O(s)}},[e,t]);if(!p.hasEvents)return(0,x.jsx)(g,{title:`Autoscaling Churn`,summary:(0,x.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`No executor add/remove events (static allocation).`}),children:(0,x.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No executor add/remove events (static allocation).`})});let{added:m,removed:y,rows:S,yAxisScale:C}=p,D=l.find(e=>e.type===`autoscalingChurn`);return(0,x.jsx)(g,{title:`Autoscaling Churn`,impactBand:D?.impactBand,badges:D&&(0,x.jsx)(h,{type:`autoscalingChurn`,impactBand:D.impactBand}),defaultCollapsed:u,summary:(0,x.jsx)(v,{value:`${m.length} added / ${y.length} removed`,context:D?`${D.value}% short-lived executors, ${D.impactBand}`:`executor churn events`}),children:(0,x.jsxs)(`div`,{className:`space-y-2`,children:[D&&(0,x.jsx)(A,{finding:D}),(0,x.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`executors added / removed over time`}),(0,x.jsx)(d,{ariaLabel:`Executor added and removed counts per time bucket over the run.`,height:w,table:{caption:`Executor added/removed counts by time bucket`,columns:[`Time`,`Executors added`,`Executors removed`],rows:S.map(e=>[e.t,e.added,Math.abs(e.removed)]),align:[`right`,`right`,`right`]},children:(0,x.jsxs)(s,{data:S,children:[(0,x.jsx)(r,{stroke:f.muted,strokeOpacity:.2}),(0,x.jsx)(o,{dataKey:`t`,tick:{fontSize:10}}),(0,x.jsx)(a,{tick:{fontSize:10},width:32,domain:C.domain,ticks:C.ticks}),(0,x.jsx)(c,{formatter:(e,t)=>[Math.abs(Number(e)),t]}),(0,x.jsx)(n,{wrapperStyle:{fontSize:10}}),(0,x.jsx)(i,{dataKey:`added`,name:`Added`,stackId:`churn`,fill:f.clean,shape:k}),(0,x.jsx)(i,{dataKey:`removed`,name:`Removed`,stackId:`churn`,fill:f.muted,shape:k})]})})]})})});export{j as AutoscalingChurn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{A as r,D as i,O as a,_ as o,at as s,b as c,ft as l,h as u,ht as d,i as f,k as p,l as m,lt as h,m as g,mt as _,v,y,yt as b}from"./index-3vlFVNCg.js";import{t as x}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as S}from"./ImpactEstimate-BGt-4WX5.js";import{t as C}from"./RowPagination-BLsm8I6i.js";import{n as w}from"./finding-anchor-DEV8JvgH.js";import{t as T}from"./usePagedRows-jNUWgVTD.js";var E=e(t(),1),D=n(),O=70;function k(e){if(!e)return`—`;let t=[];return e.useMemory&&t.push(`Memory`),e.useDisk&&t.push(`Disk`),e.deserialized?t.push(`Deserialized`):(e.useMemory||e.useDisk)&&t.push(`Serialized`),(e.replication??1)>1&&t.push(`x${e.replication}`),t.join(` · `)||`—`}function A(e){return e.name||`RDD ${e.id}`}function j(e){let t=d(A(e));return t.length<=O?t:`${t.slice(0,O)}…`}function M(e){let t=l(`pct`,_(e));return e.variant===`diskSpillover`?`${t} spilled to disk: ${h(e.diskSize??0)} disk / ${h(e.memorySize??0)} memory`:`${t} cached (${e.numCachedPartitions??0}/${e.numPartitions??0} partitions)`}function N({finding:e}){let t=w([e]),n=e.rddName??`RDD ${e.rddId}`;return(0,D.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[(0,D.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,D.jsx)(i,{impactBand:e.impactBand,className:`mt-1.5`}),(0,D.jsx)(`span`,{children:n})]}),(0,D.jsx)(p,{children:(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(e)})}),(0,D.jsx)(S,{finding:e}),(0,D.jsx)(`p`,{className:`text-sm`,children:e.recommendation})]})}var P=(0,E.memo)(function({appModel:e,catalog:t}){let[n,l]=(0,E.useState)(0),[d,p]=(0,E.useState)(0),_=e.app?.rddInfo,S=(0,E.useMemo)(()=>_?[..._.values()].filter(e=>(e.storageLevel?.useMemory||e.storageLevel?.useDisk)&&(e.numCachedPartitions??0)>0).sort((e,t)=>(t.memorySize??0)+(t.diskSize??0)-((e.memorySize??0)+(e.diskSize??0))):[],[_]),w=(0,E.useMemo)(()=>t.filter(e=>e.type===`cacheUtilization`).sort((e,t)=>s[e.impactBand]-s[t.impactBand]),[t]),O=T(S,n,l),M=m(),P=M?w.findIndex(e=>e===M.finding):null,F=T(w,d,p,P);if(S.length===0)return null;let I=e=>w.filter(t=>t.rddId===e),L=S.reduce((e,t)=>e+(t.memorySize??0)+(t.diskSize??0),0);return(0,D.jsx)(`div`,{"data-widget":`cache-utilization`,children:(0,D.jsxs)(f,{title:`Cache Storage`,impactBand:b(w),badges:(0,D.jsxs)(D.Fragment,{children:[w.length>0?(0,D.jsx)(a,{type:`cacheUtilization`,impactBand:b(w)??`info`}):null,(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[S.length,` cached RDD`,S.length===1?``:`s`,`, see`,` `,(0,D.jsx)(r,{anchor:`#memory-model`,children:`how Spark accounts cached memory`})]})]}),defaultCollapsed:!0,summary:(0,D.jsx)(x,{value:h(L),context:`cached across memory + disk`}),children:[(0,D.jsxs)(g,{children:[(0,D.jsx)(y,{children:(0,D.jsxs)(c,{children:[(0,D.jsx)(v,{children:`RDD`}),(0,D.jsx)(v,{children:`Storage level`}),(0,D.jsx)(v,{className:`text-right`,children:`Cached partitions`}),(0,D.jsx)(v,{className:`text-right`,children:`Memory`}),(0,D.jsx)(v,{className:`text-right`,children:`Disk`})]})}),(0,D.jsx)(u,{children:O.visible.map(e=>{let t=A(e),n=j(e),r=I(e.id);return(0,D.jsxs)(c,{children:[(0,D.jsxs)(o,{className:`max-w-80 truncate`,title:t===n?void 0:t,children:[n,r.length>0&&(0,D.jsx)(i,{impactBand:b(r)??`info`,className:`ml-1.5`})]}),(0,D.jsx)(o,{children:k(e.storageLevel)}),(0,D.jsxs)(o,{className:`text-right`,children:[e.numCachedPartitions,` / `,e.numPartitions]}),(0,D.jsx)(o,{className:`text-right`,children:h(e.memorySize??0)}),(0,D.jsx)(o,{className:`text-right`,children:h(e.diskSize??0)})]},e.id)})})]}),(0,D.jsx)(C,{page:O.effectivePage,totalPages:O.totalPages,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)}),w.length>0?(0,D.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[F.visible.map(e=>(0,D.jsx)(N,{finding:e},e.id)),(0,D.jsx)(C,{page:F.effectivePage,totalPages:F.totalPages,onPrev:()=>p(e=>e-1),onNext:()=>p(e=>e+1)})]}):null]})})});export{P as CacheUtilization};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-D0OA_EOK.js";import{O as i,_ as a,b as o,h as s,i as c,j as l,k as u,kt as d,l as f,lt as p,m,v as h,y as g}from"./index-3vlFVNCg.js";import{t as _}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as v}from"./ImpactEstimate-BGt-4WX5.js";import{t as y}from"./RowPagination-BLsm8I6i.js";import{n as b}from"./finding-anchor-DEV8JvgH.js";import{t as x}from"./usePagedRows-jNUWgVTD.js";var S={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};S.node;var C=d(S),w=e(t(),1),T=n();function E({relations:e,operator:t}){let n=t===`union`?`union`:`join`;return(0,T.jsx)(`span`,{className:`inline-flex flex-wrap items-baseline`,children:e.map((e,t)=>(0,T.jsxs)(`span`,{children:[t>0?(0,T.jsxs)(T.Fragment,{children:[` `,(0,T.jsx)(`span`,{className:`mx-1 font-semibold uppercase text-xs tracking-wide text-primary`,children:n}),` `]}):null,e.relation]},e.relation))})}function D({finding:e}){let t=b([e]),n=e.variant===`composite`;return(0,T.jsxs)(o,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,T.jsx)(a,{children:(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n?(0,T.jsx)(C,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}):null,n&&e.relations&&e.relations.length>0?(0,T.jsx)(E,{relations:e.relations,operator:e.operator}):(0,T.jsx)(`span`,{children:e.relation}),n?(0,T.jsx)(l,{variant:`outline`,className:`text-xs uppercase border-dashed`,children:e.operator?.toUpperCase()}):(0,T.jsx)(l,{variant:`secondary`,className:`text-xs uppercase`,children:e.format})]})}),(0,T.jsxs)(a,{children:[e.value,` queries`]}),(0,T.jsx)(a,{className:`text-right`,children:p(e.totalReadBytes??0)}),(0,T.jsxs)(a,{children:[(0,T.jsx)(v,{finding:e}),(0,T.jsx)(`p`,{className:`mt-1`,children:e.recommendation}),(0,T.jsx)(u,{children:(0,T.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]})]})}var O=(0,w.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,r]=(0,w.useState)(0),a=(0,w.useMemo)(()=>e.filter(e=>e.type===`cachingOpportunity`).sort((e,t)=>(t.totalReadBytes??0)-(e.totalReadBytes??0)||(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0)),[e]),l=f(),d=l?a.findIndex(e=>e===l.finding):null,{totalPages:p,effectivePage:v,visible:b}=x(a,n,r,d);if(a.length===0)return null;let S=a[0];return(0,T.jsx)(c,{title:`Caching Opportunities`,impactBand:`info`,badges:(0,T.jsx)(i,{type:`cachingOpportunity`,impactBand:`info`}),defaultCollapsed:t,summary:(0,T.jsx)(_,{value:`${S.value}×`,context:`read by ${S.value} queries: ${S.relation}`}),children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(g,{children:(0,T.jsxs)(o,{children:[(0,T.jsx)(h,{children:`Relation`}),(0,T.jsx)(h,{children:`Read by`}),(0,T.jsx)(h,{className:`text-right`,children:`Data read`}),(0,T.jsx)(h,{children:`Recommendation`})]})}),(0,T.jsx)(s,{children:b.map((e,t)=>(0,T.jsx)(D,{finding:e},`${e.format}:${e.relation}:${(e.executionIds??[]).join(`,`)}:${t}`))})]}),(0,T.jsx)(u,{children:(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reuse is inferred from plan structure, not confirmed by execution. Verify before caching.`})}),(0,T.jsx)(y,{page:v,totalPages:p,onPrev:()=>r(e=>e-1),onNext:()=>r(e=>e+1)})]})})});export{O as CachingOpportunity};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,at as a,i as o,l as s}from"./index-3vlFVNCg.js";import{t as c}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as l}from"./ImpactEstimate-BGt-4WX5.js";import{t as u}from"./RowPagination-BLsm8I6i.js";import{r as d}from"./impact-sort-DxaUheWV.js";import{n as f}from"./finding-anchor-DEV8JvgH.js";import{t as p}from"./usePagedRows-jNUWgVTD.js";import{n as m,t as h}from"./useSortMode-BaeAA5cw.js";var g=e(t(),1),_=n();function v(e){return`${e.value}s`}function y({finding:e}){let t=f([e]);return(0,_.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 text-sm transition-colors ${t.flashClassName}`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,_.jsx)(r,{impactBand:e.impactBand}),(0,_.jsx)(`strong`,{children:v(e)})]}),(0,_.jsx)(l,{finding:e}),(0,_.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation})]})}var b=(0,g.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:r,orderBy:l}=h(),[f,b]=(0,g.useState)(!t),[x,S]=(0,g.useState)(0),C=e.filter(e=>e.type===`coldStart`).slice().sort((e,t)=>a[e.impactBand]-a[t.impactBand]),w=l(C,e=>[e],e=>e.stageId??null),T=s(),E=T?w.findIndex(e=>e===T.finding):null,{totalPages:D,effectivePage:O,visible:k}=p(w,x,S,E);return C.length===0?null:(0,_.jsxs)(o,{title:`Cold Start`,impactBand:C[0].impactBand,badges:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(i,{type:`coldStart`,impactBand:C[0].impactBand}),d(C,C.length,f)?(0,_.jsx)(m,{mode:n,onChange:r}):null]}),open:f,onOpenChange:b,summary:(0,_.jsx)(c,{value:v(C[0]),context:`${C.length} issue${C.length===1?``:`s`} flagged`}),children:[(0,_.jsx)(`ul`,{className:`space-y-2`,children:k.map(e=>(0,_.jsx)(y,{finding:e},e.id))}),(0,_.jsx)(u,{page:O,totalPages:D,onPrev:()=>S(e=>e-1),onNext:()=>S(e=>e+1)})]})});export{b as ColdStart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-D0OA_EOK.js";import{A as i,D as a,O as o,V as s,at as c,i as l,k as u,l as d,yt as f}from"./index-3vlFVNCg.js";import{t as p}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as m}from"./ImpactEstimate-BGt-4WX5.js";import{t as h}from"./RowPagination-BLsm8I6i.js";import{n as g}from"./finding-anchor-DEV8JvgH.js";import{t as _}from"./usePagedRows-jNUWgVTD.js";var v=e(t(),1),y=n();function b({finding:e}){let t=g([e]);return(0,y.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(a,{impactBand:e.impactBand}),(0,y.jsx)(`code`,{className:`text-xs`,children:e.property}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`=`}),(0,y.jsx)(`code`,{className:`rounded bg-accent/10 px-1.5 py-0.5 font-mono text-xs text-accent`,children:String(e.value)})]}),(0,y.jsx)(m,{finding:e}),(0,y.jsxs)(`p`,{className:`text-sm`,children:[e.recommendation,e.docAnchor?(0,y.jsxs)(y.Fragment,{children:[` `,(0,y.jsxs)(i,{anchor:e.docAnchor,children:[`Why `,e.property,` matters`]})]}):null]})]})}var x=(0,v.memo)(function({appModel:e,configFindings:t,defaultCollapsed:n=!0}){let[i,a]=(0,v.useState)(0),m=(0,v.useMemo)(()=>(t??s(e.app)).filter(e=>e.type===`configAudit`).slice().sort((e,t)=>c[e.impactBand]-c[t.impactBand]),[t,e]),g=d(),x=g?m.findIndex(e=>e===g.finding):null,{totalPages:S,effectivePage:C,visible:w}=_(m,i,a,x);if(m.length===0){let t=e.evidenceAvailability?.entries.find(e=>e.key===`sparkConfiguration`),n;if(t)n=t.state===`present`?`No misconfigurations detected.`:t.state===`unknown`&&t.reasonCode===`parseIncomplete`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`span`,{children:[t.summary,` `]}),(0,y.jsx)(u,{children:(0,y.jsx)(r,{evidenceKey:`sparkConfiguration`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,y.jsx)(u,{children:(0,y.jsx)(r,{evidenceKey:`sparkConfiguration`})})]});else{let t=e.app?.evidenceInputs;n=(t?t.environmentUpdates>0:Object.keys(e.app?.config??{}).length>0||e.app?.resources)?`No misconfigurations detected.`:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,y.jsx)(u,{children:(0,y.jsx)(r,{evidenceKey:`sparkConfiguration`})})]})}let i=(0,y.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:n});return(0,y.jsx)(l,{title:`Config Sanity`,compact:!0,summary:i,children:i})}let T=f(m);return(0,y.jsxs)(l,{title:`Config Sanity`,impactBand:T,badges:(0,y.jsx)(o,{type:`configAudit`,impactBand:T??`info`}),statusBadge:(0,y.jsx)(u,{children:(0,y.jsx)(r,{evidenceKey:`sparkConfiguration`})}),defaultCollapsed:n,summary:(0,y.jsx)(p,{value:`${m.length}`,context:`misconfiguration${m.length===1?``:`s`} flagged`}),children:[(0,y.jsx)(`ul`,{className:`space-y-4`,children:w.map(e=>(0,y.jsx)(b,{finding:e},e.id))}),(0,y.jsx)(h,{page:C,totalPages:S,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})});export{x as ConfigAudit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,T as n,f as r,n as i,o as a,s as o,u as s,v as c}from"./charts-vendor-0VMaLVLN.js";import{p as l}from"./plan-graph-vendor-B0sEms9Z.js";import{S as u,T as d,w as f}from"./useRecentFiles-D0OA_EOK.js";import{t as p}from"./inbox-_QCYkBsP.js";import{A as m,D as h,O as g,i as _,k as v,q as y}from"./index-3vlFVNCg.js";import{t as b}from"./EmptyState-BCA3xioa.js";import{t as x}from"./downsample-WmNM1qc9.js";import{t as S}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as C}from"./ImpactEstimate-BGt-4WX5.js";import{t as w}from"./RowPagination-BLsm8I6i.js";import{t as T}from"./usePagedRows-jNUWgVTD.js";var E=e(t(),1),D=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`];function O(e,{bucketWidthMs:t=6e4,tiers:n=D}={}){let r=e.filter(e=>(e.completedAt??0)>(e.submittedAt??0)&&(e.executorRunTime??0)>0);if(r.length===0)return{labels:[],series:{}};let i=r.reduce((e,t)=>Math.min(e,t.submittedAt??e),1/0),a=r.reduce((e,t)=>Math.max(e,t.completedAt??e),-1/0),o=Math.max(1,Math.ceil((a-i)/t)),s={};for(let e of n)s[e]=Array(o).fill(0);let c=Array(o).fill(0);for(let e of r){let n=e.completedAt??0,r=e.submittedAt??0,a=n-r,l=(e.executorRunTime??0)/a,u=(e.localityStats??[]).reduce((e,t)=>e+t.count,0)||1,d=new Map((e.localityStats??[]).map(e=>[e.locality,e.count/u]));for(let e=0;e<o;e++){let a=i+e*t,o=a+t,u=Math.min(n,o)-Math.max(r,a);if(u<=0)continue;let f=u/t;for(let[t,n]of d){let r=l*n*f;s[t]?s[t][e]+=r:c[e]+=r}}}c.some(e=>e>0)&&(s.OTHER=c);let l=Array(o).fill(0);for(let e of Object.keys(s))for(let t=0;t<o;t++)l[t]+=s[e][t];let u=l.reduce((e,t)=>Math.max(e,t),0);s.idle=l.map(e=>Math.max(0,u-e));let d=[];for(let e=0;e<o;e++)d.push(i+e*t);return{labels:d,series:s}}var k=l(),A=240,j=60,M={PROCESS_LOCAL:`Process-local`,NODE_LOCAL:`Node-local`,RACK_LOCAL:`Rack-local`,NO_PREF:`No preference`,ANY:`Any`,OTHER:`Other`,idle:`Idle`},N={PROCESS_LOCAL:f.clean,NODE_LOCAL:f.accent,RACK_LOCAL:f.warning,NO_PREF:f.muted,ANY:f.critical,OTHER:f.muted,idle:f.muted},P=`Core Usage by Locality`,F=(0,E.memo)(function({appModel:e,catalog:t,activeFileId:l,defaultCollapsed:F=!0}){let[I,L]=(0,E.useState)(0),R=(0,E.useMemo)(()=>{let t=[...e.stages.values()];if(!t.some(e=>(e.executorRunTime??0)>0&&(e.completedAt??0)>(e.submittedAt??0)))return{hasActivity:!1};let n=e.app,r=n?.startTime??0,i=n?.endTime??r,{labels:a,series:o}=O(t,{bucketWidthMs:Math.max(6e4,Math.ceil(Math.max(1,i-r)/j))}),s=[...D.filter(e=>o[e]),...o.OTHER?[`OTHER`]:[],`idle`],c=a.map((e,t)=>{let n={t:Math.round((e-r)/1e3)};for(let e of s)n[e]=o[e]?.[t]??0;return n}),l=x(c),u=s.filter(e=>e!==`idle`);return{hasActivity:!0,order:s,points:c,sampled:l,peakCores:c.reduce((e,t)=>Math.max(e,u.reduce((e,n)=>e+t[n],0)),0)}},[e,l]),z=(0,E.useMemo)(()=>y([...e.stages.values()],{topN:1/0}),[e,l]),B=t.find(e=>e.type===`coreLocality`),V=t.some(e=>e.type===`memoryUtilization`&&e.variant===`idleCores`),H=z.topStages.filter(e=>e.nonLocalTasks>0),{totalPages:U,effectivePage:W,visible:G}=T(H,I,L);if(!R.hasActivity)return(0,k.jsx)(_,{title:P,summary:(0,k.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`No stage activity to plot.`}),children:(0,k.jsx)(b,{tone:`neutral`,icon:p,title:`No stage activity to plot.`})});let{order:K,points:q,sampled:J,peakCores:Y}=R;return(0,k.jsx)(_,{title:P,impactBand:B?.impactBand,badges:B?(0,k.jsx)(g,{type:`coreLocality`,impactBand:B.impactBand}):null,defaultCollapsed:F,summary:(0,k.jsx)(S,{value:`${Math.round(Y)} cores`,context:`peak concurrent, by locality`}),children:(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(v,{children:(0,k.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`approximate: stage-level attribution`,B?null:(0,k.jsxs)(k.Fragment,{children:[`, see `,(0,k.jsx)(m,{anchor:`#bottleneck-utilization`,children:`how utilization is measured`})]})]})}),B?(0,k.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,k.jsx)(h,{impactBand:B.impactBand,className:`mt-1.5`}),(0,k.jsxs)(`span`,{children:[(0,k.jsxs)(`strong`,{children:[B.value,`% non-local`]}),`: `,B.recommendation]})]}):null,B?(0,k.jsx)(C,{finding:B}):null,(0,k.jsx)(v,{children:B?(0,k.jsx)(u,{confidence:B.confidence,validationRequired:B.validationRequired}):null}),(0,k.jsx)(d,{ariaLabel:`Approximate concurrent core usage over time, stacked by task locality tier, with idle capacity shown. See the legend for tier colors.`,height:A,table:{caption:`Concurrent core usage over time by locality tier`,columns:[`Time (s)`,...K.map(e=>M[e]??e)],rows:q.map(e=>[e.t,...K.map(t=>Math.round(e[t]))]),align:Array.from({length:K.length+1},()=>`right`)},children:(0,k.jsxs)(i,{data:J,children:[(0,k.jsx)(r,{vertical:!1,stroke:f.muted,strokeOpacity:.2}),(0,k.jsx)(o,{dataKey:`t`,tick:{fontSize:10},label:{value:`seconds from app start`,position:`insideBottom`,offset:-2,fontSize:10}}),(0,k.jsx)(a,{tick:{fontSize:10},width:36,label:{value:`avg concurrent cores`,angle:-90,position:`insideLeft`,fontSize:10}}),(0,k.jsx)(c,{}),(0,k.jsx)(n,{wrapperStyle:{fontSize:10}}),K.map(e=>(0,k.jsx)(s,{type:`monotone`,dataKey:e,name:M[e]??e,stackId:`cores`,stroke:N[e]??f.muted,fill:N[e]??f.muted,fillOpacity:e===`idle`?.15:.8,isAnimationActive:!1},e))]})}),(0,k.jsx)(v,{children:G.length>0?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:G.map(e=>(0,k.jsxs)(`li`,{children:[`Stage `,e.stageId,`: `,Math.round(e.ratio*100),`% non-local (`,e.nonLocalTasks,`/`,e.taskCount,` tasks)`]},e.stageId))}),(0,k.jsx)(w,{page:W,totalPages:U,onPrev:()=>L(e=>e-1),onNext:()=>L(e=>e+1)})]}):null}),(0,k.jsx)(v,{children:V?(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Idle cores also flagged → see Memory Utilization widget`}):null})]})})});export{F as CoreUsageArea};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,M as n,O as r,T as i,_ as a,a as o,d as s,f as c,i as l,l as u,n as d,o as f,s as p,u as m,v as h}from"./charts-vendor-0VMaLVLN.js";import{A as g,D as _,E as v,O as y,P as b,k as x}from"./react-vendor-D2TLlSzI.js";import{p as S}from"./plan-graph-vendor-B0sEms9Z.js";import{A as C,B as ee,C as te,E as w,F as ne,H as re,I as T,L as E,M as ie,N as ae,O as oe,P as se,R as ce,S as D,T as O,V as le,_ as ue,a as k,b as de,d as fe,f as A,g as pe,h as me,i as he,j as ge,k as _e,l as ve,m as ye,n as be,o as xe,p as Se,r as Ce,s as we,t as Te,u as Ee,v as De,w as j,x as Oe,y as ke,z as Ae}from"./useRecentFiles-D0OA_EOK.js";import{t as je}from"./inbox-_QCYkBsP.js";import{A as Me,D as M,Dt as Ne,E as Pe,Et as Fe,Ft as Ie,G as Le,I as Re,It as N,J as ze,Mt as Be,N as Ve,Nt as He,O as Ue,Ot as We,P as Ge,Pt as Ke,T as qe,_ as P,_t as Je,a as Ye,at as Xe,b as F,bt as Ze,c as Qe,h as $e,ht as et,i as I,j as tt,k as L,kt as nt,lt as R,m as rt,n as it,o as at,ot,p as st,pt as ct,s as z,st as lt,ut as B,v as ut,vt as dt,w as ft,y as pt,yt as mt}from"./index-3vlFVNCg.js";import{t as ht}from"./EmptyState-BCA3xioa.js";import{n as gt,t as _t}from"./toggle-group-CUd-KWkp.js";import{n as vt,t as yt}from"./DurationHistogram-ltF-7M0A.js";import{t as bt}from"./downsample-WmNM1qc9.js";import{t as V}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as xt,t as St}from"./StagePill-BlMOW_pU.js";import{i as Ct,n as wt,r as Tt,t as Et}from"./ImpactEstimate-BGt-4WX5.js";import{t as Dt}from"./RowPagination-BLsm8I6i.js";var Ot={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Ot.node;var kt=nt(Ot),At={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};At.node;var jt=nt(At),Mt={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};Mt.node;var Nt=nt(Mt),Pt={name:`target`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};Pt.node;var Ft=nt(Pt),H=e(n(),1),It=[`critical`,`warning`,`info`];function Lt(){return{impactBands:new Set,types:new Set,stages:new Set}}function Rt(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function zt(e,t){return E(e,{impactBand:t.impactBands,type:t.types,stageId:t.stages})}function Bt(e,t){return e.filter(e=>zt(e,t))}function Vt(e,t){let n=new Set,r=new Set,i=new Set;for(let a of[...e,...t])n.add(a.impactBand),r.add(a.type),a.stageId!=null&&i.add(a.stageId);return{impactBands:It.filter(e=>n.has(e)),types:[...r].sort(),stages:[...i].sort((e,t)=>e-t)}}function Ht(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function Ut(e,t){let n=new URLSearchParams(e),r=Lt();for(let e of Ht(n.get(`impact`)))It.includes(e)&&r.impactBands.add(e);let i=new Set(t.types);for(let e of Ht(n.get(`type`)))i.has(e)&&r.types.add(e);for(let e of Ht(n.get(`stage`))){let t=Number(e);Number.isInteger(t)&&r.stages.add(t)}return r}function Wt(e){let t=[];return e.impactBands.size&&t.push(`impact=${It.filter(t=>e.impactBands.has(t)).join(`,`)}`),e.types.size&&t.push(`type=${[...e.types].sort().join(`,`)}`),e.stages.size&&t.push(`stage=${[...e.stages].sort((e,t)=>e-t).join(`,`)}`),t.length?`?${t.join(`&`)}`:``}var U=S(),Gt=(0,H.createContext)(null);function Kt(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function qt({options:e,fileId:t,children:n}){let[r,i]=(0,H.useState)(()=>Ut(typeof window>`u`?``:window.location.search,e));(0,H.useEffect)(()=>{if(typeof window>`u`)return;let e=Wt(r),t=`${window.location.pathname}${e}${window.location.hash}`;window.history.replaceState(window.history.state,``,t)},[r]);let a=(0,H.useRef)(t);(0,H.useEffect)(()=>{a.current!==t&&(a.current=t,i(Lt()))},[t]),(0,H.useEffect)(()=>()=>{if(typeof window>`u`)return;let e=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,``,e)},[]),(0,H.useEffect)(()=>{if(typeof window>`u`)return;let t=()=>i(Ut(window.location.search,e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,H.useCallback)(e=>i(t=>({...t,impactBands:Kt(t.impactBands,e)})),[]),s=(0,H.useCallback)(e=>i(t=>({...t,types:Kt(t.types,e)})),[]),c=(0,H.useCallback)(e=>i(t=>({...t,stages:Kt(t.stages,e)})),[]),l=(0,H.useCallback)(()=>i(Lt()),[]),u=(0,H.useMemo)(()=>({selection:r,toggleImpactBand:o,toggleType:s,toggleStage:c,clearAll:l}),[r,o,s,c,l]);return(0,U.jsx)(Gt.Provider,{value:u,children:n})}function Jt(){let e=(0,H.useContext)(Gt);if(!e)throw Error(`useFindingFilter outside FindingFilterProvider`);return e}function Yt(){let{clearAll:e}=Jt();return(0,U.jsx)(ht,{icon:Nt,title:`No findings match the active filters`,description:`Adjust or clear the filters to see findings.`,action:(0,U.jsx)(`button`,{type:`button`,onClick:e,className:`cursor-pointer text-sm underline`,children:`Clear all filters`})})}function Xt({className:e,orientation:t=`horizontal`,...n}){return(0,U.jsx)(b,{"data-slot":`separator`,orientation:t,className:N(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var Zt={critical:`aria-pressed:bg-critical/10 aria-pressed:text-critical`,warning:`aria-pressed:bg-warning/10 aria-pressed:text-warning`,info:`aria-pressed:bg-info/10 aria-pressed:text-info`};function Qt(e,t,n){let r=new Set(e);for(let e of r)t.has(e)||n(e);for(let e of t)r.has(e)||n(e)}function $t({label:e,count:t,children:n}){return(0,U.jsxs)(_e,{children:[(0,U.jsxs)(ie,{className:N(Ge({variant:`outline`,size:`sm`}),`gap-1.5`),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,t>0&&(0,U.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-xs font-medium text-primary-foreground`,children:t}),(0,U.jsx)(We,{"aria-hidden":`true`,className:`opacity-60`})]}),(0,U.jsx)(ge,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:n})]})}function en({options:e,resultCount:t}){let{selection:n,toggleImpactBand:r,toggleType:i,toggleStage:a,clearAll:o}=Jt(),[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(``),d=(0,H.useMemo)(()=>{let t=s.trim();return t?e.stages.filter(e=>String(e).includes(t)):e.stages},[e.stages,s]),f=(0,H.useMemo)(()=>{let t=l.trim().toLowerCase();return t?e.types.filter(e=>e.toLowerCase().includes(t)||dt(e).toLowerCase().includes(t)):e.types},[e.types,l]);if(e.impactBands.length===0&&e.types.length===0&&e.stages.length===0)return null;let p=!Rt(n),m=[...[...n.impactBands].map(e=>({key:`impact-${e}`,label:`impact ${e}`,onRemove:()=>r(e)})),...[...n.types].map(e=>({key:`type-${e}`,label:`type ${e}`,onRemove:()=>i(e)})),...[...n.stages].map(e=>({key:`stage-${e}`,label:`stage ${e}`,onRemove:()=>a(e)}))];return(0,U.jsxs)(`section`,{"aria-label":`Filter findings`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border/60 p-2`,children:[(0,U.jsxs)(`span`,{title:`Narrow the whole dashboard to findings matching the chosen impact bands, types, or stages`,className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,U.jsx)(jt,{"aria-hidden":`true`,className:`size-3.5`}),`Filter findings`]}),(0,U.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:p?`${t} finding${t===1?``:`s`} match${t===1?`es`:``} the active filters`:`Showing all ${t} finding${t===1?``:`s`}`}),(0,U.jsx)(Xt,{orientation:`vertical`,className:`h-6`}),e.impactBands.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Impact`}),(0,U.jsx)(_t,{multiple:!0,"aria-label":`Filter by impact`,value:[...n.impactBands],onValueChange:e=>Qt(e,n.impactBands,r),children:e.impactBands.map(e=>(0,U.jsxs)(gt,{value:e,variant:`outline`,size:`sm`,"aria-label":`Filter by impact: ${e}`,className:N(`tap-target-comfortable gap-1.5`,Zt[e]),children:[(0,U.jsx)(M,{impactBand:e}),e]},e))})]}),e.types.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xt,{orientation:`vertical`,className:`h-6`}),(0,U.jsxs)($t,{label:`Type`,count:n.types.size,children:[(0,U.jsx)(`div`,{className:`p-1`,children:(0,U.jsx)(oe,{type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search type…`,"aria-label":`Search types`,autoComplete:`off`,className:`h-8`})}),f.map(e=>(0,U.jsxs)(C,{checked:n.types.has(e),onCheckedChange:()=>i(e),"aria-label":`Filter by type: ${e}`,children:[(0,U.jsx)(`span`,{className:`rounded bg-muted px-1 text-xs font-medium text-foreground!`,children:dt(e)}),` `,e]},e)),f.length===0&&(0,U.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching type`})]})]}),e.stages.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xt,{orientation:`vertical`,className:`h-6`}),(0,U.jsxs)($t,{label:`Stage`,count:n.stages.size,children:[(0,U.jsx)(`div`,{className:`p-1`,children:(0,U.jsx)(oe,{type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search stage id…`,"aria-label":`Search stages`,autoComplete:`off`,className:`h-8`})}),d.map(e=>(0,U.jsxs)(C,{checked:n.stages.has(e),onCheckedChange:()=>a(e),"aria-label":`Filter by stage: ${e}`,children:[`Stage `,e]},e)),d.length===0&&(0,U.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching stage`})]})]}),p&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xt,{orientation:`vertical`,className:`h-6`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:e.onRemove,"aria-label":`Remove filter: ${e.label}`,className:`tap-target-comfortable inline-flex cursor-pointer items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs hover:bg-muted/70`,children:[e.label,` `,(0,U.jsx)(Ze,{"aria-hidden":`true`,className:`size-3`})]},e.key)),(0,U.jsx)(`button`,{type:`button`,onClick:o,className:`tap-target-comfortable cursor-pointer text-xs underline`,children:`Clear all filters`})]})]})]})}function tn(e,t){let n=[];for(let{launch:t,finish:r}of e)r>t&&(n.push({t,delta:1}),n.push({t:r,delta:-1}));n.sort((e,t)=>e.t-t.t||e.delta-t.delta);let r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e];i+=a.delta;let o=n[e+1];if(!o||o.t===a.t)continue;let s=t==null?i:Math.min(i,t);r.push({tStart:a.t,tEnd:o.t,busy:s})}return r}function nn(e,{bucketBy:t=`time`,bucketWidthMs:n=1e3,hypotheticalCores:r=null}={}){let i=tn(e,r);if(t===`coreCount`){let e=[];for(let t of i)e[t.busy]=(e[t.busy]??0)+(t.tEnd-t.tStart);for(let t=0;t<e.length;t++)e[t]===void 0&&(e[t]=0);return{mode:`coreCount`,histogram:e}}if(i.length===0)return{mode:`time`,bucketWidthMs:n,startTime:null,endTime:null,buckets:[]};let a=i[0].tStart,o=i[i.length-1].tEnd,s=[];for(let e=a;e<o;e+=n){let t=e+n,r=0;for(let n of i){let i=Math.max(n.tStart,e),a=Math.min(n.tEnd,t);a>i&&(r+=n.busy*(a-i))}s.push({tStart:e,tEnd:t,busyCoreMs:r,avgBusyCores:r/n})}return{mode:`time`,bucketWidthMs:n,startTime:a,endTime:o,buckets:s}}var rn=220;async function an(e,t){let n=[...e.stages.keys()],r=await Promise.all(n.map(e=>t(e).catch(()=>null))),i=[],a=!1;for(let e of r){if(!e){a=!0;continue}let{metrics:t,fieldNames:n}=e,r=n.length,o=n.indexOf(`launchTime`),s=n.indexOf(`finishTime`);if(o!==-1&&s!==-1)for(let e=0;e<t.length;e+=r)i.push({launch:t[e+o],finish:t[e+s]})}return{intervals:i,incomplete:a}}function on({appModel:e,getTaskData:t}){let{exportMode:n,getTaskData:r}=vt(t),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(!1),[d,m]=(0,H.useState)(!1),h=e.stages.size>0;if((0,H.useEffect)(()=>{if(!h||!d||i!==null||!r)return;let t=!1;return an(e,r).then(({intervals:e,incomplete:n})=>{if(t)return;let{histogram:r}=nn(e,{bucketBy:`coreCount`});a(r??[]),s(n)}),()=>{t=!0}},[e,r,h,d,i]),!h)return null;let g=(i??[]).map((e,t)=>({cores:String(t),coreCount:t,ms:e})),_=bt(g),v=g.reduce((e,t)=>t.ms>e.ms?t:e,g[0]);return(0,U.jsx)(I,{title:`Core-Usage Distribution`,id:`core-usage-histogram`,open:d,onOpenChange:m,summary:i!==null&&v?(0,U.jsx)(V,{value:B(v.ms),context:`at ${v.coreCount} concurrent core${v.coreCount===1?``:`s`}`}):void 0,children:i===null?n?(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Core-usage detail isn’t included in exported reports.`}):(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading core usage…`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O,{ariaLabel:`Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.`,height:rn,table:{caption:`Wall-clock time by concurrent-core count`,columns:[`Concurrent cores`,`Time`],rows:i.map((e,t)=>[t,B(e)]),align:[`right`,`right`]},children:(0,U.jsxs)(l,{data:_,children:[(0,U.jsx)(c,{vertical:!1,stroke:j.muted,strokeOpacity:.2}),(0,U.jsx)(p,{dataKey:`cores`,tick:{fontSize:10},label:{value:`Concurrent busy cores`,position:`insideBottom`,offset:-5,fontSize:10}}),(0,U.jsx)(f,{tick:{fontSize:10},width:48,tickFormatter:e=>B(e)}),(0,U.jsx)(u,{dataKey:`ms`,name:`Time`,fill:j.accent})]})}),o?(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Reopen this file to compute full core usage because some task data was released.`}):null,(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`See `,(0,U.jsx)(Me,{anchor:`#bottleneck-utilization`,children:`how to read concurrent-core utilization`}),`.`]})]})})}function sn({app:e,stages:t,executorsAdded:n,runAggregates:r}){let i=ze(e??{},n),a=(e?.endTime??0)-(e?.startTime??0),o=Le(e,t),s=a/36e5*i,c=i*((o.startup+o.gaps+o.idle)/36e5),l=i*o.stagesActive,u=r?.busyCoreMs??0,d=Math.max(0,l-u)/36e5,f=c+d,p=s>0?Math.round(f/s*100):null,m=0,h=r?.perStage??{};for(let e of Object.keys(h))m+=h[e].totalTaskDurationSum;let g=i>0?m/i:0,_=null;return(c>0||d>0)&&(_=c>=d?`driver`:`executor`),{availableComputeHours:s,driverWasteHours:c,executorWasteHours:d,wastagePct:p,floorZeroSkewMs:g,dominantWaste:_}}function cn(e){let t=e?[...e.values()]:[],n=new Map,r=0;for(let e of t){if(e.submissionTime==null||e.completionTime==null)continue;let t=e.sqlExecutionId==null?`job:${e.id??r++}`:`sql:${e.sqlExecutionId}`,i=n.get(t);i?(i.start=Math.min(i.start,e.submissionTime),i.end=Math.max(i.end,e.completionTime)):n.set(t,{start:e.submissionTime,end:e.completionTime})}let i=[...n.entries()].sort((e,t)=>e[1].start-t[1].start),a=[];for(let e=1;e<i.length;e++)for(let t=0;t<e;t++){let[n,r]=i[t],[o,s]=i[e];s.start<r.end&&r.start<s.end&&a.push([n,o])}return{wallClockReliable:a.length===0,overlappingGroupIds:a}}var ln=`This estimate is derived from a simplified compute model; compare it against wall-clock data before acting on it.`,W=e=>`${Math.round(e*100)/100} core-h`;function un(){return(0,U.jsx)(L,{children:(0,U.jsx)(D,{confidence:`low`,validationRequired:ln})})}function dn({appModel:e}){if(!e.runAggregates)return null;let t=sn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});if(t.availableComputeHours<=0)return null;let n=cn(e.jobs),r=null;return t.dominantWaste===`driver`?r=(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:`Driver-bound waste dominates.`}),` Review driver sizing (spark.driver.memory / spark.driver.cores) before scaling executors.`]}):t.dominantWaste===`executor`&&(r=(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:`Executor-bound waste dominates.`}),` Review executor count / cores by reducing cluster size or enabling dynamic allocation.`]})),(0,U.jsx)(I,{title:`Compute Efficiency`,statusBadge:(0,U.jsx)(un,{}),defaultCollapsed:!0,summary:(0,U.jsx)(V,{value:t.wastagePct==null?W(t.availableComputeHours):`${t.wastagePct}% wasted`,context:`of ${W(t.availableComputeHours)} available`}),children:(0,U.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[!n.wallClockReliable&&(0,U.jsx)(L,{children:(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`This run used concurrent job groups: the driver/executor split below is approximate, not precise.`})}),(0,U.jsxs)(`p`,{children:[`Available: `,(0,U.jsx)(`strong`,{children:W(t.availableComputeHours)}),t.wastagePct!=null&&(0,U.jsxs)(U.Fragment,{children:[` `,`· wasted `,(0,U.jsxs)(`strong`,{children:[t.wastagePct,`%`]})]})]}),(0,U.jsxs)(`p`,{children:[(0,U.jsx)(M,{impactBand:`info`}),` Driver-bound waste: `,(0,U.jsx)(`strong`,{children:W(t.driverWasteHours)})]}),(0,U.jsxs)(`p`,{children:[(0,U.jsx)(M,{impactBand:`info`}),` Executor-bound waste: `,(0,U.jsx)(`strong`,{children:W(t.executorWasteHours)})]}),(0,U.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Floor (same executors, zero skew): `,B(t.floorZeroSkewMs)]}),r]})})}function fn(e){let t={extract:0,transform:0,load:0};for(let n of e.values()){let e=Math.max(0,(n.completedAt??0)-(n.submittedAt??0));if(e===0)continue;let r=(n.shuffleReadBytes??0)>0||(n.shuffleWriteBytes??0)>0;(n.inputBytes??0)>0&&(n.shuffleReadBytes??0)===0&&(t.extract+=e),r&&(t.transform+=e),(n.outputBytes??0)>0&&(t.load+=e)}return t}var pn=[{label:`Extract`,key:`extract`},{label:`Transform`,key:`transform`},{label:`Load`,key:`load`}];function mn({appModel:e}){let t=fn(e.stages);if(t.extract+t.transform+t.load===0)return null;let n=pn.reduce((e,n)=>t[n.key]>t[e.key]?n:e);return(0,U.jsx)(I,{title:`ETL Phase Attribution`,defaultCollapsed:!0,summary:(0,U.jsx)(V,{value:`${n.label} ${B(t[n.key])}`,context:`dominant phase`}),children:(0,U.jsxs)(`div`,{className:`space-y-1`,children:[pn.map(({label:e,key:n})=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e}),`: `,B(t[n])]},n)),(0,U.jsx)(L,{children:(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Heuristic: a stage that both shuffles and writes counts in Transform and Load, so phases can overlap and need not sum to wall-clock.`})})]})})}var hn=220;function gn(e){let t=e.app,n=e.executors.added,r=e.executors.removed;if(t?.startTime==null||t?.endTime==null)return{times:[],counts:[]};let i=t.endTime-t.startTime,a=Math.max(5e3,Math.floor(i/100)),o=[],s=[],c=new Map(r.map(e=>[e.executorId,e.timestamp]));for(let e=t.startTime;e<=t.endTime;e+=a){let r=n.filter(t=>{let n=c.get(t.executorId)??1/0;return t.timestamp<=e&&e<n}).length;o.push(((e-t.startTime)/1e3).toFixed(0)+`s`),s.push(r)}return{times:o,counts:s}}var _n=(0,H.memo)(function({appModel:e,activeFileId:t}){let{chartData:n,sampled:r,hasSeries:i,peak:a}=(0,H.useMemo)(()=>{let{times:t,counts:n}=gn(e),r=t.map((e,t)=>({label:e,count:n[t]})),i=bt(r),a=n.length>0;return{chartData:r,sampled:i,hasSeries:a,peak:a?Math.max(...n):0}},[e,t]);return i?(0,U.jsx)(I,{title:`Executor Count Over Time`,summary:(0,U.jsx)(V,{value:`${a} peak`,context:`concurrent executors`}),children:(0,U.jsx)(O,{ariaLabel:`Executor count over time. See the table below for exact values.`,height:hn,table:{caption:`Executor timeline: active executor count over time`,columns:[`Time`,`Active executors`],rows:n.map(e=>[e.label,e.count]),align:[`left`,`right`]},children:(0,U.jsxs)(d,{data:r,children:[(0,U.jsx)(c,{vertical:!1,stroke:j.muted,strokeOpacity:.2}),(0,U.jsx)(p,{dataKey:`label`,tick:{fontSize:10},minTickGap:24}),(0,U.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,U.jsx)(h,{formatter:e=>[`${e} executor${e===1?``:`s`} active`,``],labelFormatter:()=>``}),(0,U.jsx)(m,{type:`monotone`,dataKey:`count`,name:`Active executors`,stroke:j.clean,fill:j.clean,fillOpacity:.15})]})})}):(0,U.jsx)(I,{title:`Executor Count Over Time`,summary:(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Timeline unavailable: no end time recorded.`}),children:(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run has no ApplicationEnd event, so the executor timeline can't be plotted without fabricating an end time. See the Incomplete Run finding for what's still reliable.`})})}),vn=[10,20,50,80,100,110,120,150,200,300,400,500];function yn(e,t,n){return t<=0||n<=0?0:e/Math.min(n,t)}function bn(e,t){let n=0;for(let r of Object.keys(e)){let{totalTaskDurationSum:i,taskCount:a}=e[r];n+=yn(i,a,t)}return n}function xn({app:e,stages:t,runAggregates:n,executorsAdded:r}){let i=n?.perStage??{},a=ze(e??{},r),o=Le(e,t).stagesActive,s=a>0?bn(i,a):0,c=o>0?Math.round(Math.abs(s-o)/o*100):null,l=s>0?o/s:1;return{baselineCores:a,testPercentages:vn,predictions:vn.map(e=>{let t=Math.max(1,Math.round(a*e/100));return{pct:e,cores:t,estMakespanMs:Math.round(bn(i,t)*l)}}),modelErrorPct:c}}var Sn=`What-If Executor Scaling`,Cn=220,wn=20;function Tn([e,t]){let n=(t-e)*.1;return[Math.max(0,e-n),t+n]}function En(e){return[...e.stages.values()].some(e=>{let t=e.submittedAt,n=e.completedAt;return typeof t==`number`&&Number.isFinite(t)&&typeof n==`number`&&Number.isFinite(n)&&n>t})}function Dn(e){return e.evidenceAvailability?.entries.find(e=>e.key===`taskCoreTime`)}function On({reason:e,evidence:t}){return(0,U.jsx)(I,{title:Sn,summary:(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e]}),children:(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e,` `,(0,U.jsx)(D,{evidenceKey:t})]})})}function kn({appModel:e}){let t=Dn(e);if(!Ie(e.runAggregates)||t!=null&&t.state!==`present`)return(0,U.jsx)(On,{reason:t?.summary??`No usable task and core-time evidence in this log.`,evidence:`taskCoreTime`});let n=xn({app:e.app,stages:e.stages,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(n.baselineCores<=0)return(0,U.jsx)(On,{reason:`Baseline executor/core capacity is unavailable in this log.`});if(!En(e))return(0,U.jsx)(On,{reason:`Usable stage timing is unavailable in this log.`});let r=cn(e.jobs),i=n.modelErrorPct!=null&&n.modelErrorPct>=wn,a=bt(n.predictions),l=n.predictions.reduce((e,t)=>t.estMakespanMs<e.estMakespanMs?t:e);return(0,U.jsx)(I,{title:Sn,defaultCollapsed:!0,summary:(0,U.jsx)(V,{value:B(l.estMakespanMs),context:`best case at ${l.pct}% executors`}),children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(L,{children:(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Model Error:`,` `,(0,U.jsx)(`strong`,{className:i?`text-warning`:void 0,children:n.modelErrorPct==null?`—`:`${n.modelErrorPct}%`}),` `,`(idealized makespan vs. observed); higher means all estimates below carry more error, since a single log only observes one scale.`]})}),(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Move along this curve by changing `,(0,U.jsx)(`code`,{children:`spark.dynamicAllocation`}),`’s executor bounds, see the `,(0,U.jsx)(Me,{anchor:`#config-autoscale-bounds`,children:`autoscaling config guide`}),`.`]}),r.wallClockReliable?null:(0,U.jsx)(L,{children:(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run used concurrent job groups, so the wall-clock-based estimates below may be unreliable.`})}),(0,U.jsx)(L,{children:(0,U.jsx)(`p`,{className:`text-xs`,children:(0,U.jsx)(D,{evidenceKey:`taskCoreTime`})})}),(0,U.jsx)(O,{ariaLabel:`Estimated makespan by executor percentage: diminishing-returns curve.`,height:Cn,table:{caption:`Estimated makespan by executor percentage`,columns:[`% Executors`,`Cores`,`Est. makespan`],rows:n.predictions.map(e=>[`${e.pct}%`,e.cores,B(e.estMakespanMs)]),align:[`right`,`right`,`right`]},children:(0,U.jsxs)(o,{data:a,children:[(0,U.jsx)(c,{stroke:j.muted,strokeOpacity:.2}),(0,U.jsx)(p,{dataKey:`pct`,tickFormatter:e=>`${e}%`,tick:{fontSize:10}}),(0,U.jsx)(f,{domain:Tn,tickFormatter:e=>B(e),tick:{fontSize:10},width:56}),(0,U.jsx)(h,{formatter:e=>[B(Number(e)),`Est. makespan`],labelFormatter:e=>`${e}% executors`}),(0,U.jsx)(s,{type:`monotone`,dataKey:`estMakespanMs`,name:`Est. makespan`,stroke:j.accent,dot:{r:3}})]})})]})})}function An(e){return typeof e?.startTime==`number`&&Number.isFinite(e.startTime)&&typeof e?.endTime==`number`&&Number.isFinite(e.endTime)&&e.endTime>e.startTime}function jn(e){if(!An(e.app))return{efficiency:{value:null,unavailableReason:`application-timing`},wastage:{value:null,unavailableReason:`application-timing`}};let t=Le(e.app,e.stages),n=Math.min(100,Math.round(t.stagesActive/t.total*100));if(!e.runAggregates)return{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`core-usage-summary`}};let r=sn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});return!Number.isFinite(r.availableComputeHours)||r.availableComputeHours<=0?{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`executor-capacity`}}:{efficiency:{value:n,unavailableReason:null},wastage:{value:r.wastagePct,unavailableReason:null}}}var Mn={critical:`inset 4px 0 0 var(--color-critical)`,warning:`inset 4px 0 0 var(--color-warning)`};function Nn({eyebrow:e,value:t,meta:n,flag:r=null,bar:i,dataTestid:a}){return(0,U.jsxs)(`div`,{"data-testid":a,className:`flex flex-col gap-1 p-3`,style:r?{boxShadow:Mn[r]}:void 0,children:[(0,U.jsxs)(`span`,{className:N(`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,r&&Pe[r]),children:[r&&(0,U.jsx)(M,{impactBand:r}),e]}),(0,U.jsx)(`div`,{className:N(`font-heading text-2xl font-semibold`,r&&Pe[r]),children:t}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}),i]})}function Pn({pct:e,flag:t,label:n}){let r=Math.max(0,Math.min(100,e));return(0,U.jsx)(`div`,{role:`img`,"aria-label":n,className:`mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:N(`h-full rounded-full`,t?qe[t]:`bg-clean`),style:{width:`${r}%`}})})}function Fn({active:e,total:t}){let n=t>0?Math.max(0,Math.min(100,e/t*100)):0;return(0,U.jsxs)(`div`,{role:`img`,"aria-label":`Active ${B(e)} of ${B(t)} total`,className:`mt-0.5 flex h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:[(0,U.jsx)(`div`,{className:`h-full bg-clean`,style:{width:`${n}%`}}),(0,U.jsx)(`div`,{className:`h-full flex-1 bg-muted-foreground/60`})]})}function In(e){return e>0?`Ran ${B(e)}`:`No stage activity recorded`}function Ln(){return(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4`,children:[(0,U.jsx)(M,{impactBand:`warning`,className:`mt-1.5`}),(0,U.jsxs)(`p`,{className:`text-sm text-warning`,children:[(0,U.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Timing unavailable`}),`. This run has no complete application timing interval, so wall-clock, efficiency, and wastage can’t be measured.`]})]})}function Rn({appModel:e,catalog:t}){let n=Ke(),{app:r,stages:i}=e;if(!An(r))return(0,U.jsx)(Ln,{});let a=Le(r,i),o=jn(e),s=a.total,c=o.efficiency.value,l=c==null?null:c<75?`critical`:c<90?`warning`:null,u=t.find(e=>e.type===`coldStart`),d=o.wastage.value,f=d==null?null:d>=70?`critical`:d>=40?`warning`:null;return(0,U.jsx)(st,{className:`overflow-hidden py-0`,children:(0,U.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,U.jsx)(Nn,{eyebrow:`Wall-clock`,dataTestid:`kpi-wall-clock`,value:s>0?B(s):`—`,meta:(0,U.jsxs)(U.Fragment,{children:[In(a.stagesActive),u?` · ${u.value}s cold start`:``]}),bar:(0,U.jsx)(Fn,{active:a.stagesActive,total:s})}),(0,U.jsx)(Nn,{eyebrow:`Efficiency`,dataTestid:`kpi-efficiency`,value:c==null?`Unavailable`:(0,U.jsxs)(U.Fragment,{children:[c,(0,U.jsx)(`small`,{children:`%`})]}),flag:l,meta:c==null?`This run has no complete application timing interval.`:s>a.stagesActive?`${In(a.stagesActive)} · ${B(s-a.stagesActive)} idle/gap time`:`executors active the whole run`,bar:c==null?void 0:(0,U.jsx)(Pn,{pct:c,flag:l,label:`Efficiency ${c}%`})}),(0,U.jsx)(Nn,{eyebrow:`Wastage`,dataTestid:`kpi-wastage`,value:d==null?`Unavailable`:(0,U.jsxs)(U.Fragment,{children:[d,(0,U.jsx)(`small`,{children:`%`})]}),flag:f,meta:o.wastage.unavailableReason===`application-timing`?`Wastage needs complete application timing.`:o.wastage.unavailableReason===`core-usage-summary`?`Wastage needs the core-usage summary.`:o.wastage.unavailableReason===`executor-capacity`?`Wastage needs usable executor-capacity data.`:n===`advanced`?`Driver-idle + executor-slack core-hours as a share of available capacity. Directional, not a cost figure.`:`Executor capacity that sat idle. Not a cost figure.`,bar:d==null?void 0:(0,U.jsx)(Pn,{pct:d,flag:f,label:`Wastage ${d}%`})})]})})}function zn({className:e,...t}){return(0,U.jsx)(g,{"data-slot":`accordion`,className:N(`flex w-full flex-col`,e),...t})}function Bn({className:e,...t}){return(0,U.jsx)(x,{"data-slot":`accordion-item`,className:N(`not-last:border-b`,e),...t})}function Vn({className:e,children:t,headingLevel:n=3,...r}){let i=`h${n}`;return(0,U.jsx)(y,{className:`flex`,render:(0,U.jsx)(i,{}),children:(0,U.jsxs)(_,{"data-slot":`accordion-trigger`,className:N(`group/accordion-trigger relative flex flex-1 cursor-pointer items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...r,children:[t,(0,U.jsx)(We,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,U.jsx)(Ne,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Hn({className:e,children:t,...n}){return(0,U.jsx)(v,{"data-slot":`accordion-content`,className:`h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none`,...n,children:(0,U.jsx)(`div`,{className:N(`pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}function Un(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Wn({type:e,label:t,thresholdSummary:n}){return(0,U.jsxs)(F,{"data-testid":`clean-check-row`,"data-clean-check-type":e,children:[(0,U.jsx)(P,{className:`w-px`,children:(0,U.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1 rounded-full bg-clean/10 px-2 font-mono text-xs font-medium whitespace-nowrap text-clean`,children:[(0,U.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),dt(e)]})}),(0,U.jsxs)(P,{className:`whitespace-normal`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:Un(t)}),(0,U.jsx)(L,{children:(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Un(`${n}.`)})})]})]})}var Gn=`suggested-improvements`,Kn={skew:`per-stage`,stageShape:`per-stage`,tinyTask:`per-stage`,shuffle:`per-stage`,partitionSizing:`per-stage`,spill:`per-stage`,gc:`per-stage`,stageFailed:`per-stage`,failures:`per-stage`,retryWaste:`per-stage`,slowHost:`per-stage`,stageSlowness:`per-stage`,straggler:`per-stage`,speculationWaste:`per-stage`,incompleteRun:`app-level`,coldStart:`app-level`,memoryUtilization:`app-level`,utilization:`app-level`,coreLocality:`app-level`,cachingOpportunity:`app-level`,cacheUtilization:`app-level`,jobFailureRate:`app-level`,autoscalingChurn:`app-level`,duplicatePlanSubtree:`sql-scope`,smallFiles:`sql-scope`,underBroadcast:`sql-scope`,overBroadcast:`sql-scope`,configAudit:`config-scope`},qn=[`per-stage`,`app-level`,`sql-scope`,`config-scope`],Jn={"per-stage":`Per-stage checks`,"app-level":`App-level checks`,"sql-scope":`SQL plan checks`,"config-scope":`Config checks`};function Yn(e,t){let n=[...e,...t].filter(de);return pe().filter(({type:e})=>!me(e)).map(({component:e,widgetId:t,type:r},i)=>{let a=n.filter(e=>e.type===r);return{component:e,widgetId:t,index:i,findings:a,impactBand:mt(a)}}).filter(e=>e.impactBand!==void 0).sort((e,t)=>Xe[e.impactBand]-Xe[t.impactBand]||e.index-t.index)}function Xn({appModel:e,catalog:t,configFindings:n=[],getTaskData:r,activeFileId:i}){let a=[...t,...n].filter(de),o=Object.keys(Se).filter(e=>!me(e)).filter(e=>!a.some(t=>t.type===e)).map(e=>({type:e,findingLabel:Se[e].findingLabel})),s=new Map;for(let e of o){let t=Kn[e.type]??`app-level`;s.has(t)||s.set(t,[]),s.get(t).push(e)}let c=ye();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(at,{children:c.map(({component:a,widgetId:o})=>(0,U.jsx)(z,{cardId:`reference-${o}`,widgetId:o,children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(Ye,{}),children:(0,U.jsx)(a,{appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,defaultCollapsed:!0})})},o))}),(0,U.jsx)(zn,{children:(0,U.jsxs)(Bn,{value:`clean-checks`,children:[(0,U.jsx)(Vn,{children:`Clean checks`}),(0,U.jsxs)(Hn,{children:[(0,U.jsxs)(`p`,{className:`pb-2 text-xs text-muted-foreground`,children:[`Every check below passed. No fix needed.`,(0,U.jsx)(L,{children:` Each line's caption states the threshold it was measured against.`})]}),qn.map(e=>{let t=s.get(e);return!t||t.length===0?null:(0,U.jsxs)(`div`,{className:`pt-3 first:pt-0`,children:[(0,U.jsx)(`p`,{className:`pb-1 text-xs font-medium text-muted-foreground`,children:Jn[e]}),(0,U.jsx)(rt,{children:(0,U.jsx)($e,{children:t.map(({type:e,findingLabel:t})=>(0,U.jsx)(Wn,{type:e,label:t,thresholdSummary:ue(e)},e))})})]},e)})]})]})})]})}function Zn(e){switch(e.type){case`skew`:return`For join-driven skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key to reduce task skew.`;case`stageShape`:switch(e.rule){case`lowParallelism`:return`Too few tasks run relative to the cores available, leaving cluster capacity idle: repartition to use more of it.`;case`dataExplosion`:return`Output volume far exceeds input volume: check for an exploding join or a cross product.`;case`taskStageSkew`:return`A single straggler task gates the whole stage's wall-clock duration.`}break;case`shuffle`:return`Consider increasing spark.sql.shuffle.partitions or adding a broadcast join to shrink the shuffle.`;case`partitionSizing`:switch(e.rule){case`shufflePartitionSkew`:return`For join skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key.`;case`lowShuffleParallelism`:return`Raise spark.sql.shuffle.partitions so each partition is smaller.`;case`maxPartitionTooBig`:return`Repartition to break up the oversized partition before this stage.`}break;case`spill`:return`If the spill is skew-driven, fix task skew first: adding memory will not help. Otherwise raise spark.sql.shuffle.partitions or increase executor memory.`;case`gc`:return e.direction===`low`?`Memory may be over-provisioned here: consider reducing spark.executor.memory for cost savings.`:`Reduce object creation, use primitive types, avoid UDFs, or increase executor memory to cut GC time.`;case`slowHost`:return e.variant===`durationShare`?`Check for data locality or partition assignment skewing work onto one node.`:e.variant===`multiDim`?`Investigate uneven partition assignment or a degraded executor.`:`Check what this host was running: it may just hold data locality for its tasks or carry one heavy stage, rather than a hardware fault. Enable spark.speculation to relaunch a lagging task automatically.`;case`stageSlowness`:return`Often a partition-count problem: raise parallelism via spark.sql.shuffle.partitions or spark.default.parallelism, or check for a large per-task data volume driving heavy shuffle and spill.`;case`stageFailed`:return`Inspect the driver log for the failure reason and the job that triggered it.`;case`failures`:return`Investigate driver logs for executor instability or data-driven errors.`;case`straggler`:return`Rule out a GC pause or a slow shuffle fetch before assuming a hardware issue. If a skewed key is the real cause, that is a candidate for AQE's skew-join handling.`;case`speculationWaste`:return`If task durations are naturally variable rather than genuine stragglers, consider tuning spark.speculation.multiplier/quantile.`;case`retryWaste`:return`Investigate executor loss or fetch failures behind the retried attempts.`;case`tinyTask`:return`Scheduler overhead may dominate: lower spark.sql.shuffle.partitions, or coalesce down to fewer, larger tasks.`;case`coldStart`:return`Keep a warm pool of idle executors, or if using dynamic allocation, raise the minimum/initial executor count so it does not scale up from zero.`;case`utilization`:return`Consider reducing cluster size or enabling dynamic allocation.`;case`memoryUtilization`:switch(e.variant){case`idleCores`:return`Reduce cluster size or enable dynamic allocation.`;case`wasteModel`:return`Review spark.executor.memory and executor count.`;case`memoryBand`:if(e.dataUnavailable)break;return e.rule===`heapNearCapacity`?`Memory may be too small: raise spark.executor.memory to avoid OOM/spill.`:`Memory may be over-provisioned: consider reducing spark.executor.memory for cost savings.`}break;case`cacheUtilization`:switch(e.variant){case`partialCache`:return`Increase executor memory or reduce the cached dataset size so more of it stays cached.`;case`diskSpillover`:return`Executor memory may be too small for this cached dataset: increase executor memory or reduce its size.`}break;case`coreLocality`:return`Check spark.locality.wait settings and executor/data colocation.`;case`autoscalingChurn`:return`This looks like wasteful re-provisioning rather than normal scale-down: consider raising spark.dynamicAllocation.executorIdleTimeout or widening the minExecutors/maxExecutors bounds to reduce flapping.`;case`cachingOpportunity`:return e.variant===`composite`?`Cache or persist the repeated join/union result so it is computed once instead of recomputed per query.`:`Cache the shared DataFrame, or broadcast it if it is a small join lookup.`;case`jobFailureRate`:return`Inspect the driver log for the failed job(s) and the stage failures that triggered them.`;case`configAudit`:switch(e.property){case`spark.shuffle.service.enabled`:return`Set spark.shuffle.service.enabled=true so shuffle data survives executor removal.`;case`spark.dynamicAllocation.minExecutors`:return`Set the minimum executor bound at or below the maximum.`;case`spark.dynamicAllocation.maxExecutors`:return`Set spark.dynamicAllocation.maxExecutors to cap cluster growth.`;case`spark.serializer`:return`Consider spark.serializer=org.apache.spark.serializer.KryoSerializer for faster, smaller buffers.`;case`spark.executor.memoryOverhead`:return`Raise executor memoryOverhead above Spark's default floor to avoid off-heap OOM-kills.`}break;case`duplicatePlanSubtree`:return`Check whether the repeated subtree could be computed once and reused, or cache/persist the shared computation.`;case`smallFiles`:return e.direction===`write`?`Repartition or coalesce before writing to raise the average file size.`:`Compact the upstream output so fewer, larger files are produced.`;case`underBroadcast`:return`This could have been a broadcast join: consider a broadcast() hint or raising spark.sql.autoBroadcastJoinThreshold.`;case`overBroadcast`:return`Check for a misapplied broadcast hint or a misconfigured spark.sql.autoBroadcastJoinThreshold.`}}function Qn(e){let t=Se[e.type],n=typeof e.recommendation==`string`?e.recommendation.trim():``;return!t?.routeable||!n?null:{finding:e,widgetId:t.widgetId,region:t.region,findingLabel:t.findingLabel,stageId:typeof e.stageId==`number`?e.stageId:null,recommendation:n}}function $n(e,t){return t.includes(e)?Qn(e):null}function er(e){return e.impactEstimate?.wallClock?.high??null}function tr(e){let t=new Map(pe().map((e,t)=>[e.widgetId,t])),n=e.map((e,t)=>({target:Qn(e),catalogIndex:t})).filter(e=>e.target!==null);return n.sort((e,n)=>{let r=er(e.target.finding),i=er(n.target.finding);return r!==null&&i!==null&&r!==i?i-r:r!==null==(i!==null)?(t.get(e.target.widgetId)??2**53-1)-(t.get(n.target.widgetId)??2**53-1)||e.catalogIndex-n.catalogIndex:r===null?1:-1}),n[0]?.target??null}var nr=10;function rr(e){return ke(e)&&Se[e.type]!=null}function ir(e){return Oe(e.findings)[0].impactBand}function ar(e){let t=e.impactEstimate;return t?t.wallClock?Ct(t.wallClock.low,t.wallClock.high):t.rawWaste?Tt(t.rawWaste):null:null}function or(e){let t=e.stageId==null?e.stageIds&&e.stageIds.length>0?`St.${ct(e.stageIds)}`:null:`St.${e.stageId}`;if(e.type===`duplicatePlanSubtree`&&e.rootName!=null){let n=sr(e);return t&&n?`${t} · ${n}`:n??t}return t||(e.property?String(e.property):null)}function sr(e){if(e.type!==`duplicatePlanSubtree`||e.rootName==null)return null;let t=et(e.rootName),n=e.groupIndex==null?t:`${t} #${Number(e.groupIndex)+1}`;return e.executionId==null?n:`${n} (SQL ${e.executionId})`}function cr({finding:e,textClassName:t,visibleLimit:n,stackIdentity:r,stagePillClassName:i}){let{stageId:a,stageIds:o}=e;if(a!=null)return(0,U.jsx)(St,{stageId:a});if(o&&o.length>0){let a=sr(e),s=a?(0,U.jsx)(`span`,{className:N(`truncate`,t),title:a,children:a}):null,c=(0,U.jsx)(xt,{pills:o.map(e=>({id:e})),visibleLimit:n,pillOverrideClassName:r?i:void 0});return(0,U.jsx)(`span`,{className:N(`inline-flex min-w-0 items-center gap-1.5`,r?`flex-col`:`flex-wrap`),children:r?(0,U.jsxs)(U.Fragment,{children:[s,c]}):(0,U.jsxs)(U.Fragment,{children:[c,s]})})}let s=or(e);return s?(0,U.jsx)(`span`,{className:N(`min-w-0 truncate`,t),title:s,children:s}):null}function lr(e){return(typeof e.recommendation==`string`?e.recommendation.trim():``)||(Se[e.type]?.findingLabel??e.type)}function ur({finding:e,allFindings:t,onRoute:n}){let r=$n(e,t),i=or(e),a=ar(e),o=lr(e),s=A(e);return(0,U.jsxs)(F,{"data-testid":`fix-these-first-row`,"data-finding-type":e.type,children:[(0,U.jsx)(P,{className:`w-px`,children:(0,U.jsx)(Ue,{type:e.type,impactBand:e.impactBand})}),(0,U.jsx)(P,{className:`whitespace-normal`,children:(0,U.jsxs)(`button`,{type:`button`,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>r&&n(r),children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium`,children:s}),(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o})]})}),(0,U.jsx)(P,{className:`w-px text-right font-mono text-xs text-muted-foreground`,title:[i,a].filter(Boolean).join(` · `),children:(0,U.jsxs)(`span`,{className:`flex items-center justify-end gap-1.5`,children:[(0,U.jsx)(cr,{finding:e}),a?(0,U.jsx)(`span`,{className:`shrink-0`,children:a}):null]})})]})}function dr({finding:e,allFindings:t,onRoute:n,id:r}){let i=$n(e,t),a=or(e),o=ar(e),s=lr(e),c=A(e),l=e.stageId!=null||a!=null;return(0,U.jsxs)(F,{id:r,"data-testid":`fix-these-first-row`,"data-finding-type":e.type,className:`bg-muted/50`,children:[(0,U.jsxs)(P,{colSpan:2,className:`whitespace-normal`,children:[l?(0,U.jsx)(`div`,{className:`mb-1`,children:(0,U.jsx)(cr,{finding:e,textClassName:`line-clamp-1 break-words text-xs font-medium font-mono`})}):null,(0,U.jsxs)(`button`,{type:`button`,className:`block w-full cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>i&&n(i),children:[l?null:(0,U.jsx)(`span`,{className:`line-clamp-1 break-words text-xs font-medium`,children:c}),(0,U.jsx)(`span`,{className:`line-clamp-1 break-words text-xs text-muted-foreground`,children:s})]})]}),(0,U.jsx)(P,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:o})]})}function fr(e){return e.kind===`time`?`×${e.findingCount} · ${Ct(e.recoverableMsHigh,e.recoverableMsHigh)} recoverable`:e.kind===`resource`?`×${e.findingCount} · resource-cost projection`:Object.entries(e.byImpactBand).map(([e,t])=>`${t} ${e}`).join(`, `)}function pr(e){return e.kind===`time`?`${e.findingCount} findings of this type; up to ${Ct(e.recoverableMsHigh,e.recoverableMsHigh)} of run time could be recovered by fixing them`:e.kind===`resource`?`${e.findingCount} findings of this type; a resource-cost estimate (not run time) is projected for fixing them`:`${e.findingCount} findings of this type, by impact`}function mr({group:e,allFindings:t,expanded:n,onToggle:r,onRoute:i}){let[a,o]=(0,H.useState)(0),s=Oe(e.findings),c=s[0],l=Zn(c),u=A(c),d=Math.ceil(s.length/nr),f=Math.min(a,Math.max(0,d-1)),p=s.slice(f*nr,f*nr+nr),m=`fix-these-first-group-content-${e.kind}-${e.type}${`unit`in e?`-${e.unit}`:``}`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(F,{"data-testid":`fix-these-first-group-row`,"data-finding-type":e.type,children:[(0,U.jsx)(P,{className:`w-px`,children:(0,U.jsx)(Ue,{type:e.type,impactBand:c.impactBand})}),(0,U.jsx)(P,{className:`whitespace-normal`,children:(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":m,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:r,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium`,children:u}),l?(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:l}):null]})}),(0,U.jsx)(P,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:(0,U.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1.5`,title:pr(e),children:[fr(e),n?(0,U.jsx)(Ne,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,U.jsx)(We,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})})]}),n&&p.map((e,n)=>(0,U.jsx)(dr,{finding:e,allFindings:t,onRoute:i,id:n===0?m:void 0},e.id)),n&&d>1&&(0,U.jsx)(F,{className:`bg-muted/50`,children:(0,U.jsx)(P,{colSpan:3,children:(0,U.jsx)(Dt,{page:f,totalPages:d,onPrev:()=>o(e=>e-1),onNext:()=>o(e=>e+1)})})})]})}function hr({target:e,onRoute:t}){let n=or(e.finding),r=ar(e.finding),i=e.finding.stageId!=null||n!=null,[a,o]=(0,H.useState)(!1),s=async()=>{let t=`${A(e.finding)} — ${lr(e.finding)}`,n=[/[.!?]$/.test(t)?t:`${t}.`,r?`Potential savings: ${r}`:null].filter(Boolean).join(` `);try{await w(n),o(!0),setTimeout(()=>o(!1),1500)}catch{}};return(0,U.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 transition-colors hover:bg-primary/10`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`${A(e.finding)}, ${lr(e.finding)}`,onClick:()=>t(e),className:`flex cursor-pointer flex-col gap-2 rounded-lg px-4 py-3 text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-semibold tracking-wide text-primary uppercase`,children:[(0,U.jsx)(Ft,{"aria-hidden":`true`,className:`size-3.5`}),`Highest impact`]}),(0,U.jsxs)(`p`,{className:`mt-2 min-w-0`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:A(e.finding)}),(0,U.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`, `,lr(e.finding)]})]})]}),r?(0,U.jsxs)(`div`,{className:`min-w-0 sm:shrink-0 sm:text-right`,children:[(0,U.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Potential savings`}),(0,U.jsx)(`p`,{className:`whitespace-nowrap font-mono text-lg font-semibold leading-tight tabular-nums text-primary`,children:r})]}):null]}),(0,U.jsxs)(`div`,{className:N(`flex items-center gap-3 px-4 pb-3`,i?`justify-between`:`justify-end`),children:[i?(0,U.jsx)(cr,{finding:e.finding,textClassName:`line-clamp-2 max-w-[140px] break-words text-xs font-semibold text-muted-foreground`,visibleLimit:2,stackIdentity:!0,stagePillClassName:`h-5 px-1.5 text-[10px] font-normal`}):null,(0,U.jsx)(`button`,{type:`button`,"data-testid":`copy-finding-button`,onClick:()=>void s(),className:`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`}),`Copied`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(kt,{"aria-hidden":`true`,className:`size-3.5`}),`Copy finding`]})})]})]})}function gr(e,t,n){let r=[...e,...t].filter(rr);return{eligible:r,groups:De(r,n),triageTarget:tr(r)}}var _r={critical:`Critical`,warning:`Warning`,info:`Info`},vr=[`critical`,`warning`,`info`];function yr(e){return`${e.kind}-${e.type}-${`unit`in e?e.unit:``}`}function br({impactBand:e,groups:t,widgets:n,allFindings:r,expandedGroupKey:i,onToggleGroup:a,onRoute:o,appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d}){if(t.length===0&&n.length===0)return null;let f=`impact-band-${e}-heading`;return(0,U.jsxs)(`section`,{"aria-labelledby":f,className:`space-y-3`,children:[(0,U.jsx)(`h2`,{id:f,className:`font-heading text-base font-semibold`,children:_r[e]}),t.length>0&&(0,U.jsx)(rt,{children:(0,U.jsx)($e,{children:t.map(e=>{if(e.findingCount===1)return(0,U.jsx)(ur,{finding:e.findings[0],allFindings:r,onRoute:o},e.findings[0].id);let t=yr(e);return(0,U.jsx)(mr,{group:e,allFindings:r,expanded:i===t,onToggle:()=>a(t),onRoute:o},t)})})}),n.length>0&&(0,U.jsx)(at,{children:n.map(({component:e,widgetId:t,index:n})=>(0,U.jsx)(z,{cardId:`alert-${n}`,widgetId:t,children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(Ye,{}),children:(0,U.jsx)(e,{appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d,defaultCollapsed:!0})})},t))})]})}function xr({appModel:e,catalog:t,configFindings:n=[],stages:r,getTaskData:i,activeFileId:a,onRoute:o}){let{eligible:s,groups:c,triageTarget:l}=(0,H.useMemo)(()=>gr(t,n,r),[t,n,r]),u=[...t,...n],d=(0,H.useMemo)(()=>Yn(t,n),[t,n]),[f,p]=(0,H.useState)(null),{groupsByImpactBand:m,widgetsByImpactBand:h}=(0,H.useMemo)(()=>{let e=new Map;for(let t of c){let n=ir(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}let t=new Map;for(let e of d)t.has(e.impactBand)||t.set(e.impactBand,[]),t.get(e.impactBand).push(e);return{groupsByImpactBand:e,widgetsByImpactBand:t}},[c,d]);return(0,U.jsxs)(`div`,{id:Gn,className:`space-y-6 scroll-mt-20`,children:[l?(0,U.jsx)(hr,{target:l,onRoute:o}):null,s.length===0?(0,U.jsx)(ht,{tone:`clean`,icon:Fe,title:`No findings to fix right now.`}):null,vr.map(r=>(0,U.jsx)(br,{impactBand:r,groups:m.get(r)??[],widgets:h.get(r)??[],allFindings:u,expandedGroupKey:f,onToggleGroup:e=>p(t=>t===e?null:e),onRoute:o,appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a},r)),(0,U.jsx)(Xn,{appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a})]})}var Sr=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`],Cr=[j.clean,j.accent,j.warning,j.muted,j.critical];function wr(e){return e?new Date(e).toLocaleString():`—`}function Tr({stats:e}){let t=new Map(e.map(e=>[e.locality,e.count])),n=Sr.filter(e=>t.has(e));for(let t of e)Sr.includes(t.locality)||n.push(t.locality);let r=n.map((e,n)=>({locality:e,count:t.get(e)??0,color:Cr[Math.min(n,Cr.length-1)]}));return(0,U.jsx)(O,{ariaLabel:`Task locality distribution`,height:140,table:{caption:`Task locality distribution`,columns:[`Locality tier`,`Task count`],rows:r.map(e=>[e.locality,e.count]),align:[`left`,`right`]},children:(0,U.jsxs)(l,{data:r,children:[(0,U.jsx)(c,{vertical:!1,stroke:j.muted,strokeOpacity:.2}),(0,U.jsx)(p,{dataKey:`locality`,tick:{fontSize:10}}),(0,U.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,U.jsx)(h,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Tasks`]}),(0,U.jsx)(u,{dataKey:`count`,name:`Tasks`,children:r.map(e=>(0,U.jsx)(a,{fill:e.color},e.locality))})]})})}function Er(e){let t=new Map;for(let n of e){t.has(n.type)||t.set(n.type,{impactBand:n.impactBand,finding:n,recs:new Map});let e=t.get(n.type);Xe[n.impactBand]<Xe[e.impactBand]&&(e.impactBand=n.impactBand,e.finding=n),n.recommendation&&!e.recs.has(n.recommendation)&&e.recs.set(n.recommendation,{extended:n.extended??null})}return[...t.entries()].sort(([,e],[,t])=>Xe[e.impactBand]-Xe[t.impactBand])}function Dr({rec:e,extended:t,finding:n,showImpactEstimate:r}){return(0,U.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,U.jsx)(`p`,{className:`max-w-full leading-normal break-words`,children:e}),t?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null,r?(0,U.jsx)(Et,{finding:n}):null]})}function Or({findings:e}){if(e.length===0)return null;let t=Er(e);return(0,U.jsx)(`section`,{className:`space-y-3 rounded-md border p-3`,children:t.map(([e,{impactBand:t,finding:n,recs:r}])=>{let i=wt(n.impactEstimate)!==null;return(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(Ue,{type:e,impactBand:t}),[...r.entries()].map(([e,{extended:t}],r)=>(0,U.jsx)(Dr,{rec:e,extended:t,finding:n,showImpactEstimate:r===0&&i},r))]},e)})})}function kr({stage:e,appModel:t}){return he(e.id,t)?(0,U.jsx)(fe,{title:`Query Plan`,children:(0,U.jsx)(Ce,{stageId:e.id,appModel:t})}):null}function Ar({stage:e,appModel:t,catalog:n,getTaskData:r}){let{exportMode:i,getTaskData:a}=vt(r),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(0),f=(e.taskCount??0)>0,p=n.filter(t=>t.stageId===e.id);(0,H.useEffect)(()=>{if(!f||!a)return;let t=!1;return l(!1),a(e.id).catch(()=>null).then(e=>{t||(e?s(e):l(!0))}),()=>{t=!0}},[u]);let m=(e.completedAt??0)-(e.submittedAt??0),h=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,g=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,_=e.fetchWaitTime??0,v=_>0&&m>0?Math.round(_/m*100):null,y=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,b=e.localityStats??[];return(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(Or,{findings:p}),(0,U.jsx)(k,{title:`Overview`,collapsible:!0,defaultOpen:!0,rows:[[`Duration`,B(m)],[`Submitted`,wr(e.submittedAt)],[`Completed`,wr(e.completedAt)],e.sqlExecutionId!=null&&[`SQL Execution`,`#${e.sqlExecutionId}`],e.stageType?[`Stage type`,e.stageType]:!1]}),(0,U.jsx)(k,{title:`Tasks`,collapsible:!0,rows:[[`Total`,String(e.taskCount)],[`Failed`,String(e.failedTasks)],[`P50 duration`,(e.taskDurationP50??0)>0?B(e.taskDurationP50):`—`],[`P95 duration`,(e.taskDurationP95??0)>0?B(e.taskDurationP95):`—`],[`Max duration`,(e.taskDurationMax??0)>0?B(e.taskDurationMax):`—`],(e.peakExecutionMemoryMax??0)>0&&[`Peak execution memory`,R(e.peakExecutionMemoryMax)]],children:f?i?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Per-task duration data isn’t included in exported reports.`}):o?(0,U.jsx)(yt,{metrics:o.metrics,fieldNames:o.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):c?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Couldn’t load task data for this stage.`}),(0,U.jsx)(Ve,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>d(e=>e+1),children:`Retry`})]}):(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading task data…`}):null}),(0,U.jsx)(k,{title:`Locality`,collapsible:!0,rows:[],children:b.length>0?(0,U.jsx)(Tr,{stats:b}):null}),(0,U.jsx)(k,{title:`I/O`,collapsible:!0,rows:[[`Input`,R(e.inputBytes)],[`Output`,R(e.outputBytes)],[`Shuffle read`,R(e.shuffleReadBytes)],[`Shuffle write`,R(e.shuffleWriteBytes)],_>0&&[`Fetch wait`,`${B(_)}${v==null?``:` (${v}%)`}`],y!=null&&[`I/O ratio`,y]]}),h?(0,U.jsx)(k,{title:`Spill`,collapsible:!0,rows:[[`Memory spilled`,R(e.memoryBytesSpilled)],[`Disk spilled`,R(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&[`Classification`,e.spillClassification??`unclassified`]]}):null,g?(0,U.jsx)(k,{title:`GC`,collapsible:!0,rows:[[`JVM GC time`,B(e.jvmGCTime)],[`Executor run time`,B(e.executorRunTime)],[`GC %`,`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?(0,U.jsx)(L,{children:(0,U.jsx)(fe,{title:`Call Stack`,children:(0,U.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap`,children:e.details})})}):null,(0,U.jsx)(kr,{stage:e,appModel:t})]})}function jr({appModel:e,catalog:t,getTaskData:n}){let{stageId:r,close:i}=it(),a=r==null?void 0:e.stages.get(r);return(0,U.jsx)(xe,{open:a!=null,onOpenChange:e=>{e||i()},children:(0,U.jsx)(we,{className:`max-h-[85vh] overflow-y-auto sm:max-w-4xl`,children:a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ve,{children:(0,U.jsxs)(Ee,{children:[`Stage `,a.id,` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,a.name??``]})]})}),(0,U.jsx)(Ar,{stage:a,appModel:e,catalog:t,getTaskData:n},a.id)]}):null})})}function Mr(e){return Nr(e)||typeof e==`function`||Pr(e)}function Nr(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Pr(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function G(e,t){return e==null?null:Mr(e)?H.createElement(e,t):e}function Fr(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?G(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:G(n.cell,t.getContext())}return`header`in e&&e.header?G(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?G(e.footer.column.columnDef.footer,e.footer.getContext()):null}function Ir({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Lr(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Rr=[],zr=0,{link:Br,unlink:Vr,propagate:Hr,checkDirty:Ur,shallowPropagate:Wr}=Ir({update(e){return e._update()},notify(e){Rr[Kr++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Yr(e))}}),Gr=0,Kr=0,K,qr=0;function Jr(e){try{++qr,e()}finally{--qr||Xr()}}function Yr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Vr(n,e)}function Xr(){if(!(qr>0)){for(;Gr<Kr;){let e=Rr[Gr];Rr[Gr++]=void 0,e.notify()}Gr=0,Kr=0}}function Zr(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return K!==void 0&&Br(i,K,zr),i._snapshot},subscribe(e){let t=Lr(e),n={current:!1},r=Qr(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=K,o=t?.compare??Object.is;if(n)K=i,++zr,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{K=a,n&&(i.flags&=-5),Yr(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Ur(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Wr(e)}}else e&32&&(i.flags=e&-33);return K!==void 0&&Br(i,K,zr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Hr(e),Wr(e),Xr())}},i}function Qr(e){let t=()=>{let t=K;K=n,++zr,n.depsTail=void 0,n.flags=6;try{return e()}finally{K=t,n.flags&=-5,Yr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Ur(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Yr(this)}};return t(),n}function $r(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=ei(e);if(n.length!==ei(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function ei(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var ti=e(r(),1);function ni(e,t){return e===t}function ri(e,t=e=>e,n){let r=n?.compare??ni,i=(0,H.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,H.useCallback)(()=>e.get(),[e]);return(0,ti.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function ii(e){let t=ri(e.source,e.selector,{compare:$r});return typeof e.children==`function`?e.children(t):e.children}function ai(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function oi(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function si(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function ci(){return oi({createAtom:Zr,batch:Jr})}function li(e,t){return typeof e==`function`?e(t):e}function q(e){if(Array.isArray(e))return e.map(q);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?J():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:q(e[i]),writable:!0})}return n}return e}function ui(e,t){let n=Object.keys(t),r=e;for(let e=0;e<n.length;e++){let i=n[e];!i.startsWith(`_memo_`)&&i!==`_cellsCache`&&(r[i]=t[i])}return e}function J(){return Object.create(null)}function di(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fi(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>li(n,e))}}function pi(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function mi(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var hi=3;function gi(e,t){return _i(e,t,hi)}function _i(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!pi(e)||!pi(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=mi(e),i=mi(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e<r.length;e++){let i=r[e];if(!Object.prototype.propertyIsEnumerable.call(t,i)||!_i(a[i],o[i],n-1))return!1}return!0}function vi(e,t,n,r=gi){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=li(n,e);return r(e,t)?e:t})}function yi(e){return e instanceof Function}function bi(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var xi=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u?(o=l,a?.(),s=e(...l??[]),r?.(s),s):s}};function Si(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function Ci({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o=()=>{if(!r)return;let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))},s={onAfterUpdate:()=>{o()}};return xi({...a,...s})}function wi(e,t=`_`){let[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function Y(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=wi(r);t[n]=a?Ci({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function X(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=wi(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=Ci({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function Z(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function Ti(e){return e.row.getValue(e.column.id)}function Ei(e){return e.getValue()??e.table.options.renderFallbackValue}function Di(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Oi={assignCellPrototype:(e,t)=>{X(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Ti(e)},cell_renderValue:{fn:e=>Ei(e)},cell_getContext:{fn:e=>Di(e),memoDeps:e=>[e]}})}};function ki(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function Ai(e,t,n){let r=ki(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function ji(){return{start:[],end:[]}}function Mi(){return J()}function Ni(e,t){Pi(e)&&Bi(e.table,n=>{let r=Object.assign(J(),n),i=t??!Z(e,`getIsVisible`,Q),a=e.getLeafColumns();for(let e=0;e<a.length;e++){let t=a[e];Pi(t)&&(r[t.id]=i)}return r})}function Q(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>Z(e,`getIsVisible`,Q)):(di(t,e.id)?t[e.id]:void 0)??!0}function Pi(e){return(e.columnDef.enableHiding??!0)&&(e.table.options.enableHiding??!0)}function Fi(e){return t=>{Ni(e,t.target.checked)}}function Ii(e){let t=e.getAllCells(),n=[];for(let e=0;e<t.length;e++){let r=t[e];Z(r.column,`getIsVisible`,Q)&&n.push(r)}let{start:r,end:i}=e.table.atoms.columnPinning?.get()??ji();if(!r.length&&!i.length)return n;let a=Z(e,`getVisibleCellsByColumnId`,Li),o=[];for(let e=0;e<r.length;e++){let t=a[r[e]];t&&o.push(t)}let s=[];for(let e=0;e<i.length;e++){let t=a[i[e]];t&&s.push(t)}let c=[];for(let e=0;e<n.length;e++){let t=n[e],a=t.column.id;!r.includes(a)&&!i.includes(a)&&c.push(t)}return[...o,...c,...s]}function Li(e){let t=J(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];Z(r.column,`getIsVisible`,Q)&&(t[r.column.id]=r)}return t}function Ri(e){return e.getAllFlatColumns().filter(e=>Z(e,`getIsVisible`,Q))}function zi(e){return e.getAllLeafColumns().filter(e=>Z(e,`getIsVisible`,Q))}function Bi(e,t){vi(e,`columnVisibility`,t)}function Vi(e,t){Bi(e,t?J():Object.assign(J(),q(e.initialState.columnVisibility??{})))}function Hi(e,t){t??=!Ui(e);let n=J(),r=e.getAllLeafColumns();for(let e=0;e<r.length;e++){let i=r[e];n[i.id]=t||!Pi(i)}Bi(e,n)}function Ui(e){return!e.getAllLeafColumns().some(e=>!Z(e,`getIsVisible`,Q))}function Wi(e){return e.getAllLeafColumns().some(e=>Z(e,`getIsVisible`,Q))}function Gi(e){return t=>{Hi(e,t.target.checked)}}function Ki(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];Z(i,`getIsVisible`,Q)&&i.columns.length&&(n=Math.max(n,Ki(i.columns,t+1)))}return n}function qi(e,t){return e?`${e}_${t}`:String(t)}function Ji(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function Yi(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function Xi(e,t,n,r,i,a){let o={depth:t,id:qi(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=Ai(n,u,{id:Ji(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Yi(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&Xi(s,t-1,n,r,i,a)}function Zi(e){for(let t=0;t<e.length;t++){let n=e[t];if(!Z(n.column,`getIsVisible`,Q))continue;let r=0;if(n.subHeaders.length){Zi(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];Z(t.column,`getIsVisible`,Q)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function Qi(e,t,n,r){let i=Ki(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=Ai(n,t[e],{depth:i,index:e}));return Xi(s,i-1,n,r,a,o),a.reverse(),Zi(a[0]?.headers??[]),a}function $i(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function ea(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=$i(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function ta(e){let t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{let e=new Map;for(let t=0;t<n.length;t++){let r=n[t];e.set(r.id,r)}for(let n=0;n<t.length;n++){let i=t[n],a=e.get(i);a&&(r.push(a),e.delete(i))}for(let t=0;t<n.length;t++){let i=n[t];e.has(i.id)&&r.push(i)}}return na(e,r)}}function na(e,t){let n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;let i=t.filter(e=>!n.includes(e.id));if(r===`remove`)return i;let a=new Map;for(let e=0;e<t.length;e++){let n=t[e];a.set(n.id,n)}let o=[];for(let e=0;e<n.length;e++){let t=a.get(n[e]);t&&o.push(t)}return[...o,...i]}function ra(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function ia(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return Z(e.table,`getOrderColumns`,ta)(t)}return[e]}function aa(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function oa(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=ea(e,o,r,n),c=o;s.columns=c.columns?oa(e,c.columns,s,r+1):[],i[a]=s}return i}function sa(e){return oa(e,e.options.columns)}function ca(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function la(e){let t=J(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function ua(e){let t=e.getAllColumns().flatMap(e=>e.getLeafColumns());return Z(e,`getOrderColumns`,ta)(t)}function da(e){let t=J(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function fa(e,t){return e.getAllFlatColumnsById()[t]}var pa={assignColumnPrototype:(e,t)=>{X(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>ra(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>ia(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{Y(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>aa(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>sa(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>ca(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>la(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>ua(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>da(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>fa(e,t)}})}};function ma(e,t){for(let n=0;n<e.subHeaders.length;n++)ma(e.subHeaders[n],t);t.push(e)}function ha(e){let t=[];return ma(e,t),t}function ga(e){return{column:e.column,header:e,table:e.column.table}}function _a(e){let{start:t,end:n}=e.atoms.columnPinning?.get()??ji(),r=e.getAllColumns(),i=Z(e,`getVisibleLeafColumns`,zi);if(!t.length&&!n.length)return Qi(r,i,e);let a=e.getAllLeafColumnsById(),o=[];for(let e=0;e<t.length;e++){let n=a[t[e]];n&&Z(n,`getIsVisible`,Q)&&o.push(n)}let s=[];for(let e=0;e<n.length;e++){let t=a[n[e]];t&&Z(t,`getIsVisible`,Q)&&s.push(t)}let c=i.filter(e=>!t.includes(e.id)&&!n.includes(e.id));return Qi(r,[...o,...c,...s],e)}function va(e){return[...e.getHeaderGroups()].reverse()}function ya(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function ba(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var xa={assignHeaderPrototype:(e,t)=>{X(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>ha(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>ga(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{Y(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>_a(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>va(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>ya(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>ba(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function Sa(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var Ca=(e,t,n,r,i,a,o)=>{let s=Sa(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=J(),c._valuesCache=J(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c},wa=/([0-9]+)/gm;function Ta(e){let t=Object.assign((e,n,r)=>{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}Ta({resolveDataValue:e=>ka(e).toLowerCase(),sort:(e,t)=>Aa(e,t)}),Ta({resolveDataValue:e=>ka(e),sort:(e,t)=>Aa(e,t)}),Ta({resolveDataValue:e=>ka(e).toLowerCase(),sort:(e,t)=>Da(e,t)}),Ta({resolveDataValue:e=>ka(e),sort:(e,t)=>Da(e,t)}),Ta({resolveDataValue:e=>Oa(e),sort:(e,t)=>e>t?1:e<t?-1:0});var Ea=Ta({sort:(e,t)=>Da(e,t)});function Da(e,t){return e===t?0:e>t?1:-1}function Oa(e){return e instanceof Date?e.getTime():e}function ka(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Aa(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n<i&&r<a;){let i=ja(e.charCodeAt(n)),a=ja(t.charCodeAt(r)),o=Ma(e,n,i),s=Ma(t,r,a);if(!i&&!a){let i=Na(e,n,o,t,r,s);if(i)return i;n=o,r=s;continue}if(i!==a)return i?1:-1;let c=Pa(e,n,o,t,r,s);if(c)return c;n=o,r=s}return Ia(e,n)-Ia(t,r)}function ja(e){return e>=48&&e<=57}function Ma(e,t,n){let r=t+1;for(;r<e.length&&ja(e.charCodeAt(r))===n;)r++;return r}function Na(e,t,n,r,i,a){let o=n-t,s=a-i,c=o<s?o:s;for(let n=0;n<c;n++){let a=e.charCodeAt(t+n),o=r.charCodeAt(i+n);if(a>o)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function Pa(e,t,n,r,i,a){let o=t;for(;o<n&&e.charCodeAt(o)===48;)o++;let s=i;for(;s<a&&r.charCodeAt(s)===48;)s++;let c=n-o,l=a-s;if(c===0&&l===0)return 0;if(c<=15&&l<=15){let t=Fa(e,o,n),i=Fa(r,s,a);return t>i?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function Fa(e,t,n){let r=0;for(let i=t;i<n;i++)r=r*10+e.charCodeAt(i)-48;return r}function Ia(e,t){let n=0,r=t;for(;r<e.length;)n++,r=Ma(e,r,ja(e.charCodeAt(r)));return n}function La(){return[]}function Ra(e,t){vi(e,`cellSelection`,t?La():q(e.initialState.cellSelection)??La())}function za(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>Ra(e))}function Ba(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>Va(e))}function Va(e,t){let n=e.initialState.expanded;vi(e,`expanded`,t?J():n===!0||Object.assign(J(),q(n??{})))}function Ha(e){let t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||Ua(t,e.id)))}function Ua(e,t){return!!(e&&e!==!0&&di(e,t)&&e[t])}var $=0,Wa=10;function Ga(){return{pageIndex:$,pageSize:Wa}}function Ka(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??$)===$)return;Xa(e,!0)}}function qa(e,t){vi(e,`pagination`,t)}function Ja(e,t){qa(e,t?Ga():q(e.initialState.pagination??Ga()))}function Ya(e,t){qa(e,n=>{let r=li(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})}function Xa(e,t){Ya(e,t?$:e.initialState.pagination?.pageIndex??$)}function Za(e,t){Qa(e,t?Wa:e.initialState.pagination?.pageSize??Wa)}function Qa(e,t){qa(e,e=>{let n=Math.max(1,li(t,e.pageSize)),r=e.pageSize===1/0?0:e.pageSize*e.pageIndex,i=n===1/0?0:Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})}function $a(e){let t=so(e),n=[];return t&&t>0&&(n=[...Array(t)].fill(null).map((e,t)=>t)),n}function eo(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function to(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=so(e);return n===-1||n!==0&&t<n-1}function no(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=so(e);return Number.isFinite(n)&&n>0&&t<n-1}function ro(e){return Ya(e,e=>e-1)}function io(e){return Ya(e,e=>e+1)}function ao(e){return Ya(e,0)}function oo(e){let t=so(e);if(!(!Number.isFinite(t)||t<=0))return Ya(e,t-1)}function so(e){let t=e.options.pageCount;if(t!=null)return t;let n=co(e),r=e.atoms.pagination?.get()?.pageSize??Wa;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function co(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function lo(){return[]}function uo(e,t){vi(e,`sorting`,t)}function fo(e,t){uo(e,t?[]:q(e.initialState.sorting??[]))}function po(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&fo(e)}function mo(e){let t=e.table._rowModelFns.sortFns,n=e.table.getFilteredRowModel().flatRows.slice(0,10),r,i=!1;for(let t=0;t<n.length;t++){let a=n[t].getValue(e.id);if(Object.prototype.toString.call(a)===`[object Date]`){r=`datetime`;break}if(typeof a==`string`&&(i=!0,a.split(wa).length>1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return Ea}function ho(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<t.length;n++){let r=t[n].getValue(e.id);if(r!=null)return typeof r==`string`?`asc`:`desc`}return`desc`}function go(e){let t=e.table._rowModelFns.sortFns;return yi(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn===`auto`?mo(e):t?.[e.columnDef.sortFn]??Ea}function _o(e,t,n){let r=yo(e,n&&xo(e)),i=t!==void 0;uo(e.table,a=>{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&xo(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function vo(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??ho(e)===`desc`?`desc`:`asc`}function yo(e,t){let n=vo(e),r=So(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function bo(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function xo(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function So(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function Co(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function wo(e){uo(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function To(e){let t=bo(e);return n=>{t&&_o(e,void 0,xo(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function Eo(){return e=>Ci({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>Oo(e,e.options.data),onAfterUpdate:Si(()=>{Ba(e),Ka(e),po(e),za(e)})})}function Do(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=Ca(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=Do(e,t,c.originalSubRows,r+1,c)))}return a}function Oo(e,t){let n={rows:[],flatRows:[],rowsById:J()};return n.rows=Do(e,n,t),n}function ko(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??Eo()(e)),e._rowModels.coreRowModel()}function Ao(e){return e.getCoreRowModel()}function jo(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function Mo(e){return e.getFilteredRowModel()}function No(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function Po(e){return e.getGroupedRowModel()}function Fo(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function Io(e){return e.getSortedRowModel()}function Lo(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function Ro(e){return e.getExpandedRowModel()}function zo(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function Bo(e){return e.getPaginatedRowModel()}var Vo={constructTableAPIs:e=>{Y(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>ko(e)},table_getPreFilteredRowModel:{fn:()=>Ao(e)},table_getFilteredRowModel:{fn:()=>jo(e)},table_getPreGroupedRowModel:{fn:()=>Mo(e)},table_getGroupedRowModel:{fn:()=>No(e)},table_getPreSortedRowModel:{fn:()=>Po(e)},table_getSortedRowModel:{fn:()=>Fo(e)},table_getPreExpandedRowModel:{fn:()=>Io(e)},table_getExpandedRowModel:{fn:()=>Lo(e)},table_getPrePaginatedRowModel:{fn:()=>Ro(e)},table_getPaginatedRowModel:{fn:()=>zo(e)},table_getRowModel:{fn:()=>Bo(e)}})}};function Ho(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function Uo(e,t,n){let r=Ho(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Wo(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function Go(e){let t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){let e=[],n=t=>{t._displayIndexCache=e.length,e.push(t),t.subRows.length&&t.getIsExpanded?.()&&t.subRows.forEach(n)};return t.forEach(n),e}for(let e=0;e<t.length;e++)t[e]._displayIndexCache=e;return t}function Ko(e,t){if(di(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function qo(e,t){if(di(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function Jo(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function Yo(e){return bi(e.subRows,e=>e.subRows)}function Xo(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function Zo(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function Qo(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function $o(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=Uo(a,e,e.table),n.set(a,o)),r[i]=o}return r}function es(e){let t=J(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function ts(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function ns(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var rs={assignRowPrototype:(e,t)=>{X(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Wo(e)},row_getAllCellsByColumnId:{fn:e=>es(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>$o(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>Yo(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>Zo(e)},row_getParentRows:{fn:e=>Qo(e)},row_getUniqueValues:{fn:(e,t)=>qo(e,t)},row_getValue:{fn:(e,t)=>Ko(e,t)},row_renderValue:{fn:(e,t)=>Jo(e,t)}})},constructTableAPIs:e=>{Y(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>Go(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>ts(t,e,n,r)},table_getRow:{fn:(t,n)=>ns(e,t,n)},table_getMaxSubRowDepth:{fn:()=>Xo(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function is(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function as(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{is(e,t,n),e._reactivity.commit?.()})}function os(e){let t=q(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function ss(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function cs(e,t,n){let r=ss(e,li(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&as(e,r.state??null)}var ls={coreCellsFeature:Oi,coreColumnsFeature:pa,coreHeadersFeature:xa,coreRowModelsFeature:Vo,coreRowsFeature:rs,coreTablesFeature:{constructTableAPIs:e=>{Y(`coreTablesFeature`,e,{table_reset:{fn:()=>os(e)},table_setOptions:{fn:t=>cs(e,t)}})}}};function us(e){return e}function ds(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),q(t)}function fs(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...ls,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=ds(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&di(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}is(v),v.store=ai(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:$r,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}var ps={getInitialState:e=>({columnVisibility:Mi(),...e}),getDefaultTableOptions:e=>({onColumnVisibilityChange:fi(`columnVisibility`,e)}),assignColumnPrototype:(e,t)=>{X(`columnVisibilityFeature`,e,t,{column_getIsVisible:{fn:e=>Q(e),memoDeps:e=>[t.options.columns,t.atoms.columnVisibility?.get(),e.columns]},column_getCanHide:{fn:e=>Pi(e)},column_getToggleVisibilityHandler:{fn:e=>Fi(e)},column_toggleVisibility:{fn:(e,t)=>Ni(e,t)}})},assignRowPrototype:(e,t)=>{X(`columnVisibilityFeature`,e,t,{row_getVisibleCells:{fn:e=>Ii(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get()]},row_getVisibleCellsByColumnId:{fn:e=>Li(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnVisibility?.get()]}})},constructTableAPIs:e=>{Y(`columnVisibilityFeature`,e,{table_getVisibleFlatColumns:{fn:()=>Ri(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getVisibleLeafColumns:{fn:()=>zi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_setColumnVisibility:{fn:t=>Bi(e,t)},table_resetColumnVisibility:{fn:t=>Vi(e,t)},table_toggleAllColumnsVisible:{fn:t=>Hi(e,t)},table_getIsAllColumnsVisible:{fn:()=>Ui(e)},table_getIsSomeColumnsVisible:{fn:()=>Wi(e)},table_getToggleAllColumnsVisibilityHandler:{fn:()=>Gi(e)}})}},ms={getInitialState:e=>({...e,pagination:{...Ga(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:fi(`pagination`,e)}),constructTableAPIs:e=>{Y(`rowPaginationFeature`,e,{table_autoResetPageIndex:{fn:()=>Ka(e)},table_setPagination:{fn:t=>qa(e,t)},table_resetPagination:{fn:t=>Ja(e,t)},table_setPageIndex:{fn:t=>Ya(e,t)},table_resetPageIndex:{fn:t=>Xa(e,t)},table_setPageSize:{fn:t=>Qa(e,t)},table_getPageCount:{fn:()=>so(e)},table_resetPageSize:{fn:t=>Za(e,t)},table_getPageOptions:{fn:()=>$a(e)},table_getCanPreviousPage:{fn:()=>eo(e)},table_getCanNextPage:{fn:()=>to(e)},table_getCanLastPage:{fn:()=>no(e)},table_previousPage:{fn:()=>ro(e)},table_nextPage:{fn:()=>io(e)},table_firstPage:{fn:()=>ao(e)},table_lastPage:{fn:()=>oo(e)},table_getRowCount:{fn:()=>co(e)}})}},hs={getInitialState(e){return{sorting:lo(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:fi(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){X(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>mo(e)},column_getAutoSortDir:{fn:e=>ho(e)},column_getSortFn:{fn:e=>go(e)},column_toggleSorting:{fn:(e,t,n)=>_o(e,t,n)},column_getFirstSortDir:{fn:e=>vo(e)},column_getNextSortingOrder:{fn:(e,t)=>yo(e,t)},column_getCanSort:{fn:e=>bo(e)},column_getCanMultiSort:{fn:e=>xo(e)},column_getIsSorted:{fn:e=>So(e)},column_getSortIndex:{fn:e=>Co(e)},column_clearSorting:{fn:e=>wo(e)},column_getToggleSortingHandler:{fn:e=>To(e)}})},constructTableAPIs(e){Y(`rowSortingFeature`,e,{table_setSorting:{fn:t=>uo(e,t)},table_resetSorting:{fn:t=>fo(e,t)}})}};function gs(e){let t=[],n=e=>{t.push(e),e.subRows.length&&Ha(e)&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function _s(){return e=>{let t=e;return Ci({feature:`rowPaginationFeature`,table:t,fnName:`table.getPaginatedRowModel`,memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>vs(t)})}}function vs(e){let t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;let{pageSize:r,pageIndex:i}=n??Ga(),{rows:a,flatRows:o,rowsById:s}=t,c=a;if(r!==1/0||i!==0){let e=r*i,t=e+r;c=a.slice(e,t)}let l;l=e.options.paginateExpandedRows?{rows:c,flatRows:o,rowsById:s}:gs({rows:c,flatRows:o,rowsById:s}),l.flatRows=[];let u=new Set,d=e=>{u.has(e.id)||(u.add(e.id),l.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d))};return l.rows.forEach(d),l}function ys(){return e=>{let t=e;return Ci({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>bs(t),onAfterUpdate:Si(()=>Ka(t))})}}function bs(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?bo(n):!1});if(!i.length)return t;let a=[];for(let t=0;t<i.length;t++){let n=i[t],r=e.getColumn(n.id);r&&a.push({id:n.id,desc:n.desc,sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortFn:go(r)})}let o=(e,t)=>{for(let n=0;n<a.length;n++){let r=a[n],i=r.sortUndefined,o=r.desc,s=0;if(i){let n=e.getValue(r.id),a=t.getValue(r.id),o=n===void 0,c=a===void 0;if(o&&c)continue;if(o||c){if(i===`first`)return o?-1:1;if(i===`last`)return o?1:-1;s=o?i:-i}}if(s===0&&(s=r.sortFn(e,t,r.id)),s!==0)return o&&(s*=-1),r.invertSorting&&(s*=-1),s}return e.index-t.index},s=e=>{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i<t.length;i++){let a=t[i];a!==e[i]&&(n=!0);let o=r.length;if(r.push(a),a.subRows.length){let e=s(a.subRows);if(e.changed){let s=Object.create(Object.getPrototypeOf(a));ui(s,a),s.subRows=e.rows,t[i]=s,r[o]=s,n=!0}}}return{rows:t,changed:n}};return{rows:s(t.rows).rows,flatRows:r,rowsById:t.rowsById}}var xs=typeof window>`u`?H.useEffect:H.useLayoutEffect;function Ss(e,t){let[{table:n,rootSource:r}]=(0,H.useState)(()=>{let t=fs({...e,features:{coreReactivityFeature:ci(),...e.features}});return t.Subscribe=(e=>ii({...e,source:e.source??t.store})),t.FlexRender=Fr,{table:t,rootSource:si(t.store,$r)}}),i=n;cs(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=ri(r,t,{compare:$r});return xs(()=>{r.markCommitted(o),as(i,a??null,$r)}),(0,H.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var Cs=us({columnVisibilityFeature:ps,rowSortingFeature:hs,rowPaginationFeature:ms,sortedRowModel:ys(),paginatedRowModel:_s()}),ws=10,Ts=10,Es=new Set([`duration`,`taskCount`,`shuffleRead`,`fetchWait`,`gcPct`,`skew`,`spill`]);function Ds(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function Os(e){return e<=0?(0,U.jsx)(U.Fragment,{children:`0`}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,` `,(0,U.jsx)(ft,{label:`RETRY`,impactBand:`critical`})]})}function ks(e,t,n){if(e<=0)return(0,U.jsx)(U.Fragment,{children:`—`});let r=B(e);if(t<=0)return(0,U.jsx)(U.Fragment,{children:r});let i=e/t;return i>.3?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,U.jsx)(ft,{label:n===`advanced`?`${Math.round(i*100)}%`:`High`,impactBand:`critical`})]}):i>.15?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,U.jsx)(ft,{label:n===`advanced`?`${Math.round(i*100)}%`:`Elevated`,impactBand:`info`})]}):(0,U.jsx)(U.Fragment,{children:r})}function As(e,t){if(!e||e<=0||!t||t<=0)return(0,U.jsx)(U.Fragment,{children:`—`});let n=t/e,r=n<.01?`${n.toExponential(1)}×`:`${n.toFixed(2)}×`;return n>2||n<.1?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,U.jsx)(ft,{label:`extreme`,impactBand:`info`})]}):(0,U.jsx)(U.Fragment,{children:r})}function js(e,t){if(e<=0)return(0,U.jsx)(U.Fragment,{children:`—`});let n=t??`unclassified`;return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[R(e),` `,(0,U.jsx)(ft,{label:ot[n],impactBand:`warning`,title:lt[n]})]})}function Ms(e,t){return!e||e<=0?0:(t??0)/e}function Ns(e){let t=new Map;for(let n of e)t.has(n.type)||t.set(n.type,[]),t.get(n.type).push(n);return[...t.values()].map(e=>{let t=mt(e);return e.find(e=>e.impactBand===t)??e[0]})}function Ps({appModel:e,catalog:t,getTaskData:n,onRoute:r}){let{openStage:i}=it(),a=Ke(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)([]),[f,p]=(0,H.useState)({pageIndex:0,pageSize:ws}),{catalogByStage:m,flaggedStageIds:h,frequency:g}=(0,H.useMemo)(()=>{let e=new Map,n=new Set;for(let r of t)r.stageId!=null&&(n.add(r.stageId),e.has(r.stageId)||e.set(r.stageId,[]),e.get(r.stageId).push(r));return{catalogByStage:e,flaggedStageIds:n,frequency:Je(t)}},[t]),_=(0,H.useMemo)(()=>{let t=[...e.stages.values()],n=o?t.filter(e=>h.has(e.id)):[...t].sort((e,t)=>(t.completedAt??0)-(t.submittedAt??0)-((e.completedAt??0)-(e.submittedAt??0))).slice(0,Ts),r=c.trim().toLowerCase();return(r?n.filter(e=>(e.name??``).toLowerCase().includes(r)||String(e.id).includes(r)):n).map(e=>({stage:e,tags:Ns(m.get(e.id)??[]),frequency:g.get(e.id)??0}))},[e.stages,o,h,m,g,c]),v=(0,H.useMemo)(()=>{if(!r)return null;let e=new Map;for(let n of t){let r=$n(n,t);r&&e.set(n,r)}return e},[t,r]),y=(0,H.useMemo)(()=>[{id:`id`,header:`Stage`,accessorFn:e=>e.stage.id,cell:({getValue:e})=>{let t=e();return(0,U.jsx)(`button`,{type:`button`,"aria-label":`Open Stage ${t} details`,className:`inline-flex cursor-pointer items-center rounded-sm hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),i(t)},children:(0,U.jsx)(`strong`,{children:t})})}},{id:`name`,header:`Operation`,accessorFn:e=>e.stage.name??``,cell:({row:e})=>{let t=e.original.stage.id;return(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[Ds(e.original.stage.name??``,40),e.original.tags.map((e,n)=>{let i=v?v.get(e)??null:null,a=i&&r?{target:i,onRoute:r}:null,o=wt(e.impactEstimate);return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[a?(0,U.jsx)(`button`,{type:`button`,"aria-label":`Investigate ${a.target.findingLabel} in Stage ${t}`,title:`Investigate ${a.target.findingLabel} in Stage ${t}`,className:`inline-flex cursor-pointer items-center rounded-full hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),a.onRoute(a.target)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:(0,U.jsx)(Ue,{type:e.type,impactBand:e.impactBand,plainBadge:!0})}):(0,U.jsx)(Ue,{type:e.type,impactBand:e.impactBand}),o?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}):null]},n)})]})}},{id:`type`,header:`Type`,accessorFn:e=>e.stage.stageType??``,cell:({row:e})=>(0,U.jsx)(tt,{variant:`outline`,children:e.original.stage.stageType??`—`})},{id:`duration`,header:`Duration`,accessorFn:e=>(e.stage.completedAt??0)-(e.stage.submittedAt??0),cell:({getValue:e})=>(0,U.jsx)(U.Fragment,{children:B(e())})},{id:`taskCount`,header:`Tasks`,accessorFn:e=>e.stage.taskCount},{id:`retried`,header:`Retried`,accessorFn:e=>e.stage.failedTasks??0,cell:({getValue:e})=>Os(e())},{id:`shuffleRead`,header:`Shuffle Read`,accessorFn:e=>e.stage.shuffleReadBytes??0,cell:({getValue:e})=>(0,U.jsx)(U.Fragment,{children:R(e())})},{id:`fetchWait`,header:`Fetch Wait`,accessorFn:e=>e.stage.fetchWaitTime??0,cell:({row:e})=>ks(e.original.stage.fetchWaitTime??0,e.original.stage.executorRunTime??0,a)},...a===`advanced`?[{id:`ioRatio`,header:`I/O Ratio`,accessorFn:e=>e.stage.inputBytes?(e.stage.outputBytes??0)/e.stage.inputBytes:0,cell:({row:e})=>As(e.original.stage.inputBytes??0,e.original.stage.outputBytes??0)}]:[],{id:`spill`,header:`Spill (mem)`,accessorFn:e=>e.stage.memoryBytesSpilled??0,cell:({row:e})=>js(e.original.stage.memoryBytesSpilled??0,e.original.stage.spillClassification)},...a===`advanced`?[{id:`gcPct`,header:`GC%`,accessorFn:e=>e.stage.gcPct??0,cell:({getValue:e})=>(0,U.jsxs)(U.Fragment,{children:[e().toFixed(1),`%`]})},{id:`skew`,header:`Skew P95/median`,accessorFn:e=>Ms(e.stage.taskDurationP50,e.stage.taskDurationP95),cell:({getValue:e})=>{let t=e();return(0,U.jsx)(U.Fragment,{children:t>0?`${t.toFixed(1)}×`:`—`})}}]:[],{id:`frequency`,header:`Flagged`,accessorFn:e=>e.frequency,cell:({getValue:e})=>{let t=e();return t<=1?(0,U.jsx)(U.Fragment,{children:`—`}):(0,U.jsx)(tt,{variant:`outline`,children:`Flagged by ${t}`})}}],[t,r,v,i,a]),b=Ss({features:Cs,data:_,columns:y,state:{sorting:u,pagination:f},sortDescFirst:!1,onSortingChange:d,onPaginationChange:p});function x(){s(e=>!e),d([]),p({pageIndex:0,pageSize:ws})}let S=e=>e===`asc`?` ▲`:e===`desc`?` ▼`:``,C=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`;return(0,U.jsx)(I,{title:`Stage Summary`,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(oe,{type:`text`,value:c,onChange:e=>{l(e.target.value),p(e=>({...e,pageIndex:0}))},placeholder:`Filter by stage name or ID…`,"aria-label":`Filter by stage name or ID`,className:`max-w-xs`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Scroll sideways to see all columns →`}),(0,U.jsx)(Ve,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:o?`Top ${Ts} by duration`:`Problems only`})]}),(0,U.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[`Showing `,_.length,` stage`,_.length===1?``:`s`,`: `,` `,o?`problems only`:`top ${Ts} by duration`,`.`]}),(0,U.jsxs)(rt,{children:[(0,U.jsx)(pt,{children:b.getHeaderGroups().map(e=>(0,U.jsx)(F,{children:e.headers.map(e=>{let t=e.column.getIsSorted(),n=e.column.getToggleSortingHandler();return(0,U.jsxs)(ut,{scope:`col`,tabIndex:e.column.getCanSort()?0:void 0,"aria-sort":C(t),className:N(e.column.getCanSort()&&`tap-target-comfortable cursor-pointer select-none`,Es.has(e.column.id)&&`text-right`),onClick:n,onKeyDown:e=>{n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[G(e.column.columnDef.header,e.getContext()),S(t)]},e.id)})},e.id))}),(0,U.jsx)($e,{children:b.getRowModel().rows.length===0?(0,U.jsx)(F,{children:(0,U.jsx)(P,{colSpan:y.length,className:`text-muted-foreground`,children:(0,U.jsxs)(`span`,{className:`flex items-center justify-center gap-2 py-2`,children:[(0,U.jsx)(je,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`No stages to show.`]})})}):b.getRowModel().rows.map(e=>(0,U.jsx)(F,{className:`cursor-pointer`,onClick:()=>i(e.original.stage.id),children:e.getVisibleCells().map(e=>(0,U.jsx)(P,{className:Es.has(e.column.id)?`text-right`:void 0,children:G(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]}),b.getPageCount()>1?(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[(0,U.jsx)(Ve,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.previousPage(),disabled:!b.getCanPreviousPage(),children:`Previous`}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,f.pageIndex+1,` of `,b.getPageCount()]}),(0,U.jsx)(Ve,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.nextPage(),disabled:!b.getCanNextPage(),children:`Next`})]}):null]})})}var Fs=20,Is=24,Ls=40,Rs=200,zs=640;function Bs(e,t=Fs){let n=[...e].filter(e=>e.submittedAt&&e.completedAt),r=n.length;return r<=t?{stages:n.sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!1}:{stages:[...n].sort((e,t)=>t.completedAt-t.submittedAt-(e.completedAt-e.submittedAt)).slice(0,t).sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!0}}function Vs({appModel:e,catalog:t}){let{openStage:n}=it(),r=[...e.stages.values()].filter(e=>e.submittedAt&&e.completedAt),i=r.length,o=r.reduce((e,t)=>Math.min(e,t.submittedAt),1/0),s=e.app?.startTime??(Number.isFinite(o)?o:0),d=new Set(t.filter(e=>e.stageId!=null).map(e=>e.stageId)),m=Ke(),[g,_]=(0,H.useState)(()=>m===`advanced`?i:Fs),{stages:v}=Bs(r,g),y=bt(v).map(e=>({stageId:e.id,label:`Stage ${e.id}`,wait:e.submittedAt-s,duration:e.completedAt-e.submittedAt,flagged:d.has(e.id)})),b=Math.min(zs,Math.max(Rs,y.length*Is+Ls)),x=b-Ls,S=Math.max(1,Math.floor(x/Is)),C=Math.max(1,Math.ceil(y.length/S));return(0,U.jsx)(I,{title:`Job Timeline`,summary:i>0?(0,U.jsx)(V,{value:`${i} stage${i===1?``:`s`}`,context:`${d.size} flagged`}):void 0,children:i===0?(0,U.jsx)(ht,{tone:`neutral`,icon:je,title:`No stages in this run.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`label`,{htmlFor:`timeline-topn`,children:`showing top`}),(0,U.jsx)(`input`,{id:`timeline-topn`,type:`number`,min:1,max:i,value:Math.min(g,i),onChange:e=>{let t=parseInt(e.target.value,10);Number.isFinite(t)||(t=g),_(Math.max(1,Math.min(i,t)))},className:`w-16 rounded border border-input bg-transparent px-1 py-0.5`,"aria-label":`Number of stages to show`}),(0,U.jsxs)(`span`,{children:[`of `,i,` by duration · flagged in red`]})]}),(0,U.jsx)(O,{ariaLabel:`Job timeline: stage durations by time from app start.`,height:b,table:{caption:`Job timeline: stage durations by time from app start`,columns:[`Stage`,`Start`,`Duration`],rows:y.map(e=>[e.label,B(e.wait),B(e.duration)]),align:[`left`,`right`,`right`]},children:(0,U.jsxs)(l,{data:y,layout:`vertical`,children:[(0,U.jsx)(c,{stroke:j.muted,strokeOpacity:.2,horizontal:!1}),(0,U.jsx)(p,{type:`number`,tickFormatter:e=>`${Math.round(e/1e3)}s`,tick:{fontSize:10},tickCount:10}),(0,U.jsx)(f,{type:`category`,dataKey:`label`,tick:{fontSize:10},width:64,interval:0,tickFormatter:(e,t)=>t%C===0?e:``}),(0,U.jsx)(h,{formatter:(e,t)=>t===`Duration`?B(Number(e)):[null,null]}),(0,U.jsx)(u,{dataKey:`wait`,stackId:`timeline`,fill:`transparent`,name:`Wait`}),(0,U.jsx)(u,{dataKey:`duration`,stackId:`timeline`,name:`Duration`,cursor:`pointer`,onClick:e=>n(e.payload.stageId),children:y.map(e=>(0,U.jsx)(a,{fill:e.flagged?j.critical:j.accent,stroke:e.flagged?j.critical:`none`,strokeWidth:e.flagged?2:0},e.stageId))})]})})]})})}var Hs={present:`present`,disabled:`disabled`,notEmitted:`not emitted`,notApplicable:`not applicable`,outsideEventLog:`outside event log`,unknown:`unknown`},Us={present:`info`,disabled:`warning`,notEmitted:`warning`,notApplicable:`muted`,outsideEventLog:`muted`,unknown:`muted`};function Ws({entry:e}){let t=e.evidence?.count,n=T(),r=`${e.summary}${t==null?``:` · ${t} observed`}`,{tooltipProps:i,srOnlyTooltip:a}=te(r);return(0,U.jsxs)(`li`,{id:`evidence-availability-${e.key}`,tabIndex:-1,ref:t=>n(e.key,t),className:`flex flex-col gap-0.5 rounded-md px-2 py-1 outline-none focus:ring-2 focus:ring-ring`,...i,children:[(0,U.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(M,{impactBand:Us[e.state]}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:se(e.key)})]}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:Hs[e.state]}),a]}),(0,U.jsx)(L,{children:(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})})]})}function Gs(e){return Object.keys(Hs).map(t=>[t,e.filter(e=>e.state===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${Hs[e]}`).join(` · `)}function Ks({ledger:e}){let{evidenceCardOpen:t,setEvidenceCardOpen:n}=ne();return(0,U.jsx)(I,{title:`Evidence availability`,open:t,onOpenChange:n,summary:(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?Gs(e.entries):`Unavailable for this restored run`}),children:e?(0,U.jsx)(`ul`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-2`,"aria-label":`Evidence availability ledger`,children:e.entries.map(e=>(0,U.jsx)(Ws,{entry:e},e.key))}):(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Evidence availability is unavailable for this restored run.`})})}var qs=64;function Js(e,t){return t>=1?e:`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function Ys(e){return[{key:`startup`,label:`Startup`,value:e.startup,color:j.info,fillOpacity:1},{key:`stagesActive`,label:`Stages active`,value:e.stagesActive,color:j.clean,fillOpacity:1},{key:`gaps`,label:`Scheduler gaps`,value:e.gaps,color:j.warning,fillOpacity:1},{key:`idle`,label:`Idle`,value:e.idle,color:j.muted,fillOpacity:.6}].filter(e=>e.value>0).map(e=>({...e,legendColor:Js(e.color,e.fillOpacity)}))}var Xs=(0,H.memo)(function({appModel:e}){let{app:n,stages:r}=e,a=Le(n,r);if(a.total<=0)return null;let o=Ys(a),s=e=>a.total>0?e/a.total*100:0,c=o.reduce((e,t)=>t.value>e.value?t:e,o[0]),d=[o.reduce((e,t)=>({...e,[t.key]:t.value}),{name:`total`})];return(0,U.jsxs)(I,{title:`Wall-Clock Breakdown`,badges:(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[B(a.total),` total`]}),summary:(0,U.jsx)(V,{value:`${c.label} ${Math.round(s(c.value))}%`,context:`of ${B(a.total)} total`}),children:[(0,U.jsx)(O,{ariaLabel:`Wall-clock breakdown: ${B(a.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:qs,table:{caption:`Wall-clock time breakdown`,columns:[`Segment`,`Duration`,`% of total`],rows:o.map(e=>[e.label,B(e.value),`${Math.round(s(e.value))}%`]),align:[`left`,`right`,`right`]},children:(0,U.jsxs)(l,{data:d,layout:`vertical`,stackOffset:`expand`,margin:{top:0,right:0,bottom:0,left:0},children:[(0,U.jsx)(p,{type:`number`,hide:!0,domain:[0,1]}),(0,U.jsx)(f,{type:`category`,dataKey:`name`,hide:!0}),(0,U.jsx)(h,{shared:!1,labelFormatter:()=>``,formatter:(e,t)=>[B(Number(e)),t]}),(0,U.jsx)(i,{wrapperStyle:{fontSize:12},itemSorter:e=>o.findIndex(t=>t.key===e.dataKey),formatter:(e,t)=>{let n=o.find(e=>e.key===t.dataKey);return(0,U.jsx)(`span`,{style:{color:n?.color},children:e})},content:e=>(0,U.jsx)(t,{...e,payload:e.payload?.map(e=>{let t=o.find(t=>t.key===e.dataKey);return t?{...e,color:t.legendColor}:e})})}),o.map(e=>(0,U.jsx)(u,{dataKey:e.key,name:e.label,stackId:`wallclock`,fill:e.color,fillOpacity:e.fillOpacity},e.key))]})}),(0,U.jsx)(L,{children:(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground`,children:o.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`inline-block size-2.5 rounded-sm`,style:{backgroundColor:e.color,opacity:e.fillOpacity}}),e.label,` (`,B(e.value),`)`]},e.key))})})]})}),Zs=36e5,Qs=5,$s={totalCoreHours:null,usefulCoreHours:null,wastedCoreHours:null,totalCores:null,topStages:[]};function ec(e,t=[],n){if(!n||e?.startTime==null||e?.endTime==null)return $s;let r=e.endTime-e.startTime;if(r<=0)return $s;let i=ze(e,t);if(i<=0)return $s;let a=i*r/Zs,o=(n.busyCoreMs??0)/Zs;return{totalCoreHours:a,usefulCoreHours:o,wastedCoreHours:Math.max(0,a-o),totalCores:i,topStages:Object.entries(n.perStage??{}).map(([e,t])=>({stageId:Number(e),coreMs:t?.totalTaskDurationSum??0})).sort((e,t)=>t.coreMs-e.coreMs).slice(0,Qs)}}function tc({appModel:e}){let t=ec(e.app,e.executors.added,e.runAggregates);if(t.totalCoreHours==null)return null;let n=t.totalCoreHours>0?Math.round(t.wastedCoreHours/t.totalCoreHours*100):0;return(0,U.jsx)(I,{title:`Wasted Core-Hours`,statusBadge:(0,U.jsx)(un,{}),defaultCollapsed:!0,summary:(0,U.jsx)(V,{value:(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:W(t.wastedCoreHours)}),context:`wasted of ${W(t.totalCoreHours)} allocated`}),children:(0,U.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,U.jsxs)(`p`,{children:[`Allocated: `,(0,U.jsx)(`strong`,{children:W(t.totalCoreHours)}),` · Used:`,` `,(0,U.jsx)(`strong`,{children:W(t.usefulCoreHours)})]}),(0,U.jsxs)(`p`,{children:[(0,U.jsx)(M,{impactBand:`info`}),` Wasted: `,(0,U.jsx)(`strong`,{children:W(t.wastedCoreHours)}),` (`,n,`% of allocated)`]}),(0,U.jsx)(L,{children:(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Allocated = `,t.totalCores,` cores over the run; used = core-time that actually ran tasks.`]})}),t.topStages.length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Top stages by task core-time`}),(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:t.topStages.map(e=>(0,U.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,U.jsxs)(`span`,{children:[`Stage `,e.stageId]}),(0,U.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:W(e.coreMs/36e5)})]},e.stageId))})]})]})})}function nc({appModel:e,catalog:t,getTaskData:n,activeFileId:r,onRoute:i}){return(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Full app report`}),(0,U.jsx)(Xs,{appModel:e}),(0,U.jsx)(Vs,{appModel:e,catalog:t}),(0,U.jsx)(_n,{appModel:e,activeFileId:r}),(0,U.jsx)(Ps,{appModel:e,catalog:t,getTaskData:n,onRoute:i}),(0,U.jsxs)(at,{children:[(0,U.jsx)(z,{cardId:`reference-evidence-availability`,collapsedTile:!0,children:(0,U.jsx)(Ks,{ledger:e.evidenceAvailability})}),(0,U.jsx)(z,{cardId:`reference-etl-phases`,collapsedTile:!0,children:(0,U.jsx)(mn,{appModel:e})}),(0,U.jsx)(z,{cardId:`reference-scaling-sim`,collapsedTile:!0,children:(0,U.jsx)(kn,{appModel:e})}),(0,U.jsx)(z,{cardId:`reference-efficiency-model`,collapsedTile:!0,children:(0,U.jsx)(dn,{appModel:e})}),(0,U.jsx)(z,{cardId:`reference-wasted-core-hours`,collapsedTile:!0,children:(0,U.jsx)(tc,{appModel:e})}),(0,U.jsx)(z,{cardId:`reference-core-usage-histogram`,collapsedTile:!0,children:(0,U.jsx)(on,{appModel:e,getTaskData:n})})]})]})}function rc({appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,options:a,onRoute:o,activeTab:s,onActiveTabChange:c}){let{selection:l}=Jt(),u=(0,H.useMemo)(()=>Bt(t,l),[t,l]),d=(0,H.useMemo)(()=>Bt(n??[],l),[n,l]),f=u.length+d.length,p=t.length+(n??[]).length>0&&f===0;return(0,U.jsxs)(`main`,{className:`flex-1 space-y-6 p-4`,children:[(0,U.jsx)(en,{options:a,resultCount:f}),p&&(0,U.jsx)(Yt,{}),(0,U.jsx)(Rn,{appModel:e,catalog:u}),!p&&(0,U.jsxs)(ce,{value:s,onValueChange:e=>c(e),children:[(0,U.jsxs)(ee,{variant:`chrome`,"aria-label":`Report view`,children:[(0,U.jsx)(le,{value:`findings`,className:`tap-target-comfortable`,children:`Findings`}),(0,U.jsx)(le,{value:`full-report`,className:`tap-target-comfortable`,children:`Full app report`})]}),(0,U.jsxs)(Ae,{value:`findings`,keepMounted:!0,children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Findings`}),(0,U.jsx)(xr,{appModel:e,catalog:u,configFindings:d,stages:e.stages,getTaskData:r,activeFileId:i,onRoute:o})]}),(0,U.jsx)(Ae,{value:`full-report`,keepMounted:!0,children:(0,U.jsx)(nc,{appModel:e,catalog:u,getTaskData:r,configFindings:d,activeFileId:i,onRoute:o})})]})]})}function ic(){let{resetToDropZone:e,startLoad:t,getTaskData:n}=Re(),r=He(e=>e.appModel),i=He(e=>e.catalog),a=He(e=>e.activeFileId),o=He(e=>e.exportMode),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=Te(a),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(`findings`),{referenceOpen:m}=ne(),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[y,b]=(0,H.useState)(null),x=(0,H.useRef)(0),S=(0,H.useRef)(null),C=(0,H.useRef)(null),ee=(0,H.useRef)(new Map),te=(0,H.useRef)(new Map),w=(0,H.useRef)(null),re=h?.target??null;(0,H.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]),(0,H.useEffect)(()=>{m&&p(`full-report`)},[m]);let T=(0,H.useCallback)(e=>{S.current?.token===e&&(S.current=null,C.current=null,g(t=>t?.token===e?null:t))},[]),E=(0,H.useCallback)(e=>{if(S.current?.token!==e.token)return null;let{catalog:t,activeFileId:n}=Be.getState();if(C.current!==n)return null;let r=$n(e.target.finding,t);return!r||r.widgetId!==e.target.widgetId||r.region!==e.target.region?null:r},[]),ie=(0,H.useCallback)(e=>{p(`findings`);let t=x.current+1;x.current=t;let{catalog:n,activeFileId:r}=Be.getState(),i=$n(e.finding,n);if(!i||i.widgetId!==e.widgetId||i.region!==e.region){S.current=null,C.current=null,g(null);return}let a={target:i,token:t};S.current=a,C.current=r,g(a)},[]),ae=(0,H.useCallback)((e,t)=>{ee.current.set(e,t);let n=S.current;return n?.target.widgetId===e&&E(n)&&t.open(),()=>{ee.current.get(e)===t&&ee.current.delete(e)}},[E]),oe=(0,H.useCallback)((e,t)=>(te.current.set(e,t),()=>{te.current.get(e)===t&&te.current.delete(e)}),[]),se=(0,H.useCallback)((e,t)=>{if(!t)return;let n=S.current;if(!n||n.target.widgetId!==e)return;let r=E(n);if(!r){T(n.token);return}let i=ee.current.get(e);if(!i)return;let a=i.getDisclosureButton();if(!a){T(n.token);return}let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=te.current.get(r.finding);s?(s.scrollIntoView({behavior:o?`auto`:`smooth`,block:`center`,inline:`nearest`}),s.focus({preventScroll:!0}),w.current&&clearTimeout(w.current),b(r.finding),w.current=setTimeout(()=>{w.current=null,b(null)},2e3)):(i.wrapperElement.scrollIntoView({behavior:o?`auto`:`smooth`,block:`start`,inline:`nearest`}),a.focus({preventScroll:!0}),v(e)),T(n.token)},[T,E]),ce=(0,H.useCallback)(e=>{v(t=>t===e?null:t)},[]);(0,H.useLayoutEffect)(()=>{if(!h)return;let e=E(h);if(!e){T(h.token);return}ee.current.get(e.widgetId)?.open()},[T,E,h]),(0,H.useLayoutEffect)(()=>{let e=S.current;e&&!E(e)&&T(e.token)},[a,i,T,E]);let D=He(e=>e.configFindings),O=(0,H.useMemo)(()=>Vt(i,D),[i,D]);return(0,U.jsxs)(`div`,{"data-testid":`dashboard`,className:`relative flex min-h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},onDragOver:e=>{o||(e.preventDefault(),d(!0))},onDragLeave:()=>d(!1),onDrop:e=>{if(o)return;e.preventDefault(),d(!1);let n=e.dataTransfer.files[0];n&&t(n)},children:[(0,U.jsx)(be,{onLoadNew:e,recentEntries:s,activeFileId:a,onPickRecent:c,onRemoveRecent:l}),(0,U.jsx)(qt,{options:O,fileId:a,children:(0,U.jsx)(Qe,{registerWidget:ae,registerFindingAnchor:oe,reportWidgetOpen:se,clearRouteFocus:ce,focusedWidgetId:_,activeRouteTarget:re,flashedFinding:y,children:(0,U.jsx)(rc,{appModel:r,catalog:i,configFindings:D,getTaskData:n,activeFileId:a,options:O,onRoute:ie,activeTab:f,onActiveTabChange:p})})}),(0,U.jsx)(jr,{appModel:r,catalog:i,getTaskData:n}),u&&(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80`,children:(0,U.jsx)(`p`,{className:`rounded-lg border-2 border-dashed border-primary px-6 py-4 text-lg font-medium`,children:`Drop to load a new event log`})})]})}function ac(){return(0,U.jsx)(ae,{children:(0,U.jsx)(ic,{})})}export{ac as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-D0OA_EOK.js";import{O as i,at as a,i as o,k as s,l as c,r as l,yt as u}from"./index-3vlFVNCg.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-BlMOW_pU.js";import{t as p}from"./ImpactEstimate-BGt-4WX5.js";import{t as m}from"./RowPagination-BLsm8I6i.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-DEV8JvgH.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BaeAA5cw.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O,groupConfidence:k}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`duplicatePlanSubtree`).sort((e,t)=>a[e.impactBand]-a[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e})),groupConfidence:t.every(e=>e.confidence===t[0]?.confidence)?t[0]:void 0}},[e]),A=p(D,e=>[e],h),j=c(),M=j?A.findIndex(e=>e===j.finding):null,{totalPages:N,effectivePage:P,visible:F}=y(A,T,E,M);return D.length===0?null:(0,C.jsxs)(o,{title:`Redundant Plan Subtree`,impactBand:u(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`duplicatePlanSubtree`,impactBand:u(D)??`info`,className:l}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:k?.confidence,validationRequired:k?.validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:F.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:P,totalPages:N,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as DuplicatePlanSubtree};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,i as t,l as n,o as r,p as i,s as a,v as o}from"./charts-vendor-0VMaLVLN.js";import{p as s}from"./plan-graph-vendor-B0sEms9Z.js";import{T as c,w as l}from"./useRecentFiles-D0OA_EOK.js";import{Nt as u,ct as d}from"./index-3vlFVNCg.js";function f(e){let t=u(e=>e.exportMode);return{exportMode:t,getTaskData:t?void 0:e}}var p=s(),m=5,h=30,g=220;function _(e,t){if(e.length<2)return e[0]??null;let n=e[1]-e[0],r=Math.round((t-e[0])/n);return e[Math.min(e.length-1,Math.max(0,r))]}function v({metrics:s,fieldNames:u,markers:f={}}){let v=u.indexOf(`duration`);if(v===-1)return null;let y=u.length,b=s.length/y,x=[];for(let e=0;e<b;e++)x.push(s[e*y+v]);if(x.length<m)return(0,p.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Too few tasks (`,x.length,`) for a distribution.`]});let{labels:S,data:C}=d(x,h),w=S[1]-S[0],T=S.map((e,t)=>({bin:`${(e/1e3).toFixed(1)}s`,range:`${(e/1e3).toFixed(1)}s – ${((e+w)/1e3).toFixed(1)}s`,ms:e,count:C[t]})),E=f.p50==null?null:_(S,f.p50),D=f.p95==null?null:_(S,f.p95),O=E==null?void 0:T.find(e=>e.ms===E)?.bin,k=D==null?void 0:T.find(e=>e.ms===D)?.bin;return(0,p.jsx)(c,{title:`Task duration`,ariaLabel:`Task duration histogram`,height:g,table:{caption:`Task duration histogram`,columns:[`Duration bin`,`Task count`],rows:T.map(e=>[e.range,e.count]),align:[`right`,`right`]},children:(0,p.jsxs)(t,{data:T,children:[(0,p.jsx)(e,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),(0,p.jsx)(a,{dataKey:`bin`,tick:{fontSize:10}}),(0,p.jsx)(r,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,p.jsx)(o,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Count`],labelFormatter:(e,t)=>t?.[0]?.payload?.range??e}),(0,p.jsx)(n,{dataKey:`count`,name:`Tasks`,fill:l.accent}),O?(0,p.jsx)(i,{x:O,stroke:l.accent,label:`P50`}):null,k?(0,p.jsx)(i,{x:k,stroke:l.warning,label:`P95`}):null]})})}export{f as n,v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{It as t}from"./index-3vlFVNCg.js";var n=e(),r={clean:{box:`border-clean/40 bg-clean/10`,icon:`text-clean`,title:`text-clean`},neutral:{box:`border-border/60 bg-muted/40`,icon:`text-muted-foreground`,title:`text-foreground`}};function i({icon:e,tone:i=`neutral`,title:a,description:o,action:s,className:c}){let l=r[i];return(0,n.jsxs)(`div`,{className:t(`flex items-start gap-3 rounded-xl border p-4`,l.box,c),children:[(0,n.jsx)(e,{"aria-hidden":`true`,className:t(`mt-0.5 size-4 shrink-0`,l.icon)}),(0,n.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,n.jsx)(`p`,{className:t(`text-sm font-medium`,l.title),children:a}),o?(0,n.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}):null]}),s]})}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,at as a,ft as o,i as s,l as c,mt as l,yt as u}from"./index-3vlFVNCg.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as f}from"./ImpactEstimate-BGt-4WX5.js";import{t as p}from"./RowPagination-BLsm8I6i.js";import{n as m}from"./finding-anchor-DEV8JvgH.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";var g=e(t(),1),_=n();function v({finding:e}){let t=m([e]);return(0,_.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,_.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,_.jsx)(r,{impactBand:e.impactBand,className:`mt-1.5`}),(0,_.jsx)(`strong`,{children:o(`pct`,l(e))}),` average executor utilization`]}),(0,_.jsx)(f,{finding:e}),(0,_.jsx)(`p`,{children:e.recommendation})]})}var y=(0,g.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,r]=(0,g.useState)(0),f=(0,g.useMemo)(()=>e.filter(e=>e.type===`utilization`).slice().sort((e,t)=>a[e.impactBand]-a[t.impactBand]),[e]),m=c(),y=m?f.findIndex(e=>e===m.finding):null,{totalPages:b,effectivePage:x,visible:S}=h(f,n,r,y);return f.length===0?null:(0,_.jsxs)(s,{title:`Executor Utilization`,impactBand:u(f),badges:(0,_.jsx)(i,{type:`utilization`,impactBand:u(f)??`info`}),defaultCollapsed:t,summary:(0,_.jsx)(d,{value:`${o(`pct`,l(f[0]))} average`,context:`${f.length} item${f.length===1?``:`s`} flagged`}),children:[(0,_.jsx)(`div`,{className:`space-y-2 text-sm`,children:S.map(e=>(0,_.jsx)(v,{finding:e},e.id))}),(0,_.jsx)(p,{page:x,totalPages:b,onPrev:()=>r(e=>e-1),onNext:()=>r(e=>e+1)})]})});export{y as ExecutorUtilization};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-D0OA_EOK.js";import{O as i,i as a,k as o,l as s,ut as c,yt as l}from"./index-3vlFVNCg.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-BGt-4WX5.js";import{t as f}from"./RowPagination-BLsm8I6i.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m,t as h}from"./finding-anchor-DEV8JvgH.js";import{t as g}from"./usePagedRows-jNUWgVTD.js";import{n as _,t as v}from"./useSortMode-BaeAA5cw.js";import{t as y}from"./StageHeader-BTzGkK8k.js";var b=e(t(),1),x=n(),S=`GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.`;function C(e){return[...e].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))}function w({finding:e,appModel:t}){let n=m([e]),i=(e.stageId==null?void 0:t.stages.get(e.stageId))?.executorRunTime;return(0,x.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${h} transition-colors ${n.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(y,{stageId:e.stageId,appModel:t}),(0,x.jsx)(o,{children:(0,x.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`GC: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]}),` · Executor run time:`,` `,(0,x.jsx)(`strong`,{children:c(i??0)})]}),(0,x.jsx)(d,{finding:e}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation})]})}function T({title:e,findings:t,appModel:n,page:r,setPage:i,routeTarget:a,orderBy:o}){let s=o(C(t),e=>[e],e=>e.stageId),c=a?s.findIndex(e=>e===a.finding):null,{totalPages:l,effectivePage:u,visible:d}=g(s,r,i,c);return(0,x.jsxs)(`section`,{className:`space-y-2`,children:[(0,x.jsxs)(`h4`,{className:`font-heading text-sm font-medium`,children:[e,` · `,t.length,` stage`,t.length===1?``:`s`]}),(0,x.jsx)(`ul`,{className:`space-y-3`,children:d.map(e=>(0,x.jsx)(w,{finding:e,appModel:n},e.stageId))}),(0,x.jsx)(f,{page:u,totalPages:l,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1)})]})}function E({catalog:e,appModel:t,defaultCollapsed:n=!0}){let[r,c]=(0,b.useState)(0),[d,f]=(0,b.useState)(0),{sortMode:m,setSortMode:h,orderBy:g}=v(),[y,C]=(0,b.useState)(!n),w=s(),E=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!E.current){E.current=!0;return}c(0),f(0)},[t]);let D=e.filter(e=>e.type===`gc`);if(D.length===0)return null;let O=D.filter(e=>e.direction!==`low`),k=D.filter(e=>e.direction===`low`),A=l(D),j=[...D].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))[0];return(0,x.jsx)(a,{title:`GC Pressure`,impactBand:A,badges:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{type:`gc`,impactBand:A??`info`}),p(D,D.length,y)?(0,x.jsx)(_,{mode:m,onChange:e=>{h(e),c(0),f(0)}}):null]}),defaultCollapsed:n,open:y,onOpenChange:C,summary:(0,x.jsx)(u,{value:`${j.value}%`,context:`${D.length} stage${D.length===1?``:`s`} flagged`}),children:(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(o,{children:(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S})}),O.length>0&&(0,x.jsx)(T,{title:`GC overhead`,findings:O,appModel:t,page:r,setPage:c,routeTarget:w,orderBy:g}),k.length>0&&(0,x.jsx)(T,{title:`Low GC (cost)`,findings:k,appModel:t,page:d,setPage:f,routeTarget:w,orderBy:g})]})})}export{E as GcPressure};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{lt as r,ut as i}from"./index-3vlFVNCg.js";var a=e(t(),1),o=n();function s(e){return e===0?`0s`:i(e)}function c(e,t){let n=s(e),r=s(t);return n===r?r:`${n}-${r}`}function l(e){let t=Math.round(e.value*10)/10;switch(e.unit){case`bytes`:return r(e.value);case`ms`:return s(e.value);case`mbSeconds`:return`${t.toLocaleString(`en-US`)} MB-s`;case`coreHours`:return`${t.toFixed(1)} core-h`;case`coreMs`:return`${t.toLocaleString(`en-US`)} core-ms`;default:return String(e.value)}}function u(e){return/^0(\.0+)?(?:[^0-9.]|$)/.test(e)}function d(e){if(!e)return null;if(e.wallClock){if(e.wallClock.high<=0)return null;let t=s(e.wallClock.high);return u(t)?null:t}if(e.rawWaste){if(e.rawWaste.value<=0)return null;let t=l(e.rawWaste);return u(t)?null:t}return null}function f({finding:e}){let t=(0,a.useId)(),n=e.impactEstimate;if(!n)return null;let r=n.wallClock&&n.wallClock.high>0?s(n.wallClock.high):null,i=r&&!u(r)?c(n.wallClock.low,n.wallClock.high):null,d=n.rawWaste&&n.rawWaste.value>0?l(n.rawWaste):null,f=!i&&d&&!u(d)?d:null,p=i??f;if(!p)return null;let m=`Estimate method: ${n.estimateMethod}`;return(0,o.jsxs)(`span`,{className:`impact-estimate text-xs text-muted-foreground`,title:m,tabIndex:0,"aria-describedby":t,children:[`Potential savings: `,(0,o.jsx)(`strong`,{children:p}),(0,o.jsx)(`span`,{id:t,className:`sr-only`,children:m})]})}export{c as i,d as n,l as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n}from"./index-3vlFVNCg.js";import{t as r}from"./ImpactEstimate-BGt-4WX5.js";var i=e();function a({finding:e}){let{recommendation:t}=e;return(0,i.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`ApplicationEnd event: `,(0,i.jsx)(`strong`,{children:`missing`})]}),(0,i.jsx)(r,{finding:e}),(0,i.jsxs)(`div`,{className:`space-y-1 pt-1`,children:[(0,i.jsx)(`p`,{children:`This run’s event log never recorded an ApplicationEnd event.`}),t?(0,i.jsx)(`p`,{children:t}):null]})]})}function o({catalog:e,defaultCollapsed:r=!0}){let o=e.find(e=>e.type===`incompleteRun`);if(!o)return null;let{impactBand:s}=o;return(0,i.jsx)(n,{title:`Incomplete Run`,impactBand:s,badges:(0,i.jsx)(t,{type:`incompleteRun`,impactBand:s}),defaultCollapsed:r,children:(0,i.jsx)(a,{finding:o})})}export{o as IncompleteRun};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n,k as r}from"./index-3vlFVNCg.js";import{t as i}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as a}from"./ImpactEstimate-BGt-4WX5.js";var o=e();function s({finding:e}){let t=e.failedJobs,n=e.totalJobs,i=e.failedTasks,s=e.totalTasks,c=e.taskFailureRate,{value:l,recommendation:u}=e;return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,o.jsxs)(`p`,{children:[`Failure rate: `,(0,o.jsxs)(`strong`,{children:[l,`%`]}),` (`,t,` of `,n,` completed jobs)`]}),(0,o.jsx)(r,{children:(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Task-failure context: `,i,` of `,s,` tasks failed (`,c,`%).`]})}),(0,o.jsx)(a,{finding:e}),u?(0,o.jsx)(`p`,{children:u}):null]})}function c({catalog:e,defaultCollapsed:r=!0}){let a=e.find(e=>e.type===`jobFailureRate`);if(!a)return null;let{impactBand:c,value:l}=a,u=a.failedJobs,d=a.totalJobs;return(0,o.jsx)(n,{title:`Job Failures`,impactBand:c,badges:(0,o.jsx)(t,{type:`jobFailureRate`,impactBand:c}),defaultCollapsed:r,summary:(0,o.jsx)(i,{value:`${l}%`,context:`${u} of ${d} completed jobs failed`}),children:(0,o.jsx)(s,{finding:a})})}export{c as JobFailures};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,b as i}from"./useRecentFiles-D0OA_EOK.js";import{D as a,O as o,at as s,ft as c,i as l,k as u,l as d,mt as f,yt as p}from"./index-3vlFVNCg.js";import{t as m}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as h}from"./ImpactEstimate-BGt-4WX5.js";import{t as g}from"./RowPagination-BLsm8I6i.js";import{n as _}from"./finding-anchor-DEV8JvgH.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";var y=e(t(),1),b=n();function x(e){let t=f(e),n=c(`pct`,t);return e.variant===`idleCores`?`${n} of allocated core-time idle`:e.variant===`memoryBand`?e.rule===`heapNearCapacity`?`${n} of allocated heap used: near capacity`:`${n} of allocated heap used: over-provisioned`:`~${t.toLocaleString(`en-US`)} MB-seconds wasted`}function S(e){let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?` ${t}`:`; ${t.slice(n+2)}`}function C(e){if(e.rule==null)return null;let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?null:` ${t.slice(0,n)}.`}function w(e){return`executorId`in e&&e.executorId!=null?`Executor ${e.executorId}`:e.variant===`idleCores`?`Idle cores`:`Memory waste`}function T({finding:e}){let t=_([e]);return e.dataUnavailable?(0,b.jsx)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:(0,b.jsx)(u,{children:(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:e.recommendation})})}):(0,b.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,b.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,b.jsx)(a,{impactBand:e.impactBand,className:`mt-1.5`}),(0,b.jsx)(`strong`,{children:w(e)})]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x(e),S(e),C(e)==null?null:(0,b.jsx)(u,{children:C(e)})]}),(0,b.jsx)(h,{finding:e})]})}var E=(0,y.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,a]=(0,y.useState)(0),{findings:c,groupConfidence:f}=(0,y.useMemo)(()=>{let t=e.filter(e=>e.type===`memoryUtilization`).sort((e,t)=>s[e.impactBand]-s[t.impactBand]),n=t.filter(i);return{findings:t,groupConfidence:n.every(e=>e.confidence===n[0]?.confidence)?n[0]:void 0}},[e]),h=d(),_=h?c.findIndex(e=>e===h.finding):null,{totalPages:x,effectivePage:S,visible:C}=v(c,n,a,_);if(!c.some(i))return null;let E=c.find(e=>!e.dataUnavailable)??c[0];return(0,b.jsxs)(l,{title:`Memory Utilization`,impactBand:p(c),badges:(0,b.jsx)(o,{type:`memoryUtilization`,impactBand:p(c)??`info`}),statusBadge:(0,b.jsx)(u,{children:(0,b.jsx)(r,{confidence:f?.confidence,validationRequired:f?.validationRequired,evidenceKey:`executorMetrics`})}),defaultCollapsed:t,summary:(0,b.jsx)(m,{value:w(E),context:`${c.length} item${c.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`div`,{className:`space-y-2 text-sm`,children:C.map(e=>(0,b.jsx)(T,{finding:e},e.id))}),(0,b.jsx)(g,{page:S,totalPages:x,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})});export{E as MemoryUtilization};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-D0OA_EOK.js";import{O as i,at as a,i as o,k as s,l as c,r as l,yt as u}from"./index-3vlFVNCg.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-BlMOW_pU.js";import{t as p}from"./ImpactEstimate-BGt-4WX5.js";import{t as m}from"./RowPagination-BLsm8I6i.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-DEV8JvgH.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BaeAA5cw.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`overBroadcast`).sort((e,t)=>a[e.impactBand]-a[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Oversized Broadcast Join`,impactBand:u(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`overBroadcast`,impactBand:u(D)??`info`,className:l}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as OverBroadcast};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-D0OA_EOK.js";import{O as i,Pt as a,at as o,i as s,l as c,lt as l,mt as u,yt as d}from"./index-3vlFVNCg.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./ImpactEstimate-BGt-4WX5.js";import{t as m}from"./RowPagination-BLsm8I6i.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g,t as _}from"./finding-anchor-DEV8JvgH.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";import{n as y,t as b}from"./useSortMode-BaeAA5cw.js";import{t as x}from"./StageHeader-BTzGkK8k.js";import{a as S,i as C,n as w,r as T,t as E}from"./select-kuy1MiAo.js";import{t as D}from"./PlanExplorer-_2oB5ouy.js";var O=e(t(),1),k=n();function A(e){if(e.rule===`lowShuffleParallelism`)return`${u(e)} tasks carrying the shuffle`;let t=u(e);return e.rule===`maxPartitionTooBig`?`Largest partition ${l(t)} (too large)`:`Largest partition ${l(t)}`}function j({entry:e,appModel:t}){let n=a(),i=g(e.partitions),o=n===`advanced`&&r(e.stageId,t);return(0,k.jsxs)(`div`,{ref:i.ref,tabIndex:i.tabIndex,"data-flashed":i.dataFlashed,className:`space-y-2 ${_} transition-colors ${i.flashClassName}`,children:[(0,k.jsx)(x,{stageId:e.stageId,appModel:t}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.partitions.map((e,t)=>(0,k.jsxs)(`span`,{children:[t>0?` · `:``,A(e)]},e.id))}),(0,k.jsx)(p,{finding:e.partitions[0]}),(0,k.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,k.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground`,children:e.partitions.map(e=>(0,k.jsxs)(`li`,{children:[e.recommendation,` `,(0,k.jsx)(p,{finding:e})]},e.id))}),o?(0,k.jsx)(D,{stageId:e.stageId,appModel:t}):null]})]})}var M=(0,O.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,a]=(0,O.useState)(0),[l,u]=(0,O.useState)(!n),{sortMode:p,setSortMode:g,orderBy:_}=b(),x=c(),{partitionFindings:D,sorted:A,orderedEntries:M}=(0,O.useMemo)(()=>{let e=t.filter(e=>e.type===`partitionSizing`),n=new Map;for(let t of e){if(t.stageId==null)continue;let e=n.get(t.stageId);e?(e.partitions.push(t),o[t.impactBand]<o[e.impactBand]&&(e.impactBand=t.impactBand)):n.set(t.stageId,{stageId:t.stageId,partitions:[t],impactBand:t.impactBand})}let r=[...n.values()].sort((e,t)=>o[e.impactBand]-o[t.impactBand]||e.stageId-t.stageId);return{partitionFindings:e,sorted:r,orderedEntries:_(r,e=>e.partitions,e=>e.stageId)}},[t,p]),N=x?M.findIndex(e=>e.partitions.includes(x.finding)):null,{totalPages:P,effectivePage:F,visible:I}=v(M,r,a,N);if(D.length===0){let t=e.stages.size;return(0,k.jsx)(s,{title:`Partition Sizing`,open:l,onOpenChange:u,summary:(0,k.jsx)(f,{value:`No issues`,context:`no issue detected: partition sizing checked across ${t} stage${t===1?``:`s`}`}),children:(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No partition-sizing issues detected.`})})}let L=d(D),R=h(D,A.length,l);return(0,k.jsx)(s,{title:`Partition Sizing`,impactBand:L,open:l,onOpenChange:u,summary:(0,k.jsx)(f,{value:`Stage ${A[0].stageId}`,context:`${A.length} stage${A.length===1?``:`s`} flagged`}),badges:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(i,{type:`partitionSizing`,impactBand:L??`info`}),R?(0,k.jsx)(y,{mode:p,onChange:e=>{g(e),a(0)}}):null]}),children:(0,k.jsxs)(`div`,{className:`space-y-4`,children:[I.map(t=>(0,k.jsx)(j,{entry:t,appModel:e},t.stageId)),(0,k.jsx)(m,{page:F,totalPages:P,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1),renderJumpControl:()=>(0,k.jsxs)(E,{value:String(F*6),onValueChange:e=>a(Math.floor(Number(e)/6)),children:[(0,k.jsx)(C,{size:`sm`,"aria-label":`Jump to stage`,children:(0,k.jsx)(S,{placeholder:`Jump to stage`})}),(0,k.jsx)(w,{children:M.map((e,t)=>(0,k.jsxs)(T,{value:String(t),children:[`Stage `,e.stageId]},e.stageId))})]})})]})})});export{M as PartitionSizing};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r,r as i}from"./useRecentFiles-D0OA_EOK.js";import{C as a,Dt as o,Ot as s,S as c,x as l}from"./index-3vlFVNCg.js";var u=e(t(),1),d=n();function f({stageId:e,appModel:t}){let[n,f]=(0,u.useState)(!1);return r(e,t)?(0,d.jsx)(`div`,{className:`space-y-3`,children:(0,d.jsxs)(l,{open:n,onOpenChange:f,children:[(0,d.jsxs)(a,{"aria-expanded":String(n),className:`flex cursor-pointer items-center gap-2 bg-transparent text-left`,children:[(0,d.jsx)(`h3`,{className:`font-heading text-sm font-medium`,children:`Plan context`}),n?(0,d.jsx)(o,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,d.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]}),(0,d.jsx)(c,{keepMounted:!0,children:(0,d.jsx)(`div`,{className:`pt-3`,children:(0,d.jsx)(i,{stageId:e,appModel:t})})})]})}):null}export{f as t};
|