sparkforensics-server 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -1
- package/package.json +1 -1
- package/public/assets/{AutoscalingChurn-Bf5TN-s_.js → AutoscalingChurn-lxZHWIwq.js} +1 -1
- package/public/assets/CacheUtilization-DuAJ-Lve.js +1 -0
- package/public/assets/CachingOpportunity-DC1t7o2_.js +1 -0
- package/public/assets/{ColdStart-DnFgnD3n.js → ColdStart-BOYXeiUZ.js} +1 -1
- package/public/assets/{ConfigAudit-B5FsOdmu.js → ConfigAudit-MCPrJomC.js} +1 -1
- package/public/assets/{CoreUsageArea-CTksBPuq.js → CoreUsageArea-ChNuqGA0.js} +1 -1
- package/public/assets/Dashboard-VuyUGvZx.js +1 -0
- package/public/assets/DuplicatePlanSubtree-JZut9xwq.js +1 -0
- package/public/assets/{DurationHistogram-xRcnND4k.js → DurationHistogram-_7C1w0l4.js} +1 -1
- package/public/assets/{EmptyState-CnTrSjtU.js → EmptyState-D_ulfIIi.js} +1 -1
- package/public/assets/{ExecutorUtilization-CP21XlUq.js → ExecutorUtilization-B08E76jT.js} +1 -1
- package/public/assets/GcPressure-BZMi2fTx.js +1 -0
- package/public/assets/{ImpactEstimate-BHcqJkcZ.js → ImpactEstimate-36WxuPdV.js} +1 -1
- package/public/assets/{IncompleteRun-b9FWrOHn.js → IncompleteRun-t8JU7HRt.js} +1 -1
- package/public/assets/{JobFailures-C5FkTq3O.js → JobFailures-CguB1bec.js} +1 -1
- package/public/assets/{MemoryUtilization-D2W4AB_f.js → MemoryUtilization-DDk8lz9-.js} +1 -1
- package/public/assets/OverBroadcast-BHXLt6s7.js +1 -0
- package/public/assets/PartitionSizing-COj3uwV-.js +1 -0
- package/public/assets/{PlanExplorer-DSk1ivS4.js → PlanExplorer-CnCdEY_i.js} +1 -1
- package/public/assets/PlanGraphRoute-BesZOW1n.js +1 -0
- package/public/assets/{RetryWaste-B4436kr1.js → RetryWaste-CcU4ctAn.js} +1 -1
- package/public/assets/{RowPagination-oeWB8gBm.js → RowPagination-D2aIcfGv.js} +1 -1
- package/public/assets/{ShuffleIO-DUiv8EJe.js → ShuffleIO-NPHkWbg1.js} +1 -1
- package/public/assets/{Skew-D2lB1oQc.js → Skew-CzztP-C4.js} +1 -1
- package/public/assets/SlowHost-Dh2KHypN.js +1 -0
- package/public/assets/SmallFiles-CgYSuZQw.js +1 -0
- package/public/assets/{SpeculationWaste-vUCniiFP.js → SpeculationWaste-C8J5z1WS.js} +1 -1
- package/public/assets/Spill-DwTQPZ_L.js +1 -0
- package/public/assets/{StageFailed-D9b83Jvy.js → StageFailed-aFeIEh3p.js} +1 -1
- package/public/assets/{StageFindingGroup-DagqHOUz.js → StageFindingGroup-DQmAE3uk.js} +1 -1
- package/public/assets/{StageHeader-DibMSunO.js → StageHeader-D6GBbcZp.js} +1 -1
- package/public/assets/{StagePill-Dt6V9yVw.js → StagePill-CSKyM8Kd.js} +1 -1
- package/public/assets/{StageShape-CfdrDUZa.js → StageShape-J6U4cUcM.js} +1 -1
- package/public/assets/{StageSlowness-BoGLIYKR.js → StageSlowness-C5F2v_ZO.js} +1 -1
- package/public/assets/Straggler-DcP3dFGA.js +1 -0
- package/public/assets/TaskFailures-C-vIEheo.js +1 -0
- package/public/assets/{TinyTask-Lsnt5mJF.js → TinyTask-Be-pvTjJ.js} +1 -1
- package/public/assets/UnderBroadcast-DfjYGhoK.js +1 -0
- package/public/assets/{finding-anchor-Bl1hRK5E.js → finding-anchor-vVODA_VC.js} +1 -1
- package/public/assets/{inbox-DHIFHqcn.js → inbox-LtbS_kBS.js} +1 -1
- package/public/assets/{index-U654cmB8.js → index-27MbqTFr.js} +5 -3
- package/public/assets/index-CWjjbtyo.css +2 -0
- package/public/assets/parser-worker-jAP0kWvS.js +122 -0
- package/public/assets/{select-CtKaJ5Hx.js → select-CC2Lyrmi.js} +1 -1
- package/public/assets/{toggle-group-DB2VfFIx.js → toggle-group-lmgO21t9.js} +1 -1
- package/public/assets/useRecentFiles-qH5Ap4xm.js +12 -0
- package/public/assets/{useSortMode-BhPky1lW.js → useSortMode-CvPY99UV.js} +1 -1
- package/public/assets/zstd-worker-C1Jq9lfb.js +1 -0
- package/public/docs/404.html +2 -2
- package/public/docs/assets/{app.BczRxXPr.js → app.C5E-wy6e.js} +1 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.CJBoRv1b.js +1 -0
- package/public/docs/assets/chunks/{VPLocalSearchBox.DXvkTVnC.js → VPLocalSearchBox.DtyygpbL.js} +1 -1
- package/public/docs/assets/chunks/{theme.ByUdwrLG.js → theme.DQS9-w_Z.js} +2 -2
- package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.B1vUqtry.js → contributor-guide_architecture_detector-contract.md.CsCytCho.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.B1vUqtry.lean.js → contributor-guide_architecture_detector-contract.md.CsCytCho.lean.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.sf9DU2bA.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DHVq1UPt.lean.js → contributor-guide_architecture_impact-estimation.md.sf9DU2bA.lean.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.rhfxoGsI.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_overview.md.DkXdJ9jE.lean.js → contributor-guide_architecture_overview.md.rhfxoGsI.lean.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_state-and-history.md.C-xxn0q7.js → contributor-guide_architecture_state-and-history.md.B8Wc_ZTg.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.CBJkwH24.js +6 -0
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.C0SovZX8.lean.js → contributor-guide_architecture_worker-protocol.md.CBJkwH24.lean.js} +1 -1
- package/public/docs/assets/contributor-guide_contributing.md.B2E9ni79.js +1 -0
- package/public/docs/assets/contributor-guide_contributing.md.B2E9ni79.lean.js +1 -0
- package/public/docs/assets/contributor-guide_development-setup.md.s85j2l8b.js +15 -0
- package/public/docs/assets/contributor-guide_development-setup.md.s85j2l8b.lean.js +1 -0
- package/public/docs/assets/contributor-guide_testing.md.Cnn6gz1C.js +1 -0
- package/public/docs/assets/contributor-guide_testing.md.Cnn6gz1C.lean.js +1 -0
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.B4tPGIal.js → user-guide_alternative-log-retrieval.md.ZHPSbBkF.js} +1 -1
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js → user-guide_alternative-log-retrieval.md.ZHPSbBkF.lean.js} +1 -1
- package/public/docs/assets/user-guide_getting-started.md.Cpe0U-eO.js +3 -0
- package/public/docs/assets/{user-guide_getting-started.md.BJvwLEIM.lean.js → user-guide_getting-started.md.Cpe0U-eO.lean.js} +1 -1
- package/public/docs/assets/{user-guide_mcp-tools.md.DGvolGzt.js → user-guide_mcp-tools.md.DrphooJv.js} +1 -1
- package/public/docs/assets/user-guide_understanding-findings.md.YBBLOwWi.js +1 -0
- package/public/docs/contributor-guide/architecture/board-widgets.html +3 -3
- package/public/docs/contributor-guide/architecture/detector-contract.html +5 -5
- package/public/docs/contributor-guide/architecture/drill-down.html +3 -3
- package/public/docs/contributor-guide/architecture/impact-estimation.html +5 -5
- package/public/docs/contributor-guide/architecture/index.html +3 -3
- package/public/docs/contributor-guide/architecture/overview.html +5 -5
- package/public/docs/contributor-guide/architecture/state-and-history.html +5 -5
- package/public/docs/contributor-guide/architecture/widget-rendering.html +3 -3
- package/public/docs/contributor-guide/architecture/worker-protocol.html +6 -6
- package/public/docs/contributor-guide/contributing.html +5 -5
- package/public/docs/contributor-guide/development-setup.html +11 -8
- package/public/docs/contributor-guide/testing.html +5 -5
- package/public/docs/hashmap.json +1 -1
- package/public/docs/index.html +3 -3
- package/public/docs/tuning-reference/anti-patterns.html +3 -3
- package/public/docs/tuning-reference/aqe.html +3 -3
- package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +3 -3
- package/public/docs/tuning-reference/bottleneck-cold-start.html +3 -3
- package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +3 -3
- package/public/docs/tuning-reference/bottleneck-failures.html +3 -3
- package/public/docs/tuning-reference/bottleneck-gc.html +3 -3
- package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +3 -3
- package/public/docs/tuning-reference/bottleneck-memory-utilization.html +3 -3
- package/public/docs/tuning-reference/bottleneck-retry-waste.html +3 -3
- package/public/docs/tuning-reference/bottleneck-shuffle.html +3 -3
- package/public/docs/tuning-reference/bottleneck-skew.html +3 -3
- package/public/docs/tuning-reference/bottleneck-slow-host.html +3 -3
- package/public/docs/tuning-reference/bottleneck-small-files.html +3 -3
- package/public/docs/tuning-reference/bottleneck-spill.html +3 -3
- package/public/docs/tuning-reference/bottleneck-straggler.html +3 -3
- package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +3 -3
- package/public/docs/tuning-reference/bottleneck-utilization.html +3 -3
- package/public/docs/tuning-reference/caching.html +3 -3
- package/public/docs/tuning-reference/cluster-config.html +3 -3
- package/public/docs/tuning-reference/config.html +3 -3
- package/public/docs/tuning-reference/data-formats.html +3 -3
- package/public/docs/tuning-reference/index.html +3 -3
- package/public/docs/tuning-reference/intro.html +3 -3
- package/public/docs/tuning-reference/joins.html +3 -3
- package/public/docs/tuning-reference/memory-model.html +3 -3
- package/public/docs/tuning-reference/metrics.html +3 -3
- package/public/docs/tuning-reference/partitioning.html +3 -3
- package/public/docs/tuning-reference/pyspark.html +3 -3
- package/public/docs/tuning-reference/shuffle.html +3 -3
- package/public/docs/tuning-reference/spark-architecture.html +3 -3
- package/public/docs/tuning-reference/table-formats.html +3 -3
- package/public/docs/user-guide/alternative-log-retrieval.html +5 -5
- package/public/docs/user-guide/getting-started.html +6 -6
- package/public/docs/user-guide/mcp-tools.html +5 -5
- package/public/docs/user-guide/run-comparison.html +3 -3
- package/public/docs/user-guide/understanding-findings.html +5 -5
- package/public/index.html +2 -2
- package/vendor-core/cli/native-zstd.js +2 -2
- package/vendor-core/detectors.js +16 -2
- package/vendor-core/docs-content/detection/fail.md +6 -2
- package/vendor-core/event-handlers.js +21 -0
- package/vendor-core/event-schemas.js +8 -0
- package/vendor-core/evidence-report.js +20 -1
- package/vendor-core/impact-estimator.js +23 -3
- package/vendor-core/occupancy.js +8 -7
- package/vendor-core/parser-worker.js +51 -18
- package/vendor-core/plan-summary.js +1 -1
- package/vendor-core/redact.js +24 -2
- package/vendor-core/run-comparison.js +8 -0
- package/vendor-core/shs-fetch.js +175 -65
- package/vendor-core/shs-load.js +1 -1
- package/vendor-core/stage-quantiles.js +65 -1
- package/vendor-core/task-failure.js +151 -0
- package/vendor-core/types.js +5 -0
- package/vendor-core/vendor/fflate.js +1 -1
- package/vendor-core/zip-archive.js +167 -0
- package/vendor-core/zstd-worker-client.js +180 -0
- package/vendor-core/zstd-worker.js +103 -0
- package/public/assets/CacheUtilization-DRf_FNrK.js +0 -1
- package/public/assets/CachingOpportunity-BTJzIhtI.js +0 -1
- package/public/assets/Dashboard-BFMsMuc_.js +0 -1
- package/public/assets/DuplicatePlanSubtree-BCt-Guuh.js +0 -1
- package/public/assets/GcPressure-BoEJsLjb.js +0 -1
- package/public/assets/OverBroadcast-Btu3xorf.js +0 -1
- package/public/assets/PartitionSizing-yZWhLN0e.js +0 -1
- package/public/assets/PlanGraphRoute-C3iOzUdB.js +0 -1
- package/public/assets/SlowHost-Qb_8aa-W.js +0 -1
- package/public/assets/SmallFiles-u6suTgfj.js +0 -1
- package/public/assets/Spill-BskXFX2e.js +0 -1
- package/public/assets/Straggler-DU1WSU-m.js +0 -1
- package/public/assets/TaskFailures-DkY6zBNJ.js +0 -1
- package/public/assets/UnderBroadcast-DxHc0lwy.js +0 -1
- package/public/assets/index-CjVklAdW.css +0 -2
- package/public/assets/parser-worker-5a9aUx3o.js +0 -115
- package/public/assets/useRecentFiles-BiYdWs8J.js +0 -11
- package/public/docs/assets/chunks/@localSearchIndexroot.c2HfrwDg.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.C0SovZX8.js +0 -6
- package/public/docs/assets/contributor-guide_contributing.md.CvRsdr6J.js +0 -1
- package/public/docs/assets/contributor-guide_contributing.md.CvRsdr6J.lean.js +0 -1
- package/public/docs/assets/contributor-guide_development-setup.md.DvMV1xhQ.js +0 -12
- package/public/docs/assets/contributor-guide_development-setup.md.DvMV1xhQ.lean.js +0 -1
- package/public/docs/assets/contributor-guide_testing.md.BohuQWvl.js +0 -1
- package/public/docs/assets/contributor-guide_testing.md.BohuQWvl.lean.js +0 -1
- package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +0 -3
- package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.js +0 -1
- /package/public/docs/assets/{contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js → contributor-guide_architecture_state-and-history.md.B8Wc_ZTg.lean.js} +0 -0
- /package/public/docs/assets/{user-guide_mcp-tools.md.DGvolGzt.lean.js → user-guide_mcp-tools.md.DrphooJv.lean.js} +0 -0
- /package/public/docs/assets/{user-guide_understanding-findings.md.B29f0ucS.lean.js → user-guide_understanding-findings.md.YBBLOwWi.lean.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,M as n,O as r,T as i,_ as a,a as o,d as s,f as c,i as l,l as u,n as d,o as f,s as p,u as m,v as h}from"./charts-vendor-0VMaLVLN.js";import{A as g,D as _,E as v,O as y,P as b,k as x}from"./react-vendor-D2TLlSzI.js";import{p as S}from"./plan-graph-vendor-B0sEms9Z.js";import{A as C,B as w,C as ee,E as T,F as te,H as ne,I as E,L as D,M as re,N as ie,O as ae,P as oe,R as se,S as O,T as k,V as ce,_ as le,a as ue,b as de,d as fe,f as pe,g as me,h as he,i as ge,j as _e,k as ve,l as ye,m as be,n as xe,o as Se,p as Ce,r as we,s as Te,t as Ee,u as De,v as Oe,w as A,x as ke,y as Ae,z as je}from"./useRecentFiles-BiYdWs8J.js";import{t as Me}from"./inbox-DHIFHqcn.js";import{A as Ne,At as Pe,D as j,Dt as Fe,E as Ie,F as Le,Ft as Re,It as ze,K as Be,L as Ve,Lt as M,N as He,Nt as Ue,O as We,Ot as Ge,P as Ke,Pt as qe,T as Je,Y as Ye,_ as N,a as Xe,b as P,bt as Ze,c as Qe,ct as $e,dt as F,gt as et,h as tt,i as I,j as nt,k as L,kt as rt,m as it,mt as at,n as ot,o as st,ot as ct,p as lt,s as R,st as ut,ut as z,v as dt,vt as ft,w as pt,xt as mt,y as ht,yt as gt}from"./index-U654cmB8.js";import{t as _t}from"./EmptyState-CnTrSjtU.js";import{n as vt,t as yt}from"./toggle-group-DB2VfFIx.js";import{n as bt,t as xt}from"./DurationHistogram-xRcnND4k.js";import{t as St}from"./downsample-WmNM1qc9.js";import{t as B}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as Ct,t as wt}from"./StagePill-Dt6V9yVw.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./ImpactEstimate-BHcqJkcZ.js";import{t as kt}from"./RowPagination-oeWB8gBm.js";var At={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};At.node;var jt=Pe(At),Mt={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Mt.node;var Nt=Pe(Mt),Pt={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};Pt.node;var Ft=Pe(Pt),It={name:`target`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};It.node;var Lt=Pe(It),V=e(n(),1),Rt=[`critical`,`warning`,`info`];function zt(){return{impactBands:new Set,types:new Set,stages:new Set}}function Bt(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function Vt(e,t){return D(e,{impactBand:t.impactBands,type:t.types,stageId:t.stages})}function Ht(e,t){return e.filter(e=>Vt(e,t))}function Ut(e,t){let n=new Set,r=new Set,i=new Set;for(let a of[...e,...t])n.add(a.impactBand),r.add(a.type),a.stageId!=null&&i.add(a.stageId);return{impactBands:Rt.filter(e=>n.has(e)),types:[...r].sort(),stages:[...i].sort((e,t)=>e-t)}}function Wt(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function Gt(e,t){let n=new URLSearchParams(e),r=zt();for(let e of Wt(n.get(`impact`)))Rt.includes(e)&&r.impactBands.add(e);let i=new Set(t.types);for(let e of Wt(n.get(`type`)))i.has(e)&&r.types.add(e);for(let e of Wt(n.get(`stage`))){let t=Number(e);Number.isInteger(t)&&r.stages.add(t)}return r}function Kt(e){let t=[];return e.impactBands.size&&t.push(`impact=${Rt.filter(t=>e.impactBands.has(t)).join(`,`)}`),e.types.size&&t.push(`type=${[...e.types].sort().join(`,`)}`),e.stages.size&&t.push(`stage=${[...e.stages].sort((e,t)=>e-t).join(`,`)}`),t.length?`?${t.join(`&`)}`:``}var H=S(),qt=(0,V.createContext)(null);function Jt(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Yt({options:e,fileId:t,children:n}){let[r,i]=(0,V.useState)(()=>Gt(typeof window>`u`?``:window.location.search,e));(0,V.useEffect)(()=>{if(typeof window>`u`)return;let e=Kt(r),t=`${window.location.pathname}${e}${window.location.hash}`;window.history.replaceState(window.history.state,``,t)},[r]);let a=(0,V.useRef)(t);(0,V.useEffect)(()=>{a.current!==t&&(a.current=t,i(zt()))},[t]),(0,V.useEffect)(()=>()=>{if(typeof window>`u`)return;let e=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,``,e)},[]),(0,V.useEffect)(()=>{if(typeof window>`u`)return;let t=()=>i(Gt(window.location.search,e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,V.useCallback)(e=>i(t=>({...t,impactBands:Jt(t.impactBands,e)})),[]),s=(0,V.useCallback)(e=>i(t=>({...t,types:Jt(t.types,e)})),[]),c=(0,V.useCallback)(e=>i(t=>({...t,stages:Jt(t.stages,e)})),[]),l=(0,V.useCallback)(()=>i(zt()),[]),u=(0,V.useMemo)(()=>({selection:r,toggleImpactBand:o,toggleType:s,toggleStage:c,clearAll:l}),[r,o,s,c,l]);return(0,H.jsx)(qt.Provider,{value:u,children:n})}function Xt(){let e=(0,V.useContext)(qt);if(!e)throw Error(`useFindingFilter outside FindingFilterProvider`);return e}function Zt(){let{clearAll:e}=Xt();return(0,H.jsx)(_t,{icon:Ft,title:`No findings match the active filters`,description:`Adjust or clear the filters to see findings.`,action:(0,H.jsx)(`button`,{type:`button`,onClick:e,className:`cursor-pointer text-sm underline`,children:`Clear all filters`})})}function Qt({className:e,orientation:t=`horizontal`,...n}){return(0,H.jsx)(b,{"data-slot":`separator`,orientation:t,className:M(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var $t={critical:`aria-pressed:bg-critical/10 aria-pressed:text-critical`,warning:`aria-pressed:bg-warning/10 aria-pressed:text-warning`,info:`aria-pressed:bg-info/10 aria-pressed:text-info`};function en(e,t,n){let r=new Set(e);for(let e of r)t.has(e)||n(e);for(let e of t)r.has(e)||n(e)}function tn({label:e,count:t,children:n}){return(0,H.jsxs)(ve,{children:[(0,H.jsxs)(re,{className:M(Le({variant:`outline`,size:`sm`}),`gap-1.5`),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,t>0&&(0,H.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-xs font-medium text-primary-foreground`,children:t}),(0,H.jsx)(rt,{"aria-hidden":`true`,className:`opacity-60`})]}),(0,H.jsx)(_e,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:n})]})}function nn({options:e,resultCount:t}){let{selection:n,toggleImpactBand:r,toggleType:i,toggleStage:a,clearAll:o}=Xt(),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),d=(0,V.useMemo)(()=>{let t=s.trim();return t?e.stages.filter(e=>String(e).includes(t)):e.stages},[e.stages,s]),f=(0,V.useMemo)(()=>{let t=l.trim().toLowerCase();return t?e.types.filter(e=>e.toLowerCase().includes(t)||gt(e).toLowerCase().includes(t)):e.types},[e.types,l]);if(e.impactBands.length===0&&e.types.length===0&&e.stages.length===0)return null;let p=!Bt(n),m=[...[...n.impactBands].map(e=>({key:`impact-${e}`,label:`impact ${e}`,onRemove:()=>r(e)})),...[...n.types].map(e=>({key:`type-${e}`,label:`type ${e}`,onRemove:()=>i(e)})),...[...n.stages].map(e=>({key:`stage-${e}`,label:`stage ${e}`,onRemove:()=>a(e)}))];return(0,H.jsxs)(`section`,{"aria-label":`Filter findings`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border/60 p-2`,children:[(0,H.jsxs)(`span`,{title:`Narrow the whole dashboard to findings matching the chosen impact bands, types, or stages`,className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,H.jsx)(Nt,{"aria-hidden":`true`,className:`size-3.5`}),`Filter findings`]}),(0,H.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:p?`${t} finding${t===1?``:`s`} match${t===1?`es`:``} the active filters`:`Showing all ${t} finding${t===1?``:`s`}`}),(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),e.impactBands.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Impact`}),(0,H.jsx)(yt,{multiple:!0,"aria-label":`Filter by impact`,value:[...n.impactBands],onValueChange:e=>en(e,n.impactBands,r),children:e.impactBands.map(e=>(0,H.jsxs)(vt,{value:e,variant:`outline`,size:`sm`,"aria-label":`Filter by impact: ${e}`,className:M(`tap-target-comfortable gap-1.5`,$t[e]),children:[(0,H.jsx)(j,{impactBand:e}),e]},e))})]}),e.types.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(tn,{label:`Type`,count:n.types.size,children:[(0,H.jsx)(`div`,{className:`p-1`,children:(0,H.jsx)(ae,{type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search type…`,"aria-label":`Search types`,autoComplete:`off`,className:`h-8`})}),f.map(e=>(0,H.jsxs)(C,{checked:n.types.has(e),onCheckedChange:()=>i(e),"aria-label":`Filter by type: ${e}`,children:[(0,H.jsx)(`span`,{className:`rounded bg-muted px-1 text-xs font-medium text-foreground!`,children:gt(e)}),` `,e]},e)),f.length===0&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching type`})]})]}),e.stages.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(tn,{label:`Stage`,count:n.stages.size,children:[(0,H.jsx)(`div`,{className:`p-1`,children:(0,H.jsx)(ae,{type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search stage id…`,"aria-label":`Search stages`,autoComplete:`off`,className:`h-8`})}),d.map(e=>(0,H.jsxs)(C,{checked:n.stages.has(e),onCheckedChange:()=>a(e),"aria-label":`Filter by stage: ${e}`,children:[`Stage `,e]},e)),d.length===0&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching stage`})]})]}),p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:e.onRemove,"aria-label":`Remove filter: ${e.label}`,className:`tap-target-comfortable inline-flex cursor-pointer items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs hover:bg-muted/70`,children:[e.label,` `,(0,H.jsx)(mt,{"aria-hidden":`true`,className:`size-3`})]},e.key)),(0,H.jsx)(`button`,{type:`button`,onClick:o,className:`tap-target-comfortable cursor-pointer text-xs underline`,children:`Clear all filters`})]})]})]})}function rn(e,t){let n=[];for(let{launch:t,finish:r}of e)r>t&&(n.push({t,delta:1}),n.push({t:r,delta:-1}));n.sort((e,t)=>e.t-t.t||e.delta-t.delta);let r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e];i+=a.delta;let o=n[e+1];if(!o||o.t===a.t)continue;let s=t==null?i:Math.min(i,t);r.push({tStart:a.t,tEnd:o.t,busy:s})}return r}function an(e,{bucketBy:t=`time`,bucketWidthMs:n=1e3,hypotheticalCores:r=null}={}){let i=rn(e,r);if(t===`coreCount`){let e=[];for(let t of i)e[t.busy]=(e[t.busy]??0)+(t.tEnd-t.tStart);for(let t=0;t<e.length;t++)e[t]===void 0&&(e[t]=0);return{mode:`coreCount`,histogram:e}}if(i.length===0)return{mode:`time`,bucketWidthMs:n,startTime:null,endTime:null,buckets:[]};let a=i[0].tStart,o=i[i.length-1].tEnd,s=[];for(let e=a;e<o;e+=n){let t=e+n,r=0;for(let n of i){let i=Math.max(n.tStart,e),a=Math.min(n.tEnd,t);a>i&&(r+=n.busy*(a-i))}s.push({tStart:e,tEnd:t,busyCoreMs:r,avgBusyCores:r/n})}return{mode:`time`,bucketWidthMs:n,startTime:a,endTime:o,buckets:s}}var on=220;async function sn(e,t){let n=[...e.stages.keys()],r=await Promise.all(n.map(e=>t(e).catch(()=>null))),i=[],a=!1;for(let e of r){if(!e){a=!0;continue}let{metrics:t,fieldNames:n}=e,r=n.length,o=n.indexOf(`launchTime`),s=n.indexOf(`finishTime`);if(o!==-1&&s!==-1)for(let e=0;e<t.length;e+=r)i.push({launch:t[e+o],finish:t[e+s]})}return{intervals:i,incomplete:a}}function cn({appModel:e,getTaskData:t}){let{exportMode:n,getTaskData:r}=bt(t),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[d,m]=(0,V.useState)(!1),h=e.stages.size>0;if((0,V.useEffect)(()=>{if(!h||!d||i!==null||!r)return;let t=!1;return sn(e,r).then(({intervals:e,incomplete:n})=>{if(t)return;let{histogram:r}=an(e,{bucketBy:`coreCount`});a(r??[]),s(n)}),()=>{t=!0}},[e,r,h,d,i]),!h)return null;let g=(i??[]).map((e,t)=>({cores:String(t),coreCount:t,ms:e})),_=St(g),v=g.reduce((e,t)=>t.ms>e.ms?t:e,g[0]);return(0,H.jsx)(I,{title:`Core-Usage Distribution`,id:`core-usage-histogram`,open:d,onOpenChange:m,summary:i!==null&&v?(0,H.jsx)(B,{value:F(v.ms),context:`at ${v.coreCount} concurrent core${v.coreCount===1?``:`s`}`}):void 0,children:i===null?n?(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Core-usage detail isn’t included in exported reports.`}):(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading core usage…`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{ariaLabel:`Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.`,height:on,table:{caption:`Wall-clock time by concurrent-core count`,columns:[`Concurrent cores`,`Time`],rows:i.map((e,t)=>[t,F(e)]),align:[`right`,`right`]},children:(0,H.jsxs)(l,{data:_,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`cores`,tick:{fontSize:10},label:{value:`Concurrent busy cores`,position:`insideBottom`,offset:-5,fontSize:10}}),(0,H.jsx)(f,{tick:{fontSize:10},width:48,tickFormatter:e=>F(e)}),(0,H.jsx)(u,{dataKey:`ms`,name:`Time`,fill:A.accent})]})}),o?(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Reopen this file to compute full core usage because some task data was released.`}):null,(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`See `,(0,H.jsx)(Ne,{anchor:`#bottleneck-utilization`,children:`how to read concurrent-core utilization`}),`.`]})]})})}function ln({app:e,stages:t,executorsAdded:n,runAggregates:r}){let i=Ye(e??{},n),a=(e?.endTime??0)-(e?.startTime??0),o=Be(e,t),s=a/36e5*i,c=i*((o.startup+o.gaps+o.idle)/36e5),l=i*o.stagesActive,u=r?.busyCoreMs??0,d=Math.max(0,l-u)/36e5,f=c+d,p=s>0?Math.round(f/s*100):null,m=0,h=r?.perStage??{};for(let e of Object.keys(h))m+=h[e].totalTaskDurationSum;let g=i>0?m/i:0,_=null;return(c>0||d>0)&&(_=c>=d?`driver`:`executor`),{availableComputeHours:s,driverWasteHours:c,executorWasteHours:d,wastagePct:p,floorZeroSkewMs:g,dominantWaste:_}}function un(e){let t=e?[...e.values()]:[],n=new Map,r=0;for(let e of t){if(e.submissionTime==null||e.completionTime==null)continue;let t=e.sqlExecutionId==null?`job:${e.id??r++}`:`sql:${e.sqlExecutionId}`,i=n.get(t);i?(i.start=Math.min(i.start,e.submissionTime),i.end=Math.max(i.end,e.completionTime)):n.set(t,{start:e.submissionTime,end:e.completionTime})}let i=[...n.entries()].sort((e,t)=>e[1].start-t[1].start),a=[];for(let e=1;e<i.length;e++)for(let t=0;t<e;t++){let[n,r]=i[t],[o,s]=i[e];s.start<r.end&&r.start<s.end&&a.push([n,o])}return{wallClockReliable:a.length===0,overlappingGroupIds:a}}var dn=`This estimate is derived from a simplified compute model; compare it against wall-clock data before acting on it.`,U=e=>`${Math.round(e*100)/100} core-h`;function fn(){return(0,H.jsx)(L,{children:(0,H.jsx)(O,{confidence:`low`,validationRequired:dn})})}function pn({appModel:e}){if(!e.runAggregates)return null;let t=ln({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});if(t.availableComputeHours<=0)return null;let n=un(e.jobs),r=null;return t.dominantWaste===`driver`?r=(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Driver-bound waste dominates.`}),` Review driver sizing (spark.driver.memory / spark.driver.cores) before scaling executors.`]}):t.dominantWaste===`executor`&&(r=(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Executor-bound waste dominates.`}),` Review executor count / cores by reducing cluster size or enabling dynamic allocation.`]})),(0,H.jsx)(I,{title:`Compute Efficiency`,statusBadge:(0,H.jsx)(fn,{}),defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:t.wastagePct==null?U(t.availableComputeHours):`${t.wastagePct}% wasted`,context:`of ${U(t.availableComputeHours)} available`}),children:(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[!n.wallClockReliable&&(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:`This run used concurrent job groups: the driver/executor split below is approximate, not precise.`})}),(0,H.jsxs)(`p`,{children:[`Available: `,(0,H.jsx)(`strong`,{children:U(t.availableComputeHours)}),t.wastagePct!=null&&(0,H.jsxs)(H.Fragment,{children:[` `,`· wasted `,(0,H.jsxs)(`strong`,{children:[t.wastagePct,`%`]})]})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Driver-bound waste: `,(0,H.jsx)(`strong`,{children:U(t.driverWasteHours)})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Executor-bound waste: `,(0,H.jsx)(`strong`,{children:U(t.executorWasteHours)})]}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Floor (same executors, zero skew): `,F(t.floorZeroSkewMs)]}),r]})})}function mn(e){let t={extract:0,transform:0,load:0};for(let n of e.values()){let e=Math.max(0,(n.completedAt??0)-(n.submittedAt??0));if(e===0)continue;let r=(n.shuffleReadBytes??0)>0||(n.shuffleWriteBytes??0)>0;(n.inputBytes??0)>0&&(n.shuffleReadBytes??0)===0&&(t.extract+=e),r&&(t.transform+=e),(n.outputBytes??0)>0&&(t.load+=e)}return t}var hn=[{label:`Extract`,key:`extract`},{label:`Transform`,key:`transform`},{label:`Load`,key:`load`}];function gn({appModel:e}){let t=mn(e.stages);if(t.extract+t.transform+t.load===0)return null;let n=hn.reduce((e,n)=>t[n.key]>t[e.key]?n:e);return(0,H.jsx)(I,{title:`ETL Phase Attribution`,defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:`${n.label} ${F(t[n.key])}`,context:`dominant phase`}),children:(0,H.jsxs)(`div`,{className:`space-y-1`,children:[hn.map(({label:e,key:n})=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e}),`: `,F(t[n])]},n)),(0,H.jsx)(L,{children:(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Heuristic: a stage that both shuffles and writes counts in Transform and Load, so phases can overlap and need not sum to wall-clock.`})})]})})}var _n=220;function vn(e){let t=e.app,n=e.executors.added,r=e.executors.removed;if(t?.startTime==null||t?.endTime==null)return{times:[],counts:[]};let i=t.endTime-t.startTime,a=Math.max(5e3,Math.floor(i/100)),o=[],s=[],c=new Map(r.map(e=>[e.executorId,e.timestamp]));for(let e=t.startTime;e<=t.endTime;e+=a){let r=n.filter(t=>{let n=c.get(t.executorId)??1/0;return t.timestamp<=e&&e<n}).length;o.push(((e-t.startTime)/1e3).toFixed(0)+`s`),s.push(r)}return{times:o,counts:s}}var yn=(0,V.memo)(function({appModel:e,activeFileId:t}){let{chartData:n,sampled:r,hasSeries:i,peak:a}=(0,V.useMemo)(()=>{let{times:t,counts:n}=vn(e),r=t.map((e,t)=>({label:e,count:n[t]})),i=St(r),a=n.length>0;return{chartData:r,sampled:i,hasSeries:a,peak:a?Math.max(...n):0}},[e,t]);return i?(0,H.jsx)(I,{title:`Executor Count Over Time`,summary:(0,H.jsx)(B,{value:`${a} peak`,context:`concurrent executors`}),children:(0,H.jsx)(k,{ariaLabel:`Executor count over time. See the table below for exact values.`,height:_n,table:{caption:`Executor timeline: active executor count over time`,columns:[`Time`,`Active executors`],rows:n.map(e=>[e.label,e.count]),align:[`left`,`right`]},children:(0,H.jsxs)(d,{data:r,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`label`,tick:{fontSize:10},minTickGap:24}),(0,H.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,H.jsx)(h,{formatter:e=>[`${e} executor${e===1?``:`s`} active`,``],labelFormatter:()=>``}),(0,H.jsx)(m,{type:`monotone`,dataKey:`count`,name:`Active executors`,stroke:A.clean,fill:A.clean,fillOpacity:.15})]})})}):(0,H.jsx)(I,{title:`Executor Count Over Time`,summary:(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Timeline unavailable: no end time recorded.`}),children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run has no ApplicationEnd event, so the executor timeline can't be plotted without fabricating an end time. See the Incomplete Run finding for what's still reliable.`})})}),bn=[10,20,50,80,100,110,120,150,200,300,400,500];function xn(e,t,n){return t<=0||n<=0?0:e/Math.min(n,t)}function Sn(e,t){let n=0;for(let r of Object.keys(e)){let{totalTaskDurationSum:i,taskCount:a}=e[r];n+=xn(i,a,t)}return n}function Cn({app:e,stages:t,runAggregates:n,executorsAdded:r}){let i=n?.perStage??{},a=Ye(e??{},r),o=Be(e,t).stagesActive,s=a>0?Sn(i,a):0,c=o>0?Math.round(Math.abs(s-o)/o*100):null,l=s>0?o/s:1;return{baselineCores:a,testPercentages:bn,predictions:bn.map(e=>{let t=Math.max(1,Math.round(a*e/100));return{pct:e,cores:t,estMakespanMs:Math.round(Sn(i,t)*l)}}),modelErrorPct:c}}var wn=`What-If Executor Scaling`,Tn=220,En=20;function Dn([e,t]){let n=(t-e)*.1;return[Math.max(0,e-n),t+n]}function On(e){return[...e.stages.values()].some(e=>{let t=e.submittedAt,n=e.completedAt;return typeof t==`number`&&Number.isFinite(t)&&typeof n==`number`&&Number.isFinite(n)&&n>t})}function kn(e){return e.evidenceAvailability?.entries.find(e=>e.key===`taskCoreTime`)}function An({reason:e,evidence:t}){return(0,H.jsx)(I,{title:wn,summary:(0,H.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e]}),children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e,` `,(0,H.jsx)(O,{evidenceKey:t})]})})}function jn({appModel:e}){let t=kn(e);if(!ze(e.runAggregates)||t!=null&&t.state!==`present`)return(0,H.jsx)(An,{reason:t?.summary??`No usable task and core-time evidence in this log.`,evidence:`taskCoreTime`});let n=Cn({app:e.app,stages:e.stages,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(n.baselineCores<=0)return(0,H.jsx)(An,{reason:`Baseline executor/core capacity is unavailable in this log.`});if(!On(e))return(0,H.jsx)(An,{reason:`Usable stage timing is unavailable in this log.`});let r=un(e.jobs),i=n.modelErrorPct!=null&&n.modelErrorPct>=En,a=St(n.predictions),l=n.predictions.reduce((e,t)=>t.estMakespanMs<e.estMakespanMs?t:e);return(0,H.jsx)(I,{title:wn,defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:F(l.estMakespanMs),context:`best case at ${l.pct}% executors`}),children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(L,{children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Model Error:`,` `,(0,H.jsx)(`strong`,{className:i?`text-warning`:void 0,children:n.modelErrorPct==null?`—`:`${n.modelErrorPct}%`}),` `,`(idealized makespan vs. observed); higher means all estimates below carry more error, since a single log only observes one scale.`]})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Move along this curve by changing `,(0,H.jsx)(`code`,{children:`spark.dynamicAllocation`}),`’s executor bounds, see the `,(0,H.jsx)(Ne,{anchor:`#config-autoscale-bounds`,children:`autoscaling config guide`}),`.`]}),r.wallClockReliable?null:(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run used concurrent job groups, so the wall-clock-based estimates below may be unreliable.`})}),(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-xs`,children:(0,H.jsx)(O,{evidenceKey:`taskCoreTime`})})}),(0,H.jsx)(k,{ariaLabel:`Estimated makespan by executor percentage: diminishing-returns curve.`,height:Tn,table:{caption:`Estimated makespan by executor percentage`,columns:[`% Executors`,`Cores`,`Est. makespan`],rows:n.predictions.map(e=>[`${e.pct}%`,e.cores,F(e.estMakespanMs)]),align:[`right`,`right`,`right`]},children:(0,H.jsxs)(o,{data:a,children:[(0,H.jsx)(c,{stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`pct`,tickFormatter:e=>`${e}%`,tick:{fontSize:10}}),(0,H.jsx)(f,{domain:Dn,tickFormatter:e=>F(e),tick:{fontSize:10},width:56}),(0,H.jsx)(h,{formatter:e=>[F(Number(e)),`Est. makespan`],labelFormatter:e=>`${e}% executors`}),(0,H.jsx)(s,{type:`monotone`,dataKey:`estMakespanMs`,name:`Est. makespan`,stroke:A.accent,dot:{r:3}})]})})]})})}function Mn(e){return typeof e?.startTime==`number`&&Number.isFinite(e.startTime)&&typeof e?.endTime==`number`&&Number.isFinite(e.endTime)&&e.endTime>e.startTime}function Nn(e){if(!Mn(e.app))return{efficiency:{value:null,unavailableReason:`application-timing`},wastage:{value:null,unavailableReason:`application-timing`}};let t=Be(e.app,e.stages),n=Math.min(100,Math.round(t.stagesActive/t.total*100));if(!e.runAggregates)return{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`core-usage-summary`}};let r=ln({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});return!Number.isFinite(r.availableComputeHours)||r.availableComputeHours<=0?{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`executor-capacity`}}:{efficiency:{value:n,unavailableReason:null},wastage:{value:r.wastagePct,unavailableReason:null}}}var Pn={critical:`inset 4px 0 0 var(--color-critical)`,warning:`inset 4px 0 0 var(--color-warning)`};function Fn({eyebrow:e,value:t,meta:n,flag:r=null,bar:i,dataTestid:a}){return(0,H.jsxs)(`div`,{"data-testid":a,className:`flex flex-col gap-1 p-3`,style:r?{boxShadow:Pn[r]}:void 0,children:[(0,H.jsxs)(`span`,{className:M(`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,r&&Ie[r]),children:[r&&(0,H.jsx)(j,{impactBand:r}),e]}),(0,H.jsx)(`div`,{className:M(`font-heading text-2xl font-semibold`,r&&Ie[r]),children:t}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}),i]})}function In({pct:e,flag:t,label:n}){let r=Math.max(0,Math.min(100,e));return(0,H.jsx)(`div`,{role:`img`,"aria-label":n,className:`mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:M(`h-full rounded-full`,t?Je[t]:`bg-clean`),style:{width:`${r}%`}})})}function Ln({active:e,total:t}){let n=t>0?Math.max(0,Math.min(100,e/t*100)):0;return(0,H.jsxs)(`div`,{role:`img`,"aria-label":`Active ${F(e)} of ${F(t)} total`,className:`mt-0.5 flex h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:[(0,H.jsx)(`div`,{className:`h-full bg-clean`,style:{width:`${n}%`}}),(0,H.jsx)(`div`,{className:`h-full flex-1 bg-muted-foreground/60`})]})}function Rn(e){return e>0?`Ran ${F(e)}`:`No stage activity recorded`}function zn(){return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4`,children:[(0,H.jsx)(j,{impactBand:`warning`,className:`mt-1.5`}),(0,H.jsxs)(`p`,{className:`text-sm text-warning`,children:[(0,H.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Timing unavailable`}),`. This run has no complete application timing interval, so wall-clock, efficiency, and wastage can’t be measured.`]})]})}function Bn({appModel:e,catalog:t}){let n=Re(),{app:r,stages:i}=e;if(!Mn(r))return(0,H.jsx)(zn,{});let a=Be(r,i),o=Nn(e),s=a.total,c=o.efficiency.value,l=c==null?null:c<75?`critical`:c<90?`warning`:null,u=t.find(e=>e.type===`coldStart`),d=o.wastage.value,f=d==null?null:d>=70?`critical`:d>=40?`warning`:null;return(0,H.jsx)(lt,{className:`overflow-hidden py-0`,children:(0,H.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,H.jsx)(Fn,{eyebrow:`Wall-clock`,dataTestid:`kpi-wall-clock`,value:s>0?F(s):`—`,meta:(0,H.jsxs)(H.Fragment,{children:[Rn(a.stagesActive),u?` · ${u.value}s cold start`:``]}),bar:(0,H.jsx)(Ln,{active:a.stagesActive,total:s})}),(0,H.jsx)(Fn,{eyebrow:`Efficiency`,dataTestid:`kpi-efficiency`,value:c==null?`Unavailable`:(0,H.jsxs)(H.Fragment,{children:[c,(0,H.jsx)(`small`,{children:`%`})]}),flag:l,meta:c==null?`This run has no complete application timing interval.`:s>a.stagesActive?`${Rn(a.stagesActive)} · ${F(s-a.stagesActive)} idle/gap time`:`executors active the whole run`,bar:c==null?void 0:(0,H.jsx)(In,{pct:c,flag:l,label:`Efficiency ${c}%`})}),(0,H.jsx)(Fn,{eyebrow:`Wastage`,dataTestid:`kpi-wastage`,value:d==null?`Unavailable`:(0,H.jsxs)(H.Fragment,{children:[d,(0,H.jsx)(`small`,{children:`%`})]}),flag:f,meta:o.wastage.unavailableReason===`application-timing`?`Wastage needs complete application timing.`:o.wastage.unavailableReason===`core-usage-summary`?`Wastage needs the core-usage summary.`:o.wastage.unavailableReason===`executor-capacity`?`Wastage needs usable executor-capacity data.`:n===`advanced`?`Driver-idle + executor-slack core-hours as a share of available capacity. Directional, not a cost figure.`:`Executor capacity that sat idle. Not a cost figure.`,bar:d==null?void 0:(0,H.jsx)(In,{pct:d,flag:f,label:`Wastage ${d}%`})})]})})}function Vn({className:e,...t}){return(0,H.jsx)(g,{"data-slot":`accordion`,className:M(`flex w-full flex-col`,e),...t})}function Hn({className:e,...t}){return(0,H.jsx)(x,{"data-slot":`accordion-item`,className:M(`not-last:border-b`,e),...t})}function Un({className:e,children:t,headingLevel:n=3,...r}){let i=`h${n}`;return(0,H.jsx)(y,{className:`flex`,render:(0,H.jsx)(i,{}),children:(0,H.jsxs)(_,{"data-slot":`accordion-trigger`,className:M(`group/accordion-trigger relative flex flex-1 cursor-pointer items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...r,children:[t,(0,H.jsx)(rt,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,H.jsx)(Ge,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Wn({className:e,children:t,...n}){return(0,H.jsx)(v,{"data-slot":`accordion-content`,className:`h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none`,...n,children:(0,H.jsx)(`div`,{className:M(`pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}function Gn(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Kn({type:e,label:t,thresholdSummary:n}){return(0,H.jsxs)(P,{"data-testid":`clean-check-row`,"data-clean-check-type":e,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1 rounded-full bg-clean/10 px-2 font-mono text-xs font-medium whitespace-nowrap text-clean`,children:[(0,H.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),gt(e)]})}),(0,H.jsxs)(N,{className:`whitespace-normal`,children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:Gn(t)}),(0,H.jsx)(L,{children:(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Gn(`${n}.`)})})]})]})}var qn=`suggested-improvements`,Jn={skew:`per-stage`,stageShape:`per-stage`,tinyTask:`per-stage`,shuffle:`per-stage`,partitionSizing:`per-stage`,spill:`per-stage`,gc:`per-stage`,stageFailed:`per-stage`,failures:`per-stage`,retryWaste:`per-stage`,slowHost:`per-stage`,stageSlowness:`per-stage`,straggler:`per-stage`,speculationWaste:`per-stage`,incompleteRun:`app-level`,coldStart:`app-level`,memoryUtilization:`app-level`,utilization:`app-level`,coreLocality:`app-level`,cachingOpportunity:`app-level`,cacheUtilization:`app-level`,jobFailureRate:`app-level`,autoscalingChurn:`app-level`,duplicatePlanSubtree:`sql-scope`,smallFiles:`sql-scope`,underBroadcast:`sql-scope`,overBroadcast:`sql-scope`,configAudit:`config-scope`},Yn=[`per-stage`,`app-level`,`sql-scope`,`config-scope`],Xn={"per-stage":`Per-stage checks`,"app-level":`App-level checks`,"sql-scope":`SQL plan checks`,"config-scope":`Config checks`};function Zn(e,t){let n=[...e,...t].filter(de);return me().filter(({type:e})=>!he(e)).map(({component:e,widgetId:t,type:r},i)=>{let a=n.filter(e=>e.type===r);return{component:e,widgetId:t,index:i,findings:a,impactBand:Ze(a)}}).filter(e=>e.impactBand!==void 0).sort((e,t)=>ct[e.impactBand]-ct[t.impactBand]||e.index-t.index)}function Qn({appModel:e,catalog:t,configFindings:n=[],getTaskData:r,activeFileId:i}){let a=[...t,...n].filter(de),o=Object.keys(Ce).filter(e=>!he(e)).filter(e=>!a.some(t=>t.type===e)).map(e=>({type:e,findingLabel:Ce[e].findingLabel})),s=new Map;for(let e of o){let t=Jn[e.type]??`app-level`;s.has(t)||s.set(t,[]),s.get(t).push(e)}let c=be();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(st,{children:c.map(({component:a,widgetId:o})=>(0,H.jsx)(R,{cardId:`reference-${o}`,widgetId:o,children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Xe,{}),children:(0,H.jsx)(a,{appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,defaultCollapsed:!0})})},o))}),(0,H.jsx)(Vn,{children:(0,H.jsxs)(Hn,{value:`clean-checks`,children:[(0,H.jsx)(Un,{children:`Clean checks`}),(0,H.jsxs)(Wn,{children:[(0,H.jsxs)(`p`,{className:`pb-2 text-xs text-muted-foreground`,children:[`Every check below passed. No fix needed.`,(0,H.jsx)(L,{children:` Each line's caption states the threshold it was measured against.`})]}),Yn.map(e=>{let t=s.get(e);return!t||t.length===0?null:(0,H.jsxs)(`div`,{className:`pt-3 first:pt-0`,children:[(0,H.jsx)(`p`,{className:`pb-1 text-xs font-medium text-muted-foreground`,children:Xn[e]}),(0,H.jsx)(it,{children:(0,H.jsx)(tt,{children:t.map(({type:e,findingLabel:t})=>(0,H.jsx)(Kn,{type:e,label:t,thresholdSummary:le(e)},e))})})]},e)})]})]})})]})}function $n(e){switch(e.type){case`skew`:return`For join-driven skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key to reduce task skew.`;case`stageShape`:switch(e.rule){case`lowParallelism`:return`Too few tasks run relative to the cores available, leaving cluster capacity idle: repartition to use more of it.`;case`dataExplosion`:return`Output volume far exceeds input volume: check for an exploding join or a cross product.`;case`taskStageSkew`:return`A single straggler task gates the whole stage's wall-clock duration.`}break;case`shuffle`:return`Consider increasing spark.sql.shuffle.partitions or adding a broadcast join to shrink the shuffle.`;case`partitionSizing`:switch(e.rule){case`shufflePartitionSkew`:return`For join skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key.`;case`lowShuffleParallelism`:return`Raise spark.sql.shuffle.partitions so each partition is smaller.`;case`maxPartitionTooBig`:return`Repartition to break up the oversized partition before this stage.`}break;case`spill`:return`If the spill is skew-driven, fix task skew first: adding memory will not help. Otherwise raise spark.sql.shuffle.partitions or increase executor memory.`;case`gc`:return e.direction===`low`?`Memory may be over-provisioned here: consider reducing spark.executor.memory for cost savings.`:`Reduce object creation, use primitive types, avoid UDFs, or increase executor memory to cut GC time.`;case`slowHost`:return e.variant===`durationShare`?`Check for data locality or partition assignment skewing work onto one node.`:e.variant===`multiDim`?`Investigate uneven partition assignment or a degraded executor.`:`Check what this host was running: it may just hold data locality for its tasks or carry one heavy stage, rather than a hardware fault. Enable spark.speculation to relaunch a lagging task automatically.`;case`stageSlowness`:return`Often a partition-count problem: raise parallelism via spark.sql.shuffle.partitions or spark.default.parallelism, or check for a large per-task data volume driving heavy shuffle and spill.`;case`stageFailed`:return`Inspect the driver log for the failure reason and the job that triggered it.`;case`failures`:return`Investigate driver logs for executor instability or data-driven errors.`;case`straggler`:return`Rule out a GC pause or a slow shuffle fetch before assuming a hardware issue. If a skewed key is the real cause, that is a candidate for AQE's skew-join handling.`;case`speculationWaste`:return`If task durations are naturally variable rather than genuine stragglers, consider tuning spark.speculation.multiplier/quantile.`;case`retryWaste`:return`Investigate executor loss or fetch failures behind the retried attempts.`;case`tinyTask`:return`Scheduler overhead may dominate: lower spark.sql.shuffle.partitions, or coalesce down to fewer, larger tasks.`;case`coldStart`:return`Keep a warm pool of idle executors, or if using dynamic allocation, raise the minimum/initial executor count so it does not scale up from zero.`;case`utilization`:return`Consider reducing cluster size or enabling dynamic allocation.`;case`memoryUtilization`:switch(e.variant){case`idleCores`:return`Reduce cluster size or enable dynamic allocation.`;case`wasteModel`:return`Review spark.executor.memory and executor count.`;case`memoryBand`:if(e.dataUnavailable)break;return e.rule===`heapNearCapacity`?`Memory may be too small: raise spark.executor.memory to avoid OOM/spill.`:`Memory may be over-provisioned: consider reducing spark.executor.memory for cost savings.`}break;case`cacheUtilization`:switch(e.variant){case`partialCache`:return`Increase executor memory or reduce the cached dataset size so more of it stays cached.`;case`diskSpillover`:return`Executor memory may be too small for this cached dataset: increase executor memory or reduce its size.`}break;case`coreLocality`:return`Check spark.locality.wait settings and executor/data colocation.`;case`autoscalingChurn`:return`This looks like wasteful re-provisioning rather than normal scale-down: consider raising spark.dynamicAllocation.executorIdleTimeout or widening the minExecutors/maxExecutors bounds to reduce flapping.`;case`cachingOpportunity`:return e.variant===`composite`?`Cache or persist the repeated join/union result so it is computed once instead of recomputed per query.`:`Cache the shared DataFrame, or broadcast it if it is a small join lookup.`;case`jobFailureRate`:return`Inspect the driver log for the failed job(s) and the stage failures that triggered them.`;case`configAudit`:switch(e.property){case`spark.shuffle.service.enabled`:return`Set spark.shuffle.service.enabled=true so shuffle data survives executor removal.`;case`spark.dynamicAllocation.minExecutors`:return`Set the minimum executor bound at or below the maximum.`;case`spark.dynamicAllocation.maxExecutors`:return`Set spark.dynamicAllocation.maxExecutors to cap cluster growth.`;case`spark.serializer`:return`Consider spark.serializer=org.apache.spark.serializer.KryoSerializer for faster, smaller buffers.`;case`spark.executor.memoryOverhead`:return`Raise executor memoryOverhead above Spark's default floor to avoid off-heap OOM-kills.`}break;case`duplicatePlanSubtree`:return`Check whether the repeated subtree could be computed once and reused, or cache/persist the shared computation.`;case`smallFiles`:return e.direction===`write`?`Repartition or coalesce before writing to raise the average file size.`:`Compact the upstream output so fewer, larger files are produced.`;case`underBroadcast`:return`This could have been a broadcast join: consider a broadcast() hint or raising spark.sql.autoBroadcastJoinThreshold.`;case`overBroadcast`:return`Check for a misapplied broadcast hint or a misconfigured spark.sql.autoBroadcastJoinThreshold.`}}function er(e){let t=Ce[e.type],n=typeof e.recommendation==`string`?e.recommendation.trim():``;return!t?.routeable||!n?null:{finding:e,widgetId:t.widgetId,region:t.region,findingLabel:t.findingLabel,stageId:typeof e.stageId==`number`?e.stageId:null,recommendation:n}}function tr(e,t){return t.includes(e)?er(e):null}function nr(e){return e.impactEstimate?.wallClock?.high??null}function rr(e){let t=new Map(me().map((e,t)=>[e.widgetId,t])),n=e.map((e,t)=>({target:er(e),catalogIndex:t})).filter(e=>e.target!==null);return n.sort((e,n)=>{let r=nr(e.target.finding),i=nr(n.target.finding);return r!==null&&i!==null&&r!==i?i-r:r!==null==(i!==null)?(t.get(e.target.widgetId)??2**53-1)-(t.get(n.target.widgetId)??2**53-1)||e.catalogIndex-n.catalogIndex:r===null?1:-1}),n[0]?.target??null}var ir=10;function ar(e){return Ae(e)&&Ce[e.type]!=null}function or(e){return ke(e.findings)[0].impactBand}function sr(e){let t=e.impactEstimate;return t?t.wallClock?Tt(t.wallClock.low,t.wallClock.high):t.rawWaste?Dt(t.rawWaste):null:null}function cr(e){let t=e.stageId==null?e.stageIds&&e.stageIds.length>0?`St.${at(e.stageIds)}`:null:`St.${e.stageId}`;if(e.type===`duplicatePlanSubtree`&&e.rootName!=null){let n=lr(e);return t&&n?`${t} · ${n}`:n??t}return t||(e.property?String(e.property):null)}function lr(e){if(e.type!==`duplicatePlanSubtree`||e.rootName==null)return null;let t=et(e.rootName),n=e.groupIndex==null?t:`${t} #${Number(e.groupIndex)+1}`;return e.executionId==null?n:`${n} (SQL ${e.executionId})`}function ur({finding:e,textClassName:t,visibleLimit:n,stackIdentity:r,stagePillClassName:i}){let{stageId:a,stageIds:o}=e;if(a!=null)return(0,H.jsx)(wt,{stageId:a});if(o&&o.length>0){let a=lr(e),s=a?(0,H.jsx)(`span`,{className:M(`truncate`,t),title:a,children:a}):null,c=(0,H.jsx)(Ct,{pills:o.map(e=>({id:e})),visibleLimit:n,pillOverrideClassName:r?i:void 0});return(0,H.jsx)(`span`,{className:M(`inline-flex min-w-0 items-center gap-1.5`,r?`flex-col`:`flex-wrap`),children:r?(0,H.jsxs)(H.Fragment,{children:[s,c]}):(0,H.jsxs)(H.Fragment,{children:[c,s]})})}let s=cr(e);return s?(0,H.jsx)(`span`,{className:M(`min-w-0 truncate`,t),title:s,children:s}):null}function dr(e){return(typeof e.recommendation==`string`?e.recommendation.trim():``)||(Ce[e.type]?.findingLabel??e.type)}function fr({finding:e,allFindings:t,onRoute:n}){let r=tr(e,t),i=cr(e),a=sr(e),o=dr(e),s=pe(e);return(0,H.jsxs)(P,{"data-testid":`fix-these-first-row`,"data-finding-type":e.type,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor})}),(0,H.jsx)(N,{className:`whitespace-normal`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>r&&n(r),children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium`,children:s}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o})]})}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,title:[i,a].filter(Boolean).join(` · `),children:(0,H.jsxs)(`span`,{className:`flex items-center justify-end gap-1.5`,children:[(0,H.jsx)(ur,{finding:e}),a?(0,H.jsx)(`span`,{className:`shrink-0`,children:a}):null]})})]})}function pr({finding:e,allFindings:t,onRoute:n,id:r}){let i=tr(e,t),a=cr(e),o=sr(e),s=dr(e),c=pe(e),l=e.stageId!=null||a!=null;return(0,H.jsxs)(P,{id:r,"data-testid":`fix-these-first-row`,"data-finding-type":e.type,className:`bg-muted/50`,children:[(0,H.jsxs)(N,{colSpan:2,className:`whitespace-normal`,children:[l?(0,H.jsx)(`div`,{className:`mb-1`,children:(0,H.jsx)(ur,{finding:e,textClassName:`line-clamp-1 break-words text-xs font-medium font-mono`})}):null,(0,H.jsxs)(`button`,{type:`button`,className:`block w-full cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>i&&n(i),children:[l?null:(0,H.jsx)(`span`,{className:`line-clamp-1 break-words text-xs font-medium`,children:c}),(0,H.jsx)(`span`,{className:`line-clamp-1 break-words text-xs text-muted-foreground`,children:s})]})]}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:o})]})}function mr(e){return e.kind===`time`?`×${e.findingCount} · ${Tt(e.recoverableMsHigh,e.recoverableMsHigh)} recoverable`:e.kind===`resource`?`×${e.findingCount} · resource-cost projection`:Object.entries(e.byImpactBand).map(([e,t])=>`${t} ${e}`).join(`, `)}function hr(e){return e.kind===`time`?`${e.findingCount} findings of this type; up to ${Tt(e.recoverableMsHigh,e.recoverableMsHigh)} of run time could be recovered by fixing them`:e.kind===`resource`?`${e.findingCount} findings of this type; a resource-cost estimate (not run time) is projected for fixing them`:`${e.findingCount} findings of this type, by impact`}function gr({group:e,allFindings:t,expanded:n,onToggle:r,onRoute:i}){let[a,o]=(0,V.useState)(0),s=ke(e.findings),c=s[0],l=$n(c),u=pe(c),d=Math.ceil(s.length/ir),f=Math.min(a,Math.max(0,d-1)),p=s.slice(f*ir,f*ir+ir),m=`fix-these-first-group-content-${e.kind}-${e.type}${`unit`in e?`-${e.unit}`:``}`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(P,{"data-testid":`fix-these-first-group-row`,"data-finding-type":e.type,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsx)(We,{type:e.type,impactBand:c.impactBand,docAnchor:He(e.findings)})}),(0,H.jsx)(N,{className:`whitespace-normal`,children:(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":m,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:r,children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium`,children:u}),l?(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:l}):null]})}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1.5`,title:hr(e),children:[mr(e),n?(0,H.jsx)(Ge,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,H.jsx)(rt,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})})]}),n&&p.map((e,n)=>(0,H.jsx)(pr,{finding:e,allFindings:t,onRoute:i,id:n===0?m:void 0},e.id)),n&&d>1&&(0,H.jsx)(P,{className:`bg-muted/50`,children:(0,H.jsx)(N,{colSpan:3,children:(0,H.jsx)(kt,{page:f,totalPages:d,onPrev:()=>o(e=>e-1),onNext:()=>o(e=>e+1)})})})]})}function _r({target:e,onRoute:t}){let n=cr(e.finding),r=sr(e.finding),i=e.finding.stageId!=null||n!=null,[a,o]=(0,V.useState)(!1),s=async()=>{let t=`${pe(e.finding)} — ${dr(e.finding)}`,n=[/[.!?]$/.test(t)?t:`${t}.`,r?`Potential savings: ${r}`:null].filter(Boolean).join(` `);try{await T(n),o(!0),setTimeout(()=>o(!1),1500)}catch{}};return(0,H.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 transition-colors hover:bg-primary/10`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-label":`${pe(e.finding)}, ${dr(e.finding)}`,onClick:()=>t(e),className:`flex cursor-pointer flex-col gap-2 rounded-lg px-4 py-3 text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-semibold tracking-wide text-primary uppercase`,children:[(0,H.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5`}),`Highest impact`]}),(0,H.jsxs)(`p`,{className:`mt-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold`,children:pe(e.finding)}),(0,H.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`, `,dr(e.finding)]})]})]}),r?(0,H.jsxs)(`div`,{className:`min-w-0 sm:shrink-0 sm:text-right`,children:[(0,H.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Potential savings`}),(0,H.jsx)(`p`,{className:`whitespace-nowrap font-mono text-lg font-semibold leading-tight tabular-nums text-primary`,children:r})]}):null]}),(0,H.jsxs)(`div`,{className:M(`flex items-center gap-3 px-4 pb-3`,i?`justify-between`:`justify-end`),children:[i?(0,H.jsx)(ur,{finding:e.finding,textClassName:`line-clamp-2 max-w-[140px] break-words text-xs font-semibold text-muted-foreground`,visibleLimit:2,stackIdentity:!0,stagePillClassName:`h-5 px-1.5 text-[10px] font-normal`}):null,(0,H.jsx)(`button`,{type:`button`,"data-testid":`copy-finding-button`,onClick:()=>void s(),className:`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`}),`Copied`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(jt,{"aria-hidden":`true`,className:`size-3.5`}),`Copy finding`]})})]})]})}function vr(e,t,n){let r=[...e,...t].filter(ar);return{eligible:r,groups:Oe(r,n),triageTarget:rr(r)}}var yr={critical:`Critical`,warning:`Warning`,info:`Info`},br=[`critical`,`warning`,`info`];function xr(e){return`${e.kind}-${e.type}-${`unit`in e?e.unit:``}`}function Sr({impactBand:e,groups:t,widgets:n,allFindings:r,expandedGroupKey:i,onToggleGroup:a,onRoute:o,appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d}){if(t.length===0&&n.length===0)return null;let f=`impact-band-${e}-heading`;return(0,H.jsxs)(`section`,{"aria-labelledby":f,className:`space-y-3`,children:[(0,H.jsx)(`h2`,{id:f,className:`font-heading text-base font-semibold`,children:yr[e]}),t.length>0&&(0,H.jsx)(it,{children:(0,H.jsx)(tt,{children:t.map(e=>{if(e.findingCount===1)return(0,H.jsx)(fr,{finding:e.findings[0],allFindings:r,onRoute:o},e.findings[0].id);let t=xr(e);return(0,H.jsx)(gr,{group:e,allFindings:r,expanded:i===t,onToggle:()=>a(t),onRoute:o},t)})})}),n.length>0&&(0,H.jsx)(st,{children:n.map(({component:e,widgetId:t,index:n})=>(0,H.jsx)(R,{cardId:`alert-${n}`,widgetId:t,children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Xe,{}),children:(0,H.jsx)(e,{appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d,defaultCollapsed:!0})})},t))})]})}function Cr({appModel:e,catalog:t,configFindings:n=[],stages:r,getTaskData:i,activeFileId:a,onRoute:o}){let{eligible:s,groups:c,triageTarget:l}=(0,V.useMemo)(()=>vr(t,n,r),[t,n,r]),u=[...t,...n],d=(0,V.useMemo)(()=>Zn(t,n),[t,n]),[f,p]=(0,V.useState)(null),{groupsByImpactBand:m,widgetsByImpactBand:h}=(0,V.useMemo)(()=>{let e=new Map;for(let t of c){let n=or(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}let t=new Map;for(let e of d)t.has(e.impactBand)||t.set(e.impactBand,[]),t.get(e.impactBand).push(e);return{groupsByImpactBand:e,widgetsByImpactBand:t}},[c,d]);return(0,H.jsxs)(`div`,{id:qn,className:`space-y-6 scroll-mt-20`,children:[l?(0,H.jsx)(_r,{target:l,onRoute:o}):null,s.length===0?(0,H.jsx)(_t,{tone:`clean`,icon:Fe,title:`No findings to fix right now.`}):null,br.map(r=>(0,H.jsx)(Sr,{impactBand:r,groups:m.get(r)??[],widgets:h.get(r)??[],allFindings:u,expandedGroupKey:f,onToggleGroup:e=>p(t=>t===e?null:e),onRoute:o,appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a},r)),(0,H.jsx)(Qn,{appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a})]})}var wr=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`],Tr=[A.clean,A.accent,A.warning,A.muted,A.critical];function Er(e){return e?new Date(e).toLocaleString():`—`}function Dr({stats:e}){let t=new Map(e.map(e=>[e.locality,e.count])),n=wr.filter(e=>t.has(e));for(let t of e)wr.includes(t.locality)||n.push(t.locality);let r=n.map((e,n)=>({locality:e,count:t.get(e)??0,color:Tr[Math.min(n,Tr.length-1)]}));return(0,H.jsx)(k,{ariaLabel:`Task locality distribution`,height:140,table:{caption:`Task locality distribution`,columns:[`Locality tier`,`Task count`],rows:r.map(e=>[e.locality,e.count]),align:[`left`,`right`]},children:(0,H.jsxs)(l,{data:r,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`locality`,tick:{fontSize:10}}),(0,H.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,H.jsx)(h,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Tasks`]}),(0,H.jsx)(u,{dataKey:`count`,name:`Tasks`,children:r.map(e=>(0,H.jsx)(a,{fill:e.color},e.locality))})]})})}function Or(e){let t=new Map;for(let n of e){t.has(n.type)||t.set(n.type,{impactBand:n.impactBand,finding:n,recs:new Map});let e=t.get(n.type);ct[n.impactBand]<ct[e.impactBand]&&(e.impactBand=n.impactBand,e.finding=n),n.recommendation&&!e.recs.has(n.recommendation)&&e.recs.set(n.recommendation,{extended:n.extended??null})}return[...t.entries()].sort(([,e],[,t])=>ct[e.impactBand]-ct[t.impactBand])}function kr({rec:e,extended:t,finding:n,showImpactEstimate:r}){return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`p`,{className:`max-w-full leading-normal break-words`,children:e}),t?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null,r?(0,H.jsx)(Ot,{finding:n}):null]})}function Ar({findings:e}){if(e.length===0)return null;let t=Or(e);return(0,H.jsx)(`section`,{className:`space-y-3 rounded-md border p-3`,children:t.map(([e,{impactBand:t,finding:n,recs:r}])=>{let i=Et(n.impactEstimate)!==null;return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(We,{type:e,impactBand:t}),[...r.entries()].map(([e,{extended:t}],r)=>(0,H.jsx)(kr,{rec:e,extended:t,finding:n,showImpactEstimate:r===0&&i},r))]},e)})})}function jr({stage:e,appModel:t}){return ge(e.id,t)?(0,H.jsx)(fe,{title:`Query Plan`,children:(0,H.jsx)(we,{stageId:e.id,appModel:t})}):null}function Mr({stage:e,appModel:t,catalog:n,getTaskData:r}){let{exportMode:i,getTaskData:a}=bt(r),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),f=(e.taskCount??0)>0,p=n.filter(t=>t.stageId===e.id);(0,V.useEffect)(()=>{if(!f||!a)return;let t=!1;return l(!1),a(e.id).catch(()=>null).then(e=>{t||(e?s(e):l(!0))}),()=>{t=!0}},[u]);let m=(e.completedAt??0)-(e.submittedAt??0),h=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,g=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,_=e.fetchWaitTime??0,v=_>0&&m>0?Math.round(_/m*100):null,y=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,b=e.localityStats??[];return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(Ar,{findings:p}),(0,H.jsx)(ue,{title:`Overview`,collapsible:!0,defaultOpen:!0,rows:[[`Duration`,F(m)],[`Submitted`,Er(e.submittedAt)],[`Completed`,Er(e.completedAt)],e.sqlExecutionId!=null&&[`SQL Execution`,`#${e.sqlExecutionId}`],e.stageType?[`Stage type`,e.stageType]:!1]}),(0,H.jsx)(ue,{title:`Tasks`,collapsible:!0,rows:[[`Total`,String(e.taskCount)],[`Failed`,String(e.failedTasks)],[`P50 duration`,(e.taskDurationP50??0)>0?F(e.taskDurationP50):`—`],[`P95 duration`,(e.taskDurationP95??0)>0?F(e.taskDurationP95):`—`],[`Max duration`,(e.taskDurationMax??0)>0?F(e.taskDurationMax):`—`],(e.peakExecutionMemoryMax??0)>0&&[`Peak execution memory`,z(e.peakExecutionMemoryMax)]],children:f?i?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Per-task duration data isn’t included in exported reports.`}):o?(0,H.jsx)(xt,{metrics:o.metrics,fieldNames:o.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):c?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Couldn’t load task data for this stage.`}),(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>d(e=>e+1),children:`Retry`})]}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading task data…`}):null}),(0,H.jsx)(ue,{title:`Locality`,collapsible:!0,rows:[],children:b.length>0?(0,H.jsx)(Dr,{stats:b}):null}),(0,H.jsx)(ue,{title:`I/O`,collapsible:!0,rows:[[`Input`,z(e.inputBytes)],[`Output`,z(e.outputBytes)],[`Shuffle read`,z(e.shuffleReadBytes)],[`Shuffle write`,z(e.shuffleWriteBytes)],_>0&&[`Fetch wait`,`${F(_)}${v==null?``:` (${v}%)`}`],y!=null&&[`I/O ratio`,y]]}),h?(0,H.jsx)(ue,{title:`Spill`,collapsible:!0,rows:[[`Memory spilled`,z(e.memoryBytesSpilled)],[`Disk spilled`,z(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&[`Classification`,e.spillClassification??`unclassified`]]}):null,g?(0,H.jsx)(ue,{title:`GC`,collapsible:!0,rows:[[`JVM GC time`,F(e.jvmGCTime)],[`Executor run time`,F(e.executorRunTime)],[`GC %`,`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?(0,H.jsx)(L,{children:(0,H.jsx)(fe,{title:`Call Stack`,children:(0,H.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap`,children:e.details})})}):null,(0,H.jsx)(jr,{stage:e,appModel:t})]})}function Nr({appModel:e,catalog:t,getTaskData:n}){let{stageId:r,close:i}=ot(),a=r==null?void 0:e.stages.get(r);return(0,H.jsx)(Se,{open:a!=null,onOpenChange:e=>{e||i()},children:(0,H.jsx)(Te,{className:`max-h-[85vh] overflow-y-auto sm:max-w-4xl`,children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ye,{children:(0,H.jsxs)(De,{children:[`Stage `,a.id,` `,(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,a.name??``]})]})}),(0,H.jsx)(Mr,{stage:a,appModel:e,catalog:t,getTaskData:n},a.id)]}):null})})}function Pr(e){return Fr(e)||typeof e==`function`||Ir(e)}function Fr(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Ir(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function W(e,t){return e==null?null:Pr(e)?V.createElement(e,t):e}function Lr(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?W(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:W(n.cell,t.getContext())}return`header`in e&&e.header?W(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?W(e.footer.column.columnDef.footer,e.footer.getContext()):null}function Rr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function zr(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Br=[],Vr=0,{link:Hr,unlink:Ur,propagate:Wr,checkDirty:Gr,shallowPropagate:Kr}=Rr({update(e){return e._update()},notify(e){Br[Jr++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Zr(e))}}),qr=0,Jr=0,G,Yr=0;function Xr(e){try{++Yr,e()}finally{--Yr||Qr()}}function Zr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ur(n,e)}function Qr(){if(!(Yr>0)){for(;qr<Jr;){let e=Br[qr];Br[qr++]=void 0,e.notify()}qr=0,Jr=0}}function $r(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return G!==void 0&&Hr(i,G,Vr),i._snapshot},subscribe(e){let t=zr(e),n={current:!1},r=ei(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=G,o=t?.compare??Object.is;if(n)G=i,++Vr,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{G=a,n&&(i.flags&=-5),Zr(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Gr(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Kr(e)}}else e&32&&(i.flags=e&-33);return G!==void 0&&Hr(i,G,Vr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Wr(e),Kr(e),Qr())}},i}function ei(e){let t=()=>{let t=G;G=n,++Vr,n.depsTail=void 0,n.flags=6;try{return e()}finally{G=t,n.flags&=-5,Zr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Gr(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Zr(this)}};return t(),n}function ti(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=ni(e);if(n.length!==ni(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function ni(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var ri=e(r(),1);function ii(e,t){return e===t}function ai(e,t=e=>e,n){let r=n?.compare??ii,i=(0,V.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,V.useCallback)(()=>e.get(),[e]);return(0,ri.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function oi(e){let t=ai(e.source,e.selector,{compare:ti});return typeof e.children==`function`?e.children(t):e.children}function si(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function ci(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function li(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function ui(){return ci({createAtom:$r,batch:Xr})}function di(e,t){return typeof e==`function`?e(t):e}function K(e){if(Array.isArray(e))return e.map(K);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?q():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:K(e[i]),writable:!0})}return n}return e}function fi(e,t){let n=Object.keys(t),r=e;for(let e=0;e<n.length;e++){let i=n[e];!i.startsWith(`_memo_`)&&i!==`_cellsCache`&&(r[i]=t[i])}return e}function q(){return Object.create(null)}function pi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mi(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>di(n,e))}}function hi(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function gi(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var _i=3;function vi(e,t){return yi(e,t,_i)}function yi(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!hi(e)||!hi(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=gi(e),i=gi(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e<r.length;e++){let i=r[e];if(!Object.prototype.propertyIsEnumerable.call(t,i)||!yi(a[i],o[i],n-1))return!1}return!0}function bi(e,t,n,r=vi){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=di(n,e);return r(e,t)?e:t})}function xi(e){return e instanceof Function}function Si(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var Ci=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u?(o=l,a?.(),s=e(...l??[]),r?.(s),s):s}};function wi(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function Ti({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o=()=>{if(!r)return;let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))},s={onAfterUpdate:()=>{o()}};return Ci({...a,...s})}function Ei(e,t=`_`){let[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function J(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=Ei(r);t[n]=a?Ti({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function Y(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=Ei(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=Ti({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function X(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function Di(e){return e.row.getValue(e.column.id)}function Oi(e){return e.getValue()??e.table.options.renderFallbackValue}function ki(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Ai={assignCellPrototype:(e,t)=>{Y(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Di(e)},cell_renderValue:{fn:e=>Oi(e)},cell_getContext:{fn:e=>ki(e),memoDeps:e=>[e]}})}};function ji(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function Mi(e,t,n){let r=ji(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Ni(){return{start:[],end:[]}}function Pi(){return q()}function Fi(e,t){Ii(e)&&Hi(e.table,n=>{let r=Object.assign(q(),n),i=t??!X(e,`getIsVisible`,Z),a=e.getLeafColumns();for(let e=0;e<a.length;e++){let t=a[e];Ii(t)&&(r[t.id]=i)}return r})}function Z(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>X(e,`getIsVisible`,Z)):(pi(t,e.id)?t[e.id]:void 0)??!0}function Ii(e){return(e.columnDef.enableHiding??!0)&&(e.table.options.enableHiding??!0)}function Li(e){return t=>{Fi(e,t.target.checked)}}function Ri(e){let t=e.getAllCells(),n=[];for(let e=0;e<t.length;e++){let r=t[e];X(r.column,`getIsVisible`,Z)&&n.push(r)}let{start:r,end:i}=e.table.atoms.columnPinning?.get()??Ni();if(!r.length&&!i.length)return n;let a=X(e,`getVisibleCellsByColumnId`,zi),o=[];for(let e=0;e<r.length;e++){let t=a[r[e]];t&&o.push(t)}let s=[];for(let e=0;e<i.length;e++){let t=a[i[e]];t&&s.push(t)}let c=[];for(let e=0;e<n.length;e++){let t=n[e],a=t.column.id;!r.includes(a)&&!i.includes(a)&&c.push(t)}return[...o,...c,...s]}function zi(e){let t=q(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];X(r.column,`getIsVisible`,Z)&&(t[r.column.id]=r)}return t}function Bi(e){return e.getAllFlatColumns().filter(e=>X(e,`getIsVisible`,Z))}function Vi(e){return e.getAllLeafColumns().filter(e=>X(e,`getIsVisible`,Z))}function Hi(e,t){bi(e,`columnVisibility`,t)}function Ui(e,t){Hi(e,t?q():Object.assign(q(),K(e.initialState.columnVisibility??{})))}function Wi(e,t){t??=!Gi(e);let n=q(),r=e.getAllLeafColumns();for(let e=0;e<r.length;e++){let i=r[e];n[i.id]=t||!Ii(i)}Hi(e,n)}function Gi(e){return!e.getAllLeafColumns().some(e=>!X(e,`getIsVisible`,Z))}function Ki(e){return e.getAllLeafColumns().some(e=>X(e,`getIsVisible`,Z))}function qi(e){return t=>{Wi(e,t.target.checked)}}function Ji(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];X(i,`getIsVisible`,Z)&&i.columns.length&&(n=Math.max(n,Ji(i.columns,t+1)))}return n}function Yi(e,t){return e?`${e}_${t}`:String(t)}function Xi(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function Zi(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function Qi(e,t,n,r,i,a){let o={depth:t,id:Yi(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=Mi(n,u,{id:Xi(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Zi(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&Qi(s,t-1,n,r,i,a)}function $i(e){for(let t=0;t<e.length;t++){let n=e[t];if(!X(n.column,`getIsVisible`,Z))continue;let r=0;if(n.subHeaders.length){$i(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];X(t.column,`getIsVisible`,Z)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function ea(e,t,n,r){let i=Ji(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=Mi(n,t[e],{depth:i,index:e}));return Qi(s,i-1,n,r,a,o),a.reverse(),$i(a[0]?.headers??[]),a}function ta(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function na(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=ta(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function ra(e){let t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{let e=new Map;for(let t=0;t<n.length;t++){let r=n[t];e.set(r.id,r)}for(let n=0;n<t.length;n++){let i=t[n],a=e.get(i);a&&(r.push(a),e.delete(i))}for(let t=0;t<n.length;t++){let i=n[t];e.has(i.id)&&r.push(i)}}return ia(e,r)}}function ia(e,t){let n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;let i=t.filter(e=>!n.includes(e.id));if(r===`remove`)return i;let a=new Map;for(let e=0;e<t.length;e++){let n=t[e];a.set(n.id,n)}let o=[];for(let e=0;e<n.length;e++){let t=a.get(n[e]);t&&o.push(t)}return[...o,...i]}function aa(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function oa(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return X(e.table,`getOrderColumns`,ra)(t)}return[e]}function sa(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function ca(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=na(e,o,r,n),c=o;s.columns=c.columns?ca(e,c.columns,s,r+1):[],i[a]=s}return i}function la(e){return ca(e,e.options.columns)}function ua(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function da(e){let t=q(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function fa(e){let t=e.getAllColumns().flatMap(e=>e.getLeafColumns());return X(e,`getOrderColumns`,ra)(t)}function pa(e){let t=q(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function ma(e,t){return e.getAllFlatColumnsById()[t]}var ha={assignColumnPrototype:(e,t)=>{Y(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>aa(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>oa(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{J(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>sa(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>la(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>ua(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>da(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>fa(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>pa(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>ma(e,t)}})}};function ga(e,t){for(let n=0;n<e.subHeaders.length;n++)ga(e.subHeaders[n],t);t.push(e)}function _a(e){let t=[];return ga(e,t),t}function va(e){return{column:e.column,header:e,table:e.column.table}}function ya(e){let{start:t,end:n}=e.atoms.columnPinning?.get()??Ni(),r=e.getAllColumns(),i=X(e,`getVisibleLeafColumns`,Vi);if(!t.length&&!n.length)return ea(r,i,e);let a=e.getAllLeafColumnsById(),o=[];for(let e=0;e<t.length;e++){let n=a[t[e]];n&&X(n,`getIsVisible`,Z)&&o.push(n)}let s=[];for(let e=0;e<n.length;e++){let t=a[n[e]];t&&X(t,`getIsVisible`,Z)&&s.push(t)}let c=i.filter(e=>!t.includes(e.id)&&!n.includes(e.id));return ea(r,[...o,...c,...s],e)}function ba(e){return[...e.getHeaderGroups()].reverse()}function xa(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function Sa(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var Ca={assignHeaderPrototype:(e,t)=>{Y(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>_a(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>va(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{J(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>ya(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>ba(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>xa(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>Sa(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function wa(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var Ta=(e,t,n,r,i,a,o)=>{let s=wa(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=q(),c._valuesCache=q(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c},Ea=/([0-9]+)/gm;function Q(e){let t=Object.assign((e,n,r)=>{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}Q({resolveDataValue:e=>Aa(e).toLowerCase(),sort:(e,t)=>ja(e,t)}),Q({resolveDataValue:e=>Aa(e),sort:(e,t)=>ja(e,t)}),Q({resolveDataValue:e=>Aa(e).toLowerCase(),sort:(e,t)=>Oa(e,t)}),Q({resolveDataValue:e=>Aa(e),sort:(e,t)=>Oa(e,t)}),Q({resolveDataValue:e=>ka(e),sort:(e,t)=>e>t?1:e<t?-1:0});var Da=Q({sort:(e,t)=>Oa(e,t)});function Oa(e,t){return e===t?0:e>t?1:-1}function ka(e){return e instanceof Date?e.getTime():e}function Aa(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function ja(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n<i&&r<a;){let i=Ma(e.charCodeAt(n)),a=Ma(t.charCodeAt(r)),o=Na(e,n,i),s=Na(t,r,a);if(!i&&!a){let i=Pa(e,n,o,t,r,s);if(i)return i;n=o,r=s;continue}if(i!==a)return i?1:-1;let c=Fa(e,n,o,t,r,s);if(c)return c;n=o,r=s}return La(e,n)-La(t,r)}function Ma(e){return e>=48&&e<=57}function Na(e,t,n){let r=t+1;for(;r<e.length&&Ma(e.charCodeAt(r))===n;)r++;return r}function Pa(e,t,n,r,i,a){let o=n-t,s=a-i,c=o<s?o:s;for(let n=0;n<c;n++){let a=e.charCodeAt(t+n),o=r.charCodeAt(i+n);if(a>o)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function Fa(e,t,n,r,i,a){let o=t;for(;o<n&&e.charCodeAt(o)===48;)o++;let s=i;for(;s<a&&r.charCodeAt(s)===48;)s++;let c=n-o,l=a-s;if(c===0&&l===0)return 0;if(c<=15&&l<=15){let t=Ia(e,o,n),i=Ia(r,s,a);return t>i?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function Ia(e,t,n){let r=0;for(let i=t;i<n;i++)r=r*10+e.charCodeAt(i)-48;return r}function La(e,t){let n=0,r=t;for(;r<e.length;)n++,r=Na(e,r,Ma(e.charCodeAt(r)));return n}function Ra(){return[]}function za(e,t){bi(e,`cellSelection`,t?Ra():K(e.initialState.cellSelection)??Ra())}function Ba(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>za(e))}function Va(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>Ha(e))}function Ha(e,t){let n=e.initialState.expanded;bi(e,`expanded`,t?q():n===!0||Object.assign(q(),K(n??{})))}function Ua(e){let t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||Wa(t,e.id)))}function Wa(e,t){return!!(e&&e!==!0&&pi(e,t)&&e[t])}var $=0,Ga=10;function Ka(){return{pageIndex:$,pageSize:Ga}}function qa(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??$)===$)return;Za(e,!0)}}function Ja(e,t){bi(e,`pagination`,t)}function Ya(e,t){Ja(e,t?Ka():K(e.initialState.pagination??Ka()))}function Xa(e,t){Ja(e,n=>{let r=di(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})}function Za(e,t){Xa(e,t?$:e.initialState.pagination?.pageIndex??$)}function Qa(e,t){$a(e,t?Ga:e.initialState.pagination?.pageSize??Ga)}function $a(e,t){Ja(e,e=>{let n=Math.max(1,di(t,e.pageSize)),r=e.pageSize===1/0?0:e.pageSize*e.pageIndex,i=n===1/0?0:Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})}function eo(e){let t=co(e),n=[];return t&&t>0&&(n=[...Array(t)].fill(null).map((e,t)=>t)),n}function to(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function no(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=co(e);return n===-1||n!==0&&t<n-1}function ro(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=co(e);return Number.isFinite(n)&&n>0&&t<n-1}function io(e){return Xa(e,e=>e-1)}function ao(e){return Xa(e,e=>e+1)}function oo(e){return Xa(e,0)}function so(e){let t=co(e);if(!(!Number.isFinite(t)||t<=0))return Xa(e,t-1)}function co(e){let t=e.options.pageCount;if(t!=null)return t;let n=lo(e),r=e.atoms.pagination?.get()?.pageSize??Ga;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function lo(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function uo(){return[]}function fo(e,t){bi(e,`sorting`,t)}function po(e,t){fo(e,t?[]:K(e.initialState.sorting??[]))}function mo(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&po(e)}function ho(e){let t=e.table._rowModelFns.sortFns,n=e.table.getFilteredRowModel().flatRows.slice(0,10),r,i=!1;for(let t=0;t<n.length;t++){let a=n[t].getValue(e.id);if(Object.prototype.toString.call(a)===`[object Date]`){r=`datetime`;break}if(typeof a==`string`&&(i=!0,a.split(Ea).length>1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return Da}function go(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<t.length;n++){let r=t[n].getValue(e.id);if(r!=null)return typeof r==`string`?`asc`:`desc`}return`desc`}function _o(e){let t=e.table._rowModelFns.sortFns;return xi(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn===`auto`?ho(e):t?.[e.columnDef.sortFn]??Da}function vo(e,t,n){let r=bo(e,n&&So(e)),i=t!==void 0;fo(e.table,a=>{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&So(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function yo(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??go(e)===`desc`?`desc`:`asc`}function bo(e,t){let n=yo(e),r=Co(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function xo(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function So(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function Co(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function wo(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function To(e){fo(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function Eo(e){let t=xo(e);return n=>{t&&vo(e,void 0,So(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function Do(){return e=>Ti({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>ko(e,e.options.data),onAfterUpdate:wi(()=>{Va(e),qa(e),mo(e),Ba(e)})})}function Oo(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=Ta(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=Oo(e,t,c.originalSubRows,r+1,c)))}return a}function ko(e,t){let n={rows:[],flatRows:[],rowsById:q()};return n.rows=Oo(e,n,t),n}function Ao(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??Do()(e)),e._rowModels.coreRowModel()}function jo(e){return e.getCoreRowModel()}function Mo(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function No(e){return e.getFilteredRowModel()}function Po(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function Fo(e){return e.getGroupedRowModel()}function Io(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function Lo(e){return e.getSortedRowModel()}function Ro(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function zo(e){return e.getExpandedRowModel()}function Bo(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function Vo(e){return e.getPaginatedRowModel()}var Ho={constructTableAPIs:e=>{J(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>Ao(e)},table_getPreFilteredRowModel:{fn:()=>jo(e)},table_getFilteredRowModel:{fn:()=>Mo(e)},table_getPreGroupedRowModel:{fn:()=>No(e)},table_getGroupedRowModel:{fn:()=>Po(e)},table_getPreSortedRowModel:{fn:()=>Fo(e)},table_getSortedRowModel:{fn:()=>Io(e)},table_getPreExpandedRowModel:{fn:()=>Lo(e)},table_getExpandedRowModel:{fn:()=>Ro(e)},table_getPrePaginatedRowModel:{fn:()=>zo(e)},table_getPaginatedRowModel:{fn:()=>Bo(e)},table_getRowModel:{fn:()=>Vo(e)}})}};function Uo(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function Wo(e,t,n){let r=Uo(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Go(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function Ko(e){let t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){let e=[],n=t=>{t._displayIndexCache=e.length,e.push(t),t.subRows.length&&t.getIsExpanded?.()&&t.subRows.forEach(n)};return t.forEach(n),e}for(let e=0;e<t.length;e++)t[e]._displayIndexCache=e;return t}function qo(e,t){if(pi(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function Jo(e,t){if(pi(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function Yo(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function Xo(e){return Si(e.subRows,e=>e.subRows)}function Zo(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function Qo(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function $o(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function es(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=Wo(a,e,e.table),n.set(a,o)),r[i]=o}return r}function ts(e){let t=q(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function ns(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function rs(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var is={assignRowPrototype:(e,t)=>{Y(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Go(e)},row_getAllCellsByColumnId:{fn:e=>ts(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>es(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>Xo(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>Qo(e)},row_getParentRows:{fn:e=>$o(e)},row_getUniqueValues:{fn:(e,t)=>Jo(e,t)},row_getValue:{fn:(e,t)=>qo(e,t)},row_renderValue:{fn:(e,t)=>Yo(e,t)}})},constructTableAPIs:e=>{J(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>Ko(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>ns(t,e,n,r)},table_getRow:{fn:(t,n)=>rs(e,t,n)},table_getMaxSubRowDepth:{fn:()=>Zo(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function as(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function os(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{as(e,t,n),e._reactivity.commit?.()})}function ss(e){let t=K(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function cs(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function ls(e,t,n){let r=cs(e,di(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&os(e,r.state??null)}var us={coreCellsFeature:Ai,coreColumnsFeature:ha,coreHeadersFeature:Ca,coreRowModelsFeature:Ho,coreRowsFeature:is,coreTablesFeature:{constructTableAPIs:e=>{J(`coreTablesFeature`,e,{table_reset:{fn:()=>ss(e)},table_setOptions:{fn:t=>ls(e,t)}})}}};function ds(e){return e}function fs(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),K(t)}function ps(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...us,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=fs(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&pi(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}as(v),v.store=si(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:ti,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}var ms={getInitialState:e=>({columnVisibility:Pi(),...e}),getDefaultTableOptions:e=>({onColumnVisibilityChange:mi(`columnVisibility`,e)}),assignColumnPrototype:(e,t)=>{Y(`columnVisibilityFeature`,e,t,{column_getIsVisible:{fn:e=>Z(e),memoDeps:e=>[t.options.columns,t.atoms.columnVisibility?.get(),e.columns]},column_getCanHide:{fn:e=>Ii(e)},column_getToggleVisibilityHandler:{fn:e=>Li(e)},column_toggleVisibility:{fn:(e,t)=>Fi(e,t)}})},assignRowPrototype:(e,t)=>{Y(`columnVisibilityFeature`,e,t,{row_getVisibleCells:{fn:e=>Ri(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get()]},row_getVisibleCellsByColumnId:{fn:e=>zi(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnVisibility?.get()]}})},constructTableAPIs:e=>{J(`columnVisibilityFeature`,e,{table_getVisibleFlatColumns:{fn:()=>Bi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getVisibleLeafColumns:{fn:()=>Vi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_setColumnVisibility:{fn:t=>Hi(e,t)},table_resetColumnVisibility:{fn:t=>Ui(e,t)},table_toggleAllColumnsVisible:{fn:t=>Wi(e,t)},table_getIsAllColumnsVisible:{fn:()=>Gi(e)},table_getIsSomeColumnsVisible:{fn:()=>Ki(e)},table_getToggleAllColumnsVisibilityHandler:{fn:()=>qi(e)}})}},hs={getInitialState:e=>({...e,pagination:{...Ka(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:mi(`pagination`,e)}),constructTableAPIs:e=>{J(`rowPaginationFeature`,e,{table_autoResetPageIndex:{fn:()=>qa(e)},table_setPagination:{fn:t=>Ja(e,t)},table_resetPagination:{fn:t=>Ya(e,t)},table_setPageIndex:{fn:t=>Xa(e,t)},table_resetPageIndex:{fn:t=>Za(e,t)},table_setPageSize:{fn:t=>$a(e,t)},table_getPageCount:{fn:()=>co(e)},table_resetPageSize:{fn:t=>Qa(e,t)},table_getPageOptions:{fn:()=>eo(e)},table_getCanPreviousPage:{fn:()=>to(e)},table_getCanNextPage:{fn:()=>no(e)},table_getCanLastPage:{fn:()=>ro(e)},table_previousPage:{fn:()=>io(e)},table_nextPage:{fn:()=>ao(e)},table_firstPage:{fn:()=>oo(e)},table_lastPage:{fn:()=>so(e)},table_getRowCount:{fn:()=>lo(e)}})}},gs={getInitialState(e){return{sorting:uo(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:mi(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){Y(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>ho(e)},column_getAutoSortDir:{fn:e=>go(e)},column_getSortFn:{fn:e=>_o(e)},column_toggleSorting:{fn:(e,t,n)=>vo(e,t,n)},column_getFirstSortDir:{fn:e=>yo(e)},column_getNextSortingOrder:{fn:(e,t)=>bo(e,t)},column_getCanSort:{fn:e=>xo(e)},column_getCanMultiSort:{fn:e=>So(e)},column_getIsSorted:{fn:e=>Co(e)},column_getSortIndex:{fn:e=>wo(e)},column_clearSorting:{fn:e=>To(e)},column_getToggleSortingHandler:{fn:e=>Eo(e)}})},constructTableAPIs(e){J(`rowSortingFeature`,e,{table_setSorting:{fn:t=>fo(e,t)},table_resetSorting:{fn:t=>po(e,t)}})}};function _s(e){let t=[],n=e=>{t.push(e),e.subRows.length&&Ua(e)&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vs(){return e=>{let t=e;return Ti({feature:`rowPaginationFeature`,table:t,fnName:`table.getPaginatedRowModel`,memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>ys(t)})}}function ys(e){let t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;let{pageSize:r,pageIndex:i}=n??Ka(),{rows:a,flatRows:o,rowsById:s}=t,c=a;if(r!==1/0||i!==0){let e=r*i,t=e+r;c=a.slice(e,t)}let l;l=e.options.paginateExpandedRows?{rows:c,flatRows:o,rowsById:s}:_s({rows:c,flatRows:o,rowsById:s}),l.flatRows=[];let u=new Set,d=e=>{u.has(e.id)||(u.add(e.id),l.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d))};return l.rows.forEach(d),l}function bs(){return e=>{let t=e;return Ti({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>xs(t),onAfterUpdate:wi(()=>qa(t))})}}function xs(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?xo(n):!1});if(!i.length)return t;let a=[];for(let t=0;t<i.length;t++){let n=i[t],r=e.getColumn(n.id);r&&a.push({id:n.id,desc:n.desc,sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortFn:_o(r)})}let o=(e,t)=>{for(let n=0;n<a.length;n++){let r=a[n],i=r.sortUndefined,o=r.desc,s=0;if(i){let n=e.getValue(r.id),a=t.getValue(r.id),o=n===void 0,c=a===void 0;if(o&&c)continue;if(o||c){if(i===`first`)return o?-1:1;if(i===`last`)return o?1:-1;s=o?i:-i}}if(s===0&&(s=r.sortFn(e,t,r.id)),s!==0)return o&&(s*=-1),r.invertSorting&&(s*=-1),s}return e.index-t.index},s=e=>{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i<t.length;i++){let a=t[i];a!==e[i]&&(n=!0);let o=r.length;if(r.push(a),a.subRows.length){let e=s(a.subRows);if(e.changed){let s=Object.create(Object.getPrototypeOf(a));fi(s,a),s.subRows=e.rows,t[i]=s,r[o]=s,n=!0}}}return{rows:t,changed:n}};return{rows:s(t.rows).rows,flatRows:r,rowsById:t.rowsById}}var Ss=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Cs(e,t){let[{table:n,rootSource:r}]=(0,V.useState)(()=>{let t=ps({...e,features:{coreReactivityFeature:ui(),...e.features}});return t.Subscribe=(e=>oi({...e,source:e.source??t.store})),t.FlexRender=Lr,{table:t,rootSource:li(t.store,ti)}}),i=n;ls(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=ai(r,t,{compare:ti});return Ss(()=>{r.markCommitted(o),os(i,a??null,ti)}),(0,V.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var ws=ds({columnVisibilityFeature:ms,rowSortingFeature:gs,rowPaginationFeature:hs,sortedRowModel:bs(),paginatedRowModel:vs()}),Ts=10,Es=10,Ds=new Set([`duration`,`taskCount`,`shuffleRead`,`fetchWait`,`gcPct`,`skew`,`spill`]);function Os(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function ks(e){return e<=0?(0,H.jsx)(H.Fragment,{children:`0`}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,` `,(0,H.jsx)(pt,{label:`RETRY`,impactBand:`critical`})]})}function As(e,t,n){if(e<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let r=F(e);if(t<=0)return(0,H.jsx)(H.Fragment,{children:r});let i=e/t;return i>.3?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:n===`advanced`?`${Math.round(i*100)}%`:`High`,impactBand:`critical`})]}):i>.15?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:n===`advanced`?`${Math.round(i*100)}%`:`Elevated`,impactBand:`info`})]}):(0,H.jsx)(H.Fragment,{children:r})}function js(e,t){if(!e||e<=0||!t||t<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let n=t/e,r=n<.01?`${n.toExponential(1)}×`:`${n.toFixed(2)}×`;return n>2||n<.1?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:`extreme`,impactBand:`info`})]}):(0,H.jsx)(H.Fragment,{children:r})}function Ms(e,t){if(e<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let n=t??`unclassified`;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[z(e),` `,(0,H.jsx)(pt,{label:ut[n],impactBand:`warning`,title:$e[n]})]})}function Ns(e,t){return!e||e<=0?0:(t??0)/e}function Ps(e){let t=new Map;for(let n of e)t.has(n.type)||t.set(n.type,[]),t.get(n.type).push(n);return[...t.values()].map(e=>{let t=Ze(e);return e.find(e=>e.impactBand===t)??e[0]})}function Fs({appModel:e,catalog:t,getTaskData:n,onRoute:r}){let{openStage:i}=ot(),a=Re(),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)([]),[f,p]=(0,V.useState)({pageIndex:0,pageSize:Ts}),{catalogByStage:m,flaggedStageIds:h,frequency:g}=(0,V.useMemo)(()=>{let e=new Map,n=new Set;for(let r of t)r.stageId!=null&&(n.add(r.stageId),e.has(r.stageId)||e.set(r.stageId,[]),e.get(r.stageId).push(r));return{catalogByStage:e,flaggedStageIds:n,frequency:ft(t)}},[t]),_=(0,V.useMemo)(()=>{let t=[...e.stages.values()],n=o?t.filter(e=>h.has(e.id)):[...t].sort((e,t)=>(t.completedAt??0)-(t.submittedAt??0)-((e.completedAt??0)-(e.submittedAt??0))).slice(0,Es),r=c.trim().toLowerCase();return(r?n.filter(e=>(e.name??``).toLowerCase().includes(r)||String(e.id).includes(r)):n).map(e=>({stage:e,tags:Ps(m.get(e.id)??[]),frequency:g.get(e.id)??0}))},[e.stages,o,h,m,g,c]),v=(0,V.useMemo)(()=>{if(!r)return null;let e=new Map;for(let n of t){let r=tr(n,t);r&&e.set(n,r)}return e},[t,r]),y=(0,V.useMemo)(()=>[{id:`id`,header:`Stage`,accessorFn:e=>e.stage.id,cell:({getValue:e})=>{let t=e();return(0,H.jsx)(`button`,{type:`button`,"aria-label":`Open Stage ${t} details`,className:`inline-flex cursor-pointer items-center rounded-sm hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),i(t)},children:(0,H.jsx)(`strong`,{children:t})})}},{id:`name`,header:`Operation`,accessorFn:e=>e.stage.name??``,cell:({row:e})=>{let t=e.original.stage.id;return(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[Os(e.original.stage.name??``,40),e.original.tags.map((e,n)=>{let i=v?v.get(e)??null:null,a=i&&r?{target:i,onRoute:r}:null,o=Et(e.impactEstimate);return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[a?(0,H.jsx)(`button`,{type:`button`,"aria-label":`Investigate ${a.target.findingLabel} in Stage ${t}`,title:`Investigate ${a.target.findingLabel} in Stage ${t}`,className:`inline-flex cursor-pointer items-center rounded-full hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),a.onRoute(a.target)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand,plainBadge:!0})}):(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand}),o?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}):null]},n)})]})}},{id:`type`,header:`Type`,accessorFn:e=>e.stage.stageType??``,cell:({row:e})=>(0,H.jsx)(nt,{variant:`outline`,children:e.original.stage.stageType??`—`})},{id:`duration`,header:`Duration`,accessorFn:e=>(e.stage.completedAt??0)-(e.stage.submittedAt??0),cell:({getValue:e})=>(0,H.jsx)(H.Fragment,{children:F(e())})},{id:`taskCount`,header:`Tasks`,accessorFn:e=>e.stage.taskCount},{id:`retried`,header:`Retried`,accessorFn:e=>e.stage.failedTasks??0,cell:({getValue:e})=>ks(e())},{id:`shuffleRead`,header:`Shuffle Read`,accessorFn:e=>e.stage.shuffleReadBytes??0,cell:({getValue:e})=>(0,H.jsx)(H.Fragment,{children:z(e())})},{id:`fetchWait`,header:`Fetch Wait`,accessorFn:e=>e.stage.fetchWaitTime??0,cell:({row:e})=>As(e.original.stage.fetchWaitTime??0,e.original.stage.executorRunTime??0,a)},...a===`advanced`?[{id:`ioRatio`,header:`I/O Ratio`,accessorFn:e=>e.stage.inputBytes?(e.stage.outputBytes??0)/e.stage.inputBytes:0,cell:({row:e})=>js(e.original.stage.inputBytes??0,e.original.stage.outputBytes??0)}]:[],{id:`spill`,header:`Spill (mem)`,accessorFn:e=>e.stage.memoryBytesSpilled??0,cell:({row:e})=>Ms(e.original.stage.memoryBytesSpilled??0,e.original.stage.spillClassification)},...a===`advanced`?[{id:`gcPct`,header:`GC%`,accessorFn:e=>e.stage.gcPct??0,cell:({getValue:e})=>(0,H.jsxs)(H.Fragment,{children:[e().toFixed(1),`%`]})},{id:`skew`,header:`Skew P95/median`,accessorFn:e=>Ns(e.stage.taskDurationP50,e.stage.taskDurationP95),cell:({getValue:e})=>{let t=e();return(0,H.jsx)(H.Fragment,{children:t>0?`${t.toFixed(1)}×`:`—`})}}]:[],{id:`frequency`,header:`Flagged`,accessorFn:e=>e.frequency,cell:({getValue:e})=>{let t=e();return t<=1?(0,H.jsx)(H.Fragment,{children:`—`}):(0,H.jsx)(nt,{variant:`outline`,children:`Flagged by ${t}`})}}],[t,r,v,i,a]),b=Cs({features:ws,data:_,columns:y,state:{sorting:u,pagination:f},sortDescFirst:!1,onSortingChange:d,onPaginationChange:p});function x(){s(e=>!e),d([]),p({pageIndex:0,pageSize:Ts})}let S=e=>e===`asc`?` ▲`:e===`desc`?` ▼`:``,C=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`;return(0,H.jsx)(I,{title:`Stage Summary`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(ae,{type:`text`,value:c,onChange:e=>{l(e.target.value),p(e=>({...e,pageIndex:0}))},placeholder:`Filter by stage name or ID…`,"aria-label":`Filter by stage name or ID`,className:`max-w-xs`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Scroll sideways to see all columns →`}),(0,H.jsx)(Ke,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:o?`Top ${Es} by duration`:`Problems only`})]}),(0,H.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[`Showing `,_.length,` stage`,_.length===1?``:`s`,`: `,` `,o?`problems only`:`top ${Es} by duration`,`.`]}),(0,H.jsxs)(it,{children:[(0,H.jsx)(ht,{children:b.getHeaderGroups().map(e=>(0,H.jsx)(P,{children:e.headers.map(e=>{let t=e.column.getIsSorted(),n=e.column.getToggleSortingHandler();return(0,H.jsxs)(dt,{scope:`col`,tabIndex:e.column.getCanSort()?0:void 0,"aria-sort":C(t),className:M(e.column.getCanSort()&&`tap-target-comfortable cursor-pointer select-none`,Ds.has(e.column.id)&&`text-right`),onClick:n,onKeyDown:e=>{n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[W(e.column.columnDef.header,e.getContext()),S(t)]},e.id)})},e.id))}),(0,H.jsx)(tt,{children:b.getRowModel().rows.length===0?(0,H.jsx)(P,{children:(0,H.jsx)(N,{colSpan:y.length,className:`text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`flex items-center justify-center gap-2 py-2`,children:[(0,H.jsx)(Me,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`No stages to show.`]})})}):b.getRowModel().rows.map(e=>(0,H.jsx)(P,{className:`cursor-pointer`,onClick:()=>i(e.original.stage.id),children:e.getVisibleCells().map(e=>(0,H.jsx)(N,{className:Ds.has(e.column.id)?`text-right`:void 0,children:W(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]}),b.getPageCount()>1?(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.previousPage(),disabled:!b.getCanPreviousPage(),children:`Previous`}),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,f.pageIndex+1,` of `,b.getPageCount()]}),(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.nextPage(),disabled:!b.getCanNextPage(),children:`Next`})]}):null]})})}var Is=20,Ls=24,Rs=40,zs=200,Bs=640;function Vs(e,t=Is){let n=[...e].filter(e=>e.submittedAt&&e.completedAt),r=n.length;return r<=t?{stages:n.sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!1}:{stages:[...n].sort((e,t)=>t.completedAt-t.submittedAt-(e.completedAt-e.submittedAt)).slice(0,t).sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!0}}function Hs({appModel:e,catalog:t}){let{openStage:n}=ot(),r=[...e.stages.values()].filter(e=>e.submittedAt&&e.completedAt),i=r.length,o=r.reduce((e,t)=>Math.min(e,t.submittedAt),1/0),s=e.app?.startTime??(Number.isFinite(o)?o:0),d=new Set(t.filter(e=>e.stageId!=null).map(e=>e.stageId)),m=Re(),[g,_]=(0,V.useState)(()=>m===`advanced`?i:Is),{stages:v}=Vs(r,g),y=St(v).map(e=>({stageId:e.id,label:`Stage ${e.id}`,wait:e.submittedAt-s,duration:e.completedAt-e.submittedAt,flagged:d.has(e.id)})),b=Math.min(Bs,Math.max(zs,y.length*Ls+Rs)),x=b-Rs,S=Math.max(1,Math.floor(x/Ls)),C=Math.max(1,Math.ceil(y.length/S));return(0,H.jsx)(I,{title:`Job Timeline`,summary:i>0?(0,H.jsx)(B,{value:`${i} stage${i===1?``:`s`}`,context:`${d.size} flagged`}):void 0,children:i===0?(0,H.jsx)(_t,{tone:`neutral`,icon:Me,title:`No stages in this run.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`label`,{htmlFor:`timeline-topn`,children:`showing top`}),(0,H.jsx)(`input`,{id:`timeline-topn`,type:`number`,min:1,max:i,value:Math.min(g,i),onChange:e=>{let t=parseInt(e.target.value,10);Number.isFinite(t)||(t=g),_(Math.max(1,Math.min(i,t)))},className:`w-16 rounded border border-input bg-transparent px-1 py-0.5`,"aria-label":`Number of stages to show`}),(0,H.jsxs)(`span`,{children:[`of `,i,` by duration · flagged in red`]})]}),(0,H.jsx)(k,{ariaLabel:`Job timeline: stage durations by time from app start.`,height:b,table:{caption:`Job timeline: stage durations by time from app start`,columns:[`Stage`,`Start`,`Duration`],rows:y.map(e=>[e.label,F(e.wait),F(e.duration)]),align:[`left`,`right`,`right`]},children:(0,H.jsxs)(l,{data:y,layout:`vertical`,children:[(0,H.jsx)(c,{stroke:A.muted,strokeOpacity:.2,horizontal:!1}),(0,H.jsx)(p,{type:`number`,tickFormatter:e=>`${Math.round(e/1e3)}s`,tick:{fontSize:10},tickCount:10}),(0,H.jsx)(f,{type:`category`,dataKey:`label`,tick:{fontSize:10},width:64,interval:0,tickFormatter:(e,t)=>t%C===0?e:``}),(0,H.jsx)(h,{formatter:(e,t)=>t===`Duration`?F(Number(e)):[null,null]}),(0,H.jsx)(u,{dataKey:`wait`,stackId:`timeline`,fill:`transparent`,name:`Wait`}),(0,H.jsx)(u,{dataKey:`duration`,stackId:`timeline`,name:`Duration`,cursor:`pointer`,onClick:e=>n(e.payload.stageId),children:y.map(e=>(0,H.jsx)(a,{fill:e.flagged?A.critical:A.accent,stroke:e.flagged?A.critical:`none`,strokeWidth:e.flagged?2:0},e.stageId))})]})})]})})}var Us={present:`present`,disabled:`disabled`,notEmitted:`not emitted`,notApplicable:`not applicable`,outsideEventLog:`outside event log`,unknown:`unknown`},Ws={present:`info`,disabled:`warning`,notEmitted:`warning`,notApplicable:`muted`,outsideEventLog:`muted`,unknown:`muted`};function Gs({entry:e}){let t=e.evidence?.count,n=E(),r=`${e.summary}${t==null?``:` · ${t} observed`}`,{tooltipProps:i,srOnlyTooltip:a}=ee(r);return(0,H.jsxs)(`li`,{id:`evidence-availability-${e.key}`,tabIndex:-1,ref:t=>n(e.key,t),className:`flex flex-col gap-0.5 rounded-md px-2 py-1 outline-none focus:ring-2 focus:ring-ring`,...i,children:[(0,H.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,H.jsx)(j,{impactBand:Ws[e.state]}),(0,H.jsx)(`span`,{className:`truncate text-sm font-medium`,children:oe(e.key)})]}),(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:Us[e.state]}),a]}),(0,H.jsx)(L,{children:(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})})]})}function Ks(e){return Object.keys(Us).map(t=>[t,e.filter(e=>e.state===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${Us[e]}`).join(` · `)}function qs({ledger:e}){let{evidenceCardOpen:t,setEvidenceCardOpen:n}=te();return(0,H.jsx)(I,{title:`Evidence availability`,open:t,onOpenChange:n,summary:(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?Ks(e.entries):`Unavailable for this restored run`}),children:e?(0,H.jsx)(`ul`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-2`,"aria-label":`Evidence availability ledger`,children:e.entries.map(e=>(0,H.jsx)(Gs,{entry:e},e.key))}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Evidence availability is unavailable for this restored run.`})})}var Js=64;function Ys(e,t){return t>=1?e:`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function Xs(e){return[{key:`startup`,label:`Startup`,value:e.startup,color:A.info,fillOpacity:1},{key:`stagesActive`,label:`Stages active`,value:e.stagesActive,color:A.clean,fillOpacity:1},{key:`gaps`,label:`Scheduler gaps`,value:e.gaps,color:A.warning,fillOpacity:1},{key:`idle`,label:`Idle`,value:e.idle,color:A.muted,fillOpacity:.6}].filter(e=>e.value>0).map(e=>({...e,legendColor:Ys(e.color,e.fillOpacity)}))}var Zs=(0,V.memo)(function({appModel:e}){let{app:n,stages:r}=e,a=Be(n,r);if(a.total<=0)return null;let o=Xs(a),s=e=>a.total>0?e/a.total*100:0,c=o.reduce((e,t)=>t.value>e.value?t:e,o[0]),d=[o.reduce((e,t)=>({...e,[t.key]:t.value}),{name:`total`})];return(0,H.jsxs)(I,{title:`Wall-Clock Breakdown`,badges:(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[F(a.total),` total`]}),summary:(0,H.jsx)(B,{value:`${c.label} ${Math.round(s(c.value))}%`,context:`of ${F(a.total)} total`}),children:[(0,H.jsx)(k,{ariaLabel:`Wall-clock breakdown: ${F(a.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:Js,table:{caption:`Wall-clock time breakdown`,columns:[`Segment`,`Duration`,`% of total`],rows:o.map(e=>[e.label,F(e.value),`${Math.round(s(e.value))}%`]),align:[`left`,`right`,`right`]},children:(0,H.jsxs)(l,{data:d,layout:`vertical`,stackOffset:`expand`,margin:{top:0,right:0,bottom:0,left:0},children:[(0,H.jsx)(p,{type:`number`,hide:!0,domain:[0,1]}),(0,H.jsx)(f,{type:`category`,dataKey:`name`,hide:!0}),(0,H.jsx)(h,{shared:!1,labelFormatter:()=>``,formatter:(e,t)=>[F(Number(e)),t]}),(0,H.jsx)(i,{wrapperStyle:{fontSize:12},itemSorter:e=>o.findIndex(t=>t.key===e.dataKey),formatter:(e,t)=>{let n=o.find(e=>e.key===t.dataKey);return(0,H.jsx)(`span`,{style:{color:n?.color},children:e})},content:e=>(0,H.jsx)(t,{...e,payload:e.payload?.map(e=>{let t=o.find(t=>t.key===e.dataKey);return t?{...e,color:t.legendColor}:e})})}),o.map(e=>(0,H.jsx)(u,{dataKey:e.key,name:e.label,stackId:`wallclock`,fill:e.color,fillOpacity:e.fillOpacity},e.key))]})}),(0,H.jsx)(L,{children:(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground`,children:o.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`inline-block size-2.5 rounded-sm`,style:{backgroundColor:e.color,opacity:e.fillOpacity}}),e.label,` (`,F(e.value),`)`]},e.key))})})]})}),Qs=36e5,$s=5,ec={totalCoreHours:null,usefulCoreHours:null,wastedCoreHours:null,totalCores:null,topStages:[]};function tc(e,t=[],n){if(!n||e?.startTime==null||e?.endTime==null)return ec;let r=e.endTime-e.startTime;if(r<=0)return ec;let i=Ye(e,t);if(i<=0)return ec;let a=i*r/Qs,o=(n.busyCoreMs??0)/Qs;return{totalCoreHours:a,usefulCoreHours:o,wastedCoreHours:Math.max(0,a-o),totalCores:i,topStages:Object.entries(n.perStage??{}).map(([e,t])=>({stageId:Number(e),coreMs:t?.totalTaskDurationSum??0})).sort((e,t)=>t.coreMs-e.coreMs).slice(0,$s)}}function nc({appModel:e}){let t=tc(e.app,e.executors.added,e.runAggregates);if(t.totalCoreHours==null)return null;let n=t.totalCoreHours>0?Math.round(t.wastedCoreHours/t.totalCoreHours*100):0;return(0,H.jsx)(I,{title:`Wasted Core-Hours`,statusBadge:(0,H.jsx)(fn,{}),defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:U(t.wastedCoreHours)}),context:`wasted of ${U(t.totalCoreHours)} allocated`}),children:(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[`Allocated: `,(0,H.jsx)(`strong`,{children:U(t.totalCoreHours)}),` · Used:`,` `,(0,H.jsx)(`strong`,{children:U(t.usefulCoreHours)})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Wasted: `,(0,H.jsx)(`strong`,{children:U(t.wastedCoreHours)}),` (`,n,`% of allocated)`]}),(0,H.jsx)(L,{children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Allocated = `,t.totalCores,` cores over the run; used = core-time that actually ran tasks.`]})}),t.topStages.length>0&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Top stages by task core-time`}),(0,H.jsx)(`ul`,{className:`space-y-0.5`,children:t.topStages.map(e=>(0,H.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,H.jsxs)(`span`,{children:[`Stage `,e.stageId]}),(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:U(e.coreMs/36e5)})]},e.stageId))})]})]})})}function rc({appModel:e,catalog:t,getTaskData:n,activeFileId:r,onRoute:i}){return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Full app report`}),(0,H.jsx)(Zs,{appModel:e}),(0,H.jsx)(Hs,{appModel:e,catalog:t}),(0,H.jsx)(yn,{appModel:e,activeFileId:r}),(0,H.jsx)(Fs,{appModel:e,catalog:t,getTaskData:n,onRoute:i}),(0,H.jsxs)(st,{children:[(0,H.jsx)(R,{cardId:`reference-evidence-availability`,collapsedTile:!0,children:(0,H.jsx)(qs,{ledger:e.evidenceAvailability})}),(0,H.jsx)(R,{cardId:`reference-etl-phases`,collapsedTile:!0,children:(0,H.jsx)(gn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-scaling-sim`,collapsedTile:!0,children:(0,H.jsx)(jn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-efficiency-model`,collapsedTile:!0,children:(0,H.jsx)(pn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-wasted-core-hours`,collapsedTile:!0,children:(0,H.jsx)(nc,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-core-usage-histogram`,collapsedTile:!0,children:(0,H.jsx)(cn,{appModel:e,getTaskData:n})})]})]})}function ic({appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,options:a,onRoute:o,activeTab:s,onActiveTabChange:c}){let{selection:l}=Xt(),u=(0,V.useMemo)(()=>Ht(t,l),[t,l]),d=(0,V.useMemo)(()=>Ht(n??[],l),[n,l]),f=u.length+d.length,p=t.length+(n??[]).length>0&&f===0;return(0,H.jsxs)(`main`,{className:`flex-1 space-y-6 p-4`,children:[(0,H.jsx)(nn,{options:a,resultCount:f}),p&&(0,H.jsx)(Zt,{}),(0,H.jsx)(Bn,{appModel:e,catalog:u}),!p&&(0,H.jsxs)(se,{value:s,onValueChange:e=>c(e),children:[(0,H.jsxs)(w,{variant:`chrome`,"aria-label":`Report view`,children:[(0,H.jsx)(ce,{value:`findings`,className:`tap-target-comfortable`,children:`Findings`}),(0,H.jsx)(ce,{value:`full-report`,className:`tap-target-comfortable`,children:`Full app report`})]}),(0,H.jsxs)(je,{value:`findings`,keepMounted:!0,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Findings`}),(0,H.jsx)(Cr,{appModel:e,catalog:u,configFindings:d,stages:e.stages,getTaskData:r,activeFileId:i,onRoute:o})]}),(0,H.jsx)(je,{value:`full-report`,keepMounted:!0,children:(0,H.jsx)(rc,{appModel:e,catalog:u,getTaskData:r,configFindings:d,activeFileId:i,onRoute:o})})]})]})}function ac(){let{resetToDropZone:e,startLoad:t,getTaskData:n}=Ve(),r=qe(e=>e.appModel),i=qe(e=>e.catalog),a=qe(e=>e.activeFileId),o=qe(e=>e.exportMode),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=Ee(a),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(`findings`),{referenceOpen:m}=te(),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(null),x=(0,V.useRef)(0),S=(0,V.useRef)(null),C=(0,V.useRef)(null),w=(0,V.useRef)(new Map),ee=(0,V.useRef)(new Map),T=(0,V.useRef)(null),ne=h?.target??null;(0,V.useEffect)(()=>()=>{T.current&&clearTimeout(T.current)},[]),(0,V.useEffect)(()=>{m&&p(`full-report`)},[m]);let E=(0,V.useCallback)(e=>{S.current?.token===e&&(S.current=null,C.current=null,g(t=>t?.token===e?null:t))},[]),D=(0,V.useCallback)(e=>{if(S.current?.token!==e.token)return null;let{catalog:t,activeFileId:n}=Ue.getState();if(C.current!==n)return null;let r=tr(e.target.finding,t);return!r||r.widgetId!==e.target.widgetId||r.region!==e.target.region?null:r},[]),re=(0,V.useCallback)(e=>{p(`findings`);let t=x.current+1;x.current=t;let{catalog:n,activeFileId:r}=Ue.getState(),i=tr(e.finding,n);if(!i||i.widgetId!==e.widgetId||i.region!==e.region){S.current=null,C.current=null,g(null);return}let a={target:i,token:t};S.current=a,C.current=r,g(a)},[]),ie=(0,V.useCallback)((e,t)=>{w.current.set(e,t);let n=S.current;return n?.target.widgetId===e&&D(n)&&t.open(),()=>{w.current.get(e)===t&&w.current.delete(e)}},[D]),ae=(0,V.useCallback)((e,t)=>(ee.current.set(e,t),()=>{ee.current.get(e)===t&&ee.current.delete(e)}),[]),oe=(0,V.useCallback)((e,t)=>{if(!t)return;let n=S.current;if(!n||n.target.widgetId!==e)return;let r=D(n);if(!r){E(n.token);return}let i=w.current.get(e);if(!i)return;let a=i.getDisclosureButton();if(!a){E(n.token);return}let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=ee.current.get(r.finding);s?(s.scrollIntoView({behavior:o?`auto`:`smooth`,block:`center`,inline:`nearest`}),s.focus({preventScroll:!0}),T.current&&clearTimeout(T.current),b(r.finding),T.current=setTimeout(()=>{T.current=null,b(null)},2e3)):(i.wrapperElement.scrollIntoView({behavior:o?`auto`:`smooth`,block:`start`,inline:`nearest`}),a.focus({preventScroll:!0}),v(e)),E(n.token)},[E,D]),se=(0,V.useCallback)(e=>{v(t=>t===e?null:t)},[]);(0,V.useLayoutEffect)(()=>{if(!h)return;let e=D(h);if(!e){E(h.token);return}w.current.get(e.widgetId)?.open()},[E,D,h]),(0,V.useLayoutEffect)(()=>{let e=S.current;e&&!D(e)&&E(e.token)},[a,i,E,D]);let O=qe(e=>e.configFindings),k=(0,V.useMemo)(()=>Ut(i,O),[i,O]);return(0,H.jsxs)(`div`,{"data-testid":`dashboard`,className:`relative flex min-h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},onDragOver:e=>{o||(e.preventDefault(),d(!0))},onDragLeave:()=>d(!1),onDrop:e=>{if(o)return;e.preventDefault(),d(!1);let n=e.dataTransfer.files[0];n&&t(n)},children:[(0,H.jsx)(xe,{onLoadNew:e,recentEntries:s,activeFileId:a,onPickRecent:c,onRemoveRecent:l}),(0,H.jsx)(Yt,{options:k,fileId:a,children:(0,H.jsx)(Qe,{registerWidget:ie,registerFindingAnchor:ae,reportWidgetOpen:oe,clearRouteFocus:se,focusedWidgetId:_,activeRouteTarget:ne,flashedFinding:y,children:(0,H.jsx)(ic,{appModel:r,catalog:i,configFindings:O,getTaskData:n,activeFileId:a,options:k,onRoute:re,activeTab:f,onActiveTabChange:p})})}),(0,H.jsx)(Nr,{appModel:r,catalog:i,getTaskData:n}),u&&(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80`,children:(0,H.jsx)(`p`,{className:`rounded-lg border-2 border-dashed border-primary px-6 py-4 text-lg font-medium`,children:`Drop to load a new event log`})})]})}function oc(){return(0,H.jsx)(ie,{children:(0,H.jsx)(ac,{})})}export{oc as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O,groupConfidence:k}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`duplicatePlanSubtree`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e})),groupConfidence:t.every(e=>e.confidence===t[0]?.confidence)?t[0]:void 0}},[e]),A=p(D,e=>[e],h),j=c(),M=j?A.findIndex(e=>e===j.finding):null,{totalPages:N,effectivePage:P,visible:F}=y(A,T,E,M);return D.length===0?null:(0,C.jsxs)(o,{title:`Redundant Plan Subtree`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`duplicatePlanSubtree`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:k?.confidence,validationRequired:k?.validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:F.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:P,totalPages:N,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as DuplicatePlanSubtree};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,dt as o,i as s,k as c,l}from"./index-U654cmB8.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-BHcqJkcZ.js";import{t as f}from"./RowPagination-oeWB8gBm.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m,t as h}from"./finding-anchor-Bl1hRK5E.js";import{t as g}from"./usePagedRows-jNUWgVTD.js";import{n as _,t as v}from"./useSortMode-BhPky1lW.js";import{t as y}from"./StageHeader-DibMSunO.js";var b=e(t(),1),x=n(),S=`GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.`;function C(e){return[...e].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))}function w({finding:e,appModel:t}){let n=m([e]),i=(e.stageId==null?void 0:t.stages.get(e.stageId))?.executorRunTime;return(0,x.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${h} transition-colors ${n.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(y,{stageId:e.stageId,appModel:t}),(0,x.jsx)(c,{children:(0,x.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`GC: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]}),` · Executor run time:`,` `,(0,x.jsx)(`strong`,{children:o(i??0)})]}),(0,x.jsx)(d,{finding:e}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation})]})}function T({title:e,findings:t,appModel:n,page:r,setPage:i,routeTarget:a,orderBy:o}){let s=o(C(t),e=>[e],e=>e.stageId),c=a?s.findIndex(e=>e===a.finding):null,{totalPages:l,effectivePage:u,visible:d}=g(s,r,i,c);return(0,x.jsxs)(`section`,{className:`space-y-2`,children:[(0,x.jsxs)(`h4`,{className:`font-heading text-sm font-medium`,children:[e,` · `,t.length,` stage`,t.length===1?``:`s`]}),(0,x.jsx)(`ul`,{className:`space-y-3`,children:d.map(e=>(0,x.jsx)(w,{finding:e,appModel:n},e.stageId))}),(0,x.jsx)(f,{page:u,totalPages:l,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1)})]})}function E({catalog:e,appModel:t,defaultCollapsed:n=!0}){let[r,o]=(0,b.useState)(0),[d,f]=(0,b.useState)(0),{sortMode:m,setSortMode:h,orderBy:g}=v(),[y,C]=(0,b.useState)(!n),w=l(),E=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!E.current){E.current=!0;return}o(0),f(0)},[t]);let D=e.filter(e=>e.type===`gc`);if(D.length===0)return null;let O=D.filter(e=>e.direction!==`low`),k=D.filter(e=>e.direction===`low`),A=a(D),j=[...D].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))[0];return(0,x.jsx)(s,{title:`GC Pressure`,impactBand:A,badges:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{type:`gc`,impactBand:A??`info`}),p(D,D.length,y)?(0,x.jsx)(_,{mode:m,onChange:e=>{h(e),o(0),f(0)}}):null]}),defaultCollapsed:n,open:y,onOpenChange:C,summary:(0,x.jsx)(u,{value:`${j.value}%`,context:`${D.length} stage${D.length===1?``:`s`} flagged`}),children:(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(c,{children:(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S})}),O.length>0&&(0,x.jsx)(T,{title:`GC overhead`,findings:O,appModel:t,page:r,setPage:o,routeTarget:w,orderBy:g}),k.length>0&&(0,x.jsx)(T,{title:`Low GC (cost)`,findings:k,appModel:t,page:d,setPage:f,routeTarget:w,orderBy:g})]})})}export{E as GcPressure};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`overBroadcast`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Oversized Broadcast Join`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`overBroadcast`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as OverBroadcast};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-BiYdWs8J.js";import{Ft as i,O as a,bt as o,ht as s,i as c,l,ot as u,ut as d}from"./index-U654cmB8.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g,t as _}from"./finding-anchor-Bl1hRK5E.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";import{n as y,t as b}from"./useSortMode-BhPky1lW.js";import{t as x}from"./StageHeader-DibMSunO.js";import{a as S,i as C,n as w,r as T,t as E}from"./select-CtKaJ5Hx.js";import{t as D}from"./PlanExplorer-DSk1ivS4.js";var O=e(t(),1),k=n();function A(e){if(e.rule===`lowShuffleParallelism`)return`${s(e)} tasks carrying the shuffle`;let t=s(e);return e.rule===`maxPartitionTooBig`?`Largest partition ${d(t)} (too large)`:`Largest partition ${d(t)}`}function j({entry:e,appModel:t}){let n=i(),a=g(e.partitions),o=n===`advanced`&&r(e.stageId,t);return(0,k.jsxs)(`div`,{ref:a.ref,tabIndex:a.tabIndex,"data-flashed":a.dataFlashed,className:`space-y-2 ${_} transition-colors ${a.flashClassName}`,children:[(0,k.jsx)(x,{stageId:e.stageId,appModel:t}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.partitions.map((e,t)=>(0,k.jsxs)(`span`,{children:[t>0?` · `:``,A(e)]},e.id))}),(0,k.jsx)(p,{finding:e.partitions[0]}),(0,k.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,k.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground`,children:e.partitions.map(e=>(0,k.jsxs)(`li`,{children:[e.recommendation,` `,(0,k.jsx)(p,{finding:e})]},e.id))}),o?(0,k.jsx)(D,{stageId:e.stageId,appModel:t}):null]})]})}var M=(0,O.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,i]=(0,O.useState)(0),[s,d]=(0,O.useState)(!n),{sortMode:p,setSortMode:g,orderBy:_}=b(),x=l(),{partitionFindings:D,sorted:A,orderedEntries:M}=(0,O.useMemo)(()=>{let e=t.filter(e=>e.type===`partitionSizing`),n=new Map;for(let t of e){if(t.stageId==null)continue;let e=n.get(t.stageId);e?(e.partitions.push(t),u[t.impactBand]<u[e.impactBand]&&(e.impactBand=t.impactBand)):n.set(t.stageId,{stageId:t.stageId,partitions:[t],impactBand:t.impactBand})}let r=[...n.values()].sort((e,t)=>u[e.impactBand]-u[t.impactBand]||e.stageId-t.stageId);return{partitionFindings:e,sorted:r,orderedEntries:_(r,e=>e.partitions,e=>e.stageId)}},[t,p]),N=x?M.findIndex(e=>e.partitions.includes(x.finding)):null,{totalPages:P,effectivePage:F,visible:I}=v(M,r,i,N);if(D.length===0){let t=e.stages.size;return(0,k.jsx)(c,{title:`Partition Sizing`,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`No issues`,context:`no issue detected: partition sizing checked across ${t} stage${t===1?``:`s`}`}),children:(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No partition-sizing issues detected.`})})}let L=o(D),R=h(D,A.length,s);return(0,k.jsx)(c,{title:`Partition Sizing`,impactBand:L,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`Stage ${A[0].stageId}`,context:`${A.length} stage${A.length===1?``:`s`} flagged`}),badges:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(a,{type:`partitionSizing`,impactBand:L??`info`}),R?(0,k.jsx)(y,{mode:p,onChange:e=>{g(e),i(0)}}):null]}),children:(0,k.jsxs)(`div`,{className:`space-y-4`,children:[I.map(t=>(0,k.jsx)(j,{entry:t,appModel:e},t.stageId)),(0,k.jsx)(m,{page:F,totalPages:P,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1),renderJumpControl:()=>(0,k.jsxs)(E,{value:String(F*6),onValueChange:e=>i(Math.floor(Number(e)/6)),children:[(0,k.jsx)(C,{size:`sm`,"aria-label":`Jump to stage`,children:(0,k.jsx)(S,{placeholder:`Jump to stage`})}),(0,k.jsx)(w,{children:M.map((e,t)=>(0,k.jsxs)(T,{value:String(t),children:[`Stage `,e.stageId]},e.stageId))})]})})]})})});export{M as PartitionSizing};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{C as n,S as r,T as i,_ as a,b as o,g as s,h as c,m as l,v as u,w as d,x as f,y as p}from"./react-vendor-D2TLlSzI.js";import{a as m,c as h,d as g,f as _,i as v,l as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./plan-graph-vendor-B0sEms9Z.js";import{c as D,f as O,i as ee,l as te,n as k,o as A,s as j,t as ne,u as M,w as N}from"./useRecentFiles-BiYdWs8J.js";import{$ as P,A as re,At as F,D as I,E as L,F as R,G as z,L as ie,Lt as B,Nt as V,O as ae,P as H,Q as oe,T as U,Tt as se,at as ce,bt as le,dt as ue,et as de,ft as fe,it as W,nt as pe,rt as me,tt as G,ut as he,w as ge,xt as _e,yt as ve}from"./index-U654cmB8.js";import{t as ye}from"./impact-sort-DxaUheWV.js";var be={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};be.node;var xe=F(be),Se={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Se.node;var Ce=F(Se),we={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};we.node;var Te=F(we),Ee={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Ee.node;var De=F(Ee),Oe={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Oe.node;var ke=F(Oe),Ae={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Ae.node;var je=F(Ae),Me={name:`zoom-out`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Me.node;var Ne=F(Me),Pe={name:`zoom-in`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Pe.node;var Fe=F(Pe),K=e(t(),1);function Ie({id:e,sourceNodeId:t,planNode:n,category:r,segmentIndex:i,splitRole:a,durationShare:o,exclusiveDurationShare:s,findings:c}){return{id:e,sourceNodeId:t,label:n.name,category:r,operatorDetail:pe(n.name,n.detail??``),primaryMetric:G(n.metrics),segmentIndex:i,splitRole:a,durationShare:o??null,exclusiveDurationShare:s??null,findings:c,metrics:(n.metrics??[]).map(e=>({name:e.name,value:de(e)})),detailText:n.detail&&n.detail!==n.name?n.detail:``}}function Le(e,t){let{scope:n,stageId:r,appModel:i,findings:a=[],durationMode:o=`exclusive`}=t;if(!e)return{nodes:[],edges:[],segmentIndex:null,segmentCount:0,scope:`full`,segmentStageIds:new Map};let s=i.stages.get(r)?.sqlExecutionId??null,c=s==null?null:i.sql.get(s),{segments:l,segOf:u,segmentTopology:d}=me(e),f=l.filter(Boolean).length,p=c&&s!=null?oe(e,i,c,s,o):null,m=o===`exclusive`?p:c&&s!=null?oe(e,i,c,s,`exclusive`):null,h=new Map,g=c&&s!=null?z(s,i.stages):[];if(g.length){let e=new Map;for(let t of g){let n=i.stages.get(t);n&&e.set(t,{submittedAt:n.submittedAt,completedAt:n.completedAt})}for(let[t,n]of W(l,e,g,d))h.set(t,n)}let _=new Map;if(s!=null){for(let e of a)if(e.executionId===s)for(let t of e.planNodeIds??[]){let n=_.get(t);n?n.push(e):_.set(t,[e])}}let v=[],y=[],b=new Map;ce(e,(e,t)=>{let n=e.id,r=P(e.name),a=u.get(e),o=t?t.id:null,s=e.exchangeRole===`write`&&t?t.id:n,c=Ie({id:n,sourceNodeId:s,planNode:e,category:r,segmentIndex:a,splitRole:e.exchangeRole??null,durationShare:p?.get(e),exclusiveDurationShare:m?.get(e),findings:_.get(n)??[]});if(v.push(c),e.exchangeRole){let t=b.get(s)??{};t[e.exchangeRole]=c,b.set(s,t)}if(o){let t={id:`${o}->${n}`,source:o,target:n};if(e.exchangeRole===`write`){let e=h.get(a),n=e==null?void 0:i.stages.get(e),r=n?.shuffleWriteBytes||n?.shuffleReadBytes;if(r){t.shuffleBytes=r;let e=b.get(s)??{};e.shuffleBytes=r,b.set(s,e)}}y.push(t)}},{dedupe:!0});for(let{read:e,write:t,shuffleBytes:n}of b.values())e&&t&&(e.pairedNodeId=t.id,t.pairedNodeId=e.id),n!=null&&(e&&(e.exchangeShuffleBytes=n),t&&(t.exchangeShuffleBytes=n));if(n===`full`)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let x=null;for(let[e,t]of h)if(t===r){x=e;break}if(x===null)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let S=new Set;return{nodes:v.filter(e=>e.segmentIndex===x&&(S.add(e.id),!0)),edges:y.filter(e=>S.has(e.source)&&S.has(e.target)),segmentIndex:x,segmentCount:f,scope:`segment`,segmentStageIds:h}}var Re=24,ze=32;function q(e,t,n={}){let r=new T.graphlib.Graph({compound:!!n.groupOf});r.setGraph({rankdir:`RL`,nodesep:128,ranksep:60,ranker:`tight-tree`}),r.setDefaultEdgeLabel(()=>({}));let i=new Set;if(n.groupOf){for(let t of e){let e=n.groupOf(t);e&&i.add(e)}for(let e of i)r.setNode(e,{})}for(let t of e){r.setNode(t.id,{width:220,height:90});let e=n.groupOf?.(t);e&&r.setParent(t.id,e)}for(let e of t)r.setEdge(e.source,e.target);return T.layout(r),e.map(e=>{let t=r.node(e.id);return{...e,position:{x:t.x-110,y:t.y-45}}})}function Be(e,t,n={}){let r=n.paddingX??Re,i=n.paddingY??Re,a=n.headerHeight??ze,o=new Map;for(let n of e){let e=t(n);if(!e)continue;let r=n.position.x,i=n.position.y,a=r+220,s=i+90,c=o.get(e);c?(c.minX=Math.min(c.minX,r),c.minY=Math.min(c.minY,i),c.maxX=Math.max(c.maxX,a),c.maxY=Math.max(c.maxY,s)):o.set(e,{minX:r,minY:i,maxX:a,maxY:s})}return[...o.entries()].map(([e,t])=>({id:e,position:{x:t.minX-r,y:t.minY-i-a},width:t.maxX-t.minX+r*2,height:t.maxY-t.minY+i*2+a}))}function J(e,t,n={}){let r=new Set,i=[];for(let a of t){let t=t=>{let n=e(t);return n&&!r.has(n)?n:null};for(let e of Be(a,t,n))r.add(e.id),i.push(e)}return i}var Y=S();function Ve({delay:e=0,...t}){return(0,Y.jsx)(p,{"data-slot":`tooltip-provider`,delay:e,...t})}function He({...e}){return(0,Y.jsx)(i,{"data-slot":`tooltip`,...e})}function Ue({...e}){return(0,Y.jsx)(d,{"data-slot":`tooltip-trigger`,...e})}function We({className:e,side:t=`top`,sideOffset:i=4,align:a=`center`,alignOffset:s=0,children:c,...l}){return(0,Y.jsx)(n,{children:(0,Y.jsx)(r,{align:a,alignOffset:s,side:t,sideOffset:i,className:`isolate z-50`,children:(0,Y.jsxs)(f,{"data-slot":`tooltip-content`,className:B(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,e),...l,children:[c,(0,Y.jsx)(o,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function Ge(e){return e==null?null:e>=40?`critical`:e>=15?`warning`:`info`}var X={scan:`⇩`,exchange:`⇄`,join:`⋈`,aggregate:`Σ`,sort:`↕`,filter:`∇`,aqe:`⚙`,boilerplate:`·`,transform:`→`};function Ke(e){return e.find(e=>e.impactBand===`critical`)??e.find(e=>e.impactBand===`warning`)??e[0]}function qe({data:e}){let{label:t,operatorDetail:n,primaryMetric:r,category:i,splitRole:a,durationSharePct:o,findings:s}=e,c=X[i]??X.transform,l=Ge(o);return(0,Y.jsxs)(`div`,{className:`relative flex flex-col overflow-visible rounded-md border border-border bg-card px-3 py-2 text-xs shadow-sm`,style:{width:220,height:90},"data-category":i,children:[(0,Y.jsx)(m,{type:`target`,position:g.Right,className:`opacity-0!`}),(0,Y.jsx)(m,{type:`source`,position:g.Left,className:`opacity-0!`}),s&&s.length>0?(()=>{let e=Ke(s);return(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{"data-testid":`node-finding-badge`,className:B(`absolute -right-1 -top-1 flex items-center gap-1 rounded-full bg-card px-1.5 py-0.5 text-[10px] font-medium leading-none shadow-sm ring-1 ring-border`,L[e.impactBand]),children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),ve(e.type),s.length>1?(0,Y.jsx)(`span`,{children:s.length}):null]}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1 text-left`,children:s.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),(0,Y.jsx)(`span`,{children:O(e)})]},e.id??`${e.type}-${t}`))})})]})})():null,a===`read`?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:`paired: see write half`}):null,o!=null&&l?(0,Y.jsxs)(`div`,{className:`mb-1 flex shrink-0 items-center gap-1.5`,title:`Share of the plan's total stage wall time`,children:[(0,Y.jsxs)(`span`,{className:B(`shrink-0 text-[10px] font-medium tabular-nums`,L[l]),children:[o,`%`]}),(0,Y.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{"data-testid":`duration-heat-bar-fill`,className:B(`h-full rounded-full`,U[l]),style:{width:`${o>0?Math.max(o,4):0}%`}})}),(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Duration share `,o,`%, `,l===`critical`?`high`:l===`warning`?`medium`:`low`]})]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:c}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium`,title:t,children:t})]}),n?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:n,children:n}):null,r?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:r,children:r}):null]})}var Je={read:`Read half. Consumes the shuffle written by its paired write half.`,write:`Write half. Produces the shuffle its paired read half consumes.`};function Ye({node:e,onClose:t,onJumpToPaired:n}){let r=X[e.category]??X.transform,i=e.findings??[],a=e.metrics??[],o=e.category.charAt(0).toUpperCase()+e.category.slice(1);return(0,Y.jsxs)(`div`,{"data-testid":`plan-node-detail`,role:`dialog`,"aria-label":`Plan node detail: ${e.label}`,className:`flex h-full w-80 shrink-0 flex-col gap-3 overflow-y-auto border-l border-border bg-card p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:r}),(0,Y.jsx)(`span`,{className:`break-words font-medium`,children:e.label})]}),(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":`Close node detail`,onClick:t,children:(0,Y.jsx)(_e,{className:`size-4`})})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[o,` · Segment `,e.segmentIndex+1,e.durationSharePct==null?null:(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[e.durationSharePct,`%`]}),` of plan stage time`]})]}),e.splitRole?(0,Y.jsxs)(Z,{title:`Exchange`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:Je[e.splitRole]}),e.exchangeShuffleBytes==null?e.label.startsWith(`Broadcast`)?(0,Y.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Broadcast, no shuffle`}):null:(0,Y.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Shuffle written`,` `,(0,Y.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:he(e.exchangeShuffleBytes)})]}),e.pairedNodeId&&n?(0,Y.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 h-7 w-full justify-start gap-1.5`,onClick:()=>n(e.pairedNodeId),children:[(0,Y.jsx)(xe,{className:`size-3.5`,"aria-hidden":`true`}),`Jump to `,e.splitRole===`read`?`write`:`read`,` half`]}):null]}):null,i.length>0?(0,Y.jsx)(Z,{title:`Findings`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:i.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`break-words`,children:O(e)})]},e.id??`${e.type}-${t}`))})}):null,a.length>0?(0,Y.jsx)(Z,{title:`Metrics`,children:(0,Y.jsx)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-3 gap-y-1`,children:a.map((e,t)=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 break-words text-muted-foreground`,children:e.name}),(0,Y.jsx)(`dd`,{className:`text-right font-medium tabular-nums`,children:e.value})]},`${e.name}-${t}`))})}):null,e.detailText?(0,Y.jsx)(Z,{title:`Plan detail`,children:(0,Y.jsx)(`pre`,{"data-testid":`plan-node-detail-text`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-[11px] leading-snug`,children:e.detailText})}):null]})}function Z({title:e,children:t}){return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:e}),t]})}var Xe=[{category:`scan`,label:`Scan`},{category:`filter`,label:`Filter`},{category:`join`,label:`Join`},{category:`aggregate`,label:`Aggregate`},{category:`sort`,label:`Sort`},{category:`exchange`,label:`Exchange`},{category:`transform`,label:`Transform`}];function Ze(){return(0,Y.jsxs)(`div`,{"data-testid":`plan-graph-legend`,role:`region`,"aria-label":`Plan graph legend`,className:`flex max-w-md flex-col gap-2 rounded-md border border-border bg-card p-3 text-xs shadow-md`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Operators`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:Xe.map(({category:e,label:t})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:X[e]}),t]},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Duration share`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.info)}),` low`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.warning)}),` medium`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.critical)}),` high`]})]})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:`Edge thickness`}),` = shuffle bytes moved across an exchange.`]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[`A `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`segment`}),` box groups one Exchange-bounded stage of the plan; a`,` `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`stage`}),` box (full-plan view) wraps every segment of one Spark stage.`]})]})}function Qe({...e}){return(0,Y.jsx)(u,{"data-slot":`popover`,...e})}function $e({...e}){return(0,Y.jsx)(a,{"data-slot":`popover-trigger`,...e})}function et({align:e=`center`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=8,className:i,...a}){return(0,Y.jsx)(s,{children:(0,Y.jsx)(c,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Y.jsx)(l,{"data-slot":`popover-content`,className:B(`z-50 w-72 origin-(--transform-origin) rounded-lg bg-popover p-3 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,i),...a})})})}function tt({ariaLabel:e,name:t,options:n,value:r,onChange:i,trailingContent:a}){return(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,role:`radiogroup`,"aria-label":e,children:[n.map(e=>(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{render:(0,Y.jsx)(`label`,{className:`tap-target-comfortable flex min-h-8 items-center gap-1.5 px-1 text-sm`}),children:[(0,Y.jsx)(`input`,{type:`radio`,name:t,value:e.value,checked:r===e.value,onChange:()=>i(e.value)}),e.label]}),(0,Y.jsx)(We,{children:e.description})]},e.value)),a]})})}var nt=[{value:`io`,label:`I/O only`,description:`Show only scan and exchange nodes, where the plan reads or shuffles/broadcasts data.`},{value:`basic`,label:`Basic`,description:`Add join, aggregate, sort, and filter nodes to I/O; hide pass-through and boilerplate operators like Project or WholeStageCodegen.`},{value:`advanced`,label:`Advanced`,description:`Show every operator, including the pass-through and boilerplate nodes the other two modes hide.`}];function rt({mode:e,onChange:t,hiddenCount:n}){return(0,Y.jsx)(tt,{ariaLabel:`Node filter`,name:`plan-graph-filter`,options:nt,value:e,onChange:t,trailingContent:n>0?(0,Y.jsx)(ge,{label:`${n} nodes hidden`,impactBand:`info`}):null})}var it=[{value:`exclusive`,label:`Node only`,description:`Each node's share reflects time spent in that operator alone, excluding its descendants.`},{value:`inclusive`,label:`Node + descendants`,description:`Each node's share adds in every descendant operator's time, so an ancestor's bar reflects its whole subtree.`}];function at({mode:e,onChange:t}){return(0,Y.jsx)(tt,{ariaLabel:`Duration heat bar scope`,name:`plan-graph-duration-mode`,options:it,value:e,onChange:t})}function ot({filterMode:e,onFilterModeChange:t,hiddenCount:n,durationMode:r,onDurationModeChange:i,iconOnly:a=!1}){return(0,Y.jsxs)(Qe,{children:[(0,Y.jsxs)($e,{"aria-label":a?`Settings`:void 0,title:a?`Settings`:void 0,className:B(R({variant:`ghost`,size:a?`icon`:`sm`}),`tap-target-comfortable`,a?void 0:`gap-1.5`),children:[(0,Y.jsx)(ke,{"aria-hidden":`true`}),a?null:`Settings`]}),(0,Y.jsxs)(et,{align:a?`start`:`end`,side:a?`right`:`bottom`,"aria-label":`Plan graph settings`,className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Node filter`}),(0,Y.jsx)(rt,{mode:e,onChange:t,hiddenCount:n})]}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-px bg-border`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Duration attribution`}),(0,Y.jsx)(at,{mode:r,onChange:i})]})]})]})}var st=e=>e.data;function ct({planNodes:e,problemNodes:t,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o,legendOpen:s,onToggleLegend:c,miniMapOpen:l,onToggleMiniMap:u}){let{zoomIn:d,zoomOut:f,fitView:p,setCenter:m}=E(),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),y=[...e].filter(e=>st(e).durationSharePct!=null).sort((e,t)=>(st(t).durationSharePct??0)-(st(e).durationSharePct??0)),b=e=>{e&&m(e.position.x,e.position.y,{zoom:1,duration:300})},x=(e,t,n)=>{if(e.length===0)return;let r=e[((t?e.findIndex(e=>e.id===t):-1)+1)%e.length];b(r),n(r.id)};return(0,Y.jsxs)(`div`,{className:`flex w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-card/60 py-2`,children:[(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Zoom in`,onClick:()=>d({duration:200}),children:(0,Y.jsx)(Fe,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Zoom out`,onClick:()=>f({duration:200}),children:(0,Y.jsx)(Ne,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Fit to view`,onClick:()=>p({duration:200}),children:(0,Y.jsx)(De,{"aria-hidden":`true`})})]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Next worst duration`,disabled:y.length===0,onClick:()=>x(y,h,g),children:(0,Y.jsx)(je,{"aria-hidden":`true`})}),t.length>0?(0,Y.jsx)(Q,{label:`Next problem`,onClick:()=>x(t,_,v),children:(0,Y.jsx)(Ce,{"aria-hidden":`true`})}):null]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(ot,{iconOnly:!0,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o}),(0,Y.jsx)(Q,{label:s?`Hide legend`:`Legend`,pressed:s,onClick:c,children:(0,Y.jsx)(se,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:l?`Hide minimap`:`Show minimap`,pressed:l,onClick:u,children:(0,Y.jsx)(Te,{"aria-hidden":`true`})})]})]})}function lt({children:e}){return(0,Y.jsx)(`div`,{className:`flex flex-col items-center gap-1`,children:e})}function ut(){return(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`my-0.5 h-px w-6 bg-border`})}function Q({label:e,onClick:t,disabled:n,pressed:r,children:i}){return(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:B(`tap-target-comfortable`,r&&`bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary`),"aria-label":e,title:e,"aria-pressed":r,disabled:n,onClick:t,children:i})}function dt(e){if(e.type!==`planNode`)return`var(--muted)`;let t=e.data.findings??[],n=le(t);return n?N[n]:`var(--plan-aggregate)`}function ft({finding:e,className:t}){let n=fe(e);return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:t}),n?(0,Y.jsx)(`span`,{className:`font-mono text-[10px] leading-none whitespace-nowrap text-muted-foreground`,children:n}):null]})}function pt({data:e}){let{width:t,height:n,stageId:r,durationLabel:i,findings:a}=e;return(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-dashed border-border/70 bg-muted/10 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{title:r==null?`This plan segment couldn't be matched to a specific Spark stage`:void 0,children:r==null?`Stage —`:`Stage ${r}`}),(0,Y.jsx)(ge,{label:i??`—`,impactBand:`info`,title:`Approximate share of this stage's wall time`}),a.length>0?(0,Y.jsx)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1`,children:a.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null]})})}function mt({data:e}){let{width:t,height:n,stageId:r,findings:i,showOwnFindings:a=!0,onSelect:o}=e;return(0,Y.jsxs)(`div`,{className:`relative rounded-xl border border-primary/25 bg-primary/5 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Focus stage ${r}`,onClick:o,style:{pointerEvents:`auto`},className:`absolute inset-0 size-full cursor-pointer rounded-xl transition-colors hover:border-primary/50 hover:bg-primary/10`}),a&&i.length>0?(0,Y.jsx)(`div`,{className:`absolute left-2 right-2 top-1 flex flex-wrap gap-1`,children:i.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null,(0,Y.jsxs)(`span`,{className:`absolute right-2 bottom-1 text-xs font-medium text-primary`,children:[`Stage `,r]})]})}var ht=1.5,gt=.55;function _t(e,t){return!(e>0)||!(t>0)?0:Math.min(1,Math.log(e+1)/Math.log(t+1))}function vt(e,t){return ht+7.5*_t(e,t)}function yt(e,t){return gt+.44999999999999996*_t(e,t)}function bt({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,markerEnd:o,data:s}){let[c,l,u]=_({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a}),{shuffleBytes:d=0,maxShuffleBytes:f=0}=s??{},p=vt(d,f),m=yt(d,f),h=d>0&&d<1e3?`<1 KB`:he(d);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{path:c,markerEnd:o,style:{stroke:`var(--text-muted)`,strokeWidth:p,strokeOpacity:m}}),(0,Y.jsx)(v,{children:(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{"data-testid":`exchange-edge-label`,className:`nodrag nopan pointer-events-auto absolute cursor-help rounded bg-card/90 px-1 py-0.5 font-mono text-[10px] leading-none text-muted-foreground ring-1 ring-border`,style:{transform:`translate(-50%, -50%) translate(${l}px, ${u}px)`},children:h}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsxs)(`p`,{children:[h,` of shuffle written across this exchange. Edge thickness scales with the volume moved.`]})})]})})]})}var xt={planNode:qe,segmentGroup:pt,stageGroup:mt},St={exchange:bt},Ct=1,wt=2,Tt=3,Et=e=>e.data,$={padding:.06,maxZoom:1.75};function Dt({resizeTick:e,fitSignal:t,centerRequest:n}){let{fitView:r,setCenter:i,getNode:a}=E();return(0,K.useEffect)(()=>{if(!n||n.token===0||!n.nodeId)return;let e=a(n.nodeId);e?i(e.position.x,e.position.y,{zoom:1,duration:300}):r({nodes:[{id:n.nodeId}],duration:300,maxZoom:1})},[n,i,a,r]),(0,K.useEffect)(()=>{let e=()=>r({duration:200,...$});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[r]),(0,K.useEffect)(()=>{e!==0&&r({duration:200,...$})},[e,r]),(0,K.useEffect)(()=>{t!==0&&r({duration:300,...$})},[t,r]),null}function Ot(){let e=(0,K.useRef)(null),[t,n]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=new ResizeObserver(()=>{if(r){r=!1;return}n(e=>e+1)});return i.observe(t),()=>i.disconnect()},[]),{ref:e,tick:t}}function kt(e,t){return e.filter(e=>e.stageId===t||e.stageIds?.includes(t))}function At({model:e,showMiniMap:t,findings:n=[],stageId:r,segmentStageIds:i,visibleNodeIds:a,visibleEdges:o,onSelectStage:s,selectedNodeId:c=null,onSelectNode:l,onJumpToPaired:u,centerRequest:d,fitSignal:f=0,filterMode:p=`basic`,onFilterModeChange:m=()=>{},hiddenCount:g=0,durationMode:_=`exclusive`,onDurationModeChange:v=()=>{}}){let{flowNodes:S,flowEdges:C}=(0,K.useMemo)(()=>{let t=e.nodes.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),c=e=>`segment-${e.segmentIndex}`,l=e.scope===`full`,u=e=>{let t=i?.get(e.segmentIndex);return t==null?null:`stage-${t}`},d=a?q(e.nodes.filter(e=>a.has(e.id)),o??e.edges,{groupOf:c}):q(e.nodes,e.edges,{groupOf:c}),f=new Set(d.map(c)),p=l?new Set(d.map(u).filter(e=>e!=null)):null,m=e.nodes.some(e=>!f.has(c(e)))||p!=null&&e.nodes.some(e=>{let t=u(e);return t!=null&&!p.has(t)})?q(e.nodes,e.edges,{groupOf:c}):d,h=d.map(e=>{let n=e.durationShare!=null&&t>0?Math.round(e.durationShare/t*100):null,r=e.splitRole===`read`?`${e.label}, paired: see write half`:[e.label,e.operatorDetail,e.primaryMetric,n==null?null:`${n}% of the plan's total stage duration`].filter(Boolean).join(`, `);return{id:e.id,type:`planNode`,position:e.position,draggable:!1,zIndex:Tt,measured:{width:220,height:90},ariaLabel:r,ariaRole:`button`,data:{...e,durationSharePct:n}}}),g=J(c,[d,m]).map(t=>{let r=Number(t.id.replace(`segment-`,``)),a=e.nodes.filter(e=>c(e)===t.id),o=a.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),s=a.some(e=>e.durationShare!=null),l=i?.get(r)??null,u=l==null?[]:kt(n,l);return{id:t.id,type:`segmentGroup`,position:t.position,draggable:!1,selectable:!1,focusable:!1,zIndex:wt,style:{width:t.width,height:t.height},measured:{width:t.width,height:t.height},data:{width:t.width,height:t.height,stageId:l,durationLabel:s?ue(o):null,findings:u}}}),_=new Set(g.map(e=>e.data.stageId).filter(e=>e!=null)),v=l?(()=>{let e={paddingX:32,paddingY:64,headerHeight:0},t=J(u,[d,m],e),i=`stage-${r}`;if(kt(n,r).length>0&&!t.some(e=>e.id===i)){let[n]=J(()=>i,[d,m],e);n&&t.push(n)}return t.map(e=>{let t=Number(e.id.replace(`stage-`,``));return{id:e.id,type:`stageGroup`,position:e.position,draggable:!1,selectable:!1,focusable:!1,zIndex:Ct,style:{width:e.width,height:e.height},measured:{width:e.width,height:e.height},data:{width:e.width,height:e.height,stageId:t,findings:kt(n,t),showOwnFindings:!_.has(t),onSelect:()=>s?.(t)}}})})():[],y=o??e.edges,b=y.reduce((e,t)=>Math.max(e,t.shuffleBytes??0),0),x=y.map(e=>e.shuffleBytes?{id:e.id,source:e.source,target:e.target,type:`exchange`,data:{shuffleBytes:e.shuffleBytes,maxShuffleBytes:b}}:{id:e.id,source:e.source,target:e.target});return{flowNodes:[...v,...g,...h],flowEdges:x}},[e,n,r,i,a,o,s]),{ref:T,tick:E}=Ot(),[D,O]=(0,K.useState)(!0),[ee,te]=(0,K.useState)(!0),k=c?S.find(e=>e.id===c&&e.type===`planNode`):void 0,A=S.filter(e=>e.type===`planNode`),j=S.filter(e=>e.type===`stageGroup`&&(e.data.findings?.length??0)>0).sort(ye(e=>e.data.findings??[])),ne=a!=null&&a.size===0&&e.nodes.length>0;return(0,Y.jsx)(h,{children:(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{ref:T,className:`flex min-h-0 flex-1`,children:[(0,Y.jsx)(ct,{planNodes:A,problemNodes:j,filterMode:p,onFilterModeChange:m,hiddenCount:g,durationMode:_,onDurationModeChange:v,legendOpen:D,onToggleLegend:()=>O(e=>!e),miniMapOpen:t&&ee,onToggleMiniMap:()=>te(e=>!e)}),(0,Y.jsx)(`div`,{className:`relative min-w-0 flex-1`,onKeyDown:e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest(`.react-flow__node-planNode`)?.getAttribute(`data-id`);t&&(e.preventDefault(),l?.(t))},children:(0,Y.jsxs)(y,{nodes:S,edges:C,nodeTypes:xt,edgeTypes:St,"aria-label":`Plan graph. Operators and the data flowing between them. Tab to move between operators, Enter to open an operator's details.`,fitView:!0,fitViewOptions:$,minZoom:.05,edgesFocusable:!1,onNodeClick:(e,t)=>{t.type===`planNode`&&l?.(t.id)},onPaneClick:()=>l?.(null),children:[(0,Y.jsx)(b,{}),(0,Y.jsx)(Dt,{resizeTick:E,fitSignal:f,centerRequest:d}),ne?(0,Y.jsx)(w,{position:`top-center`,children:(0,Y.jsxs)(`p`,{role:`status`,className:`rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground shadow-sm`,children:[`All `,e.nodes.length,` operators are hidden by the node filter. Change it in Settings to show them.`]})}):null,D?(0,Y.jsx)(w,{position:`bottom-left`,children:(0,Y.jsx)(Ze,{})}):null,t&&ee?(0,Y.jsx)(x,{nodeColor:dt,pannable:!0,zoomable:!0,ariaLabel:`Plan overview. Drag to pan and scroll to zoom the graph.`}):null]})}),k?(0,Y.jsx)(Ye,{node:Et(k),onClose:()=>l?.(null),onJumpToPaired:u}):null]})})})}function jt({open:e,nodeCount:t,onConfirm:n,onCancel:r}){return(0,Y.jsx)(A,{open:e,onOpenChange:e=>{e||r()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(te,{children:(0,Y.jsx)(M,{children:`Expand to full plan?`})}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This plan has `,t,` nodes. Rendering the full graph may take several seconds.`]}),(0,Y.jsxs)(D,{children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Cancel`}),(0,Y.jsx)(H,{type:`button`,size:`sm`,onClick:n,children:`Expand anyway`})]})]})})}var Mt={io:[`scan`,`exchange`],basic:[`scan`,`exchange`,`join`,`aggregate`,`sort`,`filter`],advanced:null},Nt=300;function Pt(e,t){let n=new Map;for(let t of e){let e=n.get(t.source);e?e.push(t.target):n.set(t.source,[t.target])}let r=new Map;function i(e){let a=r.get(e);if(a)return a;let o=new Set;r.set(e,o);for(let r of n.get(e)??[])if(t.has(r))o.add(r);else for(let e of i(r))o.add(e);return o}let a=new Map;for(let t of e)t.shuffleBytes&&a.set(`${t.source}->${t.target}`,t.shuffleBytes);let o=[];for(let e of t)for(let t of i(e)){let n={id:`${e}=>${t}`,source:e,target:t},r=a.get(`${e}->${t}`);r&&(n.shuffleBytes=r),o.push(n)}return o}function Ft(e,t){try{return Le(e,t)}catch{return null}}var It=new Map;function Lt(e,t,n,r){return`${e??`none`}::${t}::${n}::${r}`}function Rt(){It.clear()}var zt=V.getState().modelResetCount;V.subscribe(e=>{e.modelResetCount!==zt&&(zt=e.modelResetCount,Rt())});function Bt(e,t,n){let r=Lt(n,t.stageId,t.scope,t.durationMode),i=It.get(r);if(i)return i;let a=Ft(e,t);return a&&It.set(r,a),a}function Vt({stageId:e,appModel:t,findings:n,activeFileId:r,onClose:i,initialScope:a}){let{resetToDropZone:o}=ie(),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=ne(r),[u,d]=(0,K.useState)(`basic`),[f,p]=(0,K.useState)(`exclusive`),[m,h]=(0,K.useState)(a??`segment`),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(a!==`full`),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(e),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(0),[O,te]=(0,K.useState)({nodeId:null,token:0}),[A,j]=(0,K.useState)(null),M=e=>te(t=>({nodeId:e,token:t.token+1}));(0,K.useEffect)(()=>{T(null)},[S,m,u]);let N=ee(S,t),P=N?Bt(N,{scope:`segment`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,F=P!=null&&P.scope===`full`&&m===`segment`&&P.nodes.length>Nt,I=F&&!b;(0,K.useEffect)(()=>{I&&_(!0)},[I]);let L=N&&(m===`full`||g)?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,R=!v&&m===`full`&&L!=null&&L.nodes.length>Nt,z=g||R;(0,K.useEffect)(()=>{let e=e=>{e.key!==`Escape`||z||(w?T(null):i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,z,w]);let B=F||R?null:m===`full`?L:P;(0,K.useEffect)(()=>{A&&m===`full`&&B?.nodes.some(e=>e.id===A)&&(T(A),M(A),j(null))},[A,m,B]);function V(){let e=N?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null;e&&e.nodes.length>Nt?_(!0):(h(`full`),D(e=>e+1))}function ae(){h(`segment`),D(e=>e+1)}function oe(e){if(B?.nodes.some(t=>t.id===e)){T(e),M(e);return}j(e),V()}let U=(0,K.useCallback)(e=>{C(e),h(`segment`),y(!0),x(!1),j(null),D(e=>e+1)},[]);function se(){y(!0),h(`full`),_(!1),D(e=>e+1)}function ce(){_(!1),j(null),R&&(y(!0),h(`segment`),P?.scope===`full`&&x(!0)),I&&x(!0)}function le(e){return i(),c(e)}let{visibleNodeIds:ue,filteredEdges:de,hiddenNodes:fe}=(0,K.useMemo)(()=>{let e=Mt[u],t=new Set;if(B)for(let n of B.nodes)(!e||e.includes(n.category))&&t.add(n.id);return{visibleNodeIds:t,filteredEdges:B?Pt(B.edges,t):[],hiddenNodes:B?B.nodes.filter(e=>!t.has(e.id)):[]}},[B,u]),W=B?.scope===`full`,pe=m===`full`,me=(0,K.useId)(),G=W&&!pe;return(0,Y.jsxs)(`div`,{"data-testid":`dashboard`,className:`flex h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},children:[(0,Y.jsx)(k,{onLoadNew:o,recentEntries:s,activeFileId:r,onPickRecent:le,onRemoveRecent:l,leadingContent:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`h1`,{className:`truncate font-heading text-sm font-semibold`,children:[`Plan graph: Stage `,S]}),B&&B.scope===`segment`?(0,Y.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[`Segment `,B.segmentIndex+1,` of `,B.segmentCount]}):null,(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:(0,Y.jsx)(re,{anchor:`#bottleneck-duplicate-plan-subtree`,children:`Plan Advisor docs`})})]}),sectionControls:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:G,"aria-describedby":G?me:void 0,onClick:W?ae:V,children:W?`Back to segment view`:`Expand to full plan`}),G?(0,Y.jsx)(`p`,{id:me,className:`text-xs text-muted-foreground`,children:`This stage's plan couldn't be scoped to a single segment`}):null]}),(0,Y.jsx)(H,{variant:`ghost`,size:`sm`,onClick:i,children:`Close`})]})}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:R?null:!N||!B?(0,Y.jsx)(`p`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:F?`This plan has more nodes than the graph view can safely render without expanding. Click "Expand to full plan" to confirm.`:`Couldn't build the plan graph for this stage.`}):(0,Y.jsx)(At,{model:B,visibleNodeIds:ue,visibleEdges:de,showMiniMap:!0,findings:n,stageId:S,segmentStageIds:B.segmentStageIds,onSelectStage:U,selectedNodeId:w,onSelectNode:T,onJumpToPaired:oe,centerRequest:O,fitSignal:E,filterMode:u,onFilterModeChange:d,hiddenCount:fe.length,durationMode:f,onDurationModeChange:p})}),(0,Y.jsx)(jt,{open:z,nodeCount:L?.nodes.length??0,onConfirm:se,onCancel:ce})]})}export{Vt as PlanGraphRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,ht as a,i as o,l as s,ot as c,pt as l}from"./index-U654cmB8.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-BHcqJkcZ.js";import{t as f}from"./RowPagination-oeWB8gBm.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m}from"./finding-anchor-Bl1hRK5E.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";import{n as g,t as _}from"./useSortMode-BhPky1lW.js";import{t as v}from"./StageHeader-DibMSunO.js";var y=e(t(),1),b=n();function x(e){let t=a(e);if(e.metric===`execMaxMedianRatio`)return`Executor ${e.executorId}: ${l(`ratio`,t)} median on ${e.dimension??`this metric`}`;let n=Math.round((e.hostTaskShare??0)*100);return e.metric===`hostDurationShare`?`${e.host}: ${l(`pctFraction`,t)} of this stage's task time (${l(`pct`,n)} of tasks)`:`${e.host}: ${l(`ratio`,t)} median task time (${l(`pct`,n)} of tasks)`}function S(e){if(e.metric!==`hostDurationShare`&&e.metric!==`execMaxMedianRatio`)return null;let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?null:t.slice(n)}function C({finding:e,appModel:t}){let n=m([e]),i=S(e);return(0,b.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-1 text-sm transition-colors ${n.flashClassName}`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(r,{impactBand:e.impactBand}),e.stageId==null?null:(0,b.jsx)(v,{stageId:e.stageId,appModel:t})]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x(e),i]}),(0,b.jsx)(d,{finding:e}),i==null?(0,b.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation}):null]})}var w=(0,y.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:a,orderBy:l}=_(),[d,m]=(0,y.useState)(!n),[v,S]=(0,y.useState)(0),w=t.filter(e=>e.type===`slowHost`).slice().sort((e,t)=>c[e.impactBand]-c[t.impactBand]),T=l(w,e=>[e],e=>e.stageId??null),E=s(),D=E?T.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=h(T,v,S,D);return w.length===0?null:(0,b.jsxs)(o,{title:`Slow Executor Host`,impactBand:w[0].impactBand,badges:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{type:`slowHost`,impactBand:w[0].impactBand}),p(w,w.length,d)?(0,b.jsx)(g,{mode:r,onChange:a}):null]}),open:d,onOpenChange:m,summary:(0,b.jsx)(u,{value:x(w[0]),context:`${w.length} issue${w.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`ul`,{className:`space-y-2`,children:A.map(t=>(0,b.jsx)(C,{finding:t,appModel:e},t.id))}),(0,b.jsx)(f,{page:k,totalPages:O,onPrev:()=>S(e=>e-1),onNext:()=>S(e=>e+1)})]})});export{w as SlowHost};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`smallFiles`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e,n]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Excessive Small Files`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`smallFiles`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as SmallFiles};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,_ as n,c as r,d as i,f as a,l as o,o as s,r as c,s as l,t as u,v as d}from"./charts-vendor-0VMaLVLN.js";import{p as f}from"./plan-graph-vendor-B0sEms9Z.js";import{B as p,R as m,S as h,T as g,V as _,i as v,w as y,z as b}from"./useRecentFiles-BiYdWs8J.js";import{A as x,D as S,Dt as C,Ft as w,O as T,_t as E,ct as D,ht as O,i as k,k as A,l as ee,ot as j,st as M,ut as N,w as P}from"./index-U654cmB8.js";import{t as F}from"./EmptyState-CnTrSjtU.js";import{t as I}from"./downsample-WmNM1qc9.js";import{t as L}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as R}from"./StagePill-Dt6V9yVw.js";import{t as z}from"./ImpactEstimate-BHcqJkcZ.js";import{t as B}from"./RowPagination-oeWB8gBm.js";import{r as V}from"./impact-sort-DxaUheWV.js";import{n as H,t as U}from"./finding-anchor-Bl1hRK5E.js";import{t as W}from"./usePagedRows-jNUWgVTD.js";import{n as G,t as K}from"./useSortMode-BhPky1lW.js";import{t as q}from"./PlanExplorer-DSk1ivS4.js";var J=e(t(),1),Y=f(),X=240,Z=524288e3,Q=10;function $(e){let t=e.spillBytes>Z,n=e.gcPct>Q;return t&&n?`critical`:t||n?`warning`:`info`}function te(e){return y[$(e)]}function ne({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0]?.payload;if(!n)return null;let r=$(n);return(0,Y.jsxs)(`div`,{className:`rounded-md border border-border bg-popover px-2 py-1.5 text-xs text-popover-foreground shadow-md`,children:[(0,Y.jsxs)(`p`,{children:[N(n.spillBytes),` spilled`]}),(0,Y.jsxs)(`p`,{children:[n.gcPct.toFixed(1),`% GC`]}),(0,Y.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(S,{impactBand:r}),r.toUpperCase()]})]})}function re({appModel:e}){let t=[];for(let n of e.stages.values()){let e=n.memoryBytesSpilled??0;e<=0||t.push({stageId:n.id,spillBytes:e,gcPct:n.gcPct??0,submittedAt:n.submittedAt??0})}if(t.length===0)return(0,Y.jsx)(F,{tone:`clean`,icon:C,title:`No stages spilled memory in this run.`});let f=I(t),h=[...f].sort((e,t)=>e.submittedAt-t.submittedAt).map(e=>({stage:`S${e.stageId}`,spillMB:e.spillBytes/1048576,gcPct:e.gcPct}));return(0,Y.jsxs)(m,{defaultValue:`scatter`,children:[(0,Y.jsxs)(p,{"aria-label":`Memory pressure view`,children:[(0,Y.jsx)(_,{value:`scatter`,children:`Scatter`}),(0,Y.jsx)(_,{value:`twin`,children:`Twin bars`})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Spill and GC pressure both stem from tight executor memory, see`,` `,(0,Y.jsx)(x,{anchor:`#memory-model`,children:`how Spark’s memory model works`}),`.`]}),(0,Y.jsxs)(b,{value:`scatter`,children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`critical`}),`CRITICAL`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`warning`}),`WARNING`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`info`}),`INFO`]})]}),(0,Y.jsx)(g,{ariaLabel:`Memory pressure scatter: spilled memory versus GC percent, one point per stage that spilled.`,height:X,table:{caption:`Memory spilled and GC percent by stage`,columns:[`Stage`,`Memory spilled`,`GC %`],rows:f.map(e=>[`S${e.stageId}`,N(e.spillBytes),`${e.gcPct.toFixed(1)}%`]),align:[`left`,`right`,`right`]},children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(a,{stroke:y.muted,strokeOpacity:.2}),(0,Y.jsx)(l,{type:`number`,dataKey:`spillBytes`,name:`Memory spilled`,tickFormatter:e=>N(e),tick:{fontSize:10}}),(0,Y.jsx)(s,{type:`number`,dataKey:`gcPct`,name:`GC %`,tick:{fontSize:10},width:32}),(0,Y.jsx)(d,{cursor:{strokeDasharray:`3 3`},content:ne}),(0,Y.jsx)(r,{data:f,name:`Spill vs. GC`,children:f.map(e=>(0,Y.jsx)(n,{fill:te(e)},e.stageId))})]})})]}),(0,Y.jsx)(b,{value:`twin`,children:(0,Y.jsx)(g,{ariaLabel:`Memory pressure by stage: spilled memory and GC percent across stages in submission order.`,height:X,table:{caption:`Spilled memory and GC percent by stage, submission order`,columns:[`Stage`,`Spill (MB)`,`GC %`],rows:h.map(e=>[e.stage,e.spillMB.toFixed(1),`${e.gcPct.toFixed(1)}%`]),align:[`left`,`right`,`right`]},children:(0,Y.jsxs)(u,{data:h,children:[(0,Y.jsx)(a,{stroke:y.muted,strokeOpacity:.2}),(0,Y.jsx)(l,{dataKey:`stage`,tick:{fontSize:10}}),(0,Y.jsx)(s,{yAxisId:`left`,tick:{fontSize:10},width:36}),(0,Y.jsx)(s,{yAxisId:`right`,orientation:`right`,tick:{fontSize:10},width:36}),(0,Y.jsx)(d,{}),(0,Y.jsx)(o,{yAxisId:`left`,dataKey:`spillMB`,name:`Spill (MB)`,fill:y.critical}),(0,Y.jsx)(i,{yAxisId:`right`,dataKey:`gcPct`,name:`GC %`,stroke:y.info,dot:!1})]})})})]})}function ie(e,t){return e.stages.get(t)?.spillClassification??`unclassified`}function ae({finding:e,appModel:t}){let n=H([e]),r=w(),i=t.stages.get(e.stageId),a=ie(t,e.stageId),o=a===`volume`&&i?E(i):null,s=r===`advanced`&&v(e.stageId,t);return(0,Y.jsxs)(`div`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${U} transition-colors ${n.flashClassName}`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(S,{impactBand:e.impactBand}),(0,Y.jsx)(P,{label:M[a],impactBand:e.impactBand,title:D[a]}),(0,Y.jsx)(R,{stageId:e.stageId})]}),(0,Y.jsx)(A,{children:(0,Y.jsx)(h,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,Y.jsxs)(`p`,{className:`text-sm`,children:[`Memory spilled: `,(0,Y.jsx)(`strong`,{children:N(O(e))}),` · `,`Disk: `,N(i?.diskBytesSpilled??0)]}),(0,Y.jsx)(z,{finding:e}),o?(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Try: `,(0,Y.jsxs)(`code`,{children:[`spark.sql.shuffle.partitions = `,o.recommended]}),` (current ${o.current} tasks, target 128 MB per partition)`]}):null,e.recommendation?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation}):null,s?(0,Y.jsx)(`div`,{className:`pt-1`,children:(0,Y.jsx)(q,{stageId:e.stageId,appModel:t})}):null]})}var oe=(0,J.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:i,orderBy:a}=K(),[o,s]=(0,J.useState)(!n),[c,l]=(0,J.useState)(0),{findings:u,sorted:d,orderedFindings:f}=(0,J.useMemo)(()=>{let e=t.filter(e=>e.type===`spill`&&e.stageId!=null),n=[...e].sort((e,t)=>(j[e.impactBand]??9)-(j[t.impactBand]??9)||(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0));return{findings:e,sorted:n,orderedFindings:a(n,e=>[e],e=>e.stageId)}},[t,r]),p=ee(),m=p?f.findIndex(e=>e===p.finding):null,{totalPages:h,effectivePage:g,visible:_}=W(f,c,l,m);if(u.length===0){let t=0;for(let n of e.stages.values())t=Math.max(t,n.memoryBytesSpilled??0);return(0,Y.jsx)(k,{title:`Spill: no issue detected (max ${N(t)} spilled)`,children:(0,Y.jsx)(F,{tone:`clean`,icon:C,title:`No stages spilled memory in this run.`})})}let v=d[0].impactBand;return(0,Y.jsx)(k,{title:`Spill`,impactBand:v,badges:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{type:`spill`,impactBand:v}),V(u,d.length,o)?(0,Y.jsx)(G,{mode:r,onChange:i}):null]}),open:o,onOpenChange:s,summary:(0,Y.jsx)(L,{value:N(typeof d[0].value==`number`?d[0].value:0),context:`peak · ${d.length} stage${d.length===1?``:`s`}`}),children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(re,{appModel:e}),_.map(t=>(0,Y.jsx)(ae,{finding:t,appModel:e},t.stageId)),(0,Y.jsx)(B,{page:g,totalPages:h,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)})]})})});export{oe as Spill};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{D as i,O as a,ht as o,i as s,k as c,l,ot as u,pt as d}from"./index-U654cmB8.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g}from"./finding-anchor-Bl1hRK5E.js";import{t as _}from"./usePagedRows-jNUWgVTD.js";import{n as v,t as y}from"./useSortMode-BhPky1lW.js";import{t as b}from"./StageHeader-DibMSunO.js";var x=e(t(),1),S=n();function C(e){let t=o(e);return e.unit===`count`?`${t} speculative attempt${t===1?``:`s`} discarded`:`${d(`pct`,t)} of tasks straggled`}function w(e){let t=C(e),n=e.recommendation??``,r=n.startsWith(t)?n.slice(t.length):` ${n}`,i=r.indexOf(`; `);return i===-1?{primary:r,extended:null}:{primary:r.slice(0,i),extended:r.slice(i+2)}}function T({finding:e,appModel:t}){let n=g([e]),{primary:a,extended:o}=w(e);return(0,S.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-1 text-sm transition-colors ${n.flashClassName}`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(i,{impactBand:e.impactBand}),e.stageId==null?null:(0,S.jsx)(b,{stageId:e.stageId,appModel:t})]}),(0,S.jsx)(c,{children:(0,S.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[C(e),a,o==null?null:(0,S.jsx)(c,{children:`; ${o}`})]}),(0,S.jsx)(p,{finding:e})]})}var E=(0,x.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:i,orderBy:o}=y(),[c,d]=(0,x.useState)(!n),[p,g]=(0,x.useState)(0),b=t.filter(e=>e.type===`straggler`).slice().sort((e,t)=>u[e.impactBand]-u[t.impactBand]),w=o(b,e=>[e],e=>e.stageId??null),E=l(),D=E?w.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=_(w,p,g,D);return b.length===0?null:(0,S.jsxs)(s,{title:`Stragglers`,impactBand:b[0].impactBand,badges:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(a,{type:`straggler`,impactBand:b[0].impactBand}),h(b,b.length,c)?(0,S.jsx)(v,{mode:r,onChange:i}):null]}),open:c,onOpenChange:d,summary:(0,S.jsx)(f,{value:C(b[0]),context:`${b.length} issue${b.length===1?``:`s`} flagged`}),children:[(0,S.jsx)(`ul`,{className:`space-y-2`,children:A.map(t=>(0,S.jsx)(T,{finding:t,appModel:e},t.id))}),(0,S.jsx)(m,{page:k,totalPages:O,onPrev:()=>g(e=>e-1),onNext:()=>g(e=>e+1)})]})});export{E as Straggler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,ht as o,i as s,l as c,ot as l,pt as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g}from"./finding-anchor-Bl1hRK5E.js";import{t as _}from"./usePagedRows-jNUWgVTD.js";import{n as v,t as y}from"./useSortMode-BhPky1lW.js";var b=e(t(),1),x=n();function S(e){return e.stageId!=null}function C({finding:e}){let t=g([e]);return(0,x.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`flex flex-col gap-1 transition-colors ${t.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(f,{stageId:e.stageId}),(0,x.jsx)(r,{impactBand:e.impactBand})]}),(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Failure rate: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]}),` (`,String(e.failedTasks),` tasks) · Dominant reason: `,(0,x.jsx)(`strong`,{children:e.dominantReason??`—`})]}),(0,x.jsx)(p,{finding:e}),e.recommendation?(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation}):null]})}function w({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,f]=(0,b.useState)(0),{sortMode:p,setSortMode:g,orderBy:w}=y(),[T,E]=(0,b.useState)(!n),D=c(),O=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!O.current){O.current=!0;return}f(0)},[e]);let k=t.filter(S).filter(e=>e.type===`failures`),A=[...k].sort((e,t)=>l[e.impactBand]-l[t.impactBand]||e.stageId-t.stageId),j=w(A,e=>[e],e=>e.stageId),M=D?j.findIndex(e=>e===D.finding):null,{totalPages:N,effectivePage:P,visible:F}=_(j,r,f,M);return k.length===0?null:(0,x.jsxs)(s,{title:`Failed Tasks`,impactBand:a(k),badges:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{type:`failures`,impactBand:a(k)}),h(k,k.length,T)?(0,x.jsx)(v,{mode:p,onChange:e=>{g(e),f(0)}}):null]}),open:T,onOpenChange:E,summary:(0,x.jsx)(d,{value:u(`pct`,o(A[0])),context:`${k.length} item${k.length===1?``:`s`} flagged`}),children:[(0,x.jsx)(`ul`,{className:`space-y-3`,children:F.map(e=>(0,x.jsx)(C,{finding:e},e.id))}),(0,x.jsx)(m,{page:P,totalPages:N,onPrev:()=>f(e=>e-1),onNext:()=>f(e=>e+1)})]})}export{w as TaskFailures};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`underBroadcast`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Missed Broadcast Join`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`underBroadcast`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as UnderBroadcast};
|