@datarecce/ui 1.46.0-nightly.20260428 → 1.46.1

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import{C as e,F as t,H as n,J as r,P as i,Q as a,S as o,T as s,U as c,X as l,Z as u,_t as d,at as f,ct as p,et as m,f as h,gt as g,h as _,it as v,lt as y,mt as b,nt as x,ot as S,q as C,st as w,ut as T,vt as E,x as ee}from"./api-BqrSvFO2.js";import{d as D,f as O,l as k,s as te}from"./keepAlive-DbC0X4zr.js";import{n as ne,r as re}from"./fetchClient-BVyYwVMf.js";import{C as A,O as ie,_ as j,b as ae,c as M,g as oe,j as se,k as N,m as ce,n as le,o as ue,s as de,u as fe,v as pe,w as me}from"./utils-COgjW7er.js";import{_ as he,g as ge,t as _e}from"./theme-CB8KNGMx.js";import{n as P}from"./colors-BbPSDR1X.js";import{At as ve,Dt as ye,Et as be,Lt as xe,Mt as Se,Nt as Ce,Ot as we,Pt as F,Q as Te,S as Ee,St as De,Tt as Oe,b as ke,c as Ae,ct as je,dt as I,i as Me,jt as Ne,kt as Pe,l as Fe,nt as Ie,pt as Le,r as Re,rt as ze,s as Be,wt as Ve,y as He}from"./utils-Cpt1f5aU.js";import{fetchGitHubAvatar as Ue,fetchUser as We}from"./lib/api/user.js";import{PUBLIC_API_URL as Ge,RECCE_SUPPORT_CALENDAR_URL as Ke}from"./lib/const.js";import{EXPLORE_FORM_EVENT as qe,isExploreAction as Je,trackCopyToClipboard as Ye,trackExploreActionForm as Xe,trackHistoryAction as Ze,trackSingleEnvironment as Qe}from"./lib/api/track.js";import $e from"./lib/result/ResultErrorFallback.js";import{useMutation as et,useQuery as tt,useQueryClient as nt}from"@tanstack/react-query";import{Fragment as rt,createContext as it,forwardRef as at,memo as L,useCallback as R,useContext as ot,useEffect as z,useId as st,useImperativeHandle as ct,useMemo as B,useRef as V,useState as H}from"react";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"@mui/material/Box";import q from"@mui/material/Button";import lt from"@mui/material/Dialog";import ut from"@mui/material/DialogActions";import dt from"@mui/material/DialogContent";import ft from"@mui/material/DialogTitle";import pt from"@mui/material/Link";import J from"@mui/material/Stack";import Y from"@mui/material/Typography";import{LuChartBarBig as mt,LuExternalLink as ht}from"react-icons/lu";import gt from"@mui/material/CssBaseline";import{ThemeProvider as _t,alpha as vt,useTheme as yt}from"@mui/material/styles";import{useTheme as bt}from"next-themes";import{AllCommunityModule as xt,ModuleRegistry as St}from"ag-grid-community";import X from"@mui/material/IconButton";import Ct from"next/link";import{IoClose as wt}from"react-icons/io5";import Tt from"@mui/material/Divider";import Et from"@mui/material/CircularProgress";import Z from"@mui/material/Tooltip";import{FaCheckCircle as Dt,FaRegCheckCircle as Ot}from"react-icons/fa";import{PiBookmarkSimple as kt,PiCaretDown as At,PiChatText as jt,PiCheck as Mt,PiCheckCircle as Nt,PiCircle as Pt,PiClipboardText as Ft,PiCopy as It,PiDotsThreeVertical as Lt,PiDownloadSimple as Rt,PiImage as zt,PiInfo as Bt,PiNotePencil as Vt,PiPencilSimple as Ht,PiPlusCircle as Ut,PiRepeat as Wt,PiTable as Gt,PiTrashSimple as Kt,PiWarning as qt,PiX as Jt}from"react-icons/pi";import Yt from"@mui/material/Chip";import{Background as Xt,BaseEdge as Zt,Controls as Qt,EdgeLabelRenderer as $t,Handle as en,MiniMap as tn,Position as nn,ReactFlow as rn,ReactFlowProvider as an,getBezierPath as on,useEdgesState as sn,useNodesState as cn}from"@xyflow/react";import ln from"file-saver";import un from"@mui/material/Checkbox";import dn from"@mui/material/FormControlLabel";import fn from"@mui/material/ButtonGroup";import{useTimeout as pn}from"usehooks-ts";import mn from"@mui/material/Alert";import hn from"@mui/material/InputBase";import gn from"@mui/material/Menu";import Q from"@mui/material/MenuItem";import _n from"lodash";import{VscKebabVertical as vn,VscKey as yn}from"react-icons/vsc";import bn from"@mui/material/ListSubheader";import xn from"@mui/material/FormControl";import Sn from"@mui/material/FormLabel";import Cn from"@mui/material/NativeSelect";import wn from"@mui/material/TextField";import{format as Tn,formatDistanceToNow as En}from"date-fns";import Dn from"@mui/material/Tab";import On from"@mui/material/Tabs";import kn from"@mui/material/List";import An from"@mui/material/ListItem";import{toCanvas as jn,toPng as Mn}from"html-to-image";import"@xyflow/react/dist/style.css";import Nn from"yaml";import{PostgreSQL as Pn,sql as Fn}from"@codemirror/lang-sql";import{yaml as In}from"@codemirror/lang-yaml";import{EditorState as Ln,Prec as Rn}from"@codemirror/state";import{EditorView as zn,keymap as Bn,lineNumbers as Vn}from"@codemirror/view";import{githubDark as Hn,githubLight as Un}from"@uiw/codemirror-theme-github";import Wn from"@uiw/react-codemirror";import Gn from"@mui/material/Avatar";import Kn from"@mui/material/Popover";import qn from"@mui/material/LinearProgress";import{BarElement as Jn,CategoryScale as Yn,Chart as Xn,Legend as Zn,LinearScale as Qn,TimeSeriesScale as $n,Title as er,Tooltip as tr}from"chart.js";import{Bar as nr,Chart as rr}from"react-chartjs-2";import{AgGridReact as ir}from"ag-grid-react";import{MergeView as ar,unifiedMergeView as or}from"@codemirror/merge";import sr from"react-markdown";import{Prism as cr}from"react-syntax-highlighter";import{oneDark as lr}from"react-syntax-highlighter/dist/esm/styles/prism";import ur from"remark-gfm";import dr from"react-split";import{amber as fr}from"@mui/material/colors";import{usePathname as pr,useRouter as mr}from"next/navigation";import{MdFormatListNumberedRtl as hr,MdSchema as gr}from"react-icons/md";import{TbAlignBoxLeftStretch as _r,TbBrandStackshare as vr,TbChartHistogram as yr,TbEyeEdit as br,TbEyeSearch as xr,TbSql as Sr}from"react-icons/tb";import Cr from"@mui/material/Autocomplete";import wr from"@mui/material/DialogContentText";import Tr from"@mui/material/ListItemIcon";import Er from"@mui/material/ListItemText";import{FiInfo as Dr}from"react-icons/fi";import{FaPlay as Or}from"react-icons/fa6";import{ErrorBoundary as kr}from"@sentry/react";function Ar({children:e,forcedTheme:t,enableCssBaseline:n=!1}){let{resolvedTheme:r}=bt();return z(()=>{(t??r)===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[t,r]),G(_t,{theme:_e,children:[n&&W(gt,{}),e]})}const jr=it({checks:[],isLoading:!1});jr.displayName=`RecceCheckContext`;function Mr({children:e,checks:t=[],isLoading:n=!1,error:r,selectedCheckId:i,onSelectCheck:a,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:d,setLatestSelectedCheckId:f}){let p=i??d,m=a??f,h=B(()=>({checks:t,isLoading:n,error:r,selectedCheckId:p,onSelectCheck:m,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:p,setLatestSelectedCheckId:m}),[t,n,r,p,m,o,s,c,l,u]);return W(jr.Provider,{value:h,children:e})}function Nr(){return ot(jr)}const Pr=it({sql:``,isExecuting:!1});Pr.displayName=`RecceQueryContext`;function Fr({children:e,sql:t=``,isExecuting:n=!1,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}){let _=B(()=>({sql:t,isExecuting:n,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}),[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]);return W(Pr.Provider,{value:_,children:e})}function Ir(){return ot(Pr)}function Lr({children:e}){let[t,n]=H(``);return W(Mr,{selectedCheckId:t,onSelectCheck:n,latestSelectedCheckId:t,setLatestSelectedCheckId:n,children:e})}const Rr=()=>{};function zr(){let e=Nr();return{latestSelectedCheckId:e.latestSelectedCheckId??``,setLatestSelectedCheckId:e.setLatestSelectedCheckId??Rr}}const Br={INTEGER:`integer`,INT:`integer`,BIGINT:`integer`,SMALLINT:`integer`,TINYINT:`integer`,INT64:`integer`,INT32:`integer`,INT16:`integer`,INT8:`integer`,INT4:`integer`,INT2:`integer`,MEDIUMINT:`integer`,SERIAL:`integer`,BIGSERIAL:`integer`,SMALLSERIAL:`integer`,DOUBLE:`number`,FLOAT:`number`,REAL:`number`,NUMERIC:`number`,DECIMAL:`number`,NUMBER:`number`,FLOAT64:`number`,FLOAT32:`number`,"DOUBLE PRECISION":`number`,VARCHAR:`text`,TEXT:`text`,STRING:`text`,CHAR:`text`,"CHARACTER VARYING":`text`,CHARACTER:`text`,NCHAR:`text`,NVARCHAR:`text`,VARCHAR2:`text`,NVARCHAR2:`text`,CLOB:`text`,NCLOB:`text`,TINYTEXT:`text`,MEDIUMTEXT:`text`,LONGTEXT:`text`,BOOLEAN:`boolean`,BOOL:`boolean`,DATE:`date`,TIMESTAMP:`datetime`,DATETIME:`datetime`,TIMESTAMP_NTZ:`datetime`,TIMESTAMP_LTZ:`datetime`,TIMESTAMP_TZ:`datetime`,TIMESTAMPTZ:`datetime`,"TIMESTAMP WITH TIME ZONE":`datetime`,"TIMESTAMP WITHOUT TIME ZONE":`datetime`,"TIMESTAMP WITH LOCAL TIME ZONE":`datetime`,DATETIME2:`datetime`,SMALLDATETIME:`datetime`,DATETIMEOFFSET:`datetime`,TIME:`time`,TIMETZ:`time`,"TIME WITH TIME ZONE":`time`,"TIME WITHOUT TIME ZONE":`time`,BINARY:`binary`,VARBINARY:`binary`,BYTES:`binary`,BLOB:`binary`,BYTEA:`binary`,TINYBLOB:`binary`,MEDIUMBLOB:`binary`,LONGBLOB:`binary`,JSON:`json`,JSONB:`json`,VARIANT:`json`,OBJECT:`json`,STRUCT:`json`,MAP:`json`,ARRAY:`array`,LIST:`array`,GEOGRAPHY:`geography`,GEOMETRY:`geography`,POINT:`geography`,LINESTRING:`geography`,POLYGON:`geography`,MULTIPOINT:`geography`,MULTILINESTRING:`geography`,MULTIPOLYGON:`geography`,GEOMETRYCOLLECTION:`geography`,SDO_GEOMETRY:`geography`};function Vr(e){let t=e.trim().toUpperCase();if(!t)return`unknown`;if(/^TINYINT\s*\(\s*1\s*\)$/.test(t))return`boolean`;let n=t.indexOf(`(`);return Br[n===-1?t:t.slice(0,n).trimEnd()]??`unknown`}const Hr=.6,Ur=18/30;function Wr({size:e=`1em`,style:t,className:n,children:r}){return G(`svg`,{viewBox:`0 0 30 18`,width:e,height:typeof e==`number`?e*Ur:`${Ur}em`,style:t,className:n,"aria-hidden":`true`,children:[W(`rect`,{x:Hr,y:Hr,width:30-Hr*2,height:18-Hr*2,rx:3,fill:`none`,stroke:`currentColor`,strokeWidth:1.2}),r]})}function Gr({text:e,size:t,style:n,className:r}){return W(Wr,{size:t,style:n,className:r,children:W(`text`,{x:30/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10.5,fontFamily:`monospace`,fontWeight:500,fill:`currentColor`,children:e})})}function Kr(e){return W(Gr,{text:`123`,...e})}function qr(e){return W(Gr,{text:`1.2`,...e})}function Jr(e){return W(Gr,{text:`abc`,...e})}function Yr(e){return W(Gr,{text:`T/F`,...e})}function Xr({size:e,style:t,className:n}){let r=st(),i=Hr,a=Hr,o=18-Hr*2;return G(Wr,{size:e,style:t,className:n,children:[G(`mask`,{id:r,children:[W(`rect`,{x:i,y:a,width:15-i,height:o,fill:`white`}),W(`text`,{x:15/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10,fontFamily:`monospace`,fontWeight:700,fill:`black`,children:`0`})]}),W(`path`,{d:`M15 ${a} H${i+3} Q${i} ${a} ${i} ${a+3} V${a+o-3} Q${i} ${a+o} ${i+3} ${a+o} H15 Z`,fill:`currentColor`,mask:`url(#${r})`}),W(`text`,{x:22.5,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10,fontFamily:`monospace`,fontWeight:700,fill:`currentColor`,children:`1`})]})}function Zr(e){return W(Gr,{text:`{ }`,...e})}function Qr({size:e,style:t,className:n}){return G(Wr,{size:e,style:t,className:n,children:[G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.2,strokeLinecap:`round`,children:[W(`line`,{x1:6,y1:5,x2:4,y2:5}),W(`line`,{x1:4,y1:5,x2:4,y2:13}),W(`line`,{x1:4,y1:13,x2:6,y2:13}),W(`line`,{x1:24,y1:5,x2:26,y2:5}),W(`line`,{x1:26,y1:5,x2:26,y2:13}),W(`line`,{x1:26,y1:13,x2:24,y2:13})]}),W(`text`,{x:30/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:9,fontFamily:`monospace`,fontWeight:500,fill:`currentColor`,children:`1,2`})]})}function $r(e){return W(Gr,{text:`···`,...e})}function ei({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(9, 2.5)`,children:[W(`rect`,{x:0,y:2,width:11,height:9.5,rx:1.2}),W(`line`,{x1:3,y1:.5,x2:3,y2:3.5}),W(`line`,{x1:8,y1:.5,x2:8,y2:3.5}),W(`line`,{x1:0,y1:5.5,x2:11,y2:5.5})]})})}function ti({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(4, 2.5)`,children:[W(`rect`,{x:0,y:2,width:9.5,height:8.5,rx:1.2}),W(`line`,{x1:2.5,y1:.5,x2:2.5,y2:3.5}),W(`line`,{x1:7,y1:.5,x2:7,y2:3.5}),W(`line`,{x1:0,y1:5,x2:9.5,y2:5}),W(`circle`,{cx:17,cy:8.5,r:3.2}),W(`line`,{x1:17,y1:6.8,x2:17,y2:8.5}),W(`line`,{x1:17,y1:8.5,x2:18.3,y2:9.5})]})})}function ni({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(10, 3.5)`,children:[W(`circle`,{cx:5,cy:5.5,r:5}),W(`line`,{x1:5,y1:3,x2:5,y2:5.5}),W(`line`,{x1:5,y1:5.5,x2:7,y2:6.8})]})})}function ri({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,children:[W(`path`,{d:`M15 14.5 C15 14.5 10.5 11 10.5 8 A4.5 4.5 0 0 1 19.5 8 C19.5 11 15 14.5 15 14.5 Z`,strokeWidth:1.2}),W(`circle`,{cx:15,cy:8,r:1.5,fill:`currentColor`,stroke:`none`})]})})}function ii(e){let{name:t,status:n,baseType:r,currentType:i,cllAvailable:a}=e,o;switch(n){case`added`:o=i?`${t} added ${i}`:`${t} added`;break;case`removed`:return`deleted ${t}`;case`type_changed`:o=`${t}, was ${r} now ${i}`;break;case`definition_changed`:o=i?`${t} ${i} changed definition`:`${t} changed definition`;break;case`unchanged`:o=i?`${t} ${i}`:t;break;default:o=r&&i&&r!==i?`${t}, was ${r} now ${i}`:i?`${t} ${i}`:t;break}return a&&(o+=` · Click for column lineage`),o}const ai={integer:Kr,number:qr,text:Jr,boolean:Yr,date:ei,datetime:ti,time:ni,binary:Xr,json:Zr,array:Qr,geography:ri,unknown:$r};function oi({type:e,size:t,style:n,className:r,disableTooltip:i}){let a=ai[Vr(e)],o=W(`span`,{"data-testid":`data-type-icon`,style:{display:`inline-flex`,alignItems:`center`,lineHeight:0},children:W(a,{size:t,style:n,className:r})});return i?o:W(Z,{title:e,placement:`top`,arrow:!0,children:o})}const si=.35,ci=.1,li=.15,ui=`opacity(0.4) grayscale(40%)`,di=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm6.5 2.5v2.5h2.5v1H8.5v2.5h-1V8H5V7h2.5V4.5h1z`})}),fi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm3 5.5h6v1H5v-1z`})}),pi=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`path`,{d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),W(`path`,{d:`M10.6 8.7c-.1.1-.3.2-.5.2h-.1l-1.4-.3c-.5-.1-1.1-.3-1.8-.3-.6 0-1 .2-1.3.5-.2.2-.2.4-.2.7v.1l-.9.3v-.2c0-.3 0-.6.1-.9.2-.4.5-.8 1-1.1.5-.4 1.2-.5 2-.5h.2l1.5.4h.1c.5.1 1 .3 1.5.3.6 0 .9-.2 1.2-.4.2-.2.3-.5.3-.8v-.3l.8-.3h.1v.3c0 .6-.2 1.2-.6 1.6-.2.2-.3.4-.5.5l-.5.2z`})]}),mi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`})}),hi=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),W(`path`,{d:`M7.5 4h1v5h-1V4zm0 6h1v1.5h-1V10z`})]}),gi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),_i=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z`})}),vi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z`})}),yi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z`})}),bi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V80zM0 272c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v160c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272zM368 96h32c26.5 0 48 21.5 48 48v288c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48z`})}),xi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm320 96c0-15.9-5.8-30.4-15.3-41.6l76.6-147.4c6.1-11.8 1.5-26.3-10.2-32.4s-26.2-1.5-32.4 10.2L262.1 288.3c-2-.2-4-.3-6.1-.3c-35.3 0-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64z`})}),Si=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z`})}),Ci=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M256 128C141.4 128 37.5 193.3 1.6 246.1c-2.1 3.2-2.1 7.5 0 10.7C37.5 309.7 141.4 384 256 384s218.5-74.3 254.4-127.2c2.1-3.2 2.1-7.5 0-10.7C474.5 193.3 370.6 128 256 128zm0 208c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96zm0-144c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`})}),wi=e=>{let t=st(),n=`inc-bottom-${t}`,r=`inc-top-${t}`;return G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[G(`defs`,{children:[W(`clipPath`,{id:n,children:W(`rect`,{x:`0`,y:`200`,width:`512`,height:`312`})}),W(`clipPath`,{id:r,children:W(`rect`,{x:`0`,y:`0`,width:`512`,height:`200`})})]}),W(`path`,{clipPath:`url(#${n})`,d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`}),W(`path`,{clipPath:`url(#${r})`,d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`,fill:`none`,stroke:`currentColor`,strokeWidth:`12`,strokeDasharray:`20 12`})]})},Ti=e=>W(`svg`,{stroke:`currentColor`,fill:`none`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`,fill:`none`,stroke:`currentColor`,strokeWidth:`12`,strokeDasharray:`20 12`})}),Ei=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`g`,{transform:`translate(0, 0) scale(0.75)`,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),W(`g`,{transform:`translate(250, 260) scale(0.5)`,children:W(`path`,{d:`M256 128C141.4 128 37.5 193.3 1.6 246.1c-2.1 3.2-2.1 7.5 0 10.7C37.5 309.7 141.4 384 256 384s218.5-74.3 254.4-127.2c2.1-3.2 2.1-7.5 0-10.7C474.5 193.3 370.6 128 256 128zm0 208c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96zm0-144c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`})})]}),Di={added:di,removed:fi,modified:pi,impacted:hi};function Oi(e,t){return e===`cll`?{colors:Ii,bg:t?Ri:Li}:{colors:Ni,bg:t?Fi:Pi}}function ki(e,t,n=`default`){let r=e??`unchanged`,{colors:i,bg:a}=Oi(n,t),o=i[r],s=a[r];return{color:o,hexColor:o,backgroundColor:s,hexBackgroundColor:s,icon:Di[r]}}function Ai(e){return ki(`impacted`,e,`cll`)}function ji(e){switch(e){case`model`:return{color:P.cyan[200],icon:gi};case`source`:return{color:P.green[300],icon:_i};case`seed`:return{color:P.green[500],icon:vi};case`snapshot`:return{color:P.green[500],icon:yi};case`metric`:return{color:P.rose[200],icon:bi};case`exposure`:return{color:P.rose[200],icon:xi};case`semantic_model`:return{color:P.rose[400],icon:Si};default:return{color:`inherit`,icon:void 0}}}function Mi(e){switch(e){case`table`:return{color:P.cyan[200],icon:gi};case`view`:return{color:P.fuchsia[300],icon:Ci};case`incremental`:return{color:P.iochmara[300],icon:wi};case`ephemeral`:return{color:P.neutral[400],icon:Ti};case`materialized_view`:case`dynamic_table`:case`streaming_table`:return{color:P.fuchsia[200],icon:Ei};default:return{color:`inherit`,icon:void 0}}}const Ni={added:P.green[500],removed:P.red[500],modified:P.amber[500],unchanged:P.neutral[500]},Pi={added:P.green[100],removed:P.red[200],modified:P.amber[100],unchanged:P.white},Fi={added:P.green[900],removed:P.red[950],modified:P.amber[900],unchanged:P.neutral[700]},Ii={added:`rgb(46 160 67)`,removed:`rgb(248 81 73)`,modified:`rgb(212 133 11)`,impacted:`rgb(252 211 77)`,unchanged:P.neutral[500]},Li={added:`rgb(222 248 227)`,removed:`rgb(252 225 224)`,modified:`rgb(255 237 175)`,impacted:`rgb(254 249 227)`,unchanged:P.white},Ri={added:`rgb(30 58 30)`,removed:`rgb(68 35 35)`,modified:`rgb(75 65 33)`,impacted:`rgb(50 44 24)`,unchanged:`rgb(38 38 38)`},zi=24,Bi=280,Vi={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Hi({size:e=14}){return G(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[W(`circle`,{cx:`8`,cy:`3`,r:`1.5`}),W(`circle`,{cx:`8`,cy:`8`,r:`1.5`}),W(`circle`,{cx:`8`,cy:`13`,r:`1.5`})]})}function Ui({changeStatus:e,newCllExperience:t}){if(!e)return null;let n=(t?Ii:Ni)[e];return W(K,{sx:{width:14,height:14,borderRadius:`50%`,backgroundColor:n,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:{added:`+`,removed:`-`,modified:`~`}[e]})}function Wi({transformationType:e}){if(!e)return null;let t=Vi[e];return W(Yt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Gi({id:e,data:t,showContent:n=!0,showChangeAnalysis:r=!1,isDark:i=!1,newCllExperience:a,onColumnClick:o,onContextMenu:s}){let{column:c,type:l,transformationType:u,changeStatus:d,isHighlighted:f=!0,isFocused:p=!1,isImpacted:m=!1}=t,h=a??t.newCllExperience??!1,[g,_]=H(!1);if(!n)return null;let v=r&&d,y=h&&d?(i?Ri:Li)[d]:void 0,b=h&&d?Ii[d]:void 0,x=m&&!d?Ai(i):void 0,S=y??x?.backgroundColor,C=b??x?.color,w=h&&i?`#262626`:`background.paper`,T=h&&i?`#333333`:`action.hover`,E=h&&i?`#404040`:`action.selected`,ee=h&&i?`#ffffff`:`text.primary`;return G(K,{onClick:()=>o?.(e),sx:{display:`flex`,width:280,padding:`0px 10px`,border:`1px solid`,borderColor:`divider`,backgroundColor:S||(p?E:g?T:w),borderLeft:C?`3px solid ${C}`:void 0,filter:f?`none`:ui,cursor:`pointer`,transition:`background-color 0.15s ease`},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[G(K,{sx:{display:`flex`,fontSize:`11px`,color:ee,width:`100%`,gap:`6px`,alignItems:`center`,height:`23px`},children:[v?W(Ui,{changeStatus:d,newCllExperience:h}):W(Wi,{transformationType:u}),W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flexGrow:1,height:`25px`,lineHeight:`25px`},children:c}),g&&s?W(K,{sx:{display:`inline-flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:t=>{t.preventDefault(),t.stopPropagation(),s(t,e)},"data-testid":`column-kebab-menu`,children:W(Hi,{size:14})}):l&&W(oi,{type:l,style:{flexShrink:0,opacity:.7,fontSize:`1rem`}})]}),W(en,{type:`target`,position:nn.Left,isConnectable:!1,style:{left:0,visibility:`hidden`}}),W(en,{type:`source`,position:nn.Right,isConnectable:!1,style:{right:0,visibility:`hidden`}})]})}const Ki=L(Gi);Ki.displayName=`LineageColumnNode`;function qi({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:s,selected:c}){let l=s?.changeStatus??`unchanged`,u=s?.isHighlighted??!1,d=s?.label,[f,p,m]=on({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o}),h=Ii[l];return G(U,{children:[W(Zt,{id:e,path:f,style:{stroke:h,strokeWidth:u||c?2.5:1.5,opacity:u||c?1:.6}}),d&&W($t,{children:W(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${p}px,${m}px)`,fontSize:10,fontWeight:500,background:`white`,padding:`2px 4px`,borderRadius:4,pointerEvents:`all`},children:d})})]})}const Ji=L(qi);Ji.displayName=`LineageEdge`;function Yi({changedOnly:e,onChange:t}){return W(dn,{control:W(un,{checked:e??!1,onChange:()=>{t()},size:`small`}),label:`Changed only`,slotProps:{typography:{variant:`body2`}}})}function Xi({value:e,onChange:t,textOn:n,textOff:r}){return G(fn,{variant:`outlined`,size:`xsmall`,sx:{borderRadius:1},children:[W(q,{onClick:()=>{t(!1)},sx:{color:e?`text.disabled`:`text.primary`,bgcolor:e?`action.hover`:`background.paper`,borderColor:`divider`,"&:hover":{bgcolor:e?`action.selected`:`background.paper`,borderColor:`divider`}},children:r??`Off`}),W(q,{onClick:()=>{t(!0)},sx:{color:e?`text.primary`:`text.disabled`,bgcolor:e?`background.paper`:`action.hover`,borderColor:`divider`,"&:hover":{bgcolor:e?`background.paper`:`action.selected`,borderColor:`divider`}},children:n??`On`})]})}function Zi({displayMode:e,onDisplayModeChanged:t}){return G(U,{children:[e===`inline`&&G(U,{children:[W(Le,{value:`Base`,colorPalette:`red`,grayOut:!1,fontSize:`10pt`,noCopy:!0}),W(Le,{value:`Current`,colorPalette:`green`,grayOut:!1,fontSize:`10pt`,noCopy:!0})]}),W(Xi,{value:e===`side_by_side`,onChange:e=>{t(e?`side_by_side`:`inline`)},textOff:`Inline`,textOn:`Side by side`})]})}const Qi=e=>{let{defaultValues:t,suggestionList:n,onValuesChange:r,className:i}=e,[a,o]=H(t??[]),[s,c]=H(``),[l,u]=H(!1),[d,f]=H(null),p=V(null),m=!!d,h=t=>t.length>1?`${t.length} ${e.unitName}s selected`:t.length===1?t[0]:``,g=e=>{f(e.currentTarget),setTimeout(()=>p.current?.focus(),100)},_=()=>{f(null),u(!1)},v=e=>{a.includes(e)||(c(``),o([...a,e]),r([...a,e]))},y=()=>{c(``),o([]),r([])},b=e=>{o(a.filter(t=>t!==e)),r(a.filter(t=>t!==e))},x=s.toLowerCase(),S=n?.filter(e=>x===``||e.toLowerCase().includes(x)).filter(e=>!a.includes(e))??[],C=()=>{switch(e.size){case`2xs`:return`0.625rem`;case`xs`:return`0.75rem`;case`sm`:return`0.875rem`;default:return`0.875rem`}};return G(K,{sx:{display:`flex`,alignItems:`center`,width:e.width},className:i,children:[G(q,{variant:`outlined`,color:`neutral`,size:`small`,onClick:g,disabled:e.disabled,sx:{width:`100%`,height:(()=>{switch(e.size){case`2xs`:return 24;case`xs`:return 28;case`sm`:return 32;default:return 36}})(),justifyContent:`space-between`,textTransform:`none`,fontSize:C(),fontWeight:`normal`,px:1},children:[W(Y,{component:`span`,sx:{fontSize:C(),color:a.length>0?`text.primary`:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(a)||e.placeholder||``}),a.length>0&&W(Y,{component:`span`,onClick:e=>{e.stopPropagation(),y()},sx:{fontSize:C(),color:`primary.main`,cursor:`pointer`,ml:1,"&:hover":{textDecoration:`underline`}},children:`Clear`})]}),G(gn,{anchorEl:d,open:m,onClose:_,slotProps:{paper:{sx:{width:e.width,fontSize:C()}}},children:[W(K,{sx:{px:.5,py:.5},children:G(K,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,p:.5,display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`},className:`no-track-pii-safe`,children:[a.map(e=>W(Yt,{label:e,size:`small`,onDelete:()=>b(e),sx:{height:22,fontSize:C()}},e)),W(hn,{inputRef:p,placeholder:`Filter or add custom keys`,value:s,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation();let t=e.target,n=t.value.trim().replace(`,`,``);switch(e.key){case`,`:case`Enter`:e.preventDefault(),n&&(v(n),c(``));break;case`Backspace`:t.value===``&&a.length>0&&(o(a.slice(0,-1)),r(a.slice(0,-1)));break;default:break}},onBlur:()=>{p.current&&l&&p.current.focus()},sx:{flex:1,minWidth:120,fontSize:C(),"& input":{p:.5}}})]})}),W(Tt,{}),s!==``&&!n?.includes(s)&&G(Q,{onClick:()=>{v(s),u(!1)},sx:{fontSize:C()},children:[`Add '`,s,`' to the list`]}),S.slice(0,10).map((e,t)=>W(Q,{onClick:()=>{v(e)},sx:{fontSize:C()},children:e},_n.uniqueId(`option-${t}`))),S.length>10&&W(Z,{title:`Please use filter to find more items`,placement:`top`,children:G(K,{sx:{px:1.5,py:.5,color:`text.secondary`,fontSize:`8pt`},children:[`and `,S.length-10,` more items...`]})})]})]})};function $i(e){let t=[`CHAR`,`VARCHAR`,`TINYTEXT`,`TEXT`,`MEDIUMTEXT`,`LONGTEXT`,`NCHAR`,`NVARCHAR`,`VARCHAR2`,`NVARCHAR2`,`CLOB`,`NCLOB`,`VARCHAR(MAX)`,`XML`,`JSON`],n=e.trim().toUpperCase();return t.includes(n)?!0:/^(VARCHAR|NVARCHAR|VARCHAR2|NVARCHAR2|CHAR|NCHAR)\(\d+\)$/.test(n)}function ea(e){return[`BOOLEAN`,`TINYINT(1)`,`BIT`,`NUMBER(1)`,`BOOL`].includes(e.toUpperCase())}function ta(e){return[`DATE`,`DATETIME`,`TIMESTAMP`,`TIME`,`YEAR`,`DATETIME2`,`SMALLDATETIME`,`DATETIMEOFFSET`,`INTERVAL`,`TIMESTAMPTZ`,`TIMETZ`,`TIMESTAMP WITH TIME ZONE`,`TIMESTAMP WITH LOCAL TIME ZONE`,`TIMESTAMP_LTZ`,`TIMESTAMP_NTZ`,`TIMESTAMP_TZ`].includes(e.toUpperCase())}function na(e){return!$i(e)&&!ea(e)&&!ta(e)}function ra({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=Ql(e.model),o=r.filter(e=>!$i(e.type)&&!ea(e.type)&&!ta(e.type));return i?W(K,{children:`Loading...`}):r.length===0||a?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):W(K,{sx:{m:`16px`},children:G(xn,{fullWidth:!0,disabled:o.length===0,children:[W(Sn,{sx:{mb:1},children:`Pick a column to show Histogram Diff`}),G(Cn,{value:e.column_name,onChange:r=>{let i=r.target.value;n(!!i);let a=o.find(e=>e.name===i)?.type??``;t({...e,column_name:i,column_type:a})},children:[W(`option`,{value:``,children:o.length===0?`No numeric column is available`:`Select column`}),o.map(e=>G(`option`,{value:e.name,className:`no-track-pii-safe`,children:[e.name,` : `,e.type]},e.name))]})]})})}const ia=[{status:`added`,label:`Added`,description:`Newly added resource`},{status:`removed`,label:`Removed`,description:`Removed resource`},{status:`modified`,label:`Modified`,description:`Modified resource`},{status:`impacted`,label:`Impacted`,description:`Downstream of a modified resource`}],aa=[{type:`passthrough`,label:`Passthrough`,description:`Column passes through unchanged`},{type:`renamed`,label:`Renamed`,description:`Column was renamed from source`},{type:`derived`,label:`Derived`,description:`Column is derived from other columns`},{type:`source`,label:`Source`,description:`Original source column`},{type:`unknown`,label:`Unknown`,description:`Transformation type could not be determined`}],oa={added:{color:Ni.added,symbol:`+`},removed:{color:Ni.removed,symbol:`-`},modified:{color:Ni.modified,symbol:`~`}},sa={added:{color:Ii.added,symbol:`+`},removed:{color:Ii.removed,symbol:`-`},modified:{color:Ii.modified,symbol:`~`},impacted:{color:Ii.impacted,symbol:`!`}},ca={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function la({status:e,newCllExperience:t}){let n=(t?sa:oa)[e];return W(K,{sx:{width:16,height:16,borderRadius:`50%`,backgroundColor:n.color,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:n.symbol})}function ua({type:e}){let t=ca[e];return W(Yt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function da({variant:e,showTooltips:t=!0,title:n,className:r,newCllExperience:i=!1}){let a=i?ia:ia.filter(e=>e.status!==`impacted`),o=e===`changeStatus`?a:aa;return G(K,{className:r,sx:{bgcolor:`background.paper`,padding:`12px`,border:`1px solid`,borderColor:`divider`,borderRadius:1,fontSize:`0.875rem`},children:[n&&W(Y,{variant:`caption`,sx:{display:`block`,fontWeight:600,mb:1,color:`text.secondary`},children:n}),e===`changeStatus`&&o.map(e=>{let n=G(K,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[W(la,{status:e.status,newCllExperience:i}),W(Y,{variant:`body2`,children:e.label})]},e.status);return t&&e.description?W(Z,{title:e.description,placement:`right`,children:n},e.status):n}),e===`transformation`&&o.map(e=>{let n=G(K,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[W(ua,{type:e.type}),W(Y,{variant:`body2`,children:e.label})]},e.type);return t&&e.description?W(Z,{title:e.description,placement:`right`,children:n},e.type):n})]})}const fa={breaking:`Breaking`,non_breaking:`Non Breaking`,partial_breaking:`Partial Breaking`,unknown:`Unknown`},pa=()=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:W(`path`,{d:`M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z`})}),ma=()=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:W(`path`,{d:`M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z`})});function ha({name:e,color:t,resourceType:n}){let r=n===`model`?e:`${e} (${n||`unknown`})`;return W(K,{sx:{flex:1,color:t,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:W(Z,{title:r,placement:`top`,children:W(`span`,{children:e})})})}function ga({id:e,data:t,selected:n,interactive:r=!1,selectMode:i=`normal`,isNodeSelected:a=!1,isFocused:o=!1,isHighlighted:s=!0,showContent:c=!0,actionTag:l,showChangeAnalysis:u=!1,changeCategory:d,runsAggregatedTag:f,hasParents:p=!0,hasChildren:m=!0,columnCount:h=0,columnHeight:g=28,isDark:_=!1,newCllExperience:v,isImpacted:y,onNodeClick:b,onNodeDoubleClick:x,onSelect:S,onContextMenu:C,onShowImpactRadius:w}){let[T,E]=H(!1),{label:ee,changeStatus:D=`unchanged`,isSelected:O,resourceType:k,materialized:te}=t,ne=v??t.newCllExperience??!1,re=y??t.isImpacted??!1,A=a||O||n||!1,ie=h>0,j=i===`action_result`&&l,{icon:ae,color:M,backgroundColor:oe}=ne&&re&&(!D||D===`unchanged`)?Ai(_):ki(D,_,ne?`cll`:`default`),{icon:se}=k===`model`&&te?Mi(te):ji(k),N=M,ce=(()=>{let e=_?`#1e1e1e`:`#ffffff`;return c?i===`selecting`?A?M:e:i===`action_result`?j?o||A||T?oe:M:e:o||A||T?oe:e:o||A||T?M:oe})(),le=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:e:i===`action_result`&&j&&!A?t:e})(),ue=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:e:i===`action_result`&&j&&!A?t:e})(),de=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:M:i===`action_result`?j&&!A?t:e:M})();return G(K,{onClick:()=>b?.(e),onDoubleClick:()=>x?.(e),onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),sx:{display:`flex`,flexDirection:`column`,width:300,cursor:i===`selecting`?`pointer`:`inherit`,transition:`box-shadow 0.2s ease-in-out`,padding:0,filter:ne?`none`:i===`action_result`?j?`none`:ui:s||o||A||T?`none`:ui},children:[G(K,{sx:{display:`flex`,borderColor:N,borderWidth:`2px`,borderStyle:`solid`,borderTopLeftRadius:8,borderTopRightRadius:8,borderBottomLeftRadius:ie?0:8,borderBottomRightRadius:ie?0:8,backgroundColor:ce,height:60},children:[W(K,{sx:{display:`flex`,bgcolor:M,padding:r?`8px`:`2px`,borderRightWidth:`2px`,borderRightStyle:`solid`,borderColor:i===`selecting`?`#00000020`:N,alignItems:`top`,visibility:c?`inherit`:`hidden`},children:r&&W(un,{checked:i===`selecting`&&A||i===`action_result`&&!!j,onClick:t=>{i!==`action_result`&&(t.stopPropagation(),S?.(e))},disabled:i===`action_result`,size:`small`,sx:{padding:0,color:`inherit`,"&.Mui-checked":{color:`inherit`}}})}),G(K,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,width:100,flexDirection:`column`},children:[G(K,{sx:{display:`flex`,width:`100%`,textAlign:`left`,fontWeight:600,flex:1,p:.5,gap:`5px`,alignItems:`center`,visibility:c?`inherit`:`hidden`},children:[W(ha,{name:ee,color:le,resourceType:k}),T?G(U,{children:[D===`modified`&&w&&W(Z,{title:`Show Impact Radius`,placement:`top`,children:W(K,{onClick:t=>{t.preventDefault(),t.stopPropagation(),w?.(e)},sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:W(ma,{})})}),C&&W(K,{onClick:t=>{t.preventDefault(),t.stopPropagation(),C?.(t,e)},sx:{cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:W(pa,{})})]}):G(U,{children:[se&&W(K,{sx:{fontSize:16,color:ue},children:W(se,{"aria-hidden":`true`})}),D&&ae&&W(K,{sx:{color:de},children:W(ae,{"aria-hidden":`true`})})]})]}),W(K,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,flexDirection:`column`,paddingBottom:.5,visibility:c?`inherit`:`hidden`},children:W(J,{direction:`row`,spacing:1,children:l?G(U,{children:[W(K,{sx:{flexGrow:1}}),l]}):u&&d?W(Y,{sx:{height:20,color:`text.secondary`,fontSize:`9pt`,margin:0,fontWeight:600},children:fa[d]}):i!==`action_result`&&f?f:null})})]})]}),ie&&W(K,{sx:{p:`10px 10px`,borderColor:N,borderWidth:`2px`,borderStyle:`solid`,borderTopWidth:0,borderBottomLeftRadius:8,borderBottomRightRadius:8},children:W(K,{sx:{height:`${h*g}px`,overflow:`auto`}})}),p&&W(en,{type:`target`,position:nn.Left,isConnectable:!1}),m&&W(en,{type:`source`,position:nn.Right,isConnectable:!1})]})}const _a=L(ga);_a.displayName=`LineageNode`;const va=e=>({display:`inline-flex`,alignItems:`center`,borderRadius:16,px:1,py:.25,fontSize:`0.75rem`,bgcolor:e?`grey.700`:`grey.100`,color:e?`grey.100`:`inherit`}),ya={mr:.5,display:`flex`,alignItems:`center`},ba={table:`table`,view:`view`,incremental:`incremental`,ephemeral:`ephemeral`,materialized_view:`mat. view`,dynamic_table:`dyn. table`,streaming_table:`stream. table`};function xa(e){return ba[e]??e}function Sa({resourceType:e,materialized:t,"data-testid":n}){let r=F(),i=e===`model`&&t!=null,{icon:a}=i?Mi(t):ji(e),o=i?xa(t):e;return W(Z,{arrow:!0,title:i?`Materialization strategy`:`Type of resource`,children:G(K,{component:`span`,sx:va(r),"data-testid":n,children:[a&&W(K,{component:`span`,sx:ya,children:W(a,{"aria-hidden":`true`})}),o]})})}const Ca=L(Sa);Ca.displayName=`NodeTag`;const wa=()=>G(K,{component:`span`,sx:{display:`flex`,flexDirection:`column`,gap:`2px`,"& > span":{width:4,height:4,borderRadius:`50%`,backgroundColor:`currentColor`}},children:[W(`span`,{}),W(`span`,{}),W(`span`,{})]});function Ta({checkId:e,primaryActions:t=[],secondaryActions:n=[],onAction:r,variant:i=`combined`,size:a=`small`,menuIcon:o,className:s}){let[c,l]=H(null),u=!!c,d=e=>{e.stopPropagation(),l(e.currentTarget)},f=()=>{l(null)},p=t=>{f(),r?.(e,t)},m=e=>{let t=W(q,{variant:`outlined`,size:a,disabled:e.disabled,onClick:()=>p(e.type),startIcon:e.icon,color:e.destructive?`error`:`inherit`,children:e.label},e.type);return e.disabled&&e.disabledTooltip?W(Z,{title:e.disabledTooltip,children:W(`span`,{children:t})},e.type):t};if(i===`menu`){let e=[...t,...n];return G(K,{className:s,children:[W(X,{onClick:d,size:a,children:o||W(wa,{})}),W(gn,{anchorEl:c,open:u,onClose:f,children:e.map(e=>G(Q,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&W(K,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})}return i===`buttons`?W(K,{className:s,sx:{display:`flex`,gap:1},children:W(fn,{size:a,variant:`outlined`,children:t.map(m)})}):G(K,{className:s,sx:{display:`flex`,gap:1},children:[t.length>0&&W(fn,{size:a,variant:`outlined`,children:t.map(m)}),n.length>0&&G(U,{children:[W(X,{onClick:d,size:a,children:o||W(wa,{})}),W(gn,{anchorEl:c,open:u,onClose:f,children:n.map(e=>G(Q,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&W(K,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})]})}const Ea=L(Ta);Ea.displayName=`CheckActions`;function Da({name:e,onNameChange:t,placeholder:n=`Unnamed check`,disabled:r=!1,className:i}){let[a,o]=H(!1),[s,c]=H(e),l=V(null);z(()=>{c(e)},[e]);let u=R(()=>{r||(c(e),o(!0))},[r,e]),d=R(()=>{let n=s.trim();n&&n!==e&&t?.(n),o(!1)},[s,e,t]),f=R(t=>{t.key===`Enter`?(t.preventDefault(),d()):t.key===`Escape`&&(t.preventDefault(),c(e),o(!1))},[d,e]),p=R(e=>{c(e.target.value)},[]);return z(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&d()};return a&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[a,d]),z(()=>{a&&l.current&&(l.current.focus(),l.current.select())},[a]),W(K,{className:i,sx:{flex:`2`,fontSize:`1rem`,fontWeight:500,overflow:`hidden`,color:`text.primary`,cursor:r?`default`:`pointer`},children:a?W(wn,{inputRef:l,value:s,onChange:p,onKeyDown:f,placeholder:n,size:`small`,sx:{width:`100%`},variant:`outlined`}):W(K,{sx:{flex:`0 1 auto`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"&:hover":{textDecoration:r?`none`:`underline`}},onClick:u,children:e||W(K,{component:`span`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})})}const Oa=L(Da);Oa.displayName=`CheckBreadcrumb`;function ka(e){return{query:`Q`,query_base:`Q`,query_diff:`QD`,schema_diff:`SD`,lineage_diff:`LD`,profile:`P`,profile_diff:`PD`,row_count:`R`,row_count_diff:`RD`,value_diff:`VD`,histogram_diff:`H`,top_k_diff:`TK`,simple:`•`}[e]||`?`}function Aa(e){return{query:`#3b82f6`,query_base:`#3b82f6`,query_diff:`#8b5cf6`,schema_diff:`#06b6d4`,lineage_diff:`#10b981`,profile:`#f59e0b`,profile_diff:`#f97316`,row_count:`#ec4899`,row_count_diff:`#ef4444`,value_diff:`#6366f1`,histogram_diff:`#14b8a6`,top_k_diff:`#a855f7`,simple:`#6b7280`}[e]||`#6b7280`}function ja(e){if(!e)return`Check may be outdated`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`Check may be outdated`;if(t.getTime()>Date.now())return`Check may be outdated — last run: just now`;try{return`Check may be outdated — last run: ${En(t,{addSuffix:!0})}`}catch{return`Check may be outdated`}}const Ma={recce_ai:{label:`AI`,color:`#7c3aed`,bg:`rgb(124 58 237 / 0.12)`},user:{label:`User`,color:`#059669`,bg:`rgb(5 150 105 / 0.12)`},preset_system:{label:`Preset`,color:`#2563eb`,bg:`rgb(37 99 235 / 0.12)`}};function Na({check:e,isSelected:t=!1,onClick:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,disabled:o=!1,className:s}){let c=()=>{!o&&n&&n(e.id)},l=W(un,{checked:e.isApproved??!1,onChange:(t,n)=>{r&&r(e.id,n)},onClick:e=>{e.stopPropagation()},disabled:i||o,size:`small`,sx:{padding:`4px`,"&.Mui-disabled":{opacity:.5}}});return G(K,{className:s,onClick:c,sx:{display:`flex`,alignItems:`center`,gap:1,padding:`8px 12px`,cursor:o?`default`:`pointer`,borderLeft:t?`3px solid`:`3px solid transparent`,borderLeftColor:t?`primary.main`:`transparent`,backgroundColor:t?`action.selected`:`transparent`,opacity:o?.6:1,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:o?`transparent`:t?`action.selected`:`action.hover`}},children:[W(Yt,{label:ka(e.type),size:`small`,sx:{minWidth:32,height:24,fontSize:`0.7rem`,fontWeight:600,backgroundColor:`${Aa(e.type)}20`,color:Aa(e.type),"& .MuiChip-label":{px:1}}}),W(Y,{variant:`body2`,sx:{flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.isOutdated&&W(Z,{title:ja(e.lastRunAt),children:W(Yt,{label:`Outdated`,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:`rgb(245 158 11 / 0.12)`,color:`#b45309`,flexShrink:0,"& .MuiChip-label":{px:.75}}})}),e.actorType&&!e.isPreset&&Ma[e.actorType]&&W(Yt,{label:Ma[e.actorType].label,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:Ma[e.actorType].bg,color:Ma[e.actorType].color,flexShrink:0,"& .MuiChip-label":{px:.75}}}),e.isPreset&&W(Yt,{label:`Preset`,size:`small`,variant:`outlined`,sx:{height:20,fontSize:`0.65rem`}}),i&&a?W(Z,{title:a,children:W(`span`,{children:l})}):l]})}const Pa=L(Na);Pa.displayName=`CheckCard`;function Fa({value:e,onChange:t,placeholder:n=`Add description here`,disabled:r=!1,className:i}){let[a,o]=H(!1),[s,c]=H(e??``);z(()=>{c(e??``)},[e]);let l=R(()=>{r||(o(!0),c(e??``))},[r,e]),u=R(()=>{let e=s.trim();t?.(e||void 0),o(!1)},[s,t]),d=R(()=>{c(e??``),o(!1)},[e]),f=R(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),u()),e.key===`Escape`&&(e.preventDefault(),d())},[u,d]);return a?G(K,{className:i,sx:{height:`100%`},children:[W(wn,{multiline:!0,fullWidth:!0,minRows:3,value:s,onChange:e=>c(e.target.value),onKeyDown:f,placeholder:n,autoFocus:!0,sx:{"& .MuiInputBase-root":{fontSize:`0.875rem`}}}),G(J,{direction:`row`,spacing:1,sx:{mt:1},children:[W(q,{variant:`contained`,size:`small`,onClick:u,children:`Update`}),W(pt,{component:`button`,variant:`body2`,onClick:d,sx:{cursor:`pointer`},children:`Cancel`})]}),G(Y,{variant:`caption`,sx:{color:`text.secondary`,display:`block`,mt:.5},children:[navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`,`+Enter to save, Escape to cancel`]})]}):W(K,{className:i,onClick:l,sx:{height:`100%`,overflow:`auto`,cursor:r?`default`:`pointer`,padding:1,borderRadius:1,"&:hover":{backgroundColor:r?`transparent`:`action.hover`}},children:e?W(Y,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e}):W(Y,{variant:`body2`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})}const Ia=L(Fa);Ia.displayName=`CheckDescription`;function La({checkId:e,name:t,type:n,description:r,isApproved:i=!1,tabs:a=[],defaultTab:o,primaryActions:s=[],secondaryActions:c=[],onAction:l,onDescriptionChange:u,onNameChange:d,disabled:f=!1,headerContent:p,sidebarContent:m,className:h}){let[g,_]=H(o??a[0]?.id),[v,y]=H(!1),[b,x]=H(t),S=()=>{f||(y(!0),x(t))},C=()=>{b.trim()&&b!==t&&d?.(b.trim()),y(!1)},w=e=>{e.key===`Enter`?C():e.key===`Escape`&&(x(t),y(!1))},T=a.find(e=>e.id===g)?.content;return G(K,{className:h,sx:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[G(K,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[p,G(K,{sx:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2},children:[G(K,{sx:{flexGrow:1,minWidth:0},children:[v?W(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),onBlur:C,onKeyDown:w,autoFocus:!0,style:{fontSize:`1.25rem`,fontWeight:500,border:`none`,borderBottom:`2px solid`,borderColor:`currentColor`,outline:`none`,background:`transparent`,width:`100%`}}):W(Y,{variant:`h6`,onClick:S,sx:{cursor:f?`default`:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,"&:hover":{textDecoration:f?`none`:`underline`}},children:t}),G(Y,{variant:`caption`,sx:{color:`text.secondary`},children:[n,` `,i&&`• Approved`]})]}),W(Ea,{checkId:e,primaryActions:s,secondaryActions:c,onAction:l})]})]}),G(K,{sx:{display:`flex`,flexGrow:1,overflow:`hidden`},children:[G(K,{sx:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[G(K,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[W(Y,{variant:`subtitle2`,sx:{mb:1},children:`Description`}),W(Ia,{value:r,onChange:u,disabled:f})]}),a.length>0&&G(U,{children:[W(K,{sx:{borderBottom:1,borderColor:`divider`},children:W(On,{value:g,onChange:(e,t)=>_(t),children:a.map(e=>W(Dn,{value:e.id,label:e.label},e.id))})}),W(K,{sx:{flexGrow:1,overflow:`auto`,p:2},children:T})]})]}),m&&G(U,{children:[W(Tt,{orientation:`vertical`,flexItem:!0}),W(K,{sx:{width:350,flexShrink:0,overflow:`auto`},children:m})]})]})]})}const Ra=L(La);Ra.displayName=`CheckDetail`;function za({title:e=`No checks yet`,description:t=`Create your first check to start validating data changes`,icon:n,actionText:r,onAction:i,isLoading:a=!1,helperText:o,className:s}){return W(K,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,padding:4,minHeight:300},children:G(J,{spacing:2,sx:{alignItems:`center`},children:[n&&W(K,{sx:{color:`text.secondary`,fontSize:48,mb:1},children:n}),W(Y,{variant:`h6`,sx:{fontWeight:500,color:`text.primary`},children:e}),W(Y,{variant:`body2`,sx:{color:`text.secondary`,maxWidth:400},children:t}),r&&i&&W(q,{variant:`contained`,onClick:i,disabled:a,sx:{mt:2},children:a?`Creating...`:r}),o&&W(Y,{variant:`caption`,sx:{color:`text.secondary`,mt:1},children:o})]})})}const Ba=L(za);Ba.displayName=`CheckEmptyState`;function Va({checks:e,selectedId:t,onCheckSelect:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,title:o,className:s,isLoading:c=!1,emptyContent:l}){return c?W(K,{className:s,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:W(Y,{sx:{color:`text.secondary`},children:`Loading checks...`})}):e.length===0?G(K,{className:s,children:[o&&W(Y,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),l||W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:W(Y,{sx:{color:`text.secondary`},children:`No checks`})})]}):G(K,{className:s,sx:{height:`100%`,overflow:`auto`},children:[o&&W(Y,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),W(kn,{disablePadding:!0,children:e.map(e=>W(An,{disablePadding:!0,children:W(Pa,{check:e,isSelected:t===e.id,onClick:n,onApprovalChange:r,disableApproval:i,disabledApprovalTooltip:a})},e.id))})]})}const Ha=L(Va);Ha.displayName=`CheckList`;const Ua={lineageNode:_a,lineageGraphColumnNode:Ki},Wa={lineageEdge:Ji};function Ga({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,showMiniMap:i=!0,showControls:a=!0,showBackground:o=!0,height:s=600,interactive:c=!0,minZoom:l,maxZoom:u,fitViewOptions:d}){let[f,p,m]=cn(e),[h,g,_]=sn(t),v=R((e,t)=>{n?.(t.id)},[n]),y=R(()=>{n?.(null)},[n]),b=R((e,t)=>{r?.(t.id)},[r]);return W(K,{sx:{width:`100%`,height:s},children:G(rn,{nodes:f,edges:h,onNodesChange:c?m:void 0,onEdgesChange:c?_:void 0,onNodeClick:v,onNodeDoubleClick:b,onPaneClick:y,nodeTypes:Ua,edgeTypes:Wa,fitView:!0,fitViewOptions:d,minZoom:l,maxZoom:u,nodesDraggable:c,nodesConnectable:!1,elementsSelectable:c,children:[o&&W(Xt,{}),a&&W(Qt,{}),i&&W(tn,{nodeColor:e=>Ii[e.data.changeStatus??`unchanged`]})]})})}const Ka=at(function(e,t){let{lineageGraph:n,viewOptions:r,interactive:i=!0,height:a=600,filterNodes:o,onNodeSelect:s,onNodeDoubleClick:c,dagre:l,showMiniMap:u=!0,showControls:d=!0,showBackground:f=!0}=e,p=V(null),m=j(),h=n??m.lineageGraph,g=!n&&m.isLoading,_=n?void 0:m.error,{nodes:v,edges:y}=B(()=>{if(!h)return{nodes:[],edges:[]};let e;if(r?.node_ids&&r.node_ids.length>0?e=r.node_ids:r?.view_mode===`changed_models`&&(e=h.modifiedSet),r?.select&&e&&r.select.includes(`+`)){let t=de(h,e),n=ue(h,e);e=[...new Set([...t,...n])]}if(r?.packages&&r.packages.length>0){let t=new Set(r.packages);e=(e??Object.keys(h.nodes)).filter(e=>{let n=h.nodes[e];return n?.data.packageName&&t.has(n.data.packageName)})}o&&(e=(e??Object.keys(h.nodes)).filter(e=>{let t=h.nodes[e];return t?o(e,t):!1}));let[t,n]=M(h,e);return l&&t.length>0&&qa(l,t,n),{nodes:t.map(e=>({id:e.id,position:e.position,type:`lineageNode`,data:{label:e.data.name,nodeType:e.data.resourceType,changeStatus:e.data.changeStatus,resourceType:e.data.resourceType,packageName:e.data.packageName}})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,type:`lineageEdge`,data:{changeStatus:e.data?.changeStatus}}))}},[h,r,o,l]),b=R(async()=>{if(p.current)try{let e=await Mn(p.current,{backgroundColor:`#ffffff`,pixelRatio:2}),t=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[t.type]:t})])}catch(e){throw console.error(`Failed to copy to clipboard:`,e),e}},[]);return ct(t,()=>({copyToClipboard:b}),[b]),g?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Et,{})}):_?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{color:`error`,children:_})}):h?v.length===0?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{sx:{color:`text.secondary`},children:`No nodes match the current filter criteria.`})}):W(K,{ref:p,sx:{width:`100%`,height:a},children:W(Ga,{nodes:v,edges:y,onNodeSelect:s,onNodeDoubleClick:c,showMiniMap:u,showControls:d,showBackground:f,height:`100%`,interactive:i})}):W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{sx:{color:`text.secondary`},children:`No lineage data available. Provide data via LineageGraphProvider or lineageGraph prop.`})})});function qa(e,t,n,r=`LR`){let i=new e.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:r,ranksep:50,nodesep:30});for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60;i.setNode(e.id,{width:t,height:n})}for(let e of n)i.setEdge(e.source,e.target);e.layout(i);for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60,r=i.node(e.id);r&&(e.position={x:r.x-t/2,y:r.y-n/2})}}function Ja({params:e,viewOptions:t,interactive:n=!1,height:r,dagre:i},a){let o={...t,...e};return W(K,{sx:{display:`flex`,flexDirection:`column`,height:r??`100%`},children:W(an,{children:W(Ka,{viewOptions:o,interactive:n,ref:a,dagre:i})})})}const Ya=at(Ja);Ya.displayName=`LineageDiffView`;function Xa(e){switch(e){case`sql`:return Fn({dialect:Pn});case`yaml`:return In();default:return null}}function Za({value:e,onChange:t,language:n=`sql`,readOnly:r=!1,lineNumbers:i=!0,wordWrap:a=!0,fontSize:o=14,height:s=`100%`,className:c=``,theme:l=`light`,keyBindings:u=[]}){let d=B(()=>{let e=[zn.theme({"&":{fontSize:`${o}px`},".cm-content":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`},".cm-gutters":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`}})],t=Xa(n);return t&&e.push(t),a&&e.push(zn.lineWrapping),u.length>0&&e.push(Rn.highest(Bn.of(u))),e},[n,o,a,u]),f=B(()=>l===`dark`?Hn:Un,[l]);return W(Wn,{value:e,onChange:e=>{t&&t(e)},extensions:d,readOnly:r,basicSetup:{lineNumbers:i,foldGutter:!0,highlightActiveLineGutter:!r,highlightActiveLine:!r,tabSize:2},height:s,className:`${c} no-track-pii-safe`,theme:f})}function Qa({name:e,description:t,type:n,params:r,viewOptions:i}){let a={name:e,description:t,type:n,params:r};return i&&(a.view_options=i),Nn.stringify({checks:[a]})}function $a({yamlTemplate:e,height:t=`300px`}){return W(Za,{value:e,language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,theme:F()?`dark`:`light`,height:t})}const eo=L($a);eo.displayName=`PresetCheckTemplateView`;const to={apiPrefix:``,authToken:void 0,baseUrl:void 0,apiClient:ne({baseURL:Ge??``})};function no(){return D()??to}function ro({userId:e,enabled:t=!0}){let{apiClient:n}=no(),r=e?.toString(),{data:i,isLoading:a}=tt({queryKey:O.user(),queryFn:()=>We(n),enabled:t&&!!r,retry:!1,staleTime:300*1e3}),o=!!(i&&r&&i.id===r)&&i?.login_type===`github`,s=!!(t&&o&&r),{data:c,isLoading:l}=tt({queryKey:[`github-avatar`,r],queryFn:()=>r?Ue(r):Promise.resolve(null),enabled:s,retry:!1,staleTime:300*1e3});return{avatarUrl:typeof c==`string`?c:null,isLoading:a||s&&l,isGitHubUser:!!o}}function io({onSubmit:e,isSubmitting:t=!1,placeholder:n=`Add a comment...`,submitLabel:r=`Comment`,submittingLabel:i=`Submitting...`,className:a}){let o=F(),[s,c]=H(``),l=R(()=>{let t=s.trim();t&&(e(t),c(``))},[s,e]),u=R(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())},[l]);return G(K,{className:a,children:[W(wn,{value:s,onChange:R(e=>{c(e.target.value)},[]),onKeyDown:u,placeholder:n,size:`small`,multiline:!0,fullWidth:!0,minRows:3,disabled:t,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.500`:`grey.400`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`iochmara.400`,boxShadow:`0 0 0 1px #4299E1`}},"& .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.600`:void 0}}}),W(J,{direction:`row`,sx:{justifyContent:`flex-end`,mt:2},children:W(q,{size:`small`,color:`iochmara`,variant:`contained`,onClick:l,disabled:!s.trim()||t,children:t?i:r})})]})}const ao=L(io);ao.displayName=`CommentInput`;function oo(e){switch(e.event_type){case`check_created`:return`create`;case`comment`:return`comment`;case`approval_change`:return e.new_value===`true`?`approve`:`unapprove`;case`description_change`:case`name_change`:return`edit`;case`preset_applied`:return`preset`;default:return`edit`}}function so({event:e}){let t=oo(e),n={create:Ut,comment:jt,approve:Nt,unapprove:Pt,edit:Vt,preset:kt},r={create:`primary.main`,comment:`grey.500`,approve:`success.main`,unapprove:`grey.400`,edit:`warning.main`,preset:`secondary.main`},i=n[t],a=r[t];return W(K,{component:i,sx:{color:a,fontSize:16}})}function co({actor:e}){let t=(e.fullname||e.login||`User`).charAt(0).toUpperCase();return W(Gn,{src:e.avatarUrl||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:t})}function lo({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=En(new Date(e.created_at),{addSuffix:!0}),i=``;switch(e.event_type){case`check_created`:i=`created this check`;break;case`approval_change`:i=e.new_value===`true`?`approved this check`:`unapproved this check`;break;case`description_change`:i=`updated the description`;break;case`name_change`:i=`renamed this check`;break;case`preset_applied`:i=`applied a preset`;break;default:i=`made a change`}return G(K,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[W(K,{sx:{pt:`2px`},children:W(so,{event:e})}),W(K,{sx:{flex:1},children:G(J,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[W(co,{actor:t}),W(Y,{variant:`body2`,sx:{fontWeight:`500`},children:n}),W(Y,{variant:`body2`,sx:{color:`text.secondary`},children:i}),W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:r})]})})]})}const uo=L(lo);uo.displayName=`StateChangeEvent`;function fo({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i}){let a=F(),[o,s]=H(!1),[c,l]=H(e.content||``),[u,d]=H(!1),[f,p]=H(!1),[m,h]=H(null),g=!!m,{actor:_}=e,v=_.fullname||_.login||`Someone`,y=En(new Date(e.created_at),{addSuffix:!0}),b=t&&String(_.user_id)===String(t),x=R(()=>{l(e.content||``),s(!0)},[e.content]),S=R(()=>{l(e.content||``),s(!1)},[e.content]),C=R(async()=>{let t=c.trim();if(!t||t===e.content){S();return}if(n){d(!0);try{await n(e.id,t),s(!1)}finally{d(!1)}}},[c,e.content,e.id,n,S]),w=R(e=>{e.key===`Escape`?S():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},[S,C]),T=R(e=>{h(e.currentTarget)},[]),E=R(()=>{h(null)},[]),ee=R(async()=>{if(r){p(!0);try{await r(e.id),E()}finally{p(!1)}}},[r,e.id,E]),D=R(e=>{l(e.target.value)},[]);return e.is_deleted?G(K,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[W(K,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:W(so,{event:e})}),W(K,{sx:{display:`flex`,flex:1,alignItems:`center`},children:W(Y,{variant:`body2`,sx:{color:`text.disabled`,fontStyle:`italic`},children:`Comment deleted`})})]}):G(K,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[W(K,{sx:{pt:`2px`},children:W(so,{event:e})}),G(K,{sx:{flex:1},children:[G(J,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[W(co,{actor:_}),G(Y,{variant:`body2`,sx:{fontWeight:`500`},children:[v,b&&G(Y,{component:`span`,variant:`body2`,sx:{color:`text.secondary`},children:[` `,`(Author)`]})]}),W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:y}),e.is_edited&&W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:`(edited)`})]}),o?G(K,{children:[W(wn,{value:c,onChange:D,onKeyDown:w,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:u,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),G(J,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`,mt:1},children:[W(q,{size:`small`,variant:`text`,onClick:S,disabled:u,children:`Cancel`}),W(q,{size:`small`,variant:`contained`,onClick:C,disabled:!c.trim()||u,children:u?`Saving...`:`Save`})]})]}):G(K,{sx:{bgcolor:a?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:a?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[i?W(i,{content:e.content||``}):W(Y,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:e.content}),b&&(n||r)&&G(J,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&W(Z,{title:`Edit comment`,children:W(X,{"aria-label":`Edit comment`,size:`small`,onClick:x,children:W(Ht,{})})}),r&&G(U,{children:[W(Z,{title:`Delete comment`,children:W(X,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:T,children:W(Kt,{})})}),W(Kn,{open:g,anchorEl:m,onClose:E,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:G(K,{sx:{p:2},children:[W(Y,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),G(J,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[W(q,{size:`small`,variant:`text`,onClick:E,disabled:f,children:`Cancel`}),W(q,{size:`small`,variant:`contained`,color:`error`,onClick:ee,disabled:f,children:f?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}const po=L(fo);po.displayName=`CommentEvent`;function mo({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i,className:a}){return e.event_type===`comment`?W(K,{className:a,children:W(po,{event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i})}):W(K,{className:a,children:W(uo,{event:e})})}const ho=L(mo);ho.displayName=`TimelineEvent`;function go({name:e,isChecked:t}){return`${t?`✅ `:``}${e}`}function _o({description:e,fallback:t=`_(no description)_`}){return(e??``)||t}function vo({type:e,hasResult:t,hasError:n}){return e===`schema_diff`||e===`lineage_diff`?!1:!t||n}function yo({sql:e,label:t=`SQL`}){return`**${t}**
2
+ import{C as e,F as t,H as n,J as r,P as i,Q as a,S as o,T as s,U as c,X as l,Z as u,_t as d,at as f,ct as p,et as m,f as h,gt as g,h as _,it as v,lt as y,mt as b,nt as x,ot as S,q as C,st as w,ut as T,vt as E,x as ee}from"./api-BqrSvFO2.js";import{d as D,f as O,l as k,s as te}from"./keepAlive-DbC0X4zr.js";import{n as ne,r as re}from"./fetchClient-BVyYwVMf.js";import{C as A,O as ie,_ as j,b as ae,c as M,g as oe,j as se,k as N,m as ce,n as le,o as ue,s as de,u as fe,v as pe,w as me}from"./utils-COgjW7er.js";import{_ as he,g as ge,t as _e}from"./theme-CB8KNGMx.js";import{n as P}from"./colors-BbPSDR1X.js";import{At as ve,Dt as ye,Et as be,Lt as xe,Mt as Se,Nt as Ce,Ot as we,Pt as F,Q as Te,S as Ee,St as De,Tt as Oe,b as ke,c as Ae,ct as je,dt as I,i as Me,jt as Ne,kt as Pe,l as Fe,nt as Ie,pt as Le,r as Re,rt as ze,s as Be,wt as Ve,y as He}from"./utils-Cpt1f5aU.js";import{fetchGitHubAvatar as Ue,fetchUser as We}from"./lib/api/user.js";import{PUBLIC_API_URL as Ge,RECCE_SUPPORT_CALENDAR_URL as Ke}from"./lib/const.js";import{EXPLORE_FORM_EVENT as qe,isExploreAction as Je,trackCopyToClipboard as Ye,trackExploreActionForm as Xe,trackHistoryAction as Ze,trackSingleEnvironment as Qe}from"./lib/api/track.js";import $e from"./lib/result/ResultErrorFallback.js";import{useMutation as et,useQuery as tt,useQueryClient as nt}from"@tanstack/react-query";import{Fragment as rt,createContext as it,forwardRef as at,memo as L,useCallback as R,useContext as ot,useEffect as z,useId as st,useImperativeHandle as ct,useMemo as B,useRef as V,useState as H}from"react";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"@mui/material/Box";import q from"@mui/material/Button";import lt from"@mui/material/Dialog";import ut from"@mui/material/DialogActions";import dt from"@mui/material/DialogContent";import ft from"@mui/material/DialogTitle";import pt from"@mui/material/Link";import J from"@mui/material/Stack";import Y from"@mui/material/Typography";import{LuChartBarBig as mt,LuExternalLink as ht}from"react-icons/lu";import gt from"@mui/material/CssBaseline";import{ThemeProvider as _t,alpha as vt,useTheme as yt}from"@mui/material/styles";import{useTheme as bt}from"next-themes";import{AllCommunityModule as xt,ModuleRegistry as St}from"ag-grid-community";import X from"@mui/material/IconButton";import Ct from"next/link";import{IoClose as wt}from"react-icons/io5";import Tt from"@mui/material/Divider";import Et from"@mui/material/CircularProgress";import Z from"@mui/material/Tooltip";import{FaCheckCircle as Dt,FaRegCheckCircle as Ot}from"react-icons/fa";import{PiBookmarkSimple as kt,PiCaretDown as At,PiChatText as jt,PiCheck as Mt,PiCheckCircle as Nt,PiCircle as Pt,PiClipboardText as Ft,PiCopy as It,PiDotsThreeVertical as Lt,PiDownloadSimple as Rt,PiImage as zt,PiInfo as Bt,PiNotePencil as Vt,PiPencilSimple as Ht,PiPlusCircle as Ut,PiRepeat as Wt,PiTable as Gt,PiTrashSimple as Kt,PiWarning as qt,PiX as Jt}from"react-icons/pi";import Yt from"@mui/material/Chip";import{Background as Xt,BaseEdge as Zt,Controls as Qt,EdgeLabelRenderer as $t,Handle as en,MiniMap as tn,Position as nn,ReactFlow as rn,ReactFlowProvider as an,getBezierPath as on,useEdgesState as sn,useNodesState as cn}from"@xyflow/react";import ln from"file-saver";import un from"@mui/material/Checkbox";import dn from"@mui/material/FormControlLabel";import fn from"@mui/material/ButtonGroup";import{useTimeout as pn}from"usehooks-ts";import mn from"@mui/material/Alert";import hn from"@mui/material/InputBase";import gn from"@mui/material/Menu";import Q from"@mui/material/MenuItem";import _n from"lodash";import{VscKebabVertical as vn,VscKey as yn}from"react-icons/vsc";import bn from"@mui/material/ListSubheader";import xn from"@mui/material/FormControl";import Sn from"@mui/material/FormLabel";import Cn from"@mui/material/NativeSelect";import wn from"@mui/material/TextField";import{format as Tn,formatDistanceToNow as En}from"date-fns";import Dn from"@mui/material/Tab";import On from"@mui/material/Tabs";import kn from"@mui/material/List";import An from"@mui/material/ListItem";import{toCanvas as jn,toPng as Mn}from"html-to-image";import"@xyflow/react/dist/style.css";import Nn from"yaml";import{PostgreSQL as Pn,sql as Fn}from"@codemirror/lang-sql";import{yaml as In}from"@codemirror/lang-yaml";import{EditorState as Ln,Prec as Rn}from"@codemirror/state";import{EditorView as zn,keymap as Bn,lineNumbers as Vn}from"@codemirror/view";import{githubDark as Hn,githubLight as Un}from"@uiw/codemirror-theme-github";import Wn from"@uiw/react-codemirror";import Gn from"@mui/material/Avatar";import Kn from"@mui/material/Popover";import qn from"@mui/material/LinearProgress";import{BarElement as Jn,CategoryScale as Yn,Chart as Xn,Legend as Zn,LinearScale as Qn,TimeSeriesScale as $n,Title as er,Tooltip as tr}from"chart.js";import{Bar as nr,Chart as rr}from"react-chartjs-2";import{AgGridReact as ir}from"ag-grid-react";import{MergeView as ar,unifiedMergeView as or}from"@codemirror/merge";import sr from"react-markdown";import{Prism as cr}from"react-syntax-highlighter";import{oneDark as lr}from"react-syntax-highlighter/dist/esm/styles/prism";import ur from"remark-gfm";import dr from"react-split";import{amber as fr}from"@mui/material/colors";import{usePathname as pr,useRouter as mr}from"next/navigation";import{MdFormatListNumberedRtl as hr,MdSchema as gr}from"react-icons/md";import{TbAlignBoxLeftStretch as _r,TbBrandStackshare as vr,TbChartHistogram as yr,TbEyeEdit as br,TbEyeSearch as xr,TbSql as Sr}from"react-icons/tb";import Cr from"@mui/material/Autocomplete";import wr from"@mui/material/DialogContentText";import Tr from"@mui/material/ListItemIcon";import Er from"@mui/material/ListItemText";import{FiInfo as Dr}from"react-icons/fi";import{FaPlay as Or}from"react-icons/fa6";import{ErrorBoundary as kr}from"@sentry/react";function Ar({children:e,forcedTheme:t,enableCssBaseline:n=!1}){let{resolvedTheme:r}=bt();return z(()=>{(t??r)===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[t,r]),G(_t,{theme:_e,children:[n&&W(gt,{}),e]})}const jr=it({checks:[],isLoading:!1});jr.displayName=`RecceCheckContext`;function Mr({children:e,checks:t=[],isLoading:n=!1,error:r,selectedCheckId:i,onSelectCheck:a,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:d,setLatestSelectedCheckId:f}){let p=i??d,m=a??f,h=B(()=>({checks:t,isLoading:n,error:r,selectedCheckId:p,onSelectCheck:m,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:p,setLatestSelectedCheckId:m}),[t,n,r,p,m,o,s,c,l,u]);return W(jr.Provider,{value:h,children:e})}function Nr(){return ot(jr)}const Pr=it({sql:``,isExecuting:!1});Pr.displayName=`RecceQueryContext`;function Fr({children:e,sql:t=``,isExecuting:n=!1,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}){let _=B(()=>({sql:t,isExecuting:n,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}),[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]);return W(Pr.Provider,{value:_,children:e})}function Ir(){return ot(Pr)}function Lr({children:e}){let[t,n]=H(``);return W(Mr,{selectedCheckId:t,onSelectCheck:n,latestSelectedCheckId:t,setLatestSelectedCheckId:n,children:e})}const Rr=()=>{};function zr(){let e=Nr();return{latestSelectedCheckId:e.latestSelectedCheckId??``,setLatestSelectedCheckId:e.setLatestSelectedCheckId??Rr}}const Br={INTEGER:`integer`,INT:`integer`,BIGINT:`integer`,SMALLINT:`integer`,TINYINT:`integer`,INT64:`integer`,INT32:`integer`,INT16:`integer`,INT8:`integer`,INT4:`integer`,INT2:`integer`,MEDIUMINT:`integer`,SERIAL:`integer`,BIGSERIAL:`integer`,SMALLSERIAL:`integer`,DOUBLE:`number`,FLOAT:`number`,REAL:`number`,NUMERIC:`number`,DECIMAL:`number`,NUMBER:`number`,FLOAT64:`number`,FLOAT32:`number`,"DOUBLE PRECISION":`number`,VARCHAR:`text`,TEXT:`text`,STRING:`text`,CHAR:`text`,"CHARACTER VARYING":`text`,CHARACTER:`text`,NCHAR:`text`,NVARCHAR:`text`,VARCHAR2:`text`,NVARCHAR2:`text`,CLOB:`text`,NCLOB:`text`,TINYTEXT:`text`,MEDIUMTEXT:`text`,LONGTEXT:`text`,BOOLEAN:`boolean`,BOOL:`boolean`,DATE:`date`,TIMESTAMP:`datetime`,DATETIME:`datetime`,TIMESTAMP_NTZ:`datetime`,TIMESTAMP_LTZ:`datetime`,TIMESTAMP_TZ:`datetime`,TIMESTAMPTZ:`datetime`,"TIMESTAMP WITH TIME ZONE":`datetime`,"TIMESTAMP WITHOUT TIME ZONE":`datetime`,"TIMESTAMP WITH LOCAL TIME ZONE":`datetime`,DATETIME2:`datetime`,SMALLDATETIME:`datetime`,DATETIMEOFFSET:`datetime`,TIME:`time`,TIMETZ:`time`,"TIME WITH TIME ZONE":`time`,"TIME WITHOUT TIME ZONE":`time`,BINARY:`binary`,VARBINARY:`binary`,BYTES:`binary`,BLOB:`binary`,BYTEA:`binary`,TINYBLOB:`binary`,MEDIUMBLOB:`binary`,LONGBLOB:`binary`,JSON:`json`,JSONB:`json`,VARIANT:`json`,OBJECT:`json`,STRUCT:`json`,MAP:`json`,ARRAY:`array`,LIST:`array`,GEOGRAPHY:`geography`,GEOMETRY:`geography`,POINT:`geography`,LINESTRING:`geography`,POLYGON:`geography`,MULTIPOINT:`geography`,MULTILINESTRING:`geography`,MULTIPOLYGON:`geography`,GEOMETRYCOLLECTION:`geography`,SDO_GEOMETRY:`geography`};function Vr(e){let t=e.trim().toUpperCase();if(!t)return`unknown`;if(/^TINYINT\s*\(\s*1\s*\)$/.test(t))return`boolean`;let n=t.indexOf(`(`);return Br[n===-1?t:t.slice(0,n).trimEnd()]??`unknown`}const Hr=.6,Ur=18/30;function Wr({size:e=`1em`,style:t,className:n,children:r}){return G(`svg`,{viewBox:`0 0 30 18`,width:e,height:typeof e==`number`?e*Ur:`${Ur}em`,style:t,className:n,"aria-hidden":`true`,children:[W(`rect`,{x:Hr,y:Hr,width:30-Hr*2,height:18-Hr*2,rx:3,fill:`none`,stroke:`currentColor`,strokeWidth:1.2}),r]})}function Gr({text:e,size:t,style:n,className:r}){return W(Wr,{size:t,style:n,className:r,children:W(`text`,{x:30/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10.5,fontFamily:`monospace`,fontWeight:500,fill:`currentColor`,children:e})})}function Kr(e){return W(Gr,{text:`123`,...e})}function qr(e){return W(Gr,{text:`1.2`,...e})}function Jr(e){return W(Gr,{text:`abc`,...e})}function Yr(e){return W(Gr,{text:`T/F`,...e})}function Xr({size:e,style:t,className:n}){let r=st(),i=Hr,a=Hr,o=18-Hr*2;return G(Wr,{size:e,style:t,className:n,children:[G(`mask`,{id:r,children:[W(`rect`,{x:i,y:a,width:15-i,height:o,fill:`white`}),W(`text`,{x:15/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10,fontFamily:`monospace`,fontWeight:700,fill:`black`,children:`0`})]}),W(`path`,{d:`M15 ${a} H${i+3} Q${i} ${a} ${i} ${a+3} V${a+o-3} Q${i} ${a+o} ${i+3} ${a+o} H15 Z`,fill:`currentColor`,mask:`url(#${r})`}),W(`text`,{x:22.5,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:10,fontFamily:`monospace`,fontWeight:700,fill:`currentColor`,children:`1`})]})}function Zr(e){return W(Gr,{text:`{ }`,...e})}function Qr({size:e,style:t,className:n}){return G(Wr,{size:e,style:t,className:n,children:[G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.2,strokeLinecap:`round`,children:[W(`line`,{x1:6,y1:5,x2:4,y2:5}),W(`line`,{x1:4,y1:5,x2:4,y2:13}),W(`line`,{x1:4,y1:13,x2:6,y2:13}),W(`line`,{x1:24,y1:5,x2:26,y2:5}),W(`line`,{x1:26,y1:5,x2:26,y2:13}),W(`line`,{x1:26,y1:13,x2:24,y2:13})]}),W(`text`,{x:30/2,y:18/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:9,fontFamily:`monospace`,fontWeight:500,fill:`currentColor`,children:`1,2`})]})}function $r(e){return W(Gr,{text:`···`,...e})}function ei({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(9, 2.5)`,children:[W(`rect`,{x:0,y:2,width:11,height:9.5,rx:1.2}),W(`line`,{x1:3,y1:.5,x2:3,y2:3.5}),W(`line`,{x1:8,y1:.5,x2:8,y2:3.5}),W(`line`,{x1:0,y1:5.5,x2:11,y2:5.5})]})})}function ti({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(4, 2.5)`,children:[W(`rect`,{x:0,y:2,width:9.5,height:8.5,rx:1.2}),W(`line`,{x1:2.5,y1:.5,x2:2.5,y2:3.5}),W(`line`,{x1:7,y1:.5,x2:7,y2:3.5}),W(`line`,{x1:0,y1:5,x2:9.5,y2:5}),W(`circle`,{cx:17,cy:8.5,r:3.2}),W(`line`,{x1:17,y1:6.8,x2:17,y2:8.5}),W(`line`,{x1:17,y1:8.5,x2:18.3,y2:9.5})]})})}function ni({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`translate(10, 3.5)`,children:[W(`circle`,{cx:5,cy:5.5,r:5}),W(`line`,{x1:5,y1:3,x2:5,y2:5.5}),W(`line`,{x1:5,y1:5.5,x2:7,y2:6.8})]})})}function ri({size:e,style:t,className:n}){return W(Wr,{size:e,style:t,className:n,children:G(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1,strokeLinecap:`round`,strokeLinejoin:`round`,children:[W(`path`,{d:`M15 14.5 C15 14.5 10.5 11 10.5 8 A4.5 4.5 0 0 1 19.5 8 C19.5 11 15 14.5 15 14.5 Z`,strokeWidth:1.2}),W(`circle`,{cx:15,cy:8,r:1.5,fill:`currentColor`,stroke:`none`})]})})}function ii(e){let{name:t,status:n,baseType:r,currentType:i,cllAvailable:a}=e,o;switch(n){case`added`:o=i?`${t} added ${i}`:`${t} added`;break;case`removed`:return`deleted ${t}`;case`type_changed`:o=`${t}, was ${r} now ${i}`;break;case`definition_changed`:o=i?`${t} ${i} changed definition`:`${t} changed definition`;break;case`unchanged`:o=i?`${t} ${i}`:t;break;default:o=r&&i&&r!==i?`${t}, was ${r} now ${i}`:i?`${t} ${i}`:t;break}return a&&(o+=` · Click for column lineage`),o}const ai={integer:Kr,number:qr,text:Jr,boolean:Yr,date:ei,datetime:ti,time:ni,binary:Xr,json:Zr,array:Qr,geography:ri,unknown:$r};function oi({type:e,size:t,style:n,className:r,disableTooltip:i}){let a=ai[Vr(e)],o=W(`span`,{"data-testid":`data-type-icon`,style:{display:`inline-flex`,alignItems:`center`,lineHeight:0},children:W(a,{size:t,style:n,className:r})});return i?o:W(Z,{title:e,placement:`top`,arrow:!0,children:o})}const si=.35,ci=.1,li=.15,ui=`opacity(0.4) grayscale(40%)`,di=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm6.5 2.5v2.5h2.5v1H8.5v2.5h-1V8H5V7h2.5V4.5h1z`})}),fi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm3 5.5h6v1H5v-1z`})}),pi=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`path`,{d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),W(`path`,{d:`M10.6 8.7c-.1.1-.3.2-.5.2h-.1l-1.4-.3c-.5-.1-1.1-.3-1.8-.3-.6 0-1 .2-1.3.5-.2.2-.2.4-.2.7v.1l-.9.3v-.2c0-.3 0-.6.1-.9.2-.4.5-.8 1-1.1.5-.4 1.2-.5 2-.5h.2l1.5.4h.1c.5.1 1 .3 1.5.3.6 0 .9-.2 1.2-.4.2-.2.3-.5.3-.8v-.3l.8-.3h.1v.3c0 .6-.2 1.2-.6 1.6-.2.2-.3.4-.5.5l-.5.2z`})]}),mi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`})}),hi=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),W(`path`,{d:`M7.5 4h1v5h-1V4zm0 6h1v1.5h-1V10z`})]}),gi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),_i=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z`})}),vi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z`})}),yi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z`})}),bi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V80zM0 272c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v160c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272zM368 96h32c26.5 0 48 21.5 48 48v288c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48z`})}),xi=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm320 96c0-15.9-5.8-30.4-15.3-41.6l76.6-147.4c6.1-11.8 1.5-26.3-10.2-32.4s-26.2-1.5-32.4 10.2L262.1 288.3c-2-.2-4-.3-6.1-.3c-35.3 0-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64z`})}),Si=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z`})}),Ci=e=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M256 128C141.4 128 37.5 193.3 1.6 246.1c-2.1 3.2-2.1 7.5 0 10.7C37.5 309.7 141.4 384 256 384s218.5-74.3 254.4-127.2c2.1-3.2 2.1-7.5 0-10.7C474.5 193.3 370.6 128 256 128zm0 208c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96zm0-144c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`})}),wi=e=>{let t=st(),n=`inc-bottom-${t}`,r=`inc-top-${t}`;return G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[G(`defs`,{children:[W(`clipPath`,{id:n,children:W(`rect`,{x:`0`,y:`200`,width:`512`,height:`312`})}),W(`clipPath`,{id:r,children:W(`rect`,{x:`0`,y:`0`,width:`512`,height:`200`})})]}),W(`path`,{clipPath:`url(#${n})`,d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`}),W(`path`,{clipPath:`url(#${r})`,d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`,fill:`none`,stroke:`currentColor`,strokeWidth:`12`,strokeDasharray:`20 12`})]})},Ti=e=>W(`svg`,{stroke:`currentColor`,fill:`none`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`,fill:`none`,stroke:`currentColor`,strokeWidth:`12`,strokeDasharray:`20 12`})}),Ei=e=>G(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[W(`g`,{transform:`translate(0, 0) scale(0.75)`,children:W(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),W(`g`,{transform:`translate(250, 260) scale(0.5)`,children:W(`path`,{d:`M256 128C141.4 128 37.5 193.3 1.6 246.1c-2.1 3.2-2.1 7.5 0 10.7C37.5 309.7 141.4 384 256 384s218.5-74.3 254.4-127.2c2.1-3.2 2.1-7.5 0-10.7C474.5 193.3 370.6 128 256 128zm0 208c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96zm0-144c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`})})]}),Di={added:di,removed:fi,modified:pi,impacted:hi};function Oi(e,t){return e===`cll`?{colors:Ii,bg:t?Ri:Li}:{colors:Ni,bg:t?Fi:Pi}}function ki(e,t,n=`default`){let r=e??`unchanged`,{colors:i,bg:a}=Oi(n,t),o=i[r],s=a[r];return{color:o,hexColor:o,backgroundColor:s,hexBackgroundColor:s,icon:Di[r]}}function Ai(e){return ki(`impacted`,e,`cll`)}function ji(e){switch(e){case`model`:return{color:P.cyan[200],icon:gi};case`source`:return{color:P.green[300],icon:_i};case`seed`:return{color:P.green[500],icon:vi};case`snapshot`:return{color:P.green[500],icon:yi};case`metric`:return{color:P.rose[200],icon:bi};case`exposure`:return{color:P.rose[200],icon:xi};case`semantic_model`:return{color:P.rose[400],icon:Si};default:return{color:`inherit`,icon:void 0}}}function Mi(e){switch(e){case`table`:return{color:P.cyan[200],icon:gi};case`view`:return{color:P.fuchsia[300],icon:Ci};case`incremental`:return{color:P.iochmara[300],icon:wi};case`ephemeral`:return{color:P.neutral[400],icon:Ti};case`materialized_view`:case`dynamic_table`:case`streaming_table`:return{color:P.fuchsia[200],icon:Ei};default:return{color:`inherit`,icon:void 0}}}const Ni={added:P.green[500],removed:P.red[500],modified:P.amber[500],unchanged:P.neutral[500]},Pi={added:P.green[100],removed:P.red[200],modified:P.amber[100],unchanged:P.white},Fi={added:P.green[900],removed:P.red[950],modified:P.amber[900],unchanged:P.neutral[700]},Ii={added:`rgb(46 160 67)`,removed:`rgb(248 81 73)`,modified:`rgb(212 133 11)`,impacted:`rgb(252 211 77)`,unchanged:P.neutral[500]},Li={added:`rgb(222 248 227)`,removed:`rgb(252 225 224)`,modified:`rgb(255 237 175)`,impacted:`rgb(254 249 227)`,unchanged:P.white},Ri={added:`rgb(30 58 30)`,removed:`rgb(68 35 35)`,modified:`rgb(75 65 33)`,impacted:`rgb(50 44 24)`,unchanged:`rgb(38 38 38)`},zi=24,Bi=280,Vi={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Hi({size:e=14}){return G(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[W(`circle`,{cx:`8`,cy:`3`,r:`1.5`}),W(`circle`,{cx:`8`,cy:`8`,r:`1.5`}),W(`circle`,{cx:`8`,cy:`13`,r:`1.5`})]})}function Ui({changeStatus:e,newCllExperience:t}){if(!e)return null;let n=(t?Ii:Ni)[e];return W(K,{sx:{width:14,height:14,borderRadius:`50%`,backgroundColor:n,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:{added:`+`,removed:`-`,modified:`~`}[e]})}function Wi({transformationType:e}){if(!e)return null;let t=Vi[e];return W(Yt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Gi({id:e,data:t,showContent:n=!0,showChangeAnalysis:r=!1,isDark:i=!1,newCllExperience:a,onColumnClick:o,onContextMenu:s}){let{column:c,type:l,transformationType:u,changeStatus:d,isHighlighted:f=!0,isFocused:p=!1,isImpacted:m=!1}=t,h=a??t.newCllExperience??!1,[g,_]=H(!1);if(!n)return null;let v=r&&d,y=h&&d?(i?Ri:Li)[d]:void 0,b=h&&d?Ii[d]:void 0,x=m&&!d?Ai(i):void 0,S=y??x?.backgroundColor,C=b??x?.color,w=h&&i?`#262626`:`background.paper`,T=h&&i?`#333333`:`action.hover`,E=h&&i?`#404040`:`action.selected`,ee=h&&i?`#ffffff`:`text.primary`;return G(K,{onClick:()=>o?.(e),sx:{display:`flex`,width:280,padding:`0px 10px`,border:`1px solid`,borderColor:`divider`,backgroundColor:S||(p?E:g?T:w),borderLeft:C?`3px solid ${C}`:void 0,filter:f?`none`:ui,cursor:`pointer`,transition:`background-color 0.15s ease`},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[G(K,{sx:{display:`flex`,fontSize:`11px`,color:ee,width:`100%`,gap:`6px`,alignItems:`center`,height:`23px`},children:[v?W(Ui,{changeStatus:d,newCllExperience:h}):W(Wi,{transformationType:u}),W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flexGrow:1,height:`25px`,lineHeight:`25px`},children:c}),g&&s?W(K,{sx:{display:`inline-flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:t=>{t.preventDefault(),t.stopPropagation(),s(t,e)},"data-testid":`column-kebab-menu`,children:W(Hi,{size:14})}):l&&W(oi,{type:l,style:{flexShrink:0,opacity:.7,fontSize:`1rem`}})]}),W(en,{type:`target`,position:nn.Left,isConnectable:!1,style:{left:0,visibility:`hidden`}}),W(en,{type:`source`,position:nn.Right,isConnectable:!1,style:{right:0,visibility:`hidden`}})]})}const Ki=L(Gi);Ki.displayName=`LineageColumnNode`;function qi({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:s,selected:c}){let l=s?.changeStatus??`unchanged`,u=s?.isHighlighted??!1,d=s?.label,[f,p,m]=on({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o}),h=Ii[l];return G(U,{children:[W(Zt,{id:e,path:f,style:{stroke:h,strokeWidth:u||c?2.5:1.5,opacity:u||c?1:.6}}),d&&W($t,{children:W(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${p}px,${m}px)`,fontSize:10,fontWeight:500,background:`white`,padding:`2px 4px`,borderRadius:4,pointerEvents:`all`},children:d})})]})}const Ji=L(qi);Ji.displayName=`LineageEdge`;function Yi({changedOnly:e,onChange:t}){return W(dn,{control:W(un,{checked:e??!1,onChange:()=>{t()},size:`small`}),label:`Changed only`,slotProps:{typography:{variant:`body2`}}})}function Xi({value:e,onChange:t,textOn:n,textOff:r}){return G(fn,{variant:`outlined`,size:`xsmall`,sx:{borderRadius:1},children:[W(q,{onClick:()=>{t(!1)},sx:{color:e?`text.disabled`:`text.primary`,bgcolor:e?`action.hover`:`background.paper`,borderColor:`divider`,"&:hover":{bgcolor:e?`action.selected`:`background.paper`,borderColor:`divider`}},children:r??`Off`}),W(q,{onClick:()=>{t(!0)},sx:{color:e?`text.primary`:`text.disabled`,bgcolor:e?`background.paper`:`action.hover`,borderColor:`divider`,"&:hover":{bgcolor:e?`background.paper`:`action.selected`,borderColor:`divider`}},children:n??`On`})]})}function Zi({displayMode:e,onDisplayModeChanged:t}){return G(U,{children:[e===`inline`&&G(U,{children:[W(Le,{value:`Base`,colorPalette:`red`,grayOut:!1,fontSize:`10pt`,noCopy:!0}),W(Le,{value:`Current`,colorPalette:`green`,grayOut:!1,fontSize:`10pt`,noCopy:!0})]}),W(Xi,{value:e===`side_by_side`,onChange:e=>{t(e?`side_by_side`:`inline`)},textOff:`Inline`,textOn:`Side by side`})]})}const Qi=e=>{let{defaultValues:t,suggestionList:n,onValuesChange:r,className:i}=e,[a,o]=H(t??[]),[s,c]=H(``),[l,u]=H(!1),[d,f]=H(null),p=V(null),m=!!d,h=t=>t.length>1?`${t.length} ${e.unitName}s selected`:t.length===1?t[0]:``,g=e=>{f(e.currentTarget),setTimeout(()=>p.current?.focus(),100)},_=()=>{f(null),u(!1)},v=e=>{a.includes(e)||(c(``),o([...a,e]),r([...a,e]))},y=()=>{c(``),o([]),r([])},b=e=>{o(a.filter(t=>t!==e)),r(a.filter(t=>t!==e))},x=s.toLowerCase(),S=n?.filter(e=>x===``||e.toLowerCase().includes(x)).filter(e=>!a.includes(e))??[],C=()=>{switch(e.size){case`2xs`:return`0.625rem`;case`xs`:return`0.75rem`;case`sm`:return`0.875rem`;default:return`0.875rem`}};return G(K,{sx:{display:`flex`,alignItems:`center`,width:e.width},className:i,children:[G(q,{variant:`outlined`,color:`neutral`,size:`small`,onClick:g,disabled:e.disabled,sx:{width:`100%`,height:(()=>{switch(e.size){case`2xs`:return 24;case`xs`:return 28;case`sm`:return 32;default:return 36}})(),justifyContent:`space-between`,textTransform:`none`,fontSize:C(),fontWeight:`normal`,px:1},children:[W(Y,{component:`span`,sx:{fontSize:C(),color:a.length>0?`text.primary`:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(a)||e.placeholder||``}),a.length>0&&W(Y,{component:`span`,onClick:e=>{e.stopPropagation(),y()},sx:{fontSize:C(),color:`primary.main`,cursor:`pointer`,ml:1,"&:hover":{textDecoration:`underline`}},children:`Clear`})]}),G(gn,{anchorEl:d,open:m,onClose:_,slotProps:{paper:{sx:{width:e.width,fontSize:C()}}},children:[W(K,{sx:{px:.5,py:.5},children:G(K,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,p:.5,display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`},className:`no-track-pii-safe`,children:[a.map(e=>W(Yt,{label:e,size:`small`,onDelete:()=>b(e),sx:{height:22,fontSize:C()}},e)),W(hn,{inputRef:p,placeholder:`Filter or add custom keys`,value:s,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation();let t=e.target,n=t.value.trim().replace(`,`,``);switch(e.key){case`,`:case`Enter`:e.preventDefault(),n&&(v(n),c(``));break;case`Backspace`:t.value===``&&a.length>0&&(o(a.slice(0,-1)),r(a.slice(0,-1)));break;default:break}},onBlur:()=>{p.current&&l&&p.current.focus()},sx:{flex:1,minWidth:120,fontSize:C(),"& input":{p:.5}}})]})}),W(Tt,{}),s!==``&&!n?.includes(s)&&G(Q,{onClick:()=>{v(s),u(!1)},sx:{fontSize:C()},children:[`Add '`,s,`' to the list`]}),S.slice(0,10).map((e,t)=>W(Q,{onClick:()=>{v(e)},sx:{fontSize:C()},children:e},_n.uniqueId(`option-${t}`))),S.length>10&&W(Z,{title:`Please use filter to find more items`,placement:`top`,children:G(K,{sx:{px:1.5,py:.5,color:`text.secondary`,fontSize:`8pt`},children:[`and `,S.length-10,` more items...`]})})]})]})};function $i(e){let t=[`CHAR`,`VARCHAR`,`TINYTEXT`,`TEXT`,`MEDIUMTEXT`,`LONGTEXT`,`NCHAR`,`NVARCHAR`,`VARCHAR2`,`NVARCHAR2`,`CLOB`,`NCLOB`,`VARCHAR(MAX)`,`XML`,`JSON`],n=e.trim().toUpperCase();return t.includes(n)?!0:/^(VARCHAR|NVARCHAR|VARCHAR2|NVARCHAR2|CHAR|NCHAR)\(\d+\)$/.test(n)}function ea(e){return[`BOOLEAN`,`TINYINT(1)`,`BIT`,`NUMBER(1)`,`BOOL`].includes(e.toUpperCase())}function ta(e){return[`DATE`,`DATETIME`,`TIMESTAMP`,`TIME`,`YEAR`,`DATETIME2`,`SMALLDATETIME`,`DATETIMEOFFSET`,`INTERVAL`,`TIMESTAMPTZ`,`TIMETZ`,`TIMESTAMP WITH TIME ZONE`,`TIMESTAMP WITH LOCAL TIME ZONE`,`TIMESTAMP_LTZ`,`TIMESTAMP_NTZ`,`TIMESTAMP_TZ`].includes(e.toUpperCase())}function na(e){return!$i(e)&&!ea(e)&&!ta(e)}function ra({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=Xl(e.model),o=r.filter(e=>!$i(e.type)&&!ea(e.type)&&!ta(e.type));return i?W(K,{children:`Loading...`}):r.length===0||a?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):W(K,{sx:{m:`16px`},children:G(xn,{fullWidth:!0,disabled:o.length===0,children:[W(Sn,{sx:{mb:1},children:`Pick a column to show Histogram Diff`}),G(Cn,{value:e.column_name,onChange:r=>{let i=r.target.value;n(!!i);let a=o.find(e=>e.name===i)?.type??``;t({...e,column_name:i,column_type:a})},children:[W(`option`,{value:``,children:o.length===0?`No numeric column is available`:`Select column`}),o.map(e=>G(`option`,{value:e.name,className:`no-track-pii-safe`,children:[e.name,` : `,e.type]},e.name))]})]})})}const ia=[{status:`added`,label:`Added`,description:`Newly added resource`},{status:`removed`,label:`Removed`,description:`Removed resource`},{status:`modified`,label:`Modified`,description:`Modified resource`},{status:`impacted`,label:`Impacted`,description:`Downstream of a modified resource`}],aa=[{type:`passthrough`,label:`Passthrough`,description:`Column passes through unchanged`},{type:`renamed`,label:`Renamed`,description:`Column was renamed from source`},{type:`derived`,label:`Derived`,description:`Column is derived from other columns`},{type:`source`,label:`Source`,description:`Original source column`},{type:`unknown`,label:`Unknown`,description:`Transformation type could not be determined`}],oa={added:{color:Ni.added,symbol:`+`},removed:{color:Ni.removed,symbol:`-`},modified:{color:Ni.modified,symbol:`~`}},sa={added:{color:Ii.added,symbol:`+`},removed:{color:Ii.removed,symbol:`-`},modified:{color:Ii.modified,symbol:`~`},impacted:{color:Ii.impacted,symbol:`!`}},ca={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function la({status:e,newCllExperience:t}){let n=(t?sa:oa)[e];return W(K,{sx:{width:16,height:16,borderRadius:`50%`,backgroundColor:n.color,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:n.symbol})}function ua({type:e}){let t=ca[e];return W(Yt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function da({variant:e,showTooltips:t=!0,title:n,className:r,newCllExperience:i=!1}){let a=i?ia:ia.filter(e=>e.status!==`impacted`),o=e===`changeStatus`?a:aa;return G(K,{className:r,sx:{bgcolor:`background.paper`,padding:`12px`,border:`1px solid`,borderColor:`divider`,borderRadius:1,fontSize:`0.875rem`},children:[n&&W(Y,{variant:`caption`,sx:{display:`block`,fontWeight:600,mb:1,color:`text.secondary`},children:n}),e===`changeStatus`&&o.map(e=>{let n=G(K,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[W(la,{status:e.status,newCllExperience:i}),W(Y,{variant:`body2`,children:e.label})]},e.status);return t&&e.description?W(Z,{title:e.description,placement:`right`,children:n},e.status):n}),e===`transformation`&&o.map(e=>{let n=G(K,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[W(ua,{type:e.type}),W(Y,{variant:`body2`,children:e.label})]},e.type);return t&&e.description?W(Z,{title:e.description,placement:`right`,children:n},e.type):n})]})}const fa={breaking:`Breaking`,non_breaking:`Non Breaking`,partial_breaking:`Partial Breaking`,unknown:`Unknown`},pa=()=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:W(`path`,{d:`M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z`})}),ma=()=>W(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:W(`path`,{d:`M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z`})});function ha({name:e,color:t,resourceType:n}){let r=n===`model`?e:`${e} (${n||`unknown`})`;return W(K,{sx:{flex:1,color:t,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:W(Z,{title:r,placement:`top`,children:W(`span`,{children:e})})})}function ga({id:e,data:t,selected:n,interactive:r=!1,selectMode:i=`normal`,isNodeSelected:a=!1,isFocused:o=!1,isHighlighted:s=!0,showContent:c=!0,actionTag:l,showChangeAnalysis:u=!1,changeCategory:d,runsAggregatedTag:f,hasParents:p=!0,hasChildren:m=!0,columnCount:h=0,columnHeight:g=28,isDark:_=!1,newCllExperience:v,isImpacted:y,onNodeClick:b,onNodeDoubleClick:x,onSelect:S,onContextMenu:C,onShowImpactRadius:w}){let[T,E]=H(!1),{label:ee,changeStatus:D=`unchanged`,isSelected:O,resourceType:k,materialized:te}=t,ne=v??t.newCllExperience??!1,re=y??t.isImpacted??!1,A=a||O||n||!1,ie=h>0,j=i===`action_result`&&l,{icon:ae,color:M,backgroundColor:oe}=ne&&re&&(!D||D===`unchanged`)?Ai(_):ki(D,_,ne?`cll`:`default`),{icon:se}=k===`model`&&te?Mi(te):ji(k),N=M,ce=(()=>{let e=_?`#1e1e1e`:`#ffffff`;return c?i===`selecting`?A?M:e:i===`action_result`?j?o||A||T?oe:M:e:o||A||T?oe:e:o||A||T?M:oe})(),le=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:e:i===`action_result`&&j&&!A?t:e})(),ue=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:e:i===`action_result`&&j&&!A?t:e})(),de=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?A?t:M:i===`action_result`?j&&!A?t:e:M})();return G(K,{onClick:()=>b?.(e),onDoubleClick:()=>x?.(e),onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),sx:{display:`flex`,flexDirection:`column`,width:300,cursor:i===`selecting`?`pointer`:`inherit`,transition:`box-shadow 0.2s ease-in-out`,padding:0,filter:ne?`none`:i===`action_result`?j?`none`:ui:s||o||A||T?`none`:ui},children:[G(K,{sx:{display:`flex`,borderColor:N,borderWidth:`2px`,borderStyle:`solid`,borderTopLeftRadius:8,borderTopRightRadius:8,borderBottomLeftRadius:ie?0:8,borderBottomRightRadius:ie?0:8,backgroundColor:ce,height:60},children:[W(K,{sx:{display:`flex`,bgcolor:M,padding:r?`8px`:`2px`,borderRightWidth:`2px`,borderRightStyle:`solid`,borderColor:i===`selecting`?`#00000020`:N,alignItems:`top`,visibility:c?`inherit`:`hidden`},children:r&&W(un,{checked:i===`selecting`&&A||i===`action_result`&&!!j,onClick:t=>{i!==`action_result`&&(t.stopPropagation(),S?.(e))},disabled:i===`action_result`,size:`small`,sx:{padding:0,color:`inherit`,"&.Mui-checked":{color:`inherit`}}})}),G(K,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,width:100,flexDirection:`column`},children:[G(K,{sx:{display:`flex`,width:`100%`,textAlign:`left`,fontWeight:600,flex:1,p:.5,gap:`5px`,alignItems:`center`,visibility:c?`inherit`:`hidden`},children:[W(ha,{name:ee,color:le,resourceType:k}),T?G(U,{children:[D===`modified`&&w&&W(Z,{title:`Show Impact Radius`,placement:`top`,children:W(K,{onClick:t=>{t.preventDefault(),t.stopPropagation(),w?.(e)},sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:W(ma,{})})}),C&&W(K,{onClick:t=>{t.preventDefault(),t.stopPropagation(),C?.(t,e)},sx:{cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:W(pa,{})})]}):G(U,{children:[se&&W(K,{sx:{fontSize:16,color:ue},children:W(se,{"aria-hidden":`true`})}),D&&ae&&W(K,{sx:{color:de},children:W(ae,{"aria-hidden":`true`})})]})]}),W(K,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,flexDirection:`column`,paddingBottom:.5,visibility:c?`inherit`:`hidden`},children:W(J,{direction:`row`,spacing:1,children:l?G(U,{children:[W(K,{sx:{flexGrow:1}}),l]}):u&&d?W(Y,{sx:{height:20,color:`text.secondary`,fontSize:`9pt`,margin:0,fontWeight:600},children:fa[d]}):i!==`action_result`&&f?f:null})})]})]}),ie&&W(K,{sx:{p:`10px 10px`,borderColor:N,borderWidth:`2px`,borderStyle:`solid`,borderTopWidth:0,borderBottomLeftRadius:8,borderBottomRightRadius:8},children:W(K,{sx:{height:`${h*g}px`,overflow:`auto`}})}),p&&W(en,{type:`target`,position:nn.Left,isConnectable:!1}),m&&W(en,{type:`source`,position:nn.Right,isConnectable:!1})]})}const _a=L(ga);_a.displayName=`LineageNode`;const va=e=>({display:`inline-flex`,alignItems:`center`,borderRadius:16,px:1,py:.25,fontSize:`0.75rem`,bgcolor:e?`grey.700`:`grey.100`,color:e?`grey.100`:`inherit`}),ya={mr:.5,display:`flex`,alignItems:`center`},ba={table:`table`,view:`view`,incremental:`incremental`,ephemeral:`ephemeral`,materialized_view:`mat. view`,dynamic_table:`dyn. table`,streaming_table:`stream. table`};function xa(e){return ba[e]??e}function Sa({resourceType:e,materialized:t,"data-testid":n}){let r=F(),i=e===`model`&&t!=null,{icon:a}=i?Mi(t):ji(e),o=i?xa(t):e;return W(Z,{arrow:!0,title:i?`Materialization strategy`:`Type of resource`,children:G(K,{component:`span`,sx:va(r),"data-testid":n,children:[a&&W(K,{component:`span`,sx:ya,children:W(a,{"aria-hidden":`true`})}),o]})})}const Ca=L(Sa);Ca.displayName=`NodeTag`;const wa=()=>G(K,{component:`span`,sx:{display:`flex`,flexDirection:`column`,gap:`2px`,"& > span":{width:4,height:4,borderRadius:`50%`,backgroundColor:`currentColor`}},children:[W(`span`,{}),W(`span`,{}),W(`span`,{})]});function Ta({checkId:e,primaryActions:t=[],secondaryActions:n=[],onAction:r,variant:i=`combined`,size:a=`small`,menuIcon:o,className:s}){let[c,l]=H(null),u=!!c,d=e=>{e.stopPropagation(),l(e.currentTarget)},f=()=>{l(null)},p=t=>{f(),r?.(e,t)},m=e=>{let t=W(q,{variant:`outlined`,size:a,disabled:e.disabled,onClick:()=>p(e.type),startIcon:e.icon,color:e.destructive?`error`:`inherit`,children:e.label},e.type);return e.disabled&&e.disabledTooltip?W(Z,{title:e.disabledTooltip,children:W(`span`,{children:t})},e.type):t};if(i===`menu`){let e=[...t,...n];return G(K,{className:s,children:[W(X,{onClick:d,size:a,children:o||W(wa,{})}),W(gn,{anchorEl:c,open:u,onClose:f,children:e.map(e=>G(Q,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&W(K,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})}return i===`buttons`?W(K,{className:s,sx:{display:`flex`,gap:1},children:W(fn,{size:a,variant:`outlined`,children:t.map(m)})}):G(K,{className:s,sx:{display:`flex`,gap:1},children:[t.length>0&&W(fn,{size:a,variant:`outlined`,children:t.map(m)}),n.length>0&&G(U,{children:[W(X,{onClick:d,size:a,children:o||W(wa,{})}),W(gn,{anchorEl:c,open:u,onClose:f,children:n.map(e=>G(Q,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&W(K,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})]})}const Ea=L(Ta);Ea.displayName=`CheckActions`;function Da({name:e,onNameChange:t,placeholder:n=`Unnamed check`,disabled:r=!1,className:i}){let[a,o]=H(!1),[s,c]=H(e),l=V(null);z(()=>{c(e)},[e]);let u=R(()=>{r||(c(e),o(!0))},[r,e]),d=R(()=>{let n=s.trim();n&&n!==e&&t?.(n),o(!1)},[s,e,t]),f=R(t=>{t.key===`Enter`?(t.preventDefault(),d()):t.key===`Escape`&&(t.preventDefault(),c(e),o(!1))},[d,e]),p=R(e=>{c(e.target.value)},[]);return z(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&d()};return a&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[a,d]),z(()=>{a&&l.current&&(l.current.focus(),l.current.select())},[a]),W(K,{className:i,sx:{flex:`2`,fontSize:`1rem`,fontWeight:500,overflow:`hidden`,color:`text.primary`,cursor:r?`default`:`pointer`},children:a?W(wn,{inputRef:l,value:s,onChange:p,onKeyDown:f,placeholder:n,size:`small`,sx:{width:`100%`},variant:`outlined`}):W(K,{sx:{flex:`0 1 auto`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"&:hover":{textDecoration:r?`none`:`underline`}},onClick:u,children:e||W(K,{component:`span`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})})}const Oa=L(Da);Oa.displayName=`CheckBreadcrumb`;function ka(e){return{query:`Q`,query_base:`Q`,query_diff:`QD`,schema_diff:`SD`,lineage_diff:`LD`,profile:`P`,profile_diff:`PD`,row_count:`R`,row_count_diff:`RD`,value_diff:`VD`,histogram_diff:`H`,top_k_diff:`TK`,simple:`•`}[e]||`?`}function Aa(e){return{query:`#3b82f6`,query_base:`#3b82f6`,query_diff:`#8b5cf6`,schema_diff:`#06b6d4`,lineage_diff:`#10b981`,profile:`#f59e0b`,profile_diff:`#f97316`,row_count:`#ec4899`,row_count_diff:`#ef4444`,value_diff:`#6366f1`,histogram_diff:`#14b8a6`,top_k_diff:`#a855f7`,simple:`#6b7280`}[e]||`#6b7280`}function ja(e){if(!e)return`Check may be outdated`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`Check may be outdated`;if(t.getTime()>Date.now())return`Check may be outdated — last run: just now`;try{return`Check may be outdated — last run: ${En(t,{addSuffix:!0})}`}catch{return`Check may be outdated`}}const Ma={recce_ai:{label:`AI`,color:`#7c3aed`,bg:`rgb(124 58 237 / 0.12)`},user:{label:`User`,color:`#059669`,bg:`rgb(5 150 105 / 0.12)`},preset_system:{label:`Preset`,color:`#2563eb`,bg:`rgb(37 99 235 / 0.12)`}};function Na({check:e,isSelected:t=!1,onClick:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,disabled:o=!1,className:s}){let c=()=>{!o&&n&&n(e.id)},l=W(un,{checked:e.isApproved??!1,onChange:(t,n)=>{r&&r(e.id,n)},onClick:e=>{e.stopPropagation()},disabled:i||o,size:`small`,sx:{padding:`4px`,"&.Mui-disabled":{opacity:.5}}});return G(K,{className:s,onClick:c,sx:{display:`flex`,alignItems:`center`,gap:1,padding:`8px 12px`,cursor:o?`default`:`pointer`,borderLeft:t?`3px solid`:`3px solid transparent`,borderLeftColor:t?`primary.main`:`transparent`,backgroundColor:t?`action.selected`:`transparent`,opacity:o?.6:1,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:o?`transparent`:t?`action.selected`:`action.hover`}},children:[W(Yt,{label:ka(e.type),size:`small`,sx:{minWidth:32,height:24,fontSize:`0.7rem`,fontWeight:600,backgroundColor:`${Aa(e.type)}20`,color:Aa(e.type),"& .MuiChip-label":{px:1}}}),W(Y,{variant:`body2`,sx:{flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.isOutdated&&W(Z,{title:ja(e.lastRunAt),children:W(Yt,{label:`Outdated`,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:`rgb(245 158 11 / 0.12)`,color:`#b45309`,flexShrink:0,"& .MuiChip-label":{px:.75}}})}),e.actorType&&!e.isPreset&&Ma[e.actorType]&&W(Yt,{label:Ma[e.actorType].label,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:Ma[e.actorType].bg,color:Ma[e.actorType].color,flexShrink:0,"& .MuiChip-label":{px:.75}}}),e.isPreset&&W(Yt,{label:`Preset`,size:`small`,variant:`outlined`,sx:{height:20,fontSize:`0.65rem`}}),i&&a?W(Z,{title:a,children:W(`span`,{children:l})}):l]})}const Pa=L(Na);Pa.displayName=`CheckCard`;function Fa({value:e,onChange:t,placeholder:n=`Add description here`,disabled:r=!1,className:i}){let[a,o]=H(!1),[s,c]=H(e??``);z(()=>{c(e??``)},[e]);let l=R(()=>{r||(o(!0),c(e??``))},[r,e]),u=R(()=>{let e=s.trim();t?.(e||void 0),o(!1)},[s,t]),d=R(()=>{c(e??``),o(!1)},[e]),f=R(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),u()),e.key===`Escape`&&(e.preventDefault(),d())},[u,d]);return a?G(K,{className:i,sx:{height:`100%`},children:[W(wn,{multiline:!0,fullWidth:!0,minRows:3,value:s,onChange:e=>c(e.target.value),onKeyDown:f,placeholder:n,autoFocus:!0,sx:{"& .MuiInputBase-root":{fontSize:`0.875rem`}}}),G(J,{direction:`row`,spacing:1,sx:{mt:1},children:[W(q,{variant:`contained`,size:`small`,onClick:u,children:`Update`}),W(pt,{component:`button`,variant:`body2`,onClick:d,sx:{cursor:`pointer`},children:`Cancel`})]}),G(Y,{variant:`caption`,sx:{color:`text.secondary`,display:`block`,mt:.5},children:[navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`,`+Enter to save, Escape to cancel`]})]}):W(K,{className:i,onClick:l,sx:{height:`100%`,overflow:`auto`,cursor:r?`default`:`pointer`,padding:1,borderRadius:1,"&:hover":{backgroundColor:r?`transparent`:`action.hover`}},children:e?W(Y,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e}):W(Y,{variant:`body2`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})}const Ia=L(Fa);Ia.displayName=`CheckDescription`;function La({checkId:e,name:t,type:n,description:r,isApproved:i=!1,tabs:a=[],defaultTab:o,primaryActions:s=[],secondaryActions:c=[],onAction:l,onDescriptionChange:u,onNameChange:d,disabled:f=!1,headerContent:p,sidebarContent:m,className:h}){let[g,_]=H(o??a[0]?.id),[v,y]=H(!1),[b,x]=H(t),S=()=>{f||(y(!0),x(t))},C=()=>{b.trim()&&b!==t&&d?.(b.trim()),y(!1)},w=e=>{e.key===`Enter`?C():e.key===`Escape`&&(x(t),y(!1))},T=a.find(e=>e.id===g)?.content;return G(K,{className:h,sx:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[G(K,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[p,G(K,{sx:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2},children:[G(K,{sx:{flexGrow:1,minWidth:0},children:[v?W(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),onBlur:C,onKeyDown:w,autoFocus:!0,style:{fontSize:`1.25rem`,fontWeight:500,border:`none`,borderBottom:`2px solid`,borderColor:`currentColor`,outline:`none`,background:`transparent`,width:`100%`}}):W(Y,{variant:`h6`,onClick:S,sx:{cursor:f?`default`:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,"&:hover":{textDecoration:f?`none`:`underline`}},children:t}),G(Y,{variant:`caption`,sx:{color:`text.secondary`},children:[n,` `,i&&`• Approved`]})]}),W(Ea,{checkId:e,primaryActions:s,secondaryActions:c,onAction:l})]})]}),G(K,{sx:{display:`flex`,flexGrow:1,overflow:`hidden`},children:[G(K,{sx:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[G(K,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[W(Y,{variant:`subtitle2`,sx:{mb:1},children:`Description`}),W(Ia,{value:r,onChange:u,disabled:f})]}),a.length>0&&G(U,{children:[W(K,{sx:{borderBottom:1,borderColor:`divider`},children:W(On,{value:g,onChange:(e,t)=>_(t),children:a.map(e=>W(Dn,{value:e.id,label:e.label},e.id))})}),W(K,{sx:{flexGrow:1,overflow:`auto`,p:2},children:T})]})]}),m&&G(U,{children:[W(Tt,{orientation:`vertical`,flexItem:!0}),W(K,{sx:{width:350,flexShrink:0,overflow:`auto`},children:m})]})]})]})}const Ra=L(La);Ra.displayName=`CheckDetail`;function za({title:e=`No checks yet`,description:t=`Create your first check to start validating data changes`,icon:n,actionText:r,onAction:i,isLoading:a=!1,helperText:o,className:s}){return W(K,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,padding:4,minHeight:300},children:G(J,{spacing:2,sx:{alignItems:`center`},children:[n&&W(K,{sx:{color:`text.secondary`,fontSize:48,mb:1},children:n}),W(Y,{variant:`h6`,sx:{fontWeight:500,color:`text.primary`},children:e}),W(Y,{variant:`body2`,sx:{color:`text.secondary`,maxWidth:400},children:t}),r&&i&&W(q,{variant:`contained`,onClick:i,disabled:a,sx:{mt:2},children:a?`Creating...`:r}),o&&W(Y,{variant:`caption`,sx:{color:`text.secondary`,mt:1},children:o})]})})}const Ba=L(za);Ba.displayName=`CheckEmptyState`;function Va({checks:e,selectedId:t,onCheckSelect:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,title:o,className:s,isLoading:c=!1,emptyContent:l}){return c?W(K,{className:s,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:W(Y,{sx:{color:`text.secondary`},children:`Loading checks...`})}):e.length===0?G(K,{className:s,children:[o&&W(Y,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),l||W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:W(Y,{sx:{color:`text.secondary`},children:`No checks`})})]}):G(K,{className:s,sx:{height:`100%`,overflow:`auto`},children:[o&&W(Y,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),W(kn,{disablePadding:!0,children:e.map(e=>W(An,{disablePadding:!0,children:W(Pa,{check:e,isSelected:t===e.id,onClick:n,onApprovalChange:r,disableApproval:i,disabledApprovalTooltip:a})},e.id))})]})}const Ha=L(Va);Ha.displayName=`CheckList`;const Ua={lineageNode:_a,lineageGraphColumnNode:Ki},Wa={lineageEdge:Ji};function Ga({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,showMiniMap:i=!0,showControls:a=!0,showBackground:o=!0,height:s=600,interactive:c=!0,minZoom:l,maxZoom:u,fitViewOptions:d}){let[f,p,m]=cn(e),[h,g,_]=sn(t),v=R((e,t)=>{n?.(t.id)},[n]),y=R(()=>{n?.(null)},[n]),b=R((e,t)=>{r?.(t.id)},[r]);return W(K,{sx:{width:`100%`,height:s},children:G(rn,{nodes:f,edges:h,onNodesChange:c?m:void 0,onEdgesChange:c?_:void 0,onNodeClick:v,onNodeDoubleClick:b,onPaneClick:y,nodeTypes:Ua,edgeTypes:Wa,fitView:!0,fitViewOptions:d,minZoom:l,maxZoom:u,nodesDraggable:c,nodesConnectable:!1,elementsSelectable:c,children:[o&&W(Xt,{}),a&&W(Qt,{}),i&&W(tn,{nodeColor:e=>Ii[e.data.changeStatus??`unchanged`]})]})})}const Ka=at(function(e,t){let{lineageGraph:n,viewOptions:r,interactive:i=!0,height:a=600,filterNodes:o,onNodeSelect:s,onNodeDoubleClick:c,dagre:l,showMiniMap:u=!0,showControls:d=!0,showBackground:f=!0}=e,p=V(null),m=j(),h=n??m.lineageGraph,g=!n&&m.isLoading,_=n?void 0:m.error,{nodes:v,edges:y}=B(()=>{if(!h)return{nodes:[],edges:[]};let e;if(r?.node_ids&&r.node_ids.length>0?e=r.node_ids:r?.view_mode===`changed_models`&&(e=h.modifiedSet),r?.select&&e&&r.select.includes(`+`)){let t=de(h,e),n=ue(h,e);e=[...new Set([...t,...n])]}if(r?.packages&&r.packages.length>0){let t=new Set(r.packages);e=(e??Object.keys(h.nodes)).filter(e=>{let n=h.nodes[e];return n?.data.packageName&&t.has(n.data.packageName)})}o&&(e=(e??Object.keys(h.nodes)).filter(e=>{let t=h.nodes[e];return t?o(e,t):!1}));let[t,n]=M(h,e);return l&&t.length>0&&qa(l,t,n),{nodes:t.map(e=>({id:e.id,position:e.position,type:`lineageNode`,data:{label:e.data.name,nodeType:e.data.resourceType,changeStatus:e.data.changeStatus,resourceType:e.data.resourceType,packageName:e.data.packageName}})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,type:`lineageEdge`,data:{changeStatus:e.data?.changeStatus}}))}},[h,r,o,l]),b=R(async()=>{if(p.current)try{let e=await Mn(p.current,{backgroundColor:`#ffffff`,pixelRatio:2}),t=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[t.type]:t})])}catch(e){throw console.error(`Failed to copy to clipboard:`,e),e}},[]);return ct(t,()=>({copyToClipboard:b}),[b]),g?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Et,{})}):_?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{color:`error`,children:_})}):h?v.length===0?W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{sx:{color:`text.secondary`},children:`No nodes match the current filter criteria.`})}):W(K,{ref:p,sx:{width:`100%`,height:a},children:W(Ga,{nodes:v,edges:y,onNodeSelect:s,onNodeDoubleClick:c,showMiniMap:u,showControls:d,showBackground:f,height:`100%`,interactive:i})}):W(K,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{sx:{color:`text.secondary`},children:`No lineage data available. Provide data via LineageGraphProvider or lineageGraph prop.`})})});function qa(e,t,n,r=`LR`){let i=new e.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:r,ranksep:50,nodesep:30});for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60;i.setNode(e.id,{width:t,height:n})}for(let e of n)i.setEdge(e.source,e.target);e.layout(i);for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60,r=i.node(e.id);r&&(e.position={x:r.x-t/2,y:r.y-n/2})}}function Ja({params:e,viewOptions:t,interactive:n=!1,height:r,dagre:i},a){let o={...t,...e};return W(K,{sx:{display:`flex`,flexDirection:`column`,height:r??`100%`},children:W(an,{children:W(Ka,{viewOptions:o,interactive:n,ref:a,dagre:i})})})}const Ya=at(Ja);Ya.displayName=`LineageDiffView`;function Xa(e){switch(e){case`sql`:return Fn({dialect:Pn});case`yaml`:return In();default:return null}}function Za({value:e,onChange:t,language:n=`sql`,readOnly:r=!1,lineNumbers:i=!0,wordWrap:a=!0,fontSize:o=14,height:s=`100%`,className:c=``,theme:l=`light`,keyBindings:u=[]}){let d=B(()=>{let e=[zn.theme({"&":{fontSize:`${o}px`},".cm-content":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`},".cm-gutters":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`}})],t=Xa(n);return t&&e.push(t),a&&e.push(zn.lineWrapping),u.length>0&&e.push(Rn.highest(Bn.of(u))),e},[n,o,a,u]),f=B(()=>l===`dark`?Hn:Un,[l]);return W(Wn,{value:e,onChange:e=>{t&&t(e)},extensions:d,readOnly:r,basicSetup:{lineNumbers:i,foldGutter:!0,highlightActiveLineGutter:!r,highlightActiveLine:!r,tabSize:2},height:s,className:`${c} no-track-pii-safe`,theme:f})}function Qa({name:e,description:t,type:n,params:r,viewOptions:i}){let a={name:e,description:t,type:n,params:r};return i&&(a.view_options=i),Nn.stringify({checks:[a]})}function $a({yamlTemplate:e,height:t=`300px`}){return W(Za,{value:e,language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,theme:F()?`dark`:`light`,height:t})}const eo=L($a);eo.displayName=`PresetCheckTemplateView`;const to={apiPrefix:``,authToken:void 0,baseUrl:void 0,apiClient:ne({baseURL:Ge??``})};function no(){return D()??to}function ro({userId:e,enabled:t=!0}){let{apiClient:n}=no(),r=e?.toString(),{data:i,isLoading:a}=tt({queryKey:O.user(),queryFn:()=>We(n),enabled:t&&!!r,retry:!1,staleTime:300*1e3}),o=!!(i&&r&&i.id===r)&&i?.login_type===`github`,s=!!(t&&o&&r),{data:c,isLoading:l}=tt({queryKey:[`github-avatar`,r],queryFn:()=>r?Ue(r):Promise.resolve(null),enabled:s,retry:!1,staleTime:300*1e3});return{avatarUrl:typeof c==`string`?c:null,isLoading:a||s&&l,isGitHubUser:!!o}}function io({onSubmit:e,isSubmitting:t=!1,placeholder:n=`Add a comment...`,submitLabel:r=`Comment`,submittingLabel:i=`Submitting...`,className:a}){let o=F(),[s,c]=H(``),l=R(()=>{let t=s.trim();t&&(e(t),c(``))},[s,e]),u=R(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())},[l]);return G(K,{className:a,children:[W(wn,{value:s,onChange:R(e=>{c(e.target.value)},[]),onKeyDown:u,placeholder:n,size:`small`,multiline:!0,fullWidth:!0,minRows:3,disabled:t,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.500`:`grey.400`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`iochmara.400`,boxShadow:`0 0 0 1px #4299E1`}},"& .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.600`:void 0}}}),W(J,{direction:`row`,sx:{justifyContent:`flex-end`,mt:2},children:W(q,{size:`small`,color:`iochmara`,variant:`contained`,onClick:l,disabled:!s.trim()||t,children:t?i:r})})]})}const ao=L(io);ao.displayName=`CommentInput`;function oo(e){switch(e.event_type){case`check_created`:return`create`;case`comment`:return`comment`;case`approval_change`:return e.new_value===`true`?`approve`:`unapprove`;case`description_change`:case`name_change`:return`edit`;case`preset_applied`:return`preset`;default:return`edit`}}function so({event:e}){let t=oo(e),n={create:Ut,comment:jt,approve:Nt,unapprove:Pt,edit:Vt,preset:kt},r={create:`primary.main`,comment:`grey.500`,approve:`success.main`,unapprove:`grey.400`,edit:`warning.main`,preset:`secondary.main`},i=n[t],a=r[t];return W(K,{component:i,sx:{color:a,fontSize:16}})}function co({actor:e}){let t=(e.fullname||e.login||`User`).charAt(0).toUpperCase();return W(Gn,{src:e.avatarUrl||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:t})}function lo({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=En(new Date(e.created_at),{addSuffix:!0}),i=``;switch(e.event_type){case`check_created`:i=`created this check`;break;case`approval_change`:i=e.new_value===`true`?`approved this check`:`unapproved this check`;break;case`description_change`:i=`updated the description`;break;case`name_change`:i=`renamed this check`;break;case`preset_applied`:i=`applied a preset`;break;default:i=`made a change`}return G(K,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[W(K,{sx:{pt:`2px`},children:W(so,{event:e})}),W(K,{sx:{flex:1},children:G(J,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[W(co,{actor:t}),W(Y,{variant:`body2`,sx:{fontWeight:`500`},children:n}),W(Y,{variant:`body2`,sx:{color:`text.secondary`},children:i}),W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:r})]})})]})}const uo=L(lo);uo.displayName=`StateChangeEvent`;function fo({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i}){let a=F(),[o,s]=H(!1),[c,l]=H(e.content||``),[u,d]=H(!1),[f,p]=H(!1),[m,h]=H(null),g=!!m,{actor:_}=e,v=_.fullname||_.login||`Someone`,y=En(new Date(e.created_at),{addSuffix:!0}),b=t&&String(_.user_id)===String(t),x=R(()=>{l(e.content||``),s(!0)},[e.content]),S=R(()=>{l(e.content||``),s(!1)},[e.content]),C=R(async()=>{let t=c.trim();if(!t||t===e.content){S();return}if(n){d(!0);try{await n(e.id,t),s(!1)}finally{d(!1)}}},[c,e.content,e.id,n,S]),w=R(e=>{e.key===`Escape`?S():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},[S,C]),T=R(e=>{h(e.currentTarget)},[]),E=R(()=>{h(null)},[]),ee=R(async()=>{if(r){p(!0);try{await r(e.id),E()}finally{p(!1)}}},[r,e.id,E]),D=R(e=>{l(e.target.value)},[]);return e.is_deleted?G(K,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[W(K,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:W(so,{event:e})}),W(K,{sx:{display:`flex`,flex:1,alignItems:`center`},children:W(Y,{variant:`body2`,sx:{color:`text.disabled`,fontStyle:`italic`},children:`Comment deleted`})})]}):G(K,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[W(K,{sx:{pt:`2px`},children:W(so,{event:e})}),G(K,{sx:{flex:1},children:[G(J,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[W(co,{actor:_}),G(Y,{variant:`body2`,sx:{fontWeight:`500`},children:[v,b&&G(Y,{component:`span`,variant:`body2`,sx:{color:`text.secondary`},children:[` `,`(Author)`]})]}),W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:y}),e.is_edited&&W(Y,{variant:`caption`,sx:{color:`text.disabled`},children:`(edited)`})]}),o?G(K,{children:[W(wn,{value:c,onChange:D,onKeyDown:w,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:u,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),G(J,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`,mt:1},children:[W(q,{size:`small`,variant:`text`,onClick:S,disabled:u,children:`Cancel`}),W(q,{size:`small`,variant:`contained`,onClick:C,disabled:!c.trim()||u,children:u?`Saving...`:`Save`})]})]}):G(K,{sx:{bgcolor:a?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:a?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[i?W(i,{content:e.content||``}):W(Y,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:e.content}),b&&(n||r)&&G(J,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&W(Z,{title:`Edit comment`,children:W(X,{"aria-label":`Edit comment`,size:`small`,onClick:x,children:W(Ht,{})})}),r&&G(U,{children:[W(Z,{title:`Delete comment`,children:W(X,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:T,children:W(Kt,{})})}),W(Kn,{open:g,anchorEl:m,onClose:E,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:G(K,{sx:{p:2},children:[W(Y,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),G(J,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[W(q,{size:`small`,variant:`text`,onClick:E,disabled:f,children:`Cancel`}),W(q,{size:`small`,variant:`contained`,color:`error`,onClick:ee,disabled:f,children:f?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}const po=L(fo);po.displayName=`CommentEvent`;function mo({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i,className:a}){return e.event_type===`comment`?W(K,{className:a,children:W(po,{event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i})}):W(K,{className:a,children:W(uo,{event:e})})}const ho=L(mo);ho.displayName=`TimelineEvent`;function go({name:e,isChecked:t}){return`${t?`✅ `:``}${e}`}function _o({description:e,fallback:t=`_(no description)_`}){return(e??``)||t}function vo({type:e,hasResult:t,hasError:n}){return e===`schema_diff`||e===`lineage_diff`?!1:!t||n}function yo({sql:e,label:t=`SQL`}){return`**${t}**
3
3
  \`\`\`sql
4
4
  ${e}
5
5
  \`\`\``}function bo(e){return e.status?e.status:e.result?`Finished`:e.error?`Failed`:`Finished`}function xo(e){switch(e){case`Running`:return{color:`blue`,label:`Running`};case`Finished`:return{color:`green`,label:`Finished`};case`Failed`:return{color:`red`,label:`Failed`};case`Cancelled`:return{color:`grey`,label:`Cancelled`};default:return{color:`green`,label:`Finished`}}}function So({status:e,showSpinner:t=!0,size:n=`small`,className:r}){let{color:i,label:a}=xo(e);return G(K,{className:r,sx:{display:`inline-flex`,alignItems:`center`,gap:.5},children:[e===`Running`&&t&&W(Et,{size:n===`small`?12:16,color:`primary`}),W(Y,{component:`span`,sx:{fontWeight:500,fontSize:n===`small`?`0.75rem`:`0.875rem`,color:`${i}.500`},children:a})]})}const Co=L(So);Co.displayName=`RunStatusBadge`;function wo(e){if(e==null)return null;let t=new Date,n=new Date;return n.setDate(t.getDate()-1),t.toDateString()===e.toDateString()?`Today`:n.toDateString()===e.toDateString()?`Yesterday`:e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function To(e){if(e==null)return null;let t=new Date,n=new Date;n.setDate(t.getDate()-1);let r=e.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1});return t.toDateString()===e.toDateString()?`Today, ${r}`:n.toDateString()===e.toDateString()?`Yesterday, ${r}`:`${e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}, ${r}`}function Eo({status:e,runAt:t,className:n}){let r=t?To(typeof t==`string`?new Date(t):t):null;return G(K,{className:n,sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`,color:`text.secondary`},children:[W(Co,{status:e,size:`small`}),r&&G(U,{children:[W(Y,{component:`span`,sx:{fontSize:`inherit`},children:`•`}),W(Y,{component:`span`,sx:{fontSize:`inherit`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r})]})]})}const Do=L(Eo);Do.displayName=`RunStatusWithDate`;function Oo({run:e,className:t}){return W(Do,{status:bo(e),runAt:e.run_at,className:t})}const ko=L(Oo);ko.displayName=`RunStatusAndDate`;function Ao({run:e,isSelected:t=!1,icon:n,onClick:r,onAddToChecklist:i,onGoToCheck:a,addToChecklistIcon:o,goToCheckIcon:s,hideAddToChecklist:c=!1,disableAddToChecklist:l=!1,className:u}){let d=F(),f=e.checkId!=null,p=!c&&!f&&(i||l);return G(K,{className:u,onClick:()=>r?.(e.id),sx:e=>({display:`flex`,flexDirection:`column`,width:`100%`,p:`8px 16px`,cursor:`pointer`,borderBottom:1,borderColor:`divider`,borderLeft:`4px solid`,borderLeftColor:t?`warning.main`:`transparent`,bgcolor:t?d?`warning.dark`:`warning.light`:`transparent`,"&:hover":{bgcolor:t?d?`warning.dark`:`warning.light`:e.palette.action.hover}}),children:[G(K,{sx:{display:`flex`,alignItems:`center`,gap:1.5},children:[n&&W(K,{sx:{fontSize:16,color:`text.secondary`,flexShrink:0},children:n}),W(Y,{sx:{flex:1,fontSize:`0.875rem`,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:e.name?`text.primary`:`text.secondary`},children:e.name?.trim()||`<no name>`}),f&&a&&W(Z,{title:`Go to Check`,children:W(X,{size:`small`,onClick:t=>{t.stopPropagation(),e.checkId&&a(e.checkId)},sx:{p:.5},children:s||W(K,{component:`span`,sx:{fontSize:14,color:`success.main`},children:`✓`})})}),p&&W(Z,{title:l?`You don't have permission to add checks`:`Add to Checklist`,children:W(`span`,{children:W(X,{size:`small`,disabled:l,onClick:t=>{t.stopPropagation(),i?.(e.id)},sx:{p:.5},children:o||W(K,{component:`span`,sx:{fontSize:14},children:`○`})})})})]}),W(Do,{status:e.status,runAt:e.runAt})]})}const jo=L(Ao);jo.displayName=`RunListItem`;const Mo=L(function({date:e}){return W(K,{sx:{width:`100%`,p:`8px 16px`,borderBottom:1,borderColor:`divider`,color:`text.secondary`,fontSize:`0.75rem`,fontWeight:500,bgcolor:`action.hover`},children:e})});function No({runs:e,selectedId:t,isLoading:n=!1,onRunSelect:r,onAddToChecklist:i,onGoToCheck:a,getRunIcon:o,hideAddToChecklist:s=!1,disableAddToChecklist:c=!1,title:l=`Runs`,headerActions:u,emptyMessage:d=`No runs`,loadingMessage:f=`Loading...`,groupByDate:p=!1,addToChecklistIcon:m,goToCheckIcon:h,className:g}){return G(K,{className:g,sx:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`},children:[G(J,{direction:`row`,sx:{alignItems:`center`,flex:`0 0 auto`,px:2,py:1.5,borderBottom:1,borderColor:`divider`},children:[W(Y,{variant:`h6`,children:l}),W(K,{sx:{flex:1}}),u]}),W(K,{sx:{flex:1,overflow:`auto`},children:n?W(K,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`},children:f}):(()=>{if(e.length===0)return W(K,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,p:4},children:d});let n=null;return e.map(e=>{let l=e.runAt?wo(new Date(e.runAt)):null,u=p&&l&&n!==l;return n=l,G(K,{children:[u&&W(Mo,{date:l}),W(jo,{run:e,isSelected:e.id===t,icon:o?.(e.type),onClick:r,onAddToChecklist:i,onGoToCheck:a,hideAddToChecklist:s,disableAddToChecklist:c,addToChecklistIcon:m,goToCheckIcon:h})]},e.id)})})()})]})}const Po=L(No);Po.displayName=`RunList`;function Fo({status:e,progress:t,message:n,errorMessage:r,variant:i=`spinner`,showStatus:a=!0,icon:o,className:s}){let c=e===`Running`,l=e===`Failed`,u=t!==void 0&&t>=0;return G(K,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:2,p:3,textAlign:`center`},children:[o?W(K,{sx:{fontSize:40,color:`text.secondary`},children:o}):c&&G(U,{children:[i===`spinner`&&W(Et,{size:40,color:`primary`}),i===`circular`&&W(Et,{size:60,variant:u?`determinate`:`indeterminate`,value:t,color:`primary`})]}),c&&i===`linear`&&G(K,{sx:{width:`100%`,maxWidth:300},children:[W(qn,{variant:u?`determinate`:`indeterminate`,value:t,sx:{height:8,borderRadius:4}}),u&&G(Y,{variant:`caption`,sx:{color:`text.secondary`,mt:.5,display:`block`},children:[Math.round(t),`%`]})]}),a&&W(Co,{status:e,size:`medium`}),n&&!l&&W(Y,{variant:`body2`,sx:{color:`text.secondary`},children:n}),l&&r&&W(K,{sx:{p:2,bgcolor:`error.light`,borderRadius:1,maxWidth:400},children:W(Y,{variant:`body2`,sx:{color:`error.contrastText`},children:r})})]})}const Io=L(Fo);Io.displayName=`RunProgress`;function Lo({visible:e=!0,opacity:t=.8,...n}){return e?W(K,{sx:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:`rgba(255, 255, 255, ${t})`,zIndex:10,".dark &":{bgcolor:`rgba(0, 0, 0, ${t})`}},children:W(Io,{...n})}):null}const Ro=L(Lo);Ro.displayName=`RunProgressOverlay`;function zo({warnings:e,children:t,className:n}){let r=F(),i=e&&e.length>0;return G(K,{className:n,sx:{display:`flex`,borderBottom:`1px solid`,borderColor:`divider`,justifyContent:`flex-end`,gap:`5px`,alignItems:`center`,px:`10px`,bgcolor:i?r?P.amber[900]:P.amber[100]:`inherit`,color:i?r?P.amber[200]:P.amber[800]:`inherit`},children:[W(K,{sx:{display:`flex`,flexDirection:`column`,alignItems:`flex-start`,gap:0},children:e?.map((e,t)=>G(K,{children:[W(qt,{color:r?P.amber[400]:P.amber[600],style:{verticalAlign:`middle`,marginRight:4}}),e]},e))}),W(K,{sx:{flex:1,minHeight:`32px`}}),t]})}const Bo=L(zo);Bo.displayName=`RunToolbar`,Xn.register(Jn,$n,Qn,Yn,er,Zn,tr);const Vo=`#63B3ED`,Ho=`#F6AD55`,Uo=`${Vo}A5`,Wo=`${Ho}A5`,Go=`#90CDF4`,Ko=`#FBD38D`,qo=`${Go}A5`,Jo=`${Ko}A5`;function Yo(e){return{gridColor:e?`#4b5563`:`#d1d5db`,textColor:e?`#e5e7eb`:`#374151`,borderColor:e?`#6b7280`:`#9ca3af`,tooltipBackgroundColor:e?`#1f2937`:`#ffffff`,tooltipTextColor:e?`#e5e7eb`:`#111827`,barLabelColor:e?`#ffffff`:`#1f2937`,secondaryTextColor:e?`#e5e7eb`:`#6b7280`}}function Xo(e){return{current:e?Go:Vo,base:e?Ko:Ho,currentWithAlpha:e?qo:Uo,baseWithAlpha:e?Jo:Wo}}function Zo(e){if(typeof e!=`number`)return String(e);let t=Math.abs(e),n=0xe8d4a51000,r=1e9,i=1e6,a=1e3;return t>=n?`${(e/n).toFixed(1)}T`:t>=r?`${(e/r).toFixed(1)}B`:t>=i?`${(e/i).toFixed(1)}M`:t>=a?`${(e/a).toFixed(1)}K`:t>=1?e.toFixed(2):t>=.01?e.toFixed(3):e.toExponential(2)}function Qo(e,t){let n=e[t],r=e[t+1];return`${Zo(n)} - ${Zo(r)}`}function $o(e){return e>0&&e<=.001?`<0.1%`:e<1&&e>=.999?`>99.9%`:`${(e*100).toFixed(1)}%`}function es({title:e,dataType:t=`numeric`,samples:n=0,min:r=0,max:i=0,binEdges:a,baseData:o,currentData:s,animate:c=!1,hideAxis:l=!1,theme:u=`light`,height:d=300,className:f}){let p=u===`dark`,m=Yo(p),h=Xo(p),g=t===`datetime`,_=B(()=>{let e=a.slice(0,-1).map((e,t)=>Qo(a,t)),t=(e,t,n)=>{let r=e.counts??[];return{label:t,data:g?r.map((e,t)=>[a[t],e]):r,backgroundColor:n,borderColor:n,hoverBackgroundColor:n,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:`x`}};return{labels:e,datasets:[t(s,s.label??`Current`,h.currentWithAlpha),t(o,o.label??`Base`,h.baseWithAlpha)]}},[a,o,s,h,g]),v=B(()=>{let u=Math.max(...s.counts,...o.counts),d=a.slice(0,-1).map((e,t)=>Qo(a,t)),f=g?`Date Range`:t===`string`?`Text Length`:`Value Range`;return{responsive:!0,maintainAspectRatio:!1,animation:c?void 0:!1,plugins:{legend:{reverse:!0,labels:{color:m.textColor}},title:{display:!0,text:e,font:{size:20},color:m.textColor},tooltip:{mode:`index`,intersect:!1,backgroundColor:m.tooltipBackgroundColor,titleColor:m.tooltipTextColor,bodyColor:m.tooltipTextColor,borderColor:m.borderColor,borderWidth:1,callbacks:{title([{dataIndex:e}]){return`${f}\n${Qo(a,e)}`},label({datasetIndex:e,dataIndex:t,dataset:r}){let i=(e===0?s.counts:o.counts)[t],a=n>0?$o(i/n):``;return`${r.label}: ${i}${a?` (${a})`:``}`}}}},scales:{x:g?{display:!l,type:`timeseries`,min:r,max:i,adapters:{date:{}},time:{minUnit:`day`},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8,color:m.textColor}}:{display:!l,type:`category`,grid:{display:!1},ticks:{callback(e,t){return d[t]},color:m.textColor},stacked:!0},y:{display:!l,type:`linear`,max:u,border:{dash:[2,2],color:m.borderColor},grid:{color:m.gridColor},ticks:{maxTicksLimit:8,color:m.textColor,callback(e){return Zo(e)}},beginAtZero:!0}}}},[e,t,g,n,r,i,a,o,s,l,c,m]);return W(`div`,{className:f,style:{height:d},children:W(rr,{type:`bar`,options:v,data:_})})}const ts=L(es);ts.displayName=`HistogramChart`,St.registerModules([xt]);function ns({emptyMessage:e}){return W(K,{sx:{display:`flex`,height:`35px`,alignItems:`center`,justifyContent:`center`,bgcolor:`grey.100`,textAlign:`center`,gridColumn:`1/-1`},children:W(Y,{sx:{fontWeight:600},children:e??`No rows`})})}function rs({style:e,className:t,columnDefs:n,rowData:r,columns:i,rows:a,getRowId:o,rowHeight:s=32,headerHeight:c=36,defaultColDef:l,defaultColumnOptions:u,renderers:d,rowClassName:f,containerClassName:p,...m},h){let g=V(null),_=V(null);ct(h,()=>({api:_.current,element:g.current}),[]);let v=F(),y=B(()=>v?ge:he,[v]),b=n??i,x=r??a,S=l??u,C=B(()=>({resizable:!0,suppressMovable:!0,...S}),[S]),w=B(()=>{if(d?.noRowsFallback)return()=>d.noRowsFallback},[d?.noRowsFallback]),T=B(()=>o||(e=>{let t=e.data;if(t?.__rowKey!==void 0)return String(t.__rowKey);let n=e.data?.rowIndex;return String(n??Math.random())}),[o]),E=B(()=>b?`grid-${b.filter(e=>`field`in e&&e.pinned===`left`).map(e=>e.field).sort().join(`,`)}`:`grid`,[b]);return W(K,{ref:g,className:[t,p].filter(Boolean).join(` `)||void 0,sx:{flex:1,minHeight:0,width:`100%`,overflow:`hidden`,"& .ag-root-wrapper":{border:`none`,height:`100%`},"& .ag-header":{borderBottom:`1px solid var(--ag-border-color)`},"& .ag-row":{borderBottom:`1px solid var(--ag-border-color)`},"& .ag-cell":{borderRight:`1px solid var(--ag-border-color)`},"& .ag-header-cell":{borderRight:`1px solid var(--ag-border-color)`},"& .diff-cell-added":{backgroundColor:v?`#1a4d1a !important`:`#cefece !important`,color:`var(--mui-palette-text-primary)`},"& .diff-cell-removed":{backgroundColor:v?`#5c1f1f !important`:`#ffc5c5 !important`,color:`var(--mui-palette-text-primary)`},"& .diff-cell-modified":{backgroundColor:v?`#713F12 !important`:`#FEF3C7 !important`,color:`var(--mui-palette-text-primary)`},"& .diff-header-added":{backgroundColor:`#15803d !important`,color:`white`},"& .diff-header-removed":{backgroundColor:`#f43f5e !important`,color:`white`},"& .diff-header-modified":{backgroundColor:`#f59e0b !important`,color:`white`},"& .index-column":{color:`var(--mui-palette-text-secondary)`,textAlign:`right`},"& .ag-pinned-left-cols-container .ag-cell":{backgroundColor:v?`#2d2d2d`:`#f5f5f5`}},children:W(ir,{theme:y,columnDefs:b,rowData:x,getRowId:T,rowHeight:s,headerHeight:c,defaultColDef:C,suppressCellFocus:!0,suppressRowHoverHighlight:!1,animateRows:!1,rowClass:f,noRowsOverlayComponent:w,onGridReady:e=>{_.current=e.api},...m},E)})}const is=at(rs);Xn.register(Yn,Jn,Qn,Zn,tr);function as(e){return e>=0xe8d4a51000?`${(e/0xe8d4a51000).toFixed(1)}T`:e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function os(e){return e>0&&e<=.001?`<0.1%`:e<1&&e>=.999?`>99.9%`:`${(e*100).toFixed(1)}%`}function ss(e,t){let n=Math.min(t,e.counts.length),r=e.counts.slice(0,n),i=r.reduce((e,t)=>e+t,0),a=e.valids-i,o=r.map((t,n)=>{let r=e.values[n],i,a=!1;return r==null?(i=`(null)`,a=!0):typeof r==`string`&&r.length===0?(i=`(empty)`,a=!0):i=String(r),{label:i,count:t,isSpecial:a}});return a>0&&o.push({label:`(others)`,count:a,isSpecial:!0}),o}function cs({count:e,total:t,color:n,theme:r=`light`,height:i=16}){let a=r===`dark`,o=Yo(a),s=Xo(a),c=n??s.current,l=B(()=>({labels:[``],datasets:[{indexAxis:`y`,data:[e],backgroundColor:c,hoverBackgroundColor:c,borderWidth:0,borderColor:c,barPercentage:1,categoryPercentage:.6}]}),[e,c]),u=B(()=>({responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{display:!1,max:t,grid:{display:!1},ticks:{color:o.textColor}},y:{display:!1,ticks:{color:o.textColor}}},plugins:{tooltip:{enabled:!1}},animation:!1}),[t,o]);return W(`div`,{style:{height:i,width:`100%`},children:W(nr,{data:l,options:u})})}const ls=L(cs);ls.displayName=`SingleBarChart`;function us({data:e,maxItems:t=10,theme:n=`light`,className:r}){let i=Xo(n===`dark`);return W(K,{className:r,sx:{width:`100%`},children:B(()=>ss(e,t),[e,t]).map(t=>G(rt,{children:[G(K,{sx:{display:`flex`,alignItems:`center`,width:`100%`,"&:hover":{bgcolor:`action.hover`},px:1.5},children:[W(Z,{title:t.label,placement:`top-start`,children:W(Y,{sx:{width:`14em`,fontSize:`0.875rem`,color:t.isSpecial?`grey.400`:`inherit`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label})}),W(K,{sx:{display:`flex`,height:`2em`,width:`10em`},children:W(ls,{count:t.count,total:e.valids,color:i.current,theme:n})}),W(Z,{title:String(t.count),placement:`top-start`,children:W(Y,{sx:{ml:2.5,mr:1,fontSize:`0.875rem`,width:`4em`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:as(t.count)})}),W(Y,{sx:{color:`grey.400`,fontSize:`0.875rem`,width:`4em`},children:os(t.count/e.valids)})]}),W(Tt,{})]},t.label))})}const ds=L(us);ds.displayName=`TopKSummaryList`;function fs({baseData:e,currentData:t,maxItems:n=10,showComparison:r=!1,theme:i=`light`,title:a,className:o}){let s=i===`dark`,c=Xo(s),l=Yo(s),u=B(()=>ss(t,n),[t,n]),d=B(()=>e?ss(e,n):[],[e,n]),f=r&&e&&d.length>0,p=t.valids||1,m=e?.valids||1,h=B(()=>u.map((e,t)=>({current:e,base:f?d[t]??null:null})).filter(({current:e,base:t})=>!(e.label===`(others)`&&e.count===0&&(!t||t.count===0))),[u,d,f]),g=B(()=>{let e=h.map(({current:e})=>e.label),t=[{label:`Current`,data:h.map(({current:e})=>e.count/p),backgroundColor:c.current,hoverBackgroundColor:c.current,borderWidth:0,borderRadius:3,barPercentage:f?.9:1,categoryPercentage:f?.75:.6}];return f&&t.push({label:`Base`,data:h.map(({base:e})=>(e?.count??0)/m),backgroundColor:c.base,hoverBackgroundColor:c.base,borderWidth:0,borderRadius:3,barPercentage:.9,categoryPercentage:.75}),{labels:e,datasets:t}},[h,c,f,p,m]),_=B(()=>({responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,layout:{padding:{right:80}},scales:{x:{display:!1,grid:{display:!1}},y:{grid:{display:!1},ticks:{padding:8,color:e=>h[e.index]?.current.isSpecial?`#9ca3af`:l.textColor}}},plugins:{legend:{display:!!f,position:`top`,align:`center`,reverse:!0,labels:{boxWidth:32,boxHeight:12,borderRadius:3,useBorderRadius:!0,color:l.textColor}},tooltip:{mode:`index`,callbacks:{label:e=>{let t=e.parsed.x??0,n=e.dataset.label===`Base`?m:p,r=Math.round(t*n);return`${e.dataset.label}: ${as(r)} (${os(t)})`}}}},animation:!1}),[h,l,f,m,p]),v={id:`barLabels`,afterDatasetsDraw(e){let{ctx:t}=e;t.save(),t.font=`11px system-ui, sans-serif`,t.textBaseline=`middle`;let n=Yo(s);for(let r=0;r<e.data.datasets.length;r++){let i=e.data.datasets[r],a=i.label===`Base`?m:p,o=e.getDatasetMeta(r);for(let e=0;e<o.data.length;e++){let{x:r,y:s,base:c}=o.data[e],l=i.data[e]??0;if(l===0)continue;let u=Math.round(l*a),d=r-c,f=as(u),p=os(l),m=t.measureText(f).width;m+8<d?(t.fillStyle=n.barLabelColor,t.textAlign=`left`,t.fillText(f,c+4,s),t.fillStyle=n.secondaryTextColor,t.textAlign=`left`,t.fillText(p,r+4,s)):(t.fillStyle=n.textColor,t.textAlign=`left`,t.fillText(f,r+4,s),t.fillStyle=n.secondaryTextColor,t.fillText(p,r+4+m+4,s))}}t.restore()}},y=h.length*(f?46:32)+(f?30:0);return G(K,{className:o,sx:{width:`100%`,px:2,py:2},children:[a&&W(Y,{variant:`subtitle1`,sx:{fontWeight:500,mb:1},children:a}),W(`div`,{style:{height:Math.max(y,50)},children:W(nr,{data:g,options:_,plugins:[v]})})]})}const ps=L(fs);ps.displayName=`TopKBarChart`;function ms(e){switch(e){case`sql`:return Fn();case`yaml`:return In();default:return null}}function hs(e){return[zn.theme({"&":{backgroundColor:e?`#1e1e1e`:`#ffffff`,color:e?`#d4d4d4`:`#1f2937`},".cm-content":{caretColor:e?`#d4d4d4`:`#1f2937`,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:`13px`},".cm-gutters":{backgroundColor:e?`#252526`:`#f5f5f5`,color:e?`#858585`:`#6b7280`,border:`none`},".cm-activeLineGutter":{backgroundColor:e?`#2a2d2e`:`#e5e7eb`},".cm-activeLine":{backgroundColor:e?`#2a2d2e40`:`#f3f4f640`},".cm-changedLine":{backgroundColor:e?`#3d3d0050`:`#fff3c550`},".cm-changedText":{backgroundColor:e?`#5c5c0080`:`#fef08a80`},".cm-deletedChunk":{backgroundColor:e?`#5c1f1f50`:`#ffc5c550`},".cm-insertedChunk":{backgroundColor:e?`#1a4d1a50`:`#cefece50`}},{dark:e})]}function gs({original:e,modified:t,language:n=`text`,readOnly:r=!0,lineNumbers:i=!0,sideBySide:a=!0,height:o=`400px`,theme:s=`light`,onModifiedChange:c,className:l}){let u=V(null),d=V(null),f=s===`dark`;return z(()=>{if(!u.current)return;d.current&&=(d.current instanceof ar,d.current.destroy(),null);let o=[...hs(f)];i&&o.push(Vn());let s=ms(n);if(s&&o.push(s),r&&o.push(Ln.readOnly.of(!0)),c&&!r&&o.push(zn.updateListener.of(e=>{e.docChanged&&c(e.state.doc.toString())})),a)d.current=new ar({a:{doc:e,extensions:[...o]},b:{doc:t,extensions:[...o]},parent:u.current,orientation:`a-b`,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}});else{let n=[...o,or({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})];d.current=new zn({state:Ln.create({doc:t,extensions:n}),parent:u.current})}return()=>{d.current&&=(d.current instanceof ar,d.current.destroy(),null)}},[e,t,n,r,i,a,f,c]),W(K,{ref:u,className:l,sx:{height:o,width:`100%`,overflow:`auto`,border:`1px solid`,borderColor:f?`grey.700`:`grey.300`,borderRadius:1,"& .cm-editor":{height:`100%`},"& .cm-scroller":{overflow:`auto`},"& .cm-merge-view":{height:`100%`},"& .cm-merge-view > div":{height:`100%`}}})}const _s=L(gs);_s.displayName=`DiffEditor`;function vs({title:e,description:t,icon:n,actionLabel:r,onAction:i,secondaryActionLabel:a,onSecondaryAction:o,theme:s=`light`,paddingY:c=8,className:l,children:u}){let d=s===`dark`;return G(K,{className:l,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,py:c,px:4,height:`100%`,minHeight:200},children:[n&&W(K,{sx:{mb:2,color:d?`grey.500`:`grey.400`,"& svg":{width:48,height:48}},children:n}),W(Y,{variant:`h6`,sx:{fontWeight:500,color:d?`grey.300`:`grey.700`,mb:+!!t},children:e}),t&&W(Y,{variant:`body2`,sx:{color:d?`grey.400`:`grey.500`,maxWidth:400,mb:r||a?3:0},children:t}),(r||a)&&G(K,{sx:{display:`flex`,gap:2,mt:1},children:[r&&i&&W(q,{variant:`contained`,onClick:i,size:`small`,children:r}),a&&o&&W(q,{variant:`outlined`,onClick:o,size:`small`,children:a})]}),u&&W(K,{sx:{mt:3},children:u})]})}const ys=L(vs);ys.displayName=`EmptyState`;function bs(e,t=60){if(e.length<=t)return e;try{let n=new URL(e),r=n.hostname,i=n.pathname+n.search+n.hash;if(r.length>=t-3)return r.substring(0,t-3)+`...`;let a=t-r.length-3;return i.length>a?`${r}${i.substring(0,a)}...`:e}catch{return e.substring(0,t-3)+`...`}}function xs({isOpen:e,url:t,onConfirm:n,onCancel:r}){let i=V(null);return G(lt,{open:e,onClose:r,maxWidth:`sm`,fullWidth:!0,"aria-labelledby":`external-link-dialog-title`,children:[G(ft,{id:`external-link-dialog-title`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[W(K,{component:qt,sx:{color:`amber.500`,fontSize:20}}),`External Link`]}),W(X,{"aria-label":`close`,onClick:r,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),G(dt,{children:[W(Y,{sx:{mb:1.5},children:`This link will take you to an external website outside of Recce. Are you sure you want to continue?`}),W(K,{sx:{bgcolor:`grey.50`,p:1,borderRadius:1,border:`1px solid`,borderColor:`grey.200`},children:W(K,{component:`code`,sx:{fontSize:`0.875rem`,wordBreak:`break-all`,whiteSpace:`pre-wrap`,bgcolor:`transparent`,fontFamily:`monospace`},children:bs(t,100)})})]}),G(ut,{sx:{gap:1},children:[W(q,{ref:i,variant:`outlined`,onClick:r,children:`Cancel`}),W(q,{color:`iochmara`,variant:`contained`,onClick:n,children:`Open Link`})]})]})}function Ss(e,t){if(!e||e.startsWith(`/`)||e.startsWith(`#`)||e.startsWith(`?`))return!1;try{let n=new URL(e,window.location.origin);return!t.some(e=>n.hostname===e||n.hostname.endsWith(`.${e}`))}catch{return!1}}function Cs({href:e,children:t,internalDomains:n}){let[r,i]=H(!1),[a,o]=H(null),s=t=>{e&&Ss(e,n)&&(t.preventDefault(),o(e),i(!0))},c=()=>{a&&window.open(a,`_blank`,`noopener,noreferrer`),i(!1),o(null)},l=()=>{i(!1),o(null)},u=e?Ss(e,n):!1;return G(U,{children:[G(pt,{href:e,onClick:s,sx:{color:`primary.main`,textDecoration:`underline`,"&:hover":{color:`iochmara.600`}},target:`_blank`,rel:u?`noopener noreferrer`:void 0,children:[t,u&&` ↗`]}),W(xs,{isOpen:r,url:a||``,onConfirm:c,onCancel:l})]})}function ws({className:e,children:t,isDark:n=!1}){let r=/language-(\w+)/.exec(e||``),i=r?r[1]:void 0,a=String(t).replace(/\n$/,``);return!r&&!String(t).includes(`
6
- `)?W(K,{component:`code`,sx:{bgcolor:n?`grey.800`:`grey.100`,color:n?`grey.200`:`inherit`,px:1,py:.5,borderRadius:.5,fontSize:`0.9em`,fontFamily:`monospace`},children:t}):W(K,{sx:{my:2,borderRadius:1,overflow:`hidden`,fontSize:`0.875rem`},children:W(cr,{style:lr,language:i,PreTag:`div`,customStyle:{margin:0,borderRadius:`6px`,fontSize:`0.85em`},children:a})})}function Ts({content:e,fontSize:t=`0.875rem`,internalDomains:n=[]}){let r=F(),i=[window.location.hostname,`reccehq.com`,`datarecce.io`,`localhost`,...n];return W(K,{className:`markdown-content`,children:W(sr,{remarkPlugins:[ur],components:{a:({href:e,children:t})=>W(Cs,{href:e,internalDomains:i,children:t}),code:e=>W(ws,{...e,isDark:r}),p:({children:e})=>W(Y,{component:`p`,sx:{fontSize:t,mb:2,"&:last-child":{mb:0}},children:e}),h1:({children:e})=>W(Y,{sx:{fontSize:`1.25rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h2:({children:e})=>W(Y,{sx:{fontSize:`1.125rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h3:({children:e})=>W(Y,{sx:{fontSize:`1rem`,fontWeight:600,mb:2,mt:2},children:e}),ul:({children:e})=>W(K,{component:`ul`,sx:{pl:4,mb:2,listStyleType:`disc`},children:e}),ol:({children:e})=>W(K,{component:`ol`,sx:{pl:4,mb:2,listStyleType:`decimal`},children:e}),li:({children:e})=>W(K,{component:`li`,sx:{fontSize:t,mb:1},children:e}),blockquote:({children:e})=>W(K,{sx:{borderLeft:`3px solid`,borderLeftColor:r?`grey.600`:`grey.300`,pl:3,py:1,my:2,color:r?`grey.400`:`grey.600`,fontStyle:`italic`},children:e}),table:({children:e})=>W(K,{sx:{overflowX:`auto`,my:2},children:W(K,{component:`table`,sx:{width:`100%`,fontSize:t,border:`1px solid`,borderColor:r?`grey.700`:`grey.200`,borderRadius:1},children:e})}),thead:({children:e})=>W(K,{component:`thead`,sx:{bgcolor:r?`grey.800`:`grey.50`},children:e}),tbody:({children:e})=>W(K,{component:`tbody`,children:e}),tr:({children:e})=>W(K,{component:`tr`,sx:{borderBottom:`1px solid`,borderColor:r?`grey.700`:`grey.200`},children:e}),th:({children:e})=>W(K,{component:`th`,sx:{px:2,py:1,fontWeight:600,textAlign:`left`},children:e}),td:({children:e})=>W(K,{component:`td`,sx:{px:2,py:1},children:e}),hr:()=>W(K,{component:`hr`,sx:{my:3,borderColor:r?`grey.700`:`grey.200`}}),strong:({children:e})=>W(Y,{component:`strong`,sx:{fontWeight:600},children:e}),em:({children:e})=>W(Y,{component:`em`,sx:{fontStyle:`italic`},children:e}),del:({children:e})=>W(Y,{component:`del`,sx:{textDecoration:`line-through`,color:`grey.500`},children:e})},children:e})})}const Es=at(function({backgroundColor:e=`white`,blockSize:t,children:n,...r},i){return W(K,{ref:i,...r,sx:{overflowY:`auto`,overflowX:`hidden`,...r.sx},children:W(K,{sx:{backgroundColor:e,height:`100%`,blockSize:t},children:n})})});function Ds({children:e,direction:t=`horizontal`,sizes:n,minSizes:r=0,maxSizes:i,gutterSize:a=5,snapOffset:o=30,dragInterval:s=1,onDragEnd:c,onDrag:l,theme:u,style:d,className:f}){let p=F(),m=u?u===`dark`:p,h={display:`flex`,flexDirection:t===`horizontal`?`row`:`column`,height:`100%`,width:`100%`,...d};return W(K,{className:f,sx:{height:`100%`,width:`100%`,"& .gutter":{backgroundColor:`divider`,backgroundRepeat:`no-repeat`,backgroundPosition:`50%`,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:m?`grey.600`:`grey.300`}},"& .gutter.gutter-horizontal":{cursor:`col-resize`},"& .gutter.gutter-vertical":{cursor:`row-resize`}},children:W(dr,{style:h,direction:t,sizes:n,minSize:r,maxSize:i,gutterSize:a,snapOffset:o,dragInterval:s,onDragEnd:c,onDrag:l,children:e})})}const Os=L(Ds);Os.displayName=`SplitPane`;function ks(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return W(Os,{direction:`horizontal`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function As(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return W(Os,{direction:`vertical`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function js({warning:e,isDark:t}){return G(K,{sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`},children:[W(qt,{color:t?fr[400]:fr[600]}),W(K,{children:e})]})}function Ms({toolbar:e,warnings:t,warningStyle:n=`alert`,isDark:r}){return!e&&(!t||t.length===0)?null:G(K,{sx:{display:`flex`,alignItems:`center`,gap:1,px:1,py:.5,borderBottom:1,borderColor:`divider`,bgcolor:n===`amber`&&t&&t.length>0?r?fr[900]:fr[100]:r?`grey.900`:`grey.50`,color:n===`amber`&&t&&t.length>0?r?fr[200]:fr[800]:void 0},children:[n===`amber`?t?.map(e=>W(js,{warning:e,isDark:r},e)):t?.map(e=>W(mn,{severity:`warning`,sx:{py:0,fontSize:`0.75rem`},children:e},e)),W(K,{sx:{flex:1}}),e]})}function $(e){let{displayName:t,typeGuard:n,expectedRunType:r,screenshotWrapper:i,transformData:a,emptyState:o=`No data`,conditionalEmptyState:s}=e;function c({run:e,viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l},u){let d=F();if(!n(e))throw Error(`Run type must be ${r}`);let f=B(()=>a(e,{viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l,isDark:d}),[e,t,c,l,d]),p=s?.(e,t);return p==null?f?.renderNull?null:!f||f.isEmpty?f?.toolbar||f?.warnings&&f.warnings.length>0?G(K,{sx:{display:`flex`,flexDirection:`column`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:[W(Ms,{toolbar:f?.toolbar,warnings:f?.warnings,warningStyle:f?.warningStyle,isDark:d}),W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,flex:1},children:f?.emptyMessage??o})]}):W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:o}):i===`grid`?G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,W(Ms,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),W(is,{ref:u,style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.875rem`,borderWidth:1},columns:f.columns??[],rows:f.rows??[],renderers:{noRowsFallback:W(ns,{emptyMessage:f.noRowsMessage})},defaultColumnOptions:f.defaultColumnOptions}),f.footer]}):G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,W(Ms,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),W(Es,{ref:u,backgroundColor:d?`#1f2937`:`white`,sx:{height:`100%`},children:f.content}),f.footer]}):W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:p})}return c.displayName=t,at(c)}const Ns=`0.1.0`;function Ps(e){return x(e)}const Fs=$({displayName:`HistogramDiffResultView`,typeGuard:Ps,expectedRunType:`histogram_diff`,screenshotWrapper:`box`,conditionalEmptyState:e=>{let t=e.result?.base,n=e.result?.current;return!t||!n?W(`div`,{children:`Loading...`}):null},transformData:(e,{isDark:t})=>{let n=e.params,r=e.result?.base,i=e.result?.current,a=e.result?.min,o=e.result?.max,s=e.result?.bin_edges??[];if(!r||!i)return{isEmpty:!0};let c=e.params?.column_type??`numeric`,l=c===`datetime`?`datetime`:c===`string`?`string`:`numeric`;return{content:G(K,{sx:{display:`flex`,flexDirection:`row`},children:[W(K,{sx:{flex:1}}),W(K,{sx:{width:`80%`,height:`35vh`,m:4},children:W(ts,{title:`Model ${n.model}.${n.column_name}`,dataType:l,baseData:{counts:r.counts},currentData:{counts:i.counts},min:a,max:o,samples:r.total,binEdges:s,theme:t?`dark`:`light`})}),W(K,{sx:{flex:1}})]})}}});function Is({model:e,row:t,singleEnv:n,cllRunning:r,showMenu:i=!0,onViewCode:a,isImpacted:o}){let s=ce(),{isActionAvailable:c}=j(),{runAction:l}=N(),{featureToggles:u}=me(),{name:d,baseType:f,currentType:p,baseIndex:m,currentIndex:h,reordered:g,definitionChanged:_}=t,v=p??f??t.type,y=m===void 0&&h!==void 0,b=m!==void 0&&h===void 0,x=!y&&!b&&f!==p,S=!y&&!b&&(f!==p||g===!0),C=n?`unchanged`:y?`added`:b?`removed`:x?`type_changed`:_?`definition_changed`:`unchanged`,[w,T]=H(null),E=!!w,ee=e=>{e.stopPropagation(),T(e.currentTarget)},D=()=>{T(null)},O=()=>{l(`profile_diff`,{model:e.name,columns:[d]},{showForm:!1,trackProps:{action:`profile_diff`,source:`schema_column_menu`,node_count:1}})},k=()=>{l(`histogram_diff`,{model:e.name,column_name:d,column_type:v},{showForm:!1,trackProps:{action:`histogram_diff`,source:`schema_column_menu`,node_count:1}})},te=()=>{l(`top_k_diff`,{model:e.name,column_name:d,k:50},{showForm:!1,trackProps:{action:`top_k_diff`,source:`schema_column_menu`,node_count:1}})},ne=()=>{l(`value_diff`,{model:e.name,columns:[d]},{showForm:!0,trackProps:{action:`value_diff`,source:`schema_column_menu`,node_count:1}})},re=!f||!p;return W(Z,{title:ii({name:d,status:C,baseType:f,currentType:p,cllAvailable:!(s===void 0||!c(`change_analysis`)||m!==void 0&&h===void 0)}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`3px`},children:[S&&W(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`}),y&&W(`span`,{className:`schema-change-badge schema-change-badge-added`,children:`+`}),b&&W(`span`,{className:`schema-change-badge schema-change-badge-removed`,children:`-`}),o&&!y&&!b&&!S&&!_&&W(`span`,{className:`schema-change-badge schema-change-badge-impacted`,children:`!`}),_&&W(Z,{title:`Definition changed — click to view code`,placement:`top`,onMouseOver:e=>e.stopPropagation(),children:a?W(`button`,{type:`button`,className:`schema-change-badge schema-change-badge-changed schema-change-badge-clickable`,onClick:e=>{e.stopPropagation(),a()},children:`~`}):W(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`})}),W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:d}),x?G(K,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:`0.125rem`,ml:`0.25rem`,fontSize:`1.6rem`},children:[f&&W(K,{component:`span`,sx:{textDecoration:`line-through`,opacity:.6},children:W(oi,{type:f,disableTooltip:!0})}),W(K,{component:`span`,sx:{fontSize:`0.7em`,opacity:.5},children:`→`}),p&&W(oi,{type:p,disableTooltip:!0})]}):v&&W(K,{component:`span`,sx:{ml:`0.25rem`,fontSize:`1.6rem`},children:W(oi,{type:v,disableTooltip:!0})}),W(K,{sx:{flex:1}}),r&&W(Et,{size:12,color:`inherit`}),i&&!n&&e.resource_type!==`source`&&G(U,{children:[W(X,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:u.disableDatabaseQuery,onClick:ee,children:W(vn,{})}),G(gn,{anchorEl:w,open:E,onClose:D,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[W(bn,{sx:{m:0,p:`4px 12px`,lineHeight:`20px`},children:`Diff`}),W(Q,{onClick:()=>{O(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Profile Diff`}),W(Q,{onClick:()=>{k(),D()},disabled:re||(v?!na(v):!0),sx:{fontSize:`0.85rem`},children:`Histogram Diff`}),W(Q,{onClick:()=>{te(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Top-k Diff`}),W(Q,{onClick:()=>{ne(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Value Diff`})]})]})]})})}function Ls(e,t,n,r){return i=>{let a=i.data;return a?W(Is,{model:e,row:a,cllRunning:t?.get(a.name)??!1,showMenu:n,onViewCode:r,isImpacted:a.isImpacted}):null}}function Rs(e,t,n){return r=>{let i=r.data;return i?W(Is,{model:e,row:i,cllRunning:t?.get(i.name)??!1,singleEnv:!0,showMenu:n}):null}}function zs(e){if(!e.data)return null;let{baseIndex:t,currentIndex:n,reordered:r}=e.data;return r&&t!==void 0&&n!==void 0&&t!==n?G(`span`,{children:[W(`span`,{className:`schema-index-old`,children:t}),W(`span`,{className:`schema-index-new`,children:n})]}):W(`span`,{children:n===void 0?t??`-`:n??`-`})}function Bs(e={},t={}){let n={},r=Te(Object.keys(e),Object.keys(t));Object.entries(r).forEach(([e,t])=>{n[e]={name:e,reordered:t===`reordered`,__status:void 0}});let i=0;return Object.entries(e).forEach(([e,t])=>{t!=null&&(n[e].baseIndex=i+=1,n[e].baseType=t.type)}),i=0,Object.entries(t).forEach(([e,t])=>{t!=null&&(n[e].currentIndex=i+=1,n[e].currentType=t.type)}),n}function Vs(e,t={}){let{node:n,cllRunningMap:r,showMenu:i,columnChanges:a,onViewCode:o,impactedColumns:s,nodeId:c}=t,l=[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellRenderer:zs,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Ls(n,r,i,o):void 0,cellClass:`schema-column`,valueGetter:e=>{let t=e.data;return t?`${t.name}|${t.definitionChanged??!1}|${t.isImpacted??!1}`:``}}],u=Object.values(e);if(a)for(let e of u){let t=e.baseIndex===void 0,n=e.currentIndex===void 0,r=!t&&!n&&e.baseType!==e.currentType;a[e.name]===`modified`&&!t&&!n&&!r&&!e.reordered&&(e.definitionChanged=!0)}if(s&&c)for(let e of u){let t=`${c}_${e.name}`;s.has(t)&&(e.isImpacted=!0)}return{columns:l,rows:u}}function Hs(e={},t={}){let{node:n,cllRunningMap:r,showMenu:i}=t,a=Object.entries(e).filter(([e,t])=>t!=null).map(([e,t],n)=>({name:e,index:n+1,type:t.type,__status:void 0}));return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Rs(n,r,i):void 0,cellClass:`schema-column`}],rows:a}}function Us({columnName:e,primaryKeys:t}){return W(K,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:t.includes(e)&&W(yn,{})})}function Ws({params:e,column:t}){let{runAction:n}=N(),{featureToggles:r}=me(),[i,a]=H(null),o=!!i,s=e=>{a(e.currentTarget)},c=()=>{a(null)},l=(t,r)=>{n(`value_diff_detail`,{...e,...t},r)};return G(K,{sx:{display:`flex`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),W(K,{sx:{flex:1}}),W(X,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:r.disableDatabaseQuery,onClick:s,children:W(Lt,{})}),G(gn,{anchorEl:i,open:o,onClose:c,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[W(bn,{sx:{fontSize:`8pt`,lineHeight:`20px`},children:`Action`}),W(Q,{onClick:()=>{l({},{showForm:!0}),c()},sx:{fontSize:`10pt`},children:`Show mismatched values...`}),G(Q,{onClick:()=>{l({columns:[t]},{showForm:!1}),c()},sx:{fontSize:`10pt`},children:[`Show mismatched values for '`,t,`'`]})]})]})}function Gs({value:e}){let t=`N/A`;return e!=null&&(t=e>.9999&&e<1?`~99.99 %`:e<1e-4&&e>0?`~0.01 %`:`${(e*100).toFixed(2)} %`),W(K,{sx:{textAlign:`right`},children:t})}function Ks(e){return t=>{let n=t.data;return n?W(Us,{columnName:String(n[0]),primaryKeys:e}):null}}function qs(e){return t=>{let n=t.data,r=t.colDef?.field??``;return n?W(Ws,{column:String(n[r]),params:e}):null}}function Js(e){let t=e.data,n=e.colDef?.field??``;return t?W(Gs,{value:t[n]}):null}const Ys=[{key:`0`,name:`Column`,type:`text`},{key:`1`,name:`Matched`,type:`number`},{key:`2`,name:`Matched %`,type:`number`}];function Xs(e){let t=e.data;if(!t)return;let n=t[2];return n!=null&&n<1?`diff-cell-modified`:void 0}function Zs(e,t){let n=e==null,r=t==null;return n&&r?0:n?1:r?-1:e-t}const Qs={PRIMARY_KEY_INDICATOR:`__is_pk__`,COLUMN_NAME:`0`,MATCHED_COUNT:`1`,MATCHED_PERCENT:`2`};function $s(e,t){return[{field:Qs.PRIMARY_KEY_INDICATOR,headerName:``,width:30,maxWidth:30,sortable:!1,cellRenderer:Ks(e)},{field:Qs.COLUMN_NAME,headerName:`Column`,resizable:!0,cellRenderer:qs(t),cellClass:`cell-show-context-menu`},{field:Qs.MATCHED_COUNT,headerName:`Matched`,resizable:!0,cellClass:Xs},{field:Qs.MATCHED_PERCENT,headerName:`Matched %`,resizable:!0,sort:`asc`,comparator:Zs,cellRenderer:Js,cellClass:Xs}]}function ec(e,t){let{params:n}=t,r=Array.isArray(n.primary_key)?n.primary_key:[n.primary_key],i={...e.data,columns:Ys};return{columns:$s(r,n),rows:Ie(i)}}function tc(e){if(p(e)||S(e))return e.result?{kind:`query`,result:e.result}:null;if(w(e))return e.result?e.result.diff&&e.params?.primary_keys?{kind:`query_diff_joined`,result:e.result,primaryKeys:e.params.primary_keys}:{kind:`query_diff_separate`,result:e.result}:null;if(d(e))return!e.result||!e.params?null:{kind:`value_diff`,result:e.result,params:e.params};if(g(e)){if(!e.result||!e.params?.primary_key)return null;let t=e.params.primary_key,n=Array.isArray(t)?t:[t];return{kind:`value_diff_detail`,result:e.result,primaryKeys:n}}return f(e)?e.result?.current?{kind:`profile`,result:e.result}:null:v(e)?e.result?{kind:`profile_diff`,result:e.result}:null:T(e)?e.result?{kind:`row_count`,result:e.result}:null:y(e)&&e.result?{kind:`row_count_diff`,result:e.result}:null}function nc(e){let t=e.data;if(!t)return null;let n=e.colDef?.field??``,r=String(ze(t,n)??e.value??``),i=String(ze(t,`data_type`)??``)||void 0;return W(Z,{title:ii({name:r,currentType:i}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`6px`,overflow:`hidden`,height:`100%`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),i&&W(K,{component:`span`,sx:{fontSize:`1.6rem`},children:W(oi,{type:i,disableTooltip:!0})})]})})}function rc(e){let t=e.data;if(!t)return null;let n=e.colDef?.field??``,r=String(ze(t,n)??e.value??``),i=ze(t,`base__data_type`),a=i==null?void 0:String(i),o=ze(t,`current__data_type`),s=o==null?void 0:String(o),c=a!=null&&s!=null&&a!==s,l=s??a;return W(Z,{title:ii({name:r,baseType:a,currentType:s}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`6px`,overflow:`hidden`,height:`100%`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),c?G(K,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:`0.125rem`,fontSize:`1.6rem`},children:[W(K,{component:`span`,sx:{textDecoration:`line-through`,opacity:.6},children:W(oi,{type:a,disableTooltip:!0})}),W(K,{component:`span`,sx:{fontSize:`0.7em`,opacity:.5},children:`→`}),W(oi,{type:s,disableTooltip:!0})]}):l&&W(K,{component:`span`,sx:{fontSize:`1.6rem`},children:W(oi,{type:l,disableTooltip:!0})})]})})}function ic(e){if(!e)return!1;let t=e.toLowerCase();return t===`data_type`||t===`base__data_type`||t===`current__data_type`}function ac(e){let t=e.rows.length>0&&Object.hasOwn(e.rows[0],`base__data_type`),n=e.columns.filter(e=>{if(`children`in e&&e.children){let t=e.children.filter(e=>!ic(e.field));return t.length===0?!1:(e.children=t,!0)}return!ic(e.field)}).map(e=>{if(`children`in e&&e.children)return{...e,children:e.children.map(e=>{let t=e;return t.field?.toLowerCase()===`column_name`?{...t,cellRenderer:nc}:e})};let n=e;return n.field?.toLowerCase()===`column_name`?{...n,cellRenderer:t?rc:nc}:e});return{...e,columns:n}}function oc(e){return e.current?.columns.find(e=>e.name.toLowerCase()===`column_name`)?.name??`column_name`}function sc(e,t={}){let n=tc(e);if(!n)return null;switch(n.kind){case`query`:return ke(n.result,{primaryKeys:t.primaryKeys,pinnedColumns:t.pinnedColumns,columnsRenderMode:t.columnsRenderMode,onPrimaryKeyChange:t.onPrimaryKeyChange,onPinnedColumnsChange:t.onPinnedColumnsChange,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`query_diff_separate`:return He(n.result.base,n.result.current,t);case`query_diff_joined`:return n.result.diff?Ee(n.result.diff,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,baseTitle:t.baseTitle,currentTitle:t.currentTitle,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}):null;case`value_diff`:return ec(n.result,{params:n.params});case`value_diff_detail`:return Ee(n.result,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`profile`:{if(!n.result.current)return null;let e=oc(n.result);return ac(ke(n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}))}case`profile_diff`:{let e=oc(n.result);return ac(He(n.result.base,n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}))}case`row_count`:return Fe(n.result);case`row_count_diff`:return Ae(n.result);default:return null}}function cc(e,t){switch(e.type){case`single`:return ke(e.dataframe,t??{});case`dual`:return He(e.base,e.current,t??{});case`joined`:return Ee(e.dataframe,e.primaryKeys,t??{});case`schema_diff`:{let n=t??{};return Vs(Bs(e.base,e.current),n)}case`schema_single`:return Hs(e.columns,t??{})}}function lc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=H(!e.columns||e.columns.length===0),a=e.model,{columns:o,isLoading:s,error:c}=Ql(e.model);z(()=>{n(!!a)},[a,n]);let l=o.map(e=>e.name);return s?W(K,{children:`Loading...`}):l.length===0||c?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):G(J,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Model`}),W(wn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Columns`}),W(dn,{control:W(un,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:l,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>W(wn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}const uc=e=>typeof e==`object`&&!!e&&`type`in e&&v(e),dc=$({displayName:`ProfileResultView`,typeGuard:e=>typeof e==`object`&&!!e&&`type`in e&&f(e),expectedRunType:`profile`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=sc(e,{pinnedColumns:t?.pinned_columns??[],onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]};return{columns:r.columns,rows:r.rows,isEmpty:r.columns.length===0}}}),fc=$({displayName:`ProfileDiffResultView`,typeGuard:uc,expectedRunType:`profile_diff`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.pinned_columns??[],i=t?.display_mode??`inline`,a=sc(e,{pinnedColumns:r,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},displayMode:i,columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]},o=W(Bo,{children:W(Zi,{displayMode:i,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}})});return{columns:a.columns,rows:a.rows,header:o,isEmpty:a.columns.length===0}}});function pc(e){return w(e)}const mc=$({displayName:`QueryDiffResultView`,typeGuard:pc,expectedRunType:`query_diff`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=e.result&&`diff`in e.result&&e.result.diff!=null,i,a;e.params&&e.params.current_model&&(i=`Original`,a=`Editor`);let o=t?.changed_only??!1,s=t?.pinned_columns??[],c=t?.display_mode??`inline`,l=t?.columnsRenderMode??{},u=r?[]:t?.primary_keys??[],d=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},f=r?void 0:e=>{n&&n({...t,primary_keys:e})},p=e=>{n&&n({...t,pinned_columns:e})},m;if(r&&e.result?.diff){let t=e.params?.primary_keys??[];m=Ee(e.result.diff,t,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c})}else m=He(e.result?.base,e.result?.current,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c,primaryKeys:u,onPrimaryKeyChange:f});let h=[];if(!r&&u.length>0){let e=u.join(`, `);m.invalidPKeyBase&&m.invalidPKeyCurrent?h.push(`Warning: The primary key '${e}' is not unique in the base and current environments`):m.invalidPKeyBase?h.push(`Warning: The primary key '${e}' is not unique in the base environment`):m.invalidPKeyCurrent&&h.push(`Warning: The primary key '${e}' is not unique in the current environment`)}let g=r?e.result?.diff?.limit??0:e.result?.current?.limit??0,_=r?e.result?.diff?.more:e.result?.current?.more||e.result?.base?.more;if(g>0&&_&&h.push(`Warning: Displayed results are limited to ${g.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`),m.columns.length===0)return{isEmpty:!0};let v=G(U,{children:[W(Zi,{displayMode:c,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),W(Yi,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&o&&m.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:v,warnings:h.length>0?h:void 0}:{columns:m.columns,rows:m.rows,warnings:h.length>0?h:void 0,toolbar:v,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function hc(e){return p(e)||S(e)}const gc=$({displayName:`QueryResultView`,typeGuard:hc,expectedRunType:`query`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n,onAddToChecklist:r})=>{let i=t?.pinned_columns??[],a=t?.columnsRenderMode??{},o=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},s=e=>{n&&n({...t,pinned_columns:e})};if(!e.result)return{isEmpty:!0};let c=ke(e.result,{pinnedColumns:i,onPinnedColumnsChange:s,columnsRenderMode:a,onColumnsRenderModeChanged:o});if(c.columns.length===0)return{isEmpty:!0};let l=e.result,u=l?l.limit??0:0,d=[];u>0&&l?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=r?W(q,{sx:{my:`5px`},size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{r(e)},children:`Add to Checklist`}):void 0;return{columns:c.columns,rows:c.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35}}}});function _c(e){return T(e)}function vc(e){return y(e)}function yc(e){if(!e.result)return null;let t=Fe(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}function bc(e){if(!e.result)return null;let t=Ae(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}const xc=$({displayName:`RowCountResultView`,typeGuard:_c,expectedRunType:`row_count`,screenshotWrapper:`grid`,transformData:yc,emptyState:`No nodes matched`}),Sc=$({displayName:`RowCountDiffResultView`,typeGuard:vc,expectedRunType:`row_count_diff`,screenshotWrapper:`grid`,transformData:bc,emptyState:`No nodes matched`});function Cc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=Ql(e.model),o=r.map(e=>e.name);return z(()=>{n(!!e.column_name)},[e,n]),i?W(K,{children:`Loading...`}):o.length===0||a?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):W(K,{sx:{m:`16px`},children:G(xn,{fullWidth:!0,children:[W(Sn,{sx:{mb:1},children:`Pick a column to show top-k`}),G(Cn,{value:e.column_name,onChange:n=>{let r=n.target.value;t({...e,column_name:r})},children:[W(`option`,{value:``,children:`Select column`}),o.map(e=>W(`option`,{value:e,className:`no-track-pii-safe`,children:e},e))]})]})})}function wc(e){return b(e)}function Tc({model:e,columnName:t}){return G(Y,{variant:`h5`,sx:{pt:4,textAlign:`center`,color:F()?`grey.200`:`grey.600`},children:[`Model `,e,`.`,t]})}function Ec({showAll:e,onToggle:t}){return W(K,{sx:{display:`flex`,p:5,justifyContent:`start`},children:W(pt,{component:`button`,onClick:t,sx:{color:`iochmara.main`,cursor:`pointer`},children:e?`View Only Top-10`:`View More Items`})})}function Dc(e,{viewOptions:t,onViewOptionsChanged:n,isDark:r}){let i=e.result,a=e.params;if(!i)return{isEmpty:!0};let o=i.base,s=i.current,c=t?.show_all??!1,l=!c,u=o.values.length>10||s.values.length>10?W(Ec,{showAll:c,onToggle:()=>{n&&n({...t,show_all:!c})}}):void 0;return{content:G(U,{children:[W(Tc,{model:a.model,columnName:a.column_name}),G(J,{direction:`row`,sx:{alignItems:`center`},children:[W(K,{sx:{flex:1}}),W(ps,{baseData:o,currentData:s,showComparison:!0,maxItems:l?10:void 0,theme:r?`dark`:`light`}),W(K,{sx:{flex:1}})]})]}),footer:u}}const Oc=$({displayName:`TopKDiffResultView`,typeGuard:wc,expectedRunType:`top_k_diff`,screenshotWrapper:`box`,emptyState:`No data`,transformData:Dc});function kc(e){return g(e)}const Ac=$({displayName:`ValueDiffDetailResultView`,typeGuard:kc,expectedRunType:`value_diff_detail`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.changed_only??!1,i=t?.pinned_columns??[],a=t?.display_mode??`inline`,o=t?.columnsRenderMode??{},s=e.params?.primary_key;if(!s||!e.result)return{isEmpty:!0};let c=Array.isArray(s)?s:[s],l=Ee(e.result,c,{changedOnly:r,pinnedColumns:i,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:o,onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},displayMode:a});if(l.columns.length===0)return{isEmpty:!0};let u=e.result?.limit??0,d=[];u>0&&e.result?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=G(U,{children:[W(Zi,{displayMode:a,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),W(Yi,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&l.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:f,warnings:d.length>0?d:void 0,warningStyle:`amber`}:{columns:l.columns,rows:l.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function jc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=H(!e.columns||e.columns.length===0),a=e.model,o=e.primary_key,{columns:s,primaryKey:c,isLoading:l,error:u}=Ql(e.model);z(()=>{!o&&c&&t({...e,primary_key:c})},[o,c,e,t]),z(()=>{n(!!(o&&a))},[o,a,n]);let d=s.map(e=>e.name),f=Array.isArray(o)?o:o?[o]:void 0;return l?W(K,{children:`Loading...`}):d.length===0||u?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):G(J,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Model`}),W(wn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Primary key`}),W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:(f??[]).filter(e=>e!==void 0),onChange:(n,r)=>{t({...e,primary_key:r.length===1?r[0]:r})},renderInput:e=>W(wn,{...e,placeholder:(f??[]).length===0?`Select primary key`:``,className:`no-track-pii-safe`})})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Columns`}),W(dn,{control:W(un,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>W(wn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}function Mc(e){return d(e)}function Nc({params:e,summary:t}){let n=t.total-t.added-t.removed;return G(K,{sx:{px:`16px`,pt:`5px`,pb:`5px`},children:[`Model: `,e.model,`, `,t.total,` total (`,n,` common,`,` `,t.added,` added, `,t.removed,` removed)`]})}function Pc(e){if(!e.result||!e.params)return{renderNull:!0};let t=ec(e.result,{params:e.params});return t?{columns:t.columns,rows:t.rows,isEmpty:!1,header:W(Nc,{params:e.params,summary:e.result.summary})}:{renderNull:!0}}const Fc=$({displayName:`ValueDiffResultView`,typeGuard:Mc,expectedRunType:`value_diff`,screenshotWrapper:`grid`,transformData:Pc}),Ic={lineage_diff:{title:`Lineage Diff`,icon:vr},schema_diff:{title:`Schema Diff`,icon:gr},query:{title:`Query`,icon:Sr,RunResultView:gc},query_base:{title:`Query Base`,icon:Sr,RunResultView:gc},query_diff:{title:`Query Diff`,icon:Sr,RunResultView:mc},row_count:{title:`Row Count`,icon:hr,RunResultView:xc},row_count_diff:{title:`Row Count Diff`,icon:hr,RunResultView:Sc},profile:{title:`Profile`,icon:xr,RunResultView:dc,RunForm:lc},profile_diff:{title:`Profile Diff`,icon:xr,RunResultView:fc,RunForm:lc},value_diff:{title:`Value Diff`,icon:_r,RunResultView:Fc,RunForm:jc},value_diff_detail:{title:`Value Diff Detail`,icon:_r,RunResultView:Ac,RunForm:jc},top_k_diff:{title:`Top-K Diff`,icon:mt,RunResultView:Oc,RunForm:Cc},histogram_diff:{title:`Histogram Diff`,icon:yr,RunResultView:Fs,RunForm:ra},sandbox:{title:`Sandbox`,icon:br},simple:{title:`Simple`,icon:br}};function Lc(e){return Ic[e]}const Rc=Ic;function zc(e){let t={...Ic};for(let[n,r]of Object.entries(e))r&&n in t&&(t[n]={...t[n],...r});return t}function Bc(e){return t=>e[t]}function Vc(e){return{id:e.run_id,name:e.name,type:e.type,status:e.status??`Finished`,runAt:e.run_at,checkId:e.check_id}}function Hc(){let{closeHistory:e,showRunId:t,runId:n}=N(),{featureToggles:r}=me(),{apiClient:i}=no(),a=mr(),o=nt(),{basePath:c}=se(),{data:u,isLoading:d}=tt({queryKey:O.runs(),queryFn:async()=>await l(i),retry:!1}),f=B(()=>(u??[]).map(Vc),[u]),p=R(e=>{Ze({name:`click_run`}),t(e,!1)},[t]),m=R(async e=>{Ze({name:`add_to_checklist`});let t=await s(e,void 0,i);await o.invalidateQueries({queryKey:O.checks()}),a.push(`${c}/checks/?id=${t.check_id}`)},[i,o,a.push,c]),h=R(e=>{Ze({name:`go_to_check`}),a.push(`${c}/checks/?id=${e}`)},[a.push,c]),g=R(()=>{Ze({name:`hide`}),e()},[e]),_=R(e=>{let t=Lc(e)?.icon;return t?W(t,{}):null},[]),v=W(X,{"aria-label":`Close History`,onClick:g,children:W(Jt,{})});return W(Po,{runs:f,selectedId:n,isLoading:d,onRunSelect:p,onAddToChecklist:m,onGoToCheck:h,getRunIcon:_,hideAddToChecklist:r.disableUpdateChecklist&&!r.checklistPermissionDenied,disableAddToChecklist:r.checklistPermissionDenied,title:`History`,headerActions:v,emptyMessage:`No runs`,loadingMessage:`Loading...`,groupByDate:!0,addToChecklistIcon:W(Ot,{}),goToCheckIcon:W(Dt,{color:`green`})})}const Uc=({size:e=16})=>G(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`path`,{d:`M12 16v-4`}),W(`path`,{d:`M12 8h.01`})]});function Wc({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,RunForm:o,onCancel:s,onExecuteClick:c,documentationUrl:l,InfoIcon:u=Uc}){let[d,f]=H(a??{}),[p,m]=H(null),[h,g]=H(!1),_=V(!1),v=()=>{_.current||s?.(),_.current=!1,t()};return G(lt,{open:e,onClose:v,maxWidth:`sm`,fullWidth:!0,scroll:`paper`,slotProps:{paper:{sx:{height:`75%`,minHeight:`400px`}}},children:[G(ft,{sx:{display:`flex`,alignItems:`center`},children:[i,` `,l&&G(U,{children:[W(X,{size:`small`,"aria-label":`Click this button to learn more about the SQL behind`,onMouseEnter:e=>m(e.currentTarget),onMouseLeave:()=>m(null),onClick:()=>window.open(l,`_blank`),children:W(K,{component:u,sx:{fontSize:`16px`}})}),W(Kn,{open:!!p,anchorEl:p,onClose:()=>m(null),anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},disableRestoreFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{sx:{bgcolor:`black`,color:`white`,p:1}}},children:G(Y,{sx:{fontSize:`0.875rem`},children:[`Click`,` `,W(pt,{href:l,target:`_blank`,sx:{textDecoration:`underline`,color:`white`,"&:hover":{color:`iochmara.300`}},children:`here`}),` `,`to learn more about the SQL behind`]})})]})]}),W(X,{"aria-label":`close`,onClick:v,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{sx:{p:0,overflow:`auto`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:W(K,{sx:{contain:`layout`},children:o&&W(o,{params:d,onParamsChanged:f,setIsReadyToExecute:g})})}),W(ut,{children:W(J,{direction:`row`,spacing:`10px`,children:W(q,{disabled:!h,color:`iochmara`,variant:`contained`,onClick:()=>{_.current=!0,c?.(),n(r,d)},children:`Execute`})})})]})}const Gc=e=>({value_diff:`https://docs.reccehq.com/features/lineage/#value-diff`,profile_diff:`https://docs.reccehq.com/features/lineage/#profile-diff`,histogram_diff:`https://docs.reccehq.com/features/lineage/#histogram-diff`,top_k_diff:`https://docs.reccehq.com/features/lineage/#top-k-diff`})[e]||null;function Kc({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s}){return W(Wc,{isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s,onCancel:()=>{Je(r)&&Xe({action:r,event:qe.CANCEL})},onExecuteClick:()=>{Je(r)&&Xe({action:r,event:qe.EXECUTE})},documentationUrl:Gc(r),InfoIcon:Bt})}const qc=at(function({isRunning:e,isAborting:t,progress:n,error:r,run:i,onCancel:a,viewOptions:o,onViewOptionsChanged:s,RunResultView:c,children:l,ErrorBoundary:u,errorBoundaryFallback:d},f){let p=F(),m=r?.response?.data?.detail??i?.error;if(m)return G(mn,{severity:`error`,sx:p?{bgcolor:`error.dark`,color:`common.white`,"& .MuiAlert-icon":{color:`common.white`}}:void 0,children:[`Error: `,W(`span`,{className:`no-track-pii-safe`,children:m})]});if(e||i?.status===`Running`){let e=`Loading...`;n?.message?e=n.message:i?.progress?.message&&(e=i.progress.message);let r=n?.percentage==null?void 0:n.percentage*100;return W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,p:`1rem`,height:`100%`,bgcolor:p?`grey.900`:`grey.50`},children:G(J,{spacing:2,sx:{alignItems:`center`},children:[G(J,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[r==null?W(Et,{size:32}):G(K,{sx:{position:`relative`,display:`inline-flex`},children:[W(Et,{variant:`determinate`,value:r,size:32}),W(K,{sx:{top:0,left:0,bottom:0,right:0,position:`absolute`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{variant:`caption`,component:`div`,sx:{fontSize:`0.6rem`},children:`${Math.round(r)}%`})})]}),t?W(Y,{children:`Aborting...`}):W(Y,{className:`no-track-pii-safe`,children:e})]}),!t&&W(q,{variant:`contained`,onClick:a,size:`small`,children:`Cancel`})]})})}if(!i)return W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:p?`grey.900`:`grey.50`,height:`100%`},children:W(Et,{size:32})});if(l&&c)throw Error(`RunView requires either a children or a RunResultView prop, but not both.`);if(!l&&!c)throw Error(`RunView requires at least one of children or RunResultView prop.`);return W(K,{sx:{height:`100%`,contain:`layout`,overflow:`auto`,bgcolor:p?`grey.900`:`grey.50`},className:`no-track-pii-safe`,children:(()=>{let e=c&&(i.error??i.result)?W(c,{ref:f,run:i,viewOptions:o,onViewOptionsChanged:s}):null,t=l?.({run:i,viewOptions:o,onViewOptionsChanged:s});return u&&e?G(U,{children:[W(u,{fallback:d,children:e}),t]}):G(U,{children:[e,t]})})()})});qc.displayName=`RunView`;const Jc=L(({type:e,params:t})=>{let n=F();return W(Za,{value:Nn.stringify({type:e,params:t},null,2),language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,height:`100%`,theme:n?`dark`:`light`,className:`no-track-pii-safe`})});Jc.displayName=`ParamView`;function Yc(e,t){return t!=null&&t>0?`${e} (${Ve(t)})`:e}const Xc=L(({open:e,rowCount:t,onContinue:n,onCancel:r})=>G(lt,{open:e,onClose:r,children:[W(ft,{children:`Large Export Warning`}),W(dt,{children:G(wr,{children:[`You are about to download `,W(`strong`,{children:Ve(t)}),`. This may take a while and produce a large file. Are you sure you want to continue?`]})}),G(ut,{children:[W(q,{onClick:r,children:`Cancel`}),W(q,{onClick:n,variant:`contained`,children:`Continue`})]})]}));Xc.displayName=`LargeExportWarningDialog`;const Zc=L(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i,label:a=`Export`})=>{let[o,s]=H(null),c=!!o,[l,u]=H(!1),[d,f]=H(null),p=i?.totalRowCount??0,m=p>1e5,h=e=>{s(e.currentTarget)},g=()=>{s(null)},_=e=>{m?(f(()=>e),u(!0)):(e(),g())};return G(U,{children:[W(q,{size:`small`,variant:`outlined`,color:`neutral`,onClick:h,endIcon:W(At,{}),sx:{textTransform:`none`},children:a}),G(gn,{anchorEl:o,open:c,onClose:g,children:[G(Q,{onClick:async()=>{await t(),g()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[W(Tr,{children:W(zt,{})}),W(Er,{children:`Copy as Image`})]}),G(Q,{onClick:async()=>{await i?.copyAsTSV?.(),g()},disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Ft,{})}),W(Er,{children:`Copy as Text`})]}),G(Q,{onClick:async()=>{await i?.copyAsCSV(),g()},disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Gt,{})}),W(Er,{children:`Copy as CSV`})]}),G(Q,{onClick:()=>_(()=>i?.downloadAsCSV()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as CSV`,i?.totalRowCount)})]}),G(Q,{onClick:()=>_(()=>i?.downloadAsTSV?.()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as TSV`,i?.totalRowCount)})]}),i?.downloadAsExcel&&G(Q,{onClick:()=>_(()=>i?.downloadAsExcel?.()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as Excel`,i?.totalRowCount)})]})]}),W(Xc,{open:l,rowCount:p,onContinue:()=>{u(!1),d?.(),f(null),g()},onCancel:()=>{u(!1),f(null)}})]})});Zc.displayName=`DefaultExportMenu`;const Qc=L(({runId:e,run:t,disableUpdateChecklist:n,checklistPermissionDenied:r,hasError:i,onGoToCheck:a,onAddToChecklist:o})=>{let s=t?.check_id,c=!e||!t?.result||i;return n&&!r?null:s?W(q,{disabled:c,size:`small`,variant:`contained`,onClick:()=>a?.(s),startIcon:W(Mt,{}),sx:{textTransform:`none`},children:`Go to Check`}):W(Z,{title:r?`You don't have permission to add checks`:``,children:W(`span`,{children:W(q,{disabled:c||r,size:`small`,variant:`contained`,onClick:o,startIcon:W(Mt,{}),sx:{textTransform:`none`},children:`Add to Checklist`})})})});Qc.displayName=`DefaultAddToCheckButton`;const $c=L(({run:e})=>{let t=e.status||(e.result?`Finished`:e.error?`Failed`:`unknown`),n=e=>{switch(e.toLowerCase()){case`finished`:return`success.main`;case`failed`:return`error.main`;case`running`:return`primary.main`;default:return`text.secondary`}},r=e.run_at?En(new Date(e.run_at),{addSuffix:!0}):`Unknown time`;return G(Y,{variant:`body2`,sx:{color:`text.secondary`},children:[W(K,{component:`span`,sx:{fontWeight:600,color:n(t)},children:t}),`・`,r]})});$c.displayName=`RunStatusAndDateDisplay`;function el({runId:e,run:t,isRunning:n,error:r,viewOptions:i,onViewOptionsChanged:a,isSingleEnvironment:o,disableDatabaseQuery:s,disableShare:c,disableUpdateChecklist:l,checklistPermissionDenied:u,onClose:d,onCancel:f,onRerun:p,onCopyAsImage:m,onCopyMouseEnter:h,onCopyMouseLeave:g,csvExport:_,onTrackCopyToClipboard:v,onGoToCheck:y,onAddToChecklist:b,SingleEnvironmentNotification:x,SqlEditorComponent:S,DualSqlEditorComponent:C,RunResultView:w,resultViewRef:T,children:E}){let ee=F(),[D,O]=H(`result`),[k,te]=H(!0),ne=t?.type===`query`||t?.type===`query_diff`||t?.type===`query_base`,re=!e||!t?.result||!!r||D!==`result`,A=R(async()=>{await m?.(),v&&v(t?.type??`unknown`,`run`)},[m,v,t?.type]),ie=t?.type===`query_diff`,j=t?.params;return G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,bgcolor:ee?`grey.900`:`grey.50`},children:[o&&k&&x&&W(x,{runType:t?.type,onClose:()=>te(!1)}),G(K,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,mb:`1px`},children:[G(On,{value:D,onChange:(e,t)=>O(t),children:[W(Dn,{label:`Result`,value:`result`}),W(Dn,{label:`Params`,value:`params`}),ne&&W(Dn,{label:`Query`,value:`query`})]}),W(K,{sx:{flexGrow:1}}),G(J,{direction:`row`,spacing:1,sx:{alignItems:`center`,overflow:`hidden`,pr:1},children:[t&&W($c,{run:t}),W(q,{variant:`outlined`,color:`neutral`,disabled:!e||n||s,size:`small`,onClick:p,startIcon:W(Wt,{}),sx:{textTransform:`none`},children:`Rerun`}),W(Zc,{run:t,disableExport:re,onCopyAsImage:A,onMouseEnter:h,onMouseLeave:g,csvExport:_,label:c?`Export`:`Share`}),W(Qc,{runId:e,run:t,disableUpdateChecklist:l,checklistPermissionDenied:u,hasError:!!r,onGoToCheck:y,onAddToChecklist:b}),W(X,{size:`small`,onClick:d,children:W(wt,{})})]})]}),D===`result`&&(w||E)&&W(qc,{ref:T,isRunning:n,error:r,run:t,onCancel:f,viewOptions:i,onViewOptionsChanged:a,RunResultView:w,children:E}),D===`params`&&t&&W(Jc,{type:t.type,params:t.params}),D===`query`&&t&&ne&&j?.sql_template&&W(U,{children:ie&&C?W(C,{value:j.sql_template,baseValue:j.base_sql_template,readOnly:!0}):S?W(S,{value:j.sql_template,readOnly:!0}):W(Za,{value:j.sql_template,language:`sql`,readOnly:!0,theme:`dark`,height:`100%`})})]})}const tl=L(el);tl.displayName=`RunResultPane`;const nl=e=>G(K,{sx:{display:`flex`,flex:1,minHeight:`48px`,m:`4px`,px:`16px`,py:`12px`,bgcolor:`primary.50`,border:`1px solid`,borderRadius:`4px`,borderColor:`primary.400`,alignItems:e.align??`center`,gap:`12px`},children:[W(K,{component:Dr,sx:{width:`20px`,height:`20px`,color:`primary.900`}}),e.children,W(K,{sx:{flexGrow:1}}),W(X,{size:`small`,onClick:e.onClose,children:W(wt,{})})]}),rl=()=>G(pt,{href:`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,target:`_blank`,sx:{color:`primary.main`,fontWeight:`bold`,textDecoration:`underline`,display:`inline-flex`,alignItems:`center`,gap:.5},children:[`Learn how `,W(ht,{})]});function il({value:e,onChange:t,onRun:n,onRunBase:r,onRunDiff:i,label:a,CustomEditor:o,options:s={},manifestData:c,schemas:l,...u}){let{featureToggles:d}=me(),f=F(),p=e=>{t&&t(e)},m=``;c&&(m=c.generated_at?Me(c.generated_at):``);let h=B(()=>{let e=[];return n&&e.push({key:`Mod-Enter`,run:()=>(n(),!0)}),r&&e.push({key:`Alt-Enter`,run:()=>(r(),!0)}),i&&e.push({key:`Mod-Shift-Enter`,run:()=>(i(),!0)}),e},[n,r,i]);return G(U,{children:[(a??n??r)&&G(J,{direction:`row`,sx:{bgcolor:vt(f?P.neutral[600]:P.neutral[200],.7),height:`40px`,minHeight:`40px`,fontSize:`14px`,alignItems:`center`,m:0,p:`0px 16px`,flex:`0 0 40px`},children:[W(Y,{component:`strong`,sx:{fontWeight:`bold`},className:`no-track-pii-safe`,children:a?a.toUpperCase():``}),c&&G(`span`,{className:`ml-1`,children:[`(`,l&&G(`span`,{className:`no-track-pii-safe`,children:[l,`, `]}),W(`span`,{children:m}),`)`]}),W(K,{sx:{flexGrow:1}}),(n??r)&&W(q,{size:`xsmall`,variant:`outlined`,onClick:n??r,sx:{bgcolor:`background.paper`,p:`6px 12px`},disabled:d.disableDatabaseQuery,startIcon:W(Or,{}),children:`Run Query`})]}),o??W(Za,{value:e,onChange:p,language:`sql`,readOnly:s.readOnly??!1,lineNumbers:s.lineNumbers!==`off`,wordWrap:s.wordWrap!==`off`,fontSize:s.fontSize??16,keyBindings:h,theme:f?`dark`:`light`,className:`no-track-pii-safe max-h-dvh h-full`})]})}function al({value:e,baseValue:t,onChange:n,onChangeBase:r,onRun:i,onRunBase:a,onRunDiff:o,options:s={},labels:c,SetupGuide:l,...u}){let d=c?c[0]:`Base`,f=c?c[1]:`Current`,{envInfo:p,lineageGraph:m}=j(),h,g;p?.dbt?.base&&p.dbt.current&&(h=p.dbt.base,g=p.dbt.current);let[_,v]=Be(m);return W(U,{children:G(J,{direction:`row`,sx:{height:`100%`,gap:0},children:[W(J,{sx:{height:`100%`,width:`50%`,gap:0,borderRight:`1px solid`,borderRightColor:`divider`},children:W(il,{label:d,value:t??``,onChange:r,onRunBase:a,options:s,CustomEditor:l,manifestData:h??void 0,schemas:Array.from(_).join(`, `),...u})}),W(J,{sx:{height:`100%`,width:`50%`,gap:0},children:W(il,{label:f,value:e,onChange:n,onRun:i,options:s,manifestData:g??void 0,schemas:Array.from(v).join(`, `),...u})})]})})}const ol=({runType:e,onClose:t})=>{switch(e){case`row_count`:return W(nl,{onClose:t,children:G(Y,{children:[`Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. `,W(rl,{})]})});case`profile`:return W(nl,{onClose:t,children:G(Y,{children:[`Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against.`,` `,W(rl,{})]})});default:return null}},sl=({value:e,readOnly:t})=>W(il,{value:e,options:{readOnly:t}}),cl=({value:e,baseValue:t,readOnly:n})=>W(al,{value:e,baseValue:t,options:{readOnly:n}}),ll=({runId:e,onClose:t,isSingleEnvironment:n})=>{let{featureToggles:r}=me(),{runAction:i}=N(),{error:a,run:o,onCancel:c,isRunning:l}=$l(e),[u,d]=H(),f=nt(),p=mr(),{apiClient:m}=no(),{basePath:h}=se(),g;o&&E(o.type)&&(g=Lc(o.type).RunResultView);let{ref:_,onCopyToClipboard:v,onMouseEnter:y,onMouseLeave:b}=Bl(),x=Gl({run:o,runId:e,viewOptions:u}),S=R(()=>{o&&i(o.type,o.params)},[o,i]),C=R(async()=>{await v(),Ye({type:o?.type??`unknown`,from:`run`})},[v,o?.type]),w=R(e=>{p.push(`${h}/checks/?id=${e}`)},[p.push,h]),T=R(async()=>{if(e)try{let t=await s(e,u,m);await f.invalidateQueries({queryKey:O.checks()}),p.push(`${h}/checks/?id=${t.check_id}`)}catch(e){re(e)&&e.status===403?I.error({title:`Permission denied`,description:`You don't have permission to add checks. Contact your org admin for access.`}):I.error({title:`Failed to create check`,description:e instanceof Error?e.message:`An unexpected error occurred`})}},[e,u,m,f,p.push,h]);return W(tl,{runId:e,run:o,isRunning:l,error:a,viewOptions:u,onViewOptionsChanged:d,isSingleEnvironment:n,disableDatabaseQuery:r.disableDatabaseQuery,disableShare:r.disableShare,disableUpdateChecklist:r.disableUpdateChecklist,checklistPermissionDenied:r.checklistPermissionDenied,onClose:t,onCancel:c,onRerun:S,onCopyAsImage:C,onCopyMouseEnter:y,onCopyMouseLeave:b,csvExport:x,onGoToCheck:w,onAddToChecklist:T,SingleEnvironmentNotification:ol,SqlEditorComponent:sl,DualSqlEditorComponent:cl,RunResultView:g,resultViewRef:_})},ul=({onClose:e,isSingleEnvironment:t})=>{let{runId:n}=N();return W(ll,{runId:n,onClose:e,isSingleEnvironment:t})};function dl({error:e,resetError:t}){let{background:n,text:r}=eu();return W(K,{sx:{height:`100%`,bgcolor:n.subtle,display:`flex`,alignItems:`center`,justifyContent:`center`},children:G(K,{sx:{p:4,display:`flex`,flexDirection:`column`,justifyContent:`flex-start`,bgcolor:`background.paper`,border:`solid 1px`,borderColor:`divider`,minHeight:`200px`},children:[W(Y,{variant:`h6`,sx:{width:`800px`},children:`You have encountered an error`}),W(K,{sx:{flex:1,fontSize:`10pt`,color:r.secondary},children:String(e)}),W(q,{sx:{justifySelf:`center`,alignSelf:`center`,mt:`20px`},color:`iochmara`,variant:`contained`,size:`small`,onClick:t,children:`Reset`})]})})}const fl=e=>W(dl,{error:e.error,resetError:e.resetError}),pl=({children:e,fallback:t=fl})=>W(kr,{fallback:t,children:e}),ml=at(function(e,t){return W(qc,{...e,ErrorBoundary:pl,errorBoundaryFallback:$e,ref:t})});ml.displayName=`RunViewOss`;const hl={mode:`per_node`,status:`pending`,completed:0,total:0,actions:{}},gl=(e,t)=>{let{onActionStarted:n,onActionNodeUpdated:i,onActionCompleted:o,onTrackAction:s,trackingSource:c=`lineage_view_top_bar`}=t,l=k(),u=V({...hl}).current,{showRunId:d}=N(),f=async(t,r,s)=>{u.mode=`multi_nodes`,u.actions={};let c=u.mode,f=u.actions;n(),u.status=`running`;let p=[];for(let t of e){let e=r(t);e?(f[t.id]={mode:c,status:`skipped`,skipReason:e},i(t)):(f[t.id]={mode:c,status:`pending`},p.push(t))}let h=s(p);try{let{run_id:e}=await a(t,h,{nowait:!0},l);for(d(e),u.currentRun={run_id:e},u.total=1;;){let t=await m(e,2,l);u.currentRun=t;let n=t.error?`failure`:t.result?`success`:`running`;for(let e of p)f[e.id]={mode:c,status:n,run:t},i(e);if(t.error||t.result)break}}catch{}if(u.completed=1,u.status===`canceling`){u.status=`canceled`,o();return}u.status=`completed`,o()},p=async(t,r)=>{u.mode=`per_node`,u.actions={};let s=u.mode,c=u.actions;n(),u.status=`running`;for(let t of e)c[t.id]={mode:s,status:`pending`},i(t);u.completed=0,u.total=e.length;for(let n of e){let{params:e,skipReason:d}=r(n);if(d)c[n.id]={mode:s,status:`skipped`,skipReason:d},i(n);else try{let{run_id:r}=await a(t,e,{nowait:!0},l);for(u.currentRun={run_id:r},c[n.id]={mode:s,status:`running`},i(n);;){let e=await m(r,2,l);u.currentRun=e;let t=e.error?`failure`:e.result?`success`:`running`;if(c[n.id]={mode:s,status:t,run:e},i(n),e.error||e.result)break}}catch{}finally{u.currentRun=void 0}if(u.completed++,u.status===`canceling`){u.status=`canceled`,o();return}}u.status=`completed`,o()};return{actionState:u,runRowCount:async()=>{s?.({action:`row_count`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runRowCountDiff:async()=>{s?.({action:`row_count_diff`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count_diff`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runValueDiff:async()=>{s?.({action:`value_diff`,source:c,node_count:e.length}),await p(`value_diff`,e=>({skipReason:`No primary key found. The first unique column is used as primary key.`}))},addLineageDiffCheck:async()=>await ee({node_ids:e.map(e=>e.id)},l),addSchemaDiffCheck:async()=>{let t;return t=e.length===1?await _({node_id:e[0].id},l):await _({node_id:e.map(e=>e.id)},l),t},cancel:async()=>{u.status=`canceling`,u.currentRun?.run_id&&await r(u.currentRun.run_id,l)},reset:()=>{Object.assign(u,hl)}}};function _l(e){let[t,n]=H(!1),[r,i]=H(0),[a,o]=H(),s=V(null),c=R(e=>(i(e),new Promise(e=>{o(()=>e),n(!0)})),[]),l=()=>{e?.onConfirm?.(r),a?.(!0),n(!1)},u=()=>{e?.onCancel?.(r),a?.(!1),n(!1)};return{confirm:c,AlertDialog:G(lt,{open:t,onClose:u,maxWidth:`md`,fullWidth:!0,"aria-labelledby":`value-diff-alert-dialog-title`,children:[G(ft,{id:`value-diff-alert-dialog-title`,sx:{fontSize:`1.125rem`,fontWeight:`bold`},children:[`Value Diff on `,r,` nodes`]}),W(X,{"aria-label":`close`,onClick:u,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{children:W(J,{spacing:`20px`,children:G(K,{children:[`Value diff will be executed on `,r,` nodes in the Lineage, which can add extra costs to your bill.`]})})}),G(ut,{sx:{gap:.5},children:[W(q,{ref:s,onClick:u,variant:`outlined`,color:`neutral`,children:`Cancel`}),W(q,{color:`iochmara`,variant:`contained`,onClick:l,sx:{ml:1.5},children:`Execute`})]})]})}}function vl({connect:e,idleSeconds:t}){return G(U,{children:[W(ft,{children:`Server Disconnected`}),W(dt,{children:t!=null&&t>0?G(Y,{children:[`The server has been idle for `,Re(t),` and was automatically stopped. Please restart the Recce server to continue.`]}):W(Y,{children:`The server connection has been lost. Please restart the Recce server and try again.`})}),W(ut,{children:W(q,{color:`iochmara`,variant:`contained`,onClick:()=>{e()},children:`Retry`})})]})}function yl({shareUrl:e,mode:t,supportCalendarUrl:n,LinkComponent:r}){let i={"read only":{title:`Share Instance Expired`,body:`This Share Instance has expired. Please restart the share instance.`,action:`Restart`,link:e},"metadata only":{title:`Preview Instance Expired`,body:`This Preview Instance has expired. To browse more, please book a meeting with us.`,action:`Contact us`,link:n}}[t],a=W(q,{color:`iochmara`,variant:`contained`,children:i.action});return G(U,{children:[W(ft,{children:i.title}),W(dt,{children:W(Y,{children:i.body})}),W(ut,{children:t===`read only`?W(r||`a`,{href:i.link,children:a}):W(q,{color:`iochmara`,variant:`contained`,onClick:()=>window.open(i.link,`_blank`),children:i.action})})]})}function bl({enabled:e=!0,baseUrl:t,apiPrefix:n}={}){let[r,i]=H(void 0),a=V({ws:void 0,status:`pending`,artifactsUpdatedToastId:void 0}),[o,s]=H(e?`pending`:`connected`),[c,l]=H(void 0);z(()=>{a.current.status=o},[o]),z(()=>{a.current.artifactsUpdatedToastId=r},[r]);let u=nt(),d=R(()=>{u.invalidateQueries({queryKey:O.lineage()}),u.invalidateQueries({queryKey:O.checks()}),u.invalidateQueries({queryKey:O.runs()})},[u]),f=R(()=>{function e(e){return e.replace(/(http)(s)?:\/\//,`ws$2://`)}let r=t??Ge,o=n?`${n}/ws`:`/api/ws`,c=new WebSocket(`${e(r)}${o}`);a.current.ws=c,c.onopen=()=>{c.send(`ping`)},c.onmessage=e=>{if(e.data===`pong`){a.current.status===`disconnected`&&d(),s(`connected`);return}try{let t=JSON.parse(e.data);if(t.command===`refresh`){let{eventType:e,srcPath:n}=t.event,[r,o]=n.split(`/`).slice(-2),s=o.replace(/\.[^/.]+$/,``),c=`${r}-${s}-${e}`;a.current.artifactsUpdatedToastId??i(I.create({id:c,description:`Detected ${r} ${s} ${e}`,type:`info`,duration:5e3,closable:!0})),d()}else if(t.command===`relaunch`)l(`relaunch`);else{let{id:e,title:n,description:r,status:a,duration:o}=t.event;i(I.create({id:e||`broadcast`,title:n,description:r,type:a??`info`,duration:o??5e3,closable:!0}))}}catch(e){console.error(e)}},c.onerror=e=>{console.error(`An error occurred during Handling WebSockets`,e)},c.onclose=()=>{s(e=>e===`connected`?`disconnected`:e),a.current.ws=void 0}},[d,t,n]);return z(()=>{if(!e)return;let t=a.current;return f(),()=>{t.ws&&t.ws.close()}},[f,e]),{connectionStatus:o,connect:f,envStatus:c}}function xl({children:t}){let{idleTimeout:n,remainingSeconds:r,isEnabled:i,setDisconnected:a,resetConnection:o}=ae(),{apiClient:s,apiPrefix:c,baseUrl:l}=no(),u=tt({queryKey:O.lineage(),queryFn:()=>e(s)}),d=tt({queryKey:O.runsAggregated(),queryFn:()=>C(s)}),f=B(()=>{let e=u.data?.lineage;if(e?.nodes)return le(e)},[u.data]),p=u.error?.message,{state_metadata:m,lineage:h,sqlmesh:g,demo:_,codespace:v,review_mode:y,cloud_mode:b,file_mode:x,filename:S,adapter_type:w,git:T,pull_request:E,support_tasks:ee}=u.data??{demo:!1},D={stateMetadata:m,adapterType:w,git:T,pullRequest:E,dbt:{base:h?.metadata?.base?.manifest_metadata,current:h?.metadata?.current?.manifest_metadata},sqlmesh:g},{connectionStatus:k,connect:ne,envStatus:re}=bl({enabled:!0,baseUrl:l,apiPrefix:c});z(()=>{k===`disconnected`?a():k===`connected`&&o()},[k,a,o]);let{data:A,isLoading:ie}=fe(),{featureToggles:j,shareUrl:M}=me(),[se,N]=H(!1),[ce,ue]=H(!1),de=nt(),pe=!ie&&re===`relaunch`&&A?.single_env_onboarding===!0&&A.show_relaunch_hint;pe!==ce&&(ue(pe),N(pe)),z(()=>{pe&&se&&Qe({action:`target_base_added`})},[pe,se]);let he=()=>{N(!1),te(s),de.invalidateQueries({queryKey:O.flag()})},ge=R(()=>{d.refetch()},[d]),_e=R(()=>{d.refetch()},[d]);return G(U,{children:[W(oe,{lineageGraph:f,envInfo:D,reviewMode:y,cloudMode:b,fileMode:x,fileName:S,isDemoSite:_??!1,isCodespace:v,isLoading:u.isLoading,error:p,supportTasks:ee,onRefetchLineageGraph:ge,runsAggregated:d.data,onRefetchRunsAggregated:_e,children:t}),W(lt,{open:k===`disconnected`,onClose:()=>void 0,children:M&&j.mode!==null?W(yl,{shareUrl:M,mode:j.mode,supportCalendarUrl:Ke,LinkComponent:({href:e,children:t})=>W(Ct,{href:e,passHref:!0,children:t})}):W(vl,{connect:ne,idleSeconds:i&&n!==null&&r!==null&&r<=5?n-Math.max(0,r):void 0})}),A?.single_env_onboarding&&G(lt,{open:se,onClose:he,children:[W(ft,{children:`Target-base Added`}),W(X,{"aria-label":`close`,onClick:he,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{children:W(Y,{children:`Please restart the Recce server.`})}),W(ut,{children:W(q,{color:`iochmara`,variant:`contained`,onClick:he,children:`Got it!`})})]})]})}const Sl=`select * from {{ ref("mymodel") }}`;function Cl({children:e}){let[t,n]=H(Sl),[r,i]=H(Sl),[a,o]=H(!1),[s,c]=H();return W(Fr,{sql:t,sqlQuery:t,setSqlQuery:n,primaryKeys:s,setPrimaryKeys:c,isCustomQueries:a,setCustomQueries:o,baseSqlQuery:r,setBaseSqlQuery:i,children:e})}const wl=e=>{},Tl=e=>{},El=e=>{},Dl=e=>{};function Ol(){let e=Ir();return{sqlQuery:e.sqlQuery??`select * from {{ ref("mymodel") }}`,setSqlQuery:e.setSqlQuery??wl,primaryKeys:e.primaryKeys,setPrimaryKeys:e.setPrimaryKeys??Tl,isCustomQueries:e.isCustomQueries??!1,setCustomQueries:e.setCustomQueries??El,baseSqlQuery:e.baseSqlQuery??`select * from {{ ref("mymodel") }}`,setBaseSqlQuery:e.setBaseSqlQuery??Dl}}function kl(e){z(()=>{e()},[e,pr()])}function Al({children:e}){let{apiClient:t}=no(),[n,r]=H(),[i,o]=H(!1),s=R(()=>o(!0),[]),c=R(()=>o(!1),[]),l=mr(),d=pr(),f=nt(),{basePath:p}=se(),m=V(null);kl(c);let h=R(async(e,t)=>{t!==!1&&await f.invalidateQueries({queryKey:O.runs()})},[f]),g=R(async(e,n,i)=>{try{let o=new Date().getTime().toString(),c,h=i;if(h?.showLast){let r=await u(e,n,1,t);r.length===1&&(c=r[0])}let g=Lc(e),_=g.RunResultView,{title:v,RunForm:y}=g;if(_===void 0)throw Error(`Run type ${e} does not have a result view`);if(y===void 0||!i?.showForm){let{run_id:r}=await a(e,n,{nowait:!0,trackProps:h?.trackProps},t);await f.invalidateQueries({queryKey:O.runs()}),m.current&&m.current(r);let i=`${p}/lineage`;d.startsWith(`${i}/`)&&d!==i&&l.push(i);return}r({session:o,title:v,type:e,params:n,lastRun:c,options:h,RunForm:y}),s();return}catch(e){I.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0});return}},[s,f,t,d,l,p]),_=R(async(e,r)=>{try{c();let{run_id:i}=await a(e,r,{nowait:!0,trackProps:n?.options?.trackProps},t);m.current&&m.current(i)}catch(e){I.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0})}},[c,n?.options?.trackProps,t]);return G(ie,{onRunAction:g,onShowRunId:h,children:[W(jl,{showRunIdRef:m,children:e}),n&&W(Kc,{isOpen:i,onClose:c,onExecute:_,title:n.title,type:n.type,params:n.params,initialRun:n.lastRun,RunForm:n.options?.showForm&&n.RunForm?n.RunForm:void 0},n.session)]})}function jl({children:e,showRunIdRef:t}){let{showRunId:n}=N();return z(()=>(t.current=n,()=>{t.current=null}),[n,t]),W(U,{children:e})}const Ml=it(void 0);function Nl({children:e}){let[t,n]=H(),[r,i]=H(!1),[a,o]=H(),{apiClient:s}=no();return W(Ml.Provider,{value:{shareUrl:t,isLoading:r,error:a,handleShareClick:async()=>{i(!0),o(void 0),n(void 0);try{let e=await h(s);if(e.status!==`success`){o(e.message);return}n(e.share_url)}catch(e){o(e.message)}finally{i(!1)}}},children:e})}const Pl=()=>{let e=ot(Ml);if(!e)throw Error(`useRecceShareStateContext must be used within a RecceShareStateContextProvider`);return e};function Fl({children:e}){return W(A,{children:W(Nl,{children:W(Cl,{children:W(xl,{children:W(Al,{children:W(Lr,{children:e})})})})})})}const Il=async()=>(await import(`html2canvas-pro`)).default,Ll=e=>`element`in e?e.element:e,Rl=`ignore-screenshot`;function zl({renderLibrary:e=`html2canvas`,imageType:t=`png`,backgroundColor:n=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:a=`solid 1px ${P.neutral[300]}`,borderRadius:o=`10px`,onSuccess:s,onError:c,ignoreElements:l}){let[u,d]=H(`idle`),f=V(null),{onOpen:p,setImgBlob:m,ImageDownloadModal:h}=Vl(),g=async()=>{if(!f.current)throw console.error(`No node to use for screenshot`),Error(`No node to use for screenshot`);let t=Ll(f.current);if(!t)throw console.error(`Could not get HTMLElement from ref`),Error(`Could not get HTMLElement from ref`);let s=t.style.overflow,c=t.style.border,u=t.style.borderRadius,p=t.style.backgroundColor,m=t.style.height;function h(){let e=t;e&&(e.style.overflow=s,e.style.border=c,e.style.borderRadius=u,e.style.backgroundColor=p,e.style.height=m)}try{t.style.overflow=`hidden`,t.style.border=r?a:``,t.style.borderRadius=r?o:``,t.style.backgroundColor=n??P.neutral[100],t.style.height=`${String(t.offsetHeight)}px`;let s=document.createElement(`style`);document.head.appendChild(s),s.sheet?.insertRule(`body > div:last-child img { display: inline-block; }`);let c=l?e=>!l(e):void 0;d(`loading`);let u;u=e===`html2canvas`?await(await Il())(t,{logging:!1,backgroundColor:n??P.neutral[100],ignoreElements:l}):await jn(t,{filter:c}),s.remove();let f=i?document.createElement(`canvas`):u;if(i){f.width=u.width+80,f.height=u.height+80;let e=f.getContext(`2d`);if(e)e.shadowColor=`rgba(0, 0, 0, 0.5)`,e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(u,40,40);else throw console.error(`Error getting canvas context`),Error(`Error getting canvas context to add shadow effect`)}return await(await fetch(f.toDataURL())).blob()}catch(e){throw console.error(`Error converting to image`,e),e}finally{h()}};return{status:u,isLoading:u===`loading`,isErrored:u===`error`,isSuccess:u===`success`,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({[`image/${t}`]:g()})]),d(`success`),s&&s()}catch(e){e.message===`ClipboardItem is not defined`?(m(await g()),p(),d(`success`)):(d(`error`),console.error(`Error copying to clipboard`,e),c&&c(e))}},ImageDownloadModal:h,ref:f}}function Bl(e){let{successToast:t,failToast:n}=je(),{isLoading:r,copyToClipboard:i,ImageDownloadModal:a,ref:o}=zl({imageType:`png`,shadowEffect:!0,backgroundColor:e?.backgroundColor??P.neutral[100],onSuccess:()=>{t(`Copied the query result as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}}),s=R(()=>{if(o.current){let e=Ll(o.current);e&&(e.style.boxShadow=`rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px`,e.style.transition=`box-shadow 0.5s ease-in-out`)}},[o]),c=R(()=>{if(o.current){let e=Ll(o.current);e&&(e.style.boxShadow=``)}},[o]),l=R(async()=>{if(o.current){await i();let e=Ll(o.current);e&&(e.style.boxShadow=``)}else n(`Failed to copy image to clipboard`,`No content to copy`)},[o,i,n]);function u({imageType:e=`png`,...t}){return G(U,{children:[W(q,{size:`small`,sx:{position:`absolute`,bottom:16,right:16},disabled:r,onMouseEnter:s,onMouseLeave:c,onClick:l,startIcon:W(It,{}),...t,children:`Copy to Clipboard`}),W(a,{})]})}return{ref:o,CopyToClipboardButton:u,onMouseEnter:s,onMouseLeave:c,onCopyToClipboard:l}}function Vl(){let[e,t]=H(!1),[n,r]=H(),i=()=>t(!0),a=()=>t(!1);function o(){let[t,r]=H();return z(()=>{if(!n)return;let e=new FileReader;e.readAsDataURL(n),e.onloadend=e=>{e.target?.result!=null&&r(e.target.result)}},[]),G(lt,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[W(ft,{children:`Screenshot Preview`}),W(X,{"aria-label":`close`,onClick:a,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),G(dt,{children:[G(J,{sx:{px:`10px`,gap:`10px`},children:[G(J,{direction:`row`,spacing:`5px`,sx:{alignItems:`center`},children:[W(K,{component:Bt,sx:{color:`error.main`}}),W(Y,{sx:{fontWeight:500,display:`inline`},children:`Copy to the Clipboard`}),` `,`is not supported in the current browser`]}),W(Y,{children:`Please download it directly`})]}),W(K,{component:`img`,src:t,alt:`screenshot`,sx:{maxWidth:`100%`}})]}),G(ut,{children:[W(q,{sx:{mr:1.5},onClick:a,children:`Close`}),W(q,{color:`iochmara`,variant:`contained`,onClick:()=>{n&&(ln(n,`recce-screenshot-${Tn(new Date,`yyyy-MM-dd-HH-mm-ss`)}.png`),a())},children:`Download`})]})]})}return{onOpen:i,setImgBlob:r,ImageDownloadModal:o}}function Hl(e,r={}){let{enabled:a=!0}=r,o=nt(),{apiClient:s}=no(),{data:l,isLoading:u,error:d,refetch:f}=tt({queryKey:O.checkEvents(e),queryFn:()=>n(e,s),enabled:a,refetchInterval:1e4,refetchIntervalInBackground:!1}),p=et({mutationFn:t=>i(e,t,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}}),m=et({mutationFn:({eventId:t,content:n})=>c(e,t,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}}),h=et({mutationFn:n=>t(e,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}});return{events:l??[],isLoading:u,error:d,refetch:f,createComment:p.mutate,isCreatingComment:p.isPending,createCommentError:p.error,updateComment:m.mutateAsync,isUpdatingComment:m.isPending,updateCommentError:m.error,deleteComment:h.mutateAsync,isDeletingComment:h.isPending,deleteCommentError:h.error}}const Ul={TOAST_ID:`lifetime-countdown`,WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>`The server will be closed in ${e} seconds.`,STYLE:{fontFamily:`monospace`}};function Wl(e){let t=I,[n,r]=H(null),i=V(void 0),a=R(()=>{if(!e)return 0;let t=new Date,n=Math.floor((e.getTime()-t.getTime())/1e3);return Math.max(0,n)},[e]),o=R(()=>{n!=null&&(t.remove(n),r(null))},[n]),s=R(()=>{if(n==null)return;let e=a();if(e<=0){o();return}t.update(n,{description:Ul.MESSAGE(e)})},[n,a,o]),c=R(()=>{if(!e)return;o();let n=a();n<=0||(r(t.create({id:Ul.TOAST_ID,description:Ul.MESSAGE(n)})),i.current=setInterval(s,Ul.UPDATE_INTERVAL))},[e,a,s,o]),l=a();pn(c,e?Math.max(0,l-Ul.WARNING_THRESHOLD)*1e3:null),z(()=>o,[o])}function Gl({run:e,runId:t,viewOptions:n}){let r=B(()=>!e?.type||!e?.result?!1:we(e.type),[e?.type,e?.result]),i=B(()=>{if(!e?.result)return null;let t=e.result;if(`total_row_count`in t&&typeof t.total_row_count==`number`)return t.total_row_count;let n=t.base,r=t.current,i=typeof n?.total_row_count==`number`?n.total_row_count:null,a=typeof r?.total_row_count==`number`?r.total_row_count:null;return i!==null&&a!==null?Math.max(i,a):i??a},[e?.result]),a=R(()=>{if(!e?.type||!e?.result)return null;let t={displayMode:n?.display_mode,primaryKeys:e?.params?.primary_keys};return ye(e.type,e.result,t)},[e?.type,e?.result,e?.params,n]),o=R(()=>{let e=a();return e?Oe(e.columns,e.rows):null},[a]),s=R(()=>{let e=a();return e?be(e.columns,e.rows):null},[a]),c=R(e=>{if(!t)return;let n=document.createElement(`a`);n.href=`/api/runs/${t}/export?format=${e}`,document.body.appendChild(n),n.click(),document.body.removeChild(n)},[t]),l=R(async()=>{let e=o();if(!e){I.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{await ve(e),I.create({title:`Copied to clipboard`,description:`CSV data copied successfully`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy CSV to clipboard:`,e),I.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[o]),u=B(()=>e?.type===`query_diff`&&!!e?.params?.primary_keys,[e?.type,e?.params]),d=R(()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`csv`);return}let n=o();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{let t=De(e?.type??``,e?.params);Ne(n,t),I.create({title:`Downloaded`,description:t,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download CSV file:`,e),I.create({title:`Download failed`,description:`Failed to download CSV file`,type:`error`,duration:3e3})}},[t,e,u,o,c]),f=R(async()=>{let e=s();if(!e){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{await ve(e),I.create({title:`Copied to clipboard`,description:`Text data copied — paste into any spreadsheet`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy TSV to clipboard:`,e),I.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[s]),p=R(()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`tsv`);return}let n=s();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let t=De(e?.type??``,e?.params).replace(/\.csv$/,`.tsv`);Ce(n,t),I.create({title:`Downloaded`,description:t,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download TSV file:`,e),I.create({title:`Download failed`,description:`Failed to download TSV file`,type:`error`,duration:3e3})}},[t,e,u,s,c]);return{canExportCSV:r,totalRowCount:i,copyAsCSV:l,copyAsTSV:f,downloadAsCSV:d,downloadAsExcel:R(async()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`xlsx`);return}let n=a();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let t=await Pe(n.columns,n.rows),r=De(e?.type??``,e?.params).replace(/\.csv$/,`.xlsx`);Se(t,r),I.create({title:`Downloaded`,description:r,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download Excel file:`,e),I.create({title:`Download failed`,description:`Failed to download Excel file`,type:`error`,duration:3e3})}},[t,e,u,a,c]),downloadAsTSV:p}}function Kl({description:e,onLike:t,onDislike:n,onClickLink:r,externalLink:i,externalLinkText:a}){return G(K,{sx:{display:`flex`,gap:4,justifyContent:`center`,alignContent:`center`,alignItems:`center`},children:[e,W(X,{"aria-label":`thumbs up`,onClick:t,sx:{width:`32px`,height:`32px`},children:W(K,{component:`img`,src:`/imgs/feedback/thumbs-up.png`,alt:`like`})}),W(X,{"aria-label":`thumbs down`,onClick:n,sx:{width:`32px`,height:`32px`},children:W(K,{component:`img`,src:`/imgs/feedback/thumbs-down.png`,alt:`dislike`})}),i&&a&&G(pt,{href:i,target:`_blank`,onClick:r,sx:{textDecoration:`underline`},children:[a,` `,W(ht,{})]})]})}function ql(e){let{feedbackId:t,description:n,onFeedbackSubmit:r,externalLink:i,externalLinkText:a}=e,[o,s]=H(void 0);function c(e=!1){let c=localStorage.getItem(t);o??(c===`true`&&!e||s(I.create({id:t,duration:void 0,type:`success`,description:W(J,{direction:`row`,children:W(Kl,{description:n,onLike:()=>{r(`like`),I.dismiss(t),localStorage.setItem(t,`true`)},onDislike:()=>{r(`dislike`),I.dismiss(t),localStorage.setItem(t,`true`)},externalLink:i,externalLinkText:a,onClickLink:()=>{r(`link`)}})})})))}return{feedbackToast:c,closeToast:()=>{o&&I.dismiss(o)}}}function Jl(e){let[t,n]=H(void 0),{guideId:r,description:i,externalLinkText:a,onExternalLinkClick:o}=e;function s(){t??n(I.create({id:r,duration:3e3,type:`success`,description:i,action:{label:a??`link`,onClick:()=>{o&&o()}}}))}return{guideToast:s,closeGuideToast:()=>{t&&I.dismiss(t)}}}const Yl=[];function Xl(e){return Yl}function Zl(e,t){let n=[];return e.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),t.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),n}function Ql(e,t){let{lineageGraph:n}=j(),r=D(),i=t??r?.apiClient,a=_n.find(n?.nodes,{data:{name:e}}),s=Yl,[c,l]=H([]),[u,d]=H(),[f,p]=H(!0),[m,h]=H(null),[g,_]=H([]),[v,y]=H(a?.id),b=R(async()=>{if(!(!a||!i))try{let e=(await o(a.id,i)).model;if(!e.base.columns||!e.current.columns){l([]),p(!1);return}d(e.current.primary_key),l(Zl(Object.values(e.base.columns),Object.values(e.current.columns))),p(!1)}catch(e){h(e),p(!1)}},[a,i]);return(s!==g||a?.id!==v)&&(_(s),y(a?.id),s.length>0?(l(s),d(void 0),p(!1)):a?.id===void 0&&(l([]),p(!1))),z(()=>{s.length===0&&a?.id!==void 0&&b().catch(e=>{console.error(e)})},[b,a?.id]),{columns:c,primaryKey:u,isLoading:f,error:m}}const $l=e=>{let{apiClient:t}=no(),[n,i]=H(!!e),[a,o]=H(!1),[,s]=pe(),c=V(null);z(()=>{e&&(i(!0),c.current=null)},[e]);let{error:l,data:u}=tt({queryKey:O.run(e??``),queryFn:async()=>await m(e??``,n?2:0,t),enabled:!!e,refetchInterval:n?50:!1,retry:!1});z(()=>{if(!u)return;let e=u.status?.toLowerCase();l||u.result||u.error||e&&e!==`running`?c.current!==u.run_id&&(c.current=u.run_id,i(!1)):e===`running`&&(c.current=null,i(!0))},[u,l]),z(()=>{(l||u?.result||u?.error)&&(u?.type===`row_count_diff`||u?.type===`row_count`)&&s?.()},[u,l,s]);let d=R(async()=>{o(!0),e&&await r(e,t)},[e,t]),f;return u&&E(u.type)&&(f=Lc(u.type).RunResultView),{run:u,isRunning:n,aborting:a,error:l,onCancel:d,RunResultView:f}};function eu(){let e=yt(),t=xe(),n=F(),[r,i]=H(!1);z(()=>{i(!0)},[]);let a=r?t?t.resolvedMode===`dark`:n:!1;return{isDark:a,theme:e,background:{default:a?P.neutral[900]:P.white,paper:a?P.neutral[800]:P.white,subtle:a?P.neutral[800]:P.neutral[50],emphasized:a?P.neutral[700]:P.neutral[100]},text:{primary:a?P.neutral[50]:P.neutral[900],secondary:a?P.neutral[400]:P.neutral[600],disabled:a?P.neutral[500]:P.neutral[400],inverted:a?P.neutral[900]:P.neutral[50]},border:{light:a?P.neutral[700]:P.neutral[200],default:a?P.neutral[600]:P.neutral[300],strong:a?P.neutral[500]:P.neutral[400]},status:{added:{bg:a?P.green[900]:P.green[100],text:a?P.neutral[50]:P.neutral[900]},removed:{bg:a?P.red[950]:P.red[200],text:a?P.neutral[50]:P.neutral[900]},modified:{bg:a?P.yellow[900]:P.amber[100],text:a?P.neutral[50]:P.neutral[900]}},interactive:{hover:a?P.neutral[700]:P.neutral[100],active:a?P.neutral[600]:P.neutral[200],focus:P.iochmara[500]}}}export{lc as $,Pa as $t,rl as A,Vr as An,Do as At,Lc as B,ro as Bt,_l as C,ji as Cn,Bo as Ct,ul as D,si as Dn,jo as Dt,pl as E,li as En,Po as Et,Wc as F,Mr as Fn,go as Ft,Oc as G,Ya as Gt,Fc as H,eo as Ht,Hc as I,Nr as In,yo as It,xc as J,Ha as Jt,Cc as K,Ka as Kt,Bc as L,Ar as Ln,vo as Lt,tl as M,zr as Mn,To as Mt,qc as N,Fr as Nn,bo as Nt,al as O,oi as On,ko as Ot,Kc as P,Ir as Pn,_o as Pt,dc as Q,Ma as Qt,zc as R,ho as Rt,xl as S,ki as Sn,Yo as St,ml as T,ci as Tn,Ro as Tt,jc as U,Qa as Ut,Ic as V,no as Vt,Ac as W,Za as Wt,mc as X,Ra as Xt,gc as Y,Ba as Yt,fc as Z,Ia as Zt,Pl as _,di as _n,ps as _t,Ql as a,_a as an,Fs as at,Sl as b,fi as bn,ts as bt,Gl as c,na as cn,ks as ct,Rl as d,Xi as dn,Es as dt,Oa as en,cc as et,zl as f,Yi as fn,Ts as ft,Nl as g,Ki as gn,_s as gt,Fl as h,Bi as hn,ys as ht,Zl as i,ya as in,Is as it,nl as j,Lr as jn,wo as jt,il as k,ii as kn,Co as kt,Wl as l,Qi as ln,As as lt,Vl as m,zi as mn,bs as mt,$l as n,Ca as nn,Vs as nt,Jl as o,da as on,Ns as ot,Bl as p,Ji as pn,xs as pt,Sc as q,Ga as qt,Xl as r,va as rn,Hs as rt,ql as s,ra as sn,$ as st,eu as t,Ea as tn,Bs as tt,Hl as u,Zi as un,Os as ut,Al as v,mi as vn,ns as vt,gl as w,ui as wn,Io as wt,Ol as x,Ii as xn,Xo as xt,Cl as y,pi as yn,is as yt,Rc as z,ao as zt};
7
- //# sourceMappingURL=hooks-AAVgIiqs.js.map
6
+ `)?W(K,{component:`code`,sx:{bgcolor:n?`grey.800`:`grey.100`,color:n?`grey.200`:`inherit`,px:1,py:.5,borderRadius:.5,fontSize:`0.9em`,fontFamily:`monospace`},children:t}):W(K,{sx:{my:2,borderRadius:1,overflow:`hidden`,fontSize:`0.875rem`},children:W(cr,{style:lr,language:i,PreTag:`div`,customStyle:{margin:0,borderRadius:`6px`,fontSize:`0.85em`},children:a})})}function Ts({content:e,fontSize:t=`0.875rem`,internalDomains:n=[]}){let r=F(),i=[window.location.hostname,`reccehq.com`,`datarecce.io`,`localhost`,...n];return W(K,{className:`markdown-content`,children:W(sr,{remarkPlugins:[ur],components:{a:({href:e,children:t})=>W(Cs,{href:e,internalDomains:i,children:t}),code:e=>W(ws,{...e,isDark:r}),p:({children:e})=>W(Y,{component:`p`,sx:{fontSize:t,mb:2,"&:last-child":{mb:0}},children:e}),h1:({children:e})=>W(Y,{sx:{fontSize:`1.25rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h2:({children:e})=>W(Y,{sx:{fontSize:`1.125rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h3:({children:e})=>W(Y,{sx:{fontSize:`1rem`,fontWeight:600,mb:2,mt:2},children:e}),ul:({children:e})=>W(K,{component:`ul`,sx:{pl:4,mb:2,listStyleType:`disc`},children:e}),ol:({children:e})=>W(K,{component:`ol`,sx:{pl:4,mb:2,listStyleType:`decimal`},children:e}),li:({children:e})=>W(K,{component:`li`,sx:{fontSize:t,mb:1},children:e}),blockquote:({children:e})=>W(K,{sx:{borderLeft:`3px solid`,borderLeftColor:r?`grey.600`:`grey.300`,pl:3,py:1,my:2,color:r?`grey.400`:`grey.600`,fontStyle:`italic`},children:e}),table:({children:e})=>W(K,{sx:{overflowX:`auto`,my:2},children:W(K,{component:`table`,sx:{width:`100%`,fontSize:t,border:`1px solid`,borderColor:r?`grey.700`:`grey.200`,borderRadius:1},children:e})}),thead:({children:e})=>W(K,{component:`thead`,sx:{bgcolor:r?`grey.800`:`grey.50`},children:e}),tbody:({children:e})=>W(K,{component:`tbody`,children:e}),tr:({children:e})=>W(K,{component:`tr`,sx:{borderBottom:`1px solid`,borderColor:r?`grey.700`:`grey.200`},children:e}),th:({children:e})=>W(K,{component:`th`,sx:{px:2,py:1,fontWeight:600,textAlign:`left`},children:e}),td:({children:e})=>W(K,{component:`td`,sx:{px:2,py:1},children:e}),hr:()=>W(K,{component:`hr`,sx:{my:3,borderColor:r?`grey.700`:`grey.200`}}),strong:({children:e})=>W(Y,{component:`strong`,sx:{fontWeight:600},children:e}),em:({children:e})=>W(Y,{component:`em`,sx:{fontStyle:`italic`},children:e}),del:({children:e})=>W(Y,{component:`del`,sx:{textDecoration:`line-through`,color:`grey.500`},children:e})},children:e})})}const Es=at(function({backgroundColor:e=`white`,blockSize:t,children:n,...r},i){return W(K,{ref:i,...r,sx:{overflowY:`auto`,overflowX:`hidden`,...r.sx},children:W(K,{sx:{backgroundColor:e,height:`100%`,blockSize:t},children:n})})});function Ds({children:e,direction:t=`horizontal`,sizes:n,minSizes:r=0,maxSizes:i,gutterSize:a=5,snapOffset:o=30,dragInterval:s=1,onDragEnd:c,onDrag:l,theme:u,style:d,className:f}){let p=F(),m=u?u===`dark`:p,h={display:`flex`,flexDirection:t===`horizontal`?`row`:`column`,height:`100%`,width:`100%`,...d};return W(K,{className:f,sx:{height:`100%`,width:`100%`,"& .gutter":{backgroundColor:`divider`,backgroundRepeat:`no-repeat`,backgroundPosition:`50%`,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:m?`grey.600`:`grey.300`}},"& .gutter.gutter-horizontal":{cursor:`col-resize`},"& .gutter.gutter-vertical":{cursor:`row-resize`}},children:W(dr,{style:h,direction:t,sizes:n,minSize:r,maxSize:i,gutterSize:a,snapOffset:o,dragInterval:s,onDragEnd:c,onDrag:l,children:e})})}const Os=L(Ds);Os.displayName=`SplitPane`;function ks(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return W(Os,{direction:`horizontal`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function As(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return W(Os,{direction:`vertical`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function js({warning:e,isDark:t}){return G(K,{sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`},children:[W(qt,{color:t?fr[400]:fr[600]}),W(K,{children:e})]})}function Ms({toolbar:e,warnings:t,warningStyle:n=`alert`,isDark:r}){return!e&&(!t||t.length===0)?null:G(K,{sx:{display:`flex`,alignItems:`center`,gap:1,px:1,py:.5,borderBottom:1,borderColor:`divider`,bgcolor:n===`amber`&&t&&t.length>0?r?fr[900]:fr[100]:r?`grey.900`:`grey.50`,color:n===`amber`&&t&&t.length>0?r?fr[200]:fr[800]:void 0},children:[n===`amber`?t?.map(e=>W(js,{warning:e,isDark:r},e)):t?.map(e=>W(mn,{severity:`warning`,sx:{py:0,fontSize:`0.75rem`},children:e},e)),W(K,{sx:{flex:1}}),e]})}function $(e){let{displayName:t,typeGuard:n,expectedRunType:r,screenshotWrapper:i,transformData:a,emptyState:o=`No data`,conditionalEmptyState:s}=e;function c({run:e,viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l},u){let d=F();if(!n(e))throw Error(`Run type must be ${r}`);let f=B(()=>a(e,{viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l,isDark:d}),[e,t,c,l,d]),p=s?.(e,t);return p==null?f?.renderNull?null:!f||f.isEmpty?f?.toolbar||f?.warnings&&f.warnings.length>0?G(K,{sx:{display:`flex`,flexDirection:`column`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:[W(Ms,{toolbar:f?.toolbar,warnings:f?.warnings,warningStyle:f?.warningStyle,isDark:d}),W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,flex:1},children:f?.emptyMessage??o})]}):W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:o}):i===`grid`?G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,W(Ms,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),W(is,{ref:u,style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.875rem`,borderWidth:1},columns:f.columns??[],rows:f.rows??[],renderers:{noRowsFallback:W(ns,{emptyMessage:f.noRowsMessage})},defaultColumnOptions:f.defaultColumnOptions}),f.footer]}):G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,W(Ms,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),W(Es,{ref:u,backgroundColor:d?`#1f2937`:`white`,sx:{height:`100%`},children:f.content}),f.footer]}):W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:p})}return c.displayName=t,at(c)}const Ns=`0.1.0`;function Ps(e){return x(e)}const Fs=$({displayName:`HistogramDiffResultView`,typeGuard:Ps,expectedRunType:`histogram_diff`,screenshotWrapper:`box`,conditionalEmptyState:e=>{let t=e.result?.base,n=e.result?.current;return!t||!n?W(`div`,{children:`Loading...`}):null},transformData:(e,{isDark:t})=>{let n=e.params,r=e.result?.base,i=e.result?.current,a=e.result?.min,o=e.result?.max,s=e.result?.bin_edges??[];if(!r||!i)return{isEmpty:!0};let c=e.params?.column_type??`numeric`,l=c===`datetime`?`datetime`:c===`string`?`string`:`numeric`;return{content:G(K,{sx:{display:`flex`,flexDirection:`row`},children:[W(K,{sx:{flex:1}}),W(K,{sx:{width:`80%`,height:`35vh`,m:4},children:W(ts,{title:`Model ${n.model}.${n.column_name}`,dataType:l,baseData:{counts:r.counts},currentData:{counts:i.counts},min:a,max:o,samples:r.total,binEdges:s,theme:t?`dark`:`light`})}),W(K,{sx:{flex:1}})]})}}});function Is({model:e,row:t,singleEnv:n,cllRunning:r,showMenu:i=!0,onViewCode:a,isImpacted:o}){let s=ce(),{isActionAvailable:c}=j(),{runAction:l}=N(),{featureToggles:u}=me(),{name:d,baseType:f,currentType:p,baseIndex:m,currentIndex:h,reordered:g,definitionChanged:_}=t,v=p??f??t.type,y=m===void 0&&h!==void 0,b=m!==void 0&&h===void 0,x=!y&&!b&&f!==p,S=!y&&!b&&(f!==p||g===!0),C=n?`unchanged`:y?`added`:b?`removed`:x?`type_changed`:_?`definition_changed`:`unchanged`,[w,T]=H(null),E=!!w,ee=e=>{e.stopPropagation(),T(e.currentTarget)},D=()=>{T(null)},O=()=>{l(`profile_diff`,{model:e.name,columns:[d]},{showForm:!1,trackProps:{action:`profile_diff`,source:`schema_column_menu`,node_count:1}})},k=()=>{l(`histogram_diff`,{model:e.name,column_name:d,column_type:v},{showForm:!1,trackProps:{action:`histogram_diff`,source:`schema_column_menu`,node_count:1}})},te=()=>{l(`top_k_diff`,{model:e.name,column_name:d,k:50},{showForm:!1,trackProps:{action:`top_k_diff`,source:`schema_column_menu`,node_count:1}})},ne=()=>{l(`value_diff`,{model:e.name,columns:[d]},{showForm:!0,trackProps:{action:`value_diff`,source:`schema_column_menu`,node_count:1}})},re=!f||!p;return W(Z,{title:ii({name:d,status:C,baseType:f,currentType:p,cllAvailable:!(s===void 0||!c(`change_analysis`)||m!==void 0&&h===void 0)}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`3px`},children:[S&&W(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`}),y&&W(`span`,{className:`schema-change-badge schema-change-badge-added`,children:`+`}),b&&W(`span`,{className:`schema-change-badge schema-change-badge-removed`,children:`-`}),o&&!y&&!b&&!S&&!_&&W(`span`,{className:`schema-change-badge schema-change-badge-impacted`,children:`!`}),_&&W(Z,{title:`Definition changed — click to view code`,placement:`top`,onMouseOver:e=>e.stopPropagation(),children:a?W(`button`,{type:`button`,className:`schema-change-badge schema-change-badge-changed schema-change-badge-clickable`,onClick:e=>{e.stopPropagation(),a()},children:`~`}):W(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`})}),W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:d}),x?G(K,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:`0.125rem`,ml:`0.25rem`,fontSize:`1.6rem`},children:[f&&W(K,{component:`span`,sx:{textDecoration:`line-through`,opacity:.6},children:W(oi,{type:f,disableTooltip:!0})}),W(K,{component:`span`,sx:{fontSize:`0.7em`,opacity:.5},children:`→`}),p&&W(oi,{type:p,disableTooltip:!0})]}):v&&W(K,{component:`span`,sx:{ml:`0.25rem`,fontSize:`1.6rem`},children:W(oi,{type:v,disableTooltip:!0})}),W(K,{sx:{flex:1}}),r&&W(Et,{size:12,color:`inherit`}),i&&!n&&e.resource_type!==`source`&&G(U,{children:[W(X,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:u.disableDatabaseQuery,onClick:ee,children:W(vn,{})}),G(gn,{anchorEl:w,open:E,onClose:D,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[W(bn,{sx:{m:0,p:`4px 12px`,lineHeight:`20px`},children:`Diff`}),W(Q,{onClick:()=>{O(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Profile Diff`}),W(Q,{onClick:()=>{k(),D()},disabled:re||(v?!na(v):!0),sx:{fontSize:`0.85rem`},children:`Histogram Diff`}),W(Q,{onClick:()=>{te(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Top-k Diff`}),W(Q,{onClick:()=>{ne(),D()},disabled:re,sx:{fontSize:`0.85rem`},children:`Value Diff`})]})]})]})})}function Ls(e,t,n,r){return i=>{let a=i.data;return a?W(Is,{model:e,row:a,cllRunning:t?.get(a.name)??!1,showMenu:n,onViewCode:r,isImpacted:a.isImpacted}):null}}function Rs(e,t,n){return r=>{let i=r.data;return i?W(Is,{model:e,row:i,cllRunning:t?.get(i.name)??!1,singleEnv:!0,showMenu:n}):null}}function zs(e){if(!e.data)return null;let{baseIndex:t,currentIndex:n,reordered:r}=e.data;return r&&t!==void 0&&n!==void 0&&t!==n?G(`span`,{children:[W(`span`,{className:`schema-index-old`,children:t}),W(`span`,{className:`schema-index-new`,children:n})]}):W(`span`,{children:n===void 0?t??`-`:n??`-`})}function Bs(e={},t={}){let n={},r=Te(Object.keys(e),Object.keys(t));Object.entries(r).forEach(([e,t])=>{n[e]={name:e,reordered:t===`reordered`,__status:void 0}});let i=0;return Object.entries(e).forEach(([e,t])=>{t!=null&&(n[e].baseIndex=i+=1,n[e].baseType=t.type)}),i=0,Object.entries(t).forEach(([e,t])=>{t!=null&&(n[e].currentIndex=i+=1,n[e].currentType=t.type)}),n}function Vs(e,t={}){let{node:n,cllRunningMap:r,showMenu:i,columnChanges:a,onViewCode:o,impactedColumns:s,nodeId:c}=t,l=[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellRenderer:zs,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Ls(n,r,i,o):void 0,cellClass:`schema-column`,valueGetter:e=>{let t=e.data;return t?`${t.name}|${t.definitionChanged??!1}|${t.isImpacted??!1}`:``}}],u=Object.values(e);if(a)for(let e of u){let t=e.baseIndex===void 0,n=e.currentIndex===void 0,r=!t&&!n&&e.baseType!==e.currentType;a[e.name]===`modified`&&!t&&!n&&!r&&!e.reordered&&(e.definitionChanged=!0)}if(s&&c)for(let e of u){let t=`${c}_${e.name}`;s.has(t)&&(e.isImpacted=!0)}return{columns:l,rows:u}}function Hs(e={},t={}){let{node:n,cllRunningMap:r,showMenu:i}=t,a=Object.entries(e).filter(([e,t])=>t!=null).map(([e,t],n)=>({name:e,index:n+1,type:t.type,__status:void 0}));return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Rs(n,r,i):void 0,cellClass:`schema-column`}],rows:a}}function Us({columnName:e,primaryKeys:t}){return W(K,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:t.includes(e)&&W(yn,{})})}function Ws({params:e,column:t}){let{runAction:n}=N(),{featureToggles:r}=me(),[i,a]=H(null),o=!!i,s=e=>{a(e.currentTarget)},c=()=>{a(null)},l=(t,r)=>{n(`value_diff_detail`,{...e,...t},r)};return G(K,{sx:{display:`flex`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),W(K,{sx:{flex:1}}),W(X,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:r.disableDatabaseQuery,onClick:s,children:W(Lt,{})}),G(gn,{anchorEl:i,open:o,onClose:c,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[W(bn,{sx:{fontSize:`8pt`,lineHeight:`20px`},children:`Action`}),W(Q,{onClick:()=>{l({},{showForm:!0}),c()},sx:{fontSize:`10pt`},children:`Show mismatched values...`}),G(Q,{onClick:()=>{l({columns:[t]},{showForm:!1}),c()},sx:{fontSize:`10pt`},children:[`Show mismatched values for '`,t,`'`]})]})]})}function Gs({value:e}){let t=`N/A`;return e!=null&&(t=e>.9999&&e<1?`~99.99 %`:e<1e-4&&e>0?`~0.01 %`:`${(e*100).toFixed(2)} %`),W(K,{sx:{textAlign:`right`},children:t})}function Ks(e){return t=>{let n=t.data;return n?W(Us,{columnName:String(n[0]),primaryKeys:e}):null}}function qs(e){return t=>{let n=t.data,r=t.colDef?.field??``;return n?W(Ws,{column:String(n[r]),params:e}):null}}function Js(e){let t=e.data,n=e.colDef?.field??``;return t?W(Gs,{value:t[n]}):null}const Ys=[{key:`0`,name:`Column`,type:`text`},{key:`1`,name:`Matched`,type:`number`},{key:`2`,name:`Matched %`,type:`number`}];function Xs(e){let t=e.data;if(!t)return;let n=t[2];return n!=null&&n<1?`diff-cell-modified`:void 0}function Zs(e,t){let n=e==null,r=t==null;return n&&r?0:n?1:r?-1:e-t}const Qs={PRIMARY_KEY_INDICATOR:`__is_pk__`,COLUMN_NAME:`0`,MATCHED_COUNT:`1`,MATCHED_PERCENT:`2`};function $s(e,t){return[{field:Qs.PRIMARY_KEY_INDICATOR,headerName:``,width:30,maxWidth:30,sortable:!1,cellRenderer:Ks(e)},{field:Qs.COLUMN_NAME,headerName:`Column`,resizable:!0,cellRenderer:qs(t),cellClass:`cell-show-context-menu`},{field:Qs.MATCHED_COUNT,headerName:`Matched`,resizable:!0,cellClass:Xs},{field:Qs.MATCHED_PERCENT,headerName:`Matched %`,resizable:!0,sort:`asc`,comparator:Zs,cellRenderer:Js,cellClass:Xs}]}function ec(e,t){let{params:n}=t,r=Array.isArray(n.primary_key)?n.primary_key:[n.primary_key],i={...e.data,columns:Ys};return{columns:$s(r,n),rows:Ie(i)}}function tc(e){if(p(e)||S(e))return e.result?{kind:`query`,result:e.result}:null;if(w(e))return e.result?e.result.diff&&e.params?.primary_keys?{kind:`query_diff_joined`,result:e.result,primaryKeys:e.params.primary_keys}:{kind:`query_diff_separate`,result:e.result}:null;if(d(e))return!e.result||!e.params?null:{kind:`value_diff`,result:e.result,params:e.params};if(g(e)){if(!e.result||!e.params?.primary_key)return null;let t=e.params.primary_key,n=Array.isArray(t)?t:[t];return{kind:`value_diff_detail`,result:e.result,primaryKeys:n}}return f(e)?e.result?.current?{kind:`profile`,result:e.result}:null:v(e)?e.result?{kind:`profile_diff`,result:e.result}:null:T(e)?e.result?{kind:`row_count`,result:e.result}:null:y(e)&&e.result?{kind:`row_count_diff`,result:e.result}:null}function nc(e){let t=e.data;if(!t)return null;let n=e.colDef?.field??``,r=String(ze(t,n)??e.value??``),i=String(ze(t,`data_type`)??``)||void 0;return W(Z,{title:ii({name:r,currentType:i}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`6px`,overflow:`hidden`,height:`100%`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),i&&W(K,{component:`span`,sx:{fontSize:`1.6rem`},children:W(oi,{type:i,disableTooltip:!0})})]})})}function rc(e){let t=e.data;if(!t)return null;let n=e.colDef?.field??``,r=String(ze(t,n)??e.value??``),i=ze(t,`base__data_type`),a=i==null?void 0:String(i),o=ze(t,`current__data_type`),s=o==null?void 0:String(o),c=a!=null&&s!=null&&a!==s,l=s??a;return W(Z,{title:ii({name:r,baseType:a,currentType:s}),placement:`top`,children:G(K,{sx:{display:`flex`,alignItems:`center`,gap:`6px`,overflow:`hidden`,height:`100%`},children:[W(K,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),c?G(K,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:`0.125rem`,fontSize:`1.6rem`},children:[W(K,{component:`span`,sx:{textDecoration:`line-through`,opacity:.6},children:W(oi,{type:a,disableTooltip:!0})}),W(K,{component:`span`,sx:{fontSize:`0.7em`,opacity:.5},children:`→`}),W(oi,{type:s,disableTooltip:!0})]}):l&&W(K,{component:`span`,sx:{fontSize:`1.6rem`},children:W(oi,{type:l,disableTooltip:!0})})]})})}function ic(e){if(!e)return!1;let t=e.toLowerCase();return t===`data_type`||t===`base__data_type`||t===`current__data_type`}function ac(e){let t=e.rows.length>0&&Object.hasOwn(e.rows[0],`base__data_type`),n=e.columns.filter(e=>{if(`children`in e&&e.children){let t=e.children.filter(e=>!ic(e.field));return t.length===0?!1:(e.children=t,!0)}return!ic(e.field)}).map(e=>{if(`children`in e&&e.children)return{...e,children:e.children.map(e=>{let t=e;return t.field?.toLowerCase()===`column_name`?{...t,cellRenderer:nc}:e})};let n=e;return n.field?.toLowerCase()===`column_name`?{...n,cellRenderer:t?rc:nc}:e});return{...e,columns:n}}function oc(e){return e.current?.columns.find(e=>e.name.toLowerCase()===`column_name`)?.name??`column_name`}function sc(e,t={}){let n=tc(e);if(!n)return null;switch(n.kind){case`query`:return ke(n.result,{primaryKeys:t.primaryKeys,pinnedColumns:t.pinnedColumns,columnsRenderMode:t.columnsRenderMode,onPrimaryKeyChange:t.onPrimaryKeyChange,onPinnedColumnsChange:t.onPinnedColumnsChange,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`query_diff_separate`:return He(n.result.base,n.result.current,t);case`query_diff_joined`:return n.result.diff?Ee(n.result.diff,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,baseTitle:t.baseTitle,currentTitle:t.currentTitle,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}):null;case`value_diff`:return ec(n.result,{params:n.params});case`value_diff_detail`:return Ee(n.result,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`profile`:{if(!n.result.current)return null;let e=oc(n.result);return ac(ke(n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}))}case`profile_diff`:{let e=oc(n.result);return ac(He(n.result.base,n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}))}case`row_count`:return Fe(n.result);case`row_count_diff`:return Ae(n.result);default:return null}}function cc(e,t){switch(e.type){case`single`:return ke(e.dataframe,t??{});case`dual`:return He(e.base,e.current,t??{});case`joined`:return Ee(e.dataframe,e.primaryKeys,t??{});case`schema_diff`:{let n=t??{};return Vs(Bs(e.base,e.current),n)}case`schema_single`:return Hs(e.columns,t??{})}}function lc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=H(!e.columns||e.columns.length===0),a=e.model,{columns:o,isLoading:s,error:c}=Xl(e.model);z(()=>{n(!!a)},[a,n]);let l=o.map(e=>e.name);return s?W(K,{children:`Loading...`}):l.length===0||c?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):G(J,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Model`}),W(wn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Columns`}),W(dn,{control:W(un,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:l,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>W(wn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}const uc=e=>typeof e==`object`&&!!e&&`type`in e&&v(e),dc=$({displayName:`ProfileResultView`,typeGuard:e=>typeof e==`object`&&!!e&&`type`in e&&f(e),expectedRunType:`profile`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=sc(e,{pinnedColumns:t?.pinned_columns??[],onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]};return{columns:r.columns,rows:r.rows,isEmpty:r.columns.length===0}}}),fc=$({displayName:`ProfileDiffResultView`,typeGuard:uc,expectedRunType:`profile_diff`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.pinned_columns??[],i=t?.display_mode??`inline`,a=sc(e,{pinnedColumns:r,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},displayMode:i,columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]},o=W(Bo,{children:W(Zi,{displayMode:i,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}})});return{columns:a.columns,rows:a.rows,header:o,isEmpty:a.columns.length===0}}});function pc(e){return w(e)}const mc=$({displayName:`QueryDiffResultView`,typeGuard:pc,expectedRunType:`query_diff`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=e.result&&`diff`in e.result&&e.result.diff!=null,i,a;e.params&&e.params.current_model&&(i=`Original`,a=`Editor`);let o=t?.changed_only??!1,s=t?.pinned_columns??[],c=t?.display_mode??`inline`,l=t?.columnsRenderMode??{},u=r?[]:t?.primary_keys??[],d=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},f=r?void 0:e=>{n&&n({...t,primary_keys:e})},p=e=>{n&&n({...t,pinned_columns:e})},m;if(r&&e.result?.diff){let t=e.params?.primary_keys??[];m=Ee(e.result.diff,t,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c})}else m=He(e.result?.base,e.result?.current,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c,primaryKeys:u,onPrimaryKeyChange:f});let h=[];if(!r&&u.length>0){let e=u.join(`, `);m.invalidPKeyBase&&m.invalidPKeyCurrent?h.push(`Warning: The primary key '${e}' is not unique in the base and current environments`):m.invalidPKeyBase?h.push(`Warning: The primary key '${e}' is not unique in the base environment`):m.invalidPKeyCurrent&&h.push(`Warning: The primary key '${e}' is not unique in the current environment`)}let g=r?e.result?.diff?.limit??0:e.result?.current?.limit??0,_=r?e.result?.diff?.more:e.result?.current?.more||e.result?.base?.more;if(g>0&&_&&h.push(`Warning: Displayed results are limited to ${g.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`),m.columns.length===0)return{isEmpty:!0};let v=G(U,{children:[W(Zi,{displayMode:c,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),W(Yi,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&o&&m.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:v,warnings:h.length>0?h:void 0}:{columns:m.columns,rows:m.rows,warnings:h.length>0?h:void 0,toolbar:v,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function hc(e){return p(e)||S(e)}const gc=$({displayName:`QueryResultView`,typeGuard:hc,expectedRunType:`query`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n,onAddToChecklist:r})=>{let i=t?.pinned_columns??[],a=t?.columnsRenderMode??{},o=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},s=e=>{n&&n({...t,pinned_columns:e})};if(!e.result)return{isEmpty:!0};let c=ke(e.result,{pinnedColumns:i,onPinnedColumnsChange:s,columnsRenderMode:a,onColumnsRenderModeChanged:o});if(c.columns.length===0)return{isEmpty:!0};let l=e.result,u=l?l.limit??0:0,d=[];u>0&&l?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=r?W(q,{sx:{my:`5px`},size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{r(e)},children:`Add to Checklist`}):void 0;return{columns:c.columns,rows:c.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35}}}});function _c(e){return T(e)}function vc(e){return y(e)}function yc(e){if(!e.result)return null;let t=Fe(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}function bc(e){if(!e.result)return null;let t=Ae(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}const xc=$({displayName:`RowCountResultView`,typeGuard:_c,expectedRunType:`row_count`,screenshotWrapper:`grid`,transformData:yc,emptyState:`No nodes matched`}),Sc=$({displayName:`RowCountDiffResultView`,typeGuard:vc,expectedRunType:`row_count_diff`,screenshotWrapper:`grid`,transformData:bc,emptyState:`No nodes matched`});function Cc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=Xl(e.model),o=r.map(e=>e.name);return z(()=>{n(!!e.column_name)},[e,n]),i?W(K,{children:`Loading...`}):o.length===0||a?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):W(K,{sx:{m:`16px`},children:G(xn,{fullWidth:!0,children:[W(Sn,{sx:{mb:1},children:`Pick a column to show top-k`}),G(Cn,{value:e.column_name,onChange:n=>{let r=n.target.value;t({...e,column_name:r})},children:[W(`option`,{value:``,children:`Select column`}),o.map(e=>W(`option`,{value:e,className:`no-track-pii-safe`,children:e},e))]})]})})}function wc(e){return b(e)}function Tc({model:e,columnName:t}){return G(Y,{variant:`h5`,sx:{pt:4,textAlign:`center`,color:F()?`grey.200`:`grey.600`},children:[`Model `,e,`.`,t]})}function Ec({showAll:e,onToggle:t}){return W(K,{sx:{display:`flex`,p:5,justifyContent:`start`},children:W(pt,{component:`button`,onClick:t,sx:{color:`iochmara.main`,cursor:`pointer`},children:e?`View Only Top-10`:`View More Items`})})}function Dc(e,{viewOptions:t,onViewOptionsChanged:n,isDark:r}){let i=e.result,a=e.params;if(!i)return{isEmpty:!0};let o=i.base,s=i.current,c=t?.show_all??!1,l=!c,u=o.values.length>10||s.values.length>10?W(Ec,{showAll:c,onToggle:()=>{n&&n({...t,show_all:!c})}}):void 0;return{content:G(U,{children:[W(Tc,{model:a.model,columnName:a.column_name}),G(J,{direction:`row`,sx:{alignItems:`center`},children:[W(K,{sx:{flex:1}}),W(ps,{baseData:o,currentData:s,showComparison:!0,maxItems:l?10:void 0,theme:r?`dark`:`light`}),W(K,{sx:{flex:1}})]})]}),footer:u}}const Oc=$({displayName:`TopKDiffResultView`,typeGuard:wc,expectedRunType:`top_k_diff`,screenshotWrapper:`box`,emptyState:`No data`,transformData:Dc});function kc(e){return g(e)}const Ac=$({displayName:`ValueDiffDetailResultView`,typeGuard:kc,expectedRunType:`value_diff_detail`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.changed_only??!1,i=t?.pinned_columns??[],a=t?.display_mode??`inline`,o=t?.columnsRenderMode??{},s=e.params?.primary_key;if(!s||!e.result)return{isEmpty:!0};let c=Array.isArray(s)?s:[s],l=Ee(e.result,c,{changedOnly:r,pinnedColumns:i,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:o,onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},displayMode:a});if(l.columns.length===0)return{isEmpty:!0};let u=e.result?.limit??0,d=[];u>0&&e.result?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=G(U,{children:[W(Zi,{displayMode:a,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),W(Yi,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&l.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:f,warnings:d.length>0?d:void 0,warningStyle:`amber`}:{columns:l.columns,rows:l.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function jc({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=H(!e.columns||e.columns.length===0),a=e.model,o=e.primary_key,{columns:s,primaryKey:c,isLoading:l,error:u}=Xl(e.model);z(()=>{!o&&c&&t({...e,primary_key:c})},[o,c,e,t]),z(()=>{n(!!(o&&a))},[o,a,n]);let d=s.map(e=>e.name),f=Array.isArray(o)?o:o?[o]:void 0;return l?W(K,{children:`Loading...`}):d.length===0||u?W(K,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):G(J,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Model`}),W(wn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Primary key`}),W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:(f??[]).filter(e=>e!==void 0),onChange:(n,r)=>{t({...e,primary_key:r.length===1?r[0]:r})},renderInput:e=>W(wn,{...e,placeholder:(f??[]).length===0?`Select primary key`:``,className:`no-track-pii-safe`})})]}),G(K,{children:[W(Y,{variant:`body2`,sx:{mb:1},children:`Columns`}),W(dn,{control:W(un,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&W(Cr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>W(wn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}function Mc(e){return d(e)}function Nc({params:e,summary:t}){let n=t.total-t.added-t.removed;return G(K,{sx:{px:`16px`,pt:`5px`,pb:`5px`},children:[`Model: `,e.model,`, `,t.total,` total (`,n,` common,`,` `,t.added,` added, `,t.removed,` removed)`]})}function Pc(e){if(!e.result||!e.params)return{renderNull:!0};let t=ec(e.result,{params:e.params});return t?{columns:t.columns,rows:t.rows,isEmpty:!1,header:W(Nc,{params:e.params,summary:e.result.summary})}:{renderNull:!0}}const Fc=$({displayName:`ValueDiffResultView`,typeGuard:Mc,expectedRunType:`value_diff`,screenshotWrapper:`grid`,transformData:Pc}),Ic={lineage_diff:{title:`Lineage Diff`,icon:vr},schema_diff:{title:`Schema Diff`,icon:gr},query:{title:`Query`,icon:Sr,RunResultView:gc},query_base:{title:`Query Base`,icon:Sr,RunResultView:gc},query_diff:{title:`Query Diff`,icon:Sr,RunResultView:mc},row_count:{title:`Row Count`,icon:hr,RunResultView:xc},row_count_diff:{title:`Row Count Diff`,icon:hr,RunResultView:Sc},profile:{title:`Profile`,icon:xr,RunResultView:dc,RunForm:lc},profile_diff:{title:`Profile Diff`,icon:xr,RunResultView:fc,RunForm:lc},value_diff:{title:`Value Diff`,icon:_r,RunResultView:Fc,RunForm:jc},value_diff_detail:{title:`Value Diff Detail`,icon:_r,RunResultView:Ac,RunForm:jc},top_k_diff:{title:`Top-K Diff`,icon:mt,RunResultView:Oc,RunForm:Cc},histogram_diff:{title:`Histogram Diff`,icon:yr,RunResultView:Fs,RunForm:ra},sandbox:{title:`Sandbox`,icon:br},simple:{title:`Simple`,icon:br}};function Lc(e){return Ic[e]}const Rc=Ic;function zc(e){let t={...Ic};for(let[n,r]of Object.entries(e))r&&n in t&&(t[n]={...t[n],...r});return t}function Bc(e){return t=>e[t]}function Vc(e){return{id:e.run_id,name:e.name,type:e.type,status:e.status??`Finished`,runAt:e.run_at,checkId:e.check_id}}function Hc(){let{closeHistory:e,showRunId:t,runId:n}=N(),{featureToggles:r}=me(),{apiClient:i}=no(),a=mr(),o=nt(),{basePath:c}=se(),{data:u,isLoading:d}=tt({queryKey:O.runs(),queryFn:async()=>await l(i),retry:!1}),f=B(()=>(u??[]).map(Vc),[u]),p=R(e=>{Ze({name:`click_run`}),t(e,!1)},[t]),m=R(async e=>{Ze({name:`add_to_checklist`});let t=await s(e,void 0,i);await o.invalidateQueries({queryKey:O.checks()}),a.push(`${c}/checks/?id=${t.check_id}`)},[i,o,a.push,c]),h=R(e=>{Ze({name:`go_to_check`}),a.push(`${c}/checks/?id=${e}`)},[a.push,c]),g=R(()=>{Ze({name:`hide`}),e()},[e]),_=R(e=>{let t=Lc(e)?.icon;return t?W(t,{}):null},[]),v=W(X,{"aria-label":`Close History`,onClick:g,children:W(Jt,{})});return W(Po,{runs:f,selectedId:n,isLoading:d,onRunSelect:p,onAddToChecklist:m,onGoToCheck:h,getRunIcon:_,hideAddToChecklist:r.disableUpdateChecklist&&!r.checklistPermissionDenied,disableAddToChecklist:r.checklistPermissionDenied,title:`History`,headerActions:v,emptyMessage:`No runs`,loadingMessage:`Loading...`,groupByDate:!0,addToChecklistIcon:W(Ot,{}),goToCheckIcon:W(Dt,{color:`green`})})}const Uc=({size:e=16})=>G(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`path`,{d:`M12 16v-4`}),W(`path`,{d:`M12 8h.01`})]});function Wc({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,RunForm:o,onCancel:s,onExecuteClick:c,documentationUrl:l,InfoIcon:u=Uc}){let[d,f]=H(a??{}),[p,m]=H(null),[h,g]=H(!1),_=V(!1),v=()=>{_.current||s?.(),_.current=!1,t()};return G(lt,{open:e,onClose:v,maxWidth:`sm`,fullWidth:!0,scroll:`paper`,slotProps:{paper:{sx:{height:`75%`,minHeight:`400px`}}},children:[G(ft,{sx:{display:`flex`,alignItems:`center`},children:[i,` `,l&&G(U,{children:[W(X,{size:`small`,"aria-label":`Click this button to learn more about the SQL behind`,onMouseEnter:e=>m(e.currentTarget),onMouseLeave:()=>m(null),onClick:()=>window.open(l,`_blank`),children:W(K,{component:u,sx:{fontSize:`16px`}})}),W(Kn,{open:!!p,anchorEl:p,onClose:()=>m(null),anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},disableRestoreFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{sx:{bgcolor:`black`,color:`white`,p:1}}},children:G(Y,{sx:{fontSize:`0.875rem`},children:[`Click`,` `,W(pt,{href:l,target:`_blank`,sx:{textDecoration:`underline`,color:`white`,"&:hover":{color:`iochmara.300`}},children:`here`}),` `,`to learn more about the SQL behind`]})})]})]}),W(X,{"aria-label":`close`,onClick:v,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{sx:{p:0,overflow:`auto`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:W(K,{sx:{contain:`layout`},children:o&&W(o,{params:d,onParamsChanged:f,setIsReadyToExecute:g})})}),W(ut,{children:W(J,{direction:`row`,spacing:`10px`,children:W(q,{disabled:!h,color:`iochmara`,variant:`contained`,onClick:()=>{_.current=!0,c?.(),n(r,d)},children:`Execute`})})})]})}const Gc=e=>({value_diff:`https://docs.reccehq.com/features/lineage/#value-diff`,profile_diff:`https://docs.reccehq.com/features/lineage/#profile-diff`,histogram_diff:`https://docs.reccehq.com/features/lineage/#histogram-diff`,top_k_diff:`https://docs.reccehq.com/features/lineage/#top-k-diff`})[e]||null;function Kc({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s}){return W(Wc,{isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s,onCancel:()=>{Je(r)&&Xe({action:r,event:qe.CANCEL})},onExecuteClick:()=>{Je(r)&&Xe({action:r,event:qe.EXECUTE})},documentationUrl:Gc(r),InfoIcon:Bt})}const qc=at(function({isRunning:e,isAborting:t,progress:n,error:r,run:i,onCancel:a,viewOptions:o,onViewOptionsChanged:s,RunResultView:c,children:l,ErrorBoundary:u,errorBoundaryFallback:d},f){let p=F(),m=r?.response?.data?.detail??i?.error;if(m)return G(mn,{severity:`error`,sx:p?{bgcolor:`error.dark`,color:`common.white`,"& .MuiAlert-icon":{color:`common.white`}}:void 0,children:[`Error: `,W(`span`,{className:`no-track-pii-safe`,children:m})]});if(e||i?.status===`Running`){let e=`Loading...`;n?.message?e=n.message:i?.progress?.message&&(e=i.progress.message);let r=n?.percentage==null?void 0:n.percentage*100;return W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,p:`1rem`,height:`100%`,bgcolor:p?`grey.900`:`grey.50`},children:G(J,{spacing:2,sx:{alignItems:`center`},children:[G(J,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[r==null?W(Et,{size:32}):G(K,{sx:{position:`relative`,display:`inline-flex`},children:[W(Et,{variant:`determinate`,value:r,size:32}),W(K,{sx:{top:0,left:0,bottom:0,right:0,position:`absolute`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:W(Y,{variant:`caption`,component:`div`,sx:{fontSize:`0.6rem`},children:`${Math.round(r)}%`})})]}),t?W(Y,{children:`Aborting...`}):W(Y,{className:`no-track-pii-safe`,children:e})]}),!t&&W(q,{variant:`contained`,onClick:a,size:`small`,children:`Cancel`})]})})}if(!i)return W(K,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:p?`grey.900`:`grey.50`,height:`100%`},children:W(Et,{size:32})});if(l&&c)throw Error(`RunView requires either a children or a RunResultView prop, but not both.`);if(!l&&!c)throw Error(`RunView requires at least one of children or RunResultView prop.`);return W(K,{sx:{height:`100%`,contain:`layout`,overflow:`auto`,bgcolor:p?`grey.900`:`grey.50`},className:`no-track-pii-safe`,children:(()=>{let e=c&&(i.error??i.result)?W(c,{ref:f,run:i,viewOptions:o,onViewOptionsChanged:s}):null,t=l?.({run:i,viewOptions:o,onViewOptionsChanged:s});return u&&e?G(U,{children:[W(u,{fallback:d,children:e}),t]}):G(U,{children:[e,t]})})()})});qc.displayName=`RunView`;const Jc=L(({type:e,params:t})=>{let n=F();return W(Za,{value:Nn.stringify({type:e,params:t},null,2),language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,height:`100%`,theme:n?`dark`:`light`,className:`no-track-pii-safe`})});Jc.displayName=`ParamView`;function Yc(e,t){return t!=null&&t>0?`${e} (${Ve(t)})`:e}const Xc=L(({open:e,rowCount:t,onContinue:n,onCancel:r})=>G(lt,{open:e,onClose:r,children:[W(ft,{children:`Large Export Warning`}),W(dt,{children:G(wr,{children:[`You are about to download `,W(`strong`,{children:Ve(t)}),`. This may take a while and produce a large file. Are you sure you want to continue?`]})}),G(ut,{children:[W(q,{onClick:r,children:`Cancel`}),W(q,{onClick:n,variant:`contained`,children:`Continue`})]})]}));Xc.displayName=`LargeExportWarningDialog`;const Zc=L(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i,label:a=`Export`})=>{let[o,s]=H(null),c=!!o,[l,u]=H(!1),[d,f]=H(null),p=i?.totalRowCount??0,m=p>1e5,h=e=>{s(e.currentTarget)},g=()=>{s(null)},_=e=>{m?(f(()=>e),u(!0)):(e(),g())};return G(U,{children:[W(q,{size:`small`,variant:`outlined`,color:`neutral`,onClick:h,endIcon:W(At,{}),sx:{textTransform:`none`},children:a}),G(gn,{anchorEl:o,open:c,onClose:g,children:[G(Q,{onClick:async()=>{await t(),g()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[W(Tr,{children:W(zt,{})}),W(Er,{children:`Copy as Image`})]}),G(Q,{onClick:async()=>{await i?.copyAsTSV?.(),g()},disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Ft,{})}),W(Er,{children:`Copy as Text`})]}),G(Q,{onClick:async()=>{await i?.copyAsCSV(),g()},disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Gt,{})}),W(Er,{children:`Copy as CSV`})]}),G(Q,{onClick:()=>_(()=>i?.downloadAsCSV()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as CSV`,i?.totalRowCount)})]}),G(Q,{onClick:()=>_(()=>i?.downloadAsTSV?.()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as TSV`,i?.totalRowCount)})]}),i?.downloadAsExcel&&G(Q,{onClick:()=>_(()=>i?.downloadAsExcel?.()),disabled:e||!i?.canExportCSV,children:[W(Tr,{children:W(Rt,{})}),W(Er,{children:Yc(`Download as Excel`,i?.totalRowCount)})]})]}),W(Xc,{open:l,rowCount:p,onContinue:()=>{u(!1),d?.(),f(null),g()},onCancel:()=>{u(!1),f(null)}})]})});Zc.displayName=`DefaultExportMenu`;const Qc=L(({runId:e,run:t,disableUpdateChecklist:n,checklistPermissionDenied:r,hasError:i,onGoToCheck:a,onAddToChecklist:o})=>{let s=t?.check_id,c=!e||!t?.result||i;return n&&!r?null:s?W(q,{disabled:c,size:`small`,variant:`contained`,onClick:()=>a?.(s),startIcon:W(Mt,{}),sx:{textTransform:`none`},children:`Go to Check`}):W(Z,{title:r?`You don't have permission to add checks`:``,children:W(`span`,{children:W(q,{disabled:c||r,size:`small`,variant:`contained`,onClick:o,startIcon:W(Mt,{}),sx:{textTransform:`none`},children:`Add to Checklist`})})})});Qc.displayName=`DefaultAddToCheckButton`;const $c=L(({run:e})=>{let t=e.status||(e.result?`Finished`:e.error?`Failed`:`unknown`),n=e=>{switch(e.toLowerCase()){case`finished`:return`success.main`;case`failed`:return`error.main`;case`running`:return`primary.main`;default:return`text.secondary`}},r=e.run_at?En(new Date(e.run_at),{addSuffix:!0}):`Unknown time`;return G(Y,{variant:`body2`,sx:{color:`text.secondary`},children:[W(K,{component:`span`,sx:{fontWeight:600,color:n(t)},children:t}),`・`,r]})});$c.displayName=`RunStatusAndDateDisplay`;function el({runId:e,run:t,isRunning:n,error:r,viewOptions:i,onViewOptionsChanged:a,isSingleEnvironment:o,disableDatabaseQuery:s,disableShare:c,disableUpdateChecklist:l,checklistPermissionDenied:u,onClose:d,onCancel:f,onRerun:p,onCopyAsImage:m,onCopyMouseEnter:h,onCopyMouseLeave:g,csvExport:_,onTrackCopyToClipboard:v,onGoToCheck:y,onAddToChecklist:b,SingleEnvironmentNotification:x,SqlEditorComponent:S,DualSqlEditorComponent:C,RunResultView:w,resultViewRef:T,children:E}){let ee=F(),[D,O]=H(`result`),[k,te]=H(!0),ne=t?.type===`query`||t?.type===`query_diff`||t?.type===`query_base`,re=!e||!t?.result||!!r||D!==`result`,A=R(async()=>{await m?.(),v&&v(t?.type??`unknown`,`run`)},[m,v,t?.type]),ie=t?.type===`query_diff`,j=t?.params;return G(K,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,bgcolor:ee?`grey.900`:`grey.50`},children:[o&&k&&x&&W(x,{runType:t?.type,onClose:()=>te(!1)}),G(K,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,mb:`1px`},children:[G(On,{value:D,onChange:(e,t)=>O(t),children:[W(Dn,{label:`Result`,value:`result`}),W(Dn,{label:`Params`,value:`params`}),ne&&W(Dn,{label:`Query`,value:`query`})]}),W(K,{sx:{flexGrow:1}}),G(J,{direction:`row`,spacing:1,sx:{alignItems:`center`,overflow:`hidden`,pr:1},children:[t&&W($c,{run:t}),W(q,{variant:`outlined`,color:`neutral`,disabled:!e||n||s,size:`small`,onClick:p,startIcon:W(Wt,{}),sx:{textTransform:`none`},children:`Rerun`}),W(Zc,{run:t,disableExport:re,onCopyAsImage:A,onMouseEnter:h,onMouseLeave:g,csvExport:_,label:c?`Export`:`Share`}),W(Qc,{runId:e,run:t,disableUpdateChecklist:l,checklistPermissionDenied:u,hasError:!!r,onGoToCheck:y,onAddToChecklist:b}),W(X,{size:`small`,onClick:d,children:W(wt,{})})]})]}),D===`result`&&(w||E)&&W(qc,{ref:T,isRunning:n,error:r,run:t,onCancel:f,viewOptions:i,onViewOptionsChanged:a,RunResultView:w,children:E}),D===`params`&&t&&W(Jc,{type:t.type,params:t.params}),D===`query`&&t&&ne&&j?.sql_template&&W(U,{children:ie&&C?W(C,{value:j.sql_template,baseValue:j.base_sql_template,readOnly:!0}):S?W(S,{value:j.sql_template,readOnly:!0}):W(Za,{value:j.sql_template,language:`sql`,readOnly:!0,theme:`dark`,height:`100%`})})]})}const tl=L(el);tl.displayName=`RunResultPane`;const nl=e=>G(K,{sx:{display:`flex`,flex:1,minHeight:`48px`,m:`4px`,px:`16px`,py:`12px`,bgcolor:`primary.50`,border:`1px solid`,borderRadius:`4px`,borderColor:`primary.400`,alignItems:e.align??`center`,gap:`12px`},children:[W(K,{component:Dr,sx:{width:`20px`,height:`20px`,color:`primary.900`}}),e.children,W(K,{sx:{flexGrow:1}}),W(X,{size:`small`,onClick:e.onClose,children:W(wt,{})})]}),rl=()=>G(pt,{href:`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,target:`_blank`,sx:{color:`primary.main`,fontWeight:`bold`,textDecoration:`underline`,display:`inline-flex`,alignItems:`center`,gap:.5},children:[`Learn how `,W(ht,{})]});function il({value:e,onChange:t,onRun:n,onRunBase:r,onRunDiff:i,label:a,CustomEditor:o,options:s={},manifestData:c,schemas:l,...u}){let{featureToggles:d}=me(),f=F(),p=e=>{t&&t(e)},m=``;c&&(m=c.generated_at?Me(c.generated_at):``);let h=B(()=>{let e=[];return n&&e.push({key:`Mod-Enter`,run:()=>(n(),!0)}),r&&e.push({key:`Alt-Enter`,run:()=>(r(),!0)}),i&&e.push({key:`Mod-Shift-Enter`,run:()=>(i(),!0)}),e},[n,r,i]);return G(U,{children:[(a??n??r)&&G(J,{direction:`row`,sx:{bgcolor:vt(f?P.neutral[600]:P.neutral[200],.7),height:`40px`,minHeight:`40px`,fontSize:`14px`,alignItems:`center`,m:0,p:`0px 16px`,flex:`0 0 40px`},children:[W(Y,{component:`strong`,sx:{fontWeight:`bold`},className:`no-track-pii-safe`,children:a?a.toUpperCase():``}),c&&G(`span`,{className:`ml-1`,children:[`(`,l&&G(`span`,{className:`no-track-pii-safe`,children:[l,`, `]}),W(`span`,{children:m}),`)`]}),W(K,{sx:{flexGrow:1}}),(n??r)&&W(q,{size:`xsmall`,variant:`outlined`,onClick:n??r,sx:{bgcolor:`background.paper`,p:`6px 12px`},disabled:d.disableDatabaseQuery,startIcon:W(Or,{}),children:`Run Query`})]}),o??W(Za,{value:e,onChange:p,language:`sql`,readOnly:s.readOnly??!1,lineNumbers:s.lineNumbers!==`off`,wordWrap:s.wordWrap!==`off`,fontSize:s.fontSize??16,keyBindings:h,theme:f?`dark`:`light`,className:`no-track-pii-safe max-h-dvh h-full`})]})}function al({value:e,baseValue:t,onChange:n,onChangeBase:r,onRun:i,onRunBase:a,onRunDiff:o,options:s={},labels:c,SetupGuide:l,...u}){let d=c?c[0]:`Base`,f=c?c[1]:`Current`,{envInfo:p,lineageGraph:m}=j(),h,g;p?.dbt?.base&&p.dbt.current&&(h=p.dbt.base,g=p.dbt.current);let[_,v]=Be(m);return W(U,{children:G(J,{direction:`row`,sx:{height:`100%`,gap:0},children:[W(J,{sx:{height:`100%`,width:`50%`,gap:0,borderRight:`1px solid`,borderRightColor:`divider`},children:W(il,{label:d,value:t??``,onChange:r,onRunBase:a,options:s,CustomEditor:l,manifestData:h??void 0,schemas:Array.from(_).join(`, `),...u})}),W(J,{sx:{height:`100%`,width:`50%`,gap:0},children:W(il,{label:f,value:e,onChange:n,onRun:i,options:s,manifestData:g??void 0,schemas:Array.from(v).join(`, `),...u})})]})})}const ol=({runType:e,onClose:t})=>{switch(e){case`row_count`:return W(nl,{onClose:t,children:G(Y,{children:[`Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. `,W(rl,{})]})});case`profile`:return W(nl,{onClose:t,children:G(Y,{children:[`Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against.`,` `,W(rl,{})]})});default:return null}},sl=({value:e,readOnly:t})=>W(il,{value:e,options:{readOnly:t}}),cl=({value:e,baseValue:t,readOnly:n})=>W(al,{value:e,baseValue:t,options:{readOnly:n}}),ll=({runId:e,onClose:t,isSingleEnvironment:n})=>{let{featureToggles:r}=me(),{runAction:i}=N(),{error:a,run:o,onCancel:c,isRunning:l}=Zl(e),[u,d]=H(),f=nt(),p=mr(),{apiClient:m}=no(),{basePath:h}=se(),g;o&&E(o.type)&&(g=Lc(o.type).RunResultView);let{ref:_,onCopyToClipboard:v,onMouseEnter:y,onMouseLeave:b}=Bl(),x=Gl({run:o,runId:e,viewOptions:u}),S=R(()=>{o&&i(o.type,o.params)},[o,i]),C=R(async()=>{await v(),Ye({type:o?.type??`unknown`,from:`run`})},[v,o?.type]),w=R(e=>{p.push(`${h}/checks/?id=${e}`)},[p.push,h]),T=R(async()=>{if(e)try{let t=await s(e,u,m);await f.invalidateQueries({queryKey:O.checks()}),p.push(`${h}/checks/?id=${t.check_id}`)}catch(e){re(e)&&e.status===403?I.error({title:`Permission denied`,description:`You don't have permission to add checks. Contact your org admin for access.`}):I.error({title:`Failed to create check`,description:e instanceof Error?e.message:`An unexpected error occurred`})}},[e,u,m,f,p.push,h]);return W(tl,{runId:e,run:o,isRunning:l,error:a,viewOptions:u,onViewOptionsChanged:d,isSingleEnvironment:n,disableDatabaseQuery:r.disableDatabaseQuery,disableShare:r.disableShare,disableUpdateChecklist:r.disableUpdateChecklist,checklistPermissionDenied:r.checklistPermissionDenied,onClose:t,onCancel:c,onRerun:S,onCopyAsImage:C,onCopyMouseEnter:y,onCopyMouseLeave:b,csvExport:x,onGoToCheck:w,onAddToChecklist:T,SingleEnvironmentNotification:ol,SqlEditorComponent:sl,DualSqlEditorComponent:cl,RunResultView:g,resultViewRef:_})},ul=({onClose:e,isSingleEnvironment:t})=>{let{runId:n}=N();return W(ll,{runId:n,onClose:e,isSingleEnvironment:t})};function dl({error:e,resetError:t}){let{background:n,text:r}=Ql();return W(K,{sx:{height:`100%`,bgcolor:n.subtle,display:`flex`,alignItems:`center`,justifyContent:`center`},children:G(K,{sx:{p:4,display:`flex`,flexDirection:`column`,justifyContent:`flex-start`,bgcolor:`background.paper`,border:`solid 1px`,borderColor:`divider`,minHeight:`200px`},children:[W(Y,{variant:`h6`,sx:{width:`800px`},children:`You have encountered an error`}),W(K,{sx:{flex:1,fontSize:`10pt`,color:r.secondary},children:String(e)}),W(q,{sx:{justifySelf:`center`,alignSelf:`center`,mt:`20px`},color:`iochmara`,variant:`contained`,size:`small`,onClick:t,children:`Reset`})]})})}const fl=e=>W(dl,{error:e.error,resetError:e.resetError}),pl=({children:e,fallback:t=fl})=>W(kr,{fallback:t,children:e}),ml=at(function(e,t){return W(qc,{...e,ErrorBoundary:pl,errorBoundaryFallback:$e,ref:t})});ml.displayName=`RunViewOss`;const hl={mode:`per_node`,status:`pending`,completed:0,total:0,actions:{}},gl=(e,t)=>{let{onActionStarted:n,onActionNodeUpdated:i,onActionCompleted:o,onTrackAction:s,trackingSource:c=`lineage_view_top_bar`}=t,l=k(),u=V({...hl}).current,{showRunId:d}=N(),f=async(t,r,s)=>{u.mode=`multi_nodes`,u.actions={};let c=u.mode,f=u.actions;n(),u.status=`running`;let p=[];for(let t of e){let e=r(t);e?(f[t.id]={mode:c,status:`skipped`,skipReason:e},i(t)):(f[t.id]={mode:c,status:`pending`},p.push(t))}let h=s(p);try{let{run_id:e}=await a(t,h,{nowait:!0},l);for(d(e),u.currentRun={run_id:e},u.total=1;;){let t=await m(e,2,l);u.currentRun=t;let n=t.error?`failure`:t.result?`success`:`running`;for(let e of p)f[e.id]={mode:c,status:n,run:t},i(e);if(t.error||t.result)break}}catch{}if(u.completed=1,u.status===`canceling`){u.status=`canceled`,o();return}u.status=`completed`,o()},p=async(t,r)=>{u.mode=`per_node`,u.actions={};let s=u.mode,c=u.actions;n(),u.status=`running`;for(let t of e)c[t.id]={mode:s,status:`pending`},i(t);u.completed=0,u.total=e.length;for(let n of e){let{params:e,skipReason:d}=r(n);if(d)c[n.id]={mode:s,status:`skipped`,skipReason:d},i(n);else try{let{run_id:r}=await a(t,e,{nowait:!0},l);for(u.currentRun={run_id:r},c[n.id]={mode:s,status:`running`},i(n);;){let e=await m(r,2,l);u.currentRun=e;let t=e.error?`failure`:e.result?`success`:`running`;if(c[n.id]={mode:s,status:t,run:e},i(n),e.error||e.result)break}}catch{}finally{u.currentRun=void 0}if(u.completed++,u.status===`canceling`){u.status=`canceled`,o();return}}u.status=`completed`,o()};return{actionState:u,runRowCount:async()=>{s?.({action:`row_count`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runRowCountDiff:async()=>{s?.({action:`row_count_diff`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count_diff`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runValueDiff:async()=>{s?.({action:`value_diff`,source:c,node_count:e.length}),await p(`value_diff`,e=>({skipReason:`No primary key found. The first unique column is used as primary key.`}))},addLineageDiffCheck:async()=>await ee({node_ids:e.map(e=>e.id)},l),addSchemaDiffCheck:async()=>{let t;return t=e.length===1?await _({node_id:e[0].id},l):await _({node_id:e.map(e=>e.id)},l),t},cancel:async()=>{u.status=`canceling`,u.currentRun?.run_id&&await r(u.currentRun.run_id,l)},reset:()=>{Object.assign(u,hl)}}};function _l(e){let[t,n]=H(!1),[r,i]=H(0),[a,o]=H(),s=V(null),c=R(e=>(i(e),new Promise(e=>{o(()=>e),n(!0)})),[]),l=()=>{e?.onConfirm?.(r),a?.(!0),n(!1)},u=()=>{e?.onCancel?.(r),a?.(!1),n(!1)};return{confirm:c,AlertDialog:G(lt,{open:t,onClose:u,maxWidth:`md`,fullWidth:!0,"aria-labelledby":`value-diff-alert-dialog-title`,children:[G(ft,{id:`value-diff-alert-dialog-title`,sx:{fontSize:`1.125rem`,fontWeight:`bold`},children:[`Value Diff on `,r,` nodes`]}),W(X,{"aria-label":`close`,onClick:u,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{children:W(J,{spacing:`20px`,children:G(K,{children:[`Value diff will be executed on `,r,` nodes in the Lineage, which can add extra costs to your bill.`]})})}),G(ut,{sx:{gap:.5},children:[W(q,{ref:s,onClick:u,variant:`outlined`,color:`neutral`,children:`Cancel`}),W(q,{color:`iochmara`,variant:`contained`,onClick:l,sx:{ml:1.5},children:`Execute`})]})]})}}function vl({connect:e,idleSeconds:t}){return G(U,{children:[W(ft,{children:`Server Disconnected`}),W(dt,{children:t!=null&&t>0?G(Y,{children:[`The server has been idle for `,Re(t),` and was automatically stopped. Please restart the Recce server to continue.`]}):W(Y,{children:`The server connection has been lost. Please restart the Recce server and try again.`})}),W(ut,{children:W(q,{color:`iochmara`,variant:`contained`,onClick:()=>{e()},children:`Retry`})})]})}function yl({shareUrl:e,mode:t,supportCalendarUrl:n,LinkComponent:r}){let i={"read only":{title:`Share Instance Expired`,body:`This Share Instance has expired. Please restart the share instance.`,action:`Restart`,link:e},"metadata only":{title:`Preview Instance Expired`,body:`This Preview Instance has expired. To browse more, please book a meeting with us.`,action:`Contact us`,link:n}}[t],a=W(q,{color:`iochmara`,variant:`contained`,children:i.action});return G(U,{children:[W(ft,{children:i.title}),W(dt,{children:W(Y,{children:i.body})}),W(ut,{children:t===`read only`?W(r||`a`,{href:i.link,children:a}):W(q,{color:`iochmara`,variant:`contained`,onClick:()=>window.open(i.link,`_blank`),children:i.action})})]})}function bl({enabled:e=!0,baseUrl:t,apiPrefix:n}={}){let[r,i]=H(void 0),a=V({ws:void 0,status:`pending`,artifactsUpdatedToastId:void 0}),[o,s]=H(e?`pending`:`connected`),[c,l]=H(void 0);z(()=>{a.current.status=o},[o]),z(()=>{a.current.artifactsUpdatedToastId=r},[r]);let u=nt(),d=R(()=>{u.invalidateQueries({queryKey:O.lineage()}),u.invalidateQueries({queryKey:O.checks()}),u.invalidateQueries({queryKey:O.runs()})},[u]),f=R(()=>{function e(e){return e.replace(/(http)(s)?:\/\//,`ws$2://`)}let r=t??Ge,o=n?`${n}/ws`:`/api/ws`,c=new WebSocket(`${e(r)}${o}`);a.current.ws=c,c.onopen=()=>{c.send(`ping`)},c.onmessage=e=>{if(e.data===`pong`){a.current.status===`disconnected`&&d(),s(`connected`);return}try{let t=JSON.parse(e.data);if(t.command===`refresh`){let{eventType:e,srcPath:n}=t.event,[r,o]=n.split(`/`).slice(-2),s=o.replace(/\.[^/.]+$/,``),c=`${r}-${s}-${e}`;a.current.artifactsUpdatedToastId??i(I.create({id:c,description:`Detected ${r} ${s} ${e}`,type:`info`,duration:5e3,closable:!0})),d()}else if(t.command===`relaunch`)l(`relaunch`);else{let{id:e,title:n,description:r,status:a,duration:o}=t.event;i(I.create({id:e||`broadcast`,title:n,description:r,type:a??`info`,duration:o??5e3,closable:!0}))}}catch(e){console.error(e)}},c.onerror=e=>{console.error(`An error occurred during Handling WebSockets`,e)},c.onclose=()=>{s(e=>e===`connected`?`disconnected`:e),a.current.ws=void 0}},[d,t,n]);return z(()=>{if(!e)return;let t=a.current;return f(),()=>{t.ws&&t.ws.close()}},[f,e]),{connectionStatus:o,connect:f,envStatus:c}}function xl({children:t}){let{idleTimeout:n,remainingSeconds:r,isEnabled:i,setDisconnected:a,resetConnection:o}=ae(),{apiClient:s,apiPrefix:c,baseUrl:l}=no(),u=tt({queryKey:O.lineage(),queryFn:()=>e(s)}),d=tt({queryKey:O.runsAggregated(),queryFn:()=>C(s)}),f=B(()=>{let e=u.data?.lineage;if(e?.nodes)return le(e)},[u.data]),p=u.error?.message,{state_metadata:m,lineage:h,sqlmesh:g,demo:_,codespace:v,review_mode:y,cloud_mode:b,file_mode:x,filename:S,adapter_type:w,git:T,pull_request:E,support_tasks:ee}=u.data??{demo:!1},D={stateMetadata:m,adapterType:w,git:T,pullRequest:E,dbt:{base:h?.metadata?.base?.manifest_metadata,current:h?.metadata?.current?.manifest_metadata},sqlmesh:g},{connectionStatus:k,connect:ne,envStatus:re}=bl({enabled:!0,baseUrl:l,apiPrefix:c});z(()=>{k===`disconnected`?a():k===`connected`&&o()},[k,a,o]);let{data:A,isLoading:ie}=fe(),{featureToggles:j,shareUrl:M}=me(),[se,N]=H(!1),[ce,ue]=H(!1),de=nt(),pe=!ie&&re===`relaunch`&&A?.single_env_onboarding===!0&&A.show_relaunch_hint;pe!==ce&&(ue(pe),N(pe)),z(()=>{pe&&se&&Qe({action:`target_base_added`})},[pe,se]);let he=()=>{N(!1),te(s),de.invalidateQueries({queryKey:O.flag()})},ge=R(()=>{d.refetch()},[d]),_e=R(()=>{d.refetch()},[d]);return G(U,{children:[W(oe,{lineageGraph:f,envInfo:D,reviewMode:y,cloudMode:b,fileMode:x,fileName:S,isDemoSite:_??!1,isCodespace:v,isLoading:u.isLoading,error:p,supportTasks:ee,onRefetchLineageGraph:ge,runsAggregated:d.data,onRefetchRunsAggregated:_e,children:t}),W(lt,{open:k===`disconnected`,onClose:()=>void 0,children:M&&j.mode!==null?W(yl,{shareUrl:M,mode:j.mode,supportCalendarUrl:Ke,LinkComponent:({href:e,children:t})=>W(Ct,{href:e,passHref:!0,children:t})}):W(vl,{connect:ne,idleSeconds:i&&n!==null&&r!==null&&r<=5?n-Math.max(0,r):void 0})}),A?.single_env_onboarding&&G(lt,{open:se,onClose:he,children:[W(ft,{children:`Target-base Added`}),W(X,{"aria-label":`close`,onClick:he,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),W(dt,{children:W(Y,{children:`Please restart the Recce server.`})}),W(ut,{children:W(q,{color:`iochmara`,variant:`contained`,onClick:he,children:`Got it!`})})]})]})}const Sl=`select * from {{ ref("mymodel") }}`;function Cl({children:e}){let[t,n]=H(Sl),[r,i]=H(Sl),[a,o]=H(!1),[s,c]=H();return W(Fr,{sql:t,sqlQuery:t,setSqlQuery:n,primaryKeys:s,setPrimaryKeys:c,isCustomQueries:a,setCustomQueries:o,baseSqlQuery:r,setBaseSqlQuery:i,children:e})}const wl=e=>{},Tl=e=>{},El=e=>{},Dl=e=>{};function Ol(){let e=Ir();return{sqlQuery:e.sqlQuery??`select * from {{ ref("mymodel") }}`,setSqlQuery:e.setSqlQuery??wl,primaryKeys:e.primaryKeys,setPrimaryKeys:e.setPrimaryKeys??Tl,isCustomQueries:e.isCustomQueries??!1,setCustomQueries:e.setCustomQueries??El,baseSqlQuery:e.baseSqlQuery??`select * from {{ ref("mymodel") }}`,setBaseSqlQuery:e.setBaseSqlQuery??Dl}}function kl(e){z(()=>{e()},[e,pr()])}function Al({children:e}){let{apiClient:t}=no(),[n,r]=H(),[i,o]=H(!1),s=R(()=>o(!0),[]),c=R(()=>o(!1),[]),l=mr(),d=pr(),f=nt(),{basePath:p}=se(),m=V(null);kl(c);let h=R(async(e,t)=>{t!==!1&&await f.invalidateQueries({queryKey:O.runs()})},[f]),g=R(async(e,n,i)=>{try{let o=new Date().getTime().toString(),c,h=i;if(h?.showLast){let r=await u(e,n,1,t);r.length===1&&(c=r[0])}let g=Lc(e),_=g.RunResultView,{title:v,RunForm:y}=g;if(_===void 0)throw Error(`Run type ${e} does not have a result view`);if(y===void 0||!i?.showForm){let{run_id:r}=await a(e,n,{nowait:!0,trackProps:h?.trackProps},t);await f.invalidateQueries({queryKey:O.runs()}),m.current&&m.current(r);let i=`${p}/lineage`;d.startsWith(`${i}/`)&&d!==i&&l.push(i);return}r({session:o,title:v,type:e,params:n,lastRun:c,options:h,RunForm:y}),s();return}catch(e){I.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0});return}},[s,f,t,d,l,p]),_=R(async(e,r)=>{try{c();let{run_id:i}=await a(e,r,{nowait:!0,trackProps:n?.options?.trackProps},t);m.current&&m.current(i)}catch(e){I.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0})}},[c,n?.options?.trackProps,t]);return G(ie,{onRunAction:g,onShowRunId:h,children:[W(jl,{showRunIdRef:m,children:e}),n&&W(Kc,{isOpen:i,onClose:c,onExecute:_,title:n.title,type:n.type,params:n.params,initialRun:n.lastRun,RunForm:n.options?.showForm&&n.RunForm?n.RunForm:void 0},n.session)]})}function jl({children:e,showRunIdRef:t}){let{showRunId:n}=N();return z(()=>(t.current=n,()=>{t.current=null}),[n,t]),W(U,{children:e})}const Ml=it(void 0);function Nl({children:e}){let[t,n]=H(),[r,i]=H(!1),[a,o]=H(),{apiClient:s}=no();return W(Ml.Provider,{value:{shareUrl:t,isLoading:r,error:a,handleShareClick:async()=>{i(!0),o(void 0),n(void 0);try{let e=await h(s);if(e.status!==`success`){o(e.message);return}n(e.share_url)}catch(e){o(e.message)}finally{i(!1)}}},children:e})}const Pl=()=>{let e=ot(Ml);if(!e)throw Error(`useRecceShareStateContext must be used within a RecceShareStateContextProvider`);return e};function Fl({children:e}){return W(A,{children:W(Nl,{children:W(Cl,{children:W(xl,{children:W(Al,{children:W(Lr,{children:e})})})})})})}const Il=async()=>(await import(`html2canvas-pro`)).default,Ll=e=>`element`in e?e.element:e,Rl=`ignore-screenshot`;function zl({renderLibrary:e=`html2canvas`,imageType:t=`png`,backgroundColor:n=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:a=`solid 1px ${P.neutral[300]}`,borderRadius:o=`10px`,onSuccess:s,onError:c,ignoreElements:l}){let[u,d]=H(`idle`),f=V(null),{onOpen:p,setImgBlob:m,ImageDownloadModal:h}=Vl(),g=async()=>{if(!f.current)throw console.error(`No node to use for screenshot`),Error(`No node to use for screenshot`);let t=Ll(f.current);if(!t)throw console.error(`Could not get HTMLElement from ref`),Error(`Could not get HTMLElement from ref`);let s=t.style.overflow,c=t.style.border,u=t.style.borderRadius,p=t.style.backgroundColor,m=t.style.height;function h(){let e=t;e&&(e.style.overflow=s,e.style.border=c,e.style.borderRadius=u,e.style.backgroundColor=p,e.style.height=m)}try{t.style.overflow=`hidden`,t.style.border=r?a:``,t.style.borderRadius=r?o:``,t.style.backgroundColor=n??P.neutral[100],t.style.height=`${String(t.offsetHeight)}px`;let s=document.createElement(`style`);document.head.appendChild(s),s.sheet?.insertRule(`body > div:last-child img { display: inline-block; }`);let c=l?e=>!l(e):void 0;d(`loading`);let u;u=e===`html2canvas`?await(await Il())(t,{logging:!1,backgroundColor:n??P.neutral[100],ignoreElements:l}):await jn(t,{filter:c}),s.remove();let f=i?document.createElement(`canvas`):u;if(i){f.width=u.width+80,f.height=u.height+80;let e=f.getContext(`2d`);if(e)e.shadowColor=`rgba(0, 0, 0, 0.5)`,e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(u,40,40);else throw console.error(`Error getting canvas context`),Error(`Error getting canvas context to add shadow effect`)}return await(await fetch(f.toDataURL())).blob()}catch(e){throw console.error(`Error converting to image`,e),e}finally{h()}};return{status:u,isLoading:u===`loading`,isErrored:u===`error`,isSuccess:u===`success`,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({[`image/${t}`]:g()})]),d(`success`),s&&s()}catch(e){e.message===`ClipboardItem is not defined`?(m(await g()),p(),d(`success`)):(d(`error`),console.error(`Error copying to clipboard`,e),c&&c(e))}},ImageDownloadModal:h,ref:f}}function Bl(e){let{successToast:t,failToast:n}=je(),{isLoading:r,copyToClipboard:i,ImageDownloadModal:a,ref:o}=zl({imageType:`png`,shadowEffect:!0,backgroundColor:e?.backgroundColor??P.neutral[100],onSuccess:()=>{t(`Copied the query result as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}}),s=R(()=>{if(o.current){let e=Ll(o.current);e&&(e.style.boxShadow=`rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px`,e.style.transition=`box-shadow 0.5s ease-in-out`)}},[o]),c=R(()=>{if(o.current){let e=Ll(o.current);e&&(e.style.boxShadow=``)}},[o]),l=R(async()=>{if(o.current){await i();let e=Ll(o.current);e&&(e.style.boxShadow=``)}else n(`Failed to copy image to clipboard`,`No content to copy`)},[o,i,n]);function u({imageType:e=`png`,...t}){return G(U,{children:[W(q,{size:`small`,sx:{position:`absolute`,bottom:16,right:16},disabled:r,onMouseEnter:s,onMouseLeave:c,onClick:l,startIcon:W(It,{}),...t,children:`Copy to Clipboard`}),W(a,{})]})}return{ref:o,CopyToClipboardButton:u,onMouseEnter:s,onMouseLeave:c,onCopyToClipboard:l}}function Vl(){let[e,t]=H(!1),[n,r]=H(),i=()=>t(!0),a=()=>t(!1);function o(){let[t,r]=H();return z(()=>{if(!n)return;let e=new FileReader;e.readAsDataURL(n),e.onloadend=e=>{e.target?.result!=null&&r(e.target.result)}},[]),G(lt,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[W(ft,{children:`Screenshot Preview`}),W(X,{"aria-label":`close`,onClick:a,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:W(wt,{})}),G(dt,{children:[G(J,{sx:{px:`10px`,gap:`10px`},children:[G(J,{direction:`row`,spacing:`5px`,sx:{alignItems:`center`},children:[W(K,{component:Bt,sx:{color:`error.main`}}),W(Y,{sx:{fontWeight:500,display:`inline`},children:`Copy to the Clipboard`}),` `,`is not supported in the current browser`]}),W(Y,{children:`Please download it directly`})]}),W(K,{component:`img`,src:t,alt:`screenshot`,sx:{maxWidth:`100%`}})]}),G(ut,{children:[W(q,{sx:{mr:1.5},onClick:a,children:`Close`}),W(q,{color:`iochmara`,variant:`contained`,onClick:()=>{n&&(ln(n,`recce-screenshot-${Tn(new Date,`yyyy-MM-dd-HH-mm-ss`)}.png`),a())},children:`Download`})]})]})}return{onOpen:i,setImgBlob:r,ImageDownloadModal:o}}function Hl(e,r={}){let{enabled:a=!0}=r,o=nt(),{apiClient:s}=no(),{data:l,isLoading:u,error:d,refetch:f}=tt({queryKey:O.checkEvents(e),queryFn:()=>n(e,s),enabled:a,refetchInterval:1e4,refetchIntervalInBackground:!1}),p=et({mutationFn:t=>i(e,t,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}}),m=et({mutationFn:({eventId:t,content:n})=>c(e,t,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}}),h=et({mutationFn:n=>t(e,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:O.checkEvents(e)})}});return{events:l??[],isLoading:u,error:d,refetch:f,createComment:p.mutate,isCreatingComment:p.isPending,createCommentError:p.error,updateComment:m.mutateAsync,isUpdatingComment:m.isPending,updateCommentError:m.error,deleteComment:h.mutateAsync,isDeletingComment:h.isPending,deleteCommentError:h.error}}const Ul={TOAST_ID:`lifetime-countdown`,WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>`The server will be closed in ${e} seconds.`,STYLE:{fontFamily:`monospace`}};function Wl(e){let t=I,[n,r]=H(null),i=V(void 0),a=R(()=>{if(!e)return 0;let t=new Date,n=Math.floor((e.getTime()-t.getTime())/1e3);return Math.max(0,n)},[e]),o=R(()=>{n!=null&&(t.remove(n),r(null))},[n]),s=R(()=>{if(n==null)return;let e=a();if(e<=0){o();return}t.update(n,{description:Ul.MESSAGE(e)})},[n,a,o]),c=R(()=>{if(!e)return;o();let n=a();n<=0||(r(t.create({id:Ul.TOAST_ID,description:Ul.MESSAGE(n)})),i.current=setInterval(s,Ul.UPDATE_INTERVAL))},[e,a,s,o]),l=a();pn(c,e?Math.max(0,l-Ul.WARNING_THRESHOLD)*1e3:null),z(()=>o,[o])}function Gl({run:e,runId:t,viewOptions:n}){let r=B(()=>!e?.type||!e?.result?!1:we(e.type),[e?.type,e?.result]),i=B(()=>{if(!e?.result)return null;let t=e.result;if(`total_row_count`in t&&typeof t.total_row_count==`number`)return t.total_row_count;let n=t.base,r=t.current,i=typeof n?.total_row_count==`number`?n.total_row_count:null,a=typeof r?.total_row_count==`number`?r.total_row_count:null;return i!==null&&a!==null?Math.max(i,a):i??a},[e?.result]),a=R(()=>{if(!e?.type||!e?.result)return null;let t={displayMode:n?.display_mode,primaryKeys:e?.params?.primary_keys};return ye(e.type,e.result,t)},[e?.type,e?.result,e?.params,n]),o=R(()=>{let e=a();return e?Oe(e.columns,e.rows):null},[a]),s=R(()=>{let e=a();return e?be(e.columns,e.rows):null},[a]),c=R(e=>{if(!t)return;let n=document.createElement(`a`);n.href=`/api/runs/${t}/export?format=${e}`,document.body.appendChild(n),n.click(),document.body.removeChild(n)},[t]),l=R(async()=>{let e=o();if(!e){I.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{await ve(e),I.create({title:`Copied to clipboard`,description:`CSV data copied successfully`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy CSV to clipboard:`,e),I.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[o]),u=B(()=>e?.type===`query_diff`&&!!e?.params?.primary_keys,[e?.type,e?.params]),d=R(()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`csv`);return}let n=o();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{let t=De(e?.type??``,e?.params);Ne(n,t),I.create({title:`Downloaded`,description:t,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download CSV file:`,e),I.create({title:`Download failed`,description:`Failed to download CSV file`,type:`error`,duration:3e3})}},[t,e,u,o,c]),f=R(async()=>{let e=s();if(!e){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{await ve(e),I.create({title:`Copied to clipboard`,description:`Text data copied — paste into any spreadsheet`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy TSV to clipboard:`,e),I.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[s]),p=R(()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`tsv`);return}let n=s();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let t=De(e?.type??``,e?.params).replace(/\.csv$/,`.tsv`);Ce(n,t),I.create({title:`Downloaded`,description:t,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download TSV file:`,e),I.create({title:`Download failed`,description:`Failed to download TSV file`,type:`error`,duration:3e3})}},[t,e,u,s,c]);return{canExportCSV:r,totalRowCount:i,copyAsCSV:l,copyAsTSV:f,downloadAsCSV:d,downloadAsExcel:R(async()=>{if(t&&!u&&[`query`,`query_base`,`query_diff`].includes(e?.type??``)){c(`xlsx`);return}let n=a();if(!n){I.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let t=await Pe(n.columns,n.rows),r=De(e?.type??``,e?.params).replace(/\.csv$/,`.xlsx`);Se(t,r),I.create({title:`Downloaded`,description:r,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download Excel file:`,e),I.create({title:`Download failed`,description:`Failed to download Excel file`,type:`error`,duration:3e3})}},[t,e,u,a,c]),downloadAsTSV:p}}function Kl({description:e,onLike:t,onDislike:n,onClickLink:r,externalLink:i,externalLinkText:a}){return G(K,{sx:{display:`flex`,gap:4,justifyContent:`center`,alignContent:`center`,alignItems:`center`},children:[e,W(X,{"aria-label":`thumbs up`,onClick:t,sx:{width:`32px`,height:`32px`},children:W(K,{component:`img`,src:`/imgs/feedback/thumbs-up.png`,alt:`like`})}),W(X,{"aria-label":`thumbs down`,onClick:n,sx:{width:`32px`,height:`32px`},children:W(K,{component:`img`,src:`/imgs/feedback/thumbs-down.png`,alt:`dislike`})}),i&&a&&G(pt,{href:i,target:`_blank`,onClick:r,sx:{textDecoration:`underline`},children:[a,` `,W(ht,{})]})]})}function ql(e){let{feedbackId:t,description:n,onFeedbackSubmit:r,externalLink:i,externalLinkText:a}=e,[o,s]=H(void 0);function c(e=!1){let c=localStorage.getItem(t);o??(c===`true`&&!e||s(I.create({id:t,duration:void 0,type:`success`,description:W(J,{direction:`row`,children:W(Kl,{description:n,onLike:()=>{r(`like`),I.dismiss(t),localStorage.setItem(t,`true`)},onDislike:()=>{r(`dislike`),I.dismiss(t),localStorage.setItem(t,`true`)},externalLink:i,externalLinkText:a,onClickLink:()=>{r(`link`)}})})})))}return{feedbackToast:c,closeToast:()=>{o&&I.dismiss(o)}}}function Jl(e){let[t,n]=H(void 0),{guideId:r,description:i,externalLinkText:a,onExternalLinkClick:o}=e;function s(){t??n(I.create({id:r,duration:3e3,type:`success`,description:i,action:{label:a??`link`,onClick:()=>{o&&o()}}}))}return{guideToast:s,closeGuideToast:()=>{t&&I.dismiss(t)}}}function Yl(e,t){let n=[];return e.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),t.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),n}function Xl(e,t){let{lineageGraph:n}=j(),r=D(),i=t??r?.apiClient,a=_n.find(n?.nodes,{data:{name:e}}),s=!!i&&!!a?.id,{data:c,isLoading:l,error:u}=tt({queryKey:[`modelDetail`,a?.id],queryFn:()=>{if(!a?.id||!i)throw Error(`useModelColumns: missing node id or api client`);return o(a.id,i)},enabled:s,staleTime:300*1e3}),{columns:d,primaryKey:f}=B(()=>{let e=c?.model;return!e?.base.columns||!e.current.columns?{columns:[],primaryKey:e?.current.primary_key}:{columns:Yl(Object.values(e.base.columns),Object.values(e.current.columns)),primaryKey:e.current.primary_key}},[c]);return{columns:d,primaryKey:f,isLoading:s?l:!1,error:u?u instanceof Error?u:Error(String(u)):null}}const Zl=e=>{let{apiClient:t}=no(),[n,i]=H(!!e),[a,o]=H(!1),[,s]=pe(),c=V(null);z(()=>{e&&(i(!0),c.current=null)},[e]);let{error:l,data:u}=tt({queryKey:O.run(e??``),queryFn:async()=>await m(e??``,n?2:0,t),enabled:!!e,refetchInterval:n?50:!1,retry:!1});z(()=>{if(!u)return;let e=u.status?.toLowerCase();l||u.result||u.error||e&&e!==`running`?c.current!==u.run_id&&(c.current=u.run_id,i(!1)):e===`running`&&(c.current=null,i(!0))},[u,l]),z(()=>{(l||u?.result||u?.error)&&(u?.type===`row_count_diff`||u?.type===`row_count`)&&s?.()},[u,l,s]);let d=R(async()=>{o(!0),e&&await r(e,t)},[e,t]),f;return u&&E(u.type)&&(f=Lc(u.type).RunResultView),{run:u,isRunning:n,aborting:a,error:l,onCancel:d,RunResultView:f}};function Ql(){let e=yt(),t=xe(),n=F(),[r,i]=H(!1);z(()=>{i(!0)},[]);let a=r?t?t.resolvedMode===`dark`:n:!1;return{isDark:a,theme:e,background:{default:a?P.neutral[900]:P.white,paper:a?P.neutral[800]:P.white,subtle:a?P.neutral[800]:P.neutral[50],emphasized:a?P.neutral[700]:P.neutral[100]},text:{primary:a?P.neutral[50]:P.neutral[900],secondary:a?P.neutral[400]:P.neutral[600],disabled:a?P.neutral[500]:P.neutral[400],inverted:a?P.neutral[900]:P.neutral[50]},border:{light:a?P.neutral[700]:P.neutral[200],default:a?P.neutral[600]:P.neutral[300],strong:a?P.neutral[500]:P.neutral[400]},status:{added:{bg:a?P.green[900]:P.green[100],text:a?P.neutral[50]:P.neutral[900]},removed:{bg:a?P.red[950]:P.red[200],text:a?P.neutral[50]:P.neutral[900]},modified:{bg:a?P.yellow[900]:P.amber[100],text:a?P.neutral[50]:P.neutral[900]}},interactive:{hover:a?P.neutral[700]:P.neutral[100],active:a?P.neutral[600]:P.neutral[200],focus:P.iochmara[500]}}}export{cc as $,Oa as $t,nl as A,Vr as An,wo as At,Ic as B,no as Bt,gl as C,ji as Cn,Io as Ct,al as D,si as Dn,ko as Dt,ul as E,li as En,jo as Et,Hc as F,Mr as Fn,yo as Ft,Cc as G,Ka as Gt,jc as H,Qa as Ht,Bc as I,Nr as In,vo as It,gc as J,Ba as Jt,Sc as K,Ga as Kt,zc as L,Ar as Ln,ho as Lt,qc as M,zr as Mn,bo as Mt,Kc as N,Fr as Nn,_o as Nt,il as O,oi as On,Co as Ot,Wc as P,Ir as Pn,go as Pt,lc as Q,Pa as Qt,Rc as R,ao as Rt,_l as S,ki as Sn,Bo as St,pl as T,ci as Tn,Po as Tt,Ac as U,Za as Ut,Fc as V,eo as Vt,Oc as W,Ya as Wt,fc as X,Ia as Xt,mc as Y,Ra as Yt,dc as Z,Ma as Zt,Al as _,mi as _n,ns as _t,Jl as a,da as an,Ns as at,Ol as b,Ni as bn,Xo as bt,Wl as c,Qi as cn,As as ct,zl as d,Yi as dn,Ts as dt,Ea as en,Bs as et,Bl as f,Ji as fn,xs as ft,Pl as g,di as gn,ps as gt,Nl as h,Ki as hn,_s as ht,Xl as i,_a as in,Fs as it,tl as j,Lr as jn,To as jt,rl as k,ii as kn,Do as kt,Hl as l,Zi as ln,Os as lt,Fl as m,Bi as mn,ys as mt,Zl as n,va as nn,Hs as nt,ql as o,ra as on,$ as ot,Vl as p,zi as pn,bs as pt,xc as q,Ha as qt,Yl as r,ya as rn,Is as rt,Gl as s,na as sn,ks as st,Ql as t,Ca as tn,Vs as tt,Rl as u,Xi as un,Es as ut,Cl as v,pi as vn,is as vt,ml as w,ui as wn,Ro as wt,xl as x,Ii as xn,Yo as xt,Sl as y,fi as yn,ts as yt,Lc as z,ro as zt};
7
+ //# sourceMappingURL=hooks-Il_UWbPS.js.map