From 4fc25b56f278f9bf9c84b772fb3ef7779864df5b Mon Sep 17 00:00:00 2001 From: popcornylu Date: Wed, 13 Nov 2024 06:36:45 +0000 Subject: [PATCH] AUTO-COMMIT - build js statics to recce data/ --- recce/data/404.html | 2 +- .../{page-b11fb8bf449bfd6c.js => page-b7a3d8e0939cace5.js} | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 recce/data/index.html | 4 ++-- recce/data/index.txt | 4 ++-- 6 files changed, 6 insertions(+), 6 deletions(-) rename recce/data/_next/static/chunks/app/{page-b11fb8bf449bfd6c.js => page-b7a3d8e0939cace5.js} (62%) rename recce/data/_next/static/{7OO5H0u3fYPozSTDlB1PP => tYlT3jXbkvsZEbsL8O1gv}/_buildManifest.js (100%) rename recce/data/_next/static/{7OO5H0u3fYPozSTDlB1PP => tYlT3jXbkvsZEbsL8O1gv}/_ssgManifest.js (100%) diff --git a/recce/data/404.html b/recce/data/404.html index b0fe4ffe..6fe8eff1 100644 --- a/recce/data/404.html +++ b/recce/data/404.html @@ -1 +1 @@ -404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file diff --git a/recce/data/_next/static/chunks/app/page-b11fb8bf449bfd6c.js b/recce/data/_next/static/chunks/app/page-b7a3d8e0939cace5.js similarity index 62% rename from recce/data/_next/static/chunks/app/page-b11fb8bf449bfd6c.js rename to recce/data/_next/static/chunks/app/page-b7a3d8e0939cace5.js index edf7b8e7..970907a6 100644 --- a/recce/data/_next/static/chunks/app/page-b11fb8bf449bfd6c.js +++ b/recce/data/_next/static/chunks/app/page-b7a3d8e0939cace5.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,68868))},68868:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return lq}});var i=t(95766),l=t(88117),r=t(78390),s=t(51742),o=t(58396),a=t(49989),c=t(41042),d=t(15370),u=t(68825),h=t(26138),x=t(78939),m=t(63993),p=t(83246),f=t(50068),g=t(46088),v=t(66518),j=t(57489),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,v.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=v.useState(k),[r,s]=v.useState(k),[o,a]=v.useState(!1),[c,d]=v.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:l,sqlQuery:t,setPrimaryKeys:d,primaryKeys:c,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:r,setBaseSqlQuery:s},children:n})}let _=()=>(0,v.useContext)(w),S=(0,v.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=v.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:l},children:n})}var R=t(48510);function T(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,l={},r=(e,t)=>{if(!(t<0)&&(void 0===l[e]||!(l[e]>=t))){for(let i of(l[e]=t,n(e)))r(i,t-1);i.add(e)}};for(let n of e)r(n,t);return i}function E(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var O=t(28482),I=t.n(O);function M(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function A(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function D(e,n,t){let i=[],l=[];function r(e){return"base"===e?0:"current"===e?2:1}function s(e,n){let t=r(e.from),i=r(n.from);return ti?1:0}let o=n?function(e,n){var t;let i=Object.values(e.nodes);if("changed_models"===(n.view_mode||"changed_models")){let n=E(M(e,e.modifiedSet,1),A(e,e.modifiedSet));i=i.filter(e=>n.has(e.id))}if(void 0!==n.node_ids){let e=new Set(n.node_ids);i=i.filter(n=>e.has(n.id))}let l=void 0!==n.packages?n.packages:(null===(t=e.manifestMetadata.current)||void 0===t?void 0:t.project_name)?[e.manifestMetadata.current.project_name]:void 0;return void 0!==l&&(i=i.filter(e=>!!e.packageName&&l.includes(e.packageName))),new Set(i.map(e=>e.id))}(e,n):void 0;for(let n of(null!=t&&(o=o?function(){for(var e=arguments.length,n=Array(e),t=0;te.has(n)));return i}(o,new Set(t)):new Set(t)),Object.values(e.nodes).sort(s)))(!o||o.has(n.id))&&i.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(s))(!o||o.has(n.parent.id)&&o.has(n.child.id))&&l.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return L(i,l),N(Array.from(A(e,e.modifiedSet)),i,l)}let L=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(I()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),I().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function N(e,n,t){let i=new Set(e),l=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}))]}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function F(e,n){return n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let H={rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var W=t(62330),V=t(39588);let K=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var J=t(94614);let U=W.default.create({baseURL:K}),B=new J.S;async function Q(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var Z=t(99873),G=t(85929),Y=t.n(G);async function $(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ee(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function en(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function et(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ei(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function el(){return(await U.get("/api/runs")).data}async function er(){return(await U.post("/api/runs/aggregate",{})).data}let es=(0,v.createContext)({});function eo(e){let{refetch:n}=e,t=(0,Z.p)(),[l,r]=(0,v.useState)(),s=(0,b.NL)();return(0,v.useEffect)(()=>{let e=new WebSocket("".concat(K.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));return r(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:i}=n.event,[l,r]=i.split("/").slice(-2),o=Y().parse(r).name;t({description:"Detected ".concat(l," ").concat(o," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),s.invalidateQueries({queryKey:H.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,s]),(0,i.jsx)(i.Fragment,{})}function ea(e){var n,t;let{children:l}=e,{data:r,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:H.lineage(),queryFn:Q}),{data:c,refetch:d}=(0,y.a)({queryKey:H.runsAggregated(),queryFn:er}),u=(0,v.useMemo)(()=>{let e=null==r?void 0:r.lineage;if(e&&e.base&&e.current)return function(e,n){let t={},i={},l=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=l(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=l(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,l]of Object.entries(e.parent_map))for(let e of l){let l=t[n],r=t[e],s="".concat(e,"_").concat(n);if(!l||!r)continue;i[s]={id:s,from:"base",parent:r,child:l};let o=i[s];l.parents[e]=o,r.children[n]=o}for(let[e,l]of Object.entries(n.parent_map))for(let n of l){let l=t[e],r=t[n],s="".concat(n,"_").concat(e);if(!l||!r)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:r,child:l};let o=i[s];l.parents[n]=o,r.children[e]=o}let r=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",r.push(n.id);else if("current"===n.from)n.changeStatus="added",r.push(n.id);else{var s,o,a,c,d,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(d=u.current)||void 0===d?void 0:null===(c=d.checksum)||void 0===c?void 0:c.checksum;e&&t&&e!==t&&(n.changeStatus="modified",r.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:r,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(e.base,e.current)},[r]),h=null==o?void 0:o.message,x=null==r?void 0:r.lineage,m=null==r?void 0:r.demo,p=null==r?void 0:r.review_mode,f=null==r?void 0:r.cloud_mode,g=null==r?void 0:r.file_mode,j=null==r?void 0:r.adapter_type,b=null==r?void 0:r.git,k={adapterType:j,git:b,pullRequest:null==r?void 0:r.pull_request,dbt:{base:null==x?void 0:null===(n=x.base)||void 0===n?void 0:n.manifest_metadata,current:null==x?void 0:null===(t=x.current)||void 0===t?void 0:t.manifest_metadata},sqlmesh:null==r?void 0:r.sqlmesh};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eo,{refetch:a}),(0,i.jsx)(es.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:k,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,refetchRunsAggregated:()=>{d()}},children:l})]})}let ec=()=>(0,v.useContext)(es),ed=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ec();return[e,n]};var eu=t(17695),eh=t(62628),ex=t(33678),em=t(96985),ep=t(69384),ef=t(7797),eg=t(13844),ev=t(64653);let ej=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,v.useState)(c),[x,m]=(0,v.useState)(!1);return(0,i.jsxs)(eu.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(em.x,{children:a}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(l.xu,{style:{contain:"layout"},children:d&&(0,i.jsx)(d,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(ev.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var ey=t(25612),eb=t(76330),ek=t(53152),ew=t(18222),eC=t(30678),e_=t(2838),eS=t(13156),ez=t.n(eS);function eR(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eT=e=>{var n;let{lineageGraph:t}=ec(),[i,l]=(0,v.useState)([]),[r,s]=(0,v.useState)(),[o,a]=(0,v.useState)(!0),[c,d]=(0,v.useState)(null),u=ez().find(null==t?void 0:t.nodes,{name:e}),h=(0,v.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eR(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,v.useEffect)(()=>{let e=async()=>{try{let e=(await X(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){l([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);l(eR(n,t))}catch(e){d(e)}};h.length>0?(l(h),s(x)):(null==u?void 0:u.id)===void 0?l([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:r,isLoading:o,error:c}};function eE(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eO(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eI=t(85813),eM=t(81945),eA=t(14827);function eD(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eL(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,l=n>=1e9,r=n>=1e15;if(r||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:r?0:2}).format(e/1e12).replace("L","T");if(l||i||n>=1e3){let n={base:l?1e9:i?1e6:1e3,unit:l?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}var eN=t(79481);let eq="#63B3ED",eF="#F6AD55",eP="".concat(eq,"A5"),eH="".concat(eF,"A5");function eW(e){let{color:n}=e;return(0,i.jsx)(l.xu,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function eV(e){let{data:n,hideAxis:t=!1,animation:l=!1}=e;eM.kL.register(eM.ZL,eM.RM,eM.f$,eM.uw,eM.u);let r=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasets:i,type:l,samples:r=0,binEdges:s}=e,[o,a]=i,c="datetime"===l;return{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eJ(s,n);return"".concat(c?"Date Range":"string"===l?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,l=0===n?a.counts:o.counts,s=eD(l[t]/r),c=l[t];return"".concat(i,": ").concat(c," (").concat(s,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:l,binEdges:r}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,c=Math.max(...a.counts,...o.counts),d=r.map((e,n)=>eJ(r,n)).slice(0,-1);return{x:"datetime"===l?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>d[n]},stacked:!0},y:{display:!s,type:"linear",max:c,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eL(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:l}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[l,r]=n,s=eK(t,i,"Current",eP,r),o=eK(t,i,"Base",eH,l);return{labels:i.map((e,n)=>eJ(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eH})," Base"]}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eP})," Current"]}),(0,i.jsx)(h.L,{})]}),(0,i.jsx)(eA.kL,{type:"bar",options:r,data:s,plugins:[]})]})}function eK(e,n,t,i,l){let{counts:r=[]}=l;return{label:t,data:"datetime"===e?r.map((e,t)=>({x:n[t],y:e})):r,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function eJ(e,n){let t=e[n],i=e[n+1],l=eL(t),r=eL(i);return"".concat(l," - ").concat(r)}let eU=(0,eI.G)((e,n)=>{let{backgroundColor:t="white",blockSize:r,children:s,...o}=e;return(0,i.jsx)(l.xu,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(l.xu,{backgroundColor:t,height:"100%",blockSize:r,children:s})})}),eB=(0,eI.G)(function(e,n){var t,r,s,a,d,x;let{run:m}=e,p=m.params,f=null===(t=m.result)||void 0===t?void 0:t.base,g=null===(r=m.result)||void 0===r?void 0:r.current,v=null===(s=m.result)||void 0===s?void 0:s.min,j=null===(a=m.result)||void 0===a?void 0:a.max,y=null===(d=m.result)||void 0===d?void 0:d.bin_edges;return f&&g?(0,i.jsx)(o.k,{direction:"column",height:"500px",children:(0,i.jsxs)(eU,{ref:n,height:"100%",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:"4",textAlign:"center",children:["Model ",p.model,".",p.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.xu,{w:"80%",h:"300px",m:"4",children:(0,i.jsx)(eV,{data:{type:(null===(x=m.params)||void 0===x?void 0:x.column_type)||"",datasets:[g,f],min:v,max:j,samples:f.total,binEdges:y}})}),(0,i.jsx)(h.L,{})]})]})}):(0,i.jsx)("div",{children:"Loading..."})});var eQ=t(24112);t(63156);var eX=t(22204),eZ=t(20074),eG=t(48289),eY=t(81737),e$=t.n(eY),e0=t(77249);function e1(){let e=(0,Z.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}var e2=t(50228),e4=t(67605),e5=t.n(e4);let e3="ignore-screenshot";function e8(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:c="solid 1px #ccc",borderRadius:d="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,v.useState)("idle"),f=(0,v.useRef)(null),{onOpen:g,setImgBlob:j,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ey.q)(),[l,r]=(0,v.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&r(e.target.result)}},[r]),(0,i.jsxs)(eu.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{children:"Screenshot Preview"}),(0,i.jsx)(ep.o,{}),(0,i.jsxs)(ef.f,{children:[(0,i.jsxs)(o.k,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(eG.s,{color:"red.600"}),(0,i.jsx)(eN.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(eN.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,e2.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");e5()(l,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=r?c:"",e.style.borderRadius=r?d:"",e.style.backgroundColor=l||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await e$()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,e0.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(j(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function e9(e){let{successToast:n,failToast:t}=e1(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=e8({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,v.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},[o]),c=(0,v.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),d=(0,v.useCallback)(async()=>{o.current&&(await r(),(o.current.element||o.current).style.boxShadow="")},[o,r]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ev.z,{size:"sm",leftIcon:(0,i.jsx)(eZ.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:l,onMouseEnter:a,onMouseLeave:c,onClick:d,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:c,onCopyToClipboard:d}}let e6=(0,eI.G)((e,n)=>{let{...t}=e,{CopyToClipboardButton:l}=e9();return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eX.ZP,{ref:n,...t})})});function e7(){return(0,i.jsx)(o.k,{h:"35px",alignItems:"center",justifyContent:"center",bg:"gray.100",style:{textAlign:"center",gridColumn:"1/-1"},children:(0,i.jsx)(eN.x,{fontWeight:"600",children:" No rows"})})}t(87679);var ne=t(52091);function nn(e,n){let t=function(e,n){let t=[...e],i=[...n],l=[];for(;t.length>0&&i.length>0;)if(l.includes(t[0]))t.shift();else if(l.includes(i[0]))i.shift();else if(t[0]===i[0])l.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{l.includes(e)||l.push(e)}),i.forEach(e=>{l.includes(e)||l.push(e)}),l}(e,n),i={};for(let l of t)e.includes(l)?n.includes(l)?i[l]=void 0:i[l]="removed":i[l]="added";let l={};e.forEach((e,n)=>{l[e]=n});let r=-1;for(let e of t){let n=l[e];void 0!==n&&(n>r?r=n:i[e]="reordered")}return i}function nt(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}function ni(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}function nl(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&r&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?ne.ven:ne.MhP,onClick:h?()=>{let e=d.filter(e=>e!==n);r&&r(e)}:()=>{let e=[...d.filter(e=>"index"!==e),n];r&&r(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?ne.$kI:ne.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let nr=e=>{let n;let t=!1;return"boolean"==typeof e?n=e.toString():""===e?(n="(empty)",t=!0):null==e?(n="(null)",t=!0):n=e,[n,t]},ns=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(eN.x,{style:{color:"gray"},children:"-"});let[l,r]=nr(n[t.key]);return(0,i.jsx)(eN.x,{style:{color:r?"gray":"inherit"},children:l})};function no(e,n,t){let l=e||{columns:[],data:[]},r=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,c=[],d=function(e,n){let t={};return Object.entries(nn(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[l,r]=i;t[l]={status:r,baseColumnIndex:e.columns.findIndex(e=>e.name===l),currentColumnIndex:n.columns.findIndex(e=>e.name===l)}}),t}(l,r),u={},h={},x=!1,m=!1;if(0===s.length)l.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nt(l.columns,s);l.data.forEach((n,t)=>{let i=ni(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nt(r.columns,s),r.data.forEach((n,t)=>{let i=ni(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=nn(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(d))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||ez().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(nl,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eX.Ug,headerCellClass:l,cellClass:r,renderCell:ns,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eX.Ug,headerCellClass:l,cellClass:r,renderCell:ns,size:"auto"}]}};return 0===s.length?c.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=d[e].status||"";c.push({key:"".concat(e),name:(0,i.jsx)(nl,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:ns})}),o.forEach(e=>{let n=d[e].status||"";"index"===e||s.includes(e)||c.push(v(e,n))}),Object.entries(d).forEach(e=>{let[n,t]=e,i=t.status||"";"index"===n||s.includes(n)||o.includes(n)||a&&f.modified>0&&"added"!==i&&"removed"!==i&&"modified"!==i||c.push(v(n,i))}),{columns:c,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let na=(0,eI.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,v.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),c=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),d=(null==c?void 0:c.name)||"column_name",u=(0,v.useMemo)(()=>no(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[d],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}),[o,d,a,r,s]);return 0===u.columns.length?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function nc(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?ne.$kI:ne.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nd(e,n,t){let l=(null==t?void 0:t.pinnedColumns)||[],r=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},c={};if(0===n.length)throw Error("Primary keys are required");let d=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}(e.columns,d,n);n[u]&&(a[i]=n),n[h]&&(c[i]=n)});let x=nn(Object.keys(a),Object.keys(c)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,l]=t,r=a[i],s=c[i],d=JSON.parse(i);if(r&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=r[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=s[t])}),r){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(ez().isEqual(r[t.index],s[t.index])||(d.__status="modified",t.status="modified"));else d.__status="removed",m.removed++}else d.__status="added",m.added++;return"modified"===d.__status&&m.modified++,d});r&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(nc,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eX.Ug,headerCellClass:l,cellClass:r,renderCell:ns,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eX.Ug,headerCellClass:l,cellClass:r,renderCell:ns,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(nc,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:ns})}),l.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||l.includes(t)||r&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nu=t(93998),nh=t(25773),nx=t(63352);let nm=e=>{let{run:n,warnings:t,viewOptions:r,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nh.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.xu,{children:[(0,i.jsx)(nu.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nx.X,{isChecked:null==r?void 0:r.changed_only,onChange:()=>{let e=!(null==r?void 0:r.changed_only);a&&a({...r,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(ev.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},np=(e,n)=>{var t,l,r,s,a,c;let{run:d,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,v.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,v.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,v.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,v.useMemo)(()=>{var e,n;return no(null==d?void 0:null===(e=d.result)||void 0===e?void 0:e.base,null==d?void 0:null===(n=d.result)||void 0===n?void 0:n.current,{changedOnly:p,primaryKeys:m,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:f,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})}})},[d,h,p,m,f,x]),j=(0,v.useMemo)(()=>{let e=m.join(", ");return g.invalidPKeyBase&&g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):g.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[g.invalidPKeyBase,g.invalidPKeyCurrent,m]),y=(null===(l=d.result)||void 0===l?void 0:null===(t=l.current)||void 0===t?void 0:t.limit)||0,b=y>0&&((null==d?void 0:null===(s=d.result)||void 0===s?void 0:null===(r=s.current)||void 0===r?void 0:r.more)||(null==d?void 0:null===(c=d.result)||void 0===c?void 0:null===(a=c.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(y.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,k=[];return(j&&k.push(j),b&&k.push(b),0===g.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):p&&0===g.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nf=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:c,viewOptions:d,onViewOptionsChanged:u}=e,h=(0,v.useMemo)(()=>(null==d?void 0:d.changed_only)||!1,[d]),x=(0,v.useMemo)(()=>(null==d?void 0:d.pinned_columns)||[],[d]),m=(0,v.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nd(null==a?void 0:a.result.diff,t,{changedOnly:h,pinnedColumns:x,onPinnedColumnsChange:e=>{u&&u({...d,pinned_columns:e})}})},[a,d,h,x,u]),p=(null===(l=a.result)||void 0===l?void 0:null===(t=l.diff)||void 0===t?void 0:t.limit)||0,f=p>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(r=s.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(p.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,g=[];return(f&&g.push(f),0===m.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):h&&0===m.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},ng=(0,eI.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eI.G)(nf);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eI.G)(np);return(0,i.jsx)(t,{...e,ref:n})}});function nv(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:r=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(l.xu,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?ne.$kI:ne.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let nj=(0,eI.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,c=(0,v.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=null==t?void 0:t.result,u=(0,v.useMemo)(()=>d?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(nv,{name:t,...n}),width:"auto",renderCell:ns});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=ez().findIndex(e.columns,e=>e.name===n);i<0||t.push(r(i,n))}),e.columns.forEach((e,n)=>{l.includes(e.name)||t.push(r(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,r,s]);if(0===u.columns.length)return(0,i.jsx)(eQ.M,{height:"100%",children:"No data"});let x=(null==d?void 0:d.limit)||0,m=x>0&&(null==d?void 0:d.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nu.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.xu,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(ev.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function ny(e,n){if(e=.1?t.toFixed(1):" <0.1 ","%")}if(!(e>n))return"0 %";{let t=(e-n)/e*100;return"-".concat(t>=.1?t.toFixed(1):" <0.1 ","%")}}var nb=t(68844),nk=t.n(nb);let nw=(0,eI.G)(function(e,n){let{run:t}=e;function l(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nk()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nk()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="No Change";return null!==t&&null!==i?l=t!==i?ny(t,i):"No Change":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===s.length?(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:l},{key:"base",name:"Base Rows",cellClass:l},{key:"current",name:"Current Rows",cellClass:l},{key:"delta",name:"Delta",cellClass:l}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},className:"rdg-light",enableScreenshot:!0})})})});var nC=t(32088),n_=t(96124);let nS="#63B3ED";function nz(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),l=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([l]).map((n,t)=>{let r;let s=t===i.length,o=s?l:i[t],a=!1;return s?(r="(others)",a=!0):null==n?(r="(null)",a=!0):"string"==typeof n&&0===n.length?(r="(empty)",a=!0):r=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:r,count:o,displayCount:eL(o),displayRatio:eD(o/e.valids)||"N/A"}})}function nR(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nC.u,{label:(0,i.jsxs)(l.xu,{children:[(0,i.jsxs)(eN.x,{children:[(0,i.jsx)(eW,{color:eq}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(eN.x,{children:[(0,i.jsx)(eW,{color:eF}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function nT(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=nz(n.current,t),s=nz(n.base,t);return(0,i.jsxs)(l.xu,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eF})," Base"]}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eq})," Current"]}),(0,i.jsx)(h.L,{})]}),r.map((e,t)=>{let l=s[t];return e.isLastItemOthers&&0===e.count&&0===l.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(v.Fragment,{children:[(0,i.jsx)(nR,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(eN.x,{noOfLines:1,width:"10em",fontSize:"sm",color:e.isSpecialLabel?"gray.400":"inherit",children:e.label}),(0,i.jsxs)(o.k,{width:"70%",direction:"column",children:[(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eq}),(0,i.jsx)(eN.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(eN.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:eF}),(0,i.jsx)(eN.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(eN.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(n_.i,{})]},t)})]})}function nE(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=nS}=e;eM.kL.register(eM.uw,eM.ZL,eM.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,l,{animation:r}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nS}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:i,hoverBackgroundColor:i,borderWidth:0,borderColor:i,barPercentage:1,categoryPercentage:.6}]}}({topkCount:n,topkLabel:t,color:s});return(0,i.jsx)(eA.$Q,{data:a,options:o,plugins:[]})}let nO=(0,eI.G)((e,n)=>{let{run:t}=e,[l,s]=(0,v.useState)(!0),a=t.result,d=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(eU,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",children:["Model ",d.model,".",d.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nT,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:l}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(r.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:l?"View More Items":"View Only Top-10"})})]})}),nI=(0,eI.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:c}=e,d=(0,v.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,v.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,v.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nd(null==r?void 0:r.result,t,{changedOnly:d,pinnedColumns:u,onPinnedColumnsChange:e=>{c&&c({...a,pinned_columns:e})}})},[r,a,d,u,c]),x=(null===(t=r.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==r?void 0:null===(l=r.result)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):d&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nM=t(93960),nA=t(66011);function nD(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,v.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,c=null==n?void 0:n.primary_key,{columns:d,primaryKey:u,isLoading:h,error:x}=eT(n.model);(0,v.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,v.useEffect)(()=>{r(!!c&&!!a)},[c,a,r]);let m=d.map(e=>e.name),p=Array.isArray(c)?c:c?[c]:void 0;return h?(0,i.jsx)(l.xu,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(l.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nh.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Model"}),(0,i.jsx)(nM.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Primary key"}),(0,i.jsx)(nA.Z,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Columns"}),(0,i.jsx)(nx.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nA.Z,{isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(n.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,columns:(e||[]).map(e=>e.value)})}})]})]})}var nL=t(49801),nN=t(50104),nq=t(39171),nF=t(39226),nP=t(70949),nH=t(34510);function nW(e){let{params:n,column:t}=e,{runAction:r}=nG(),a=(e,t)=>{r("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nL.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nF.q,{lineHeight:"20px",children:(0,i.jsxs)(nP.k,{title:"Action",as:l.xu,fontSize:"8pt",children:[(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nH.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nV=(0,eI.G)(function(e,n){let{run:t}=e,r=t.result,a=t.params,c=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},d=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(eQ.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:ne.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nW,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:c},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,r=t[n.key];return(0,i.jsx)(l.xu,{textAlign:"end",children:void 0!=r&&null!==r?"".concat((100*r).toFixed(2)," %"):"N/A"})},cellClass:c}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(l.xu,{px:"16px",children:["Model: ",a.model,", ",r.summary.total," total (",r.summary.total-r.summary.added-r.summary.removed," ","common, ",r.summary.added," added, ",r.summary.removed," removed)"]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray",flex:"1"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nK=t(18502),nJ=t(63594);let nU={lineage_diff:{title:"Lineage Diff",icon:ek.Ks7},schema_diff:{title:"Schema Diff",icon:nJ.C8A},query:{title:"Query",icon:ek.r2i,RunResultView:nj},query_base:{title:"Query Base",icon:ek.r2i,RunResultView:nj},query_diff:{title:"Query Diff",icon:ek.r2i,RunResultView:ng},row_count_diff:{title:"Row Count Diff",icon:nJ.QUK,RunResultView:nw},profile_diff:{title:"Profile Diff",icon:ek.KA6,RunResultView:na},value_diff:{title:"Value Diff",icon:ek.pRi,RunResultView:nV,RunForm:nD},value_diff_detail:{title:"Value Diff Detail",icon:ek.pRi,RunResultView:nI,RunForm:nD},top_k_diff:{title:"Top-K Diff",icon:nK.Pkc,RunResultView:nO,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.map(e=>e.name);return((0,v.useEffect)(()=>{r(!!n.column_name)},[n,r]),o)?(0,i.jsx)(l.xu,{children:"Loading..."}):0===c.length||a?(0,i.jsx)(l.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(e_.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:c.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:ek.dku,RunResultView:eB,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.filter(e=>!eE(e.type)&&!eO(e.type));return o?(0,i.jsx)(l.xu,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(l.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(e_.P,{placeholder:0!==c.length?"Select column":"No numeric column is available",isDisabled:0===c.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let l=e.target.value;r(!!l);let s=(null===(i=c.find(e=>e.name===l))||void 0===i?void 0:i.type)||"";t({...n,column_name:l,column_type:s})},children:c.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}}},nB=e=>nU[e],nQ=(0,v.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nX=e=>{let[n]=(0,eb.TH)();(0,v.useEffect)(()=>{e()},[e,n])};function nZ(e){var n;let{children:t}=e,[l,r]=(0,v.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ey.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),p=(0,Z.p)(),[f,g]=(0,v.useState)(),[j,y]=(0,eb.TH)(),k=(0,b.NL)(),w=(0,v.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:H.runs()})},[g,d,k]),C=(0,v.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ei(e,n,1);1===t.length&&(i=t[0])}let s=nB(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:c,RunForm:d}=s;if(void 0===c)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==d&&(null==t?void 0:t.showForm))r({session:l,title:a,type:e,params:n,lastRun:i,options:t,RunForm:d}),o();else{let{run_id:t}=await $(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:H.runs()}),j.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[r,o,w,p,j,y,k]);nX(a);let _=async(e,n)=>{try{a();let{run_id:t}=await $(e,n,{nowait:!0});w(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,v.useEffect)(()=>{f&&j.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nQ.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[l&&(0,i.jsx)(ej,{isOpen:s,onClose:a,onExecute:_,title:l.title,type:l.type,params:l.params,initialRun:l.lastRun,RunForm:(null===(n=l.options)||void 0===n?void 0:n.showForm)&&l.RunForm?l.RunForm:void 0},l.session),t]})}let nG=()=>(0,v.useContext)(nQ);function nY(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ea,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nZ,{children:n})})})})})}var n$=t(81600);async function n0(){return(await U.post("/api/checks",{type:"simple"})).data}async function n1(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function n2(){return(await U.get("/api/checks")).data}async function n4(e){return(await U.get("/api/checks/".concat(e))).data}async function n5(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function n3(e){return(await U.delete("/api/checks/".concat(e))).data}async function n8(e){return await U.post("/api/checks/reorder",e)}var n9=t(94734),n6=t(71738),n7=t(38414),te=t(29598),tn=t(62216),tt=t(42675),ti=t(54097),tl=t(95862),tr=t(82960),ts=t(69879),to=t(618),ta=t(77153);function tc(e){let{name:n,setName:t}=e,[r,s]=(0,v.useState)(!1),[o,a]=(0,v.useState)(n),c=(0,v.useRef)(null),d=(0,v.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,v.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,c,d]),(0,i.jsxs)(ts.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(ta.X,{color:"gray.500"}),children:[(0,i.jsx)(to.g,{children:(0,i.jsx)(l.xu,{children:"Checklist"})}),(0,i.jsx)(to.g,{flex:"0 1",cursor:"pointer",children:r?(0,i.jsx)(nM.I,{ref:c,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"auto",minW:"200px",maxW:"600px"}):(0,i.jsx)(l.xu,{onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}var td=t(94019);t(81974);var tu=t(78439);function th(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:c}=nG(),d=a||r,u=()=>{c("histogram_diff",{model:n,column_name:t,column_type:d},{showForm:!1})},x=()=>{c("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!r||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nL.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(tu.h,{children:(0,i.jsx)(nF.q,{lineHeight:"20px",children:(0,i.jsxs)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eE(d)&&!eO(d)),children:"Histogram Diff"}),(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tx(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function l(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:l}=e;return n?(0,i.jsx)(th,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:l},{key:"currentType",name:"Current Type",resizable:!0,cellClass:l}],rows:Object.values(e)}}var tm=t(89725),tp=t(13965);function tf(e){let n,t,{base:l,current:r,enableScreenshot:s=!1}=e,{columns:a,rows:c}=(0,v.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(nn(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,l]=e;t[i].baseIndex=n+1,t[i].baseType=l.type}),Object.entries(n).map((e,n)=>{let[i,l]=e;t[i].currentIndex=n+1,t[i].currentType=l.type}),t}(null==l?void 0:l.columns,null==r?void 0:r.columns),n=(null==r?void 0:r.resource_type)||(null==l?void 0:l.resource_type);return n&&["model","seed","snapshot"].includes(n)?tx(e,(null==r?void 0:r.name)||(null==l?void 0:l.name)):tx(e)},[l,r]),{lineageGraph:d}=ec(),u=!(null==d?void 0:d.catalogMetadata.base),h=!(null==d?void 0:d.catalogMetadata.current);u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let x=l&&void 0===l.columns,m=r&&void 0===r.columns;return x&&m?t="Schema information is missing on both current and base environments.":x?t="Schema information is missing on base environment.":m&&(t="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[n?(0,i.jsxs)(tm.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tp.z,{}),n]}):t?(0,i.jsxs)(tm.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tp.z,{}),t]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:a,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},className:"rdg-light",enableScreenshot:s})})]})}async function tg(e){return(await U.post("/api/select",e)).data}var tv=t(12282);t(15080);let tj=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tv.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},ty=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tv.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var tb=t(79898),tk=t(68630),tw=t(91363);let tC=ne.Nbv,t_=ne.sFB,tS=ne.UGs;function tz(e){return"added"===e?{color:"#1dce00",icon:tC}:"removed"===e?{color:"#ff4444",icon:t_}:"modified"===e?{color:"#ffa502",icon:tS}:{color:"inherit",icon:void 0}}function tR(e){if("model"===e)return{color:"#c0eafd",icon:tk.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tw._MV};if("source"===e)return{color:"#a6dda6",icon:tk.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tw.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tw.R1C};if("seed"===e)return{color:"#a6dda6",icon:tk.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tk.Dmm};else return{color:"inherit",icon:void 0}}function tT(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:r,selected:a,onSelect:c,schemaChanged:d}=e,{icon:u}=tR(r.resourceType),{base:h,current:x}=r.data;if(d){var m;n=null===(m=nB("schema_diff"))||void 0===m?void 0:m.icon,t=tz("modified").color}else!h&&x?(n=tz("added").icon,t=tz("added").color):h&&!x&&(n=tz("removed").icon,t=tz("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>c(r.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(l.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})};function tO(e){let{check:n}=e,{lineageGraph:t}=ec(),l=n.params,r=[...H.check(n.check_id),"select"],{isLoading:s,error:o,refetch:a,data:c}=(0,y.a)({queryKey:r,queryFn:async()=>tg({select:null==l?void 0:l.select,exclude:null==l?void 0:l.exclude}),refetchOnMount:!0,enabled:!(null==l?void 0:l.node_id)}),[d,u]=(0,v.useMemo)(()=>{let e=[],n=[],i=[],r=[];if(null==l?void 0:l.node_id){let n=null==t?void 0:t.nodes[l.node_id];n&&e.push(n)}else for(let n of(null==c?void 0:c.nodes)||[]){let i=null==t?void 0:t.nodes[n];i&&e.push(i)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tT(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?i.push(e.id):e.data.base&&!e.data.current&&r.push(e.id)}function d(e){return n.includes(e.id)?3:i.includes(e.id)?2:r.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==l?void 0:l.node_id,null==c?void 0:c.nodes,t]),[h,x]=(0,v.useState)(0);if(s)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(o)return(0,i.jsxs)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==o?void 0:o.message]});if(0==d.length)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(h(0,i.jsx)(tE,{node:e,schemaChanged:u.includes(e.id),selected:n===h,onSelect:()=>{x(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})}var tI=t(51643);function tM(e){let{value:n,onChange:t}=e,[l,s]=(0,v.useState)(!1),[a,c]=(0,v.useState)(),d=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(l&&d.current){let e=d.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[l]),l)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tI.g,{value:a,onChange:e=>{c(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1)},ref:d,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(ev.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(eN.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tA=t(40902);function tD(){let e=(0,n$._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tD=function(){return e},e}function tL(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tN(e){return e.description?e.description:"_(no description)_"}var tq=t(23256),tF=t(31265);let tP=e=>{let{value:n,onChange:t,onRun:l,onRunBase:r,onRunDiff:a,label:c,options:d={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(c||l||r)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(eN.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(ev.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tw.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tF.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,l),r&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,r),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...d}})]})},tH=e=>{let{value:n,baseValue:t,onChange:l,onChangeBase:r,onRun:s,onRunBase:a,onRunDiff:c,options:d={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tq.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tP,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:d,...u})}),(0,i.jsx)(tq.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tP,{label:"Current",value:n,onChange:l,onRun:s,options:d,...u})})]})})};var tW=t(23567),tV=t(20085);let tK=(0,eI.G)((e,n)=>{var t,r,s,a;let{isRunning:c,isAborting:d,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(r=h.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tm.b,{status:"error",children:[(0,i.jsx)(tp.z,{}),"Error: ",y]});if(void 0!==c?c:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(eQ.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsxs)(o.k,{alignItems:"center",children:[(null==u?void 0:u.percentage)===void 0||(null==u?void 0:u.percentage)===null?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tW.D,{size:"20px",value:100*u.percentage,mr:"8px"}),d?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!d&&(0,i.jsx)(ev.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(l.xu,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tV.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tJ=t(65674),tU=t(29012),tB=t(25783),tQ=t(43361),tX=t(49110),tZ=t(55415),tG=t(24432);t(90548),t(91074);var tY=t(66633),t$=t(83143),t0=t(29937);function t1(e){let{node:n}=e,{icon:t}=tR(n.resourceType);return(0,i.jsx)(nC.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(n9.Vp,{children:[(0,i.jsx)(n9.AD,{as:t}),(0,i.jsx)(n9.Sn,{children:n.resourceType})]})})}function t2(e){let{rowCount:n}=e,t=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===l?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(eN.x,{children:r}),(0,i.jsx)(s.J,{as:t$.Rgz}),(0,i.jsx)(eN.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(eN.x,{children:o}),(0,i.jsx)(s.J,{as:t0.lxc,color:"gray.500"}),(0,i.jsx)(eN.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nC.u,{label:r,children:(0,i.jsxs)(n9.Vp,{children:[(0,i.jsx)(n9.AD,{as:x}),(0,i.jsx)(n9.Sn,{children:m||c?(0,i.jsx)(tY.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(t2,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(n9.bq,{as:nq.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(tt.n,{}),size:"xs",onClick:a})]})})}let t5=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tW.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.xu,{children:"Skipped"}),s&&(0,i.jsx)(nC.u,{label:s,children:(0,i.jsx)(eG.s,{})})]});if(!a)return(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"});let{error:c,result:d,run_id:u,progress:h}=a;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tW.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(c)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.xu,{children:"Error"}),s&&(0,i.jsx)(nC.u,{label:c,children:(0,i.jsx)(nu.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(n9.Vp,{children:(0,i.jsx)(n9.Sn,{children:(0,i.jsx)(o.k,{fontSize:"10pt",color:e>0?"red":"green",alignItems:"center",gap:"3px",children:e>0?"".concat(e," columns mismatched"):"All columns match"})})})}if("row_count_diff"===a.type){let e=a.result;return(0,i.jsx)(t4,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},t3=e=>{var n,t,r,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ec(),m=null==x?void 0:x[u],p=null==h?void 0:h.nodes[u];if(!m&&!p)return(0,i.jsx)(i.Fragment,{});if((null==p?void 0:p.data.base)&&(null==p?void 0:p.data.current)&&(c=tT(null===(r=p.data.base)||void 0===r?void 0:r.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nC.u,{label:"Schema (".concat(c?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nB("schema_diff"))||void 0===n?void 0:n.icon,color:c?tz("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nC.u,{label:"Row count (".concat(d?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tz("modified").color:"lightgray"})})})]})};var t8=t(13358),t9=t(15196),t6=t(28023),t7=t(84963);function ie(e){let{base:n,current:t}=e;return(0,i.jsx)(tF.SV,{height:"100%",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}async function it(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}function ii(e){var n,t,r,a,d,f,g;let{node:j,onCloseNode:y}=e,[,b]=(0,eb.TH)(),{setSqlQuery:k,setPrimaryKeys:w}=_(),C="model"===j.resourceType||"seed"===j.resourceType||"source"===j.resourceType||"snapshot"===j.resourceType,{isOpen:S,onOpen:z,onClose:R}=(0,ey.q)(),{runAction:T}=nG(),{envInfo:E}=ec(),{primaryKey:O}=eT(j.name),I=()=>{T("row_count_diff",{node_names:[j.name]},{showForm:!1,showLast:!1})},M=(0,v.useCallback)(async()=>{let e=j.id,n=await it({node_id:e});b("/checks/".concat(n.check_id))},[j,b]),A="added"===j.changeStatus||"removed"===j.changeStatus;return(0,i.jsxs)(t9.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.xu,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(c.X,{size:"sm",children:j.name})}),(0,i.jsx)(h.L,{}),("model"===j.resourceType||"seed"===j.resourceType||"snapshot"===j.resourceType)&&(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{as:ev.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nB("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==E?void 0:E.adapterType)==="dbt"?k('select * from {{ ref("'.concat(j.name,'") }}')):(null==E?void 0:E.adapterType)==="sqlmesh"&&k("select * from ".concat(j.name)),w(void 0!==O?[O]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===j.resourceType||"snapshot"===j.resourceType)&&(0,i.jsx)(nH.s,{onClick:z,icon:(0,i.jsx)(tk.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>I(),children:"Row Count Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(r=nB("profile_diff"))||void 0===r?void 0:r.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{T("profile_diff",{model:j.name},{showForm:!1,showLast:!1})},children:"Profile Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nB("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{T("value_diff",{model:j.name},{showForm:!0,showLast:!1})},children:"Value Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nB("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{T("top_k_diff",{model:j.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nB("histogram_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{T("histogram_diff",{model:j.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]}),(0,i.jsx)(t6.R,{}),(0,i.jsx)(nP.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nB("schema_diff"))||void 0===g?void 0:g.icon}),fontSize:"14px",onClick:M,children:"Schema Diff"})})]})]}),(0,i.jsx)(l.xu,{flex:"0 1 1%",children:(0,i.jsx)(t7.P,{onClick:y})})]}),(0,i.jsx)(l.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(t1,{node:j}),("model"===j.resourceType||"snapshot"===j.resourceType||"seed"===j.resourceType)&&(0,i.jsx)(t4,{node:j,onRefresh:I})]})}),C&&(0,i.jsxs)(x.m,{overflow:"auto",as:o.k,children:[(0,i.jsx)(m.t,{children:(0,i.jsx)(p.O,{children:"Columns"})}),(0,i.jsx)(n6.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(n7.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tf,{base:j.data.base,current:j.data.current})})})]}),(0,i.jsxs)(eu.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(em.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsx)(ie,{base:j.data.base,current:j.data.current})})]})]})]})}var il=t(88989),ir=t(12867),is=t(27547);async function io(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function ia(e){var n;let{nodes:t,onFinish:l}=e,[,r]=(0,eb.TH)();return(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e;1===t.length?e=await it({node_id:t[0].id}):await Promise.all(t.map(async e=>{await it({node_id:e.id})})),l(),e?r("/checks/".concat(e.check_id)):r("/checks")},children:[(0,i.jsx)(s.J,{as:null===(n=nB("schema_diff"))||void 0===n?void 0:n.icon}),"Add schema check"]})}function ic(e){var n;let{viewMode:t,nodes:l,onFinish:r,isDisabled:o,withIcon:a}=e,[,c]=(0,eb.TH)();return(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",backgroundColor:"white",isDisabled:0===l.length||o,onClick:async()=>{let e=l.map(e=>e.id),n=await io({view_mode:t,node_ids:e});r(),n?c("/checks/".concat(n.check_id)):c("/checks")},children:[a&&(0,i.jsx)(s.J,{as:null===(n=nB("lineage_diff"))||void 0===n?void 0:n.icon}),"Add lineage diff check"]})}function id(e){var n,t,r,o,a,c;let{viewMode:d,nodes:h,onClose:x,onActionStarted:m,onActionNodeUpdated:p,onActionCompleted:f}=e,[g,j]=(0,v.useState)({mode:"per_node",status:"pending",completed:0,total:0}),y=(0,b.NL)(),[,k]=(0,eb.TH)(),{showRunId:w}=nG(),C=async(e,n,t)=>{let i="multi_nodes";g.mode=i,m(),g.status="running";let l=[];for(let e of h){let t=n(e);t?(e.action={mode:i,status:"skipped",skipReason:t},p(e)):(e.action={mode:i,status:"pending"},l.push(e))}let r=t(l);try{let{run_id:n}=await $(e,r,{nowait:!0});for(w(n),g.currentRun={run_id:n},g.total=1;;){let e=await ee(n,2);g.currentRun=e;let t=e.error?"failure":e.result?"success":"running";for(let n of l)n.action={mode:i,status:t,run:e},p(n);if(e.error||e.result)break}}catch(e){}if(g.completed=1,"canceling"===g.status){g.status="canceled",f();return}g.status="completed",f()},_=async(e,n)=>{let t="per_node";for(let e of(g.mode=t,m(),g.status="running",h))e.action={mode:t,status:"pending"},p(e);for(let i of(g.completed=0,g.total=h.length,h)){let{params:l,skipReason:r}=n(i);if(r)i.action={mode:t,status:"skipped",skipReason:r},p(i);else try{let{run_id:n}=await $(e,l,{nowait:!0});for(g.currentRun={run_id:n},i.action={mode:t,status:"running"},p(i);;){let e=await ee(n,2);g.currentRun=e;let l=e.error?"failure":e.result?"success":"running";if(i.action={mode:t,status:l,run:e},p(i),e.error||e.result)break}}catch(e){}finally{g.currentRun=void 0}if(g.completed++,"canceling"===g.status){g.status="canceled",f();return}}g.status="completed",f()},S=async()=>{let e=[];for(let n of h)"model"!==n.resourceType?(n.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},p(n)):e.push(n.name);C("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},z=async()=>{_("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},R=async()=>{var e;g.status="canceling",(null===(e=g.currentRun)||void 0===e?void 0:e.run_id)&&en(g.currentRun.run_id)},T=(0,v.useCallback)(async()=>{var e;let n=null===(e=g.currentRun)||void 0===e?void 0:e.run_id;if(!n)return;let t=await n1(n);y.invalidateQueries({queryKey:H.checks()}),k("/checks/".concat(t.check_id))},[null===(n=g.currentRun)||void 0===n?void 0:n.run_id,k,y]);return(0,ir.z)(()=>{"running"===g.status&&R()}),(0,i.jsxs)(l.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:["pending"===g.status&&(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(is.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:x,children:[(0,i.jsxs)(ev.z,{children:[h.length," selected"]}),(0,i.jsx)(nq.h,{"aria-label":"Exit select Mode",icon:(0,i.jsx)(il.D,{})})]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(ia,{nodes:h,onFinish:x}),(0,i.jsx)(ic,{viewMode:d,nodes:h,onFinish:x,withIcon:!0})]}),(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===h.length,onClick:S,children:[(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon}),"Row count diff"]}),(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===h.length,onClick:z,children:[(0,i.jsx)(s.J,{as:null===(r=nB("value_diff"))||void 0===r?void 0:r.icon}),"Value diff"]})]})]}),"pending"!==g.status&&(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.xu,{fontSize:"10pt",children:["Progress: ","per_node"===g.mode?"".concat(g.completed," / ").concat(g.total):(null===(c=g.currentRun)||void 0===c?void 0:null===(a=c.progress)||void 0===a?void 0:a.percentage)?"".concat(100*g.currentRun.progress.percentage,"%"):"completed"===g.status?"100%":"0%"," ","canceled"===g.status?" (canceled)":""]}),"running"===g.status||"canceling"===g.status?(0,i.jsx)(ev.z,{size:"xs",variant:"outline",onClick:R,isLoading:"canceling"===g.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsxs)(u.U,{children:["multi_nodes"===g.mode&&(null===(o=g.currentRun)||void 0===o?void 0:o.result)&&(0,i.jsx)(ev.z,{display:"none",size:"xs",variant:"outline",onClick:T,children:"Add to Checklist"}),(0,i.jsx)(ev.z,{size:"xs",variant:"outline",onClick:x,children:"Close"})]})]})]})}let iu=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nG();return(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(s.J,{as:ne.M1Q}),size:"xs",variant:"outline",onClick:e?t:n,children:e?"Hide":"Show"})},ih=e=>{let{isDisabled:n,viewOptions:t,onViewOptionsChanged:l}=e,r=t.view_mode||"changed_models",o=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{as:ev.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tR("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===r?"Changed Models":"All"}),(0,i.jsxs)(nF.q,{title:"packages",children:[(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:"changed_models"===r,onChange:()=>o("changed_models"),children:"Changed Models"}),(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:"all"===r,onChange:()=>o("all"),children:"All"})]})]})},ix=e=>{var n,t;let{viewOptions:l,onViewOptionsChanged:r,isDisabled:o}=e,{lineageGraph:a}=ec(),c=new Set;for(let e of Object.values((null==a?void 0:a.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==a?void 0:null===(t=a.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=l.packages?new Set(l.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),r({...l,packages:Array.from(n)})};return(0,i.jsxs)(nL.v,{closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{as:ev.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t$.zFh}),size:"xs",variant:"outline",isDisabled:o,children:m}),(0,i.jsx)(nF.q,{title:"packages",children:(0,i.jsxs)(nP.k,{title:"Select Packages",children:[(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?r({...l,packages:[]}):r({...l,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(t6.R,{}),Array.from(c).map(e=>(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},im=e=>{let[n,t]=(0,v.useState)(e.value),l=(0,v.useRef)(null);return(0,v.useEffect)(()=>{l.current&&(l.current.value=e.value)},[e.value]),(0,i.jsx)(nM.I,{ref:l,height:"24px",fontSize:"10pt",placeholder:"",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),l.current&&l.current.blur())},onBlur:()=>t(e.value)})},ip=e=>(0,i.jsx)(im,{isDisabled:e.isDisabled,value:e.viewOptions.select||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,select:n||void 0})}}),ig=e=>(0,i.jsx)(im,{isDisabled:e.isDisabled,value:e.viewOptions.exclude||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,exclude:n||void 0})}}),iv=e=>(0,i.jsxs)(l.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.xu,{fontSize:"8pt",children:e.label}),e.children]}),ij=e=>{let[,n]=(0,eb.TH)(),{runAction:t}=nG(),l=(0,v.useCallback)(e=>{e.check_id&&n("/checks/".concat(e.check_id))},[n]);return(0,i.jsxs)(nL.v,{placement:"bottom-end",children:[(0,i.jsx)(nN.j,{as:ev.z,size:"xs",isDisabled:e.isDisabled,children:"..."}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:()=>{t("row_count_diff",{select:e.viewOptions.select,exclude:e.viewOptions.exclude})},children:"Row Count Diff by Selector"})}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await io(e.viewOptions);n&&l(n)},children:"Lineage Diff"}),(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await it({select:e.viewOptions.select,exclude:e.viewOptions.exclude});n&&l(n)},children:"Schema Diff by Selector"})]})]})]})},iy=e=>(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(iv,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(iu,{})}),(0,i.jsx)(iv,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(ih,{...e})}),(0,i.jsx)(iv,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(ix,{...e})}),(0,i.jsx)(iv,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(ip,{...e})}),(0,i.jsx)(iv,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ig,{...e})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iv,{label:"Actions",action:!0,children:(0,i.jsxs)(is.h,{isAttached:!0,variant:"outline",children:[(0,i.jsx)(ev.z,{size:"xs",fontSize:"9pt",onClick:e.onSelectNodesClicked,isDisabled:e.isDisabled,children:"Select nodes"}),(0,i.jsx)(ij,{...e})]})})]})});function ib(){return(0,i.jsx)(l.xu,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,l]]=e,{icon:r,color:a}=tz(n);return(0,i.jsx)(nC.u,{label:l,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:r})," ",t]})},n)})})}var ik=t(11978);let iw={customNode:function(e){var n,t;let r,{data:a}=e,{isHighlighted:c,isSelected:d,resourceType:x,changeStatus:m}=a,p=(0,R.oR)(e=>e.transform[2]>.3),{icon:f}=tR(x),g="gray.400",v="solid";m&&(r=tz(m).icon,g=tz(m).color);let j=g,y=a.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",b=null==a?void 0:a.name;return(0,i.jsx)(nC.u,{label:"model"===x?b:"".concat(b," (").concat(x,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",_hover:{backgroundColor:p?"gray.100":g},borderColor:j,borderWidth:1,borderStyle:v,backgroundColor:p?"white":g,borderRadius:3,boxShadow:y,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===c?"node-highlight":!0===d?"node-highlight":!1===c?"node-unhighlight":void 0,children:[(0,i.jsx)(o.k,{backgroundColor:g,padding:2,borderRightWidth:1,borderColor:j,borderStyle:v,alignItems:"top",visibility:p?"inherit":"hidden",children:(0,i.jsx)(s.J,{as:f})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:p?"inherit":"hidden",children:[(0,i.jsx)(l.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:b}),r&&(0,i.jsx)(o.k,{children:(0,i.jsx)(s.J,{color:g,as:r,flex:"0 0 20px"})})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:p?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(h.L,{}),a.isActionMode?a.action?(0,i.jsx)(t5,{node:a,action:a.action}):(0,i.jsx)(i.Fragment,{}):"model"===a.resourceType?(0,i.jsx)(t3,{id:a.id}):(0,i.jsx)(i.Fragment,{})]})})]}),Object.keys(null!==(n=null==a?void 0:a.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==a?void 0:a.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},iC={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:l,targetY:r,sourcePosition:s,targetPosition:o,style:a={},markerEnd:c,data:d}=e,u={...a};(null==d?void 0:d.changeStatus)&&(u.stroke=tz(null==d?void 0:d.changeStatus).color,u.strokeDasharray="5"),(null==d?void 0:d.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:l,targetY:r,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:c,style:{...u,...a}})})}},i_=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tz(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iS=(e,n)=>{let t=null==e?void 0:e.current,i=(0,v.useRef)({width:0,height:0});(0,v.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,l=t.contentRect.height;(Math.abs(l-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&l>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:l}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])};function iz(e){var n;let{...t}=e,r=(0,R._K)(),a=(0,v.useRef)(null),{successToast:c,failToast:d}=e1(),{copyToClipboard:h,ImageDownloadModal:x,ref:m}=e8({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(e3))},onSuccess:()=>{c("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),d("Failed to copy image to clipboard",e)}}),[p,f,g]=(0,R.Rr)([]),[j,y,b]=(0,R.ll)([]),[k,w]=(0,v.useState)(t.viewOptions||{}),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:T}=ec(),{showRunId:O,closeRunResult:I}=nG(),W=k.view_mode||t.viewMode||"changed_models",[V,K]=(0,v.useState)("detail"),[J,U]=(0,v.useState)("normal"),[B,Q]=(0,v.useState)(),[X,G]=(0,v.useState)(!1),[Y,$]=(0,v.useState)(!1),[ee,en]=(0,v.useState)({x:0,y:0});[...H.lineage(),k.select,k.exclude];let et=(0,Z.p)();(0,v.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(k.select||k.exclude)try{e=(await tg({select:k.select,exclude:k.exclude})).nodes}catch(e){}let[n,t]=D(C,k,e);L(n,t),f(n),y(t)})()},[f,y,C]);let ei=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=r.getZoom();r.setCenter(n,t,{zoom:i,duration:200})}};iS(a,async()=>{if("detail"===V||"action_result"===V){let e=p.find(e=>e.data.isSelected);e?ei(e):r.fitView({nodes:p,duration:200})}});let el=(0,v.useCallback)(e=>{f(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[f]),er=async e=>{let n;if(!C)return;try{n=(await tg({select:e.select,exclude:e.exclude})).nodes}catch(e){if(e instanceof ik.d7){var t,i;et({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[l,s]=D(C,e,n);L(l,s),f(l),y(s),w(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{r.fitView({nodes:l,duration:200})})()};if(S)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tU.$,{size:"xl"})});let es=()=>{$(!1),en({x:0,y:0})};return z?(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsx)(l.xu,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(l.xu,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):"changed_models"!==W||(null==C?void 0:null===(n=C.modifiedSet)||void 0===n?void 0:n.length)?(0,i.jsxs)(tj,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nh.g,{ref:a,divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[t.interactive&&(0,i.jsx)(iy,{isDisabled:"normal"!==J,viewOptions:k,onViewOptionsChanged:er,onSelectNodesClicked:()=>{let e="detail"===V?"action":"detail";Q(void 0),G(!1),f(P(p,"action"===e)),K(e),U("selector")}}),(0,i.jsxs)(R.x$,{nodeTypes:iw,edgeTypes:iC,nodes:p,edges:j,onNodesChange:g,onEdgesChange:b,onNodeClick:(e,n)=>{if(!1!==t.interactive){var i,l,r,s,o;(es(),"detail"===V)?(Q(n.data),X||(ei(n),G(!0)),f(q(n.id,p))):"action_result"===V?((null===(l=n.data.action)||void 0===l?void 0:null===(i=l.run)||void 0===i?void 0:i.run_id)&&O(null===(s=n.data.action)||void 0===s?void 0:null===(r=s.run)||void 0===r?void 0:r.run_id),ei(n),f(q(n.id,p))):f((o=n.id,p.map(e=>{let n=e.id===o;return{...e,data:{...e.data,isSelected:e.data.isSelected!==n}}})))}},onNodeMouseEnter:(e,n)=>{if(!C)return;let[t,i]=N(Array.from(E(M(C,[n.id]),A(C,[n.id]))),p,j);f(t),y(i)},onNodeMouseLeave:(e,n)=>{if(!C)return;let[t,i]=N(Array.from(A(C,C.modifiedSet)),p,j);f(t),y(i)},onNodeContextMenu:(e,n)=>{"action"===V&&(e.preventDefault(),en({x:e.clientX,y:e.clientY,selectedNode:n}),$(!0))},onClick:es,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:t.interactive,ref:m,children:[(0,i.jsx)(tX.A,{color:"#ccc"}),(0,i.jsx)(tZ.Z,{showInteractive:!1,position:"top-right",className:e3,children:(0,i.jsx)(tZ.B,{title:"copy image",onClick:async()=>{h()},children:(0,i.jsx)(s.J,{as:t$.C3L})})}),(0,i.jsx)(x,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(ib,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(eN.x,{fontSize:"xl",color:"grey",opacity:.5,children:p.length>0?"":"No nodes"})}),(0,i.jsx)(tG.a,{nodeColor:i_,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),(0,i.jsx)(R.s_,{position:"bottom-center",className:e3,children:(0,i.jsx)(tQ.R,{in:"selector"===J,unmountOnExit:!0,style:{zIndex:10},children:(0,i.jsx)(id,{viewMode:W,nodes:p.map(e=>e.data).filter(e=>e.isSelected),onClose:()=>{K("detail"),U("normal");let e=P(p);Q(void 0),G(!1),f(e),I(),null==T||T()},onActionStarted:()=>{K("action_result")},onActionNodeUpdated:el,onActionCompleted:()=>{}})})})]})]}),"detail"===V&&B?(0,i.jsx)(l.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(ii,{node:B,onCloseNode:()=>{Q(void 0),G(!1),f(P(p))}})}):(0,i.jsx)(l.xu,{}),Y&&(0,i.jsx)(nL.v,{isOpen:!0,onClose:es,children:(0,i.jsxs)(nF.q,{style:{position:"absolute",left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(t8.Cv2,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(F([...M(C,[e.id])],p))},children:"Select parent nodes"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(t8.IMj,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(F([...A(C,[e.id])],p))},children:"Select child nodes"})]})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{U("normal"),er({...k,view_mode:"all"})},children:"Show all nodes"})]})})}function iR(e){let{check:n}=e,t={...n.params,...n.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(iz,{viewOptions:t,interactive:!1})})})}var iT=t(19339);function iE(e){let{name:n,description:t,type:l,params:r,viewOptions:s}=e,o={name:n,description:t,type:l,params:r};s&&(o.view_options=s);let a=iT.ZP.stringify({checks:[o]});return(0,i.jsx)(tF.ML,{height:"300px",language:"yaml",theme:"vs",value:a,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}let iO=e=>{var n;let[t,i]=(0,v.useState)(!1),[l,r]=(0,v.useState)(!1),[,s]=ed(),{error:o,data:a}=(0,y.a)({queryKey:H.run(e||""),queryFn:async()=>ee(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,v.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let c=(0,v.useCallback)(async()=>{if(r(!0),e)return await en(e)},[e,r]),d=(null==a?void 0:a.type)?null===(n=nB(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:c,RunResultView:d}};function iI(){let e=(0,n$._)(["\n
","\n\n ","\n\n
"]);return iI=function(){return e},e}let iM=e=>{var n,t,r,a,d;let{checkId:f}=e,g=(0,b.NL)(),[,j]=(0,eb.TH)(),{successToast:k,failToast:w}=e1(),[C,_]=(0,v.useState)(),[S,z]=(0,v.useState)(),[R,T]=(0,v.useState)(!1),{isOpen:E,onOpen:O,onClose:I}=(0,ey.q)(),M=()=>(0,i.jsx)(eh.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[A,D]=(0,v.useState)((0,i.jsx)(M,{})),{isLoading:L,error:N,data:q}=(0,y.a)({queryKey:H.check(f),queryFn:async()=>n4(f),refetchOnMount:!0}),F=C||(null==q?void 0:null===(n=q.last_run)||void 0===n?void 0:n.run_id),{run:P,error:W}=iO(F),V=C?!P||"running"===P.status:(null==P?void 0:P.status)==="running",K=(null==q?void 0:q.type)?nB(null==q?void 0:q.type):void 0,J=(null==q?void 0:q.is_preset)||!1,{mutate:U}=(0,td.D)({mutationFn:e=>n5(f,e),onSuccess:()=>{g.invalidateQueries({queryKey:H.check(f)}),g.invalidateQueries({queryKey:H.checks()})}}),{mutate:B}=(0,td.D)({mutationFn:()=>n3(f),onSuccess:()=>{g.invalidateQueries({queryKey:H.checks()}),j("/checks")}}),Q=(0,v.useCallback)(async()=>{(null==q?void 0:q.type)&&_((await et(f,{nowait:!0})).run_id)},[q,f,_]),X=(0,v.useCallback)(async()=>{if(T(!0),F)return await en(F)},[F]),Z=async()=>{if(!q)return;let e=(0,tA.RI)(iI(),tL(q),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tN(e),"\n\n").concat((0,tA.Pn)(tD(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tN(e)}(q));if(!navigator.clipboard){w("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),k("Copied the check to the clipboard")}catch(e){w("Failed to copy the check to clipboard",e)}},G=(0,v.useCallback)(()=>{U({is_checked:!(null==q?void 0:q.is_checked)})},[null==q?void 0:q.is_checked,U]),{ref:Y,onCopyToClipboard:$,onMouseEnter:ee,onMouseLeave:ei}=e9();if(L)return(0,i.jsx)(eQ.M,{h:"100%",children:"Loading"});if(N)return(0,i.jsxs)(eQ.M,{h:"100%",children:["Error: ",N.message]});let el=(null==P?void 0:P.run_at)?(0,tJ.Q)(new Date(P.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(ty,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.xu,{style:{contain:"strict"},display:"flex",flexDirection:"column",overflow:"auto",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",children:[(0,i.jsx)(tc,{name:(null==q?void 0:q.name)||"",setName:e=>{U({name:e})}}),(0,i.jsx)(h.L,{}),J&&(0,i.jsx)(nC.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(n9.Vp,{size:"sm",children:[(0,i.jsx)(n9.AD,{boxSize:"14px",as:tl.bX4}),"Preset"]})}),(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{isRound:!0,as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"ghost"}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(tr.ovA,{}),onClick:()=>{D((0,i.jsx)(M,{})),O()},children:"Get Preset Check Template"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(tn.p,{}),onClick:()=>B(),children:"Delete"})]})]}),el&&(0,i.jsx)(l.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:el}),(null==K?void 0:K.RunResultView)&&(0,i.jsx)(nC.u,{label:"Rerun",children:(0,i.jsx)(nq.h,{isRound:!0,isLoading:V,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(tt.n,{}),onClick:()=>Q()})}),(0,i.jsx)(nC.u,{label:"Copy markdown",children:(0,i.jsx)(nq.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(eZ.T,{}),onClick:()=>Z()})}),(0,i.jsx)(nC.u,{label:(null==q?void 0:q.is_checked)?"Mark as pending":"Mark as approved",placement:"bottom-end",children:(0,i.jsx)(ev.z,{size:"sm",colorScheme:(null==q?void 0:q.is_checked)?"green":"gray",leftIcon:(0,i.jsx)(ti.r,{}),onClick:()=>G(),children:(null==q?void 0:q.is_checked)?"Approved":"Pending"})})]}),(0,i.jsx)(l.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tM,{value:null==q?void 0:q.description,onChange:e=>{U({description:e})}},null==q?void 0:q.check_id)})]}),(0,i.jsx)(l.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==q?void 0:q.type)==="query"||(null==q?void 0:q.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(u.U,{mr:"10px",children:(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(eZ.T,{}),variant:"outline",isDisabled:!(null==P?void 0:P.result)||!!(null==P?void 0:P.error),onMouseEnter:ee,onMouseLeave:ei,size:"sm",onClick:$,children:"Copy to Clipboard"})})]}),(0,i.jsxs)(n6.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(n7.x,{p:0,width:"100%",height:"100%",children:[(null==K?void 0:K.RunResultView)&&((null==q?void 0:q.last_run)||F?(0,i.jsx)(tK,{ref:Y,isRunning:V,isAborting:R,run:F?P:null==q?void 0:q.last_run,error:W,progress:S,RunResultView:K.RunResultView,viewOptions:null==q?void 0:q.view_options,onViewOptionsChanged:e=>{U({view_options:e})},onCancel:X,onExecuteRun:Q}):(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(ev.z,{onClick:Q,colorScheme:"blue",size:"sm",children:"Run Query"})})),q&&"schema_diff"===q.type&&(0,i.jsx)(tO,{check:q}),q&&"lineage_diff"===q.type&&(0,i.jsx)(iR,{check:q})]}),((null==q?void 0:q.type)==="query"||(null==q?void 0:q.type)==="query_diff"||(null==q?void 0:q.type)==="query_base")&&(0,i.jsx)(n7.x,{p:0,height:"100%",width:"100%",children:(null===(t=q.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tH,{value:(null==q?void 0:null===(r=q.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==q?void 0:null===(a=q.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tP,{value:(null==q?void 0:null===(d=q.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(eu.u_,{isOpen:E,onClose:I,isCentered:!0,size:"6xl",children:[A,(0,i.jsxs)(ex.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(em.x,{children:"Preset Check Template"}),(0,i.jsx)(ep.o,{}),(0,i.jsxs)(ef.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(te.y$,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"Please copy the following template and paste it into the recce.yml file."})}),(0,i.jsx)("br",{}),(0,i.jsx)(iE,{name:(null==q?void 0:q.name)||"",description:(null==q?void 0:q.description)||"",type:(null==q?void 0:q.type)||"",params:null==q?void 0:q.params,viewOptions:null==q?void 0:q.view_options})]})]})]})]})};var iA=t(53924);let iD=e=>{var n;let{check:t,selected:r,onSelect:a}=e,c=(0,b.NL)(),d=t.check_id,{mutate:u}=(0,td.D)({mutationFn:e=>n5(d,e),onSuccess:()=>{c.invalidateQueries({queryKey:H.check(d)}),c.invalidateQueries({queryKey:H.checks()})}}),h=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||ek.WzH;return(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:r?"gray.100":"inherit",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),t.is_checked&&(0,i.jsx)(s.J,{color:"green",as:tk.FJM})]})},iL=e=>{let{checks:n,selectedItem:t,onCheckSelected:l,onChecksReordered:r}=e;return(0,i.jsx)(iA.Z5,{onDragEnd:e=>{e.destination&&r(e.source.index,e.destination.index)},children:(0,i.jsx)(iA.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nh.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iA._l,{draggableId:e.check_id,index:n,children:(n,r)=>{if(r.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,l=e.style.top-t.y;e.style.left=i,e.style.top=l}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(iD,{check:e,selected:e.check_id===t,onSelect:l},e.check_id)})}},e.check_id)),e.placeholder]})})})};function iN(){let e=(0,n$._)(["\n
","\n\n ","\n\n
"]);return iN=function(){return e},e}let iq=()=>{let[,e]=(0,eb.TH)(),[,n]=(0,eb.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=e1(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:H.checks(),queryFn:n2,refetchOnMount:!0}),h=(0,v.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,v.useState)(d||[]),{mutate:p}=(0,td.D)({mutationFn:e=>n8(e),onSuccess:()=>{t.invalidateQueries({queryKey:H.checks()})}}),f=(0,v.useCallback)((e,n)=>{let t=[...x],[i]=t.splice(e,1);t.splice(n,0,i),p({source:e,destination:n}),m(t)},[x,m,p]);return((0,v.useCallback)(async()=>{let e=await n0();t.invalidateQueries({queryKey:H.checks()}),h(e.check_id)},[t,h]),(0,v.useEffect)(()=>{"success"===u&&(!o&&d.length>0&&e("/checks/".concat(d[0].check_id)),m(d))},[u,o,d,m,e]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==d?void 0:d.length)?(0,i.jsxs)(tj,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.xu,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nh.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nC.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nq.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tA.RI)(iN(),tL(e),tN(e))).join("\n\n");if(!navigator.clipboard){s("Failed to copy checklist to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),r("Copied ".concat(d.length," checks to the clipboard"))}catch(e){s("Failed to copy checklist to clipboard",e)}},icon:(0,i.jsx)(eZ.T,{})})}),(0,i.jsx)(n_.i,{mb:"8px"}),(0,i.jsx)(iL,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(l.xu,{height:"100%",children:(0,i.jsx)(eb.rs,{children:(0,i.jsx)(eb.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iM,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsx)(l.xu,{children:"No checks"})})};var iF=t(25356);async function iP(e,n){return await $("query",e,n)}async function iH(e,n){return await $("query_base",e,n)}async function iW(e,n){return await $("query_diff",e,n)}var iV=t(67619),iK=t(58565),iJ=t(49468);let iU=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r}=e,[s,o]=(0,v.useState)(t||[]),[a,c]=(0,v.useState)(""),[d,u]=(0,v.useState)(!1),h=(0,v.useRef)(null),x=e=>{s.includes(e)||(c(""),o([...s,e]),r([...s,e]))};return(0,i.jsxs)(iV.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nL.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{width:"100%",children:(0,i.jsx)(nM.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:s.length>1?"".concat(s.length," ").concat(e.unitName,"s selected"):1===s.length?"".concat(s.length," ").concat(e.unitName," selected"):""})}),(0,i.jsx)(tu.h,{children:(0,i.jsxs)(nF.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nP.k,{children:(0,i.jsxs)(iK.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[s.map((n,t)=>(0,i.jsx)(iK.U,{children:(0,i.jsxs)(n9.Vp,{size:e.size,children:[(0,i.jsx)(n9.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(n9.SD,{paddingRight:"8px",onClick:()=>{o(s.filter(e=>e!==n)),r(s.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iK.U,{width:"100%",children:(0,i.jsx)(nM.I,{ref:h,placeholder:"Filter keys or add custom",variant:"unstyled",size:e.size,value:a,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":x(n),c("");break;case"Backspace":""===e.currentTarget.value&&s.length>0&&(o(s.slice(0,-1)),r(s.slice(0,-1)))}},onBlur:()=>{var e;h&&d&&(null==h||null===(e=h.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{children:[""!==a&&!(null==l?void 0:l.includes(a))&&(0,i.jsxs)(nH.s,{onClick:()=>{x(a),u(!1)},children:["Add '",a,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===a||e.includes(a)).filter(e=>!s.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nH.s,{onClick:()=>x(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(iJ.x,{children:(0,i.jsx)(ev.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===s.length,onClick:()=>{c(""),o([]),r([])},children:"Clear"})})]})},iB=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r}=ec(),s=(0,v.useMemo)(()=>{if(!r)return[];let e=new Set;for(let i in r.nodes){var n,t;let l=r.nodes[i],s=null===(n=l.data.base)||void 0===n?void 0:n.columns,o=null===(t=l.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[r]);return(0,i.jsx)(o.k,{...l,children:(0,i.jsxs)(ew.NI,{m:"4px 8px",children:[(0,i.jsxs)(eC.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nC.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",children:(0,i.jsx)(eG.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iU,{unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name..."})]})})},iQ=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nG();return(0,i.jsxs)(l.xu,{children:[(0,i.jsx)(l.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(s.J,{as:ne.M1Q}),size:"xs",variant:"outline",onClick:e?t:n,children:e?"Hide":"Show"})]})},iX=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=_();return(0,i.jsxs)(l.xu,{children:[(0,i.jsxs)(l.xu,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nC.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(eG.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iF.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},iZ=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=ec(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nG(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iP;case"query_base":return iH;case"query_diff":return iW;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,c&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return x(r),await ee(r)},{mutate:p,isPending:f}=(0,td.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(iQ,{}),(0,i.jsx)(iX,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iB,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(l.xu,{width:"100%",flex:"1",children:c?(0,i.jsx)(tH,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tP,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var iG=t(30148);let iY=e=>(0,iG.c4)("#!"+e),i$=()=>[(0,iG.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),iY];var i0=t(24681),i1=t(62843);let i2=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:H.run(t),queryFn:async()=>ee(t)}),o=(null==s?void 0:s.type)?null===(n=nB(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tK,{isPending:l,error:r,run:s,RunResultView:o})},i4=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(eQ.M,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(o.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(c.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.xu,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(ev.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},i5=e=>{let{children:n}=e;return(0,i.jsx)(tV.SV,{fallback:i4,children:n})};async function i3(){return(await U.post("/api/export")).data}async function i8(e){let n=new FormData;return n.append("file",e),(await U.post("/api/import",n)).data}async function i9(){return 208===(await U.get("/api/sync")).status}async function i6(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,ik.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var i7=t(16021);function le(){let e=(0,Z.p)(),n=async()=>{try{let e=await i3(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,e2.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");e5()(t,l)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nC.u,{label:"Export",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:i7.tRY,boxSize:"1.2em"})})})}var ln=t(65475);function lt(){let e=(0,Z.p)(),n=(0,b.NL)(),t=(0,v.useRef)(null),l=(0,v.useRef)(null),[r,a]=(0,v.useState)(null),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),[h,x]=(0,eb.TH)(),[,m]=ed(),p=(0,v.useCallback)(async()=>{if(r){try{let{runs:t,checks:i}=await i8(r);m(),await n.invalidateQueries({queryKey:H.checks()}),await n.invalidateQueries({queryKey:H.runs()}),h.includes("/checks")&&x("/checks"),e({description:"".concat(t," runs and ").concat(i," checks imported successfully"),status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(n){console.error("Import failed",n),e({title:"Import failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}u()}},[n,r,e,u,h,x,m]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Import",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{t.current&&t.current.click()},icon:(0,i.jsx)(s.J,{as:i7.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:t,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(a(e.target.files[0]),d())}}),(0,i.jsx)(ln.a,{isOpen:c,leastDestructiveRef:l,onClose:u,size:"xl",children:(0,i.jsx)(eh.Z,{children:(0,i.jsxs)(ln._,{children:[(0,i.jsx)(em.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(o.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(eG.s,{color:"red.600"}),(0,i.jsx)(eN.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(eN.x,{children:["The current runs and checks will be"," ",(0,i.jsx)(eN.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{ref:l,onClick:u,children:"Cancel"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:p,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var li=t(93126),ll=t(1026),lr=t(13154),ls=t(99434),lo=t(20143),la=t(89830),lc=t(13276),ld=t(31610);function lu(e){let n=(0,ld.D)(e);return(0,e2.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function lh(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(o.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,t]=e;return"url"!==n&&null!=t}).map(e=>{let[n,t]=e;return(0,i.jsxs)(tb.HC,{ml:"10px",children:[n,": ",t]},n)})}function lx(){var e,n,t,l,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ec(),{isOpen:m,onOpen:p,onClose:f}=(0,ey.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,k=(null==y?void 0:y.generated_at)?lu(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?lu(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(d=e.data.current)||void 0===d?void 0:d.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Environment Info",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:tr.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(eu.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{children:"Environment Information"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(o.k,{direction:"column",gap:"5px",children:[h?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(tb.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tb.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&lh(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(tb.QI,{spacing:1,children:g&&lh(g)})]})}),(0,i.jsx)(n_.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"DBT"}),(0,i.jsx)(li.x,{children:(0,i.jsxs)(ll.i,{variant:"simple",children:[(0,i.jsx)(lr.h,{children:(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lo.Th,{}),(0,i.jsx)(lo.Th,{children:"base"}),(0,i.jsx)(lo.Th,{children:"current"})]})}),(0,i.jsxs)(la.p,{children:[(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lc.Td,{children:"schema"}),(0,i.jsx)(lc.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(lc.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lc.Td,{children:"version"}),(0,i.jsx)(lc.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(lc.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lc.Td,{children:"timestamp"}),(0,i.jsx)(lc.Td,{children:k}),(0,i.jsx)(lc.Td,{children:w})]})]})]})})]}),(null==u?void 0:u.adapterType)==="sqlmesh"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(li.x,{children:(0,i.jsxs)(ll.i,{variant:"simple",children:[(0,i.jsx)(lr.h,{children:(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lo.Th,{}),(0,i.jsx)(lo.Th,{children:"base"}),(0,i.jsx)(lo.Th,{children:"current"})]})}),(0,i.jsx)(la.p,{children:(0,i.jsxs)(ls.Tr,{children:[(0,i.jsx)(lc.Td,{children:"Environment"}),(0,i.jsx)(lc.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(lc.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(ev.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var lm=t(21166),lp=t(43399),lf=t(60057);function lg(){return(0,i.jsx)(nC.u,{label:"Syncing",children:(0,i.jsx)(ev.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tU.$,{})})})}function lv(){let[e,n]=(0,v.useState)(!1),t=(0,b.NL)(),[r,o]=(0,eb.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ey.q)(),[u,h]=(0,v.useState)(""),x=(0,Z.p)(),m=(0,v.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await i6(e)).status){c(),n(!1);return}for(;await i9();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:H.lineage()}),t.invalidateQueries({queryKey:H.checks()}),t.invalidateQueries({queryKey:H.runs()}),/^\/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(r)&&o("/checks")},[t,r,o,x,c,d]);return e?(0,i.jsx)(lg,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Sync with Cloud",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:i7.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(eu.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ef.f,{children:[(0,i.jsx)(l.xu,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.xu,{mt:"5px",children:(0,i.jsx)(lm.E,{onChange:h,value:u,children:(0,i.jsxs)(tq.K,{direction:"column",children:[(0,i.jsxs)(lp.Y,{value:"merge",children:["Merge",(0,i.jsx)(nC.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lf.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lp.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nC.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lf.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lp.Y,{value:"revert",children:["Revert",(0,i.jsx)(nC.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lf.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}function lj(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iz,{viewMode:"changed_models",interactive:!0})})}async function ly(){return(await U.get("/api/flag")).data}async function lb(){try{await U.post("/api/onboarding/completed")}catch(e){}}var lk=()=>{let[e,n]=(0,v.useState)(!1);(0,v.useEffect)(()=>{ly().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),lb()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(eu.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(em.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(tq.K,{spacing:4,children:[(0,i.jsxs)(tb.aV,{spacing:2,children:[(0,i.jsx)(tb.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tb.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tb.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(n_.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},lw=t(1873);let lC=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",l=null==n?void 0:n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",s="";"successful"===l||"finished"===l?(r="green",s="Finished"):"failed"===l?(r="red",s="Failed"):"cancelled"===l?(r="gray",s="Cancelled"):"running"===l?(r="blue",s="Running"):(r="green",s="Finished");let a=(null==n?void 0:n.run_at)?(0,e2.WU)(new Date(n.run_at),"MMM d, HH:mm"):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tU.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(eN.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(eN.x,{children:"•"}),(0,i.jsx)(eN.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},l_=e=>{let n=iT.ZP.stringify(e,null,2);return(0,i.jsx)(tF.ML,{height:"100%",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},lS=e=>{var n,t,l;let{runId:r,onClose:s}=e,{runAction:a}=nG(),{error:c,run:d,onCancel:f,isRunning:g}=iO(r),[j,y]=(0,v.useState)(),k=(0,b.NL)(),[,w]=(0,eb.TH)(),[C,_]=(0,v.useState)(0),S=(null==d?void 0:d.type)?null===(n=nB(d.type))||void 0===n?void 0:n.RunResultView:void 0,z=(0,v.useCallback)(()=>{a((null==d?void 0:d.type)||"",null==d?void 0:d.params)},[d,a]),R=null==d?void 0:d.check_id,T=(0,v.useCallback)(async()=>{R&&w("/checks/".concat(R))},[R,w]),E=(0,v.useCallback)(async()=>{if(!r)return;let e=await n1(r,j);k.invalidateQueries({queryKey:H.checks()}),w("/checks/".concat(e.check_id))},[r,w,k,j]),O=(null==d?void 0:d.type)==="query"||(null==d?void 0:d.type)==="query_diff"||(null==d?void 0:d.type)==="query_base",{ref:I,onCopyToClipboard:M,onMouseEnter:A,onMouseLeave:D}=e9();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:C,onChange:_,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),O&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[d&&(0,i.jsx)(lC,{run:d}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(tt.n,{}),variant:"outline",isDisabled:!r||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(eZ.T,{}),variant:"outline",isDisabled:!r||!(null==d?void 0:d.result)||!!c,onMouseEnter:A,onMouseLeave:D,size:"sm",onClick:M,children:"Copy to Clipboard"}),(null==d?void 0:d.check_id)?(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(lw.n,{}),isDisabled:!r||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(lw.n,{}),isDisabled:!r||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t7.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tK,{ref:I,error:c,run:d,onCancel:f,viewOptions:j,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(l_,{type:d.type,params:d.params}),2===C&&d&&((null===(t=d.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tH,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tP,{value:(null==d?void 0:null===(l=d.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},lz=e=>{let{onClose:n}=e,{runId:t}=nG();return(0,i.jsx)(lS,{runId:t,onClose:n})};var lR=t(22661);t(86777);let lT=e=>{var n;let{run:t,isSelected:r,onSelectRun:a,onAddToChecklist:c,onGoToCheck:d}=e,{data:u}=(0,y.a)({queryKey:H.run(t.run_id),queryFn:async()=>await ee(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||ek.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:r?"orange.400":"transparent",backgroundColor:r?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:r?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nC.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(eN.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:tk.FJM})})}):(0,i.jsx)(nC.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(eN.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t.run_id)},children:(0,i.jsx)(s.J,{as:tk.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(lC,{run:u||t})})]})},lE=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:H.runs(),queryFn:async()=>await el(),retry:!1}),{showRunId:a,runId:d}=nG(),x=e=>{a(e,!1)},[,m]=(0,eb.TH)(),p=(0,b.NL)(),f=(0,v.useCallback)(async()=>{if(!d)return;let e=await n1(d);p.invalidateQueries({queryKey:H.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,v.useCallback)(e=>{m("/checks/".concat(e))},[m]);return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(c.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.h,{variant:"unstyled",icon:(0,i.jsx)(tt.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(l.xu,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(eQ.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(lR.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>(0,i.jsx)(lT,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id))})})]})};var lO=t(39588);let lI=e=>{let{children:n,path:t}=e,[r]=(0,eb.yj)(t);return(0,i.jsx)(l.xu,{display:r?"block":"none",height:"100%",children:n})};function lM(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.r,{height:"20px",color:"white",href:t,isExternal:!0,...l,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function lA(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=ec(),p=function(){let[e,n]=(0,v.useState)("");return(0,v.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},j=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(c.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.xu,{children:"cloud mode"}),(0,i.jsx)(l.xu,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:ne.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.xu,{children:"demo mode"}),(0,i.jsx)(l.xu,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:ne.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(j)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(lM,{icon:tk.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(lM,{icon:tk.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(lM,{mr:"18px",icon:tk.MXt,href:"https://datarecce.io/docs"})]})}function lD(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.xu,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function lL(){let{isDemoSite:e,cloudMode:n,isLoading:t}=ec(),[l,r]=(0,eb.TH)(),s=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(lD,{queryKey:H.checks(),fetchCallback:n2,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],o=ez().findIndex(s,e=>{let{href:n}=e;return l.startsWith(n)});return(0,i.jsx)(x.m,{index:o,children:(0,i.jsxs)(m.t,{children:[s.map(e=>{let{name:n,href:t,badge:l}=e;return(0,i.jsxs)(p.O,{onClick:()=>{r(t)},children:[n,l]},n)}),(0,i.jsx)(h.L,{}),!t&&(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(lv,{}),!e&&!n&&(0,i.jsx)(lt,{}),(0,i.jsx)(le,{})]}),(0,i.jsx)(lx,{})]})})}function lN(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nG(),[r]=(0,eb.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(tj,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(l.xu,{style:{contain:"size"},children:o&&(0,i.jsx)(lE,{})}),(0,i.jsxs)(ty,{sizes:s?[60,40]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.xu,{p:0,style:{contain:"content"},children:(0,i.jsxs)(i5,{children:[(0,i.jsx)(lI,{path:"/lineage",children:(0,i.jsx)(lj,{})}),(0,i.jsxs)(eb.rs,{children:[(0,i.jsx)(eb.AW,{path:"/query",children:(0,i.jsx)(iZ,{})}),(0,i.jsx)(eb.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iq,{})}),(0,i.jsx)(eb.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(i2,{runId:n})}}),(0,i.jsx)(eb.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eb.AW,{children:(0,i.jsx)(eb.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(lz,{onClose:t}):(0,i.jsx)(l.xu,{})]})]})}function lq(){(0,v.useLayoutEffect)(()=>{var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"";if(n&&lO.env.AMPLITUDE_API_KEY)try{j.S1(lO.env.AMPLITUDE_API_KEY,n,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,i0.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(i1.Z,{theme:e,children:(0,i.jsx)(g.x,{children:(0,i.jsx)(b.aH,{client:B,children:(0,i.jsx)(eb.F0,{hook:i$,children:(0,i.jsx)(nY,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",children:[(0,i.jsx)(lA,{}),(0,i.jsx)(lL,{}),(0,i.jsx)(lk,{}),(0,i.jsx)(lN,{})]})})})})})})}},91074:function(){},87679:function(){},81974:function(){},15080:function(){}},function(e){e.O(0,[634,145,170,591,521,462,531,498,43,987,182,710,615,971,495,599,512,518,132,584,744],function(){return e(e.s=27709)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,68868))},68868:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rF}});var i=t(95766),r=t(88117),l=t(78390),s=t(51742),o=t(58396),a=t(49989),c=t(41042),d=t(15370),u=t(68825),h=t(26138),x=t(78939),m=t(63993),p=t(83246),f=t(50068),g=t(46088),v=t(66518),j=t(57489),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,v.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,r]=v.useState(k),[l,s]=v.useState(k),[o,a]=v.useState(!1),[c,d]=v.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:r,sqlQuery:t,setPrimaryKeys:d,primaryKeys:c,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:l,setBaseSqlQuery:s},children:n})}let _=()=>(0,v.useContext)(w),S=(0,v.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,r]=v.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:r},children:n})}var R=t(48510);function T(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,r={},l=(e,t)=>{if(!(t<0)&&(void 0===r[e]||!(r[e]>=t))){for(let i of(r[e]=t,n(e)))l(i,t-1);i.add(e)}};for(let n of e)l(n,t);return i}function E(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var O=t(28482),I=t.n(O);function D(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function M(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function A(e,n,t){let i=[],r=[];function l(e){return"base"===e?0:"current"===e?2:1}function s(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let o=n?function(e,n){var t;let i=Object.values(e.nodes);if("changed_models"===(n.view_mode||"changed_models")){let n=E(D(e,e.modifiedSet,1),M(e,e.modifiedSet));i=i.filter(e=>n.has(e.id))}if(void 0!==n.node_ids){let e=new Set(n.node_ids);i=i.filter(n=>e.has(n.id))}let r=void 0!==n.packages?n.packages:(null===(t=e.manifestMetadata.current)||void 0===t?void 0:t.project_name)?[e.manifestMetadata.current.project_name]:void 0;return void 0!==r&&(i=i.filter(e=>!!e.packageName&&r.includes(e.packageName))),new Set(i.map(e=>e.id))}(e,n):void 0;for(let n of(null!=t&&(o=o?function(){for(var e=arguments.length,n=Array(e),t=0;te.has(n)));return i}(o,new Set(t)):new Set(t)),Object.values(e.nodes).sort(s)))(!o||o.has(n.id))&&i.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(s))(!o||o.has(n.parent.id)&&o.has(n.child.id))&&r.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return L(i,r),N(Array.from(M(e,e.modifiedSet)),i,r)}let L=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(I()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),I().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function N(e,n,t){let i=new Set(e),r=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:r.has(e.id)}}))]}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function F(e,n){return n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let H={rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var W=t(62330),V=t(39588);let K=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var J=t(94614);let U=W.default.create({baseURL:K}),B=new J.S;async function Q(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var Z=t(99873),G=t(85929),Y=t.n(G);async function $(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ee(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function en(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function et(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ei(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function er(){return(await U.get("/api/runs")).data}async function el(){return(await U.post("/api/runs/aggregate",{})).data}let es=(0,v.createContext)({});function eo(e){let{refetch:n}=e,t=(0,Z.p)(),[r,l]=(0,v.useState)(),s=(0,b.NL)();return(0,v.useEffect)(()=>{let e=new WebSocket("".concat(K.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));return l(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:i}=n.event,[r,l]=i.split("/").slice(-2),o=Y().parse(l).name;t({description:"Detected ".concat(r," ").concat(o," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),s.invalidateQueries({queryKey:H.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,s]),(0,i.jsx)(i.Fragment,{})}function ea(e){var n,t;let{children:r}=e,{data:l,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:H.lineage(),queryFn:Q}),{data:c,refetch:d}=(0,y.a)({queryKey:H.runsAggregated(),queryFn:el}),u=(0,v.useMemo)(()=>{let e=null==l?void 0:l.lineage;if(e&&e.base&&e.current)return function(e,n){let t={},i={},r=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=r(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=r(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,r]of Object.entries(e.parent_map))for(let e of r){let r=t[n],l=t[e],s="".concat(e,"_").concat(n);if(!r||!l)continue;i[s]={id:s,from:"base",parent:l,child:r};let o=i[s];r.parents[e]=o,l.children[n]=o}for(let[e,r]of Object.entries(n.parent_map))for(let n of r){let r=t[e],l=t[n],s="".concat(n,"_").concat(e);if(!r||!l)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:l,child:r};let o=i[s];r.parents[n]=o,l.children[e]=o}let l=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",l.push(n.id);else if("current"===n.from)n.changeStatus="added",l.push(n.id);else{var s,o,a,c,d,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(d=u.current)||void 0===d?void 0:null===(c=d.checksum)||void 0===c?void 0:c.checksum;e&&t&&e!==t&&(n.changeStatus="modified",l.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:l,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(e.base,e.current)},[l]),h=null==o?void 0:o.message,x=null==l?void 0:l.lineage,m=null==l?void 0:l.demo,p=null==l?void 0:l.review_mode,f=null==l?void 0:l.cloud_mode,g=null==l?void 0:l.file_mode,j=null==l?void 0:l.adapter_type,b=null==l?void 0:l.git,k={adapterType:j,git:b,pullRequest:null==l?void 0:l.pull_request,dbt:{base:null==x?void 0:null===(n=x.base)||void 0===n?void 0:n.manifest_metadata,current:null==x?void 0:null===(t=x.current)||void 0===t?void 0:t.manifest_metadata},sqlmesh:null==l?void 0:l.sqlmesh};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eo,{refetch:a}),(0,i.jsx)(es.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:k,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,refetchRunsAggregated:()=>{d()}},children:r})]})}let ec=()=>(0,v.useContext)(es),ed=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ec();return[e,n]};var eu=t(17695),eh=t(62628),ex=t(33678),em=t(96985),ep=t(69384),ef=t(7797),eg=t(13844),ev=t(64653);let ej=e=>{let{isOpen:n,onClose:t,onExecute:l,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,v.useState)(c),[x,m]=(0,v.useState)(!1);return(0,i.jsxs)(eu.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(em.x,{children:a}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(r.xu,{style:{contain:"layout"},children:d&&(0,i.jsx)(d,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(ev.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var ey=t(25612),eb=t(76330),ek=t(53152),ew=t(18222),eC=t(30678),e_=t(2838),eS=t(13156),ez=t.n(eS);function eR(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eT=e=>{var n;let{lineageGraph:t}=ec(),[i,r]=(0,v.useState)([]),[l,s]=(0,v.useState)(),[o,a]=(0,v.useState)(!0),[c,d]=(0,v.useState)(null),u=ez().find(null==t?void 0:t.nodes,{name:e}),h=(0,v.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eR(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,v.useEffect)(()=>{let e=async()=>{try{let e=(await X(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){r([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);r(eR(n,t))}catch(e){d(e)}};h.length>0?(r(h),s(x)):(null==u?void 0:u.id)===void 0?r([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:l,isLoading:o,error:c}};function eE(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eO(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eI=t(85813),eD=t(81945),eM=t(14827);function eA(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eL(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,r=n>=1e9,l=n>=1e15;if(l||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:l?0:2}).format(e/1e12).replace("L","T");if(r||i||n>=1e3){let n={base:r?1e9:i?1e6:1e3,unit:r?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}var eN=t(79481);let eq="#63B3ED",eF="#F6AD55",eP="".concat(eq,"A5"),eH="".concat(eF,"A5");function eW(e){let{color:n}=e;return(0,i.jsx)(r.xu,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function eV(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eD.kL.register(eD.ZL,eD.RM,eD.f$,eD.uw,eD.u);let l=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasets:i,type:r,samples:l=0,binEdges:s}=e,[o,a]=i,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eJ(s,n);return"".concat(c?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,r=0===n?a.counts:o.counts,s=eA(r[t]/l),c=r[t];return"".concat(i,": ").concat(c," (").concat(s,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:r,binEdges:l}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,c=Math.max(...a.counts,...o.counts),d=l.map((e,n)=>eJ(l,n)).slice(0,-1);return{x:"datetime"===r?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>d[n]},stacked:!0},y:{display:!s,type:"linear",max:c,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eL(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:r}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[r,l]=n,s=eK(t,i,"Current",eP,l),o=eK(t,i,"Base",eH,r);return{labels:i.map((e,n)=>eJ(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eH})," Base"]}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eP})," Current"]}),(0,i.jsx)(h.L,{})]}),(0,i.jsx)(eM.kL,{type:"bar",options:l,data:s,plugins:[]})]})}function eK(e,n,t,i,r){let{counts:l=[]}=r;return{label:t,data:"datetime"===e?l.map((e,t)=>({x:n[t],y:e})):l,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function eJ(e,n){let t=e[n],i=e[n+1],r=eL(t),l=eL(i);return"".concat(r," - ").concat(l)}let eU=(0,eI.G)((e,n)=>{let{backgroundColor:t="white",blockSize:l,children:s,...o}=e;return(0,i.jsx)(r.xu,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.xu,{backgroundColor:t,height:"100%",blockSize:l,children:s})})}),eB=(0,eI.G)(function(e,n){var t,l,s,a,d,x;let{run:m}=e,p=m.params,f=null===(t=m.result)||void 0===t?void 0:t.base,g=null===(l=m.result)||void 0===l?void 0:l.current,v=null===(s=m.result)||void 0===s?void 0:s.min,j=null===(a=m.result)||void 0===a?void 0:a.max,y=null===(d=m.result)||void 0===d?void 0:d.bin_edges;return f&&g?(0,i.jsx)(o.k,{direction:"column",height:"500px",children:(0,i.jsxs)(eU,{ref:n,height:"100%",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:"4",textAlign:"center",children:["Model ",p.model,".",p.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(r.xu,{w:"80%",h:"300px",m:"4",children:(0,i.jsx)(eV,{data:{type:(null===(x=m.params)||void 0===x?void 0:x.column_type)||"",datasets:[g,f],min:v,max:j,samples:f.total,binEdges:y}})}),(0,i.jsx)(h.L,{})]})]})}):(0,i.jsx)("div",{children:"Loading..."})});var eQ=t(24112);t(63156);var eX=t(22204),eZ=t(20074),eG=t(48289),eY=t(81737),e$=t.n(eY),e0=t(77249);function e1(){let e=(0,Z.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}var e2=t(50228),e5=t(67605),e4=t.n(e5);let e3="ignore-screenshot";function e8(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:r=null,boardEffect:l=!0,shadowEffect:s=!1,borderStyle:c="solid 1px #ccc",borderRadius:d="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,v.useState)("idle"),f=(0,v.useRef)(null),{onOpen:g,setImgBlob:j,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ey.q)(),[r,l]=(0,v.useState)();return{onOpen:n,setImgBlob:l,ImageDownloadModal:function(){let[n,l]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!r)return;let e=new FileReader;e.readAsDataURL(r),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&l(e.target.result)}},[l]),(0,i.jsxs)(eu.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{children:"Screenshot Preview"}),(0,i.jsx)(ep.o,{}),(0,i.jsxs)(ef.f,{children:[(0,i.jsxs)(o.k,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(eG.s,{color:"red.600"}),(0,i.jsx)(eN.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(eN.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,e2.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");e4()(r,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=l?c:"",e.style.borderRadius=l?d:"",e.style.backgroundColor=r||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await e$()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,e0.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(j(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function e9(e){let{successToast:n,failToast:t}=e1(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=e8({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,v.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},[o]),c=(0,v.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),d=(0,v.useCallback)(async()=>{o.current&&(await l(),(o.current.element||o.current).style.boxShadow="")},[o,l]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ev.z,{size:"sm",leftIcon:(0,i.jsx)(eZ.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:r,onMouseEnter:a,onMouseLeave:c,onClick:d,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:c,onCopyToClipboard:d}}let e6=(0,eI.G)((e,n)=>{let{...t}=e,{CopyToClipboardButton:r}=e9();return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eX.ZP,{ref:n,...t})})});function e7(){return(0,i.jsx)(o.k,{h:"35px",alignItems:"center",justifyContent:"center",bg:"gray.100",style:{textAlign:"center",gridColumn:"1/-1"},children:(0,i.jsx)(eN.x,{fontWeight:"600",children:" No rows"})})}t(87679);var ne=t(52091);function nn(e,n){let t=function(e,n){let t=[...e],i=[...n],r=[];for(;t.length>0&&i.length>0;)if(r.includes(t[0]))t.shift();else if(r.includes(i[0]))i.shift();else if(t[0]===i[0])r.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{r.includes(e)||r.push(e)}),i.forEach(e=>{r.includes(e)||r.push(e)}),r}(e,n),i={};for(let r of t)e.includes(r)?n.includes(r)?i[r]=void 0:i[r]="removed":i[r]="added";let r={};e.forEach((e,n)=>{r[e]=n});let l=-1;for(let e of t){let n=r[e];void 0!==n&&(n>l?l=n:i[e]="reordered")}return i}function nt(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}function ni(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let r of n)i[e[r].name]=t[r];return JSON.stringify(i)}function nr(e){let{name:n,columnStatus:t,onPrimaryKeyChange:l,onPinnedColumnsChange:a,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(r.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&l&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?ne.ven:ne.MhP,onClick:h?()=>{let e=d.filter(e=>e!==n);l&&l(e)}:()=>{let e=[...d.filter(e=>"index"!==e),n];l&&l(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?ne.$kI:ne.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let nl=e=>{let n;let t=!1;return"boolean"==typeof e?n=e.toString():""===e?(n="(empty)",t=!0):null==e?(n="(null)",t=!0):n=e,[n,t]},ns=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(eN.x,{style:{color:"gray"},children:"-"});let[r,l]=nl(n[t.key]);return(0,i.jsx)(eN.x,{style:{color:l?"gray":"inherit"},children:r})};function no(e,n,t){let r=e||{columns:[],data:[]},l=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,c=[],d=function(e,n){let t={};return Object.entries(nn(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[r,l]=i;t[r]={status:l,baseColumnIndex:e.columns.findIndex(e=>e.name===r),currentColumnIndex:n.columns.findIndex(e=>e.name===r)}}),t}(r,l),u={},h={},x=!1,m=!1;if(0===s.length)r.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),l.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nt(r.columns,s);r.data.forEach((n,t)=>{let i=ni(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nt(l.columns,s),l.data.forEach((n,t)=>{let i=ni(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=nn(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(d))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||ez().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(nr,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eX.Ug,headerCellClass:r,cellClass:l,renderCell:ns,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eX.Ug,headerCellClass:r,cellClass:l,renderCell:ns,size:"auto"}]}};return 0===s.length?c.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=d[e].status||"";c.push({key:"".concat(e),name:(0,i.jsx)(nr,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:ns})}),o.forEach(e=>{let n=d[e].status||"";"index"===e||s.includes(e)||c.push(v(e,n))}),Object.entries(d).forEach(e=>{let[n,t]=e,i=t.status||"";"index"===n||s.includes(n)||o.includes(n)||a&&f.modified>0&&"added"!==i&&"removed"!==i&&"modified"!==i||c.push(v(n,i))}),{columns:c,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let na=(0,eI.G)((e,n)=>{var t;let{run:r,viewOptions:l,onViewOptionsChanged:s}=e,o=r.result;r.params;let a=(0,v.useMemo)(()=>(null==l?void 0:l.pinned_columns)||[],[l]),c=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),d=(null==c?void 0:c.name)||"column_name",u=(0,v.useMemo)(()=>no(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[d],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})}}),[o,d,a,l,s]);return 0===u.columns.length?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function nc(e){let{name:n,columnStatus:t,onPrimaryKeyChange:l,onPinnedColumnsChange:a,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(r.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?ne.$kI:ne.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nd(e,n,t){let r=(null==t?void 0:t.pinnedColumns)||[],l=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},c={};if(0===n.length)throw Error("Primary keys are required");let d=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let r of n)i[e[r].name]=t[r];return JSON.stringify(i)}(e.columns,d,n);n[u]&&(a[i]=n),n[h]&&(c[i]=n)});let x=nn(Object.keys(a),Object.keys(c)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,r]=t,l=a[i],s=c[i],d=JSON.parse(i);if(l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=l[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=s[t])}),l){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(ez().isEqual(l[t.index],s[t.index])||(d.__status="modified",t.status="modified"));else d.__status="removed",m.removed++}else d.__status="added",m.added++;return"modified"===d.__status&&m.modified++,d});l&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(nc,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eX.Ug,headerCellClass:r,cellClass:l,renderCell:ns,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eX.Ug,headerCellClass:r,cellClass:l,renderCell:ns,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(nc,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:ns})}),r.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||r.includes(t)||l&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nu=t(93998),nh=t(25773),nx=t(63352);let nm=e=>{let{run:n,warnings:t,viewOptions:l,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nh.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(nu.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nx.X,{isChecked:null==l?void 0:l.changed_only,onChange:()=>{let e=!(null==l?void 0:l.changed_only);a&&a({...l,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(ev.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},np=(e,n)=>{var t,r,l,s,a,c;let{run:d,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,v.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,v.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,v.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,v.useMemo)(()=>{var e,n;return no(null==d?void 0:null===(e=d.result)||void 0===e?void 0:e.base,null==d?void 0:null===(n=d.result)||void 0===n?void 0:n.current,{changedOnly:p,primaryKeys:m,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:f,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})}})},[d,h,p,m,f,x]),j=(0,v.useMemo)(()=>{let e=m.join(", ");return g.invalidPKeyBase&&g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):g.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[g.invalidPKeyBase,g.invalidPKeyCurrent,m]),y=(null===(r=d.result)||void 0===r?void 0:null===(t=r.current)||void 0===t?void 0:t.limit)||0,b=y>0&&((null==d?void 0:null===(s=d.result)||void 0===s?void 0:null===(l=s.current)||void 0===l?void 0:l.more)||(null==d?void 0:null===(c=d.result)||void 0===c?void 0:null===(a=c.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(y.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,k=[];return(j&&k.push(j),b&&k.push(b),0===g.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):p&&0===g.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nf=(e,n)=>{var t,r,l,s;let{run:a,onAddToChecklist:c,viewOptions:d,onViewOptionsChanged:u}=e,h=(0,v.useMemo)(()=>(null==d?void 0:d.changed_only)||!1,[d]),x=(0,v.useMemo)(()=>(null==d?void 0:d.pinned_columns)||[],[d]),m=(0,v.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nd(null==a?void 0:a.result.diff,t,{changedOnly:h,pinnedColumns:x,onPinnedColumnsChange:e=>{u&&u({...d,pinned_columns:e})}})},[a,d,h,x,u]),p=(null===(r=a.result)||void 0===r?void 0:null===(t=r.diff)||void 0===t?void 0:t.limit)||0,f=p>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(l=s.diff)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(p.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,g=[];return(f&&g.push(f),0===m.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):h&&0===m.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},ng=(0,eI.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eI.G)(nf);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eI.G)(np);return(0,i.jsx)(t,{...e,ref:n})}});function nv(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:l=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(r.xu,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?ne.$kI:ne.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let nj=(0,eI.G)((e,n)=>{let{run:t,viewOptions:l,onViewOptionsChanged:s,onAddToChecklist:a}=e,c=(0,v.useMemo)(()=>(null==l?void 0:l.pinned_columns)||[],[l]),d=null==t?void 0:t.result,u=(0,v.useMemo)(()=>d?function(e,n){let t=[],r=n.pinnedColumns||[],l=(e,t)=>({key:String(e),name:(0,i.jsx)(nv,{name:t,...n}),width:"auto",renderCell:ns});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=ez().findIndex(e.columns,e=>e.name===n);i<0||t.push(l(i,n))}),e.columns.forEach((e,n)=>{r.includes(e.name)||t.push(l(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,l,s]);if(0===u.columns.length)return(0,i.jsx)(eQ.M,{height:"100%",children:"No data"});let x=(null==d?void 0:d.limit)||0,m=x>0&&(null==d?void 0:d.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nu.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.xu,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(ev.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function ny(e,n){if(e=.1?t.toFixed(1):" <0.1 ","%")}if(!(e>n))return"0 %";{let t=(e-n)/e*100;return"-".concat(t>=.1?t.toFixed(1):" <0.1 ","%")}}var nb=t(68844),nk=t.n(nb);let nw=(0,eI.G)(function(e,n){let{run:t}=e;function r(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let l=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=l[e],t=nk()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nk()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,r="No Change";return null!==t&&null!==i?r=t!==i?ny(t,i):"No Change":t===i?r="N/A":null===t?r="Added":null===i&&(r="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:r}});return 0===s.length?(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(l).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:r},{key:"base",name:"Base Rows",cellClass:r},{key:"current",name:"Current Rows",cellClass:r},{key:"delta",name:"Delta",cellClass:r}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},className:"rdg-light",enableScreenshot:!0})})})});var nC=t(32088),n_=t(96124);let nS="#63B3ED";function nz(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),r=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([r]).map((n,t)=>{let l;let s=t===i.length,o=s?r:i[t],a=!1;return s?(l="(others)",a=!0):null==n?(l="(null)",a=!0):"string"==typeof n&&0===n.length?(l="(empty)",a=!0):l=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:l,count:o,displayCount:eL(o),displayRatio:eA(o/e.valids)||"N/A"}})}function nR(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nC.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(eN.x,{children:[(0,i.jsx)(eW,{color:eq}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(eN.x,{children:[(0,i.jsx)(eW,{color:eF}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nT(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=nz(n.current,t),s=nz(n.base,t);return(0,i.jsxs)(r.xu,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eF})," Base"]}),(0,i.jsxs)(eN.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eq})," Current"]}),(0,i.jsx)(h.L,{})]}),l.map((e,t)=>{let r=s[t];return e.isLastItemOthers&&0===e.count&&0===r.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(v.Fragment,{children:[(0,i.jsx)(nR,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(eN.x,{noOfLines:1,width:"10em",fontSize:"sm",color:e.isSpecialLabel?"gray.400":"inherit",children:e.label}),(0,i.jsxs)(o.k,{width:"70%",direction:"column",children:[(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eq}),(0,i.jsx)(eN.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(eN.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eF}),(0,i.jsx)(eN.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(eN.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(n_.i,{})]},t)})]})}function nE(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nS}=e;eD.kL.register(eD.uw,eD.ZL,eD.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,r,{animation:l}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nS}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:i,hoverBackgroundColor:i,borderWidth:0,borderColor:i,barPercentage:1,categoryPercentage:.6}]}}({topkCount:n,topkLabel:t,color:s});return(0,i.jsx)(eM.$Q,{data:a,options:o,plugins:[]})}let nO=(0,eI.G)((e,n)=>{let{run:t}=e,[r,s]=(0,v.useState)(!0),a=t.result,d=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(eU,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",children:["Model ",d.model,".",d.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nT,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:r}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(l.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:r?"View More Items":"View Only Top-10"})})]})}),nI=(0,eI.G)((e,n)=>{var t,r;let{run:l,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:c}=e,d=(0,v.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,v.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,v.useMemo)(()=>{var e;if(!l.result||!(null==l?void 0:null===(e=l.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=l.params.primary_key,t=Array.isArray(n)?n:[n];return nd(null==l?void 0:l.result,t,{changedOnly:d,pinnedColumns:u,onPinnedColumnsChange:e=>{c&&c({...a,pinned_columns:e})}})},[l,a,d,u,c]),x=(null===(t=l.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==l?void 0:null===(r=l.result)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(eQ.M,{height:"100%",children:"No data"}):d&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eQ.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nm,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nD=t(93960),nM=t(66011);function nA(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,[s,o]=(0,v.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,c=null==n?void 0:n.primary_key,{columns:d,primaryKey:u,isLoading:h,error:x}=eT(n.model);(0,v.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,v.useEffect)(()=>{l(!!c&&!!a)},[c,a,l]);let m=d.map(e=>e.name),p=Array.isArray(c)?c:c?[c]:void 0;return h?(0,i.jsx)(r.xu,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nh.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Model"}),(0,i.jsx)(nD.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Primary key"}),(0,i.jsx)(nM.Z,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Columns"}),(0,i.jsx)(nx.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nM.Z,{isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(n.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,columns:(e||[]).map(e=>e.value)})}})]})]})}var nL=t(49801),nN=t(50104),nq=t(39171),nF=t(39226),nP=t(70949),nH=t(34510);function nW(e){let{params:n,column:t}=e,{runAction:l}=nG(),a=(e,t)=>{l("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(r.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nL.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nF.q,{lineHeight:"20px",children:(0,i.jsxs)(nP.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nH.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nV=(0,eI.G)(function(e,n){let{run:t}=e,l=t.result,a=t.params,c=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},d=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(eQ.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:ne.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nW,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:c},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,l=t[n.key];return(0,i.jsx)(r.xu,{textAlign:"end",children:void 0!=l&&null!==l?"".concat((100*l).toFixed(2)," %"):"N/A"})},cellClass:c}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(r.xu,{px:"16px",children:["Model: ",a.model,", ",l.summary.total," total (",l.summary.total-l.summary.added-l.summary.removed," ","common, ",l.summary.added," added, ",l.summary.removed," removed)"]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray",flex:"1"},columns:u,rows:l.data.data,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nK=t(18502),nJ=t(63594);let nU={lineage_diff:{title:"Lineage Diff",icon:ek.Ks7},schema_diff:{title:"Schema Diff",icon:nJ.C8A},query:{title:"Query",icon:ek.r2i,RunResultView:nj},query_base:{title:"Query Base",icon:ek.r2i,RunResultView:nj},query_diff:{title:"Query Diff",icon:ek.r2i,RunResultView:ng},row_count_diff:{title:"Row Count Diff",icon:nJ.QUK,RunResultView:nw},profile_diff:{title:"Profile Diff",icon:ek.KA6,RunResultView:na},value_diff:{title:"Value Diff",icon:ek.pRi,RunResultView:nV,RunForm:nA},value_diff_detail:{title:"Value Diff Detail",icon:ek.pRi,RunResultView:nI,RunForm:nA},top_k_diff:{title:"Top-K Diff",icon:nK.Pkc,RunResultView:nO,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.map(e=>e.name);return((0,v.useEffect)(()=>{l(!!n.column_name)},[n,l]),o)?(0,i.jsx)(r.xu,{children:"Loading..."}):0===c.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(e_.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:c.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:ek.dku,RunResultView:eB,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.filter(e=>!eE(e.type)&&!eO(e.type));return o?(0,i.jsx)(r.xu,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(e_.P,{placeholder:0!==c.length?"Select column":"No numeric column is available",isDisabled:0===c.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let r=e.target.value;l(!!r);let s=(null===(i=c.find(e=>e.name===r))||void 0===i?void 0:i.type)||"";t({...n,column_name:r,column_type:s})},children:c.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}}},nB=e=>nU[e],nQ=(0,v.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nX=e=>{let[n]=(0,eb.TH)();(0,v.useEffect)(()=>{e()},[e,n])};function nZ(e){var n;let{children:t}=e,[r,l]=(0,v.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ey.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),p=(0,Z.p)(),[f,g]=(0,v.useState)(),[j,y]=(0,eb.TH)(),k=(0,b.NL)(),w=(0,v.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:H.runs()})},[g,d,k]),C=(0,v.useCallback)(async(e,n,t)=>{try{let i;let r=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ei(e,n,1);1===t.length&&(i=t[0])}let s=nB(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:c,RunForm:d}=s;if(void 0===c)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==d&&(null==t?void 0:t.showForm))l({session:r,title:a,type:e,params:n,lastRun:i,options:t,RunForm:d}),o();else{let{run_id:t}=await $(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:H.runs()}),j.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[l,o,w,p,j,y,k]);nX(a);let _=async(e,n)=>{try{a();let{run_id:t}=await $(e,n,{nowait:!0});w(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,v.useEffect)(()=>{f&&j.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nQ.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[r&&(0,i.jsx)(ej,{isOpen:s,onClose:a,onExecute:_,title:r.title,type:r.type,params:r.params,initialRun:r.lastRun,RunForm:(null===(n=r.options)||void 0===n?void 0:n.showForm)&&r.RunForm?r.RunForm:void 0},r.session),t]})}let nG=()=>(0,v.useContext)(nQ);function nY(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ea,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nZ,{children:n})})})})})}var n$=t(81600);async function n0(){return(await U.post("/api/checks",{type:"simple"})).data}async function n1(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function n2(){return(await U.get("/api/checks")).data}async function n5(e){return(await U.get("/api/checks/".concat(e))).data}async function n4(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function n3(e){return(await U.delete("/api/checks/".concat(e))).data}async function n8(e){return await U.post("/api/checks/reorder",e)}var n9=t(94734),n6=t(71738),n7=t(38414),te=t(29598),tn=t(62216),tt=t(42675),ti=t(54097),tr=t(95862),tl=t(82960),ts=t(69879),to=t(618),ta=t(77153);function tc(e){let{name:n,setName:t}=e,[l,s]=(0,v.useState)(!1),[o,a]=(0,v.useState)(n),c=(0,v.useRef)(null),d=(0,v.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,v.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l,c,d]),(0,i.jsxs)(ts.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(ta.X,{color:"gray.500"}),children:[(0,i.jsx)(to.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(to.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(nD.I,{ref:c,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"auto",minW:"200px",maxW:"600px"}):(0,i.jsx)(r.xu,{onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}var td=t(94019);t(81974);var tu=t(78439);function th(e){let{model:n,name:t,baseType:l,currentType:a}=e,{runAction:c}=nG(),d=a||l,u=()=>{c("histogram_diff",{model:n,column_name:t,column_type:d},{showForm:!1})},x=()=>{c("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!l||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(r.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nL.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(tu.h,{children:(0,i.jsx)(nF.q,{lineHeight:"20px",children:(0,i.jsxs)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eE(d)&&!eO(d)),children:"Histogram Diff"}),(0,i.jsx)(nH.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tx(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function r(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:r}=e;return n?(0,i.jsx)(th,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:r},{key:"currentType",name:"Current Type",resizable:!0,cellClass:r}],rows:Object.values(e)}}var tm=t(89725),tp=t(13965);function tf(e){let n,t,{base:r,current:l,enableScreenshot:s=!1}=e,{columns:a,rows:c}=(0,v.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(nn(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,r]=e;t[i].baseIndex=n+1,t[i].baseType=r.type}),Object.entries(n).map((e,n)=>{let[i,r]=e;t[i].currentIndex=n+1,t[i].currentType=r.type}),t}(null==r?void 0:r.columns,null==l?void 0:l.columns),n=(null==l?void 0:l.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tx(e,(null==l?void 0:l.name)||(null==r?void 0:r.name)):tx(e)},[r,l]),{lineageGraph:d}=ec(),u=!(null==d?void 0:d.catalogMetadata.base),h=!(null==d?void 0:d.catalogMetadata.current);u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let x=r&&void 0===r.columns,m=l&&void 0===l.columns;return x&&m?t="Schema information is missing on both current and base environments.":x?t="Schema information is missing on base environment.":m&&(t="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[n?(0,i.jsxs)(tm.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tp.z,{}),n]}):t?(0,i.jsxs)(tm.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tp.z,{}),t]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:a,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e7,{})},className:"rdg-light",enableScreenshot:s})})]})}async function tg(e){return(await U.post("/api/select",e)).data}var tv=t(12282);t(15080);let tj=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tv.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},ty=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tv.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var tb=t(79898),tk=t(68630),tw=t(91363);let tC=ne.Nbv,t_=ne.sFB,tS=ne.UGs;function tz(e){return"added"===e?{color:"#1dce00",icon:tC}:"removed"===e?{color:"#ff4444",icon:t_}:"modified"===e?{color:"#ffa502",icon:tS}:{color:"inherit",icon:void 0}}function tR(e){if("model"===e)return{color:"#c0eafd",icon:tk.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tw._MV};if("source"===e)return{color:"#a6dda6",icon:tk.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tw.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tw.R1C};if("seed"===e)return{color:"#a6dda6",icon:tk.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tk.Dmm};else return{color:"inherit",icon:void 0}}function tT(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:l,selected:a,onSelect:c,schemaChanged:d}=e,{icon:u}=tR(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nB("schema_diff"))||void 0===m?void 0:m.icon,t=tz("modified").color}else!h&&x?(n=tz("added").icon,t=tz("added").color):h&&!x&&(n=tz("removed").icon,t=tz("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>c(l.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:l.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})};function tO(e){let{check:n}=e,{lineageGraph:t}=ec(),r=n.params,l=[...H.check(n.check_id),"select"],{isLoading:s,error:o,refetch:a,data:c}=(0,y.a)({queryKey:l,queryFn:async()=>tg({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[d,u]=(0,v.useMemo)(()=>{let e=[],n=[],i=[],l=[];if(null==r?void 0:r.node_id){let n=null==t?void 0:t.nodes[r.node_id];n&&e.push(n)}else for(let n of(null==c?void 0:c.nodes)||[]){let i=null==t?void 0:t.nodes[n];i&&e.push(i)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tT(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?i.push(e.id):e.data.base&&!e.data.current&&l.push(e.id)}function d(e){return n.includes(e.id)?3:i.includes(e.id)?2:l.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==c?void 0:c.nodes,t]),[h,x]=(0,v.useState)(0);if(s)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(o)return(0,i.jsxs)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==o?void 0:o.message]});if(0==d.length)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(h(0,i.jsx)(tE,{node:e,schemaChanged:u.includes(e.id),selected:n===h,onSelect:()=>{x(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})}var tI=t(51643);function tD(e){let{value:n,onChange:t}=e,[r,s]=(0,v.useState)(!1),[a,c]=(0,v.useState)(),d=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(r&&d.current){let e=d.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[r]),r)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tI.g,{value:a,onChange:e=>{c(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1)},ref:d,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(l.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(ev.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(eN.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tM=t(40902);function tA(){let e=(0,n$._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tA=function(){return e},e}function tL(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tN(e){return e.description?e.description:"_(no description)_"}var tq=t(23256),tF=t(31265);let tP=e=>{let{value:n,onChange:t,onRun:r,onRunBase:l,onRunDiff:a,label:c,options:d={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(c||r||l)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(eN.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(r||l)&&(0,i.jsx)(ev.z,{size:"sm",variant:"outline",onClick:r||l,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tw.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tF.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{r&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,r),l&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,l),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...d}})]})},tH=e=>{let{value:n,baseValue:t,onChange:r,onChangeBase:l,onRun:s,onRunBase:a,onRunDiff:c,options:d={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tq.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tP,{label:"Base",value:t||"",onChange:l,onRunBase:a,options:d,...u})}),(0,i.jsx)(tq.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tP,{label:"Current",value:n,onChange:r,onRun:s,options:d,...u})})]})})};var tW=t(23567),tV=t(20085);let tK=(0,eI.G)((e,n)=>{var t,l,s,a;let{isRunning:c,isAborting:d,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(l=h.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tm.b,{status:"error",children:[(0,i.jsx)(tp.z,{}),"Error: ",y]});if(void 0!==c?c:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(eQ.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsxs)(o.k,{alignItems:"center",children:[(null==u?void 0:u.percentage)===void 0||(null==u?void 0:u.percentage)===null?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tW.D,{size:"20px",value:100*u.percentage,mr:"8px"}),d?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!d&&(0,i.jsx)(ev.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(r.xu,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tV.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tJ=t(65674),tU=t(29012),tB=t(25783),tQ=t(43361),tX=t(49110),tZ=t(55415),tG=t(24432);t(90548),t(91074);var tY=t(66633),t$=t(83143),t0=t(29937);function t1(e){let{node:n}=e,{icon:t}=tR(n.resourceType);return(0,i.jsx)(nC.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(n9.Vp,{children:[(0,i.jsx)(n9.AD,{as:t}),(0,i.jsx)(n9.Sn,{children:n.resourceType})]})})}function t2(e){let{rowCount:n}=e,t=n.base,r=n.curr,l=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===r?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===r?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(eN.x,{children:l}),(0,i.jsx)(s.J,{as:t$.Rgz}),(0,i.jsx)(eN.x,{children:o})]}):t===r?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(eN.x,{children:o}),(0,i.jsx)(s.J,{as:t0.lxc,color:"gray.500"}),(0,i.jsx)(eN.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nC.u,{label:l,children:(0,i.jsxs)(n9.Vp,{children:[(0,i.jsx)(n9.AD,{as:x}),(0,i.jsx)(n9.Sn,{children:m||c?(0,i.jsx)(tY.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(t2,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(n9.bq,{as:nq.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(tt.n,{}),size:"xs",onClick:a})]})})}let t4=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tW.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Skipped"}),s&&(0,i.jsx)(nC.u,{label:s,children:(0,i.jsx)(eG.s,{})})]});if(!a)return(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"});let{error:c,result:d,run_id:u,progress:h}=a;if("running"===l)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tW.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(c)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Error"}),s&&(0,i.jsx)(nC.u,{label:c,children:(0,i.jsx)(nu.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(n9.Vp,{children:(0,i.jsx)(n9.Sn,{children:(0,i.jsx)(o.k,{fontSize:"10pt",color:e>0?"red":"green",alignItems:"center",gap:"3px",children:e>0?"".concat(e," columns mismatched"):"All columns match"})})})}if("row_count_diff"===a.type){let e=a.result;return(0,i.jsx)(t5,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},t3=e=>{var n,t,l,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ec(),m=null==x?void 0:x[u],p=null==h?void 0:h.nodes[u];if(!m&&!p)return(0,i.jsx)(i.Fragment,{});if((null==p?void 0:p.data.base)&&(null==p?void 0:p.data.current)&&(c=tT(null===(l=p.data.base)||void 0===l?void 0:l.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nC.u,{label:"Schema (".concat(c?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nB("schema_diff"))||void 0===n?void 0:n.icon,color:c?tz("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nC.u,{label:"Row count (".concat(d?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tz("modified").color:"lightgray"})})})]})};var t8=t(13358),t9=t(15196),t6=t(28023),t7=t(84963);function ie(e){let{base:n,current:t}=e;return(0,i.jsx)(tF.SV,{height:"100%",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}async function it(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}function ii(e){var n,t,l,a,d,f,g;let{node:j,onCloseNode:y}=e,[,b]=(0,eb.TH)(),{setSqlQuery:k,setPrimaryKeys:w}=_(),C="model"===j.resourceType||"seed"===j.resourceType||"source"===j.resourceType||"snapshot"===j.resourceType,{isOpen:S,onOpen:z,onClose:R}=(0,ey.q)(),{runAction:T}=nG(),{envInfo:E}=ec(),{primaryKey:O}=eT(j.name),I=()=>{T("row_count_diff",{node_names:[j.name]},{showForm:!1,showLast:!1})},D=(0,v.useCallback)(async()=>{let e=j.id,n=await it({node_id:e});b("/checks/".concat(n.check_id))},[j,b]),M="added"===j.changeStatus||"removed"===j.changeStatus;return(0,i.jsxs)(t9.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(r.xu,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(c.X,{size:"sm",children:j.name})}),(0,i.jsx)(h.L,{}),("model"===j.resourceType||"seed"===j.resourceType||"snapshot"===j.resourceType)&&(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{as:ev.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nB("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==E?void 0:E.adapterType)==="dbt"?k('select * from {{ ref("'.concat(j.name,'") }}')):(null==E?void 0:E.adapterType)==="sqlmesh"&&k("select * from ".concat(j.name)),w(void 0!==O?[O]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===j.resourceType||"snapshot"===j.resourceType)&&(0,i.jsx)(nH.s,{onClick:z,icon:(0,i.jsx)(tk.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>I(),children:"Row Count Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nB("profile_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("profile_diff",{model:j.name},{showForm:!1,showLast:!1})},children:"Profile Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nB("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("value_diff",{model:j.name},{showForm:!0,showLast:!1})},children:"Value Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nB("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("top_k_diff",{model:j.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nB("histogram_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("histogram_diff",{model:j.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]}),(0,i.jsx)(t6.R,{}),(0,i.jsx)(nP.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nH.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nB("schema_diff"))||void 0===g?void 0:g.icon}),fontSize:"14px",onClick:D,children:"Schema Diff"})})]})]}),(0,i.jsx)(r.xu,{flex:"0 1 1%",children:(0,i.jsx)(t7.P,{onClick:y})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(t1,{node:j}),("model"===j.resourceType||"snapshot"===j.resourceType||"seed"===j.resourceType)&&(0,i.jsx)(t5,{node:j,onRefresh:I})]})}),C&&(0,i.jsxs)(x.m,{overflow:"auto",as:o.k,children:[(0,i.jsx)(m.t,{children:(0,i.jsx)(p.O,{children:"Columns"})}),(0,i.jsx)(n6.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(n7.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tf,{base:j.data.base,current:j.data.current})})})]}),(0,i.jsxs)(eu.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(em.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsx)(ie,{base:j.data.base,current:j.data.current})})]})]})]})}var ir=t(88989),il=t(12867),is=t(27547);async function io(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function ia(e){var n;let{nodes:t,onFinish:r}=e,[,l]=(0,eb.TH)();return(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e;1===t.length?e=await it({node_id:t[0].id}):await Promise.all(t.map(async e=>{await it({node_id:e.id})})),r(),e?l("/checks/".concat(e.check_id)):l("/checks")},children:[(0,i.jsx)(s.J,{as:null===(n=nB("schema_diff"))||void 0===n?void 0:n.icon}),"Add schema check"]})}function ic(e){var n;let{viewMode:t,nodes:r,onFinish:l,isDisabled:o,withIcon:a}=e,[,c]=(0,eb.TH)();return(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",backgroundColor:"white",isDisabled:0===r.length||o,onClick:async()=>{let e=r.map(e=>e.id),n=await io({view_mode:t,node_ids:e});l(),n?c("/checks/".concat(n.check_id)):c("/checks")},children:[a&&(0,i.jsx)(s.J,{as:null===(n=nB("lineage_diff"))||void 0===n?void 0:n.icon}),"Add lineage diff check"]})}function id(e){var n,t,l,o,a,c;let{viewMode:d,nodes:h,onClose:x,onActionStarted:m,onActionNodeUpdated:p,onActionCompleted:f}=e,[g,j]=(0,v.useState)({mode:"per_node",status:"pending",completed:0,total:0}),y=(0,b.NL)(),[,k]=(0,eb.TH)(),{showRunId:w}=nG(),C=async(e,n,t)=>{let i="multi_nodes";g.mode=i,m(),g.status="running";let r=[];for(let e of h){let t=n(e);t?(e.action={mode:i,status:"skipped",skipReason:t},p(e)):(e.action={mode:i,status:"pending"},r.push(e))}let l=t(r);try{let{run_id:n}=await $(e,l,{nowait:!0});for(w(n),g.currentRun={run_id:n},g.total=1;;){let e=await ee(n,2);g.currentRun=e;let t=e.error?"failure":e.result?"success":"running";for(let n of r)n.action={mode:i,status:t,run:e},p(n);if(e.error||e.result)break}}catch(e){}if(g.completed=1,"canceling"===g.status){g.status="canceled",f();return}g.status="completed",f()},_=async(e,n)=>{let t="per_node";for(let e of(g.mode=t,m(),g.status="running",h))e.action={mode:t,status:"pending"},p(e);for(let i of(g.completed=0,g.total=h.length,h)){let{params:r,skipReason:l}=n(i);if(l)i.action={mode:t,status:"skipped",skipReason:l},p(i);else try{let{run_id:n}=await $(e,r,{nowait:!0});for(g.currentRun={run_id:n},i.action={mode:t,status:"running"},p(i);;){let e=await ee(n,2);g.currentRun=e;let r=e.error?"failure":e.result?"success":"running";if(i.action={mode:t,status:r,run:e},p(i),e.error||e.result)break}}catch(e){}finally{g.currentRun=void 0}if(g.completed++,"canceling"===g.status){g.status="canceled",f();return}}g.status="completed",f()},S=async()=>{let e=[];for(let n of h)"model"!==n.resourceType?(n.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},p(n)):e.push(n.name);C("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},z=async()=>{_("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},R=async()=>{var e;g.status="canceling",(null===(e=g.currentRun)||void 0===e?void 0:e.run_id)&&en(g.currentRun.run_id)},T=(0,v.useCallback)(async()=>{var e;let n=null===(e=g.currentRun)||void 0===e?void 0:e.run_id;if(!n)return;let t=await n1(n);y.invalidateQueries({queryKey:H.checks()}),k("/checks/".concat(t.check_id))},[null===(n=g.currentRun)||void 0===n?void 0:n.run_id,k,y]);return(0,il.z)(()=>{"running"===g.status&&R()}),(0,i.jsxs)(r.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:["pending"===g.status&&(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(is.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:x,children:[(0,i.jsxs)(ev.z,{children:[h.length," selected"]}),(0,i.jsx)(nq.h,{"aria-label":"Exit select Mode",icon:(0,i.jsx)(ir.D,{})})]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(ia,{nodes:h,onFinish:x}),(0,i.jsx)(ic,{viewMode:d,nodes:h,onFinish:x,withIcon:!0})]}),(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===h.length,onClick:S,children:[(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon}),"Row count diff"]}),(0,i.jsxs)(ev.z,{size:"xs",variant:"outline",isDisabled:0===h.length,onClick:z,children:[(0,i.jsx)(s.J,{as:null===(l=nB("value_diff"))||void 0===l?void 0:l.icon}),"Value diff"]})]})]}),"pending"!==g.status&&(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(r.xu,{fontSize:"10pt",children:["Progress: ","per_node"===g.mode?"".concat(g.completed," / ").concat(g.total):(null===(c=g.currentRun)||void 0===c?void 0:null===(a=c.progress)||void 0===a?void 0:a.percentage)?"".concat(100*g.currentRun.progress.percentage,"%"):"completed"===g.status?"100%":"0%"," ","canceled"===g.status?" (canceled)":""]}),"running"===g.status||"canceling"===g.status?(0,i.jsx)(ev.z,{size:"xs",variant:"outline",onClick:R,isLoading:"canceling"===g.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsxs)(u.U,{children:["multi_nodes"===g.mode&&(null===(o=g.currentRun)||void 0===o?void 0:o.result)&&(0,i.jsx)(ev.z,{display:"none",size:"xs",variant:"outline",onClick:T,children:"Add to Checklist"}),(0,i.jsx)(ev.z,{size:"xs",variant:"outline",onClick:x,children:"Close"})]})]})]})}let iu=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nG();return(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(s.J,{as:ne.M1Q}),size:"xs",variant:"outline",onClick:e?t:n,children:e?"Hide":"Show"})},ih=e=>{let{isDisabled:n,viewOptions:t,onViewOptionsChanged:r}=e,l=t.view_mode||"changed_models",o=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{as:ev.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tR("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===l?"Changed Models":"All"}),(0,i.jsxs)(nF.q,{title:"packages",children:[(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:"changed_models"===l,onChange:()=>o("changed_models"),children:"Changed Models"}),(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:"all"===l,onChange:()=>o("all"),children:"All"})]})]})},ix=e=>{var n,t;let{viewOptions:r,onViewOptionsChanged:l,isDisabled:o}=e,{lineageGraph:a}=ec(),c=new Set;for(let e of Object.values((null==a?void 0:a.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==a?void 0:null===(t=a.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=r.packages?new Set(r.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),l({...r,packages:Array.from(n)})};return(0,i.jsxs)(nL.v,{closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{as:ev.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t$.zFh}),size:"xs",variant:"outline",isDisabled:o,children:m}),(0,i.jsx)(nF.q,{title:"packages",children:(0,i.jsxs)(nP.k,{title:"Select Packages",children:[(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?l({...r,packages:[]}):l({...r,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(t6.R,{}),Array.from(c).map(e=>(0,i.jsx)(nH.s,{as:nx.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},im=e=>{let[n,t]=(0,v.useState)(e.value),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nD.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})},ip=e=>(0,i.jsx)(im,{isDisabled:e.isDisabled,value:e.viewOptions.select||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,select:n||void 0})}}),ig=e=>(0,i.jsx)(im,{isDisabled:e.isDisabled,value:e.viewOptions.exclude||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,exclude:n||void 0})}}),iv=e=>(0,i.jsxs)(r.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:e.label}),e.children]}),ij=e=>{let[,n]=(0,eb.TH)(),{runAction:t}=nG(),r=(0,v.useCallback)(e=>{e.check_id&&n("/checks/".concat(e.check_id))},[n]);return(0,i.jsxs)(nL.v,{placement:"bottom-end",children:[(0,i.jsx)(nN.j,{as:ev.z,size:"xs",isDisabled:e.isDisabled,children:"..."}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nP.k,{title:"Diff",m:"0",p:"4px 12px",children:(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:()=>{t("row_count_diff",{select:e.viewOptions.select,exclude:e.viewOptions.exclude})},children:"Row Count Diff by Selector"})}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await io(e.viewOptions);n&&r(n)},children:"Lineage Diff"}),(0,i.jsx)(nH.s,{as:eN.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await it({select:e.viewOptions.select,exclude:e.viewOptions.exclude});n&&r(n)},children:"Schema Diff by Selector"})]})]})]})},iy=e=>(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(iv,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(iu,{})}),(0,i.jsx)(iv,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(ih,{...e})}),(0,i.jsx)(iv,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(ix,{...e})}),(0,i.jsx)(iv,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(ip,{...e})}),(0,i.jsx)(iv,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ig,{...e})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iv,{label:"Actions",action:!0,children:(0,i.jsxs)(is.h,{isAttached:!0,variant:"outline",children:[(0,i.jsx)(ev.z,{size:"xs",fontSize:"9pt",onClick:e.onSelectNodesClicked,isDisabled:e.isDisabled,children:"Select nodes"}),(0,i.jsx)(ij,{...e})]})})]})});function ib(){return(0,i.jsx)(r.xu,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,r]]=e,{icon:l,color:a}=tz(n);return(0,i.jsx)(nC.u,{label:r,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:l})," ",t]})},n)})})}var ik=t(11978);let iw={customNode:function(e){var n,t;let l,{data:a}=e,{isHighlighted:c,isSelected:d,resourceType:x,changeStatus:m}=a,p=(0,R.oR)(e=>e.transform[2]>.3),{icon:f}=tR(x),g="gray.400",v="solid";m&&(l=tz(m).icon,g=tz(m).color);let j=g,y=a.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",b=null==a?void 0:a.name;return(0,i.jsx)(nC.u,{label:"model"===x?b:"".concat(b," (").concat(x,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",_hover:{backgroundColor:p?"gray.100":g},borderColor:j,borderWidth:1,borderStyle:v,backgroundColor:p?"white":g,borderRadius:3,boxShadow:y,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===c?"node-highlight":!0===d?"node-highlight":!1===c?"node-unhighlight":void 0,children:[(0,i.jsx)(o.k,{backgroundColor:g,padding:2,borderRightWidth:1,borderColor:j,borderStyle:v,alignItems:"top",visibility:p?"inherit":"hidden",children:(0,i.jsx)(s.J,{as:f})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:p?"inherit":"hidden",children:[(0,i.jsx)(r.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:b}),l&&(0,i.jsx)(o.k,{children:(0,i.jsx)(s.J,{color:g,as:l,flex:"0 0 20px"})})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:p?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(h.L,{}),a.isActionMode?a.action?(0,i.jsx)(t4,{node:a,action:a.action}):(0,i.jsx)(i.Fragment,{}):"model"===a.resourceType?(0,i.jsx)(t3,{id:a.id}):(0,i.jsx)(i.Fragment,{})]})})]}),Object.keys(null!==(n=null==a?void 0:a.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==a?void 0:a.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},iC={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:r,targetY:l,sourcePosition:s,targetPosition:o,style:a={},markerEnd:c,data:d}=e,u={...a};(null==d?void 0:d.changeStatus)&&(u.stroke=tz(null==d?void 0:d.changeStatus).color,u.strokeDasharray="5"),(null==d?void 0:d.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:r,targetY:l,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:c,style:{...u,...a}})})}},i_=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tz(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iS=(e,n)=>{let t=null==e?void 0:e.current,i=(0,v.useRef)({width:0,height:0});(0,v.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,r=t.contentRect.height;(Math.abs(r-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&r>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:r}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])};function iz(e){var n;let{...t}=e,l=(0,R._K)(),a=(0,v.useRef)(null),{successToast:c,failToast:d}=e1(),{copyToClipboard:h,ImageDownloadModal:x,ref:m}=e8({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(e3))},onSuccess:()=>{c("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),d("Failed to copy image to clipboard",e)}}),[p,f,g]=(0,R.Rr)([]),[j,y,b]=(0,R.ll)([]),[k,w]=(0,v.useState)(t.viewOptions||{}),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:T}=ec(),{showRunId:O,closeRunResult:I}=nG(),W=k.view_mode||t.viewMode||"changed_models",[V,K]=(0,v.useState)("detail"),[J,U]=(0,v.useState)("normal"),[B,Q]=(0,v.useState)(),[X,G]=(0,v.useState)(!1),[Y,$]=(0,v.useState)(!1),[ee,en]=(0,v.useState)({x:0,y:0});[...H.lineage(),k.select,k.exclude];let et=(0,Z.p)();(0,v.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(k.select||k.exclude)try{e=(await tg({select:k.select,exclude:k.exclude})).nodes}catch(e){}let[n,t]=A(C,k,e);L(n,t),f(n),y(t)})()},[f,y,C]);let ei=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=l.getZoom();l.setCenter(n,t,{zoom:i,duration:200})}};iS(a,async()=>{if("detail"===V||"action_result"===V){let e=p.find(e=>e.data.isSelected);e?ei(e):l.fitView({nodes:p,duration:200})}});let er=(0,v.useCallback)(e=>{f(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[f]),el=async e=>{let n;if(!C)return;try{n=(await tg({select:e.select,exclude:e.exclude})).nodes}catch(e){if(e instanceof ik.d7){var t,i;et({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[r,s]=A(C,e,n);L(r,s),f(r),y(s),w(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{l.fitView({nodes:r,duration:200})})()};if(S)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tU.$,{size:"xl"})});let es=()=>{$(!1),en({x:0,y:0})};return z?(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsx)(r.xu,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(r.xu,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):"changed_models"!==W||(null==C?void 0:null===(n=C.modifiedSet)||void 0===n?void 0:n.length)?(0,i.jsxs)(tj,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nh.g,{ref:a,divider:(0,i.jsx)(tB.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[t.interactive&&(0,i.jsx)(iy,{isDisabled:"normal"!==J,viewOptions:k,onViewOptionsChanged:el,onSelectNodesClicked:()=>{let e="detail"===V?"action":"detail";Q(void 0),G(!1),f(P(p,"action"===e)),K(e),U("selector")}}),(0,i.jsxs)(R.x$,{nodeTypes:iw,edgeTypes:iC,nodes:p,edges:j,onNodesChange:g,onEdgesChange:b,onNodeClick:(e,n)=>{if(!1!==t.interactive){var i,r,l,s,o;(es(),"detail"===V)?(Q(n.data),X||(ei(n),G(!0)),f(q(n.id,p))):"action_result"===V?((null===(r=n.data.action)||void 0===r?void 0:null===(i=r.run)||void 0===i?void 0:i.run_id)&&O(null===(s=n.data.action)||void 0===s?void 0:null===(l=s.run)||void 0===l?void 0:l.run_id),ei(n),f(q(n.id,p))):f((o=n.id,p.map(e=>{let n=e.id===o;return{...e,data:{...e.data,isSelected:e.data.isSelected!==n}}})))}},onNodeMouseEnter:(e,n)=>{if(!C)return;let[t,i]=N(Array.from(E(D(C,[n.id]),M(C,[n.id]))),p,j);f(t),y(i)},onNodeMouseLeave:(e,n)=>{if(!C)return;let[t,i]=N(Array.from(M(C,C.modifiedSet)),p,j);f(t),y(i)},onNodeContextMenu:(e,n)=>{"action"===V&&(e.preventDefault(),en({x:e.clientX,y:e.clientY,selectedNode:n}),$(!0))},onClick:es,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:t.interactive,ref:m,children:[(0,i.jsx)(tX.A,{color:"#ccc"}),(0,i.jsx)(tZ.Z,{showInteractive:!1,position:"top-right",className:e3,children:(0,i.jsx)(tZ.B,{title:"copy image",onClick:async()=>{h()},children:(0,i.jsx)(s.J,{as:t$.C3L})})}),(0,i.jsx)(x,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(ib,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(eN.x,{fontSize:"xl",color:"grey",opacity:.5,children:p.length>0?"":"No nodes"})}),(0,i.jsx)(tG.a,{nodeColor:i_,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),(0,i.jsx)(R.s_,{position:"bottom-center",className:e3,children:(0,i.jsx)(tQ.R,{in:"selector"===J,unmountOnExit:!0,style:{zIndex:10},children:(0,i.jsx)(id,{viewMode:W,nodes:p.map(e=>e.data).filter(e=>e.isSelected),onClose:()=>{K("detail"),U("normal");let e=P(p);Q(void 0),G(!1),f(e),I(),null==T||T()},onActionStarted:()=>{K("action_result")},onActionNodeUpdated:er,onActionCompleted:()=>{}})})})]})]}),"detail"===V&&B?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(ii,{node:B,onCloseNode:()=>{Q(void 0),G(!1),f(P(p))}})}):(0,i.jsx)(r.xu,{}),Y&&(0,i.jsx)(nL.v,{isOpen:!0,onClose:es,children:(0,i.jsxs)(nF.q,{style:{position:"absolute",left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(t8.Cv2,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(F([...D(C,[e.id])],p))},children:"Select parent nodes"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(t8.IMj,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(F([...M(C,[e.id])],p))},children:"Select child nodes"})]})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(nh.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>{U("normal"),el({...k,view_mode:"all"})},children:"Show all nodes"})]})})}function iR(e){let{check:n}=e,t={...n.params,...n.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(iz,{viewOptions:t,interactive:!1})})})}var iT=t(19339);function iE(e){let{name:n,description:t,type:r,params:l,viewOptions:s}=e,o={name:n,description:t,type:r,params:l};s&&(o.view_options=s);let a=iT.ZP.stringify({checks:[o]});return(0,i.jsx)(tF.ML,{height:"300px",language:"yaml",theme:"vs",value:a,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}let iO=e=>{var n;let[t,i]=(0,v.useState)(!1),[r,l]=(0,v.useState)(!1),[,s]=ed(),{error:o,data:a}=(0,y.a)({queryKey:H.run(e||""),queryFn:async()=>ee(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,v.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let c=(0,v.useCallback)(async()=>{if(l(!0),e)return await en(e)},[e,l]),d=(null==a?void 0:a.type)?null===(n=nB(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:r,error:o,onCancel:c,RunResultView:d}};function iI(){let e=(0,n$._)(["\n
","\n\n ","\n\n
"]);return iI=function(){return e},e}let iD=e=>{var n,t,l,a,d;let{checkId:f}=e,g=(0,b.NL)(),[,j]=(0,eb.TH)(),{successToast:k,failToast:w}=e1(),[C,_]=(0,v.useState)(),[S,z]=(0,v.useState)(),[R,T]=(0,v.useState)(!1),{isOpen:E,onOpen:O,onClose:I}=(0,ey.q)(),D=()=>(0,i.jsx)(eh.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[M,A]=(0,v.useState)((0,i.jsx)(D,{})),{isLoading:L,error:N,data:q}=(0,y.a)({queryKey:H.check(f),queryFn:async()=>n5(f),refetchOnMount:!0}),F=C||(null==q?void 0:null===(n=q.last_run)||void 0===n?void 0:n.run_id),{run:P,error:W}=iO(F),V=C?!P||"running"===P.status:(null==P?void 0:P.status)==="running",K=(null==q?void 0:q.type)?nB(null==q?void 0:q.type):void 0,J=(null==q?void 0:q.is_preset)||!1,{mutate:U}=(0,td.D)({mutationFn:e=>n4(f,e),onSuccess:()=>{g.invalidateQueries({queryKey:H.check(f)}),g.invalidateQueries({queryKey:H.checks()})}}),{mutate:B}=(0,td.D)({mutationFn:()=>n3(f),onSuccess:()=>{g.invalidateQueries({queryKey:H.checks()}),j("/checks")}}),Q=(0,v.useCallback)(async()=>{(null==q?void 0:q.type)&&_((await et(f,{nowait:!0})).run_id)},[q,f,_]),X=(0,v.useCallback)(async()=>{if(T(!0),F)return await en(F)},[F]),Z=async()=>{if(!q)return;let e=(0,tM.RI)(iI(),tL(q),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tN(e),"\n\n").concat((0,tM.Pn)(tA(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tN(e)}(q));if(!navigator.clipboard){w("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),k("Copied the check to the clipboard")}catch(e){w("Failed to copy the check to clipboard",e)}},G=(0,v.useCallback)(()=>{U({is_checked:!(null==q?void 0:q.is_checked)})},[null==q?void 0:q.is_checked,U]),{ref:Y,onCopyToClipboard:$,onMouseEnter:ee,onMouseLeave:ei}=e9();if(L)return(0,i.jsx)(eQ.M,{h:"100%",children:"Loading"});if(N)return(0,i.jsxs)(eQ.M,{h:"100%",children:["Error: ",N.message]});let er=(null==P?void 0:P.run_at)?(0,tJ.Q)(new Date(P.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(ty,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(r.xu,{style:{contain:"strict"},display:"flex",flexDirection:"column",overflow:"auto",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",children:[(0,i.jsx)(tc,{name:(null==q?void 0:q.name)||"",setName:e=>{U({name:e})}}),(0,i.jsx)(h.L,{}),J&&(0,i.jsx)(nC.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(n9.Vp,{size:"sm",children:[(0,i.jsx)(n9.AD,{boxSize:"14px",as:tr.bX4}),"Preset"]})}),(0,i.jsxs)(nL.v,{children:[(0,i.jsx)(nN.j,{isRound:!0,as:nq.h,icon:(0,i.jsx)(s.J,{as:ne.D_A}),variant:"ghost"}),(0,i.jsxs)(nF.q,{children:[(0,i.jsx)(nH.s,{icon:(0,i.jsx)(tl.ovA,{}),onClick:()=>{A((0,i.jsx)(D,{})),O()},children:"Get Preset Check Template"}),(0,i.jsx)(nH.s,{icon:(0,i.jsx)(tn.p,{}),onClick:()=>B(),children:"Delete"})]})]}),er&&(0,i.jsx)(r.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:er}),(null==K?void 0:K.RunResultView)&&(0,i.jsx)(nC.u,{label:"Rerun",children:(0,i.jsx)(nq.h,{isRound:!0,isLoading:V,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(tt.n,{}),onClick:()=>Q()})}),(0,i.jsx)(nC.u,{label:"Copy markdown",children:(0,i.jsx)(nq.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(eZ.T,{}),onClick:()=>Z()})}),(0,i.jsx)(nC.u,{label:(null==q?void 0:q.is_checked)?"Mark as pending":"Mark as approved",placement:"bottom-end",children:(0,i.jsx)(ev.z,{size:"sm",colorScheme:(null==q?void 0:q.is_checked)?"green":"gray",leftIcon:(0,i.jsx)(ti.r,{}),onClick:()=>G(),children:(null==q?void 0:q.is_checked)?"Approved":"Pending"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tD,{value:null==q?void 0:q.description,onChange:e=>{U({description:e})}},null==q?void 0:q.check_id)})]}),(0,i.jsx)(r.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==q?void 0:q.type)==="query"||(null==q?void 0:q.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(u.U,{mr:"10px",children:(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(eZ.T,{}),variant:"outline",isDisabled:!(null==P?void 0:P.result)||!!(null==P?void 0:P.error),onMouseEnter:ee,onMouseLeave:ei,size:"sm",onClick:$,children:"Copy to Clipboard"})})]}),(0,i.jsxs)(n6.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(n7.x,{p:0,width:"100%",height:"100%",children:[(null==K?void 0:K.RunResultView)&&((null==q?void 0:q.last_run)||F?(0,i.jsx)(tK,{ref:Y,isRunning:V,isAborting:R,run:F?P:null==q?void 0:q.last_run,error:W,progress:S,RunResultView:K.RunResultView,viewOptions:null==q?void 0:q.view_options,onViewOptionsChanged:e=>{U({view_options:e})},onCancel:X,onExecuteRun:Q}):(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(ev.z,{onClick:Q,colorScheme:"blue",size:"sm",children:"Run Query"})})),q&&"schema_diff"===q.type&&(0,i.jsx)(tO,{check:q}),q&&"lineage_diff"===q.type&&(0,i.jsx)(iR,{check:q})]}),((null==q?void 0:q.type)==="query"||(null==q?void 0:q.type)==="query_diff"||(null==q?void 0:q.type)==="query_base")&&(0,i.jsx)(n7.x,{p:0,height:"100%",width:"100%",children:(null===(t=q.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tH,{value:(null==q?void 0:null===(l=q.params)||void 0===l?void 0:l.sql_template)||"",baseValue:(null==q?void 0:null===(a=q.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tP,{value:(null==q?void 0:null===(d=q.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(eu.u_,{isOpen:E,onClose:I,isCentered:!0,size:"6xl",children:[M,(0,i.jsxs)(ex.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(em.x,{children:"Preset Check Template"}),(0,i.jsx)(ep.o,{}),(0,i.jsxs)(ef.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(te.y$,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"Please copy the following template and paste it into the recce.yml file."})}),(0,i.jsx)("br",{}),(0,i.jsx)(iE,{name:(null==q?void 0:q.name)||"",description:(null==q?void 0:q.description)||"",type:(null==q?void 0:q.type)||"",params:null==q?void 0:q.params,viewOptions:null==q?void 0:q.view_options})]})]})]})]})};var iM=t(53924);let iA=e=>{var n;let{check:t,selected:l,onSelect:a}=e,c=(0,b.NL)(),d=t.check_id,{mutate:u}=(0,td.D)({mutationFn:e=>n4(d,e),onSuccess:()=>{c.invalidateQueries({queryKey:H.check(d)}),c.invalidateQueries({queryKey:H.checks()})}}),h=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||ek.WzH;return(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:l?"gray.100":"inherit",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),t.is_checked&&(0,i.jsx)(s.J,{color:"green",as:tk.FJM})]})},iL=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:l}=e;return(0,i.jsx)(iM.Z5,{onDragEnd:e=>{e.destination&&l(e.source.index,e.destination.index)},children:(0,i.jsx)(iM.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nh.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iM._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,r=e.style.top-t.y;e.style.left=i,e.style.top=r}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(iA,{check:e,selected:e.check_id===t,onSelect:r},e.check_id)})}},e.check_id)),e.placeholder]})})})};function iN(){let e=(0,n$._)(["\n
","\n\n ","\n\n
"]);return iN=function(){return e},e}let iq=()=>{let[,e]=(0,eb.TH)(),[,n]=(0,eb.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=e1(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:H.checks(),queryFn:n2,refetchOnMount:!0}),h=(0,v.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,v.useState)(d||[]),{mutate:p}=(0,td.D)({mutationFn:e=>n8(e),onSuccess:()=>{t.invalidateQueries({queryKey:H.checks()})}}),f=(0,v.useCallback)((e,n)=>{let t=[...x],[i]=t.splice(e,1);t.splice(n,0,i),p({source:e,destination:n}),m(t)},[x,m,p]);return((0,v.useCallback)(async()=>{let e=await n0();t.invalidateQueries({queryKey:H.checks()}),h(e.check_id)},[t,h]),(0,v.useEffect)(()=>{"success"===u&&(!o&&d.length>0&&e("/checks/".concat(d[0].check_id)),m(d))},[u,o,d,m,e]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==d?void 0:d.length)?(0,i.jsxs)(tj,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(r.xu,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nh.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nC.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nq.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tM.RI)(iN(),tL(e),tN(e))).join("\n\n");if(!navigator.clipboard){s("Failed to copy checklist to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),l("Copied ".concat(d.length," checks to the clipboard"))}catch(e){s("Failed to copy checklist to clipboard",e)}},icon:(0,i.jsx)(eZ.T,{})})}),(0,i.jsx)(n_.i,{mb:"8px"}),(0,i.jsx)(iL,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(eb.rs,{children:(0,i.jsx)(eb.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iD,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};var iF=t(25356);async function iP(e,n){return await $("query",e,n)}async function iH(e,n){return await $("query_base",e,n)}async function iW(e,n){return await $("query_diff",e,n)}var iV=t(67619),iK=t(58565),iJ=t(49468);let iU=e=>{var n;let{defaultValues:t,suggestionList:r,onValuesChange:l}=e,[s,o]=(0,v.useState)(t||[]),[a,c]=(0,v.useState)(""),[d,u]=(0,v.useState)(!1),h=(0,v.useRef)(null),x=e=>{s.includes(e)||(c(""),o([...s,e]),l([...s,e]))};return(0,i.jsxs)(iV.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nL.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{width:"100%",children:(0,i.jsx)(nD.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:s.length>1?"".concat(s.length," ").concat(e.unitName,"s selected"):1===s.length?"".concat(s.length," ").concat(e.unitName," selected"):""})}),(0,i.jsx)(tu.h,{children:(0,i.jsxs)(nF.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nP.k,{children:(0,i.jsxs)(iK.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[s.map((n,t)=>(0,i.jsx)(iK.U,{children:(0,i.jsxs)(n9.Vp,{size:e.size,children:[(0,i.jsx)(n9.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(n9.SD,{paddingRight:"8px",onClick:()=>{o(s.filter(e=>e!==n)),l(s.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iK.U,{width:"100%",children:(0,i.jsx)(nD.I,{ref:h,placeholder:"Filter keys or add custom",variant:"unstyled",size:e.size,value:a,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":x(n),c("");break;case"Backspace":""===e.currentTarget.value&&s.length>0&&(o(s.slice(0,-1)),l(s.slice(0,-1)))}},onBlur:()=>{var e;h&&d&&(null==h||null===(e=h.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(t6.R,{}),(0,i.jsxs)(nP.k,{children:[""!==a&&!(null==r?void 0:r.includes(a))&&(0,i.jsxs)(nH.s,{onClick:()=>{x(a),u(!1)},children:["Add '",a,"' to the list"]},"custom-value-by-filter"),null==r?void 0:null===(n=r.filter(e=>""===a||e.includes(a)).filter(e=>!s.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nH.s,{onClick:()=>x(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(iJ.x,{children:(0,i.jsx)(ev.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===s.length,onClick:()=>{c(""),o([]),l([])},children:"Clear"})})]})},iB=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=ec(),s=(0,v.useMemo)(()=>{if(!l)return[];let e=new Set;for(let i in l.nodes){var n,t;let r=l.nodes[i],s=null===(n=r.data.base)||void 0===n?void 0:n.columns,o=null===(t=r.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[l]);return(0,i.jsx)(o.k,{...r,children:(0,i.jsxs)(ew.NI,{m:"4px 8px",children:[(0,i.jsxs)(eC.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nC.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",children:(0,i.jsx)(eG.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iU,{unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name..."})]})})},iQ=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nG();return(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(s.J,{as:ne.M1Q}),size:"xs",variant:"outline",onClick:e?t:n,children:e?"Hide":"Show"})]})},iX=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:l}=_();return(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(r.xu,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nC.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(eG.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iF.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&l&&l(t),n(!e)}})]})},iZ=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:l,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=ec(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nG(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iP;case"query_base":return iH;case"query_diff":return iW;default:throw Error("Unknown query type: ".concat(e))}}(e),r={sql_template:t};"query_diff"===e&&(r.primary_keys=s,c&&(r.base_sql_template=n));let{run_id:l}=await i(r,{nowait:!0});return x(l),await ee(l)},{mutate:p,isPending:f}=(0,td.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(iQ,{}),(0,i.jsx)(iX,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iB,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(r.xu,{width:"100%",flex:"1",children:c?(0,i.jsx)(tH,{value:u,baseValue:n,onChange:t,onChangeBase:l,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tP,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var iG=t(30148);let iY=e=>(0,iG.c4)("#!"+e),i$=()=>[(0,iG.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),iY];var i0=t(24681),i1=t(62843);let i2=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:H.run(t),queryFn:async()=>ee(t)}),o=(null==s?void 0:s.type)?null===(n=nB(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tK,{isPending:r,error:l,run:s,RunResultView:o})},i5=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(eQ.M,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(o.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(c.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(r.xu,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(ev.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},i4=e=>{let{children:n}=e;return(0,i.jsx)(tV.SV,{fallback:i5,children:n})};async function i3(){return(await U.post("/api/export")).data}async function i8(e){let n=new FormData;return n.append("file",e),(await U.post("/api/import",n)).data}async function i9(){return 208===(await U.get("/api/sync")).status}async function i6(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,ik.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var i7=t(16021);function re(){let e=(0,Z.p)(),n=async()=>{try{let e=await i3(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,e2.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");e4()(t,r)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nC.u,{label:"Export",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:i7.tRY,boxSize:"1.2em"})})})}var rn=t(65475);function rt(){let e=(0,Z.p)(),n=(0,b.NL)(),t=(0,v.useRef)(null),r=(0,v.useRef)(null),[l,a]=(0,v.useState)(null),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),[h,x]=(0,eb.TH)(),[,m]=ed(),p=(0,v.useCallback)(async()=>{if(l){try{let{runs:t,checks:i}=await i8(l);m(),await n.invalidateQueries({queryKey:H.checks()}),await n.invalidateQueries({queryKey:H.runs()}),h.includes("/checks")&&x("/checks"),e({description:"".concat(t," runs and ").concat(i," checks imported successfully"),status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(n){console.error("Import failed",n),e({title:"Import failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}u()}},[n,l,e,u,h,x,m]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Import",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{t.current&&t.current.click()},icon:(0,i.jsx)(s.J,{as:i7.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:t,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(a(e.target.files[0]),d())}}),(0,i.jsx)(rn.a,{isOpen:c,leastDestructiveRef:r,onClose:u,size:"xl",children:(0,i.jsx)(eh.Z,{children:(0,i.jsxs)(rn._,{children:[(0,i.jsx)(em.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(o.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(eG.s,{color:"red.600"}),(0,i.jsx)(eN.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(eN.x,{children:["The current runs and checks will be"," ",(0,i.jsx)(eN.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{ref:r,onClick:u,children:"Cancel"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:p,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var ri=t(93126),rr=t(1026),rl=t(13154),rs=t(99434),ro=t(20143),ra=t(89830),rc=t(13276),rd=t(31610);function ru(e){let n=(0,rd.D)(e);return(0,e2.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function rh(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(o.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,t]=e;return"url"!==n&&null!=t}).map(e=>{let[n,t]=e;return(0,i.jsxs)(tb.HC,{ml:"10px",children:[n,": ",t]},n)})}function rx(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ec(),{isOpen:m,onOpen:p,onClose:f}=(0,ey.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,k=(null==y?void 0:y.generated_at)?ru(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?ru(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(d=e.data.current)||void 0===d?void 0:d.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Environment Info",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:tl.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(eu.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{children:"Environment Information"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(o.k,{direction:"column",gap:"5px",children:[h?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(tb.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tb.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&rh(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(tb.QI,{spacing:1,children:g&&rh(g)})]})}),(0,i.jsx)(n_.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"DBT"}),(0,i.jsx)(ri.x,{children:(0,i.jsxs)(rr.i,{variant:"simple",children:[(0,i.jsx)(rl.h,{children:(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(ro.Th,{}),(0,i.jsx)(ro.Th,{children:"base"}),(0,i.jsx)(ro.Th,{children:"current"})]})}),(0,i.jsxs)(ra.p,{children:[(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(rc.Td,{children:"schema"}),(0,i.jsx)(rc.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(rc.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(rc.Td,{children:"version"}),(0,i.jsx)(rc.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(rc.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(rc.Td,{children:"timestamp"}),(0,i.jsx)(rc.Td,{children:k}),(0,i.jsx)(rc.Td,{children:w})]})]})]})})]}),(null==u?void 0:u.adapterType)==="sqlmesh"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(c.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(ri.x,{children:(0,i.jsxs)(rr.i,{variant:"simple",children:[(0,i.jsx)(rl.h,{children:(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(ro.Th,{}),(0,i.jsx)(ro.Th,{children:"base"}),(0,i.jsx)(ro.Th,{children:"current"})]})}),(0,i.jsx)(ra.p,{children:(0,i.jsxs)(rs.Tr,{children:[(0,i.jsx)(rc.Td,{children:"Environment"}),(0,i.jsx)(rc.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(rc.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(ev.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var rm=t(21166),rp=t(43399),rf=t(60057);function rg(){return(0,i.jsx)(nC.u,{label:"Syncing",children:(0,i.jsx)(ev.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tU.$,{})})})}function rv(){let[e,n]=(0,v.useState)(!1),t=(0,b.NL)(),[l,o]=(0,eb.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ey.q)(),[u,h]=(0,v.useState)(""),x=(0,Z.p)(),m=(0,v.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await i6(e)).status){c(),n(!1);return}for(;await i9();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:H.lineage()}),t.invalidateQueries({queryKey:H.checks()}),t.invalidateQueries({queryKey:H.runs()}),/^\/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(l)&&o("/checks")},[t,l,o,x,c,d]);return e?(0,i.jsx)(rg,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.u,{label:"Sync with Cloud",children:(0,i.jsx)(nq.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:i7.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(eu.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{children:[(0,i.jsx)(em.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ef.f,{children:[(0,i.jsx)(r.xu,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(r.xu,{mt:"5px",children:(0,i.jsx)(rm.E,{onChange:h,value:u,children:(0,i.jsxs)(tq.K,{direction:"column",children:[(0,i.jsxs)(rp.Y,{value:"merge",children:["Merge",(0,i.jsx)(nC.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rf.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rp.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nC.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rf.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rp.Y,{value:"revert",children:["Revert",(0,i.jsx)(nC.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rf.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(eg.m,{children:[(0,i.jsx)(ev.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}function rj(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iz,{viewMode:"changed_models",interactive:!0})})}async function ry(){return(await U.get("/api/flag")).data}async function rb(){try{await U.post("/api/onboarding/completed")}catch(e){}}var rk=()=>{let[e,n]=(0,v.useState)(!1);(0,v.useEffect)(()=>{ry().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),rb()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(eu.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(eh.Z,{}),(0,i.jsxs)(ex.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(em.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ep.o,{}),(0,i.jsx)(ef.f,{children:(0,i.jsxs)(tq.K,{spacing:4,children:[(0,i.jsxs)(tb.aV,{spacing:2,children:[(0,i.jsx)(tb.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tb.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tb.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(n_.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(eg.m,{children:(0,i.jsx)(ev.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},rw=t(1873);let rC=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",r=null==n?void 0:n.status;!r&&(n.result?r="finished":n.error&&(r="failed"));let l="",s="";"successful"===r||"finished"===r?(l="green",s="Finished"):"failed"===r?(l="red",s="Failed"):"cancelled"===r?(l="gray",s="Cancelled"):"running"===r?(l="blue",s="Running"):(l="green",s="Finished");let a=(null==n?void 0:n.run_at)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,e2.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,e2.WU)(e,"HH:mm"):(0,e2.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tU.$,{size:"xs",color:"".concat(l,".400")}),(0,i.jsx)(eN.x,{fontWeight:500,color:"".concat(l,".400"),children:s}),(0,i.jsx)(eN.x,{children:"•"}),(0,i.jsx)(eN.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},r_=e=>{let n=iT.ZP.stringify(e,null,2);return(0,i.jsx)(tF.ML,{height:"100%",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},rS=e=>{var n,t,r;let{runId:l,onClose:s}=e,{runAction:a}=nG(),{error:c,run:d,onCancel:f,isRunning:g}=iO(l),[j,y]=(0,v.useState)(),k=(0,b.NL)(),[,w]=(0,eb.TH)(),[C,_]=(0,v.useState)(0),S=(null==d?void 0:d.type)?null===(n=nB(d.type))||void 0===n?void 0:n.RunResultView:void 0,z=(0,v.useCallback)(()=>{a((null==d?void 0:d.type)||"",null==d?void 0:d.params)},[d,a]),R=null==d?void 0:d.check_id,T=(0,v.useCallback)(async()=>{R&&w("/checks/".concat(R))},[R,w]),E=(0,v.useCallback)(async()=>{if(!l)return;let e=await n1(l,j);k.invalidateQueries({queryKey:H.checks()}),w("/checks/".concat(e.check_id))},[l,w,k,j]),O=(null==d?void 0:d.type)==="query"||(null==d?void 0:d.type)==="query_diff"||(null==d?void 0:d.type)==="query_base",{ref:I,onCopyToClipboard:D,onMouseEnter:M,onMouseLeave:A}=e9();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:C,onChange:_,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),O&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[d&&(0,i.jsx)(rC,{run:d}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(tt.n,{}),variant:"outline",isDisabled:!l||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(eZ.T,{}),variant:"outline",isDisabled:!l||!(null==d?void 0:d.result)||!!c,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:D,children:"Copy to Clipboard"}),(null==d?void 0:d.check_id)?(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(rw.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(ev.z,{leftIcon:(0,i.jsx)(rw.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t7.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tK,{ref:I,error:c,run:d,onCancel:f,viewOptions:j,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(r_,{type:d.type,params:d.params}),2===C&&d&&((null===(t=d.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tH,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tP,{value:(null==d?void 0:null===(r=d.params)||void 0===r?void 0:r.sql_template)||"",options:{readOnly:!0}}))]})},rz=e=>{let{onClose:n}=e,{runId:t}=nG();return(0,i.jsx)(rS,{runId:t,onClose:n})};var rR=t(22661);t(86777);let rT=e=>{var n;let{run:t,isSelected:l,onSelectRun:a,onAddToChecklist:c,onGoToCheck:d}=e,{data:u}=(0,y.a)({queryKey:H.run(t.run_id),queryFn:async()=>await ee(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||ek.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:l?"orange.400":"transparent",backgroundColor:l?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:l?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nC.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(eN.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:tk.FJM})})}):(0,i.jsx)(nC.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(eN.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t.run_id)},children:(0,i.jsx)(s.J,{as:tk.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(rC,{run:u||t})})]})},rE=e=>{let{runAt:n}=e,t=n?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":t.toDateString()===e.toDateString()?"Yesterday":(0,e2.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(o.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},rO=()=>{let{data:e,isLoading:n,isFetching:t,error:l,refetch:s}=(0,y.a)({queryKey:H.runs(),queryFn:async()=>await er(),retry:!1}),{showRunId:a,runId:d}=nG(),x=e=>{a(e,!1)},[,m]=(0,eb.TH)(),p=(0,b.NL)(),f=(0,v.useCallback)(async()=>{if(!d)return;let e=await n1(d);p.invalidateQueries({queryKey:H.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,v.useCallback)(e=>{m("/checks/".concat(e))},[m]),j=null;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(c.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.h,{variant:"unstyled",icon:(0,i.jsx)(tt.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(r.xu,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(eQ.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(rR.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),r=null!=j&&j!==t;return j=t,(0,i.jsxs)(i.Fragment,{children:[r&&(0,i.jsx)(rE,{runAt:e.run_at},t),(0,i.jsx)(rT,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var rI=t(39588);let rD=e=>{let{children:n,path:t}=e,[l]=(0,eb.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rM(e){let{icon:n,href:t,...r}=e;return(0,i.jsx)(l.r,{height:"20px",color:"white",href:t,isExternal:!0,...r,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function rA(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=ec(),p=function(){let[e,n]=(0,v.useState)("");return(0,v.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},j=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(c.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(r.xu,{children:"cloud mode"}),(0,i.jsx)(r.xu,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(l.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:ne.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(r.xu,{children:"demo mode"}),(0,i.jsx)(r.xu,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(l.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:ne.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(j)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rM,{icon:tk.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rM,{icon:tk.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rM,{mr:"18px",icon:tk.MXt,href:"https://datarecce.io/docs"})]})}function rL(e){let{queryKey:n,fetchCallback:t,selectCallback:l}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:l});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(r.xu,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function rN(){let{isDemoSite:e,cloudMode:n,isLoading:t}=ec(),[r,l]=(0,eb.TH)(),s=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(rL,{queryKey:H.checks(),fetchCallback:n2,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],o=ez().findIndex(s,e=>{let{href:n}=e;return r.startsWith(n)});return(0,i.jsx)(x.m,{index:o,children:(0,i.jsxs)(m.t,{children:[s.map(e=>{let{name:n,href:t,badge:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{l(t)},children:[n,r]},n)}),(0,i.jsx)(h.L,{}),!t&&(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(rv,{}),!e&&!n&&(0,i.jsx)(rt,{}),(0,i.jsx)(re,{})]}),(0,i.jsx)(rx,{})]})})}function rq(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nG(),[l]=(0,eb.TH)(),s=e&&!l.startsWith("/checks"),o=n&&!l.startsWith("/checks");return(0,i.jsxs)(tj,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(r.xu,{style:{contain:"size"},children:o&&(0,i.jsx)(rO,{})}),(0,i.jsxs)(ty,{sizes:s?[60,40]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(r.xu,{p:0,style:{contain:"content"},children:(0,i.jsxs)(i4,{children:[(0,i.jsx)(rD,{path:"/lineage",children:(0,i.jsx)(rj,{})}),(0,i.jsxs)(eb.rs,{children:[(0,i.jsx)(eb.AW,{path:"/query",children:(0,i.jsx)(iZ,{})}),(0,i.jsx)(eb.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iq,{})}),(0,i.jsx)(eb.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(i2,{runId:n})}}),(0,i.jsx)(eb.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eb.AW,{children:(0,i.jsx)(eb.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(rz,{onClose:t}):(0,i.jsx)(r.xu,{})]})]})}function rF(){(0,v.useLayoutEffect)(()=>{var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"";if(n&&rI.env.AMPLITUDE_API_KEY)try{j.S1(rI.env.AMPLITUDE_API_KEY,n,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,i0.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(i1.Z,{theme:e,children:(0,i.jsx)(g.x,{children:(0,i.jsx)(b.aH,{client:B,children:(0,i.jsx)(eb.F0,{hook:i$,children:(0,i.jsx)(nY,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",children:[(0,i.jsx)(rA,{}),(0,i.jsx)(rN,{}),(0,i.jsx)(rk,{}),(0,i.jsx)(rq,{})]})})})})})})}},91074:function(){},87679:function(){},81974:function(){},15080:function(){}},function(e){e.O(0,[634,145,170,591,521,462,531,498,43,987,182,710,615,971,495,599,512,518,132,584,744],function(){return e(e.s=27709)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/_next/static/7OO5H0u3fYPozSTDlB1PP/_buildManifest.js b/recce/data/_next/static/tYlT3jXbkvsZEbsL8O1gv/_buildManifest.js similarity index 100% rename from recce/data/_next/static/7OO5H0u3fYPozSTDlB1PP/_buildManifest.js rename to recce/data/_next/static/tYlT3jXbkvsZEbsL8O1gv/_buildManifest.js diff --git a/recce/data/_next/static/7OO5H0u3fYPozSTDlB1PP/_ssgManifest.js b/recce/data/_next/static/tYlT3jXbkvsZEbsL8O1gv/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/7OO5H0u3fYPozSTDlB1PP/_ssgManifest.js rename to recce/data/_next/static/tYlT3jXbkvsZEbsL8O1gv/_ssgManifest.js diff --git a/recce/data/index.html b/recce/data/index.html index 8f15f6e6..ecad4354 100644 --- a/recce/data/index.html +++ b/recce/data/index.html @@ -1,4 +1,4 @@ -recce
\ No newline at end of file + );position:absolute;will-change:left;min-width:50%;-webkit-animation:animation-11lmxjq 1s ease infinite normal none running;animation:animation-11lmxjq 1s ease infinite normal none running;}@-webkit-keyframes animation-11lmxjq{0%{left:-40%;}100%{left:100%;}}@keyframes animation-11lmxjq{0%{left:-40%;}100%{left:100%;}}
\ No newline at end of file diff --git a/recce/data/index.txt b/recce/data/index.txt index 9a4752b3..0ebe7695 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,7 +1,7 @@ 2:I[60814,[],""] -3:I[68868,["634","static/chunks/7c9ab469-d59c34a146c2259a.js","145","static/chunks/fb2d5402-b112ee94f359fd91.js","170","static/chunks/526a6206-9156b8e9753ffaa7.js","591","static/chunks/035f84b6-8627f6ae9f8d2526.js","521","static/chunks/607285b2-58a32e0915404339.js","462","static/chunks/f6be744d-578a34dee0c50186.js","531","static/chunks/f78b7092-7d3d27886d08bf3a.js","498","static/chunks/6af6e714-b57f801ec893d6a3.js","43","static/chunks/73f1a627-0f5d5ff9ebdbe15c.js","987","static/chunks/e2488a8c-a5aa24a54074e027.js","182","static/chunks/5e9a126f-4e3f5e14318f7e68.js","710","static/chunks/2d02f0f7-d861d41150edee1d.js","615","static/chunks/873d823b-c0f78eb6c43e16d3.js","971","static/chunks/49348413-1d6c560347c39bd1.js","495","static/chunks/6dc81886-17734d434fe3ce1e.js","599","static/chunks/c132bf7d-3d57a8751ef59e60.js","512","static/chunks/4b89641d-a6f609f4e82ef6d5.js","518","static/chunks/518-e10da815fefffee9.js","931","static/chunks/app/page-b11fb8bf449bfd6c.js"],""] +3:I[68868,["634","static/chunks/7c9ab469-d59c34a146c2259a.js","145","static/chunks/fb2d5402-b112ee94f359fd91.js","170","static/chunks/526a6206-9156b8e9753ffaa7.js","591","static/chunks/035f84b6-8627f6ae9f8d2526.js","521","static/chunks/607285b2-58a32e0915404339.js","462","static/chunks/f6be744d-578a34dee0c50186.js","531","static/chunks/f78b7092-7d3d27886d08bf3a.js","498","static/chunks/6af6e714-b57f801ec893d6a3.js","43","static/chunks/73f1a627-0f5d5ff9ebdbe15c.js","987","static/chunks/e2488a8c-a5aa24a54074e027.js","182","static/chunks/5e9a126f-4e3f5e14318f7e68.js","710","static/chunks/2d02f0f7-d861d41150edee1d.js","615","static/chunks/873d823b-c0f78eb6c43e16d3.js","971","static/chunks/49348413-1d6c560347c39bd1.js","495","static/chunks/6dc81886-17734d434fe3ce1e.js","599","static/chunks/c132bf7d-3d57a8751ef59e60.js","512","static/chunks/4b89641d-a6f609f4e82ef6d5.js","518","static/chunks/518-e10da815fefffee9.js","931","static/chunks/app/page-b7a3d8e0939cace5.js"],""] 4:I[4737,[],""] 5:I[25587,[],""] -0:["7OO5H0u3fYPozSTDlB1PP",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/f15c0cae9ebd0e4b.css","precedence":"next","crossOrigin":""}]]}]}]}],null]],[null,"$L6"]]]] +0:["tYlT3jXbkvsZEbsL8O1gv",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/f15c0cae9ebd0e4b.css","precedence":"next","crossOrigin":""}]]}]}]}],null]],[null,"$L6"]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"recce"}],["$","meta","3",{"name":"description","content":"Recce: Data validation toolkit for comprehensive PR review"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"32x32"}]] 1:null