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.
Files changed (219) hide show
  1. package/index.js +1 -1
  2. package/lib/static-files.js +5 -4
  3. package/package.json +4 -3
  4. package/public/assets/AutoscalingChurn-B96FKx97.js +1 -0
  5. package/public/assets/CacheUtilization-lKua3J1x.js +1 -0
  6. package/public/assets/CachingOpportunity-U0g-8HPV.js +1 -0
  7. package/public/assets/ColdStart-w8QYTNKo.js +1 -0
  8. package/public/assets/ConfigAudit-ClZp5BpV.js +1 -0
  9. package/public/assets/CoreUsageArea-o3kqQwyi.js +1 -0
  10. package/public/assets/Dashboard-Bjl-MYMm.js +1 -0
  11. package/public/assets/DuplicatePlanSubtree-Cm_UU3lY.js +1 -0
  12. package/public/assets/DurationHistogram-ltF-7M0A.js +1 -0
  13. package/public/assets/EmptyState-BCA3xioa.js +1 -0
  14. package/public/assets/ExecutorUtilization-Cn69i0uq.js +1 -0
  15. package/public/assets/GcPressure-CYsmU1d7.js +1 -0
  16. package/public/assets/ImpactEstimate-BGt-4WX5.js +1 -0
  17. package/public/assets/IncompleteRun-s6uQ8OLf.js +1 -0
  18. package/public/assets/JobFailures-DJ2dDvPA.js +1 -0
  19. package/public/assets/MemoryUtilization-C9G7P94X.js +1 -0
  20. package/public/assets/OverBroadcast-DYauoYWQ.js +1 -0
  21. package/public/assets/PartitionSizing-Cz_B0-uG.js +1 -0
  22. package/public/assets/PlanExplorer-_2oB5ouy.js +1 -0
  23. package/public/assets/PlanGraphRoute-Cj-GWM8W.js +1 -0
  24. package/public/assets/RetryWaste-D_m8ASwP.js +1 -0
  25. package/public/assets/RowPagination-BLsm8I6i.js +1 -0
  26. package/public/assets/ShuffleIO-pyDhxdaz.js +1 -0
  27. package/public/assets/Skew-BGLJuZZR.js +1 -0
  28. package/public/assets/SlowHost-ChdWVvGO.js +1 -0
  29. package/public/assets/SmallFiles-gTilBtjW.js +1 -0
  30. package/public/assets/SpeculationWaste-CVzgJnSj.js +1 -0
  31. package/public/assets/Spill-NGJGQaTB.js +1 -0
  32. package/public/assets/StageFailed-sGhki53z.js +1 -0
  33. package/public/assets/StageFindingGroup-AyI7BMd3.js +1 -0
  34. package/public/assets/StageHeader-BTzGkK8k.js +1 -0
  35. package/public/assets/StagePill-BlMOW_pU.js +1 -0
  36. package/public/assets/StageShape-DfOW93Z1.js +1 -0
  37. package/public/assets/StageSlowness-BMZ-K_5e.js +1 -0
  38. package/public/assets/Straggler-dffcAN7t.js +1 -0
  39. package/public/assets/TaskFailures-DGDwUK2A.js +1 -0
  40. package/public/assets/TinyTask-CfT8zZDr.js +1 -0
  41. package/public/assets/UnderBroadcast-CiOiJ0k1.js +1 -0
  42. package/public/assets/WidgetLeadSummary-BdUUi7L5.js +1 -0
  43. package/public/assets/charts-vendor-0VMaLVLN.js +59 -0
  44. package/public/assets/downsample-WmNM1qc9.js +1 -0
  45. package/public/assets/finding-anchor-DEV8JvgH.js +1 -0
  46. package/public/assets/impact-sort-DxaUheWV.js +1 -0
  47. package/public/assets/inbox-_QCYkBsP.js +1 -0
  48. package/public/assets/index-3vlFVNCg.js +9 -0
  49. package/public/assets/index-CjVklAdW.css +2 -0
  50. package/public/assets/parser-worker-B2bc0lWe.js +112 -0
  51. package/public/assets/plan-graph-vendor-B0sEms9Z.js +7 -0
  52. package/public/assets/plan-graph-vendor-DLioOiRN.css +1 -0
  53. package/public/assets/react-vendor-D2TLlSzI.js +9 -0
  54. package/public/assets/rolldown-runtime-hePW80VL.js +1 -0
  55. package/public/assets/select-kuy1MiAo.js +1 -0
  56. package/public/assets/toggle-group-CUd-KWkp.js +1 -0
  57. package/public/assets/usePagedRows-jNUWgVTD.js +1 -0
  58. package/public/assets/useRecentFiles-D0OA_EOK.js +11 -0
  59. package/public/assets/useSortMode-BaeAA5cw.js +1 -0
  60. package/public/docs/404.html +3 -3
  61. package/public/docs/assets/{app.BgzsaTS3.js → app.APoq_UBs.js} +1 -1
  62. package/public/docs/assets/chunks/@localSearchIndexroot.CvM5fuxe.js +1 -0
  63. package/public/docs/assets/chunks/{VPLocalSearchBox.DOq3t-On.js → VPLocalSearchBox.B3TPzlHq.js} +1 -1
  64. package/public/docs/assets/chunks/theme.PavXO_vz.js +2 -0
  65. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.CWpj01WU.js +1 -0
  66. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.CWpj01WU.lean.js +1 -0
  67. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.CgzUsQ6W.js +1 -0
  68. package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DYCDPgkh.js → contributor-guide_architecture_impact-estimation.md.CooslVJt.js} +1 -1
  69. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.js +1 -0
  70. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js +1 -0
  71. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.R27gQrgY.js +1 -0
  72. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.IbnfNrV3.js +6 -0
  73. package/public/docs/assets/{style.DXOMCXxn.css → style.DSixAiZE.css} +1 -1
  74. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.js → user-guide_alternative-log-retrieval.md.B4tPGIal.js} +1 -1
  75. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.lean.js → user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js} +1 -1
  76. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +3 -0
  77. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.lean.js +1 -0
  78. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.js → user-guide_mcp-tools.md.Vi3RoflJ.js} +3 -3
  79. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.lean.js → user-guide_mcp-tools.md.Vi3RoflJ.lean.js} +1 -1
  80. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.js +1 -0
  81. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.lean.js +1 -0
  82. package/public/docs/assets/user-guide_understanding-findings.md.DL1UDhvR.js +1 -0
  83. package/public/docs/assets/user-guide_understanding-findings.md.DL1UDhvR.lean.js +1 -0
  84. package/public/docs/contributor-guide/architecture/board-widgets.html +6 -6
  85. package/public/docs/contributor-guide/architecture/detector-contract.html +6 -6
  86. package/public/docs/contributor-guide/architecture/drill-down.html +4 -4
  87. package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -6
  88. package/public/docs/contributor-guide/architecture/index.html +4 -4
  89. package/public/docs/contributor-guide/architecture/overview.html +4 -4
  90. package/public/docs/contributor-guide/architecture/state-and-history.html +6 -6
  91. package/public/docs/contributor-guide/architecture/widget-rendering.html +6 -6
  92. package/public/docs/contributor-guide/architecture/worker-protocol.html +6 -6
  93. package/public/docs/contributor-guide/contributing.html +4 -4
  94. package/public/docs/contributor-guide/development-setup.html +4 -4
  95. package/public/docs/contributor-guide/testing.html +4 -4
  96. package/public/docs/hashmap.json +1 -1
  97. package/public/docs/index.html +4 -4
  98. package/public/docs/tuning-reference/anti-patterns.html +4 -4
  99. package/public/docs/tuning-reference/aqe.html +4 -4
  100. package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -4
  101. package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -4
  102. package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -4
  103. package/public/docs/tuning-reference/bottleneck-failures.html +4 -4
  104. package/public/docs/tuning-reference/bottleneck-gc.html +4 -4
  105. package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -4
  106. package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -4
  107. package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -4
  108. package/public/docs/tuning-reference/bottleneck-shuffle.html +4 -4
  109. package/public/docs/tuning-reference/bottleneck-skew.html +4 -4
  110. package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -4
  111. package/public/docs/tuning-reference/bottleneck-small-files.html +4 -4
  112. package/public/docs/tuning-reference/bottleneck-spill.html +4 -4
  113. package/public/docs/tuning-reference/bottleneck-straggler.html +4 -4
  114. package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +4 -4
  115. package/public/docs/tuning-reference/bottleneck-utilization.html +4 -4
  116. package/public/docs/tuning-reference/caching.html +4 -4
  117. package/public/docs/tuning-reference/cluster-config.html +4 -4
  118. package/public/docs/tuning-reference/config.html +4 -4
  119. package/public/docs/tuning-reference/data-formats.html +4 -4
  120. package/public/docs/tuning-reference/index.html +4 -4
  121. package/public/docs/tuning-reference/intro.html +4 -4
  122. package/public/docs/tuning-reference/joins.html +4 -4
  123. package/public/docs/tuning-reference/memory-model.html +4 -4
  124. package/public/docs/tuning-reference/metrics.html +4 -4
  125. package/public/docs/tuning-reference/partitioning.html +4 -4
  126. package/public/docs/tuning-reference/pyspark.html +4 -4
  127. package/public/docs/tuning-reference/shuffle.html +4 -4
  128. package/public/docs/tuning-reference/spark-architecture.html +4 -4
  129. package/public/docs/tuning-reference/table-formats.html +4 -4
  130. package/public/docs/user-guide/alternative-log-retrieval.html +6 -6
  131. package/public/docs/user-guide/getting-started.html +7 -7
  132. package/public/docs/user-guide/mcp-tools.html +8 -8
  133. package/public/docs/user-guide/run-comparison.html +6 -6
  134. package/public/docs/user-guide/understanding-findings.html +6 -6
  135. package/public/index.html +7 -6
  136. package/public/sample-runs/sample-run.ndjson.gz +0 -0
  137. package/vendor-core/detectors.js +149 -24
  138. package/vendor-core/docs-content/detection/cache.md +4 -3
  139. package/vendor-core/docs-content/detection/chrn.md +4 -2
  140. package/vendor-core/docs-content/detection/local.md +2 -3
  141. package/vendor-core/docs-content/detection/mem.md +3 -3
  142. package/vendor-core/docs-content/detection/spec.md +4 -3
  143. package/vendor-core/evidence-report.js +1 -1
  144. package/vendor-core/parser-worker.js +2 -2
  145. package/vendor-core/run-comparison.js +21 -2
  146. package/public/assets/AutoscalingChurn-CFJkiqxW.js +0 -1
  147. package/public/assets/CacheUtilization-kTKZBzDA.js +0 -1
  148. package/public/assets/CachingOpportunity-CU70EWcF.js +0 -1
  149. package/public/assets/ColdStart-hOI-WOvm.js +0 -1
  150. package/public/assets/ConfigAudit-B4oAksZY.js +0 -1
  151. package/public/assets/CoreUsageArea-D-dR3SQk.js +0 -1
  152. package/public/assets/Dashboard-MDhohsq4.js +0 -4
  153. package/public/assets/DuplicatePlanSubtree-54RKsfI7.js +0 -1
  154. package/public/assets/DurationHistogram-CviQyPNM.js +0 -1
  155. package/public/assets/EmptyState-v2ehFncc.js +0 -1
  156. package/public/assets/ExecutorUtilization-vHyFHgL6.js +0 -1
  157. package/public/assets/GcPressure-DINuhcno.js +0 -1
  158. package/public/assets/ImpactEstimate-C6GzFOY9.js +0 -1
  159. package/public/assets/IncompleteRun-a1kuCnU6.js +0 -1
  160. package/public/assets/JobFailures-CYwPfUhR.js +0 -1
  161. package/public/assets/MemoryUtilization-Dlfj0e_f.js +0 -1
  162. package/public/assets/OverBroadcast-BMu7Y8l9.js +0 -1
  163. package/public/assets/PartitionSizing-CvMGfSVB.js +0 -1
  164. package/public/assets/PlanExplorer-xYFme_Rx.js +0 -1
  165. package/public/assets/PlanGraphRoute-a3OGg6ET.js +0 -1
  166. package/public/assets/RetryWaste-JKRjOZ-J.js +0 -1
  167. package/public/assets/RowPagination-DypWbnic.js +0 -1
  168. package/public/assets/ShuffleIO-Mi8HiVu-.js +0 -1
  169. package/public/assets/Skew-C3iOScTC.js +0 -1
  170. package/public/assets/SlowHost-DKBg18v-.js +0 -1
  171. package/public/assets/SmallFiles-CCCB6AIu.js +0 -1
  172. package/public/assets/SpeculationWaste-DUNupw0_.js +0 -1
  173. package/public/assets/Spill-BlLdatik.js +0 -1
  174. package/public/assets/StageFailed-qtY7C7Yo.js +0 -1
  175. package/public/assets/StageFindingGroup-CoVdEZYs.js +0 -1
  176. package/public/assets/StageHeader-uDBLHgdg.js +0 -1
  177. package/public/assets/StagePill-CYCMdlIx.js +0 -1
  178. package/public/assets/StageShape-zs0mAjQJ.js +0 -1
  179. package/public/assets/StageSlowness-C7vg0u5Q.js +0 -1
  180. package/public/assets/Straggler-4BRGAQP4.js +0 -1
  181. package/public/assets/TaskFailures-CSjO23Kg.js +0 -1
  182. package/public/assets/TinyTask-6Zuovcn5.js +0 -1
  183. package/public/assets/UnderBroadcast-CePjo0ZV.js +0 -1
  184. package/public/assets/WidgetLeadSummary-DRNRVvn7.js +0 -1
  185. package/public/assets/charts-vendor-Cf1-wzeH.js +0 -59
  186. package/public/assets/downsample-D8XmJk6i.js +0 -1
  187. package/public/assets/finding-anchor-4TmpXd7j.js +0 -1
  188. package/public/assets/impact-sort-Cq6KOLqh.js +0 -1
  189. package/public/assets/inbox-DBFovbUX.js +0 -1
  190. package/public/assets/index-CHjV2-jB.js +0 -9
  191. package/public/assets/index-DMEtaP4u.css +0 -1
  192. package/public/assets/parser-worker-BMPPE37w.js +0 -64
  193. package/public/assets/plan-graph-vendor-B96a-e4N.js +0 -7
  194. package/public/assets/plan-graph-vendor-BnuhLJ6X.css +0 -1
  195. package/public/assets/react-vendor-DA6opS-q.js +0 -9
  196. package/public/assets/select-D5fK-za0.js +0 -1
  197. package/public/assets/toggle-group-lbIXRG0W.js +0 -1
  198. package/public/assets/usePagedRows-CFoZrPr4.js +0 -1
  199. package/public/assets/useRecentFiles-BPGQ6XII.js +0 -13
  200. package/public/assets/useSortMode-BOPpfLhJ.js +0 -1
  201. package/public/docs/assets/chunks/@localSearchIndexroot.PQ5JepCp.js +0 -1
  202. package/public/docs/assets/chunks/theme.BP14rGBx.js +0 -2
  203. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.js +0 -1
  204. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.lean.js +0 -1
  205. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.BOeH4d1J.js +0 -1
  206. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.js +0 -1
  207. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.lean.js +0 -1
  208. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DbqPf2OT.js +0 -1
  209. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.B93qJ_tT.js +0 -6
  210. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.js +0 -3
  211. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.lean.js +0 -1
  212. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.js +0 -1
  213. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.lean.js +0 -1
  214. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.js +0 -1
  215. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.lean.js +0 -1
  216. /package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.BOeH4d1J.lean.js → contributor-guide_architecture_detector-contract.md.CgzUsQ6W.lean.js} +0 -0
  217. /package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DYCDPgkh.lean.js → contributor-guide_architecture_impact-estimation.md.CooslVJt.lean.js} +0 -0
  218. /package/public/docs/assets/{contributor-guide_architecture_widget-rendering.md.DbqPf2OT.lean.js → contributor-guide_architecture_widget-rendering.md.R27gQrgY.lean.js} +0 -0
  219. /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
@@ -1,7 +1,8 @@
1
1
  ### `SPEC`: Speculation waste {#spec}
2
2
 
3
3
  Speculative task attempts used a lot of executor time without confirming a
4
- genuine straggler. Self-flagged low-confidence: a design spike, not yet
5
- validated against real-world runs. If task durations are just naturally
6
- variable rather than genuine stragglers, tune
4
+ genuine straggler. Self-flags a confidence that scales with how far the
5
+ wasted time sits past the threshold: these thresholds are still a design
6
+ spike, not yet validated against real-world runs. If task durations are
7
+ just naturally variable rather than genuine stragglers, tune
7
8
  `spark.speculation.multiplier`/`spark.speculation.quantile`.
@@ -269,7 +269,7 @@ function renderEvidenceValue(key , value ) {
269
269
 
270
270
  function formatWallClockRange(low , high ) {
271
271
  const fmtMs = (ms ) => (ms === 0 ? '0s' : formatDuration(ms));
272
- return low === high ? `Est. ${fmtMs(high)}` : `Est. ${fmtMs(low)}-${fmtMs(high)}`;
272
+ return low === high ? `Estimated ${fmtMs(high)}` : `Estimated ${fmtMs(low)}-${fmtMs(high)}`;
273
273
  }
274
274
 
275
275
  function formatRawWaste(rawWaste ) {
@@ -147,7 +147,7 @@ export async function runParse(
147
147
  }
148
148
 
149
149
  if (!state.app) {
150
- emit({ type: 'error', message: 'Not a Spark event log: SparkListenerApplicationStart not found.' });
150
+ emit({ type: 'error', message: 'Not a Spark event log: no application-start event found. Choose a Spark event log file, or check the docs for supported formats.' });
151
151
  return;
152
152
  }
153
153
 
@@ -203,7 +203,7 @@ export async function runParseFiles(
203
203
  }
204
204
 
205
205
  if (!state.app) {
206
- emit({ type: 'error', message: 'Not a Spark event log: SparkListenerApplicationStart not found.' });
206
+ emit({ type: 'error', message: 'Not a Spark event log: no application-start event found. Choose a Spark event log file, or check the docs for supported formats.' });
207
207
  return;
208
208
  }
209
209
 
@@ -395,6 +395,14 @@ export function buildComparison(
395
395
  );
396
396
  }
397
397
 
398
+ // matchStages' coverage is a Dice coefficient: (2 * pairs.length) / (baseCount
399
+ // + candCount). Below 0.5, more than half of each run's stages went unpaired,
400
+ // so the stage-level rows (stageSkew, baseStages/candStages) mostly show
401
+ // unrelated work side by side rather than the same stage before/after -- the
402
+ // comparison is dominated by guesswork, not genuine pairing. 0.5 is thus the
403
+ // natural midpoint for "more matched than not," not an arbitrary tuning knob.
404
+ const LOW_COVERAGE_THRESHOLD = 0.5;
405
+
398
406
  export function compareRuns(
399
407
  baseline ,
400
408
  candidate ,
@@ -405,10 +413,21 @@ export function compareRuns(
405
413
  // is the normal way to label an A/B experiment, so a mismatch must not block
406
414
  // the (matching-free, name-independent) deltas. Surface it as `low` instead.
407
415
  const namesDiffer = namesConflict(baseSnap.app, candSnap.app);
416
+ // Coverage is the other half of the signal: identical names on two runs that
417
+ // barely share any stages are just as misleading as differing names on two
418
+ // runs that match well, so either condition alone drops confidence to `low`.
419
+ const lowCoverage = match.coverage < LOW_COVERAGE_THRESHOLD;
420
+ const reason = namesDiffer && lowCoverage
421
+ ? `Run names differ and only ${(match.coverage * 100).toFixed(0)}% of stages matched, so deltas may compare different work.`
422
+ : namesDiffer
423
+ ? 'Run names differ, so deltas may compare different work.'
424
+ : lowCoverage
425
+ ? `Only ${(match.coverage * 100).toFixed(0)}% of stages matched between runs, so per-stage rows mostly compare unrelated work.`
426
+ : null;
408
427
  return {
409
428
  baselineLabel: baseline.label, candidateLabel: candidate.label,
410
- confidence: namesDiffer ? 'low' : 'ok',
411
- reason: namesDiffer ? 'Run names differ, so deltas may compare different work.' : null,
429
+ confidence: namesDiffer || lowCoverage ? 'low' : 'ok',
430
+ reason,
412
431
  matchedCoverage: match.coverage,
413
432
  metrics: metricDeltas(baseSnap, candSnap),
414
433
  findings: findingsDelta(baseSnap, candSnap),
@@ -1 +0,0 @@
1
- import{r as C,j as e}from"./react-vendor-DA6opS-q.js";import{W as k,T as A,I as T,D as B}from"./index-CHjV2-jB.js";import{I as E}from"./ImpactEstimate-C6GzFOY9.js";import{W as N}from"./WidgetLeadSummary-DRNRVvn7.js";import{j as w,C as f}from"./useRecentFiles-BPGQ6XII.js";import{d as I}from"./downsample-D8XmJk6i.js";import{k as R,C as K,X as L,Y as $,T as _,f as z,a as b,l as D}from"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";const F=60,G=6e4,H=220;function O(t,s,a,c,r){if(t.length===0&&s.length===0)return[];const x=Math.max(r,c-a),l=Math.max(1,Math.ceil(x/r)),i=[];for(let n=0;n<l;n++)i.push({tStart:a+n*r,adds:0,removes:0});const u=n=>Math.min(l-1,Math.max(0,Math.floor((n-a)/r)));for(const n of t)i[u(n.timestamp)].adds++;for(const n of s)i[u(n.timestamp)].removes++;return i}function Y(t,s){const a=Math.max(1,s-t);return Math.max(G,Math.ceil(a/F))}function U(t){if(t<=0)return 1;const a=10**Math.floor(Math.log10(t)),c=t/a;return(c<=1?1:c<=2?2:c<=5?5:10)*a}function W(t){const s=t.reduce((c,r)=>Math.max(c,Math.abs(r.added),Math.abs(r.removed)),0),a=U(s);return{domain:[-a,a],ticks:[-a,-a/2,0,a/2,a]}}function M(t){return Math.abs(t.height)<1?null:e.jsx(D,{...t})}function X({finding:t}){return e.jsxs("div",{className:"flex flex-col gap-1 transition-colors",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Short-lived executors: ",e.jsxs("strong",{children:[t.value,"%"]})]}),e.jsx(E,{finding:t}),e.jsxs("p",{className:"flex flex-wrap items-start gap-2 text-sm",children:[e.jsx(T,{impactBand:t.impactBand,className:"mt-1.5"}),e.jsxs("span",{children:[t.recommendation," ",e.jsx(B,{anchor:"#config-autoscale-bounds",children:"Tuning executorIdleTimeout and the min/max bounds"}),"."]})]})]})}const se=C.memo(function({appModel:s,activeFileId:a,catalog:c=[],defaultCollapsed:r=!0}){const x=C.useMemo(()=>{const o=s.executors.added,m=s.executors.removed;if(o.length===0&&m.length===0)return{hasEvents:!1,added:o,removed:m};const g=s.app,h=g?.startTime??0,v=g?.endTime??h,S=Y(h,v),j=I(O(o,m,h,v,S)).map(p=>({t:`${Math.round((p.tStart-h)/1e3)}s`,added:p.adds,removed:-p.removes})),y=W(j);return{hasEvents:!0,added:o,removed:m,rows:j,yAxisScale:y}},[s,a]);if(!x.hasEvents)return e.jsx(k,{title:"Autoscaling Churn",summary:e.jsx("span",{className:"text-muted-foreground text-xs",children:"No executor add/remove events (static allocation)."}),children:e.jsx("p",{className:"text-muted-foreground text-xs",children:"No executor add/remove events (static allocation)."})});const{added:l,removed:i,rows:u,yAxisScale:n}=x,d=c.find(o=>o.type==="autoscalingChurn");return e.jsx(k,{title:"Autoscaling Churn",impactBand:d?.impactBand,badges:d&&e.jsx(A,{type:"autoscalingChurn",impactBand:d.impactBand}),defaultCollapsed:r,summary:e.jsx(N,{value:`${l.length} added / ${i.length} removed`,context:d?`${d.value}% short-lived executors, ${d.impactBand}`:"executor churn events"}),children:e.jsxs("div",{className:"space-y-2",children:[d&&e.jsx(X,{finding:d}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"executors added / removed over time"}),e.jsx(w,{ariaLabel:"Executor added and removed counts per time bucket over the run.",height:H,table:{caption:"Executor added/removed counts by time bucket",columns:["Time","Executors added","Executors removed"],rows:u.map(o=>[o.t,o.added,Math.abs(o.removed)]),align:["right","right","right"]},children:e.jsxs(R,{data:u,children:[e.jsx(K,{stroke:f.muted,strokeOpacity:.2}),e.jsx(L,{dataKey:"t",tick:{fontSize:10}}),e.jsx($,{tick:{fontSize:10},width:32,domain:n.domain,ticks:n.ticks}),e.jsx(_,{formatter:(o,m)=>[Math.abs(Number(o)),m]}),e.jsx(z,{wrapperStyle:{fontSize:10}}),e.jsx(b,{dataKey:"added",name:"Added",stackId:"churn",fill:f.clean,shape:M}),e.jsx(b,{dataKey:"removed",name:"Removed",stackId:"churn",fill:f.muted,shape:M})]})})]})})});export{se as AutoscalingChurn,O as bucketChurn};
@@ -1 +0,0 @@
1
- import{r as o,j as s}from"./react-vendor-DA6opS-q.js";import{L as v,at as C,W as M,P as $,Z as L,H as P,_ as c,Q as A,J as d,I as R,n as j,j as l,T as F,D as E,S as _,A as H,ar as U,as as W}from"./index-CHjV2-jB.js";import{u as O}from"./finding-anchor-4TmpXd7j.js";import{I as V}from"./ImpactEstimate-C6GzFOY9.js";import{R as S}from"./RowPagination-DypWbnic.js";import{u as D}from"./usePagedRows-CFoZrPr4.js";import{W as G}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";const z=70;function J(a){if(!a)return"—";const t=[];return a.useMemory&&t.push("Memory"),a.useDisk&&t.push("Disk"),a.deserialized?t.push("Deserialized"):(a.useMemory||a.useDisk)&&t.push("Serialized"),(a.replication??1)>1&&t.push(`x${a.replication}`),t.join(" · ")||"—"}function k(a){return a.name||`RDD ${a.id}`}function Q(a){const t=_(k(a));return t.length<=z?t:`${t.slice(0,z)}…`}function X(a){const t=U("pct",W(a));return a.variant==="diskSpillover"?`${t} spilled to disk: ${l(a.diskSize??0)} disk / ${l(a.memorySize??0)} memory`:`${t} cached (${a.numCachedPartitions??0}/${a.numPartitions??0} partitions)`}function Z({finding:a}){const t=O([a]),m=a.rddName??`RDD ${a.rddId}`;return s.jsxs("div",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[s.jsxs("p",{className:"flex flex-wrap items-start gap-2",children:[s.jsx(R,{impactBand:a.impactBand,className:"mt-1.5"}),s.jsx("span",{children:m})]}),s.jsx(H,{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:X(a)})}),s.jsx(V,{finding:a}),s.jsx("p",{className:"text-sm",children:a.recommendation})]})}const re=o.memo(function({appModel:t,catalog:m}){const[b,h]=o.useState(0),[w,u]=o.useState(0),x=t.app?.rddInfo,r=o.useMemo(()=>x?[...x.values()].filter(e=>(e.storageLevel?.useMemory||e.storageLevel?.useDisk)&&(e.numCachedPartitions??0)>0).sort((e,i)=>(i.memorySize??0)+(i.diskSize??0)-((e.memorySize??0)+(e.diskSize??0))):[],[x]),n=o.useMemo(()=>m.filter(e=>e.type==="cacheUtilization").sort((e,i)=>v[e.impactBand]-v[i.impactBand]),[m]),p=D(r,b,h),f=C(),B=f?n.findIndex(e=>e===f.finding):null,g=D(n,w,u,B);if(r.length===0)return null;const I=e=>n.filter(i=>i.rddId===e),T=r.reduce((e,i)=>e+(i.memorySize??0)+(i.diskSize??0),0);return s.jsx("div",{"data-widget":"cache-utilization",children:s.jsxs(M,{title:"Cache Storage",impactBand:j(n),badges:s.jsxs(s.Fragment,{children:[n.length>0?s.jsx(F,{type:"cacheUtilization",impactBand:j(n)??"info"}):null,s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," cached RDD",r.length===1?"":"s",", see"," ",s.jsx(E,{anchor:"#memory-model",children:"how Spark accounts cached memory"})]})]}),defaultCollapsed:!0,summary:s.jsx(G,{value:l(T),context:"cached across memory + disk"}),children:[s.jsxs($,{children:[s.jsx(L,{children:s.jsxs(P,{children:[s.jsx(c,{children:"RDD"}),s.jsx(c,{children:"Storage level"}),s.jsx(c,{className:"text-right",children:"Cached partitions"}),s.jsx(c,{className:"text-right",children:"Memory"}),s.jsx(c,{className:"text-right",children:"Disk"})]})}),s.jsx(A,{children:p.visible.map(e=>{const i=k(e),N=Q(e),y=I(e.id);return s.jsxs(P,{children:[s.jsxs(d,{className:"max-w-80 truncate",title:i!==N?i:void 0,children:[N,y.length>0&&s.jsx(R,{impactBand:j(y)??"info",className:"ml-1.5"})]}),s.jsx(d,{children:J(e.storageLevel)}),s.jsxs(d,{className:"text-right",children:[e.numCachedPartitions," / ",e.numPartitions]}),s.jsx(d,{className:"text-right",children:l(e.memorySize??0)}),s.jsx(d,{className:"text-right",children:l(e.diskSize??0)})]},e.id)})})]}),s.jsx(S,{page:p.effectivePage,totalPages:p.totalPages,onPrev:()=>h(e=>e-1),onNext:()=>h(e=>e+1)}),n.length>0?s.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[g.visible.map(e=>s.jsx(Z,{finding:e},e.id)),s.jsx(S,{page:g.effectivePage,totalPages:g.totalPages,onPrev:()=>u(e=>e-1),onNext:()=>u(e=>e+1)})]}):null]})})});export{re as CacheUtilization};
@@ -1 +0,0 @@
1
- import{r as x,j as e}from"./react-vendor-DA6opS-q.js";import{c as R,at as v,W as b,P as N,Z as w,H as h,_ as l,Q as C,A as T,T as B,J as d,Y as u,j as I}from"./index-CHjV2-jB.js";import{u as $}from"./finding-anchor-4TmpXd7j.js";import{I as P}from"./ImpactEstimate-C6GzFOY9.js";import{R as k}from"./RowPagination-DypWbnic.js";import{u as O}from"./usePagedRows-CFoZrPr4.js";import{W}from"./WidgetLeadSummary-DRNRVvn7.js";import{R as A}from"./useRecentFiles-BPGQ6XII.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";const E=[["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"}]],H=R("git-merge",E);function M({relations:a,operator:t}){const r=t==="union"?"union":"join";return e.jsx("span",{className:"inline-flex flex-wrap items-baseline",children:a.map((i,o)=>e.jsxs("span",{children:[o>0?e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"mx-1 font-semibold uppercase text-xs tracking-wide text-primary",children:r})," "]}):null,i.relation]},i.relation))})}function S({finding:a}){const t=$([a]),r=a.variant==="composite";return e.jsxs(h,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[e.jsx(d,{children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[r?e.jsx(H,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}):null,r&&a.relations&&a.relations.length>0?e.jsx(M,{relations:a.relations,operator:a.operator}):e.jsx("span",{children:a.relation}),r?e.jsx(u,{variant:"outline",className:"text-xs uppercase border-dashed",children:a.operator?.toUpperCase()}):e.jsx(u,{variant:"secondary",className:"text-xs uppercase",children:a.format})]})}),e.jsxs(d,{children:[a.value," queries"]}),e.jsx(d,{className:"text-right",children:I(a.totalReadBytes??0)}),e.jsxs(d,{children:[e.jsx(P,{finding:a}),e.jsx("p",{className:"mt-1",children:a.recommendation})]})]})}const U=x.memo(function({catalog:t,defaultCollapsed:r=!0}){const[i,o]=x.useState(0),c=x.useMemo(()=>t.filter(s=>s.type==="cachingOpportunity").sort((s,n)=>(n.totalReadBytes??0)-(s.totalReadBytes??0)||(typeof n.value=="number"?n.value:0)-(typeof s.value=="number"?s.value:0)),[t]),p=v(),j=p?c.findIndex(s=>s===p.finding):null,{totalPages:y,effectivePage:f,visible:g}=O(c,i,o,j);if(c.length===0)return null;const m=c[0];return e.jsx(b,{title:"Caching Opportunities",impactBand:"info",badges:e.jsx(B,{type:"cachingOpportunity",impactBand:"info"}),defaultCollapsed:r,summary:e.jsx(W,{value:`${m.value}×`,context:`read by ${m.value} queries: ${m.relation}`}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs(N,{children:[e.jsx(w,{children:e.jsxs(h,{children:[e.jsx(l,{children:"Relation"}),e.jsx(l,{children:"Read by"}),e.jsx(l,{className:"text-right",children:"Data read"}),e.jsx(l,{children:"Recommendation"})]})}),e.jsx(C,{children:g.map((s,n)=>e.jsx(S,{finding:s},`${s.format}:${s.relation}:${(s.executionIds??[]).join(",")}:${n}`))})]}),e.jsxs(T,{children:[e.jsx(A,{confidence:"low"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Reuse is inferred from plan structure, not confirmed by execution. Verify before caching."})]}),e.jsx(k,{page:f,totalPages:y,onPrev:()=>o(s=>s-1),onNext:()=>o(s=>s+1)})]})})});export{U as CachingOpportunity};
@@ -1 +0,0 @@
1
- import{r as n,j as e}from"./react-vendor-DA6opS-q.js";import{L as d,at as C,W as v,T as y,I as N}from"./index-CHjV2-jB.js";import{W as P}from"./WidgetLeadSummary-DRNRVvn7.js";import{u as T}from"./finding-anchor-4TmpXd7j.js";import{c as b}from"./impact-sort-Cq6KOLqh.js";import{I as w}from"./ImpactEstimate-C6GzFOY9.js";import{u as M,S as A}from"./useSortMode-BOPpfLhJ.js";import{R as E}from"./RowPagination-DypWbnic.js";import{u as O}from"./usePagedRows-CFoZrPr4.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";import"./useRecentFiles-BPGQ6XII.js";function l(s){return`${s.value}s`}function W({finding:s}){const o=T([s]);return e.jsxs("li",{ref:o.ref,tabIndex:o.tabIndex,"data-flashed":o.dataFlashed,className:`space-y-1 text-sm transition-colors ${o.flashClassName}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(N,{impactBand:s.impactBand}),e.jsx("strong",{children:l(s)})]}),e.jsx(w,{finding:s}),e.jsx("p",{className:"text-muted-foreground pt-1",children:s.recommendation})]})}const U=n.memo(function({catalog:o,defaultCollapsed:p=!0}){const{sortMode:u,setSortMode:g,orderBy:x}=M(),[m,f]=n.useState(!p),[h,r]=n.useState(0),a=o.filter(t=>t.type==="coldStart").slice().sort((t,R)=>d[t.impactBand]-d[R.impactBand]),c=x(a,t=>[t],t=>t.stageId??null),i=C(),j=i?c.findIndex(t=>t===i.finding):null,{totalPages:S,effectivePage:I,visible:B}=O(c,h,r,j);return a.length===0?null:e.jsxs(v,{title:"Cold Start",impactBand:a[0].impactBand,badges:e.jsxs(e.Fragment,{children:[e.jsx(y,{type:"coldStart",impactBand:a[0].impactBand}),b(a,a.length,m)?e.jsx(A,{mode:u,onChange:g}):null]}),open:m,onOpenChange:f,summary:e.jsx(P,{value:l(a[0]),context:`${a.length} issue${a.length===1?"":"s"} flagged`}),children:[e.jsx("ul",{className:"space-y-2",children:B.map(t=>e.jsx(W,{finding:t},t.id))}),e.jsx(E,{page:I,totalPages:S,onPrev:()=>r(t=>t-1),onNext:()=>r(t=>t+1)})]})});export{U as ColdStart};
@@ -1 +0,0 @@
1
- import{r as m,j as e}from"./react-vendor-DA6opS-q.js";import{ag as A,L as g,at as I,A as r,W as f,n as R,T as k,I as B,D as b}from"./index-CHjV2-jB.js";import{R as c}from"./useRecentFiles-BPGQ6XII.js";import{u as w}from"./finding-anchor-4TmpXd7j.js";import{I as P}from"./ImpactEstimate-C6GzFOY9.js";import{R as S}from"./RowPagination-DypWbnic.js";import{u as D}from"./usePagedRows-CFoZrPr4.js";import{W as T}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function W({finding:n}){const t=w([n]);return e.jsxs("li",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{impactBand:n.impactBand}),e.jsx("code",{className:"text-xs",children:n.property}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"="}),e.jsx("code",{className:"rounded bg-accent/10 px-1.5 py-0.5 font-mono text-xs text-accent",children:String(n.value)})]}),e.jsx(P,{finding:n}),e.jsxs("p",{className:"text-sm",children:[n.recommendation,n.docAnchor?e.jsxs(e.Fragment,{children:[" ",e.jsxs(b,{anchor:n.docAnchor,children:["Why ",n.property," matters"]})]}):null]})]})}const H=m.memo(function({appModel:t,configFindings:l,defaultCollapsed:h=!0}){const[j,d]=m.useState(0),o=m.useMemo(()=>(l??A(t.app)).filter(s=>s.type==="configAudit").slice().sort((s,a)=>g[s.impactBand]-g[a.impactBand]),[l,t]),u=I(),y=u?o.findIndex(s=>s===u.finding):null,{totalPages:v,effectivePage:C,visible:N}=D(o,j,d,y);if(o.length===0){const s=t.evidenceAvailability?.entries.find(i=>i.key==="sparkConfiguration");let a;if(s)s.state==="present"?a="No misconfigurations detected.":s.state==="unknown"&&s.reasonCode==="parseIncomplete"?a=e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:[s.summary," "]}),e.jsx(r,{children:e.jsx(c,{evidenceKey:"sparkConfiguration"})})]}):a=e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"No environment info captured in this log. "}),e.jsx(r,{children:e.jsx(c,{evidenceKey:"sparkConfiguration"})})]});else{const i=t.app?.evidenceInputs;a=(i?i.environmentUpdates>0:Object.keys(t.app?.config??{}).length>0||!!t.app?.resources)?"No misconfigurations detected.":e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"No environment info captured in this log. "}),e.jsx(r,{children:e.jsx(c,{evidenceKey:"sparkConfiguration"})})]})}const p=e.jsx("p",{className:"text-muted-foreground text-xs",children:a});return e.jsx(f,{title:"Config Sanity",compact:!0,summary:p,children:p})}const x=R(o);return e.jsxs(f,{title:"Config Sanity",impactBand:x,badges:e.jsx(k,{type:"configAudit",impactBand:x??"info"}),statusBadge:e.jsx(r,{children:e.jsx(c,{evidenceKey:"sparkConfiguration"})}),defaultCollapsed:h,summary:e.jsx(T,{value:`${o.length}`,context:`misconfiguration${o.length===1?"":"s"} flagged`}),children:[e.jsx("ul",{className:"space-y-4",children:N.map(s=>e.jsx(W,{finding:s},s.id))}),e.jsx(S,{page:C,totalPages:v,onPrev:()=>d(s=>s-1),onNext:()=>d(s=>s+1)})]})});export{H as ConfigAudit};
@@ -1 +0,0 @@
1
- import{r as O,j as e}from"./react-vendor-DA6opS-q.js";import{az as G,W as B,A as T,D as q,I as X,T as W}from"./index-CHjV2-jB.js";import{R as $,j as J,C as l}from"./useRecentFiles-BPGQ6XII.js";import{d as Q}from"./downsample-D8XmJk6i.js";import{E as V}from"./EmptyState-v2ehFncc.js";import{I as Z}from"./ImpactEstimate-C6GzFOY9.js";import{R as tt}from"./RowPagination-DypWbnic.js";import{u as et}from"./usePagedRows-CFoZrPr4.js";import{W as at}from"./WidgetLeadSummary-DRNRVvn7.js";import{I as ot}from"./inbox-DBFovbUX.js";import{A as st,C as nt,X as it,Y as rt,T as ct,f as lt,b as mt}from"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";const D=["PROCESS_LOCAL","NODE_LOCAL","RACK_LOCAL","NO_PREF","ANY"];function dt(M,{bucketWidthMs:n=6e4,tiers:y=D}={}){const m=M.filter(a=>(a.completedAt??0)>(a.submittedAt??0)&&(a.executorRunTime??0)>0);if(m.length===0)return{labels:[],series:{}};const x=m.reduce((a,s)=>Math.min(a,s.submittedAt??a),1/0),v=m.reduce((a,s)=>Math.max(a,s.completedAt??a),-1/0),c=Math.max(1,Math.ceil((v-x)/n)),i={};for(const a of y)i[a]=new Array(c).fill(0);const g=new Array(c).fill(0);for(const a of m){const s=a.completedAt??0,h=a.submittedAt??0,u=s-h,S=(a.executorRunTime??0)/u,b=(a.localityStats??[]).reduce((t,d)=>t+d.count,0)||1,N=new Map((a.localityStats??[]).map(t=>[t.locality,t.count/b]));for(let t=0;t<c;t++){const d=x+t*n,L=d+n,p=Math.min(s,L)-Math.max(h,d);if(p<=0)continue;const k=p/n;for(const[C,I]of N){const f=S*I*k;i[C]?i[C][t]+=f:g[t]+=f}}}g.some(a=>a>0)&&(i.OTHER=g);const o=new Array(c).fill(0);for(const a of Object.keys(i))for(let s=0;s<c;s++)o[s]+=i[a][s];const E=o.reduce((a,s)=>Math.max(a,s),0);i.idle=o.map(a=>Math.max(0,E-a));const A=[];for(let a=0;a<c;a++)A.push(x+a*n);return{labels:A,series:i}}const ut=240,pt=60,z={PROCESS_LOCAL:"Process-local",NODE_LOCAL:"Node-local",RACK_LOCAL:"Rack-local",NO_PREF:"No preference",ANY:"Any",OTHER:"Other",idle:"Idle"},H={PROCESS_LOCAL:l.clean,NODE_LOCAL:l.accent,RACK_LOCAL:l.warning,NO_PREF:l.muted,ANY:l.critical,OTHER:l.muted,idle:l.muted},F="Core Usage by Locality",vt=O.memo(function({appModel:n,catalog:y,activeFileId:m,defaultCollapsed:x=!0}){const[v,c]=O.useState(0),i=O.useMemo(()=>{const t=[...n.stages.values()];if(!t.some(r=>(r.executorRunTime??0)>0&&(r.completedAt??0)>(r.submittedAt??0)))return{hasActivity:!1};const L=n.app,p=L?.startTime??0,k=L?.endTime??p,C=Math.max(6e4,Math.ceil(Math.max(1,k-p)/pt)),{labels:I,series:f}=dt(t,{bucketWidthMs:C}),w=[...D.filter(r=>f[r]),...f.OTHER?["OTHER"]:[],"idle"],P=I.map((r,_)=>{const j={t:Math.round((r-p)/1e3)};for(const R of w)j[R]=f[R]?.[_]??0;return j}),K=Q(P),U=w.filter(r=>r!=="idle"),Y=P.reduce((r,_)=>Math.max(r,U.reduce((j,R)=>j+_[R],0)),0);return{hasActivity:!0,order:w,points:P,sampled:K,peakCores:Y}},[n,m]),g=O.useMemo(()=>G([...n.stages.values()],{topN:1/0}),[n,m]),o=y.find(t=>t.type==="coreLocality"),E=y.some(t=>t.type==="memoryUtilization"&&t.variant==="idleCores"),A=g.topStages.filter(t=>t.nonLocalTasks>0),{totalPages:a,effectivePage:s,visible:h}=et(A,v,c);if(!i.hasActivity)return e.jsx(B,{title:F,summary:e.jsx("span",{className:"text-muted-foreground text-xs",children:"No stage activity to plot."}),children:e.jsx(V,{tone:"neutral",icon:ot,title:"No stage activity to plot."})});const{order:u,points:S,sampled:b,peakCores:N}=i;return e.jsx(B,{title:F,impactBand:o?.impactBand,badges:o?e.jsx(W,{type:"coreLocality",impactBand:o.impactBand}):null,defaultCollapsed:x,summary:e.jsx(at,{value:`${Math.round(N)} cores`,context:"peak concurrent, by locality"}),children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:e.jsxs("p",{className:"text-muted-foreground text-xs",children:["approximate: stage-level attribution",o?null:e.jsxs(e.Fragment,{children:[", see ",e.jsx(q,{anchor:"#bottleneck-utilization",children:"how utilization is measured"})]})]})}),o?e.jsxs("p",{className:"flex flex-wrap items-start gap-2 text-sm",children:[e.jsx(X,{impactBand:o.impactBand,className:"mt-1.5"}),e.jsxs("span",{children:[e.jsxs("strong",{children:[o.value,"% non-local"]}),": ",o.recommendation]})]}):null,o?e.jsx(Z,{finding:o}):null,e.jsx(T,{children:o?e.jsx($,{confidence:o.confidence,validationRequired:o.validationRequired}):null}),e.jsx(J,{ariaLabel:"Approximate concurrent core usage over time, stacked by task locality tier, with idle capacity shown. See the legend for tier colors.",height:ut,table:{caption:"Concurrent core usage over time by locality tier",columns:["Time (s)",...u.map(t=>z[t]??t)],rows:S.map(t=>[t.t,...u.map(d=>Math.round(t[d]))]),align:Array.from({length:u.length+1},()=>"right")},children:e.jsxs(st,{data:b,children:[e.jsx(nt,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),e.jsx(it,{dataKey:"t",tick:{fontSize:10},label:{value:"seconds from app start",position:"insideBottom",offset:-2,fontSize:10}}),e.jsx(rt,{tick:{fontSize:10},width:36,label:{value:"avg concurrent cores",angle:-90,position:"insideLeft",fontSize:10}}),e.jsx(ct,{}),e.jsx(lt,{wrapperStyle:{fontSize:10}}),u.map(t=>e.jsx(mt,{type:"monotone",dataKey:t,name:z[t]??t,stackId:"cores",stroke:H[t]??l.muted,fill:H[t]??l.muted,fillOpacity:t==="idle"?.15:.8,isAnimationActive:!1},t))]})}),e.jsx(T,{children:h.length>0?e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground",children:h.map(t=>e.jsxs("li",{children:["Stage ",t.stageId,": ",Math.round(t.ratio*100),"% non-local (",t.nonLocalTasks,"/",t.taskCount," tasks)"]},t.stageId))}),e.jsx(tt,{page:s,totalPages:a,onPrev:()=>c(t=>t-1),onNext:()=>c(t=>t+1)})]}):null}),e.jsx(T,{children:E?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Idle cores also flagged → see Memory Utilization widget"}):null})]})})});export{vt as CoreUsageArea};
@@ -1,4 +0,0 @@
1
- import{r as w,j as o,S as An,J as Dn,K as Vn,L as Bn,M as Ln,N as Hn}from"./react-vendor-DA6opS-q.js";import{c as _e,e as D,t as Je,I as se,X as zn,v as it,k as On,W as z,q as I,D as Xt,x as at,y as Se,A as H,z as Gn,E as lt,F as qn,h as Rt,i as Wn,G as Jt,H as Z,J as B,K as Qt,n as Yt,L as oe,M as ut,N as Q,O as Zt,P as ct,Q as dt,R as Un,T as pe,S as Kn,U as gt,B as $e,j as K,V as Xn,Y as bt,Z as Jn,_ as Qn,C as he,$ as Yn,a0 as Zn,u as es,a1 as de,r as kt,a2 as ts}from"./index-CHjV2-jB.js";import{m as ns,I as Qe,e as Ft,g as ss,h as rs,i as os,j as ae,C as N,R as ft,k as en,o as tn,l as nn,n as xe,p as is,q as as,s as ls,t as sn,f as ie,v as us,w as cs,x as ds,D as gs,a as fs,b as ms,c as ps,S as re,y as rn,r as hs,P as xs,z as on,A as vs,B as ws,E as Ss,F as Cs,u as ys,T as js,G as Rs,H as bs,J as It,K as $t}from"./useRecentFiles-BPGQ6XII.js";import{E as mt}from"./EmptyState-v2ehFncc.js";import{T as ks,a as Fs}from"./toggle-group-lbIXRG0W.js";import{u as an,D as Is}from"./DurationHistogram-CviQyPNM.js";import{d as Me}from"./downsample-D8XmJk6i.js";import{W as te}from"./WidgetLeadSummary-DRNRVvn7.js";import{B as Pe,C as Ce,X as le,Y as ue,a as ve,A as $s,T as ye,b as _s,L as Ms,d as Ps,e as ln,f as Ns,D as Es}from"./charts-vendor-Cf1-wzeH.js";import{S as Ts,a as As}from"./StagePill-CYCMdlIx.js";import{f as un,a as Ds,b as cn,I as Vs}from"./ImpactEstimate-C6GzFOY9.js";import{R as Bs}from"./RowPagination-DypWbnic.js";import{I as dn}from"./inbox-DBFovbUX.js";import"./plan-graph-vendor-B96a-e4N.js";const Ls=[["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"}]],Hs=_e("copy",Ls);const zs=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],Os=_e("list-filter",zs);const Gs=[["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"}]],qs=_e("search-x",Gs);const Ws=[["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"}]],Us=_e("target",Ws),pt=["critical","warning","info"];function Ye(){return{impactBands:new Set,types:new Set,stages:new Set}}function Ks(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function Xs(e,n){return ns(e,{impactBand:n.impactBands,type:n.types,stageId:n.stages})}function _t(e,n){return e.filter(t=>Xs(t,n))}function Js(e,n){const t=new Set,s=new Set,r=new Set;for(const i of[...e,...n])t.add(i.impactBand),s.add(i.type),i.stageId!=null&&r.add(i.stageId);return{impactBands:pt.filter(i=>t.has(i)),types:[...s].sort(),stages:[...r].sort((i,a)=>i-a)}}function De(e){return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function Mt(e,n){const t=new URLSearchParams(e),s=Ye();for(const i of De(t.get("impact")))pt.includes(i)&&s.impactBands.add(i);const r=new Set(n.types);for(const i of De(t.get("type")))r.has(i)&&s.types.add(i);for(const i of De(t.get("stage"))){const a=Number(i);Number.isInteger(a)&&s.stages.add(a)}return s}function Qs(e){const n=[];return e.impactBands.size&&n.push(`impact=${pt.filter(t=>e.impactBands.has(t)).join(",")}`),e.types.size&&n.push(`type=${[...e.types].sort().join(",")}`),e.stages.size&&n.push(`stage=${[...e.stages].sort((t,s)=>t-s).join(",")}`),n.length?`?${n.join("&")}`:""}const gn=w.createContext(null);function Ve(e,n){const t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}function Ys({options:e,fileId:n,children:t}){const[s,r]=w.useState(()=>Mt(typeof window>"u"?"":window.location.search,e));w.useEffect(()=>{if(typeof window>"u")return;const p=Qs(s),f=`${window.location.pathname}${p}${window.location.hash}`;window.history.replaceState(window.history.state,"",f)},[s]);const i=w.useRef(n);w.useEffect(()=>{i.current!==n&&(i.current=n,r(Ye()))},[n]),w.useEffect(()=>()=>{if(typeof window>"u")return;const p=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,"",p)},[]),w.useEffect(()=>{if(typeof window>"u")return;const p=()=>r(Mt(window.location.search,e));return window.addEventListener("popstate",p),()=>window.removeEventListener("popstate",p)},[e]);const a=w.useCallback(p=>r(f=>({...f,impactBands:Ve(f.impactBands,p)})),[]),u=w.useCallback(p=>r(f=>({...f,types:Ve(f.types,p)})),[]),c=w.useCallback(p=>r(f=>({...f,stages:Ve(f.stages,p)})),[]),l=w.useCallback(()=>r(Ye()),[]),d=w.useMemo(()=>({selection:s,toggleImpactBand:a,toggleType:u,toggleStage:c,clearAll:l}),[s,a,u,c,l]);return o.jsx(gn.Provider,{value:d,children:t})}function ht(){const e=w.useContext(gn);if(!e)throw new Error("useFindingFilter outside FindingFilterProvider");return e}function Zs(){const{clearAll:e}=ht();return o.jsx(mt,{icon:qs,title:"No findings match the active filters",description:"Adjust or clear the filters to see findings.",action:o.jsx("button",{type:"button",onClick:e,className:"cursor-pointer text-sm underline",children:"Clear all filters"})})}function Re({className:e,orientation:n="horizontal",...t}){return o.jsx(An,{"data-slot":"separator",orientation:n,className:D("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...t})}const er={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 tr(e,n,t){const s=new Set(e);for(const r of s)n.has(r)||t(r);for(const r of n)s.has(r)||t(r)}function Pt({label:e,count:n,children:t}){return o.jsxs(ss,{children:[o.jsxs(rs,{className:D(On({variant:"outline",size:"sm"}),"gap-1.5"),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,n>0&&o.jsx("span",{className:"rounded-full bg-primary px-1.5 text-xs font-medium text-primary-foreground",children:n}),o.jsx(it,{"aria-hidden":"true",className:"opacity-60"})]}),o.jsx(os,{align:"start",className:"max-h-72 w-56 overflow-y-auto",children:t})]})}function nr({options:e,resultCount:n}){const{selection:t,toggleImpactBand:s,toggleType:r,toggleStage:i,clearAll:a}=ht(),[u,c]=w.useState(""),[l,d]=w.useState(""),p=w.useMemo(()=>{const m=u.trim();return m?e.stages.filter(S=>String(S).includes(m)):e.stages},[e.stages,u]),f=w.useMemo(()=>{const m=l.trim().toLowerCase();return m?e.types.filter(S=>S.toLowerCase().includes(m)||Je(S).toLowerCase().includes(m)):e.types},[e.types,l]);if(e.impactBands.length===0&&e.types.length===0&&e.stages.length===0)return null;const g=!Ks(t),h=[...[...t.impactBands].map(m=>({key:`impact-${m}`,label:`impact ${m}`,onRemove:()=>s(m)})),...[...t.types].map(m=>({key:`type-${m}`,label:`type ${m}`,onRemove:()=>r(m)})),...[...t.stages].map(m=>({key:`stage-${m}`,label:`stage ${m}`,onRemove:()=>i(m)}))];return o.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:[o.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:[o.jsx(Os,{"aria-hidden":"true",className:"size-3.5"}),"Filter findings"]}),o.jsx("span",{role:"status","aria-live":"polite",className:"text-xs text-muted-foreground",children:g?`${n} finding${n===1?"":"s"} match${n===1?"es":""} the active filters`:`Showing all ${n} finding${n===1?"":"s"}`}),o.jsx(Re,{orientation:"vertical",className:"h-6"}),e.impactBands.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Impact"}),o.jsx(ks,{multiple:!0,"aria-label":"Filter by impact",value:[...t.impactBands],onValueChange:m=>tr(m,t.impactBands,s),children:e.impactBands.map(m=>o.jsxs(Fs,{value:m,variant:"outline",size:"sm","aria-label":`Filter by impact: ${m}`,className:D("tap-target-comfortable gap-1.5",er[m]),children:[o.jsx(se,{impactBand:m}),m]},m))})]}),e.types.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs(Pt,{label:"Type",count:t.types.size,children:[o.jsx("div",{className:"p-1",children:o.jsx(Qe,{type:"text",value:l,onChange:m=>d(m.target.value),onKeyDown:m=>m.stopPropagation(),placeholder:"Search type…","aria-label":"Search types",autoComplete:"off",className:"h-8"})}),f.map(m=>o.jsxs(Ft,{checked:t.types.has(m),onCheckedChange:()=>r(m),"aria-label":`Filter by type: ${m}`,children:[o.jsx("span",{className:"rounded bg-muted px-1 text-xs font-medium text-foreground!",children:Je(m)})," ",m]},m)),f.length===0&&o.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No matching type"})]})]}),e.stages.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs(Pt,{label:"Stage",count:t.stages.size,children:[o.jsx("div",{className:"p-1",children:o.jsx(Qe,{type:"text",value:u,onChange:m=>c(m.target.value),onKeyDown:m=>m.stopPropagation(),placeholder:"Search stage id…","aria-label":"Search stages",autoComplete:"off",className:"h-8"})}),p.map(m=>o.jsxs(Ft,{checked:t.stages.has(m),onCheckedChange:()=>i(m),"aria-label":`Filter by stage: ${m}`,children:["Stage ",m]},m)),p.length===0&&o.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No matching stage"})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.map(m=>o.jsxs("button",{type:"button",onClick:m.onRemove,"aria-label":`Remove filter: ${m.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:[m.label," ",o.jsx(zn,{"aria-hidden":"true",className:"size-3"})]},m.key)),o.jsx("button",{type:"button",onClick:a,className:"tap-target-comfortable cursor-pointer text-xs underline",children:"Clear all filters"})]})]})]})}function sr(e,n){const t=[];for(const{launch:i,finish:a}of e)a>i&&(t.push({t:i,delta:1}),t.push({t:a,delta:-1}));t.sort((i,a)=>i.t-a.t||i.delta-a.delta);const s=[];let r=0;for(let i=0;i<t.length;i++){const a=t[i];r+=a.delta;const u=t[i+1];if(!u||u.t===a.t)continue;const c=n!=null?Math.min(r,n):r;s.push({tStart:a.t,tEnd:u.t,busy:c})}return s}function rr(e,{bucketBy:n="time",bucketWidthMs:t=1e3,hypotheticalCores:s=null}={}){const r=sr(e,s);if(n==="coreCount"){const c=[];for(const l of r)c[l.busy]=(c[l.busy]??0)+(l.tEnd-l.tStart);for(let l=0;l<c.length;l++)c[l]===void 0&&(c[l]=0);return{mode:"coreCount",histogram:c}}if(r.length===0)return{mode:"time",bucketWidthMs:t,startTime:null,endTime:null,buckets:[]};const i=r[0].tStart,a=r[r.length-1].tEnd,u=[];for(let c=i;c<a;c+=t){const l=c+t;let d=0;for(const p of r){const f=Math.max(p.tStart,c),g=Math.min(p.tEnd,l);g>f&&(d+=p.busy*(g-f))}u.push({tStart:c,tEnd:l,busyCoreMs:d,avgBusyCores:d/t})}return{mode:"time",bucketWidthMs:t,startTime:i,endTime:a,buckets:u}}const or=220;async function ir(e,n){const t=[...e.stages.keys()],s=await Promise.all(t.map(a=>n(a).catch(()=>null))),r=[];let i=!1;for(const a of s){if(!a){i=!0;continue}const{metrics:u,fieldNames:c}=a,l=c.length,d=c.indexOf("launchTime"),p=c.indexOf("finishTime");if(!(d===-1||p===-1))for(let f=0;f<u.length;f+=l)r.push({launch:u[f+d],finish:u[f+p]})}return{intervals:r,incomplete:i}}function ar({appModel:e,getTaskData:n}){const{exportMode:t,getTaskData:s}=an(n),[r,i]=w.useState(null),[a,u]=w.useState(!1),[c,l]=w.useState(!1),d=e.stages.size>0;if(w.useEffect(()=>{if(!d||!c||r!==null||!s)return;let h=!1;return ir(e,s).then(({intervals:m,incomplete:S})=>{if(h)return;const{histogram:C}=rr(m,{bucketBy:"coreCount"});i(C??[]),u(S)}),()=>{h=!0}},[e,s,d,c,r]),!d)return null;const p=(r??[]).map((h,m)=>({cores:String(m),coreCount:m,ms:h})),f=Me(p),g=p.reduce((h,m)=>m.ms>h.ms?m:h,p[0]);return o.jsx(z,{title:"Core-Usage Distribution",id:"core-usage-histogram",open:c,onOpenChange:l,summary:r!==null&&g?o.jsx(te,{value:I(g.ms),context:`at ${g.coreCount} concurrent core${g.coreCount===1?"":"s"}`}):void 0,children:r===null?t?o.jsx("p",{className:"text-muted-foreground text-xs",children:"Core-usage detail isn’t included in exported reports."}):o.jsx("p",{className:"text-muted-foreground text-xs",children:"Loading core usage…"}):o.jsxs(o.Fragment,{children:[o.jsx(ae,{ariaLabel:"Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.",height:or,table:{caption:"Wall-clock time by concurrent-core count",columns:["Concurrent cores","Time"],rows:r.map((h,m)=>[m,I(h)]),align:["right","right"]},children:o.jsxs(Pe,{data:f,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"cores",tick:{fontSize:10},label:{value:"Concurrent busy cores",position:"insideBottom",offset:-5,fontSize:10}}),o.jsx(ue,{tick:{fontSize:10},width:48,tickFormatter:h=>I(h)}),o.jsx(ve,{dataKey:"ms",name:"Time",fill:N.accent})]})}),a?o.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopen this file to compute full core usage because some task data was released."}):null,o.jsxs("p",{className:"text-muted-foreground text-xs",children:["See ",o.jsx(Xt,{anchor:"#bottleneck-utilization",children:"how to read concurrent-core utilization"}),"."]})]})})}function fn({app:e,stages:n,executorsAdded:t,runAggregates:s}){const r=at(e??{},t),i=(e?.endTime??0)-(e?.startTime??0),a=Se(e,n),u=r*(i/36e5),c=a.startup+a.gaps+a.idle,l=r*(c/36e5),d=r*a.stagesActive,p=s?.busyCoreMs??0,f=Math.max(0,d-p)/36e5,g=l+f,h=u>0?Math.round(g/u*100):null;let m=0;const S=s?.perStage??{};for(const b of Object.keys(S))m+=S[b].totalTaskDurationSum;const C=r>0?m/r:0;let v=null;return(l>0||f>0)&&(v=l>=f?"driver":"executor"),{availableComputeHours:u,driverWasteHours:l,executorWasteHours:f,wastagePct:h,floorZeroSkewMs:C,dominantWaste:v}}function mn(e){const n=e?[...e.values()]:[],t=new Map;let s=0;for(const a of n){if(a.submissionTime==null||a.completionTime==null)continue;const u=a.sqlExecutionId!=null?`sql:${a.sqlExecutionId}`:`job:${a.id??s++}`,c=t.get(u);c?(c.start=Math.min(c.start,a.submissionTime),c.end=Math.max(c.end,a.completionTime)):t.set(u,{start:a.submissionTime,end:a.completionTime})}const r=[...t.entries()].sort((a,u)=>a[1].start-u[1].start),i=[];for(let a=1;a<r.length;a++)for(let u=0;u<a;u++){const[c,l]=r[u],[d,p]=r[a];p.start<l.end&&l.start<p.end&&i.push([c,d])}return{wallClockReliable:i.length===0,overlappingGroupIds:i}}const lr="This is a design-spike estimate; verify against wall-clock data before acting on it.",G=e=>`${Math.round(e*100)/100} core-h`;function pn(){return o.jsx(H,{children:o.jsx(ft,{confidence:"low",validationRequired:lr})})}function ur({appModel:e}){if(!e.runAggregates)return null;const n=fn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});if(n.availableComputeHours<=0)return null;const t=mn(e.jobs);let s=null;return n.dominantWaste==="driver"?s=o.jsxs("p",{children:[o.jsx("strong",{children:"Driver-bound waste dominates."})," Review driver sizing (spark.driver.memory / spark.driver.cores) before scaling executors."]}):n.dominantWaste==="executor"&&(s=o.jsxs("p",{children:[o.jsx("strong",{children:"Executor-bound waste dominates."})," Review executor count / cores by reducing cluster size or enabling dynamic allocation."]})),o.jsx(z,{title:"Compute Efficiency",statusBadge:o.jsx(pn,{}),defaultCollapsed:!0,summary:o.jsx(te,{value:n.wastagePct!=null?`${n.wastagePct}% wasted`:G(n.availableComputeHours),context:`of ${G(n.availableComputeHours)} available`}),children:o.jsxs("div",{className:"space-y-2 text-sm",children:[!t.wallClockReliable&&o.jsx(H,{children:o.jsx("p",{className:"text-muted-foreground",children:"This run used concurrent job groups: the driver/executor split below is approximate, not precise."})}),o.jsxs("p",{children:["Available: ",o.jsx("strong",{children:G(n.availableComputeHours)}),n.wastagePct!=null&&o.jsxs(o.Fragment,{children:[" ","· wasted ",o.jsxs("strong",{children:[n.wastagePct,"%"]})]})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Driver-bound waste: ",o.jsx("strong",{children:G(n.driverWasteHours)})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Executor-bound waste: ",o.jsx("strong",{children:G(n.executorWasteHours)})]}),o.jsxs("p",{className:"text-muted-foreground",children:["Floor (same executors, zero skew): ",I(n.floorZeroSkewMs)]}),s]})})}function cr(e){const n={extract:0,transform:0,load:0};for(const t of e.values()){const s=Math.max(0,(t.completedAt??0)-(t.submittedAt??0));if(s===0)continue;const r=(t.shuffleReadBytes??0)>0||(t.shuffleWriteBytes??0)>0;(t.inputBytes??0)>0&&(t.shuffleReadBytes??0)===0&&(n.extract+=s),r&&(n.transform+=s),(t.outputBytes??0)>0&&(n.load+=s)}return n}const Nt=[{label:"Extract",key:"extract"},{label:"Transform",key:"transform"},{label:"Load",key:"load"}];function dr({appModel:e}){const n=cr(e.stages);if(n.extract+n.transform+n.load===0)return null;const s=Nt.reduce((r,i)=>n[i.key]>n[r.key]?i:r);return o.jsx(z,{title:"ETL Phase Attribution",defaultCollapsed:!0,summary:o.jsx(te,{value:`${s.label} ${I(n[s.key])}`,context:"dominant phase"}),children:o.jsxs("div",{className:"space-y-1",children:[Nt.map(({label:r,key:i})=>o.jsxs("div",{children:[o.jsx("strong",{children:r}),": ",I(n[i])]},i)),o.jsx(H,{children:o.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."})})]})})}const gr=220;function fr(e){const n=e.app,t=e.executors.added,s=e.executors.removed;if(n?.startTime==null||n?.endTime==null)return{times:[],counts:[]};const r=n.endTime-n.startTime,i=Math.max(5e3,Math.floor(r/100)),a=[],u=[],c=new Map(s.map(l=>[l.executorId,l.timestamp]));for(let l=n.startTime;l<=n.endTime;l+=i){const d=t.filter(p=>{const f=c.get(p.executorId)??1/0;return p.timestamp<=l&&l<f}).length;a.push(((l-n.startTime)/1e3).toFixed(0)+"s"),u.push(d)}return{times:a,counts:u}}const mr=w.memo(function({appModel:n,activeFileId:t}){const{chartData:s,sampled:r,hasSeries:i,peak:a}=w.useMemo(()=>{const{times:u,counts:c}=fr(n),l=u.map((g,h)=>({label:g,count:c[h]})),d=Me(l),p=c.length>0,f=p?Math.max(...c):0;return{chartData:l,sampled:d,hasSeries:p,peak:f}},[n,t]);return i?o.jsx(z,{title:"Executor Count Over Time",summary:o.jsx(te,{value:`${a} peak`,context:"concurrent executors"}),children:o.jsx(ae,{ariaLabel:"Executor count over time. See the table below for exact values.",height:gr,table:{caption:"Executor timeline: active executor count over time",columns:["Time","Active executors"],rows:s.map(u=>[u.label,u.count]),align:["left","right"]},children:o.jsxs($s,{data:r,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"label",tick:{fontSize:10},minTickGap:24}),o.jsx(ue,{allowDecimals:!1,tick:{fontSize:10},width:32}),o.jsx(ye,{formatter:u=>[`${u} executor${u===1?"":"s"} active`,""],labelFormatter:()=>""}),o.jsx(_s,{type:"monotone",dataKey:"count",name:"Active executors",stroke:N.clean,fill:N.clean,fillOpacity:.15})]})})}):o.jsx(z,{title:"Executor Count Over Time",summary:o.jsx("span",{className:"text-muted-foreground text-xs",children:"Timeline unavailable: no end time recorded."}),children:o.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."})})}),Et=[10,20,50,80,100,110,120,150,200,300,400,500];function pr(e,n,t){return n<=0||t<=0?0:e/Math.min(t,n)}function Tt(e,n){let t=0;for(const s of Object.keys(e)){const{totalTaskDurationSum:r,taskCount:i}=e[s];t+=pr(r,i,n)}return t}function hr({app:e,stages:n,runAggregates:t,executorsAdded:s}){const r=t?.perStage??{},i=at(e??{},s),u=Se(e,n).stagesActive,c=i>0?Tt(r,i):0,l=u>0?Math.round(Math.abs(c-u)/u*100):null,d=c>0?u/c:1,p=Et.map(f=>{const g=Math.max(1,Math.round(i*f/100)),h=Math.round(Tt(r,g)*d);return{pct:f,cores:g,estMakespanMs:h}});return{baselineCores:i,testPercentages:Et,predictions:p,modelErrorPct:l}}const hn="What-If Executor Scaling",xr=220,vr=20;function wr([e,n]){const t=(n-e)*.1;return[Math.max(0,e-t),n+t]}function Sr(e){return[...e.stages.values()].some(n=>{const t=n.submittedAt,s=n.completedAt;return typeof t=="number"&&Number.isFinite(t)&&typeof s=="number"&&Number.isFinite(s)&&s>t})}function Cr(e){return e.evidenceAvailability?.entries.find(n=>n.key==="taskCoreTime")}function Be({reason:e,evidence:n}){return o.jsx(z,{title:hn,summary:o.jsxs("span",{className:"text-muted-foreground text-xs",children:["Not available: ",e]}),children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not available: ",e," ",o.jsx(ft,{evidenceKey:n})]})})}function yr({appModel:e}){const n=Cr(e);if(!(Gn(e.runAggregates)&&(n==null||n.state==="present")))return o.jsx(Be,{reason:n?.summary??"No usable task and core-time evidence in this log.",evidence:"taskCoreTime"});const s=hr({app:e.app,stages:e.stages,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(s.baselineCores<=0)return o.jsx(Be,{reason:"Baseline executor/core capacity is unavailable in this log."});if(!Sr(e))return o.jsx(Be,{reason:"Usable stage timing is unavailable in this log."});const r=mn(e.jobs),i=s.modelErrorPct!=null&&s.modelErrorPct>=vr,a=Me(s.predictions),u=s.predictions.reduce((c,l)=>l.estMakespanMs<c.estMakespanMs?l:c);return o.jsx(z,{title:hn,defaultCollapsed:!0,summary:o.jsx(te,{value:I(u.estMakespanMs),context:`best case at ${u.pct}% executors`}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(H,{children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Model Error:"," ",o.jsx("strong",{className:i?"text-warning":void 0,children:s.modelErrorPct==null?"—":`${s.modelErrorPct}%`})," ","(idealized makespan vs. observed); higher means all estimates below are less trustworthy. Predictions are unvalidated (a single log observes only one scale)."]})}),o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Move along this curve by changing ",o.jsx("code",{children:"spark.dynamicAllocation"}),"’s executor bounds, see the ",o.jsx(Xt,{anchor:"#config-autoscale-bounds",children:"autoscaling config guide"}),"."]}),r.wallClockReliable?null:o.jsx(H,{children:o.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."})}),o.jsx(H,{children:o.jsx("p",{className:"text-xs",children:o.jsx(ft,{evidenceKey:"taskCoreTime"})})}),o.jsx(ae,{ariaLabel:"Estimated makespan by executor percentage: diminishing-returns curve.",height:xr,table:{caption:"Estimated makespan by executor percentage",columns:["% Executors","Cores","Est. makespan"],rows:s.predictions.map(c=>[`${c.pct}%`,c.cores,I(c.estMakespanMs)]),align:["right","right","right"]},children:o.jsxs(Ms,{data:a,children:[o.jsx(Ce,{stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"pct",tickFormatter:c=>`${c}%`,tick:{fontSize:10}}),o.jsx(ue,{domain:wr,tickFormatter:c=>I(c),tick:{fontSize:10},width:56}),o.jsx(ye,{formatter:c=>[I(Number(c)),"Est. makespan"],labelFormatter:c=>`${c}% executors`}),o.jsx(Ps,{type:"monotone",dataKey:"estMakespanMs",name:"Est. makespan",stroke:N.accent,dot:{r:3}})]})})]})})}function xn(e){return typeof e?.startTime=="number"&&Number.isFinite(e.startTime)&&typeof e?.endTime=="number"&&Number.isFinite(e.endTime)&&e.endTime>e.startTime}function jr(e){if(!xn(e.app))return{efficiency:{value:null,unavailableReason:"application-timing"},wastage:{value:null,unavailableReason:"application-timing"}};const n=Se(e.app,e.stages),t=Math.min(100,Math.round(n.stagesActive/n.total*100));if(!e.runAggregates)return{efficiency:{value:t,unavailableReason:null},wastage:{value:null,unavailableReason:"core-usage-summary"}};const s=fn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});return!Number.isFinite(s.availableComputeHours)||s.availableComputeHours<=0?{efficiency:{value:t,unavailableReason:null},wastage:{value:null,unavailableReason:"executor-capacity"}}:{efficiency:{value:t,unavailableReason:null},wastage:{value:s.wastagePct,unavailableReason:null}}}const Rr={critical:"inset 4px 0 0 var(--color-critical)",warning:"inset 4px 0 0 var(--color-warning)"};function Le({eyebrow:e,value:n,meta:t,flag:s=null,bar:r,dataTestid:i}){return o.jsxs("div",{"data-testid":i,className:"flex flex-col gap-1 p-3",style:s?{boxShadow:Rr[s]}:void 0,children:[o.jsxs("span",{className:D("flex items-center gap-1.5 text-xs font-medium text-muted-foreground",s&&Rt[s]),children:[s&&o.jsx(se,{impactBand:s}),e]}),o.jsx("div",{className:D("font-heading text-2xl font-semibold",s&&Rt[s]),children:n}),o.jsx("p",{className:"text-xs text-muted-foreground",children:t}),r]})}function At({pct:e,flag:n,label:t}){const s=Math.max(0,Math.min(100,e));return o.jsx("div",{role:"img","aria-label":t,className:"mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:D("h-full rounded-full",n?Wn[n]:"bg-clean"),style:{width:`${s}%`}})})}function br({active:e,total:n}){const t=n>0?Math.max(0,Math.min(100,e/n*100)):0;return o.jsxs("div",{role:"img","aria-label":`Active ${I(e)} of ${I(n)} total`,className:"mt-0.5 flex h-1.5 w-full overflow-hidden rounded-full bg-muted",children:[o.jsx("div",{className:"h-full bg-clean",style:{width:`${t}%`}}),o.jsx("div",{className:"h-full flex-1 bg-muted-foreground/60"})]})}function kr(){return o.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4",children:[o.jsx(se,{impactBand:"warning",className:"mt-1.5"}),o.jsxs("p",{className:"text-sm text-warning",children:[o.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 Fr({appModel:e,catalog:n}){const t=lt(),{app:s,stages:r}=e;if(!xn(s))return o.jsx(kr,{});const a=Se(s,r),u=jr(e),c=a.total,l=u.efficiency.value,d=l==null?null:l<75?"critical":l<90?"warning":null,p=n.find(h=>h.type==="coldStart"),f=u.wastage.value,g=f==null?null:f>=70?"critical":f>=40?"warning":null;return o.jsx(qn,{className:"overflow-hidden py-0",children:o.jsxs("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0",children:[o.jsx(Le,{eyebrow:"Wall-clock",dataTestid:"kpi-wall-clock",value:c>0?I(c):"—",meta:o.jsxs(o.Fragment,{children:["Ran ",I(a.stagesActive),p?` · ${p.value}s cold start`:""]}),bar:o.jsx(br,{active:a.stagesActive,total:c})}),o.jsx(Le,{eyebrow:"Efficiency",dataTestid:"kpi-efficiency",value:l==null?"Unavailable":o.jsxs(o.Fragment,{children:[l,o.jsx("small",{children:"%"})]}),flag:d,meta:l==null?"This run has no complete application timing interval.":c>a.stagesActive?`Ran ${I(a.stagesActive)} · ${I(c-a.stagesActive)} idle/gap time`:"executors active the whole run",bar:l!=null?o.jsx(At,{pct:l,flag:d,label:`Efficiency ${l}%`}):void 0}),o.jsx(Le,{eyebrow:"Wastage",dataTestid:"kpi-wastage",value:f==null?"Unavailable":o.jsxs(o.Fragment,{children:[f,o.jsx("small",{children:"%"})]}),flag:g,meta:u.wastage.unavailableReason==="application-timing"?"Wastage needs complete application timing.":u.wastage.unavailableReason==="core-usage-summary"?"Wastage needs the core-usage summary.":u.wastage.unavailableReason==="executor-capacity"?"Wastage needs usable executor-capacity data.":t==="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:f!=null?o.jsx(At,{pct:f,flag:g,label:`Wastage ${f}%`}):void 0})]})})}function Ir({className:e,...n}){return o.jsx(Dn,{"data-slot":"accordion",className:D("flex w-full flex-col",e),...n})}function $r({className:e,...n}){return o.jsx(Vn,{"data-slot":"accordion-item",className:D("not-last:border-b",e),...n})}function _r({className:e,children:n,headingLevel:t=3,...s}){const r=`h${t}`;return o.jsx(Bn,{className:"flex",render:o.jsx(r,{}),children:o.jsxs(Ln,{"data-slot":"accordion-trigger",className:D("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),...s,children:[n,o.jsx(it,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),o.jsx(Jt,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Mr({className:e,children:n,...t}){return o.jsx(Hn,{"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",...t,children:o.jsx("div",{className:D("pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:n})})}function Dt(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Pr({type:e,label:n,thresholdSummary:t}){return o.jsxs(Z,{"data-testid":"clean-check-row","data-clean-check-type":e,children:[o.jsx(B,{className:"w-px",children:o.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:[o.jsx(Qt,{"aria-hidden":"true",className:"size-3.5 shrink-0"}),Je(e)]})}),o.jsxs(B,{className:"whitespace-normal",children:[o.jsx("span",{className:"block text-sm font-medium text-foreground",children:Dt(n)}),o.jsx(H,{children:o.jsx("span",{className:"block text-xs text-muted-foreground",children:Dt(`${t}.`)})})]})]})}const Nr="suggested-improvements",Er={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"},Tr=["per-stage","app-level","sql-scope","config-scope"],Ar={"per-stage":"Per-stage checks","app-level":"App-level checks","sql-scope":"SQL plan checks","config-scope":"Config checks"};function Dr(e,n){const t=[...e,...n].filter(en);return tn().filter(({type:r})=>!nn(r)).map(({component:r,widgetId:i,type:a},u)=>{const c=t.filter(l=>l.type===a);return{component:r,widgetId:i,index:u,findings:c,impactBand:Yt(c)}}).filter(r=>r.impactBand!==void 0).sort((r,i)=>oe[r.impactBand]-oe[i.impactBand]||r.index-i.index)}function Vr({appModel:e,catalog:n,configFindings:t=[],getTaskData:s,activeFileId:r}){const i=[...n,...t].filter(en),a=Object.keys(xe).filter(l=>!nn(l)).filter(l=>!i.some(d=>d.type===l)).map(l=>({type:l,findingLabel:xe[l].findingLabel})),u=new Map;for(const l of a){const d=Er[l.type]??"app-level";u.has(d)||u.set(d,[]),u.get(d).push(l)}const c=is();return o.jsxs(o.Fragment,{children:[o.jsx(ut,{children:c.map(({component:l,widgetId:d})=>o.jsx(Q,{cardId:`reference-${d}`,widgetId:d,children:o.jsx(w.Suspense,{fallback:o.jsx(Zt,{}),children:o.jsx(l,{appModel:e,catalog:n,configFindings:t,getTaskData:s,activeFileId:r,defaultCollapsed:!0})})},d))}),o.jsx(Ir,{children:o.jsxs($r,{value:"clean-checks",children:[o.jsx(_r,{children:"Clean checks"}),o.jsxs(Mr,{children:[o.jsxs("p",{className:"pb-2 text-xs text-muted-foreground",children:["Every check below passed. No fix needed.",o.jsx(H,{children:" Each line's caption states the threshold it was measured against."})]}),Tr.map(l=>{const d=u.get(l);return!d||d.length===0?null:o.jsxs("div",{className:"pt-3 first:pt-0",children:[o.jsx("p",{className:"pb-1 text-xs font-medium text-muted-foreground",children:Ar[l]}),o.jsx(ct,{children:o.jsx(dt,{children:d.map(({type:p,findingLabel:f})=>o.jsx(Pr,{type:p,label:f,thresholdSummary:as(p)},p))})})]},l)})]})]})})]})}function Br(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 vn(e){const n=xe[e.type],t=typeof e.recommendation=="string"?e.recommendation.trim():"";return!n?.routeable||!t?null:{finding:e,widgetId:n.widgetId,region:n.region,findingLabel:n.findingLabel,stageId:typeof e.stageId=="number"?e.stageId:null,recommendation:t}}function we(e,n){return n.includes(e)?vn(e):null}function Vt(e){return e.impactEstimate?.wallClock?.high??null}function Lr(e){const n=new Map(tn().map((s,r)=>[s.widgetId,r])),t=e.map((s,r)=>({target:vn(s),catalogIndex:r})).filter(s=>s.target!==null);return t.sort((s,r)=>{const i=Vt(s.target.finding),a=Vt(r.target.finding);return i!==null&&a!==null&&i!==a?a-i:i!==null!=(a!==null)?i!==null?-1:1:(n.get(s.target.widgetId)??Number.MAX_SAFE_INTEGER)-(n.get(r.target.widgetId)??Number.MAX_SAFE_INTEGER)||s.catalogIndex-r.catalogIndex}),t[0]?.target??null}const be=10;function Hr(e){return cs(e)&&xe[e.type]!=null}function zr(e){return sn(e.findings)[0].impactBand}function xt(e){const n=e.impactEstimate;return n?n.wallClock?un(n.wallClock.low,n.wallClock.high):n.rawWaste?Ds(n.rawWaste):null:null}function Ne(e){const n=e.stageId!=null?`St.${e.stageId}`:e.stageIds&&e.stageIds.length>0?`St.${Un(e.stageIds)}`:null;if(e.type==="duplicatePlanSubtree"&&e.rootName!=null){const t=wn(e);return n&&t?`${n} · ${t}`:t??n}return n||(e.property?String(e.property):null)}function wn(e){if(e.type!=="duplicatePlanSubtree"||e.rootName==null)return null;const n=Kn(e.rootName),t=e.groupIndex!=null?`${n} #${Number(e.groupIndex)+1}`:n;return e.executionId!=null?`${t} (SQL ${e.executionId})`:t}function vt({finding:e,textClassName:n,visibleLimit:t,stackIdentity:s,stagePillClassName:r}){const{stageId:i,stageIds:a}=e;if(i!=null)return o.jsx(Ts,{stageId:i});if(a&&a.length>0){const c=wn(e),l=c?o.jsx("span",{className:D("truncate",n),title:c,children:c}):null,d=o.jsx(As,{pills:a.map(p=>({id:p})),visibleLimit:t,pillOverrideClassName:s?r:void 0});return o.jsx("span",{className:D("inline-flex min-w-0 items-center gap-1.5",s?"flex-col":"flex-wrap"),children:s?o.jsxs(o.Fragment,{children:[l,d]}):o.jsxs(o.Fragment,{children:[d,l]})})}const u=Ne(e);return u?o.jsx("span",{className:D("min-w-0 truncate",n),title:u,children:u}):null}function fe(e){const n=typeof e.recommendation=="string"?e.recommendation.trim():"";return n||(xe[e.type]?.findingLabel??e.type)}function Or({finding:e,allFindings:n,onRoute:t}){const s=we(e,n),r=Ne(e),i=xt(e),a=fe(e),u=ie(e);return o.jsxs(Z,{"data-testid":"fix-these-first-row","data-finding-type":e.type,children:[o.jsx(B,{className:"w-px",children:o.jsx(pe,{type:e.type,impactBand:e.impactBand})}),o.jsx(B,{className:"whitespace-normal",children:o.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:()=>s&&t(s),children:[o.jsx("span",{className:"block text-sm font-medium",children:u}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:a})]})}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",title:[r,i].filter(Boolean).join(" · "),children:o.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[o.jsx(vt,{finding:e}),i?o.jsx("span",{className:"shrink-0",children:i}):null]})})]})}function Gr({finding:e,allFindings:n,onRoute:t,id:s}){const r=we(e,n),i=Ne(e),a=xt(e),u=fe(e),c=ie(e),l=e.stageId!=null||i!=null;return o.jsxs(Z,{id:s,"data-testid":"fix-these-first-row","data-finding-type":e.type,className:"bg-muted/50",children:[o.jsxs(B,{colSpan:2,className:"whitespace-normal",children:[l?o.jsx("div",{className:"mb-1",children:o.jsx(vt,{finding:e,textClassName:"line-clamp-1 break-words text-xs font-medium font-mono"})}):null,o.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:()=>r&&t(r),children:[l?null:o.jsx("span",{className:"line-clamp-1 break-words text-xs font-medium",children:c}),o.jsx("span",{className:"line-clamp-1 break-words text-xs text-muted-foreground",children:u})]})]}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",children:a})]})}function qr(e){return e.kind==="time"?`×${e.findingCount} · ${un(e.recoverableMsHigh,e.recoverableMsHigh)} recoverable`:e.kind==="resource"?`×${e.findingCount} · resource-cost projection`:Object.entries(e.byImpactBand).map(([n,t])=>`${t} ${n}`).join(", ")}function Wr({group:e,allFindings:n,expanded:t,onToggle:s,onRoute:r}){const[i,a]=w.useState(0),u=sn(e.findings),c=u[0],l=Br(c),d=ie(c),p=Math.ceil(u.length/be),f=Math.min(i,Math.max(0,p-1)),g=u.slice(f*be,f*be+be),h=`fix-these-first-group-content-${e.kind}-${e.type}${"unit"in e?`-${e.unit}`:""}`;return o.jsxs(o.Fragment,{children:[o.jsxs(Z,{"data-testid":"fix-these-first-group-row","data-finding-type":e.type,children:[o.jsx(B,{className:"w-px",children:o.jsx(pe,{type:e.type,impactBand:c.impactBand})}),o.jsx(B,{className:"whitespace-normal",children:o.jsxs("button",{type:"button","aria-expanded":t,"aria-controls":h,className:"cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",onClick:s,children:[o.jsx("span",{className:"block text-sm font-medium",children:d}),l?o.jsx("span",{className:"block text-xs text-muted-foreground",children:l}):null]})}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",children:o.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",children:[qr(e),t?o.jsx(Jt,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}):o.jsx(it,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]})})]}),t&&g.map((m,S)=>o.jsx(Gr,{finding:m,allFindings:n,onRoute:r,id:S===0?h:void 0},m.id)),t&&p>1&&o.jsx(Z,{className:"bg-muted/50",children:o.jsx(B,{colSpan:3,children:o.jsx(Bs,{page:f,totalPages:p,onPrev:()=>a(m=>m-1),onNext:()=>a(m=>m+1)})})})]})}function Ur({target:e,onRoute:n}){const t=Ne(e.finding),s=xt(e.finding),r=e.finding.stageId!=null||t!=null,[i,a]=w.useState(!1),u=async()=>{const c=`${ie(e.finding)} — ${fe(e.finding)}`,l=[/[.!?]$/.test(c)?c:`${c}.`,s?`Potential savings: ${s}`:null].filter(Boolean).join(" ");try{await ds(l),a(!0),setTimeout(()=>a(!1),1500)}catch{}};return o.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:[o.jsxs("button",{type:"button","aria-label":`${ie(e.finding)}, ${fe(e.finding)}`,onClick:()=>n(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:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold tracking-wide text-primary uppercase",children:[o.jsx(Us,{"aria-hidden":"true",className:"size-3.5"}),"Highest impact"]}),o.jsxs("p",{className:"mt-2 min-w-0",children:[o.jsx("span",{className:"text-sm font-semibold",children:ie(e.finding)}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[", ",fe(e.finding)]})]})]}),s?o.jsxs("div",{className:"min-w-0 sm:shrink-0 sm:text-right",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Potential savings"}),o.jsx("p",{className:"whitespace-nowrap font-mono text-lg font-semibold leading-tight tabular-nums text-primary",children:s})]}):null]}),o.jsxs("div",{className:D("flex items-center gap-3 px-4 pb-3",r?"justify-between":"justify-end"),children:[r?o.jsx(vt,{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,o.jsx("button",{type:"button","data-testid":"copy-finding-button",onClick:()=>{u()},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:i?o.jsxs(o.Fragment,{children:[o.jsx(us,{"aria-hidden":"true",className:"size-3.5"}),"Copied"]}):o.jsxs(o.Fragment,{children:[o.jsx(Hs,{"aria-hidden":"true",className:"size-3.5"}),"Copy finding"]})})]})]})}function Kr(e,n,t){const r=[...e,...n].filter(Hr),i=ls(r,t),a=Lr(r);return{eligible:r,groups:i,triageTarget:a}}const Xr={critical:"Critical",warning:"Warning",info:"Info"},Jr=["critical","warning","info"];function Qr(e){return`${e.kind}-${e.type}-${"unit"in e?e.unit:""}`}function Yr({impactBand:e,groups:n,widgets:t,allFindings:s,expandedGroupKey:r,onToggleGroup:i,onRoute:a,appModel:u,catalog:c,configFindings:l,getTaskData:d,activeFileId:p}){if(n.length===0&&t.length===0)return null;const f=`impact-band-${e}-heading`;return o.jsxs("section",{"aria-labelledby":f,className:"space-y-3",children:[o.jsx("h2",{id:f,className:"font-heading text-base font-semibold",children:Xr[e]}),n.length>0&&o.jsx(ct,{children:o.jsx(dt,{children:n.map(g=>{if(g.findingCount===1)return o.jsx(Or,{finding:g.findings[0],allFindings:s,onRoute:a},g.findings[0].id);const h=Qr(g);return o.jsx(Wr,{group:g,allFindings:s,expanded:r===h,onToggle:()=>i(h),onRoute:a},h)})})}),t.length>0&&o.jsx(ut,{children:t.map(({component:g,widgetId:h,index:m})=>o.jsx(Q,{cardId:`alert-${m}`,widgetId:h,children:o.jsx(w.Suspense,{fallback:o.jsx(Zt,{}),children:o.jsx(g,{appModel:u,catalog:c,configFindings:l,getTaskData:d,activeFileId:p,defaultCollapsed:!0})})},h))})]})}function Zr({appModel:e,catalog:n,configFindings:t=[],stages:s,getTaskData:r,activeFileId:i,onRoute:a}){const{eligible:u,groups:c,triageTarget:l}=w.useMemo(()=>Kr(n,t,s),[n,t,s]),d=[...n,...t],p=w.useMemo(()=>Dr(n,t),[n,t]),[f,g]=w.useState(null),{groupsByImpactBand:h,widgetsByImpactBand:m}=w.useMemo(()=>{const S=new Map;for(const v of c){const b=zr(v);S.has(b)||S.set(b,[]),S.get(b).push(v)}const C=new Map;for(const v of p)C.has(v.impactBand)||C.set(v.impactBand,[]),C.get(v.impactBand).push(v);return{groupsByImpactBand:S,widgetsByImpactBand:C}},[c,p]);return o.jsxs("div",{id:Nr,className:"space-y-6 scroll-mt-20",children:[l?o.jsx(Ur,{target:l,onRoute:a}):null,u.length===0?o.jsx(mt,{tone:"clean",icon:Qt,title:"No findings to fix right now."}):null,Jr.map(S=>o.jsx(Yr,{impactBand:S,groups:h.get(S)??[],widgets:m.get(S)??[],allFindings:d,expandedGroupKey:f,onToggleGroup:C=>g(v=>v===C?null:C),onRoute:a,appModel:e,catalog:n,configFindings:t,getTaskData:r,activeFileId:i},S)),o.jsx(Vr,{appModel:e,catalog:n,configFindings:t,getTaskData:r,activeFileId:i})]})}const Bt=["PROCESS_LOCAL","NODE_LOCAL","RACK_LOCAL","NO_PREF","ANY"],Lt=[N.clean,N.accent,N.warning,N.muted,N.critical];function Ht(e){return e?new Date(e).toLocaleString():"—"}function eo({stats:e}){const n=new Map(e.map(r=>[r.locality,r.count])),t=Bt.filter(r=>n.has(r));for(const r of e)Bt.includes(r.locality)||t.push(r.locality);const s=t.map((r,i)=>({locality:r,count:n.get(r)??0,color:Lt[Math.min(i,Lt.length-1)]}));return o.jsx(ae,{ariaLabel:"Task locality distribution",height:140,table:{caption:"Task locality distribution",columns:["Locality tier","Task count"],rows:s.map(r=>[r.locality,r.count]),align:["left","right"]},children:o.jsxs(Pe,{data:s,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"locality",tick:{fontSize:10}}),o.jsx(ue,{allowDecimals:!1,tick:{fontSize:10},width:32}),o.jsx(ye,{formatter:r=>[`${Number(r)} task${Number(r)===1?"":"s"}`,"Tasks"]}),o.jsx(ve,{dataKey:"count",name:"Tasks",children:s.map(r=>o.jsx(ln,{fill:r.color},r.locality))})]})})}function to(e){const n=new Map;for(const t of e){n.has(t.type)||n.set(t.type,{impactBand:t.impactBand,finding:t,recs:new Map});const s=n.get(t.type);oe[t.impactBand]<oe[s.impactBand]&&(s.impactBand=t.impactBand,s.finding=t),t.recommendation&&!s.recs.has(t.recommendation)&&s.recs.set(t.recommendation,{extended:t.extended??null})}return[...n.entries()].sort(([,t],[,s])=>oe[t.impactBand]-oe[s.impactBand])}function no({rec:e,extended:n,finding:t,showImpactEstimate:s}){return o.jsxs("div",{className:"space-y-1 text-sm",children:[o.jsx("p",{className:"max-w-full leading-normal break-words",children:e}),n?o.jsx("p",{className:"text-xs text-muted-foreground",children:n}):null,s?o.jsx(Vs,{finding:t}):null]})}function so({findings:e}){if(e.length===0)return null;const n=to(e);return o.jsx("section",{className:"space-y-3 rounded-md border p-3",children:n.map(([t,{impactBand:s,finding:r,recs:i}])=>{const a=cn(r.impactEstimate)!==null;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(pe,{type:t,impactBand:s}),[...i.entries()].map(([u,{extended:c}],l)=>o.jsx(no,{rec:u,extended:c,finding:r,showImpactEstimate:l===0&&a},l))]},t)})})}function ro({stage:e,appModel:n}){return hs(e.id,n)?o.jsx(rn,{title:"Query Plan",children:o.jsx(xs,{stageId:e.id,appModel:n})}):null}function oo({stage:e,appModel:n,catalog:t,getTaskData:s}){const{exportMode:r,getTaskData:i}=an(s),[a,u]=w.useState(null),[c,l]=w.useState(!1),[d,p]=w.useState(0),f=(e.taskCount??0)>0,g=t.filter(M=>M.stageId===e.id);w.useEffect(()=>{if(!f||!i)return;let M=!1;return l(!1),i(e.id).catch(()=>null).then(E=>{M||(E?u(E):l(!0))}),()=>{M=!0}},[d]);const h=(e.completedAt??0)-(e.submittedAt??0),m=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,S=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,C=e.fetchWaitTime??0,v=C>0&&h>0?Math.round(C/h*100):null,b=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,_=e.localityStats??[];return o.jsxs("div",{className:"space-y-6",children:[o.jsx(so,{findings:g}),o.jsx(re,{title:"Overview",collapsible:!0,defaultOpen:!0,rows:[["Duration",I(h)],["Submitted",Ht(e.submittedAt)],["Completed",Ht(e.completedAt)],e.sqlExecutionId!=null&&["SQL Execution",`#${e.sqlExecutionId}`],e.stageType?["Stage type",e.stageType]:!1]}),o.jsx(re,{title:"Tasks",collapsible:!0,rows:[["Total",String(e.taskCount)],["Failed",String(e.failedTasks)],["P50 duration",(e.taskDurationP50??0)>0?I(e.taskDurationP50):"—"],["P95 duration",(e.taskDurationP95??0)>0?I(e.taskDurationP95):"—"],["Max duration",(e.taskDurationMax??0)>0?I(e.taskDurationMax):"—"],(e.peakExecutionMemoryMax??0)>0&&["Peak execution memory",K(e.peakExecutionMemoryMax)]],children:f?r?o.jsx("p",{className:"text-xs text-muted-foreground",children:"Per-task duration data isn’t included in exported reports."}):a?o.jsx(Is,{metrics:a.metrics,fieldNames:a.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):c?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Couldn’t load task data for this stage."}),o.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(M=>M+1),children:"Retry"})]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading task data…"}):null}),o.jsx(re,{title:"Locality",collapsible:!0,rows:[],children:_.length>0?o.jsx(eo,{stats:_}):null}),o.jsx(re,{title:"I/O",collapsible:!0,rows:[["Input",K(e.inputBytes)],["Output",K(e.outputBytes)],["Shuffle read",K(e.shuffleReadBytes)],["Shuffle write",K(e.shuffleWriteBytes)],C>0&&["Fetch wait",`${I(C)}${v!=null?` (${v}%)`:""}`],b!=null&&["I/O ratio",b]]}),m?o.jsx(re,{title:"Spill",collapsible:!0,rows:[["Memory spilled",K(e.memoryBytesSpilled)],["Disk spilled",K(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&["Classification",e.spillClassification??"unclassified"]]}):null,S?o.jsx(re,{title:"GC",collapsible:!0,rows:[["JVM GC time",I(e.jvmGCTime)],["Executor run time",I(e.executorRunTime)],["GC %",`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?o.jsx(H,{children:o.jsx(rn,{title:"Call Stack",children:o.jsx("pre",{className:"overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap",children:e.details})})}):null,o.jsx(ro,{stage:e,appModel:n})]})}function io({appModel:e,catalog:n,getTaskData:t}){const{stageId:s,close:r}=gt(),i=s!=null?e.stages.get(s):void 0,a=i!=null;return o.jsx(gs,{open:a,onOpenChange:u=>{u||r()},children:o.jsx(fs,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:i?o.jsxs(o.Fragment,{children:[o.jsx(ms,{children:o.jsxs(ps,{children:["Stage ",i.id," ",o.jsxs("span",{className:"text-muted-foreground",children:["— ",i.name??""]})]})}),o.jsx(oo,{stage:i,appModel:e,catalog:n,getTaskData:t},i.id)]}):null})})}function Y(e,n){return typeof e=="function"?e(n):e}function L(e,n){return t=>{n.setState(s=>({...s,[e]:Y(t,s[e])}))}}function Ee(e){return e instanceof Function}function ao(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function lo(e,n){const t=[],s=r=>{r.forEach(i=>{t.push(i);const a=n(i);a!=null&&a.length&&s(a)})};return s(e),t}function y(e,n,t){let s=[],r;return i=>{let a;t.key&&t.debug&&(a=Date.now());const u=e(i);if(!(u.length!==s.length||u.some((d,p)=>s[p]!==d)))return r;s=u;let l;if(t.key&&t.debug&&(l=Date.now()),r=n(...u),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const d=Math.round((Date.now()-a)*100)/100,p=Math.round((Date.now()-l)*100)/100,f=p/16,g=(h,m)=>{for(h=String(h);h.length<m;)h=" "+h;return h};console.info(`%c⏱ ${g(p,5)} /${g(d,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,t?.key)}return r}}function j(e,n,t,s){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[n]},key:!1,onChange:s}}function uo(e,n,t,s){const r=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(s),renderValue:r,getContext:y(()=>[e,t,n,i],(a,u,c,l)=>({table:a,column:u,row:c,cell:l,getValue:l.getValue,renderValue:l.renderValue}),j(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,n,e)},{}),i}function co(e,n,t,s){var r,i;const u={...e._getDefaultColumnDef(),...n},c=u.accessorKey;let l=(r=(i=u.id)!=null?i:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,d;if(u.accessorFn?d=u.accessorFn:c&&(c.includes(".")?d=f=>{let g=f;for(const m of c.split(".")){var h;g=(h=g)==null?void 0:h[m]}return g}:d=f=>f[u.accessorKey]),!l)throw new Error;let p={id:`${String(l)}`,accessorFn:d,parent:s,depth:t,columnDef:u,columns:[],getFlatColumns:y(()=>[!0],()=>{var f;return[p,...(f=p.columns)==null?void 0:f.flatMap(g=>g.getFlatColumns())]},j(e.options,"debugColumns")),getLeafColumns:y(()=>[e._getOrderColumnsFn()],f=>{var g;if((g=p.columns)!=null&&g.length){let h=p.columns.flatMap(m=>m.getLeafColumns());return f(h)}return[p]},j(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(p,e);return p}const A="debugHeaders";function zt(e,n,t){var s;let i={id:(s=t.id)!=null?s:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],u=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(u),a.push(c)};return u(i),a},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const go={createTable:e=>{e.getHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,r)=>{var i,a;const u=(i=s?.map(p=>t.find(f=>f.id===p)).filter(Boolean))!=null?i:[],c=(a=r?.map(p=>t.find(f=>f.id===p)).filter(Boolean))!=null?a:[],l=t.filter(p=>!(s!=null&&s.includes(p.id))&&!(r!=null&&r.includes(p.id)));return ke(n,[...u,...l,...c],e)},j(e.options,A)),e.getCenterHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,r)=>(t=t.filter(i=>!(s!=null&&s.includes(i.id))&&!(r!=null&&r.includes(i.id))),ke(n,t,e,"center")),j(e.options,A)),e.getLeftHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,s)=>{var r;const i=(r=s?.map(a=>t.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return ke(n,i,e,"left")},j(e.options,A)),e.getRightHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,s)=>{var r;const i=(r=s?.map(a=>t.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return ke(n,i,e,"right")},j(e.options,A)),e.getFooterGroups=y(()=>[e.getHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getLeftFooterGroups=y(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getCenterFooterGroups=y(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getRightFooterGroups=y(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getFlatHeaders=y(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getLeftFlatHeaders=y(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getCenterFlatHeaders=y(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getRightFlatHeaders=y(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getCenterLeafHeaders=y(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getLeftLeafHeaders=y(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getRightLeafHeaders=y(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getLeafHeaders=y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,s)=>{var r,i,a,u,c,l;return[...(r=(i=n[0])==null?void 0:i.headers)!=null?r:[],...(a=(u=t[0])==null?void 0:u.headers)!=null?a:[],...(c=(l=s[0])==null?void 0:l.headers)!=null?c:[]].map(d=>d.getLeafHeaders()).flat()},j(e.options,A))}};function ke(e,n,t,s){var r,i;let a=0;const u=function(f,g){g===void 0&&(g=1),a=Math.max(a,g),f.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&u(h.columns,g+1)},0)};u(e);let c=[];const l=(f,g)=>{const h={depth:g,id:[s,`${g}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(S=>{const C=[...m].reverse()[0],v=S.column.depth===h.depth;let b,_=!1;if(v&&S.column.parent?b=S.column.parent:(b=S.column,_=!0),C&&C?.column===b)C.subHeaders.push(S);else{const M=zt(t,b,{id:[s,g,b.id,S?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${m.filter(E=>E.column===b).length}`:void 0,depth:g,index:m.length});M.subHeaders.push(S),m.push(M)}h.headers.push(S),S.headerGroup=h}),c.push(h),g>0&&l(m,g-1)},d=n.map((f,g)=>zt(t,f,{depth:a,index:g}));l(d,a-1),c.reverse();const p=f=>f.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,S=0,C=[0];h.subHeaders&&h.subHeaders.length?(C=[],p(h.subHeaders).forEach(b=>{let{colSpan:_,rowSpan:M}=b;m+=_,C.push(M)})):m=1;const v=Math.min(...C);return S=S+v,h.colSpan=m,h.rowSpan=S,{colSpan:m,rowSpan:S}});return p((r=(i=c[0])==null?void 0:i.headers)!=null?r:[]),c}const fo=(e,n,t,s,r,i,a)=>{let u={id:n,index:s,original:t,depth:r,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(u._valuesCache.hasOwnProperty(c))return u._valuesCache[c];const l=e.getColumn(c);if(l!=null&&l.accessorFn)return u._valuesCache[c]=l.accessorFn(u.original,s),u._valuesCache[c]},getUniqueValues:c=>{if(u._uniqueValuesCache.hasOwnProperty(c))return u._uniqueValuesCache[c];const l=e.getColumn(c);if(l!=null&&l.accessorFn)return l.columnDef.getUniqueValues?(u._uniqueValuesCache[c]=l.columnDef.getUniqueValues(u.original,s),u._uniqueValuesCache[c]):(u._uniqueValuesCache[c]=[u.getValue(c)],u._uniqueValuesCache[c])},renderValue:c=>{var l;return(l=u.getValue(c))!=null?l:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>lo(u.subRows,c=>c.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let c=[],l=u;for(;;){const d=l.getParentRow();if(!d)break;c.push(d),l=d}return c.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],c=>c.map(l=>uo(e,u,l,l.id)),j(e.options,"debugRows")),_getAllCellsByColumnId:y(()=>[u.getAllCells()],c=>c.reduce((l,d)=>(l[d.column.id]=d,l),{}),j(e.options,"debugRows"))};for(let c=0;c<e._features.length;c++){const l=e._features[c];l==null||l.createRow==null||l.createRow(u,e)}return u},mo={createColumn:(e,n)=>{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Sn=(e,n,t)=>{var s,r;const i=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((r=e.getValue(n))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};Sn.autoRemove=e=>q(e);const Cn=(e,n,t)=>{var s;return!!(!((s=e.getValue(n))==null||(s=s.toString())==null)&&s.includes(t))};Cn.autoRemove=e=>q(e);const yn=(e,n,t)=>{var s;return((s=e.getValue(n))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};yn.autoRemove=e=>q(e);const jn=(e,n,t)=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(t)};jn.autoRemove=e=>q(e);const Rn=(e,n,t)=>!t.some(s=>{var r;return!((r=e.getValue(n))!=null&&r.includes(s))});Rn.autoRemove=e=>q(e)||!(e!=null&&e.length);const bn=(e,n,t)=>t.some(s=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(s)});bn.autoRemove=e=>q(e)||!(e!=null&&e.length);const kn=(e,n,t)=>e.getValue(n)===t;kn.autoRemove=e=>q(e);const Fn=(e,n,t)=>e.getValue(n)==t;Fn.autoRemove=e=>q(e);const wt=(e,n,t)=>{let[s,r]=t;const i=e.getValue(n);return i>=s&&i<=r};wt.resolveFilterValue=e=>{let[n,t]=e,s=typeof n!="number"?parseFloat(n):n,r=typeof t!="number"?parseFloat(t):t,i=n===null||Number.isNaN(s)?-1/0:s,a=t===null||Number.isNaN(r)?1/0:r;if(i>a){const u=i;i=a,a=u}return[i,a]};wt.autoRemove=e=>q(e)||q(e[0])&&q(e[1]);const X={includesString:Sn,includesStringSensitive:Cn,equalsString:yn,arrIncludes:jn,arrIncludesAll:Rn,arrIncludesSome:bn,equals:kn,weakEquals:Fn,inNumberRange:wt};function q(e){return e==null||e===""}const po={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:L("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?X.includesString:typeof s=="number"?X.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?X.equals:Array.isArray(s)?X.arrIncludes:X.weakEquals},e.getFilterFn=()=>{var t,s;return Ee(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=n.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:X[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=n.options.enableColumnFilters)!=null?s:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=n.getState().columnFilters)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(s=>{const r=e.getFilterFn(),i=s?.find(d=>d.id===e.id),a=Y(t,i?i.value:void 0);if(Ot(r,a,e)){var u;return(u=s?.filter(d=>d.id!==e.id))!=null?u:[]}const c={id:e.id,value:a};if(i){var l;return(l=s?.map(d=>d.id===e.id?c:d))!=null?l:[]}return s!=null&&s.length?[...s,c]:[c]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),s=r=>{var i;return(i=Y(n,r))==null?void 0:i.filter(a=>{const u=t.find(c=>c.id===a.id);if(u){const c=u.getFilterFn();if(Ot(c,a.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=n=>{var t,s;e.setColumnFilters(n?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Ot(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const ho=(e,n,t)=>t.reduce((s,r)=>{const i=r.getValue(e);return s+(typeof i=="number"?i:0)},0),xo=(e,n,t)=>{let s;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(s>i||s===void 0&&i>=i)&&(s=i)}),s},vo=(e,n,t)=>{let s;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(s<i||s===void 0&&i>=i)&&(s=i)}),s},wo=(e,n,t)=>{let s,r;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(s===void 0?a>=a&&(s=r=a):(s>a&&(s=a),r<a&&(r=a)))}),[s,r]},So=(e,n)=>{let t=0,s=0;if(n.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,s+=i)}),t)return s/t},Co=(e,n)=>{if(!n.length)return;const t=n.map(i=>i.getValue(e));if(!ao(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),r=t.sort((i,a)=>i-a);return t.length%2!==0?r[s]:(r[s-1]+r[s])/2},yo=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),jo=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,Ro=(e,n)=>n.length,He={sum:ho,min:xo,max:vo,extent:wo,mean:So,median:Co,unique:yo,uniqueCount:jo,count:Ro},bo={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:L("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=n.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return He.sum;if(Object.prototype.toString.call(s)==="[object Date]")return He.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return Ee(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=n.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:He[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,s;e.setGrouping(n?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=n.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,s)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function ko(e,n,t){if(!(n!=null&&n.length)||!t)return e;const s=e.filter(i=>!n.includes(i.id));return t==="remove"?s:[...n.map(i=>e.find(a=>a.id===i)).filter(Boolean),...s]}const Fo={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:L("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=y(t=>[me(n,t)],t=>t.findIndex(s=>s.id===e.id),j(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=me(n,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const r=me(n,t);return((s=r[r.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=y(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,s)=>r=>{let i=[];if(!(n!=null&&n.length))i=r;else{const a=[...n],u=[...r];for(;u.length&&a.length;){const c=a.shift(),l=u.findIndex(d=>d.id===c);l>-1&&i.push(u.splice(l,1)[0])}i=[...i,...u]}return ko(i,t,s)},j(e.options,"debugTable"))}},ze=()=>({left:[],right:[]}),Io={getInitialState:e=>({columnPinning:ze(),...e}),getDefaultOptions:e=>({onColumnPinningChange:L("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const s=e.getLeafColumns().map(r=>r.id).filter(Boolean);n.setColumnPinning(r=>{var i,a;if(t==="right"){var u,c;return{left:((u=r?.left)!=null?u:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((c=r?.right)!=null?c:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(t==="left"){var l,d;return{left:[...((l=r?.left)!=null?l:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((d=r?.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((i=r?.left)!=null?i:[]).filter(p=>!(s!=null&&s.includes(p))),right:((a=r?.right)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var r,i,a;return((r=s.columnDef.enablePinning)!=null?r:!0)&&((i=(a=n.options.enableColumnPinning)!=null?a:n.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(u=>u.id),{left:s,right:r}=n.getState().columnPinning,i=t.some(u=>s?.includes(u)),a=t.some(u=>r?.includes(u));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,s;const r=e.getIsPinned();return r?(t=(s=n.getState().columnPinning)==null||(s=s[r])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,s,r)=>{const i=[...s??[],...r??[]];return t.filter(a=>!i.includes(a.column.id))},j(n.options,"debugRows")),e.getLeftVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),j(n.options,"debugRows")),e.getRightVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),j(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,s;return e.setColumnPinning(n?ze():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:ze())},e.getIsSomeColumnsPinned=n=>{var t;const s=e.getState().columnPinning;if(!n){var r,i;return!!((r=s.left)!=null&&r.length||(i=s.right)!=null&&i.length)}return!!((t=s[n])!=null&&t.length)},e.getLeftLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(s=>n.find(r=>r.id===s)).filter(Boolean),j(e.options,"debugColumns")),e.getRightLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(s=>n.find(r=>r.id===s)).filter(Boolean),j(e.options,"debugColumns")),e.getCenterLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s)=>{const r=[...t??[],...s??[]];return n.filter(i=>!r.includes(i.id))},j(e.options,"debugColumns"))}};function $o(e){return e||(typeof document<"u"?document:null)}const Fe={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Oe=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),_o={getDefaultColumnDef:()=>Fe,getInitialState:e=>({columnSizing:{},columnSizingInfo:Oe(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:L("columnSizing",e),onColumnSizingInfoChange:L("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,s,r;const i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Fe.minSize,(s=i??e.columnDef.size)!=null?s:Fe.size),(r=e.columnDef.maxSize)!=null?r:Fe.maxSize)},e.getStart=y(t=>[t,me(n,t),n.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((r,i)=>r+i.getSize(),0),j(n.options,"debugColumns")),e.getAfter=y(t=>[t,me(n,t),n.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((r,i)=>r+i.getSize(),0),j(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:s,...r}=t;return r})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=n.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const s=r=>{if(r.subHeaders.length)r.subHeaders.forEach(s);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=n.getColumn(e.column.id),r=s?.getCanResize();return i=>{if(!s||!r||(i.persist==null||i.persist(),Ge(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),u=e?e.getLeafHeaders().map(C=>[C.column.id,C.column.getSize()]):[[s.id,s.getSize()]],c=Ge(i)?Math.round(i.touches[0].clientX):i.clientX,l={},d=(C,v)=>{typeof v=="number"&&(n.setColumnSizingInfo(b=>{var _,M;const E=n.options.columnResizeDirection==="rtl"?-1:1,U=(v-((_=b?.startOffset)!=null?_:0))*E,x=Math.max(U/((M=b?.startSize)!=null?M:0),-.999999);return b.columnSizingStart.forEach(k=>{let[F,O]=k;l[F]=Math.round(Math.max(O+O*x,0)*100)/100}),{...b,deltaOffset:U,deltaPercentage:x}}),(n.options.columnResizeMode==="onChange"||C==="end")&&n.setColumnSizing(b=>({...b,...l})))},p=C=>d("move",C),f=C=>{d("end",C),n.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=$o(t),h={moveHandler:C=>p(C.clientX),upHandler:C=>{g?.removeEventListener("mousemove",h.moveHandler),g?.removeEventListener("mouseup",h.upHandler),f(C.clientX)}},m={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),p(C.touches[0].clientX),!1),upHandler:C=>{var v;g?.removeEventListener("touchmove",m.moveHandler),g?.removeEventListener("touchend",m.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),f((v=C.touches[0])==null?void 0:v.clientX)}},S=Mo()?{passive:!1}:!1;Ge(i)?(g?.addEventListener("touchmove",m.moveHandler,S),g?.addEventListener("touchend",m.upHandler,S)):(g?.addEventListener("mousemove",h.moveHandler,S),g?.addEventListener("mouseup",h.upHandler,S)),n.setColumnSizingInfo(C=>({...C,startOffset:c,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?Oe():(t=e.initialState.columnSizingInfo)!=null?t:Oe())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0}}};let Ie=null;function Mo(){if(typeof Ie=="boolean")return Ie;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return Ie=e,Ie}function Ge(e){return e.type==="touchstart"}const Po={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:L("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const r=e.columns;return(t=r.length?r.some(i=>i.getIsVisible()):(s=n.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=n.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=y(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),j(n.options,"debugRows")),e.getVisibleCells=y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,r)=>[...t,...s,...r],j(n.options,"debugRows"))},createTable:e=>{const n=(t,s)=>y(()=>[s(),s().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),j(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function me(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const No={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Eo={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:L("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,s,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=n.options.enableGlobalFilter)!=null?s:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&((i=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>X.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:s}=e.options;return Ee(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[s])!=null?n:X[s]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},To={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:L("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var s,r;if(!n){e._queue(()=>{n=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var r,i;e.setExpanded(s?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");s=Math.max(s,a.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(s=>{var r;const i=s===!0?!0:!!(s!=null&&s[e.id]);let a={};if(s===!0?Object.keys(n.getRowModel().rowsById).forEach(u=>{a[u]=!0}):a=s,t=(r=t)!=null?r:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:u,...c}=a;return c}return s})},e.getIsExpanded=()=>{var t;const s=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,r;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((s=n.options.enableExpanding)!=null?s:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=n.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Ze=0,et=10,qe=()=>({pageIndex:Ze,pageSize:et}),Ao={getInitialState:e=>({...e,pagination:{...qe(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:L("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var s,r;if(!n){e._queue(()=>{n=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const r=i=>Y(s,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=s=>{var r;e.setPagination(s?qe():(r=e.initialState.pagination)!=null?r:qe())},e.setPageIndex=s=>{e.setPagination(r=>{let i=Y(s,r.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...r,pageIndex:i}})},e.resetPageIndex=s=>{var r,i;e.setPageIndex(s?Ze:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:Ze)},e.resetPageSize=s=>{var r,i;e.setPageSize(s?et:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:et)},e.setPageSize=s=>{e.setPagination(r=>{const i=Math.max(1,Y(s,r.pageSize)),a=r.pageSize*r.pageIndex,u=Math.floor(a/i);return{...r,pageIndex:u,pageSize:i}})},e.setPageCount=s=>e.setPagination(r=>{var i;let a=Y(s,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...r,pageCount:a}}),e.getPageOptions=y(()=>[e.getPageCount()],s=>{let r=[];return s&&s>0&&(r=[...new Array(s)].fill(null).map((i,a)=>a)),r},j(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:s<r-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},We=()=>({top:[],bottom:[]}),Do={getInitialState:e=>({rowPinning:We(),...e}),getDefaultOptions:e=>({onRowPinningChange:L("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,s,r)=>{const i=s?e.getLeafRows().map(c=>{let{id:l}=c;return l}):[],a=r?e.getParentRows().map(c=>{let{id:l}=c;return l}):[],u=new Set([...a,e.id,...i]);n.setRowPinning(c=>{var l,d;if(t==="bottom"){var p,f;return{top:((p=c?.top)!=null?p:[]).filter(m=>!(u!=null&&u.has(m))),bottom:[...((f=c?.bottom)!=null?f:[]).filter(m=>!(u!=null&&u.has(m))),...Array.from(u)]}}if(t==="top"){var g,h;return{top:[...((g=c?.top)!=null?g:[]).filter(m=>!(u!=null&&u.has(m))),...Array.from(u)],bottom:((h=c?.bottom)!=null?h:[]).filter(m=>!(u!=null&&u.has(m)))}}return{top:((l=c?.top)!=null?l:[]).filter(m=>!(u!=null&&u.has(m))),bottom:((d=c?.bottom)!=null?d:[]).filter(m=>!(u!=null&&u.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:r}=n.options;return typeof s=="function"?s(e):(t=s??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:r}=n.getState().rowPinning,i=t.some(u=>s?.includes(u)),a=t.some(u=>r?.includes(u));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const r=e.getIsPinned();if(!r)return-1;const i=(t=r==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(a=>{let{id:u}=a;return u});return(s=i?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,s;return e.setRowPinning(n?We():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:We())},e.getIsSomeRowsPinned=n=>{var t;const s=e.getState().rowPinning;if(!n){var r,i;return!!((r=s.top)!=null&&r.length||(i=s.bottom)!=null&&i.length)}return!!((t=s[n])!=null&&t.length)},e._getPinnedRows=(n,t,s)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(a=>{const u=e.getRow(a,!0);return u.getIsAllParentsExpanded()?u:null}):(t??[]).map(a=>n.find(u=>u.id===a))).filter(Boolean).map(a=>({...a,position:s}))},e.getTopRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),j(e.options,"debugRows")),e.getBottomRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),j(e.options,"debugRows")),e.getCenterRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,s)=>{const r=new Set([...t??[],...s??[]]);return n.filter(i=>!r.has(i.id))},j(e.options,"debugRows"))}},Vo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:L("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const s={...t},r=e.getPreGroupedRowModel().flatRows;return n?r.forEach(i=>{i.getCanSelect()&&(s[i.id]=!0)}):r.forEach(i=>{delete s[i.id]}),s})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const s=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{tt(r,i.id,s,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getFilteredSelectedRowModel=y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getGroupedSelectedRowModel=y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(n.length&&Object.keys(t).length);return s&&n.some(r=>r.getCanSelect()&&!t[r.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let s=!!n.length;return s&&n.some(r=>!t[r.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,s)=>{const r=e.getIsSelected();n.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const u={...i};return tt(u,e.id,t,(a=s?.selectChildren)!=null?a:!0,n),u})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return St(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return nt(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return nt(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var r;t&&e.toggleSelected((r=s.target)==null?void 0:r.checked)}}}},tt=(e,n,t,s,r)=>{var i;const a=r.getRow(n,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),a.getCanSelect()&&(e[n]=!0)):delete e[n],s&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(u=>tt(e,u.id,t,s,r))};function Ue(e,n){const t=e.getState().rowSelection,s=[],r={},i=function(a,u){return a.map(c=>{var l;const d=St(c,t);if(d&&(s.push(c),r[c.id]=c),(l=c.subRows)!=null&&l.length&&(c={...c,subRows:i(c.subRows)}),d)return c}).filter(Boolean)};return{rows:i(n.rows),flatRows:s,rowsById:r}}function St(e,n){var t;return(t=n[e.id])!=null?t:!1}function nt(e,n,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let r=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!r)&&(a.getCanSelect()&&(St(a,n)?i=!0:r=!1),a.subRows&&a.subRows.length)){const u=nt(a,n);u==="all"?i=!0:(u==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const st=/([0-9]+)/gm,Bo=(e,n,t)=>In(ee(e.getValue(t)).toLowerCase(),ee(n.getValue(t)).toLowerCase()),Lo=(e,n,t)=>In(ee(e.getValue(t)),ee(n.getValue(t))),Ho=(e,n,t)=>Ct(ee(e.getValue(t)).toLowerCase(),ee(n.getValue(t)).toLowerCase()),zo=(e,n,t)=>Ct(ee(e.getValue(t)),ee(n.getValue(t))),Oo=(e,n,t)=>{const s=e.getValue(t),r=n.getValue(t);return s>r?1:s<r?-1:0},Go=(e,n,t)=>Ct(e.getValue(t),n.getValue(t));function Ct(e,n){return e===n?0:e>n?1:-1}function ee(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function In(e,n){const t=e.split(st).filter(Boolean),s=n.split(st).filter(Boolean);for(;t.length&&s.length;){const r=t.shift(),i=s.shift(),a=parseInt(r,10),u=parseInt(i,10),c=[a,u].sort();if(isNaN(c[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(c[1]))return isNaN(a)?-1:1;if(a>u)return 1;if(u>a)return-1}return t.length-s.length}const ge={alphanumeric:Bo,alphanumericCaseSensitive:Lo,text:Ho,textCaseSensitive:zo,datetime:Oo,basic:Go},qo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:L("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const r of t){const i=r?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return ge.datetime;if(typeof i=="string"&&(s=!0,i.split(st).length>1))return ge.alphanumeric}return s?ge.text:ge.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return Ee(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=n.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:ge[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(a=>{const u=a?.find(g=>g.id===e.id),c=a?.findIndex(g=>g.id===e.id);let l=[],d,p=i?t:r==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&s?u?d="toggle":d="add":a!=null&&a.length&&c!==a.length-1?d="replace":u?d="toggle":d="replace",d==="toggle"&&(i||r||(d="remove")),d==="add"){var f;l=[...a,{id:e.id,desc:p}],l.splice(0,l.length-((f=n.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?l=a.map(g=>g.id===e.id?{...g,desc:p}:g):d==="remove"?l=a.filter(g=>g.id!==e.id):l=[{id:e.id,desc:p}];return l})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,r;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((s=n.options.enableSortingRemoval)==null||s)&&(!(t&&(r=n.options.enableMultiRemove)!=null)||r)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=n.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=n.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=n.getState().sorting)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,s;e.setSorting(n?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Wo=[go,Po,Fo,Io,mo,po,No,Eo,qo,bo,To,Ao,Do,Vo,_o];function Uo(e){var n,t;const s=[...Wo,...(n=e._features)!=null?n:[]];let r={_features:s};const i=r._features.reduce((f,g)=>Object.assign(f,g.getDefaultOptions==null?void 0:g.getDefaultOptions(r)),{}),a=f=>r.options.mergeOptions?r.options.mergeOptions(i,f):{...i,...f};let c={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(f=>{var g;c=(g=f.getInitialState==null?void 0:f.getInitialState(c))!=null?g:c});const l=[];let d=!1;const p={_features:s,options:{...i,...e},initialState:c,_queue:f=>{l.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();d=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{r.setState(r.initialState)},setOptions:f=>{const g=Y(f,r.options);r.options=a(g)},getState:()=>r.options.state,setState:f=>{r.options.onStateChange==null||r.options.onStateChange(f)},_getRowId:(f,g,h)=>{var m;return(m=r.options.getRowId==null?void 0:r.options.getRowId(f,g,h))!=null?m:`${h?[h.id,g].join("."):g}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(f,g)=>{let h=(g?r.getPrePaginationRowModel():r.getRowModel()).rowsById[f];if(!h&&(h=r.getCoreRowModel().rowsById[f],!h))throw new Error;return h},_getDefaultColumnDef:y(()=>[r.options.defaultColumn],f=>{var g;return f=(g=f)!=null?g:{},{header:h=>{const m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,S;return(m=(S=h.renderValue())==null||S.toString==null?void 0:S.toString())!=null?m:null},...r._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},j(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:y(()=>[r._getColumnDefs()],f=>{const g=function(h,m,S){return S===void 0&&(S=0),h.map(C=>{const v=co(r,C,S,m),b=C;return v.columns=b.columns?g(b.columns,v,S+1):[],v})};return g(f)},j(e,"debugColumns")),getAllFlatColumns:y(()=>[r.getAllColumns()],f=>f.flatMap(g=>g.getFlatColumns()),j(e,"debugColumns")),_getAllFlatColumnsById:y(()=>[r.getAllFlatColumns()],f=>f.reduce((g,h)=>(g[h.id]=h,g),{}),j(e,"debugColumns")),getAllLeafColumns:y(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(f,g)=>{let h=f.flatMap(m=>m.getLeafColumns());return g(h)},j(e,"debugColumns")),getColumn:f=>r._getAllFlatColumnsById()[f]};Object.assign(r,p);for(let f=0;f<r._features.length;f++){const g=r._features[f];g==null||g.createTable==null||g.createTable(r)}return r}function Ko(){return e=>y(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(r,i,a){i===void 0&&(i=0);const u=[];for(let l=0;l<r.length;l++){const d=fo(e,e._getRowId(r[l],l,a),r[l],l,i,void 0,a?.id);if(t.flatRows.push(d),t.rowsById[d.id]=d,u.push(d),e.options.getSubRows){var c;d.originalSubRows=e.options.getSubRows(r[l],l),(c=d.originalSubRows)!=null&&c.length&&(d.subRows=s(d.originalSubRows,i+1,d))}}return u};return t.rows=s(n),t},j(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Xo(e){const n=[],t=s=>{var r;n.push(s),(r=s.subRows)!=null&&r.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function Jo(e){return n=>y(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:r,pageIndex:i}=t;let{rows:a,flatRows:u,rowsById:c}=s;const l=r*i,d=l+r;a=a.slice(l,d);let p;n.options.paginateExpandedRows?p={rows:a,flatRows:u,rowsById:c}:p=Xo({rows:a,flatRows:u,rowsById:c}),p.flatRows=[];const f=g=>{p.flatRows.push(g),g.subRows.length&&g.subRows.forEach(f)};return p.rows.forEach(f),p},j(n.options,"debugTable"))}function Qo(){return e=>y(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const s=e.getState().sorting,r=[],i=s.filter(c=>{var l;return(l=e.getColumn(c.id))==null?void 0:l.getCanSort()}),a={};i.forEach(c=>{const l=e.getColumn(c.id);l&&(a[c.id]={sortUndefined:l.columnDef.sortUndefined,invertSorting:l.columnDef.invertSorting,sortingFn:l.getSortingFn()})});const u=c=>{const l=c.map(d=>({...d}));return l.sort((d,p)=>{for(let g=0;g<i.length;g+=1){var f;const h=i[g],m=a[h.id],S=m.sortUndefined,C=(f=h?.desc)!=null?f:!1;let v=0;if(S){const b=d.getValue(h.id),_=p.getValue(h.id),M=b===void 0,E=_===void 0;if(M||E){if(S==="first")return M?-1:1;if(S==="last")return M?1:-1;v=M&&E?0:M?S:-S}}if(v===0&&(v=m.sortingFn(d,p,h.id)),v!==0)return C&&(v*=-1),m.invertSorting&&(v*=-1),v}return d.index-p.index}),l.forEach(d=>{var p;r.push(d),(p=d.subRows)!=null&&p.length&&(d.subRows=u(d.subRows))}),l};return{rows:u(t.rows),flatRows:r,rowsById:t.rowsById}},j(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Gt(e,n){return e?Yo(e)?w.createElement(e,n):e:null}function Yo(e){return Zo(e)||typeof e=="function"||ei(e)}function Zo(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function ei(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function ti(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=w.useState(()=>({current:Uo(n)})),[s,r]=w.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...s,...e.state},onStateChange:a=>{r(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}const qt=10,Ke=10,Wt=new Set(["duration","taskCount","shuffleRead","fetchWait","gcPct","skew","spill"]);function ni(e,n){return e.length>n?`${e.slice(0,n)}…`:e}function si(e){return e<=0?o.jsx(o.Fragment,{children:"0"}):o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e," ",o.jsx(he,{label:"RETRY",impactBand:"critical"})]})}function ri(e,n,t){if(e<=0)return o.jsx(o.Fragment,{children:"—"});const s=I(e);if(n<=0)return o.jsx(o.Fragment,{children:s});const r=e/n;return r>.3?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:t==="advanced"?`${Math.round(r*100)}%`:"High",impactBand:"critical"})]}):r>.15?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:t==="advanced"?`${Math.round(r*100)}%`:"Elevated",impactBand:"info"})]}):o.jsx(o.Fragment,{children:s})}function oi(e,n){if(!e||e<=0)return o.jsx(o.Fragment,{children:"—"});if(!n||n<=0)return o.jsx(o.Fragment,{children:"—"});const t=n/e,s=t<.01?`${t.toExponential(1)}×`:`${t.toFixed(2)}×`;return t>2||t<.1?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:"extreme",impactBand:"info"})]}):o.jsx(o.Fragment,{children:s})}function ii(e,n){if(e<=0)return o.jsx(o.Fragment,{children:"—"});const t=n??"unclassified";return o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[K(e)," ",o.jsx(he,{label:Zn[t],impactBand:"warning",title:Yn[t]})]})}function ai(e,n){return!e||e<=0?0:(n??0)/e}function li(e){const n=new Map;for(const t of e)n.has(t.type)||n.set(t.type,[]),n.get(t.type).push(t);return[...n.values()].map(t=>{const s=Yt(t);return t.find(r=>r.impactBand===s)??t[0]})}function ui({appModel:e,catalog:n,getTaskData:t,onRoute:s}){const{openStage:r}=gt(),i=lt(),[a,u]=w.useState(!1),[c,l]=w.useState(""),[d,p]=w.useState([]),[f,g]=w.useState({pageIndex:0,pageSize:qt}),{catalogByStage:h,flaggedStageIds:m,frequency:S}=w.useMemo(()=>{const x=new Map,k=new Set;for(const F of n)F.stageId!=null&&(k.add(F.stageId),x.has(F.stageId)||x.set(F.stageId,[]),x.get(F.stageId).push(F));return{catalogByStage:x,flaggedStageIds:k,frequency:Xn(n)}},[n]),C=w.useMemo(()=>{const x=[...e.stages.values()],k=a?x.filter($=>m.has($.id)):[...x].sort(($,T)=>(T.completedAt??0)-(T.submittedAt??0)-(($.completedAt??0)-($.submittedAt??0))).slice(0,Ke),F=c.trim().toLowerCase();return(F?k.filter($=>($.name??"").toLowerCase().includes(F)||String($.id).includes(F)):k).map($=>({stage:$,tags:li(h.get($.id)??[]),frequency:S.get($.id)??0}))},[e.stages,a,m,h,S,c]),v=w.useMemo(()=>{if(!s)return null;const x=new Map;for(const k of n){const F=we(k,n);F&&x.set(k,F)}return x},[n,s]),b=w.useMemo(()=>[{id:"id",header:"Stage",accessorFn:x=>x.stage.id,cell:({getValue:x})=>{const k=x();return o.jsx("button",{type:"button","aria-label":`Open Stage ${k} 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:F=>{F.stopPropagation(),r(k)},children:o.jsx("strong",{children:k})})}},{id:"name",header:"Operation",accessorFn:x=>x.stage.name??"",cell:({row:x})=>{const k=x.original.stage.id;return o.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[ni(x.original.stage.name??"",40),x.original.tags.map((F,O)=>{const $=v?v.get(F)??null:null,T=$&&s?{target:$,onRoute:s}:null,je=cn(F.impactEstimate);return o.jsxs("span",{className:"inline-flex items-center gap-1",children:[T?o.jsx("button",{type:"button","aria-label":`Investigate ${T.target.findingLabel} in Stage ${k}`,title:`Investigate ${T.target.findingLabel} in Stage ${k}`,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:ne=>{ne.stopPropagation(),T.onRoute(T.target)},onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&ne.stopPropagation()},children:o.jsx(pe,{type:F.type,impactBand:F.impactBand,plainBadge:!0})}):o.jsx(pe,{type:F.type,impactBand:F.impactBand}),je?o.jsx("span",{className:"text-xs text-muted-foreground",children:je}):null]},O)})]})}},{id:"type",header:"Type",accessorFn:x=>x.stage.stageType??"",cell:({row:x})=>o.jsx(bt,{variant:"outline",children:x.original.stage.stageType??"—"})},{id:"duration",header:"Duration",accessorFn:x=>(x.stage.completedAt??0)-(x.stage.submittedAt??0),cell:({getValue:x})=>o.jsx(o.Fragment,{children:I(x())})},{id:"taskCount",header:"Tasks",accessorFn:x=>x.stage.taskCount},{id:"retried",header:"Retried",accessorFn:x=>x.stage.failedTasks??0,cell:({getValue:x})=>si(x())},{id:"shuffleRead",header:"Shuffle Read",accessorFn:x=>x.stage.shuffleReadBytes??0,cell:({getValue:x})=>o.jsx(o.Fragment,{children:K(x())})},{id:"fetchWait",header:"Fetch Wait",accessorFn:x=>x.stage.fetchWaitTime??0,cell:({row:x})=>ri(x.original.stage.fetchWaitTime??0,x.original.stage.executorRunTime??0,i)},...i==="advanced"?[{id:"ioRatio",header:"I/O Ratio",accessorFn:x=>x.stage.inputBytes?(x.stage.outputBytes??0)/x.stage.inputBytes:0,cell:({row:x})=>oi(x.original.stage.inputBytes??0,x.original.stage.outputBytes??0)}]:[],{id:"spill",header:"Spill (mem)",accessorFn:x=>x.stage.memoryBytesSpilled??0,cell:({row:x})=>ii(x.original.stage.memoryBytesSpilled??0,x.original.stage.spillClassification)},...i==="advanced"?[{id:"gcPct",header:"GC%",accessorFn:x=>x.stage.gcPct??0,cell:({getValue:x})=>o.jsxs(o.Fragment,{children:[x().toFixed(1),"%"]})},{id:"skew",header:"Skew P95/median",accessorFn:x=>ai(x.stage.taskDurationP50,x.stage.taskDurationP95),cell:({getValue:x})=>{const k=x();return o.jsx(o.Fragment,{children:k>0?`${k.toFixed(1)}×`:"—"})}}]:[],{id:"frequency",header:"Flagged",accessorFn:x=>x.frequency,cell:({getValue:x})=>{const k=x();return k<=1?o.jsx(o.Fragment,{children:"—"}):o.jsx(bt,{variant:"outline",children:`Flagged by ${k}`})}}],[n,s,v,r,i]),_=ti({data:C,columns:b,state:{sorting:d,pagination:f},sortDescFirst:!1,onSortingChange:p,onPaginationChange:g,getCoreRowModel:Ko(),getSortedRowModel:Qo(),getPaginationRowModel:Jo()});function M(){u(x=>!x),p([]),g({pageIndex:0,pageSize:qt})}const E=x=>x==="asc"?" ▲":x==="desc"?" ▼":"",U=x=>x==="asc"?"ascending":x==="desc"?"descending":"none";return o.jsx(z,{title:"Stage Summary",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(Qe,{type:"text",value:c,onChange:x=>{l(x.target.value),g(k=>({...k,pageIndex:0}))},placeholder:"Filter by stage name or ID…","aria-label":"Filter by stage name or ID",className:"max-w-xs"}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("p",{className:"text-muted-foreground text-xs",children:"Scroll sideways to see all columns →"}),o.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:M,children:a?`Top ${Ke} by duration`:"Problems only"})]}),o.jsxs("p",{className:"sr-only",role:"status","aria-live":"polite",children:["Showing ",C.length," stage",C.length===1?"":"s",": "," ",a?"problems only":`top ${Ke} by duration`,"."]}),o.jsxs(ct,{children:[o.jsx(Jn,{children:_.getHeaderGroups().map(x=>o.jsx(Z,{children:x.headers.map(k=>{const F=k.column.getIsSorted(),O=k.column.getToggleSortingHandler();return o.jsxs(Qn,{scope:"col",tabIndex:k.column.getCanSort()?0:void 0,"aria-sort":U(F),className:D(k.column.getCanSort()&&"tap-target-comfortable cursor-pointer select-none",Wt.has(k.column.id)&&"text-right"),onClick:O,onKeyDown:$=>{O&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),O($))},children:[Gt(k.column.columnDef.header,k.getContext()),E(F)]},k.id)})},x.id))}),o.jsx(dt,{children:_.getRowModel().rows.length===0?o.jsx(Z,{children:o.jsx(B,{colSpan:b.length,className:"text-muted-foreground",children:o.jsxs("span",{className:"flex items-center justify-center gap-2 py-2",children:[o.jsx(dn,{"aria-hidden":"true",className:"size-4 shrink-0"}),"No stages to show."]})})}):_.getRowModel().rows.map(x=>o.jsx(Z,{className:"cursor-pointer",onClick:()=>r(x.original.stage.id),children:x.getVisibleCells().map(k=>o.jsx(B,{className:Wt.has(k.column.id)?"text-right":void 0,children:Gt(k.column.columnDef.cell,k.getContext())},k.id))},x.id))})]}),_.getPageCount()>1?o.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[o.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:()=>_.previousPage(),disabled:!_.getCanPreviousPage(),children:"Previous"}),o.jsxs("span",{className:"text-muted-foreground",children:["Page ",f.pageIndex+1," of ",_.getPageCount()]}),o.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:()=>_.nextPage(),disabled:!_.getCanNextPage(),children:"Next"})]}):null]})})}const $n=20,Ut=24,Kt=40,ci=200,di=640;function gi(e,n=$n){const t=[...e].filter(i=>i.submittedAt&&i.completedAt),s=t.length;return s<=n?{stages:t.sort((i,a)=>i.submittedAt-a.submittedAt),total:s,capped:!1}:{stages:[...t].sort((i,a)=>a.completedAt-a.submittedAt-(i.completedAt-i.submittedAt)).slice(0,n).sort((i,a)=>i.submittedAt-a.submittedAt),total:s,capped:!0}}function fi({appModel:e,catalog:n}){const{openStage:t}=gt(),s=[...e.stages.values()].filter(v=>v.submittedAt&&v.completedAt),r=s.length,i=s.reduce((v,b)=>Math.min(v,b.submittedAt),1/0),a=e.app?.startTime??(Number.isFinite(i)?i:0),u=new Set(n.filter(v=>v.stageId!=null).map(v=>v.stageId)),c=lt(),[l,d]=w.useState(()=>c==="advanced"?r:$n),{stages:p}=gi(s,l),g=Me(p).map(v=>({stageId:v.id,label:`Stage ${v.id}`,wait:v.submittedAt-a,duration:v.completedAt-v.submittedAt,flagged:u.has(v.id)})),h=Math.min(di,Math.max(ci,g.length*Ut+Kt)),m=h-Kt,S=Math.max(1,Math.floor(m/Ut)),C=Math.max(1,Math.ceil(g.length/S));return o.jsx(z,{title:"Job Timeline",summary:r>0?o.jsx(te,{value:`${r} stage${r===1?"":"s"}`,context:`${u.size} flagged`}):void 0,children:r===0?o.jsx(mt,{tone:"neutral",icon:dn,title:"No stages in this run."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("label",{htmlFor:"timeline-topn",children:"showing top"}),o.jsx("input",{id:"timeline-topn",type:"number",min:1,max:r,value:Math.min(l,r),onChange:v=>{let b=parseInt(v.target.value,10);Number.isFinite(b)||(b=l),d(Math.max(1,Math.min(r,b)))},className:"w-16 rounded border border-input bg-transparent px-1 py-0.5","aria-label":"Number of stages to show"}),o.jsxs("span",{children:["of ",r," by duration · flagged in red"]})]}),o.jsx(ae,{ariaLabel:"Job timeline: stage durations by time from app start.",height:h,table:{caption:"Job timeline: stage durations by time from app start",columns:["Stage","Start","Duration"],rows:g.map(v=>[v.label,I(v.wait),I(v.duration)]),align:["left","right","right"]},children:o.jsxs(Pe,{data:g,layout:"vertical",children:[o.jsx(Ce,{stroke:N.muted,strokeOpacity:.2,horizontal:!1}),o.jsx(le,{type:"number",tickFormatter:v=>`${Math.round(v/1e3)}s`,tick:{fontSize:10},tickCount:10}),o.jsx(ue,{type:"category",dataKey:"label",tick:{fontSize:10},width:64,interval:0,tickFormatter:(v,b)=>b%C===0?v:""}),o.jsx(ye,{formatter:(v,b)=>b==="Duration"?I(Number(v)):[null,null]}),o.jsx(ve,{dataKey:"wait",stackId:"timeline",fill:"transparent",name:"Wait"}),o.jsx(ve,{dataKey:"duration",stackId:"timeline",name:"Duration",cursor:"pointer",onClick:v=>t(v.payload.stageId),children:g.map(v=>o.jsx(ln,{fill:v.flagged?N.critical:N.accent,stroke:v.flagged?N.critical:"none",strokeWidth:v.flagged?2:0},v.stageId))})]})})]})})}const rt={present:"present",disabled:"disabled",notEmitted:"not emitted",notApplicable:"not applicable",outsideEventLog:"outside event log",unknown:"unknown"},mi={present:"info",disabled:"warning",notEmitted:"warning",notApplicable:"muted",outsideEventLog:"muted",unknown:"muted"};function pi({entry:e}){const n=e.evidence?.count,t=vs(),s=`${e.summary}${n!=null?` · ${n} observed`:""}`,{tooltipProps:r,srOnlyTooltip:i}=ws(s);return o.jsxs("li",{id:`evidence-availability-${e.key}`,tabIndex:-1,ref:a=>t(e.key,a),className:"flex flex-col gap-0.5 rounded-md px-2 py-1 outline-none focus:ring-2 focus:ring-ring",...r,children:[o.jsxs("span",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(se,{impactBand:mi[e.state]}),o.jsx("span",{className:"truncate text-sm font-medium",children:Ss(e.key)})]}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:rt[e.state]}),i]}),o.jsx(H,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:s})})]})}function hi(e){return Object.keys(rt).map(n=>[n,e.filter(t=>t.state===n).length]).filter(([,n])=>n>0).map(([n,t])=>`${t} ${rt[n]}`).join(" · ")}function xi({ledger:e}){const{evidenceCardOpen:n,setEvidenceCardOpen:t}=on();return o.jsx(z,{title:"Evidence availability",open:n,onOpenChange:t,summary:o.jsx("span",{className:"text-xs text-muted-foreground",children:e?hi(e.entries):"Unavailable for this restored run"}),children:e?o.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(s=>o.jsx(pi,{entry:s},s.key))}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Evidence availability is unavailable for this restored run."})})}const vi=64;function wi(e,n){return n>=1?e:`color-mix(in srgb, ${e} ${n*100}%, transparent)`}function Si(e){return[{key:"startup",label:"Startup",value:e.startup,color:N.info,fillOpacity:1},{key:"stagesActive",label:"Stages active",value:e.stagesActive,color:N.clean,fillOpacity:1},{key:"gaps",label:"Scheduler gaps",value:e.gaps,color:N.warning,fillOpacity:1},{key:"idle",label:"Idle",value:e.idle,color:N.muted,fillOpacity:.6}].filter(n=>n.value>0).map(n=>({...n,legendColor:wi(n.color,n.fillOpacity)}))}const Ci=w.memo(function({appModel:n}){const{app:t,stages:s}=n,r=Se(t,s);if(r.total<=0)return null;const i=Si(r),a=l=>r.total>0?l/r.total*100:0,u=i.reduce((l,d)=>d.value>l.value?d:l,i[0]),c=[i.reduce((l,d)=>({...l,[d.key]:d.value}),{name:"total"})];return o.jsxs(z,{title:"Wall-Clock Breakdown",badges:o.jsxs("span",{className:"text-xs text-muted-foreground",children:[I(r.total)," total"]}),summary:o.jsx(te,{value:`${u.label} ${Math.round(a(u.value))}%`,context:`of ${I(r.total)} total`}),children:[o.jsx(ae,{ariaLabel:`Wall-clock breakdown: ${I(r.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:vi,table:{caption:"Wall-clock time breakdown",columns:["Segment","Duration","% of total"],rows:i.map(l=>[l.label,I(l.value),`${Math.round(a(l.value))}%`]),align:["left","right","right"]},children:o.jsxs(Pe,{data:c,layout:"vertical",stackOffset:"expand",margin:{top:0,right:0,bottom:0,left:0},children:[o.jsx(le,{type:"number",hide:!0,domain:[0,1]}),o.jsx(ue,{type:"category",dataKey:"name",hide:!0}),o.jsx(ye,{shared:!1,labelFormatter:()=>"",formatter:(l,d)=>[I(Number(l)),d]}),o.jsx(Ns,{wrapperStyle:{fontSize:12},itemSorter:l=>i.findIndex(d=>d.key===l.dataKey),formatter:(l,d)=>{const p=i.find(f=>f.key===d.dataKey);return o.jsx("span",{style:{color:p?.color},children:l})},content:l=>o.jsx(Es,{...l,payload:l.payload?.map(d=>{const p=i.find(f=>f.key===d.dataKey);return p?{...d,color:p.legendColor}:d})})}),i.map(l=>o.jsx(ve,{dataKey:l.key,name:l.label,stackId:"wallclock",fill:l.color,fillOpacity:l.fillOpacity},l.key))]})}),o.jsx(H,{children:o.jsx("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground",children:i.map(l=>o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block size-2.5 rounded-sm",style:{backgroundColor:l.color,opacity:l.fillOpacity}}),l.label," (",I(l.value),")"]},l.key))})})]})}),ot=36e5,yi=5,Xe={totalCoreHours:null,usefulCoreHours:null,wastedCoreHours:null,totalCores:null,topStages:[]};function ji(e,n=[],t){if(!t||e?.startTime==null||e?.endTime==null)return Xe;const s=e.endTime-e.startTime;if(s<=0)return Xe;const r=at(e,n);if(r<=0)return Xe;const i=r*s/ot,a=(t.busyCoreMs??0)/ot,u=Math.max(0,i-a),c=Object.entries(t.perStage??{}).map(([l,d])=>({stageId:Number(l),coreMs:d?.totalTaskDurationSum??0})).sort((l,d)=>d.coreMs-l.coreMs).slice(0,yi);return{totalCoreHours:i,usefulCoreHours:a,wastedCoreHours:u,totalCores:r,topStages:c}}function Ri({appModel:e}){const n=ji(e.app,e.executors.added,e.runAggregates);if(n.totalCoreHours==null)return null;const t=n.totalCoreHours>0?Math.round(n.wastedCoreHours/n.totalCoreHours*100):0;return o.jsx(z,{title:"Wasted Core-Hours",statusBadge:o.jsx(pn,{}),defaultCollapsed:!0,summary:o.jsx(te,{value:o.jsx("span",{className:"whitespace-nowrap",children:G(n.wastedCoreHours)}),context:`wasted of ${G(n.totalCoreHours)} allocated`}),children:o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("p",{children:["Allocated: ",o.jsx("strong",{children:G(n.totalCoreHours)})," · Used:"," ",o.jsx("strong",{children:G(n.usefulCoreHours)})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Wasted: ",o.jsx("strong",{children:G(n.wastedCoreHours)})," (",t,"% of allocated)"]}),o.jsx(H,{children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Allocated = ",n.totalCores," cores over the run; used = core-time that actually ran tasks."]})}),n.topStages.length>0&&o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground text-xs",children:"Top stages by task core-time"}),o.jsx("ul",{className:"space-y-0.5",children:n.topStages.map(s=>o.jsxs("li",{className:"flex justify-between gap-2",children:[o.jsxs("span",{children:["Stage ",s.stageId]}),o.jsx("span",{className:"text-muted-foreground tabular-nums",children:G(s.coreMs/ot)})]},s.stageId))})]})]})})}function bi({appModel:e,catalog:n,getTaskData:t,activeFileId:s,onRoute:r}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("h2",{className:"sr-only",children:"Full app report"}),o.jsx(Ci,{appModel:e}),o.jsx(fi,{appModel:e,catalog:n}),o.jsx(mr,{appModel:e,activeFileId:s}),o.jsx(ui,{appModel:e,catalog:n,getTaskData:t,onRoute:r}),o.jsxs(ut,{children:[o.jsx(Q,{cardId:"reference-evidence-availability",collapsedTile:!0,children:o.jsx(xi,{ledger:e.evidenceAvailability})}),o.jsx(Q,{cardId:"reference-etl-phases",collapsedTile:!0,children:o.jsx(dr,{appModel:e})}),o.jsx(Q,{cardId:"reference-scaling-sim",collapsedTile:!0,children:o.jsx(yr,{appModel:e})}),o.jsx(Q,{cardId:"reference-efficiency-model",collapsedTile:!0,children:o.jsx(ur,{appModel:e})}),o.jsx(Q,{cardId:"reference-wasted-core-hours",collapsedTile:!0,children:o.jsx(Ri,{appModel:e})}),o.jsx(Q,{cardId:"reference-core-usage-histogram",collapsedTile:!0,children:o.jsx(ar,{appModel:e,getTaskData:t})})]})]})}function ki({appModel:e,catalog:n,configFindings:t,getTaskData:s,activeFileId:r,options:i,onRoute:a,activeTab:u,onActiveTabChange:c}){const{selection:l}=ht(),d=w.useMemo(()=>_t(n,l),[n,l]),p=w.useMemo(()=>_t(t??[],l),[t,l]),f=d.length+p.length,g=n.length+(t??[]).length>0&&f===0;return o.jsxs("main",{className:"flex-1 space-y-6 p-4",children:[o.jsx(nr,{options:i,resultCount:f}),g&&o.jsx(Zs,{}),o.jsx(Fr,{appModel:e,catalog:d}),!g&&o.jsxs(Rs,{value:u,onValueChange:h=>c(h),children:[o.jsxs(bs,{variant:"chrome","aria-label":"Report view",children:[o.jsx(It,{value:"findings",className:"tap-target-comfortable",children:"Findings"}),o.jsx(It,{value:"full-report",className:"tap-target-comfortable",children:"Full app report"})]}),o.jsxs($t,{value:"findings",keepMounted:!0,children:[o.jsx("h2",{className:"sr-only",children:"Findings"}),o.jsx(Zr,{appModel:e,catalog:d,configFindings:p,stages:e.stages,getTaskData:s,activeFileId:r,onRoute:a})]}),o.jsx($t,{value:"full-report",keepMounted:!0,children:o.jsx(bi,{appModel:e,catalog:d,getTaskData:s,configFindings:p,activeFileId:r,onRoute:a})})]})]})}function Fi(){const{resetToDropZone:e,startLoad:n,getTaskData:t}=es(),s=de(R=>R.appModel),r=de(R=>R.catalog),i=de(R=>R.activeFileId),a=de(R=>R.exportMode),{recentEntries:u,onPickRecent:c,onRemoveRecent:l}=ys(i),[d,p]=w.useState(!1),[f,g]=w.useState("findings"),{referenceOpen:h}=on(),[m,S]=w.useState(null),[C,v]=w.useState(null),[b,_]=w.useState(null),M=w.useRef(0),E=w.useRef(null),U=w.useRef(null),x=w.useRef(new Map),k=w.useRef(new Map),F=w.useRef(null),O=m?.target??null;w.useEffect(()=>()=>{F.current&&clearTimeout(F.current)},[]),w.useEffect(()=>{h&&g("full-report")},[h]);const $=w.useCallback(R=>{E.current?.token===R&&(E.current=null,U.current=null,S(P=>P?.token===R?null:P))},[]),T=w.useCallback(R=>{if(E.current?.token!==R.token)return null;const{catalog:P,activeFileId:V}=kt.getState();if(U.current!==V)return null;const W=we(R.target.finding,P);return!W||W.widgetId!==R.target.widgetId||W.region!==R.target.region?null:W},[]),je=w.useCallback(R=>{g("findings");const P=M.current+1;M.current=P;const{catalog:V,activeFileId:W}=kt.getState(),J=we(R.finding,V);if(!J||J.widgetId!==R.widgetId||J.region!==R.region){E.current=null,U.current=null,S(null);return}const ce={target:J,token:P};E.current=ce,U.current=W,S(ce)},[]),ne=w.useCallback((R,P)=>{x.current.set(R,P);const V=E.current;return V?.target.widgetId===R&&T(V)&&P.open(),()=>{x.current.get(R)===P&&x.current.delete(R)}},[T]),_n=w.useCallback((R,P)=>(k.current.set(R,P),()=>{k.current.get(R)===P&&k.current.delete(R)}),[]),Mn=w.useCallback((R,P)=>{if(!P)return;const V=E.current;if(!V||V.target.widgetId!==R)return;const W=T(V);if(!W){$(V.token);return}const J=x.current.get(R);if(!J)return;const ce=J.getDisclosureButton();if(!ce){$(V.token);return}const jt=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=k.current.get(W.finding);Ae?(Ae.scrollIntoView({behavior:jt?"auto":"smooth",block:"center",inline:"nearest"}),Ae.focus({preventScroll:!0}),F.current&&clearTimeout(F.current),_(W.finding),F.current=setTimeout(()=>{F.current=null,_(null)},2e3)):(J.wrapperElement.scrollIntoView({behavior:jt?"auto":"smooth",block:"start",inline:"nearest"}),ce.focus({preventScroll:!0}),v(R)),$(V.token)},[$,T]),Pn=w.useCallback(R=>{v(P=>P===R?null:P)},[]);w.useLayoutEffect(()=>{if(!m)return;const R=T(m);if(!R){$(m.token);return}x.current.get(R.widgetId)?.open()},[$,T,m]),w.useLayoutEffect(()=>{const R=E.current;R&&!T(R)&&$(R.token)},[i,r,$,T]);const Te=de(R=>R.configFindings),yt=w.useMemo(()=>Js(r,Te),[r,Te]),Nn=R=>{a||(R.preventDefault(),p(!0))},En=()=>p(!1),Tn=R=>{if(a)return;R.preventDefault(),p(!1);const P=R.dataTransfer.files[0];P&&n(P)};return o.jsxs("div",{"data-testid":"dashboard",className:"relative flex min-h-screen flex-col",style:{paddingRight:"var(--docs-inset, 0px)"},onDragOver:Nn,onDragLeave:En,onDrop:Tn,children:[o.jsx(js,{onLoadNew:e,recentEntries:u,activeFileId:i,onPickRecent:c,onRemoveRecent:l}),o.jsx(Ys,{options:yt,fileId:i,children:o.jsx(ts,{registerWidget:ne,registerFindingAnchor:_n,reportWidgetOpen:Mn,clearRouteFocus:Pn,focusedWidgetId:C,activeRouteTarget:O,flashedFinding:b,children:o.jsx(ki,{appModel:s,catalog:r,configFindings:Te,getTaskData:t,activeFileId:i,options:yt,onRoute:je,activeTab:f,onActiveTabChange:g})})}),o.jsx(io,{appModel:s,catalog:r,getTaskData:t}),d&&o.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80",children:o.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 zi(){return o.jsx(Cs,{children:o.jsx(Fi,{})})}export{zi as Dashboard};
@@ -1 +0,0 @@
1
- import{r,j as t}from"./react-vendor-DA6opS-q.js";import{L as g,at as B,W as T,A as O,T as w,a8 as M,n as f}from"./index-CHjV2-jB.js";import{R as N}from"./useRecentFiles-BPGQ6XII.js";import{I as _}from"./ImpactEstimate-C6GzFOY9.js";import{u as $,R as D}from"./finding-anchor-4TmpXd7j.js";import{a as E}from"./StagePill-CYCMdlIx.js";import{W as L}from"./WidgetLeadSummary-DRNRVvn7.js";import{s as W,c as q}from"./impact-sort-Cq6KOLqh.js";import{u as F,S as G}from"./useSortMode-BOPpfLhJ.js";import{u as K}from"./usePagedRows-CFoZrPr4.js";import{R as k}from"./RowPagination-DypWbnic.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";function z({finding:n}){const o=$([n]);return t.jsxs("li",{ref:o.ref,tabIndex:o.tabIndex,"data-flashed":o.dataFlashed,className:`space-y-2 ${D} transition-colors ${o.flashClassName}`,children:[n.stageIds&&n.stageIds.length>0?t.jsx(E,{pills:n.stageIds.map(i=>({id:i}))}):null,t.jsxs("p",{children:[n.recommendation," ",t.jsx(_,{finding:n})]})]})}const re=r.memo(function({catalog:o,defaultCollapsed:i=!0}){const{sortMode:x,setSortMode:S,orderBy:h}=F(),[l,R]=r.useState(!i),[P,d]=r.useState(0),{findings:s,pills:c,groupConfidence:m}=r.useMemo(()=>{const e=o.filter(a=>a.type==="duplicatePlanSubtree").sort((a,y)=>g[a.impactBand]-g[y.impactBand]),C=[...new Set(e.flatMap(a=>a.stageIds??[]))].map(a=>({id:a})),b=e.every(a=>a.confidence===e[0]?.confidence)?e[0]:void 0;return{findings:e,pills:C,groupConfidence:b}},[o]),p=h(s,e=>[e],W),u=B(),j=u?p.findIndex(e=>e===u.finding):null,{totalPages:I,effectivePage:v,visible:A}=K(p,P,d,j);return s.length===0?null:t.jsxs(T,{title:"Redundant Plan Subtree",impactBand:f(s),open:l,onOpenChange:R,badges:t.jsxs(t.Fragment,{children:[t.jsx(w,{type:"duplicatePlanSubtree",impactBand:f(s)??"info",className:M}),q(s,s.length,l)?t.jsx(G,{mode:x,onChange:S}):null]}),statusBadge:t.jsx(O,{children:t.jsx(N,{confidence:m?.confidence,validationRequired:m?.validationRequired,evidenceKey:"sqlPlan"})}),summary:t.jsx(L,{value:`${c.length} stage${c.length===1?"":"s"}`,context:`${s.length} finding${s.length===1?"":"s"} flagged`}),children:[t.jsx("ul",{className:"space-y-3 text-sm",children:A.map(e=>t.jsx(z,{finding:e},e.id))}),t.jsx(k,{page:v,totalPages:I,onPrev:()=>d(e=>e-1),onNext:()=>d(e=>e+1)})]})});export{re as DuplicatePlanSubtree};
@@ -1 +0,0 @@
1
- import{a1 as M,au as b}from"./index-CHjV2-jB.js";import{j as a}from"./react-vendor-DA6opS-q.js";import{j as S,C as l}from"./useRecentFiles-BPGQ6XII.js";import{B as C,C as B,X as H,Y as w,T as A,a as D,i as m}from"./charts-vendor-Cf1-wzeH.js";function G(n){const s=M(o=>o.exportMode);return{exportMode:s,getTaskData:s?void 0:n}}const I=5,O=30,R=220;function g(n,s){if(n.length<2)return n[0]??null;const o=n[1]-n[0],e=Math.round((s-n[0])/o);return n[Math.min(n.length-1,Math.max(0,e))]}function L({metrics:n,fieldNames:s,markers:o={}}){const e=s.indexOf("duration");if(e===-1)return null;const d=s.length,T=n.length/d,r=[];for(let t=0;t<T;t++)r.push(n[t*d+e]);if(r.length<I)return a.jsxs("p",{className:"text-muted-foreground text-xs",children:["Too few tasks (",r.length,") for a distribution."]});const{labels:i,data:j}=b(r,O),k=i[1]-i[0],u=i.map((t,c)=>({bin:`${(t/1e3).toFixed(1)}s`,range:`${(t/1e3).toFixed(1)}s – ${((t+k)/1e3).toFixed(1)}s`,ms:t,count:j[c]})),x=o.p50!=null?g(i,o.p50):null,p=o.p95!=null?g(i,o.p95):null,f=x!=null?u.find(t=>t.ms===x)?.bin:void 0,h=p!=null?u.find(t=>t.ms===p)?.bin:void 0;return a.jsx(S,{title:"Task duration",ariaLabel:"Task duration histogram",height:R,table:{caption:"Task duration histogram",columns:["Duration bin","Task count"],rows:u.map(t=>[t.range,t.count]),align:["right","right"]},children:a.jsxs(C,{data:u,children:[a.jsx(B,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),a.jsx(H,{dataKey:"bin",tick:{fontSize:10}}),a.jsx(w,{allowDecimals:!1,tick:{fontSize:10},width:32}),a.jsx(A,{formatter:t=>[`${Number(t)} task${Number(t)===1?"":"s"}`,"Count"],labelFormatter:(t,c)=>c?.[0]?.payload?.range??t}),a.jsx(D,{dataKey:"count",name:"Tasks",fill:l.accent}),f?a.jsx(m,{x:f,stroke:l.accent,label:"P50"}):null,h?a.jsx(m,{x:h,stroke:l.warning,label:"P95"}):null]})})}export{L as D,G as u};
@@ -1 +0,0 @@
1
- import{j as e}from"./react-vendor-DA6opS-q.js";import{e as r}from"./index-CHjV2-jB.js";const x={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 m({icon:n,tone:o="neutral",title:a,description:s,action:l,className:i}){const t=x[o];return e.jsxs("div",{className:r("flex items-start gap-3 rounded-xl border p-4",t.box,i),children:[e.jsx(n,{"aria-hidden":"true",className:r("mt-0.5 size-4 shrink-0",t.icon)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:r("text-sm font-medium",t.title),children:a}),s?e.jsx("p",{className:"text-xs text-muted-foreground",children:s}):null]}),l]})}export{m as E};
@@ -1 +0,0 @@
1
- import{r,j as a}from"./react-vendor-DA6opS-q.js";import{L as m,at as v,W as I,ar as l,as as d,T as R,n as c,I as B}from"./index-CHjV2-jB.js";import{I as z}from"./ImpactEstimate-C6GzFOY9.js";import{R as E}from"./RowPagination-DypWbnic.js";import{u as N}from"./finding-anchor-4TmpXd7j.js";import{u as P}from"./usePagedRows-CFoZrPr4.js";import{W as w}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function y({finding:i}){const s=N([i]);return a.jsxs("div",{ref:s.ref,tabIndex:s.tabIndex,"data-flashed":s.dataFlashed,className:`transition-colors ${s.flashClassName}`,children:[a.jsxs("p",{className:"flex flex-wrap items-start gap-2",children:[a.jsx(B,{impactBand:i.impactBand,className:"mt-1.5"}),a.jsx("strong",{children:l("pct",d(i))})," average executor utilization"]}),a.jsx(z,{finding:i}),a.jsx("p",{children:i.recommendation})]})}const L=r.memo(function({catalog:s,defaultCollapsed:p=!0}){const[u,o]=r.useState(0),e=r.useMemo(()=>s.filter(t=>t.type==="utilization").slice().sort((t,j)=>m[t.impactBand]-m[j.impactBand]),[s]),n=v(),x=n?e.findIndex(t=>t===n.finding):null,{totalPages:f,effectivePage:g,visible:h}=P(e,u,o,x);return e.length===0?null:a.jsxs(I,{title:"Executor Utilization",impactBand:c(e),badges:a.jsx(R,{type:"utilization",impactBand:c(e)??"info"}),defaultCollapsed:p,summary:a.jsx(w,{value:`${l("pct",d(e[0]))} average`,context:`${e.length} item${e.length===1?"":"s"} flagged`}),children:[a.jsx("div",{className:"space-y-2 text-sm",children:h.map(t=>a.jsx(y,{finding:t},t.id))}),a.jsx(E,{page:g,totalPages:f,onPrev:()=>o(t=>t-1),onNext:()=>o(t=>t+1)})]})});export{L as ExecutorUtilization};
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./react-vendor-DA6opS-q.js";import{at as I,n as N,W as P,A as w,T as G,q as T}from"./index-CHjV2-jB.js";import{W as b}from"./WidgetLeadSummary-DRNRVvn7.js";import{R as A}from"./useRecentFiles-BPGQ6XII.js";import{S as E}from"./StageHeader-uDBLHgdg.js";import{I as O}from"./ImpactEstimate-C6GzFOY9.js";import{R as B}from"./RowPagination-DypWbnic.js";import{u as W}from"./usePagedRows-CFoZrPr4.js";import{u as $,R as F}from"./finding-anchor-4TmpXd7j.js";import{c as L}from"./impact-sort-Cq6KOLqh.js";import{u as q,S as _}from"./useSortMode-BOPpfLhJ.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./StagePill-CYCMdlIx.js";import"./toggle-group-lbIXRG0W.js";const H="GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.";function M(t){return[...t].sort((a,r)=>(typeof r.value=="number"?r.value:0)-(typeof a.value=="number"?a.value:0))}function V({finding:t,appModel:a}){const r=$([t]),n=(t.stageId!=null?a.stages.get(t.stageId):void 0)?.executorRunTime;return e.jsxs("li",{ref:r.ref,tabIndex:r.tabIndex,"data-flashed":r.dataFlashed,className:`space-y-2 ${F} transition-colors ${r.flashClassName}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(E,{stageId:t.stageId,appModel:a}),e.jsx(w,{children:e.jsx(A,{confidence:t.confidence,validationRequired:t.validationRequired})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["GC: ",e.jsxs("strong",{children:[t.value,"%"]})," · Executor run time:"," ",e.jsx("strong",{children:T(n??0)})]}),e.jsx(O,{finding:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.recommendation})]})}function S({title:t,findings:a,appModel:r,page:u,setPage:n,routeTarget:d,orderBy:i}){const h=M(a),m=i(h,s=>[s],s=>s.stageId),g=d?m.findIndex(s=>s===d.finding):null,{totalPages:x,effectivePage:p,visible:f}=W(m,u,n,g);return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("h4",{className:"font-heading text-sm font-medium",children:[t," · ",a.length," stage",a.length===1?"":"s"]}),e.jsx("ul",{className:"space-y-3",children:f.map(s=>e.jsx(V,{finding:s,appModel:r},s.stageId))}),e.jsx(B,{page:p,totalPages:x,onPrev:()=>n(s=>s-1),onNext:()=>n(s=>s+1)})]})}function oe({catalog:t,appModel:a,defaultCollapsed:r=!0}){const[u,n]=l.useState(0),[d,i]=l.useState(0),{sortMode:h,setSortMode:m,orderBy:g}=q(),[x,p]=l.useState(!r),f=I(),s=l.useRef(!1);l.useEffect(()=>{if(!s.current){s.current=!0;return}n(0),i(0)},[a]);const c=t.filter(o=>o.type==="gc");if(c.length===0)return null;const j=c.filter(o=>o.direction!=="low"),v=c.filter(o=>o.direction==="low"),R=N(c),C=[...c].sort((o,y)=>(typeof y.value=="number"?y.value:0)-(typeof o.value=="number"?o.value:0))[0];return e.jsx(P,{title:"GC Pressure",impactBand:R,badges:e.jsxs(e.Fragment,{children:[e.jsx(G,{type:"gc",impactBand:R??"info"}),L(c,c.length,x)?e.jsx(_,{mode:h,onChange:o=>{m(o),n(0),i(0)}}):null]}),defaultCollapsed:r,open:x,onOpenChange:p,summary:e.jsx(b,{value:`${C.value}%`,context:`${c.length} stage${c.length===1?"":"s"} flagged`}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{children:e.jsx("p",{className:"text-xs text-muted-foreground",children:H})}),j.length>0&&e.jsx(S,{title:"GC overhead",findings:j,appModel:a,page:u,setPage:n,routeTarget:f,orderBy:g}),v.length>0&&e.jsx(S,{title:"Low GC (cost)",findings:v,appModel:a,page:d,setPage:i,routeTarget:f,orderBy:g})]})})}export{oe as GcPressure};
@@ -1 +0,0 @@
1
- import{r as h,j as s}from"./react-vendor-DA6opS-q.js";import{j as d,q as x}from"./index-CHjV2-jB.js";function a(t){return t===0?"0s":x(t)}function w(t,e){const n=a(t),r=a(e);return n===r?r:`${n}-${r}`}function f(t){const e=Math.round(t.value*10)/10;switch(t.unit){case"bytes":return d(t.value);case"ms":return a(t.value);case"mbSeconds":return`${e.toLocaleString("en-US")} MB-s`;case"coreHours":return`${e.toFixed(1)} core-h`;case"coreMs":return`${e.toLocaleString("en-US")} core-ms`;default:return String(t.value)}}function l(t){return/^0(\.0+)?(?:[^0-9.]|$)/.test(t)}function C(t){if(!t)return null;if(t.wallClock){if(t.wallClock.high<=0)return null;const e=a(t.wallClock.high);return l(e)?null:e}if(t.rawWaste){if(t.rawWaste.value<=0)return null;const e=f(t.rawWaste);return l(e)?null:e}return null}function k({finding:t}){const e=h.useId(),n=t.impactEstimate;if(!n)return null;const r=n.wallClock&&n.wallClock.high>0?a(n.wallClock.high):null,u=r&&!l(r)?w(n.wallClock.low,n.wallClock.high):null,o=n.rawWaste&&n.rawWaste.value>0?f(n.rawWaste):null,m=!u&&o&&!l(o)?o:null,c=u??m;if(!c)return null;const i=`Estimate method: ${n.estimateMethod}`;return s.jsxs("span",{className:"impact-estimate text-xs text-muted-foreground",title:i,tabIndex:0,"aria-describedby":e,children:["Potential savings: ",s.jsx("strong",{children:c}),s.jsx("span",{id:e,className:"sr-only",children:i})]})}export{k as I,f as a,C as b,w as f};
@@ -1 +0,0 @@
1
- import{j as e}from"./react-vendor-DA6opS-q.js";import{I as o}from"./ImpactEstimate-C6GzFOY9.js";import{W as c,T as l}from"./index-CHjV2-jB.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function p({finding:n}){const{recommendation:t}=n;return e.jsxs("div",{className:"flex flex-col gap-1 transition-colors",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ApplicationEnd event: ",e.jsx("strong",{children:"missing"})]}),e.jsx(o,{finding:n}),e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx("p",{children:"This run’s event log never recorded an ApplicationEnd event."}),t?e.jsx("p",{children:t}):null]})]})}function j({catalog:n,defaultCollapsed:t=!0}){const s=n.find(r=>r.type==="incompleteRun");if(!s)return null;const{impactBand:i}=s;return e.jsx(c,{title:"Incomplete Run",impactBand:i,badges:e.jsx(l,{type:"incompleteRun",impactBand:i}),defaultCollapsed:t,children:e.jsx(p,{finding:s})})}export{j as IncompleteRun};
@@ -1 +0,0 @@
1
- import{j as s}from"./react-vendor-DA6opS-q.js";import{I as n}from"./ImpactEstimate-C6GzFOY9.js";import{W as d,T as m,A as u}from"./index-CHjV2-jB.js";import{W as x}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function f({finding:t}){const l=t.failedJobs,a=t.totalJobs,e=t.failedTasks,r=t.totalTasks,i=t.taskFailureRate,{value:c,recommendation:o}=t;return s.jsxs("div",{className:"flex flex-col gap-1 transition-colors",children:[s.jsxs("p",{children:["Failure rate: ",s.jsxs("strong",{children:[c,"%"]})," (",l," of ",a," completed jobs)"]}),s.jsx(u,{children:s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Task-failure context: ",e," of ",r," tasks failed (",i,"%)."]})}),s.jsx(n,{finding:t}),o?s.jsx("p",{children:o}):null]})}function h({catalog:t,defaultCollapsed:l=!0}){const a=t.find(o=>o.type==="jobFailureRate");if(!a)return null;const{impactBand:e,value:r}=a,i=a.failedJobs,c=a.totalJobs;return s.jsx(d,{title:"Job Failures",impactBand:e,badges:s.jsx(m,{type:"jobFailureRate",impactBand:e}),defaultCollapsed:l,summary:s.jsx(x,{value:`${r}%`,context:`${i} of ${c} completed jobs failed`}),children:s.jsx(f,{finding:a})})}export{h as JobFailures};
@@ -1 +0,0 @@
1
- import{r as d,j as a}from"./react-vendor-DA6opS-q.js";import{L as p,at as w,W as C,A as l,T as M,n as x,I as b,as as U,ar as A}from"./index-CHjV2-jB.js";import{k as f,R as P}from"./useRecentFiles-BPGQ6XII.js";import{u as S}from"./finding-anchor-4TmpXd7j.js";import{I as z}from"./ImpactEstimate-C6GzFOY9.js";import{R as D}from"./RowPagination-DypWbnic.js";import{u as E}from"./usePagedRows-CFoZrPr4.js";import{W as T}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function F(e){const t=U(e),o=A("pct",t);return e.variant==="idleCores"?`${o} of allocated core-time idle`:e.variant==="memoryBand"?e.rule==="heapNearCapacity"?`${o} of allocated heap used: near capacity`:`${o} of allocated heap used: over-provisioned`:`~${t.toLocaleString("en-US")} MB-seconds wasted`}function L(e){const t=e.recommendation??"",o=t.indexOf(": ");return o===-1?` ${t}`:`; ${t.slice(o+2)}`}function g(e){if(e.rule==null)return null;const t=e.recommendation??"",o=t.indexOf(": ");return o===-1?null:` ${t.slice(0,o)}.`}function v(e){return"executorId"in e&&e.executorId!=null?`Executor ${e.executorId}`:e.variant==="idleCores"?"Idle cores":"Memory waste"}function O({finding:e}){const t=S([e]);return e.dataUnavailable?a.jsx("div",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:a.jsx(l,{children:a.jsx("p",{className:"text-muted-foreground",children:e.recommendation})})}):a.jsxs("div",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[a.jsxs("p",{className:"flex flex-wrap items-start gap-2",children:[a.jsx(b,{impactBand:e.impactBand,className:"mt-1.5"}),a.jsx("strong",{children:v(e)})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[F(e),L(e),g(e)!=null?a.jsx(l,{children:g(e)}):null]}),a.jsx(z,{finding:e})]})}const X=d.memo(function({catalog:t,defaultCollapsed:o=!0}){const[h,i]=d.useState(0),{findings:r,groupConfidence:m}=d.useMemo(()=>{const n=t.filter(s=>s.type==="memoryUtilization").sort((s,$)=>p[s.impactBand]-p[$.impactBand]),c=n.filter(f),N=c.every(s=>s.confidence===c[0]?.confidence)?c[0]:void 0;return{findings:n,groupConfidence:N}},[t]),u=w(),y=u?r.findIndex(n=>n===u.finding):null,{totalPages:j,effectivePage:I,visible:R}=E(r,h,i,y);if(!r.some(f))return null;const B=r.find(n=>!n.dataUnavailable)??r[0];return a.jsxs(C,{title:"Memory Utilization",impactBand:x(r),badges:a.jsx(M,{type:"memoryUtilization",impactBand:x(r)??"info"}),statusBadge:a.jsx(l,{children:a.jsx(P,{confidence:m?.confidence,validationRequired:m?.validationRequired,evidenceKey:"executorMetrics"})}),defaultCollapsed:o,summary:a.jsx(T,{value:v(B),context:`${r.length} item${r.length===1?"":"s"} flagged`}),children:[a.jsx("div",{className:"space-y-2 text-sm",children:R.map(n=>a.jsx(O,{finding:n},n.id))}),a.jsx(D,{page:I,totalPages:j,onPrev:()=>i(n=>n-1),onNext:()=>i(n=>n+1)})]})});export{X as MemoryUtilization};
@@ -1 +0,0 @@
1
- import{r as n,j as e}from"./react-vendor-DA6opS-q.js";import{L as g,at as P,W as y,A as C,T,a8 as w,n as u}from"./index-CHjV2-jB.js";import{R as M}from"./useRecentFiles-BPGQ6XII.js";import{I as N}from"./ImpactEstimate-C6GzFOY9.js";import{u as _,R as $}from"./finding-anchor-4TmpXd7j.js";import{a as E}from"./StagePill-CYCMdlIx.js";import{W as L}from"./WidgetLeadSummary-DRNRVvn7.js";import{s as W,c as b}from"./impact-sort-Cq6KOLqh.js";import{u as q,S as F}from"./useSortMode-BOPpfLhJ.js";import{u as D}from"./usePagedRows-CFoZrPr4.js";import{R as G}from"./RowPagination-DypWbnic.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";function z({finding:a}){const o=_([a]);return e.jsxs("li",{ref:o.ref,tabIndex:o.tabIndex,"data-flashed":o.dataFlashed,className:`space-y-2 ${$} transition-colors ${o.flashClassName}`,children:[a.stageIds&&a.stageIds.length>0?e.jsx(E,{pills:a.stageIds.map(i=>({id:i}))}):null,e.jsxs("p",{children:[a.recommendation," ",e.jsx(N,{finding:a})]})]})}const oe=n.memo(function({catalog:o,defaultCollapsed:i=!0}){const{sortMode:f,setSortMode:x,orderBy:h}=q(),[l,R]=n.useState(!i),[j,d]=n.useState(0),{findings:t,pills:c}=n.useMemo(()=>{const s=o.filter(r=>r.type==="overBroadcast").sort((r,O)=>g[r.impactBand]-g[O.impactBand]),A=[...new Set(s.flatMap(r=>r.stageIds??[]))].map(r=>({id:r}));return{findings:s,pills:A}},[o]),m=h(t,s=>[s],W),p=P(),v=p?m.findIndex(s=>s===p.finding):null,{totalPages:S,effectivePage:B,visible:I}=D(m,j,d,v);return t.length===0?null:e.jsxs(y,{title:"Oversized Broadcast Join",impactBand:u(t),open:l,onOpenChange:R,badges:e.jsxs(e.Fragment,{children:[e.jsx(T,{type:"overBroadcast",impactBand:u(t)??"info",className:w}),b(t,t.length,l)?e.jsx(F,{mode:f,onChange:x}):null]}),statusBadge:e.jsx(C,{children:e.jsx(M,{confidence:t[0].confidence,validationRequired:t[0].validationRequired,evidenceKey:"sqlPlan"})}),summary:e.jsx(L,{value:`${c.length} stage${c.length===1?"":"s"}`,context:`${t.length} finding${t.length===1?"":"s"} flagged`}),children:[e.jsx("ul",{className:"space-y-3 text-sm",children:I.map(s=>e.jsx(z,{finding:s},s.id))}),e.jsx(G,{page:B,totalPages:S,onPrev:()=>d(s=>s-1),onNext:()=>d(s=>s+1)})]})});export{oe as OverBroadcast};