@datarecce/ui 1.64.0-nightly.20260907 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RouteConfigContext-367DdwY4.d.ts → RouteConfigContext--vAmbSFM.d.ts} +2 -2
- package/dist/{RouteConfigContext-367DdwY4.d.ts.map → RouteConfigContext--vAmbSFM.d.ts.map} +1 -1
- package/dist/advanced.d.ts +7 -7
- package/dist/advanced.js +1 -1
- package/dist/{api-B_skAKT6.d.ts → api-DHRfPMHD.d.ts} +2 -2
- package/dist/{api-B_skAKT6.d.ts.map → api-DHRfPMHD.d.ts.map} +1 -1
- package/dist/api-cPhVDn2I.js.map +1 -1
- package/dist/api.d.ts +3 -3
- package/dist/components-run.d.ts +2 -2
- package/dist/components-run.js +1 -1
- package/dist/components.d.ts +6 -6
- package/dist/components.js +1 -1
- package/dist/contexts.d.ts +4 -4
- package/dist/{hooks-BSxXEMR0.js → hooks-ThfMFiAt.js} +3 -3
- package/dist/hooks-ThfMFiAt.js.map +1 -0
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{index-CRa-1JsL.d.ts → index-DBJCYvR5.d.ts} +3 -3
- package/dist/{index-CRa-1JsL.d.ts.map → index-DBJCYvR5.d.ts.map} +1 -1
- package/dist/{index-CKe_lWCa.d.ts → index-DJDIPW8P.d.ts} +3 -3
- package/dist/{index-CKe_lWCa.d.ts.map → index-DJDIPW8P.d.ts.map} +1 -1
- package/dist/{index-uYf0lWvH.d.ts → index-Zr-xf-Xu.d.ts} +4 -4
- package/dist/{index-uYf0lWvH.d.ts.map → index-Zr-xf-Xu.d.ts.map} +1 -1
- package/dist/{index-BN6CHUlP.d.ts → index-aiXlnVHA.d.ts} +5 -5
- package/dist/{index-BN6CHUlP.d.ts.map → index-aiXlnVHA.d.ts.map} +1 -1
- package/dist/{index-w9QQM3lB.d.ts → index-wxLE0wgO.d.ts} +7 -7
- package/dist/{index-w9QQM3lB.d.ts.map → index-wxLE0wgO.d.ts.map} +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +1 -1
- package/dist/{instanceInfo-Du8rItaU.d.ts → instanceInfo-BJSksM8Y.d.ts} +38 -5
- package/dist/instanceInfo-BJSksM8Y.d.ts.map +1 -0
- package/dist/{lineage-ByaWpzhF.d.ts → lineage-CtdTcDRo.d.ts} +16 -12
- package/dist/{lineage-ByaWpzhF.d.ts.map → lineage-CtdTcDRo.d.ts.map} +1 -1
- package/dist/{primitives-TkFRmCop.d.ts → primitives-CUGBs6c7.d.ts} +4 -4
- package/dist/{primitives-TkFRmCop.d.ts.map → primitives-CUGBs6c7.d.ts.map} +1 -1
- package/dist/primitives.d.ts +3 -3
- package/dist/primitives.js +1 -1
- package/dist/result.js +1 -1
- package/dist/src-CLsh3QXf.js +12 -0
- package/dist/src-CLsh3QXf.js.map +1 -0
- package/dist/{types-C3QUIPi2.d.ts → types-D1yn0fSO.d.ts} +2 -2
- package/dist/{types-C3QUIPi2.d.ts.map → types-D1yn0fSO.d.ts.map} +1 -1
- package/dist/{types-BqB0C6yi.d.ts → types-GXcdehfJ.d.ts} +17 -3
- package/dist/types-GXcdehfJ.d.ts.map +1 -0
- package/dist/types.d.ts +7 -7
- package/dist/types.js.map +1 -1
- package/dist/utils-C20Vb3f6.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/hooks-BSxXEMR0.js.map +0 -1
- package/dist/instanceInfo-Du8rItaU.d.ts.map +0 -1
- package/dist/src-Bv9q0fda.js +0 -12
- package/dist/src-Bv9q0fda.js.map +0 -1
- package/dist/types-BqB0C6yi.d.ts.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-cPhVDn2I.js";import{c as ne,f as A}from"./keepAlive-ysOdIHPt.js";import{n as j,r as M,t as N}from"./fetchClient-CrlcoCZY.js";import{A as re,D as P,E as F,N as ie,S as ae,T as I,_ as oe,a as se,b as ce,c as le,d as ue,f as de,g as fe,h as pe,j as me,l as he,m as ge,o as _e,p as ve,s as ye,u as be,v as xe,x as Se,y as L}from"./utils-C20Vb3f6.js";import{S as Ce,T as we,a as Te,r as Ee,x as De}from"./theme-nKZCsBcx.js";import{$ as Oe,$t as ke,A as Ae,An as je,Bt as R,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 He,Ht as Ue,In as We,It as Ge,Jn as Ke,Jt as qe,Kt as Je,Ln as Ye,Mn as Xe,Nn as Ze,Nt as Qe,O as $e,On as et,Pn as tt,Pt as nt,Qt as z,Rn as rt,Rt as it,S as at,Sn as ot,Tn as st,Ut as ct,Vt as lt,Wn as ut,Wt as dt,Xt as ft,Yt as pt,an as mt,b as ht,bt as gt,cn as _t,ct as vt,d as yt,en as bt,f as xt,ft as St,gt as Ct,i as wt,in as Tt,it as Et,jn as Dt,jt as Ot,k as kt,kn as At,l as jt,lt as Mt,mn as Nt,n as Pt,nn as Ft,on as It,qn as Lt,qt as Rt,rn as zt,sn as Bt,t as Vt,tn as Ht,u as Ut,un as Wt,ut as Gt,vn as Kt,vt as qt,w as Jt,wn as Yt,xn as Xt,yt as Zt,z as Qt,zt as $t}from"./hooks-ThfMFiAt.js";import{Bt as en,Ht as tn,Rt as nn,Vt as rn,_ as an,c as on,dt as sn,l as cn,mt as ln,o as un,p as dn,r as fn,s as pn,t as mn}from"./utils-Uyt6wNnz.js";import{fetchGitHubAvatar as hn,fetchUser as gn}from"./lib/api/user.js";import{PUBLIC_API_URL as _n,PUBLIC_CLOUD_WEB_URL as vn,RECCE_SUPPORT_CALENDAR_URL as yn}from"./lib/const.js";import{EXPLORE_ACTION as bn,EXPLORE_SOURCE as xn,trackArtifactUploadStarted as Sn,trackColumnLevelLineage as Cn,trackCopyToClipboard as wn,trackDwSetupCompleted as Tn,trackDwSetupShown as En,trackDwSetupSkipped as Dn,trackEnvironmentConfig as On,trackExploreAction as kn,trackHistoryAction as An,trackInit as jn,trackLineageSelection as Mn,trackLineageViewRender as Nn,trackMultiNodesAction as Pn,trackNavigation as Fn,trackOssShareButtonClicked as In,trackProfileDistribution as Ln,trackRedirectToCloudSession as Rn,trackSignupCompleted as zn,trackSignupRedirectInitiated as Bn,trackStateAction as Vn}from"./lib/api/track.js";import{t as Hn}from"./constants-Bgp90yan.js";import{QueryClient as Un,QueryClientProvider as Wn,useMutation as Gn,useQuery as Kn,useQueryClient as qn}from"@tanstack/react-query";import{Suspense as Jn,createContext as Yn,forwardRef as Xn,memo as Zn,useCallback as B,useContext as Qn,useEffect as V,useId as $n,useImperativeHandle as er,useLayoutEffect as tr,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 nr from"@mui/material/Dialog";import rr from"@mui/material/DialogActions";import ir from"@mui/material/DialogContent";import ar from"@mui/material/DialogTitle";import or from"@mui/material/Link";import X from"@mui/material/Stack";import Z from"@mui/material/Typography";import sr from"js-cookie";import{LuExternalLink as cr,LuSave as lr}from"react-icons/lu";import{useTheme as ur}from"@mui/material/styles";import{useTheme as dr}from"next-themes";import Q from"@mui/material/IconButton";import fr from"next/link";import{IoBookmarksOutline as pr,IoClose as mr,IoSync as hr,IoWarning as gr}from"react-icons/io5";import _r from"@mui/material/Divider";import vr from"@mui/material/CircularProgress";import $ from"@mui/material/Tooltip";import{FaCloud as yr,FaExpandArrowsAlt as br,FaGithub as xr,FaQuestionCircle as Sr,FaRegDotCircle as Cr,FaSlack as wr,FaUser as Tr}from"react-icons/fa";import{PiBookmarkSimple as Er,PiCaretDown as Dr,PiChatText as Or,PiCheckCircle as kr,PiCircle as Ar,PiCopy as jr,PiExport as Mr,PiInfo as Nr,PiInfoFill as Pr,PiMoon as Fr,PiNotePencil as Ir,PiPencil as Lr,PiPencilSimple as Rr,PiPlusCircle as zr,PiRepeat as Br,PiSun as Vr,PiTrashFill as Hr,PiTrashSimple as Ur,PiUserPlus as Wr,PiX as Gr}from"react-icons/pi";import Kr from"@mui/material/Chip";import{Background as qr,BackgroundVariant as Jr,BaseEdge as Yr,ControlButton as Xr,Controls as Zr,MiniMap as Qr,Panel as $r,Position as ei,ReactFlow as ti,ReactFlowProvider as ni,getBezierPath as ri,getNodesBounds as ii,useEdgesState as ai,useNodesState as oi,useReactFlow as si,useStore as ci}from"@xyflow/react";import li from"@mui/material/Paper";import ui from"@mui/material/Popper";import di from"file-saver";import fi from"@mui/material/Checkbox";import pi from"@mui/material/FormControlLabel";import mi from"@mui/material/Alert";import hi from"@mui/material/InputBase";import gi from"@mui/material/Menu";import _i from"@mui/material/MenuItem";import{isEmpty as vi}from"lodash";import{VscCircleLarge as yi,VscGitPullRequest as bi,VscHistory as xi,VscKebabVertical as Si}from"react-icons/vsc";import Ci from"@mui/material/ListSubheader";import wi from"@mui/material/FormControl";import{Box as Ti,Typography as Ei}from"@mui/material";import Di from"@mui/material/TextField";import{format as Oi,formatDistanceToNow as ki}from"date-fns";import Ai from"@mui/material/Tab";import ji from"@mui/material/Tabs";import Mi from"@mui/material/List";import Ni from"@mui/material/ListItem";import Pi from"@mui/material/Avatar";import Fi from"@mui/material/Popover";import{usePathname as Ii,useRouter as Li,useSearchParams as Ri}from"next/navigation";import{MdArrowBack as zi,MdArrowDownward as Bi,MdArrowUpward as Vi,MdGpsFixed as Hi,MdInfo as Ui,MdSearch as Wi}from"react-icons/md";import{TbChecklist as Gi,TbEdit as Ki}from"react-icons/tb";import qi from"@mui/material/ListItemIcon";import Ji from"@mui/material/ListItemText";import{FiArrowRight as Yi,FiCopy as Xi,FiInfo as Zi,FiPackage as Qi}from"react-icons/fi";import $i from"@mui/material/Switch";import{RiArrowDownSFill as ea,RiArrowUpSFill as ta,RiMindMap as na,RiSwapLine as ra,RiTerminalBoxLine as ia}from"react-icons/ri";import{FaBookmark as aa,FaFileImport as oa}from"react-icons/fa6";import{captureException as sa}from"@sentry/react";import{BiArrowFromBottom as ca,BiArrowToBottom as la}from"react-icons/bi";import"@xyflow/react/dist/style.css";import ua from"@dagrejs/dagre";import da from"@mui/material/Skeleton";import fa from"@mui/material/Radio";import pa from"@mui/material/RadioGroup";import{snapdom as ma}from"@zumer/snapdom";import ha from"@mui/material/Table";import ga from"@mui/material/TableBody";import _a from"@mui/material/TableCell";import va from"@mui/material/TableContainer";import ya from"@mui/material/TableHead";import ba from"@mui/material/TableRow";import xa from"@mui/material/InputLabel";import Sa from"@mui/material/Select";import Ca from"@mui/material/Badge";import wa from"@mui/material/Grid";import{stripIndents as Ta}from"common-tags";import{IoMdCodeWorking as Ea}from"react-icons/io";import{DragDropContext as Da,Draggable as Oa,Droppable as ka}from"@hello-pangea/dnd";import Aa from"@mui/material/Card";import ja from"@mui/material/CardContent";import Ma from"@mui/material/CardHeader";const Na=Yn(null);Na.displayName=`RecceRoutingContext`;function Pa(){return Qn(Na)||{basePath:``,buildPath:e=>e,pathname:``,navigate:e=>{typeof window<`u`&&(window.location.href=e)}}}function Fa(){let{pathname:e,navigate:t}=Pa();return[e,t]}function Ia({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(Na.Provider,{value:s,children:e})}const La=e=>new Un({defaultOptions:{queries:{staleTime:e?.staleTime??6e4,gcTime:e?.gcTime??3e5,retry:1,refetchOnWindowFocus:!1}}});function Ra({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(()=>La({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(Ia,{config:r,children:y}),y=K(tn,{defaultMode:n,children:y}),y=K(ne,{config:t,children:y}),y=K(Wn,{client:f,children:y}),v&&(y=K(Ve,{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(Lt,{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(xe,{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(Se,{children:y})),p&&(y=K(I,{children:y})),y}function za({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(_r,{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 Ba(e){return e?{node_id:e,change_analysis:!0,no_upstream:!0}:{change_analysis:!0,no_upstream:!0}}function Va({nodeId:e,setChangeAnalysisMode:t,showColumnLevelLineage:n}){t?.(!0),n?.(Ba(e))}function Ha(e,t){return{node_id:e,column:t}}function Ua(e,t){return{...e,change_analysis:e.change_analysis??t}}function Wa({cllInput:e,changeAnalysisMode:t,newCllExperience:n}){return!e&&!n?!1:t}function Ga({changeAnalysisMode:e,newCllExperience:t}){return t&&e?Ba():void 0}function Ka({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 qa=({lineageGraph:e,cllInput:t,onCenterNode:n})=>{let r={cursor:`pointer`,fontFamily:`monospace`,bgcolor:rn()?`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]})]})},Ja=({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(Cr,{}),onClick:()=>{Va({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(qa,{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:Nr,sx:{color:`error.main`,fontSize:`14px`}})})}),e.isPending?K(vr,{size:12,sx:{ml:`2px`}}):K(Q,{size:`small`,sx:{ml:`2px`},"aria-label":`Reset Column Level Lineage`,onClick:()=>{s()},children:K(Gr,{size:`10px`})})]})]})};function Ya({onClose:e}){let{cancel:t,actionState:n}=oe();return K(za,{actionState:n,onCancel:t,onClose:e})}const Xa=({action:e})=>{let{showColumnLevelLineage:t,resetColumnLevelLineage:n,interactive:r,viewOptions:i,centerNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c}=oe(),{data:l}=de(),u=l?.single_env_onboarding??!1,{lineageGraph:d,isActionAvailable:f}=L();return K(Ja,{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 Za(e){let{id:t,data:n}=e,{id:r}=n.node,{column:i,type:a,transformationType:o,changeStatus:s,isImpacted:c,hiddenUpstreamColumnCount:l,hiddenDownstreamColumnCount:u}=n,d=ci(e=>e.transform[2]>Ze),{isDark:f}=Vt(),{viewOptions:p,showContextMenu:m,isNodeHighlighted:h,isNodeShowingChangeAnalysis:g,newCllExperience:_}=oe(),v=p.column_level_lineage?.node_id,y=i===p.column_level_lineage?.column&&r===v,b=h(t),x=g(r);return K(Xt,{id:t,data:{column:i,type:a,nodeId:r,transformationType:o,changeStatus:s,isHighlighted:b,isFocused:y,isImpacted:c,hiddenUpstreamColumnCount:l,hiddenDownstreamColumnCount:u},showContent:d,showChangeAnalysis:x,isDark:f,newCllExperience:_,onContextMenu:(t,n)=>{m(t,e)}})}const Qa=Zn(Za);Qa.displayName=`GraphColumnNode`;function $a(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=rn(),m=we(p),h=d?.changeStatus??`unchanged`,g=`${De[h].label} change`,_={stroke:m.structural.neutral.border,strokeDasharray:Ce[h],...l};!f||f(t,n)||(_.filter=tt);let[v]=ri({sourceX:r,sourceY:i,sourcePosition:s,targetX:a,targetY:o,targetPosition:c});return K(G,{children:K(Yr,{path:v,markerEnd:u,style:_,role:`img`,"aria-label":g})})}const eo=Zn($a);eo.displayName=`GraphEdge`;function to(e){let{isEdgeHighlighted:t}=oe();return K(eo,{...e,isEdgeHighlighted:t})}const no=()=>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`})}),ro=()=>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 io({skipReason:e}){return K(Kr,{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(no,{})})})]}),sx:{bgcolor:`grey.100`}})}function ao({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(ro,{})})})]})}function oo({result:e}){let{mismatchedColumns:t}=e,n=t>0;return K(Kr,{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 so({result:e}){let{base:t,current:n}=e,r=rn(),i=we(r).direction,a=dn(t,n),o=t!==null&&n!==null,s=t===null?`N/A`:t.toLocaleString(),c=n===null?`N/A`:n.toLocaleString(),l=``,u=i.foreground;return t!==null&&n!==null&&(l=a===`increase`?`↑`:a===`decrease`?`↓`:`=`),K(Kr,{size:`small`,sx:{...o?{bgcolor:i.background,border:`1px solid ${i.border}`,color:i.foreground}:{bgcolor:`grey.100`}},label:q(X,{direction:`row`,sx:{fontSize:`10pt`,alignItems:`center`,gap:`3px`},children:[K(J,{children:s}),K(J,{children:`→`}),K(J,{children:c}),l&&K(J,{component:`span`,"data-row-count-direction":a,sx:{color:u,ml:.5},children:l})]})})}function co({status:e,skipReason:t,errorMessage:n,progress:r,valueDiffResult:i,rowCountDiffResult:a,runId:o,"data-testid":s}){return e===`pending`?K(vr,{size:16,"data-testid":s,"data-status":`pending`}):e===`skipped`?K(J,{"data-testid":s,"data-status":`skipped`,children:K(io,{skipReason:t})}):e===`running`?r?.percentage===void 0?K(vr,{size:16,"data-testid":s,"data-status":`running`}):K(vr,{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(ao,{errorMessage:n})}):i?K(J,{"data-testid":s,"data-status":`success`,children:K(oo,{result:i})}):a?K(J,{"data-testid":s,"data-status":`success`,children:K(so,{result:a})}):K(J,{"data-testid":s,"data-status":`success`,children:o||`Complete`})}const lo=Zn(co);lo.displayName=`ActionTag`;const uo={success:`#059669`,failure:`#ef4444`,error:`#ef4444`,warning:`#f59e0b`},fo={success:`PASSED`,failure:`FAILED`,error:`ERROR`,warning:`WARNING`};function po(e){return uo[e]??`#6b7280`}function mo(e){return fo[e]??e.toUpperCase()}function ho({run:e,index:t,onClick:n}){let r=po(e.status),i=mo(e.status),a=ki(new Date(e.run_at),{addSuffix:!0}),o=!!n;return q(Ti,{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(Ei,{variant:`body2`,sx:{fontWeight:600,fontSize:`0.75rem`},children:[`Run #`,t,` — `,i,e.triggered_by===`recce_ai`&&K(Ei,{component:`span`,sx:{ml:.75,fontSize:`0.65rem`,fontWeight:500,color:`#7c3aed`},children:`by AI`})]}),e.summary&&K(Ei,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.7rem`,mt:.25},children:e.summary}),K(Ei,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mt:.25},children:a})]})}function go({event:e}){let t=p(e),n={create:zr,comment:Or,approve:kr,unapprove:Ar,edit:Ir,preset:Er},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 _o({event:e}){let{actor:t}=e,{avatarUrl:n}=$t({userId:t.user_id}),r=(t.fullname||t.login||`User`).charAt(0).toUpperCase();return K(Pi,{src:n||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:r})}function vo({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=ki(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(go,{event:e})}),K(J,{sx:{flex:1},children:q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[K(_o,{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 yo({event:e,currentUserId:t,onEdit:n,onDelete:r}){let i=rn(),[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=ki(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(go,{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(go,{event:e})}),q(J,{sx:{flex:1},children:[q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[K(_o,{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(Di,{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(St,{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(Rr,{})})}),r&&q(G,{children:[K($,{title:`Delete comment`,children:K(Q,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:w,children:K(Ur,{})})}),K(Fi,{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 bo({event:e,currentUserId:t,onEdit:n,onDelete:r}){return e.event_type===`comment`?K(yo,{event:e,currentUserId:t,onEdit:n,onDelete:r}):K(vo,{event:e})}function xo(e,t){let n=e?.toLowerCase();return n===`finished`?t?`error`:`success`:n===`failed`?`error`:e??`unknown`}function So(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 Co({checkId:t}){let n=rn(),{apiClient:r,authToken:i}=R(),{events:a,isLoading:o,error:s,createComment:c,isCreatingComment:l,updateComment:u,deleteComment:d}=jt(t),{data:f}=Kn({queryKey:A.user(),queryFn:()=>gn(r),retry:!1}),{data:p}=Kn({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:xo(e.status,e.error),summary:e.error||void 0,triggered_by:e.triggered_by})),enabled:!!i,staleTime:3e4}),m=H(()=>So(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(vr,{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(bo,{event:e.event,currentUserId:f?.id,onEdit:g,onDelete:_}):K(ho,{run:e.run,index:e.index}),t<m.length-1&&K(_r,{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(it,{onSubmit:h,isSubmitting:l})})]})}function wo({color:e}){return K(J,{component:`span`,sx:{display:`inline-block`,width:`10px`,height:`10px`,bgcolor:e,mr:1,borderRadius:`4px`}})}const To=({defaultPrimaryKeys:e,onPrimaryKeysChange:t,...n})=>{let{isActionAvailable:r}=L(),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(Nr,{fontSize:`0.75rem`})})})]}),K(Nt,{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 Eo({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:ia,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(mn(t,e),`_blank`)},children:`Connect to Data Warehouse`})})]})})}const Do=()=>{let{isCustomQueries:e,setCustomQueries:t,sqlQuery:n,setBaseSqlQuery:r}=ht();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(Pr,{fontSize:`1rem`})})})]}),K($i,{size:`small`,checked:e,onChange:()=>{!e&&r&&r(n),t(!e)},color:`primary`})]})},Oo=()=>{let{sqlQuery:e,baseSqlQuery:t,setSqlQuery:n,setBaseSqlQuery:r,primaryKeys:i,setPrimaryKeys:a,isCustomQueries:o}=ht(),{lineageGraph:c,envInfo:l}=L(),{featureToggles:u,singleEnv:d}=F(),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 ${yn}\n${f}`);let{showRunId:p}=me(),{apiClient:h}=R(),{mutate:g,isPending:_}=Gn({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(Bc,{}),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(ou,{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(Eo,{}):K(Fc,{})})]}):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(Bc,{}),K(Do,{}),K(J,{sx:{flexGrow:1}}),K(To,{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($e,{value:f,onChange:n,onRun:()=>{g(`query`)},onRunDiff:()=>{g(`query_diff`)}})})]})};function ko({rowCount:e,isDark:t}){let n=e.base,r=e.curr,i=we(t).direction,a=dn(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=`=`,l=i):a===`increase`?(c=`↑ ${an(n,r)} Rows`,l=i):(c=`↓ ${an(n,r)} Rows`,l=i);let u=Qt(`row_count_diff`).icon;return K(Kr,{size:`small`,icon:u?K(u,{}):void 0,label:c,"data-row-count-direction":a,sx:{height:20,fontSize:`0.7rem`,maxWidth:`100%`,...l&&{bgcolor:l.background,border:`1px solid ${l.border}`,color:l.foreground}}})}function Ao(e,t,n=`${t}s`){return`${e.toLocaleString()} ${e===1?t:n}`}function jo(e){let t=Ao(e.result_count,`result`);return e.types.value_diff?`${t} · ${Ao(e.types.value_diff.difference_count,`diff`)}`:t}function Mo(e){let t=e?.result_count;return typeof t==`number`&&Number.isFinite(t)&&t>0}function No({summary:e}){let{value_diff:t,profile_diff:n,top_k_diff:r,histogram_diff:i}=e.types;return q(X,{component:`dl`,spacing:.75,sx:{m:0},children:[t&&q(J,{children:[K(Z,{component:`dt`,variant:`caption`,sx:{fontWeight:600},children:`Value diff`}),q(Z,{component:`dd`,variant:`caption`,sx:{m:0},children:[Ao(1,`result`),` ·`,` `,Ao(t.difference_count,`diff`)]})]}),n&&q(J,{children:[K(Z,{component:`dt`,variant:`caption`,sx:{fontWeight:600},children:`Profile diff`}),K(Z,{component:`dd`,variant:`caption`,sx:{m:0},children:Ao(n.result_count,`result`)})]}),r&&q(J,{children:[K(Z,{component:`dt`,variant:`caption`,sx:{fontWeight:600},children:`Top-k diff`}),K(Z,{component:`dd`,variant:`caption`,sx:{m:0},children:Ao(r.column_count,`column`)})]}),i&&q(J,{children:[K(Z,{component:`dt`,variant:`caption`,sx:{fontWeight:600},children:`Histogram diff`}),K(Z,{component:`dd`,variant:`caption`,sx:{m:0},children:Ao(i.column_count,`column`)})]})]})}function Po({nodeId:e,nodeName:t,summary:n,onOpenAnalysis:r}){let[i,a]=W(!1),o=U(null),s=U(void 0),c=$n(),l=jo(n),u=B(()=>{s.current!==void 0&&(clearTimeout(s.current),s.current=void 0)},[]),d=B(()=>{u(),a(!0)},[u]),f=B(()=>{u(),a(!1)},[u]),p=B(()=>{u(),s.current=setTimeout(()=>a(!1),100)},[u]),m=B(()=>{document.activeElement!==o.current&&p()},[p]);V(()=>u,[u]);let h=e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),f(),o.current?.focus())},g=e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),f(),o.current?.focus())},_=e=>e.stopPropagation();return q(G,{children:[K(J,{ref:o,component:`button`,type:`button`,"aria-controls":i?c:void 0,"aria-expanded":i,"aria-haspopup":`dialog`,"aria-label":`Open validation analysis for ${t}: ${l}`,className:`nodrag nopan nokey`,onBlur:f,onClick:t=>{t.stopPropagation(),d(),r(e)},onDoubleClick:e=>e.stopPropagation(),onFocus:d,onKeyDown:h,onKeyUp:_,onMouseEnter:d,onMouseLeave:m,onPointerDown:e=>e.stopPropagation(),sx:{alignItems:`center`,appearance:`none`,background:`transparent`,border:0,color:`inherit`,cursor:`pointer`,display:`flex`,flex:`0 1 auto`,margin:0,maxWidth:150,minHeight:24,minWidth:0,padding:`2px 0`},children:K(Kr,{"data-testid":`validation-summary-chip`,label:l,size:`small`,variant:`outlined`,sx:{height:20,fontSize:`0.7rem`,maxWidth:`100%`,pointerEvents:`none`}})}),i&&K(ui,{open:!0,anchorEl:o.current,placement:`bottom-start`,sx:{zIndex:1500},children:K(li,{id:c,role:`dialog`,"aria-label":`${t} validation details`,className:`nodrag nopan nokey`,onClick:_,onContextMenu:_,onDoubleClick:_,onKeyDown:g,onKeyUp:_,onMouseDown:_,onMouseEnter:u,onMouseLeave:m,onPointerDown:_,sx:{minWidth:160,p:1.25},children:K(No,{summary:n})})})]})}function Fo({inverted:e,nodeId:t,nodeName:n,runs:r,schemaChanged:i,showValidationSummary:a,onOpenAnalysis:o}){let{text:s,isDark:c}=Vt(),l;if(r?.row_count_diff){let e=r.row_count_diff.result;l=e.curr!==e.base}let u=e?s.inverted:je(`modified`).color,d=e?s.secondary:c?`grey.700`:`grey.100`,f=Qt(`schema_diff`).icon;return q(J,{"data-testid":`node-runs-aggregated-display`,sx:{alignItems:`center`,display:`flex`,flex:1,gap:.5,minWidth:0,overflow:`hidden`},children:[i!==void 0&&K($,{title:`Schema (${i?`changed`:`no change`})`,enterDelay:500,children:K(J,{sx:{height:16},children:f&&K(J,{component:f,sx:{color:i?u:d}})})}),K(J,{sx:{flexGrow:1}}),a&&r?.validation_summary&&K(Po,{nodeId:t,nodeName:n,summary:r.validation_summary,onOpenAnalysis:o}),r?.row_count_diff&&l!==void 0&&K($,{title:`Row count (${l?`changed`:`=`})`,enterDelay:500,children:K(J,{sx:{maxWidth:120,minWidth:0,overflow:`hidden`},children:K(ko,{rowCount:r.row_count_diff.result,isDark:c})})})]})}function Io({nodeId:e,nodeName:t}){let{isDark:n}=Vt(),{getNodeAction:r}=oe(),i=r(e);if(!i)return null;let{status:a,skipReason:o,run:s}=i;if(a===`pending`)return K(lo,{status:`pending`});if(a===`skipped`)return K(lo,{status:`skipped`,skipReason:o});if(!s)return K(lo,{status:`pending`});let{error:c,run_id:l,progress:u}=s;if(a===`running`)return K(lo,{status:`running`,progress:{percentage:u?.percentage}});if(c)return K(lo,{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(lo,{status:`success`,valueDiffResult:{mismatchedColumns:t,totalColumns:n}})}if(y(s)&&s.result){let e=s.result[t];if(e)return K(ko,{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(Kr,{size:`small`,label:`${e.curr.toLocaleString()} Rows`,sx:{height:20,fontSize:`0.7rem`}})}return K(lo,{status:`success`,runId:l})}function Lo(e){let{data:t}=e,{id:n,resourceType:r,changeStatus:i,name:a}=t,o=ci(e=>e.transform[2]>Ze),{isDark:s}=Vt(),c=oe(),{runsAggregated:l}=L(),{interactive:u,openNodeDetails:d,selectNode:f,selectMode:p,focusedNode:m,getNodeAction:h,getNodeColumnSet:g,isNodeHighlighted:_,isNodeSelected:v,isNodeShowingChangeAnalysis:y,showContextMenu:b,viewOptions:x,cll:S,impactedNodeIds:C,newCllExperience:w}=c,T=w?C.has(n):!1,{isWholeModelChanged:E,isWholeModelImpacted:D}=mt(n,c),O=_t(S?.current.nodes[n]?.change_category,w?void 0:t.change?.category),k=_(n),ee=v(n),te=x.column_level_lineage?.node_id===n&&x.column_level_lineage.column===void 0,ne=m?.id===n||te,A=y(n),j=g(t.id),M=p===`action_result`?h(t.id):void 0,N=i,re=p,P=p===`action_result`&&M?K(Io,{nodeId:n,nodeName:a}):void 0,F=l?.[n],ie=t.change?.columns==null?void 0:Object.keys(t.change.columns).length>0,ae=Mo(F?.validation_summary),I=ie!==void 0||F?.row_count_diff!==void 0||ae,se=p!==`action_result`&&t.resourceType===`model`&&I?K(Fo,{inverted:p===`selecting`&&ee,nodeId:n,nodeName:a,onOpenAnalysis:e=>d(e,`analysis`),runs:F,schemaChanged:ie,showValidationSummary:ae}):void 0;return K(Ht,{id:n,data:{label:a,changeStatus:N,resourceType:r,materialized:t.materialized},newCllExperience:w,isImpacted:T,isWholeModelChanged:E,isWholeModelImpacted:D,interactive:u,selectMode:re,isNodeSelected:ee,isFocused:ne,isHighlighted:k,showContent:o,actionTag:P,showChangeAnalysis:A||!w&&O!==void 0,changeCategory:O,runsAggregatedTag:se,hasParents:Object.keys(t.parents).length>0,hasChildren:Object.keys(t.children).length>0,columnCount:j.size,columnHeight:24,isDark:s,onSelect:e=>{f(e)},onContextMenu:(t,n)=>{b(t,e)}})}const Ro=Zn(Lo);Ro.displayName=`GraphNode`;const zo={lineageGraphNode:Ro,lineageGraphColumnNode:Qa},Bo={lineageGraphEdge:to},Vo=[],Ho=(e={})=>t=>{let{impactedNodeIds:n,isDark:r,newCllExperience:i}=e;return Xe({changeStatus:t.data.changeStatus,isImpacted:i?n?.has(t.id):!1,newCllExperience:i},r).secondaryAccent},Uo={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`},Wo={LINEAGE_VIEW_CONTEXT_MENU:`lineage_view_context_menu`},Go={SELECT_PARENT_NODES:`select_parent_nodes`,SELECT_CHILD_NODES:`select_child_nodes`,SELECT_ALL_UPSTREAM:`select_all_upstream`,SELECT_ALL_DOWNSTREAM:`select_all_downstream`},Ko=({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(gi,{open:t,onClose:n,anchorReference:`anchorPosition`,anchorPosition:{top:i,left:r},slotProps:{paper:{sx:{fontSize:`0.85rem`,width:`250px`}}},children:e.length===0?K(_i,{disabled:!0,children:`No action available`},`no action`):e.map(({isSeparator:e,label:t,isDisabled:r,action:i,itemIcon:a})=>{if(e)return K(_r,{},t);let l=q(_i,{disabled:r,onClick:()=>{i&&i(),n()},children:[a,` `,t]},t);return r&&o?K(s,{display:c,children:l},t):l})})},qo=({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(Cr,{}),isDisabled:l||!u(`change_analysis`),action:()=>{Va({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=on(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?Uo.ROW_COUNT:Uo.ROW_COUNT_DIFF,source:Wo.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?Uo.PROFILE:Uo.PROFILE_DIFF,source:Wo.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:Uo.VALUE_DIFF,source:Wo.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(ca,{}),action:()=>{m?.(`lineage_selection`,{action:Go.SELECT_PARENT_NODES}),w?.(i.id,1)}}),d.push({label:`Select Child Nodes`,itemIcon:K(la,{}),action:()=>{m?.(`lineage_selection`,{action:Go.SELECT_CHILD_NODES}),T?.(i.id,1)}}),d.push({label:`Select All Upstream Nodes`,itemIcon:K(ca,{}),action:()=>{m?.(`lineage_selection`,{action:Go.SELECT_ALL_UPSTREAM}),w?.(i.id)}}),d.push({label:`Select All Downstream Nodes`,itemIcon:K(la,{}),action:()=>{m?.(`lineage_selection`,{action:Go.SELECT_ALL_DOWNSTREAM}),T?.(i.id)}})),K(Ko,{x:n,y:r,menuItems:d,open:e,onClose:t,featureToggles:s,DisabledItemWrapper:y})},Jo=({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:Uo.PROFILE_DIFF,source:Wo.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`profile_diff`,{model:v.name,columns:[y]},{showForm:!1,trackProps:x})},C=()=>{d?.(`explore_action`,{action:Uo.HISTOGRAM_DIFF,source:Wo.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:Uo.TOP_K_DIFF,source:Wo.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:Uo.VALUE_DIFF,source:Wo.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(Ko,{x:n,y:r,menuItems:l,open:e,onClose:t,featureToggles:o,DisabledItemWrapper:m})},Yo=({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(Ko,{menuItems:[],open:e,onClose:t,x:n,y:r,featureToggles:s,DisabledItemWrapper:a.DisabledItemWrapper}):i&&ge(i)?K(qo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,viewOptions:o,featureToggles:s,serverFlags:c,noCatalogCurrent:l,isActionAvailable:u}):i&&ve(i)?K(Jo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,featureToggles:s,serverFlags:c,isActionAvailable:u}):null,Xo=()=>{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 Zo({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(Fi,{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 Qo=()=>{let{isDark:e}=Vt(),{successToast:t,failToast:n}=sn();return yt({imageType:`png`,shadowEffect:!0,backgroundColor:e?Ee.neutral[900]:Ee.neutral[50],ignoreElements:e=>{try{return e.classList.contains(Ut)}catch{return e.className?e.className.includes(Ut):!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)}})},$o=()=>{let e=Li(),{basePath:t}=ie();return B(n=>{n.check_id&&e.push(`${t}/checks/?id=${n.check_id}`)},[e.push,t])},es=new Set;function ts(){let[e,t]=W(()=>new Set),[n,r]=W(()=>new Set),[i,a]=W(()=>es),[o,s]=W(()=>es);return{impactedNodeIds:e,impactedColumnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:o,publish:B(e=>{t(e.nodeIds),r(e.columnIds),a(e.wholeModelImpactedNodeIds),s(e.wholeModelChangedNodeIds)},[]),reset:B(()=>{t(new Set),r(new Set),a(es),s(es)},[])}}const ns=(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])},rs=()=>B((e,t,n,r,i)=>{let a=e.filter(ge),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),Nn(s)},[]),is=Yn(void 0);function as(e){let t=rn(),n=Qn(is);return K(Ht,{...e,isDark:t,onContextMenu:n})}function os(e){let t=rn();return K(Xt,{...e,isDark:t})}const ss={lineageNode:as,lineageGraphColumnNode:os},cs={lineageEdge:Kt};function ls({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=rn(),[m,h,g]=oi(e),[_,v,y]=ai(t),b=B((e,t)=>{n?.(t.id)},[n]),x=B(()=>{n?.(null)},[n]),S=B((e,t)=>{r?.(t.id)},[r]),C=B(e=>{let t=e.data;return Xe({changeStatus:t.changeStatus,isImpacted:t.isImpacted,newCllExperience:t.newCllExperience},p).secondaryAccent},[p]);return K(J,{sx:{width:`100%`,height:c},children:K(is.Provider,{value:i,children:q(ti,{nodes:m,edges:_,onNodesChange:l?g:void 0,onEdgesChange:l?y:void 0,onNodeClick:b,onNodeDoubleClick:S,onPaneClick:x,nodeTypes:ss,edgeTypes:cs,fitView:!0,fitViewOptions:f,minZoom:u,maxZoom:d,nodesDraggable:l,nodesConnectable:!1,elementsSelectable:l,children:[s&&K(qr,{}),o&&K(Zr,{}),a&&K(Qr,{nodeColor:C})]})})})}const us={row_count:bn.ROW_COUNT,row_count_diff:bn.ROW_COUNT_DIFF,value_diff:bn.VALUE_DIFF},ds=e=>{let t=us[e.action];t&&kn({action:t,source:xn.LINEAGE_VIEW_TOP_BAR,node_count:e.node_count})},fs=(e,t)=>Me(e,{...t,onTrackAction:ds,trackingSource:xn.LINEAGE_VIEW_TOP_BAR});function ps({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(mr,{})})]})}function ms(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 hs(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 gs(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 _s=e=>{let{runAction:t}=me(),{setSqlQuery:n,setPrimaryKeys:r}=ht(),i=Li(),{primaryKey:a}=wt(e),{basePath:o}=ie();return{runAction:(e,n,r)=>{t(e,n,r)},onNavigate:e=>{i.push(`${o}${e}`)},onTrack:(e,t)=>{e===`explore_action`?kn({action:t.action,source:Wo.LINEAGE_VIEW_CONTEXT_MENU,node_count:t.node_count}):e===`lineage_selection`&&Mn({action:t.action})},supportsHistogramDiff:Wt,findByRunType:e=>{let t=Qt(e);return t?{title:t.title,icon:t.icon}:void 0},setSqlQuery:n,setPrimaryKeys:r,getPrimaryKey:()=>a,DisabledItemWrapper:ou}},vs=({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}=oe(),{featureToggles:f}=F(),{isActionAvailable:p,lineageGraph:m}=L(),{data:h}=de(),g=!m?.catalogMetadata.current,_=i?.type===`lineageGraphNode`?i.data?.name:i?.type===`lineageGraphColumnNode`?i.data?.node?.name:void 0,v=_s(_);return K(Yo,{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})},ys=Xo;function bs(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:be(l.change_status)},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:ei.Left,sourcePosition:ei.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:ei.Left,sourcePosition:ei.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&&xs(n,r,c,a,f),n.some(e=>e.type===`lineageGraphNode`&&!o?.has(e.id))&&Cs(n,r),[n,r,l]}function xs(e,t,n,r,i){let a=Ss(n,r,i),o=new Set,s=new Map;for(let[t,c]of n){if(i&&!i.has(t))continue;let n=a.get(t);for(let i=0;i<c.length;i++){let a=c[i],l=`${t}_${a.column}`;o.add(l),s.set(l,{modelId:t,isImpacted:a.isImpacted});let u=r.current.columns[l];e.push({id:l,position:{x:10,y:64+i*24},parentId:t,draggable:!1,className:`no-track-pii-safe`,data:{node:{id:t},column:a.column,type:u?.type,transformationType:a.transformationType,changeStatus:a.changeStatus,isHighlighted:!0,isFocused:!1,isImpacted:a.isImpacted,hiddenUpstreamColumnCount:i===0?n?.upstreamColumnCount:void 0,hiddenDownstreamColumnCount:i===c.length-1?n?.downstreamColumnCount:void 0},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:ei.Left,sourcePosition:ei.Right})}if(c.length>0){let n=e.find(e=>e.id===t&&e.type===`lineageGraphNode`);n&&(n.height=80+c.length*24)}}for(let e of o){let n=r.current.parent_map[e]??[];for(let r of n)if(o.has(r)){let n=s.get(r)?.isImpacted??!1;t.push({id:`ancestry_${r}_${e}`,source:r,target:e,style:{zIndex:9999,strokeWidth:2,stroke:n?Le.impacted:Le.unchanged}})}}}function Ss(e,t,n){if(!n)return new Map;let r=n,i=new Map;for(let[t,n]of e)for(let e of n)i.set(`${t}_${e.column}`,t);function a(e,t,n){let a=[...e];for(;a.length>0;){let e=a.pop();if(!e||n.has(e))continue;let o=i.get(e);!o||r.has(o)||(n.add(e),a.push(...t[e]??[]))}}let o=new Map;for(let[n,i]of e){if(!r.has(n))continue;let e=new Set,s=new Set;for(let r of i){let i=`${n}_${r.column}`;a(t.current.parent_map[i]??[],t.current.parent_map,e),a(t.current.child_map[i]??[],t.current.child_map,s)}(e.size>0||s.size>0)&&o.set(n,{upstreamColumnCount:e.size||void 0,downstreamColumnCount:s.size||void 0})}return o}const Cs=(e,t,n=`LR`)=>{se(ua,e,t,n)},ws={};function Ts(e){return e?.type===`profile_distribution`?e.result:void 0}function Es(e){let t=0;for(let n of Object.values(e))n.kind===null&&(t+=1);return t}const Ds=e=>typeof performance<`u`?Math.round(performance.now()-e):0,Os=e=>M(e)&&e.status>=400&&e.status<500;function ks(e){let{model:t,columns:n,enabled:r=!0}=e,i=e.nodeId??t,{apiClient:a}=R(),{data:o}=de(),s=(o?.inline_profile??!1)&&r&&!!t,c=n?JSON.stringify(n):`*`,{data:l,error:u,isFetching:d}=Kn({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:xn.SCHEMA_VIEW}},a);return As(r,Ds(e)),r}catch(t){throw Ln({status:`error`,total_wall_ms:Ds(e),column_count:0,error_count:0}),Os(t)||sa(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:ws,baseTotal:0,currentTotal:0};let e=u??f??void 0;if(e)return{status:`error`,isLoading:!1,columns:ws,error:e,baseTotal:0,currentTotal:0};let t=Ts(l);return t?t.status===`unsupported`?{status:`unsupported`,isLoading:!1,columns:ws,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:ws,baseTotal:0,currentTotal:0}},[s,u,f,l,d])}function As(e,t){if(e.error){Ln({status:`error`,total_wall_ms:t,column_count:0,error_count:0});return}let n=Ts(e);if(!n||n.status===`unsupported`){Ln({status:`unsupported`,total_wall_ms:t,column_count:0,error_count:0});return}Ln({status:`ok`,strategy:n.strategy,total_wall_ms:t,column_count:Object.keys(n.columns).length,error_count:Es(n.columns),cache_hit:n.cache_hit})}function js({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)nn(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 Ms(){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 Ns(e,t){let n=e===`unchecked`,r=t===`unchecked`;return n&&r?`base and current environments`:n?`base environment`:r?`current environment`:`base/current environments`}function Ps({current:e,showMenu:t=!0},n){let r=fe(),[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}=L(),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;Cn({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(mi,{severity:`warning`,sx:{fontSize:`0.75rem`,p:1},children:m}):g?K(mi,{severity:`warning`,sx:{fontSize:`0.75rem`,p:1},children:g}):K(G,{}),l.length>0&&K(Zt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.833rem`,borderWidth:1},columns:c,rows:l,renderers:{noRowsFallback:K(qt,{})},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 Fs({base:e,current:t,showMenu:n=!0,columnChanges:r,onViewCode:i,headerAction:a},o){let s=fe(),{data:c}=de(),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,{lineageGraph:b,isActionAvailable:x,envInfo:S}=L(),C=y?b?.nodes[y]?.data:void 0,w=y?C?.schemaComparisonStatus??`unknown`:`not_applicable`,T=w===`unchecked`||w===`unknown`,E=Ns(C?.baseCatalogStatus,C?.currentCatalogStatus),D=E===`base environment`?`base catalog`:E===`current environment`?`current catalog`:E===`base and current environments`?`base and current catalogs`:`base/current catalogs`,O=S?.adapterType!==`sqlmesh`,k=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]),ee=h!=null&&h===y,te=s?.wholeModelChangedNodeIds?.has(y??``)??!1,{scopedColumns:ne,profileEnabled:A,profilingAll:j}=H(()=>js({newCllExperience:l,columnChanges:r,impactedColumns:_,nodeId:y,nodeColumnNames:k,wholeModelChange:te,profileAllColumns:ee}),[l,r,_,y,k,te,ee]),M=ks({model:v?.name,nodeId:y,columns:ne,enabled:A}),N=H(()=>{if(M.status!==`disabled`&&M.status!==`unsupported`)return{payloads:M.columns,baseTotal:M.baseTotal,currentTotal:M.currentTotal,isLoading:M.isLoading,hasError:M.status===`error`,scopedColumns:ne}},[M.status,M.columns,M.baseTotal,M.currentTotal,M.isLoading,ne]),{columns:re,rows:P}=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:N,schemaComparisonStatus:w}),[e,t,v,y,p,n,r,i,_,N,w]),F=x(`change_analysis`),ie=!b?.catalogMetadata.base,ae=!b?.catalogMetadata.current,I;ie&&ae?I="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":ie?I="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":ae&&(I="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let oe=e&&e.columns===void 0,se=t&&t.columns===void 0,ce;oe&&se?ce=`Node schema not found in catalog.json on both environments. Please regenerate your catalog.json to update.`:se?ce=`Node schema not found in catalog.json on current environment. Please regenerate your catalog.json to update.`:oe&&(ce=`Node schema not found in catalog.json on base environment. Please regenerate your catalog.json to update.`);let le=async n=>{if(!F)return;Cn({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))},ue=B(n=>`${t?.id??e?.id}-${n.data.name}`,[t?.id,e?.id]),pe=s?.viewOptions.column_level_lineage,me=pe?`${pe.node_id}-${pe.column}`:null;V(()=>{if(d&&(d.deselectAll(),me)){let e=d.getRowNode(me);e&&e.setSelected(!0)}},[d,me]);let he=B(e=>{f(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[T?q(mi,{severity:`warning`,"aria-label":`Incomplete schema comparison`,sx:{fontSize:`0.75rem`,p:1},children:[`Schema comparison incomplete for the `,E,`.`,` `,O?q(G,{children:[`Regenerate the `,D,` with`,` `,K(`code`,{children:`dbt docs generate`}),`, then rerun the comparison.`]}):q(G,{children:[`Refresh the `,E,` so this model's columns are resolved, then rerun the comparison.`]})]}):I?K(mi,{severity:`warning`,sx:{fontSize:`0.75rem`,p:1},children:I}):ce?K(mi,{severity:`warning`,sx:{fontSize:`0.75rem`,p:1},children:ce}):K(G,{}),q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,gap:1,pr:1},children:[K(Ms,{}),q(X,{direction:`row`,sx:{alignItems:`center`,gap:1},children:[l&&u&&v&&M.status!==`unsupported`&&!j&&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]})]}),M.status===`unsupported`&&K(J,{sx:{px:1,pb:.5},children:K(gt,{reason:M.unsupportedReason})}),P.length>0&&K(Zt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.8rem`,borderWidth:1},columns:re,rows:P,rowHeight:35,renderers:{noRowsFallback:K(qt,{})},className:`rdg-light no-track-pii-safe${l?` cll-experience`:``}`,ref:o,getRowId:ue,getRowClass:e=>{let t=e.data;if(!t)return`row-normal`;let n=Et(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&&F&&(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 le(t.name)},onGridReady:he,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}const Is=Xn(Fs),Ls=Xn(Ps);function Rs(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 zs={light:`rgb(252 211 77 / 0.18)`,dark:`rgb(252 211 77 / 0.10)`};function Bs(e){return e?At.dark:At.light}function Vs(e){return e?.data.changeStatus??`unchanged`}function Hs(e,t){return e===`unchanged`&&t?`impacted`:e}function Us(e,t){return e===`impacted`?Le.impacted:we(t).structural.secondaryAccent[e]}function Ws(e,t){return t?.[e]?.data.name??e}function Gs(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>Ws(e,n).toLowerCase().includes(r)):e}function Ks(e,t){return e?`Show all models`:t?`Show only impacting models`:`Show only impacted models`}function qs({status:e,cllImpacted:t}){let{isDark:n}=Vt(),r=Hs(e,t);return r===`impacted`?q(J,{component:`span`,"aria-label":`Impacted model`,"data-testid":`lineage-status-dot`,"data-status":r,sx:{alignItems:`center`,color:Bs(n),display:`inline-flex`,fontSize:`10px`,fontWeight:600,gap:`2px`,flex:`0 0 auto`},children:[K(Bi,{"aria-hidden":`true`,size:11}),K(`span`,{"aria-hidden":`true`,children:`Impacted`})]}):K(J,{component:`span`,"data-testid":`lineage-status-dot`,"data-status":r,sx:{display:`inline-flex`,flex:`0 0 auto`},children:K(en,{emphasis:`secondary`,showLabel:!0,size:`sm`,status:r})})}function Js({name:e,status:t,direction:n,decorateAsImpacted:r,dotImpacted:i,onClick:a}){let{isDark:o}=Vt(),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?zs.dark:zs.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:Le.impacted}}),K(qs,{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:Bs(o),flex:`0 0 auto`},children:K(Bi,{size:12})})})]})}function Ys({isDark:e,active:t}){return t?Fe.dark:e?et.dark:et.light}function Xs({isDark:e,active:t}){return t?`#fff`:e?At.dark:At.light}const Zs={display:`inline-flex`,alignItems:`center`,gap:`4px`,ml:.75,px:`7px`,py:`1px`,borderRadius:`999px`,fontSize:`10px`,fontWeight:600,letterSpacing:`0.02em`};function Qs({color:e}){return K(J,{component:`span`,"aria-hidden":`true`,sx:{width:`5px`,height:`5px`,borderRadius:`50%`,backgroundColor:e}})}function $s({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:{...Zs,backgroundColor:Ys(a),color:Xs(a),border:`none`,font:`inherit`,cursor:`pointer`,"&:hover":{filter:n?`brightness(0.95)`:`brightness(0.97)`}},children:[K(Qs,{color:Xs(a)}),e]})})}function ec({direction:e,directCount:t,impactCount:n,onlyImpact:r,onToggleOnlyImpact:i}){let a=e===`up`,o=a?Vi:Bi,{isDark:s,background:c}=Vt(),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($s,{label:d,title:Ks(r,a),active:r,isDark:s,onClick:i})]})}function tc({label:e}){return K(J,{sx:{px:1.5,py:1,fontSize:`11px`,color:`text.disabled`,fontStyle:`italic`},children:e})}function nc({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(Wi,{size:12,color:`currentColor`,opacity:.55}),K(hi,{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 rc({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 ic({node:e,onCenterFocus:t,cllImpacted:n}){let r=Hs(Vs(e),n),{isDark:i,background:a}=Vt(),o=Us(r,i),s=r===`impacted`?Bs(i):o,c=r===`impacted`?Bs(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(Hi,{size:14})})}),r===`impacted`?K(J,{component:`span`,"aria-label":`Impacted model`,sx:{fontSize:`10px`,fontWeight:600,px:.875,py:`2px`,borderRadius:`3px`,color:s,backgroundColor:`background.paper`,border:`1px solid`,borderColor:c,flex:`0 0 auto`},children:`↓ Impacted`}):K(en,{emphasis:`secondary`,showLabel:!0,size:`sm`,status:r})]})}function ac({previousName:e,currentName:t,onJumpBack:n}){let{isDark:r}=Vt();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 oc({node:e,nodesById:t,onNavigate:n,onBack:r,onCenterFocus:i,historyTrail:a,onJumpToHistory:o,impactingNodeIds:s,impactedNodeIds:c}){let{background:l}=Vt(),[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(()=>Gs(S,u,t),[S,u,t]),T=H(()=>Gs(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(nc,{direction:e,query:s,onChange:e=>{l(e),x(8)}}),i.length===0?K(tc,{label:ee}):o.length===0?K(tc,{label:`no matches`}):O.map(r=>K(Js,{name:Ws(r,t),status:Vs(t?.[r]),direction:e,decorateAsImpacted:D(r,e),dotImpacted:c?.has(r)??!1,onClick:n?()=>n(r):void 0},`${e}-${r}`)),k>0&&K(rc,{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(zi,{size:14})})}),te&&a?K(ac,{previousName:Ws(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(ec,{direction:`up`,directCount:S.length,impactCount:O,onlyImpact:v,onToggleOnlyImpact:()=>{y(e=>!e),h(8)}}),ee(`up`),K(ic,{node:e,onCenterFocus:i,cllImpacted:c?.has(e.id)??!1}),K(ec,{direction:`down`,directCount:C.length,impactCount:k,onlyImpact:b,onToggleOnlyImpact:()=>{x(e=>!e),_(8)}}),ee(`down`)]})]})}const sc=({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(br,{})}),q(nr,{open:o,onClose:()=>s(!1),maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{height:`75%`,overflowY:`auto`}}},children:[q(ar,{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(mr,{})})]}),K(ir,{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`})})]})]})},cc=({node:e})=>{let{data:t,isLoading:r}=de(),i=rn(),{apiClient:a}=R(),o=e.data.resourceType,s=o===`model`||o===`snapshot`,{data:c,isLoading:l}=Kn({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(da,{variant:`rectangular`,height:`100%`,animation:`wave`})}):K(sc,{node:e,modelDetail:c?.model,isSingleEnv:t?.single_env_onboarding??!1,CodeEditor:ct,DiffEditor:Ct,isDark:i})};function lc({rowCount:e}){return`base`in e?K(dc,{rowCount:e}):K(`span`,{children:uc(e.curr)})}function uc(e){return e===null?`N/A`:`${e.toLocaleString()} ${e===1?`row`:`rows`}`}function dc({rowCount:e}){let t=e.base,n=e.curr,r=rn(),i=we(r).direction,a=dn(t,n),o=uc(t),s=uc(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(Yi,{}),K(Z,{variant:`body2`,component:`span`,children:s})]}):t===null||n===null?K(G,{children:`Failed to load`}):a===`unchanged`?q(X,{component:`span`,"data-row-count-direction":`equal`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`,backgroundColor:i.background,border:`1px solid ${i.border}`,borderRadius:`6px`,color:i.foreground,px:.5},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{display:`flex`},children:K(ra,{})}),K(Z,{variant:`body2`,component:`span`,children:`No Change`})]}):a===`increase`&&t!==null&&n!==null?q(X,{component:`span`,"data-row-count-direction":`increase`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`,backgroundColor:i.background,border:`1px solid ${i.border}`,borderRadius:`6px`,color:i.foreground,px:.5},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{display:`flex`},children:K(ta,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:i.foreground},children:an(t,n)})]}):q(X,{component:`span`,"data-row-count-direction":`decrease`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`,backgroundColor:i.background,border:`1px solid ${i.border}`,borderRadius:`6px`,color:i.foreground,px:.5},children:[K(Z,{variant:`body2`,component:`span`,children:s}),K(J,{component:`span`,sx:{display:`flex`},children:K(ea,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:i.foreground},children:an(t,n)})]})}function fc({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=rn(),{featureToggles:a}=F(),{runsAggregated:o}=L(),s=o?.[t.id]?.row_count_diff?.result,c=Qt(`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(ou,{display:a.mode===`metadata only`,children:q(J,{component:`span`,sx:{...ke(i),gap:.5},children:[K(c,{}),u!=null||r?r?K(da,{width:30,height:16}):u==null?K(Z,{variant:`caption`,children:`row count`}):K(dc,{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(Br,{size:12})})]})})})}function pc({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=rn(),{runsAggregated:a}=L(),o=a?.[t.id]?.row_count?.result,s=Qt(`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:bt,children:K(s,{})}),l||r?r?K(da,{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(Br,{size:12})})]})}function mc({children:e,value:t,index:n}){return t===n?K(G,{children:e}):null}const hc=()=>K(`span`,{}),gc=({children:e})=>K(G,{children:e}),_c=()=>!0;function vc(e,t,n){return e?Hn.add_or_remove:n(t)?``:`This action is not supported yet.`}function yc({node:e,actionCallbacks:t,runTypeIcons:n,isActionAvailable:r,rowCountDisplay:i}){let a=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,o=n?.query??hc,s=n?.row_count??hc,c=n?.profile??hc;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:vc(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 bc({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 xc({node:e,actionCallbacks:t,runTypeIcons:n,featureToggles:r,isActionAvailable:i,ConnectionPopoverWrapper:a}){let o=r?.mode===`metadata only`,s=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,c=n?.profile_diff??hc,l=n?.value_diff??hc,u=n?.top_k_diff??hc,d=n?.histogram_diff??hc,f=(e,t)=>{if(o)return K(a,{display:!0,children:e});let n=vc(s,t,i);return K($,{title:n,placement:`top`,children:K(`span`,{children:e})})};return q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1},children:[f(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(c,{fontSize:`small`}),onClick:t?.onProfileDiffClick,disabled:s||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Profile`}),`profile_diff`),f(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(l,{fontSize:`small`}),onClick:t?.onValueDiffClick,disabled:s||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Value`}),`value_diff`),f(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(u,{fontSize:`small`}),onClick:t?.onTopKDiffClick,disabled:s||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Top-K`}),`top_k_diff`),f(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(d,{fontSize:`small`}),onClick:t?.onHistogramDiffClick,disabled:s||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Histogram`}),`histogram_diff`)]})}function Sc({label:e,onClick:t,Icon:n,featureToggles:r,ConnectionPopoverWrapper:i,rowCountDisplay:a}){return K(i,{display:r?.mode===`metadata only`,children:q(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(n,{fontSize:`small`}),onClick:t,disabled:r?.disableDatabaseQuery,sx:{textTransform:`none`,flexShrink:0},children:[e,e===`Row Count`&&a!=null&&q(G,{children:[`:\xA0`,a]})]})})}const Cc={profile_diff:`Profile`,value_diff:`Value`,top_k_diff:`Top-K`,histogram_diff:`Histogram`};function wc({runs:e,onViewRun:t}){return q(X,{sx:{gap:.5},children:[K(Z,{variant:`overline`,sx:{color:`text.secondary`,fontWeight:700,mt:2},children:`Recent`}),e.length===0?K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:`No recent analysis runs`}):e.map(e=>q(X,{direction:`row`,sx:{alignItems:`center`,gap:1,py:.75,borderBottom:1,borderColor:`divider`},children:[q(Z,{variant:`body2`,sx:{minWidth:0},children:[Cc[e.type],e.columnName?` · ${e.columnName}`:``]}),K(Z,{variant:`caption`,sx:{color:`text.secondary`,mr:`auto`},children:un(e.runAt)}),K(Y,{"aria-label":`View ${Cc[e.type]} result${e.columnName?` for ${e.columnName}`:``}`,size:`small`,variant:`text`,onClick:()=>t?.(e.id),sx:{minWidth:0,textTransform:`none`},children:`view ↗`})]},e.id))]})}function Tc({node:e,onCloseNode:t,isSingleEnv:n,featureToggles:r,modelDetail:i,lineageTabContent:a,SchemaView:o,SingleEnvSchemaView:s,NodeSqlView:c,ResourceTypeTag:l,NotificationComponent:u,ConnectionPopoverWrapper:d=gc,runTypeIcons:f,actionCallbacks:p,isActionAvailable:m=_c,isWholeModelChanged:h=!1,isWholeModelImpacted:g=!1,newCllExperience:_=!1,isImpacted:v=!1,rowCountDisplay:y,recentAnalysisRuns:b=[],onViewAnalysisRun:x,openRequest:S,onOpenRequestConsumed:C}){let w=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`source`||e.data.resourceType===`snapshot`,[T,E]=W(!0),[D,O]=W({nodeId:e.id,value:`columns`}),k=D.nodeId===e.id?D.value:`columns`,ee=t=>{O({nodeId:e.id,value:t})},{base:te,current:ne}=i??{},A=!n&&e.data.change?.columns!=null&&Object.keys(e.data.change.columns).length>0,j=!n&&e.data.changeStatus===`modified`,M=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`snapshot`,N=!n&&M,re=U(void 0);V(()=>{S!==void 0&&re.current!==S.requestToken&&S.nodeId===e.id&&S.view===`analysis`&&N&&(re.current=S.requestToken,O({nodeId:e.id,value:`analysis`}),C?.(S.requestToken))},[e.id,C,S,N]);let P=!n&&M&&p?.onAddSchemaDiffClick!=null,F=f?.schema_diff??hc,{isDark:ie}=Vt(),ae={newCllExperience:_,isWholeModelChanged:h,isWholeModelImpacted:g,isImpacted:v,changeCategory:e.data.change?.category},I=Tt(ae,ie),oe=zt({name:e.data.name,resourceType:e.data.resourceType,materialized:e.data.materialized},ae),se=_?void 0:Bt(e.data.change?.category);return q(J,{className:I?`cll-experience`:void 0,sx:{height:`100%`,display:`flex`,flexDirection:`column`,borderLeft:`3px solid ${I?I.tokens.stripeAccent:`transparent`}`},children:[q(X,{direction:`row`,sx:{alignItems:`center`,px:2,py:1.5,gap:1},children:[K($,{title:oe,placement:`top`,children:I?K(It,{tokens:I.tokens,variant:`titleChip`,testId:`whole-model-${I.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})}),se&&K(Kr,{"data-testid":`change-category-chip`,label:se,size:`small`,variant:`outlined`,sx:{flexShrink:0}}),N&&K(Sc,{label:`Row Count`,Icon:f?.row_count_diff??hc,onClick:p?.onRowCountDiffClick,featureToggles:r,ConnectionPopoverWrapper:d,rowCountDisplay:y}),K(Q,{"aria-label":`Close node details`,size:`small`,onClick:t,sx:{flexShrink:0},children:K(mr,{})})]}),M&&n&&K(J,{sx:{pl:2,py:1},children:K(yc,{node:e,actionCallbacks:p,runTypeIcons:f,isActionAvailable:m,rowCountDisplay:y})}),w&&q(J,{sx:{overflow:`auto`,display:`flex`,flexDirection:`column`,flex:1,minHeight:0},children:[n&&T&&u&&K(J,{sx:{p:1.5},children:K(u,{onClose:()=>E(!1),children:K(Z,{variant:`body2`,children:`Enable the Recce Checklist and start adding checks for better data validation and review.`})})}),q(ji,{value:k,onChange:(e,t)=>ee(t),sx:{borderBottom:1,borderColor:`divider`},children:[K(Ai,{value:`columns`,label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Columns`,A&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),K(Ai,{value:`code`,label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Code`,j&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),N&&K(Ai,{label:`Analysis`,value:`analysis`}),a&&K(Ai,{label:`Lineage`,value:`lineage`})]}),q(J,{sx:{overflow:`auto`,height:`calc(100% - 48px)`},children:[K(mc,{value:k,index:`columns`,children:K(J,{sx:{overflowY:`auto`,height:`100%`},children:n?s&&K(s,{current:ne}):o&&K(o,{base:te,current:ne,columnChanges:e.data.change?.columns,onViewCode:()=>ee(`code`),headerAction:P?K(bc,{onClick:p?.onAddSchemaDiffClick,Icon:F}):void 0})})}),K(mc,{value:k,index:`code`,children:q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[N&&K(J,{sx:{px:2,pt:1.5},children:K(Sc,{label:`Query`,Icon:f?.query_diff??hc,onClick:p?.onQueryDiffClick,featureToggles:r,ConnectionPopoverWrapper:d})}),c&&K(c,{node:e})]})}),N&&K(mc,{value:k,index:`analysis`,children:q(J,{sx:{p:2},children:[K(xc,{node:e,actionCallbacks:p,runTypeIcons:f,featureToggles:r,isActionAvailable:m,ConnectionPopoverWrapper:d}),K(wc,{runs:b,onViewRun:x})]})}),a&&K(mc,{value:k,index:`lineage`,children:K(J,{sx:{height:`100%`},children:a})})]})]})]})}const Ec=({node:e})=>K(z,{resourceType:e.data.resourceType,materialized:e.data.materialized}),Dc=new Set([`profile_diff`,`value_diff`,`top_k_diff`,`histogram_diff`]);function Oc(e){return Dc.has(e.type)}function kc({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(kt,{})]})})}function Ac({node:t,onCloseNode:r,openRequest:i,onOpenRequestConsumed:a,onNavigateToNode:o,onBack:s,onCenterFocused:c,historyTrail:l,onJumpToHistory:u}){let d=Li(),{runAction:f,showRunId:p}=me(),{isActionAvailable:m,envInfo:h,lineageGraph:g}=L(),_=fe(),{impactingNodeIds:v,impactedNodeIds:y}=H(()=>Rs(_?.cll),[_?.cll]),{singleEnv:x,featureToggles:S}=F(),{setSqlQuery:C,setPrimaryKeys:w}=ht(),{primaryKey:T}=wt(t.data.name),{apiClient:E}=R(),{basePath:D}=ie(),{runsAggregated:O}=L(),k=x??!1,ee=!k&&(t.data.resourceType===`model`||t.data.resourceType===`seed`||t.data.resourceType===`snapshot`),te=H(()=>{let e=O?.[t.id],n=k?e?.row_count?.result:e?.row_count_diff?.result;return n?K(lc,{rowCount:n}):void 0},[O,t.id,k]),{data:ne}=Kn({queryKey:[`modelDetail`,t.id],queryFn:()=>n(t.id,E),enabled:!!E,staleTime:3e5}),j=ne?.model,{data:M}=Kn({queryKey:A.runs(),queryFn:()=>e(E),enabled:ee&&!!E,retry:!1}),N=H(()=>(M??[]).filter(Oc).filter(e=>e.status!==`Running`&&e.params?.model===t.data.name).sort((e,t)=>new Date(t.run_at).getTime()-new Date(e.run_at).getTime()).map(e=>{let t=e.params;return{id:e.run_id,type:e.type,runAt:e.run_at,columnName:t!=null&&`column_name`in t&&typeof t.column_name==`string`?t.column_name:void 0}}),[M,t.data.name]),re=B(e=>p(e,!1),[p]),P=H(()=>({query:Qt(`query`).icon,row_count:Qt(`row_count`).icon,row_count_diff:Qt(`row_count_diff`).icon,profile:Qt(`profile`).icon,profile_diff:Qt(`profile_diff`).icon,query_diff:Qt(`query_diff`).icon,value_diff:Qt(`value_diff`).icon,top_k_diff:Qt(`top_k_diff`).icon,histogram_diff:Qt(`histogram_diff`).icon,schema_diff:Qt(`schema_diff`).icon}),[]),ae=Object.keys(j?.base?.columns??{}),I=Object.keys(j?.current?.columns??{}),oe=on(ae,I),se=H(()=>oe.length?`select \n ${oe.join(`
|
|
6
|
+
`)}\nfrom {{ ref("${t.data.name}") }}`:`select * from {{ ref("${t.data.name}") }}`,[oe,t.data.name]),ce=H(()=>({onQueryClick:()=>{h?.adapterType===`dbt`?C(se):h?.adapterType===`sqlmesh`&&C(`select * from ${t.data.name}`),d.push(`${D}/query`)},onRowCountClick:()=>{kn({action:bn.ROW_COUNT,source:xn.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),f(`row_count`,{node_names:[t.data.name]},{showForm:!1,showLast:!1})},onRowCountDiffClick:()=>{kn({action:bn.ROW_COUNT_DIFF,source:xn.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),f(`row_count_diff`,{node_names:[t.data.name]},{showForm:!1,showLast:!1})},onProfileClick:()=>{kn({action:bn.PROFILE,source:xn.NODE_SIDEBAR_SINGLE_ENV,node_count:1}),f(`profile`,{model:t.data.name},{showForm:!0,showLast:!1})},onProfileDiffClick:()=>{kn({action:bn.PROFILE_DIFF,source:xn.NODE_SIDEBAR_MULTI_ENV,node_count:1}),f(`profile_diff`,{model:t.data.name},{showForm:!0,showLast:!1})},onQueryDiffClick:()=>{h?.adapterType===`dbt`?C(se):h?.adapterType===`sqlmesh`&&C(`select * from ${t.data.name}`),m(`query_diff_with_primary_key`)&&w(T===void 0?void 0:[T]),d.push(`${D}/query`)},onValueDiffClick:()=>{kn({action:bn.VALUE_DIFF,source:xn.NODE_SIDEBAR_MULTI_ENV,node_count:1}),f(`value_diff`,{model:t.data.name},{showForm:!0,showLast:!1})},onTopKDiffClick:()=>{kn({action:bn.TOP_K_DIFF,source:xn.NODE_SIDEBAR_MULTI_ENV,node_count:1}),f(`top_k_diff`,{model:t.data.name,column_name:``,k:50},{showForm:!0})},onHistogramDiffClick:()=>{kn({action:bn.HISTOGRAM_DIFF,source:xn.NODE_SIDEBAR_MULTI_ENV,node_count:1}),f(`histogram_diff`,{model:t.data.name,column_name:``,column_type:``},{showForm:!0,submitOnSelection:!0,trackProps:{source:`lineage_model_node`}})},onAddSchemaDiffClick:async()=>{let e=await b({node_id:t.id},E);d.push(`${D}/checks/?id=${e.check_id}`)}}),[t,se,h,C,f,m,w,T,E,d.push,D]),le=_?mt(t.id,_):{isWholeModelChanged:!1,isWholeModelImpacted:!1};return K(Tc,{node:t,onCloseNode:r,openRequest:i,onOpenRequestConsumed:a,isSingleEnv:k,featureToggles:S,isWholeModelChanged:le.isWholeModelChanged,isWholeModelImpacted:le.isWholeModelImpacted,newCllExperience:_?.newCllExperience??!1,isImpacted:y?.has(t.id)??!1,modelDetail:(()=>{if(!j)return;let e=!!j.base&&Object.keys(j.base).length>0,n=!!j.current&&Object.keys(j.current).length>0;if(!(!e&&!n))return{base:e?{id:t.id,unique_id:t.id,name:t.data.name,resource_type:t.data.resourceType,package_name:t.data.packageName,...j.base}:void 0,current:n?{id:t.id,unique_id:t.id,name:t.data.name,resource_type:t.data.resourceType,package_name:t.data.packageName,...j.current}:void 0}})(),SchemaView:Is,SingleEnvSchemaView:Ls,NodeSqlView:cc,ResourceTypeTag:Ec,rowCountDisplay:te,recentAnalysisRuns:N,onViewAnalysisRun:re,NotificationComponent:kc,ConnectionPopoverWrapper:ou,runTypeIcons:P,actionCallbacks:ce,isActionAvailable:m,lineageTabContent:o?K(oc,{node:t,nodesById:g?.nodes,onNavigate:o,onBack:s,onCenterFocus:c,historyTrail:l,onJumpToHistory:u,impactingNodeIds:v,impactedNodeIds:y}):void 0})}function jc(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 Mc(e,t){if(!jc(e))return!1;let n=e.params?.model;return!n||t.length===0?!1:!t.filter(ge).some(e=>e.data.name===n)}function Nc({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:Nr}),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 Pc(e){let{featureToggles:t}=F(),{data:n}=P();return K(Nc,{featureToggles:e.featureToggles??t,settingsUrl:e.settingsUrl??mn(n,yn)})}function Fc({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:ia,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(Mi,{sx:{listStyleType:`disc`,pl:2},children:[K(Ni,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run statistical data diffs`})}),K(Ni,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run query diffs`})}),K(Ni,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Save checks to your Recce Checklist`})}),K(Ni,{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 Ic({docsUrl:e=`https://docs.reccehq.com/configure-diff/`}={}){return q(X,{direction:`row`,spacing:`10px`,sx:{alignItems:`flex-start`},children:[K(J,{component:na,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(Mi,{sx:{pl:2},children:[K(Ni,{sx:{p:0,display:`list-item`},children:K(Z,{sx:{fontSize:`0.875rem`},children:"Run `recce debug` for setup assistance"})}),K(Ni,{sx:{p:0,display:`list-item`},children:q(Z,{sx:{fontSize:`0.875rem`},children:[`Visit`,` `,K(or,{sx:{color:`primary.main`,fontWeight:500},target:`_blank`,href:e,children:`docs`}),` `,`for configuration details`]})})]})]})]})}function Lc(){return K(J,{sx:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(vr,{size:48})})}function Rc({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 zc({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 Bc(){let{isHistoryOpen:e,showHistory:t}=me();if(!e)return q(J,{children:[K(J,{sx:{fontSize:`8pt`},children:`History`}),K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(xi,{}),onClick:()=>{An({name:e?`hide`:`show`}),t()},children:`Show`})]})}const Vc=e=>({fontSize:`8pt`,bgcolor:e?`grey.700`:`grey.100`,px:.5,borderRadius:1}),Hc=()=>{let e=rn(),t=Vc(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`]})]})},Uc=({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=Dt(`model`).icon;return q(G,{children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,onClick:c,disabled:e,startIcon:d&&K(d,{}),endIcon:K(Dr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:s}),q(gi,{anchorEl:r,open:a,onClose:l,children:[K(Ci,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`mode`}),q(pa,{value:o,children:[K(_i,{onClick:()=>u(`changed_models`),children:K(pi,{value:`changed_models`,control:K(fa,{size:`small`,sx:{py:0}}),label:`Changed Models`,sx:{m:0}})}),K(_i,{onClick:()=>u(`all`),children:K(pi,{value:`all`,control:K(fa,{size:`small`,sx:{py:0}}),label:`All`,sx:{m:0}})})]})]})]})},Wc=({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(Qi,{}),endIcon:K(Dr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:p}),q(gi,{anchorEl:i,open:o,onClose:h,children:[K(Ci,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Select Packages`}),q(_i,{onClick:g,children:[K(fi,{checked:d,indeterminate:!d&&!f,size:`small`,sx:{py:0}}),K(Ji,{children:`Select All`})]}),K(_r,{}),Array.from(s).map(e=>q(_i,{onClick:()=>_(e),children:[K(fi,{checked:u.has(e),size:`small`,sx:{py:0}}),K(Ji,{className:`no-track-pii-safe`,children:e})]},e))]})]})},Gc=({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(Di,{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}}})})},Kc=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n,showTooltip:r})=>K(Gc,{isDisabled:e,value:t.select??``,onChange:e=>{n({...t,select:e||void 0})},tooltipComponent:K(Hc,{}),showTooltip:r}),qc=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n})=>K(Gc,{isDisabled:e,value:t.exclude??``,onChange:e=>{n({...t,exclude:e||void 0})}}),Jc=({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]}),Yc=({children:e})=>K(G,{children:e}),Xc=({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=Yc})=>{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(Jc,{label:`Mode`,style:{flexShrink:1},children:K(Uc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K(Jc,{label:`Package`,style:{flexShrink:1},children:K(Wc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,lineageGraph:n})}),K(Jc,{label:`Select`,style:{flexShrink:1},children:K(Kc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,showTooltip:g})}),K(Jc,{label:`Exclude`,style:{flexShrink:1},children:K(qc,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K(J,{sx:{flexGrow:1}}),b&&q(G,{children:[K(Jc,{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(Jc,{label:``,children:K(Y,{variant:`outlined`,color:`neutral`,size:`xsmall`,onClick:()=>{s()},sx:{textTransform:`none`,fontSize:`9pt`},children:`Deselect`})}),g&&K(Jc,{label:`Explore`,children:q(J,{sx:{display:`inline-flex`},children:[K(Y,{size:`xsmall`,color:`neutral`,variant:`outlined`,onClick:S,endIcon:K(Dr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),K(gi,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:q(_i,{disabled:r.disableDatabaseQuery,onClick:async()=>{await c?.(),C()},children:[K(qi,{children:K(w,{fontSize:`small`})}),K(Ji,{children:`Row Count`})]})})]})})]}),!g&&K(Jc,{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(Dr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),q(gi,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:[K(Ci,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Diff`}),K(h,{display:r.mode===`metadata only`,children:q(_i,{disabled:r.disableDatabaseQuery,onClick:async()=>{await l?.(),C()},children:[K(qi,{children:K(w,{fontSize:`small`})}),K(Ji,{children:`Row Count Diff`})]})}),K(h,{display:r.mode===`metadata only`,children:q(_i,{disabled:r.disableDatabaseQuery,onClick:async()=>{await u?.(),C()},children:[K(qi,{children:K(T,{fontSize:`small`})}),K(Ji,{children:`Value Diff`})]})}),(!r.disableUpdateChecklist||r.checklistPermissionDenied)&&[K(_r,{},`checklist-divider`),K(Ci,{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(_i,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(d?.(e.view_mode),C())},children:[K(qi,{children:K(E,{fontSize:`small`})}),K(Ji,{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(_i,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(f?.(),C())},children:[K(qi,{children:K(D,{fontSize:`small`})}),K(Ji,{children:`Schema Diff`})]})})},`add-schema-diff`)]]})]})})]})})},Zc=({display:e,children:t})=>K(ou,{display:e,children:t}),Qc=()=>{let{deselect:e,focusedNode:t,selectedNodes:n,viewOptions:r,onViewOptionsChanged:i,runRowCount:a,runRowCountDiff:o,runValueDiff:s,addLineageDiffCheck:c,addSchemaDiffCheck:l}=oe(),{lineageGraph:u}=L(),{featureToggles:d}=F(),{data:f}=de(),p={rowCountDiff:Qt(`row_count_diff`).icon,valueDiff:Qt(`value_diff`).icon,lineageDiff:Qt(`lineage_diff`).icon,schemaDiff:Qt(`schema_diff`).icon};return K(Xc,{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(Bc,{}),SetupConnectionPopoverSlot:Zc})};function $c(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 el(e,t){return!!e.change_analysis&&!!t}function tl(e,t){let n=e.getQueryData(A.lineage()),r=e.setQueryData(A.lineage(),e=>e&&{...e,lineage:$c(e.lineage,t)});return n!==void 0&&r!==n}const nl=Object.keys({node_id:!0,column:!0,change_analysis:!0,no_cll:!0,no_upstream:!0,no_downstream:!0});function rl(e,t){return nl.every(n=>e[n]===t[n])}function il(e){let t={};for(let n of nl)t[n]=e[n];return t}function al(){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=Ua(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(el(s,l)){let t={apiInput:il(s),resolution:u};e=t,!tl(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&&rl(e.apiInput,il(Ua(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 ol(){let e=[];return{push(t){e.push({input:t})},peek(){return e[e.length-1]},pop(){return e.pop()},async restore(t){let n=e[e.length-1];return!n||!await t(n.input)||e[e.length-1]!==n?!1:(e.pop(),!0)},reset(){e.length=0}}}function sl({apiClient:e,queryClient:t}){let[n,i]=W(),[a]=W(ol),[o]=W(al),s=U(0),{impactedNodeIds:c,impactedColumnIds:l,wholeModelImpactedNodeIds:u,wholeModelChangedNodeIds:d,publish:f,reset:p}=ts(),m=Gn({mutationFn:t=>r(t,e)},t),h=m.mutateAsync,g=m.reset,_=H(()=>({mutateAsync:h}),[h]),v=B(e=>({...e,actionGetCll:_,queryClient:t}),[_,t]),y=B(e=>o.resolveCllForLayout(v(e)),[v,o]),b=B(e=>o.refreshCll(v(e)),[v,o]),x=B(e=>{i(e)},[]),S=B(()=>++s.current,[]),C=B(e=>s.current===e,[]),w=B(()=>{++s.current,o.invalidate()},[o]),T=B(()=>{w(),a.reset(),i(void 0),p(),g()},[a,w,p,g]);return V(()=>()=>{++s.current,o.invalidate(),a.reset()},[a,o]),{cll:n,action:m,commit:x,resolveForLayout:y,refresh:b,invalidate:w,supersedeInteraction:S,isInteractionCurrent:C,history:a,impactedNodeIds:c,impactedColumnIds:l,wholeModelImpactedNodeIds:u,wholeModelChangedNodeIds:d,publishImpactSets:f,reset:T}}function cl(e,t){return e===t?void 0:t}function ll(e,t,n){return{nodeId:t,view:n,requestToken:e+1}}function ul(e,t){let n=ms(t),r=new Set;for(let i of Object.keys(e.nodes)){let a=e.nodes[i];hs(i,t,a.data.changeStatus,n)&&r.add(i)}let{wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:a}=gs(e,t);return{nodeIds:r,columnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:a}}function dl(e,t,n,r){return e&&t&&n?.node_id&&n?.column?ue(t,n.node_id,n.column,r??new Set):void 0}function fl({interactive:e=!1,...t},n){let{isDark:r}=Vt(),{apiClient:i}=R(),a=qn(),o=si(),s=ci(e=>e.transform[2]>Ze),c=U(null),{copyToClipboard:l,ImageDownloadModal:u,ref:f}=Qo(),[p,m,h]=oi(Vo),[g,_,v]=ai([]),{lineageGraph:y,refetchLineageGraph:x,isLoading:S,error:w,refetchRunsAggregated:T}=L(),{featureToggles:E,singleEnv:D}=F(),{data:O}=de(),k=O?.new_cll_experience??!1,{runId:ee,showRunId:te,closeRunResult:ne,runAction:j,isRunResultOpen:M}=me(),{run:re}=Pt(ee),[P,ie]=W({...t.viewOptions}),ae=rs(),{cll:I,action:oe,commit:se,resolveForLayout:ce,refresh:le,invalidate:ue,supersedeInteraction:fe,isInteractionCurrent:be,history:xe,impactedNodeIds:Se,impactedColumnIds:Ce,wholeModelImpactedNodeIds:we,wholeModelChangedNodeIds:Te,publishImpactSets:De}=sl({apiClient:i,queryClient:a}),[Oe,ke]=W(!1),Ae=U(!1);Ae.current=Oe;let je=U(0),Me=U(void 0),Ne=U(void 0),[Pe,Fe]=W(0),Ie=B(()=>Fe(e=>e+1),[]),[Le,Re]=W({});tr(()=>()=>{++je.current,ue()},[ue]);let Be=B(e=>p.filter(ge).find(t=>t.data.name===e),[p]);er(n,()=>({copyToClipboard:l}));let Ve=H(()=>!!(y&&y.modifiedSet.length>0),[y]),He=H(()=>s?rt(p,e=>Ka({nodeId:e,changeAnalysisMode:Oe,cllInput:P.column_level_lineage,lineageGraph:y})):[],[p,s,Oe,P.column_level_lineage,y]),Ue=P.view_mode??`changed_models`,Ge=H(()=>p.filter(e=>e.type===`lineageGraphNode`).map(e=>e.id),[p]),Ke=H(()=>y?Ge.map(e=>y.nodes[e]):[],[y,Ge]),[qe,Je]=W(),[Xe,Qe]=W(),$e=U(0),et=qe?y?.nodes[qe]:void 0,[tt,nt]=W([]),[z,it]=W(),[at,ot]=W(new Set),st=H(()=>y?Array.from(at).map(e=>y.nodes[e]):[],[y,at]),ct=fs(st.length>0?st:Ke,{onActionStarted:()=>{fe(),it(`action_result`)},onActionNodeUpdated:e=>{m(t=>t.map(t=>t.id===e.id?{...t}:t))},onActionCompleted:()=>{}}),lt=B(()=>{let e=new Map,t=o.getNodes();for(let n of t)!n.parentId&&n.position&&e.set(n.id,{x:n.position.x,y:n.position.y});return e},[o]),ut=H(()=>{if(!y)return new Set;let e=new Set;if(I){for(let[t,n]of Object.entries(I.current.nodes))n.impacted!==!1&&e.add(t);for(let t of Object.keys(I.current.columns))e.add(t)}else if(z===`action_result`){let t=Object.keys(ct.actionState.actions);e=new Set(t)}else e=et?he(ye(y,[et.id]),_e(y,[et.id])):Ve?_e(y,y.modifiedSet):new Set(Ge);return new Set(e)},[y,I,z,et,Ve,ct.actionState.actions,Ge]),dt=ys(),ft=()=>{dt.closeContextMenu()},pt=U(!1),mt=H(()=>Ho({impactedNodeIds:Se,isDark:r,newCllExperience:k}),[Se,r,k]);tr(()=>{let e=++je.current,n=()=>je.current===e,r=()=>{O?.impact_at_startup&&!pt.current&&Ie()};return(async()=>{let e;if(!y){ce({cllInput:void 0,changeAnalysis:Ae.current});return}if(P.node_ids)e=P.node_ids;else{let a=y.manifestMetadata.current?.project_name,o={view_mode:P.view_mode??(Ve?`changed_models`:`all`),packages:a?[a]:void 0,...t.viewOptions};try{let t=await C({select:o.select,exclude:o.exclude,packages:o.packages,view_mode:o.view_mode},i);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},i);if(!n()){r();return}e=t.nodes}ie(o)}let a=P.column_level_lineage,o=!1;O?.impact_at_startup&&!pt.current&&!a&&(pt.current=!0,o=!0,Ae.current=!0,ke(!0),a=Ba(),ie(e=>({...e,column_level_lineage:a})));let s;try{let e=await ce({cllInput:a,changeAnalysis:Ae.current});if(!n()||!e.isCurrent())return;s=e.cll}catch(e){if(!n())return;if(o&&(Ae.current=!1,ke(!1),ie(e=>({...e,column_level_lineage:void 0})),a=void 0),e instanceof N){ln.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}let c=k&&s?ul(y,s):void 0,[l,u,d]=await bs(y,{selectedNodes:e,cll:s,newCllExperience:k,columnAncestry:dl(k,s,a,c?.columnIds)});n()&&(m(l),_(u),Re(d),se(s),c&&a?.change_analysis&&!a?.column&&De(c),ae(l,P.view_mode??`changed_models`,Ae.current,!!a?.column,!!qe||!!re))})(),()=>{n()&&je.current++}},[y,O?.impact_at_startup,Pe]);let ht=()=>{fe(),Je(void 0),Qe(void 0),nt([])},gt=(e,t)=>{if(!y?.nodes[e])return;fe();let n=ll($e.current,e,t);$e.current=n.requestToken,Qe(n),Je(e),nt([])},_t=B(e=>{Qe(t=>t?.requestToken===e?void 0:t)},[]),yt=e=>{y?.nodes[e]&&(fe(),Qe(void 0),qe!==e&&(qe&&qe!==e&&nt(e=>[...e,qe]),Je(e)))},bt=()=>{if(tt.length===0)return;let e=tt[tt.length-1];y?.nodes[e]&&(fe(),Qe(void 0),Je(e),nt(e=>e.slice(0,-1)))},xt=e=>{if(e<0||e>=tt.length)return;let t=tt[e];y?.nodes[t]&&(fe(),Qe(void 0),Je(t),nt(t=>t.slice(0,e)))},St=()=>{qe&&Ct(qe)},Ct=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=o.getZoom();await o.setCenter(r,i,{zoom:a,duration:200})}}}},wt=$o();ns(c,async()=>{z!==`selecting`&&(qe?await Ct(qe):await o.fitView({nodes:p,duration:200,padding:We,minZoom:Ye,maxZoom:1}))});let Tt=async(e,t=!1)=>{let n=fe(),r=P.column_level_lineage,i=Wa({cllInput:e,changeAnalysisMode:Oe,newCllExperience:k});i!==Oe&&ke(i);let a=r!==void 0;return await jt({...P,column_level_lineage:e},!1,a,n),be(n)?(t||xe.push(r),e?.node_id?Je(e.node_id):e||Je(void 0),!0):!1},Et=async e=>{await Tt(e)},Dt=async e=>{e?await xe.restore(e=>Tt(e,!0)):await Tt(Ga({changeAnalysisMode:Oe,newCllExperience:k}),!0)},Ot=(e,t)=>{z||Et(Ha(t.data.node.id,t.data.column))},kt=(t,n)=>{if(e&&y){if(ve(n)){Ot(t,n);return}if(ft(),fe(),Qe(void 0),!z)Je(cl(qe,n.id)),nt([]);else if(z===`action_result`){let e=ct.actionState.actions[n.id];e.run?.run_id&&te(e.run.run_id),Je(n.id),nt([])}else{let e=new Set(at);at.has(n.id)?e.delete(n.id):e.add(n.id),ot(e),e.size===0&&it(void 0)}}},At=async e=>{let t=++je.current,n=()=>je.current===t,r=()=>{n()&&(je.current++,Ie())},{viewOptions:a=P}=e,{fitView:s,preservePositions:c=!1}=e,l;if(!y){le({cllInput:void 0,changeAnalysis:Oe});return}if(P.select!==a.select||P.exclude!==a.exclude||P.packages!==a.packages||P.view_mode!==a.view_mode){try{let e=await C({select:a.select,exclude:a.exclude,packages:a.packages,view_mode:a.view_mode},i);if(!n())return;a={...a,column_level_lineage:void 0},l=e.nodes}catch(e){if(!n())return;e instanceof N&&ln.create({title:`Select node error`,description:e.data?.detail??e.message,type:`error`,closable:!0}),r();return}Je(void 0)}else l=p.map(e=>e.id);let u;try{let e=await le({cllInput:a.column_level_lineage,changeAnalysis:Oe});if(!n()||!e.isCurrent())return;u=e.cll}catch(e){if(!n())return;if(e instanceof N){ln.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}if(!a.column_level_lineage){let e=Wa({cllInput:void 0,changeAnalysisMode:Oe,newCllExperience:k});e!==Oe&&ke(e)}let d;(c||k)&&(d=lt());let f=a.column_level_lineage,h=k&&u?ul(y,u):void 0,[g,v,b]=await bs(y,{selectedNodes:l,cll:u,existingPositions:d,newCllExperience:k,columnAncestry:dl(k,u,f,h?.columnIds)});if(n()&&(m(g),_(v),Re(b),se(u),h&&!f?.column&&De(h),ae(g,a.view_mode??`changed_models`,Oe,!!a.column_level_lineage?.column,!!qe||!!re),Mc(re,p)&&ne(),s)){if(await new Promise(e=>setTimeout(e,1)),!n())return;o.fitView({nodes:g,duration:200,padding:We,minZoom:Ye,maxZoom:1})}},jt=async(e,t=!0,n=!1,r)=>{r===void 0&&fe(),ie(e),await At({viewOptions:e,fitView:t,preservePositions:n})};V(()=>{let t=re?.type;if(!e){Me.current=void 0,Ne.current=void 0;return}if(!M){Me.current=void 0,Ne.current=void 0;return}if(!t||[`query_diff`,`query`,`row_count`,`row_count_diff`].includes(t)){Me.current=void 0,Ne.current=void 0;return}if(z){Me.current=void 0,Ne.current=void 0;return}let n=jc(re)?re.params?.model:void 0,r=JSON.stringify([ee??re.run_id,t,n]),i=Me.current!==r,a=Ne.current,o=a?.key===r&&be(a.interactionGeneration);if(!i&&!o){Ne.current=void 0;return}let s=a?.interactionGeneration;if(i&&(s=fe(),Me.current=r,Ne.current=void 0),n){let e=Be(n);if(!e){i&&s!==void 0&&(Ne.current={key:r,interactionGeneration:s},jt({...P,view_mode:`all`},!0,!1,s));return}Ne.current=void 0,ge(e)&&et?.id!==e.id&&(ft(),Je(e.id),nt([]))}else Ne.current=void 0,Je(void 0),nt([])},[re,ee,P,M,z,Be,et,e]);let Mt=(e,t=1e3)=>{if(z===`action_result`||y===void 0||!y.nodes[e])return;let n=ye(y,[e],t);fe(),!(z===`selecting`&&Array.from(n).every(e=>at.has(e)))&&(z||(it(`selecting`),ct.reset(),P.column_level_lineage&&jt({...P,column_level_lineage:void 0})),ot(he(at,n)))},Nt=(e,t=1e3)=>{if(z===`action_result`||y===void 0||!y.nodes[e])return;let n=_e(y,[e],t);fe(),!(z===`selecting`&&Array.from(n).every(e=>at.has(e)))&&(z||(it(`selecting`),ct.reset(),P.column_level_lineage&&jt({...P,column_level_lineage:void 0})),ot(he(at,n)))},It=(t,n)=>{if(!e||z===`action_result`)return;t.preventDefault();let r=f.current,i=r.getBoundingClientRect(),a=t.clientX-i.left,o=t.clientY-i.top+r.offsetTop;dt.showContextMenu(a,o,n)},Lt=e=>{if(!z){if(!y?.nodes[e])return;fe(),ot(new Set([e])),it(`selecting`),Je(void 0),ct.reset()}else if(z===`selecting`){if(!y?.nodes[e])return;fe();let t=new Set(at);at.has(e)?t.delete(e):t.add(e),ot(t),t.size===0&&it(void 0)}},Rt=()=>{fe(),it(void 0),ot(new Set),Je(void 0),ne(),T?.()},zt={interactive:e,nodes:p,focusedNode:et,selectedNodes:st,viewOptions:P,showContextMenu:It,onViewOptionsChanged:jt,selectMode:z,selectNode:Lt,openNodeDetails:gt,selectParentNodes:Mt,selectChildNodes:Nt,deselect:Rt,impactedNodeIds:Se,impactedColumnIds:Ce,wholeModelChangedNodeIds:Te,wholeModelImpactedNodeIds:we,isNodeHighlighted:e=>ut.has(e),isNodeSelected:e=>at.has(e),isEdgeHighlighted:(e,t)=>I?e in I.current.parent_map&&t in I.current.parent_map[e]:ut.has(e)&&ut.has(t),isNodeShowingChangeAnalysis:e=>Ka({nodeId:e,changeAnalysisMode:Oe,cllInput:P.column_level_lineage,lineageGraph:y}),changeAnalysisMode:Oe,newCllExperience:k,setChangeAnalysisMode:ke,getNodeAction:e=>ct.actionState.actions[e],getNodeColumnSet:e=>e in Le?new Set(Le[e]):new Set,runRowCount:async()=>{z===`selecting`?(await ct.runRowCount(),Pn({type:`row_count`,selected:`multi`})):et?(j(`row_count`,{node_names:[et.data.name]},{showForm:!1,showLast:!1}),Pn({type:`row_count`,selected:`single`})):(j(`row_count`,{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),Pn({type:`row_count`,selected:`none`}))},runRowCountDiff:async()=>{z===`selecting`?(await ct.runRowCountDiff(),Pn({type:`row_count_diff`,selected:`multi`})):et?(j(`row_count_diff`,{node_names:[et.data.name]},{showForm:!1,showLast:!1}),Pn({type:`row_count_diff`,selected:`single`})):(j(`row_count_diff`,{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),Pn({type:`row_count_diff`,selected:`none`}))},runValueDiff:async()=>{et?(j(`value_diff`,{model:et.data.name},{showForm:!0,showLast:!1}),Pn({type:`value_diff`,selected:`single`})):(await ct.runValueDiff(),Pn({type:`value_diff`,selected:z===`selecting`?`multi`:`none`}))},addLineageDiffCheck:async()=>{let e=await d(P,i),t;t=z===`selecting`?`multi`:et?`single`:`none`,Pn({type:`lineage_diff`,selected:t}),e&&(await a.invalidateQueries({queryKey:A.checks()}),wt(e))},addSchemaDiffCheck:async()=>{let e;z===`selecting`?st.length>0&&(e=await ct.addSchemaDiffCheck(),Rt(),Pn({type:`schema_diff`,selected:`multi`})):et?(e=await b({node_id:et.id},i),Pn({type:`schema_diff`,selected:`single`})):(e=await b({select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode},i),Pn({type:`schema_diff`,selected:`none`})),e&&(await a.invalidateQueries({queryKey:A.checks()}),wt(e))},cancel:ct.cancel,actionState:ct.actionState,centerNode:Ct,cll:I,showColumnLevelLineage:Et,resetColumnLevelLineage:Dt};return S?K(Lc,{}):w?K(Rc,{error:w,onRetry:x}):!y||p==Vo?K(G,{}):Ue===`changed_models`&&!y.modifiedSet.length?K(zc,{viewOptions:P,onViewOptionsChanged:jt}):K(pe.Provider,{value:zt,children:q(vt,{sizes:et?[70,30]:[100,0],minSize:0,gutterSize:5,className:et?void 0:`split-gutter-hidden`,style:{height:`100%`,width:`100%`},children:[q(X,{ref:c,divider:K(_r,{sx:{borderColor:`grey.200`}}),spacing:0,sx:{contain:`strict`,position:`relative`},children:[e&&q(G,{children:[K(Qc,{}),E.mode===`metadata only`&&K(Pc,{})]}),q(ti,{proOptions:{hideAttribution:!0},nodeTypes:zo,edgeTypes:Bo,nodes:p,edges:g,onNodesChange:h,onEdgesChange:v,onNodeClick:kt,onNodeContextMenu:It,onClick:ft,onInit:async()=>{if(Ve){let e=p.filter(e=>ge(e)&&e.data.changeStatus!==void 0),t=e.length>0?e:p;await o.fitView({nodes:t,duration:200,padding:We,minZoom:Ye,maxZoom:1})}else{let e=ii(p,{});await o.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:ze,nodesDraggable:e,ref:f,colorMode:r?`dark`:`light`,children:[K(qr,{id:`lineage-bg`,variant:Jr.Dots,color:r?Ee.neutral[700]:Ee.neutral[300],gap:20,size:2}),K(Zr,{showInteractive:!1,position:`top-right`,className:Ut,style:{backgroundColor:r?Ee.neutral[700]:void 0,borderColor:r?Ee.neutral[600]:void 0},children:K(Xr,{title:`copy image`,onClick:async()=>{await l(),wn({type:Ue,from:`lineage_view`})},style:{backgroundColor:r?Ee.neutral[700]:void 0,color:r?Ee.neutral[200]:void 0},children:K(J,{component:Xi})})}),K(u,{}),K($r,{position:`bottom-left`,children:q(X,{spacing:`5px`,children:[Ve&&K(Ft,{variant:`changeStatus`,newCllExperience:k}),He.length>0&&K(Ft,{variant:`transformation`,title:`Column transformations`,transformationTypes:He})]})}),K($r,{position:`top-center`,children:K(ps,{notification:D?K(Ic,{}):null,type:`info`})}),K($r,{position:`top-left`,children:q(X,{spacing:`5px`,children:[K(Xa,{action:oe}),p.length==0&&K(Z,{sx:{fontSize:`1.25rem`,color:`grey`,opacity:.5},children:`No nodes`})]})}),p.length<=500&&K(Qr,{nodeColor:mt,nodeStrokeWidth:3,zoomable:!0,pannable:!0,bgColor:r?Ee.neutral[800]:void 0,maskColor:r?`${Ee.neutral[900]}99`:`${Ee.neutral[100]}99`}),z===`action_result`&&K($r,{position:`bottom-center`,className:`ignore-screenshot`,children:K(Ya,{onClose:()=>{Rt()}})})]}),K(vs,{...dt.props})]}),et?K(J,{sx:{borderLeft:`solid 1px`,borderColor:`divider`,height:`100%`},children:K(Ac,{node:et,onCloseNode:ht,openRequest:Xe,onOpenRequestConsumed:_t,onNavigateToNode:yt,onBack:tt.length>0?bt:void 0,onCenterFocused:St,historyTrail:tt,onJumpToHistory:xt})}):K(J,{})]})})}const pl=Xn(fl);function ml(){return K(ni,{children:K(pl,{interactive:!0})})}const hl=Xn(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=L(),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=ye(h,e),n=_e(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]=le(h,e);return l&&t.length>0&&gl(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 ma.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 er(t,()=>({copyToClipboard:b}),[b]),g?K(J,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(vr,{})}):_?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(ls,{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 gl(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 _l({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}=L(),{apiClient:d}=R(),p=r??bl,[m,h]=W(!1),g=U(null),[_,v]=W(null),y=U(!1),{data:b}=at({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(()=>yl(C));if(V(()=>{T(yl(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=vl(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(vr,{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(mr,{})}):null,j=c?K(Zo,{anchorEl:_}):null;return e===`card`?q(li,{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:Ui,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(Ui,{color:`inherit`,size:16}),K(Z,{variant:`body2`,sx:{flex:1},children:te}),ne,A]}),j]})}function vl(e){return`${e.source_session_id}|${e.source_session_updated_at}|${e.current_base_session_id}|${e.current_base_updated_at}`}function yl(e){if(!e||typeof window>`u`)return null;try{return sessionStorage.getItem(e)}catch{return null}}const bl={success:(e,t)=>{ln.success({description:e,duration:t?.duration??5e3,closable:!0})},error:(e,t)=>{ln.error({description:e,duration:t?.duration??5e3,closable:!0})}},xl=j({baseURL:_n??``});async function Sl(e=xl){return(await e.post(`/api/connect`)).data}function Cl({handleParentClose:e,parentOpen:t=!1,ignoreCookie:n=!1,variant:r=`auth`}){let{authed:i}=F(),{apiClient:a}=R(),[o,s]=W(t||!i),c=sr.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(nr,{open:o,onClose:f,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[l!==`authenticating`&&K(ar,{sx:{textAlign:`center`,fontSize:`1.5rem`},children:d.title}),l===`authenticating`?q(G,{children:[K(ir,{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(rr,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,color:`brand`,variant:`contained`,onClick:()=>{window.location.reload()},children:`Reload`})})]}):q(G,{children:[q(ir,{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(or,{underline:`always`,sx:{color:`primary.main`,"&:focus":{outline:`none`}},href:new URL(`/connect-to-cloud`,vn).href,target:`_blank`,children:[`here `,K(cr,{style:{display:`inline`}})]})]})]}),q(rr,{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 Sl(a);window.open(e,`_blank`)},children:[d.action,` `,K(cr,{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:()=>{sr.set(`authState`,`ignored`,{expires:30}),u(`ignored`),f()},children:`Snooze for 30 days`})]})]})]})}function wl(){let{apiClient:e}=R(),{data:t,isLoading:n,error:r}=Kn({queryKey:A.user(),queryFn:()=>gn(e),retry:!1}),{data:i}=Kn({queryKey:[`github-avatar`,t?.id],queryFn:()=>t?hn(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(vr,{size:16})}):K(Pi,{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(gi,{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(vr,{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(_r,{}),q(_i,{onClick:()=>{window.open(vn,`_blank`),l()},children:[K(qi,{children:K(yr,{})}),K(Ji,{children:`Recce Cloud`})]}),q(_i,{onClick:()=>{window.open(yn,`_blank`),l()},children:[K(qi,{children:K(Tr,{})}),K(Ji,{children:`Get live support`})]})]})]})}const Tl=()=>{let{setTheme:e,resolvedTheme:t}=dr(),[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(Vr,{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?Vr:Fr,{style:{width:18,height:18}})})})};function El(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:!vi(i),has_pr_info:!vi(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 Dl(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 Ol(){let{envInfo:e,reviewMode:t,lineageGraph:n}=L(),[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?pn(c.generated_at):``,d=l?.generated_at?pn(l.generated_at):``,f=``,p=``;c&&(f=c.generated_at?un(c.generated_at):``),l&&(p=l.generated_at?un(l.generated_at):``);let[m,h]=cn(n),g=U(!1);V(()=>{if(!g.current&&e){g.current=!0;let n=El(e,t,m,h);On(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:Nr,sx:{fontSize:16,verticalAlign:`middle`}})})]})}),q(nr,{open:r,onClose:v,maxWidth:`sm`,fullWidth:!0,children:[q(ar,{sx:{display:`flex`,alignItems:`center`},children:[`Environment Information`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:v,children:K(mr,{})})]}),K(ir,{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(or,{href:s.url,target:`_blank`,sx:{color:`primary.main`},children:[s.url,` `,K(cr,{})]})]}),!vi(s)&&Dl(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&&Dl(a)})]}),K(_r,{}),e?.adapterType===`dbt`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`DBT`}),K(va,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(ha,{size:`small`,stickyHeader:!0,children:[K(ya,{children:q(ba,{children:[K(_a,{}),K(_a,{children:`base`}),K(_a,{children:`current`})]})}),q(ga,{children:[q(ba,{children:[K(_a,{children:`schema`}),K(_a,{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(_a,{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(ba,{children:[K(_a,{children:`version`}),K(_a,{children:c?.dbt_version}),K(_a,{children:l?.dbt_version})]}),q(ba,{children:[K(_a,{children:`timestamp`}),K(_a,{children:u}),K(_a,{children:d})]})]})]})})]}),e?.adapterType===`sqlmesh`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`SQLMesh`}),K(va,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(ha,{stickyHeader:!0,children:[K(ya,{children:q(ba,{children:[K(_a,{}),K(_a,{children:`base`}),K(_a,{children:`current`})]})}),K(ga,{children:q(ba,{children:[K(_a,{children:`Environment`}),K(_a,{className:`no-track-pii-safe`,children:e.sqlmesh?.base_env}),K(_a,{className:`no-track-pii-safe`,children:e.sqlmesh?.current_env})]})})]})})]})]})}),K(rr,{children:K(Y,{color:`iochmara`,onClick:v,children:`Close`})})]})]})}const kl=()=>({toastSuccess:e=>{ln.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}`),ln.create({description:n,type:`error`,duration:5e3,closable:!0})}}),Al=e=>{V(()=>{let t=e=>{e.preventDefault()};return e&&window.addEventListener(`beforeunload`,t),()=>{e&&window.removeEventListener(`beforeunload`,t)}},[e])},jl=()=>{let{featureToggles:e}=F(),{fileName:t,cloudMode:n,isDemoSite:r,envInfo:i}=L(),{apiClient:a}=R(),[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;Al(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}=kl(),T=qn(),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?Ot(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?Lr:lr,sx:{fontSize:16,verticalAlign:`middle`}})})})]}),q(nr,{open:s,onClose:D,children:[q(ar,{sx:{display:`flex`,alignItems:`center`},children:[t?`Change Filename`:`Save File`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:D,children:K(mr,{})})]}),K(ir,{onKeyDown:e=>{e.stopPropagation()},children:K(Di,{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(rr,{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(nr,{open:l,onClose:O,children:[q(ar,{sx:{display:`flex`,alignItems:`center`},children:[`Overwrite File?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:O,children:K(mr,{})})]}),q(ir,{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(pi,{control:K(fi,{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(rr,{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 Ml(e){return(await e.get(`/api/cloud/organizations`)).data.organizations}async function Nl(e,t){return(await e.get(`/api/cloud/organizations/${t}/projects`)).data.projects}async function Pl(e,t,n){return(await e.get(`/api/cloud/organizations/${t}/projects/${n}/base-status`)).data}async function Fl(e,t){return(await e.post(`/api/cloud/upload`,t)).data}async function Il(e){return(await e.get(`/api/connection-info`)).data.connection_info}async function Ll(e,t){return(await e.post(`/api/cloud/warehouse-setup`,t)).data}const Rl={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 zl(e){return e in Rl}function Bl(e){return Rl[e]?.authMethods[0]?.value??``}function Vl(e,t){let n=Rl[e];if(!n)return[];let r=n.authMethods.find(e=>e.value===t);return[...n.commonFields,...r?.fields??[]]}function Hl(e,t){let n=Rl[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 Ul({open:e,onClose:t}){let{apiClient:n}=R(),[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),Ml(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(``),Nl(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}Pl(n,l,d).then(e=>S(e.base_needs_upload)).catch(()=>S(!1))},[l,d,n]);let A=async()=>{if(!(!l||!d||!p.trim())){Sn(),i(`uploading`);try{let e=await Fl(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 Il(n);t&&zl(t.type)?(E(t),O(Hl(t.type,t)),ee(Bl(t.type)),En(),i(`dw_setup`)):(b(e.session_url),i(`success`),Rn(),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=Vl(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 Ll(n,{org_id:l,project_id:d,connection_name:`${re?.display_name||re?.name||`Project`} DW`,config:t}),Tn(),b(te.sessionUrl),i(`success`),Rn(),window.open(te.sessionUrl,`_blank`)}catch(e){w(e instanceof Error?e.message:`Failed to set up warehouse connection`),i(`dw_error`)}},M=()=>{te&&(Dn(),b(te.sessionUrl),i(`success`),Rn(),window.open(te.sessionUrl,`_blank`))},N=a.find(e=>String(e.id)===l),re=s.find(e=>String(e.id)===d),P=N&&re?`${vn}/${N.name}/${re.name}`:void 0,F=l&&d&&p.trim()&&!h;return q(nr,{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(ar,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Upload to Recce Cloud`}),K(ir,{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(wi,{fullWidth:!0,size:`small`,children:[K(xa,{children:`Organization`}),K(Sa,{value:l,label:`Organization`,onChange:e=>u(e.target.value),disabled:h,children:a.map(e=>K(_i,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),q(wi,{fullWidth:!0,size:`small`,children:[K(xa,{children:`Project`}),K(Sa,{value:d,label:`Project`,onChange:e=>f(e.target.value),disabled:!l||_,children:s.map(e=>K(_i,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),K(Di,{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(rr,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:A,disabled:!F,sx:{borderRadius:2,fontWeight:500},children:`Upload`})})]}),r===`uploading`&&K(ir,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(vr,{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=Rl[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(ar,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Set Up Data Warehouse`}),K(ir,{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(Di,{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(wi,{fullWidth:!0,size:`small`,children:[K(xa,{children:`Authentication`}),K(Sa,{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(_i,{value:e.value,children:e.label},e.value))})]}),n?.fields.map(e=>K(Di,{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(rr,{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(ir,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(vr,{size:36}),K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Setting up warehouse connection...`})]})}),r===`success`&&q(ir,{sx:{position:`relative`},children:[K(Q,{size:`small`,onClick:t,sx:{position:`absolute`,top:8,right:8},"aria-label":`Close`,children:K(Gr,{})}),q(X,{spacing:1.5,sx:{alignItems:`center`,pt:2,pb:1},children:[K(J,{component:kr,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(or,{href:P,target:`_blank`,sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.8125rem`,mt:1},children:[`Go to project page `,K(cr,{size:12})]})]})]}),r===`dw_error`&&q(G,{children:[K(ir,{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(rr,{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(ir,{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(rr,{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 Wl(){let{authed:e}=F(),{apiClient:t}=R(),[n,r]=W(null),[i,a]=W(`signup`),[o,s]=W(!1),c=U(!1),l=B(async()=>{if(c.current)try{await gn(t),c.current=!1,zn(),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(Wr,{}),onClick:()=>{In({authed:!0}),s(!0)},sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(Ul,{open:o,onClose:()=>s(!1)})]});let u=e=>{In({authed:!1}),a(`signup`),c.current=!1,r(e.currentTarget)},d=()=>{r(null),c.current=!1},f=async()=>{Bn();let e=window.open(``,`_blank`);try{let{connection_url:n}=await Sl(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(Wr,{}),onClick:u,sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(Fi,{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(Gr,{})}),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(vr,{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 Gl(){let{featureToggles:e}=F(),{apiClient:t}=R(),n=async()=>{try{let e=await ee(t),n=JSON.stringify(e,null,2),r=new Blob([n],{type:`application/json`}),i=`recce-state-${Oi(new Date,`yyyy-MM-dd-HH-mm-ss`)}.json`;di(r,i)}catch(e){console.error(`Export failed`,e),ln.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(),Vn({name:`export`})},disabled:e.disableExportStateFile,children:K(J,{component:Mr,sx:{verticalAlign:`middle`,width:`16px`,height:`16px`}})})})}function Kl(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 ql(){return K($,{title:`Syncing`,children:K(J,{sx:{mx:`10px`},children:K(vr,{size:20})})})}function Jl(){let[e,t]=W(!1),n=qn(),{apiClient:r}=R(),i=Li(),a=Ii(),{basePath:o}=ie(),[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));ln.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()}),Kl(a)&&i.push(`${o}/checks`)},[n,a,r,i.push,o]);return e?K(ql,{}):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:hr,sx:{fontSize:16,verticalAlign:`middle`}})})}),q(nr,{open:s,onClose:f,children:[q(ar,{sx:{display:`flex`,alignItems:`center`,fontWeight:`bold`},children:[`Sync with Cloud`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:f,children:K(mr,{})})]}),q(ir,{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(pa,{value:l,onChange:e=>{u(e.target.value)},children:q(X,{direction:`column`,children:[K(pi,{value:`merge`,control:K(fa,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Merge`,K($,{title:`This will merge the local and remote states.`,children:K(J,{component:Nr,sx:{ml:2,cursor:`pointer`}})})]})}),K(pi,{value:`overwrite`,control:K(fa,{}),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:Nr,sx:{ml:2,cursor:`pointer`}})})]})}),K(pi,{value:`revert`,control:K(fa,{}),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:Nr,sx:{ml:2,cursor:`pointer`}})})]})})]})})})]}),q(rr,{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 Yl=[{path:`/lineage`,name:`Lineage`},{path:`/query`,name:`Query`},{path:`/checks`,name:`Checklist`}];function Xl({queryKey:e,fetchCallback:t,selectCallback:n}){let{data:r,isLoading:i,error:a}=Kn({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 Zl(){let{apiClient:e}=R();return K(Xl,{queryKey:A.checks(),fetchCallback:()=>c(e),selectCallback:e=>e.filter(e=>!e.is_checked).length})}const Ql=()=>{let e=Ii(),{isDemoSite:t,isLoading:n,cloudMode:r}=L(),{featureToggles:i}=F(),{data:a,isLoading:o}=de(),s=U(null);V(()=>{s.current&&s.current!==e&&Fn({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(ji,{value:c,sx:{borderBottom:`none`,minHeight:`auto`},children:Yl.map(({path:e,name:t})=>t===`Query`&&a?.single_env_onboarding?null:t===`Checklist`&&Zl?K(Ai,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:q(fr,{href:e,style:{textDecoration:`none`,color:`inherit`,padding:`0.875rem 1.1875rem`,display:`flex`,gap:3,alignItems:`center`},children:[t,` `,K(Zl,{})]})})},e):K(Ai,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:K(fr,{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(jl,{})}),!n&&q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,mr:`8px`},children:[!t&&!a?.single_env_onboarding&&!i.disableShare&&K(Wl,{}),K(Ol,{}),r&&K(Jl,{}),K(Gl,{})]})]})})};function $l(){let{remainingSeconds:e,isEnabled:t}=ae();return!t||e===null||e>60?null:q(Ca,{color:`warning`,variant:`standard`,sx:{display:`flex`,alignItems:`center`,gap:1,fontSize:`0.75rem`,mr:2},children:[K(J,{component:gr,sx:{display:`inline-flex`}}),`Idle timeout: `,fn(e,`compact`)]})}const eu=()=>{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(()=>{ln.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(or,{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(or,{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 tu({icon:e,href:t,sx:n,...r}){let i=ur();return K(or,{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 nu=()=>{let{reviewMode:e,isDemoSite:t,envInfo:n,cloudMode:r}=L(),{featureToggles:i,authed:a}=F(),{url:o,id:s}=n?.pullRequest??{},c=o?o.split(`/`).pop():null,l=r||a?vn:`https://reccehq.com/`,[u,d]=W(!1);return q(J,{sx:{display:`flex`,gap:`10px`,minHeight:`40px`,alignItems:`center`,bgcolor:Ee.brand[400]},children:[K(or,{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(eu,{}),(i.mode??e)&&K(Ca,{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(Ca,{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(or,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(bi,{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(Ca,{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(or,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(bi,{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(tu,{icon:xr,href:`https://github.com/DataRecce/recce`}),K(tu,{icon:wr,href:`https://getdbt.slack.com/archives/C05C28V7CPP`}),K(tu,{sx:{mr:2},icon:Sr,href:`https://docs.reccehq.com`})]}),!t&&i.mode!==`read only`&&q(G,{children:[K($l,{}),a||r?K(J,{sx:{mr:2},children:K(wl,{})}):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(Cl,{parentOpen:u,handleParentClose:d,ignoreCookie:!0,variant:`user-profile`})]})]})]})};function ru(){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(vr,{size:48})})})}function iu({children:e,lineage:t}){let n=Ii(),{isDemoSite:r,isLoading:i,isCodespace:a}=L(),{featureToggles:o}=F(),s=n.replace(/\/$/,``)||`/`,c=s===`/lineage`||s===`/`;return V(()=>{jn()},[]),q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:[K(_l,{}),K(nu,{}),K(Ql,{}),K(au,{isLineageRoute:c,lineage:t,children:e}),!i&&!r&&!a&&o.mode===null&&K(Cl,{})]})}function au({children:e,lineage:t,isLineageRoute:n,disableInternalHistory:r=!1}){let{isRunResultOpen:i,isHistoryOpen:a,closeRunResult:o}=me(),{basePath:s}=ie(),{data:c}=de(),l=Ii(),u=rn(),d=i&&!l.startsWith(`${s}/checks`),f=!r&&a&&!l.startsWith(`${s}/checks`);return q(vt,{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(Mt,{sizes:d?[50,50]:[100,0],minSize:0,gutterSize:5,className:d?void 0:`split-gutter-hidden`,style:{flex:`1`,contain:`size`},children:[K(Jn,{fallback:K(ru,{}),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 ou({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(Fi,{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(or,{href:yn,target:`_blank`,sx:{color:`white`,textDecoration:`underline`},children:`Learn more`}),`.`]})]}):e}function su({checksOnly:e=!0}){let t=rn(),{featureToggles:n}=F(),r=qn(),{apiClient:i}=R(),a=U(null),o=U(null),[s,c]=W(null),[l,u]=W(!1),d=Li(),f=Ii(),{basePath:p}=ie(),[,m]=ce(),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`;ln.create({description:a,type:`info`,duration:5e3,closable:!0})}catch(e){console.error(`Import failed`,e),ln.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}=L();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(),Vn({name:`import`})},disabled:n.disableImportStateFile||x,children:K(oa,{})})}),K(`input`,{type:`file`,style:{display:`none`},ref:a,onChange:v}),q(nr,{open:l,onClose:y,maxWidth:`sm`,fullWidth:!0,"aria-labelledby":`import-dialog-title`,children:[q(ar,{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(mr,{})})]}),K(ir,{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:Nr,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(rr,{children:[K(Y,{ref:o,onClick:y,children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:h,sx:{ml:`5px`},children:`Import`})]})]})]})}function cu({check:e},t){let n={...e.params,...e.view_options};return K(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:K(ni,{children:K(pl,{viewOptions:n,interactive:!1,ref:t})})})}const lu=Xn(cu),uu=({node:e,selected:t,onSelect:n,schemaChanged:r,isDark:i})=>{let{icon:a}=Dt(e.data.resourceType),o,s;return r?(o=Qt(`schema_diff`).icon,s=je(`modified`).color):e.data.changeStatus===`added`?(o=je(`added`).icon,s=je(`added`).color):e.data.changeStatus===`removed`&&(o=je(`removed`).icon,s=je(`removed`).color),K(Ni,{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 du({check:e},t){let r=rn(),{apiClient:i}=R(),{lineageGraph:a}=L(),o=e.params,s=[...A.check(e.check_id),`select`],{isLoading:c,error:l,data:u}=Kn({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}=Kn({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(vt,{sizes:[80,20],minSize:30,style:{height:`100%`},children:[K(Is,{base:g?.model?.base&&Object.keys(g.model.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,...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,resource_type:e.data.resourceType,...g.model.current}:void 0,columnChanges:e.data.change?.columns,enableScreenshot:!0,showMenu:!1,ref:t}),K(Mi,{sx:{overflow:`auto`,bgcolor:`background.paper`,listStyle:`none`},children:d.map((e,t)=>K(uu,{node:e,schemaChanged:f.includes(e.id),selected:t===p,isDark:r,onSelect:()=>{m(t)}},e.id))})]})}return K(G,{})}const fu=Xn(du);function pu({checkId:e,refreshCheckList:n}){let r=ur(),i=rn(),{apiClient:o}=R(),{featureToggles:s,sessionId:c}=F(),{setLatestSelectedCheckId:u}=ut(),{cloudMode:d}=L(),f=qn(),p=Li(),{basePath:m}=ie(),{setSqlQuery:h,setBaseSqlQuery:g,setCustomQueries:_,setPrimaryKeys:v}=ht(),{successToast:y,failToast:b}=sn(),[S,C]=W(),[w]=W(),[E,D]=W(!1),[O,k]=W(null),ee=!!O,{isLoading:te,error:ne,data:j}=Kn({queryKey:A.check(e),queryFn:async()=>x(e,o),refetchOnMount:!0}),M=S??j?.last_run?.run_id,{run:N,error:re,onCancel:P}=Pt(M),ae=S?!N||N.status===`Running`:N?.status===`Running`,I=j?.type?Qt(j.type):void 0,oe;I&&(oe=I.RunResultView);let se=j?.is_preset??!1,ce=U(null),{mutate:le}=Gn({mutationFn:t=>a(e,t,o),onSuccess:async()=>{await f.invalidateQueries({queryKey:A.check(e)}),await f.invalidateQueries({queryKey:A.checks()})}}),{mutate:ue}=Gn({mutationFn:()=>t(e,o),onSuccess:async()=>{u(``),await f.invalidateQueries({queryKey:A.checks()}),p.push(`${m}/checks`)}}),{mutate:de,isPending:fe}=Gn({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)}}),pe=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]),me=async()=>{if(!j)return;let e=mu(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)}},he=B(()=>{let e=j?.is_checked;le({is_checked:!e}),e||ln.create({title:`Marked as approved`,type:`success`,duration:2e3})},[j?.is_checked,le]),ge=e=>{le({view_options:e})},_e=e=>{le({description:e})},ve=e=>{k(e.currentTarget)},ye=()=>{k(null)},be=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]),[xe,Se]=W(`result`),{ref:Ce,onCopyToClipboard:we,onMouseEnter:Te,onMouseLeave:Ee}=xt(),De=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(Mt,{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(ft,{name:`Check not found`,disabled:!0})})})});let Oe=N?.run_at?ki(new Date(N.run_at),{addSuffix:!0}):null,ke=I?.icon;return q(wa,{spacing:0,container:!0,sx:{height:`100%`,width:`100%`},children:[K(wa,{size:{xs:12,md:d?9:12},sx:{height:`100%`},children:q(Mt,{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:[ke&&K(J,{component:ke,sx:{fontSize:20,mr:1,flexShrink:0}}),K(ft,{name:j.name,onNameChange:e=>{le({name:e})}}),K(J,{sx:{flexGrow:1}}),q(X,{direction:`row`,spacing:2,sx:{mr:`10px`},children:[se&&K($,{title:`This is a preset check`,children:K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(aa,{size:`1rem`,color:r.palette.iochmara.dark})})}),j?.actor_type&&!j.is_preset&&qe[j.actor_type]&&K(Kr,{label:qe[j.actor_type].label,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:qe[j.actor_type].bg,color:qe[j.actor_type].color,flexShrink:0,"& .MuiChip-label":{px:.75}}}),K(Q,{size:`small`,onClick:ve,children:K(Si,{})}),q(gi,{anchorEl:O,open:ee,onClose:ye,children:[c&&q(_i,{onClick:()=>{de(),ye()},disabled:fe||se,children:[K(qi,{children:K(pr,{})}),K(Ji,{children:`Mark as Preset Check`})]}),q(_i,{onClick:()=>{D(!0),ye()},children:[K(qi,{children:K(Ea,{})}),K(Ji,{children:`Get Preset Check Template`})]}),q(_i,{onClick:()=>{me(),ye()},children:[K(qi,{children:K(jr,{})}),K(Ji,{children:`Copy Markdown`})]}),K(_r,{}),q(_i,{onClick:()=>{ue(),ye()},disabled:s.disableUpdateChecklist,sx:{color:`error.main`},children:[K(qi,{sx:{color:`error.main`},children:K(Hr,{})}),K(Ji,{children:`Delete`})]})]}),K($,{title:Ge({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:()=>{he()},disabled:Ge({type:j.type,hasResult:!!N?.result,hasError:!!N?.error})||s.disableUpdateChecklist,startIcon:j.is_checked?K(kr,{}):K(yi,{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(Rt,{value:j.description,onChange:_e,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(ji,{value:xe,onChange:(e,t)=>Se(t),children:[K(Ai,{label:`Result`,value:`result`,sx:{fontSize:`0.75rem`,textTransform:`none`}}),(j.type===`query`||j.type===`query_diff`)&&K(Ai,{label:`Query`,value:`query`,sx:{fontSize:`0.75rem`,textTransform:`none`}})]}),Oe&&K(Z,{variant:`caption`,sx:{color:`text.secondary`,ml:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0,display:`flex`,alignItems:`center`},children:Oe}),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:be,disabled:s.disableDatabaseQuery,startIcon:K(Ki,{}),sx:{textTransform:`none`},children:`Open Query`})}),oe&&K($,{title:`Rerun`,children:K(Y,{variant:`outlined`,color:`neutral`,size:`small`,onClick:()=>pe(),disabled:s.disableDatabaseQuery||ae,startIcon:K(Br,{}),sx:{textTransform:`none`},children:ae?`Running...`:`Rerun`})}),K(Y,{variant:`outlined`,color:`neutral`,disabled:Ge({type:j.type,hasResult:!!N?.result,hasError:!!N?.error})||xe!==`result`,onMouseEnter:Te,onMouseLeave:Ee,size:`small`,onClick:async()=>{j.type===`lineage_diff`?ce.current?.copyToClipboard():await we(),wn({type:j.type,from:`check`})},startIcon:K(jr,{}),sx:{textTransform:`none`},children:`Copy to Clipboard`})]})]}),q(J,{sx:{flex:1,contain:`strict`},children:[xe===`result`&&q(J,{sx:{width:`100%`,height:`100%`},children:[oe&&(j.last_run||M?K(Jt,{ref:Ce,runId:M,isRunning:ae,run:M?N:j.last_run,error:re,progress:w,RunResultView:oe,viewOptions:j.view_options,onViewOptionsChanged:ge,onCancel:P,onExecuteRun:pe}):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(ou,{display:s.mode===`metadata only`,children:K(Y,{onClick:pe,variant:`contained`,size:`small`,disabled:s.disableDatabaseQuery,children:`Run Query`})})]})})),j.type===`schema_diff`&&K(fu,{check:j,ref:Ce},j.check_id),j.type===`lineage_diff`&&K(lu,{check:j,ref:ce},j.check_id)]}),xe===`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($e,{value:j.params.sql_template||``,options:{readOnly:!0}})})]})]})}),q(nr,{open:E,onClose:()=>D(!1),maxWidth:`md`,fullWidth:!0,children:[K(ar,{children:`Preset Check Template`}),q(ir,{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(De),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:De})]}),K(rr,{children:K(Q,{size:`small`,onClick:()=>D(!1),sx:{position:`absolute`,top:8,right:8},children:K(mr,{})})})]})]})}),d&&K(wa,{size:3,sx:{height:`100%`,overflow:`hidden`,flexShrink:0,display:{xs:`none`,md:`block`}},children:K(Co,{checkId:e})})]})}function mu(e){let t=nt({name:e.name,isChecked:e.is_checked});return Ta`
|
|
7
|
+
<details><summary>${t}</summary>
|
|
8
|
+
|
|
9
|
+
${hu(e)}
|
|
10
|
+
|
|
11
|
+
</details>`}function hu(e){let t=Qe({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 gu=()=>{let e=qn(),t=Li(),{apiClient:n}=R(),{basePath:r}=ie(),{mutate:i,isPending:a}=Gn({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(He,{title:`No checks yet`,description:`Checks help you validate data quality and catch issues.`,icon:K(Gi,{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.`})},_u=({check:e,selected:t,onSelect:n,onApprovalChange:r})=>{let{featureToggles:i}=F(),a=e.last_run?.run_id,{run:o}=Pt(a),s=Ge({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(pt,{check:l,isSelected:t,onClick:n,onApprovalChange:r,disableApproval:c,disabledApprovalTooltip:s?`Run the check first`:void 0})},vu=({checks:e,selectedItem:t,onCheckSelected:n,onChecksReordered:r})=>{let[i,o]=W(!1),[s,c]=W(!1),[l,u]=W(null),d=qn(),{apiClient:f}=R(),{mutate:p}=Gn({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)},_=()=>{ln.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(Da,{onDragEnd:m,children:K(ka,{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(Oa,{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(_u,{check:e,selected:e.check_id===t,onSelect:n,onApprovalChange:v},e.check_id)})}},e.check_id)),r.placeholder]})})}),q(nr,{open:s,onClose:g,maxWidth:`xs`,fullWidth:!0,children:[q(ar,{sx:{display:`flex`,alignItems:`center`},children:[`Mark as Approved?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:g,children:K(mr,{})})]}),K(_r,{}),q(ir,{sx:{fontSize:`0.875rem`},children:[K(Z,{children:`Please ensure you have reviewed the contents of this check before marking it as approved.`}),K(pi,{control:K(fi,{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(_r,{}),q(rr,{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`})]})]})]})},yu=()=>{let{isDark:e}=Vt(),t=e?`grey.700`:`grey.300`,n=Li(),r=Ri().get(`id`),{latestSelectedCheckId:i,setLatestSelectedCheckId:a}=ut(),o=qn(),{apiClient:s}=R(),{basePath:l}=ie(),d=r;V(()=>{d&&a(d)},[d,a]);let{isLoading:f,error:p,data:m,status:h,refetch:g}=Kn({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}=Gn({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(vt,{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(su,{checksOnly:!0})}),K(_r,{}),K(vu,{checks:v,selectedItem:d,onCheckSelected:_,onChecksReordered:C})]})}),K(J,{sx:{height:`100%`},children:w&&d&&K(pu,{checkId:d,refreshCheckList:g},d)})]}):q(vt,{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(su,{checksOnly:!0})}),K(_r,{}),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(gu,{})})})]})},bu=()=>{let{isDark:e}=Vt();return q(vt,{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(vr,{size:20})})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(vr,{size:20})})})]})},xu={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 Su(e){let t=String(Te(`colors.green.solid`)),n=String(Te(`colors.red.solid`)),r=String(Te(`colors.amber.emphasized`));return e===`added`?{color:t,icon:ot}:e===`removed`?{color:n,icon:st}:e===`modified`?{color:r,icon:Yt}:e===`col_added`?{color:t,icon:ot}:e===`col_removed`?{color:n,icon:st}:e===`col_changed`?{color:r,icon:Yt}:e===`folder_changed`?{color:r,icon:Ne}:{color:`inherit`,icon:void 0}}function Cu(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 wu(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:Zi,sx:{mx:`2px`,fontSize:12,verticalAlign:`middle`}})})})]}),t]})}function Eu({changeStatus:e,value:t}){let[n]=e?xu[e]:[``],{icon:r,color:i}=Su(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 Du({lineageGraph:e}){let{adds:t,removes:n,modifies:r,col_added:i,col_removed:a,col_changed:o}=wu(e);return q(wa,{container:!0,sx:{mb:`10px`,borderTop:`1px solid`,borderColor:`divider`,p:`2.5vw`},children:[K(wa,{size:6,sx:{borderColor:`divider`},children:K(Tu,{name:`Code Changes`,value:q(wa,{container:!0,sx:{width:`100%`},children:[K(wa,{size:4,children:K(Eu,{changeStatus:`added`,value:t})}),K(wa,{size:4,children:K(Eu,{changeStatus:`removed`,value:n})}),K(wa,{size:4,children:K(Eu,{changeStatus:`modified`,value:r})})]})})}),K(wa,{size:6,sx:{borderLeft:`1px solid`,borderLeftColor:`divider`,pl:`12px`},children:K(Tu,{name:`Column Changes`,value:q(wa,{container:!0,sx:{width:`100%`},children:[K(wa,{size:4,children:K(Eu,{changeStatus:`col_added`,value:i})}),K(wa,{size:4,children:K(Eu,{changeStatus:`col_removed`,value:a})}),K(wa,{size:4,children:K(Eu,{changeStatus:`col_changed`,value:o})})]})})})]})}function Ou(e){let t=e.status===`unknown`&&e.unchecked_node_count===0?`The number of unchecked nodes is unknown.`:`${e.unchecked_node_count} ${e.unchecked_node_count===1?`node was`:`nodes were`} not checked.`;if(e.unchecked_nodes.length===0)return t;let n=e.unchecked_node_count-e.unchecked_nodes.length;return`${t} Unchecked nodes: ${e.unchecked_nodes.join(`, `)}${e.more&&n>0?e.unchecked_nodes.length===1?` and ${n} more`:`, and ${n} more`:``}.`}function ku(e){let t=e.artifactHealth?.base?.status,n=e.artifactHealth?.current?.status,r=t!=null&&![`complete`,`not_applicable`].includes(t),i=n!=null&&![`complete`,`not_applicable`].includes(n);return r&&i?`base and current catalogs`:r?`base catalog`:i?`current catalog`:`affected base/current catalogs`}function Au({node:e,...t}){let{apiClient:r}=R(),{data:i,isLoading:a}=Kn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,r),enabled:!!r,staleTime:3e5}),o=i?.model;return q(Aa,{sx:{maxWidth:500},children:[K(Ma,{title:K(Z,{sx:{fontSize:`1.125rem`,fontWeight:`bold`},children:t.title}),subheader:q(X,{direction:`row`,spacing:`8px`,sx:{p:`16px`},children:[K(z,{resourceType:e.data.resourceType,materialized:e.data.materialized}),e.data.resourceType===`model`&&K(fc,{node:e})]})}),K(ja,{children:K(J,{sx:{display:`flex`},children:a?K(da,{variant:`rectangular`,width:`100%`,height:100}):K(Is,{base:o?.base&&Object.keys(o.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,...o.base}:void 0,current:o?.current&&Object.keys(o.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,...o.current}:void 0,columnChanges:e.data.change?.columns})})})]})}function ju(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 Mu({lineageGraph:e}){let[t,n]=W([]),{envInfo:r}=L(),i=r?.adapterType!==`sqlmesh`;V(()=>{n(ju(e))},[e]);let a=e.schemaCoverage??{status:`unknown`,unchecked_nodes:[],unchecked_node_count:0,more:!1},o=a.status!==`complete`;return q(G,{children:[K(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`,mt:`20px`},children:K(Z,{variant:`h5`,sx:{fontSize:`1.5rem`},children:`Schema Summary`})}),q(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`},children:[o&&q(mi,{severity:`warning`,"aria-label":`Incomplete schema comparison`,sx:{fontSize:`0.875rem`,mb:2},children:[`Schema comparison incomplete.`,` `,Ou(a),` `,i?q(G,{children:[`Regenerate the `,ku(e),` with`,` `,K(`code`,{children:`dbt docs generate`}),`, then rerun the comparison.`]}):`Refresh your environments so model columns are resolved, then rerun the comparison.`]}),t.length===0?!o&&K(Z,{sx:{fontSize:`1.125rem`,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(Au,{title:e.data.name,node:e},e.id))})]})]})}function Nu({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(vr,{})});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(He,{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(Gt,{direction:`horizontal`,sizes:[_,100-_],minSizes:[v,200],maxSizes:[y,1/0],children:[K(J,{sx:{height:`100%`,overflow:`auto`},children:K(dt,{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(Je,{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 Pu=Zn(Nu);Pu.displayName=`ChecksView`;const Fu=`0.2.0`;export{Cs as A,wo as B,fc as C,Ms as D,oc as E,ls as F,Fa as H,Zo as I,Oo as L,hs as M,ms as N,Is as O,ps as P,Eo as R,Tc as S,pc as T,Pa as U,Ra as V,Ol as _,wu as a,ml as b,xu as c,vu as d,gu as f,$l as g,iu as h,Du as i,bs as j,Ls as k,bu as l,au as m,Pu as n,Cu as o,pu as p,Mu as r,Su as s,Fu as t,yu as u,_l as v,lc as w,Bc as x,hl as y,To as z};
|
|
12
|
+
//# sourceMappingURL=src-CLsh3QXf.js.map
|