@datarecce/ui 1.59.0 → 1.60.0-nightly.20260809
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ScreenshotDataGrid-C0a0wbBT.d.ts.map +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +1 -1
- package/dist/{chartTheme-CRNnzu80.d.ts → chartTheme-Bvfcz7RJ.d.ts} +24 -2
- package/dist/{chartTheme-CRNnzu80.d.ts.map → chartTheme-Bvfcz7RJ.d.ts.map} +1 -1
- package/dist/components-run.js +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/hooks-CHOQS8OF.js +7 -0
- package/dist/hooks-CHOQS8OF.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/{index-BGsgHfs5.d.ts → index-DFyyDTjx.d.ts} +11 -2
- package/dist/{index-BGsgHfs5.d.ts.map → index-DFyyDTjx.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{lineage-BNYgYQBZ.d.ts → lineage-DYzdL90Y.d.ts} +4 -3
- package/dist/{lineage-BNYgYQBZ.d.ts.map → lineage-DYzdL90Y.d.ts.map} +1 -1
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.js +1 -1
- package/dist/result.js +1 -1
- package/dist/src-wC_8HFG2.js +12 -0
- package/dist/src-wC_8HFG2.js.map +1 -0
- package/dist/theme-BFY2LXHk.js +3 -0
- package/dist/theme-BFY2LXHk.js.map +1 -0
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +1 -1
- package/dist/utils-svMSMuTZ.js +6 -0
- package/dist/utils-svMSMuTZ.js.map +1 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/package.json +8 -8
- package/dist/hooks-DxCl_1oG.js +0 -7
- package/dist/hooks-DxCl_1oG.js.map +0 -1
- package/dist/src-GMigm_06.js +0 -12
- package/dist/src-GMigm_06.js.map +0 -1
- package/dist/theme-u98ih3Tv.js +0 -3
- package/dist/theme-u98ih3Tv.js.map +0 -1
- package/dist/utils-DITU6vUm.js +0 -6
- package/dist/utils-DITU6vUm.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{$ as e,A as t,C as n,D as r,E as i,F as a,I as o,J as s,M as c,N as l,P as u,S as d,T as f,V as p,Y as m,_ as h,a as g,c as _,d as v,ft as y,h as b,j as x,l as S,m as C,n as w,nt as T,o as E,p as D,q as O,rt as k,s as ee,u as te}from"./api-S5ho3Qs3.js";import{c as ne,f as A}from"./keepAlive-bjIHulj-.js";import{n as j,r as M,t as N}from"./fetchClient-D0p358nB.js";import{A as re,D as P,E as ie,N as ae,S as oe,T as se,_ as ce,a as le,b as ue,c as de,d as fe,f as pe,g as me,h as he,j as ge,l as _e,m as ve,o as ye,p as be,s as xe,u as Se,v as Ce,x as we,y as F}from"./utils-D2GZ30yl.js";import{m as Te}from"./theme-BFY2LXHk.js";import{i as Ee,n as De}from"./colors-4aGxuAVw.js";import{$ as Oe,$t as ke,A as Ae,An as je,Bt as I,C as Me,Cn as Ne,D as Pe,Dn as Fe,E as Ie,En as Le,F as Re,Fn as ze,Ft as Be,Gn as Ve,Gt as L,Hn as He,Ht as Ue,In as We,It as R,Jt as Ge,Kn as Ke,Kt as qe,Ln as Je,Mn as Ye,Nn as Xe,Nt as Ze,O as Qe,On as $e,Pn as et,Pt as tt,Qt as nt,Rt as rt,S as it,Sn as at,Tn as ot,Un as st,Ut as ct,Vt as lt,Wt as ut,Xt as dt,Yt as ft,an as pt,b as mt,bt as ht,cn as gt,ct as _t,d as vt,en as yt,f as bt,ft as xt,gt as St,i as Ct,in as wt,it as Tt,jn as Et,jt as Dt,k as Ot,kn as kt,l as At,lt as jt,mn as Mt,n as Nt,nn as Pt,on as Ft,qt as It,rn as Lt,sn as Rt,t as zt,tn as Bt,u as Vt,un as Ht,ut as Ut,vn as Wt,vt as Gt,w as Kt,wn as qt,xn as Jt,yt as Yt,z,zt as Xt}from"./hooks-CHOQS8OF.js";import{Bt as Zt,Vt as Qt,_ as $t,c as en,ft as tn,ht as nn,l as rn,o as an,p as on,r as sn,s as cn,t as ln,zt as un}from"./utils-svMSMuTZ.js";import{fetchGitHubAvatar as dn,fetchUser as fn}from"./lib/api/user.js";import{PUBLIC_API_URL as pn,PUBLIC_CLOUD_WEB_URL as mn,RECCE_SUPPORT_CALENDAR_URL as hn}from"./lib/const.js";import{EXPLORE_ACTION as gn,EXPLORE_SOURCE as _n,trackArtifactUploadStarted as vn,trackColumnLevelLineage as yn,trackCopyToClipboard as bn,trackDwSetupCompleted as xn,trackDwSetupShown as Sn,trackDwSetupSkipped as Cn,trackEnvironmentConfig as wn,trackExploreAction as Tn,trackHistoryAction as En,trackInit as Dn,trackLineageSelection as On,trackLineageViewRender as kn,trackMultiNodesAction as An,trackNavigation as jn,trackOssShareButtonClicked as Mn,trackProfileDistribution as Nn,trackRedirectToCloudSession as Pn,trackSignupCompleted as Fn,trackSignupRedirectInitiated as In,trackStateAction as Ln}from"./lib/api/track.js";import{t as Rn}from"./constants-Bgp90yan.js";import{QueryClient as zn,QueryClientProvider as Bn,useMutation as Vn,useQuery as Hn,useQueryClient as Un}from"@tanstack/react-query";import{Suspense as Wn,createContext as Gn,forwardRef as Kn,memo as qn,useCallback as B,useContext as Jn,useEffect as V,useImperativeHandle as Yn,useLayoutEffect as Xn,useMemo as H,useRef as U,useState as W}from"react";import{Fragment as G,jsx as K,jsxs as q}from"react/jsx-runtime";import J from"@mui/material/Box";import Y from"@mui/material/Button";import Zn from"@mui/material/Dialog";import Qn from"@mui/material/DialogActions";import $n from"@mui/material/DialogContent";import er from"@mui/material/DialogTitle";import tr from"@mui/material/Link";import X from"@mui/material/Stack";import Z from"@mui/material/Typography";import nr from"js-cookie";import{LuExternalLink as rr,LuSave as ir}from"react-icons/lu";import{useTheme as ar}from"@mui/material/styles";import{useTheme as or}from"next-themes";import Q from"@mui/material/IconButton";import sr from"next/link";import{IoBookmarksOutline as cr,IoClose as lr,IoSync as ur,IoWarning as dr}from"react-icons/io5";import fr from"@mui/material/Divider";import pr from"@mui/material/CircularProgress";import $ from"@mui/material/Tooltip";import{FaCloud as mr,FaExpandArrowsAlt as hr,FaGithub as gr,FaQuestionCircle as _r,FaRegDotCircle as vr,FaSlack as yr,FaUser as br}from"react-icons/fa";import{PiBookmarkSimple as xr,PiCaretDown as Sr,PiChatText as Cr,PiCheckCircle as wr,PiCircle as Tr,PiCopy as Er,PiExport as Dr,PiInfo as Or,PiInfoFill as kr,PiMoon as Ar,PiNotePencil as jr,PiPencil as Mr,PiPencilSimple as Nr,PiPlusCircle as Pr,PiRepeat as Fr,PiSun as Ir,PiTrashFill as Lr,PiTrashSimple as Rr,PiUserPlus as zr,PiX as Br}from"react-icons/pi";import Vr from"@mui/material/Chip";import{Background as Hr,BackgroundVariant as Ur,BaseEdge as Wr,ControlButton as Gr,Controls as Kr,MiniMap as qr,Panel as Jr,Position as Yr,ReactFlow as Xr,ReactFlowProvider as Zr,getBezierPath as Qr,getNodesBounds as $r,useEdgesState as ei,useNodesState as ti,useReactFlow as ni,useStore as ri}from"@xyflow/react";import ii from"file-saver";import ai from"@mui/material/Checkbox";import oi from"@mui/material/FormControlLabel";import si from"@mui/material/Alert";import ci from"@mui/material/InputBase";import li from"@mui/material/Menu";import ui from"@mui/material/MenuItem";import{isEmpty as di}from"lodash";import{VscCircleLarge as fi,VscGitPullRequest as pi,VscHistory as mi,VscKebabVertical as hi}from"react-icons/vsc";import gi from"@mui/material/ListSubheader";import _i from"@mui/material/FormControl";import{Box as vi,Typography as yi}from"@mui/material";import bi from"@mui/material/TextField";import{format as xi,formatDistanceToNow as Si}from"date-fns";import Ci from"@mui/material/Tab";import wi from"@mui/material/Tabs";import Ti from"@mui/material/List";import Ei from"@mui/material/ListItem";import Di from"@mui/material/Avatar";import Oi from"@mui/material/Popover";import{usePathname as ki,useRouter as Ai,useSearchParams as ji}from"next/navigation";import{MdArrowBack as Mi,MdArrowDownward as Ni,MdArrowUpward as Pi,MdGpsFixed as Fi,MdInfo as Ii,MdSearch as Li}from"react-icons/md";import{TbChecklist as Ri,TbEdit as zi}from"react-icons/tb";import Bi from"@mui/material/ListItemIcon";import Vi from"@mui/material/ListItemText";import{FiArrowRight as Hi,FiCopy as Ui,FiInfo as Wi,FiPackage as Gi}from"react-icons/fi";import Ki from"@mui/material/Switch";import{RiArrowDownSFill as qi,RiArrowUpSFill as Ji,RiMindMap as Yi,RiSwapLine as Xi,RiTerminalBoxLine as Zi}from"react-icons/ri";import{FaBookmark as Qi,FaFileImport as $i}from"react-icons/fa6";import{captureException as ea}from"@sentry/react";import{BiArrowFromBottom as ta,BiArrowToBottom as na}from"react-icons/bi";import"@xyflow/react/dist/style.css";import ra from"@dagrejs/dagre";import ia from"@mui/material/Skeleton";import aa from"@mui/material/Radio";import oa from"@mui/material/RadioGroup";import{snapdom as sa}from"@zumer/snapdom";import ca from"@mui/material/Paper";import la from"@mui/material/Table";import ua from"@mui/material/TableBody";import da from"@mui/material/TableCell";import fa from"@mui/material/TableContainer";import pa from"@mui/material/TableHead";import ma from"@mui/material/TableRow";import ha from"@mui/material/InputLabel";import ga from"@mui/material/Select";import _a from"@mui/material/Badge";import va from"@mui/material/Grid";import{stripIndents as ya}from"common-tags";import{IoMdCodeWorking as ba}from"react-icons/io";import{DragDropContext as xa,Draggable as Sa,Droppable as Ca}from"@hello-pangea/dnd";import wa from"@mui/material/Card";import Ta from"@mui/material/CardContent";import Ea from"@mui/material/CardHeader";const Da=Gn(null);Da.displayName=`RecceRoutingContext`;function Oa(){return Jn(Da)||{basePath:``,buildPath:e=>e,pathname:``,navigate:e=>{typeof window<`u`&&(window.location.href=e)}}}function ka(){let{pathname:e,navigate:t}=Oa();return[e,t]}function Aa({children:e,config:t}){let n=t?.basePath??``,r=t?.pathname??``,i=t?.onNavigate,a=B(e=>n?`${n}${e.startsWith(`/`)?e:`/${e}`}`:e,[n]),o=B((e,t)=>{i?i(e,t):typeof window<`u`&&(t?.replace?(window.history.replaceState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))):window.location.href=e)},[i]),s=H(()=>({basePath:n,buildPath:a,pathname:r,navigate:o}),[n,a,r,o]);return K(Da.Provider,{value:s,children:e})}const ja=e=>new zn({defaultOptions:{queries:{staleTime:e?.staleTime??6e4,gcTime:e?.gcTime??3e5,retry:1,refetchOnWindowFocus:!1}}});function Ma({children:e,api:t,theme:n=`system`,routing:r,queryClient:i,runActions:a,lineage:o,checks:s,query:c,features:l={}}){let u=i?.staleTime,d=i?.gcTime,f=H(()=>ja({staleTime:u,gcTime:d}),[u,d]),{enableInstance:p=!0,enableIdleTimeout:m=!0,enableLineage:h=!0,enableRunActions:g=!0,enableChecks:_=!0,enableQuery:v=!0}=l,y=e;return y=K(Aa,{config:r,children:y}),y=K(Qt,{defaultMode:n,children:y}),y=K(ne,{config:t,children:y}),y=K(Bn,{client:f,children:y}),v&&(y=K(st,{sql:c?.sql,isExecuting:c?.isExecuting,error:c?.error,baseResult:c?.baseResult,currentResult:c?.currentResult,onSqlChange:c?.onSqlChange,onExecute:c?.onExecute,onCancel:c?.onCancel,children:y})),_&&(y=K(Ve,{checks:s?.checks,isLoading:s?.isLoading,error:s?.error,selectedCheckId:s?.selectedCheckId,onSelectCheck:s?.onSelectCheck,onCreateCheck:s?.onCreateCheck,onUpdateCheck:s?.onUpdateCheck,onDeleteCheck:s?.onDeleteCheck,onReorderChecks:s?.onReorderChecks,refetchChecks:s?.refetchChecks,children:y})),g&&(y=K(re,{onRunAction:a?.onRunAction,onShowRunId:a?.onShowRunId,initialRunId:a?.initialRunId,initialHistoryOpen:a?.initialHistoryOpen,children:y})),h&&(y=K(Ce,{lineageGraph:o?.lineageGraph,envInfo:o?.envInfo,reviewMode:o?.reviewMode,cloudMode:o?.cloudMode,fileMode:o?.fileMode,fileName:o?.fileName,isDemoSite:o?.isDemoSite,isCodespace:o?.isCodespace,isLoading:o?.isLoading,error:o?.error,supportTasks:o?.supportTasks,onRefetchLineageGraph:o?.onRefetchLineageGraph,runsAggregated:o?.runsAggregated,onRefetchRunsAggregated:o?.onRefetchRunsAggregated,children:y})),m&&(y=K(we,{children:y})),p&&(y=K(se,{children:y})),y}function Na({actionState:e,onCancel:t,onClose:n}){let r=()=>e.mode===`per_node`?`${e.completed} / ${e.total}`:e.currentRun?.progress?.percentage?`${e.currentRun.progress.percentage*100}%`:e.status===`completed`?`100%`:`0%`,i=e.status===`running`||e.status===`canceling`;return K(J,{sx:{bgcolor:`background.paper`,borderRadius:1,boxShadow:6},children:q(X,{direction:`row`,divider:K(fr,{orientation:`vertical`,flexItem:!0}),spacing:2,sx:{p:`5px 15px`,mt:2},children:[q(J,{sx:{fontSize:`10pt`},children:[`Progress: `,r(),` `,e.status===`canceled`?` (canceled)`:``]}),i?K(Y,{size:`small`,variant:`outlined`,onClick:t,disabled:e.status===`canceling`,children:e.status===`canceling`?`Canceling`:`Cancel`}):K(X,{direction:`row`,children:K(Y,{size:`small`,variant:`outlined`,onClick:n,children:`Close`})})]})})}function Pa(e){return e?{node_id:e,change_analysis:!0,no_upstream:!0}:{change_analysis:!0,no_upstream:!0}}function Fa({nodeId:e,setChangeAnalysisMode:t,showColumnLevelLineage:n}){t?.(!0),n?.(Pa(e))}function Ia(e,t){return{node_id:e,column:t}}function La(e,t){return{...e,change_analysis:e.change_analysis??t}}function Ra({cllInput:e,changeAnalysisMode:t,newCllExperience:n}){return!e&&!n?!1:t}function za({changeAnalysisMode:e,newCllExperience:t}){return t&&e?Pa():void 0}function Ba({nodeId:e,changeAnalysisMode:t,cllInput:n,lineageGraph:r}){if(!r||!t)return!1;let i=!!(e in r.nodes?r.nodes[e]:void 0)?.data.changeStatus;return n?.node_id&&!n.column?n.node_id===e&&i:i}const Va=({lineageGraph:e,cllInput:t,onCenterNode:n})=>{let r={cursor:`pointer`,fontFamily:`monospace`,bgcolor:Zt()?`grey.700`:`grey.100`,px:.5,borderRadius:.5};if(!e)return K(G,{});if(!t)return K(G,{children:`Default View`});if(t.node_id===void 0)return K(Z,{component:`span`,children:`Impact Radius for All Changed Models`});let i=t.node_id in e.nodes?e.nodes[t.node_id].data.name:t.node_id;if(!t.column){let e=t.node_id;return q(G,{children:[K(Z,{component:`span`,sx:{mr:`5px`},children:`Impact Radius for`}),K(J,{component:`code`,onClick:()=>{n(e)},sx:r,children:i})]})}let a=`${t.node_id}_${t.column}`;return q(G,{children:[q(Z,{component:`span`,sx:{mr:`5px`},children:[`Column Lineage for`,` `]}),q(J,{component:`code`,onClick:()=>{n(a)},sx:r,children:[i,`.`,t.column]})]})},Ha=({action:e,interactive:t,viewOptions:n,lineageGraph:r,singleEnvMode:i=!1,changeAnalysisAvailable:a=!0,onShowCll:o,onResetCll:s,onCenterNode:c,setChangeAnalysisMode:l,newCllExperience:u=!1,changeAnalysisMode:d=!1})=>{let f=n.column_level_lineage,p=!r?.catalogMetadata.current,m=u&&d,h=f&&!(u&&!f.column);return q(X,{direction:`row`,spacing:`5px`,children:[!i&&!m&&K(J,{sx:{borderRadius:1,boxShadow:3},children:K($,{enterDelay:50,title:a?p?`Please provide catalog.json to enable Impact Radius`:``:`Requires warehouse connection`,placement:`top`,children:K(`span`,{children:K(Y,{size:`small`,variant:`outlined`,color:`neutral`,sx:{whiteSpace:`nowrap`,display:`inline-flex`,bgcolor:`background.paper`},disabled:!t||p||!a||e.isPending,startIcon:K(vr,{}),onClick:()=>{Fa({setChangeAnalysisMode:l,showColumnLevelLineage:o})},children:`Impact Radius`})})})}),h&&q(X,{direction:`row`,sx:{alignItems:`center`,borderRadius:1,boxShadow:3,border:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`,fontSize:`0.8rem`,p:`0 0.625rem`},children:[K(Va,{lineageGraph:r,cllInput:f,onCenterNode:c}),e.isError&&K($,{title:`Error: ${e.error.message}`,placement:`bottom`,children:K(Z,{component:`span`,sx:{color:`error.main`,ml:`2px`,display:`inline-flex`,alignItems:`center`},children:K(J,{component:Or,sx:{color:`error.main`,fontSize:`14px`}})})}),e.isPending?K(pr,{size:12,sx:{ml:`2px`}}):K(Q,{size:`small`,sx:{ml:`2px`},"aria-label":`Reset Column Level Lineage`,onClick:()=>{s()},children:K(Br,{size:`10px`})})]})]})};function Ua({onClose:e}){let{cancel:t,actionState:n}=ce();return K(Na,{actionState:n,onCancel:t,onClose:e})}const Wa=({action:e})=>{let{showColumnLevelLineage:t,resetColumnLevelLineage:n,interactive:r,viewOptions:i,centerNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c}=ce(),{data:l}=pe(),u=l?.single_env_onboarding??!1,{lineageGraph:d,isActionAvailable:f}=F();return K(Ha,{action:e,interactive:r,viewOptions:i,lineageGraph:d,singleEnvMode:u,changeAnalysisAvailable:f(`change_analysis`),onShowCll:t,onResetCll:()=>n(),onCenterNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c})};function Ga(e){let{id:t,data:n}=e,{id:r}=n.node,{column:i,type:a,transformationType:o,changeStatus:s,isImpacted:c}=n,l=ri(e=>e.transform[2]>.3),{isDark:u}=zt(),{viewOptions:d,showContextMenu:f,isNodeHighlighted:p,isNodeShowingChangeAnalysis:m,newCllExperience:h}=ce(),g=d.column_level_lineage?.node_id,_=i===d.column_level_lineage?.column&&r===g,v=p(t),y=m(r);return K(Jt,{id:t,data:{column:i,type:a,nodeId:r,transformationType:o,changeStatus:s,isHighlighted:v,isFocused:_,isImpacted:c},showContent:l,showChangeAnalysis:y,isDark:u,newCllExperience:h,onContextMenu:(t,n)=>{f(t,e)}})}const Ka=qn(Ga);Ka.displayName=`GraphColumnNode`;function qa(e){let{source:t,target:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,style:l={},markerEnd:u,data:d,isEdgeHighlighted:f}=e,p={...l};d?.changeStatus&&(p.stroke=Et(d.changeStatus).hexColor,p.strokeDasharray=`5`),!f||f(t,n)||(p.filter=et);let[m]=Qr({sourceX:r,sourceY:i,sourcePosition:s,targetX:a,targetY:o,targetPosition:c});return K(G,{children:K(Wr,{path:m,markerEnd:u,style:{...p,...l}})})}const Ja=qn(qa);Ja.displayName=`GraphEdge`;function Ya(e){let{isEdgeHighlighted:t}=ce();return K(Ja,{...e,isEdgeHighlighted:t})}const Xa=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`})}),Za=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`})});function Qa({skipReason:e}){return K(Vr,{size:`small`,label:q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`grey.500`,alignItems:`center`,gap:`3px`},children:[K(J,{children:`Skipped`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K(Xa,{})})})]}),sx:{bgcolor:`grey.100`}})}function $a({errorMessage:e}){return q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`gray`,alignItems:`center`},children:[K(J,{children:`Error`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K(Za,{})})})]})}function eo({result:e}){let{mismatchedColumns:t}=e,n=t>0;return K(Vr,{size:`small`,sx:{bgcolor:n?`error.light`:`success.light`},label:K(X,{direction:`row`,sx:{fontSize:`10pt`,color:n?`error.main`:`success.main`,alignItems:`center`,gap:`3px`},children:n?`${t} columns mismatched`:`All columns match`})})}function to({result:e}){let{base:t,current:n}=e,r=Zt(),i=Te(r),a=on(t,n),o=t===null?`N/A`:t.toLocaleString(),s=n===null?`N/A`:n.toLocaleString(),c=``,l=`grey.500`;return t!==null&&n!==null&&(a===`increase`?(c=`↑`,l=i.current.foreground):a===`decrease`?(c=`↓`,l=i.base.foreground):c=`=`),K(Vr,{size:`small`,sx:{bgcolor:`grey.100`},label:q(X,{direction:`row`,sx:{fontSize:`10pt`,alignItems:`center`,gap:`3px`},children:[K(J,{children:o}),K(J,{children:`→`}),K(J,{children:s}),c&&K(J,{component:`span`,"data-row-count-direction":a,sx:{color:l,ml:.5},children:c})]})})}function no({status:e,skipReason:t,errorMessage:n,progress:r,valueDiffResult:i,rowCountDiffResult:a,runId:o,"data-testid":s}){return e===`pending`?K(pr,{size:16,"data-testid":s,"data-status":`pending`}):e===`skipped`?K(J,{"data-testid":s,"data-status":`skipped`,children:K(Qa,{skipReason:t})}):e===`running`?r?.percentage===void 0?K(pr,{size:16,"data-testid":s,"data-status":`running`}):K(pr,{variant:`determinate`,value:r.percentage*100,size:16,"data-testid":s,"data-status":`running`}):e===`error`?K(J,{"data-testid":s,"data-status":`error`,children:K($a,{errorMessage:n})}):i?K(J,{"data-testid":s,"data-status":`success`,children:K(eo,{result:i})}):a?K(J,{"data-testid":s,"data-status":`success`,children:K(to,{result:a})}):K(J,{"data-testid":s,"data-status":`success`,children:o||`Complete`})}const ro=qn(no);ro.displayName=`ActionTag`;const io={success:`#059669`,failure:`#ef4444`,error:`#ef4444`,warning:`#f59e0b`},ao={success:`PASSED`,failure:`FAILED`,error:`ERROR`,warning:`WARNING`};function oo(e){return io[e]??`#6b7280`}function so(e){return ao[e]??e.toUpperCase()}function co({run:e,index:t,onClick:n}){let r=oo(e.status),i=so(e.status),a=Si(new Date(e.run_at),{addSuffix:!0}),o=!!n;return q(vi,{component:o?`button`:`div`,type:o?`button`:void 0,onClick:o?()=>n?.(e.run_id):void 0,"aria-label":o?`View run #${t} — ${i}`:void 0,sx:{p:1,border:`none`,borderLeft:`3px solid ${r}`,borderRadius:1,bgcolor:`action.hover`,cursor:o?`pointer`:`default`,"&:hover":o?{bgcolor:`action.selected`}:{},textAlign:`left`,width:`100%`,font:`inherit`,color:`inherit`},children:[q(yi,{variant:`body2`,sx:{fontWeight:600,fontSize:`0.75rem`},children:[`Run #`,t,` — `,i,e.triggered_by===`recce_ai`&&K(yi,{component:`span`,sx:{ml:.75,fontSize:`0.65rem`,fontWeight:500,color:`#7c3aed`},children:`by AI`})]}),e.summary&&K(yi,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.7rem`,mt:.25},children:e.summary}),K(yi,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mt:.25},children:a})]})}function lo({event:e}){let t=p(e),n={create:Pr,comment:Cr,approve:wr,unapprove:Tr,edit:jr,preset:xr},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 K(J,{component:i,sx:{color:a,fontSize:16}})}function uo({event:e}){let{actor:t}=e,{avatarUrl:n}=Xt({userId:t.user_id}),r=(t.fullname||t.login||`User`).charAt(0).toUpperCase();return K(Di,{src:n||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:r})}function fo({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=Si(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 q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(lo,{event:e})}),K(J,{sx:{flex:1},children:q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[K(uo,{event:e}),K(Z,{variant:`body2`,sx:{fontWeight:`500`},children:n}),K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:i}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:r})]})})]})}function po({event:e,currentUserId:t,onEdit:n,onDelete:r}){let i=Zt(),[a,o]=W(!1),[s,c]=W(e.content||``),[l,u]=W(!1),[d,f]=W(!1),[p,m]=W(null),h=!!p,{actor:g}=e,_=g.fullname||g.login||`Someone`,v=Si(new Date(e.created_at),{addSuffix:!0}),y=t&&String(g.user_id)===String(t),b=()=>{c(e.content||``),o(!0)},x=()=>{c(e.content||``),o(!1)},S=async()=>{let t=s.trim();if(!t||t===e.content){x();return}if(n){u(!0);try{await n(e.id,t),o(!1)}finally{u(!1)}}},C=e=>{e.key===`Escape`?x():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())},w=e=>{m(e.currentTarget)},T=()=>{m(null)};return e.is_deleted?q(J,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[K(J,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:K(lo,{event:e})}),K(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:K(Z,{variant:`body2`,sx:{color:`text.disabled`,fontStyle:`italic`},children:`Comment deleted`})})]}):q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(lo,{event:e})}),q(J,{sx:{flex:1},children:[q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[K(uo,{event:e}),q(Z,{variant:`body2`,sx:{fontWeight:`500`},children:[_,y&&q(Z,{component:`span`,variant:`body2`,sx:{color:`text.secondary`},children:[` `,`(Author)`]})]}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:v}),e.is_edited&&K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:`(edited)`})]}),a?q(J,{children:[K(bi,{value:s,onChange:e=>c(e.target.value),onKeyDown:C,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:l,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`,mt:1},children:[K(Y,{size:`small`,variant:`text`,onClick:x,disabled:l,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,onClick:S,disabled:!s.trim()||l,children:l?`Saving...`:`Save`})]})]}):q(J,{sx:{bgcolor:i?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:i?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[K(xt,{content:e.content||``,fontSize:`sm`}),y&&(n||r)&&q(X,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&K($,{title:`Edit comment`,children:K(Q,{"aria-label":`Edit comment`,size:`small`,onClick:b,children:K(Nr,{})})}),r&&q(G,{children:[K($,{title:`Delete comment`,children:K(Q,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:w,children:K(Rr,{})})}),K(Oi,{open:h,anchorEl:p,onClose:T,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:q(J,{sx:{p:2},children:[K(Z,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[K(Y,{size:`small`,variant:`text`,onClick:T,disabled:d,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,color:`error`,onClick:async()=>{if(r){f(!0);try{await r(e.id),T()}finally{f(!1)}}},disabled:d,children:d?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}function mo({event:e,currentUserId:t,onEdit:n,onDelete:r}){return e.event_type===`comment`?K(po,{event:e,currentUserId:t,onEdit:n,onDelete:r}):K(fo,{event:e})}function ho(e,t){let n=e?.toLowerCase();return n===`finished`?t?`error`:`success`:n===`failed`?`error`:e??`unknown`}function go(e,t){let n=[];for(let t of e)n.push({kind:`event`,event:t,at:t.created_at});if(t){let e=[...t].sort((e,t)=>new Date(e.run_at).getTime()-new Date(t.run_at).getTime());for(let t=0;t<e.length;t++)n.push({kind:`run`,run:e[t],index:t+1,at:e[t].run_at})}return n.sort((e,t)=>new Date(t.at).getTime()-new Date(e.at).getTime()),n}function _o({checkId:t}){let n=Zt(),{apiClient:r,authToken:i}=I(),{events:a,isLoading:o,error:s,createComment:c,isCreatingComment:l,updateComment:u,deleteComment:d}=At(t),{data:f}=Hn({queryKey:A.user(),queryFn:()=>fn(r),retry:!1}),{data:p}=Hn({queryKey:[`check-runs`,t],queryFn:async()=>(await e(r)).filter(e=>e.check_id===t).map(e=>({run_id:e.run_id,run_at:e.run_at,status:ho(e.status,e.error),summary:e.error||void 0,triggered_by:e.triggered_by})),enabled:!!i,staleTime:3e4}),m=H(()=>go(a,p),[a,p]),h=e=>{c(e)},g=async(e,t)=>{await u({eventId:e,content:t})},_=async e=>{await d(e)};return o?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(pr,{size:20})}):s?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(Z,{sx:{fontSize:`0.875rem`,color:`error.main`},children:`Failed to load timeline`})}):q(X,{sx:{height:`100%`,alignItems:`stretch`,borderLeft:`1px solid`,borderColor:n?`grey.700`:`grey.200`},spacing:0,children:[K(J,{sx:{px:3,py:2,borderBottom:`1px solid`,borderColor:n?`grey.700`:`grey.200`},children:K(Z,{variant:`subtitle2`,sx:{fontWeight:500},children:`Activity`})}),K(J,{sx:{flex:1,overflowY:`auto`,px:3,py:2},children:m.length===0?K(Z,{sx:{fontSize:`0.875rem`,color:`grey.500`},children:`No activity yet`}):K(X,{sx:{alignItems:`stretch`},spacing:0,children:m.map((e,t)=>q(J,{children:[e.kind===`event`?K(mo,{event:e.event,currentUserId:f?.id,onEdit:g,onDelete:_}):K(co,{run:e.run,index:e.index}),t<m.length-1&&K(fr,{sx:{borderColor:n?`grey.700`:`grey.100`}})]},e.kind===`event`?e.event.id:e.run.run_id))})}),K(J,{sx:{px:3,py:3,borderTop:`1px solid`,borderColor:n?`grey.700`:`grey.200`,bgcolor:n?`grey.900`:`grey.50`},children:K(rt,{onSubmit:h,isSubmitting:l})})]})}function vo({color:e}){return K(J,{component:`span`,sx:{display:`inline-block`,width:`10px`,height:`10px`,bgcolor:e,mr:1,borderRadius:`4px`}})}const yo=({defaultPrimaryKeys:e,onPrimaryKeysChange:t,...n})=>{let{isActionAvailable:r}=F(),i=H(()=>[],[]);return K(J,{sx:{display:`flex`},...n,children:q(X,{spacing:0,sx:{m:`0 0.5rem`},children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[K(Z,{component:`label`,sx:{fontSize:`0.625rem`,color:`text.secondary`},children:`Diff with Primary Key(s) (suggested)`}),K($,{title:`Provide a primary key to perform query diff in data warehouse and only return changed rows.`,placement:`bottom-end`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`,cursor:`help`},children:K(Or,{fontSize:`0.75rem`})})})]}),K(Mt,{className:`no-track-pii-safe`,unitName:`key`,defaultValues:e,suggestionList:i,onValuesChange:t,size:`2xs`,width:`240px`,placeholder:`Select or type to add keys`,disabled:!r(`query_diff_with_primary_key`)})]})})};function bo({supportCalendarUrl:e=`https://cal.com/team/recce/chat`}){let{data:t}=P();return K(`div`,{className:`flex flex-1 h-full min-h-0 m-2 p-4 bg-blue-50 rounded-lg shadow-md justify-center`,children:q(`div`,{className:`w-4/5 flex flex-col overflow-y-auto gap-6 px-8 pb-8`,children:[q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{sx:{p:1,bgcolor:`background.paper`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:2},children:K(J,{component:Zi,sx:{fontSize:28,color:`iochmara.500`}})}),K(Z,{variant:`h5`,sx:{mt:2},children:`Wait, there's more!`}),q(Z,{sx:{fontSize:`1rem`,textAlign:`center`},children:[`Query functions disabled without a`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`data warehouse connection`})]})]}),K(X,{sx:{width:`50%`,mt:3,mx:`auto`},children:K(Y,{color:`iochmara`,variant:`contained`,size:`large`,onClick:()=>{window.open(ln(t,e),`_blank`)},children:`Connect to Data Warehouse`})})]})})}const xo=()=>{let{isCustomQueries:e,setCustomQueries:t,sqlQuery:n,setBaseSqlQuery:r}=mt();return q(J,{children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`,fontSize:`0.75rem`},children:[K(Z,{variant:`body2`,sx:{fontSize:`0.75rem`},children:`Custom Queries`}),K($,{title:`Custom queries allow you to use two SQL queries to compare results between current and base environments.`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`},children:K(kr,{fontSize:`1rem`})})})]}),K(Ki,{size:`small`,checked:e,onChange:()=>{!e&&r&&r(n),t(!e)},color:`primary`})]})},So=()=>{let{sqlQuery:e,baseSqlQuery:t,setSqlQuery:n,setBaseSqlQuery:r,primaryKeys:i,setPrimaryKeys:a,isCustomQueries:o}=mt(),{lineageGraph:c,envInfo:l}=F(),{featureToggles:u,singleEnv:d}=ie(),f=e;l?.adapterType===`sqlmesh`&&e===`select * from {{ ref("mymodel") }}`&&(f=`select * from db.mymodel`),u.mode===`read only`&&(f=`--- Would like to do query here? Book a demo with us at ${hn}\n${f}`);let{showRunId:p}=ge(),{apiClient:h}=I(),{mutate:g,isPending:_}=Vn({mutationFn:async e=>{function n(e){switch(e){case`query`:return O;case`query_base`:return s;case`query_diff`:return m;default:throw Error(`Unknown query type: ${e}`)}}let r=e===`query_base`?t??``:f,a=n(e),c={sql_template:r},l={nowait:!0};e===`query_diff`&&(c.primary_keys=i,o&&(c.base_sql_template=t));let{run_id:u}=await a(c,l,h);return p(u),await k(u,void 0,h)}}),v=H(()=>{let e={};if(!c)return`N/A`;for(let t in c.nodes){let n=c.nodes[t].data.schema;n&&(e[n]=(e[n]||0)+1)}return Object.keys(e).reduce((t,n)=>e[n]>(e[t]||0)?n:t,`N/A`)},[c]);return d||u.mode===`metadata only`?q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`},children:[K(Ec,{}),K(J,{sx:{flexGrow:1}}),d?K($,{title:`Please configure the base environment before running the diff`,placement:`left`,children:K(`span`,{children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})}):K(Il,{display:u.mode===`metadata only`,children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})]}),K(Pe,{value:f,onChange:n,onRun:()=>{g(`query`)},labels:[`base (production)`,`current (${v})`],SetupGuide:u.mode===`metadata only`?K(bo,{}):K(xc,{})})]}):q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`flex-end`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`,flex:`0 0 54px`},children:[K(Ec,{}),K(xo,{}),K(J,{sx:{flexGrow:1}}),K(yo,{defaultPrimaryKeys:i,onPrimaryKeysChange:a}),K(Y,{variant:`contained`,onClick:()=>{g(`query_diff`)},disabled:_||u.disableDatabaseQuery,size:`small`,children:`Run Diff`})]}),K(J,{sx:{width:`100%`,flex:1,overflowY:`auto`},children:o?K(Pe,{value:f,baseValue:t,onChange:n,onChangeBase:r,onRun:()=>{g(`query`)},onRunBase:()=>{g(`query_base`)},onRunDiff:()=>{g(`query_diff`)}}):K(Qe,{value:f,onChange:n,onRun:()=>{g(`query`)},onRunDiff:()=>{g(`query_diff`)}})})]})};function Co({rowCount:e,isDark:t}){let n=e.base,r=e.curr,i=Te(t),a=on(n,r),o=e.base===null?`N/A`:`${e.base} Rows`,s=e.curr===null?`N/A`:`${e.curr} Rows`,c,l;n===null&&r===null?c=`Failed to load`:n===null?c=`Added · ${s}`:r===null?c=`Removed · ${o}`:a===`unchanged`?c=`=`:a===`increase`?(c=`↑ ${$t(n,r)} Rows`,l=i.current):(c=`↓ ${$t(n,r)} Rows`,l=i.base);let u=z(`row_count_diff`).icon;return K(Vr,{size:`small`,icon:u?K(u,{}):void 0,label:c,"data-row-count-direction":a,sx:{height:20,fontSize:`0.7rem`,...l&&{bgcolor:l.background,border:`1px solid ${l.accent}`,color:l.foreground}}})}function wo({id:e,inverted:t}){let{lineageGraph:n,runsAggregated:r}=F(),{text:i,isDark:a}=zt(),o=r?.[e],s=n?.nodes[e];if(!o&&!s)return null;let c;s?.data.change?.columns&&(c=Object.keys(s.data.change.columns).length>0);let l;if(o?.row_count_diff){let e=o.row_count_diff.result;l=e.curr!==e.base}let u=t?i.inverted:Et(`modified`).color,d=t?i.secondary:a?`grey.700`:`grey.100`,f=z(`schema_diff`).icon;return q(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:[c!==void 0&&K($,{title:`Schema (${c?`changed`:`no change`})`,enterDelay:500,children:K(J,{sx:{height:16},children:f&&K(J,{component:f,sx:{color:c?u:d}})})}),K(J,{sx:{flexGrow:1}}),o?.row_count_diff&&l!==void 0&&K($,{title:`Row count (${l?`changed`:`=`})`,enterDelay:500,children:K(J,{children:K(Co,{rowCount:o.row_count_diff.result,isDark:a})})})]})}function To({nodeId:e,nodeName:t}){let{isDark:n}=zt(),{getNodeAction:r}=ce(),i=r(e);if(!i)return null;let{status:a,skipReason:o,run:s}=i;if(a===`pending`)return K(ro,{status:`pending`});if(a===`skipped`)return K(ro,{status:`skipped`,skipReason:o});if(!s)return K(ro,{status:`pending`});let{error:c,run_id:l,progress:u}=s;if(a===`running`)return K(ro,{status:`running`,progress:{percentage:u?.percentage}});if(c)return K(ro,{status:`error`,errorMessage:c});if(s.type===`value_diff`&&s.result){let e=s.result,t=0,n=e.data.data.length;for(let n of e.data.data)n[2]<1&&t++;return K(ro,{status:`success`,valueDiffResult:{mismatchedColumns:t,totalColumns:n}})}if(y(s)&&s.result){let e=s.result[t];if(e)return K(Co,{rowCount:e,isDark:n})}if(s.type===`row_count`&&s.result){let e=s.result[t];if(e?.curr!==void 0&&e.curr!==null)return K(Vr,{size:`small`,label:`${e.curr.toLocaleString()} Rows`,sx:{height:20,fontSize:`0.7rem`}})}return K(ro,{status:`success`,runId:l})}function Eo(e){let{data:t}=e,{id:n,resourceType:r,changeStatus:i,name:a}=t,o=ri(e=>e.transform[2]>.3),{isDark:s}=zt(),c=ce(),{interactive:l,selectNode:u,selectMode:d,focusedNode:f,getNodeAction:p,getNodeColumnSet:m,isNodeHighlighted:h,isNodeSelected:g,isNodeShowingChangeAnalysis:_,showContextMenu:v,viewOptions:y,cll:b,impactedNodeIds:x,newCllExperience:S}=c,C=S?x.has(n):!1,{isWholeModelChanged:w,isWholeModelImpacted:T}=pt(n,c),E=gt(b?.current.nodes[n]?.change_category,S?void 0:t.change?.category),D=h(n),O=g(n),k=y.column_level_lineage?.node_id===n&&y.column_level_lineage.column===void 0,ee=f?.id===n||k,te=_(n),ne=m(t.id),A=d===`action_result`?p(t.id):void 0,j=i,M=d,N=d===`action_result`&&A?K(To,{nodeId:n,nodeName:a}):void 0,re=d!==`action_result`&&t.resourceType===`model`?K(wo,{id:t.id,inverted:d===`selecting`&&O}):void 0;return K(Bt,{id:n,data:{label:a,changeStatus:j,resourceType:r,materialized:t.materialized},newCllExperience:S,isImpacted:C,isWholeModelChanged:w,isWholeModelImpacted:T,interactive:l,selectMode:M,isNodeSelected:O,isFocused:ee,isHighlighted:D,showContent:o,actionTag:N,showChangeAnalysis:te||!S&&E!==void 0,changeCategory:E,runsAggregatedTag:re,hasParents:Object.keys(t.parents).length>0,hasChildren:Object.keys(t.children).length>0,columnCount:ne.size,columnHeight:24,isDark:s,onSelect:e=>{u(e)},onContextMenu:(t,n)=>{v(t,e)}})}const Do=qn(Eo);Do.displayName=`GraphNode`;const Oo={lineageGraphNode:Do,lineageGraphColumnNode:Ka},ko={lineageGraphEdge:Ya},Ao=[],jo=(e={})=>t=>{let{impactedNodeIds:n,newCllExperience:r}=e;return Xe({changeStatus:t.data.changeStatus,isImpacted:r?n?.has(t.id):!1,newCllExperience:r}).color},Mo={ROW_COUNT:`row_count`,ROW_COUNT_DIFF:`row_count_diff`,PROFILE:`profile`,PROFILE_DIFF:`profile_diff`,VALUE_DIFF:`value_diff`,HISTOGRAM_DIFF:`histogram_diff`,TOP_K_DIFF:`top_k_diff`},No={LINEAGE_VIEW_CONTEXT_MENU:`lineage_view_context_menu`},Po={SELECT_PARENT_NODES:`select_parent_nodes`,SELECT_CHILD_NODES:`select_child_nodes`,SELECT_ALL_UPSTREAM:`select_all_upstream`,SELECT_ALL_DOWNSTREAM:`select_all_downstream`},Fo=({menuItems:e,open:t,onClose:n,x:r,y:i,featureToggles:a,DisabledItemWrapper:o})=>{let s=o??(({children:e})=>K(G,{children:e})),c=a?.mode===`metadata only`;return K(li,{open:t,onClose:n,anchorReference:`anchorPosition`,anchorPosition:{top:i,left:r},slotProps:{paper:{sx:{fontSize:`0.85rem`,width:`250px`}}},children:e.length===0?K(ui,{disabled:!0,children:`No action available`},`no action`):e.map(({isSeparator:e,label:t,isDisabled:r,action:i,itemIcon:a})=>{if(e)return K(fr,{},t);let l=q(ui,{disabled:r,onClick:()=>{i&&i(),n()},children:[a,` `,t]},t);return r&&o?K(s,{display:c,children:l},t):l})})},Io=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},viewOptions:o={},featureToggles:s={},serverFlags:c={},noCatalogCurrent:l=!1,isActionAvailable:u=()=>!0})=>{let d=[],{runAction:f,onNavigate:p,onTrack:m,findByRunType:h,setSqlQuery:g,setPrimaryKeys:_,getPrimaryKey:v,DisabledItemWrapper:y}=a,{selectMode:b,cll:x,showColumnLevelLineage:S,setChangeAnalysisMode:C,selectParentNodes:w,selectChildNodes:T,getNodeColumnSet:E}=o,D=c.single_env_onboarding??!1,O=s.disableDatabaseQuery??!1;if(!i?.data)return K(G,{});let k=i.data,ee=k.resourceType,te=E?Array.from(E(i.id)):[],ne={source:`lineage_model_node`},A=k.changeStatus,j=v?.(k.name);if(A===`modified`&&d.push({label:`Show Impact Radius`,itemIcon:K(vr,{}),isDisabled:l||!u(`change_analysis`),action:()=>{Fa({nodeId:i.id,setChangeAnalysisMode:C,showColumnLevelLineage:S})}}),!b&&ee&&[`model`,`seed`,`snapshot`].includes(ee)){d.length>0&&d.push({label:`select group one`,isSeparator:!0});let e=h?.(D?`query`:`query_diff`),t=k.change?.columns?Object.keys(k.change.columns):[],n=en(t,t),r=`select * from {{ ref("${k.name}") }}`;if(n.length&&(r=`select \n ${n.join(`
|
|
3
|
+
`)}\nfrom {{ ref("${k.name}") }}`),e&&d.push({label:`Query`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{g?.(r),u(`query_diff_with_primary_key`)&&_?.(j===void 0?void 0:[j]),p?.(`/query`)}}),te.length>0&&e)if(x!==void 0){let t=new Set;j&&t.add(j),te.forEach(e=>{t.add(e)}),d.push({label:`Query Related Columns`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=`select \n ${Array.from(t).join(`,
|
|
4
|
+
`)}\nfrom {{ ref("${k.name}") }}`;g?.(e),u(`query_diff_with_primary_key`)&&_?.(j===void 0?void 0:[j]),p?.(`/query`)}})}else{let t=Object.entries(k.change?.columns??{}).filter(([,e])=>e===`modified`).map(([e])=>e);if(t.length>0){let n=new Set;j&&n.add(j),t.forEach(e=>{n.add(e)}),d.push({label:`Query Modified Columns`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=`select \n ${Array.from(n).join(`,
|
|
5
|
+
`)}\nfrom {{ ref("${k.name}") }}`;g?.(e),u(`query_diff_with_primary_key`)&&_?.(j===void 0?void 0:[j]),p?.(`/query`)}})}}let a=D?`row_count`:`row_count_diff`,o=h?.(a);o&&d.push({label:o.title,itemIcon:K(J,{component:o.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{m?.(`explore_action`,{action:D?Mo.ROW_COUNT:Mo.ROW_COUNT_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(a,{node_names:[k.name]},{showForm:!1,trackProps:ne})}});let s=D?`profile`:`profile_diff`,c=h?.(s);if(c&&d.push({label:c.title,itemIcon:K(J,{component:c.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=E?Array.from(E(i.id)):[];m?.(`explore_action`,{action:D?Mo.PROFILE:Mo.PROFILE_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(s,{model:k.name,columns:e},{showForm:!0,trackProps:ne})}}),!D){let e=h?.(`value_diff`);e&&d.push({label:e.title,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=E?Array.from(E(i.id)):[];m?.(`explore_action`,{action:Mo.VALUE_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(`value_diff`,{model:k.name,columns:e},{showForm:!0,trackProps:ne})}})}}return D||(d.length>0&&d.push({label:`select group two`,isSeparator:!0}),d.push({label:`Select Parent Nodes`,itemIcon:K(ta,{}),action:()=>{m?.(`lineage_selection`,{action:Po.SELECT_PARENT_NODES}),w?.(i.id,1)}}),d.push({label:`Select Child Nodes`,itemIcon:K(na,{}),action:()=>{m?.(`lineage_selection`,{action:Po.SELECT_CHILD_NODES}),T?.(i.id,1)}}),d.push({label:`Select All Upstream Nodes`,itemIcon:K(ta,{}),action:()=>{m?.(`lineage_selection`,{action:Po.SELECT_ALL_UPSTREAM}),w?.(i.id)}}),d.push({label:`Select All Downstream Nodes`,itemIcon:K(na,{}),action:()=>{m?.(`lineage_selection`,{action:Po.SELECT_ALL_DOWNSTREAM}),T?.(i.id)}})),K(Fo,{x:n,y:r,menuItems:d,open:e,onClose:t,featureToggles:s,DisabledItemWrapper:y})},Lo=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},featureToggles:o={},serverFlags:s={},isActionAvailable:c=()=>!0})=>{let l=[],{runAction:u,onTrack:d,findByRunType:f,supportsHistogramDiff:p,DisabledItemWrapper:m}=a,h=s.single_env_onboarding??!1,g=o.disableDatabaseQuery??!1;if(i?.data===void 0)return K(G,{});let _=i.data,v=_.node,y=_.column,b=_.type,x={source:`lineage_column_node`},S=()=>{d?.(`explore_action`,{action:Mo.PROFILE_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`profile_diff`,{model:v.name,columns:[y]},{showForm:!1,trackProps:x})},C=()=>{d?.(`explore_action`,{action:Mo.HISTOGRAM_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`histogram_diff`,{model:v.name,column_name:y,column_type:b},{showForm:!1,trackProps:x})},w=()=>{d?.(`explore_action`,{action:Mo.TOP_K_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`top_k_diff`,{model:v.name,column_name:y,k:50},{showForm:!1,trackProps:x})},T=()=>{d?.(`explore_action`,{action:Mo.VALUE_DIFF,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`value_diff`,{model:v.name,columns:[y]},{showForm:!0,trackProps:x})},E=_.changeStatus===`added`||_.changeStatus===`removed`,D=f?.(h?`profile`:`profile_diff`);if(D&&l.push({label:D.title,itemIcon:K(J,{component:D.icon,sx:{display:`inline-flex`}}),action:S,isDisabled:E||!c(`profile_diff`)||g}),!h){let e=f?.(`histogram_diff`);if(e){let t=p?.(b)??!0;l.push({label:e.title,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),action:C,isDisabled:E||!t||g})}let t=f?.(`top_k_diff`);t&&l.push({label:t.title,itemIcon:K(J,{component:t.icon,sx:{display:`inline-flex`}}),action:w,isDisabled:E||g});let n=f?.(`value_diff`);n&&l.push({label:n.title,itemIcon:K(J,{component:n.icon,sx:{display:`inline-flex`}}),action:T,isDisabled:E||g})}return K(Fo,{x:n,y:r,menuItems:l,open:e,onClose:t,featureToggles:o,DisabledItemWrapper:m})},Ro=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},viewOptions:o={},featureToggles:s={},serverFlags:c={},noCatalogCurrent:l=!1,isActionAvailable:u=()=>!0})=>s.disableViewActionDropdown?K(Fo,{menuItems:[],open:e,onClose:t,x:n,y:r,featureToggles:s,DisabledItemWrapper:a.DisabledItemWrapper}):i&&ve(i)?K(Io,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,viewOptions:o,featureToggles:s,serverFlags:c,noCatalogCurrent:l,isActionAvailable:u}):i&&be(i)?K(Lo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,featureToggles:s,serverFlags:c,isActionAvailable:u}):null,zo=()=>{let[e,t]=W(!1),n=()=>t(!0),r=()=>t(!1),[i,a]=W({x:0,y:0}),[o,s]=W();return{props:{x:i.x,y:i.y,node:o,isOpen:e,onClose:r},showContextMenu:(e,t,r)=>{a({x:e,y:t}),s(r),n()},closeContextMenu:()=>{a({x:0,y:0}),s(void 0),r()}}};function Bo({anchorEl:e}){let[t,n]=W(!1),r=U(!1);V(()=>{if(!r.current){r.current=!0;try{localStorage.getItem(g.snapshotBaseIntroSeen)||n(!0)}catch{}}},[]);let i=B(()=>{try{localStorage.setItem(g.snapshotBaseIntroSeen,`1`)}catch{}n(!1)},[]);return q(Oi,{open:t&&e!==null,anchorEl:e,onClose:i,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableAutoFocus:!0,slotProps:{paper:{sx:{bgcolor:`grey.800`,color:`white`,p:2,maxWidth:360}}},children:[K(Z,{variant:`body2`,sx:{mb:1.5},children:`New: Recce now snapshots your base data when each PR is created. We'll let you know when production has changed since then so your comparisons stay accurate.`}),K(Y,{size:`small`,variant:`contained`,onClick:i,sx:{bgcolor:`grey.600`,"&:hover":{bgcolor:`grey.500`}},children:`Got it`})]})}const Vo=()=>{let{isDark:e}=zt(),{successToast:t,failToast:n}=tn();return vt({imageType:`png`,shadowEffect:!0,backgroundColor:e?De.neutral[900]:De.neutral[50],ignoreElements:e=>{try{return e.classList.contains(Vt)}catch{return e.className?e.className.includes(Vt):!1}},onSuccess:()=>{t(`Copied the Lineage View as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}})},Ho=()=>{let e=Ai(),{basePath:t}=ae();return B(n=>{n.check_id&&e.push(`${t}/checks/?id=${n.check_id}`)},[e.push,t])},Uo=new Set;function Wo(){let[e,t]=W(()=>new Set),[n,r]=W(()=>new Set),[i,a]=W(()=>Uo),[o,s]=W(()=>Uo);return{impactedNodeIds:e,impactedColumnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:o,publish:B(e=>{t(e.nodeIds),r(e.columnIds),a(e.wholeModelImpactedNodeIds),s(e.wholeModelChangedNodeIds)},[])}}const Go=(e,t)=>{let n=U({width:0,height:0});V(()=>{let r=e.current,i=new ResizeObserver(e=>{for(let r of e){let e=r.contentRect.width,i=r.contentRect.height;(Math.abs(i-n.current.height)>10||Math.abs(e-n.current.width)>10)&&n.current.height>0&&i>0&&n.current.width>0&&e>0&&t(),n.current={width:e,height:i}}});return r&&i.observe(r),()=>{r&&i.unobserve(r)}},[t,e])},Ko=()=>B((e,t,n,r,i)=>{let a=e.filter(ve),o=a.reduce((e,t)=>{let n=`nodes_${t.data.changeStatus??`unchanged`}`;return e[n]=(e[n]??0)+1,e},{}),s={node_count:a.length,view_mode:t,impact_radius_enabled:n,right_sidebar_open:i,...o};r&&(s.cll_column_active=!0),kn(s)},[]),qo={lineageNode:Bt,lineageGraphColumnNode:Jt},Jo={lineageEdge:Wt};function Yo({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,onNodeContextMenu:i,showMiniMap:a=!0,showControls:o=!0,showBackground:s=!0,height:c=600,interactive:l=!0,minZoom:u,maxZoom:d,fitViewOptions:f}){let[p,m,h]=ti(e),[g,_,v]=ei(t),y=B((e,t)=>{n?.(t.id)},[n]),b=B(()=>{n?.(null)},[n]),x=B((e,t)=>{r?.(t.id)},[r]),S=U(i);V(()=>{S.current=i},[i]);let C=i!=null,w=H(()=>{if(!C)return qo;let e=e=>K(Bt,{...e,onContextMenu:(e,t)=>S.current?.(e,t)});return e.displayName=`LineageNodeWithContextMenu`,{...qo,lineageNode:e}},[C]);return K(J,{sx:{width:`100%`,height:c},children:q(Xr,{nodes:p,edges:g,onNodesChange:l?h:void 0,onEdgesChange:l?v:void 0,onNodeClick:y,onNodeDoubleClick:x,onPaneClick:b,nodeTypes:w,edgeTypes:Jo,fitView:!0,fitViewOptions:f,minZoom:u,maxZoom:d,nodesDraggable:l,nodesConnectable:!1,elementsSelectable:l,children:[s&&K(Hr,{}),o&&K(Kr,{}),a&&K(qr,{nodeColor:e=>{let t=e.data;return Xe({changeStatus:t.changeStatus,isImpacted:t.isImpacted,newCllExperience:t.newCllExperience}).color}})]})})}const Xo={row_count:gn.ROW_COUNT,row_count_diff:gn.ROW_COUNT_DIFF,value_diff:gn.VALUE_DIFF},Zo=e=>{let t=Xo[e.action];t&&Tn({action:t,source:_n.LINEAGE_VIEW_TOP_BAR,node_count:e.node_count})},Qo=(e,t)=>Me(e,{...t,onTrackAction:Zo,trackingSource:_n.LINEAGE_VIEW_TOP_BAR});function $o({notification:e,type:t}){let n=E.lineageNotificationDismissed,[r,i]=W(()=>sessionStorage.getItem(n)!==`true`);if(e===null||!r)return null;let a={info:`iochmara.light`,success:`success.light`,warning:`warning.light`,error:`error.light`}[t];return q(J,{sx:{width:`100%`,display:`flex`,flexDirection:`row`,p:`5px 10px`,gap:`5px`,alignItems:`flex-start`,borderRadius:1,boxShadow:4,border:`1px solid`,borderColor:`neutral.light`,bgcolor:a},children:[e,K(J,{sx:{flex:1}}),K(Q,{size:`small`,onClick:()=>{sessionStorage.setItem(n,`true`),i(!1)},children:K(lr,{})})]})}function es(e,t){let n={...e.nodes};for(let[e,r]of Object.entries(t.current.nodes)){if(!r.change_status)continue;let t=n[e];if(!t)continue;let i;if(r.columns){let e={},t=!1;for(let n of Object.values(r.columns))n.change_status&&(e[n.name]=n.change_status,t=!0);t&&(i=e)}n[e]={...t,change_status:r.change_status,change:r.change_category?{category:r.change_category,columns:i}:t.change}}return{...e,nodes:n}}function ts(e,t){return!!e.change_analysis&&!!t}function ns(e,t){let n=e.getQueryData(A.lineage()),r=e.setQueryData(A.lineage(),e=>e&&{...e,lineage:es(e.lineage,t)});return n!==void 0&&r!==n}const rs=Object.keys({node_id:!0,column:!0,change_analysis:!0,no_cll:!0,no_upstream:!0,no_downstream:!0});function is(e,t){return rs.every(n=>e[n]===t[n])}function as(e){let t={};for(let n of rs)t[n]=e[n];return t}function os(){let e,t=0;function n(e,n){return{cll:n,isCurrent:()=>t===e}}function r(){return i(),n(t,void 0)}function i(){++t,e=void 0}async function a({cllInput:r,changeAnalysis:i,actionGetCll:a,queryClient:o}){let s=La(r,i),c=++t;e=void 0;let l;try{l=await a.mutateAsync(s)}catch(e){if(t!==c)return n(c,void 0);throw e}let u=n(c,l);if(!u.isCurrent())return u;if(ts(s,l)){let t={apiInput:as(s),resolution:u};e=t,!ns(o,l)&&e===t&&(e=void 0)}return u}return{invalidate:i,async resolveCllForLayout(t){let{cllInput:n,changeAnalysis:i}=t;if(!n)return r();if(e&&is(e.apiInput,as(La(n,i)))){let{resolution:t}=e;return e=void 0,t}return await a({...t,cllInput:n})},async refreshCll(e){let{cllInput:t}=e;return t?await a({...e,cllInput:t}):r()}}}function ss(e){let{columns:t,parent_map:n}=e.current,r=new Map;function i(e){let a=r.get(e);if(a===`pending`)return!1;if(a!==void 0)return a;if(r.set(e,`pending`),t[e]?.change_status)return r.set(e,!0),!0;let o=n[e]??[];for(let t of o)if(i(t))return r.set(e,!0),!0;return r.set(e,!1),!1}let a=new Set;for(let e of Object.keys(t))i(e)&&a.add(e);return a}function cs(e,t,n,r){if(n)return!0;if(!t)return!1;if(t.current.nodes[e]?.impacted)return!0;let i=r,a=`${e}_`;for(let e of i)if(e.startsWith(a))return!0;return!1}function ls(e,t){let n=[];for(let[e,r]of Object.entries(t.current.nodes))r.change_category===`breaking`&&n.push(e);if(n.length===0)return{wholeModelImpactedNodeIds:new Set,wholeModelChangedNodeIds:new Set};let r=new Set(n),i=new Set(n),a=new Set(n),o=[...n];for(;o.length>0;){let t=[];for(let n of o){let i=e.nodes[n];if(i)for(let e of Object.keys(i.data.children))a.has(e)||(a.add(e),r.add(e),t.push(e))}o=t}return{wholeModelImpactedNodeIds:r,wholeModelChangedNodeIds:i}}const us=e=>{let{runAction:t}=ge(),{setSqlQuery:n,setPrimaryKeys:r}=mt(),i=Ai(),{primaryKey:a}=Ct(e),{basePath:o}=ae();return{runAction:(e,n,r)=>{t(e,n,r)},onNavigate:e=>{i.push(`${o}${e}`)},onTrack:(e,t)=>{e===`explore_action`?Tn({action:t.action,source:No.LINEAGE_VIEW_CONTEXT_MENU,node_count:t.node_count}):e===`lineage_selection`&&On({action:t.action})},supportsHistogramDiff:Ht,findByRunType:e=>{let t=z(e);return t?{title:t.title,icon:t.icon}:void 0},setSqlQuery:n,setPrimaryKeys:r,getPrimaryKey:()=>a,DisabledItemWrapper:Il}},ds=({isOpen:e,onClose:t,x:n,y:r,node:i})=>{let{selectParentNodes:a,selectChildNodes:o,getNodeColumnSet:s,selectMode:c,cll:l,showColumnLevelLineage:u,setChangeAnalysisMode:d}=ce(),{featureToggles:f}=ie(),{isActionAvailable:p,lineageGraph:m}=F(),{data:h}=pe(),g=!m?.catalogMetadata.current,_=i?.type===`lineageGraphNode`?i.data?.name:i?.type===`lineageGraphColumnNode`?i.data?.node?.name:void 0,v=us(_);return K(Ro,{x:n,y:r,node:i,isOpen:e,onClose:t,deps:v,viewOptions:{selectMode:c,cll:l,showColumnLevelLineage:u,setChangeAnalysisMode:d,selectParentNodes:a,selectChildNodes:o,getNodeColumnSet:s},featureToggles:{disableDatabaseQuery:f.disableDatabaseQuery,disableViewActionDropdown:f.disableViewActionDropdown,mode:f.mode??void 0},serverFlags:{single_env_onboarding:h?.single_env_onboarding},noCatalogCurrent:g,isActionAvailable:p})},fs=zo;function ps(e,t){let n=[],r=[],{selectedNodes:i,cll:a,existingPositions:o,newCllExperience:s,columnAncestry:c}=t??{},l={};function u(e){return e===`removed`?0:e===`added`?2:1}function d(e,t){let n=u(e.data?.changeStatus),r=u(t.data?.changeStatus);return n<r?-1:+(n>r)}let f=i===void 0?void 0:new Set(i),p=Object.values(e.nodes).sort(d);for(let e of p){if(f&&!f.has(e.id))continue;let t=new Set,i=0;if(a&&!s){let o=a.current,s=o?.parent_map[e.id]??new Set;for(let t of s){let n=t,i=e.id;r.push({id:`m2c_${n}_${i}`,source:n,target:i,style:{zIndex:9999}})}let c=Object.entries(o?.columns??{}).filter(([t])=>t.startsWith(`${e.id}_`)).map(([t])=>t.slice(e.id.length+1));for(let o of c){let s=`${e.id}_${o}`,c=a.current,l=c?.columns[s],u=c?.parent_map[s]??new Set;if(l!=null){n.push({id:s,position:{x:10,y:70+i*24},parentId:e.id,extent:`parent`,draggable:!1,className:`no-track-pii-safe`,data:{node:e.data,column:l.name,type:l.type,transformationType:l.transformation_type,changeStatus:Se(l.change_status)},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:Yr.Left,sourcePosition:Yr.Right});for(let e of u){let t=e,n=s;r.push({id:`${t}_${n}`,source:t,target:n,style:{zIndex:9999}})}i++,t.add(l.name)}}}l[e.id]=t;let c=60;i>0&&(c+=20+i*24);let u=o?.get(e.id);n.unshift({id:e.id,position:u??{x:0,y:0},width:300,height:c,className:`no-track-pii-safe`,data:{...e.data},type:`lineageGraphNode`,targetPosition:Yr.Left,sourcePosition:Yr.Right,style:{width:300,height:c}})}let m=Object.values(e.edges).sort(d);for(let e of m)f&&(!f.has(e.source)||!f.has(e.target))||r.push({id:e.id,type:`lineageGraphEdge`,source:e.source,target:e.target,data:{...e.data}});return s&&c&&a&&ms(n,r,c,a,f),n.some(e=>e.type===`lineageGraphNode`&&!o?.has(e.id))&&hs(n,r),[n,r,l]}function ms(e,t,n,r,i){let a=new Set,o=new Map;for(let[t,s]of n)if(!(i&&!i.has(t))){for(let n=0;n<s.length;n++){let i=s[n],c=`${t}_${i.column}`;a.add(c),o.set(c,{modelId:t,isImpacted:i.isImpacted});let l=r.current.columns[c];e.push({id:c,position:{x:10,y:64+n*24},parentId:t,draggable:!1,className:`no-track-pii-safe`,data:{node:{id:t},column:i.column,type:l?.type,transformationType:i.transformationType,changeStatus:i.changeStatus,isHighlighted:!0,isFocused:!1,isImpacted:i.isImpacted},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:Yr.Left,sourcePosition:Yr.Right})}if(s.length>0){let n=e.find(e=>e.id===t&&e.type===`lineageGraphNode`);n&&(n.height=80+s.length*24)}}for(let e of a){let n=r.current.parent_map[e]??[];for(let r of n)if(a.has(r)){let n=o.get(r)?.isImpacted??!1;t.push({id:`ancestry_${r}_${e}`,source:r,target:e,style:{zIndex:9999,strokeWidth:2,stroke:n?Fe.impacted:Fe.unchanged}})}}}const hs=(e,t,n=`LR`)=>{le(ra,e,t,n)},gs={};function _s(e){return e?.type===`profile_distribution`?e.result:void 0}function vs(e){let t=0;for(let n of Object.values(e))n.kind===null&&(t+=1);return t}const ys=e=>typeof performance<`u`?Math.round(performance.now()-e):0,bs=e=>M(e)&&e.status>=400&&e.status<500;function xs(e){let{model:t,columns:n,enabled:r=!0}=e,i=e.nodeId??t,{apiClient:a}=I(),{data:o}=pe(),s=(o?.inline_profile??!1)&&r&&!!t,c=n?JSON.stringify(n):`*`,{data:l,error:u,isFetching:d}=Hn({queryKey:[`profile_distribution`,i,c],queryFn:async()=>{let e=typeof performance<`u`?performance.now():0;try{let r=await h({model:t,columns:n},{trackProps:{source:_n.SCHEMA_VIEW}},a);return Ss(r,ys(e)),r}catch(t){throw Nn({status:`error`,total_wall_ms:ys(e),column_count:0,error_count:0}),bs(t)||ea(t,{tags:{feature:`inline_profile_distribution`}}),t}},enabled:s,staleTime:1/0,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1,placeholderData:(e,t)=>t&&t.queryKey[1]===i?e:void 0}),f=l?.error?Error(l.error):void 0;return H(()=>{if(!s)return{status:`disabled`,isLoading:!1,columns:gs,baseTotal:0,currentTotal:0};let e=u??f??void 0;if(e)return{status:`error`,isLoading:!1,columns:gs,error:e,baseTotal:0,currentTotal:0};let t=_s(l);return t?t.status===`unsupported`?{status:`unsupported`,isLoading:!1,columns:gs,unsupportedReason:t.reason,baseTotal:0,currentTotal:0}:{status:`ok`,isLoading:d,columns:t.columns,baseTotal:t.base_total,currentTotal:t.current_total}:{status:`loading`,isLoading:!0,columns:gs,baseTotal:0,currentTotal:0}},[s,u,f,l,d])}function Ss(e,t){if(e.error){Nn({status:`error`,total_wall_ms:t,column_count:0,error_count:0});return}let n=_s(e);if(!n||n.status===`unsupported`){Nn({status:`unsupported`,total_wall_ms:t,column_count:0,error_count:0});return}Nn({status:`ok`,strategy:n.strategy,total_wall_ms:t,column_count:Object.keys(n.columns).length,error_count:vs(n.columns),cache_hit:n.cache_hit})}function Cs({newCllExperience:e,columnChanges:t,impactedColumns:n,nodeId:r,nodeColumnNames:i,wholeModelChange:a,profileAllColumns:o}){if(!e)return{changedColumns:void 0,scopedColumns:void 0,profileEnabled:!1,profilingAll:!1};let s=new Set(Object.keys(t??{}));if(n&&r&&i)for(let e of i)un(r,e,n)&&s.add(e);let c=[...s],l=c.length>0,u=o||a||!l?void 0:c,d=l||a||o;return{changedColumns:c,scopedColumns:u,profileEnabled:d,profilingAll:u===void 0&&d}}function ws(){return q(J,{sx:{display:`flex`,gap:2,px:1,py:.5,fontSize:`0.75rem`,color:`text.secondary`},children:[q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-added`,children:`+`}),` `,`added`]}),q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-removed`,children:`-`}),` `,`removed`]}),q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`}),` `,`changed`]})]})}function Ts({current:e,showMenu:t=!0},n){let r=me(),[i,a]=W(null),[o,s]=W(new Map),{columns:c,rows:l}=H(()=>Oe({type:`schema_single`,columns:e?.columns},{node:e,cllRunningMap:o,showMenu:t}),[e,o,t]),{lineageGraph:u,isActionAvailable:d}=F(),f=d(`change_analysis`),p=!u?.catalogMetadata.current,m;p&&(m="catalog.json not found. Run `recce debug` to troubleshoot.");let h=e&&e.columns===void 0,g;h&&(g=`Node schema not found in catalog.json. Please regenerate your catalog.json to update.`);let _=async t=>{if(!f)return;yn({action:`view`,source:`schema_column`}),s(e=>new Map(e).set(t,!0));let n=e?.id;n&&await r?.showColumnLevelLineage({node_id:n,column:t}),s(e=>new Map(e).set(t,!1))},v=B(t=>`${e?.id}-${t.data.name}`,[e?.id]),y=r?.viewOptions.column_level_lineage,b=y?`${y.node_id}-${y.column}`:null;V(()=>{if(i&&(i.deselectAll(),b)){let e=i.getRowNode(b);e&&e.setSelected(!0)}},[i,b]);let x=B(e=>{a(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[m?K(si,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:m}):g?K(si,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:g}):K(G,{}),l.length>0&&K(Yt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`10pt`,borderWidth:1},columns:c,rows:l,renderers:{noRowsFallback:K(Gt,{})},ref:n,getRowId:v,getRowClass:e=>r!==void 0&&f?`row-normal row-selectable`:`row-normal`,onCellClicked:async e=>{if((e.event?.target)?.closest(`.row-context-menu`))return;let t=e.data;t&&await _(t.name)},onGridReady:x,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}function Es({base:e,current:t,showMenu:n=!0,columnChanges:r,onViewCode:i,headerAction:a},o){let s=me(),{data:c}=pe(),l=c?.new_cll_experience??!1,u=c?.inline_profile??!1,[d,f]=W(null),[p,m]=W(new Map),[h,g]=W(null),_=H(()=>{if(!l)return;let e=s?.impactedColumnIds;return e?.size?e:void 0},[l,s?.impactedColumnIds]),v=H(()=>{let n=t?.resource_type??e?.resource_type;return n&&[`model`,`seed`,`snapshot`,`source`].includes(n)?t??e:void 0},[t,e]),y=t?.id??e?.id,b=H(()=>{let n=new Set;for(let t of Object.keys(e?.columns??{}))n.add(t);for(let e of Object.keys(t?.columns??{}))n.add(e);return n},[e,t]),x=h!=null&&h===y,S=s?.wholeModelChangedNodeIds?.has(y??``)??!1,{scopedColumns:C,profileEnabled:w,profilingAll:T}=H(()=>Cs({newCllExperience:l,columnChanges:r,impactedColumns:_,nodeId:y,nodeColumnNames:b,wholeModelChange:S,profileAllColumns:x}),[l,r,_,y,b,S,x]),E=xs({model:v?.name,nodeId:y,columns:C,enabled:w}),D=H(()=>{if(E.status!==`disabled`&&E.status!==`unsupported`)return{payloads:E.columns,baseTotal:E.baseTotal,currentTotal:E.currentTotal,isLoading:E.isLoading,hasError:E.status===`error`,scopedColumns:C}},[E.status,E.columns,E.baseTotal,E.currentTotal,E.isLoading,C]),{columns:O,rows:k}=H(()=>Oe({type:`schema_diff`,base:e?.columns,current:t?.columns},{node:v,cllRunningMap:p,showMenu:n,columnChanges:r,onViewCode:i,impactedColumns:_,nodeId:y,distribution:D}),[e,t,v,y,p,n,r,i,_,D]),{lineageGraph:ee,isActionAvailable:te}=F(),ne=te(`change_analysis`),A=!ee?.catalogMetadata.base,j=!ee?.catalogMetadata.current,M;A&&j?M="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":A?M="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":j&&(M="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let N=e&&e.columns===void 0,re=t&&t.columns===void 0,P;N&&re?P=`Node schema not found in catalog.json on both environments. Please regenerate your catalog.json to update.`:re?P=`Node schema not found in catalog.json on current environment. Please regenerate your catalog.json to update.`:N&&(P=`Node schema not found in catalog.json on base environment. Please regenerate your catalog.json to update.`);let ie=async n=>{if(!ne)return;yn({action:`view`,source:`schema_column`}),m(e=>new Map(e).set(n,!0));let r=t?.id??e?.id;r&&await s?.showColumnLevelLineage({node_id:r,column:n}),m(e=>new Map(e).set(n,!1))},ae=B(n=>`${t?.id??e?.id}-${n.data.name}`,[t?.id,e?.id]),oe=s?.viewOptions.column_level_lineage,se=oe?`${oe.node_id}-${oe.column}`:null;V(()=>{if(d&&(d.deselectAll(),se)){let e=d.getRowNode(se);e&&e.setSelected(!0)}},[d,se]);let ce=B(e=>{f(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[M?K(si,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:M}):P?K(si,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:P}):K(G,{}),q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,gap:1,pr:1},children:[K(ws,{}),q(X,{direction:`row`,sx:{alignItems:`center`,gap:1},children:[l&&u&&v&&E.status!==`unsupported`&&!T&&K(Y,{size:`small`,variant:`text`,onClick:()=>{g(y??null)},sx:{textTransform:`none`,fontSize:`0.7rem`,py:.25,px:1,minWidth:0,whiteSpace:`nowrap`},children:`Profile all columns`}),a]})]}),E.status===`unsupported`&&K(J,{sx:{px:1,pb:.5},children:K(ht,{reason:E.unsupportedReason})}),k.length>0&&K(Yt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.8rem`,borderWidth:1},columns:O,rows:k,rowHeight:35,renderers:{noRowsFallback:K(Gt,{})},className:`rdg-light no-track-pii-safe${l?` cll-experience`:``}`,ref:o,getRowId:ae,getRowClass:e=>{let t=e.data;if(!t)return`row-normal`;let n=Tt(t,t.isImpacted);if(n===`removed`)return`row-removed`;let r;switch(n){case`added`:r=`row-added`;break;case`changed`:case`unknown`:r=`row-changed`;break;case`impacted`:r=`row-impacted`;break;default:r=`row-normal`}return s!==void 0&&ne&&(r+=` row-selectable`),r},onCellClicked:async e=>{if((e.event?.target)?.closest(`.row-context-menu`))return;let t=e.data;t&&(t.baseIndex===void 0||t.currentIndex!==void 0)&&await ie(t.name)},onGridReady:ce,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}const Ds=Kn(Es),Os=Kn(Ts);function ks(e){let t=e?.current.nodes;if(!t)return{impactingNodeIds:void 0,impactedNodeIds:void 0};let n=new Set,r=new Set;for(let[e,i]of Object.entries(t))i.impacted===!0?(r.add(e),n.add(e)):(i.change_category===`partial_breaking`||i.change_status===`removed`)&&n.add(e);return{impactingNodeIds:n,impactedNodeIds:r}}const As={light:`rgb(252 211 77 / 0.18)`,dark:`rgb(252 211 77 / 0.10)`};function js(e){return e?je.dark:je.light}function Ms(e){return e?.data.changeStatus??`unchanged`}function Ns(e,t){return e===`unchanged`&&t?`impacted`:e}function Ps(e){return e===`impacted`?Fe.impacted:Le[e]}function Fs(e,t){return t?.[e]?.data.name??e}function Is(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>Fs(e,n).toLowerCase().includes(r)):e}function Ls(e,t){return e?`Show all models`:t?`Show only impacting models`:`Show only impacted models`}function Rs({status:e,cllImpacted:t}){let n=Ns(e,t);return K(J,{component:`span`,"data-testid":`lineage-status-dot`,"data-status":n,sx:{width:`8px`,height:`8px`,borderRadius:`2px`,backgroundColor:Ps(n),flex:`0 0 auto`}})}function zs({name:e,status:t,direction:n,decorateAsImpacted:r,dotImpacted:i,onClick:a}){let{isDark:o}=zt(),s=n===`up`?`Impacts this model`:`Impacted by this model`;return q(J,{onClick:a,sx:{position:`relative`,display:`flex`,alignItems:`center`,gap:.75,pl:1.5,pr:1.25,py:.5,cursor:a?`pointer`:`default`,fontSize:`12px`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,lineHeight:1.3,color:`text.primary`,minWidth:0,backgroundColor:r?o?As.dark:As.light:void 0,"&:hover":a?{backgroundColor:`action.hover`}:void 0},children:[r&&K(J,{"aria-hidden":`true`,sx:{position:`absolute`,left:0,top:0,bottom:0,width:`3px`,backgroundColor:Fe.impacted}}),K(Rs,{status:t,cllImpacted:i}),K(J,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,flex:1},title:e,children:e}),r&&K($,{title:s,placement:`top`,arrow:!0,children:K(J,{component:`span`,"aria-label":s,"data-testid":`lineage-impact-mark`,sx:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`16px`,height:`16px`,color:js(o),flex:`0 0 auto`},children:K(Ni,{size:12})})})]})}function Bs({isDark:e,active:t}){return t?$e.dark:e?kt.dark:kt.light}function Vs({isDark:e,active:t}){return t?`#fff`:e?je.dark:je.light}const Hs={display:`inline-flex`,alignItems:`center`,gap:`4px`,ml:.75,px:`7px`,py:`1px`,borderRadius:`999px`,fontSize:`10px`,fontWeight:600,letterSpacing:`0.02em`};function Us({color:e}){return K(J,{component:`span`,"aria-hidden":`true`,sx:{width:`5px`,height:`5px`,borderRadius:`50%`,backgroundColor:e}})}function Ws({label:e,title:t,active:n,isDark:r,onClick:i}){let a={isDark:r,active:n};return K($,{title:t,placement:`top`,arrow:!0,children:q(J,{component:`button`,type:`button`,"data-testid":`lineage-impact-chip`,"aria-pressed":n,"aria-label":t,onClick:i,sx:{...Hs,backgroundColor:Bs(a),color:Vs(a),border:`none`,font:`inherit`,cursor:`pointer`,"&:hover":{filter:n?`brightness(0.95)`:`brightness(0.97)`}},children:[K(Us,{color:Vs(a)}),e]})})}function Gs({direction:e,directCount:t,impactCount:n,onlyImpact:r,onToggleOnlyImpact:i}){let a=e===`up`,o=a?Pi:Ni,{isDark:s,background:c}=zt(),l=n??0,u=l>0,d=a?`${l} impacting`:`${l} impacted`;return q(X,{direction:`row`,spacing:.75,sx:{alignItems:`center`,px:1.5,py:.875,backgroundColor:c.subtle,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`,fontSize:`11px`,color:`text.secondary`,fontWeight:600},children:[K(o,{size:11}),K(J,{component:`span`,sx:{textTransform:`uppercase`,letterSpacing:`0.06em`},children:a?`Upstream`:`Downstream`}),q(J,{component:`span`,sx:{color:`text.disabled`,fontWeight:500},children:[`· `,t,` direct`]}),u&&K(Ws,{label:d,title:Ls(r,a),active:r,isDark:s,onClick:i})]})}function Ks({label:e}){return K(J,{sx:{px:1.5,py:1,fontSize:`11px`,color:`text.disabled`,fontStyle:`italic`},children:e})}function qs({direction:e,query:t,onChange:n}){return K(J,{sx:{px:1.25,py:.75,borderBottom:`1px solid`,borderColor:`divider`,backgroundColor:`background.paper`},children:q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`,border:`1px solid`,borderColor:`divider`,borderRadius:`4px`,px:.875,py:.25},children:[K(Li,{size:12,color:`currentColor`,opacity:.55}),K(ci,{value:t,onChange:e=>{n(e.target.value)},placeholder:`filter…`,inputProps:{"aria-label":`Filter ${e===`up`?`Upstream`:`Downstream`}`,style:{padding:0,fontSize:`11px`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`}},sx:{flex:1,fontSize:`11px`}})]})})}function Js({hidden:e,onClick:t}){return q(J,{onClick:t,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},sx:{px:1.5,py:.75,fontSize:`11px`,color:`info.main`,cursor:`pointer`,userSelect:`none`,"&:hover":{backgroundColor:`action.hover`}},children:[`+ show `,Math.min(20,e),` more`,` `,q(J,{component:`span`,sx:{color:`text.disabled`,ml:.5},children:[`(`,e,` hidden)`]})]})}function Ys({node:e,onCenterFocus:t,cllImpacted:n}){let r=Ns(Ms(e),n),{isDark:i,background:a}=zt(),o=Ps(r),s=r===`impacted`?js(i):o,c=r===`impacted`?js(i):`divider`;return q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,px:1.5,py:1.25,backgroundColor:i?a.emphasized:`rgb(255 245 241)`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:[K(J,{component:`span`,sx:{width:`4px`,height:`26px`,borderRadius:`2px`,backgroundColor:o,flex:`0 0 auto`}}),K(J,{component:`span`,sx:{flex:1,minWidth:0,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,fontSize:`13px`,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.data.name,children:e.data.name}),t&&K($,{title:`Center on canvas`,placement:`top`,children:K(Q,{size:`small`,"aria-label":`Center on canvas`,onClick:t,sx:{p:.5,color:`text.secondary`,flex:`0 0 auto`},children:K(Fi,{size:14})})}),K(J,{component:`span`,sx:{fontSize:`10px`,fontWeight:600,px:.875,py:`2px`,borderRadius:`3px`,color:s,backgroundColor:`background.paper`,border:`1px solid`,borderColor:c,textTransform:`capitalize`,flex:`0 0 auto`},children:r})]})}function Xs({previousName:e,currentName:t,onJumpBack:n}){let{isDark:r}=zt();return q(X,{direction:`row`,spacing:.75,sx:{alignItems:`center`,minWidth:0,flex:1,overflow:`hidden`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,fontSize:`12px`},children:[K(J,{component:`span`,sx:{color:`text.secondary`,fontFamily:`inherit`,flex:`0 0 auto`},children:`Path`}),K(J,{component:`span`,role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:n,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())}:void 0,sx:{color:`text.primary`,cursor:n?`pointer`:`default`,textDecoration:`underline`,textDecorationColor:r?`rgb(255 255 255 / 0.35)`:`rgb(0 0 0 / 0.25)`,textUnderlineOffset:`2px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,"&:hover":n?{textDecorationColor:`currentColor`}:void 0},title:e,children:e}),K(J,{component:`span`,"aria-hidden":`true`,sx:{color:`text.disabled`,flex:`0 0 auto`},children:`›`}),K(J,{component:`span`,sx:{color:`primary.main`,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},title:t,children:t})]})}function Zs({node:e,nodesById:t,onNavigate:n,onBack:r,onCenterFocus:i,historyTrail:a,onJumpToHistory:o,impactingNodeIds:s,impactedNodeIds:c}){let{background:l}=zt(),[u,d]=W(``),[f,p]=W(``),[m,h]=W(8),[g,_]=W(8),[v,y]=W(!1),[b,x]=W(!1);V(()=>{d(``),p(``),h(8),_(8),y(!1),x(!1)},[e.id]);let S=H(()=>Object.keys(e.data.parents??{}),[e.data.parents]),C=H(()=>Object.keys(e.data.children??{}),[e.data.children]),w=H(()=>Is(S,u,t),[S,u,t]),T=H(()=>Is(C,f,t),[C,f,t]),E=((s?.size??0)>0||(c?.size??0)>0)&&((s?.has(e.id)??!1)||(c?.has(e.id)??!1)),D=(e,t)=>E?(t===`up`?s:c)?.has(e)??!1:!1,O=E?S.filter(e=>s?.has(e)).length:0,k=E?C.filter(e=>c?.has(e)).length:0,ee=e=>{let r=e===`up`,i=r?S:C,a=r?w:T,o=(r?v:b)?a.filter(t=>D(t,e)):a,s=r?u:f,l=r?d:p,y=r?m:g,x=r?h:_,E=i.length>8,O=o.slice(0,y),k=o.length-O.length,ee=r?`(source — no upstream)`:`(leaf — no downstream)`;return q(G,{children:[E&&K(qs,{direction:e,query:s,onChange:e=>{l(e),x(8)}}),i.length===0?K(Ks,{label:ee}):o.length===0?K(Ks,{label:`no matches`}):O.map(r=>K(zs,{name:Fs(r,t),status:Ms(t?.[r]),direction:e,decorateAsImpacted:D(r,e),dotImpacted:c?.has(r)??!1,onClick:n?()=>n(r):void 0},`${e}-${r}`)),k>0&&K(Js,{hidden:k,onClick:()=>x(e=>Math.min(o.length,e+20))})]})},te=(a?.length??0)>0;return q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,backgroundColor:`background.paper`},"data-testid":`lineage-tab-content`,children:[(!!r||te)&&q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,px:1.25,py:.75,borderBottom:`1px solid`,borderColor:`divider`,backgroundColor:l.subtle,minWidth:0},children:[r&&K($,{title:`Back to previous node`,placement:`top`,children:K(Q,{size:`small`,"aria-label":`Back to previous node`,onClick:r,sx:{flex:`0 0 auto`,border:`1px solid`,borderColor:`divider`,borderRadius:`6px`,px:1,py:.375,color:`text.secondary`,backgroundColor:`background.paper`,"&:hover":{backgroundColor:`action.hover`}},children:K(Mi,{size:14})})}),te&&a?K(Xs,{previousName:Fs(a[a.length-1],t),currentName:e.data.name,onJumpBack:o?()=>o(a.length-1):r}):K(J,{sx:{flex:1}})]}),q(J,{sx:{flex:1,overflowY:`auto`,minHeight:0},children:[K(Gs,{direction:`up`,directCount:S.length,impactCount:O,onlyImpact:v,onToggleOnlyImpact:()=>{y(e=>!e),h(8)}}),ee(`up`),K(Ys,{node:e,onCenterFocus:i,cllImpacted:c?.has(e.id)??!1}),K(Gs,{direction:`down`,directCount:C.length,impactCount:k,onlyImpact:b,onToggleOnlyImpact:()=>{x(e=>!e),_(8)}}),ee(`down`)]})]})}const Qs=({node:e,modelDetail:t,isSingleEnv:n,CodeEditor:r,DiffEditor:i,isDark:a=!1})=>{let[o,s]=W(!1),[c,l]=W(!1);if(e.data.resourceType!==`model`&&e.data.resourceType!==`snapshot`)return`Not available`;let u=t?.base?.raw_code,d=t?.current?.raw_code,f=t?.base?.name??t?.current?.name??e.data.name??``,p=u!=null||d!=null;return q(J,{className:`no-track-pii-safe`,sx:{position:`relative`,height:`100%`},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},children:[p?n?K(r,{language:`sql`,value:u??``,readOnly:!0,lineNumbers:!0,wordWrap:!1,theme:a?`dark`:`light`}):K(i,{original:u??``,modified:d??``,language:`sql`,readOnly:!0,lineNumbers:!0,sideBySide:!1,theme:a?`dark`:`light`,height:`100%`}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`text.secondary`},children:`No code available`}),K(Q,{onClick:()=>s(!0),size:`medium`,"aria-label":`Expand`,sx:{position:`absolute`,top:`5px`,right:`20px`,opacity:c?.5:.1,transition:`opacity 0.3s ease-in-out`},children:K(hr,{})}),q(Zn,{open:o,onClose:()=>s(!1),maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{height:`75%`,overflowY:`auto`}}},children:[q(er,{sx:{display:`flex`,alignItems:`center`},children:[n?q(G,{children:[K(`code`,{children:f}),`\xA0Model Code`]}):q(G,{children:[K(`code`,{children:f}),`\xA0Model Code Diff`]}),K(J,{sx:{flex:1}}),K(Q,{size:`small`,onClick:()=>s(!1),children:K(lr,{})})]}),K($n,{children:p?n?K(r,{language:`sql`,value:u??``,fontSize:16,readOnly:!0,lineNumbers:!0,wordWrap:!1,theme:a?`dark`:`light`}):K(i,{original:u??``,modified:d??``,language:`sql`,theme:a?`dark`:`light`,className:`text-base`}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`text.secondary`},children:`No code available`})})]})]})},$s=({node:e})=>{let{data:t,isLoading:r}=pe(),i=Zt(),{apiClient:a}=I(),o=e.data.resourceType,s=o===`model`||o===`snapshot`,{data:c,isLoading:l}=Hn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,a),enabled:s&&!!a,staleTime:3e5,retry:1});return r?K(G,{}):s&&l?K(J,{"aria-label":`Loading model code`,sx:{p:2,height:`100%`},"data-testid":`node-sql-view-loading`,children:K(ia,{variant:`rectangular`,height:`100%`,animation:`wave`})}):K(Qs,{node:e,modelDetail:c?.model,isSingleEnv:t?.single_env_onboarding??!1,CodeEditor:ct,DiffEditor:St,isDark:i})};function ec({rowCount:e}){return`base`in e?K(nc,{rowCount:e}):K(`span`,{children:tc(e.curr)})}function tc(e){return e===null?`N/A`:`${e.toLocaleString()} ${e===1?`row`:`rows`}`}function nc({rowCount:e}){let t=e.base,n=e.curr,r=Zt(),i=Te(r),a=on(t,n),o=tc(t),s=tc(n);return a===`unavailable`?K(G,{children:`Failed to load`}):a===`added`||a===`removed`?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:o}),K(Hi,{}),K(Z,{variant:`body2`,component:`span`,children:s})]}):t===null||n===null?K(G,{children:`Failed to load`}):a===`unchanged`?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{color:`grey.500`,display:`flex`},children:K(Xi,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`grey.500`},children:`No Change`})]}):a===`increase`&&t!==null&&n!==null?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{color:i.current.foreground,display:`flex`},children:K(Ji,{})}),K(Z,{variant:`body2`,component:`span`,"data-row-count-direction":`increase`,sx:{color:i.current.foreground},children:$t(t,n)})]}):q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{color:i.base.foreground,display:`flex`},children:K(qi,{})}),K(Z,{variant:`body2`,component:`span`,"data-row-count-direction":`decrease`,sx:{color:i.base.foreground},children:$t(t,n)})]})}function rc({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=Zt(),{featureToggles:a}=ie(),{runsAggregated:o}=F(),s=o?.[t.id]?.row_count_diff.result,c=z(`row_count_diff`).icon,l=e??s,u=l,d=l?`${l.base??`N/A`} -> ${l.curr??`N/A`} rows`:``;return K($,{title:d,children:K(Il,{display:a.mode===`metadata only`,children:q(J,{component:`span`,sx:{...ke(i),gap:.5},children:[K(c,{}),u!=null||r?r?K(ia,{width:30,height:16}):u==null?K(Z,{variant:`caption`,children:`row count`}):K(nc,{rowCount:u}):K(Z,{variant:`caption`,children:`row count`}),n&&K(Q,{"aria-label":`Query Row Count`,size:`small`,onClick:n,disabled:a.disableDatabaseQuery,sx:{p:0,ml:.5},children:K(Fr,{size:12})})]})})})}function ic({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=Zt(),{runsAggregated:a}=F(),o=a?.[t.id]?.row_count.result,s=z(`row_count`).icon,c,l=e??o;return l&&(c=`${l.curr??`N/A`} rows`),q(J,{component:`span`,sx:ke(i),children:[K(J,{component:`span`,sx:yt,children:K(s,{})}),l||r?r?K(ia,{width:30,height:16}):K(Z,{variant:`caption`,children:c}):K(Z,{variant:`caption`,children:`row count`}),n&&K(Q,{"aria-label":`Query Row Count`,size:`small`,onClick:n,disabled:t.data.changeStatus===`removed`,sx:{p:0,ml:.5},children:K(Fr,{size:12})})]})}function ac({children:e,value:t,index:n}){return t===n?K(G,{children:e}):null}const oc=()=>K(`span`,{}),sc=({children:e})=>K(G,{children:e}),cc=()=>!0;function lc(e,t,n){return e?Rn.add_or_remove:n(t)?``:`This action is not supported yet.`}function uc({node:e,actionCallbacks:t,runTypeIcons:n,isActionAvailable:r,rowCountDisplay:i}){let a=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,o=n?.query??oc,s=n?.row_count??oc,c=n?.profile??oc;return q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1},children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(o,{fontSize:`small`}),onClick:t?.onQueryClick,sx:{textTransform:`none`},children:`Query`}),q(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(s,{fontSize:`small`}),onClick:t?.onRowCountClick,sx:{textTransform:`none`},children:[`Row Count`,i!=null&&q(G,{children:[`:\xA0`,i]})]}),K($,{title:lc(a,`profile`,r),placement:`top`,children:K(`span`,{children:K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(c,{fontSize:`small`}),onClick:t?.onProfileClick,disabled:a,sx:{textTransform:`none`},children:`Profile`})})})]})}function dc({onClick:e,Icon:t}){return K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(t,{fontSize:`small`}),onClick:e,sx:{textTransform:`none`},children:`Add schema diff to checklist`})}function fc({node:e,actionCallbacks:t,runTypeIcons:n,featureToggles:r,isActionAvailable:i,ConnectionPopoverWrapper:a,rowCountDisplay:o}){let s=r?.mode===`metadata only`,c=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,l=n?.query_diff??oc,u=n?.row_count_diff??oc,d=n?.profile_diff??oc,f=n?.value_diff??oc,p=n?.top_k_diff??oc,m=n?.histogram_diff??oc,h=(e,t)=>{if(s)return K(a,{display:!0,children:e});let n=lc(c,t,i);return K($,{title:n,placement:`top`,children:K(`span`,{children:e})})};return q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:2},children:[K(Z,{variant:`caption`,sx:{fontWeight:`bold`},children:`Diff`}),q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1,width:`93%`},children:[K(a,{display:s,children:q(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(u,{fontSize:`small`}),onClick:t?.onRowCountDiffClick,disabled:r?.disableDatabaseQuery,sx:{textTransform:`none`},children:[`Row Count`,o!=null&&q(G,{children:[`:\xA0`,o]})]})}),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(d,{fontSize:`small`}),onClick:t?.onProfileDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Profile`}),`profile_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(f,{fontSize:`small`}),onClick:t?.onValueDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Value`}),`value_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(p,{fontSize:`small`}),onClick:t?.onTopKDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Top-K`}),`top_k_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(m,{fontSize:`small`}),onClick:t?.onHistogramDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Histogram`}),`histogram_diff`),K(a,{display:s,children:K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(l,{fontSize:`small`}),onClick:t?.onQueryDiffClick,disabled:r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Query`})})]})]})}function pc({node:e,onCloseNode:t,isSingleEnv:n,featureToggles:r,modelDetail:i,lineageTabContent:a,SchemaView:o,SingleEnvSchemaView:s,NodeSqlView:c,ResourceTypeTag:l,NotificationComponent:u,ConnectionPopoverWrapper:d=sc,runTypeIcons:f,actionCallbacks:p,isActionAvailable:m=cc,isWholeModelChanged:h=!1,isWholeModelImpacted:g=!1,newCllExperience:_=!1,isImpacted:v=!1,rowCountDisplay:y}){let b=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`source`||e.data.resourceType===`snapshot`,[x,S]=W(!0),[C,w]=W(0),{base:T,current:E}=i??{},D=!n&&e.data.change?.columns!=null&&Object.keys(e.data.change.columns).length>0,O=!n&&e.data.changeStatus===`modified`,k=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`snapshot`,ee=!n&&k&&p?.onAddSchemaDiffClick!=null,te=f?.schema_diff??oc,{isDark:ne}=zt(),A={newCllExperience:_,isWholeModelChanged:h,isWholeModelImpacted:g,isImpacted:v,changeCategory:e.data.change?.category},j=wt(A,ne),M=Lt({name:e.data.name,resourceType:e.data.resourceType,materialized:e.data.materialized},A),N=_?void 0:Rt(e.data.change?.category);return q(J,{className:j?`cll-experience`:void 0,sx:{height:`100%`,display:`flex`,flexDirection:`column`,borderLeft:`3px solid ${j?j.tokens.stripeAccent:`transparent`}`},children:[q(X,{direction:`row`,sx:{alignItems:`center`,px:2,py:1.5,gap:1},children:[K($,{title:M,placement:`top`,children:j?K(Ft,{tokens:j.tokens,variant:`titleChip`,testId:`whole-model-${j.kind}-title-chip`,sx:{flex:`0 1 auto`,mr:`auto`,minWidth:0},children:K(Z,{variant:`subtitle1`,component:`span`,className:`no-track-pii-safe`,sx:{fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`inherit`},children:e.data.name})}):K(Z,{component:`span`,variant:`subtitle1`,className:`no-track-pii-safe`,sx:{fontWeight:600,flex:`0 1 auto`,mr:`auto`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.data.name})}),l&&K(J,{sx:{color:`text.secondary`,flexShrink:0},children:K(l,{node:e})}),N&&K(Vr,{"data-testid":`change-category-chip`,label:N,size:`small`,variant:`outlined`,sx:{flexShrink:0}}),K(Q,{size:`small`,onClick:t,sx:{flexShrink:0},children:K(lr,{})})]}),k&&K(J,{sx:{pl:2,py:1},children:n?K(uc,{node:e,actionCallbacks:p,runTypeIcons:f,isActionAvailable:m,rowCountDisplay:y}):K(fc,{node:e,actionCallbacks:p,runTypeIcons:f,featureToggles:r,isActionAvailable:m,ConnectionPopoverWrapper:d,rowCountDisplay:y})}),b&&q(J,{sx:{overflow:`auto`,display:`flex`,flexDirection:`column`,flex:1,minHeight:0},children:[n&&x&&u&&K(J,{sx:{p:1.5},children:K(u,{onClose:()=>S(!1),children:K(Z,{variant:`body2`,children:`Enable the Recce Checklist and start adding checks for better data validation and review.`})})}),q(wi,{value:C,onChange:(e,t)=>w(t),sx:{borderBottom:1,borderColor:`divider`},children:[K(Ci,{label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Columns`,D&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),K(Ci,{label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Code`,O&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),a&&K(Ci,{label:`Lineage`})]}),q(J,{sx:{overflow:`auto`,height:`calc(100% - 48px)`},children:[K(ac,{value:C,index:0,children:K(J,{sx:{overflowY:`auto`,height:`100%`},children:n?s&&K(s,{current:E}):o&&K(o,{base:T,current:E,columnChanges:e.data.change?.columns,onViewCode:()=>w(1),headerAction:ee?K(dc,{onClick:p?.onAddSchemaDiffClick,Icon:te}):void 0})})}),K(ac,{value:C,index:1,children:K(J,{sx:{height:`100%`},children:c&&K(c,{node:e})})}),a&&K(ac,{value:C,index:2,children:K(J,{sx:{height:`100%`},children:a})})]})]})]})}const mc=({node:e})=>K(nt,{resourceType:e.data.resourceType,materialized:e.data.materialized});function hc({onClose:e}){return K(Ae,{onClose:e,align:`flex-start`,children:q(Z,{variant:`body2`,children:[`Enable the Recce Checklist and start adding checks for better data validation and review.`,K(`br`,{}),K(Ot,{})]})})}function gc({node:e,onCloseNode:t,onNavigateToNode:r,onBack:i,onCenterFocused:a,historyTrail:o,onJumpToHistory:s}){let c=Ai(),{runAction:l}=ge(),{isActionAvailable:u,envInfo:d,lineageGraph:f}=F(),p=me(),{impactingNodeIds:m,impactedNodeIds:h}=H(()=>ks(p?.cll),[p?.cll]),{singleEnv:g,featureToggles:_}=ie(),{setSqlQuery:v,setPrimaryKeys:y}=mt(),{primaryKey:x}=Ct(e.data.name),{apiClient:S}=I(),{basePath:C}=ae(),{runsAggregated:w}=F(),T=g??!1,E=H(()=>{let t=w?.[e.id],n=T?t?.row_count?.result:t?.row_count_diff?.result;return n?K(ec,{rowCount:n}):void 0},[w,e.id,T]),{data:D}=Hn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,S),enabled:!!S,staleTime:3e5}),O=D?.model,k=H(()=>({query:z(`query`).icon,row_count:z(`row_count`).icon,row_count_diff:z(`row_count_diff`).icon,profile:z(`profile`).icon,profile_diff:z(`profile_diff`).icon,query_diff:z(`query_diff`).icon,value_diff:z(`value_diff`).icon,top_k_diff:z(`top_k_diff`).icon,histogram_diff:z(`histogram_diff`).icon,schema_diff:z(`schema_diff`).icon}),[]),ee=Object.keys(O?.base?.columns??{}),te=Object.keys(O?.current?.columns??{}),ne=en(ee,te),A=H(()=>ne.length?`select \n ${ne.join(`
|
|
6
|
+
`)}\nfrom {{ ref("${e.data.name}") }}`:`select * from {{ ref("${e.data.name}") }}`,[ne,e.data.name]),j=H(()=>({onQueryClick:()=>{d?.adapterType===`dbt`?v(A):d?.adapterType===`sqlmesh`&&v(`select * from ${e.data.name}`),c.push(`${C}/query`)},onRowCountClick:()=>{Tn({action:gn.ROW_COUNT,source:_n.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),l(`row_count`,{node_names:[e.data.name]},{showForm:!1,showLast:!1})},onRowCountDiffClick:()=>{Tn({action:gn.ROW_COUNT_DIFF,source:_n.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),l(`row_count_diff`,{node_names:[e.data.name]},{showForm:!1,showLast:!1})},onProfileClick:()=>{Tn({action:gn.PROFILE,source:_n.NODE_SIDEBAR_SINGLE_ENV,node_count:1}),l(`profile`,{model:e.data.name},{showForm:!0,showLast:!1})},onProfileDiffClick:()=>{Tn({action:gn.PROFILE_DIFF,source:_n.NODE_SIDEBAR_MULTI_ENV,node_count:1}),l(`profile_diff`,{model:e.data.name},{showForm:!0,showLast:!1})},onQueryDiffClick:()=>{d?.adapterType===`dbt`?v(A):d?.adapterType===`sqlmesh`&&v(`select * from ${e.data.name}`),u(`query_diff_with_primary_key`)&&y(x===void 0?void 0:[x]),c.push(`${C}/query`)},onValueDiffClick:()=>{Tn({action:gn.VALUE_DIFF,source:_n.NODE_SIDEBAR_MULTI_ENV,node_count:1}),l(`value_diff`,{model:e.data.name},{showForm:!0,showLast:!1})},onTopKDiffClick:()=>{Tn({action:gn.TOP_K_DIFF,source:_n.NODE_SIDEBAR_MULTI_ENV,node_count:1}),l(`top_k_diff`,{model:e.data.name,column_name:``,k:50},{showForm:!0})},onHistogramDiffClick:()=>{Tn({action:gn.HISTOGRAM_DIFF,source:_n.NODE_SIDEBAR_MULTI_ENV,node_count:1}),l(`histogram_diff`,{model:e.data.name,column_name:``,column_type:``},{showForm:!0})},onAddSchemaDiffClick:async()=>{let t=await b({node_id:e.id},S);c.push(`${C}/checks/?id=${t.check_id}`)}}),[e,A,d,v,l,u,y,x,S,c.push,C]),M=p?pt(e.id,p):{isWholeModelChanged:!1,isWholeModelImpacted:!1};return K(pc,{node:e,onCloseNode:t,isSingleEnv:T,featureToggles:_,isWholeModelChanged:M.isWholeModelChanged,isWholeModelImpacted:M.isWholeModelImpacted,newCllExperience:p?.newCllExperience??!1,isImpacted:h?.has(e.id)??!1,modelDetail:(()=>{if(!O)return;let t=!!O.base&&Object.keys(O.base).length>0,n=!!O.current&&Object.keys(O.current).length>0;if(!(!t&&!n))return{base:t?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,package_name:e.data.packageName,...O.base}:void 0,current:n?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,package_name:e.data.packageName,...O.current}:void 0}})(),SchemaView:Ds,SingleEnvSchemaView:Os,NodeSqlView:$s,ResourceTypeTag:mc,rowCountDisplay:E,NotificationComponent:hc,ConnectionPopoverWrapper:Il,runTypeIcons:k,actionCallbacks:j,isActionAvailable:u,lineageTabContent:r?K(Zs,{node:e,nodesById:f?.nodes,onNavigate:r,onBack:i,onCenterFocus:a,historyTrail:o,onJumpToHistory:s,impactingNodeIds:m,impactedNodeIds:h}):void 0})}function _c(e){switch(e?.type){case`top_k_diff`:case`profile`:case`profile_diff`:case`histogram_diff`:case`value_diff`:case`value_diff_detail`:return!0;default:return!1}}function vc(e,t){if(!_c(e))return!1;let n=e.params?.model;return!n||t.length===0?!1:!t.filter(ve).some(e=>e.data.name===n)}function yc({featureToggles:e,settingsUrl:t}){return e.mode===`metadata only`?K(J,{sx:{display:`flex`,alignItems:`center`,width:`100%`,px:1,py:.25,bgcolor:`cyan.50`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,flex:1,fontSize:`0.875rem`,color:`cyan.600`},children:[K(J,{component:Or}),K(Z,{sx:{fontSize:`inherit`,color:`inherit`},children:`Query functions disabled without a data warehouse connection.`}),K(Y,{sx:{bgcolor:`iochmara.400`},size:`small`,variant:`contained`,onClick:()=>{window.open(t,`_blank`)},children:`Connect to Data Warehouse`})]})}):null}function bc(e){let{featureToggles:t}=ie(),{data:n}=P();return K(yc,{featureToggles:e.featureToggles??t,settingsUrl:e.settingsUrl??ln(n,hn)})}function xc({docsUrl:e=`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,onStartClick:t}={}){return K(X,{sx:{flex:1,height:`100%`,minHeight:0,m:1,p:2,bgcolor:`iochmara.50`,borderRadius:2,boxShadow:2,justifyContent:`center`},children:q(X,{sx:{alignSelf:`center`,width:`80%`,overflowY:`auto`,gap:3,px:4,pb:4},children:[q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{sx:{p:1,bgcolor:`background.paper`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:2},children:K(J,{component:Zi,sx:{fontSize:28,color:`iochmara.500`}})}),K(Z,{variant:`h5`,sx:{mt:2},children:`Wait, there's more!`}),q(Z,{sx:{textAlign:`center`},children:[`Recce is currently running in`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`limited functionality mode`}),` `,`so you can run queries but`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`can't diff the results yet!`})]})]}),q(X,{spacing:1,children:[K(Z,{children:`To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison.`}),K(Z,{children:`Once configured, you'll be able to:`}),q(Ti,{sx:{listStyleType:`disc`,pl:2},children:[K(Ei,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run statistical data diffs`})}),K(Ei,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run query diffs`})}),K(Ei,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Save checks to your Recce Checklist`})}),K(Ei,{sx:{display:`list-item`,p:0},children:K(Z,{children:`...and more!`})})]}),K(Z,{children:`Take the next step toward better data impact assessment.`})]}),K(X,{sx:{width:`100%`,mt:3},children:K(Y,{color:`iochmara`,variant:`contained`,size:`large`,onClick:()=>{t?t():window.open(e,`_blank`)},children:`Start Now`})})]})})}function Sc({docsUrl:e=`https://docs.reccehq.com/configure-diff/`}={}){return q(X,{direction:`row`,spacing:`10px`,sx:{alignItems:`flex-start`},children:[K(J,{component:Yi,sx:{color:`iochmara.main`,fontSize:20}}),q(X,{spacing:`5px`,children:[q(Z,{sx:{fontWeight:700},children:[`Single Environment Mode`,` `,K(Z,{component:`span`,sx:{color:`error.main`,fontWeight:600},children:`Limited Functionality`})]}),K(Z,{sx:{fontSize:`0.875rem`},children:`Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments.`}),K(Z,{sx:{fontSize:`0.875rem`},children:`To set up full environment comparison:`}),q(Ti,{sx:{pl:2},children:[K(Ei,{sx:{p:0,display:`list-item`},children:K(Z,{sx:{fontSize:`0.875rem`},children:"Run `recce debug` for setup assistance"})}),K(Ei,{sx:{p:0,display:`list-item`},children:q(Z,{sx:{fontSize:`0.875rem`},children:[`Visit`,` `,K(tr,{sx:{color:`primary.main`,fontWeight:500},target:`_blank`,href:e,children:`docs`}),` `,`for configuration details`]})})]})]})]})}function Cc(){return K(J,{sx:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(pr,{size:48})})}function wc({error:e,onRetry:t}){return K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:q(X,{spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`Failed to load lineage data. This could be because the server has been terminated or there is a network error.`}),q(J,{children:[`[Reason: `,e,`]`]}),K(Y,{color:`iochmara`,variant:`contained`,onClick:()=>{t&&t()},children:`Retry`})]})})}function Tc({viewOptions:e,onViewOptionsChanged:t}){return K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:q(X,{spacing:1,sx:{alignItems:`center`},children:[K(G,{children:`No change detected`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:async()=>{await t({...e,view_mode:`all`})},children:`Show all nodes`})]})})}function Ec(){let{isHistoryOpen:e,showHistory:t}=ge();if(!e)return q(J,{children:[K(J,{sx:{fontSize:`8pt`},children:`History`}),K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(mi,{}),onClick:()=>{En({name:e?`hide`:`show`}),t()},children:`Show`})]})}const Dc=e=>({fontSize:`8pt`,bgcolor:e?`grey.700`:`grey.100`,px:.5,borderRadius:1}),Oc=()=>{let e=Zt(),t=Dc(e);return q(X,{spacing:0,sx:{alignItems:`flex-start`},children:[K(Z,{sx:{fontSize:`10pt`,color:`text.secondary`,pb:1},children:`Select nodes by dbt node selector syntax`}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:t,children:`model_name`}),` `,`Select a node`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:t,children:`model_name+`}),` `,`Select downstream nodes`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:t,children:`+model_name`}),` `,`Select upstream nodes`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:t,children:`model*`}),` `,`Select by wildcard`]})]})},kc=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n})=>{let[r,i]=W(null),a=!!r,o=t.view_mode??`changed_models`,s=o===`changed_models`?`Changed Models`:`All`,c=e=>{i(e.currentTarget)},l=()=>{i(null)},u=e=>{n({...t,view_mode:e}),l()},d=Ye(`model`).icon;return q(G,{children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,onClick:c,disabled:e,startIcon:d&&K(d,{}),endIcon:K(Sr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:s}),q(li,{anchorEl:r,open:a,onClose:l,children:[K(gi,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`mode`}),q(oa,{value:o,children:[K(ui,{onClick:()=>u(`changed_models`),children:K(oi,{value:`changed_models`,control:K(aa,{size:`small`,sx:{py:0}}),label:`Changed Models`,sx:{m:0}})}),K(ui,{onClick:()=>u(`all`),children:K(oi,{value:`all`,control:K(aa,{size:`small`,sx:{py:0}}),label:`All`,sx:{m:0}})})]})]})]})},Ac=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n,lineageGraph:r})=>{let[i,a]=W(null),o=!!i,s=new Set,c=Object.values(r?.nodes??{});for(let e of c)e.data.packageName&&s.add(e.data.packageName);let l=r?.manifestMetadata.current?.project_name,u=t.packages?new Set(t.packages):l?new Set([l]):s,d=u.size===s.size,f=u.size===0,p=u.size===1?Array.from(u)[0]:d?`All Packages`:f?`No Package`:`${u.size} Packages`,m=e=>{a(e.currentTarget)},h=()=>{a(null)},g=()=>{n(d?{...t,packages:[]}:{...t,packages:Array.from(s)})},_=e=>{let r=new Set(u);r.has(e)?r.delete(e):r.add(e),n({...t,packages:Array.from(r)})};return q(G,{children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,onClick:m,disabled:e,startIcon:K(Gi,{}),endIcon:K(Sr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:p}),q(li,{anchorEl:i,open:o,onClose:h,children:[K(gi,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Select Packages`}),q(ui,{onClick:g,children:[K(ai,{checked:d,indeterminate:!d&&!f,size:`small`,sx:{py:0}}),K(Vi,{children:`Select All`})]}),K(fr,{}),Array.from(s).map(e=>q(ui,{onClick:()=>_(e),children:[K(ai,{checked:u.has(e),size:`small`,sx:{py:0}}),K(Vi,{className:`no-track-pii-safe`,children:e})]},e))]})]})},jc=({value:e,onChange:t,isDisabled:n,tooltipComponent:r,showTooltip:i=!0})=>{let[a,o]=W(e),s=U(null);return V(()=>{s.current&&(s.current.value=e)},[e]),K($,{title:i?r:``,placement:`bottom-start`,slotProps:{tooltip:{sx:{width:`18.75rem`,p:2,boxShadow:3,border:1,borderRadius:1,color:`text.primary`,bgcolor:`background.paper`}}},children:K(bi,{inputRef:s,size:`small`,placeholder:`with selectors`,disabled:n,value:a,onChange:e=>{o(e.target.value)},onKeyUp:n=>{n.key===`Enter`?t(a):n.key===`Escape`&&(n.preventDefault(),o(e),s.current&&s.current.blur())},onBlur:()=>{o(e)},sx:{"& .MuiInputBase-root":{width:`18.75rem`,height:24,fontSize:`0.75rem`},"& .MuiInputBase-input":{py:.5,px:1}}})})},Mc=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n,showTooltip:r})=>K(jc,{isDisabled:e,value:t.select??``,onChange:e=>{n({...t,select:e||void 0})},tooltipComponent:K(Oc,{}),showTooltip:r}),Nc=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n})=>K(jc,{isDisabled:e,value:t.exclude??``,onChange:e=>{n({...t,exclude:e||void 0})}}),Pc=({label:e,children:t,style:n})=>q(J,{style:n,sx:{maxWidth:300},children:[K(Z,{sx:{fontSize:`8pt`},children:(e??``).trim()||K(G,{children:`\xA0`})}),t]}),Fc=({children:e})=>K(G,{children:e}),Ic=({viewOptions:e,onViewOptionsChanged:t,lineageGraph:n,featureToggles:r,serverFlags:i,focusedNode:a,selectedNodes:o,onDeselect:s,onRunRowCount:c,onRunRowCountDiff:l,onRunValueDiff:u,onAddLineageDiffCheck:d,onAddSchemaDiffCheck:f,runTypeIcons:p,historyToggleSlot:m,SetupConnectionPopoverSlot:h=Fc})=>{let g=i?.single_env_onboarding,[_,v]=W(null),y=!!_,b=o.length>0,x=b,S=e=>{v(e.currentTarget)},C=()=>{v(null)},w=p.rowCountDiff,T=p.valueDiff,E=p.lineageDiff,D=p.schemaDiff;return K(X,{direction:`row`,sx:{alignItems:`center`,borderBottom:1,borderColor:`neutral.light`,width:`100%`,p:`4pt 8pt`,gap:`0.5rem`},children:q(X,{direction:`row`,sx:{alignItems:`center`,flex:1,gap:`0.5rem`},children:[m,K(Pc,{label:`Mode`,style:{flexShrink:1},children:K(kc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K(Pc,{label:`Package`,style:{flexShrink:1},children:K(Ac,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,lineageGraph:n})}),K(Pc,{label:`Select`,style:{flexShrink:1},children:K(Mc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,showTooltip:g})}),K(Pc,{label:`Exclude`,style:{flexShrink:1},children:K(Nc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K(J,{sx:{flexGrow:1}}),b&&q(G,{children:[K(Pc,{label:``,style:{flexShrink:0},children:K(Z,{sx:{fontSize:`9pt`,color:`text.secondary`},children:o.length>1?`${o.length} nodes selected`:`${o.length} node selected`})}),K(Pc,{label:``,children:K(Y,{variant:`outlined`,color:`neutral`,size:`xsmall`,onClick:()=>{s()},sx:{textTransform:`none`,fontSize:`9pt`},children:`Deselect`})}),g&&K(Pc,{label:`Explore`,children:q(J,{sx:{display:`inline-flex`},children:[K(Y,{size:`xsmall`,color:`neutral`,variant:`outlined`,onClick:S,endIcon:K(Sr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),K(li,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:q(ui,{disabled:r.disableDatabaseQuery,onClick:async()=>{await c?.(),C()},children:[K(Bi,{children:K(w,{fontSize:`small`})}),K(Vi,{children:`Row Count`})]})})]})})]}),!g&&K(Pc,{label:`Explore`,children:q(J,{sx:{display:`inline-flex`},children:[K(Y,{size:`xsmall`,color:`neutral`,variant:`outlined`,disabled:r.disableViewActionDropdown,onClick:S,endIcon:K(Sr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),q(li,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:[K(gi,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Diff`}),K(h,{display:r.mode===`metadata only`,children:q(ui,{disabled:r.disableDatabaseQuery,onClick:async()=>{await l?.(),C()},children:[K(Bi,{children:K(w,{fontSize:`small`})}),K(Vi,{children:`Row Count Diff`})]})}),K(h,{display:r.mode===`metadata only`,children:q(ui,{disabled:r.disableDatabaseQuery,onClick:async()=>{await u?.(),C()},children:[K(Bi,{children:K(T,{fontSize:`small`})}),K(Vi,{children:`Value Diff`})]})}),(!r.disableUpdateChecklist||r.checklistPermissionDenied)&&[K(fr,{},`checklist-divider`),K(gi,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Add to Checklist`},`checklist-header`),K($,{title:r.checklistPermissionDenied?`You don't have permission to add checks`:``,placement:`left`,children:K(`span`,{children:q(ui,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(d?.(e.view_mode),C())},children:[K(Bi,{children:K(E,{fontSize:`small`})}),K(Vi,{children:`Lineage Diff`})]})})},`add-lineage-diff`),K($,{title:r.checklistPermissionDenied?`You don't have permission to add checks`:``,placement:`left`,children:K(`span`,{children:q(ui,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(f?.(),C())},children:[K(Bi,{children:K(D,{fontSize:`small`})}),K(Vi,{children:`Schema Diff`})]})})},`add-schema-diff`)]]})]})})]})})},Lc=({display:e,children:t})=>K(Il,{display:e,children:t}),Rc=()=>{let{deselect:e,focusedNode:t,selectedNodes:n,viewOptions:r,onViewOptionsChanged:i,runRowCount:a,runRowCountDiff:o,runValueDiff:s,addLineageDiffCheck:c,addSchemaDiffCheck:l}=ce(),{lineageGraph:u}=F(),{featureToggles:d}=ie(),{data:f}=pe(),p={rowCountDiff:z(`row_count_diff`).icon,valueDiff:z(`value_diff`).icon,lineageDiff:z(`lineage_diff`).icon,schemaDiff:z(`schema_diff`).icon};return K(Ic,{viewOptions:r,onViewOptionsChanged:i,lineageGraph:u,featureToggles:d,serverFlags:f,focusedNode:t,selectedNodes:n,onDeselect:e,onRunRowCount:a,onRunRowCountDiff:o,onRunValueDiff:s,onAddLineageDiffCheck:c,onAddSchemaDiffCheck:l,runTypeIcons:p,historyToggleSlot:K(Ec,{}),SetupConnectionPopoverSlot:Lc})};function zc(e,t){return e===t?void 0:t}function Bc(e,t){let n=ss(t),r=new Set;for(let i of Object.keys(e.nodes)){let a=e.nodes[i];cs(i,t,a.data.changeStatus,n)&&r.add(i)}let{wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:a}=ls(e,t);return{nodeIds:r,columnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:a}}function Vc(e,t,n,r){return e&&t&&n?.node_id&&n?.column?fe(t,n.node_id,n.column,r??new Set):void 0}function Hc({interactive:e=!1,...t},n){let{isDark:i}=zt(),{apiClient:a}=I(),o=Un(),s=ni(),c=U(null),{copyToClipboard:l,ImageDownloadModal:u,ref:f}=Vo(),[p,m,h]=ti(Ao),[g,_,v]=ei([]),{lineageGraph:y,refetchLineageGraph:x,isLoading:S,error:w,refetchRunsAggregated:T}=F(),{featureToggles:E,singleEnv:D}=ie(),{data:O}=pe(),k=O?.new_cll_experience??!1,{runId:ee,showRunId:te,closeRunResult:ne,runAction:j,isRunResultOpen:M}=ge(),{run:re}=Nt(ee),[P,ae]=W({...t.viewOptions}),oe=Ko(),se=U([]).current,[ce,le]=W(void 0),[ue,de]=W(!1),fe=U(!1);fe.current=ue;let me=Vn({mutationFn:e=>r(e,a)}),Se=U(os()).current,Ce=U(0),we=U(0),Te=U(void 0),Ee=U(void 0),Oe=B(()=>++we.current,[]),[ke,Ae]=W(0),je=B(()=>Ae(e=>e+1),[]),[Me,Ne]=W({});Xn(()=>()=>{++Ce.current,Oe(),Se.invalidate()},[Se,Oe]);let Pe=B(e=>p.filter(ve).find(t=>t.data.name===e),[p]);Yn(n,()=>({copyToClipboard:l}));let Fe=H(()=>!!(y&&y.modifiedSet.length>0),[y]),Ie=P.view_mode??`changed_models`,Le=H(()=>p.filter(e=>e.type===`lineageGraphNode`).map(e=>e.id),[p]),Re=H(()=>y?Le.map(e=>y.nodes[e]):[],[y,Le]),[Be,Ve]=W(),L=Be?y?.nodes[Be]:void 0,[He,Ue]=W([]),[R,Ge]=W(),[Ke,qe]=W(new Set),Ye=H(()=>y?Array.from(Ke).map(e=>y.nodes[e]):[],[y,Ke]),Xe=Qo(Ye.length>0?Ye:Re,{onActionStarted:()=>{Oe(),Ge(`action_result`)},onActionNodeUpdated:e=>{m(t=>t.map(t=>t.id===e.id?{...t}:t))},onActionCompleted:()=>{}}),Ze=B(()=>{let e=new Map,t=s.getNodes();for(let n of t)!n.parentId&&n.position&&e.set(n.id,{x:n.position.x,y:n.position.y});return e},[s]),Qe=H(()=>{if(!y)return new Set;let e=new Set;if(ce){for(let[t,n]of Object.entries(ce.current.nodes))n.impacted!==!1&&e.add(t);for(let t of Object.keys(ce.current.columns))e.add(t)}else if(R===`action_result`){let t=Object.keys(Xe.actionState.actions);e=new Set(t)}else e=L?_e(xe(y,[L.id]),ye(y,[L.id])):Fe?ye(y,y.modifiedSet):new Set(Le);return new Set(e)},[y,ce,R,L,Fe,Xe.actionState.actions,Le]),$e=fs(),et=()=>{$e.closeContextMenu()},tt=U(!1),{impactedNodeIds:nt,impactedColumnIds:rt,wholeModelImpactedNodeIds:it,wholeModelChangedNodeIds:at,publish:ot}=Wo(),st=H(()=>jo({impactedNodeIds:nt,newCllExperience:k}),[nt,k]);Xn(()=>{let e=++Ce.current,n=()=>Ce.current===e,r=()=>{O?.impact_at_startup&&!tt.current&&je()};return(async()=>{let e;if(!y){Se.resolveCllForLayout({cllInput:void 0,changeAnalysis:fe.current,actionGetCll:me,queryClient:o});return}if(P.node_ids)e=P.node_ids;else{let i=y.manifestMetadata.current?.project_name,o={view_mode:P.view_mode??(Fe?`changed_models`:`all`),packages:i?[i]:void 0,...t.viewOptions};try{let t=await C({select:o.select,exclude:o.exclude,packages:o.packages,view_mode:o.view_mode},a);if(!n()){r();return}e=t.nodes}catch{if(!n()){r();return}o.view_mode=`all`;let t=await C({select:o.select,exclude:o.exclude,packages:o.packages,view_mode:o.view_mode},a);if(!n()){r();return}e=t.nodes}ae(o)}let i=P.column_level_lineage,s=!1;O?.impact_at_startup&&!tt.current&&!i&&(tt.current=!0,s=!0,fe.current=!0,de(!0),i=Pa(),ae(e=>({...e,column_level_lineage:i})));let c;try{let e=await Se.resolveCllForLayout({cllInput:i,changeAnalysis:fe.current,actionGetCll:me,queryClient:o});if(!n()||!e.isCurrent())return;c=e.cll}catch(e){if(!n())return;if(s&&(fe.current=!1,de(!1),ae(e=>({...e,column_level_lineage:void 0})),i=void 0),e instanceof N){nn.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}let l=k&&c?Bc(y,c):void 0,[u,d,f]=await ps(y,{selectedNodes:e,cll:c,newCllExperience:k,columnAncestry:Vc(k,c,i,l?.columnIds)});n()&&(m(u),_(d),Ne(f),le(c),l&&i?.change_analysis&&!i?.column&&ot(l),oe(u,P.view_mode??`changed_models`,fe.current,!!i?.column,!!Be||!!re))})(),()=>{n()&&Ce.current++}},[y,O?.impact_at_startup,ke]);let ct=()=>{Oe(),Ve(void 0),Ue([])},lt=e=>{y?.nodes[e]&&(Oe(),Be!==e&&(Be&&Be!==e&&Ue(e=>[...e,Be]),Ve(e)))},ut=()=>{if(He.length===0)return;let e=He[He.length-1];y?.nodes[e]&&(Oe(),Ve(e),Ue(e=>e.slice(0,-1)))},dt=e=>{if(e<0||e>=He.length)return;let t=He[e];y?.nodes[t]&&(Oe(),Ve(t),Ue(t=>t.slice(0,e)))},ft=()=>{Be&&pt(Be)},pt=async e=>{let t=p.find(t=>t.id===e);if(t){if(t.parentId){let e=t.parentId;t=p.find(t=>t.id===e)??t}if(t.measured!=null){let{width:e,height:n}=t.measured;if(e&&n){let r=t.position.x+e/2,i=t.position.y+n/2,a=s.getZoom();await s.setCenter(r,i,{zoom:a,duration:200})}}}},mt=Ho();Go(c,async()=>{R!==`selecting`&&(Be?await pt(Be):await s.fitView({nodes:p,duration:200,padding:We,minZoom:Je,maxZoom:1}))});let ht=async(e,t=!1)=>{let n=Oe(),r=P.column_level_lineage,i=Ra({cllInput:e,changeAnalysisMode:ue,newCllExperience:k});i!==ue&&de(i);let a=r!==void 0;return await St({...P,column_level_lineage:e},!1,a,n),we.current===n&&(t||se.push(r),e?.node_id?Ve(e.node_id):e||Ve(void 0),!0)},gt=async e=>{await ht(e)},vt=async e=>{if(e){if(se.length===0)return;let e=se[se.length-1];await ht(e,!0)&&se.pop()}else await ht(za({changeAnalysisMode:ue,newCllExperience:k}),!0)},yt=(e,t)=>{R||gt(Ia(t.data.node.id,t.data.column))},bt=(t,n)=>{if(e&&y){if(be(n)){yt(t,n);return}if(et(),Oe(),!R)Ve(zc(Be,n.id)),Ue([]);else if(R===`action_result`){let e=Xe.actionState.actions[n.id];e.run?.run_id&&te(e.run.run_id),Ve(n.id),Ue([])}else{let e=new Set(Ke);Ke.has(n.id)?e.delete(n.id):e.add(n.id),qe(e),e.size===0&&Ge(void 0)}}},xt=async e=>{let t=++Ce.current,n=()=>Ce.current===t,r=()=>{n()&&(Ce.current++,je())},{viewOptions:i=P}=e,{fitView:c,preservePositions:l=!1}=e,u;if(!y){Se.refreshCll({cllInput:void 0,changeAnalysis:ue,actionGetCll:me,queryClient:o});return}if(P.select!==i.select||P.exclude!==i.exclude||P.packages!==i.packages||P.view_mode!==i.view_mode){try{let e=await C({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode},a);if(!n())return;i={...i,column_level_lineage:void 0},u=e.nodes}catch(e){if(!n())return;e instanceof N&&nn.create({title:`Select node error`,description:e.data?.detail??e.message,type:`error`,closable:!0}),r();return}Ve(void 0)}else u=p.map(e=>e.id);let d;try{let e=await Se.refreshCll({cllInput:i.column_level_lineage,changeAnalysis:ue,actionGetCll:me,queryClient:o});if(!n()||!e.isCurrent())return;d=e.cll}catch(e){if(!n())return;if(e instanceof N){nn.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}if(!i.column_level_lineage){let e=Ra({cllInput:void 0,changeAnalysisMode:ue,newCllExperience:k});e!==ue&&de(e)}let f;(l||k)&&(f=Ze());let h=i.column_level_lineage,g=k&&d?Bc(y,d):void 0,[v,b,x]=await ps(y,{selectedNodes:u,cll:d,existingPositions:f,newCllExperience:k,columnAncestry:Vc(k,d,h,g?.columnIds)});if(n()&&(m(v),_(b),Ne(x),le(d),g&&!h?.column&&ot(g),oe(v,i.view_mode??`changed_models`,ue,!!i.column_level_lineage?.column,!!Be||!!re),vc(re,p)&&ne(),c)){if(await new Promise(e=>setTimeout(e,1)),!n())return;s.fitView({nodes:v,duration:200,padding:We,minZoom:Je,maxZoom:1})}},St=async(e,t=!0,n=!1,r)=>{r===void 0&&Oe(),ae(e),await xt({viewOptions:e,fitView:t,preservePositions:n})};V(()=>{let t=re?.type;if(!e){Te.current=void 0,Ee.current=void 0;return}if(!M){Te.current=void 0,Ee.current=void 0;return}if(!t||[`query_diff`,`query`,`row_count`,`row_count_diff`].includes(t)){Te.current=void 0,Ee.current=void 0;return}if(R){Te.current=void 0,Ee.current=void 0;return}let n=_c(re)?re.params?.model:void 0,r=JSON.stringify([ee??re.run_id,t,n]),i=Te.current!==r,a=Ee.current,o=a?.key===r&&a.interactionGeneration===we.current;if(!i&&!o){Ee.current=void 0;return}let s=a?.interactionGeneration;if(i&&(s=Oe(),Te.current=r,Ee.current=void 0),n){let e=Pe(n);if(!e){i&&s!==void 0&&(Ee.current={key:r,interactionGeneration:s},St({...P,view_mode:`all`},!0,!1,s));return}Ee.current=void 0,ve(e)&&L?.id!==e.id&&(et(),Ve(e.id),Ue([]))}else Ee.current=void 0,Ve(void 0),Ue([])},[re,ee,P,M,R,Pe,L,e]);let Ct=(e,t=1e3)=>{if(R===`action_result`||y===void 0||!y.nodes[e])return;let n=xe(y,[e],t);Oe(),!(R===`selecting`&&Array.from(n).every(e=>Ke.has(e)))&&(R||(Ge(`selecting`),Xe.reset(),P.column_level_lineage&&St({...P,column_level_lineage:void 0})),qe(_e(Ke,n)))},wt=(e,t=1e3)=>{if(R===`action_result`||y===void 0||!y.nodes[e])return;let n=ye(y,[e],t);Oe(),!(R===`selecting`&&Array.from(n).every(e=>Ke.has(e)))&&(R||(Ge(`selecting`),Xe.reset(),P.column_level_lineage&&St({...P,column_level_lineage:void 0})),qe(_e(Ke,n)))},Tt=(t,n)=>{if(!e||R===`action_result`)return;t.preventDefault();let r=f.current,i=r.getBoundingClientRect(),a=t.clientX-i.left,o=t.clientY-i.top+r.offsetTop;$e.showContextMenu(a,o,n)},Et=e=>{if(!R){if(!y?.nodes[e])return;Oe(),qe(new Set([e])),Ge(`selecting`),Ve(void 0),Xe.reset()}else if(R===`selecting`){if(!y?.nodes[e])return;Oe();let t=new Set(Ke);Ke.has(e)?t.delete(e):t.add(e),qe(t),t.size===0&&Ge(void 0)}},Dt=()=>{Oe(),Ge(void 0),qe(new Set),Ve(void 0),ne(),T?.()},Ot={interactive:e,nodes:p,focusedNode:L,selectedNodes:Ye,viewOptions:P,showContextMenu:Tt,onViewOptionsChanged:St,selectMode:R,selectNode:Et,selectParentNodes:Ct,selectChildNodes:wt,deselect:Dt,impactedNodeIds:nt,impactedColumnIds:rt,wholeModelChangedNodeIds:at,wholeModelImpactedNodeIds:it,isNodeHighlighted:e=>Qe.has(e),isNodeSelected:e=>Ke.has(e),isEdgeHighlighted:(e,t)=>ce?e in ce.current.parent_map&&t in ce.current.parent_map[e]:Qe.has(e)&&Qe.has(t),isNodeShowingChangeAnalysis:e=>Ba({nodeId:e,changeAnalysisMode:ue,cllInput:P.column_level_lineage,lineageGraph:y}),changeAnalysisMode:ue,newCllExperience:k,setChangeAnalysisMode:de,getNodeAction:e=>Xe.actionState.actions[e],getNodeColumnSet:e=>e in Me?new Set(Me[e]):new Set,runRowCount:async()=>{R===`selecting`?(await Xe.runRowCount(),An({type:`row_count`,selected:`multi`})):L?(j(`row_count`,{node_names:[L.data.name]},{showForm:!1,showLast:!1}),An({type:`row_count`,selected:`single`})):(j(`row_count`,{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),An({type:`row_count`,selected:`none`}))},runRowCountDiff:async()=>{R===`selecting`?(await Xe.runRowCountDiff(),An({type:`row_count_diff`,selected:`multi`})):L?(j(`row_count_diff`,{node_names:[L.data.name]},{showForm:!1,showLast:!1}),An({type:`row_count_diff`,selected:`single`})):(j(`row_count_diff`,{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),An({type:`row_count_diff`,selected:`none`}))},runValueDiff:async()=>{L?(j(`value_diff`,{model:L.data.name},{showForm:!0,showLast:!1}),An({type:`value_diff`,selected:`single`})):(await Xe.runValueDiff(),An({type:`value_diff`,selected:R===`selecting`?`multi`:`none`}))},addLineageDiffCheck:async()=>{let e=await d(P,a),t;t=R===`selecting`?`multi`:L?`single`:`none`,An({type:`lineage_diff`,selected:t}),e&&(await o.invalidateQueries({queryKey:A.checks()}),mt(e))},addSchemaDiffCheck:async()=>{let e;R===`selecting`?Ye.length>0&&(e=await Xe.addSchemaDiffCheck(),Dt(),An({type:`schema_diff`,selected:`multi`})):L?(e=await b({node_id:L.id},a),An({type:`schema_diff`,selected:`single`})):(e=await b({select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode},a),An({type:`schema_diff`,selected:`none`})),e&&(await o.invalidateQueries({queryKey:A.checks()}),mt(e))},cancel:Xe.cancel,actionState:Xe.actionState,centerNode:pt,cll:ce,showColumnLevelLineage:gt,resetColumnLevelLineage:vt};return S?K(Cc,{}):w?K(wc,{error:w,onRetry:x}):!y||p==Ao?K(G,{}):Ie===`changed_models`&&!y.modifiedSet.length?K(Tc,{viewOptions:P,onViewOptionsChanged:St}):K(he.Provider,{value:Ot,children:q(_t,{sizes:L?[70,30]:[100,0],minSize:0,gutterSize:5,className:L?void 0:`split-gutter-hidden`,style:{height:`100%`,width:`100%`},children:[q(X,{ref:c,divider:K(fr,{sx:{borderColor:`grey.200`}}),spacing:0,sx:{contain:`strict`,position:`relative`},children:[e&&q(G,{children:[K(Rc,{}),E.mode===`metadata only`&&K(bc,{})]}),q(Xr,{proOptions:{hideAttribution:!0},nodeTypes:Oo,edgeTypes:ko,nodes:p,edges:g,onNodesChange:h,onEdgesChange:v,onNodeClick:bt,onNodeContextMenu:Tt,onClick:et,onInit:async()=>{if(Fe){let e=p.filter(e=>ve(e)&&e.data.changeStatus!==void 0),t=e.length>0?e:p;await s.fitView({nodes:t,duration:200,padding:We,minZoom:Je,maxZoom:1})}else{let e=$r(p,{});await s.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:ze,nodesDraggable:e,ref:f,colorMode:i?`dark`:`light`,children:[K(Hr,{id:`lineage-bg`,variant:Ur.Dots,color:i?De.neutral[700]:De.neutral[300],gap:20,size:2}),K(Kr,{showInteractive:!1,position:`top-right`,className:Vt,style:{backgroundColor:i?De.neutral[700]:void 0,borderColor:i?De.neutral[600]:void 0},children:K(Gr,{title:`copy image`,onClick:async()=>{await l(),bn({type:Ie,from:`lineage_view`})},style:{backgroundColor:i?De.neutral[700]:void 0,color:i?De.neutral[200]:void 0},children:K(J,{component:Ui})})}),K(u,{}),K(Jr,{position:`bottom-left`,children:q(X,{spacing:`5px`,children:[Fe&&K(Pt,{variant:`changeStatus`,newCllExperience:k}),P.column_level_lineage&&K(Pt,{variant:`transformation`})]})}),K(Jr,{position:`top-center`,children:K($o,{notification:D?K(Sc,{}):null,type:`info`})}),K(Jr,{position:`top-left`,children:q(X,{spacing:`5px`,children:[K(Wa,{action:me}),p.length==0&&K(Z,{sx:{fontSize:`1.25rem`,color:`grey`,opacity:.5},children:`No nodes`})]})}),p.length<=500&&K(qr,{nodeColor:st,nodeStrokeWidth:3,zoomable:!0,pannable:!0,bgColor:i?De.neutral[800]:void 0,maskColor:i?`${De.neutral[900]}99`:`${De.neutral[100]}99`}),R===`action_result`&&K(Jr,{position:`bottom-center`,className:`ignore-screenshot`,children:K(Ua,{onClose:()=>{Dt()}})})]}),K(ds,{...$e.props})]}),L?K(J,{sx:{borderLeft:`solid 1px`,borderColor:`divider`,height:`100%`},children:K(gc,{node:L,onCloseNode:ct,onNavigateToNode:lt,onBack:He.length>0?ut:void 0,onCenterFocused:ft,historyTrail:He,onJumpToHistory:dt})}):K(J,{})]})})}const Uc=Kn(Hc);function Wc(){return K(Zr,{children:K(Uc,{interactive:!0})})}const Gc=Kn(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=U(null),m=F(),h=n??m.lineageGraph,g=!n&&m.isLoading,_=n?void 0:m.error,{nodes:v,edges:y}=H(()=>{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=xe(h,e),n=ye(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]=de(h,e);return l&&t.length>0&&Kc(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=B(async()=>{if(p.current)try{let e=await sa.toBlob(p.current,{backgroundColor:`#ffffff`,dpr:1,scale:2,type:`png`});await navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(e){throw console.error(`Failed to copy to clipboard:`,e),e}},[]);return Yn(t,()=>({copyToClipboard:b}),[b]),g?K(J,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(pr,{})}):_?K(J,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{color:`error`,children:_})}):h?v.length===0?K(J,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{sx:{color:`text.secondary`},children:`No nodes match the current filter criteria.`})}):K(J,{ref:p,sx:{width:`100%`,height:a},children:K(Yo,{nodes:v,edges:y,onNodeSelect:s,onNodeDoubleClick:c,showMiniMap:u,showControls:d,showBackground:f,height:`100%`,interactive:i})}):K(J,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{sx:{color:`text.secondary`},children:`No lineage data available. Provide data via LineageGraphProvider or lineageGraph prop.`})})});function Kc(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 qc({variant:e=`banner`,dismissible:t=!1,sessionId:n,toastAdapter:r,successToastOnlyOnUserRefresh:a=!1,requireCloudMode:o=!0,messageVariant:s=`data`,showFirstTimePopover:c=!0,cardSx:l}={}){let{cloudMode:u}=F(),{apiClient:d}=I(),p=r??Xc,[m,h]=W(!1),g=U(null),[_,v]=W(null),y=U(!1),{data:b}=it({select:e=>e.session_staleness}),x=U(null),S=b!=null&&f(b),C=t&&n?`recce-staleness-banner-dismissed-signature::${n}`:null,[w,T]=W(()=>Yc(C));if(V(()=>{T(Yc(C))},[C]),V(()=>{},[t,n]),V(()=>{},[o,r]),V(()=>{let e=x.current===!0&&!S,t=!a||y.current;e&&t&&(p.success(`Base refreshed. If you've saved checks in this session, you may want to re-run them against the new base.`,{duration:8e3}),h(!1),g.current&&=(clearTimeout(g.current),null),y.current=!1),x.current=S},[S,a,p]),V(()=>()=>{g.current&&clearTimeout(g.current)},[]),o&&!u||!b||!S)return null;let E=Jc(b);if(t&&w===E)return null;let D=b.current_base_session_id===null,O=s===`metadata`?`Production metadata has changed since this PR's base was captured. Comparisons may not reflect current state.`:`Production data has changed since this PR's base was captured. Comparisons may not reflect current state.`,k=async()=>{y.current=!0,h(!0),g.current=setTimeout(()=>{h(!1),p.error(`Refresh failed — try again.`,{duration:5e3}),g.current=null,y.current=!1},3e4);try{await i(d)}catch{if(!g.current)return;clearTimeout(g.current),g.current=null,h(!1),y.current=!1,p.error(`Refresh failed — try again.`,{duration:5e3})}},ee=()=>{if(g.current&&=(clearTimeout(g.current),null),h(!1),y.current=!1,C)try{sessionStorage.setItem(C,E)}catch{}T(E)},te=D?`This PR's base snapshot may be out of date, and no shared base is currently configured for this project. Comparisons may not reflect current state.`:O,ne=K($,{title:D?`No shared base configured for this project.`:``,disableHoverListener:!D,children:K(`span`,{children:K(Y,{size:`small`,variant:`outlined`,onClick:()=>void k(),disabled:m||D,startIcon:m?K(pr,{size:12}):void 0,sx:{whiteSpace:`nowrap`},children:m?`Refreshing…`:`Refresh base`})})}),A=t?K(Q,{"aria-label":`Dismiss`,size:`small`,onClick:ee,sx:{flex:`0 0 auto`},children:K(lr,{})}):null,j=c?K(Bo,{anchorEl:_}):null;return e===`card`?q(ca,{ref:v,role:`status`,elevation:4,sx:[{position:`fixed`,left:`50%`,transform:`translateX(-50%)`,zIndex:e=>e.zIndex.drawer+1,maxWidth:760,minWidth:480,bgcolor:`warning.light`,border:1,borderColor:`warning.main`,borderRadius:1,px:1.5,py:1},...Array.isArray(l)?l:[l]],children:[q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{component:Ii,sx:{flex:`0 0 auto`},size:18}),K(Z,{variant:`body2`,sx:{flex:1},children:te}),ne,A]}),j]}):q(J,{ref:v,role:`status`,sx:{bgcolor:`warning.light`,borderBottom:1,borderColor:`warning.main`,px:2,py:.75},children:[q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(Ii,{color:`inherit`,size:16}),K(Z,{variant:`body2`,sx:{flex:1},children:te}),ne,A]}),j]})}function Jc(e){return`${e.source_session_id}|${e.source_session_updated_at}|${e.current_base_session_id}|${e.current_base_updated_at}`}function Yc(e){if(!e||typeof window>`u`)return null;try{return sessionStorage.getItem(e)}catch{return null}}const Xc={success:(e,t)=>{nn.success({description:e,duration:t?.duration??5e3,closable:!0})},error:(e,t)=>{nn.error({description:e,duration:t?.duration??5e3,closable:!0})}},Zc=j({baseURL:pn??``});async function Qc(e=Zc){return(await e.post(`/api/connect`)).data}function $c({handleParentClose:e,parentOpen:t=!1,ignoreCookie:n=!1,variant:r=`auth`}){let{authed:i}=ie(),{apiClient:a}=I(),[o,s]=W(t||!i),c=nr.get(`authState`)??`pending`,[l,u]=W(n?`pending`:c);if(l===`ignored`&&!n||i)return null;let d={auth:{title:`Configure Cloud Token`,action:`Get token and configure`},"enable-share":{title:`Enable Sharing with Cloud`,action:`Enable sharing`},"user-profile":{title:`Configure Cloud Token`,action:`Get token and configure`}}[r],f=()=>{s(!1),e&&e(!1)};return q(Zn,{open:o,onClose:f,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[l!==`authenticating`&&K(er,{sx:{textAlign:`center`,fontSize:`1.5rem`},children:d.title}),l===`authenticating`?q(G,{children:[K($n,{className:`space-y-2 self-center font-light`,children:q(X,{spacing:2,sx:{alignItems:`center`,pt:`1rem`},children:[K(J,{component:`img`,sx:{height:`6rem`,objectFit:`contain`,mx:`auto`,mb:1},src:`/imgs/reload-image.svg`,alt:`Reload`}),K(Z,{sx:{fontSize:`1.5rem`,fontWeight:500},children:`Reload to Finish`}),K(Z,{children:`Reload to complete connection to Recce Cloud`})]})}),K(Qn,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,color:`brand`,variant:`contained`,onClick:()=>{window.location.reload()},children:`Reload`})})]}):q(G,{children:[q($n,{className:`space-y-2 font-light`,children:[K(Z,{children:`To enable sharing, get your token from Recce Cloud and launch your local instance with it.`}),q(`ul`,{className:`list-inside list-disc`,children:[K(`li`,{children:`Share your instance with teammates via Recce Cloud.`}),K(`li`,{children:`Your instance will be securely and freely hosted for sharing.`}),r===`auth`&&K(`li`,{children:`This step is recommended but optional.`})]}),q(J,{sx:{display:`flex`,gap:1},children:[`More directions`,q(tr,{underline:`always`,sx:{color:`primary.main`,"&:focus":{outline:`none`}},href:new URL(`/connect-to-cloud`,mn).href,target:`_blank`,children:[`here `,K(rr,{style:{display:`inline`}})]})]})]}),q(Qn,{sx:{flexDirection:`column`,gap:1,px:3,pb:3},children:[q(Y,{fullWidth:!0,color:`brand`,variant:`contained`,sx:{borderRadius:2,fontWeight:500},onClick:async()=>{u(`authenticating`);let{connection_url:e}=await Qc(a);window.open(e,`_blank`)},children:[d.action,` `,K(rr,{style:{marginLeft:4}})]}),K(Y,{fullWidth:!0,color:`neutral`,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500},onClick:f,children:r===`auth`?`Skip`:`Cancel`}),r===`auth`&&K(Y,{fullWidth:!0,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500,color:`text.primary`},onClick:()=>{nr.set(`authState`,`ignored`,{expires:30}),u(`ignored`),f()},children:`Snooze for 30 days`})]})]})]})}function el(){let{apiClient:e}=I(),{data:t,isLoading:n,error:r}=Hn({queryKey:A.user(),queryFn:()=>fn(e),retry:!1}),{data:i}=Hn({queryKey:[`github-avatar`,t?.id],queryFn:()=>t?dn(t.id):Promise.resolve(null),enabled:!!t?.id&&t.login_type===`github`,retry:!1,staleTime:3e5}),[a,o]=W(null),s=!!a,c=e=>{o(e.currentTarget)},l=()=>{o(null)},u=!n&&!r&&t;return q(G,{children:[n?K(J,{onClick:c,sx:{width:32,height:32,borderRadius:`50%`,bgcolor:`background.paper`,color:`primary.main`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:K(pr,{size:16})}):K(Di,{onClick:c,src:i||void 0,sx:{width:28,height:28,cursor:`pointer`,outline:`1px solid white`,fontSize:`0.875rem`},children:(e=>e?e.charAt(0).toUpperCase():`U`)(t?.login)}),q(li,{anchorEl:a,open:s,onClose:l,slotProps:{paper:{sx:{bgcolor:`background.paper`,borderColor:`divider`,boxShadow:3,minWidth:180}}},children:[q(J,{sx:{px:2,py:1.5},children:[n&&q(J,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[K(Z,{variant:`body2`,sx:{color:`text.primary`},children:`Loading...`}),K(pr,{size:16})]}),r&&K(Z,{variant:`caption`,color:`error`,children:`Failed to load user information`}),u&&q(G,{children:[K(Z,{variant:`body2`,sx:{fontWeight:`600`,color:`text.primary`},children:t.login}),t.email&&K(Z,{variant:`caption`,sx:{color:`text.secondary`},children:t.email})]})]}),K(fr,{}),q(ui,{onClick:()=>{window.open(mn,`_blank`),l()},children:[K(Bi,{children:K(mr,{})}),K(Vi,{children:`Recce Cloud`})]}),q(ui,{onClick:()=>{window.open(hn,`_blank`),l()},children:[K(Bi,{children:K(br,{})}),K(Vi,{children:`Get live support`})]})]})]})}const tl=()=>{let{setTheme:e,resolvedTheme:t}=or(),[n,r]=W(!1);V(()=>{r(!0)},[]);let i=()=>{e(t===`dark`?`light`:`dark`)};if(!n)return K(Q,{size:`small`,sx:{color:`rgba(255, 255, 255, 0.8)`,"&:hover":{bgcolor:`rgba(255, 255, 255, 0.1)`}},disabled:!0,children:K(Ir,{style:{width:18,height:18}})});let a=t===`dark`;return K($,{title:a?`Switch to light mode`:`Switch to dark mode`,children:K(Q,{size:`small`,onClick:i,sx:{color:`rgba(255, 255, 255, 0.8)`,"&:hover":{bgcolor:`rgba(255, 255, 255, 0.1)`}},"aria-label":a?`Switch to light mode`:`Switch to dark mode`,children:K(a?Ir:Ar,{style:{width:18,height:18}})})})};function nl(e,t,n,r){let i=e?.git,a=e?.pullRequest,o=e?.dbt?.base,s=e?.dbt?.current,c={review_mode:t||!1,adapter_type:e?.adapterType||null,has_git_info:!di(i),has_pr_info:!di(a)};return e?.adapterType===`dbt`&&(c.base={schema_count:n.size,dbt_version:o?.dbt_version||null,timestamp:o?.generated_at||null},c.current={schema_count:r.size,dbt_version:s?.dbt_version||null,timestamp:s?.generated_at||null},c.schemas_match=n.size===r.size&&Array.from(n).every(e=>r.has(e))),e?.adapterType===`sqlmesh`&&(c.base={has_env:!!e.sqlmesh?.base_env},c.current={has_env:!!e.sqlmesh?.current_env}),c}function rl(e){return Object.values(e).every(e=>e===null)?[K(J,{sx:{ml:`10px`},children:`No information`},`no info`)]:Object.entries(e).filter(([e,t])=>e!==`url`&&t!=null).map(([e,t])=>q(`li`,{style:{marginLeft:`10px`},children:[e,`: `,t]},e))}function il(){let{envInfo:e,reviewMode:t,lineageGraph:n}=F(),[r,i]=W(!1),a=e?.git,o=e?.pullRequest,s={...a,...o},c=e?.dbt?.base,l=e?.dbt?.current,u=c?.generated_at?cn(c.generated_at):``,d=l?.generated_at?cn(l.generated_at):``,f=``,p=``;c&&(f=c.generated_at?an(c.generated_at):``),l&&(p=l.generated_at?an(l.generated_at):``);let[m,h]=rn(n),g=U(!1);V(()=>{if(!g.current&&e){g.current=!0;let n=nl(e,t,m,h);wn(n)}},[e,t,m,h]);let _=()=>i(!0),v=()=>i(!1);return q(G,{children:[K($,{title:`Environment Info`,placement:`bottom-end`,children:q(J,{sx:{display:`flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:_,children:[q(X,{direction:`column`,sx:{display:{xs:`none`,lg:`flex`},fontSize:`0.875rem`},children:[q(J,{sx:{display:`flex`,alignItems:`baseline`,gap:.5},children:[K(Z,{component:`span`,noWrap:!0,sx:{color:`warning.main`,maxWidth:128},className:`no-track-pii-safe`,children:Array.from(m).join(`, `)}),q(Z,{component:`span`,noWrap:!0,children:[`(`,f,`)`]})]}),q(J,{sx:{display:`flex`,alignItems:`baseline`,gap:.5},children:[K(Z,{component:`span`,noWrap:!0,sx:{color:`primary.main`,maxWidth:128},className:`no-track-pii-safe`,children:Array.from(h).join(`, `)}),q(Z,{component:`span`,noWrap:!0,children:[`(`,p,`)`]})]})]}),K(Q,{size:`small`,"aria-label":`Environment Info`,children:K(J,{component:Or,sx:{fontSize:16,verticalAlign:`middle`}})})]})}),q(Zn,{open:r,onClose:v,maxWidth:`sm`,fullWidth:!0,children:[q(er,{sx:{display:`flex`,alignItems:`center`},children:[`Environment Information`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:v,children:K(lr,{})})]}),K($n,{children:q(X,{direction:`column`,spacing:1,children:[t?q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`Review Information`}),q(`ul`,{style:{margin:0,paddingLeft:`20px`},children:[s.url&&q(`li`,{style:{marginLeft:`10px`},children:[`url:`,` `,q(tr,{href:s.url,target:`_blank`,sx:{color:`primary.main`},children:[s.url,` `,K(rr,{})]})]}),!di(s)&&rl(s)]})]}):q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`Dev Information`}),K(`ul`,{style:{margin:0,paddingLeft:`20px`},children:a&&rl(a)})]}),K(fr,{}),e?.adapterType===`dbt`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`DBT`}),K(fa,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(la,{size:`small`,stickyHeader:!0,children:[K(pa,{children:q(ma,{children:[K(da,{}),K(da,{children:`base`}),K(da,{children:`current`})]})}),q(ua,{children:[q(ma,{children:[K(da,{children:`schema`}),K(da,{className:`no-track-pii-safe`,children:Array.from(m).map(e=>K($,{title:e,placement:`bottom`,children:K(`div`,{className:`max-w-72 truncate`,children:e})},e))}),K(da,{className:`no-track-pii-safe`,children:Array.from(h).map(e=>K($,{title:e,placement:`bottom`,children:K(`div`,{className:`max-w-72 truncate`,children:e})},e))})]}),q(ma,{children:[K(da,{children:`version`}),K(da,{children:c?.dbt_version}),K(da,{children:l?.dbt_version})]}),q(ma,{children:[K(da,{children:`timestamp`}),K(da,{children:u}),K(da,{children:d})]})]})]})})]}),e?.adapterType===`sqlmesh`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`SQLMesh`}),K(fa,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(la,{stickyHeader:!0,children:[K(pa,{children:q(ma,{children:[K(da,{}),K(da,{children:`base`}),K(da,{children:`current`})]})}),K(ua,{children:q(ma,{children:[K(da,{children:`Environment`}),K(da,{className:`no-track-pii-safe`,children:e.sqlmesh?.base_env}),K(da,{className:`no-track-pii-safe`,children:e.sqlmesh?.current_env})]})})]})})]})]})}),K(Qn,{children:K(Y,{color:`iochmara`,onClick:v,children:`Close`})})]})]})}const al=()=>({toastSuccess:e=>{nn.create({description:e,type:`success`,duration:5e3,closable:!0})},toastError:(e,t)=>{let n=e;t!=null&&(n=M(t)?`${e}. ${String(t.data?.detail)}`:`${e}. ${t}`),nn.create({description:n,type:`error`,duration:5e3,closable:!0})}}),ol=e=>{V(()=>{let t=e=>{e.preventDefault()};return e&&window.addEventListener(`beforeunload`,t),()=>{e&&window.removeEventListener(`beforeunload`,t)}},[e])},sl=()=>{let{featureToggles:e}=ie(),{fileName:t,cloudMode:n,isDemoSite:r,envInfo:i}=F(),{apiClient:a}=I(),[s,c]=W(!1),[l,u]=W(!1),d=!t&&!n&&!r,{data:f}=o(d),p=f!=null&&f.filter(e=>!e.is_preset).length>0;ol(d&&p);let[{newFileName:m,errorMessage:h,modified:_,overwriteWithMethod:y,bypass:b},x]=W({newFileName:t??`recce_state.json`,bypass:!1}),S=U(null),{toastSuccess:C,toastError:w}=al(),T=Un(),E=()=>{x({newFileName:t??`recce_state.json`,modified:!t,bypass:!1}),c(!0)},D=()=>c(!1),O=()=>u(!1),k=async(e,t)=>{if(!m)return;let n=localStorage.getItem(g.bypassSaveOverwrite)===`true`;try{e===`save`?await v({filename:m,overwrite:t??n},a):await te({filename:m,overwrite:t??n},a),C(e===`save`?`Save file successfully`:`Rename file successfully`),await T.invalidateQueries({queryKey:A.lineage()}),b&&localStorage.setItem(g.bypassSaveOverwrite,`true`)}catch(t){if(M(t)&&t.status===409){x(t=>({...t,overwriteWithMethod:e})),u(!0);return}w(e===`save`?`Save file failed`:`Rename file failed`,t)}finally{D()}},ee=()=>{O(),c(!0),x(e=>({...e,overwriteWithMethod:void 0}))};if(n||r)return K(G,{});let ne=`New Instance`+(p?` (unsaved)`:``),j;if(e.disableSaveToFile&&t){let e=i?.stateMetadata?.generated_at,n=e?Dt(new Date(e)):null;j=n?`${t} (${n})`:null}return q(G,{children:[q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`center`},children:[K(J,{sx:{fontWeight:600},children:j??t??ne}),!e.disableSaveToFile&&K($,{title:t?`Change Filename`:`Save`,enterDelay:1e3,children:K(Q,{onClick:E,"aria-label":t?`Change Filename`:`Save`,size:`small`,children:K(J,{component:t?Mr:ir,sx:{fontSize:16,verticalAlign:`middle`}})})})]}),q(Zn,{open:s,onClose:D,children:[q(er,{sx:{display:`flex`,alignItems:`center`},children:[t?`Change Filename`:`Save File`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:D,children:K(lr,{})})]}),K($n,{onKeyDown:e=>{e.stopPropagation()},children:K(bi,{inputRef:S,value:m,label:`File name`,placeholder:`Enter filename`,error:!!h,helperText:h,fullWidth:!0,size:`small`,sx:{mt:1},onChange:e=>{let n=e.target.value,r;n?n.endsWith(`.json`)?/^[a-zA-Z0-9 _-]+\.json$/.test(n)?t&&n===t&&(r=`Filename is the same as the current one.`):r=`Invalid filename. Only alphanumeric, space, _ and - are allowed.`:r=`Filename must end with .json.`:r=`Filename cannot be empty.`,x(e=>({...e,modified:!0,newFileName:n,errorMessage:r}))},onKeyDown:e=>{if(e.key===`Enter`){if(h)return;k(t?`rename`:`save`)}else e.key===`Escape`&&D()}})}),q(Qn,{sx:{gap:`5px`},children:[K(Y,{size:`small`,color:t?`inherit`:`iochmara`,variant:`contained`,onClick:async()=>{await k(`save`)},disabled:!m||!!h||!_,children:t?`Save as New File`:`Confirm`}),t&&K(Y,{size:`small`,color:`iochmara`,variant:`contained`,onClick:async()=>{await k(`rename`)},disabled:!m||!!h||!_,children:`Rename`})]})]}),q(Zn,{open:l,onClose:O,children:[q(er,{sx:{display:`flex`,alignItems:`center`},children:[`Overwrite File?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:O,children:K(lr,{})})]}),q($n,{sx:{borderTop:`solid 1px`,borderBottom:`solid 1px`,borderColor:`divider`},onKeyDown:e=>{e.stopPropagation()},children:[K(Z,{sx:{fontSize:`12pt`},children:y===`save`?`Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?`:`Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?`}),K(oi,{control:K(ai,{size:`small`,checked:b,onChange:e=>{x(t=>({...t,bypass:e.target.checked}))}}),label:K(Z,{sx:{fontWeight:`bold`,pt:`8px`},children:`Don't show this again`})})]}),q(Qn,{sx:{gap:`5px`},children:[K(Y,{variant:`outlined`,onClick:ee,size:`small`,children:`Back`}),K(Y,{size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{y&&(k(y,!0),O())},children:`Overwrite`})]})]})]})};async function cl(e){return(await e.get(`/api/cloud/organizations`)).data.organizations}async function ll(e,t){return(await e.get(`/api/cloud/organizations/${t}/projects`)).data.projects}async function ul(e,t,n){return(await e.get(`/api/cloud/organizations/${t}/projects/${n}/base-status`)).data}async function dl(e,t){return(await e.post(`/api/cloud/upload`,t)).data}async function fl(e){return(await e.get(`/api/connection-info`)).data.connection_info}async function pl(e,t){return(await e.post(`/api/cloud/warehouse-setup`,t)).data}const ml={snowflake:{type:`snowflake`,label:`Snowflake`,commonFields:[{name:`account`,label:`Account`,type:`text`,isCredential:!1,required:!0},{name:`user`,label:`User`,type:`text`,isCredential:!1,required:!0},{name:`warehouse`,label:`Warehouse`,type:`text`,isCredential:!1,required:!0},{name:`database`,label:`Database`,type:`text`,isCredential:!1,required:!0},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`user-password`,label:`User & Password`,fields:[{name:`password`,label:`Password`,type:`password`,isCredential:!0,required:!0}]},{value:`key-pair`,label:`Key Pair`,fields:[{name:`private_key`,label:`Private Key`,type:`textarea`,isCredential:!0,required:!0,placeholder:`Paste PEM-encoded private key`},{name:`private_key_passphrase`,label:`Private Key Passphrase`,type:`password`,isCredential:!0,required:!1}]}]},databricks:{type:`databricks`,label:`Databricks`,commonFields:[{name:`host`,label:`Host`,type:`text`,isCredential:!1,required:!0},{name:`http_path`,label:`HTTP Path`,type:`text`,isCredential:!1,required:!0},{name:`catalog`,label:`Catalog`,type:`text`,isCredential:!1,required:!1,prefillFrom:`database`},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`token`,label:`Token`,fields:[{name:`token`,label:`Access Token`,type:`password`,isCredential:!0,required:!0}]},{value:`oauth`,label:`OAuth (M2M)`,fields:[{name:`client_id`,label:`Client ID`,type:`text`,isCredential:!0,required:!0},{name:`client_secret`,label:`Client Secret`,type:`password`,isCredential:!0,required:!0}]}]},bigquery:{type:`bigquery`,label:`BigQuery`,commonFields:[{name:`project`,label:`Project`,type:`text`,isCredential:!1,required:!0,prefillFrom:`database`},{name:`dataset`,label:`Dataset`,type:`text`,isCredential:!1,required:!0,prefillFrom:`schema`}],authMethods:[{value:`service-account-json`,label:`Service Account JSON`,fields:[{name:`keyfile_json`,label:`Service Account Key (JSON)`,type:`textarea`,isCredential:!0,required:!0,placeholder:`Paste service account JSON`}]}]},redshift:{type:`redshift`,label:`Redshift`,commonFields:[{name:`host`,label:`Host`,type:`text`,isCredential:!1,required:!0},{name:`user`,label:`User`,type:`text`,isCredential:!1,required:!0},{name:`port`,label:`Port`,type:`number`,isCredential:!1,required:!0},{name:`dbname`,label:`Database`,type:`text`,isCredential:!1,required:!0,prefillFrom:`database`},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`password`,label:`Password`,fields:[{name:`password`,label:`Password`,type:`password`,isCredential:!0,required:!0}]}]}};function hl(e){return e in ml}function gl(e){return ml[e]?.authMethods[0]?.value??``}function _l(e,t){let n=ml[e];if(!n)return[];let r=n.authMethods.find(e=>e.value===t);return[...n.commonFields,...r?.fields??[]]}function vl(e,t){let n=ml[e];if(!n)return{};let r={};for(let e of n.commonFields){if(e.isCredential)continue;let n=t[e.prefillFrom??e.name];n!=null&&(r[e.name]=String(n))}return r}function yl({open:e,onClose:t}){let{apiClient:n}=I(),[r,i]=W(`select`),[a,o]=W([]),[s,c]=W([]),[l,u]=W(``),[d,f]=W(``),[p,m]=W(``),[h,g]=W(!1),[_,v]=W(!1),[y,b]=W(``),[x,S]=W(!1),[C,w]=W(``),[T,E]=W(null),[D,O]=W({}),[k,ee]=W(``),[te,ne]=W(null);V(()=>{e&&(i(`select`),m(`dev-${new Date().toISOString().slice(0,16).replace(`T`,`-`).replace(`:`,``)}`),g(!0),cl(n).then(e=>{o(e),e.length===1&&u(String(e[0].id))}).catch(()=>o([])).finally(()=>g(!1)))},[e,n]),V(()=>{if(!l){c([]),f(``);return}v(!0),f(``),ll(n,l).then(e=>{c(e),e.length===1&&f(String(e[0].id))}).catch(()=>c([])).finally(()=>v(!1))},[l,n]),V(()=>{if(!l||!d){S(!1);return}ul(n,l,d).then(e=>S(e.base_needs_upload)).catch(()=>S(!1))},[l,d,n]);let A=async()=>{if(!(!l||!d||!p.trim())){vn(),i(`uploading`);try{let e=await dl(n,{org_id:l,project_id:d,session_name:p.trim()});if(e.status===`success`&&e.session_url){ne({sessionUrl:e.session_url,baseUploaded:x});let t=re?.warehouse_connection?null:await fl(n);t&&hl(t.type)?(E(t),O(vl(t.type,t)),ee(gl(t.type)),Sn(),i(`dw_setup`)):(b(e.session_url),i(`success`),Pn(),window.open(e.session_url,`_blank`))}else w(e.message||`Upload failed`),i(`error`)}catch(e){w(e instanceof Error?e.message:`An error occurred during upload`),i(`error`)}}},j=async()=>{if(!T||!te)return;let e=_l(T.type,k),t=[];for(let n of e){let e=D[n.name]?.trim();if(n.required&&!e)t.push(`${n.label} is required`);else if(n.type===`number`&&e){let r=Number(e);Number.isFinite(r)||t.push(`${n.label} must be a valid number`)}}if(t.length>0){w(t.join(`. `)),i(`dw_error`);return}i(`dw_saving`);try{let t={type:T.type};T.type===`databricks`&&k===`oauth`&&(t.auth_type=`oauth`),T.type===`bigquery`&&(t.method=`service-account-json`);for(let n of e){let e=D[n.name];e&&(t[n.name]=n.type===`number`?Number(e):e)}await pl(n,{org_id:l,project_id:d,connection_name:`${re?.display_name||re?.name||`Project`} DW`,config:t}),xn(),b(te.sessionUrl),i(`success`),Pn(),window.open(te.sessionUrl,`_blank`)}catch(e){w(e instanceof Error?e.message:`Failed to set up warehouse connection`),i(`dw_error`)}},M=()=>{te&&(Cn(),b(te.sessionUrl),i(`success`),Pn(),window.open(te.sessionUrl,`_blank`))},N=a.find(e=>String(e.id)===l),re=s.find(e=>String(e.id)===d),P=N&&re?`${mn}/${N.name}/${re.name}`:void 0,ie=l&&d&&p.trim()&&!h;return q(Zn,{open:e,onClose:r===`uploading`||r===`dw_saving`?void 0:t,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[r===`select`&&q(G,{children:[K(er,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Upload to Recce Cloud`}),K($n,{children:q(X,{spacing:2,sx:{pt:.5},children:[K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:`Upload your local artifacts to Recce Cloud so your team can review and query the data.`}),q(_i,{fullWidth:!0,size:`small`,children:[K(ha,{children:`Organization`}),K(ga,{value:l,label:`Organization`,onChange:e=>u(e.target.value),disabled:h,children:a.map(e=>K(ui,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),q(_i,{fullWidth:!0,size:`small`,children:[K(ha,{children:`Project`}),K(ga,{value:d,label:`Project`,onChange:e=>f(e.target.value),disabled:!l||_,children:s.map(e=>K(ui,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),K(bi,{fullWidth:!0,size:`small`,label:`Session Name`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., my-feature-review`}),x&&K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:`Base artifacts will also be uploaded to set up the project's base environment for diffing.`})]})}),K(Qn,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:A,disabled:!ie,sx:{borderRadius:2,fontWeight:500},children:`Upload`})})]}),r===`uploading`&&K($n,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(pr,{size:36}),K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Uploading artifacts...`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:x?`Uploading base and current artifacts. This may take a moment.`:`This may take a moment.`})]})}),r===`dw_setup`&&T&&(()=>{let e=ml[T.type];if(!e)return null;let t=e.authMethods.length>1,n=e.authMethods.find(e=>e.value===k);return q(G,{children:[K(er,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Set Up Data Warehouse`}),K($n,{children:q(X,{spacing:2,sx:{pt:.5},children:[q(Z,{variant:`body2`,sx:{color:`text.secondary`},children:[`Connect your `,e.label,` warehouse so Recce Cloud can query your data. You can skip this and set it up later.`]}),e.commonFields.map(e=>K(bi,{fullWidth:!0,size:`small`,label:e.label,type:e.type===`textarea`?`text`:e.type,multiline:e.type===`textarea`,minRows:e.type===`textarea`?3:void 0,required:e.required,placeholder:e.placeholder,value:D[e.name]??``,onChange:t=>O(n=>({...n,[e.name]:t.target.value}))},e.name)),t&&q(_i,{fullWidth:!0,size:`small`,children:[K(ha,{children:`Authentication`}),K(ga,{value:k,label:`Authentication`,onChange:t=>{ee(t.target.value),O(t=>{let n={...t};for(let t of e.authMethods)for(let e of t.fields)delete n[e.name];return n})},children:e.authMethods.map(e=>K(ui,{value:e.value,children:e.label},e.value))})]}),n?.fields.map(e=>K(bi,{fullWidth:!0,size:`small`,label:e.label,type:e.type===`textarea`?`text`:e.type,multiline:e.type===`textarea`,minRows:e.type===`textarea`?3:void 0,required:e.required,placeholder:e.placeholder,value:D[e.name]??``,onChange:t=>O(n=>({...n,[e.name]:t.target.value}))},e.name))]})}),q(Qn,{sx:{px:3,pb:3,gap:1},children:[K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:M,sx:{borderRadius:2,fontWeight:500},children:`Skip`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:j,sx:{borderRadius:2,fontWeight:500},children:`Setup & Continue`})]})]})})(),r===`dw_saving`&&K($n,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(pr,{size:36}),K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Setting up warehouse connection...`})]})}),r===`success`&&q($n,{sx:{position:`relative`},children:[K(Q,{size:`small`,onClick:t,sx:{position:`absolute`,top:8,right:8},"aria-label":`Close`,children:K(Br,{})}),q(X,{spacing:1.5,sx:{alignItems:`center`,pt:2,pb:1},children:[K(J,{component:wr,sx:{fontSize:36,color:`success.main`}}),K(Z,{sx:{fontWeight:600,fontSize:`1rem`},children:`Upload Complete`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:`Your artifacts have been uploaded to Recce Cloud.`}),K(Y,{variant:`contained`,color:`primary`,href:y,target:`_blank`,component:`a`,sx:{borderRadius:2,textTransform:`none`,fontWeight:600,mt:1},children:`Open in Recce Cloud`}),P&&q(tr,{href:P,target:`_blank`,sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.8125rem`,mt:1},children:[`Go to project page `,K(rr,{size:12})]})]})]}),r===`dw_error`&&q(G,{children:[K($n,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:2},children:[K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Warehouse Setup Failed`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:C})]})}),q(Qn,{sx:{px:3,pb:2,gap:1},children:[K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:M,sx:{borderRadius:2,fontWeight:500},children:`Skip`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:()=>i(`dw_setup`),sx:{borderRadius:2,fontWeight:500},children:`Retry Setup`})]})]}),r===`error`&&q(G,{children:[K($n,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:2},children:[K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Upload Failed`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:C})]})}),K(Qn,{sx:{px:3,pb:2},children:K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:()=>i(`select`),sx:{borderRadius:2,fontWeight:500},children:`Try Again`})})]})]})}function bl(){let{authed:e}=ie(),{apiClient:t}=I(),[n,r]=W(null),[i,a]=W(`signup`),[o,s]=W(!1),c=U(!1),l=B(async()=>{if(c.current)try{await fn(t),c.current=!1,Fn(),a(`reload`)}catch{}},[t]);if(V(()=>{let e=()=>{document.visibilityState===`visible`&&l()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[l]),e)return q(G,{children:[K(Y,{variant:`contained`,color:`primary`,size:`small`,startIcon:K(zr,{}),onClick:()=>{Mn({authed:!0}),s(!0)},sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(yl,{open:o,onClose:()=>s(!1)})]});let u=e=>{Mn({authed:!1}),a(`signup`),c.current=!1,r(e.currentTarget)},d=()=>{r(null),c.current=!1},f=async()=>{In();let e=window.open(``,`_blank`);try{let{connection_url:n}=await Qc(t);e&&!e.closed?e.location.href=n:window.open(n,`_blank`),c.current=!0,a(`waiting`)}catch{e?.close(),a(`error`)}};return q(G,{children:[K(Y,{variant:`contained`,color:`primary`,size:`small`,startIcon:K(zr,{}),onClick:u,sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(Oi,{open:!!n,anchorEl:n,onClose:d,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},slotProps:{paper:{sx:{borderRadius:`12px`,p:3,maxWidth:360,mt:1}}},children:q(J,{sx:{position:`relative`},children:[K(Q,{size:`small`,onClick:d,sx:{position:`absolute`,top:-12,right:-12},"aria-label":`Close`,children:K(Br,{})}),i===`signup`&&q(G,{children:[K(Z,{sx:{mb:3,pr:2},children:`Sign up to Recce Cloud so your team members can see and query your instance directly`}),K(Y,{variant:`contained`,color:`primary`,onClick:f,sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600,px:4,py:1},children:`Sign up`})]}),i===`waiting`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(pr,{size:40}),K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Waiting for signup...`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Complete signup in the browser tab.`}),K(Y,{fullWidth:!0,variant:`text`,color:`primary`,size:`small`,onClick:f,sx:{textTransform:`none`},children:`Retry`})]}),i===`reload`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(J,{component:`img`,sx:{height:`5rem`,objectFit:`contain`},src:`/imgs/reload-image.svg`,alt:`Reload`}),K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Reload to Finish`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Signup complete! Reload to connect to Recce Cloud.`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:()=>window.location.reload(),sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600},children:`Reload`})]}),i===`error`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Connection Failed`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Could not connect to Recce Cloud. Please try again.`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:f,sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600},children:`Retry`})]})]})})]})}function xl(){let{featureToggles:e}=ie(),{apiClient:t}=I(),n=async()=>{try{let e=await ee(t),n=JSON.stringify(e,null,2),r=new Blob([n],{type:`application/json`}),i=`recce-state-${xi(new Date,`yyyy-MM-dd-HH-mm-ss`)}.json`;ii(r,i)}catch(e){console.error(`Export failed`,e),nn.create({title:`Export failed`,description:String(e),type:`error`,duration:5e3,closable:!0})}};return K($,{title:`Export`,children:K(Q,{size:`small`,"aria-label":`Export state`,onClick:async()=>{await n(),Ln({name:`export`})},disabled:e.disableExportStateFile,children:K(J,{component:Dr,sx:{verticalAlign:`middle`,width:`16px`,height:`16px`}})})})}function Sl(e){return/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(e)}function Cl(){return K($,{title:`Syncing`,children:K(J,{sx:{mx:`10px`},children:K(pr,{size:20})})})}function wl(){let[e,t]=W(!1),n=Un(),{apiClient:r}=I(),i=Ai(),a=ki(),{basePath:o}=ae(),[s,c]=W(!1),[l,u]=W(``),{data:d}=P(),f=()=>c(!1),p=B(async e=>{if(c(!1),t(!0),(await D(e,r)).status===`conflict`){c(!0),t(!1);return}for(;await S(r);)await new Promise(e=>setTimeout(e,1e3));nn.create({description:`Sync Completed`,type:`success`,duration:5e3,closable:!0}),t(!1),u(``),await n.invalidateQueries({queryKey:A.lineage()}),await n.invalidateQueries({queryKey:A.checks()}),await n.invalidateQueries({queryKey:A.runs()}),Sl(a)&&i.push(`${o}/checks`)},[n,a,r,i.push,o]);return e?K(Cl,{}):q(G,{children:[K($,{title:`Sync with Cloud`,children:K(Q,{size:`small`,"aria-label":`Sync state`,onClick:()=>p(d?.session_id?{method:`merge`}:{}),children:K(J,{component:ur,sx:{fontSize:16,verticalAlign:`middle`}})})}),q(Zn,{open:s,onClose:f,children:[q(er,{sx:{display:`flex`,alignItems:`center`,fontWeight:`bold`},children:[`Sync with Cloud`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:f,children:K(lr,{})})]}),q($n,{children:[K(Z,{children:`New changes have been detected in the cloud. Please choose a method to sync your state`}),K(J,{sx:{mt:`5px`},children:K(oa,{value:l,onChange:e=>{u(e.target.value)},children:q(X,{direction:`column`,children:[K(oi,{value:`merge`,control:K(aa,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Merge`,K($,{title:`This will merge the local and remote states.`,children:K(J,{component:Or,sx:{ml:2,cursor:`pointer`}})})]})}),K(oi,{value:`overwrite`,control:K(aa,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Overwrite`,K($,{title:`This will overwrite the remote state file with the local state.`,children:K(J,{component:Or,sx:{ml:2,cursor:`pointer`}})})]})}),K(oi,{value:`revert`,control:K(aa,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Revert`,K($,{title:`This will discard local changes and revert to the cloud state.`,children:K(J,{component:Or,sx:{ml:2,cursor:`pointer`}})})]})})]})})})]}),q(Qn,{children:[K(Y,{onClick:f,sx:{mr:1},children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:()=>p({method:l||void 0}),disabled:!l,children:`Sync`})]})]})]})}const Tl=[{path:`/lineage`,name:`Lineage`},{path:`/query`,name:`Query`},{path:`/checks`,name:`Checklist`}];function El({queryKey:e,fetchCallback:t,selectCallback:n}){let{data:r,isLoading:i,error:a}=Hn({queryKey:e,queryFn:t,select:n});return i||a||r===0?K(G,{}):K(J,{sx:{bgcolor:`brand.main`,display:`flex`,justifyContent:`center`,alignItems:`center`,p:1,borderRadius:`100%`,color:`white`,fontWeight:700,fontSize:`0.75rem`},children:K(`span`,{children:r})})}function Dl(){let{apiClient:e}=I();return K(El,{queryKey:A.checks(),fetchCallback:()=>c(e),selectCallback:e=>e.filter(e=>!e.is_checked).length})}const Ol=()=>{let e=ki(),{isDemoSite:t,isLoading:n,cloudMode:r}=F(),{featureToggles:i}=ie(),{data:a,isLoading:o}=pe(),s=U(null);V(()=>{s.current&&s.current!==e&&jn({from:s.current,to:e}),s.current=e},[e]);let c=H(()=>e.startsWith(`/checks`)?`/checks`:e.startsWith(`/query`)?`/query`:e.startsWith(`/runs`)?`/runs`:`/lineage`,[e]);return K(J,{sx:{borderBottom:`1px solid lightgray`,px:`12px`},children:q(J,{sx:{display:`grid`,gridTemplateColumns:`1fr auto 1fr`,width:`100%`,alignItems:`center`},children:[K(wi,{value:c,sx:{borderBottom:`none`,minHeight:`auto`},children:Tl.map(({path:e,name:t})=>t===`Query`&&a?.single_env_onboarding?null:t===`Checklist`&&Dl?K(Ci,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:q(sr,{href:e,style:{textDecoration:`none`,color:`inherit`,padding:`0.875rem 1.1875rem`,display:`flex`,gap:3,alignItems:`center`},children:[t,` `,K(Dl,{})]})})},e):K(Ci,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:K(sr,{href:e,style:{textDecoration:`none`,color:`inherit`,padding:`0.875rem 1.1875rem`},children:t})})},e))}),K(J,{sx:{display:`flex`,alignItems:`center`,gap:`12px`,justifyContent:`center`},children:!n&&!t&&K(sl,{})}),!n&&q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,mr:`8px`},children:[!t&&!a?.single_env_onboarding&&!i.disableShare&&K(bl,{}),K(il,{}),r&&K(wl,{}),K(xl,{})]})]})})};function kl(){let{remainingSeconds:e,isEnabled:t}=oe();return!t||e===null||e>60?null:q(_a,{color:`warning`,variant:`standard`,sx:{display:`flex`,alignItems:`center`,gap:1,fontSize:`0.75rem`,mr:2},children:[K(J,{component:dr,sx:{display:`inline-flex`}}),`Idle timeout: `,sn(e,`compact`)]})}const Al=()=>{let{version:e,latestVersion:t}=w(),n=H(()=>RegExp(`^\\d+\\.\\d+\\.\\d+$`),[]);return V(()=>{if(n.test(e)&&e!==t){let e=`recce-update-toast-shown`;if(sessionStorage.getItem(e))return;setTimeout(()=>{nn.create({id:`recce-update-available`,title:`Update available`,description:q(`span`,{children:[`A new version of Recce (v`,t,`) is available.`,K(`br`,{}),`Please run`,` `,K(J,{component:`code`,sx:{bgcolor:`grey.200`,px:.5,py:.25,borderRadius:.5,fontFamily:`monospace`,fontSize:`0.875em`},children:`pip install --upgrade recce`}),` `,`to update Recce.`,K(`br`,{}),K(tr,{sx:{color:`primary.main`,fontWeight:`bold`,"&:hover":{textDecoration:`underline`}},href:`https://github.com/DataRecce/recce/releases/tag/v${t}`,target:`_blank`,children:`Click here to view the detail of latest release`})]}),duration:6e4,closable:!0}),sessionStorage.setItem(e,`true`)},0)}},[e,t,n]),n.test(e)?K(tr,{href:`https://github.com/DataRecce/recce/releases/tag/v${e}`,sx:{"&:hover":{textDecoration:`none`},fontSize:`sm`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75},target:`_blank`,children:e}):K(Z,{component:`span`,sx:{fontSize:`sm`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75},children:e})};function jl({icon:e,href:t,sx:n,...r}){let i=ar();return K(tr,{sx:{height:`20px`,color:`common.white`,...n},href:t,target:`_blank`,...r,children:K(e,{style:{color:i.palette.common.white,width:20,height:20}})})}const Ml=()=>{let{reviewMode:e,isDemoSite:t,envInfo:n,cloudMode:r}=F(),{featureToggles:i,authed:a}=ie(),{url:o,id:s}=n?.pullRequest??{},c=o?o.split(`/`).pop():null,l=r||a?mn:`https://reccehq.com/`,[u,d]=W(!1);return q(J,{sx:{display:`flex`,gap:`10px`,minHeight:`40px`,alignItems:`center`,bgcolor:De.brand[400]},children:[K(tr,{href:l,target:`_blank`,sx:{"&:hover":{textDecoration:`none`}},children:q(J,{sx:{display:`flex`,gap:`10px`,alignItems:`center`},children:[K(J,{component:`img`,sx:{width:20,height:20,ml:`18px`},src:`/logo/recce-logo-white.png`,alt:`recce-logo-white`}),K(Z,{variant:`h4`,sx:{fontFamily:`"Montserrat", sans-serif`,color:`common.white`,fontSize:`1.25rem`},children:`RECCE`})]})}),K(tl,{}),K(Al,{}),(i.mode??e)&&K(_a,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:i.mode??`review mode`}),r&&s&&K(_a,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`cloud mode`}),K(J,{sx:{borderLeft:`1px solid rgba(255,255,255,0.8)`,pl:`8px`},children:q(tr,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(pi,{style:{color:`rgba(255,255,255,0.8)`,width:12,height:12,marginRight:2,display:`inline`,verticalAlign:`middle`}}),K(Z,{component:`span`,sx:{color:`rgba(255,255,255,0.8)`,display:`inline`},children:`#${String(s)}`})]})})]})}),t&&o&&c&&K(_a,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`demo mode`}),K(J,{sx:{borderLeft:`1px solid rgba(255,255,255,0.8)`,pl:`8px`},children:q(tr,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(pi,{style:{color:`rgba(255,255,255,0.8)`,width:12,height:12,marginRight:2,display:`inline`,verticalAlign:`middle`}}),K(Z,{component:`span`,sx:{color:`rgba(255,255,255,0.8)`,display:`inline`},children:`#${c}`})]})})]})}),K(J,{sx:{flex:1}}),(t||i.mode===`read only`)&&q(G,{children:[K(jl,{icon:gr,href:`https://github.com/DataRecce/recce`}),K(jl,{icon:yr,href:`https://getdbt.slack.com/archives/C05C28V7CPP`}),K(jl,{sx:{mr:2},icon:_r,href:`https://docs.reccehq.com`})]}),!t&&i.mode!==`read only`&&q(G,{children:[K(kl,{}),a||r?K(J,{sx:{mr:2},children:K(el,{})}):q(G,{children:[K(J,{component:`button`,sx:{color:`common.white`,fontSize:`0.875rem`,fontWeight:600,bgcolor:`brand.700`,borderRadius:1,px:3,py:1,mr:2,cursor:`pointer`,border:`none`},onClick:()=>{d(!0)},children:`Connect to Cloud`}),u&&K($c,{parentOpen:u,handleParentClose:d,ignoreCookie:!0,variant:`user-profile`})]})]})]})};function Nl(){return K(J,{sx:{display:`flex`,height:`100%`,alignItems:`center`,justifyContent:`center`,contain:`size`},children:K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:K(pr,{size:48})})})}function Pl({children:e,lineage:t}){let n=ki(),{isDemoSite:r,isLoading:i,isCodespace:a}=F(),{featureToggles:o}=ie(),s=n.replace(/\/$/,``)||`/`,c=s===`/lineage`||s===`/`;return V(()=>{Dn()},[]),q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:[K(qc,{}),K(Ml,{}),K(Ol,{}),K(Fl,{isLineageRoute:c,lineage:t,children:e}),!i&&!r&&!a&&o.mode===null&&K($c,{})]})}function Fl({children:e,lineage:t,isLineageRoute:n,disableInternalHistory:r=!1}){let{isRunResultOpen:i,isHistoryOpen:a,closeRunResult:o}=ge(),{basePath:s}=ae(),{data:c}=pe(),l=ki(),u=Zt(),d=i&&!l.startsWith(`${s}/checks`),f=!r&&a&&!l.startsWith(`${s}/checks`);return q(_t,{sizes:f?[20,80]:[0,100],minSize:0,gutterSize:5,className:f?void 0:`split-gutter-hidden`,style:{height:`100%`},children:[K(J,{style:{contain:`size`},suppressHydrationWarning:!0,children:f&&K(Re,{})}),q(jt,{sizes:d?[50,50]:[100,0],minSize:0,gutterSize:5,className:d?void 0:`split-gutter-hidden`,style:{flex:`1`,contain:`size`},children:[K(Wn,{fallback:K(Nl,{}),children:q(J,{sx:{p:0,contain:`content`,height:`100%`,position:`relative`},suppressHydrationWarning:!0,children:[K(J,{sx:{display:n?`block`:`none`,height:`100%`,position:n?`relative`:`absolute`,inset:0},children:t}),!n&&e]})}),K(J,{sx:{height:`100%`,bgcolor:u?`grey.900`:`grey.50`},suppressHydrationWarning:!0,children:d?K(Ie,{onClose:o,isSingleEnvironment:!!c?.single_env_onboarding}):null})]})]})}function Il({children:e,display:t}){let[n,r]=W(!1),i=U(null),a=U(null),o=B(()=>{i.current&&=(clearTimeout(i.current),null),r(!0)},[]),s=B(()=>{i.current=setTimeout(()=>{r(!1)},100)},[]);return t?q(G,{children:[K(J,{ref:a,onMouseEnter:o,onMouseLeave:s,sx:{display:`contents`},children:e}),q(Oi,{open:n,anchorEl:a.current,onClose:()=>r(!1),anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableAutoFocus:!0,disableEnforceFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{onMouseEnter:o,onMouseLeave:s,sx:{bgcolor:`grey.600`,color:`white`,p:1.5,pointerEvents:`auto`}}},children:[`Connect to a data warehouse to unlock Diff.`,` `,K(tr,{href:hn,target:`_blank`,sx:{color:`white`,textDecoration:`underline`},children:`Learn more`}),`.`]})]}):e}function Ll({checksOnly:e=!0}){let t=Zt(),{featureToggles:n}=ie(),r=Un(),{apiClient:i}=I(),a=U(null),o=U(null),[s,c]=W(null),[l,u]=W(!1),d=Ai(),f=ki(),{basePath:p}=ae(),[,m]=ue(),h=B(async()=>{if(s){try{let{runs:t,checks:n}=await _(s,e,i);m?.(),await r.invalidateQueries({queryKey:A.checks()}),await r.invalidateQueries({queryKey:A.runs()}),f.includes(`/checks`)&&d.push(`${p}/checks`);let a=e?`${n} checks imported successfully`:`${t} runs and ${n} checks imported successfully`;nn.create({description:a,type:`info`,duration:5e3,closable:!0})}catch(e){console.error(`Import failed`,e),nn.create({title:`Import failed`,description:String(e),type:`error`,duration:5e3,closable:!0})}u(!1)}},[r,s,f,m,e,i,d.push,p]),g=()=>{a.current&&a.current.click()},v=e=>{e.target.files?.length===1&&(c(e.target.files[0]),u(!0)),a.current&&(a.current.value=``)},y=()=>u(!1),b=e?`checks`:`runs and checks`,{isDemoSite:x}=F();return q(G,{children:[K($,{title:`Import Checklist from State File`+(x?` (Disabled in the demo site)`:``),children:K(Q,{sx:{pt:`6px`,color:t?`grey.300`:`grey.600`,"&:hover":{color:t?`grey.100`:`grey.800`},fontSize:20},"aria-label":`Import state`,onClick:()=>{g(),Ln({name:`import`})},disabled:n.disableImportStateFile||x,children:K($i,{})})}),K(`input`,{type:`file`,style:{display:`none`},ref:a,onChange:v}),q(Zn,{open:l,onClose:y,maxWidth:`sm`,fullWidth:!0,"aria-labelledby":`import-dialog-title`,children:[q(er,{id:`import-dialog-title`,sx:{display:`flex`,alignItems:`center`,fontWeight:`bold`},children:[`Import state`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:y,children:K(lr,{})})]}),K($n,{children:q(X,{direction:`column`,spacing:1,sx:{px:`5px`,borderRadius:1},children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[K(J,{component:Or,sx:{color:`error.main`}}),K(Z,{component:`span`,sx:{fontWeight:500,color:`error.main`},children:`Caution!`})]}),q(Z,{children:[`The current `,b,` will be`,` `,K(Z,{component:`span`,sx:{fontWeight:600},children:`merged`}),` `,`with the imported state`]})]})}),q(Qn,{children:[K(Y,{ref:o,onClick:y,children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:h,sx:{ml:`5px`},children:`Import`})]})]})]})}function Rl({check:e},t){let n={...e.params,...e.view_options};return K(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:K(Zr,{children:K(Uc,{viewOptions:n,interactive:!1,ref:t})})})}const zl=Kn(Rl),Bl=({node:e,selected:t,onSelect:n,schemaChanged:r,isDark:i})=>{let{icon:a}=Ye(e.data.resourceType),o,s;return r?(o=z(`schema_diff`).icon,s=Et(`modified`).color):e.data.changeStatus===`added`?(o=Et(`added`).icon,s=Et(`added`).color):e.data.changeStatus===`removed`&&(o=Et(`removed`).icon,s=Et(`removed`).color),K(Ei,{disablePadding:!0,children:q(J,{sx:{display:`flex`,width:`100%`,fontSize:`10pt`,p:`5px 8px`,cursor:`pointer`,"&:hover":{bgcolor:i?`grey.700`:`grey.200`},bgcolor:t?i?`grey.800`:`grey.100`:`inherit`,alignItems:`center`,gap:`5px`},onClick:()=>{n(e.id)},children:[a&&K(J,{component:a}),K(J,{sx:{flex:1,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`},children:e.data.name}),o&&s&&K(J,{component:o,sx:{color:s}})]})})};function Vl({check:e},t){let r=Zt(),{apiClient:i}=I(),{lineageGraph:a}=F(),o=e.params,s=[...A.check(e.check_id),`select`],{isLoading:c,error:l,data:u}=Hn({queryKey:s,queryFn:async()=>C({select:o.select,exclude:o.exclude,packages:o.packages,view_mode:o.view_mode},i),refetchOnMount:!0,enabled:!o.node_id}),[d,f]=H(()=>{let e=[],t=[],n=[],r=[];if(o.node_id){let t=o.node_id instanceof Array?o.node_id:[o.node_id];for(let n of t){let t=a?.nodes[n];t&&e.push(t)}}else for(let t of u?.nodes??[]){let n=a?.nodes[t];n&&e.push(n)}let i=e.filter(e=>e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`source`||e.data.resourceType===`snapshot`);for(let e of i)e.data.change?.columns&&Object.keys(e.data.change.columns).length>0?t.push(e.id):e.data.changeStatus===`added`?n.push(e.id):e.data.changeStatus===`removed`&&r.push(e.id);function s(e){return t.includes(e.id)?3:n.includes(e.id)?2:+!!r.includes(e.id)}return i.sort((e,t)=>{let n=s(e),r=s(t);return n===r?e.data.name.localeCompare(t.data.name):r-n}),[i,t]},[o.node_id,u?.nodes,a]),[p,m]=W(0),h=p<d.length?d[p]:void 0,{data:g}=Hn({queryKey:[`modelDetail`,h?.id],queryFn:()=>n(h?.id??``,i),enabled:!!h&&!!i,staleTime:3e5});if(c)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:r?`grey.900`:`grey.50`,height:`100%`},children:`Loading...`});if(l)return q(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:r?`grey.900`:`grey.50`,height:`100%`},className:`no-track-pii-safe`,children:[`Error: `,l.message]});if(d.length==0)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:r?`grey.900`:`grey.50`,height:`100%`},children:`No nodes matched`});if(p<d.length){let e=d[p];return q(_t,{sizes:[80,20],minSize:30,style:{height:`100%`},children:[K(Ds,{base:g?.model?.base&&Object.keys(g.model.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...g.model.base}:void 0,current:g?.model?.current&&Object.keys(g.model.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...g.model.current}:void 0,columnChanges:e.data.change?.columns,enableScreenshot:!0,showMenu:!1,ref:t}),K(Ti,{sx:{overflow:`auto`,bgcolor:`background.paper`,listStyle:`none`},children:d.map((e,t)=>K(Bl,{node:e,schemaChanged:f.includes(e.id),selected:t===p,isDark:r,onSelect:()=>{m(t)}},e.id))})]})}return K(G,{})}const Hl=Kn(Vl);function Ul({checkId:e,refreshCheckList:n}){let r=ar(),i=Zt(),{apiClient:o}=I(),{featureToggles:s,sessionId:c}=ie(),{setLatestSelectedCheckId:u}=He(),{cloudMode:d}=F(),f=Un(),p=Ai(),{basePath:m}=ae(),{setSqlQuery:h,setBaseSqlQuery:g,setCustomQueries:_,setPrimaryKeys:v}=mt(),{successToast:y,failToast:b}=tn(),[S,C]=W(),[w]=W(),[E,D]=W(!1),[O,k]=W(null),ee=!!O,{isLoading:te,error:ne,data:j}=Hn({queryKey:A.check(e),queryFn:async()=>x(e,o),refetchOnMount:!0}),M=S??j?.last_run?.run_id,{run:N,error:re,onCancel:P}=Nt(M),oe=S?!N||N.status===`Running`:N?.status===`Running`,se=j?.type?z(j.type):void 0,ce;se&&(ce=se.RunResultView);let le=j?.is_preset??!1,ue=U(null),{mutate:de}=Vn({mutationFn:t=>a(e,t,o),onSuccess:async()=>{await f.invalidateQueries({queryKey:A.check(e)}),await f.invalidateQueries({queryKey:A.checks()})}}),{mutate:fe}=Vn({mutationFn:()=>t(e,o),onSuccess:async()=>{u(``),await f.invalidateQueries({queryKey:A.checks()}),p.push(`${m}/checks`)}}),{mutate:pe,isPending:me}=Vn({mutationFn:async()=>{if(!j)throw Error(`Check not found`);return await l(e,o)},onSuccess:async()=>{y(`Check marked as preset successfully`),await f.invalidateQueries({queryKey:A.check(e)})},onError:e=>{b(`Failed to mark check as preset`,e)}}),he=B(async()=>{if(!j?.type)return;let t=await T(e,{nowait:!0},o);C(t.run_id),await f.invalidateQueries({queryKey:A.check(e)}),n&&n()},[j,e,f,n,o]),ge=async()=>{if(!j)return;let e=Wl(j);if(!window.isSecureContext){b(`Failed to copy the check to clipboard`,Error(`Copy to clipboard is available only in secure contexts (HTTPS)`));return}try{await navigator.clipboard.writeText(e),y(`Copied the check to the clipboard`)}catch(e){b(`Failed to copy the check to clipboard`,e)}},_e=B(()=>{let e=j?.is_checked;de({is_checked:!e}),e||nn.create({title:`Marked as approved`,type:`success`,duration:2e3})},[j?.is_checked,de]),ve=e=>{de({view_options:e})},ye=e=>{de({description:e})},be=e=>{k(e.currentTarget)},xe=()=>{k(null)},Se=B(()=>{if(!j)return;let e=j.params,t=e?.sql_template||``;h(t),`base_sql_template`in e&&e.base_sql_template?(g(e.base_sql_template),_(!0)):(g(``),_(!1)),`primary_keys`in e&&e.primary_keys?v(e.primary_keys):v(void 0),p.push(`${m}/query`)},[j,p,m,h,g,_,v]),[Ce,we]=W(`result`),{ref:Te,onCopyToClipboard:Ee,onMouseEnter:De,onMouseLeave:Oe}=bt(),ke=Ue({name:j?.name??``,description:j?.description??``,type:j?.type??``,params:j?.params,viewOptions:j?.view_options});if(te)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:`Loading`});if(ne)return q(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:[`Error: `,K(`span`,{className:`no-track-pii-safe`,children:ne.message})]});if(!j)return K(jt,{minSize:100,sizes:[30,70],style:{height:`100%`,width:`100%`,maxHeight:`100%`},children:K(J,{style:{contain:`strict`},sx:{display:`flex`,flexDirection:`column`},children:K(J,{sx:{display:`flex`,p:`0px 16px`,alignItems:`center`,height:40},children:K(dt,{name:`Check not found`,disabled:!0})})})});let Ae=N?.run_at?Si(new Date(N.run_at),{addSuffix:!0}):null,je=se?.icon;return q(va,{spacing:0,container:!0,sx:{height:`100%`,width:`100%`},children:[K(va,{size:{xs:12,md:d?9:12},sx:{height:`100%`},children:q(jt,{minSize:100,sizes:[40,60],style:{height:`100%`,width:`100%`,maxHeight:`100%`},children:[K(J,{sx:{height:`100%`,contain:`strict`,display:`flex`,flexDirection:`row`},children:q(J,{sx:{flex:1,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[q(J,{sx:{display:`flex`,p:`0px 16px`,alignItems:`center`,height:40,borderBottom:`2px solid`,borderColor:i?`grey.700`:`grey.300`},children:[je&&K(J,{component:je,sx:{fontSize:20,mr:1,flexShrink:0}}),K(dt,{name:j.name,onNameChange:e=>{de({name:e})}}),K(J,{sx:{flexGrow:1}}),q(X,{direction:`row`,spacing:2,sx:{mr:`10px`},children:[le&&K($,{title:`This is a preset check`,children:K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Qi,{size:`1rem`,color:r.palette.iochmara.dark})})}),j?.actor_type&&!j.is_preset&&Ge[j.actor_type]&&K(Vr,{label:Ge[j.actor_type].label,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:Ge[j.actor_type].bg,color:Ge[j.actor_type].color,flexShrink:0,"& .MuiChip-label":{px:.75}}}),K(Q,{size:`small`,onClick:be,children:K(hi,{})}),q(li,{anchorEl:O,open:ee,onClose:xe,children:[c&&q(ui,{onClick:()=>{pe(),xe()},disabled:me||le,children:[K(Bi,{children:K(cr,{})}),K(Vi,{children:`Mark as Preset Check`})]}),q(ui,{onClick:()=>{D(!0),xe()},children:[K(Bi,{children:K(ba,{})}),K(Vi,{children:`Get Preset Check Template`})]}),q(ui,{onClick:()=>{ge(),xe()},children:[K(Bi,{children:K(Er,{})}),K(Vi,{children:`Copy Markdown`})]}),K(fr,{}),q(ui,{onClick:()=>{fe(),xe()},disabled:s.disableUpdateChecklist,sx:{color:`error.main`},children:[K(Bi,{sx:{color:`error.main`},children:K(Lr,{})}),K(Vi,{children:`Delete`})]})]}),K($,{title:R({type:j.type,hasResult:!!N?.result,hasError:!!N?.error})?`Run the check first`:j.is_checked?`Remove approval`:`Mark as approved`,placement:`bottom-end`,children:K(Y,{size:`small`,color:j.is_checked?`success`:`neutral`,variant:j.is_checked?`contained`:`outlined`,onClick:()=>{_e()},disabled:R({type:j.type,hasResult:!!N?.result,hasError:!!N?.error})||s.disableUpdateChecklist,startIcon:j.is_checked?K(wr,{}):K(fi,{style:{color:i?r.palette.grey[600]:r.palette.grey[400]}}),sx:{flex:`0 0 auto`,textTransform:`none`},children:j.is_checked?`Approved`:`Pending`})})]})]}),K(J,{sx:{flex:1,p:`8px 16px`,minHeight:100},children:K(It,{value:j.description,onChange:ye,disabled:s.disableUpdateChecklist},j.check_id)})]})}),K(J,{style:{contain:`strict`},children:q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[q(J,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,height:50},children:[q(wi,{value:Ce,onChange:(e,t)=>we(t),children:[K(Ci,{label:`Result`,value:`result`,sx:{fontSize:`0.75rem`,textTransform:`none`}}),(j.type===`query`||j.type===`query_diff`)&&K(Ci,{label:`Query`,value:`query`,sx:{fontSize:`0.75rem`,textTransform:`none`}})]}),Ae&&K(Z,{variant:`caption`,sx:{color:`text.secondary`,ml:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0,display:`flex`,alignItems:`center`},children:Ae}),K(J,{sx:{flexGrow:1}}),q(X,{direction:`row`,spacing:1,sx:{mr:`10px`},children:[(j.type===`query`||j.type===`query_base`||j.type===`query_diff`)&&K($,{title:`Open in Query tab`,children:K(Y,{variant:`outlined`,color:`neutral`,size:`small`,onClick:Se,disabled:s.disableDatabaseQuery,startIcon:K(zi,{}),sx:{textTransform:`none`},children:`Open Query`})}),ce&&K($,{title:`Rerun`,children:K(Y,{variant:`outlined`,color:`neutral`,size:`small`,onClick:()=>he(),disabled:s.disableDatabaseQuery||oe,startIcon:K(Fr,{}),sx:{textTransform:`none`},children:oe?`Running...`:`Rerun`})}),K(Y,{variant:`outlined`,color:`neutral`,disabled:R({type:j.type,hasResult:!!N?.result,hasError:!!N?.error})||Ce!==`result`,onMouseEnter:De,onMouseLeave:Oe,size:`small`,onClick:async()=>{j.type===`lineage_diff`?ue.current?.copyToClipboard():await Ee(),bn({type:j.type,from:`check`})},startIcon:K(Er,{}),sx:{textTransform:`none`},children:`Copy to Clipboard`})]})]}),q(J,{sx:{flex:1,contain:`strict`},children:[Ce===`result`&&q(J,{sx:{width:`100%`,height:`100%`},children:[ce&&(j.last_run||M?K(Kt,{ref:Te,runId:M,isRunning:oe,run:M?N:j.last_run,error:re,progress:w,RunResultView:ce,viewOptions:j.view_options,onViewOptionsChanged:ve,onCancel:P,onExecuteRun:he}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:i?`grey.900`:`grey.50`,height:`100%`},children:q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{children:`This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here.`}),K(Il,{display:s.mode===`metadata only`,children:K(Y,{onClick:he,variant:`contained`,size:`small`,disabled:s.disableDatabaseQuery,children:`Run Query`})})]})})),j.type===`schema_diff`&&K(Hl,{check:j,ref:Te},j.check_id),j.type===`lineage_diff`&&K(zl,{check:j,ref:ue},j.check_id)]}),Ce===`query`&&(j.type===`query`||j.type===`query_diff`||j.type===`query_base`)&&K(J,{sx:{height:`100%`,width:`100%`},children:j.params.base_sql_template?K(Pe,{value:j.params.sql_template||``,baseValue:j.params.base_sql_template??``,options:{readOnly:!0}}):K(Qe,{value:j.params.sql_template||``,options:{readOnly:!0}})})]})]})}),q(Zn,{open:E,onClose:()=>D(!1),maxWidth:`md`,fullWidth:!0,children:[K(er,{children:`Preset Check Template`}),q($n,{children:[q(Z,{variant:`subtitle2`,sx:{fontWeight:`bold`,mb:2},children:[`Please`,` `,K(Z,{component:`span`,sx:{cursor:`pointer`,"&:hover":{textDecoration:`underline`},color:`primary.main`},onClick:async()=>{await navigator.clipboard.writeText(ke),y(`Copied the template to the clipboard`)},children:`copy`}),` `,`the following template and paste it into the`,` `,K(J,{component:`span`,sx:{px:.5,bgcolor:`error.light`,borderRadius:.5},children:`recce.yml`}),` `,`file.`]}),K(lt,{yamlTemplate:ke})]}),K(Qn,{children:K(Q,{size:`small`,onClick:()=>D(!1),sx:{position:`absolute`,top:8,right:8},children:K(lr,{})})})]})]})}),d&&K(va,{size:3,sx:{height:`100%`,overflow:`hidden`,flexShrink:0,display:{xs:`none`,md:`block`}},children:K(_o,{checkId:e})})]})}function Wl(e){let t=tt({name:e.name,isChecked:e.is_checked});return ya`
|
|
7
|
+
<details><summary>${t}</summary>
|
|
8
|
+
|
|
9
|
+
${Gl(e)}
|
|
10
|
+
|
|
11
|
+
</details>`}function Gl(e){let t=Ze({description:e.description});if(e.type===`query`||e.type===`query_diff`){let n=e.params,r=n&&`sql_template`in n?n.sql_template:``;return`${t}\n\n${Be({sql:r})}`}return t}const Kl=()=>{let e=Un(),t=Ai(),{apiClient:n}=I(),{basePath:r}=ae(),{mutate:i,isPending:a}=Vn({mutationFn:()=>b({select:`state:modified`},n),onSuccess:async n=>{await e.invalidateQueries({queryKey:A.checks()}),t.push(`${r}/checks/?id=${n.check_id}`)}});return K(L,{title:`No checks yet`,description:`Checks help you validate data quality and catch issues.`,icon:K(Ri,{size:48}),actionText:`Create Schema Diff Check`,onAction:()=>{i()},isLoading:a,helperText:`The schema checks compare modified models between environments to detect changes, additions, or removals.`})},ql=({check:e,selected:t,onSelect:n,onApprovalChange:r})=>{let{featureToggles:i}=ie(),a=e.last_run?.run_id,{run:o}=Nt(a),s=R({type:e.type,hasResult:!!o?.result,hasError:!!o?.error}),c=s||i.disableUpdateChecklist,l={id:e.check_id,name:e.name,type:e.type,isApproved:e.is_checked,runStatus:(()=>{if(o){if(o.error)return`error`;if(o.result)return`success`}})(),isPreset:e.is_preset,isOutdated:e.is_outdated,lastRunAt:e.last_run?.run_at,actorType:e.actor_type};return K(ft,{check:l,isSelected:t,onClick:n,onApprovalChange:r,disableApproval:c,disabledApprovalTooltip:s?`Run the check first`:void 0})},Jl=({checks:e,selectedItem:t,onCheckSelected:n,onChecksReordered:r})=>{let[i,o]=W(!1),[s,c]=W(!1),[l,u]=W(null),d=Un(),{apiClient:f}=I(),{mutate:p}=Vn({mutationFn:({checkId:e,isChecked:t})=>a(e,{is_checked:t},f),onSuccess:async(e,{checkId:t})=>{await d.invalidateQueries({queryKey:A.check(t)}),await d.invalidateQueries({queryKey:A.checks()})}}),m=e=>{e.destination&&r(e.source.index,e.destination.index)},h=()=>c(!0),g=()=>{c(!1),u(null)},_=()=>{nn.create({title:`Marked as approved`,type:`success`,duration:2e3})},v=(e,t)=>{t?localStorage.getItem(`bypassMarkAsApprovedWarning`)===`true`?(p({checkId:e,isChecked:!0}),_()):(u(e),h()):p({checkId:e,isChecked:!1})};return q(G,{children:[K(xa,{onDragEnd:m,children:K(Ca,{droppableId:`checklist`,children:r=>q(X,{...r.droppableProps,ref:r.innerRef,className:`no-track-pii-safe`,sx:{width:`100%`,flex:1,overflow:`auto`},spacing:0,children:[e.map((e,r)=>K(Sa,{draggableId:e.check_id,index:r,children:(r,i)=>{let a=r.draggableProps.style;if(i.isDragging&&a&&`left`in a){let e={x:0,y:80};a={...a,left:a.left-e.x,top:a.top-e.y}}return K(J,{ref:r.innerRef,...r.draggableProps,...r.dragHandleProps,style:a,sx:{borderBottom:`1px solid`,borderColor:`divider`,width:`100%`},children:K(ql,{check:e,selected:e.check_id===t,onSelect:n,onApprovalChange:v},e.check_id)})}},e.check_id)),r.placeholder]})})}),q(Zn,{open:s,onClose:g,maxWidth:`xs`,fullWidth:!0,children:[q(er,{sx:{display:`flex`,alignItems:`center`},children:[`Mark as Approved?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:g,children:K(lr,{})})]}),K(fr,{}),q($n,{sx:{fontSize:`0.875rem`},children:[K(Z,{children:`Please ensure you have reviewed the contents of this check before marking it as approved.`}),K(oi,{control:K(ai,{checked:i,onChange:e=>{o(e.target.checked)},size:`small`}),label:K(Z,{sx:{fontWeight:`bold`,pt:`8px`},children:`Don't show this again`})})]}),K(fr,{}),q(Qn,{sx:{gap:0},children:[K(Y,{variant:`outlined`,size:`small`,onClick:g,children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,size:`small`,onClick:()=>{l&&(p({checkId:l,isChecked:!0}),i&&localStorage.setItem(`bypassMarkAsApprovedWarning`,`true`),_(),g(),u(null))},children:`Mark as approved`})]})]})]})},Yl=()=>{let{isDark:e}=zt(),t=e?`grey.700`:`grey.300`,n=Ai(),r=ji().get(`id`),{latestSelectedCheckId:i,setLatestSelectedCheckId:a}=He(),o=Un(),{apiClient:s}=I(),{basePath:l}=ae(),d=r;V(()=>{d&&a(d)},[d,a]);let{isLoading:f,error:p,data:m,status:h,refetch:g}=Hn({queryKey:A.checks(),queryFn:()=>c(s),refetchOnMount:!0}),_=B(e=>{n.push(`${l}/checks/?id=${e}`)},[n.push,l]),[v,y]=W(m??[]),[b,x]=W(m);m!==b&&(x(m),y(m??[]));let{mutate:S}=Vn({mutationFn:e=>u(e,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:A.checks()})}}),C=B((e,t)=>{let n=[...v],[r]=n.splice(e,1);n.splice(t,0,r),S({source:e,destination:t}),y(n)},[v,S]),w=H(()=>!!(d&&m?.some(e=>e.check_id===d)),[d,m]);return V(()=>{h===`success`&&m.length!==0&&(w||(i&&m.some(e=>e.check_id===i)?n.replace(`${l}/checks/?id=${i}`):n.replace(`${l}/checks/?id=${m[0].check_id}`)))},[h,w,m,i,n.replace,l]),f?null:p?q(J,{children:[`Error: `,K(`span`,{className:`no-track-pii-safe`,children:p.message})]}):m?.length?q(_t,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{height:`100%`},style:{contain:`size`},children:q(X,{sx:{height:`100%`,alignItems:`stretch`},style:{contain:`strict`},spacing:0,children:[K(J,{sx:{display:`flex`,justifyContent:`flex-end`,p:`0px 10px`},children:K(Ll,{checksOnly:!0})}),K(fr,{}),K(Jl,{checks:v,selectedItem:d,onCheckSelected:_,onChecksReordered:C})]})}),K(J,{sx:{height:`100%`},children:w&&d&&K(Ul,{checkId:d,refreshCheckList:g},d)})]}):q(_t,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{borderRight:`1px solid`,borderRightColor:t,height:`100%`},style:{contain:`size`},children:q(X,{sx:{height:`100%`,alignItems:`stretch`},style:{contain:`strict`},spacing:0,children:[K(J,{sx:{display:`flex`,justifyContent:`flex-end`,p:`0px 10px`},children:K(Ll,{checksOnly:!0})}),K(fr,{}),K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(J,{sx:{textAlign:`center`,color:`grey.500`},children:`No checks`})})]})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(Kl,{})})})]})},Xl=()=>{let{isDark:e}=zt();return q(_t,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{borderRight:`1px solid`,borderRightColor:e?`grey.700`:`grey.300`,height:`100%`},style:{contain:`size`},children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(pr,{size:20})})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(pr,{size:20})})})]})},Zl={added:[`Model Added`,`Added resource`],removed:[`Model Removed`,`Removed resource`],modified:[`Model Modified`,`Modified resource`],col_added:[`Column Added`,`Added column`],col_removed:[`Column Removed`,`Removed column`],col_changed:[`Column Modified`,`Modified column`],folder_changed:[`Modified`,`Modified folder`]};function Ql(e){let t=String(Ee(`colors.green.solid`)),n=String(Ee(`colors.red.solid`)),r=String(Ee(`colors.amber.emphasized`));return e===`added`?{color:t,icon:at}:e===`removed`?{color:n,icon:ot}:e===`modified`?{color:r,icon:qt}:e===`col_added`?{color:t,icon:at}:e===`col_removed`?{color:n,icon:ot}:e===`col_changed`?{color:r,icon:qt}:e===`folder_changed`?{color:r,icon:Ne}:{color:`inherit`,icon:void 0}}function $l(e,t){let n=0,r=0,i=0;return!e&&!t?{adds:n,removes:r,modifies:i}:(t&&Object.keys(t.columns??{}).forEach(t=>{e?.columns?.[t]||n++}),e&&Object.keys(e.columns??{}).forEach(e=>{t?.columns?.[e]||r++}),t&&e&&Object.keys(t.columns??{}).forEach(n=>{e.columns&&t.columns?.[n]&&e.columns[n]&&e.columns[n].type!==t.columns[n].type&&i++}),{adds:n,removes:r,modifies:i})}function eu(e){let t=e.modifiedSet,n=0,r=0,i=0,a=0,o=0,s=0;return t.forEach(t=>{e.nodes[t].data.changeStatus===`added`?n++:e.nodes[t].data.changeStatus===`removed`?r++:e.nodes[t].data.changeStatus===`modified`&&i++;let c=e.nodes[t].data.change?.columns;if(c)for(let e of Object.values(c))e===`added`?a++:e===`removed`?o++:(e===`modified`||e===`unknown`)&&s++}),{adds:n,removes:r,modifies:i,col_added:a,col_removed:o,col_changed:s}}function tu({name:e,value:t,tip:n}){return q(X,{sx:{alignItems:`stretch`},children:[q(Z,{sx:{fontSize:`0.875rem`,color:`grey.600`},children:[e,n&&K($,{title:n,children:K(J,{sx:{display:`inline-block`},children:K(J,{component:Wi,sx:{mx:`2px`,fontSize:12,verticalAlign:`middle`}})})})]}),t]})}function nu({changeStatus:e,value:t}){let[n]=e?Zl[e]:[``],{icon:r,color:i}=Ql(e);return q(X,{sx:{alignItems:`stretch`},children:[q(X,{direction:`row`,sx:{alignItems:`center`,fontSize:`0.875rem`,color:`grey.600`},children:[r&&K(J,{component:r,sx:{mr:`5px`,color:i,fontSize:`1rem`}}),n]}),K(Z,{sx:{fontSize:`0.875rem`},children:t})]})}function ru({lineageGraph:e}){let{adds:t,removes:n,modifies:r,col_added:i,col_removed:a,col_changed:o}=eu(e);return q(va,{container:!0,sx:{mb:`10px`,borderTop:`1px solid`,borderColor:`divider`,p:`2.5vw`},children:[K(va,{size:6,sx:{borderColor:`divider`},children:K(tu,{name:`Code Changes`,value:q(va,{container:!0,sx:{width:`100%`},children:[K(va,{size:4,children:K(nu,{changeStatus:`added`,value:t})}),K(va,{size:4,children:K(nu,{changeStatus:`removed`,value:n})}),K(va,{size:4,children:K(nu,{changeStatus:`modified`,value:r})})]})})}),K(va,{size:6,sx:{borderLeft:`1px solid`,borderLeftColor:`divider`,pl:`12px`},children:K(tu,{name:`Column Changes`,value:q(va,{container:!0,sx:{width:`100%`},children:[K(va,{size:4,children:K(nu,{changeStatus:`col_added`,value:i})}),K(va,{size:4,children:K(nu,{changeStatus:`col_removed`,value:a})}),K(va,{size:4,children:K(nu,{changeStatus:`col_changed`,value:o})})]})})})]})}function iu({node:e,...t}){let{apiClient:r}=I(),{data:i,isLoading:a}=Hn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,r),enabled:!!r,staleTime:3e5}),o=i?.model;return q(wa,{sx:{maxWidth:500},children:[K(Ea,{title:K(Z,{sx:{fontSize:18,fontWeight:`bold`},children:t.title}),subheader:q(X,{direction:`row`,spacing:`8px`,sx:{p:`16px`},children:[K(nt,{resourceType:e.data.resourceType,materialized:e.data.materialized}),e.data.resourceType===`model`&&K(rc,{node:e})]})}),K(Ta,{children:K(J,{sx:{display:`flex`},children:a?K(ia,{variant:`rectangular`,width:`100%`,height:100}):K(Ds,{base:o?.base&&Object.keys(o.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...o.base}:void 0,current:o?.current&&Object.keys(o.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...o.current}:void 0,columnChanges:e.data.change?.columns})})})]})}function au(e){let t=[],n=e.nodes;return e.modifiedSet.forEach(e=>{let r=n[e];r.data.change?.columns&&Object.keys(r.data.change.columns).length>0&&t.push(r)}),t}function ou({lineageGraph:e}){let[t,n]=W([]);return V(()=>{n(au(e))},[e]),q(G,{children:[K(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`,mt:`20px`},children:K(Z,{variant:`h5`,sx:{fontSize:24},children:`Schema Summary`})}),K(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`},children:t.length===0?K(Z,{sx:{fontSize:18,color:`grey.600`},children:`No schema changes detected.`}):K(J,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(400px, 1fr))`,gap:`2vw`,p:`2.5vw`,width:`100%`,bgcolor:`lightgray`},children:t.map(e=>K(iu,{title:e.data.name,node:e},e.id))})})]})}function su({checks:e,isLoading:t,error:n,selectedCheckId:r,onCheckSelect:i,onApprovalChange:a,onAction:o,onReorder:s,onDescriptionChange:c,onNameChange:l,onCreateCheck:u,getCheckTabs:d,getPrimaryActions:f,getSecondaryActions:p,disableApproval:m=!1,disabledApprovalTooltip:h,height:g=`100%`,listPaneSize:_=30,minListSize:v=200,maxListSize:y=500,listTitle:b,className:x}){let S=Ke(),C=e??S.checks,w=t===void 0?S.isLoading:t,T=n??S.error,E=r??S.selectedCheckId,D=i??S.onSelectCheck,O=H(()=>C.map(e=>({id:e.check_id,name:e.name,type:e.type,description:e.description,isApproved:e.is_checked})),[C]),k=H(()=>C.find(e=>e.check_id===E),[C,E]),ee=B(e=>{D?.(e)},[D]),te=B((e,t)=>{o?.(e,t)},[o]),ne=B(e=>{E&&c?.(E,e)},[E,c]),A=B(e=>{E&&l?.(E,e)},[E,l]);if(w)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(pr,{})});if(T)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{color:`error`,children:T})});if(C.length===0)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(L,{title:`No checks yet`,description:`Create your first check to start validating your data.`,actionText:`Create Check`,onAction:u})});let j=k?d?.(k):void 0,M=k?f?.(k):void 0,N=k?p?.(k):void 0;return K(J,{className:x,sx:{width:`100%`,height:g},children:q(Ut,{direction:`horizontal`,sizes:[_,100-_],minSizes:[v,200],maxSizes:[y,1/0],children:[K(J,{sx:{height:`100%`,overflow:`auto`},children:K(ut,{checks:O,selectedId:E,onCheckSelect:ee,onApprovalChange:a,onReorder:s,disableApproval:m,disabledApprovalTooltip:h,title:b})}),K(J,{sx:{height:`100%`,overflow:`auto`},children:k?K(qe,{checkId:k.check_id,name:k.name,type:k.type,description:k.description,isApproved:k.is_checked,tabs:j,primaryActions:M,secondaryActions:N,onAction:te,onDescriptionChange:ne,onNameChange:A}):K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{sx:{color:`text.secondary`},children:`Select a check from the list to view details`})})})]})})}const cu=qn(su);cu.displayName=`ChecksView`;const lu=`0.2.0`;export{hs as A,vo as B,rc as C,ws as D,Zs as E,Yo as F,ka as H,Bo as I,So as L,cs as M,ss as N,Ds as O,$o as P,bo as R,pc as S,ic as T,Oa as U,Ma as V,il as _,eu as a,Wc as b,Zl as c,Jl as d,Kl as f,kl as g,Pl as h,ru as i,ps as j,Os as k,Xl as l,Fl as m,cu as n,$l as o,Ul as p,ou as r,Ql as s,lu as t,Yl as u,qc as v,ec as w,Ec as x,Gc as y,yo as z};
|
|
12
|
+
//# sourceMappingURL=src-wC_8HFG2.js.map
|