sparkforensics-server 0.2.0 → 0.2.3

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 (288) 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-Bf5TN-s_.js +1 -0
  5. package/public/assets/CacheUtilization-DRf_FNrK.js +1 -0
  6. package/public/assets/CachingOpportunity-BTJzIhtI.js +1 -0
  7. package/public/assets/ColdStart-DnFgnD3n.js +1 -0
  8. package/public/assets/ConfigAudit-B5FsOdmu.js +1 -0
  9. package/public/assets/CoreUsageArea-CTksBPuq.js +1 -0
  10. package/public/assets/Dashboard-BFMsMuc_.js +1 -0
  11. package/public/assets/DuplicatePlanSubtree-BCt-Guuh.js +1 -0
  12. package/public/assets/DurationHistogram-xRcnND4k.js +1 -0
  13. package/public/assets/EmptyState-CnTrSjtU.js +1 -0
  14. package/public/assets/ExecutorUtilization-CP21XlUq.js +1 -0
  15. package/public/assets/GcPressure-BoEJsLjb.js +1 -0
  16. package/public/assets/ImpactEstimate-BHcqJkcZ.js +1 -0
  17. package/public/assets/IncompleteRun-b9FWrOHn.js +1 -0
  18. package/public/assets/JobFailures-C5FkTq3O.js +1 -0
  19. package/public/assets/MemoryUtilization-D2W4AB_f.js +1 -0
  20. package/public/assets/OverBroadcast-Btu3xorf.js +1 -0
  21. package/public/assets/PartitionSizing-yZWhLN0e.js +1 -0
  22. package/public/assets/PlanExplorer-DSk1ivS4.js +1 -0
  23. package/public/assets/PlanGraphRoute-C3iOzUdB.js +1 -0
  24. package/public/assets/RetryWaste-B4436kr1.js +1 -0
  25. package/public/assets/RowPagination-oeWB8gBm.js +1 -0
  26. package/public/assets/ShuffleIO-DUiv8EJe.js +1 -0
  27. package/public/assets/Skew-D2lB1oQc.js +1 -0
  28. package/public/assets/SlowHost-Qb_8aa-W.js +1 -0
  29. package/public/assets/SmallFiles-u6suTgfj.js +1 -0
  30. package/public/assets/SpeculationWaste-vUCniiFP.js +1 -0
  31. package/public/assets/Spill-BskXFX2e.js +1 -0
  32. package/public/assets/StageFailed-D9b83Jvy.js +1 -0
  33. package/public/assets/StageFindingGroup-DagqHOUz.js +1 -0
  34. package/public/assets/StageHeader-DibMSunO.js +1 -0
  35. package/public/assets/StagePill-Dt6V9yVw.js +1 -0
  36. package/public/assets/StageShape-CfdrDUZa.js +1 -0
  37. package/public/assets/StageSlowness-BoGLIYKR.js +1 -0
  38. package/public/assets/Straggler-DU1WSU-m.js +1 -0
  39. package/public/assets/TaskFailures-DkY6zBNJ.js +1 -0
  40. package/public/assets/TinyTask-Lsnt5mJF.js +1 -0
  41. package/public/assets/UnderBroadcast-DxHc0lwy.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-Bl1hRK5E.js +1 -0
  46. package/public/assets/impact-sort-DxaUheWV.js +1 -0
  47. package/public/assets/inbox-DHIFHqcn.js +1 -0
  48. package/public/assets/index-CjVklAdW.css +2 -0
  49. package/public/assets/index-U654cmB8.js +9 -0
  50. package/public/assets/parser-worker-5a9aUx3o.js +115 -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-CtKaJ5Hx.js +1 -0
  56. package/public/assets/toggle-group-DB2VfFIx.js +1 -0
  57. package/public/assets/usePagedRows-jNUWgVTD.js +1 -0
  58. package/public/assets/useRecentFiles-BiYdWs8J.js +11 -0
  59. package/public/assets/useSortMode-BhPky1lW.js +1 -0
  60. package/public/docs/404.html +3 -3
  61. package/public/docs/assets/{app.BgzsaTS3.js → app.BczRxXPr.js} +1 -1
  62. package/public/docs/assets/chunks/@localSearchIndexroot.c2HfrwDg.js +1 -0
  63. package/public/docs/assets/chunks/{VPLocalSearchBox.DOq3t-On.js → VPLocalSearchBox.DXvkTVnC.js} +1 -1
  64. package/public/docs/assets/chunks/theme.ByUdwrLG.js +2 -0
  65. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.js +1 -0
  66. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.lean.js +1 -0
  67. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.B1vUqtry.js +1 -0
  68. package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.BOeH4d1J.lean.js → contributor-guide_architecture_detector-contract.md.B1vUqtry.lean.js} +1 -1
  69. package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.js} +1 -1
  70. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.js +1 -0
  71. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.lean.js +1 -0
  72. package/public/docs/assets/{contributor-guide_architecture_overview.md.CehiRmGn.js → contributor-guide_architecture_overview.md.DkXdJ9jE.js} +1 -1
  73. package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.lean.js +1 -0
  74. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.js +1 -0
  75. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js +1 -0
  76. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DYwFeyjV.js +1 -0
  77. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.C0SovZX8.js +6 -0
  78. package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.B93qJ_tT.lean.js → contributor-guide_architecture_worker-protocol.md.C0SovZX8.lean.js} +1 -1
  79. package/public/docs/assets/{contributor-guide_development-setup.md.DvAN_9mK.js → contributor-guide_development-setup.md.DvMV1xhQ.js} +3 -3
  80. package/public/docs/assets/contributor-guide_development-setup.md.DvMV1xhQ.lean.js +1 -0
  81. package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.js → contributor-guide_testing.md.BohuQWvl.js} +1 -1
  82. package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.lean.js → contributor-guide_testing.md.BohuQWvl.lean.js} +1 -1
  83. package/public/docs/assets/{style.DXOMCXxn.css → style.DSixAiZE.css} +1 -1
  84. package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.js} +1 -1
  85. package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.js} +2 -2
  86. package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.lean.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.lean.js} +1 -1
  87. package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.DDMQVOW6.js +12 -0
  88. package/public/docs/assets/{tuning-reference_bottleneck-shuffle.md.CM-nTmIH.lean.js → tuning-reference_bottleneck-shuffle.md.DDMQVOW6.lean.js} +1 -1
  89. package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.js} +4 -4
  90. package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.lean.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.lean.js} +1 -1
  91. package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.js} +2 -2
  92. package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.lean.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.lean.js} +1 -1
  93. package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.js} +2 -2
  94. package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.lean.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.lean.js} +1 -1
  95. package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.js} +1 -1
  96. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.js +5 -0
  97. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.lean.js +1 -0
  98. package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.js → tuning-reference_cluster-config.md.CD6vzYtD.js} +1 -1
  99. package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.lean.js → tuning-reference_cluster-config.md.CD6vzYtD.lean.js} +1 -1
  100. package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.js → tuning-reference_memory-model.md.CWhvgevP.js} +1 -1
  101. package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.lean.js → tuning-reference_memory-model.md.CWhvgevP.lean.js} +1 -1
  102. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.js → user-guide_alternative-log-retrieval.md.B4tPGIal.js} +1 -1
  103. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.lean.js → user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js} +1 -1
  104. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +3 -0
  105. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.lean.js +1 -0
  106. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.js → user-guide_mcp-tools.md.DGvolGzt.js} +4 -4
  107. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.lean.js → user-guide_mcp-tools.md.DGvolGzt.lean.js} +1 -1
  108. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.js +1 -0
  109. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.lean.js +1 -0
  110. package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.js +1 -0
  111. package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.lean.js +1 -0
  112. package/public/docs/contributor-guide/architecture/board-widgets.html +6 -6
  113. package/public/docs/contributor-guide/architecture/detector-contract.html +6 -6
  114. package/public/docs/contributor-guide/architecture/drill-down.html +6 -6
  115. package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -6
  116. package/public/docs/contributor-guide/architecture/index.html +4 -4
  117. package/public/docs/contributor-guide/architecture/overview.html +6 -6
  118. package/public/docs/contributor-guide/architecture/state-and-history.html +6 -6
  119. package/public/docs/contributor-guide/architecture/widget-rendering.html +6 -6
  120. package/public/docs/contributor-guide/architecture/worker-protocol.html +7 -7
  121. package/public/docs/contributor-guide/contributing.html +4 -4
  122. package/public/docs/contributor-guide/development-setup.html +6 -6
  123. package/public/docs/contributor-guide/testing.html +6 -6
  124. package/public/docs/hashmap.json +1 -1
  125. package/public/docs/index.html +4 -4
  126. package/public/docs/tuning-reference/anti-patterns.html +4 -4
  127. package/public/docs/tuning-reference/aqe.html +4 -4
  128. package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -4
  129. package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -4
  130. package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -4
  131. package/public/docs/tuning-reference/bottleneck-failures.html +6 -6
  132. package/public/docs/tuning-reference/bottleneck-gc.html +6 -6
  133. package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -4
  134. package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -4
  135. package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -4
  136. package/public/docs/tuning-reference/bottleneck-shuffle.html +7 -7
  137. package/public/docs/tuning-reference/bottleneck-skew.html +8 -8
  138. package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -4
  139. package/public/docs/tuning-reference/bottleneck-small-files.html +7 -7
  140. package/public/docs/tuning-reference/bottleneck-spill.html +4 -4
  141. package/public/docs/tuning-reference/bottleneck-straggler.html +6 -6
  142. package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +6 -6
  143. package/public/docs/tuning-reference/bottleneck-utilization.html +7 -7
  144. package/public/docs/tuning-reference/caching.html +4 -4
  145. package/public/docs/tuning-reference/cluster-config.html +6 -6
  146. package/public/docs/tuning-reference/config.html +4 -4
  147. package/public/docs/tuning-reference/data-formats.html +4 -4
  148. package/public/docs/tuning-reference/index.html +4 -4
  149. package/public/docs/tuning-reference/intro.html +4 -4
  150. package/public/docs/tuning-reference/joins.html +4 -4
  151. package/public/docs/tuning-reference/memory-model.html +6 -6
  152. package/public/docs/tuning-reference/metrics.html +4 -4
  153. package/public/docs/tuning-reference/partitioning.html +4 -4
  154. package/public/docs/tuning-reference/pyspark.html +4 -4
  155. package/public/docs/tuning-reference/shuffle.html +4 -4
  156. package/public/docs/tuning-reference/spark-architecture.html +4 -4
  157. package/public/docs/tuning-reference/table-formats.html +4 -4
  158. package/public/docs/user-guide/alternative-log-retrieval.html +6 -6
  159. package/public/docs/user-guide/getting-started.html +7 -7
  160. package/public/docs/user-guide/mcp-tools.html +9 -9
  161. package/public/docs/user-guide/run-comparison.html +6 -6
  162. package/public/docs/user-guide/understanding-findings.html +6 -6
  163. package/public/index.html +7 -6
  164. package/public/sample-runs/sample-run.ndjson.gz +0 -0
  165. package/vendor-core/cli/collect-run.js +3 -2
  166. package/vendor-core/cli/native-zstd.js +351 -0
  167. package/vendor-core/detectors.js +390 -75
  168. package/vendor-core/docs-config.js +34 -8
  169. package/vendor-core/docs-content/chapters/03-memory-model.md +39 -0
  170. package/vendor-core/docs-content/chapters/11-cluster-config.md +40 -0
  171. package/vendor-core/docs-content/detection/cache.md +4 -3
  172. package/vendor-core/docs-content/detection/chrn.md +4 -2
  173. package/vendor-core/docs-content/detection/gc.md +2 -0
  174. package/vendor-core/docs-content/detection/host.md +2 -1
  175. package/vendor-core/docs-content/detection/local.md +2 -3
  176. package/vendor-core/docs-content/detection/mem.md +3 -3
  177. package/vendor-core/docs-content/detection/plan.md +3 -1
  178. package/vendor-core/docs-content/detection/shape.md +2 -1
  179. package/vendor-core/docs-content/detection/shfl.md +2 -1
  180. package/vendor-core/docs-content/detection/spec.md +4 -3
  181. package/vendor-core/docs-content/detection/spill.md +1 -1
  182. package/vendor-core/docs-content/detection/strag.md +2 -1
  183. package/vendor-core/docs-content/detection/tiny.md +2 -1
  184. package/vendor-core/docs-content/tuning/failures.md +1 -1
  185. package/vendor-core/docs-content/tuning/gc.md +11 -4
  186. package/vendor-core/docs-content/tuning/shuffle.md +25 -5
  187. package/vendor-core/docs-content/tuning/skew.md +14 -6
  188. package/vendor-core/docs-content/tuning/small-files.md +12 -7
  189. package/vendor-core/docs-content/tuning/straggler.md +34 -0
  190. package/vendor-core/docs-content/tuning/tiny-tasks.md +1 -1
  191. package/vendor-core/docs-content/tuning/utilization.md +57 -7
  192. package/vendor-core/docs-content/upstream.json +4 -0
  193. package/vendor-core/event-handlers.js +321 -69
  194. package/vendor-core/event-schemas.js +8 -6
  195. package/vendor-core/evidence-report.js +4 -2
  196. package/vendor-core/impact-estimator.js +150 -34
  197. package/vendor-core/mcp-tools.js +20 -7
  198. package/vendor-core/occupancy.js +70 -2
  199. package/vendor-core/parser-worker.js +30 -14
  200. package/vendor-core/plan-summary.js +4 -0
  201. package/vendor-core/run-comparison.js +22 -17
  202. package/vendor-core/shs-fetch.js +18 -7
  203. package/vendor-core/shs-load.js +2 -1
  204. package/vendor-core/stage-quantiles.js +59 -3
  205. package/vendor-core/string-hash.js +15 -0
  206. package/vendor-core/types.js +9 -1
  207. package/vendor-core/vendor/fzstd.js +94 -18
  208. package/public/assets/AutoscalingChurn-CFJkiqxW.js +0 -1
  209. package/public/assets/CacheUtilization-kTKZBzDA.js +0 -1
  210. package/public/assets/CachingOpportunity-CU70EWcF.js +0 -1
  211. package/public/assets/ColdStart-hOI-WOvm.js +0 -1
  212. package/public/assets/ConfigAudit-B4oAksZY.js +0 -1
  213. package/public/assets/CoreUsageArea-D-dR3SQk.js +0 -1
  214. package/public/assets/Dashboard-MDhohsq4.js +0 -4
  215. package/public/assets/DuplicatePlanSubtree-54RKsfI7.js +0 -1
  216. package/public/assets/DurationHistogram-CviQyPNM.js +0 -1
  217. package/public/assets/EmptyState-v2ehFncc.js +0 -1
  218. package/public/assets/ExecutorUtilization-vHyFHgL6.js +0 -1
  219. package/public/assets/GcPressure-DINuhcno.js +0 -1
  220. package/public/assets/ImpactEstimate-C6GzFOY9.js +0 -1
  221. package/public/assets/IncompleteRun-a1kuCnU6.js +0 -1
  222. package/public/assets/JobFailures-CYwPfUhR.js +0 -1
  223. package/public/assets/MemoryUtilization-Dlfj0e_f.js +0 -1
  224. package/public/assets/OverBroadcast-BMu7Y8l9.js +0 -1
  225. package/public/assets/PartitionSizing-CvMGfSVB.js +0 -1
  226. package/public/assets/PlanExplorer-xYFme_Rx.js +0 -1
  227. package/public/assets/PlanGraphRoute-a3OGg6ET.js +0 -1
  228. package/public/assets/RetryWaste-JKRjOZ-J.js +0 -1
  229. package/public/assets/RowPagination-DypWbnic.js +0 -1
  230. package/public/assets/ShuffleIO-Mi8HiVu-.js +0 -1
  231. package/public/assets/Skew-C3iOScTC.js +0 -1
  232. package/public/assets/SlowHost-DKBg18v-.js +0 -1
  233. package/public/assets/SmallFiles-CCCB6AIu.js +0 -1
  234. package/public/assets/SpeculationWaste-DUNupw0_.js +0 -1
  235. package/public/assets/Spill-BlLdatik.js +0 -1
  236. package/public/assets/StageFailed-qtY7C7Yo.js +0 -1
  237. package/public/assets/StageFindingGroup-CoVdEZYs.js +0 -1
  238. package/public/assets/StageHeader-uDBLHgdg.js +0 -1
  239. package/public/assets/StagePill-CYCMdlIx.js +0 -1
  240. package/public/assets/StageShape-zs0mAjQJ.js +0 -1
  241. package/public/assets/StageSlowness-C7vg0u5Q.js +0 -1
  242. package/public/assets/Straggler-4BRGAQP4.js +0 -1
  243. package/public/assets/TaskFailures-CSjO23Kg.js +0 -1
  244. package/public/assets/TinyTask-6Zuovcn5.js +0 -1
  245. package/public/assets/UnderBroadcast-CePjo0ZV.js +0 -1
  246. package/public/assets/WidgetLeadSummary-DRNRVvn7.js +0 -1
  247. package/public/assets/charts-vendor-Cf1-wzeH.js +0 -59
  248. package/public/assets/downsample-D8XmJk6i.js +0 -1
  249. package/public/assets/finding-anchor-4TmpXd7j.js +0 -1
  250. package/public/assets/impact-sort-Cq6KOLqh.js +0 -1
  251. package/public/assets/inbox-DBFovbUX.js +0 -1
  252. package/public/assets/index-CHjV2-jB.js +0 -9
  253. package/public/assets/index-DMEtaP4u.css +0 -1
  254. package/public/assets/parser-worker-BMPPE37w.js +0 -64
  255. package/public/assets/plan-graph-vendor-B96a-e4N.js +0 -7
  256. package/public/assets/plan-graph-vendor-BnuhLJ6X.css +0 -1
  257. package/public/assets/react-vendor-DA6opS-q.js +0 -9
  258. package/public/assets/select-D5fK-za0.js +0 -1
  259. package/public/assets/toggle-group-lbIXRG0W.js +0 -1
  260. package/public/assets/usePagedRows-CFoZrPr4.js +0 -1
  261. package/public/assets/useRecentFiles-BPGQ6XII.js +0 -13
  262. package/public/assets/useSortMode-BOPpfLhJ.js +0 -1
  263. package/public/docs/assets/chunks/@localSearchIndexroot.PQ5JepCp.js +0 -1
  264. package/public/docs/assets/chunks/theme.BP14rGBx.js +0 -2
  265. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.js +0 -1
  266. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.lean.js +0 -1
  267. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.BOeH4d1J.js +0 -1
  268. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.js +0 -1
  269. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.lean.js +0 -1
  270. package/public/docs/assets/contributor-guide_architecture_overview.md.CehiRmGn.lean.js +0 -1
  271. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.js +0 -1
  272. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.lean.js +0 -1
  273. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DbqPf2OT.js +0 -1
  274. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.B93qJ_tT.js +0 -6
  275. package/public/docs/assets/contributor-guide_development-setup.md.DvAN_9mK.lean.js +0 -1
  276. package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.CM-nTmIH.js +0 -12
  277. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.js +0 -5
  278. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.lean.js +0 -1
  279. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.js +0 -3
  280. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.lean.js +0 -1
  281. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.js +0 -1
  282. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.lean.js +0 -1
  283. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.js +0 -1
  284. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.lean.js +0 -1
  285. /package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.lean.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.lean.js} +0 -0
  286. /package/public/docs/assets/{contributor-guide_architecture_widget-rendering.md.DbqPf2OT.lean.js → contributor-guide_architecture_widget-rendering.md.DYwFeyjV.lean.js} +0 -0
  287. /package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.lean.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.lean.js} +0 -0
  288. /package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.lean.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.lean.js} +0 -0
@@ -1,9 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./PlanGraphRoute-a3OGg6ET.js","./react-vendor-DA6opS-q.js","./useRecentFiles-BPGQ6XII.js","./charts-vendor-Cf1-wzeH.js","./plan-graph-vendor-B96a-e4N.js","./plan-graph-vendor-BnuhLJ6X.css","./impact-sort-Cq6KOLqh.js","./Dashboard-MDhohsq4.js","./EmptyState-v2ehFncc.js","./toggle-group-lbIXRG0W.js","./DurationHistogram-CviQyPNM.js","./downsample-D8XmJk6i.js","./WidgetLeadSummary-DRNRVvn7.js","./StagePill-CYCMdlIx.js","./ImpactEstimate-C6GzFOY9.js","./RowPagination-DypWbnic.js","./inbox-DBFovbUX.js"])))=>i.map(i=>d[i]);
2
- import{j as u,P as sa,e as oa,f as ra,R as M,r as v,h as aa,B as ia,i as la,m as ca,C as da,k as ua,l as fa,a as pa,D as ma,n as ha,o as ga,p as ba,q as xa,s as va}from"./react-vendor-DA6opS-q.js";import{c as mo}from"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();const ya="modulepreload",wa=function(e,t){return new URL(e,t).href},ts={},ho=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let d=function(f){return Promise.all(f.map(i=>Promise.resolve(i).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");o=d(n.map(f=>{if(f=wa(f,s),f in ts)return;ts[f]=!0;const i=f.endsWith(".css"),p=i?'[rel="stylesheet"]':"";if(s)for(let m=a.length-1;m>=0;m--){const g=a[m];if(g.href===f&&(!i||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${p}`))return;const h=document.createElement("link");if(h.rel=i?"stylesheet":ya,i||(h.as="script"),h.crossOrigin="",h.href=f,c&&h.setAttribute("nonce",c),document.head.appendChild(h),i)return new Promise((m,g)=>{h.addEventListener("load",m),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${f}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})},ka=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},Sa=(e,t)=>({classGroupId:e,validator:t}),go=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ot="-",ns=[],Ca="arbitrary..",Ma=e=>{const t=Ra(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Ia(a);const l=a.split(Ot),c=l[0]===""&&l.length>1?1:0;return bo(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=s[a],d=n[a];return c?d?ka(d,c):c:d||ns}return n[a]||ns}}},bo=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],r=n.nextPart.get(o);if(r){const d=bo(e,t+1,r);if(d)return d}const a=n.validators;if(a===null)return;const l=t===0?e.join(Ot):e.slice(t).join(Ot),c=a.length;for(let d=0;d<c;d++){const f=a[d];if(f.validator(l))return f.classGroupId}},Ia=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?Ca+s:void 0})(),Ra=e=>{const{theme:t,classGroups:n}=e;return Ta(n,t)},Ta=(e,t)=>{const n=go();for(const s in e){const o=e[s];Mn(o,n,s,t)}return n},Mn=(e,t,n,s)=>{const o=e.length;for(let r=0;r<o;r++){const a=e[r];ja(a,t,n,s)}},ja=(e,t,n,s)=>{if(typeof e=="string"){Ea(e,t,n);return}if(typeof e=="function"){Na(e,t,n,s);return}za(e,t,n,s)},Ea=(e,t,n)=>{const s=e===""?t:xo(t,e);s.classGroupId=n},Na=(e,t,n,s)=>{if(Aa(e)){Mn(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(Sa(n,e))},za=(e,t,n,s)=>{const o=Object.entries(e),r=o.length;for(let a=0;a<r;a++){const[l,c]=o[a];Mn(c,xo(t,l),n,s)}},xo=(e,t)=>{let n=e;const s=t.split(Ot),o=s.length;for(let r=0;r<o;r++){const a=s[r];let l=n.nextPart.get(a);l||(l=go(),n.nextPart.set(a,l)),n=l}return n},Aa=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Pa=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const o=(r,a)=>{n[r]=a,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(r){let a=n[r];if(a!==void 0)return a;if((a=s[r])!==void 0)return o(r,a),a},set(r,a){r in n?n[r]=a:o(r,a)}}},on="!",ss=":",Ba=[],os=(e,t,n,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:o}),Da=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const r=[];let a=0,l=0,c=0,d;const f=o.length;for(let g=0;g<f;g++){const b=o[g];if(a===0&&l===0){if(b===ss){r.push(o.slice(c,g)),c=g+1;continue}if(b==="/"){d=g;continue}}b==="["?a++:b==="]"?a--:b==="("?l++:b===")"&&l--}const i=r.length===0?o:o.slice(c);let p=i,h=!1;i.endsWith(on)?(p=i.slice(0,-1),h=!0):i.startsWith(on)&&(p=i.slice(1),h=!0);const m=d&&d>c?d-c:void 0;return os(r,h,p,m)};if(t){const o=t+ss,r=s;s=a=>a.startsWith(o)?r(a.slice(o.length)):os(Ba,!1,a,void 0,!0)}if(n){const o=s;s=r=>n({className:r,parseClassName:o})}return s},La=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let o=[];for(let r=0;r<n.length;r++){const a=n[r],l=a[0]==="[",c=t.has(a);l||c?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(a)):o.push(a)}return o.length>0&&(o.sort(),s.push(...o)),s}},_a=e=>({cache:Pa(e.cacheSize),parseClassName:Da(e),sortModifiers:La(e),postfixLookupClassGroupIds:$a(e),...Ma(e)}),$a=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},Fa=/\s+/,Oa=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:r,postfixLookupClassGroupIds:a}=t,l=[],c=e.trim().split(Fa);let d="";for(let f=c.length-1;f>=0;f-=1){const i=c[f],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=n(i);if(p){d=i+(d.length>0?" "+d:d);continue}let x=!!b,y;if(x){const j=g.substring(0,b);y=s(j);const S=y&&a[y]?s(g):void 0;S&&S!==y&&(y=S,x=!1)}else y=s(g);if(!y){if(!x){d=i+(d.length>0?" "+d:d);continue}if(y=s(g),!y){d=i+(d.length>0?" "+d:d);continue}x=!1}const w=h.length===0?"":h.length===1?h[0]:r(h).join(":"),C=m?w+on:w,k=C+y;if(l.indexOf(k)>-1)continue;l.push(k);const R=o(y,x);for(let j=0;j<R.length;++j){const S=R[j];l.push(C+S)}d=i+(d.length>0?" "+d:d)}return d},Wa=(...e)=>{let t=0,n,s,o="";for(;t<e.length;)(n=e[t++])&&(s=vo(n))&&(o&&(o+=" "),o+=s);return o},vo=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=vo(e[s]))&&(n&&(n+=" "),n+=t);return n},Ga=(e,...t)=>{let n,s,o,r;const a=c=>{const d=t.reduce((f,i)=>i(f),e());return n=_a(d),s=n.cache.get,o=n.cache.set,r=l,l(c)},l=c=>{const d=s(c);if(d)return d;const f=Oa(c,n);return o(c,f),f};return r=a,(...c)=>r(Wa(...c))},Ua=[],ce=e=>{const t=n=>n[e]||Ua;return t.isThemeGetter=!0,t},yo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ha=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,qa=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Va=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ya=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ja=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ka=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$e=e=>Ha.test(e),H=e=>!!e&&!Number.isNaN(Number(e)),Ee=e=>!!e&&Number.isInteger(Number(e)),Jt=e=>e.endsWith("%")&&H(e.slice(0,-1)),De=e=>qa.test(e),ko=()=>!0,Xa=e=>Va.test(e)&&!Ya.test(e),In=()=>!1,Za=e=>Ja.test(e),Qa=e=>Ka.test(e),ei=e=>!E(e)&&!N(e),ti=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),ni=e=>He(e,Mo,In),E=e=>yo.test(e),Ve=e=>He(e,Io,Xa),rs=e=>He(e,di,H),si=e=>He(e,To,ko),oi=e=>He(e,Ro,In),as=e=>He(e,So,In),ri=e=>He(e,Co,Qa),Nt=e=>He(e,jo,Za),N=e=>wo.test(e),vt=e=>tt(e,Io),ai=e=>tt(e,Ro),is=e=>tt(e,So),ii=e=>tt(e,Mo),li=e=>tt(e,Co),zt=e=>tt(e,jo,!0),ci=e=>tt(e,To,!0),He=(e,t,n)=>{const s=yo.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},tt=(e,t,n=!1)=>{const s=wo.exec(e);return s?s[1]?t(s[1]):n:!1},So=e=>e==="position"||e==="percentage",Co=e=>e==="image"||e==="url",Mo=e=>e==="length"||e==="size"||e==="bg-size",Io=e=>e==="length",di=e=>e==="number",Ro=e=>e==="family-name",To=e=>e==="number"||e==="weight",jo=e=>e==="shadow",ui=()=>{const e=ce("color"),t=ce("font"),n=ce("text"),s=ce("font-weight"),o=ce("tracking"),r=ce("leading"),a=ce("breakpoint"),l=ce("container"),c=ce("spacing"),d=ce("radius"),f=ce("shadow"),i=ce("inset-shadow"),p=ce("text-shadow"),h=ce("drop-shadow"),m=ce("blur"),g=ce("perspective"),b=ce("aspect"),x=ce("ease"),y=ce("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),N,E],R=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[N,E,c],_=()=>[$e,"full","auto",...S()],te=()=>[Ee,"none","subgrid",N,E],L=()=>["auto",{span:["full",Ee,N,E]},Ee,N,E],D=()=>[Ee,"auto",N,E],P=()=>["auto","min","max","fr",N,E],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...S()],q=()=>[$e,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],re=()=>[$e,"screen","full","dvw","lvw","svw","min","max","fit",...S()],ae=()=>[$e,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],T=()=>[e,N,E],ie=()=>[...C(),is,as,{position:[N,E]}],Ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",ii,ni,{size:[N,E]}],Y=()=>[Jt,vt,Ve],$=()=>["","none","full",d,N,E],G=()=>["",H,vt,Ve],K=()=>["solid","dashed","dotted","double"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[H,Jt,is,as],A=()=>["","none",m,N,E],Q=()=>["none",H,N,E],le=()=>["none",H,N,E],ue=()=>[H,N,E],X=()=>[$e,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[De],breakpoint:[De],color:[ko],container:[De],"drop-shadow":[De],ease:["in","out","in-out"],font:[ei],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[De],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[De],shadow:[De],spacing:["px",H],text:[De],"text-shadow":[De],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$e,E,N,b]}],container:["container"],"container-type":[{"@container":["","normal","size",N,E]}],"container-named":[ti],columns:[{columns:[H,E,N,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Ee,"auto",N,E]}],basis:[{basis:[$e,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[H,$e,"auto","initial","none",E]}],grow:[{grow:["",H,N,E]}],shrink:[{shrink:["",H,N,E]}],order:[{order:[Ee,"first","last","none",N,E]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...ae()]}],"min-block-size":[{"min-block":["auto",...ae()]}],"max-block-size":[{"max-block":["none",...ae()]}],w:[{w:[l,"screen",...q()]}],"min-w":[{"min-w":[l,"screen","none",...q()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,vt,Ve]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,ci,si]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jt,E]}],"font-family":[{font:[ai,oi,t]}],"font-features":[{"font-features":[E]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,N,E]}],"line-clamp":[{"line-clamp":[H,"none",N,rs]}],leading:[{leading:[r,...S()]}],"list-image":[{"list-image":["none",N,E]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",N,E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[H,"from-font","auto",N,Ve]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[H,"auto",N,E]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[Ee,N,E]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N,E]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N,E]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:Ce()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ee,N,E],radial:["",N,E],conic:[Ee,N,E]},li,ri]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[H,N,E]}],"outline-w":[{outline:["",H,vt,Ve]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",f,zt,Nt]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",i,zt,Nt]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[H,Ve]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",p,zt,Nt]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[H,N,E]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[H]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[N,E]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[H]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:Ce()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",N,E]}],filter:[{filter:["","none",N,E]}],blur:[{blur:A()}],brightness:[{brightness:[H,N,E]}],contrast:[{contrast:[H,N,E]}],"drop-shadow":[{"drop-shadow":["","none",h,zt,Nt]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",H,N,E]}],"hue-rotate":[{"hue-rotate":[H,N,E]}],invert:[{invert:["",H,N,E]}],saturate:[{saturate:[H,N,E]}],sepia:[{sepia:["",H,N,E]}],"backdrop-filter":[{"backdrop-filter":["","none",N,E]}],"backdrop-blur":[{"backdrop-blur":A()}],"backdrop-brightness":[{"backdrop-brightness":[H,N,E]}],"backdrop-contrast":[{"backdrop-contrast":[H,N,E]}],"backdrop-grayscale":[{"backdrop-grayscale":["",H,N,E]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[H,N,E]}],"backdrop-invert":[{"backdrop-invert":["",H,N,E]}],"backdrop-opacity":[{"backdrop-opacity":[H,N,E]}],"backdrop-saturate":[{"backdrop-saturate":[H,N,E]}],"backdrop-sepia":[{"backdrop-sepia":["",H,N,E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",N,E]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[H,"initial",N,E]}],ease:[{ease:["linear","initial",x,N,E]}],delay:[{delay:[H,N,E]}],animate:[{animate:["none",y,N,E]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,N,E]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[N,E,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],zoom:[{zoom:[Ee,N,E]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N,E]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N,E]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[H,vt,Ve,rs]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},fi=Ga(ui);function J(...e){return fi(mo(e))}function ls({className:e,children:t,value:n,...s}){return u.jsxs(sa,{value:n,"data-slot":"progress",className:J("flex flex-wrap gap-3",e),...s,children:[t,u.jsx(pi,{children:u.jsx(mi,{})})]})}function pi({className:e,...t}){return u.jsx(oa,{className:J("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",e),"data-slot":"progress-track",...t})}function mi({className:e,...t}){return u.jsx(ra,{"data-slot":"progress-indicator",className:J("h-full bg-primary transition-all",e),...t})}const cs=e=>{let t;const n=new Set,s=(d,f)=>{const i=typeof d=="function"?d(t):d;if(!Object.is(i,t)){const p=t;t=f??(typeof i!="object"||i===null)?i:Object.assign({},t,i),n.forEach(h=>h(t,p))}},o=()=>t,l={setState:s,getState:o,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=t=e(s,o,l);return l},hi=(e=>e?cs(e):cs),gi=e=>e;function bi(e,t=gi){const n=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(n),n}const Eo=1,No={observed:"Observed in this event log.",explicitlyDisabled:"Explicitly disabled in this event log.",noObservedExecutorMetrics:"Not emitted by this event log.",noObservedStageSubmission:"Not emitted by this event log.",noRddStorageSnapshot:"Stages were submitted without RDD storage snapshots.",noResolvedSqlPlan:"Not emitted by this event log.",noSqlExecution:"Not applicable to this event log.",noEnvironmentUpdate:"Not emitted by this event log.",noTaskRecords:"Not emitted by this event log.",noUsableCoreTimeAggregate:"No usable aggregate was emitted.",outsideEventLogScope:"Available outside local event-log scope.",parseIncomplete:"Cannot determine from an incomplete parse."};function yt(e,t,n){return{key:e,state:"present",reasonCode:"observed",summary:No.observed,evidence:{eventType:t,count:n}}}function Je(e,t,n){return{key:e,state:t,reasonCode:n,summary:No[n]}}function Fe(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)&&n>0?n:0}function xi(e){return e!=null&&e.schemaVersion===Eo}function ds(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function vi(e){const t=e?.perStage;return t!=null&&typeof t=="object"&&!Array.isArray(t)&&Object.values(t).some(n=>ds(n?.taskCount)&&ds(n?.totalTaskDurationSum))}function yi(e,t){return e!=null&&String(e).toLowerCase()===t}function it(e,t,n){return n?Je(e,t==="noSqlExecution"?"notApplicable":"notEmitted",t):Je(e,"unknown","parseIncomplete")}function us(e,{skippedLines:t=0}={}){const n=e?.app,s=n?.evidenceInputs??{},o=t===0&&Fe(s,"applicationEnds")>0,r=Fe(s,"executorMetricRows"),a=Fe(s,"stageSubmissions"),l=Fe(s,"rddStorageSnapshots"),c=Fe(s,"resolvedSqlPlans"),d=Fe(s,"sqlExecutions"),f=Fe(s,"environmentUpdates"),i=Fe(s,"taskRecords"),p=r>0?yt("executorMetrics","executorMetricRows",r):yi(n?.config?.["spark.eventLog.logStageExecutorMetrics"],"false")?Je("executorMetrics","disabled","explicitlyDisabled"):it("executorMetrics","noObservedExecutorMetrics",o),h=l>0?yt("rddStorageSnapshots","rddStorageSnapshots",l):it("rddStorageSnapshots",a===0?"noObservedStageSubmission":"noRddStorageSnapshot",o),m=c>0?yt("sqlPlan","resolvedSqlPlans",c):d>0&&o?Je("sqlPlan","notEmitted","noResolvedSqlPlan"):it("sqlPlan","noSqlExecution",o),g=f>0?yt("sparkConfiguration","environmentUpdates",f):it("sparkConfiguration","noEnvironmentUpdate",o),b=i===0?it("taskCoreTime","noTaskRecords",o):vi(e?.runAggregates)?yt("taskCoreTime","taskRecords",i):it("taskCoreTime","noUsableCoreTimeAggregate",o);return{schemaVersion:Eo,entries:[p,h,m,g,b,Je("infrastructureContext","outsideEventLog","outsideEventLogScope"),Je("sourceContext","outsideEventLog","outsideEventLogScope"),Je("costContext","outsideEventLog","outsideEventLogScope")]}}function rn(e,t,n){return{app:e.app,stages:new Map(e.stages),executors:{added:[...e.executors.added],removed:[...e.executors.removed]},sql:new Map(e.sql),jobs:new Map(e.jobs),runAggregates:e.runAggregates,evidenceAvailability:e.evidenceAvailability,catalog:[...t],taskData:new Map(n)}}function fs(e,t,n){e.app=n.app,e.stages=new Map(n.stages),e.executors={added:[...n.executors.added],removed:[...n.executors.removed]},e.sql=new Map(n.sql),e.jobs=new Map(n.jobs),e.runAggregates=n.runAggregates??null,e.evidenceAvailability=xi(n.evidenceAvailability)?n.evidenceAvailability:null,t.clear();for(const[s,o]of n.taskData)t.set(s,o);return[...n.catalog]}function ps(){return{app:null,stages:new Map,executors:{added:[],removed:[]},sql:new Map,jobs:new Map,runAggregates:null,evidenceAvailability:null}}function wi(){if(typeof window>"u")return"dark";try{const e=window.localStorage.getItem("shuffle-works-theme");if(e==="light"||e==="dark")return e}catch{}return window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"}const zo="shuffle-works-widget-density";function ki(){if(typeof window>"u")return"basic";try{const e=window.localStorage.getItem(zo);if(e==="basic"||e==="advanced")return e}catch{}return"basic"}const z=hi(e=>({appModel:ps(),catalog:[],configFindings:[],activeFileId:null,sessionCache:new Map,taskDataCache:new Map,parse:{pct:0,lines:0,etaMs:null},status:"idle",shsParsing:!1,errorMessage:null,errorNonce:0,theme:wi(),widgetDensity:ki(),exportMode:!1,skippedLines:0,comparison:{active:!1,baselineId:null,candidateId:null},compareLoad:null,planGraph:{active:!1,stageId:null,initialScope:"segment"},modelResetCount:0,openComparison:(t,n)=>e(s=>(s.activeFileId!=null&&s.appModel.app&&s.sessionCache.set(s.activeFileId,rn(s.appModel,s.catalog,s.taskDataCache)),{comparison:{active:!0,baselineId:t,candidateId:n}})),setComparisonActive:t=>e(n=>({comparison:{...n.comparison,active:t}})),setCompareLoad:t=>e({compareLoad:t}),closeComparison:()=>e({comparison:{active:!1,baselineId:null,candidateId:null}}),openPlanGraph:(t,n)=>e({planGraph:{active:!0,stageId:t,initialScope:n?.initialScope??"segment"}}),closePlanGraph:()=>e({planGraph:{active:!1,stageId:null,initialScope:"segment"}}),resetModel:()=>e(t=>({appModel:ps(),catalog:[],configFindings:[],taskDataCache:new Map,status:"idle",shsParsing:!1,errorMessage:null,skippedLines:0,comparison:{active:!1,baselineId:null,candidateId:null},compareLoad:null,planGraph:{active:!1,stageId:null,initialScope:"segment"},modelResetCount:t.modelResetCount+1})),setStatus:t=>e({status:t}),setShsParsing:t=>e({shsParsing:t}),setParse:t=>e({parse:t}),setCatalog:t=>e({catalog:t}),setConfigFindings:t=>e({configFindings:t}),setTaskData:(t,n)=>e(s=>{const o=new Map(s.taskDataCache);return o.set(t,n),{taskDataCache:o}}),setActiveFile:t=>e({activeFileId:t}),setError:t=>e(n=>({errorMessage:t,errorNonce:t?n.errorNonce+1:n.errorNonce,status:t?"error":n.status})),setTheme:t=>e({theme:t}),setWidgetDensity:t=>{try{window.localStorage.setItem(zo,t)}catch{}e({widgetDensity:t})},setSkippedLines:t=>e({skippedLines:t}),setEvidenceAvailability:t=>e(n=>({appModel:{...n.appModel,evidenceAvailability:t}}))}));function se(e){return bi(z,e)}function Ao(){return se(e=>e.widgetDensity)}const Po=v.createContext(null);function Si({children:e}){const t=se(s=>s.theme);v.useEffect(()=>{if(t==="light"?document.documentElement.setAttribute("data-theme","light"):document.documentElement.removeAttribute("data-theme"),typeof window<"u"){try{window.localStorage.setItem("shuffle-works-theme",t)}catch{}try{window.localStorage.setItem("vitepress-theme-appearance",t)}catch{}}},[t]);const n=()=>z.getState().setTheme(t==="dark"?"light":"dark");return u.jsx(Po.Provider,{value:{theme:t,toggle:n},children:e})}function Rn(){const e=v.useContext(Po);if(!e)throw new Error("useTheme outside ThemeProvider");return e}function Ci(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Mi=e=>{switch(e){case"success":return Ti;case"info":return Ei;case"warning":return ji;case"error":return Ni;default:return null}},Ii=Array(12).fill(0),Ri=({visible:e,className:t})=>M.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},M.createElement("div",{className:"sonner-spinner"},Ii.map((n,s)=>M.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Ti=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ji=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Ei=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ni=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},M.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),zi=M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},M.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),M.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ai=()=>{const[e,t]=M.useState(document.hidden);return M.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let an=1;class Pi{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...o}=t,r=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:an++,a=this.toasts.find(c=>c.id===r),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),a?this.toasts=this.toasts.map(c=>c.id===r?(this.publish({...c,...t,id:r,title:s}),{...c,...t,id:r,dismissible:l,title:s}):c):this.addToast({title:s,...o,dismissible:l,id:r}),r},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let r=s!==void 0,a;const l=o.then(async d=>{if(a=["resolve",d],M.isValidElement(d))r=!1,this.create({id:s,type:"default",message:d});else if(Di(d)&&!d.ok){r=!1;const i=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,m=typeof i=="object"&&!M.isValidElement(i)?i:{message:i};this.create({id:s,type:"error",description:p,...m})}else if(d instanceof Error){r=!1;const i=typeof n.error=="function"?await n.error(d):n.error,p=typeof n.description=="function"?await n.description(d):n.description,m=typeof i=="object"&&!M.isValidElement(i)?i:{message:i};this.create({id:s,type:"error",description:p,...m})}else if(n.success!==void 0){r=!1;const i=typeof n.success=="function"?await n.success(d):n.success,p=typeof n.description=="function"?await n.description(d):n.description,m=typeof i=="object"&&!M.isValidElement(i)?i:{message:i};this.create({id:s,type:"success",description:p,...m})}}).catch(async d=>{if(a=["reject",d],n.error!==void 0){r=!1;const f=typeof n.error=="function"?await n.error(d):n.error,i=typeof n.description=="function"?await n.description(d):n.description,h=typeof f=="object"&&!M.isValidElement(f)?f:{message:f};this.create({id:s,type:"error",description:i,...h})}}).finally(()=>{r&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((d,f)=>l.then(()=>a[0]==="reject"?f(a[1]):d(a[1])).catch(f));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(t,n)=>{const s=n?.id||an++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ve=new Pi,Bi=(e,t)=>{const n=t?.id||an++;return ve.addToast({title:e,...t,id:n}),n},Di=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Li=Bi,_i=()=>ve.toasts,$i=()=>ve.getActiveToasts(),Fi=Object.assign(Li,{success:ve.success,info:ve.info,warning:ve.warning,error:ve.error,custom:ve.custom,message:ve.message,promise:ve.promise,dismiss:ve.dismiss,loading:ve.loading},{getHistory:_i,getToasts:$i});Ci("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function At(e){return e.label!==void 0}const Oi=3,Wi="24px",Gi="16px",ms=4e3,Ui=356,Hi=14,qi=45,Vi=200;function Ne(...e){return e.filter(Boolean).join(" ")}function Yi(e){const[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}const Ji=e=>{var t,n,s,o,r,a,l,c,d;const{invert:f,toast:i,unstyled:p,interacting:h,setHeights:m,visibleToasts:g,heights:b,index:x,toasts:y,expanded:w,removeToast:C,defaultRichColors:k,closeButton:R,style:j,cancelButtonStyle:S,actionButtonStyle:_,className:te="",descriptionClassName:L="",duration:D,position:P,gap:W,expandByDefault:U,classNames:B,icons:q,closeButtonAriaLabel:re="Close toast"}=e,[ae,T]=M.useState(null),[ie,Ce]=M.useState(null),[F,Y]=M.useState(!1),[$,G]=M.useState(!1),[K,V]=M.useState(!1),[I,A]=M.useState(!1),[Q,le]=M.useState(!1),[ue,X]=M.useState(0),[qr,qn]=M.useState(0),xt=M.useRef(i.duration||D||ms),Vn=M.useRef(null),Be=M.useRef(null),Vr=x===0,Yr=x+1<=g,we=i.type,ot=i.dismissible!==!1,Jr=i.className||"",Kr=i.descriptionClassName||"",Tt=M.useMemo(()=>b.findIndex(O=>O.toastId===i.id)||0,[b,i.id]),Xr=M.useMemo(()=>{var O;return(O=i.closeButton)!=null?O:R},[i.closeButton,R]),Yn=M.useMemo(()=>i.duration||D||ms,[i.duration,D]),Vt=M.useRef(0),rt=M.useRef(0),Jn=M.useRef(0),at=M.useRef(null),[Zr,Qr]=P.split("-"),Kn=M.useMemo(()=>b.reduce((O,fe,me)=>me>=Tt?O:O+fe.height,0),[b,Tt]),Xn=Ai(),ea=i.invert||f,Yt=we==="loading";rt.current=M.useMemo(()=>Tt*W+Kn,[Tt,Kn]),M.useEffect(()=>{xt.current=Yn},[Yn]),M.useEffect(()=>{Y(!0)},[]),M.useEffect(()=>{const O=Be.current;if(O){const fe=O.getBoundingClientRect().height;return qn(fe),m(me=>[{toastId:i.id,height:fe,position:i.position},...me]),()=>m(me=>me.filter(ke=>ke.toastId!==i.id))}},[m,i.id]),M.useLayoutEffect(()=>{if(!F)return;const O=Be.current,fe=O.style.height;O.style.height="auto";const me=O.getBoundingClientRect().height;O.style.height=fe,qn(me),m(ke=>ke.find(pe=>pe.toastId===i.id)?ke.map(pe=>pe.toastId===i.id?{...pe,height:me}:pe):[{toastId:i.id,height:me,position:i.position},...ke])},[F,i.title,i.description,m,i.id,i.jsx,i.action,i.cancel]);const _e=M.useCallback(()=>{G(!0),X(rt.current),m(O=>O.filter(fe=>fe.toastId!==i.id)),setTimeout(()=>{C(i)},Vi)},[i,C,m,rt]);M.useEffect(()=>{if(i.promise&&we==="loading"||i.duration===1/0||i.type==="loading")return;let O;return w||h||Xn?(()=>{if(Jn.current<Vt.current){const ke=new Date().getTime()-Vt.current;xt.current=xt.current-ke}Jn.current=new Date().getTime()})():xt.current!==1/0&&(Vt.current=new Date().getTime(),O=setTimeout(()=>{i.onAutoClose==null||i.onAutoClose.call(i,i),_e()},xt.current)),()=>clearTimeout(O)},[w,h,i,we,Xn,_e]),M.useEffect(()=>{i.delete&&(_e(),i.onDismiss==null||i.onDismiss.call(i,i))},[_e,i.delete]);function ta(){var O;if(q?.loading){var fe;return M.createElement("div",{className:Ne(B?.loader,i==null||(fe=i.classNames)==null?void 0:fe.loader,"sonner-loader"),"data-visible":we==="loading"},q.loading)}return M.createElement(Ri,{className:Ne(B?.loader,i==null||(O=i.classNames)==null?void 0:O.loader),visible:we==="loading"})}const na=i.icon||q?.[we]||Mi(we);var Zn,Qn;return M.createElement("li",{tabIndex:0,ref:Be,className:Ne(te,Jr,B?.toast,i==null||(t=i.classNames)==null?void 0:t.toast,B?.default,B?.[we],i==null||(n=i.classNames)==null?void 0:n[we]),"data-sonner-toast":"","data-rich-colors":(Zn=i.richColors)!=null?Zn:k,"data-styled":!(i.jsx||i.unstyled||p),"data-mounted":F,"data-promise":!!i.promise,"data-swiped":Q,"data-removed":$,"data-visible":Yr,"data-y-position":Zr,"data-x-position":Qr,"data-index":x,"data-front":Vr,"data-swiping":K,"data-dismissible":ot,"data-type":we,"data-invert":ea,"data-swipe-out":I,"data-swipe-direction":ie,"data-expanded":!!(w||U&&F),"data-testid":i.testId,style:{"--index":x,"--toasts-before":x,"--z-index":y.length-x,"--offset":`${$?ue:rt.current}px`,"--initial-height":U?"auto":`${qr}px`,...j,...i.style},onDragEnd:()=>{V(!1),T(null),at.current=null},onPointerDown:O=>{O.button!==2&&(Yt||!ot||(Vn.current=new Date,X(rt.current),O.target.setPointerCapture(O.pointerId),O.target.tagName!=="BUTTON"&&(V(!0),at.current={x:O.clientX,y:O.clientY})))},onPointerUp:()=>{var O,fe,me;if(I||!ot)return;at.current=null;const ke=Number(((O=Be.current)==null?void 0:O.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),jt=Number(((fe=Be.current)==null?void 0:fe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),pe=new Date().getTime()-((me=Vn.current)==null?void 0:me.getTime()),Me=ae==="x"?ke:jt,Et=Math.abs(Me)/pe;if(Math.abs(Me)>=qi||Et>.11){X(rt.current),i.onDismiss==null||i.onDismiss.call(i,i),Ce(ae==="x"?ke>0?"right":"left":jt>0?"down":"up"),_e(),A(!0);return}else{var Ie,Re;(Ie=Be.current)==null||Ie.style.setProperty("--swipe-amount-x","0px"),(Re=Be.current)==null||Re.style.setProperty("--swipe-amount-y","0px")}le(!1),V(!1),T(null)},onPointerMove:O=>{var fe,me,ke;if(!at.current||!ot||((fe=window.getSelection())==null?void 0:fe.toString().length)>0)return;const pe=O.clientY-at.current.y,Me=O.clientX-at.current.x;var Et;const Ie=(Et=e.swipeDirections)!=null?Et:Yi(P);!ae&&(Math.abs(Me)>1||Math.abs(pe)>1)&&T(Math.abs(Me)>Math.abs(pe)?"x":"y");let Re={x:0,y:0};const es=qe=>1/(1.5+Math.abs(qe)/20);if(ae==="y"){if(Ie.includes("top")||Ie.includes("bottom"))if(Ie.includes("top")&&pe<0||Ie.includes("bottom")&&pe>0)Re.y=pe;else{const qe=pe*es(pe);Re.y=Math.abs(qe)<Math.abs(pe)?qe:pe}}else if(ae==="x"&&(Ie.includes("left")||Ie.includes("right")))if(Ie.includes("left")&&Me<0||Ie.includes("right")&&Me>0)Re.x=Me;else{const qe=Me*es(Me);Re.x=Math.abs(qe)<Math.abs(Me)?qe:Me}(Math.abs(Re.x)>0||Math.abs(Re.y)>0)&&le(!0),(me=Be.current)==null||me.style.setProperty("--swipe-amount-x",`${Re.x}px`),(ke=Be.current)==null||ke.style.setProperty("--swipe-amount-y",`${Re.y}px`)}},Xr&&!i.jsx&&we!=="loading"?M.createElement("button",{"aria-label":re,"data-disabled":Yt,"data-close-button":!0,onClick:Yt||!ot?()=>{}:()=>{_e(),i.onDismiss==null||i.onDismiss.call(i,i)},className:Ne(B?.closeButton,i==null||(s=i.classNames)==null?void 0:s.closeButton)},(Qn=q?.close)!=null?Qn:zi):null,(we||i.icon||i.promise)&&i.icon!==null&&(q?.[we]!==null||i.icon)?M.createElement("div",{"data-icon":"",className:Ne(B?.icon,i==null||(o=i.classNames)==null?void 0:o.icon)},i.promise||i.type==="loading"&&!i.icon?i.icon||ta():null,i.type!=="loading"?na:null):null,M.createElement("div",{"data-content":"",className:Ne(B?.content,i==null||(r=i.classNames)==null?void 0:r.content)},M.createElement("div",{"data-title":"",className:Ne(B?.title,i==null||(a=i.classNames)==null?void 0:a.title)},i.jsx?i.jsx:typeof i.title=="function"?i.title():i.title),i.description?M.createElement("div",{"data-description":"",className:Ne(L,Kr,B?.description,i==null||(l=i.classNames)==null?void 0:l.description)},typeof i.description=="function"?i.description():i.description):null),M.isValidElement(i.cancel)?i.cancel:i.cancel&&At(i.cancel)?M.createElement("button",{"data-button":!0,"data-cancel":!0,style:i.cancelButtonStyle||S,onClick:O=>{At(i.cancel)&&ot&&(i.cancel.onClick==null||i.cancel.onClick.call(i.cancel,O),_e())},className:Ne(B?.cancelButton,i==null||(c=i.classNames)==null?void 0:c.cancelButton)},i.cancel.label):null,M.isValidElement(i.action)?i.action:i.action&&At(i.action)?M.createElement("button",{"data-button":!0,"data-action":!0,style:i.actionButtonStyle||_,onClick:O=>{At(i.action)&&(i.action.onClick==null||i.action.onClick.call(i.action,O),!O.defaultPrevented&&_e())},className:Ne(B?.actionButton,i==null||(d=i.classNames)==null?void 0:d.actionButton)},i.action.label):null)};function hs(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Ki(e,t){const n={};return[e,t].forEach((s,o)=>{const r=o===1,a=r?"--mobile-offset":"--offset",l=r?Gi:Wi;function c(d){["top","right","bottom","left"].forEach(f=>{n[`${a}-${f}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?n[`${a}-${d}`]=l:n[`${a}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):c(l)}),n}const Xi=M.forwardRef(function(t,n){const{id:s,invert:o,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:l,closeButton:c,className:d,offset:f,mobileOffset:i,theme:p="light",richColors:h,duration:m,style:g,visibleToasts:b=Oi,toastOptions:x,dir:y=hs(),gap:w=Hi,icons:C,containerAriaLabel:k="Notifications"}=t,[R,j]=M.useState([]),S=M.useMemo(()=>s?R.filter(F=>F.toasterId===s):R.filter(F=>!F.toasterId),[R,s]),_=M.useMemo(()=>Array.from(new Set([r].concat(S.filter(F=>F.position).map(F=>F.position)))),[S,r]),[te,L]=M.useState([]),[D,P]=M.useState(!1),[W,U]=M.useState(!1),[B,q]=M.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),re=M.useRef(null),ae=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),T=M.useRef(null),ie=M.useRef(!1),Ce=M.useCallback(F=>{j(Y=>{var $;return($=Y.find(G=>G.id===F.id))!=null&&$.delete||ve.dismiss(F.id),Y.filter(({id:G})=>G!==F.id)})},[]);return M.useEffect(()=>ve.subscribe(F=>{if(F.dismiss){requestAnimationFrame(()=>{j(Y=>Y.map($=>$.id===F.id?{...$,delete:!0}:$))});return}setTimeout(()=>{aa.flushSync(()=>{j(Y=>{const $=Y.findIndex(G=>G.id===F.id);return $!==-1?[...Y.slice(0,$),{...Y[$],...F},...Y.slice($+1)]:[F,...Y]})})})}),[R]),M.useEffect(()=>{if(p!=="system"){q(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:Y})=>{q(Y?"dark":"light")})}catch{F.addListener(({matches:$})=>{try{q($?"dark":"light")}catch(G){console.error(G)}})}},[p]),M.useEffect(()=>{R.length<=1&&P(!1)},[R]),M.useEffect(()=>{const F=Y=>{var $;if(a.every(V=>Y[V]||Y.code===V)){var K;P(!0),(K=re.current)==null||K.focus()}Y.code==="Escape"&&(document.activeElement===re.current||($=re.current)!=null&&$.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[a]),M.useEffect(()=>{if(re.current)return()=>{T.current&&(T.current.focus({preventScroll:!0}),T.current=null,ie.current=!1)}},[re.current]),M.createElement("section",{ref:n,"aria-label":`${k} ${ae}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((F,Y)=>{var $;const[G,K]=F.split("-");return S.length?M.createElement("ol",{key:F,dir:y==="auto"?hs():y,tabIndex:-1,ref:re,className:d,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":G,"data-x-position":K,style:{"--front-toast-height":`${(($=te[0])==null?void 0:$.height)||0}px`,"--width":`${Ui}px`,"--gap":`${w}px`,...g,...Ki(f,i)},onBlur:V=>{ie.current&&!V.currentTarget.contains(V.relatedTarget)&&(ie.current=!1,T.current&&(T.current.focus({preventScroll:!0}),T.current=null))},onFocus:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||ie.current||(ie.current=!0,T.current=V.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{W||P(!1)},onDragEnd:()=>P(!1),onPointerDown:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},S.filter(V=>!V.position&&Y===0||V.position===F).map((V,I)=>{var A,Q;return M.createElement(Ji,{key:V.id,icons:C,index:I,toast:V,defaultRichColors:h,duration:(A=x?.duration)!=null?A:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:o,visibleToasts:b,closeButton:(Q=x?.closeButton)!=null?Q:c,interacting:W,position:F,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:Ce,toasts:S.filter(le=>le.position==V.position),heights:te.filter(le=>le.position==V.position),setHeights:L,expandByDefault:l,gap:w,expanded:D,swipeDirections:t.swipeDirections})})):null}))});const Bo=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const Zi=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Qi=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const gs=e=>{const t=Qi(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Kt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const el=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},tl=v.createContext({}),nl=()=>v.useContext(tl),sl=v.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:o="",children:r,iconNode:a,...l},c)=>{const{size:d=24,strokeWidth:f=2,absoluteStrokeWidth:i=!1,color:p="currentColor",className:h=""}=nl()??{},m=s??i?Number(n??f)*24/Number(t??d):n??f;return v.createElement("svg",{ref:c,...Kt,width:t??d??Kt.width,height:t??d??Kt.height,stroke:e??p,strokeWidth:m,className:Bo("lucide",h,o),...!r&&!el(l)&&{"aria-hidden":"true"},...l},[...a.map(([g,b])=>v.createElement(g,b)),...Array.isArray(r)?r:[r]])});const de=(e,t)=>{const n=v.forwardRef(({className:s,...o},r)=>v.createElement(sl,{ref:r,iconNode:t,className:Bo(`lucide-${Zi(gs(e))}`,`lucide-${e}`,s),...o}));return n.displayName=gs(e),n};const ol=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],rl=de("activity",ol);const al=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Wt=de("arrow-right",al);const il=[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]],ll=de("book-open",il);const cl=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Do=de("bot",cl);const dl=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ul=de("chevron-down",dl);const fl=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pl=de("chevron-up",fl);const ml=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hl=de("circle-check",ml);const gl=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Lo=de("file-text",gl);const bl=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],_o=de("git-compare-arrows",bl);const xl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vl=de("info",xl);const yl=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],wl=de("loader-circle",yl);const kl=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Sl=de("moon",kl);const Cl=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Ml=de("octagon-x",Cl);const Il=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Rl=de("shield-check",Il);const Tl=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],jl=de("sun",Tl);const El=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$o=de("triangle-alert",El);const Nl=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zl=de("upload",Nl);const Al=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Pl=de("workflow",Al);const Bl=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Fo=de("x",Bl),Dl=({...e})=>{const{theme:t}=Rn();return u.jsx(Xi,{theme:t,className:"toaster group",icons:{success:u.jsx(hl,{className:"size-4"}),info:u.jsx(vl,{className:"size-4"}),warning:u.jsx($o,{className:"size-4"}),error:u.jsx(Ml,{className:"size-4"}),loading:u.jsx(wl,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function Ll(e,t,n){switch(e.type){case"progress":t.onProgress?.(e);break;case"app":t.onApp?.(e.data);break;case"stage":t.onStage?.(e.data);break;case"sql":t.onSql?.(e.data);break;case"sqlPlan":t.onSqlPlan?.(e.data);break;case"executor":t.onExecutor?.(e.data);break;case"job":t.onJob?.(e.data);break;case"runAggregates":t.onRunAggregates?.(e.data);break;case"stageExecutorMetrics":t.onStageExecutorMetrics?.(e.data);break;case"done":{const{skippedLines:s}=e;t.onDone?.({skippedLines:s});break}case"error":t.onError?.(e);break;case"taskData":{const s=n?.get(e.reqId);s&&(s.resolve({metrics:e.metrics,fieldNames:e.fieldNames}),n.delete(e.reqId));break}}}function _l(){let e=null;const t=new Map;let n=0,s={};function o(){e=new Worker(new URL(""+new URL("parser-worker-BMPPE37w.js",import.meta.url).href,import.meta.url),{type:"module"}),e.onmessage=({data:i})=>Ll(i,s,t),e.onerror=i=>{s.onError?.(`Worker crashed: ${i.message}`),f()}}function r(i,p){s=p,o(),e.postMessage({type:"parse",file:i})}function a(i,p){s=p,o(),e.postMessage({type:"parseFromUrl",request:i})}function l(i,p){s=p,o(),e.postMessage({type:"parseFiles",files:i})}function c(i){return new Promise((p,h)=>{const m=String(n++);t.set(m,{resolve:p,reject:h}),e.postMessage({type:"getTaskData",stageId:i,reqId:m})})}async function d(i){return await Promise.all(i.map(h=>c(h).then(m=>({stageId:h,...m}))))}function f(){e?.terminate(),e=null;for(const{reject:i}of t.values())i(new Error("Worker terminated"));t.clear()}return{startParse:r,startParseFromUrl:a,startParseFiles:l,requestTaskData:c,prefetchFlaggedStages:d,terminate:f}}function bs(e,{onProgress:t,onDone:n,onError:s}){return{onProgress:t,onApp(o){e.app=o},onStage(o){const r=o;e.stages.set(r.id,r)},onSql(o){const r=o;e.sql.set(r.id,o);for(const a of r.stageIds??[]){const l=e.stages.get(a);l&&(l.sqlExecutionId=r.id)}},onSqlPlan(o){const r=o,a=e.sql.get(r.executionId);a&&(a.planTree=r.planTree)},onExecutor(o){const r=o;r.kind==="added"?e.executors.added.push(r):e.executors.removed.push(r)},onJob(o){const r=o;e.jobs.set(r.id,r)},onRunAggregates(o){e.runAggregates=o},onStageExecutorMetrics(o){if(!(o instanceof Map))return;const r=o;for(const[a,l]of r){const c=e.stages.get(a);c&&(c.executorMetrics=l)}},onDone:n,onError:s}}const $l=128*1024*1024,Fl=8e3,Ol=1.5,af=6,ht={critical:0,warning:1,info:2},Wl={skew:"task-skew",slowHost:"task-skew",straggler:"task-skew",shuffle:"shuffle-io",spill:"spill",gc:"gc-pressure",failures:"failures",coldStart:"executor-timeline",utilization:"executor-timeline",speculationWaste:"executor-timeline"};function lf(e){const t=new Map;for(const s of e){if(s.stageId==null)continue;const o=Wl[s.type];o&&(t.has(s.stageId)||t.set(s.stageId,new Set),t.get(s.stageId).add(o))}const n=new Map;for(const[s,o]of t)n.set(s,o.size);return n}const Gl={skew:"SKEW",shuffle:"SHFL",spill:"SPILL",gc:"GC",coldStart:"COLD",utilization:"UTIL",memoryUtilization:"MEM",cacheUtilization:"CSTOR",coreLocality:"LOCAL",autoscalingChurn:"CHRN",slowHost:"HOST",failures:"FAIL",straggler:"STRAG",retryWaste:"RETRY",tinyTask:"TINY",stageFailed:"SFAIL",speculationWaste:"SPEC",partitionSizing:"PART",stageSlowness:"SLOW",stageShape:"SHAPE",cachingOpportunity:"CACHE",jobFailureRate:"JOBS",configAudit:"CFG",duplicatePlanSubtree:"PLAN",smallFiles:"PLAN",underBroadcast:"PLAN",overBroadcast:"PLAN",broadcastSizing:"PLAN",incompleteRun:"INCMP"};function Tn(e){return Gl[e]??e.toUpperCase()}const cf={skew:"Skew spill: a few heavy tasks spill while most do not; rebalance partitioning",volume:"Volume spill: most tasks spill because data exceeds memory; add partitions",unclassified:"Spill cause could not be classified"},df={skew:"skew",volume:"vol",unclassified:"?"},Ul=8;function uf(e,t=Ul){return e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")}, +${e.length-t} more`}function ff(e){let t;for(const n of e)(t===void 0||ht[n.impactBand]<ht[t])&&(t=n.impactBand);return t}function dt(e){const t=String(e),n=t.match(/((?:hdfs?|s3[an]?):\/\/\S+|\/[^\s,)]+)/i);if(!n)return t;const s=n[1].replace(/[/,]+$/,"").split("/").filter(Boolean);return s[s.length-1]||t}function xs(e){return e.split("::")[0]||e}function ne(e){return!e||e<=0?"—":e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${(e/1e6).toFixed(0)} MB`:`${(e/1e3).toFixed(0)} KB`}function Hl(e){return e/1e6}function pf(e){return typeof e.value=="number"?e.value:0}function wt(e,t){switch(e){case"pct":return`${t}%`;case"pctFraction":return`${Math.round(t*100)}%`;case"ratio":return`${t}×`;case"ms":return je(t);case"count":return`${t}`}}const ql={shuffleReadBytes:"bytes",memoryBytesSpilled:"bytes",shuffleReadMax:"bytes",avgFileSizeBytes:"bytes",smallerSideBytes:"bytes",broadcastBytes:"bytes",speculationWasteMs:"ms",retryWasteMs:"ms",taskDurationP50:"ms",stageDurationMinutes:"minutes","P95/median":"ratio","max/median":"ratio",pRatio:"ratio",oiRatio:"ratio",taskStageSkew:"ratio",hostMeanRatio:"ratio",execMaxMedianRatio:"ratio",gcPct:"pct",failureRate:"pct",stragglerShare:"pct",hostDurationShare:"pctFraction",taskCount:"count",speculativeTasks:"count",subtreeOccurrences:"count"};function Vl(e){return e>0&&e<1e3?`${Math.round(e)} B`:ne(e)}function Yl(e){const t=e.metric?ql[e.metric]:void 0;if(!t||typeof e.value!="number")return null;switch(t){case"bytes":return Vl(e.value);case"minutes":return je(e.value*6e4);case"ms":return wt("ms",e.value);case"ratio":return wt("ratio",e.value);case"pct":return wt("pct",e.value);case"pctFraction":return wt("pctFraction",e.value);case"count":return wt("count",e.value)}}function mf(e){const t=Yl(e),n=e.impactEstimate?.wallClock,s=n?`~${je(n.high)}`:null,o=[t,s].filter(Boolean);return o.length>0?o.join(" · "):null}function je(e){return!e||e<=0?"—":e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function hf(e){const t=e.shuffleReadBytes??0;if(t<=0)return null;const n=Math.min(Fl,Math.ceil(t/$l)),s=e.taskCount??0;return n<=s*Ol?null:{recommended:n,current:s}}function gf(e,t){if(e.length===0)return{labels:[],data:[]};let n=e[0],s=e[0];for(let l=1;l<e.length;l++)e[l]<n&&(n=e[l]),e[l]>s&&(s=e[l]);const o=(s-n)/t||1,r=new Array(t).fill(0);for(const l of e)r[Math.min(Math.floor((l-n)/o),t-1)]++;return{labels:r.map((l,c)=>Math.round(n+c*o)),data:r}}function Ke(e,t,{dedupe:n=!1}={}){if(!e)return;const s=n?new Set:null,o=[{node:e,parent:null}];for(;o.length>0;){const{node:r,parent:a}=o.pop();if(s){if(s.has(r))continue;s.add(r)}t(r,a);const l=r.children??[];for(let c=l.length-1;c>=0;c--)o.push({node:l[c],parent:r})}}function Jl(e){for(const t of e.metrics??[]){if(t.metricType==="timing")return t.value;if(t.metricType==="nsTiming")return t.value/1e6}for(const t of e.metrics??[])if(/time/i.test(t.name)&&typeof t.value=="number")return t.value;return null}function Oo(e){const t=[],n=new Map,s=new Map;if(!e)return{segments:t,segOf:n,segmentTopology:s};let o=1,r=0;return Ke(e,(a,l)=>{let c;if(!l)c=0,s.set(c,{parentIndex:null,depth:0,traversalOrder:r++});else if(l.exchangeRole==="read"){const d=n.get(l);c=o++,s.set(c,{parentIndex:d,depth:s.get(d).depth+1,traversalOrder:r++})}else c=n.get(l);n.set(a,c),(t[c]??=[]).push(a)},{dedupe:!0}),{segments:t,segOf:n,segmentTopology:s}}function jn(e,t,n,s){const o=e.filter(Boolean).map((c,d)=>({i:d,nodes:c,...s.get(d)})).sort((c,d)=>d.depth-c.depth||c.traversalOrder-d.traversalOrder),r=[...n].map(c=>({id:c,s:t.get(c)})).filter(c=>!!c.s).sort((c,d)=>c.s.submittedAt-d.s.submittedAt),a=Math.min(o.length,r.length),l=[];for(let c=0;c<a;c++)l.push({segmentIndex:o[c].i,stageId:r[c].id,nodes:o[c].nodes,stage:r[c].s});return{orderedSegments:o,orderedStages:r,pairs:l}}function vs(e,t,n){const s=new Map;let o=e,r=0;for(;o!=null;)s.set(o,r++),o=n.get(o)?.parentIndex??null;for(o=t,r=0;o!=null;){const a=s.get(o);if(a!=null)return a+r;o=n.get(o)?.parentIndex??null,r++}return Number.POSITIVE_INFINITY}function bf(e,t,n,s){const o=t,r=s,{orderedSegments:a,pairs:l}=jn(e,o,n,r),c=new Map(l.map(f=>[f.segmentIndex,f.stageId])),d=l.map(f=>f.segmentIndex);if(d.length===0)return c;for(const{i:f}of a){if(c.has(f))continue;let i=d[0],p=vs(f,i,r);for(const h of d){const m=vs(f,h,r);m<p&&(p=m,i=h)}c.set(f,c.get(i))}return c}function Wo(e){const t=new Map;for(const{nodes:n,stage:s}of e){const{submittedAt:o,completedAt:r}=s,a=Math.max(0,r-o),l=n.map(Jl),c=l.reduce((d,f)=>d+(f??0),0);n.forEach((d,f)=>{const i=c>0?a*((l[f]??0)/c):a/n.length;t.set(d,i)})}return t}function Kl(e,t,n){const s=n?.stageIds??[];if(!e||s.length===0)return new Map;const{segments:o,segmentTopology:r}=Oo(e),a=t,{pairs:l}=jn(o,a,s,r);return Wo(l)}function Xl(e,t,n){const s=n?.stageIds??[],o=new Map;if(!e||s.length===0)return o;const{segments:r,segmentTopology:a}=Oo(e),l=t,{pairs:c}=jn(r,l,s,a),d=Wo(c);for(const{nodes:f}of c){const i=new Set(f);for(const p of f){let h=function(g){if(m.has(g))return 0;m.add(g);let b=d.get(g)??0;for(const x of g.children??[])i.has(x)&&(b+=h(x));return b};const m=new Set;o.set(p,h(p))}}return o}const Go=["serializefromobject","deserializetoobject","mapelements","mappartitions","inputadapter","columnartorow","rowtocolumnar","union"];function Zl(e){const t=(e??"").toLowerCase();return t.startsWith("scan")?"scan":t.includes("exchange")?"exchange":t.includes("join")?"join":t.includes("aggregate")?"aggregate":t.startsWith("sort")?"sort":t.startsWith("filter")?"filter":t==="adaptivesparkplan"?"aqe":Go.some(n=>t.startsWith(n))||t.startsWith("wholestagecodegen")?"boilerplate":"transform"}function Uo(e){return e.exchangeRole!==void 0||Zl(e.name)==="exchange"}function Ql(e){return e==="BroadcastExchange"}function xf(e,t){if(!t||t===e)return"";const n=(e??"").toLowerCase(),s=a=>a.replace(/#\d+/g,"");if(Go.some(a=>n.startsWith(a))||n==="adaptivesparkplan")return"";if(n.startsWith("wholestagecodegen")){const a=e.match(/\((\d+)\)/);return a?`codegen #${a[1]}`:""}if(n.includes("exchange")){const a=t.match(/Exchange\s+(\w+partitioning)\(([^)]+)\)/i);if(a){const c=a[1].toLowerCase().startsWith("hash")?"hash":"range",d=s(a[2]).split(",").map(h=>h.trim()),i=/^\d+$/.test(d[d.length-1])?d.pop():null,p=d.map(h=>h.replace(/\s+ASC(\s+NULLS\s+\w+)?$/i,"↑").replace(/\s+DESC(\s+NULLS\s+\w+)?$/i,"↓").trim()).slice(0,3);return`${c}(${p.join(", ")}${i?`, ${i}`:""})`}const l=t.match(/Exchange\s+(\w+)/);return l?l[1]:""}if(n.startsWith("sort")&&!n.includes("merge")){const a=t.match(/Sort\s+\[([^\]]+)\]/);if(a)return s(a[1]).split(",").map(l=>l.trim().replace(/\s+ASC(\s+NULLS\s+\w+)?$/i,"↑").replace(/\s+DESC(\s+NULLS\s+\w+)?$/i,"↓")).slice(0,4).join(", ")}if(n.includes("join")){const a=t.match(/Join\s+\[([^\]]*)\][^,]*,\s*\[[^\]]*\][^,]*,\s*(\w+)/i);if(a){const l=s(a[1]).split(",")[0].trim();return l?`${l} ${a[2]}`:a[2]}}if(n.includes("aggregate")){const a=t.match(/functions=\[([^\]]+)\]/);if(a){const l=[...new Set(a[1].split(",").map(c=>(c.trim().match(/^(\w+)\(/)?.[1]??"").replace(/^partial_/,"")))].filter(Boolean);return l.slice(0,5).join(", ")+(l.length>5?` +${l.length-5}`:"")}}if(n.startsWith("filter")){const a=t.match(/Filter\s+(.+)/s);if(a){const l=s(a[1]).trim().replace(/^\((.+)\)$/s,"$1");return l.length>70?l.slice(0,70)+"…":l}}if(n.startsWith("project")){const a=t.match(/Project\s+\[([^\]]+)\]/);if(a){const l=s(a[1]).split(",").map(c=>c.trim());return l.length<=3?l.join(", "):`${l.length} columns`}return""}if(n.startsWith("scan")){if(n.includes("existingrdd")){const l=dt(e);if(l!==e)return l}const a=e.match(/Scan\s+(\S+)/);return a?a[1]:""}const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=s(t).replace(new RegExp(`^${o}\\s*`,"i"),"").trim();return r.length>80?r.slice(0,80)+"…":r}function ec(e){const{value:t,metricType:n}=e;return typeof t=="string"?t:n==="size"?ne(t):n==="timing"?je(t):n==="nsTiming"?je(t/1e6):t.toLocaleString("en-US")}function vf(e){if(!e||e.length===0)return"";const n=["number of output rows","size of files read","spill size","duration"].map(s=>e.find(o=>o.name===s)).find(Boolean)??e[0];return ec(n)}function yf(e,t,n,s,o="exclusive"){if(!e||!n)return null;const r=Lt(s,t.stages);if(!r.length)return null;const a=new Map;for(const l of r){const c=t.stages.get(l);c&&a.set(l,{submittedAt:c.submittedAt,completedAt:c.completedAt})}return o==="inclusive"?Xl(e,a,{...n,stageIds:r}):Kl(e,a,{...n,stageIds:r})}function ln(e){return e.trim().replace(/#\w+$/,"")}function Gt(e){return e.replace(/^\[|\]$/g,"").split(",").map(ln).filter(Boolean)}function cn(e){const t=[];let n=0,s=0;for(let o=0;o<e.length;o++)e[o]==="("?n++:e[o]===")"?n--:e[o]===","&&n===0&&(t.push(e.slice(s,o).trim()),s=o+1);return t.push(e.slice(s).trim()),t.filter(Boolean)}function En(e,t){e.warnings.push({type:"crossJoin",detail:`${t} detected: this can cause severe data explosion.`})}function Ho(e,t){e.warnings.push({type:"longFilterCondition",detail:`Filter condition is ${t} characters: consider simplifying or pushing the filter down closer to the scan.`})}function Ut(e,t){let n=null,s=null;const o=e.match(/^Scan\s+(parquet|orc|csv|json)\s+(spark_catalog\.\S+)$/i);if(o)n=o[1].toLowerCase(),s=o[2];else{const a=t.match(/FileScan\s+(parquet|orc|csv|json)\s+(spark_catalog\.[^[\s]+)\[/i);a&&(n=a[1].toLowerCase(),s=a[2])}if(s)return/PreparedDeltaFileIndex/i.test(t)&&(n="delta"),`${n}:${s.replace(/^spark_catalog\./,"")}`;if(/_delta_log/.test(e)||/_delta_log/.test(t)||/DeltaLogFileIndex/i.test(e+t)||/checkpointMetadata#|sidecar#|commitInfo#/.test(e+t))return null;const r=t.match(/FileScan\s+(parquet|orc|csv|json)\b/i);if(r){const a=t.match(/Location:[^[]*\[([^\]]+)\]/);return a?`${r[1].toLowerCase()}:${dt(a[1].split(",")[0].trim())}`:null}if(/JDBCRelation/.test(t)){const a=qo(t).match(/\bFROM\s+(\(|[A-Za-z_][\w.]*)/i);return!a||a[1]==="("?null:`jdbc:${a[1].toLowerCase()}`}return null}function qo(e){const t=e.match(/JDBCRelation\(([\s\S]+?)\)\s*(?:SPARK_GEN_SUBQ_\d+\)?)?\s*\[numPartitions/),n=e.match(/JDBCRelation\(\(([\s\S]+?)\)\s*SPARK_GEN_SUBQ/);return(n?n[1]:t?t[1]:"").replace(/\s+/g," ").trim()}function Vo(e,t,n){const s=Ut(e,t);if(!s)return!1;const o=s.indexOf(":"),r=s.slice(0,o),a=s.slice(o+1);if(r==="jdbc")return n.scans.push({path:a,format:r,projectedColumns:[],pushedFilters:[],sql:qo(t)}),!0;const l=t.match(/FileScan\s+\w+\s+(\[[^\]]*\])/i)??t.match(/(\[[^\]]*\])/),c=t.match(/PushedFilters:\s*\[([^\]]*)\]/);return n.scans.push({path:a,format:r,projectedColumns:l?Gt(l[1]):[],pushedFilters:c&&c[1]?c[1].split(",").map(d=>d.trim()).filter(Boolean):[]}),!0}function Yo(e,t,n){const s=t.match(/^(SortMergeJoin|BroadcastHashJoin|ShuffledHashJoin|BroadcastNestedLoopJoin)\s+(\[[^\]]*\]),\s*(\[[^\]]*\]),\s*(\w+)/);return s?(n.joins.push({joinType:s[1],leftKeys:Gt(s[2]),rightKeys:Gt(s[3])}),/^Cross$/i.test(s[4])&&En(n,"Cross join"),!0):!1}function Jo(e,t,n){const s=t.match(/(?:Object)?HashAggregate\(keys=(\[[^\]]*\]),\s*functions=(\[[\s\S]*\])\)/);if(!s)return!1;const o=s[2].replace(/^\[|\]$/g,"");if(/\bpartial_/.test(o))return!0;const r=cn(o).map(l=>l.replace(/#\w+/g,"").trim()).filter(Boolean).slice(0,8),a=Gt(s[1]);return(a.length||r.length)&&n.aggs.push({groupByKeys:a,aggregations:r}),!0}function Ko(e,t){const n=e.match(/hashpartitioning\((.+?),\s*(\d+)\)/i),s=e.match(/rangepartitioning\((.+?),\s*(\d+)\)/i);if(n)t.exchanges.push({partitioning:"hash",keys:cn(n[1]).map(o=>ln(o.replace(/\s+(ASC|DESC)(\s+NULLS\s+\w+)?/i,""))).filter(Boolean),numPartitions:parseInt(n[2],10)});else if(s)t.exchanges.push({partitioning:"range",keys:cn(s[1]).map(o=>ln(o.replace(/\s+(ASC|DESC)(\s+NULLS\s+\w+)?/i,""))).filter(Boolean),numPartitions:parseInt(s[2],10)});else if(/RoundRobinPartitioning/i.test(e)){const o=e.match(/RoundRobinPartitioning\((\d+)\)/i);t.exchanges.push({partitioning:"roundrobin",keys:[],numPartitions:o?parseInt(o[1],10):0})}else/SinglePartition/i.test(e)&&t.exchanges.push({partitioning:"single",keys:[],numPartitions:1})}function wf(e){const t={scans:[],joins:[],aggs:[],exchanges:[],warnings:[]};return e&&Ke(e,n=>{const s=n.name??"",o=n.detail??"";if(/CartesianProduct/i.test(s)||/CartesianProduct/i.test(o))En(t,"CartesianProduct");else if(!Vo(s,o,t)){if(!(/Join/i.test(s)&&Yo(s,o,t))){if(!(/Aggregate/i.test(s)&&Jo(s,o,t))){if(n.exchangeRole==="read")Ko(o,t);else if(/^Filter/i.test(s)){const r=o.match(/^Filter\s+([\s\S]+)/);r&&r[1].trim().length>1e3&&Ho(t,r[1].trim().length)}}}}},{dedupe:!0}),t}function kf(e){if(!e)return null;const t=e.name??"",n=e.detail??"",s={scans:[],joins:[],aggs:[],exchanges:[],warnings:[]};let o=null;if(/CartesianProduct/i.test(t)||/CartesianProduct/i.test(n))o="cartesian",En(s,"CartesianProduct");else if(Vo(t,n,s))o="scan";else if(/Join/i.test(t)&&Yo(t,n,s))o="join";else if(/Aggregate/i.test(t)&&Jo(t,n,s))o="agg";else if(Uo(e))o="exchange",Ko(n,s);else if(/^Filter/i.test(t)){o="filter";const c=n.match(/^Filter\s+([\s\S]+)/);c&&c[1].trim().length>1e3&&Ho(s,c[1].trim().length)}const r=s.scans[0]?"scan":s.joins[0]?"join":s.aggs[0]?"agg":s.exchanges[0]||o==="exchange"&&e.exchangeRole!=="write"?"exchange":null,a=s.scans[0]??s.joins[0]??s.aggs[0]??s.exchanges[0]??null,l=s.warnings[0]??null;return!o||(o==="agg"||o==="filter")&&!r&&!l?null:{kind:r,warning:l,...a??{}}}function Sf(e,t){let n=t.reduce((s,o)=>s+(o.totalCores??0),0);if(n<=0){const s=e.resources?.executor?.cores??null;n=s!=null?t.length*s:0}return n}function Xo(e){const t=[...e].sort((o,r)=>o.time-r.time||o.delta-r.delta);let n=0,s=0;for(const o of t)n+=o.delta,n>s&&(s=n);return s}function dn(e,t,n){const s=new Map,o=[];for(const c of t){const d=c.totalCores??0;s.set(c.executorId,d),o.push({time:c.timestamp,delta:d})}for(const c of n){const d=s.get(c.executorId)??0;o.push({time:c.timestamp,delta:-d})}const r=Xo(o);if(r>0)return r;const a=Zo(t,n),l=e.resources?.executor?.cores??null;return l!=null?a*l:0}function Zo(e,t){const n=[...e.map(s=>({time:s.timestamp,delta:1})),...t.map(s=>({time:s.timestamp,delta:-1}))];return Xo(n)}const tc=new Set(["RACK_LOCAL","ANY"]),nc=5,sc=10,ys={totalTasks:null,nonLocalTasks:null,ratio:null,topStages:[]};function oc(e,{minTasksPerStage:t=sc,topN:n=nc}={}){if(!Array.isArray(e)||e.length===0)return ys;let s=0,o=0;const r=[];for(const l of e){const c=l?.localityStats;if(!Array.isArray(c)||c.length===0)continue;let d=0,f=0;for(const{locality:i,count:p}of c)Number.isFinite(p)&&(d+=p,tc.has(i)&&(f+=p));s+=d,o+=f,d>=t&&r.push({stageId:l.id,nonLocalTasks:f,taskCount:d,ratio:f/d})}if(s===0)return ys;const a=r.sort((l,c)=>c.nonLocalTasks-l.nonLocalTasks).slice(0,n);return{totalTasks:s,nonLocalTasks:o,ratio:o/s,topStages:a}}function Qo(e){if(e.length===0)return[];const t=[...e].sort((s,o)=>s[0]-o[0]),n=[[t[0][0],t[0][1]]];for(let s=1;s<t.length;s++){const o=n[n.length-1],r=t[s];r[0]<=o[1]?o[1]=Math.max(o[1],r[1]):n.push([r[0],r[1]])}return n}function ws(e,t){const n=e?.startTime??0,o=[...t.values()].filter(g=>g.submittedAt!=null&&g.completedAt!=null).map(g=>[g.submittedAt,g.completedAt]),a=e?.endTime??null??(o.length>0?o.reduce((g,b)=>Math.max(g,b[1]),-1/0):n),l=Math.max(0,a-n);if(o.length===0)return{total:l,startup:l,stagesActive:0,gaps:0,idle:0};const c=Qo(o),d=c.reduce((g,[b,x])=>g+(x-b),0),f=c[0][0],i=Math.max(0,f-n);let p=0;for(let g=1;g<c.length;g++)p+=c[g][0]-c[g-1][1];const h=c[c.length-1][1],m=Math.max(0,a-h);return{total:l,startup:i,stagesActive:d,gaps:p,idle:m}}function Ht(e){return(e.completedAt??0)-(e.submittedAt??0)}function rc(e){const t=Ht(e);return t>0?(e.executorRunTime??0)/t:0}function ac(e){const t=[...e.values()].filter(l=>Ht(l)>0),n=new Map;for(const l of t)n.set(l.id,0);if(t.length===0)return n;const s=[];for(const l of t){const c=rc(l);s.push({time:l.submittedAt??0,id:l.id,weight:c,isStart:!0}),s.push({time:l.completedAt??0,id:l.id,weight:c,isStart:!1})}s.sort((l,c)=>l.time-c.time);const o=new Map;let r=s[0].time,a=0;for(;a<s.length;){const l=s[a].time;if(l>r&&o.size>0){const c=l-r;let d=0;for(const f of o.values())d+=f;for(const[f,i]of o){const p=d>0?i/d:1/o.size;n.set(f,(n.get(f)??0)+c*p)}}for(;a<s.length&&s[a].time===l;){const c=s[a];c.isStart?o.set(c.id,c.weight):o.delete(c.id),a++}r=l}return n}function ic(e){const t=ac(e),n=new Map;for(const s of e.values()){const o=Ht(s);if(o<=0)continue;const r=t.get(s.id)??0;n.set(s.id,Math.min(1,r/o))}return n}function lc(e,t){const n=e.taskDurationMax??0;if(t<=0)return n;const s=e.executorRunTime??0;return Math.max(n,s/t)}function cc(e,t,n){const s=Math.max(0,Ht(t)-n);return Math.min(e,s)}function er(e,t){const n=ic(e),s=new Map;for(const o of e.values()){const r=n.get(o.id);r!==void 0&&s.set(o.id,{gate:r,ceiling:lc(o,t)})}return s}const dc=.999;function Nn(e,t,n,s){const o=n.get(t),r=s.get(t);if(!o||!r)return null;const a=cc(e,o,r.ceiling);return r.gate>=dc?{basis:"serial",wallClock:{low:a,high:a}}:{basis:"contended",wallClock:{low:a*r.gate,high:a}}}function tr(e,t,n,s){const o=[],r=[];for(const p of e){const h=Nn(t.get(p)??0,p,n,s);if(!h)continue;o.push(h);const m=n.get(p);r.push([m.submittedAt??0,m.completedAt??0])}if(o.length===0)return null;const a=o.reduce((p,h)=>p+h.wallClock.high,0),l=o.reduce((p,h)=>p+h.wallClock.low,0),c=Qo(r).reduce((p,[h,m])=>p+(m-h),0),d=Math.min(a,c),f=Math.min(l,c);return{basis:o.every(p=>p.basis==="serial")?"serial":"contended",wallClock:{low:f,high:d}}}const Se=1024*1024,ye=1024*Se,uc=1024*ye;function fc(e,t){const{taskCount:n,spillDiskMax:s=0,spillMemMax:o=0,spillDiskP50:r=0,spillMemP50:a=0}=e;if(n===1){if(s>=t.singleTaskDiskGiB*ye||o>=t.singleTaskMemGiB*ye)return{magnitude:"severe"}}else{const l=n>0?s/n:0;if(s>=t.highDiskGiB*ye||l>=t.highTaskDiskMB*Se||o>=t.highMemGiB*ye)return{magnitude:"high"};if(s>=t.medDiskMB*Se||o>=t.medMemGiB*ye)return{magnitude:"medium"}}if(n>=t.skewMinTasks){if(r>0&&s/r>t.skewRatio&&s>=t.skewDiskFloorMB*Se)return{magnitude:"high"};if(a>0&&o/a>t.skewRatio&&o>=t.skewMemFloorMB*Se)return{magnitude:"medium"}}return null}function pc(e){return!Array.isArray(e)||e.length===0?null:[...e].sort((t,n)=>n.count-t.count)[0].reason}function Lt(e,t){const n=[];for(const s of t.values())s.sqlExecutionId===e&&n.push(s.id);return n}function Pt(e,t){const n=new Set;for(const s of e)for(const o of s.stageIds??[])n.add(o);return n.size>0?[...n].sort((s,o)=>s-o):t}function mc(e,t={}){const{includeDetail:n=!1,normalizeDetail:s=l=>l}=t,o=new WeakMap,r=[];function a(l,c){r.push(l);const d=l.exchangeRole==="read"?l.children[0]:null,f=d?d.children:l.children??[],i=d?d.metrics:l.metrics,p=f.map(y=>a(y,!1)),h=1+p.reduce((y,w)=>y+w.size,0),m=(i??[]).map(y=>y.name).sort().join(","),g=p.map(y=>y.fingerprint).join(","),b=c&&n?`${l.name}[${m}]<${s(l.detail??"")}>{${g}}`:`${l.name}[${m}]{${g}}`,x={size:h,fingerprint:b};return o.set(l,x),x}return a(e,!0),{shapeOf:o,allNodes:r}}function zn(e){let t=e.replace(/#\d+L?/g,"").replace(/,?\s*plan_id=\d+/g,"").replace(/\[codegen id\s*:\s*\d+\]/gi,"[codegen id]").replace(/\bBuild(Left|Right)\b/g,"BuildSide");return t=t.replace(/([A-Za-z_][\w.]*)\s*=\s*([A-Za-z_][\w.]*)/g,(n,s,o)=>{const[r,a]=[s,o].sort();return`${r} = ${a}`}),t}const hc=/Join/i;function gc(e){return hc.test(e)?"join":e==="Union"?"union":null}function bc(e){const t=[],n=[];function s(o){n.push(o);const r=(o.children??[]).map(s);n.pop();const a=(o.metrics??[]).map(p=>p.name).sort().join(","),l=r.map(p=>p.fingerprint).join(","),c=`${o.name}[${a}]{${l}}`,d=new Map,f=Ut(o.name??"",o.detail??"");if(f){const p=(o.metrics??[]).find(h=>h.name===un);d.set(f,(d.get(f)??0)+(p?p.value:0))}for(const p of r)for(const[h,m]of p.leafRelationBytes)d.set(h,(d.get(h)??0)+m);const i=gc(o.name??"");return i&&t.push({node:o,operator:i,fingerprint:`${o.name}[${a}]<${zn(o.detail??"")}>{${l}}`,leafRelationBytes:new Map(d),ancestorNodes:n.slice()}),{fingerprint:c,leafRelationBytes:d}}return s(e),t}function xc(e){let t=null;return Ke(e,n=>{t||(t=Ut(n.name??"",n.detail??""))}),t}function vc(e,{minSubtreeSize:t,minOccurrences:n}){const{shapeOf:s,allNodes:o}=mc(e),r=o.filter(i=>s.get(i).size>=t&&i.exchangeRole!=="write"),a=new Map;for(const i of r){const p=s.get(i).fingerprint;a.has(p)||a.set(p,[]),a.get(p).push(i)}const l=[...a.values()].filter(i=>i.length>=n).sort((i,p)=>s.get(p[0]).size-s.get(i[0]).size),c=new WeakSet,d=i=>{c.add(i);for(const p of i.children??[])d(p)},f=[];for(const i of l){const p=i.filter(h=>!c.has(h));if(!(p.length<n)){for(const h of p)d(h);f.push({rootName:p[0].name,subtreeSize:s.get(p[0]).size,occurrences:p.length,isExchangeRoot:Uo(p[0]),sampleRelation:xc(p[0]),groupIndex:f.length,nodes:p})}}return f}const yc="number of files read",un="size of files read",wc="number of written files",kc="written output";function fn(e){const t=(e.metrics??[]).find(s=>s.name==="data size");if(t)return t.value;let n=0;for(const s of e.children??[])n+=fn(s);return n}function pn(e){if((e.metrics??[]).find(s=>s.name==="data size"))return[e];const n=[];for(const s of e.children??[])n.push(...pn(s));return n}function Sc(e){if(e.length<3)return null;const t=e.map(o=>o.value).sort((o,r)=>o-r),n=t[Math.floor(t.length/2)];if(n<=0)return null;const s=e.reduce((o,r)=>r.value>o.value?r:o);return{key:s.key,ratio:s.value/n,value:s.value}}function nr(){return An.map(e=>({type:e.type,version:e.version??1,scope:e.scope,thresholds:e.thresholds,docAnchor:e.docAnchor}))}function Cc(e,t){const{taskCount:n,taskDurationP50:s,taskDurationP95:o,taskDurationMax:r}=e;return s===0?null:(n??0)>=t?{ratio:o/s,metric:"P95/median"}:{ratio:r/s,metric:"max/median"}}function ks(e){const t=e?.app;if(t?.startTime==null||t?.endTime==null)return null;const n=t.endTime-t.startTime;return n>0?n:null}function Xt(e,t,n){return t==null||e>=t*n}function Ss(e,t,n){if(!n)return e;const s=Nn(e,t,n.stages,n.occupancy);return s?s.wallClock.high:e}const sr="This ratio is a point-in-time storage snapshot from stage-submission events, not a runtime read-count. Confirm against the Spark UI's Storage tab before acting.";function Cs(e,t,n){const s=e.name||`RDD ${e.id}`,o=Math.round(t*100),r=100-o;return{type:"cacheUtilization",variant:"partialCache",stageId:null,rddId:e.id,rddName:s,impactBand:n,metric:"cachedRatio",value:o,confidence:"medium",validationRequired:sr,memorySize:e.memorySize,diskSize:e.diskSize,numCachedPartitions:e.numCachedPartitions,numPartitions:e.numPartitions,recommendation:`RDD ${s} is ${r}% evicted from cache (${o}% of partitions cached). Increase executor memory or reduce the cached dataset size.`}}function Ms(e,t,n){const s=e.name||`RDD ${e.id}`,o=Math.round(t*100);return{type:"cacheUtilization",variant:"diskSpillover",stageId:null,rddId:e.id,rddName:s,impactBand:n,metric:"diskRatio",value:o,confidence:"medium",validationRequired:sr,memorySize:e.memorySize,diskSize:e.diskSize,numCachedPartitions:e.numCachedPartitions,numPartitions:e.numPartitions,recommendation:`RDD ${s} is ${o}% spilled to disk despite requesting MEMORY_AND_DISK. Executor memory may be too small for this cached dataset.`}}const or=.005,rr=.02,An=[{type:"skew",scope:"stage",order:30,fixEffort:"code",version:1,docAnchor:"#bottleneck-skew",thresholds:{ratioWarn:3,minTasksForP95:20,floorPctWarn:.005},detect(e,t){const n=Cc(e,this.thresholds.minTasksForP95);if(n===null)return null;const{ratio:s,metric:o}=n;if(s<=this.thresholds.ratioWarn)return null;const r=Math.max(0,o==="P95/median"?e.taskDurationP95-e.taskDurationP50:e.taskDurationMax-e.taskDurationP50),a=ks(t),l=Ss(r,e.id,t);if(!Xt(l,a,this.thresholds.floorPctWarn))return null;const c=Math.round(s*10)/10;return{type:"skew",stageId:e.id,impactBand:"warning",metric:o,value:c,confidence:"low",validationRequired:"The 0.5% runtime-floor percentage that gates this finding is our own noise floor, unvalidated: no external tool publishes an equivalent metric to calibrate against. Confirm against known-good/known-bad real logs before trusting the impact-band split.",recommendation:`Task duration ratio (${o}) is ${c}×: 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.`}}},{type:"stageShape",scope:"stage",order:35,fixEffort:"code",version:1,docAnchor:"#bottleneck-stage-shape",thresholds:{pRatioMax:.5,oiRatioMax:10,skewWarn:3},detect(e,t){const n=[],s=(e.executorStats??[]).length,o=t?.app?.resources?.executor?.cores??1,r=s*o;if(r>0){const l=e.taskCount/r;l<this.thresholds.pRatioMax&&n.push({type:"stageShape",stageId:e.id,impactBand:"info",rule:"lowParallelism",metric:"pRatio",value:Math.round(l*100)/100,totalCores:r,recommendation:`This stage runs ${e.taskCount} ${e.taskCount===1?"task":"tasks"} across ~${r} cores, so it is under-parallelized and leaves cluster capacity idle.`})}if(e.inputBytes>0){const l=e.outputBytes/e.inputBytes;l>this.thresholds.oiRatioMax&&n.push({type:"stageShape",stageId:e.id,impactBand:"info",rule:"dataExplosion",metric:"oiRatio",value:Math.round(l*10)/10,recommendation:`This stage outputs ${Math.round(l)}× its input volume: check for an exploding join or a cross product.`})}const a=(e.completedAt??0)-(e.submittedAt??0);if(a>0){const l=e.taskDurationMax/a;l>this.thresholds.skewWarn&&n.push({type:"stageShape",stageId:e.id,impactBand:"info",rule:"taskStageSkew",metric:"taskStageSkew",value:Math.round(l*10)/10,totalCores:r,recommendation:`One task takes ${Math.round(l*10)/10}× this stage's wall-clock duration; a single straggler is gating the whole stage.`})}return n}},{type:"shuffle",scope:"stage",order:20,fixEffort:"config",version:1,docAnchor:"#bottleneck-shuffle",thresholds:{minBytes:50*Se},detect(e){const t=e.shuffleReadBytes;return t<=this.thresholds.minBytes?null:{type:"shuffle",stageId:e.id,impactBand:"info",metric:"shuffleReadBytes",value:t,recommendation:`${ne(t)} shuffled in this stage: consider increasing spark.sql.shuffle.partitions or adding a broadcast join.`}}},{type:"partitionSizing",scope:"stage",order:22,fixEffort:"config",version:1,docAnchor:"#bottleneck-shuffle",thresholds:{skewRatio:5,skewFloorBytes:256*Se,lowParTotalBytes:ye,lowParMaxTasks:7,maxPartBytes:5*ye},detect(e){const t=[],{shuffleReadP50:n,shuffleReadMax:s,shuffleReadBytes:o,taskCount:r}=e;if(s>this.thresholds.skewRatio*n&&s>this.thresholds.skewFloorBytes){const a=n>0?`${Math.round(s/n*10)/10}× the median (${ne(n)})`:`far larger than the median (${ne(n)}, effectively empty)`;t.push({type:"partitionSizing",stageId:e.id,impactBand:"warning",rule:"shufflePartitionSkew",metric:"shuffleReadMax",value:s,recommendation:`The largest shuffle partition (${ne(s)}) is ${a}: for join skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key.`})}return o>=this.thresholds.lowParTotalBytes&&r<=this.thresholds.lowParMaxTasks&&t.push({type:"partitionSizing",stageId:e.id,impactBand:"warning",rule:"lowShuffleParallelism",metric:"taskCount",value:r,recommendation:`${Math.round(o/ye*10)/10} GB of shuffle spread over only ${r} tasks: raise spark.sql.shuffle.partitions so each partition is smaller.`}),s>=this.thresholds.maxPartBytes&&t.push({type:"partitionSizing",stageId:e.id,impactBand:"critical",rule:"maxPartitionTooBig",metric:"shuffleReadMax",value:s,recommendation:`A single shuffle partition (${ne(s)}) exceeds 5 GB: this will OOM or spill heavily. Repartition to break it up before this stage.`}),t}},{type:"spill",scope:"stage",order:10,fixEffort:"code",version:1,docAnchor:"#bottleneck-spill",thresholds:{singleTaskDiskGiB:1,singleTaskMemGiB:4,highDiskGiB:1,highTaskDiskMB:512,highMemGiB:4,medDiskMB:256,medMemGiB:1,skewRatio:5,skewDiskFloorMB:128,skewMemFloorMB:256,skewMinTasks:10},detect(e){if(e.memoryBytesSpilled===0)return null;const t=e.spillClassification,n=t==="skew"||t==="volume",s=fc(e,this.thresholds);return{type:"spill",stageId:e.id,impactBand:"warning",spillMagnitude:s?.magnitude,metric:"memoryBytesSpilled",value:e.memoryBytesSpilled,confidence:n?"medium":"low",validationRequired:n?"Spill cause is inferred from the share of tasks that spilled: confirm against per-task spill metrics in the Spark UI.":"Spill cause could not be classified: inspect per-task spill metrics in the Spark UI before acting.",recommendation:t==="skew"?`${ne(e.memoryBytesSpilled)} spilled, skew-driven: fix task skew first; adding memory will not help.`:`${ne(e.memoryBytesSpilled)} spilled: raise spark.sql.shuffle.partitions or increase executor memory.`}}},{type:"gc",scope:"stage",order:50,fixEffort:"config",version:1,docAnchor:"#bottleneck-gc",confidence:"low",validationRequired:"The 10-second minimum-runtime floor that gates this finding is our own noise floor, unvalidated: no external tool publishes an equivalent metric to calibrate against. Confirm against known-good/known-bad real logs before trusting the impact-band split.",thresholds:{warnPct100:10,lowInfoPct100:5,minRunTimeMs:1e4},detect(e){const t=e.gcPct;if((e.executorRunTime??0)>=this.thresholds.minRunTimeMs&&t>this.thresholds.warnPct100){const n=Math.round(t*10)/10;return{type:"gc",stageId:e.id,impactBand:"warning",metric:"gcPct",value:n,confidence:this.confidence,validationRequired:this.validationRequired,recommendation:`GC consumed ${n}% of executor run time: reduce object creation, use primitive types, avoid UDFs, increase executor memory.`}}if((e.executorRunTime??0)>=this.thresholds.minRunTimeMs&&t<this.thresholds.lowInfoPct100){const n=Math.round(t*10)/10;return{type:"gc",stageId:e.id,direction:"low",impactBand:"info",metric:"gcPct",value:n,confidence:this.confidence,validationRequired:this.validationRequired,recommendation:`GC consumed only ${n}% of executor run time: memory may be over-provisioned; consider reducing spark.executor.memory for cost savings.`}}return null}},{type:"slowHost",scope:"stage",order:60,fixEffort:"config",version:1,docAnchor:"#bottleneck-slow-host",thresholds:{minHosts:3,minTasks:15,ratioWarn:2,minShare:.2,shareWarn:.75,taskShareWarn:.5,ratioTiers:[1.33,1.78,3.16,10],floorMs:1e3,floorBytes:64*Se},detect(e){const t=e.hostStats??[],n=e.executorStats??[];if(t.length<this.thresholds.minHosts&&n.length<this.thresholds.minHosts||e.taskCount<this.thresholds.minTasks)return null;const s=[];if(t.length>=this.thresholds.minHosts){const i=t.map(g=>({host:g.host,taskCount:g.taskCount,mean:g.totalDuration/g.taskCount})),p=[...i].map(g=>g.mean).sort((g,b)=>g-b),h=p[Math.floor(p.length/2)];if(h>0)for(const g of i){const b=g.mean/h,x=g.taskCount/e.taskCount;b<this.thresholds.ratioWarn||x<this.thresholds.minShare||g.mean<this.thresholds.floorMs||s.push({type:"slowHost",stageId:e.id,impactBand:"warning",metric:"hostMeanRatio",value:Math.round(b*10)/10,hostMeanMs:g.mean,host:g.host,hostTaskShare:Math.round(x*100)/100,recommendation:`${g.host} may just hold data locality for its tasks or carry one heavy stage, not necessarily a hardware fault: check what it was running, and consider enabling spark.speculation to relaunch a lagging task automatically.`})}const m=t.reduce((g,b)=>g+b.totalDuration,0);if(m>0)for(const g of t){const b=g.totalDuration/m,x=g.taskCount/e.taskCount;b>=this.thresholds.shareWarn&&x>=this.thresholds.taskShareWarn&&s.push({type:"slowHost",stageId:e.id,impactBand:"warning",variant:"durationShare",metric:"hostDurationShare",value:Math.round(b*100)/100,hostMeanMs:g.totalDuration/g.taskCount,host:g.host,hostTaskShare:Math.round(x*100)/100,recommendation:`${g.host} is doing ${Math.round(b*100)}% of this stage's total task time: check for data locality or partition assignment skewing work onto one node.`})}}const o=e.executorStats??[],r=this.thresholds.ratioTiers,a=i=>i>=r[3]?"critical":i>=r[1]?"warning":i>=r[0]?"info":null,l=this.thresholds.floorMs,c=this.thresholds.floorBytes,d=[{dimension:"taskTime",floor:l,samples:o.filter(i=>i.taskCount>0).map(i=>({key:i.executorId,value:i.totalDuration/i.taskCount}))},{dimension:"inputBytes",floor:c,samples:o.map(i=>({key:i.executorId,value:i.inputBytes??0}))},{dimension:"shuffleBytes",floor:c,samples:o.map(i=>({key:i.executorId,value:(i.shuffleReadBytes??0)+(i.shuffleWriteBytes??0)}))}],f=e.executorMetrics instanceof Map?e.executorMetrics:null;f&&f.size>=3&&d.push({dimension:"storageMemory",floor:c,samples:[...f.entries()].map(([i,p])=>({key:i,value:(p.onHeapStorageMemory??0)+(p.offHeapStorageMemory??0)}))});for(const i of d){const p=Sc(i.samples);if(!p||p.value<i.floor)continue;const h=a(p.ratio);if(!h)continue;const m=i.dimension==="taskTime"?"info":h;s.push({type:"slowHost",stageId:e.id,impactBand:m,variant:"multiDim",dimension:i.dimension,metric:"execMaxMedianRatio",value:Math.round(p.ratio*10)/10,execMaxValue:p.value,executorId:p.key,recommendation:`Executor ${p.key} deviates ${Math.round(p.ratio*10)/10}× from the median on ${i.dimension}: investigate uneven partition assignment or a degraded executor.`})}return s}},{type:"stageSlowness",scope:"stage",order:65,fixEffort:"code",version:2,docAnchor:"#bottleneck-stage-slowness",thresholds:{infoMin:15},suppressWhen(e,t){return t.some(n=>n.type==="slowHost"&&n.stageId===e.stageId)},detect(e){const t=(e.completedAt??0)-(e.submittedAt??0);if(!(t>0))return null;const n=t/6e4,s=this.thresholds,o=n>=s.infoMin?"info":null;if(!o)return null;const r=Math.round(n*10)/10;return{type:"stageSlowness",stageId:e.id,impactBand:o,metric:"stageDurationMinutes",value:r,recommendation:`This stage ran ${r} minutes with no more specific cause flagged: 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.`}}},{type:"stageFailed",scope:"stage",order:42,fixEffort:"code",version:1,docAnchor:"#bottleneck-failures",thresholds:{},detect(e){return e.stageFailureReason==null?null:{type:"stageFailed",stageId:e.id,impactBand:"critical",variant:"stageFailure",metric:"stageFailureReason",value:e.stageFailureReason,numTasks:e.taskCount,memoryBytesSpilled:e.memoryBytesSpilled,failedTaskDetails:e.failedTaskSamples??[],recommendation:"This stage attempt failed outright. Inspect the driver log for the failure reason and the job that triggered it."}}},{type:"failures",scope:"stage",order:40,fixEffort:"code",version:1,docAnchor:"#bottleneck-failures",thresholds:{minTasks:10,warnRate:.05,critRate:.2},detect(e){if(e.taskCount<this.thresholds.minTasks||!e.failedTasks)return null;const t=e.failedTasks/e.taskCount;if(t<=this.thresholds.warnRate)return null;const n=Math.round(t*1e3)/10,s=pc(e.failureReasons);return{type:"failures",stageId:e.id,impactBand:t>this.thresholds.critRate?"critical":"warning",metric:"failureRate",value:n,failedTasks:e.failedTasks,dominantReason:s,recommendation:`${n}% of tasks failed${s?` (dominant reason: ${s})`:""}: investigate driver logs for executor instability or data-driven errors.`}}},{type:"straggler",scope:"stage",order:70,fixEffort:"code",version:1,docAnchor:"#bottleneck-straggler",thresholds:{minTasks:10,shareWarn:.05,warnPct:.1,critPct:.2,floorPctWarn:or,floorPctCrit:rr},detect(e,t){if(e.taskCount<this.thresholds.minTasks)return null;const n=(e.stragglerCount??0)/e.taskCount;if((e.speculativeTasks??0)===0&&n<=this.thresholds.shareWarn)return null;const s=(e.speculativeTasks??0)>0,o=s?e.speculativeTasks/e.taskCount:0,r=Math.max(0,e.taskDurationMax-e.taskDurationP50),a=ks(t),l=Ss(r,e.id,t),c=Xt(l,a,this.thresholds.floorPctWarn),d=Xt(l,a,this.thresholds.floorPctCrit),f=o>=this.thresholds.critPct&&d?"critical":o>=this.thresholds.warnPct&&c?"warning":"info",i=n>this.thresholds.shareWarn&&c?"warning":"info",p="info",h=s&&!(ht[i]<ht[f]),m=h?e.speculativeTasks:Math.round(n*100),g=h?`${m} speculative attempt${m===1?"":"s"} discarded`:`${m}% of tasks straggled`;return{type:"straggler",stageId:e.id,impactBand:p,metric:h?"speculativeTasks":"stragglerShare",value:m,unit:h?"count":"pct",speculativeTasks:e.speculativeTasks??0,stragglerCount:e.stragglerCount??0,confidence:"low",validationRequired:"The 0.5%/2% runtime-floor percentages that gate this finding are our own noise floor, unvalidated: no external tool publishes an equivalent metric to calibrate against. Confirm against known-good/known-bad real logs before trusting the impact-band split.",recommendation:`${g}: rule out a GC pause or a slow shuffle fetch before assuming a hardware issue; if a skewed key is the real cause, that's a candidate for AQE's skew-join handling.`}}},{type:"speculationWaste",scope:"stage",order:71,fixEffort:"config",version:1,docAnchor:"#bottleneck-straggler",confidence:"low",thresholds:{minWasted:5,minWasteMs:6e4},detect(e){const t=e.speculationWastedAttempts??0,n=e.speculationWasteMs??0;return t<this.thresholds.minWasted||n<this.thresholds.minWasteMs?null:{type:"speculationWaste",stageId:e.id,impactBand:"warning",metric:"speculationWasteMs",value:n,confidence:this.confidence,recommendation:`Speculative execution discarded ${Math.round(n/1e3)}s of executor time in this stage; if task durations are naturally variable rather than genuine stragglers, consider tuning spark.speculation.multiplier/quantile.`}}},{type:"retryWaste",scope:"stage",order:45,fixEffort:"code",version:1,docAnchor:"#bottleneck-retry-waste",thresholds:{minWasted:3,minWasteMs:3e4},detect(e){const t=e.wastedAttempts??0,n=e.retryWasteMs??0;return t<this.thresholds.minWasted||n<this.thresholds.minWasteMs?null:{type:"retryWaste",stageId:e.id,impactBand:"warning",metric:"retryWasteMs",value:n,numTasks:e.taskCount,memoryBytesSpilled:e.memoryBytesSpilled,retriedTaskDetails:e.retryTaskSamples??[],recommendation:`Retried task attempts wasted ${Math.round(n/1e3)}s of executor time (${t} attempt${t===1?"":"s"}) even though the stage completed: investigate executor loss or fetch failures.`,extended:`${t} task attempts were superseded by a later retry, wasting ${Math.round(n/1e3)}s of executor time. Common causes: executor loss (OOM-kill, node death) or shuffle FetchFailed forcing a stage-map recompute. Check driver logs for the dominant reason (see the Failures widget) even if the final failure rate looks low; retries hide the true cost.`}}},{type:"tinyTask",scope:"stage",order:80,fixEffort:"code",version:1,docAnchor:"#bottleneck-tiny-tasks",thresholds:{minTasks:100,maxP50:500,maxP95:1e3},detect(e){if(e.taskCount<this.thresholds.minTasks||e.taskDurationP50>this.thresholds.maxP50||e.taskDurationP95>this.thresholds.maxP95)return null;const t=Math.max(1,Math.round(e.taskCount/10)),n=e.shuffleReadBytes>0?`lower spark.sql.shuffle.partitions or .coalesce(${t})`:`.coalesce(${t})`;return{type:"tinyTask",stageId:e.id,impactBand:"info",metric:"taskDurationP50",value:Math.round(e.taskDurationP50),recommendation:`Many small tasks (${e.taskCount}, P50 ${Math.round(e.taskDurationP50)}ms): scheduler overhead may dominate. Try ${n}.`}}},{type:"incompleteRun",scope:"app",order:5,fixEffort:"code",version:1,thresholds:{},recommendation:"This event log never recorded an ApplicationEnd event: the capture stopped before the run finished (an in-flight job, a rotated-away log, or a cut-short capture). Findings and metrics elsewhere on this board reflect only what was captured up to that point, not the full run.",detect(e){return!e.app||e.app.startTime==null||e.app.endTime!=null?null:{type:"incompleteRun",stageId:null,impactBand:"warning",metric:"applicationEnd",value:"missing",recommendation:this.recommendation}}},{type:"coldStart",scope:"app",order:90,fixEffort:"code",version:1,docAnchor:"#bottleneck-cold-start",thresholds:{gapSeconds:30},detect(e){const{app:t,stages:n}=e;if(!t||t.startTime==null||n.size===0)return null;let s=1/0;for(const a of n.values())a.submittedAt>0&&a.submittedAt<s&&(s=a.submittedAt);if(!Number.isFinite(s))return null;const o=(s-t.startTime)/1e3;if(o<=this.thresholds.gapSeconds)return null;const r=Math.round(o);return{type:"coldStart",stageId:null,impactBand:"warning",metric:"startupGapSeconds",value:r,recommendation:`The first task waited ${r}s for executors to become available: keep a warm pool of idle executors, or if using dynamic allocation, raise the minimum/initial executor count so it doesn't scale up from zero.`}}},{type:"utilization",scope:"app",order:100,fixEffort:"config",version:1,docAnchor:"#bottleneck-utilization",thresholds:{minUtil:.6},detect(e){const{app:t,executorsAdded:n,executorsRemoved:s,runAggregates:o}=e;if(!t||n.length===0||t.startTime==null||t.endTime==null)return null;const r=t.endTime-t.startTime;if(r<=0)return null;const a=dn(t,n,s);if(a<=0)return null;const l=a*r,d=(o?.busyCoreMs??0)/l;if(d>=this.thresholds.minUtil)return null;let f=null;if(a>0){let p=0;for(const h of e.stages.values())p+=Hl(h.executorCpuTime??0);f=Math.round(p/(r*a)*100)}const i=Math.round(d*100);return{type:"utilization",stageId:null,impactBand:"info",metric:"avgUtilization",value:i,utilizationFraction:d,appDurationMs:r,totalCores:a,cpuUtilizationPct:f,recommendation:`Average executor utilization was only ${i}%: consider reducing cluster size or enabling dynamic allocation.`}}},{type:"memoryUtilization",scope:"app",order:102,fixEffort:"config",version:1,docAnchor:"#bottleneck-memory-utilization",thresholds:{idleCoreWarn:.5,bandTooSmall:.95,bandTooHigh:.7,wasteBufferMultiplier:1.5},detect(e){const{app:t,executorsAdded:n,executorsRemoved:s,runAggregates:o,stages:r}=e,a=[];if(t?.startTime==null||t?.endTime==null)return a;const l=t.endTime-t.startTime;if(l<=0)return a;const c=Zo(n,s),d=dn(t,n,s),f=t.resources?.executor?.memoryMB??null;if(o&&d>0){const p=d*l,h=p>0?1-o.busyCoreMs/p:0;if(h>this.thresholds.idleCoreWarn){const m=Math.round(h*100);a.push({type:"memoryUtilization",variant:"idleCores",stageId:null,impactBand:"warning",metric:"idleCoreRate",value:m,idleRateFraction:h,allocatedMB:f,peakExecutors:c,appDurationMs:l,recommendation:`${m}% of allocated core-time ran no task: reduce cluster size or enable dynamic allocation.`})}}const i=new Map;for(const p of r.values()){const h=p.executorMetrics;if(h instanceof Map)for(const[m,g]of h){const b=g?.jvmHeapMemory??0;b>(i.get(m)??0)&&i.set(m,b)}}if(i.size===0)a.push({type:"memoryUtilization",variant:"memoryBand",stageId:null,impactBand:"info",metric:"memoryBand",dataUnavailable:!0,recommendation:"Per-executor memory usage requires spark.eventLog.logStageExecutorMetrics=true: not enabled for this run."});else if(f!=null&&f>0){const p=f*1024*1024;for(const[h,m]of i){const g=m/p;g>this.thresholds.bandTooSmall?a.push({type:"memoryUtilization",variant:"memoryBand",rule:"heapNearCapacity",stageId:null,executorId:h,impactBand:"warning",metric:"heapUsedRatio",value:Math.round(g*100),recommendation:`Executor ${h} peaked at ${Math.round(g*100)}% of allocated heap: memory may be too small; raise spark.executor.memory to avoid OOM/spill.`}):g<this.thresholds.bandTooHigh&&a.push({type:"memoryUtilization",variant:"memoryBand",rule:"heapOverProvisioned",stageId:null,executorId:h,impactBand:"info",metric:"heapUsedRatio",value:Math.round(g*100),allocatedBytes:p,heap:m,appDurationMs:l,recommendation:`Executor ${h} used only ${Math.round(g*100)}% of allocated heap: memory may be over-provisioned; consider reducing spark.executor.memory for cost savings.`})}}if(f!=null&&c>0){const p=c*f*(l/1e3);let h=0;for(const b of r.values())h+=b.executorRunTime??0;const m=f*(h/1e3),g=p-m;if(g>this.thresholds.wasteBufferMultiplier*m){const b=Math.round(g);a.push({type:"memoryUtilization",variant:"wasteModel",stageId:null,impactBand:"info",metric:"wastedMBSeconds",value:b,confidence:"low",validationRequired:"Memory-waste estimate uses allocated-vs-used memory-time and an unverified 1.5x buffer: confirm against the Spark UI before acting.",recommendation:`Allocated executor memory sat largely idle over the run (~${b.toLocaleString("en-US")} MB-seconds wasted): review spark.executor.memory and executor count.`})}}return a}},{type:"cacheUtilization",scope:"app",order:103,fixEffort:"code",version:1,docAnchor:"#memory-model",thresholds:{cachedRatioWarn:.5,cachedRatioInfo:.9,diskRatioWarn:.4,diskRatioInfo:.15},detect(e){const t=e.app?.rddInfo;if(!(t instanceof Map))return null;const n=[];for(const s of t.values()){const o=s.storageLevel??{};if((o.useMemory||o.useDisk)&&(s.numCachedPartitions??0)>0){if((s.numPartitions??0)>0){const r=s.numCachedPartitions/s.numPartitions;r<this.thresholds.cachedRatioWarn?n.push(Cs(s,r,"warning")):r<this.thresholds.cachedRatioInfo&&n.push(Cs(s,r,"info"))}if(o.useMemory&&o.useDisk){const r=(s.memorySize??0)+(s.diskSize??0);if(r>0){const a=(s.diskSize??0)/r;a>this.thresholds.diskRatioWarn?n.push(Ms(s,a,"warning")):a>this.thresholds.diskRatioInfo&&n.push(Ms(s,a,"info"))}}}}return n}},{type:"coreLocality",scope:"app",order:103,fixEffort:"config",version:1,docAnchor:"#bottleneck-utilization",thresholds:{minTasks:50,warnRatio:.15,critRatio:.35},detect(e){const{totalTasks:t,nonLocalTasks:n,ratio:s}=oc([...e.stages.values()]);if(t==null||t<this.thresholds.minTasks||s<this.thresholds.warnRatio)return null;const o=Math.round(s*100);return{type:"coreLocality",stageId:null,impactBand:s>=this.thresholds.critRatio?"critical":"warning",metric:"nonLocalRatio",value:o,nonLocalTaskCount:n,confidence:"low",validationRequired:"The 15%/35% non-local-ratio thresholds (and the 50-task minimum) are unvalidated design-spike values: no external tool publishes an equivalent metric to calibrate against. Confirm against known-good/known-bad real logs before trusting the impact-band split.",recommendation:`${o}% of tasks (${n}) ran without process- or node-local data placement: check spark.locality.wait settings and executor/data colocation.`}}},{type:"autoscalingChurn",scope:"app",order:103,fixEffort:"config",version:1,confidence:"low",thresholds:{shortLivedMs:12e4,warningPct:.3,criticalPct:.6,minExecutors:5},detect(e){const{app:t,executorsAdded:n,executorsRemoved:s}=e;if(!t||n.length===0||t.endTime==null||n.length<this.thresholds.minExecutors)return null;const o=new Map;for(const d of s)o.set(d.executorId,d.timestamp);let r=0;for(const d of n)(o.has(d.executorId)?o.get(d.executorId):t.endTime)-d.timestamp<this.thresholds.shortLivedMs&&r++;const a=r/n.length,l=a>this.thresholds.criticalPct?"critical":a>this.thresholds.warningPct?"warning":null;if(!l)return null;const c=Math.round(a*100);return{type:"autoscalingChurn",stageId:null,impactBand:l,metric:"shortLivedExecutorPct",value:c,shortLivedExecutorCount:r,confidence:this.confidence,recommendation:`${c}% of executors ran for under 2 minutes before being removed. 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.`}}},{type:"cachingOpportunity",scope:"app",order:105,fixEffort:"code",version:1,docAnchor:"#bottleneck-utilization",thresholds:{minExecutions:2},detect(e){const t=e.sql;if(!(t instanceof Map)||t.size===0)return null;const n=new Map;for(const f of t.values()){if(!f.planTree)continue;const i=new Map;Ke(f.planTree,p=>{const h=Ut(p.name??"",p.detail??"");if(!h)return;const m=(p.metrics??[]).find(g=>g.name===un);i.set(h,(i.get(h)??0)+(m?m.value:0))});for(const[p,h]of i){let m=n.get(p);if(!m){const g=p.indexOf(":");m={format:p.slice(0,g),relation:p.slice(g+1),executionIds:new Set,executionBytes:new Map},n.set(p,m)}m.executionIds.add(f.id),m.executionBytes.set(f.id,(m.executionBytes.get(f.id)??0)+h)}}const s=new Map;for(const f of t.values()){if(!f.planTree)continue;const i=bc(f.planTree),p=new Map(i.map(m=>[m.node,m.fingerprint])),h=new Map;for(const m of i){let g=h.get(m.fingerprint);g||(g={operator:m.operator,node:m.node,leafRelationBytes:new Map,ancestorFingerprints:new Set(m.ancestorNodes.map(b=>p.get(b)).filter(b=>!!b))},h.set(m.fingerprint,g));for(const[b,x]of m.leafRelationBytes)g.leafRelationBytes.set(b,(g.leafRelationBytes.get(b)??0)+x)}for(const[m,g]of h){let b=s.get(m);b||(b={operator:g.operator,exampleNode:g.node,executionIds:new Set,executionBytes:new Map,ancestorFingerprints:new Set,leafRelationRids:new Set},s.set(m,b)),b.executionIds.add(f.id);const x=[...g.leafRelationBytes.values()].reduce((y,w)=>y+w,0);b.executionBytes.set(f.id,(b.executionBytes.get(f.id)??0)+x);for(const y of g.ancestorFingerprints)b.ancestorFingerprints.add(y);for(const y of g.leafRelationBytes.keys())b.leafRelationRids.add(y)}}const o=f=>s.has(f)&&s.get(f).executionIds.size>=this.thresholds.minExecutions,r=new Map;for(const[f,i]of s){if(!o(f)){r.set(f,{finalExecutionIds:i.executionIds,suppressed:!0});continue}const p=[...i.ancestorFingerprints].filter(o).map(g=>s.get(g));if(p.length===0){r.set(f,{finalExecutionIds:i.executionIds,suppressed:!1});continue}const h=new Set(p.flatMap(g=>[...g.executionIds])),m=new Set([...i.executionIds].filter(g=>!h.has(g)));m.size===0?r.set(f,{finalExecutionIds:m,suppressed:!0}):m.size<this.thresholds.minExecutions?r.set(f,{finalExecutionIds:m,suppressed:!0}):r.set(f,{finalExecutionIds:m,suppressed:!1})}const a=f=>f.slice(f.indexOf(":")+1),l={join:["joined","join"],union:["unioned","union"]},c=[],d=new Map;for(const[f,i]of s){const p=r.get(f);if(p.suppressed)continue;const h=[...p.finalExecutionIds].sort((R,j)=>R-j),m=h.reduce((R,j)=>R+(i.executionBytes.get(j)??0),0),g=[...i.leafRelationRids].sort();if(g.length===0)continue;const b=g.map(R=>{const j=R.indexOf(":");return{relation:R.slice(j+1),format:R.slice(0,j)}}),[x,y]=l[i.operator],w=g.map(a).join(` ${y} `),C=h.length,k=m>=128*Se?`${x[0].toUpperCase()}${x.slice(1)} result read by ${C} queries (~${ne(m)}). Cache/persist the ${x} DataFrame so it is computed once.`:`${x[0].toUpperCase()}${x.slice(1)} result read by ${C} queries. Cache the ${x} DataFrame, or reconsider whether it needs to be recomputed each time.`;c.push({type:"cachingOpportunity",variant:"composite",stageId:null,impactBand:"info",metric:"executionReuse",value:C,format:"derived",relations:b,operator:i.operator,relation:w,executionIds:h,totalReadBytes:m,confidence:"low",validationRequired:"Composite reuse is inferred from a structural plan-shape match (operator + normalized join/filter condition + child shapes) across SQL executions; confirm these executions truly compute the same join/union before caching.",recommendation:k});for(const R of g){d.has(R)||d.set(R,new Set);for(const j of h)d.get(R).add(j)}}for(const[f,i]of n){const p=d.get(f),h=p?[...i.executionIds].filter(x=>!p.has(x)):[...i.executionIds];if(h.length<this.thresholds.minExecutions)continue;const m=h.length,g=h.reduce((x,y)=>x+(i.executionBytes.get(y)??0),0),b=g>=128*Se?`Read by ${m} queries (~${ne(g)}). Cache/persist the shared DataFrame so it is scanned once.`:`Read by ${m} queries. Cache the shared DataFrame, or broadcast it if it is a small join lookup.`;c.push({type:"cachingOpportunity",stageId:null,impactBand:"info",metric:"executionReuse",value:m,relation:i.relation,format:i.format,executionIds:h.sort((x,y)=>x-y),totalReadBytes:g,confidence:"low",validationRequired:"Relation-reuse is inferred from the pre-AQE plan scan identity across SQL executions; confirm the reads are the same data and cacheable within one session before acting.",recommendation:b})}return c}},{type:"jobFailureRate",scope:"app",order:110,fixEffort:"code",version:1,docAnchor:"#bottleneck-job-failure-rate",thresholds:{infoRate:.1,warnRate:.3,critRate:.5},detect(e){const{jobs:t,stages:n}=e,o=(t?[...t.values()]:[]).filter(m=>m.result!=null);if(o.length===0)return null;const r=o.filter(m=>m.succeeded===!1),a=r.length,l=a/o.length;if(l<this.thresholds.infoRate)return null;let c=0,d=0;for(const m of n.values())c+=m.taskCount??0,d+=m.failedTasks??0;const f=c>0?d/c:0,i=r.filter(m=>m.submissionTime!=null&&m.completionTime!=null),p=i.length>0?i.reduce((m,g)=>m+(g.completionTime-g.submissionTime),0)/i.length:0,h=o.length;return{type:"jobFailureRate",stageId:null,impactBand:l>=this.thresholds.critRate?"critical":l>=this.thresholds.warnRate?"warning":"info",metric:"jobFailureRate",value:Math.round(l*1e3)/10,failedJobs:a,totalJobs:h,failedTasks:d,totalTasks:c,avgJobDurationMs:p,taskFailureRate:Math.round(f*1e3)/10,recommendation:`${a} of ${h} jobs never recovered: inspect the driver log for the failed job(s) and the stage failures that triggered them.`}}},{type:"configAudit",scope:"config",order:120,fixEffort:"config",version:1,inScorecard:!1,docAnchor:"#config-shuffle-service",thresholds:{},property:"spark.shuffle.service.enabled",detect(e){const t=e.app?.resources??null;return t?.dynamicAllocationEnabled===!0&&t?.shuffleServiceEnabled===!1?{type:"configAudit",property:"spark.shuffle.service.enabled",impactBand:"warning",metric:"config",value:"false",recommendation:"Dynamic allocation is on but the external shuffle service is off: set spark.shuffle.service.enabled=true so shuffle data survives executor removal."}:null}},{type:"configAudit",scope:"config",order:121,fixEffort:"config",version:1,inScorecard:!1,docAnchor:"#config-autoscale-bounds",thresholds:{},property:"spark.dynamicAllocation.maxExecutors",detect(e){const t=e.app,n=t?.config??{};if((t?.resources??null)?.dynamicAllocationEnabled!==!0)return null;const o=n["spark.dynamicAllocation.minExecutors"]!=null?parseInt(n["spark.dynamicAllocation.minExecutors"],10):null,r=n["spark.dynamicAllocation.maxExecutors"]!=null?parseInt(n["spark.dynamicAllocation.maxExecutors"],10):null;return o!=null&&r!=null&&o>r?{type:"configAudit",property:"spark.dynamicAllocation.minExecutors",impactBand:"critical",metric:"config",value:`${o} > ${r}`,recommendation:`Autoscaling bounds are inverted: spark.dynamicAllocation.minExecutors (${o}) exceeds maxExecutors (${r}). Set min ≤ max.`}:r==null?{type:"configAudit",property:"spark.dynamicAllocation.maxExecutors",impactBand:"info",metric:"config",value:"(unset)",recommendation:"Dynamic allocation is on with no upper bound: set spark.dynamicAllocation.maxExecutors to cap cluster growth."}:null}},{type:"configAudit",scope:"config",order:122,fixEffort:"config",version:1,inScorecard:!1,docAnchor:"#config-serializer",thresholds:{},property:"spark.serializer",detect(e){const t=e.app,n=t?.config??{},s=t?.resources??null;if(Object.keys(n).length===0)return null;const o=s?.serializer??n["spark.serializer"]??null;return typeof o=="string"&&/kryo/i.test(o)?null:{type:"configAudit",property:"spark.serializer",impactBand:"info",metric:"config",value:o??"(default JavaSerializer)",recommendation:`Current serializer is ${o??"the default JavaSerializer"}: consider spark.serializer=org.apache.spark.serializer.KryoSerializer for faster, smaller buffers.`}}},{type:"configAudit",scope:"config",order:123,fixEffort:"config",version:1,inScorecard:!1,docAnchor:"#config-memory-overhead",thresholds:{floorMB:384,floorPct:.1},property:"spark.executor.memoryOverhead",detect(e){const t=e.app?.resources??null,n=t?.executor?.memoryMB??null,s=t?.executor?.memoryOverheadMB??null;if(n==null||s==null)return null;const o=Math.max(this.thresholds.floorMB,Math.round(n*this.thresholds.floorPct));return s>=o?null:{type:"configAudit",property:"spark.executor.memoryOverhead",impactBand:"info",metric:"config",value:`${s} MiB`,recommendation:`Executor memoryOverhead (${s} MiB) is below Spark's default floor of ${o} MiB (max of 384 MiB or 10% of executor memory): raise it to avoid off-heap OOM-kills.`}}},{type:"duplicatePlanSubtree",scope:"sql",order:130,fixEffort:"code",version:2,docAnchor:"#bottleneck-duplicate-plan-subtree",thresholds:{minSubtreeSize:3,minOccurrences:2},detect(e,t){if(!e.planTree)return null;const n=vc(e.planTree,this.thresholds);if(n.length===0)return null;const s=Lt(e.id,t.stages);return n.map(o=>{const r=[];for(const d of o.nodes)Ke(d,f=>r.push(f));const a=Pt(r,s),l=r.map(d=>d.id).filter(Boolean),c=o.sampleRelation?` (touching ${o.sampleRelation})`:"";return{type:"duplicatePlanSubtree",executionId:e.id,stageIds:a,planNodeIds:l,impactBand:"warning",metric:"subtreeOccurrences",value:o.occurrences,rootName:o.rootName,subtreeSize:o.subtreeSize,sampleRelation:o.sampleRelation,groupIndex:o.groupIndex,confidence:"medium",validationRequired:"Duplicate-subtree matching compares operator names and metric names only, not literal values or expr IDs: confirm the repeated work is real in the Spark SQL plan tab before acting.",recommendation:o.isExchangeRoot?`A ${o.subtreeSize}-node subtree rooted at ${dt(o.rootName)} repeats ${o.occurrences}x in this plan${c}: this looks like a possible missed exchange reuse; check whether the same shuffle could be computed once and reused.`:`A ${o.subtreeSize}-node subtree rooted at ${dt(o.rootName)} repeats ${o.occurrences}x in this plan${c}: consider caching/persisting the shared computation or check for a duplicated query branch.`}})}},{type:"smallFiles",scope:"sql",order:131,fixEffort:"config",version:2,docAnchor:"#bottleneck-small-files",thresholds:{minFiles:100,maxAvgFileSizeMB:3},detect(e,t){if(!e.planTree)return null;const{minFiles:n,maxAvgFileSizeMB:s}=this.thresholds,o=[];if(Ke(e.planTree,a=>{const l=a.metrics??[],c=f=>l.find(i=>i.name===f),d=(f,i,p)=>{if(!f||!i||!(f.value>n))return;const h=i.value/f.value;h<s*Se&&o.push({direction:p,fileCount:f.value,avgBytes:h,nodeName:a.name,node:a})};d(c(yc),c(un),"read"),d(c(wc),c(kc),"write")}),o.length===0)return null;const r=Lt(e.id,t.stages);return o.map(a=>{const l=Pt([a.node],r),c=a.node.id?[a.node.id]:[];return{type:"smallFiles",executionId:e.id,stageIds:l,planNodeIds:c,impactBand:"warning",metric:"avgFileSizeBytes",value:Math.round(a.avgBytes),fileCount:a.fileCount,direction:a.direction,nodeName:a.nodeName,recommendation:a.direction==="read"?`${a.fileCount} small files were read at ${dt(a.nodeName)}: consider compacting the upstream output so fewer, larger files are produced.`:`${a.fileCount} small files were written at ${dt(a.nodeName)}: repartition or coalesce before writing to raise the average file size.`}})}},{type:"broadcastSizing",scope:"sql",order:132,fixEffort:"config",version:2,docAnchor:"#bottleneck-broadcast-sizing",thresholds:{broadcastTiers:[10*Se,100*Se,ye,5*ye],comparisonTiers:[10*ye,300*ye,uc],overBroadcastBytes:ye},detect(e,t){if(!e.planTree)return null;const{broadcastTiers:n,comparisonTiers:s,overBroadcastBytes:o}=this.thresholds,r=Lt(e.id,t.stages),a=[];return Ke(e.planTree,l=>{if(l.name==="SortMergeJoin"&&(l.children??[]).length===2){const[c,d]=l.children,f=fn(c),i=fn(d),p=Math.min(f,i),h=Math.max(f,i);if(p>0&&(p<n[0]||p<n[1]&&h>s[0]||p<n[2]&&h>s[1]||p<n[3]&&h>s[2])){const g=[...pn(c),...pn(d)];a.push({type:"underBroadcast",executionId:e.id,stageIds:Pt(g,r),planNodeIds:g.map(b=>b.id).filter(Boolean),impactBand:"info",metric:"smallerSideBytes",value:p,largerSideBytes:h,recommendation:`The smaller input to this Sort Merge Join (${ne(p)}) is well under the broadcast threshold relative to the larger side (${ne(h)}): this could have been a broadcast join. Consider a broadcast() hint or raising spark.sql.autoBroadcastJoinThreshold.`})}}if(Ql(l.name)){const c=(l.metrics??[]).find(d=>d.name==="data size");if(c&&c.value>o){const d=(l.children??[])[0];a.push({type:"overBroadcast",executionId:e.id,stageIds:Pt(d?[d]:[],r),planNodeIds:[l.id].filter(Boolean),impactBand:"warning",metric:"broadcastBytes",value:c.value,recommendation:`This broadcast (${ne(c.value)}) exceeds the 1 GB threshold: check for a misapplied broadcast hint or a misconfigured spark.sql.autoBroadcastJoinThreshold.`})}}}),a.length?a:null}}];function Mc(e){throw new Error(`Unreachable case: ${JSON.stringify(e)}`)}const Zt=125e6,Ic=2e8,Rc=128*1024*1024,Tc=50,jc=10,Is=125e6,Ec=20,Nc=15e3,Rs=125e6,zc=(()=>{const e=nr().find(t=>t.type==="stageSlowness")?.thresholds?.infoMin;if(typeof e!="number")throw new Error("impact-estimator: stageSlowness detector's 'infoMin' threshold not found in detectorCatalog()");return e})();function ee(e,t){return t?{basis:"resourceOnly",wallClock:null,estimateMethod:e,rawWaste:t}:{basis:"informational",wallClock:null,estimateMethod:e}}function Te(e,t,n,s,o,r){const a=Nn(e,t,n,s);return a?{basis:a.basis,wallClock:a.wallClock,estimateMethod:o,rawWaste:r}:ee(o,r)}function Qt(e,t,n,s){const o=e>0?{value:e,unit:"ms"}:void 0;if(!t||t.length===0)return ee("modeled",o);const r=e/t.length,a=new Map(t.map(c=>[c,r])),l=tr(t,a,n,s);return l?{basis:l.basis,wallClock:l.wallClock,estimateMethod:"modeled",rawWaste:o}:ee("modeled",o)}function Ac(e,t,n){switch(e.type){case"retryWaste":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.retryWasteMs??0;return Te(o,e.stageId,t,n,"measured",{value:o,unit:"ms"})}case"speculationWaste":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.speculationWasteMs??0;return Te(o,e.stageId,t,n,"measured",{value:o,unit:"ms"})}case"coldStart":{if(typeof e.value!="number")return null;const s=e.value*1e3;return{basis:"serial",wallClock:{low:s,high:s},estimateMethod:"measured"}}case"gc":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=(s.completedAt??0)-(s.submittedAt??0),r=s.executorRunTime??0,a=s.jvmGCTime??0,l={value:a,unit:"coreMs"};if(r<=0||o<=0)return ee("modeled",l);const c=r/o,d=a/c;return Te(d,e.stageId,t,n,"modeled",l)}case"skew":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.taskDurationP50??0,r=e.metric==="P95/median",a=Math.max(0,r?(s.taskDurationP95??0)-o:(s.taskDurationMax??0)-o);return Te(a,e.stageId,t,n,"measured",{value:a,unit:"ms"})}case"straggler":case"stageShape":{if(e.type==="stageShape"){if(e.rule==="lowParallelism"){const r=t.get(e.stageId);if(!r)return null;const a=(r.completedAt??0)-(r.submittedAt??0),l=Math.max(0,(e.totalCores??0)-(r.taskCount??0))*a;return ee("measured",{value:l,unit:"coreMs"})}if(e.rule==="dataExplosion"){const r=t.get(e.stageId);if(!r)return null;const a=Math.max(0,(r.outputBytes??0)-(r.inputBytes??0));return ee("measured",{value:a,unit:"bytes"})}if(e.rule==="taskStageSkew"){const r=t.get(e.stageId);if(!r)return null;const a=e.totalCores??0,l=r.taskCount??0,c=Math.max(0,Math.min(a,l)-1)*Math.max(0,(r.taskDurationMax??0)-(r.taskDurationP50??0));return ee("measured",{value:c,unit:"coreMs"})}return null}if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=Math.max(0,(s.taskDurationMax??0)-(s.taskDurationP50??0));return Te(o,e.stageId,t,n,"measured",{value:o,unit:"ms"})}case"slowHost":{const s=e.metric==="hostMeanRatio"||e.variant==="durationShare"?e.hostMeanMs:e.variant==="multiDim"&&e.dimension==="taskTime"?e.execMaxValue:null;if(s==null)return ee("none");if(e.stageId==null)return null;const o=t.get(e.stageId);if(!o)return null;const r=Math.max(0,s-(o.taskDurationP50??0));return Te(r,e.stageId,t,n,"measured",{value:r,unit:"ms"})}case"duplicatePlanSubtree":{const s=e.stageIds;if(!s||s.length===0)return null;const o=typeof e.value=="number"?e.value:0;if(o<2)return ee("none");const r=(o-1)/o,a=new Map;for(const f of s){const i=t.get(f);if(i){const p=Math.max(0,(i.completedAt??0)-(i.submittedAt??0));a.set(f,p*r)}}const c={value:[...a.values()].reduce((f,i)=>f+i,0),unit:"ms"},d=tr(s,a,t,n);return d?{basis:d.basis,wallClock:d.wallClock,estimateMethod:"measured",rawWaste:c}:ee("measured",c)}case"shuffle":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.shuffleReadBytes??0,r=o/Zt*1e3;return Te(r,e.stageId,t,n,"modeled",{value:o,unit:"bytes"})}case"spill":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.diskBytesSpilled??0,r=o/Ic*1e3;return Te(r,e.stageId,t,n,"modeled",{value:o,unit:"bytes"})}case"stageSlowness":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=(s.completedAt??0)-(s.submittedAt??0),r=Math.max(0,o-zc*6e4);return Te(r,e.stageId,t,n,"modeled",{value:r,unit:"ms"})}case"partitionSizing":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;let o=0;if(e.rule==="maxPartitionTooBig")o=(s.shuffleReadMax??0)/Zt*1e3;else if(e.rule==="shufflePartitionSkew")o=Math.max(0,(s.shuffleReadMax??0)-(s.shuffleReadP50??0))/Zt*1e3;else if(e.rule==="lowShuffleParallelism"){const r=Math.ceil((s.shuffleReadBytes??0)/Rc),a=s.taskCount??0;r>a&&a>0&&(o=Math.max(0,(s.completedAt??0)-(s.submittedAt??0))*(1-a/r))}else return null;return Te(o,e.stageId,t,n,"modeled",{value:o,unit:"ms"})}case"tinyTask":{if(e.stageId==null)return null;const s=t.get(e.stageId);if(!s)return null;const o=s.taskCount??0,a=Math.max(0,o-Math.round(o/10))*Tc;return Te(a,e.stageId,t,n,"modeled",{value:a,unit:"ms"})}case"smallFiles":{const s=(e.fileCount??0)*jc;return Qt(s,e.stageIds,t,n)}case"overBroadcast":{const s=(e.value??0)/Is*1e3;return Qt(s,e.stageIds,t,n)}case"underBroadcast":{const s=(e.value??0)/Is*1e3;return Qt(s,e.stageIds,t,n)}case"memoryUtilization":{if(e.variant==="wasteModel"&&typeof e.value=="number")return ee("measured",{value:e.value,unit:"mbSeconds"});if(e.variant==="idleCores"){const s=e.idleRateFraction,o=e.allocatedMB,r=e.peakExecutors,a=e.appDurationMs;if(s!=null&&o!=null&&r!=null&&a!=null){const l=s*o*r*(a/1e3);return ee("modeled",{value:l,unit:"mbSeconds"})}return ee("modeled")}if(e.variant==="memoryBand"&&e.rule==="heapOverProvisioned"){const s=e.allocatedBytes,o=e.heap,r=e.appDurationMs;if(s!=null&&o!=null&&r!=null){const l=(s-o)/1048576*(r/1e3);return ee("modeled",{value:l,unit:"mbSeconds"})}}return ee("modeled")}case"utilization":{const s=e.utilizationFraction,o=e.appDurationMs,r=e.totalCores;if(s==null||o==null||r==null)return ee("measured");const a=(1-s)*o*r/36e5;return ee("measured",{value:a,unit:"coreHours"})}case"coreLocality":{const o=(e.nonLocalTaskCount??0)*Ec;return ee("modeled",{value:o,unit:"coreMs"})}case"autoscalingChurn":{const o=(e.shortLivedExecutorCount??0)*Nc/36e5;return ee("modeled",{value:o,unit:"coreHours"})}case"configAudit":return ee("none");case"jobFailureRate":{const s=e.failedJobs??0,o=e.avgJobDurationMs??0,r=s*o/36e5;return ee("modeled",{value:r,unit:"coreHours"})}case"cachingOpportunity":{const o=(e.totalReadBytes??0)/Rs*1e3;return ee("modeled",{value:o,unit:"ms"})}case"cacheUtilization":{const s=e.memorySize??0,o=e.diskSize??0,r=e.numCachedPartitions??0,a=e.numPartitions??0,l=Math.max(0,a-r),c=s+o,i=((r>0?c/r*l:0)+o)/Rs*1e3;return ee("modeled",{value:i,unit:"ms"})}case"stageFailed":case"failures":case"incompleteRun":return ee("none");default:return null}}function ar(e,t,n=0){const s=er(t,n);for(const o of e){const r=Ac(o,t,s);r&&(o.impactEstimate=r)}return e}const Pc=or,Bc=rr;function Dc(e){if(e?.startTime==null||e?.endTime==null)return null;const t=e.endTime-e.startTime;return t>0?t:null}function ir(e,t){const n=Dc(t);if(n==null)return e;for(const s of e){if(s.type==="partitionSizing"&&s.rule==="maxPartitionTooBig")continue;const o=s.impactEstimate?.wallClock?.high;if(o==null)continue;const r=o/n;s.impactBand=r>=Bc?"critical":r>=Pc?"warning":"info"}return e}function Lc(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function _c(e){const t=e.stageId??e.executionId??e.property??"",n=e.type==="memoryUtilization"?void 0:e.rule,s=[e.host,e.executorId,n,e.variant,e.dimension,e.direction,e.nodeName,e.rootName,e.subtreeSize,e.groupIndex,e.largerSideBytes,e.rddId,e.relation,e.format,e.operator,e.executionIds?e.executionIds.join(","):""].map(o=>o??"").join("|");return Lc(`${e.type}|${t}|${e.metric??""}|${e.value??""}|${s}`)}function Ts(e){return`This overlaps with the ${e} finding on this stage: both are driven by the same dominant outlier task, so don't add their recoverable-time figures together.`}function $c(e){const t=new Set(e.filter(o=>o.type==="skew"&&o.metric==="max/median"&&o.stageId!=null).map(o=>o.stageId));if(t.size===0)return;const n=new Set(e.filter(o=>o.type==="straggler"&&o.stageId!=null).map(o=>o.stageId)),s=new Set([...t].filter(o=>n.has(o)));if(s.size!==0)for(const o of e){if(o.stageId==null||!s.has(o.stageId))continue;const r=o.type==="skew"?Ts("straggler"):o.type==="straggler"?Ts("skew"):null;r&&(o.validationRequired=o.validationRequired?`${o.validationRequired} ${r}`:r)}}function _t(e,t,n){if(!n)return;const s=t.version??1;for(const o of Array.isArray(n)?n:[n]){if(!o||t.suppressWhen&&t.suppressWhen(o,e))continue;const r={...o,docAnchor:o.docAnchor??t.docAnchor,detectorVersion:s},a=_c(r);e.some(l=>l.id===a)||e.push({...r,id:a})}}function js(e,t,n,s,o,r=new Map,a=null){const l=dn(e??{},n,s),c=er(t,l),d={app:e,stages:t,executorsAdded:n,executorsRemoved:s,jobs:o,sql:r,runAggregates:a,occupancy:c},f=[];for(const i of An)if(i.inScorecard!==!1)switch(i.scope){case"stage":for(const p of t.values())_t(f,i,i.detect(p,d));break;case"sql":for(const p of r.values())_t(f,i,i.detect(p,d));break;case"app":case"config":_t(f,i,i.detect(d));break;default:Mc(i.scope)}return ar(f,t,l),ir(f,e),$c(f),f.sort((i,p)=>ht[i.impactBand]-ht[p.impactBand]),f}const Es=new WeakMap;function Ns(e){const t=[];for(const n of An)n.scope==="config"&&_t(t,n,n.detect({app:e}));return ar(t,new Map),ir(t,e),t.map(n=>({...n,stageId:n.stageId??null}))}function en(e){if(e===null)return Ns(e);const t=Es.get(e);if(t)return t.slice();const n=Ns(e);return Es.set(e,n),n.slice()}const Fc="sparkforensics",Oc=1,Ct="recentFiles",zs=10;let tn=0;function lr(){const e=Date.now();return e>tn?(tn=e,e):++tn}function As(){return typeof window<"u"&&"showOpenFilePicker"in window}function Wc(e){e.objectStoreNames.contains(Ct)&&e.deleteObjectStore(Ct),e.createObjectStore(Ct,{keyPath:"id"})}function ut(e,t,n){return`${e}::${t}::${n}`}function Rt(){return new Promise((e,t)=>{const n=indexedDB.open(Fc,Oc);n.onupgradeneeded=()=>Wc(n.result),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function We(e,t){return e.transaction(Ct,t).objectStore(Ct)}function Ge(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}async function cr({handle:e,name:t,size:n,lastModified:s,appName:o=null,issueCount:r=null}){const a=await Rt();try{const l={id:ut(t,n,s),name:t,size:n,lastModified:s,handle:e,appName:o,issueCount:r,lastOpenedAt:lr()};await Ge(We(a,"readwrite").put(l));const c=await Ge(We(a,"readonly").getAll());if(c.length>zs){c.sort((f,i)=>f.lastOpenedAt-i.lastOpenedAt);const d=c.slice(0,c.length-zs);for(const f of d)await Ge(We(a,"readwrite").delete(f.id))}return l}finally{a.close()}}async function Gc(){const e=await Rt();try{return(await Ge(We(e,"readonly").getAll())).sort((n,s)=>s.lastOpenedAt-n.lastOpenedAt)}finally{e.close()}}async function Uc(e){const t=await Rt();try{const n=await Ge(We(t,"readonly").get(e));if(!n)return;n.lastOpenedAt=lr(),await Ge(We(t,"readwrite").put(n))}finally{t.close()}}async function dr(e){const t=await Rt();try{await Ge(We(t,"readwrite").delete(e))}finally{t.close()}}async function Ps(e){const t=await Rt();try{const n=await Ge(We(t,"readonly").get(e));return n?n.handle:null}finally{t.close()}}async function Bs(e,t="read"){if(!e)return!1;const n=e,s={mode:t};return await n.queryPermission(s)==="granted"?!0:await n.requestPermission(s)==="granted"}const Hc=new Set(["local-server-unavailable","upstream-unreachable","application-not-found","access-or-upstream-failure","invalid-event-log"]),qc=[/^application_\d+_\d+$/,/^local-\d+$/,/^app-[A-Za-z0-9][A-Za-z0-9._-]*$/,/^spark-[A-Za-z0-9][A-Za-z0-9._~-]*$/,/^driver-\d+$/],Vc=/^(?!\.{1,2}$)[A-Za-z0-9][A-Za-z0-9._~-]*$/;function mn(e){return typeof e=="string"?e.trim():""}function Yc(e){const t=mn(e);if(!t||t.includes("?")||t.includes("#"))return null;let n;try{n=new URL(t)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.search||n.hash?null:(n.pathname=`${n.pathname.replace(/\/+$/,"")}/`,n.toString())}function Jc(e){return qc.some(t=>t.test(e))}function Kc(e){return Vc.test(e)}function Xc({baseUrl:e="",appId:t="",attemptId:n=""}={}){const s=Yc(e),o=mn(t),r=mn(n),a={baseUrl:s?null:"Enter an absolute HTTP(S) base URL without credentials, query, or fragment.",appId:Jc(o)?null:"Enter a supported Spark application ID.",attemptId:!r||Kc(r)?null:"Enter a URL-path-safe attempt ID."};return a.baseUrl||a.appId||a.attemptId?{request:null,errors:a}:{request:{baseUrl:s,appId:o,attemptId:r||null},errors:a}}function Ds(e){return e?.request!=null}function Zc(e){return typeof e=="string"&&Hc.has(e)}const oe={current:null},nn={current:null};function Pn(e={}){const t=e.makeClient??_l,n=v.useCallback(async b=>{const x=z.getState().taskDataCache.get(b);if(x)return x;const y=await oe.current.requestTaskData(b);return z.getState().setTaskData(b,y),y},[]),s=v.useCallback(async(b=0)=>{const x=z.getState().appModel,y=us(x,{skippedLines:b});z.getState().setEvidenceAvailability(y);const w=js(x.app,x.stages,x.executors.added,x.executors.removed,x.jobs,x.sql,x.runAggregates);z.getState().setCatalog(w),z.getState().setConfigFindings(en(x.app)),z.getState().setSkippedLines(b),z.getState().setStatus("ready");const C=[...new Set(w.map(j=>j.stageId).filter(j=>j!=null))],k=await oe.current.prefetchFlaggedStages(C);for(const{stageId:j,metrics:S,fieldNames:_}of k)z.getState().setTaskData(j,{metrics:S,fieldNames:_});const R=nn.current;if(R?.handle){const j=new Set(w.map(S=>S.stageId??`app:${S.type}`)).size;await cr({handle:R.handle,name:R.name,size:R.size,lastModified:R.lastModified,appName:x.app?.name??null,issueCount:j})}},[]),o=v.useCallback(()=>{const b=z.getState();b.activeFileId!=null&&b.appModel.app&&b.sessionCache.set(b.activeFileId,rn(b.appModel,b.catalog,b.taskDataCache))},[]),r=v.useCallback(b=>(oe.current?.terminate(),z.getState().resetModel(),z.getState().setStatus("parsing"),z.getState().setActiveFile(null),nn.current=null,oe.current=t(),bs(z.getState().appModel,{onProgress:x=>z.getState().setParse({pct:x.pct??0,lines:x.linesProcessed??0,etaMs:x.etaMs??null}),onDone:x=>{s(x?.skippedLines??0)},onError:x=>{b?b(x):z.getState().setError(String(x?.message??x))}})),[t,s]),a=v.useCallback((b,x)=>{const y=r(),w=x?.id??ut(b.name,b.size,b.lastModified);z.getState().setActiveFile(w),x?.handle&&(nn.current={handle:x.handle,name:b.name,size:b.size,lastModified:b.lastModified}),oe.current.startParse(b,y)},[r]),l=v.useCallback(b=>{const x=r();oe.current.startParseFiles(Array.from(b),x)},[r]),c=v.useCallback((b,x)=>{const y=r(w=>{if(z.getState().setShsParsing(!1),w?.source==="shs"&&Zc(w.code)){z.getState().resetModel(),x(w);return}z.getState().setError(String(w?.message??w))});z.getState().setShsParsing(!0),oe.current.startParseFromUrl(b,y)},[r]),d=v.useCallback(()=>{o(),oe.current?.terminate(),z.getState().resetModel(),z.getState().setStatus("idle")},[o]),f=v.useCallback(async(b,x)=>{const y=z.getState();if(b===y.activeFileId)return"noop";const w=y.sessionCache.get(b);if(w){o(),oe.current?.terminate(),oe.current=null;const j=fs(y.appModel,y.taskDataCache,w);return z.getState().setCatalog(j),z.getState().setConfigFindings(en(y.appModel.app)),z.getState().setActiveFile(b),z.getState().setStatus("ready"),await Uc(b),"restored"}const C=x??await Ps(b);if(!C||!await Bs(C))return"gone";let R;try{R=await C.getFile()}catch(j){return j instanceof DOMException&&(j.name==="NotFoundError"||j.name==="NotAllowedError")&&(await dr(b).catch(()=>{}),y.sessionCache.delete(b)),"gone"}return o(),a(R,{handle:C,id:b}),"started"},[a,o]),i=v.useCallback((b,x)=>{const y=z.getState().sessionCache,w=y.get(b),C=y.get(x);return!w||!C?null:{baseline:{label:xs(b),snapshot:w},candidate:{label:xs(x),snapshot:C}}},[]),p=v.useCallback(async(b,x)=>{if(b.kind==="file")return{start:k=>oe.current.startParse(b.file,k)};if(b.kind==="folder")return{start:k=>oe.current.startParseFiles(b.files,k)};if(b.kind==="url")return{start:k=>oe.current.startParseFromUrl(b.request,k)};const y=b.handle??await Ps(b.id);if(!y)return z.getState().setError(`Run ${x}: this recent file is no longer available.`),null;if(!await Bs(y))return z.getState().setError(`Run ${x}: permission to read this file was denied.`),null;let C;try{C=await y.getFile()}catch{return z.getState().setError(`Run ${x}: this recent file could not be read.`),null}return{start:k=>oe.current.startParse(C,k)}},[]),h=v.useCallback((b,x=0)=>{const y=z.getState().appModel;z.getState().setEvidenceAvailability(us(y,{skippedLines:x}));const w=z.getState().appModel,C=js(w.app,w.stages,w.executors.added,w.executors.removed,w.jobs,w.sql,w.runAggregates);z.getState().sessionCache.set(b,rn(w,C,z.getState().taskDataCache))},[]),m=v.useCallback((b,x)=>{const y=(C,k)=>{oe.current?.terminate(),z.getState().setCompareLoad(null),z.getState().setComparisonActive(!1);const R=k?.message??String(k);z.getState().setError(`Run ${C}: ${R}`)},w=async(C,k,R)=>{oe.current?.terminate(),z.getState().resetModel(),z.getState().setActiveFile(C.id),z.getState().setCompareLoad({current:k==="A"?1:2}),oe.current=t();const j=await p(C,k);if(!j){oe.current?.terminate(),z.getState().setCompareLoad(null),z.getState().setComparisonActive(!1);return}const S=bs(z.getState().appModel,{onProgress:_=>z.getState().setParse({pct:_.pct??0,lines:_.linesProcessed??0,etaMs:_.etaMs??null}),onDone:_=>R(_?.skippedLines??0),onError:_=>y(k,_)});j.start(S)};w(b,"A",C=>{h(b.id,C),w(x,"B",k=>{h(x.id,k),z.getState().setCompareLoad(null),z.getState().setActiveFile(null),z.getState().openComparison(b.id,x.id)})})},[t,p,h]),g=v.useCallback(b=>{const x=z.getState(),y=x.sessionCache.get(b);if(!y)return;oe.current?.terminate(),oe.current=null;const w=fs(x.appModel,x.taskDataCache,y);z.getState().setCatalog(w),z.getState().setConfigFindings(en(x.appModel.app)),z.getState().setActiveFile(b),z.getState().setStatus("ready"),z.getState().setComparisonActive(!1)},[]);return{startLoad:a,startLoadFolder:l,startLoadFromUrl:c,resetToDropZone:d,getTaskData:n,pickRecent:f,prepareComparison:i,startCompareLoad:m,drillIntoRun:g}}function Bn(e){return String(e).toLowerCase().replace(/\b[0-9a-f]{8,}\b/g,"#").replace(/\d+/g,"#").replace(/\s+/g," ").trim()}function ur(e,t=0){let n=3735928559^t,s=1103547991^t;for(let o=0;o<e.length;o++){const r=e.charCodeAt(o);n=Math.imul(n^r,2654435761),s=Math.imul(s^r,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&s)+(n>>>0)).toString(16)}function Qc(e){if(!e)return null;function t(n){const s=(n.children??[]).map(t).sort();return ur(JSON.stringify([Bn(n.name??""),zn(n.detail??""),s]))}return t(e)}function ed(e,t){const n=e.sqlExecutionId;if(n==null)return"";const s=t.sql.get(n)?.planTree??null;if(!s)return"";const o=[];return(function r(a){a.stageIds?.includes(e.id)&&o.push(JSON.stringify([Bn(a.name??""),zn(a.detail??"")]));for(const l of a.children??[])r(l)})(s),o.length===0?Qc(s)??"":ur(JSON.stringify(o.sort()))}function td(e,t){return Bn(e.name??"")+"§"+ed(e,t)}function Ls(e){const t=new Map;for(const[n,s]of e.stages){const o=td(s,e),r=t.get(o);r?r.push(n):t.set(o,[n])}return t}function nd(e,t){const n=Ls(e),s=Ls(t),o=[],r=new Set,a=new Set;for(const d of[n,s])for(const[f,i]of d)i.length>1&&a.add(f);for(const d of[...n.keys()].sort()){const f=s.get(d);if(!f)continue;const i=n.get(d);if(i.length!==f.length)continue;const p=[...i].sort((m,g)=>m-g),h=[...f].sort((m,g)=>m-g);for(let m=0;m<p.length;m++)o.push({identity:d,baseId:p[m],candId:h[m]});r.add(d)}const l=e.stages.size+t.stages.size,c=l===0?1:2*o.length/l;return{pairs:o,matchedIdentities:r,collisionIdentities:a,coverage:c}}function _s(e){if(e.length===0)return null;const t=[...e].sort((s,o)=>s-o),n=Math.ceil(.95*t.length)-1;return t[Math.min(t.length-1,Math.max(0,n))]}function Oe(e,t){let n=0,s=!1;for(const o of e){const r=o[t];Number.isFinite(r)&&(n+=r,s=!0)}return{sum:n,present:s}}function hn(e){const t=(e.completedAt??0)-(e.submittedAt??0);return t>0&&Number.isFinite(e.taskDurationMax)?e.taskDurationMax/t:null}function $s(e){const t=[];for(const n of e){const s=hn(n);s!=null&&t.push(s)}return t}const fr=new Set(["inputBytes","outputBytes","taskCount","executorsAdded"]);function sd(e,t,n){if(t==null||n==null)return"unavailable";if(fr.has(e))return n===t?"unchanged":"neutral";const s=n-t;return s<0?"improvement":s>0?"regression":"unchanged"}function lt(e,t,n,s,o={}){const r=sd(e,n,s),a=n==null||s==null?null:s-n;return{key:e,label:t,baseline:n,candidate:s,delta:a,direction:r,...o}}function od(e,t){const n=[];n.push(lt("wallClock","Wall-clock duration",ws(e.app,e.stages).total,ws(t.app,t.stages).total));const s=Oe([...e.stages.values()],"memoryBytesSpilled"),o=Oe([...t.stages.values()],"memoryBytesSpilled");n.push(lt("shuffleSpill","Shuffle spill",s.present?s.sum:null,o.present?o.sum:null,{unavailableReason:s.present&&o.present?void 0:"No shuffle-spill data recorded for a run"}));const r=_s($s([...e.stages.values()])),a=_s($s([...t.stages.values()]));n.push(lt("taskSkew","Task skew (p95)",r,a,{unavailableReason:r!=null&&a!=null?void 0:"No stage had measurable duration for a run"}));const l=Oe([...e.stages.values()],"taskCount"),c=Oe([...t.stages.values()],"taskCount"),d=Oe([...e.stages.values()],"failedTasks"),f=Oe([...t.stages.values()],"failedTasks"),i=l.present&&l.sum>0&&d.present?d.sum/l.sum:null,p=c.present&&c.sum>0&&f.present?f.sum/c.sum:null;n.push(lt("failedTaskRate","Failed-task rate",i,p,{unavailableReason:i!=null&&p!=null?void 0:"No task or failure counts recorded for a run"}));const h=(x,y,w,C)=>{const k=Oe([...e.stages.values()],w),R=Oe([...t.stages.values()],w);n.push(lt(x,y,k.present?k.sum:null,R.present?R.sum:null,{unavailableReason:k.present&&R.present?void 0:C}))};h("diskSpill","Disk spill","diskBytesSpilled","No disk-spill data recorded for a run"),h("gcTime","GC time","jvmGCTime","No GC-time data recorded for a run"),h("inputBytes","Input read","inputBytes","No input-bytes data recorded for a run"),h("outputBytes","Output written","outputBytes","No output-bytes data recorded for a run"),h("executorRunTime","Executor run-time","executorRunTime","No executor run-time recorded for a run"),h("taskCount","Task count","taskCount","No task counts recorded for a run");const m=x=>Array.isArray(x.executors?.added)?x.executors.added.length:null,g=m(e),b=m(t);return n.push(lt("executorsAdded","Executors added",g,b,{unavailableReason:g!=null&&b!=null?void 0:"No executor events recorded for a run"})),n}function rd(e,t){const n=l=>{const c=new Map;for(const d of l.catalog){const f=typeof d.rule=="string"?d.rule:d.type,i=d.impactBand??"unknown",p=`${f}§${i}`,h=c.get(p)??{rule:f,impactBand:i,count:0,stages:new Set};h.count++;const m=d.stageId!=null?l.stages.get(d.stageId):null;m?.name&&h.stages.add(m.name),c.set(p,h)}return c},s=n(e),o=n(t),r=[],a=[];for(const l of[...new Set([...s.keys(),...o.keys()])].sort()){const c=s.get(l),d=o.get(l),f=c?.count??0,i=d?.count??0;if(i===f)continue;const p=d??c,h=i>f?d:c,m={rule:p.rule,impactBand:p.impactBand,baseCount:f,candCount:i,delta:i-f,stages:[...h.stages].sort()};(i>f?r:a).push(m)}return{introduced:r,resolved:a}}function ad(e,t){return e?.name!=null&&t?.name!=null&&e.name!==t.name}function id(e,t,n){return n.pairs.map(s=>{const o=hn(e.stages.get(s.baseId)),r=hn(t.stages.get(s.candId));return{identity:s.identity,baseId:s.baseId,candId:s.candId,baseline:o,candidate:r,delta:o!=null&&r!=null?r-o:null}}).sort((s,o)=>s.identity<o.identity?-1:s.identity>o.identity?1:0)}function ld(e){const t=s=>Number.isFinite(s)?s:null,n=(e.completedAt??0)-(e.submittedAt??0);return{duration:n>0?n:null,memoryBytesSpilled:t(e.memoryBytesSpilled),diskBytesSpilled:t(e.diskBytesSpilled),jvmGCTime:t(e.jvmGCTime),inputBytes:t(e.inputBytes),outputBytes:t(e.outputBytes),executorRunTime:t(e.executorRunTime),taskCount:t(e.taskCount),failedTasks:t(e.failedTasks)}}function Fs(e){return[...e.stages].map(([t,n])=>({id:t,name:n.name??`Stage ${t}`,metrics:ld(n)}))}function cd(e,t){const n=e.snapshot,s=t.snapshot,o=nd(n,s),r=ad(n.app,s.app);return{baselineLabel:e.label,candidateLabel:t.label,confidence:r?"low":"ok",reason:r?"Run names differ, so deltas may compare different work.":null,matchedCoverage:o.coverage,metrics:od(n,s),findings:rd(n,s),stageSkew:id(n,s,o),baseStages:Fs(n),candStages:Fs(s)}}const Os=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ws=mo,qt=(e,t)=>n=>{var s;if(t?.variants==null)return Ws(e,n?.class,n?.className);const{variants:o,defaultVariants:r}=t,a=Object.keys(o).map(d=>{const f=n?.[d],i=r?.[d];if(f===null)return null;const p=Os(f)||Os(i);return o[d][p]}),l=n&&Object.entries(n).reduce((d,f)=>{let[i,p]=f;return p===void 0||(d[i]=p),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,f)=>{let{class:i,className:p,...h}=f;return Object.entries(h).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...r,...l}[g]):{...r,...l}[g]===b})?[...d,i,p]:d},[]);return Ws(e,a,c,n?.class,n?.className)},pr=qt("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none cursor-pointer focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ge({className:e,variant:t="default",size:n="default",...s}){return u.jsx(ia,{"data-slot":"button",className:J(pr({variant:t,size:n,className:e})),...s})}const dd="docs/tuning-reference";function ud(e){return e.startsWith("metric-")?"metrics":e.startsWith("config-")?"config":e==="bottleneck-stage-shape"?"bottleneck-skew":e==="bottleneck-stage-slowness"?"bottleneck-slow-host":e}function gt(e){const t=String(e).replace(/^#/,"");return`${dd}/${ud(t)}.html#${encodeURIComponent(t)}`}const fd={"task-duration":"#metric-task-duration","shuffle-read-bytes":"#metric-shuffle-read-bytes","shuffle-write-bytes":"#metric-shuffle-write-bytes","memory-bytes-spilled":"#metric-memory-bytes-spilled","disk-bytes-spilled":"#metric-disk-bytes-spilled","jvm-gc-time":"#metric-jvm-gc-time",gcpct:"#metric-gcpct","executor-run-time":"#metric-executor-run-time","fetch-wait-time-ratio":"#metric-fetch-wait-time-ratio","input-bytes":"#metric-input-bytes","output-bytes":"#metric-output-bytes","io-ratio":"#metric-io-ratio","peak-execution-memory":"#metric-peak-execution-memory","failed-tasks":"#metric-failed-tasks","speculative-tasks":"#metric-speculative-tasks","first-stage-submitted-at":"#metric-first-stage-submitted-at","executor-count":"#metric-executor-count","stage-duration":"#metric-stage-duration"},pd=new Set(["#intro","#spark-architecture","#memory-model","#partitioning","#joins","#shuffle","#data-formats","#table-formats","#caching","#pyspark","#aqe","#cluster-config","#anti-patterns","#metrics","#config","#bottleneck-cold-start","#bottleneck-failures","#bottleneck-gc","#bottleneck-job-failure-rate","#bottleneck-retry-waste","#bottleneck-shuffle","#bottleneck-skew","#bottleneck-slow-host","#bottleneck-spill","#bottleneck-straggler","#bottleneck-tiny-tasks","#bottleneck-utilization","#bottleneck-memory-utilization","#bottleneck-broadcast-sizing","#bottleneck-duplicate-plan-subtree","#bottleneck-small-files","#bottleneck-stage-shape","#bottleneck-stage-slowness","#config-autoscale-bounds","#config-memory-overhead","#config-serializer","#config-shuffle-service",...Object.values(fd)]);function mr(e){return pd.has(String(e))}const md={underBroadcast:"broadcastSizing",overBroadcast:"broadcastSizing"};let kt;function hd(){if(!kt){kt=new Map;for(const e of nr()){const t=kt.get(e.type)??new Set;t.add(e.docAnchor),kt.set(e.type,t)}}return kt}function gd(e){const t=md[e]??e,n=hd().get(t)??new Set;if(n.size!==1)return;const[s]=n;return s&&mr(s)?s:void 0}function bd({entries:e,activeId:t=null,onPick:n,onRemove:s}){return e.length?u.jsx("ul",{className:"flex flex-col gap-0.5",children:e.map(o=>{const r=o.appName||o.name,a=o.issueCount!=null?` · ${o.issueCount} issue${o.issueCount===1?"":"s"}`:"";return u.jsxs("li",{className:J("flex items-center gap-1 rounded-md",o.id===t&&"bg-accent"),children:[u.jsxs("button",{type:"button",className:"tap-target-comfortable flex min-w-0 flex-1 cursor-pointer flex-col items-start gap-0.5 rounded-md px-1.5 py-1 text-left hover:bg-muted",onClick:()=>n?.(o.id),children:[u.jsx("span",{className:"w-full truncate text-sm font-medium",children:r}),u.jsxs("span",{className:"w-full truncate text-xs text-muted-foreground",children:[o.name," · ",ne(o.size),a]})]}),u.jsx(ge,{type:"button",variant:"ghost",size:"icon",className:"tap-target-comfortable","aria-label":"Remove from recent files",onClick:()=>s?.(o.id),children:u.jsx(Fo,{"aria-hidden":"true"})})]},o.id)})}):u.jsx("p",{className:"px-1.5 py-1 text-sm text-muted-foreground",children:"No recent files yet"})}function xd(e,t){const n=a=>a.match(/(\d+)|(\D+)/g)??[a],s=n(e),o=n(t),r=Math.max(s.length,o.length);for(let a=0;a<r;a++){const l=s[a]??"",c=o[a]??"";if(l===c)continue;const d=Number(l),f=Number(c);return!Number.isNaN(d)&&!Number.isNaN(f)?d-f:l<c?-1:1}return 0}function vd(e){const n=e.filter(d=>!d.toLowerCase().startsWith("appstatus")).filter(d=>/^events_\d+_/.test(d)),s=d=>parseInt(d.match(/^events_(\d+)_/)[1],10),o=n.filter(d=>d.endsWith(".compact")).map(s),r=o.length>0?Math.max(...o):-1,l=n.filter(d=>{const f=s(d);return d.endsWith(".compact")?f===r:f>r}).sort(xd),c=l.map(s);for(let d=1;d<c.length;d++)if(c[d]!==c[d-1]+1)throw new Error(`Rolling event-log directory is missing file(s) between index ${c[d-1]} and ${c[d]}.`);return l}const yd={"local-server-unavailable":"The local server is unavailable. Start local-server mode, then try again.","upstream-unreachable":"The History Server could not be reached. Check the address and try again.","application-not-found":"The requested application was not found. Check the application and attempt IDs.","access-or-upstream-failure":"The History Server could not provide this event log. Check access and try again.","invalid-event-log":"The response did not contain a supported event log. Choose a local file or try another application."};async function wd(e){const t=e.createReader(),n=[];for(;;){const o=await new Promise((r,a)=>t.readEntries(r,a));if(o.length===0)break;n.push(...o)}const s=n.filter(o=>o.isFile);return Promise.all(s.map(o=>new Promise((r,a)=>o.file(r,a))))}function hr({onPick:e,compact:t=!1}={}){const{startLoad:n,startLoadFolder:s,startLoadFromUrl:o,pickRecent:r}=Pn(),a=se(I=>I.shsParsing),l=v.useRef(null),c=v.useRef(null),[d,f]=v.useState(!1),[i,p]=v.useState([]),[h,m]=v.useState(""),[g,b]=v.useState(""),[x,y]=v.useState(""),[w,C]=v.useState(!1),[k,R]=v.useState(!1),[j,S]=v.useState({baseUrl:!1,appId:!1,attemptId:!1}),[_,te]=v.useState(null),L=v.useRef(null),D=Xc({baseUrl:h,appId:g,attemptId:x}),P=k||a,W=w||a;v.useEffect(()=>{_&&L.current?.focus()},[_]);const U=v.useCallback(()=>{Gc().then(I=>p(I)).catch(()=>p([]))},[]);v.useEffect(()=>{U()},[U]);const B=v.useCallback(async()=>{if(As()){let I;try{[I]=await window.showOpenFilePicker()}catch{return}try{const A=await I.getFile();e?e({kind:"file",id:ut(A.name,A.size,A.lastModified),label:A.name,file:A,handle:I}):n(A,{handle:I})}catch{z.getState().setError("Could not read the selected file.")}return}l.current?.click()},[n,e]),q=v.useCallback(I=>{const A=I.map(X=>X.name);if(!A.some(X=>/^events_\d+_/.test(X))){z.getState().setError("This isn't a Spark rolling event-log directory. Choose file to load a single event log.");return}let Q;try{Q=vd(A)}catch(X){z.getState().setError(X.message);return}const le=new Map(I.map(X=>[X.name,X])),ue=Q.map(X=>le.get(X));if(e){const X=ue[0];e({kind:"folder",id:`folder:${X?.name??Q[0]}`,label:`${ue.length}-file rolling log`,files:ue});return}s(ue)},[s,e]),re=v.useCallback(I=>{const A=I.target.files?.[0];A&&(e?e({kind:"file",id:ut(A.name,A.size,A.lastModified),label:A.name,file:A}):n(A)),I.target.value=""},[n,e]),ae=v.useCallback(I=>{const A=Array.from(I.target.files??[]);A.length&&q(A),I.target.value=""},[q]),T=v.useCallback(async I=>{const A=I.dataTransfer.files[0],Q=I.dataTransfer.items?.[0],le=Q?.webkitGetAsEntry?.();if(le&&le.isDirectory){try{const ue=await wd(le);q(ue)}catch{z.getState().setError("Could not read the dropped folder.")}return}if(As()&&Q?.getAsFileSystemHandle)try{const ue=await Q.getAsFileSystemHandle();if(ue&&ue.kind==="file"){const X=await ue.getFile();e?e({kind:"file",id:ut(X.name,X.size,X.lastModified),label:X.name,file:X,handle:ue}):n(X,{handle:ue});return}}catch{z.getState().setError("Could not read the selected file.");return}A&&(e?e({kind:"file",id:ut(A.name,A.size,A.lastModified),label:A.name,file:A}):n(A))},[n,q,e]),ie=v.useCallback(I=>{I.preventDefault(),f(!1),T(I)},[T]),Ce=v.useCallback(async I=>{const A=i.find(le=>le.id===I);if(e){e({kind:"recent",id:I,label:A?.appName||A?.name||I,handle:A?.handle});return}const Q=await r(I,A?.handle);(Q==="restored"||Q==="gone")&&U()},[i,r,U,e]),F=v.useCallback(I=>{const A=i.find(Q=>Q.id===I);dr(I).catch(()=>{}).finally(U),A&&Fi(`Removed "${A.appName||A.name}" from recent files`,{action:{label:"Undo",onClick:()=>{cr(A).catch(()=>{}).finally(U)}}})},[i,U]),Y=v.useCallback((I,A)=>{I==="baseUrl"&&m(A),I==="appId"&&b(A),I==="attemptId"&&y(A),te(null)},[]),$=v.useCallback(I=>{S(A=>({...A,[I]:!0}))},[]),G=v.useCallback(I=>{I.preventDefault(),S({baseUrl:!0,appId:!0,attemptId:!0}),te(null);const A=D.request;if(!(!Ds(D)||!A)){if(e){const Q=A.attemptId?`${A.appId}/${A.attemptId}`:A.appId;e({kind:"url",id:Q,label:Q,request:A});return}o(A,Q=>{te(Q.code)})}},[D,o,e]),K=I=>j[I]?D.errors[I]:null,V=u.jsxs("section",{className:"landing-history-server w-full text-left",children:[u.jsx("button",{type:"button",className:"tap-target-comfortable w-full cursor-pointer rounded-md border border-border px-3 py-2 text-left text-sm font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-expanded":P,"aria-controls":"shs-fetch-panel",onClick:()=>R(I=>!I),children:"Fetch from Spark History Server"}),P?u.jsxs("div",{id:"shs-fetch-panel",className:"mt-3 rounded-md border border-border p-4",children:[u.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"Requires local-server mode and a History Server reachable from this machine."}),u.jsxs("form",{onSubmit:G,className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[u.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Base URL",u.jsx("input",{type:"text",value:h,onChange:I=>Y("baseUrl",I.target.value),onBlur:()=>$("baseUrl"),placeholder:"http://history-server:18080","aria-label":"Spark History Server base URL","aria-invalid":!!K("baseUrl"),"aria-describedby":K("baseUrl")?"shs-base-url-error":void 0,className:"tap-target-input rounded-md border border-input bg-background px-2 py-1 text-sm text-foreground"}),K("baseUrl")?u.jsx("span",{id:"shs-base-url-error",className:"text-destructive",children:K("baseUrl")}):null]}),u.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Application ID",u.jsx("input",{type:"text",value:g,onChange:I=>Y("appId",I.target.value),onBlur:()=>$("appId"),placeholder:"application_1234567890_0001","aria-label":"Application ID","aria-invalid":!!K("appId"),"aria-describedby":K("appId")?"shs-app-id-error":void 0,className:"tap-target-input rounded-md border border-input bg-background px-2 py-1 text-sm text-foreground"}),K("appId")?u.jsx("span",{id:"shs-app-id-error",className:"text-destructive",children:K("appId")}):null]}),u.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Attempt ID (optional)",u.jsx("input",{type:"text",value:x,onChange:I=>Y("attemptId",I.target.value),onBlur:()=>$("attemptId"),placeholder:"2","aria-label":"Attempt ID (optional)","aria-invalid":!!K("attemptId"),"aria-describedby":K("attemptId")?"shs-attempt-id-error":void 0,className:"tap-target-input rounded-md border border-input bg-background px-2 py-1 text-sm text-foreground"}),K("attemptId")?u.jsx("span",{id:"shs-attempt-id-error",className:"text-destructive",children:K("attemptId")}):null]})]}),a?u.jsx("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:"Fetching event log…"}):null,_?u.jsxs("p",{ref:L,role:"alert",tabIndex:-1,className:"text-sm text-destructive",children:[yd[_]," ","Edit the fields, review ",u.jsx("a",{href:gt("#intro"),target:"_blank",rel:"noopener noreferrer",className:"tap-target-comfortable text-primary underline-offset-4 hover:underline",children:"Local-server setup"}),", or choose a local file."]}):null,u.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[u.jsx(ge,{type:"submit",className:"tap-target-comfortable",disabled:!Ds(D)||a,children:"Fetch"}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"Application IDs: application_…, local-…, app-…, spark-…, or driver-…"})]})]})]}):null]});return u.jsxs("div",{"data-testid":"drop-zone",role:"region","aria-label":"Drop Spark event log file here",className:J("mx-auto flex w-full flex-col items-center justify-center gap-6 rounded-xl border-2 border-dashed border-border p-6 text-center transition-colors",t?"max-w-full":"landing-drop-zone max-w-none p-6 sm:p-8",d&&"border-primary bg-primary/5"),onDragOver:I=>{I.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:ie,children:[u.jsx(zl,{"aria-hidden":"true",className:"size-10 text-primary"}),u.jsxs("div",{children:[u.jsx("p",{className:"font-heading text-lg font-semibold",children:"Choose a Spark event log"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Drop an event log file here, or choose a file below."}),u.jsx("p",{className:"mt-1 max-w-xl text-xs text-muted-foreground",children:"Accepts a Spark event log file: newline-delimited JSON, one event per line, optionally gzip/Zstandard/LZ4/Snappy-compressed."})]}),u.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:u.jsx(ge,{type:"button",className:"tap-target-comfortable",onClick:()=>{B()},children:"Choose file"})}),u.jsx("input",{ref:l,type:"file",className:"hidden","data-testid":"file-input","aria-label":"Choose file",onChange:re}),u.jsx("input",{ref:c,type:"file",className:"hidden","data-testid":"folder-input","aria-label":"Choose rolling log folder",onChange:ae,webkitdirectory:"true",directory:"true"}),t?u.jsxs(u.Fragment,{children:[u.jsx(ge,{type:"button",variant:"outline",className:"tap-target-comfortable",onClick:()=>c.current?.click(),children:"Choose rolling-log folder"}),u.jsx("div",{className:"w-full max-w-2xl",children:V})]}):u.jsxs("section",{className:"landing-other-sources w-full max-w-2xl text-left",children:[u.jsx("button",{type:"button",className:"tap-target-comfortable w-full cursor-pointer rounded-md border border-border px-3 py-2 text-left text-sm font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-expanded":W,"aria-controls":"other-sources-panel",onClick:()=>C(I=>!I),children:"Other sources"}),W?u.jsxs("div",{id:"other-sources-panel",className:"mt-3 flex flex-col gap-3 rounded-md border border-border p-4",children:[u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Use these for a rolling ",u.jsx("code",{children:"eventlog_v2_*"})," directory or to fetch an application from a local Spark History Server."]}),u.jsx("div",{children:u.jsx(ge,{type:"button",variant:"outline",className:"tap-target-comfortable",onClick:()=>c.current?.click(),children:"Choose rolling-log folder"})}),V]}):null]}),i.length>0&&u.jsxs("div",{className:"w-full max-w-md text-left",children:[u.jsx("p",{className:"mb-1 px-1.5 text-xs font-medium tracking-wide text-muted-foreground uppercase",children:"Recent files"}),u.jsx(bd,{entries:i,onPick:I=>{Ce(I)},onRemove:F})]})]})}const kd=qt("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function gr({className:e,variant:t="default",render:n,...s}){return la({defaultTagName:"span",props:ca({className:J(kd({variant:t}),e)},s),render:n,state:{slot:"badge",variant:t}})}function Sd(e){return`docs/user-guide/understanding-findings.html#${Tn(e).toLowerCase()}`}const Gs="#intro",Dn=v.createContext(null);function Cd({children:e}){const[t,n]=v.useState(!1),[s,o]=v.useState({kind:"site",source:"reference",path:gt(Gs)}),r=v.useCallback((d=Gs)=>{o({kind:"site",source:"reference",path:gt(d)}),n(!0)},[]),a=v.useCallback(d=>{o({kind:"site",source:"guide",path:d}),n(!0)},[]),l=v.useCallback(()=>n(!1),[]),c=v.useMemo(()=>({open:r,openSite:a,close:l,isOpen:t,target:s}),[r,a,l,t,s]);return u.jsx(Dn.Provider,{value:c,children:e})}function br(){const e=v.useContext(Dn);if(!e)throw new Error("useDocs outside DocsProvider");return e}function Md(){return v.useContext(Dn)}function Cf({anchor:e,children:t}){const{open:n}=br();return mr(e)?u.jsx("a",{href:gt(e),className:"text-primary underline-offset-4 hover:underline",onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),n(e))},children:t}):null}const Id={INCMP:{expansion:"Incomplete run",description:"This event log never recorded an application-end event, so other findings and metrics reflect only what was captured."},SKEW:{expansion:"Task skew",description:"A small number of tasks take much longer than their peers."},SHFL:{expansion:"Shuffle I/O",description:"Tasks are moving a large amount of intermediate data between stages."},SPILL:{expansion:"Memory and disk spill",description:"Tasks are writing data out of memory, which slows execution."},GC:{expansion:"Garbage collection pressure",description:"Tasks are spending an unusually large share of time reclaiming memory."},COLD:{expansion:"Executor cold start",description:"New executors are taking time to become available for work."},UTIL:{expansion:"Low utilization",description:"Allocated executors are idle for a large share of the application run."},MEM:{expansion:"Memory utilization",description:"Executor memory or core capacity may be over- or under-provisioned."},LOCAL:{expansion:"Core usage locality",description:"Tasks are running without process- or node-local data placement more than expected."},HOST:{expansion:"Slow host",description:"One executor is substantially slower than its peers."},FAIL:{expansion:"Failed tasks",description:"Tasks are failing often enough to affect the stage."},STRAG:{expansion:"Straggler tasks",description:"A few tasks are much slower than the rest of their stage."},SPEC:{expansion:"Speculation waste",description:"Speculative task attempts used a lot of executor time without confirming a genuine straggler."},RETRY:{expansion:"Retry waste",description:"Repeated task attempts are consuming avoidable execution time."},TINY:{expansion:"Tiny tasks",description:"Many very short tasks are adding scheduling overhead."},SFAIL:{expansion:"Failed stage",description:"A stage attempt failed outright."},PART:{expansion:"Partition sizing",description:"Shuffle partitions are too large, too uneven, or too few for the work."},SLOW:{expansion:"Stage slowness",description:"A stage is slow overall without a more specific diagnosed cause."},SHAPE:{expansion:"Stage shape",description:"The stage has an inefficient task count, output shape, or task-to-stage balance."},CACHE:{expansion:"Caching opportunity",description:"A reusable dataset may benefit from being persisted between stages."},CSTOR:{expansion:"Cache storage",description:"A persisted dataset is not fully cached in memory or is spilling to disk."},CHRN:{expansion:"Autoscaling churn",description:"Executors are being stood up and torn down again before they can do useful work."},JOBS:{expansion:"Job failure rate",description:"A large share of completed jobs did not succeed."},CFG:{expansion:"Configuration audit",description:"Configuration settings may cause reliability or efficiency problems."},PLAN:{expansion:"Plan advisor",description:"The SQL execution plan has a pattern worth reviewing."},BROADCASTSIZING:{expansion:"Broadcast sizing",description:"A broadcast join threshold or hint may be misconfigured for this query."}};function Rd({children:e}){return Ao()!=="advanced"?null:u.jsx(u.Fragment,{children:e})}const Td={critical:"bg-critical",warning:"bg-warning",info:"bg-info"},Mf={critical:"text-critical",warning:"text-warning",info:"text-info"},xr={critical:"border-critical",warning:"border-warning",info:"border-info"},jd=qt("inline-block size-2 shrink-0 rounded-full",{variants:{impactBand:{...Td,muted:"bg-muted-foreground"}},defaultVariants:{impactBand:"info"}}),gn=qt("gap-1.5 border-transparent",{variants:{impactBand:{critical:"bg-critical/10 text-critical",warning:"bg-warning/10 text-warning",info:"bg-info/10 text-info"}},defaultVariants:{impactBand:"info"}});function Ed({impactBand:e,className:t}){return u.jsx("span",{"aria-hidden":"true",className:J(jd({impactBand:e}),t)})}function Nd({type:e,impactBand:t,className:n,plainBadge:s}){const o=Md(),r=Ao(),a=Tn(e),l=Id[a],c=s?void 0:l?`${l.expansion}: ${l.description}`:void 0,d=s?void 0:gd(e),f=l?.expansion??a,i=!s&&r==="advanced",p=u.jsxs(gr,{title:c,className:J(gn({impactBand:t}),"h-6",i?J("rounded-r-none",n):n),render:d?u.jsx("a",{href:gt(d),onClick:m=>{!o||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey||m.button!==0||(m.preventDefault(),o.open(d))}}):void 0,children:[u.jsx(Ed,{impactBand:t}),a]});if(s)return p;const h=Sd(e);return u.jsxs("span",{className:"inline-flex items-center",children:[p,u.jsx(Rd,{children:u.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer","aria-label":`SparkForensics guide: ${f}`,title:`SparkForensics guide: ${f}`,onClick:m=>{!o||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey||m.button!==0||(m.preventDefault(),o.openSite(h))},className:J("tap-target-comfortable tap-target-comfortable--sm inline-flex h-6 shrink-0 items-center rounded-r-4xl border border-transparent py-0.5 pr-2 pl-1 text-xs font-medium whitespace-nowrap transition-colors",gn({impactBand:t}),n,"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"),children:u.jsx(Lo,{"aria-hidden":"true",className:"size-3"})})})]})}function If({label:e,impactBand:t,title:n,className:s}){return u.jsx(gr,{title:n,className:J(gn({impactBand:t}),"font-mono",s),children:e})}function vr({...e}){return u.jsx(da,{"data-slot":"collapsible",...e})}function yr({...e}){return u.jsx(ua,{"data-slot":"collapsible-trigger",...e})}function wr({className:e,...t}){return u.jsx(fa,{"data-slot":"collapsible-content",className:J("h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none",e),...t})}const zd="npx sparkforensics-mcp",Ad=`{
3
- "mcpServers": {
4
- "sparkforensics": {
5
- "command": "npx",
6
- "args": ["sparkforensics-mcp"]
7
- }
8
- }
9
- }`;function Pd(){return u.jsxs(vr,{className:"w-full",children:[u.jsx(yr,{className:J(pr({variant:"outline"}),"tap-target-comfortable"),children:"Use with an AI assistant (MCP)"}),u.jsxs(wr,{className:"mt-2 flex w-full flex-col gap-2 text-sm",children:[u.jsx("p",{className:"text-muted-foreground",children:"This project exposes an MCP server so an AI assistant can diagnose a run directly, without going through this web UI."}),u.jsx("pre",{"data-testid":"mcp-config-snippet",className:"overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre",children:zd}),u.jsx("p",{className:"text-muted-foreground",children:"Or, in an MCP client config:"}),u.jsx("pre",{className:"overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre",children:Ad})]})]})}const Bd="[data-shuffle-product-bar]";function Dd(){return document.querySelector(Bd)}function Ld({className:e,children:t}){const n=Dd();return n?pa.createPortal(u.jsx("div",{"data-shuffle-page-controls":!0,children:t}),n):u.jsx("div",{className:e,"data-shuffle-page-controls":!0,children:t})}function Us({message:e,nonce:t}){const n=v.useRef(null);return v.useEffect(()=>{n.current?.focus()},[e,t]),u.jsxs("div",{ref:n,role:"alert",tabIndex:-1,className:J("mb-4 flex items-start gap-3 rounded-lg border-l-4 bg-critical/10 p-4 text-sm text-foreground",xr.critical),children:[u.jsx($o,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-critical"}),u.jsx("p",{children:e})]})}const _d="docs/";function $d({label:e,onChange:t}){return u.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border p-4",children:[u.jsxs("span",{className:"min-w-0 truncate text-sm",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-2 text-clean",children:"✓"}),e]}),u.jsx(ge,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:t,children:"Change"})]})}function Hs({testId:e,ariaLabel:t,source:n,onPick:s,onChange:o}){return u.jsx("div",{"data-testid":e,"aria-label":t,className:"min-w-0 flex-1",children:n?u.jsx($d,{label:n.label,onChange:o}):u.jsx(hr,{onPick:s,compact:!0})})}function Fd({onClick:e}){return u.jsxs(ge,{type:"button",variant:"outline",className:"tap-target-comfortable",onClick:e,children:["Compare two runs ",u.jsx(Wt,{"aria-hidden":"true"})]})}function Od(){return u.jsxs("div",{className:"landing-resources","aria-label":"SparkForensics resources",children:[u.jsxs("a",{href:_d,target:"_blank",rel:"noopener noreferrer",className:"landing-resource-card",children:[u.jsx(Lo,{"aria-hidden":"true"}),u.jsxs("span",{children:[u.jsx("strong",{children:"Read the docs"}),u.jsx("span",{children:"How to load a log, read the board, and use every finding."})]}),u.jsx(Wt,{"aria-hidden":"true",className:"landing-resource-arrow"})]}),u.jsxs("a",{href:gt("#intro"),target:"_blank",rel:"noopener noreferrer",className:"landing-resource-card",children:[u.jsx(ll,{"aria-hidden":"true"}),u.jsxs("span",{children:[u.jsx("strong",{children:"Spark optimization reference"}),u.jsx("span",{children:"Architecture, memory, shuffle, and tuning notes behind every finding."})]}),u.jsx(Wt,{"aria-hidden":"true",className:"landing-resource-arrow"})]})]})}function Wd({onCompare:e}){return u.jsxs("section",{className:"landing-next-steps","aria-labelledby":"next-steps-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"landing-next-steps-label",children:"After your first run"}),u.jsx("h2",{id:"next-steps-title",children:"Go further with the evidence you already have."})]}),u.jsxs("div",{className:"landing-next-step-list",children:[u.jsxs("article",{children:[u.jsx(_o,{"aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("h3",{children:"Compare two runs"}),u.jsx("p",{children:"Use a baseline and candidate log to see which structurally matched stages changed."}),u.jsx(Fd,{onClick:e})]})]}),u.jsxs("article",{children:[u.jsx(Do,{"aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("h3",{children:"Use with an AI assistant"}),u.jsx("p",{children:"Connect MCP when you want an agent to inspect this evidence with you."}),u.jsx(Pd,{})]})]}),u.jsxs("article",{children:[u.jsx(Pl,{"aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("h3",{children:"Automate it in Airflow"}),u.jsx("p",{children:"Run this analysis after every Spark job with sparkforensics-operator instead of checking runs by hand."}),u.jsxs(ge,{variant:"outline",className:"tap-target-comfortable",nativeButton:!1,render:u.jsx("a",{href:"https://github.com/shuffle-works/sparkforensics-operator",target:"_blank",rel:"noopener noreferrer"}),children:["View sparkforensics-operator ",u.jsx(Wt,{"aria-hidden":"true"})]})]})]})]})]})}function Gd({errorMessage:e,errorNonce:t}={}){const{startCompareLoad:n}=Pn(),{theme:s,toggle:o}=Rn(),[r,a]=v.useState(!1),[l,c]=v.useState(null),[d,f]=v.useState(null);return r?u.jsxs("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Compare two runs"}),u.jsx(ge,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:()=>{a(!1),c(null),f(null)},children:"Cancel"})]}),u.jsx("p",{className:"landing-compare-intro",children:"Use Run A as the baseline and Run B as the candidate. Compare structurally matched stages to review material changes in a shared stage-level context."}),e?u.jsx(Us,{message:e,nonce:t}):null,u.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[u.jsxs("div",{children:[u.jsx("p",{className:"mb-2 text-sm font-medium text-muted-foreground",children:"Run A (baseline)"}),u.jsx(Hs,{testId:"compare-slot-a",ariaLabel:"Run A",source:l,onPick:c,onChange:()=>c(null)})]}),u.jsxs("div",{children:[u.jsx("p",{className:"mb-2 text-sm font-medium text-muted-foreground",children:"Run B (candidate)"}),u.jsx(Hs,{testId:"compare-slot-b",ariaLabel:"Run B",source:d,onPick:f,onChange:()=>f(null)})]})]}),u.jsx("div",{className:"flex justify-end",children:u.jsx(ge,{type:"button",className:"tap-target-comfortable",disabled:!l||!d,onClick:()=>{l&&d&&n(l,d)},children:"Compare"})})]}):u.jsxs("div",{className:"landing-shell mx-auto w-full max-w-6xl",children:[u.jsxs("section",{className:"landing-hero","aria-labelledby":"landing-title",children:[u.jsxs(Ld,{className:"landing-identity",children:[u.jsx(rl,{"aria-hidden":"true",className:"size-4"}),u.jsx("span",{children:"SparkForensics"}),u.jsxs("button",{type:"button",className:"theme-toggle tap-target-comfortable","aria-label":"Toggle theme","aria-pressed":s==="light",title:"Toggle theme",onClick:o,children:[u.jsx(jl,{"aria-hidden":"true",className:"theme-icon sun"}),u.jsx(Sl,{"aria-hidden":"true",className:"theme-icon moon"})]})]}),u.jsxs("div",{className:"landing-hero-copy",children:[u.jsx("p",{className:"landing-kicker",children:"Private by default"}),u.jsx("h2",{id:"landing-title",children:"Analyze a Spark event log."}),u.jsx("p",{children:"Read stages, timelines, shuffle reads, and executor behavior from the log Spark already produced."})]}),u.jsxs("div",{className:"landing-proof","aria-label":"SparkForensics guarantees",children:[u.jsxs("span",{children:[u.jsx(Rl,{"aria-hidden":"true"})," Nothing leaves your machine"]}),u.jsxs("span",{children:[u.jsx(Do,{"aria-hidden":"true"})," Bring your AI into the investigation"]}),u.jsxs("span",{children:[u.jsx(_o,{"aria-hidden":"true"})," Compare one run against another"]})]}),u.jsx(Od,{})]}),u.jsxs("section",{className:"landing-intake","aria-labelledby":"start-investigation-title",children:[u.jsx("div",{className:"landing-section-heading",children:u.jsx("div",{children:u.jsx("h2",{id:"start-investigation-title",children:"Analyze a single run first."})})}),e?u.jsx(Us,{message:e,nonce:t}):null,u.jsx(hr,{})]}),u.jsx(Wd,{onCompare:()=>a(!0)})]})}function Ud(e,t){const n=getComputedStyle(e),s=parseFloat(n.fontSize);return t*s}function Hd(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),s=parseFloat(n.fontSize);return t*s}function qd(e){return e/100*window.innerHeight}function Vd(e){return e/100*window.innerWidth}function Yd(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function St({groupSize:e,panelElement:t,styleProp:n}){let s;const[o,r]=Yd(n);switch(r){case"%":{s=o/100*e;break}case"px":{s=o;break}case"rem":{s=Hd(t,o);break}case"em":{s=Ud(t,o);break}case"vh":{s=qd(o);break}case"vw":{s=Vd(o);break}}return s}function xe(e){return parseFloat(e.toFixed(3))}function bt({group:e}){const{orientation:t,panels:n}=e;return n.reduce((s,o)=>(s+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,s),0)}function bn(e){const{panels:t}=e,n=bt({group:e});return n===0?t.map(s=>({groupResizeBehavior:s.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:s.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:s.panelConstraints.disabled,minSize:0,maxSize:100,panelId:s.id})):t.map(s=>{const{element:o,panelConstraints:r}=s;let a=0;if(r.collapsedSize!==void 0){const f=St({groupSize:n,panelElement:o,styleProp:r.collapsedSize});a=xe(f/n*100)}let l;if(r.defaultSize!==void 0){const f=St({groupSize:n,panelElement:o,styleProp:r.defaultSize});l=xe(f/n*100)}let c=0;if(r.minSize!==void 0){const f=St({groupSize:n,panelElement:o,styleProp:r.minSize});c=xe(f/n*100)}let d=100;if(r.maxSize!==void 0){const f=St({groupSize:n,panelElement:o,styleProp:r.maxSize});d=xe(f/n*100)}return{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:a,collapsible:r.collapsible===!0,defaultSize:l,disabled:r.disabled,minSize:c,maxSize:d,panelId:s.id}})}function Z(e,t="Assertion error"){if(!e)throw Error(t)}function xn(e,t){return Array.from(t).sort(e==="horizontal"?Jd:Kd)}function Jd(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Kd(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function kr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Sr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Xd({orientation:e,rects:t,targetRect:n}){const s={x:n.x+n.width/2,y:n.y+n.height/2};let o,r=Number.MAX_VALUE;for(const a of t){const{x:l,y:c}=Sr(s,a),d=e==="horizontal"?l:c;d<r&&(r=d,o=a)}return Z(o,"No rect found"),o}let Bt;function Zd(){return Bt===void 0&&(typeof matchMedia=="function"?Bt=!!matchMedia("(pointer:coarse)").matches:Bt=!1),Bt}function Cr(e){const{element:t,orientation:n,panels:s,separators:o}=e,r=xn(n,Array.from(t.children).filter(kr).map(m=>({element:m}))).map(({element:m})=>m),a=[];let l=!1,c=!1,d=-1,f=-1,i=0,p,h=[];{let m=-1;for(const g of r)g.hasAttribute("data-panel")&&(m++,g.hasAttribute("data-disabled")||(i++,d===-1&&(d=m),f=m))}if(i>1){let m=-1;for(const g of r)if(g.hasAttribute("data-panel")){m++;const b=s.find(x=>x.element===g);if(b){if(p){const x=p.element.getBoundingClientRect(),y=g.getBoundingClientRect();let w;if(c){const C=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),k=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(h.length){case 0:{w=[C,k];break}case 1:{const R=h[0],j=Xd({orientation:n,rects:[x,y],targetRect:R.element.getBoundingClientRect()});w=[R,j===x?k:C];break}default:{w=h;break}}}else h.length?w=h:w=[n==="horizontal"?new DOMRect(x.right,y.top,y.left-x.right,y.height):new DOMRect(y.left,x.bottom,y.width,y.top-x.bottom)];for(const C of w){let k="width"in C?C:C.element.getBoundingClientRect();const R=Zd()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(k.width<R){const S=R-k.width;k=new DOMRect(k.x-S/2,k.y,k.width+S,k.height)}if(k.height<R){const S=R-k.height;k=new DOMRect(k.x,k.y-S/2,k.width,k.height+S)}const j=m<=d||m>f;!l&&!j&&a.push({group:e,groupSize:bt({group:e}),panels:[p,b],separator:"width"in C?void 0:C,rect:k}),l=!1}}c=!1,p=b,h=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const b=o.find(x=>x.element===g);b?h.push(b):(p=void 0,h=[])}else c=!0}return a}class Mr{#e={};addListener(t,n){const s=this.#e[t];return s===void 0?this.#e[t]=[n]:s.includes(n)||s.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const s=this.#e[t];if(s!==void 0)if(s.length===1)s[0].call(null,n);else{let o=!1,r=null;const a=Array.from(s);for(let l=0;l<a.length;l++){const c=a[l];try{c.call(null,n)}catch(d){r===null&&(o=!0,r=d)}}if(o)throw r}}removeAllListeners(){this.#e={}}removeListener(t,n){const s=this.#e[t];if(s!==void 0){const o=s.indexOf(n);o>=0&&s.splice(o,1)}}}let pt={cursorFlags:0,state:"inactive"};const Ln=new Mr;function Ze(){return pt}function Qd(e){return Ln.addListener("change",e)}function eu(e){const t=pt,n={...pt};n.cursorFlags=e,pt=n,Ln.emit("change",{prev:t,next:n})}function mt(e){const t=pt;pt=e,Ln.emit("change",{prev:t,next:e})}const tu=e=>e,sn=()=>{},Ir=1,Rr=2,Tr=4,jr=8,qs=3,Vs=12;let Dt;function Ys(){return Dt===void 0&&(Dt=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Dt=!0)),Dt}function nu({cursorFlags:e,groups:t,state:n}){let s=0,o=0;switch(n){case"active":case"hover":t.forEach(r=>{if(!r.mutableState.disableCursor)switch(r.orientation){case"horizontal":{s++;break}case"vertical":{o++;break}}})}if(!(s===0&&o===0)){switch(n){case"active":{if(e&&Ys()){const r=(e&Ir)!==0,a=(e&Rr)!==0,l=(e&Tr)!==0,c=(e&jr)!==0;if(r)return l?"se-resize":c?"ne-resize":"e-resize";if(a)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return Ys()?s>0&&o>0?"move":s>0?"ew-resize":"ns-resize":s>0&&o>0?"grab":s>0?"col-resize":"row-resize"}}const Js=new WeakMap;function _n(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Js.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const s=Ze();switch(s.state){case"active":case"hover":{const o=nu({cursorFlags:s.cursorFlags,groups:s.hitRegions.map(a=>a.group),state:s.state}),r=`*, *:hover {cursor: ${o} !important; }`;if(t===r)return;t=r,o?n.cssRules.length===0?n.insertRule(r):n.replaceSync(r):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Js.set(e,{prevStyle:t,styleSheet:n})}let Ae=new Map;const Er=new Mr;function su(e){Ae=new Map(Ae),Ae.delete(e)}function Ks(e,t){for(const[n]of Ae)if(n.id===e)return n}function Ue(e,t){for(const[n,s]of Ae)if(n.id===e)return s;if(t)throw Error(`Could not find data for Group with id ${e}`)}function nt(){return Ae}function $n(e,t){return Er.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Le(e,t,n){const s=Ae.get(e);Ae=new Map(Ae),Ae.set(e,t),Er.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:s,next:t})}function Nr(e){const t=Ze();let n=!1;return t.state==="active"&&(mt({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(_n(e),n=!0,t.hitRegions.forEach(s=>{const o=Ue(s.group.id,!0);Le(s.group,o,{isUserInteraction:!0})}))),n}function Xs(e){e.defaultPrevented||Nr(e.currentTarget)}function ou(e,t,n){let s,o={x:1/0,y:1/0};for(const r of t){const a=Sr(n,r.rect);switch(e){case"horizontal":{a.x<=o.x&&(s=r,o=a);break}case"vertical":{a.y<=o.y&&(s=r,o=a);break}}}return s?{distance:o,hitRegion:s}:void 0}function ru(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function au(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:eo(e),b:eo(t)};let s;for(;n.a.at(-1)===n.b.at(-1);)s=n.a.pop(),n.b.pop();Z(s,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Qs(Zs(n.a)),b:Qs(Zs(n.b))};if(o.a===o.b){const r=s.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let l=r.length;for(;l--;){const c=r[l];if(c===a.a)return 1;if(c===a.b)return-1}}return Math.sign(o.a-o.b)}const iu=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function lu(e){const t=getComputedStyle(zr(e)??e).display;return t==="flex"||t==="inline-flex"}function cu(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||lu(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||iu.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Zs(e){let t=e.length;for(;t--;){const n=e[t];if(Z(n,"Missing node"),cu(n))return n}return null}function Qs(e){return e&&Number(getComputedStyle(e).zIndex)||0}function eo(e){const t=[];for(;e;)t.push(e),e=zr(e);return t}function zr(e){const{parentNode:t}=e;return ru(t)?t.host:t}function du(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function uu({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!kr(n)||n.contains(e)||e.contains(n))return!0;if(au(n,e)>0){let s=n;for(;s;){if(s.contains(e))return!0;if(du(s.getBoundingClientRect(),t))return!1;s=s.parentElement}}return!0}function Fn(e,t){const n=[];return t.forEach((s,o)=>{if(o.disabled)return;const r=Cr(o),a=ou(o.orientation,r,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&uu({groupElement:o.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function fu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function he(e,t,n=0){return Math.abs(xe(e)-xe(t))<=n}function ze(e,t){return he(e,t)?0:e>t?1:-1}function ft({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:s}){const{collapsedSize:o=0,collapsible:r,disabled:a,maxSize:l=100,minSize:c=0}=t;if(a&&!e)return n;if(ze(s,c)<0)if(r){const d=(o+c)/2;ze(s,d)<0?s=o:s=c}else s=c;return s=Math.min(l,s),s=xe(s),s}function It({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:s,prevLayout:o,trigger:r}){if(he(e,0))return t;const a=r==="imperative-api",l=Object.values(t),c=Object.values(o),d=[...l],[f,i]=s;Z(f!=null,"Invalid first pivot index"),Z(i!=null,"Invalid second pivot index");let p=0;switch(r){case"keyboard":{{const g=e<0?i:f,b=n[g];Z(b,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:y,minSize:w=0}=b;if(y){const C=l[g];if(Z(C!=null,`Previous layout not found for panel index ${g}`),he(C,x)){const k=w-C;ze(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}{const g=e<0?f:i,b=n[g];Z(b,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:y,minSize:w=0}=b;if(y){const C=l[g];if(Z(C!=null,`Previous layout not found for panel index ${g}`),he(C,w)){const k=C-x;ze(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}break}default:{const g=e<0?i:f,b=n[g];Z(b,`Panel constraints not found for index ${g}`);const x=l[g],{collapsible:y,collapsedSize:w,minSize:C}=b;if(y&&ze(x,C)<0)if(e>0){const k=C-w,R=k/2,j=x+e;ze(j,C)<0&&(e=ze(e,R)<=0?0:k)}else{const k=C-w,R=100-k/2,j=x-e;ze(j,C)<0&&(e=ze(100+e,R)>0?0:-k)}break}}{const g=e<0?1:-1;let b=e<0?i:f,x=0;for(;;){const w=l[b];Z(w!=null,`Previous layout not found for panel index ${b}`);const C=ft({overrideDisabledPanels:a,panelConstraints:n[b],prevSize:w,size:100})-w;if(x+=C,b+=g,b<0||b>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-y:y}{let g=e<0?f:i;for(;g>=0&&g<n.length;){const b=Math.abs(e)-Math.abs(p),x=l[g];Z(x!=null,`Previous layout not found for panel index ${g}`);const y=x-b,w=ft({overrideDisabledPanels:a,panelConstraints:n[g],prevSize:x,size:y});if(!he(x,w)&&(p+=x-w,d[g]=w,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(fu(c,d))return o;{const g=e<0?i:f,b=l[g];Z(b!=null,`Previous layout not found for panel index ${g}`);const x=b+p,y=ft({overrideDisabledPanels:a,panelConstraints:n[g],prevSize:b,size:x});if(d[g]=y,!he(y,x)){let w=x-y,C=e<0?i:f;for(;C>=0&&C<n.length;){const k=d[C];Z(k!=null,`Previous layout not found for panel index ${C}`);const R=k+w,j=ft({overrideDisabledPanels:a,panelConstraints:n[C],prevSize:k,size:R});if(he(k,j)||(w-=j-k,d[C]=j),he(w,0))break;e>0?C--:C++}}}const h=Object.values(d).reduce((g,b)=>b+g,0);if(!he(h,100,.1))return o;const m=Object.keys(o);return d.reduce((g,b,x)=>(g[m[x]]=b,g),{})}function Qe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ze(e[n],t[n])!==0)return!1;return!0}function et({layout:e,panelConstraints:t}){const n=Object.values(e),s=[...n],o=s.reduce((l,c)=>l+c,0);if(s.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${s.map(l=>`${l}%`).join(", ")}`);if(!he(o,100)&&s.length>0)for(let l=0;l<t.length;l++){const c=s[l];Z(c!=null,`No layout data found for index ${l}`);const d=100/o*c;s[l]=d}let r=0;for(let l=0;l<t.length;l++){const c=n[l];Z(c!=null,`No layout data found for index ${l}`);const d=s[l];Z(d!=null,`No layout data found for index ${l}`);const f=ft({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:d});d!=f&&(r+=d-f,s[l]=f)}if(!he(r,0))for(let l=0;l<t.length;l++){const c=s[l];Z(c!=null,`No layout data found for index ${l}`);const d=c+r,f=ft({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:d});if(c!==f&&(r-=f-c,s[l]=f,he(r,0)))break}const a=Object.keys(e);return s.reduce((l,c,d)=>(l[a[d]]=c,l),{})}function Ar({groupId:e,panelId:t}){const n=()=>{const c=nt();for(const[d,{defaultLayoutDeferred:f,derivedPanelConstraints:i,layout:p,groupSize:h,separatorToPanels:m}]of c)if(d.id===e)return{defaultLayoutDeferred:f,derivedPanelConstraints:i,group:d,groupSize:h,layout:p,separatorToPanels:m};throw Error(`Group ${e} not found`)},s=()=>{const c=n().derivedPanelConstraints.find(d=>d.panelId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const c=n().group.panels.find(d=>d.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},r=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},a=({nextSize:c,panels:d,prevLayout:f,derivedPanelConstraints:i})=>{const p=r(),h=d.findIndex(b=>b.id===t),m=h===0,g=h===d.length-1;if(g&&c<p&&(m||d.slice(0,h).every((b,x)=>{const y=i[x];return y?.collapsible&&he(y.collapsedSize,f[y.panelId])}))){const b=d.slice(0,h).reduce((x,y)=>x+f[y.id],0);return{...f,[t]:xe(100-b)}}return It({delta:g?p-c:c-p,initialLayout:f,panelConstraints:i,pivotIndices:g?[h-1,h]:[h,h+1],prevLayout:f,trigger:"imperative-api"})},l=c=>{const d=r();if(c===d)return;const{defaultLayoutDeferred:f,derivedPanelConstraints:i,group:p,groupSize:h,layout:m,separatorToPanels:g}=n(),b=a({nextSize:c,panels:p.panels,prevLayout:m,derivedPanelConstraints:i}),x=et({layout:b,panelConstraints:i});Qe(m,x)||Le(p,{defaultLayoutDeferred:f,derivedPanelConstraints:i,groupSize:h,layout:x,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=s(),{mutableValues:f}=o(),i=r();c&&i!==d&&(f.expandToSize=i,l(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:f}=s(),{mutableValues:i}=o(),p=r();if(c&&p===d){let h=i.expandToSize??f;h===0&&(h=1),l(h)}},getSize:()=>{const{group:c}=n(),d=r(),{element:f}=o(),i=c.orientation==="horizontal"?f.offsetWidth:f.offsetHeight;return{asPercentage:d,inPixels:i}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=s(),f=r();return c&&he(d,f)},resize:c=>{const{group:d}=n(),{element:f}=o(),i=bt({group:d}),p=St({groupSize:i,panelElement:f,styleProp:c}),h=xe(p/i*100);l(h)}}}function to(e){if(e.defaultPrevented)return;const t=nt();Fn(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const s=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(s){const o=s.panelConstraints.defaultSize,r=Ar({groupId:n.group.id,panelId:s.id});r&&o!==void 0&&(r.resize(o),e.preventDefault())}}})}function $t(e){const t=nt();for(const[n]of t)if(n.separators.some(s=>s.element===e))return n;throw Error("Could not find parent Group for separator element")}function Pr({groupId:e}){const t=()=>{const n=nt();for(const[s,o]of n)if(s.id===e)return{group:s,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:s}=t();return n?{}:s},setLayout(n){const{defaultLayoutDeferred:s,derivedPanelConstraints:o,group:r,groupSize:a,layout:l,separatorToPanels:c}=t(),d=et({layout:n,panelConstraints:o});return s?l:(Qe(l,d)||Le(r,{defaultLayoutDeferred:s,derivedPanelConstraints:o,groupSize:a,layout:d,separatorToPanels:c}),d)}}}function Ye(e,t){const n=$t(e),s=Ue(n.id,!0),o=n.separators.find(f=>f.element===e);Z(o,"Matching separator not found");const r=s.separatorToPanels.get(o);Z(r,"Matching panels not found");const a=r.map(f=>n.panels.indexOf(f)),l=Pr({groupId:n.id}).getLayout(),c=It({delta:t,initialLayout:l,panelConstraints:s.derivedPanelConstraints,pivotIndices:a,prevLayout:l,trigger:"keyboard"}),d=et({layout:c,panelConstraints:s.derivedPanelConstraints});Qe(l,d)||Le(n,{defaultLayoutDeferred:s.defaultLayoutDeferred,derivedPanelConstraints:s.derivedPanelConstraints,groupSize:s.groupSize,layout:d,separatorToPanels:s.separatorToPanels},{isUserInteraction:!0})}function no(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=$t(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Ye(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Ye(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Ye(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Ye(t,-5);break}case"End":{e.preventDefault(),Ye(t,100);break}case"Enter":{e.preventDefault();const s=$t(t),o=Ue(s.id,!0),{derivedPanelConstraints:r,layout:a,separatorToPanels:l}=o,c=s.separators.find(p=>p.element===t);Z(c,"Matching separator not found");const d=l.get(c);Z(d,"Matching panels not found");const f=d[0],i=r.find(p=>p.panelId===f.id);if(Z(i,"Panel metadata not found"),i.collapsible){const p=a[f.id],h=i.collapsedSize===p?s.mutableState.expandedPanelSizes[f.id]??i.minSize:i.collapsedSize;Ye(t,h-p)}break}case"F6":{e.preventDefault();const s=$t(t).separators.map(a=>a.element),o=Array.from(s).findIndex(a=>a===e.currentTarget);Z(o!==null,"Index not found");const r=e.shiftKey?o>0?o-1:s.length-1:o+1<s.length?o+1:0;s[r].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Ye(t,-100);break}}}function so(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=nt(),n=Fn(e,t),s=new Map;let o=!1;n.forEach(r=>{r.separator&&(o||(o=!0,r.separator.element.focus({focusVisible:!1,preventScroll:!0})));const a=t.get(r.group);a&&s.set(r.group,a.layout)}),mt({cursorFlags:0,hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function Br({document:e,event:t,hitRegions:n,initialLayoutMap:s,mountedGroups:o,pointerDownAtPoint:r,prevCursorFlags:a}){let l=0;n.forEach(d=>{const{group:f,groupSize:i}=d,{orientation:p,panels:h}=f,{disableCursor:m}=f.mutableState;let g=0;r?p==="horizontal"?g=(t.clientX-r.x)/i*100:g=(t.clientY-r.y)/i*100:p==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const b=s.get(f),x=o.get(f);if(!b||!x)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:w,groupSize:C,layout:k,separatorToPanels:R}=x;if(w&&k&&R){const j=It({delta:g,initialLayout:b,panelConstraints:w,pivotIndices:d.panels.map(S=>h.indexOf(S)),prevLayout:k,trigger:"mouse-or-touch"});if(Qe(j,k)){if(g!==0&&!m)switch(p){case"horizontal":{l|=g<0?Ir:Rr;break}case"vertical":{l|=g<0?Tr:jr;break}}}else Le(d.group,{defaultLayoutDeferred:y,derivedPanelConstraints:w,groupSize:C,layout:j,separatorToPanels:R})}});let c=0;t.movementX===0?c|=a&qs:c|=l&qs,t.movementY===0?c|=a&Vs:c|=l&Vs,eu(c),_n(e)}function oo(e){const t=nt(),n=Ze();n.state==="active"&&Br({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function ro(e){if(e.defaultPrevented)return;const t=Ze(),n=nt();switch(t.state){case"active":{if(e.buttons===0){mt({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Ue(s.group.id,!0);Le(s.group,o,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:o}=s.separator;o.hasPointerCapture?.(e.pointerId)||o.setPointerCapture?.(e.pointerId)}Br({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Fn(e,n);s.length===0?t.state!=="inactive"&&mt({cursorFlags:0,state:"inactive"}):mt({cursorFlags:0,hitRegions:s,state:"hover"}),_n(e.currentTarget);break}}}function ao(e){e.relatedTarget instanceof HTMLIFrameElement&&Ze().state==="hover"&&mt({cursorFlags:0,state:"inactive"})}function io(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||Nr(e.currentTarget)&&e.preventDefault()}function lo(e){let t=0,n=0;const s={};for(const r of e)if(r.defaultSize!==void 0){t++;const a=xe(r.defaultSize);n+=a,s[r.panelId]=a}else s[r.panelId]=void 0;const o=e.length-t;if(o!==0){const r=xe((100-n)/o);for(const a of e)a.defaultSize===void 0&&(s[a.panelId]=r)}return s}function pu(e,t,n){if(!n[0])return;const s=e.panels.find(c=>c.element===t);if(!s||!s.onResize)return;const o=bt({group:e}),r=e.orientation==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,a=s.mutableValues.prevSize,l={asPercentage:xe(r/o*100),inPixels:r};s.mutableValues.prevSize=l,s.onResize(l,s.id,a)}function mu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function hu({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:s}){if(n<=0||t<=0||n===t)return s;let o=0,r=0,a=!1;const l=new Map,c=[];for(const i of e.panels){const p=s[i.id]??0;if(i.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){a=!0;const h=p/100*n,m=xe(h/t*100);l.set(i.id,m),o+=m}else c.push(i.id),r+=p}if(!a||c.length===0)return s;const d=100-o,f={...s};if(l.forEach((i,p)=>{f[p]=i}),r>0)for(const i of c){const p=s[i]??0;f[i]=xe(p/r*d)}else{const i=xe(d/c.length);for(const p of c)f[p]=i}return f}function gu(e,t){const n=e.map(o=>o.id),s=Object.keys(t);if(n.length!==s.length)return!1;for(const o of n)if(!s.includes(o))return!1;return!0}const ct=new Map;function bu(e){let t=!0;Z(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,s=new Set,o=new Set,r=new n(m=>{for(const g of m){const{borderBoxSize:b,target:x}=g;if(x===e.element){if(t){const y=bt({group:e});if(y===0)return;const w=Ue(e.id);if(!w)return;const C=bn(e),k=w.defaultLayoutDeferred?lo(C):w.layout,R=hu({group:e,nextGroupSize:y,prevGroupSize:w.groupSize,prevLayout:k}),j=et({layout:R,panelConstraints:C});if(!w.defaultLayoutDeferred&&Qe(w.layout,j)&&mu(w.derivedPanelConstraints,C)&&w.groupSize===y)return;Le(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:C,groupSize:y,layout:j,separatorToPanels:w.separatorToPanels})}}else pu(e,x,b)}});r.observe(e.element),e.panels.forEach(m=>{Z(!s.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),s.add(m.id),m.onResize&&r.observe(m.element)});const a=bt({group:e}),l=bn(e),c=e.panels.map(({id:m})=>m).join(",");let d=e.mutableState.defaultLayout;d&&(gu(e.panels,d)||(d=void 0));const f=e.mutableState.layouts[c]??d??lo(l),i=et({layout:f,panelConstraints:l}),p=e.element.ownerDocument;ct.set(p,(ct.get(p)??0)+1);const h=new Map;return Cr(e).forEach(m=>{m.separator&&h.set(m.separator,m.panels)}),Le(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:l,groupSize:a,layout:i,separatorToPanels:h}),e.separators.forEach(m=>{Z(!o.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.element.addEventListener("keydown",no)}),ct.get(p)===1&&(p.addEventListener("contextmenu",Xs,!0),p.addEventListener("dblclick",to,!0),p.addEventListener("pointerdown",so,!0),p.addEventListener("pointerleave",oo),p.addEventListener("pointermove",ro),p.addEventListener("pointerout",ao),p.addEventListener("pointerup",io,!0)),function(){t=!1,ct.set(p,Math.max(0,(ct.get(p)??0)-1)),su(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",no)}),ct.get(p)||(p.removeEventListener("contextmenu",Xs,!0),p.removeEventListener("dblclick",to,!0),p.removeEventListener("pointerdown",so,!0),p.removeEventListener("pointerleave",oo),p.removeEventListener("pointermove",ro),p.removeEventListener("pointerout",ao),p.removeEventListener("pointerup",io,!0)),r.disconnect()}}function xu(){const[e,t]=v.useState({}),n=v.useCallback(()=>t({}),[]);return[e,n]}function On(e){const t=v.useId();return`${e??t}`}const st=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Mt(e){const t=v.useRef(e);return st(()=>{t.current=e},[e]),v.useCallback((...n)=>t.current?.(...n),[t])}function Wn(...e){return Mt(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Gn(e){const t=v.useRef({...e});return st(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Dr=v.createContext(null);function vu(e,t){const n=v.useRef({getLayout:()=>({}),setLayout:tu});v.useImperativeHandle(t,()=>n.current,[]),st(()=>{Object.assign(n.current,Pr({groupId:e}))})}function Lr({children:e,className:t,defaultLayout:n,disableCursor:s,disabled:o,elementRef:r,groupRef:a,id:l,onLayoutChange:c,onLayoutChanged:d,orientation:f="horizontal",resizeTargetMinimumSize:i={coarse:20,fine:10},style:p,...h}){const m=v.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Mt(L=>{Qe(m.current.onLayoutChange,L)||(m.current.onLayoutChange=L,c?.(L))}),b=Mt((L,D)=>{Qe(m.current.onLayoutChanged,L)||(m.current.onLayoutChanged=L,d?.(L,{isUserInteraction:D}))}),x=On(l),y=v.useRef(null),[w,C]=xu(),k=v.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:i,separators:[]}),R=Wn(y,r);vu(x,a);const j=Mt((L,D)=>{const P=Ze(),W=Ks(L),U=Ue(L);if(U){let B=!1;return P.state==="active"&&(B=P.hitRegions.some(q=>q.group===W)),{flexGrow:U.layout[D]??1,pointerEvents:B?"none":void 0}}if(n?.[D])return{flexGrow:n?.[D]}}),S=Gn({defaultLayout:n,disableCursor:s}),_=v.useMemo(()=>({get disableCursor(){return!!S.disableCursor},getPanelStyles:j,id:x,orientation:f,registerPanel:L=>{const D=k.current;return D.panels=xn(f,[...D.panels,L]),C(),()=>{D.panels=D.panels.filter(P=>P!==L),C()}},registerSeparator:L=>{const D=k.current;return D.separators=xn(f,[...D.separators,L]),C(),()=>{D.separators=D.separators.filter(P=>P!==L),C()}},updatePanelProps:(L,{disabled:D})=>{const P=k.current.panels.find(B=>B.id===L);P&&(P.panelConstraints.disabled=D);const W=Ks(x),U=Ue(x);W&&U&&Le(W,{...U,derivedPanelConstraints:bn(W)})},updateSeparatorProps:(L,{disabled:D,disableDoubleClick:P})=>{const W=k.current.separators.find(U=>U.id===L);W&&(W.disabled=D,W.disableDoubleClick=P)}}),[j,x,C,f,S]),te=v.useRef(null);return st(()=>{const L=y.current;if(L===null)return;const D=k.current;let P;if(S.defaultLayout!==void 0&&Object.keys(S.defaultLayout).length===D.panels.length){P={};for(const T of D.panels){const ie=S.defaultLayout[T.id];ie!==void 0&&(P[T.id]=ie)}}const W={disabled:!!o,element:L,id:x,mutableState:{defaultLayout:P,disableCursor:!!S.disableCursor,expandedPanelSizes:k.current.lastExpandedPanelSizes,layouts:k.current.layouts},orientation:f,panels:D.panels,resizeTargetMinimumSize:D.resizeTargetMinimumSize,separators:D.separators};te.current=W;const U=bu(W),{defaultLayoutDeferred:B,derivedPanelConstraints:q,layout:re}=Ue(W.id,!0);!B&&q.length>0&&(g(re),b(re,!1));const ae=$n(x,T=>{const{defaultLayoutDeferred:ie,derivedPanelConstraints:Ce,layout:F}=T.next;if(ie||Ce.length===0)return;const Y=W.panels.map(({id:G})=>G).join(",");W.mutableState.layouts[Y]=F,Ce.forEach(G=>{if(G.collapsible){const{layout:K}=T.prev??{};if(K){const V=he(G.collapsedSize,F[G.panelId]),I=he(G.collapsedSize,K[G.panelId]);V&&!I&&(W.mutableState.expandedPanelSizes[G.panelId]=K[G.panelId])}}});const $=Ze().state!=="active";g(F),$&&b(F,T.isUserInteraction)});return()=>{te.current=null,U(),ae()}},[o,x,b,g,f,w,S]),v.useEffect(()=>{const L=te.current;L&&(L.mutableState.defaultLayout=n,L.mutableState.disableCursor=!!s)}),u.jsx(Dr.Provider,{value:_,children:u.jsx("div",{...h,className:t,"data-group":!0,"data-testid":x,id:x,ref:R,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:f==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:f==="horizontal"?"pan-y":"pan-x"},children:e})})}Lr.displayName="Group";function Un(){const e=v.useContext(Dr);return Z(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function yu(e,t){const{id:n}=Un(),s=v.useRef({collapse:sn,expand:sn,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:sn});v.useImperativeHandle(t,()=>s.current,[]),st(()=>{Object.assign(s.current,Ar({groupId:n,panelId:e}))})}function vn({children:e,className:t,collapsedSize:n="0%",collapsible:s=!1,defaultSize:o,disabled:r,elementRef:a,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:d="100%",minSize:f="0%",onResize:i,panelRef:p,style:h,...m}){const g=!!c,b=On(c),x=Gn({disabled:r}),y=v.useRef(null),w=Wn(y,a),{getPanelStyles:C,id:k,orientation:R,registerPanel:j,updatePanelProps:S}=Un(),_=i!==null,te=Mt((W,U,B)=>{i?.(W,c,B)});st(()=>{const W=y.current;if(W!==null){const U={element:W,id:b,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:_?te:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:s,defaultSize:o,disabled:x.disabled,maxSize:d,minSize:f}};return j(U)}},[l,n,s,o,_,b,g,d,f,te,j,x]),v.useEffect(()=>{S(b,{disabled:r})},[r,b,S]),yu(b,p);const L=()=>{const W=C(k,b);if(W)return JSON.stringify(W)},D=v.useSyncExternalStore(W=>$n(k,W),L,L);let P;return D?P=JSON.parse(D):o!==void 0?P={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:P={flexGrow:1},u.jsx("div",{...m,"data-disabled":r||void 0,"data-panel":!0,"data-testid":b,id:b,ref:w,style:{...wu,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...P},children:u.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:R==="horizontal"?"pan-y":"pan-x"},children:e})})}vn.displayName="Panel";const wu={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function ku({layout:e,panelConstraints:t,panelId:n,panelIndex:s}){let o,r;const a=e[n],l=t.find(c=>c.panelId===n);if(l){const c=l.maxSize,d=l.collapsible?l.collapsedSize:l.minSize,f=[s,s+1];r=et({layout:It({delta:d-a,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e}),panelConstraints:t})[n],o=et({layout:It({delta:c-a,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:r,valueNow:a}}function _r({children:e,className:t,disabled:n,disableDoubleClick:s,elementRef:o,id:r,style:a,...l}){const c=On(r),d=Gn({disabled:n,disableDoubleClick:s}),[f,i]=v.useState({}),[p,h]=v.useState("inactive"),[m,g]=v.useState(!1),b=v.useRef(null),x=Wn(b,o),{disableCursor:y,id:w,orientation:C,registerSeparator:k,updateSeparatorProps:R}=Un(),j=C==="horizontal"?"vertical":"horizontal";st(()=>{const te=b.current;if(te!==null){const L={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:te,id:c},D=k(L),P=Qd(U=>{h(U.next.state!=="inactive"&&U.next.hitRegions.some(B=>B.separator===L)?U.next.state:"inactive")}),W=$n(w,U=>{const{derivedPanelConstraints:B,layout:q,separatorToPanels:re}=U.next,ae=re.get(L);if(ae){const T=ae[0],ie=ae.indexOf(T);i(ku({layout:q,panelConstraints:B,panelId:T.id,panelIndex:ie}))}});return()=>{P(),W(),D()}}},[w,c,k,d]),v.useEffect(()=>{R(c,{disabled:n,disableDoubleClick:s})},[n,s,c,R]);let S;n&&!y&&(S="not-allowed");let _;return n?_="disabled":p==="active"?_="active":m?_="focus":_=p,u.jsx("div",{...l,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":j,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":_,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:S,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}_r.displayName="Separator";const Su=6,Cu=320,Mu=.9;function Iu(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function Ru(){return Math.min(Cu,Math.floor(window.innerWidth*Mu))}function Tu(e,t){const n=e.indexOf("#"),s=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n),r=s.includes("?")?"&":"?";return`${s}${r}t=${t}${o}`}function ju(){const{isOpen:e,target:t,close:n}=br(),{theme:s}=Rn(),o=v.useSyncExternalStore(Iu,Ru),r=v.useRef(null),[a,l]=v.useState(null),c=v.useRef(null),d=v.useCallback(i=>{if(c.current?.disconnect(),c.current=null,!i){document.documentElement.style.setProperty("--docs-inset","0px");return}const p=()=>document.documentElement.style.setProperty("--docs-inset",`${i.getBoundingClientRect().width+Su}px`),h=new ResizeObserver(p);h.observe(i),p(),c.current=h},[]);v.useEffect(()=>{if(!e){r.current=null,l(null);return}const i=t.path,p=r.current;p&&p.path===i&&p.theme===s||(r.current={kind:"site",path:i,theme:s},l(Tu(i,s)))},[e,t,s]);const f=t.source==="reference"?"Reference":"Guide";return u.jsx(ma,{open:e,modal:!1,disablePointerDismissal:!0,onOpenChange:i=>{i||n()},children:u.jsx(ha,{children:u.jsx(ga,{"data-slot":"docs-panel",className:"pointer-events-none fixed inset-0 z-[60]",children:u.jsxs(Lr,{orientation:"horizontal",className:"h-full w-full",children:[u.jsx(vn,{minSize:"10%",className:"pointer-events-none"}),u.jsx(_r,{"aria-label":"Resize docs panel",className:"pointer-events-auto w-1.5 cursor-col-resize bg-border/60 transition-colors hover:bg-primary/50 data-dragging:bg-primary/50"}),u.jsx(vn,{defaultSize:576,minSize:o,maxSize:"90vw",className:"pointer-events-auto",children:u.jsxs("div",{ref:d,className:"flex h-full flex-col border-l border-border bg-popover text-sm text-popover-foreground shadow-lg",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[u.jsx(ba,{className:"font-heading text-base font-medium text-foreground",children:f}),u.jsxs(xa,{render:u.jsx(ge,{variant:"ghost",size:"icon-sm"}),children:[u.jsx(Fo,{"aria-hidden":"true"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]}),u.jsx("iframe",{src:a??void 0,title:f,className:"w-full flex-1 border-0"})]})})]})})})})}function yn({className:e,...t}){return u.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",tabIndex:0,children:u.jsx("table",{"data-slot":"table",className:J("w-full caption-bottom text-sm",e),...t})})}function wn({className:e,...t}){return u.jsx("thead",{"data-slot":"table-header",className:J("[&_tr]:border-b",e),...t})}function kn({className:e,...t}){return u.jsx("tbody",{"data-slot":"table-body",className:J("[&_tr:last-child]:border-0",e),...t})}function Xe({className:e,...t}){return u.jsx("tr",{"data-slot":"table-row",className:J("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function be({className:e,...t}){return u.jsx("th",{"data-slot":"table-head",className:J("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Pe({className:e,...t}){return u.jsx("td",{"data-slot":"table-cell",className:J("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Rf({className:e,...t}){return u.jsx("caption",{"data-slot":"table-caption",className:J("mt-4 text-sm text-muted-foreground",e),...t})}function $r({className:e,size:t="default",...n}){return u.jsx("div",{"data-slot":"card","data-size":t,className:J("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function Sn({className:e,...t}){return u.jsx("div",{"data-slot":"card-content",className:J("px-(--card-spacing)",e),...t})}const Fr=v.createContext(!0),Tf=()=>v.useContext(Fr),Or=v.createContext(null),Wr=v.createContext(null),Gr=v.createContext(null),Ur=v.createContext(null);function jf({children:e,registerWidget:t,registerFindingAnchor:n,reportWidgetOpen:s,clearRouteFocus:o,focusedWidgetId:r,activeRouteTarget:a,flashedFinding:l}){const c=v.useMemo(()=>({registerWidget:t,registerFindingAnchor:n,reportWidgetOpen:s,clearRouteFocus:o}),[t,n,s,o]);return u.jsx(Or.Provider,{value:c,children:u.jsx(Wr.Provider,{value:r,children:u.jsx(Gr.Provider,{value:a,children:u.jsx(Ur.Provider,{value:l,children:e})})})})}function Eu(){return v.useContext(Or)}function Nu(){return v.useContext(Wr)}function Ef(){return v.useContext(Gr)}function Nf(){return v.useContext(Ur)}const Hn=v.createContext(null);function zu(){return v.useContext(Hn)}function zf({children:e,className:t}){return u.jsx("div",{className:J("grid grid-cols-[repeat(auto-fit,minmax(320px,1fr))] items-start gap-4",t),children:e})}function Af({cardId:e,widgetId:t,children:n,className:s,collapsedTile:o=!1}){const r=Eu(),a=Nu(),[l,c]=v.useState(0),[d,f]=v.useState(!1),i=v.useRef(null),p=v.useRef(null),h=v.useMemo(()=>({openRequestGeneration:l,reportOpen:m=>{f(m),t&&r?.reportWidgetOpen(t,m)},setDisclosureButton:m=>{p.current=m},onDisclosureBlur:()=>{t&&r?.clearRouteFocus(t)},routeFocused:t?a===t:!1,collapsedTile:o}),[r,l,t,a,o]);return v.useLayoutEffect(()=>{if(!(!r||!t||!i.current))return r.registerWidget(t,{wrapperElement:i.current,open:()=>{c(m=>m+1)},getDisclosureButton:()=>p.current})},[r,t]),u.jsx(Hn.Provider,{value:h,children:u.jsx("div",{ref:i,"data-testid":`widget-grid-item-${e}`,className:J("empty:hidden",t&&"scroll-mt-20",d&&"col-span-full",s),children:n})})}function co({children:e}){return u.jsx(Hn.Provider,{value:null,children:e})}function Ft({title:e,impactBand:t,badges:n,statusBadge:s,summary:o,defaultCollapsed:r=!1,collapsible:a=!0,open:l,onOpenChange:c,compact:d=!1,routeFocused:f,disclosureButtonRef:i,children:p,id:h}){const m=zu(),g=v.useRef(null),b=m?.collapsedTile??!1,[x,y]=v.useState(b?!1:!r),w=l??x,C=f??m?.routeFocused??!1,[k,R]=v.useState(C),j=v.useRef(0);v.useLayoutEffect(()=>{m?.reportOpen(w)},[m,w]),v.useLayoutEffect(()=>{const P=m?.openRequestGeneration??0;P===0||P===j.current||(j.current=P,w||(l!==void 0?c?.(!0):y(!0)))},[l,m?.openRequestGeneration,c,w]),v.useLayoutEffect(()=>{R(C)},[C]);const S=P=>{l!==void 0?c?.(P):y(P)},_=P=>{m?.setDisclosureButton(P),typeof i=="function"?i(P):i&&(i.current=P)},te=P=>{P.relatedTarget&&g.current?.contains(P.relatedTarget)||(R(!1),m?.onDisclosureBlur())},L=u.jsxs("div",{className:"flex flex-col gap-2 px-(--card-spacing) sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[a?u.jsxs(yr,{ref:_,"aria-expanded":String(w),"data-route-focused":k?"":void 0,className:J("tap-target-comfortable tap-target-comfortable--sm flex min-w-0 cursor-pointer items-center gap-2 bg-transparent text-left sm:flex-1",k&&"border-ring ring-[3px] ring-ring/50 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"),onBlur:te,children:[u.jsx("h3",{className:"font-heading text-base leading-snug font-bold",children:e}),w?u.jsx(pl,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}):u.jsx(ul,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]}):u.jsx("h3",{className:"min-w-0 font-heading text-base leading-snug font-bold sm:flex-1",children:e}),n||w&&s?u.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1",children:[n,w?s:null]}):null]}),D=u.jsx(co,{children:u.jsx(Sn,{children:p})});return u.jsx($r,{ref:g,id:h,size:d?"sm":"default",className:J("border-l-4",t?xr[t]:"border-transparent",b&&!w&&"min-h-[6.5rem]"),children:a?u.jsxs(vr,{open:w,onOpenChange:S,children:[L,o&&!w?u.jsx("div",{className:"px-(--card-spacing) pb-(--card-spacing)",children:o}):null,u.jsx(co,{children:u.jsx(wr,{keepMounted:!0,children:u.jsx(Fr.Provider,{value:w,children:u.jsx(Sn,{children:p})})})})]}):u.jsxs(u.Fragment,{children:[L,D]})})}function Pf(){return u.jsx($r,{className:"border-l-4 border-transparent","aria-hidden":"true",children:u.jsx(Sn,{children:u.jsx("div",{className:"h-5 w-1/3 animate-pulse rounded-md bg-muted motion-reduce:animate-none"})})})}const uo=e=>String(e),Au=[{key:"duration",label:"Duration",fmt:je},{key:"executorRunTime",label:"Executor run-time",fmt:je},{key:"jvmGCTime",label:"GC time",fmt:je},{key:"memoryBytesSpilled",label:"Memory spill",fmt:ne},{key:"diskBytesSpilled",label:"Disk spill",fmt:ne},{key:"inputBytes",label:"Input read",fmt:ne},{key:"outputBytes",label:"Output written",fmt:ne},{key:"taskCount",label:"Task count",fmt:uo},{key:"failedTasks",label:"Failed tasks",fmt:uo}];function fo(e,t){return e==null?"—":t(e)}function Pu({base:e,cand:t,fmt:n}){if(e==null||t==null)return u.jsx(Pe,{className:"text-muted-foreground",children:"—"});const s=t-e,o=s===0?"unchanged":(s<0?"-":"+")+n(Math.abs(s)),r=s===0?"text-muted-foreground":s<0?"text-clean":"text-critical";return u.jsx(Pe,{className:J("font-medium",r),children:o})}function Bu({base:e,cand:t}){return u.jsxs(yn,{children:[u.jsx(wn,{children:u.jsxs(Xe,{children:[u.jsx(be,{className:"text-left",children:"Metric"}),u.jsx(be,{children:"Baseline"}),u.jsx(be,{children:"Candidate"}),u.jsx(be,{children:"Δ"})]})}),u.jsx(kn,{children:Au.map(n=>u.jsxs(Xe,{"aria-label":n.label,children:[u.jsx(be,{scope:"row",className:"text-left",children:n.label}),u.jsx(Pe,{children:fo(e.metrics[n.key],n.fmt)}),u.jsx(Pe,{children:fo(t.metrics[n.key],n.fmt)}),u.jsx(Pu,{base:e.metrics[n.key],cand:t.metrics[n.key],fmt:n.fmt})]},n.key))})]})}function Du({baseStages:e,candStages:t}){const[n,s]=v.useState(""),[o,r]=v.useState(""),[a,l]=v.useState([]);if(e.length===0||t.length===0)return null;const c=p=>e.find(h=>h.id===p),d=p=>t.find(h=>h.id===p),f=()=>{n===""||o===""||l(p=>[...p,{baseId:Number(n),candId:Number(o)}])},i=p=>l(h=>h.filter((m,g)=>g!==p));return u.jsxs(Ft,{title:"Pinned per-stage deltas",children:[u.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Pick one stage from each run to compare directly. Pairs are chosen by you: no automatic matching."}),u.jsxs("div",{className:"mb-4 flex flex-wrap items-end gap-3",children:[u.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Baseline stage",u.jsxs("select",{className:"rounded border border-border bg-background px-2 py-1 text-sm text-foreground",value:n,onChange:p=>s(p.target.value),children:[u.jsx("option",{value:"",children:"Select…"}),e.map(p=>u.jsx("option",{value:String(p.id),children:p.name},p.id))]})]}),u.jsxs("label",{className:"flex flex-col gap-1 text-xs text-muted-foreground",children:["Candidate stage",u.jsxs("select",{className:"rounded border border-border bg-background px-2 py-1 text-sm text-foreground",value:o,onChange:p=>r(p.target.value),children:[u.jsx("option",{value:"",children:"Select…"}),t.map(p=>u.jsx("option",{value:String(p.id),children:p.name},p.id))]})]}),u.jsx(ge,{type:"button",size:"sm",disabled:n===""||o==="",onClick:f,children:"Pin pair"})]}),u.jsx("div",{className:"flex flex-col gap-4",children:a.map((p,h)=>{const m=c(p.baseId),g=d(p.candId);return!m||!g?null:u.jsxs("div",{className:"rounded border border-border p-3",children:[u.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[u.jsxs("span",{className:"text-sm font-medium",children:[m.name," → ",g.name]}),u.jsx(ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(h),children:"Remove"})]}),u.jsx(Bu,{base:m,cand:g})]},h)})})]})}const Lu="bg-plan-aggregate/8 text-plan-aggregate",Cn=e=>`${e.toFixed(2)}×`,_u=e=>`${(e*100).toFixed(1)}%`,$u={wallClock:je,shuffleSpill:ne,taskSkew:Cn,failedTaskRate:_u,diskSpill:ne,gcTime:je,inputBytes:ne,outputBytes:ne,executorRunTime:je},Fu=e=>$u[e]??(t=>Intl.NumberFormat().format(t)),Ou={regression:"text-critical",improvement:"text-clean",unchanged:"text-muted-foreground",neutral:"text-muted-foreground",unavailable:"text-muted-foreground"};function Wu({m:e}){if(e.direction==="unavailable")return u.jsxs(Xe,{"aria-label":e.label,"data-direction":"unavailable",children:[u.jsx(be,{scope:"row",className:"text-left",children:e.label}),u.jsxs(Pe,{colSpan:3,className:"text-muted-foreground",children:["Unavailable: ",e.unavailableReason]})]});const t=Fu(e.key),n=r=>r==null?"—":t(r),s=r=>r==null?"—":r===0?"unchanged":(r<0?"-":"+")+t(Math.abs(r)),o=fr.has(e.key)?"text-muted-foreground":Ou[e.direction];return u.jsxs(Xe,{"aria-label":e.label,"data-direction":e.direction,children:[u.jsx(be,{scope:"row",className:"text-left",children:e.label}),u.jsx(Pe,{children:n(e.baseline)}),u.jsx(Pe,{children:n(e.candidate)}),u.jsx(Pe,{className:J("font-medium",o),children:s(e.delta)})]})}const Gu=["critical","warning","info"],Uu=e=>Gu.includes(e)?e:"info";function Hu({stages:e}){return e.length===0?null:u.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.map(t=>u.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:t},t))})}function po({items:e}){return u.jsx("ul",{className:"flex flex-col gap-2",children:e.map(t=>u.jsxs("li",{className:"flex flex-col gap-1 border-b border-border pb-2 last:border-0 last:pb-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Nd,{type:t.rule,impactBand:Uu(t.impactBand),className:Tn(t.rule)==="PLAN"?Lu:void 0}),u.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.baseCount," → ",t.candCount]})]}),u.jsx(Hu,{stages:t.stages})]},`${t.rule}§${t.impactBand}`))})}function qu({reason:e}){const[t,n]=v.useState(!1);return t?null:u.jsxs("div",{role:"alert",className:"mb-4 flex items-start justify-between gap-3 rounded border border-warning/40 bg-warning/10 px-3 py-2 text-sm text-warning",children:[u.jsx("span",{children:e}),u.jsx("button",{type:"button",onClick:()=>n(!0),"aria-label":"Dismiss warning",className:"shrink-0 cursor-pointer rounded px-1 text-muted-foreground hover:text-foreground",children:"Dismiss"})]})}function Vu({model:e,onClose:t,onDrillIn:n}){const s=Math.round(e.matchedCoverage*100);v.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]);const o=u.jsxs("header",{className:"mb-4 flex items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"font-heading text-lg font-semibold",children:"Run comparison"}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Baseline ",u.jsx("strong",{children:e.baselineLabel})," vs candidate ",u.jsx("strong",{children:e.candidateLabel})]})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n?u.jsxs(u.Fragment,{children:[u.jsx(ge,{variant:"outline",size:"sm",onClick:()=>n("baseline"),children:"View run A dashboard"}),u.jsx(ge,{variant:"outline",size:"sm",onClick:()=>n("candidate"),children:"View run B dashboard"})]}):null,u.jsx(ge,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]})]});return u.jsxs("div",{"data-testid":"dashboard",className:"mx-auto flex max-w-4xl flex-col gap-6 p-6",children:[o,u.jsxs("main",{className:"contents",children:[u.jsx("h2",{className:"sr-only",children:"Comparison results"}),e.confidence==="low"&&e.reason?u.jsx(qu,{reason:e.reason}):null,u.jsxs(Ft,{title:"Metrics",children:[u.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Metrics and finding categories cover the whole run. Per-stage skew below covers only the ",s,"% of stages that matched by unique identity."]}),u.jsxs(yn,{children:[u.jsx(wn,{children:u.jsxs(Xe,{children:[u.jsx(be,{className:"text-left",children:"Metric"}),u.jsxs(be,{children:["Baseline (",e.baselineLabel,")"]}),u.jsxs(be,{children:["Candidate (",e.candidateLabel,")"]}),u.jsx(be,{children:"Δ"})]})}),u.jsx(kn,{children:e.metrics.map(r=>u.jsx(Wu,{m:r},r.key))})]})]}),e.findings.introduced.length>0||e.findings.resolved.length>0?u.jsxs(Ft,{title:"Findings by category",children:[e.findings.introduced.length>0?u.jsxs("div",{className:"mb-4",children:[u.jsxs("h3",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:["More in candidate (",e.candidateLabel,")"]}),u.jsx(po,{items:e.findings.introduced})]}):null,e.findings.resolved.length>0?u.jsxs("div",{children:[u.jsxs("h3",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:["Fewer in candidate (",e.candidateLabel,")"]}),u.jsx(po,{items:e.findings.resolved})]}):null]}):null,e.stageSkew.length>0?u.jsx(Ft,{title:"Per-stage task skew (matched stages only)",children:u.jsxs(yn,{children:[u.jsx(wn,{children:u.jsxs(Xe,{children:[u.jsx(be,{className:"text-left",children:"Stage"}),u.jsx(be,{children:"Baseline"}),u.jsx(be,{children:"Candidate"})]})}),u.jsx(kn,{children:[...e.stageSkew].sort((r,a)=>Math.abs(a.delta??0)-Math.abs(r.delta??0)).map(r=>u.jsxs(Xe,{children:[u.jsx(be,{scope:"row",className:"text-left",children:r.identity.split("§")[0]}),u.jsx(Pe,{children:r.baseline==null?"—":Cn(r.baseline)}),u.jsx(Pe,{children:r.candidate==null?"—":Cn(r.candidate)})]},`${r.baseId}-${r.candId}`))})]})}):null,u.jsx(Du,{baseStages:e.baseStages??[],candStages:e.candStages??[]})]})]})}const Hr=v.createContext(null);function Yu({children:e}){const[t,n]=v.useState(null),s=v.useCallback(a=>n(a),[]),o=v.useCallback(()=>n(null),[]),r=v.useMemo(()=>({stageId:t,openStage:s,close:o}),[t,s,o]);return u.jsx(Hr.Provider,{value:r,children:e})}function Bf(){const e=v.useContext(Hr);if(!e)throw new Error("useStageDetail outside StageDetailProvider");return e}function Ju(){const e=se(a=>a.planGraph.stageId),t=se(a=>a.planGraph.initialScope),n=se(a=>a.appModel),s=se(a=>a.catalog),o=se(a=>a.activeFileId),r=se(a=>a.closePlanGraph);return e==null?null:{stageId:e,initialScope:t,appModel:n,findings:s,activeFileId:o,onClose:r}}const Ku=v.lazy(()=>ho(async()=>{const{PlanGraphRoute:e}=await import("./PlanGraphRoute-a3OGg6ET.js");return{PlanGraphRoute:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(({PlanGraphRoute:e})=>({default:e}))),Xu=v.lazy(()=>ho(async()=>{const{Dashboard:e}=await import("./Dashboard-MDhohsq4.js");return{Dashboard:e}},__vite__mapDeps([7,1,2,3,4,5,8,9,10,11,12,13,14,15,16]),import.meta.url).then(({Dashboard:e})=>({default:e})));function Zu(){const e=se(a=>a.comparison),t=se(a=>a.closeComparison),{prepareComparison:n,drillIntoRun:s}=Pn(),o=v.useMemo(()=>{const a=e.baselineId&&e.candidateId?n(e.baselineId,e.candidateId):null;return a?cd(a.baseline,a.candidate):null},[e.baselineId,e.candidateId,n]),r=!o;return v.useEffect(()=>{r&&t()},[r,t]),o?u.jsx(Vu,{model:o,onClose:t,onDrillIn:a=>{const l=a==="baseline"?e.baselineId:e.candidateId;l&&s(l)}}):null}function Qu(){const e=Ju();return e?u.jsx(v.Suspense,{fallback:u.jsx("p",{role:"status","aria-live":"polite","aria-label":"Loading plan graph",className:"p-6 text-sm text-muted-foreground",children:"Loading plan graph…"}),children:u.jsx(Ku,{...e},e.stageId)}):null}function ef(){const e=se(c=>c.status),t=se(c=>c.errorMessage),n=se(c=>c.errorNonce),s=se(c=>c.parse),o=se(c=>c.shsParsing),r=se(c=>c.planGraph.active),a=se(c=>c.comparison.active),l=se(c=>c.compareLoad);if(l){const c=Math.round(s.pct*100);return u.jsxs("main",{className:"flex min-h-screen flex-col items-center justify-center gap-4 p-10",children:[u.jsxs("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:["Parsing run ",l.current," of 2… ",c,"%"]}),u.jsx(ls,{value:s.pct*100,className:"w-full max-w-md"})]})}if(r)return u.jsx(Qu,{});if(a)return u.jsx(Zu,{});if(e==="ready")return u.jsx(v.Suspense,{fallback:u.jsx("p",{role:"status","aria-live":"polite","aria-label":"Loading dashboard",className:"p-6 text-sm text-muted-foreground",children:"Loading dashboard…"}),children:u.jsx(Xu,{})});if(e==="parsing"&&!o){const c=Math.round(s.pct*100),d=s.lines>0?` · ${s.lines.toLocaleString()} lines`:"";return u.jsxs("main",{className:"flex min-h-screen flex-col items-center justify-center gap-4 p-10",children:[u.jsxs("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:["Parsing… ",c,"%",d]}),u.jsx(ls,{value:s.pct*100,className:"w-full max-w-md"})]})}return u.jsx("main",{className:"min-h-screen p-6 sm:p-10",children:u.jsx(Gd,{errorMessage:e==="error"?t:null,errorNonce:n})})}function tf(){const e=se(o=>o.status),t=se(o=>o.planGraph.active),n=se(o=>o.comparison.active),s=e==="ready"||t||n;return u.jsx(Si,{children:u.jsx(Cd,{children:u.jsxs(Yu,{children:[s?null:u.jsx("header",{children:u.jsx("h1",{className:"sr-only",children:"SparkForensics"})}),u.jsx(ef,{}),u.jsx(ju,{}),u.jsx(Dl,{})]})})})}va.createRoot(document.getElementById("root")).render(u.jsx(v.StrictMode,{children:u.jsx(tf,{})}));export{cf as $,Rd as A,ge as B,If as C,Cf as D,Ao as E,$r as F,pl as G,Xe as H,Ed as I,Pe as J,hl as K,ht as L,zf as M,Af as N,Pf as O,yn as P,kn as Q,uf as R,dt as S,Nd as T,Bf as U,lf as V,Ft as W,Fo as X,gr as Y,wn as Z,be as _,Oo as a,df as a0,se as a1,jf as a2,qt as a3,vr as a4,yr as a5,wr as a6,wf as a7,Lu as a8,kf as a9,ho as aa,An as ab,Tf as ac,Rf as ad,Qo as ae,js as af,en as ag,nr as ah,bd as ai,Pl as aj,Rn as ak,jl as al,Sl as am,Gc as an,dr as ao,Fi as ap,cr as aq,wt as ar,pf as as,Ef as at,gf as au,af as av,hf as aw,Eu as ax,Nf as ay,oc as az,yf as b,de as c,Zl as d,J as e,ec as f,vf as g,Mf as h,Td as i,ne as j,pr as k,vl as l,bf as m,ff as n,mf as o,xf as p,je as q,z as r,Lt as s,Tn as t,Pn as u,ul as v,Ke as w,Sf as x,ws as y,vi as z};