From 29cf009097c3eb1a11946a88fc408ff9bf0f5a38 Mon Sep 17 00:00:00 2001 From: kentwelcome Date: Thu, 12 Dec 2024 07:15:35 +0000 Subject: [PATCH] AUTO-COMMIT - build js statics to recce data/ --- recce/data/404.html | 2 +- recce/data/_next/static/chunks/app/page-d238b14e32288b94.js | 1 + recce/data/_next/static/chunks/app/page-e9463241ce30f70d.js | 1 - .../_buildManifest.js | 0 .../_ssgManifest.js | 0 recce/data/index.html | 4 ++-- recce/data/index.txt | 4 ++-- 7 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 recce/data/_next/static/chunks/app/page-d238b14e32288b94.js delete mode 100644 recce/data/_next/static/chunks/app/page-e9463241ce30f70d.js rename recce/data/_next/static/{t9g3TyzSKWJz98HjtGkxP => uc8y5w_Kw4R3yjojwd83L}/_buildManifest.js (100%) rename recce/data/_next/static/{t9g3TyzSKWJz98HjtGkxP => uc8y5w_Kw4R3yjojwd83L}/_ssgManifest.js (100%) diff --git a/recce/data/404.html b/recce/data/404.html index f03644a8..d0f75e4d 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-d238b14e32288b94.js b/recce/data/_next/static/chunks/app/page-d238b14e32288b94.js new file mode 100644 index 00000000..099c0d9b --- /dev/null +++ b/recce/data/_next/static/chunks/app/page-d238b14e32288b94.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,38827))},38827:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return l$}});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(630),v=t(27470),j=t(66518),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,j.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=j.useState(k),[r,s]=j.useState(k),[o,a]=j.useState(!1),[c,d]=j.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,j.useContext)(w),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=j.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 D=t(28482),I=t.n(D);function O(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 M(e,n){let t=[],i=[];function l(e){return"base"===e?0:"current"===e?2:1}function r(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(r))(!s||s.has(n.id))&&t.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(r))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return L(t,i),N(Array.from(A(e,e.modifiedSet)),t,i)}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=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function P(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function W(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 V=t(62330),K=t(39588);let J=K.env.NEXT_PUBLIC_API_URL?K.env.NEXT_PUBLIC_API_URL:window.location.origin;var B=t(94614);let U=V.default.create({baseURL:J}),Q=new B.S;async function Z(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var G=t(99873),Y=t(17695),$=t(62628),ee=t(6533),en=t(96985),et=t(7797),ei=t(79481),el=t(13844),er=t(64653),es=t(85929),eo=t.n(es);async function ea(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ec(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function ed(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function eu(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function eh(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function ex(){return(await U.get("/api/runs")).data}async function em(){return(await U.post("/api/runs/aggregate",{})).data}let ep=(0,j.createContext)({isActionAvailable:()=>!0});function ef(e){var n,t;let{children:l}=e,{data:r,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:H.lineage(),queryFn:Z}),{data:c,refetch:d}=(0,y.a)({queryKey:H.runsAggregated(),queryFn:em}),u=(0,j.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,v=null==r?void 0:r.adapter_type,k=null==r?void 0:r.git,w=null==r?void 0:r.pull_request,C=null==x?void 0:null===(n=x.base)||void 0===n?void 0:n.manifest_metadata,_=null==x?void 0:null===(t=x.current)||void 0===t?void 0:t.manifest_metadata,S=null==r?void 0:r.support_tasks,z={adapterType:v,git:k,pullRequest:w,dbt:{base:C,current:_},sqlmesh:null==r?void 0:r.sqlmesh},{connectionStatus:R,connect:T}=function(){let e=(0,G.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending");n.current.status=t;let l=(0,b.NL)(),r=()=>{l.invalidateQueries({queryKey:H.lineage()}),l.invalidateQueries({queryKey:H.checks()}),l.invalidateQueries({queryKey:H.runs()})},s=()=>{let t=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&r(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[l,s]=i.split("/").slice(-2),o=eo().parse(s).name;e({description:"Detected ".concat(l," ").concat(o," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),r()}}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return s(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:s}}(),E=(0,j.useCallback)(e=>{if(S){var n;return null===(n=S[e])||void 0===n||n}return!0},[S]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ep.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:z,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,supportTasks:S,isActionAvailable:E,refetchRunsAggregated:()=>{d()}},children:l}),(0,i.jsxs)(Y.u_,{isOpen:"disconnected"===R,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Server Disconnected"}),(0,i.jsx)(et.f,{children:(0,i.jsx)(ei.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(el.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{T()},children:"Retry"})})]})]})]})}let eg=()=>(0,j.useContext)(ep),ev=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eg();return[e,n]};var ej=t(69384);let ey=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,j.useState)(c),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)(Y.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(en.x,{children:a}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.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)(el.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(er.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var eb=t(25612),ek=t(76330),ew=t(53152),eC=t(18222),e_=t(30678),eS=t(2838),ez=t(13156),eR=t.n(ez);function eT(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 eE=e=>{var n;let{lineageGraph:t}=eg(),[i,l]=(0,j.useState)([]),[r,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[c,d]=(0,j.useState)(null),u=eR().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eT(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,j.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(eT(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 eD(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 eI(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 eO=t(85813),eA=t(81945),eM=t(14827);function eL(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 eN(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)}}let eq="#63B3ED",eF="#F6AD55",eP="".concat(eq,"A5"),eW="".concat(eF,"A5");function eH(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;eA.kL.register(eA.ZL,eA.RM,eA.f$,eA.uw,eA.Dx,eA.De,eA.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]:{},{title:i,datasets:l,type:r,samples:s=0,binEdges:o}=e,[a,c]=l,d="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eJ(o,n);return"".concat(d?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,l=0===n?c.counts:a.counts,r=eL(l[t]/s),o=l[t];return"".concat(i,": ").concat(o," (").concat(r,")")}}}},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 eN(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",eW,l);return{labels:i.map((e,n)=>eJ(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eM.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=eN(t),r=eN(i);return"".concat(l," - ").concat(r)}let eB=(0,eO.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})})}),eU=(0,eO.G)(function(e,n){var t,r,s,a,c,d;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(r=x.result)||void 0===r?void 0:r.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(c=x.result)||void 0===c?void 0:c.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(eB,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.xu,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(eV,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(d=x.params)||void 0===d?void 0:d.column_type)||"",datasets:[f,p],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var eQ=t(24112);t(63156);var eZ=t(22204);let eX=(0,eO.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ.ZP,{ref:n,...t})})});function eG(){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)(ei.x,{fontWeight:"600",children:" No rows"})})}t(87679);var eY=t(52091);function e$(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 e0(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 e1(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 e2(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?eY.ven:eY.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?eY.$kI:eY.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let e5=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]},e4=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(ei.x,{style:{color:"gray"},children:"-"});let[l,r]=e5(n[t.key]);return(0,i.jsx)(ei.x,{style:{color:r?"gray":"inherit"},children:l})};function e3(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(e$(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=e0(l.columns,s);l.data.forEach((n,t)=>{let i=e1(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e0(r.columns,s),r.data.forEach((n,t)=>{let i=e1(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=e$(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||eR().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(!eR().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(e2,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eZ.Ug,headerCellClass:l,cellClass:r,renderCell:e4,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eZ.Ug,headerCellClass:l,cellClass:r,renderCell:e4,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)(e2,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e4})}),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 e9=(0,eO.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,j.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,j.useMemo)(()=>e3(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)(eX,{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 e8(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?eY.$kI:eY.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function e6(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=e$(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))&&(eR().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(!eR().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(e8,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eZ.Ug,headerCellClass:l,cellClass:r,renderCell:e4,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eZ.Ug,headerCellClass:l,cellClass:r,renderCell:e4,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(e8,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e4})}),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 e7=t(93998),ne=t(25773),nn=t(63352);let nt=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)(ne.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.xu,{children:[(0,i.jsx)(e7.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nn.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)(er.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},ni=(e,n)=>{var t,l,r,s,a,c;let{run:d,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,j.useMemo)(()=>{var e,n;return e3(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]),v=(0,j.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(v&&k.push(v),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)(nt,{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)(nt,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nl=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:c,viewOptions:d,onViewOptionsChanged:u}=e,h=(0,j.useMemo)(()=>(null==d?void 0:d.changed_only)||!1,[d]),x=(0,j.useMemo)(()=>(null==d?void 0:d.pinned_columns)||[],[d]),m=(0,j.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 e6(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)(nt,{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)(nt,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nr=(0,eO.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,eO.G)(nl);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eO.G)(ni);return(0,i.jsx)(t,{...e,ref:n})}});function ns(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?eY.$kI:eY.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let no=(0,eO.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,c=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=null==t?void 0:t.result,u=(0,j.useMemo)(()=>d?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(ns,{name:t,...n}),width:"auto",renderCell:e4});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eR().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)(e7.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.xu,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(er.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function na(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 nc=t(68844),nd=t.n(nc);let nu=(0,eO.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=nd()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nd()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="No Change";return null!==t&&null!==i?l=t!==i?na(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)(eX,{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)(eG,{})},className:"rdg-light",enableScreenshot:!0})})})});var nh=t(32088),nx=t(96124);let nm="#63B3ED";function np(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:eN(o),displayRatio:eL(o/e.valids)||"N/A"}})}function nf(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nh.u,{label:(0,i.jsxs)(l.xu,{children:[(0,i.jsxs)(ei.x,{children:[(0,i.jsx)(eH,{color:eq}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(ei.x,{children:[(0,i.jsx)(eH,{color:eF}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function ng(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=np(n.current,t),s=np(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)(ei.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eH,{color:eF})," Base"]}),(0,i.jsxs)(ei.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eH,{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)(j.Fragment,{children:[(0,i.jsx)(nf,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(ei.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)(nv,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eq}),(0,i.jsx)(ei.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(ei.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nv,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:eF}),(0,i.jsx)(ei.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(ei.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(nx.i,{})]},t)})]})}function nv(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=nm}=e;eA.kL.register(eA.uw,eA.ZL,eA.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=nm}=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 nj=(0,eO.G)((e,n)=>{let{run:t}=e,[l,s]=(0,j.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)(eB,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",d.model,".",d.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(ng,{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"})})]})}),ny=(0,eO.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:c}=e,d=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.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 e6(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)(nt,{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)(nt,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nb=t(93960),nk=t(66011);function nw(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,j.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}=eE(n.model);(0,j.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,j.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)(ne.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Model"}),(0,i.jsx)(nb.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Primary key"}),(0,i.jsx)(nk.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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Columns"}),(0,i.jsx)(nn.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nk.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 nC=t(49801),n_=t(50104),nS=t(39171),nz=t(39226),nR=t(70949),nT=t(34510);function nE(e){let{params:n,column:t}=e,{runAction:r}=nF(),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)(nC.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n_.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nz.q,{lineHeight:"20px",children:(0,i.jsxs)(nR.k,{title:"Action",as:l.xu,fontSize:"8pt",children:[(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nT.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nD=(0,eO.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:eY.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nE,{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)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nI=t(18502),nO=t(63594);let nA={lineage_diff:{title:"Lineage Diff",icon:ew.Ks7},schema_diff:{title:"Schema Diff",icon:nO.C8A},query:{title:"Query",icon:ew.r2i,RunResultView:no},query_base:{title:"Query Base",icon:ew.r2i,RunResultView:no},query_diff:{title:"Query Diff",icon:ew.r2i,RunResultView:nr},row_count_diff:{title:"Row Count Diff",icon:nO.QUK,RunResultView:nu},profile_diff:{title:"Profile Diff",icon:ew.KA6,RunResultView:e9},value_diff:{title:"Value Diff",icon:ew.pRi,RunResultView:nD,RunForm:nw},value_diff_detail:{title:"Value Diff Detail",icon:ew.pRi,RunResultView:ny,RunForm:nw},top_k_diff:{title:"Top-K Diff",icon:nI.Pkc,RunResultView:nj,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eE(n.model),c=s.map(e=>e.name);return((0,j.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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eS.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:ew.dku,RunResultView:eU,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eE(n.model),c=s.filter(e=>!eD(e.type)&&!eI(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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eS.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))})]})})}}},nM=e=>nA[e],nL=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nN=e=>{let[n]=(0,ek.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nq(e){var n;let{children:t}=e,[l,r]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,eb.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,eb.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,eb.q)(),p=(0,G.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,ek.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:H.runs()})},[g,d,k]),C=(0,j.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await eh(e,n,1);1===t.length&&(i=t[0])}let s=nM(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 ea(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:H.runs()}),v.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,v,y,k]);nN(a);let _=async(e,n)=>{try{a();let{run_id:t}=await ea(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,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nL.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[l&&(0,i.jsx)(ey,{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 nF=()=>(0,j.useContext)(nL);function nP(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ef,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nq,{children:n})})})})})}var nW=t(81600);async function nH(){return(await U.post("/api/checks",{type:"simple"})).data}async function nV(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function nK(){return(await U.get("/api/checks")).data}async function nJ(e){return(await U.get("/api/checks/".concat(e))).data}async function nB(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function nU(e){return(await U.delete("/api/checks/".concat(e))).data}async function nQ(e){return await U.post("/api/checks/reorder",e)}var nZ=t(94734),nX=t(71738),nG=t(38414),nY=t(29598),n$=t(62216),n0=t(42675),n1=t(20074),n2=t(54097),n5=t(95862),n4=t(82960),n3=t(69879),n9=t(618),n8=t(77153);function n6(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.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)(n3.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n8.X,{color:"gray.500"}),children:[(0,i.jsx)(n9.g,{children:(0,i.jsx)(l.xu,{children:"Checklist"})}),(0,i.jsx)(n9.g,{flex:"0 1",cursor:"pointer",children:r?(0,i.jsx)(nb.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 n7=t(94019);t(81974);var te=t(78439);function tn(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:c}=nF(),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)(nC.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n_.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(te.h,{children:(0,i.jsx)(nz.q,{lineHeight:"20px",children:(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eD(d)&&!eI(d)),children:"Histogram Diff"}),(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tt(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)(tn,{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 ti=t(89725),tl=t(13965);let tr=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:a=!1}=e,{columns:c,rows:d}=(0,j.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(e$(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==r?void 0:r.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tt(e,(null==s?void 0:s.name)||(null==r?void 0:r.name)):tt(e)},[r,s]),{lineageGraph:u}=eg(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=r&&void 0===r.columns,p=s&&void 0===s.columns;return m&&p?l="Schema information is missing on both current and base environments.":m?l="Schema information is missing on base environment.":p&&(l="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(ti.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tl.z,{}),t]}):l?(0,i.jsxs)(ti.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tl.z,{}),l]}):(0,i.jsx)(i.Fragment,{}),d.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eX,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:d,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function ts(e){return(await U.post("/api/select",e)).data}var to=t(12282);t(15080);let ta=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(to.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},tc=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(to.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var td=t(79898),tu=t(68630),th=t(91363);let tx=eY.Nbv,tm=eY.sFB,tp=eY.UGs;function tf(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:tx}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tm}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tp}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tg(e){if("model"===e)return{color:"#c0eafd",icon:tu.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:th._MV};if("source"===e)return{color:"#a6dda6",icon:tu.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:th.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:th.R1C};if("seed"===e)return{color:"#a6dda6",icon:tu.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tu.Dmm};else return{color:"inherit",icon:void 0}}function tv(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}=tg(r.resourceType),{base:h,current:x}=r.data;if(d){var m;n=null===(m=nM("schema_diff"))||void 0===m?void 0:m.icon,t=tf("modified").color}else!h&&x?(n=tf("added").icon,t=tf("added").color):h&&!x&&(n=tf("removed").icon,t=tf("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})]})},ty=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=eg(),r=t.params,s=[...H.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,y.a)({queryKey:s,queryFn:async()=>ts({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude,packages:null==r?void 0:r.packages,view_mode:null==r?void 0:r.view_mode}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==r?void 0:r.node_id)for(let n of r.node_id instanceof Array?r.node_id:[r.node_id]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}else for(let n of(null==d?void 0:d.nodes)||[]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}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;tv(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?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function c(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=c(e),i=c(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==d?void 0:d.nodes,l]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tj,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tb=t(51643);function tk(e){let{value:n,onChange:t}=e,[l,s]=(0,j.useState)(!1),[a,c]=(0,j.useState)(),d=(0,j.useRef)(null);return((0,j.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)(tb.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)(er.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(ei.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tw=t(40902);function tC(){let e=(0,G.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})}}}function t_(){let e=(0,nW._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return t_=function(){return e},e}function tS(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tz(e){return e.description?e.description:"_(no description)_"}var tR=t(23256),tT=t(31265);let tE=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)(ei.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(er.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:th.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tT.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}})]})},tD=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)(tR.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tE,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:d,...u})}),(0,i.jsx)(tR.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tE,{label:"Current",value:n,onChange:l,onRun:s,options:d,...u})})]})})};var tI=t(23567),tO=t(20085);let tA=(0,eO.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)(ti.b,{status:"error",children:[(0,i.jsx)(tl.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)(ne.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)(tI.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tI.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)(er.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)(tO.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tM=t(65674),tL=t(29012),tN=t(25783),tq=t(28023),tF=t(49110),tP=t(55415),tW=t(24432);t(90548),t(91074);var tH=t(48289),tV=t(66633),tK=t(83143),tJ=t(29937);function tB(e){let{node:n}=e,{icon:t}=tg(n.resourceType);return(0,i.jsx)(nh.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nZ.Vp,{children:[(0,i.jsx)(nZ.AD,{as:t}),(0,i.jsx)(nZ.Sn,{children:n.resourceType})]})})}function tU(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)(ei.x,{children:r}),(0,i.jsx)(s.J,{as:tK.Rgz}),(0,i.jsx)(ei.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(ei.x,{children:o}),(0,i.jsx)(s.J,{as:tJ.lxc,color:"gray.500"}),(0,i.jsx)(ei.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nh.u,{label:r,children:(0,i.jsxs)(nZ.Vp,{children:[(0,i.jsx)(nZ.AD,{as:x}),(0,i.jsx)(nZ.Sn,{children:m||c?(0,i.jsx)(tV.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tU,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nZ.bq,{as:nS.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n0.n,{}),size:"xs",onClick:a})]})})}let tZ=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tI.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsx)(nZ.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.xu,{children:"Skipped"}),s&&(0,i.jsx)(nh.u,{label:s,children:(0,i.jsx)(tH.s,{})})]})});if(!a)return(0,i.jsx)(tI.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)(tI.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tI.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)(nh.u,{label:c,children:(0,i.jsx)(e7.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nZ.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(nZ.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)(tQ,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tX=(0,j.createContext)(void 0),tG=()=>{let e=(0,j.useContext)(tX);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},tY=e=>{var n,t,r,a;let c,d,{id:u,inverted:h}=e,{lineageGraph:x,runsAggregated:m}=eg(),p=null==m?void 0:m[u],f=null==x?void 0:x.nodes[u];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(c=tv(null===(r=f.data.base)||void 0===r?void 0:r.columns,null===(a=f.data.current)||void 0===a?void 0:a.columns)),p&&p.row_count_diff){let e=p.row_count_diff;d=e.result.curr!==e.result.base}let g=h?"white":tf("modified").color,v=h?"gray":"lightgray";return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nh.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=nM("schema_diff"))||void 0===n?void 0:n.icon,color:c?g:v})})}),void 0!==d&&(0,i.jsx)(nh.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=nM("row_count_diff"))||void 0===t?void 0:t.icon,color:d?g:v})})})]})},t$=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tu.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tu.hGI})})};var t0=t(13358),t1=t(15196),t2=t(84963);function t5(e){let{base:n,current:t}=e;return(0,i.jsx)(tT.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 t4(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}let t3={audit_helper:"Require the dbt package 'dbt-labs/audit_helper'. Please install it and re-run dbt to activate this feature.",dbt_profiler:"Require the dbt package 'data-mie/dbt_profiler'. Please install it and re-run dbt to activate this feature.",add_or_remove:"Unavailable for added or removed resources."};function t9(e){var n,t,r,a,d,f,g;let{node:v,onCloseNode:y}=e,[,b]=(0,ek.TH)(),{setSqlQuery:k,setPrimaryKeys:w}=_(),C="model"===v.resourceType||"seed"===v.resourceType||"source"===v.resourceType||"snapshot"===v.resourceType,{isOpen:S,onOpen:z,onClose:R}=(0,eb.q)(),{runAction:T}=nF(),{envInfo:E,isActionAvailable:D}=eg(),{primaryKey:I}=eE(v.name),O=()=>{T("row_count_diff",{node_names:[v.name]},{showForm:!1,showLast:!1})},A=(0,j.useCallback)(async()=>{let e=v.id,n=await t4({node_id:e});b("/checks/".concat(n.check_id))},[v,b]),M=(e,n)=>e?t3.add_or_remove:D(n)?"":"value_diff"===n?t3.audit_helper:"profile_diff"===n?t3.dbt_profiler:"This action is not supported yet.",L="added"===v.changeStatus||"removed"===v.changeStatus;return(0,i.jsxs)(t1.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:v.name})}),(0,i.jsx)(h.L,{}),("model"===v.resourceType||"seed"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{as:er.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nM("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==E?void 0:E.adapterType)==="dbt"?k('select * from {{ ref("'.concat(v.name,'") }}')):(null==E?void 0:E.adapterType)==="sqlmesh"&&k("select * from ".concat(v.name)),D("query_diff_with_primary_key")&&w(void 0!==I?[I]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(tq.R,{}),(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsx)(nT.s,{onClick:z,icon:(0,i.jsx)(tu.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nM("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>O(),children:"Row Count Diff"}),(0,i.jsx)(nh.u,{label:M(L,"profile_diff"),placement:"left",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(r=nM("profile_diff"))||void 0===r?void 0:r.icon}),fontSize:"14px",isDisabled:L||!D("profile_diff"),onClick:()=>{T("profile_diff",{model:v.name},{showForm:!1,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nh.u,{label:M(L,"value_diff"),placement:"left",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nM("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:L||!D("value_diff"),onClick:()=>{T("value_diff",{model:v.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nh.u,{label:M(L,"top_k_diff"),placement:"left",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nM("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:L,onClick:()=>{T("top_k_diff",{model:v.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nh.u,{label:M(L,"histogram_diff"),placement:"left",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nM("histogram_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",isDisabled:L,onClick:()=>{T("histogram_diff",{model:v.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(tq.R,{}),(0,i.jsx)(nR.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nM("schema_diff"))||void 0===g?void 0:g.icon}),fontSize:"14px",onClick:A,children:"Schema Diff"})})]})]}),(0,i.jsx)(l.xu,{flex:"0 1 1%",children:(0,i.jsx)(t2.P,{onClick:y})})]}),(0,i.jsx)(l.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(tB,{node:v}),("model"===v.resourceType||"snapshot"===v.resourceType||"seed"===v.resourceType)&&(0,i.jsx)(tQ,{node:v,onRefresh:O})]})}),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)(nX.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nG.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tr,{base:v.data.base,current:v.data.current})})})]}),(0,i.jsxs)(Y.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(en.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.f,{children:(0,i.jsx)(t5,{base:v.data.base,current:v.data.current})})]})]})]})}function t8(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=tG();return(0,i.jsx)(l.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tN.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.xu,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(er.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(er.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var t6=t(27547),t7=t(35052),ie=t(57489),it=t(39588);function ii(e){ie.j("[Web] multi_nodes_action",e)}function il(e){ie.j("[Web] history_action",e)}let ir=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nF();return(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eY.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(il({name:"hide"}),t()):(il({name:"show"}),n())},children:e?"Hide":"Show"})},is=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l,selectMode:r}=tG(),o=t.view_mode||"changed_models",a=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tg("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nz.q,{title:"packages",children:[(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},io=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=eg(),{viewOptions:o,onViewOptionsChanged:a}=tG(),c=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==r?void 0:null===(t=r.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.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),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nC.v,{closeOnSelect:!1,children:[(0,i.jsx)(n_.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tK.zFh}),size:"xs",variant:"outline",isDisabled:l,children:m}),(0,i.jsx)(nz.q,{title:"packages",children:(0,i.jsxs)(nR.k,{title:"Select Packages",children:[(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(tq.R,{}),Array.from(c).map(e=>(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},ia=e=>{let[n,t]=(0,j.useState)(e.value),l=(0,j.useRef)(null);return(0,j.useEffect)(()=>{l.current&&(l.current.value=e.value)},[e.value]),(0,i.jsx)(nb.I,{ref:l,height:"24px",fontSize:"10pt",placeholder:"with selectors",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)})},ic=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=tG();return(0,i.jsx)(ia,{isDisabled:n,value:t.select||"",onChange:e=>{l({...t,select:e||void 0})}})},id=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=tG();return(0,i.jsx)(ia,{isDisabled:n,value:t.exclude||"",onChange:e=>{l({...t,exclude:e||void 0})}})},iu=e=>(0,i.jsxs)(l.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.xu,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),ih=()=>{var e,n,t,l;let{nodes:r,deselect:o,selectMode:a,...c}=tG(),{isActionAvailable:d}=eg(),x=(0,j.useMemo)(()=>r.filter(e=>e.data.isSelected),[r]),m="single"===a&&1===x.length,p="multi"===a&&x.length>=1,f="single"===a&&0===x.length,g="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(iu,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(ir,{})}),(0,i.jsx)(iu,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(is,{isDisabled:g})}),(0,i.jsx)(iu,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(io,{isDisabled:g})}),(0,i.jsx)(iu,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(ic,{isDisabled:g})}),(0,i.jsx)(iu,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(id,{isDisabled:g})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iu,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(ei.x,{fontSize:"9pt",color:"gray.500",children:x.length>1?"".concat(x.length," nodes selected"):"".concat(x.length," node selected")})}),(0,i.jsx)(iu,{label:"",children:(0,i.jsx)(er.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),(0,i.jsx)(iu,{label:"Explore",children:(0,i.jsx)(t6.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nC.v,{placement:"bottom-end",children:[(0,i.jsx)(n_.j,{as:er.z,size:"xs",rightIcon:(0,i.jsx)(t7.v,{}),children:"Actions"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(f||m||p),icon:(0,i.jsx)(s.J,{as:null===(e=nM("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{c.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nh.u,{label:d("value_diff")?null:t3.audit_helper,placement:"left",children:(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(f||m||p)||!d("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(n=nM("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{c.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(tq.R,{}),(0,i.jsxs)(nR.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(f||p&&x.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nM("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{c.addLineageDiffCheck(c.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(f||m||p),icon:(0,i.jsx)(s.J,{as:null===(l=nM("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{c.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};var ix=t(81737),im=t.n(ix),ip=t(77249),ig=t(50228),iv=t(67605),ij=t.n(iv);let iy="ignore-screenshot";function ib(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,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,eb.q)(),[l,r]=(0,j.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,j.useState)();return(0,j.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)(Y.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Screenshot Preview"}),(0,i.jsx)(ej.o,{}),(0,i.jsxs)(et.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)(tH.s,{color:"red.600"}),(0,i.jsx)(ei.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(ei.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(el.m,{children:[(0,i.jsx)(er.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,ig.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");ij()(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 im()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,ip.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?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function ik(e){let{successToast:n,failToast:t}=tC(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=ib({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,j.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,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),d=(0,j.useCallback)(async()=>{o.current?(await r(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,r,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(er.z,{size:"sm",leftIcon:(0,i.jsx)(n1.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}}async function iw(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function iC(){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}=tf(n);return(0,i.jsx)(nh.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 i_=t(11978);let iS={mode:"per_node",status:"pending",completed:0,total:0},iz=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...iS}).current,{showRunId:s}=nF(),o=async(n,o,a)=>{let c="multi_nodes";r.mode=c,t(),r.status="running";let d=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:c,status:"skipped",skipReason:e},i(n)):(n.action={mode:c,status:"pending"},d.push(n))}let u=a(d);try{let{run_id:e}=await ea(n,u,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await ec(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of d)e.action={mode:c,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{let o="per_node";for(let n of(r.mode=o,t(),r.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:l}=await ea(n,e,{nowait:!0});for(r.currentRun={run_id:l},t.action={mode:o,status:"running"},i(t);;){let e=await ec(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},c=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await ed(r.currentRun.run_id)};return{actionState:r,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("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."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await iw({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await t4({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await t4({node_id:t})}return n},cancel:c,reset:()=>{Object.assign(r,iS)}}};var iR=t(65475),iT=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,eb.q)(),[r,s]=(0,j.useState)(0),[a,c]=(0,j.useState)(),d=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{c(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(iR.a,{size:"xl",isOpen:e,leastDestructiveRef:d,onClose:h,children:(0,i.jsx)($.Z,{children:(0,i.jsxs)(iR._,{children:[(0,i.jsxs)(en.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",r," nodes"]}),(0,i.jsx)(et.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(l.xu,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(el.m,{children:[(0,i.jsx)(er.z,{ref:d,onClick:h,children:"Cancel"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}};let iE={customNode:function(e){var n,t;let{data:r}=e,{isHighlighted:a,isSelected:c,resourceType:d,changeStatus:x}=r,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tg(d),[f,g]=(0,j.useState)(!1),{interactive:v,selectNodeMulti:y,selectMode:b}=tG(),{icon:k,color:w,backgroundColor:C}=x?tf(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},_="solid";r.isSelected;let S=null==r?void 0:r.name;return(0,i.jsx)(nh.u,{label:"model"===d?S:"".concat(S," (").concat(d,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:w,borderWidth:1,borderStyle:_,backgroundColor:m?"multi"===b?c?w:"white":"action_result"!==b?c?C:"white":r.action?c?C:w:"white":c?w:C,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===b?(null==r?void 0:r.action)?"none":"opacity(0.2) grayscale(50%)":a||c?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:w,padding:v?"8px":"2px",borderRightWidth:1,borderColor:"multi"===b?"#00000020":w,borderStyle:_,alignItems:"top",visibility:m?"inherit":"hidden",children:v&&(0,i.jsx)(t$,{checked:"multi"===b&&c||"action_result"===b&&!!r.action,onClick:e=>{"action_result"!==b&&(e.stopPropagation(),y(r.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(l.xu,{flex:"1",color:"multi"===b?c?"white":"inherit":"action_result"===b&&r.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:S}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===b?c?"white":"inherit":"action_result"===b&&r.action&&!c?"white":"inherit",as:p}),k&&(0,i.jsx)(s.J,{color:"multi"===b?c?"white":w:"action_result"===b?r.action&&!c?"white":"inherit":w,as:k})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==b&&"model"===r.resourceType&&(0,i.jsx)(tY,{id:r.id,inverted:"multi"===b&&!!c}),(0,i.jsx)(h.L,{}),r.isActionMode&&(r.action?(0,i.jsx)(tZ,{node:r,action:r.action}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==r?void 0:r.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==r?void 0:r.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},iD={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=tf(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}})})}},iI=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tf(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iO=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.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])},iA=()=>{let[,e]=(0,ek.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},iM=(0,j.forwardRef)(function(e,n){var t;let{interactive:r=!1,...a}=e,c=(0,R._K)(),d=(0,j.useRef)(null),{successToast:h,failToast:x}=tC(),{copyToClipboard:m,ImageDownloadModal:p,ref:f}=ib({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iy))},onSuccess:()=>{h("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),x("Failed to copy image to clipboard",e)}}),[g,v,y]=(0,R.Rr)([]),[b,k,w]=(0,R.ll)([]),[C,_]=(0,j.useState)({view_mode:"changed_models",...a.viewOptions}),{lineageGraph:S,retchLineageGraph:z,isLoading:T,error:D,refetchRunsAggregated:I}=eg(),{showRunId:H,closeRunResult:V,runAction:K}=nF();(0,j.useImperativeHandle)(n,()=>({copyToClipboard:m}));let J=C.view_mode||a.viewMode||"changed_models",[B,U]=(0,j.useState)("single"),Q=(0,j.useMemo)(()=>{var e;if("single"===B)return null===(e=g.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[B,g]),Z=(0,j.useMemo)(()=>g.filter(e=>e.data.isSelected).map(e=>e.data),[g]),X=(0,j.useMemo)(()=>g.map(e=>e.data),[g]),[Y,$]=(0,j.useState)(!1),[ee,en]=(0,j.useState)({x:0,y:0}),et=(0,G.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!S)return;if(C.node_ids)e=C.node_ids;else{var n;let t=null===(n=S.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:C.view_mode,packages:t?[t]:void 0,...a.viewOptions};_(i),e=(await ts({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=M(S,e);L(t,i),v(t),k(i)})()},[S]);let el=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=c.getZoom();c.setCenter(n,t,{zoom:i,duration:200})}},es=iA();iO(d,async()=>{if("single"===B||"action_result"===B){let e=g.find(e=>e.data.isSelected);e?el(e):c.fitView({nodes:g,duration:200})}});let eo=(0,j.useCallback)(e=>{v(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[v]),ea=async e=>{let n;if(!S)return;try{n=(await ts({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof i_.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,r]=M(S,n);L(l,r),v(l),k(r),_(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{c.fitView({nodes:l,duration:200})})()},ec=iz("multi"===B?Z:X,{onActionStarted:()=>{U("action_result")},onActionNodeUpdated:eo,onActionCompleted:()=>{}}),ed=iT();if(T)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tL.$,{size:"xl"})});let eu=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ee.selectedNode;"action_result"!==B&&void 0!==n&&void 0!==S&&("single"===B&&(v(W(g,!0)),U("multi"),ec.reset()),v(P([...O(S,[n.id],e)],g,"single"===B)))},eh=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ee.selectedNode;"action_result"!==B&&void 0!==n&&void 0!==S&&("single"===B&&(v(W(g,!0)),U("multi"),ec.reset()),v(P([...A(S,[n.id],e)],g,"single"===B)))},ex=()=>{$(!1),en({x:0,y:0})};if(D)return(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(ne.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: ",D,"]"]}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{z&&z()},children:"Retry"})]})});if("changed_models"===J&&!(null==S?void 0:null===(t=S.modifiedSet)||void 0===t?void 0:t.length))return(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(ne.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{ea({...C,view_mode:"all"})},children:"Show all nodes"})]})});let em=()=>{U("single"),v(W(g)),V(),null==I||I()},ep={interactive:r,selectMode:B,nodes:g,viewOptions:C,onViewOptionsChanged:ea,selectNodeMulti:e=>{if("multi"!==B){if(!S)return;let[n,t]=N(Array.from(A(S,S.modifiedSet)),g,b);v(n=q(e,n=W(n,!0))),k(t),U("multi"),ec.reset()}else{let n=F(e,g);n.find(e=>e.data.isSelected)||(U("single"),n=W(n)),v(n)}},deselect:em,runRowCountDiff:async()=>{"multi"===B?(await ec.runRowCountDiff(),ii({type:"row_count_diff",selected:"multi"})):Q?(await K("row_count_diff",{node_names:[Q.name]},{showForm:!1,showLast:!1}),ii({type:"row_count_diff",selected:"single"})):(await K("row_count_diff",{select:C.select,exclude:C.exclude,packages:C.packages,view_mode:C.view_mode}),ii({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(Q)await K("value_diff",{model:Q.name},{showForm:!0,showLast:!1}),ii({type:"value_diff",selected:"single"});else{let e="multi"===B?Z.length:X.length;await ed.confirm(e)&&(await ec.runValueDiff(),ii({type:"value_diff",selected:"multi"===B?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===B?(e=await ec.addLineageDiffCheck(),em(),ii({type:"lineage_diff",selected:"multi"})):Q||(e=await iw(C),ii({type:"lineage_diff",selected:"none"})),e&&es(e)},addSchemaDiffCheck:async()=>{let e;"multi"===B?Z.length>0&&(e=await ec.addSchemaDiffCheck(),em(),ii({type:"schema_diff",selected:"multi"})):Q?(e=await t4({node_id:Q.id}),ii({type:"schema_diff",selected:"single"})):(e=await t4({select:C.select,exclude:C.exclude,packages:C.packages,view_mode:C.view_mode}),ii({type:"schema_diff",selected:"none"})),e&&es(e)},cancel:ec.cancel,actionState:ec.actionState};return(0,i.jsxs)(tX.Provider,{value:ep,children:[(0,i.jsxs)(ta,{sizes:Q?[70,30]:[100,0],minSize:Q?400:0,gutterSize:Q?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(ne.g,{ref:d,divider:(0,i.jsx)(tN.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[r&&(0,i.jsx)(ih,{}),(0,i.jsxs)(R.x$,{nodeTypes:iE,edgeTypes:iD,nodes:g,edges:b,onNodesChange:y,onEdgesChange:w,onNodeClick:(e,n)=>{if(!1!==r&&S){if(ex(),"single"===B){Q||el(n);let[e,t]=N(Array.from(E(O(S,[n.id]),A(S,[n.id]))),g,b);v(q(n.id,e)),k(t)}else if("action_result"===B){var t,i,l,s;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&H(null===(s=n.data.action)||void 0===s?void 0:null===(l=s.run)||void 0===l?void 0:l.run_id),el(n),v(q(n.id,g))}else{let e=F(n.id,g);e.find(e=>e.data.isSelected)||(U("single"),e=W(e)),v(e)}}},onNodeMouseEnter:(e,n)=>{if(!S||Q||"single"!==B)return;let[t,i]=N(Array.from(E(O(S,[n.id]),A(S,[n.id]))),g,b);v(t),k(i)},onNodeMouseLeave:(e,n)=>{if(!S||Q)return;let[t,i]=N(Array.from(A(S,S.modifiedSet)),g,b);v(t),k(i)},onNodeContextMenu:(e,n)=>{if(!r||"action_result"===B)return;e.preventDefault();let t=f.current.getBoundingClientRect(),i=f.current.offsetTop;en({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),$(!0)},onClick:ex,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:r,ref:f,children:[(0,i.jsx)(tF.A,{color:"#ccc"}),(0,i.jsx)(tP.Z,{showInteractive:!1,position:"top-right",className:iy,children:(0,i.jsx)(tP.B,{title:"copy image",onClick:async()=>{m()},children:(0,i.jsx)(s.J,{as:tK.C3L})})}),(0,i.jsx)(p,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(iC,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(ei.x,{fontSize:"xl",color:"grey",opacity:.5,children:g.length>0?"":"No nodes"})}),(0,i.jsx)(tW.a,{nodeColor:iI,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===B&&(0,i.jsx)(R.s_,{position:"bottom-center",className:iy,children:(0,i.jsx)(t8,{onClose:()=>{em()}})})]}),Y&&(0,i.jsx)(nC.v,{isOpen:!0,onClose:ex,children:(0,i.jsxs)(nz.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.Cv2,{}),onClick:()=>{eu(1)},children:"Select parent nodes"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.IMj,{}),onClick:()=>{eh(1)},children:"Select child nodes"}),(0,i.jsx)(tq.R,{}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.Cv2,{}),onClick:()=>{eu()},children:"Select all upstream nodes"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.IMj,{}),onClick:()=>{eh()},children:"Select all downstream nodes"})]})})]}),"single"===B&&Q?(0,i.jsx)(l.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(t9,{node:Q,onCloseNode:()=>{if(!S)return;let[e,n]=N(Array.from(A(S,S.modifiedSet)),g,b);v(W(e)),k(n)}})}):(0,i.jsx)(l.xu,{})]}),ed.AlertDialog]})}),iL=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(iM,{viewOptions:l,interactive:!1,ref:n})})})});var iN=t(19339);function iq(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=iN.ZP.stringify({checks:[o]});return(0,i.jsx)(tT.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 iF=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=ev(),{error:o,data:a}=(0,y.a)({queryKey:H.run(e||""),queryFn:async()=>ec(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.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,j.useCallback)(async()=>{if(r(!0),e)return await ed(e)},[e,r]),d=(null==a?void 0:a.type)?null===(n=nM(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 iP(){let e=(0,G.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function iW(){let e=(0,nW._)(["\n
","\n\n ","\n\n
"]);return iW=function(){return e},e}let iH=e=>{var n,t,r,a,d,f,g;let{checkId:v}=e,k=(0,b.NL)(),[,w]=(0,ek.TH)(),{successToast:C,failToast:_}=tC(),{markedAsApprovedToast:S}=iP(),[z,R]=(0,j.useState)(),[T,E]=(0,j.useState)(),[D,I]=(0,j.useState)(!1),{isOpen:O,onOpen:A,onClose:M}=(0,eb.q)(),L=()=>(0,i.jsx)($.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[N,q]=(0,j.useState)((0,i.jsx)(L,{})),{isLoading:F,error:P,data:W}=(0,y.a)({queryKey:H.check(v),queryFn:async()=>nJ(v),refetchOnMount:!0}),V=z||(null==W?void 0:null===(n=W.last_run)||void 0===n?void 0:n.run_id),{run:K,error:J}=iF(V),B=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==W?void 0:W.type)?nM(null==W?void 0:W.type):void 0,Q=(null==W?void 0:W.is_preset)||!1,Z=(0,j.useRef)(null),{mutate:X}=(0,n7.D)({mutationFn:e=>nB(v,e),onSuccess:()=>{k.invalidateQueries({queryKey:H.check(v)}),k.invalidateQueries({queryKey:H.checks()})}}),{mutate:G}=(0,n7.D)({mutationFn:()=>nU(v),onSuccess:()=>{k.invalidateQueries({queryKey:H.checks()}),w("/checks")}}),ei=(0,j.useCallback)(async()=>{(null==W?void 0:W.type)&&R((await eu(v,{nowait:!0})).run_id)},[W,v,R]),el=(0,j.useCallback)(async()=>{if(I(!0),V)return await ed(V)},[V]),es=async()=>{if(!W)return;let e=(0,tw.RI)(iW(),tS(W),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tz(e),"\n\n").concat((0,tw.Pn)(t_(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tz(e)}(W));if(!navigator.clipboard){_("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),C("Copied the check to the clipboard")}catch(e){_("Failed to copy the check to clipboard",e)}},eo=(0,j.useCallback)(()=>{let e=null==W?void 0:W.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==W?void 0:W.is_checked,X,S]),[ea,ec]=(0,j.useState)(0),{ref:eh,onCopyToClipboard:ex,onMouseEnter:em,onMouseLeave:ep}=ik();if(F)return(0,i.jsx)(eQ.M,{h:"100%",children:"Loading"});if(P)return(0,i.jsxs)(eQ.M,{h:"100%",children:["Error: ",P.message]});let ef=(null==K?void 0:K.run_at)?(0,tM.Q)(new Date(K.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tc,{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)(n6,{name:(null==W?void 0:W.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Q&&(0,i.jsx)(nh.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nZ.Vp,{size:"sm",children:[(0,i.jsx)(nZ.AD,{boxSize:"14px",as:n5.bX4}),"Preset"]})}),(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{isRound:!0,as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"ghost"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(n4.ovA,{}),onClick:()=>{q((0,i.jsx)(L,{})),A()},children:"Get Preset Check Template"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(n$.p,{}),onClick:()=>G(),children:"Delete"})]})]}),ef&&(0,i.jsx)(l.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ef}),(null==U?void 0:U.RunResultView)&&(0,i.jsx)(nh.u,{label:"Rerun",children:(0,i.jsx)(nS.h,{isRound:!0,isLoading:B,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n0.n,{}),onClick:()=>ei()})}),(0,i.jsx)(nh.u,{label:"Copy markdown",children:(0,i.jsx)(nS.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(n1.T,{}),onClick:()=>es()})}),(0,i.jsx)(nh.u,{label:(null==W?void 0:W.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(er.z,{size:"sm",colorScheme:(null==W?void 0:W.is_checked)?"green":"gray",variant:(null==W?void 0:W.is_checked)?"solid":"outline",leftIcon:(0,i.jsx)(n2.r,{color:(null==W?void 0:W.is_checked)?"inherit":"green"}),onClick:()=>eo(),children:(null==W?void 0:W.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(l.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tk,{value:null==W?void 0:W.description,onChange:e=>{X({description:e})}},null==W?void 0:W.check_id)})]}),(0,i.jsx)(l.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:ea,onChange:ec,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==W?void 0:W.type)==="query"||(null==W?void 0:W.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)(er.z,{leftIcon:(0,i.jsx)(n1.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==W?void 0:W.type)&&void 0!==f?f:"")&&"lineage_diff"!==g&&(!(null==K?void 0:K.result)||!!(null==K?void 0:K.error))||0!==ea,onMouseEnter:em,onMouseLeave:ep,size:"sm",onClick:()=>{if((null==W?void 0:W.type)==="lineage_diff"){var e;null===(e=Z.current)||void 0===e||e.copyToClipboard()}else ex()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(nX.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nG.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==W?void 0:W.last_run)||V?(0,i.jsx)(tA,{ref:eh,isRunning:B,isAborting:D,run:V?K:null==W?void 0:W.last_run,error:J,progress:T,RunResultView:U.RunResultView,viewOptions:null==W?void 0:W.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:el,onExecuteRun:ei}):(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(er.z,{onClick:ei,colorScheme:"blue",size:"sm",children:"Run Query"})})),W&&"schema_diff"===W.type&&(0,i.jsx)(ty,{check:W,ref:eh}),W&&"lineage_diff"===W.type&&(0,i.jsx)(iL,{check:W,ref:Z})]}),((null==W?void 0:W.type)==="query"||(null==W?void 0:W.type)==="query_diff"||(null==W?void 0:W.type)==="query_base")&&(0,i.jsx)(nG.x,{p:0,height:"100%",width:"100%",children:(null===(t=W.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tD,{value:(null==W?void 0:null===(r=W.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==W?void 0:null===(a=W.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tE,{value:(null==W?void 0:null===(d=W.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(Y.u_,{isOpen:O,onClose:M,isCentered:!0,size:"6xl",children:[N,(0,i.jsxs)(ee.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(en.x,{children:"Preset Check Template"}),(0,i.jsx)(ej.o,{}),(0,i.jsxs)(et.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(nY.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)(iq,{name:(null==W?void 0:W.name)||"",description:(null==W?void 0:W.description)||"",type:(null==W?void 0:W.type)||"",params:null==W?void 0:W.params,viewOptions:null==W?void 0:W.view_options})]})]})]})]})};var iV=t(53924);let iK=e=>{var n;let{check:t,selected:r,onSelect:a,onMarkAsApproved:c}=e,d=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,n7.D)({mutationFn:e=>nB(u,e),onSuccess:()=>{d.invalidateQueries({queryKey:H.check(u)}),d.invalidateQueries({queryKey:H.checks()})}}),x=(null===(n=nM(t.type))||void 0===n?void 0:n.icon)||ew.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:r?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:r?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(l.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nh.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(nn.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):c()}})})})]})})},iJ=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[a,c]=(0,j.useState)(!1),d=(0,b.NL)(),{mutate:u}=(0,n7.D)({mutationFn:e=>nB(e,{is_checked:!0}),onSuccess:(e,n)=>{d.invalidateQueries({queryKey:H.check(n)}),d.invalidateQueries({queryKey:H.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,eb.q)(),{markedAsApprovedToast:p}=iP(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iV.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(iV.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(ne.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iV._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,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)(iK,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(Y.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{width:"400px",children:[(0,i.jsx)(en.x,{children:"Mark as Approved?"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(nx.i,{}),(0,i.jsxs)(l.xu,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(nn.X,{isChecked:a,onChange:e=>c(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nx.i,{}),(0,i.jsxs)(el.m,{children:[(0,i.jsx)(er.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(er.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};function iB(){let e=(0,nW._)(["\n
","\n\n ","\n\n
"]);return iB=function(){return e},e}let iU=()=>{let[,e]=(0,ek.TH)(),[,n]=(0,ek.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=tC(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:H.checks(),queryFn:nK,refetchOnMount:!0}),h=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,j.useState)(d||[]),{mutate:p}=(0,n7.D)({mutationFn:e=>nQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:H.checks()})}}),f=(0,j.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,j.useCallback)(async()=>{let e=await nH();t.invalidateQueries({queryKey:H.checks()}),h(e.check_id)},[t,h]),(0,j.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)(ta,{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)(ne.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nh.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nS.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tw.RI)(iB(),tS(e),tz(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)(n1.T,{})})}),(0,i.jsx)(nx.i,{}),(0,i.jsx)(iJ,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(l.xu,{height:"100%",children:(0,i.jsx)(ek.rs,{children:(0,i.jsx)(ek.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iH,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsx)(l.xu,{children:"No checks"})})};var iQ=t(25356);async function iZ(e,n){return await ea("query",e,n)}async function iX(e,n){return await ea("query_base",e,n)}async function iG(e,n){return await ea("query_diff",e,n)}var iY=t(67619),i$=t(58565),i0=t(49468);let i1=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r,isDisabled:s}=e,[o,a]=(0,j.useState)(t||[]),[c,d]=(0,j.useState)(""),[u,h]=(0,j.useState)(!1),x=(0,j.useRef)(null),m=e=>{o.includes(e)||(d(""),a([...o,e]),r([...o,e]))};return s?(0,i.jsx)(nh.u,{label:t3.audit_helper,children:(0,i.jsx)(nb.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})}):(0,i.jsxs)(iY.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nC.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(n_.j,{width:"100%",children:(0,i.jsx)(nb.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:o.length>1?"".concat(o.length," ").concat(e.unitName,"s selected"):1===o.length?"".concat(o[0]):""})}),(0,i.jsx)(te.h,{children:(0,i.jsxs)(nz.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nR.k,{children:(0,i.jsxs)(i$.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[o.map((n,t)=>(0,i.jsx)(i$.U,{children:(0,i.jsxs)(nZ.Vp,{size:e.size,children:[(0,i.jsx)(nZ.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(nZ.SD,{paddingRight:"8px",onClick:()=>{a(o.filter(e=>e!==n)),r(o.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(i$.U,{width:"100%",children:(0,i.jsx)(nb.I,{ref:x,placeholder:"Filter keys or add custom",variant:"unstyled",size:e.size,value:c,onChange:e=>{d(e.target.value),h(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":m(n),d("");break;case"Backspace":""===e.currentTarget.value&&o.length>0&&(a(o.slice(0,-1)),r(o.slice(0,-1)))}},onBlur:()=>{var e;x&&u&&(null==x||null===(e=x.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(tq.R,{}),(0,i.jsxs)(nR.k,{children:[""!==c&&!(null==l?void 0:l.includes(c))&&(0,i.jsxs)(nT.s,{onClick:()=>{m(c),h(!1)},children:["Add '",c,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===c||e.includes(c)).filter(e=>!o.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nT.s,{onClick:()=>m(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(i0.x,{children:(0,i.jsx)(er.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===o.length,onClick:()=>{d(""),a([]),r([])},children:"Clear"})})]})},i2=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=eg(),a=(0,j.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)(eC.NI,{m:"4px 8px",children:[(0,i.jsxs)(e_.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nh.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,i.jsx)(tH.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(i1,{unitName:"key",defaultValues:n,suggestionList:a,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name...",isDisabled:!s("query_diff_with_primary_key")})]})})},i5=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nF();return(0,i.jsxs)(l.xu,{children:[(0,i.jsx)(l.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eY.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(il({name:"hide"}),t()):(il({name:"show"}),n())},children:e?"Hide":"Show"})]})},i4=()=>{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)(nh.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tH.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iQ.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},i3=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=eg(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nF(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iZ;case"query_base":return iX;case"query_diff":return iG;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 ec(r)},{mutate:p,isPending:f}=(0,n7.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)(i5,{}),(0,i.jsx)(i4,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(i2,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(er.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)(tD,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tE,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var i9=t(30148);let i8=e=>(0,i9.c4)("#!"+e),i6=()=>[(0,i9.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),i8];var i7=t(24681),le=t(62843);let ln=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:H.run(t),queryFn:async()=>ec(t)}),o=(null==s?void 0:s.type)?null===(n=nM(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tA,{isPending:l,error:r,run:s,RunResultView:o})},lt=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)(er.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},li=e=>{let{children:n}=e;return(0,i.jsx)(tO.SV,{fallback:lt,children:n})};async function ll(){return(await U.post("/api/export")).data}async function lr(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await U.post("/api/import",t)).data}async function ls(){return 208===(await U.get("/api/sync")).status}async function lo(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,i_.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var la=t(16021);function lc(){let e=(0,G.p)(),n=async()=>{try{let e=await ll(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,ig.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");ij()(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)(nh.u,{label:"Export",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:la.tRY,boxSize:"1.2em"})})})}function ld(e){let{checksOnly:n}=e,t=(0,G.p)(),l=(0,b.NL)(),r=(0,j.useRef)(null),a=(0,j.useRef)(null),[c,d]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,eb.q)(),[m,p]=(0,ek.TH)(),[,f]=ev(),g=(0,j.useCallback)(async()=>{if(c){try{let{runs:e,checks:i}=await lr(c,n);f(),await l.invalidateQueries({queryKey:H.checks()}),await l.invalidateQueries({queryKey:H.runs()}),m.includes("/checks")&&p("/checks");let r=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:r,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[l,c,t,x,m,p,f,n]),v=n?"checks":"runs and checks";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nh.u,{label:"Import",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{r.current&&r.current.click()},icon:(0,i.jsx)(s.J,{as:la.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(d(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,i.jsx)(iR.a,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)($.Z,{children:(0,i.jsxs)(iR._,{children:[(0,i.jsx)(en.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(et.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)(tH.s,{color:"red.600"}),(0,i.jsx)(ei.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(ei.x,{children:["The current ",v," will be"," ",(0,i.jsx)(ei.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(el.m,{children:[(0,i.jsx)(er.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var lu=t(93126),lh=t(1026),lx=t(13154),lm=t(99434),lp=t(20143),lf=t(89830),lg=t(13276),lv=t(31610);function lj(e){let n=(0,lv.D)(e);return(0,ig.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function ly(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)(td.HC,{ml:"10px",children:[n,": ",t]},n)})}function lb(){var e,n,t,l,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=eg(),{isOpen:m,onOpen:p,onClose:f}=(0,eb.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)?lj(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?lj(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)(nh.u,{label:"Environment Info",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n4.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(Y.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Environment Information"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.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)(td.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(td.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&ly(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)(td.QI,{spacing:1,children:g&&ly(g)})]})}),(0,i.jsx)(nx.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)(lu.x,{children:(0,i.jsxs)(lh.i,{variant:"simple",children:[(0,i.jsx)(lx.h,{children:(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lp.Th,{}),(0,i.jsx)(lp.Th,{children:"base"}),(0,i.jsx)(lp.Th,{children:"current"})]})}),(0,i.jsxs)(lf.p,{children:[(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lg.Td,{children:"schema"}),(0,i.jsx)(lg.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(lg.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lg.Td,{children:"version"}),(0,i.jsx)(lg.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(lg.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lg.Td,{children:"timestamp"}),(0,i.jsx)(lg.Td,{children:k}),(0,i.jsx)(lg.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)(lu.x,{children:(0,i.jsxs)(lh.i,{variant:"simple",children:[(0,i.jsx)(lx.h,{children:(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lp.Th,{}),(0,i.jsx)(lp.Th,{children:"base"}),(0,i.jsx)(lp.Th,{children:"current"})]})}),(0,i.jsx)(lf.p,{children:(0,i.jsxs)(lm.Tr,{children:[(0,i.jsx)(lg.Td,{children:"Environment"}),(0,i.jsx)(lg.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(lg.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(el.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var lk=t(21166),lw=t(43399),lC=t(60057);function l_(){return(0,i.jsx)(nh.u,{label:"Syncing",children:(0,i.jsx)(er.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tL.$,{})})})}function lS(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[r,o]=(0,ek.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,eb.q)(),[u,h]=(0,j.useState)(""),x=(0,G.p)(),m=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await lo(e)).status){c(),n(!1);return}for(;await ls();)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)(l_,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nh.u,{label:"Sync with Cloud",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:la.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(Y.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(et.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)(lk.E,{onChange:h,value:u,children:(0,i.jsxs)(tR.K,{direction:"column",children:[(0,i.jsxs)(lw.Y,{value:"merge",children:["Merge",(0,i.jsx)(nh.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lC.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lw.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nh.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:lC.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lw.Y,{value:"revert",children:["Revert",(0,i.jsx)(nh.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:lC.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(el.m,{children:[(0,i.jsx)(er.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}function lz(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iM,{viewMode:"changed_models",interactive:!0})})}async function lR(){return(await U.get("/api/flag")).data}async function lT(){try{await U.post("/api/onboarding/completed")}catch(e){}}var lE=()=>{let[e,n]=(0,j.useState)(!1);(0,j.useEffect)(()=>{lR().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),lT()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(Y.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(en.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.f,{children:(0,i.jsxs)(tR.K,{spacing:4,children:[(0,i.jsxs)(td.aV,{spacing:2,children:[(0,i.jsx)(td.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(td.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(td.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nx.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(el.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},lD=t(1873);let lI=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)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,ig.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,ig.WU)(e,"HH:mm"):(0,ig.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)(tL.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(ei.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(ei.x,{children:"•"}),(0,i.jsx)(ei.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},lO=e=>{let n=iN.ZP.stringify(e,null,2);return(0,i.jsx)(tT.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}})},lA=e=>{var n,t,l;let{runId:r,onClose:s}=e,{runAction:a}=nF(),{error:c,run:d,onCancel:f,isRunning:g}=iF(r),[v,y]=(0,j.useState)(),k=(0,b.NL)(),[,w]=(0,ek.TH)(),[C,_]=(0,j.useState)(0),S=(null==d?void 0:d.type)?null===(n=nM(d.type))||void 0===n?void 0:n.RunResultView:void 0,z=(0,j.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,j.useCallback)(async()=>{R&&w("/checks/".concat(R))},[R,w]),E=(0,j.useCallback)(async()=>{if(!r)return;let e=await nV(r,v);k.invalidateQueries({queryKey:H.checks()}),w("/checks/".concat(e.check_id))},[r,w,k,v]),D=(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:O,onMouseEnter:A,onMouseLeave:M}=ik();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"}),D&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[d&&(0,i.jsx)(lI,{run:d}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n0.n,{}),variant:"outline",isDisabled:!r||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n1.T,{}),variant:"outline",isDisabled:!r||!(null==d?void 0:d.result)||!!c||0!==C,onMouseEnter:A,onMouseLeave:M,size:"sm",onClick:O,children:"Copy to Clipboard"}),(null==d?void 0:d.check_id)?(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(lD.n,{}),isDisabled:!r||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(lD.n,{}),isDisabled:!r||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t2.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tA,{ref:I,error:c,run:d,onCancel:f,viewOptions:v,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(lO,{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)(tD,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tE,{value:(null==d?void 0:null===(l=d.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},lM=e=>{let{onClose:n}=e,{runId:t}=nF();return(0,i.jsx)(lA,{runId:t,onClose:n})};var lL=t(22661);t(86777);let lN=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 ec(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nM(t.type))||void 0===n?void 0:n.icon)||ew.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)(nh.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(ei.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:tu.FJM})})}):(0,i.jsx)(nh.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(ei.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),il({name:"add_to_checklist"}),c(t.run_id)},children:(0,i.jsx)(s.J,{as:tu.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(lI,{run:u||t})})]})},lq=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,ig.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})},lF=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:H.runs(),queryFn:async()=>await ex(),retry:!1}),{showRunId:a,runId:d}=nF(),x=e=>{il({name:"click_run"}),a(e,!1)},[,m]=(0,ek.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!d)return;let e=await nV(d);p.invalidateQueries({queryKey:H.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,j.useCallback)(e=>{il({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=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)(nS.h,{variant:"unstyled",icon:(0,i.jsx)(n0.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)(lL.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(lq,{runAt:e.run_at},t),(0,i.jsx)(lN,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var lP=t(65627),lW=t(78032);let{definePartsStyle:lH,defineMultiStyleConfig:lV}=(0,lW.D)(lP.TB.keys),lK=lV({variants:{circular:lH({control:(0,lW.k0)({rounded:"full"})})},sizes:{xs:lH({icon:(0,lW.k0)({fontSize:"8px"}),control:(0,lW.k0)({boxSize:"16px",padding:"4px"}),label:(0,lW.k0)({fontSize:"xs"})})}}),lJ=(0,t(62821).fj)({baseStyle:{borderRadius:"4px"}}),lB=e=>{let{children:n,path:t}=e,[r]=(0,ek.yj)(t);return(0,i.jsx)(l.xu,{display:r?"block":"none",height:"100%",children:n})};function lU(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 lQ(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eg(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.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)||{},v=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:eY.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:eY.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(lU,{icon:tu.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(lU,{icon:tu.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(lU,{mr:"18px",icon:tu.MXt,href:"https://datarecce.io/docs"})]})}function lZ(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 lX(){let{isDemoSite:e,reviewMode:n,cloudMode:t,isLoading:l}=eg(),[r,s]=(0,ek.TH)(),o=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(lZ,{queryKey:H.checks(),fetchCallback:nK,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],a=eR().findIndex(o,e=>{let{href:n}=e;return r.startsWith(n)});return(0,i.jsx)(x.m,{index:a,children:(0,i.jsxs)(m.t,{children:[o.map(e=>{let{name:n,href:t,badge:l}=e;return(0,i.jsxs)(p.O,{onClick:()=>{s(t)},children:[n,l]},n)}),(0,i.jsx)(h.L,{}),!l&&(0,i.jsxs)(i.Fragment,{children:[t&&(0,i.jsx)(lS,{}),!e&&!t&&(0,i.jsx)(ld,{}),!e&&t&&n&&(0,i.jsx)(ld,{checksOnly:!0}),(0,i.jsx)(lc,{})]}),(0,i.jsx)(lb,{})]})})}function lG(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nF(),[r]=(0,ek.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(ta,{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)(lF,{})}),(0,i.jsxs)(tc,{sizes:s?[50,50]:[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)(li,{children:[(0,i.jsx)(lB,{path:"/lineage",children:(0,i.jsx)(lz,{})}),(0,i.jsxs)(ek.rs,{children:[(0,i.jsx)(ek.AW,{path:"/query",children:(0,i.jsx)(i3,{})}),(0,i.jsx)(ek.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iU,{})}),(0,i.jsx)(ek.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(ln,{runId:n})}}),(0,i.jsx)(ek.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(ek.AW,{children:(0,i.jsx)(ek.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(lM,{onClose:t}):(0,i.jsx)(l.xu,{})]})]})}let lY=(0,g.B1)({components:{Checkbox:lK,Tooltip:lJ}});function l$(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=it.env.AMPLITUDE_API_KEY;if(n&&t)try{ie.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,i7.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(le.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:lY,children:(0,i.jsx)(b.aH,{client:Q,children:(0,i.jsx)(ek.F0,{hook:i6,children:(0,i.jsx)(nP,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(lQ,{}),(0,i.jsx)(lX,{}),(0,i.jsx)(lE,{}),(0,i.jsx)(lG,{})]})})})})})})}},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,314,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/chunks/app/page-e9463241ce30f70d.js b/recce/data/_next/static/chunks/app/page-e9463241ce30f70d.js deleted file mode 100644 index 27b33930..00000000 --- a/recce/data/_next/static/chunks/app/page-e9463241ce30f70d.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,18517))},18517:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rY}});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(630),v=t(27470),j=t(66518),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,j.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,r]=j.useState(k),[l,s]=j.useState(k),[o,a]=j.useState(!1),[c,d]=j.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,j.useContext)(w),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,r]=j.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 D=t(28482),I=t.n(D);function O(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){let t=[],i=[];function r(e){return"base"===e?0:"current"===e?2:1}function l(e,n){let t=r(e.from),i=r(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(l))(!s||s.has(n.id))&&t.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(l))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return L(t,i),N(Array.from(M(e,e.modifiedSet)),t,i)}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=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function P(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function W(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 V=t(62330),K=t(39588);let J=K.env.NEXT_PUBLIC_API_URL?K.env.NEXT_PUBLIC_API_URL:window.location.origin;var B=t(94614);let U=V.default.create({baseURL:J}),Q=new B.S;async function Z(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var G=t(99873),Y=t(17695),$=t(62628),ee=t(6533),en=t(96985),et=t(7797),ei=t(79481),er=t(13844),el=t(64653),es=t(85929),eo=t.n(es);async function ea(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ec(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function ed(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function eu(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function eh(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function ex(){return(await U.get("/api/runs")).data}async function em(){return(await U.post("/api/runs/aggregate",{})).data}let ep=(0,j.createContext)({});function ef(e){var n,t;let{children:r}=e,{data:l,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:H.lineage(),queryFn:Z}),{data:c,refetch:d}=(0,y.a)({queryKey:H.runsAggregated(),queryFn:em}),u=(0,j.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,v=null==l?void 0:l.adapter_type,k=null==l?void 0:l.git,w={adapterType:v,git:k,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},{connectionStatus:C,connect:_}=function(){let e=(0,G.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending");n.current.status=t;let r=(0,b.NL)(),l=()=>{r.invalidateQueries({queryKey:H.lineage()}),r.invalidateQueries({queryKey:H.checks()}),r.invalidateQueries({queryKey:H.runs()})},s=()=>{let t=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&l(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[r,s]=i.split("/").slice(-2),o=eo().parse(s).name;e({description:"Detected ".concat(r," ").concat(o," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),l()}}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return s(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:s}}();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ep.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:w,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,refetchRunsAggregated:()=>{d()}},children:r}),(0,i.jsxs)(Y.u_,{isOpen:"disconnected"===C,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Server Disconnected"}),(0,i.jsx)(et.f,{children:(0,i.jsx)(ei.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>{_()},children:"Retry"})})]})]})]})}let eg=()=>(0,j.useContext)(ep),ev=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eg();return[e,n]};var ej=t(69384);let ey=e=>{let{isOpen:n,onClose:t,onExecute:l,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,j.useState)(c),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)(Y.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(en.x,{children:a}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.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)(er.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(el.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var eb=t(25612),ek=t(76330),ew=t(53152),eC=t(18222),e_=t(30678),eS=t(2838),ez=t(13156),eR=t.n(ez);function eT(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 eE=e=>{var n;let{lineageGraph:t}=eg(),[i,r]=(0,j.useState)([]),[l,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[c,d]=(0,j.useState)(null),u=eR().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eT(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,j.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(eT(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 eD(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 eI(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 eO=t(85813),eM=t(81945),eA=t(14827);function eL(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 eN(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)}}let eq="#63B3ED",eF="#F6AD55",eP="".concat(eq,"A5"),eW="".concat(eF,"A5");function eH(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;eM.kL.register(eM.ZL,eM.RM,eM.f$,eM.uw,eM.Dx,eM.De,eM.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]:{},{title:i,datasets:r,type:l,samples:s=0,binEdges:o}=e,[a,c]=r,d="datetime"===l;return{responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eJ(o,n);return"".concat(d?"Date Range":"string"===l?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,r=0===n?c.counts:a.counts,l=eL(r[t]/s),o=r[t];return"".concat(i,": ").concat(o," (").concat(l,")")}}}},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 eN(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",eW,r);return{labels:i.map((e,n)=>eJ(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eA.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=eN(t),l=eN(i);return"".concat(r," - ").concat(l)}let eB=(0,eO.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})})}),eU=(0,eO.G)(function(e,n){var t,l,s,a,c,d;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(l=x.result)||void 0===l?void 0:l.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(c=x.result)||void 0===c?void 0:c.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(eB,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(r.xu,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(eV,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(d=x.params)||void 0===d?void 0:d.column_type)||"",datasets:[f,p],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var eQ=t(24112);t(63156);var eZ=t(22204);let eX=(0,eO.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ.ZP,{ref:n,...t})})});function eG(){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)(ei.x,{fontWeight:"600",children:" No rows"})})}t(87679);var eY=t(52091);function e$(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 e0(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 e1(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 e2(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?eY.ven:eY.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?eY.$kI:eY.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let e5=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]},e4=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(ei.x,{style:{color:"gray"},children:"-"});let[r,l]=e5(n[t.key]);return(0,i.jsx)(ei.x,{style:{color:l?"gray":"inherit"},children:r})};function e3(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(e$(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=e0(r.columns,s);r.data.forEach((n,t)=>{let i=e1(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e0(l.columns,s),l.data.forEach((n,t)=>{let i=e1(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=e$(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||eR().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(!eR().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e2,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eZ.Ug,headerCellClass:r,cellClass:l,renderCell:e4,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eZ.Ug,headerCellClass:r,cellClass:l,renderCell:e4,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)(e2,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e4})}),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 e9=(0,eO.G)((e,n)=>{var t;let{run:r,viewOptions:l,onViewOptionsChanged:s}=e,o=r.result;r.params;let a=(0,j.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,j.useMemo)(()=>e3(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)(eX,{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 e6(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?eY.$kI:eY.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function e8(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=e$(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))&&(eR().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(!eR().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e6,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eZ.Ug,headerCellClass:r,cellClass:l,renderCell:e4,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eZ.Ug,headerCellClass:r,cellClass:l,renderCell:e4,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(e6,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e4})}),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 e7=t(93998),ne=t(25773),nn=t(63352);let nt=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)(ne.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(e7.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nn.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)(el.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},ni=(e,n)=>{var t,r,l,s,a,c;let{run:d,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,j.useMemo)(()=>{var e,n;return e3(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]),v=(0,j.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(v&&k.push(v),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)(nt,{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)(nt,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nr=(e,n)=>{var t,r,l,s;let{run:a,onAddToChecklist:c,viewOptions:d,onViewOptionsChanged:u}=e,h=(0,j.useMemo)(()=>(null==d?void 0:d.changed_only)||!1,[d]),x=(0,j.useMemo)(()=>(null==d?void 0:d.pinned_columns)||[],[d]),m=(0,j.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 e8(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)(nt,{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)(nt,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nl=(0,eO.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,eO.G)(nr);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eO.G)(ni);return(0,i.jsx)(t,{...e,ref:n})}});function ns(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?eY.$kI:eY.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let no=(0,eO.G)((e,n)=>{let{run:t,viewOptions:l,onViewOptionsChanged:s,onAddToChecklist:a}=e,c=(0,j.useMemo)(()=>(null==l?void 0:l.pinned_columns)||[],[l]),d=null==t?void 0:t.result,u=(0,j.useMemo)(()=>d?function(e,n){let t=[],r=n.pinnedColumns||[],l=(e,t)=>({key:String(e),name:(0,i.jsx)(ns,{name:t,...n}),width:"auto",renderCell:e4});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=eR().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)(e7.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.xu,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(el.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function na(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 nc=t(68844),nd=t.n(nc);let nu=(0,eO.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=nd()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nd()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,r="No Change";return null!==t&&null!==i?r=t!==i?na(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)(eX,{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)(eG,{})},className:"rdg-light",enableScreenshot:!0})})})});var nh=t(32088),nx=t(96124);let nm="#63B3ED";function np(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:eN(o),displayRatio:eL(o/e.valids)||"N/A"}})}function nf(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nh.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(ei.x,{children:[(0,i.jsx)(eH,{color:eq}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(ei.x,{children:[(0,i.jsx)(eH,{color:eF}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function ng(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=np(n.current,t),s=np(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)(ei.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eH,{color:eF})," Base"]}),(0,i.jsxs)(ei.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eH,{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)(j.Fragment,{children:[(0,i.jsx)(nf,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(ei.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)(nv,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eq}),(0,i.jsx)(ei.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(ei.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nv,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eF}),(0,i.jsx)(ei.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(ei.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nx.i,{})]},t)})]})}function nv(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nm}=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,r,{animation:l}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nm}=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 nj=(0,eO.G)((e,n)=>{let{run:t}=e,[r,s]=(0,j.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)(eB,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",d.model,".",d.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(ng,{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"})})]})}),ny=(0,eO.G)((e,n)=>{var t,r;let{run:l,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:c}=e,d=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.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 e8(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)(nt,{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)(nt,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nb=t(93960),nk=t(66011);function nw(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,[s,o]=(0,j.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}=eE(n.model);(0,j.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,j.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)(ne.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Model"}),(0,i.jsx)(nb.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Primary key"}),(0,i.jsx)(nk.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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Columns"}),(0,i.jsx)(nn.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nk.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 nC=t(49801),n_=t(50104),nS=t(39171),nz=t(39226),nR=t(70949),nT=t(34510);function nE(e){let{params:n,column:t}=e,{runAction:l}=nF(),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)(nC.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n_.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nz.q,{lineHeight:"20px",children:(0,i.jsxs)(nR.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nT.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nD=(0,eO.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:eY.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nE,{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)(eX,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:l.data.data,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nI=t(18502),nO=t(63594);let nM={lineage_diff:{title:"Lineage Diff",icon:ew.Ks7},schema_diff:{title:"Schema Diff",icon:nO.C8A},query:{title:"Query",icon:ew.r2i,RunResultView:no},query_base:{title:"Query Base",icon:ew.r2i,RunResultView:no},query_diff:{title:"Query Diff",icon:ew.r2i,RunResultView:nl},row_count_diff:{title:"Row Count Diff",icon:nO.QUK,RunResultView:nu},profile_diff:{title:"Profile Diff",icon:ew.KA6,RunResultView:e9},value_diff:{title:"Value Diff",icon:ew.pRi,RunResultView:nD,RunForm:nw},value_diff_detail:{title:"Value Diff Detail",icon:ew.pRi,RunResultView:ny,RunForm:nw},top_k_diff:{title:"Top-K Diff",icon:nI.Pkc,RunResultView:nj,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eE(n.model),c=s.map(e=>e.name);return((0,j.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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eS.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:ew.dku,RunResultView:eU,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eE(n.model),c=s.filter(e=>!eD(e.type)&&!eI(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)(eC.NI,{children:[(0,i.jsx)(e_.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eS.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))})]})})}}},nA=e=>nM[e],nL=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nN=e=>{let[n]=(0,ek.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nq(e){var n;let{children:t}=e,[r,l]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,eb.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,eb.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,eb.q)(),p=(0,G.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,ek.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:H.runs()})},[g,d,k]),C=(0,j.useCallback)(async(e,n,t)=>{try{let i;let r=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await eh(e,n,1);1===t.length&&(i=t[0])}let s=nA(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 ea(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:H.runs()}),v.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,v,y,k]);nN(a);let _=async(e,n)=>{try{a();let{run_id:t}=await ea(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,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nL.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[r&&(0,i.jsx)(ey,{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 nF=()=>(0,j.useContext)(nL);function nP(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ef,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nq,{children:n})})})})})}var nW=t(81600);async function nH(){return(await U.post("/api/checks",{type:"simple"})).data}async function nV(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function nK(){return(await U.get("/api/checks")).data}async function nJ(e){return(await U.get("/api/checks/".concat(e))).data}async function nB(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function nU(e){return(await U.delete("/api/checks/".concat(e))).data}async function nQ(e){return await U.post("/api/checks/reorder",e)}var nZ=t(94734),nX=t(71738),nG=t(38414),nY=t(29598),n$=t(62216),n0=t(42675),n1=t(20074),n2=t(54097),n5=t(95862),n4=t(82960),n3=t(69879),n9=t(618),n6=t(77153);function n8(e){let{name:n,setName:t}=e,[l,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.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)(n3.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n6.X,{color:"gray.500"}),children:[(0,i.jsx)(n9.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(n9.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(nb.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 n7=t(94019);t(81974);var te=t(78439);function tn(e){let{model:n,name:t,baseType:l,currentType:a}=e,{runAction:c}=nF(),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)(nC.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n_.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(te.h,{children:(0,i.jsx)(nz.q,{lineHeight:"20px",children:(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eD(d)&&!eI(d)),children:"Histogram Diff"}),(0,i.jsx)(nT.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tt(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)(tn,{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 ti=t(89725),tr=t(13965);let tl=(0,j.forwardRef)(function(e,n){let t,r,{base:l,current:s,enableScreenshot:a=!1}=e,{columns:c,rows:d}=(0,j.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(e$(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==l?void 0:l.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==l?void 0:l.resource_type);return n&&["model","seed","snapshot"].includes(n)?tt(e,(null==s?void 0:s.name)||(null==l?void 0:l.name)):tt(e)},[l,s]),{lineageGraph:u}=eg(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=l&&void 0===l.columns,p=s&&void 0===s.columns;return m&&p?r="Schema information is missing on both current and base environments.":m?r="Schema information is missing on base environment.":p&&(r="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(ti.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tr.z,{}),t]}):r?(0,i.jsxs)(ti.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tr.z,{}),r]}):(0,i.jsx)(i.Fragment,{}),d.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eX,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:d,renderers:{noRowsFallback:(0,i.jsx)(eG,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function ts(e){return(await U.post("/api/select",e)).data}var to=t(12282);t(15080);let ta=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(to.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},tc=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(to.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var td=t(79898),tu=t(68630),th=t(91363);let tx=eY.Nbv,tm=eY.sFB,tp=eY.UGs;function tf(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:tx}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tm}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tp}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tg(e){if("model"===e)return{color:"#c0eafd",icon:tu.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:th._MV};if("source"===e)return{color:"#a6dda6",icon:tu.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:th.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:th.R1C};if("seed"===e)return{color:"#a6dda6",icon:tu.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tu.Dmm};else return{color:"inherit",icon:void 0}}function tv(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}=tg(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nA("schema_diff"))||void 0===m?void 0:m.icon,t=tf("modified").color}else!h&&x?(n=tf("added").icon,t=tf("added").color):h&&!x&&(n=tf("removed").icon,t=tf("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})]})},ty=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:r}=eg(),l=t.params,s=[...H.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,y.a)({queryKey:s,queryFn:async()=>ts({select:null==l?void 0:l.select,exclude:null==l?void 0:l.exclude,packages:null==l?void 0:l.packages,view_mode:null==l?void 0:l.view_mode}),refetchOnMount:!0,enabled:!(null==l?void 0:l.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==l?void 0:l.node_id)for(let n of l.node_id instanceof Array?l.node_id:[l.node_id]){let t=null==r?void 0:r.nodes[n];t&&e.push(t)}else for(let n of(null==d?void 0:d.nodes)||[]){let t=null==r?void 0:r.nodes[n];t&&e.push(t)}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;tv(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?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function c(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=c(e),i=c(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==l?void 0:l.node_id,null==d?void 0:d.nodes,r]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tj,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tb=t(51643);function tk(e){let{value:n,onChange:t}=e,[r,s]=(0,j.useState)(!1),[a,c]=(0,j.useState)(),d=(0,j.useRef)(null);return((0,j.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)(tb.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)(el.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(ei.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tw=t(40902);function tC(){let e=(0,G.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})}}}function t_(){let e=(0,nW._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return t_=function(){return e},e}function tS(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tz(e){return e.description?e.description:"_(no description)_"}var tR=t(23256),tT=t(31265);let tE=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)(ei.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(r||l)&&(0,i.jsx)(el.z,{size:"sm",variant:"outline",onClick:r||l,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:th.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tT.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}})]})},tD=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)(tR.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tE,{label:"Base",value:t||"",onChange:l,onRunBase:a,options:d,...u})}),(0,i.jsx)(tR.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tE,{label:"Current",value:n,onChange:r,onRun:s,options:d,...u})})]})})};var tI=t(23567),tO=t(20085);let tM=(0,eO.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)(ti.b,{status:"error",children:[(0,i.jsx)(tr.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)(ne.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)(tI.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tI.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)(el.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)(tO.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tA=t(65674),tL=t(29012),tN=t(25783),tq=t(28023),tF=t(49110),tP=t(55415),tW=t(24432);t(90548),t(91074);var tH=t(48289),tV=t(66633),tK=t(83143),tJ=t(29937);function tB(e){let{node:n}=e,{icon:t}=tg(n.resourceType);return(0,i.jsx)(nh.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nZ.Vp,{children:[(0,i.jsx)(nZ.AD,{as:t}),(0,i.jsx)(nZ.Sn,{children:n.resourceType})]})})}function tU(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)(ei.x,{children:l}),(0,i.jsx)(s.J,{as:tK.Rgz}),(0,i.jsx)(ei.x,{children:o})]}):t===r?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(ei.x,{children:o}),(0,i.jsx)(s.J,{as:tJ.lxc,color:"gray.500"}),(0,i.jsx)(ei.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nh.u,{label:l,children:(0,i.jsxs)(nZ.Vp,{children:[(0,i.jsx)(nZ.AD,{as:x}),(0,i.jsx)(nZ.Sn,{children:m||c?(0,i.jsx)(tV.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tU,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nZ.bq,{as:nS.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n0.n,{}),size:"xs",onClick:a})]})})}let tZ=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tI.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsx)(nZ.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(r.xu,{children:"Skipped"}),s&&(0,i.jsx)(nh.u,{label:s,children:(0,i.jsx)(tH.s,{})})]})});if(!a)return(0,i.jsx)(tI.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)(tI.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tI.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)(nh.u,{label:c,children:(0,i.jsx)(e7.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nZ.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(nZ.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)(tQ,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tX=(0,j.createContext)(void 0),tG=()=>{let e=(0,j.useContext)(tX);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},tY=e=>{var n,t,l,a;let c,d,{id:u,inverted:h}=e,{lineageGraph:x,runsAggregated:m}=eg(),p=null==m?void 0:m[u],f=null==x?void 0:x.nodes[u];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(c=tv(null===(l=f.data.base)||void 0===l?void 0:l.columns,null===(a=f.data.current)||void 0===a?void 0:a.columns)),p&&p.row_count_diff){let e=p.row_count_diff;d=e.result.curr!==e.result.base}let g=h?"white":tf("modified").color,v=h?"gray":"lightgray";return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nh.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=nA("schema_diff"))||void 0===n?void 0:n.icon,color:c?g:v})})}),void 0!==d&&(0,i.jsx)(nh.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=nA("row_count_diff"))||void 0===t?void 0:t.icon,color:d?g:v})})})]})},t$=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tu.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tu.hGI})})};var t0=t(13358),t1=t(15196),t2=t(84963);function t5(e){let{base:n,current:t}=e;return(0,i.jsx)(tT.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 t4(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}function t3(e){var n,t,l,a,d,f,g;let{node:v,onCloseNode:y}=e,[,b]=(0,ek.TH)(),{setSqlQuery:k,setPrimaryKeys:w}=_(),C="model"===v.resourceType||"seed"===v.resourceType||"source"===v.resourceType||"snapshot"===v.resourceType,{isOpen:S,onOpen:z,onClose:R}=(0,eb.q)(),{runAction:T}=nF(),{envInfo:E}=eg(),{primaryKey:D}=eE(v.name),I=()=>{T("row_count_diff",{node_names:[v.name]},{showForm:!1,showLast:!1})},O=(0,j.useCallback)(async()=>{let e=v.id,n=await t4({node_id:e});b("/checks/".concat(n.check_id))},[v,b]),M="added"===v.changeStatus||"removed"===v.changeStatus;return(0,i.jsxs)(t1.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:v.name})}),(0,i.jsx)(h.L,{}),("model"===v.resourceType||"seed"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{as:el.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nA("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==E?void 0:E.adapterType)==="dbt"?k('select * from {{ ref("'.concat(v.name,'") }}')):(null==E?void 0:E.adapterType)==="sqlmesh"&&k("select * from ".concat(v.name)),w(void 0!==D?[D]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(tq.R,{}),(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsx)(nT.s,{onClick:z,icon:(0,i.jsx)(tu.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nA("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>I(),children:"Row Count Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nA("profile_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("profile_diff",{model:v.name},{showForm:!1,showLast:!1})},children:"Profile Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nA("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("value_diff",{model:v.name},{showForm:!0,showLast:!1})},children:"Value Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nA("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("top_k_diff",{model:v.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nA("histogram_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",isDisabled:M,onClick:()=>{T("histogram_diff",{model:v.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]}),(0,i.jsx)(tq.R,{}),(0,i.jsx)(nR.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nT.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nA("schema_diff"))||void 0===g?void 0:g.icon}),fontSize:"14px",onClick:O,children:"Schema Diff"})})]})]}),(0,i.jsx)(r.xu,{flex:"0 1 1%",children:(0,i.jsx)(t2.P,{onClick:y})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(tB,{node:v}),("model"===v.resourceType||"snapshot"===v.resourceType||"seed"===v.resourceType)&&(0,i.jsx)(tQ,{node:v,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)(nX.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nG.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tl,{base:v.data.base,current:v.data.current})})})]}),(0,i.jsxs)(Y.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(en.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.f,{children:(0,i.jsx)(t5,{base:v.data.base,current:v.data.current})})]})]})]})}function t9(e){var n,t;let{onClose:l}=e,{cancel:s,actionState:o}=tG();return(0,i.jsx)(r.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tN.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(r.xu,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(el.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(el.z,{size:"xs",variant:"outline",onClick:l,children:"Close"})})]})})}var t6=t(27547),t8=t(35052),t7=t(57489),ie=t(39588);function it(e){t7.j("[Web] multi_nodes_action",e)}function ii(e){t7.j("[Web] history_action",e)}let ir=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nF();return(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(s.J,{as:eY.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ii({name:"hide"}),t()):(ii({name:"show"}),n())},children:e?"Hide":"Show"})},il=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r,selectMode:l}=tG(),o=t.view_mode||"changed_models",a=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{as:el.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tg("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nz.q,{title:"packages",children:[(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},is=e=>{var n,t;let{isDisabled:r}=e,{lineageGraph:l}=eg(),{viewOptions:o,onViewOptionsChanged:a}=tG(),c=new Set;for(let e of Object.values((null==l?void 0:l.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==l?void 0:null===(t=l.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.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),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nC.v,{closeOnSelect:!1,children:[(0,i.jsx)(n_.j,{as:el.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tK.zFh}),size:"xs",variant:"outline",isDisabled:r,children:m}),(0,i.jsx)(nz.q,{title:"packages",children:(0,i.jsxs)(nR.k,{title:"Select Packages",children:[(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(tq.R,{}),Array.from(c).map(e=>(0,i.jsx)(nT.s,{as:nn.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},io=e=>{let[n,t]=(0,j.useState)(e.value),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nb.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",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)})},ia=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tG();return(0,i.jsx)(io,{isDisabled:n,value:t.select||"",onChange:e=>{r({...t,select:e||void 0})}})},ic=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tG();return(0,i.jsx)(io,{isDisabled:n,value:t.exclude||"",onChange:e=>{r({...t,exclude:e||void 0})}})},id=e=>(0,i.jsxs)(r.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),iu=()=>{var e,n,t,r;let{nodes:l,deselect:o,selectMode:a,...c}=tG(),d=(0,j.useMemo)(()=>l.filter(e=>e.data.isSelected),[l]),x="single"===a&&1===d.length,m="multi"===a&&d.length>=1,p="single"===a&&0===d.length,f="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(id,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(ir,{})}),(0,i.jsx)(id,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(il,{isDisabled:f})}),(0,i.jsx)(id,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(is,{isDisabled:f})}),(0,i.jsx)(id,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(ia,{isDisabled:f})}),(0,i.jsx)(id,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ic,{isDisabled:f})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(id,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(ei.x,{fontSize:"9pt",color:"gray.500",children:d.length>1?"".concat(d.length," nodes selected"):"".concat(d.length," node selected")})}),(0,i.jsx)(id,{label:"",children:(0,i.jsx)(el.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),(0,i.jsx)(id,{label:"Explore",children:(0,i.jsx)(t6.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nC.v,{placement:"bottom-end",children:[(0,i.jsx)(n_.j,{as:el.z,size:"xs",rightIcon:(0,i.jsx)(t8.v,{}),children:"Actions"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsxs)(nR.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),icon:(0,i.jsx)(s.J,{as:null===(e=nA("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{c.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),icon:(0,i.jsx)(s.J,{as:null===(n=nA("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{c.runValueDiff()},children:"Value Diff"})]}),(0,i.jsx)(tq.R,{}),(0,i.jsxs)(nR.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(p||m&&d.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nA("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{c.addLineageDiffCheck(c.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nT.s,{as:ei.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),icon:(0,i.jsx)(s.J,{as:null===(r=nA("schema_diff"))||void 0===r?void 0:r.icon}),onClick:()=>{c.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};var ih=t(81737),ix=t.n(ih),im=t(77249),ip=t(50228),ig=t(67605),iv=t.n(ig);let ij="ignore-screenshot";function iy(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,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,eb.q)(),[r,l]=(0,j.useState)();return{onOpen:n,setImgBlob:l,ImageDownloadModal:function(){let[n,l]=(0,j.useState)();return(0,j.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)(Y.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Screenshot Preview"}),(0,i.jsx)(ej.o,{}),(0,i.jsxs)(et.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)(tH.s,{color:"red.600"}),(0,i.jsx)(ei.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(ei.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(el.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,ip.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");iv()(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 ix()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,im.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?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function ib(e){let{successToast:n,failToast:t}=tC(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=iy({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,j.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,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),d=(0,j.useCallback)(async()=>{o.current?(await l(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,l,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.z,{size:"sm",leftIcon:(0,i.jsx)(n1.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}}async function ik(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function iw(){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}=tf(n);return(0,i.jsx)(nh.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 iC=t(11978);let i_={mode:"per_node",status:"pending",completed:0,total:0},iS=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:r}=n,l=(0,j.useRef)({...i_}).current,{showRunId:s}=nF(),o=async(n,o,a)=>{let c="multi_nodes";l.mode=c,t(),l.status="running";let d=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:c,status:"skipped",skipReason:e},i(n)):(n.action={mode:c,status:"pending"},d.push(n))}let u=a(d);try{let{run_id:e}=await ea(n,u,{nowait:!0});for(s(e),l.currentRun={run_id:e},l.total=1;;){let n=await ec(e,2);l.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of d)e.action={mode:c,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(l.completed=1,"canceling"===l.status){l.status="canceled",r();return}l.status="completed",r()},a=async(n,s)=>{let o="per_node";for(let n of(l.mode=o,t(),l.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(l.completed=0,l.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:r}=await ea(n,e,{nowait:!0});for(l.currentRun={run_id:r},t.action={mode:o,status:"running"},i(t);;){let e=await ec(r,2);l.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{l.currentRun=void 0}if(l.completed++,"canceling"===l.status){l.status="canceled",r();return}}l.status="completed",r()},c=async()=>{var e;l.status="canceling",(null===(e=l.currentRun)||void 0===e?void 0:e.run_id)&&await ed(l.currentRun.run_id)};return{actionState:l,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("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."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await ik({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await t4({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await t4({node_id:t})}return n},cancel:c,reset:()=>{Object.assign(l,i_)}}};var iz=t(65475),iR=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,eb.q)(),[l,s]=(0,j.useState)(0),[a,c]=(0,j.useState)(),d=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{c(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(iz.a,{size:"xl",isOpen:e,leastDestructiveRef:d,onClose:h,children:(0,i.jsx)($.Z,{children:(0,i.jsxs)(iz._,{children:[(0,i.jsxs)(en.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",l," nodes"]}),(0,i.jsx)(et.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(r.xu,{children:["Value diff will be executed on ",l," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(el.z,{ref:d,onClick:h,children:"Cancel"}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}};let iT={customNode:function(e){var n,t;let{data:l}=e,{isHighlighted:a,isSelected:c,resourceType:d,changeStatus:x}=l,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tg(d),[f,g]=(0,j.useState)(!1),{interactive:v,selectNodeMulti:y,selectMode:b}=tG(),{icon:k,color:w,backgroundColor:C}=x?tf(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},_="solid";l.isSelected;let S=null==l?void 0:l.name;return(0,i.jsx)(nh.u,{label:"model"===d?S:"".concat(S," (").concat(d,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:w,borderWidth:1,borderStyle:_,backgroundColor:m?"multi"===b?c?w:"white":"action_result"!==b?c?C:"white":l.action?c?C:w:"white":c?w:C,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===b?(null==l?void 0:l.action)?"none":"opacity(0.2) grayscale(50%)":a||c?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:w,padding:v?"8px":"2px",borderRightWidth:1,borderColor:"multi"===b?"#00000020":w,borderStyle:_,alignItems:"top",visibility:m?"inherit":"hidden",children:v&&(0,i.jsx)(t$,{checked:"multi"===b&&c||"action_result"===b&&!!l.action,onClick:e=>{"action_result"!==b&&(e.stopPropagation(),y(l.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(r.xu,{flex:"1",color:"multi"===b?c?"white":"inherit":"action_result"===b&&l.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:S}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===b?c?"white":"inherit":"action_result"===b&&l.action&&!c?"white":"inherit",as:p}),k&&(0,i.jsx)(s.J,{color:"multi"===b?c?"white":w:"action_result"===b?l.action&&!c?"white":"inherit":w,as:k})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==b&&"model"===l.resourceType&&(0,i.jsx)(tY,{id:l.id,inverted:"multi"===b&&!!c}),(0,i.jsx)(h.L,{}),l.isActionMode&&(l.action?(0,i.jsx)(tZ,{node:l,action:l.action}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==l?void 0:l.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==l?void 0:l.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},iE={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=tf(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}})})}},iD=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tf(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iI=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.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])},iO=()=>{let[,e]=(0,ek.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},iM=(0,j.forwardRef)(function(e,n){var t;let{interactive:l=!1,...a}=e,c=(0,R._K)(),d=(0,j.useRef)(null),{successToast:h,failToast:x}=tC(),{copyToClipboard:m,ImageDownloadModal:p,ref:f}=iy({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(ij))},onSuccess:()=>{h("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),x("Failed to copy image to clipboard",e)}}),[g,v,y]=(0,R.Rr)([]),[b,k,w]=(0,R.ll)([]),[C,_]=(0,j.useState)({view_mode:"changed_models",...a.viewOptions}),{lineageGraph:S,retchLineageGraph:z,isLoading:T,error:D,refetchRunsAggregated:I}=eg(),{showRunId:H,closeRunResult:V,runAction:K}=nF();(0,j.useImperativeHandle)(n,()=>({copyToClipboard:m}));let J=C.view_mode||a.viewMode||"changed_models",[B,U]=(0,j.useState)("single"),Q=(0,j.useMemo)(()=>{var e;if("single"===B)return null===(e=g.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[B,g]),Z=(0,j.useMemo)(()=>g.filter(e=>e.data.isSelected).map(e=>e.data),[g]),X=(0,j.useMemo)(()=>g.map(e=>e.data),[g]),[Y,$]=(0,j.useState)(!1),[ee,en]=(0,j.useState)({x:0,y:0}),et=(0,G.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!S)return;if(C.node_ids)e=C.node_ids;else{var n;let t=null===(n=S.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:C.view_mode,packages:t?[t]:void 0,...a.viewOptions};_(i),e=(await ts({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=A(S,e);L(t,i),v(t),k(i)})()},[S]);let er=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=c.getZoom();c.setCenter(n,t,{zoom:i,duration:200})}},es=iO();iI(d,async()=>{if("single"===B||"action_result"===B){let e=g.find(e=>e.data.isSelected);e?er(e):c.fitView({nodes:g,duration:200})}});let eo=(0,j.useCallback)(e=>{v(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[v]),ea=async e=>{let n;if(!S)return;try{n=(await ts({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof iC.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,l]=A(S,n);L(r,l),v(r),k(l),_(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{c.fitView({nodes:r,duration:200})})()},ec=iS("multi"===B?Z:X,{onActionStarted:()=>{U("action_result")},onActionNodeUpdated:eo,onActionCompleted:()=>{}}),ed=iR();if(T)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tL.$,{size:"xl"})});let eu=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ee.selectedNode;"action_result"!==B&&void 0!==n&&void 0!==S&&("single"===B&&(v(W(g,!0)),U("multi"),ec.reset()),v(P([...O(S,[n.id],e)],g,"single"===B)))},eh=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ee.selectedNode;"action_result"!==B&&void 0!==n&&void 0!==S&&("single"===B&&(v(W(g,!0)),U("multi"),ec.reset()),v(P([...M(S,[n.id],e)],g,"single"===B)))},ex=()=>{$(!1),en({x:0,y:0})};if(D)return(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(ne.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: ",D,"]"]}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>{z&&z()},children:"Retry"})]})});if("changed_models"===J&&!(null==S?void 0:null===(t=S.modifiedSet)||void 0===t?void 0:t.length))return(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsxs)(ne.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>{ea({...C,view_mode:"all"})},children:"Show all nodes"})]})});let em=()=>{U("single"),v(W(g)),V(),null==I||I()},ep={interactive:l,selectMode:B,nodes:g,viewOptions:C,onViewOptionsChanged:ea,selectNodeMulti:e=>{if("multi"!==B){if(!S)return;let[n,t]=N(Array.from(M(S,S.modifiedSet)),g,b);v(n=q(e,n=W(n,!0))),k(t),U("multi"),ec.reset()}else{let n=F(e,g);n.find(e=>e.data.isSelected)||(U("single"),n=W(n)),v(n)}},deselect:em,runRowCountDiff:async()=>{"multi"===B?(await ec.runRowCountDiff(),it({type:"row_count_diff",selected:"multi"})):Q?(await K("row_count_diff",{node_names:[Q.name]},{showForm:!1,showLast:!1}),it({type:"row_count_diff",selected:"single"})):(await K("row_count_diff",{select:C.select,exclude:C.exclude,packages:C.packages,view_mode:C.view_mode}),it({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(Q)await K("value_diff",{model:Q.name},{showForm:!0,showLast:!1}),it({type:"value_diff",selected:"single"});else{let e="multi"===B?Z.length:X.length;await ed.confirm(e)&&(await ec.runValueDiff(),it({type:"value_diff",selected:"multi"===B?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===B?(e=await ec.addLineageDiffCheck(),em(),it({type:"lineage_diff",selected:"multi"})):Q||(e=await ik(C),it({type:"lineage_diff",selected:"none"})),e&&es(e)},addSchemaDiffCheck:async()=>{let e;"multi"===B?Z.length>0&&(e=await ec.addSchemaDiffCheck(),em(),it({type:"schema_diff",selected:"multi"})):Q?(e=await t4({node_id:Q.id}),it({type:"schema_diff",selected:"single"})):(e=await t4({select:C.select,exclude:C.exclude,packages:C.packages,view_mode:C.view_mode}),it({type:"schema_diff",selected:"none"})),e&&es(e)},cancel:ec.cancel,actionState:ec.actionState};return(0,i.jsxs)(tX.Provider,{value:ep,children:[(0,i.jsxs)(ta,{sizes:Q?[70,30]:[100,0],minSize:Q?400:0,gutterSize:Q?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(ne.g,{ref:d,divider:(0,i.jsx)(tN.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[l&&(0,i.jsx)(iu,{}),(0,i.jsxs)(R.x$,{nodeTypes:iT,edgeTypes:iE,nodes:g,edges:b,onNodesChange:y,onEdgesChange:w,onNodeClick:(e,n)=>{if(!1!==l&&S){if(ex(),"single"===B){Q||er(n);let[e,t]=N(Array.from(E(O(S,[n.id]),M(S,[n.id]))),g,b);v(q(n.id,e)),k(t)}else if("action_result"===B){var t,i,r,s;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&H(null===(s=n.data.action)||void 0===s?void 0:null===(r=s.run)||void 0===r?void 0:r.run_id),er(n),v(q(n.id,g))}else{let e=F(n.id,g);e.find(e=>e.data.isSelected)||(U("single"),e=W(e)),v(e)}}},onNodeMouseEnter:(e,n)=>{if(!S||Q||"single"!==B)return;let[t,i]=N(Array.from(E(O(S,[n.id]),M(S,[n.id]))),g,b);v(t),k(i)},onNodeMouseLeave:(e,n)=>{if(!S||Q)return;let[t,i]=N(Array.from(M(S,S.modifiedSet)),g,b);v(t),k(i)},onNodeContextMenu:(e,n)=>{if(!l||"action_result"===B)return;e.preventDefault();let t=f.current.getBoundingClientRect(),i=f.current.offsetTop;en({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),$(!0)},onClick:ex,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:l,ref:f,children:[(0,i.jsx)(tF.A,{color:"#ccc"}),(0,i.jsx)(tP.Z,{showInteractive:!1,position:"top-right",className:ij,children:(0,i.jsx)(tP.B,{title:"copy image",onClick:async()=>{m()},children:(0,i.jsx)(s.J,{as:tK.C3L})})}),(0,i.jsx)(p,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(iw,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(ei.x,{fontSize:"xl",color:"grey",opacity:.5,children:g.length>0?"":"No nodes"})}),(0,i.jsx)(tW.a,{nodeColor:iD,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===B&&(0,i.jsx)(R.s_,{position:"bottom-center",className:ij,children:(0,i.jsx)(t9,{onClose:()=>{em()}})})]}),Y&&(0,i.jsx)(nC.v,{isOpen:!0,onClose:ex,children:(0,i.jsxs)(nz.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.Cv2,{}),onClick:()=>{eu(1)},children:"Select parent nodes"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.IMj,{}),onClick:()=>{eh(1)},children:"Select child nodes"}),(0,i.jsx)(tq.R,{}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.Cv2,{}),onClick:()=>{eu()},children:"Select all upstream nodes"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(t0.IMj,{}),onClick:()=>{eh()},children:"Select all downstream nodes"})]})})]}),"single"===B&&Q?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(t3,{node:Q,onCloseNode:()=>{if(!S)return;let[e,n]=N(Array.from(M(S,S.modifiedSet)),g,b);v(W(e)),k(n)}})}):(0,i.jsx)(r.xu,{})]}),ed.AlertDialog]})}),iA=(0,j.forwardRef)(function(e,n){let{check:t}=e,r={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(iM,{viewOptions:r,interactive:!1,ref:n})})})});var iL=t(19339);function iN(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=iL.ZP.stringify({checks:[o]});return(0,i.jsx)(tT.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 iq=e=>{var n;let[t,i]=(0,j.useState)(!1),[r,l]=(0,j.useState)(!1),[,s]=ev(),{error:o,data:a}=(0,y.a)({queryKey:H.run(e||""),queryFn:async()=>ec(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.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,j.useCallback)(async()=>{if(l(!0),e)return await ed(e)},[e,l]),d=(null==a?void 0:a.type)?null===(n=nA(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 iF(){let e=(0,G.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function iP(){let e=(0,nW._)(["\n
","\n\n ","\n\n
"]);return iP=function(){return e},e}let iW=e=>{var n,t,l,a,d,f,g;let{checkId:v}=e,k=(0,b.NL)(),[,w]=(0,ek.TH)(),{successToast:C,failToast:_}=tC(),{markedAsApprovedToast:S}=iF(),[z,R]=(0,j.useState)(),[T,E]=(0,j.useState)(),[D,I]=(0,j.useState)(!1),{isOpen:O,onOpen:M,onClose:A}=(0,eb.q)(),L=()=>(0,i.jsx)($.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[N,q]=(0,j.useState)((0,i.jsx)(L,{})),{isLoading:F,error:P,data:W}=(0,y.a)({queryKey:H.check(v),queryFn:async()=>nJ(v),refetchOnMount:!0}),V=z||(null==W?void 0:null===(n=W.last_run)||void 0===n?void 0:n.run_id),{run:K,error:J}=iq(V),B=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==W?void 0:W.type)?nA(null==W?void 0:W.type):void 0,Q=(null==W?void 0:W.is_preset)||!1,Z=(0,j.useRef)(null),{mutate:X}=(0,n7.D)({mutationFn:e=>nB(v,e),onSuccess:()=>{k.invalidateQueries({queryKey:H.check(v)}),k.invalidateQueries({queryKey:H.checks()})}}),{mutate:G}=(0,n7.D)({mutationFn:()=>nU(v),onSuccess:()=>{k.invalidateQueries({queryKey:H.checks()}),w("/checks")}}),ei=(0,j.useCallback)(async()=>{(null==W?void 0:W.type)&&R((await eu(v,{nowait:!0})).run_id)},[W,v,R]),er=(0,j.useCallback)(async()=>{if(I(!0),V)return await ed(V)},[V]),es=async()=>{if(!W)return;let e=(0,tw.RI)(iP(),tS(W),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tz(e),"\n\n").concat((0,tw.Pn)(t_(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tz(e)}(W));if(!navigator.clipboard){_("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),C("Copied the check to the clipboard")}catch(e){_("Failed to copy the check to clipboard",e)}},eo=(0,j.useCallback)(()=>{let e=null==W?void 0:W.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==W?void 0:W.is_checked,X,S]),[ea,ec]=(0,j.useState)(0),{ref:eh,onCopyToClipboard:ex,onMouseEnter:em,onMouseLeave:ep}=ib();if(F)return(0,i.jsx)(eQ.M,{h:"100%",children:"Loading"});if(P)return(0,i.jsxs)(eQ.M,{h:"100%",children:["Error: ",P.message]});let ef=(null==K?void 0:K.run_at)?(0,tA.Q)(new Date(K.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tc,{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)(n8,{name:(null==W?void 0:W.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Q&&(0,i.jsx)(nh.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nZ.Vp,{size:"sm",children:[(0,i.jsx)(nZ.AD,{boxSize:"14px",as:n5.bX4}),"Preset"]})}),(0,i.jsxs)(nC.v,{children:[(0,i.jsx)(n_.j,{isRound:!0,as:nS.h,icon:(0,i.jsx)(s.J,{as:eY.D_A}),variant:"ghost"}),(0,i.jsxs)(nz.q,{children:[(0,i.jsx)(nT.s,{icon:(0,i.jsx)(n4.ovA,{}),onClick:()=>{q((0,i.jsx)(L,{})),M()},children:"Get Preset Check Template"}),(0,i.jsx)(nT.s,{icon:(0,i.jsx)(n$.p,{}),onClick:()=>G(),children:"Delete"})]})]}),ef&&(0,i.jsx)(r.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ef}),(null==U?void 0:U.RunResultView)&&(0,i.jsx)(nh.u,{label:"Rerun",children:(0,i.jsx)(nS.h,{isRound:!0,isLoading:B,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n0.n,{}),onClick:()=>ei()})}),(0,i.jsx)(nh.u,{label:"Copy markdown",children:(0,i.jsx)(nS.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(n1.T,{}),onClick:()=>es()})}),(0,i.jsx)(nh.u,{label:(null==W?void 0:W.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(el.z,{size:"sm",colorScheme:(null==W?void 0:W.is_checked)?"green":"gray",variant:(null==W?void 0:W.is_checked)?"solid":"outline",leftIcon:(0,i.jsx)(n2.r,{color:(null==W?void 0:W.is_checked)?"inherit":"green"}),onClick:()=>eo(),children:(null==W?void 0:W.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tk,{value:null==W?void 0:W.description,onChange:e=>{X({description:e})}},null==W?void 0:W.check_id)})]}),(0,i.jsx)(r.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:ea,onChange:ec,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==W?void 0:W.type)==="query"||(null==W?void 0:W.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)(el.z,{leftIcon:(0,i.jsx)(n1.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==W?void 0:W.type)&&void 0!==f?f:"")&&"lineage_diff"!==g&&(!(null==K?void 0:K.result)||!!(null==K?void 0:K.error))||0!==ea,onMouseEnter:em,onMouseLeave:ep,size:"sm",onClick:()=>{if((null==W?void 0:W.type)==="lineage_diff"){var e;null===(e=Z.current)||void 0===e||e.copyToClipboard()}else ex()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(nX.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nG.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==W?void 0:W.last_run)||V?(0,i.jsx)(tM,{ref:eh,isRunning:B,isAborting:D,run:V?K:null==W?void 0:W.last_run,error:J,progress:T,RunResultView:U.RunResultView,viewOptions:null==W?void 0:W.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:er,onExecuteRun:ei}):(0,i.jsx)(eQ.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(el.z,{onClick:ei,colorScheme:"blue",size:"sm",children:"Run Query"})})),W&&"schema_diff"===W.type&&(0,i.jsx)(ty,{check:W,ref:eh}),W&&"lineage_diff"===W.type&&(0,i.jsx)(iA,{check:W,ref:Z})]}),((null==W?void 0:W.type)==="query"||(null==W?void 0:W.type)==="query_diff"||(null==W?void 0:W.type)==="query_base")&&(0,i.jsx)(nG.x,{p:0,height:"100%",width:"100%",children:(null===(t=W.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tD,{value:(null==W?void 0:null===(l=W.params)||void 0===l?void 0:l.sql_template)||"",baseValue:(null==W?void 0:null===(a=W.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tE,{value:(null==W?void 0:null===(d=W.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(Y.u_,{isOpen:O,onClose:A,isCentered:!0,size:"6xl",children:[N,(0,i.jsxs)(ee.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(en.x,{children:"Preset Check Template"}),(0,i.jsx)(ej.o,{}),(0,i.jsxs)(et.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(nY.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)(iN,{name:(null==W?void 0:W.name)||"",description:(null==W?void 0:W.description)||"",type:(null==W?void 0:W.type)||"",params:null==W?void 0:W.params,viewOptions:null==W?void 0:W.view_options})]})]})]})]})};var iH=t(53924);let iV=e=>{var n;let{check:t,selected:l,onSelect:a,onMarkAsApproved:c}=e,d=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,n7.D)({mutationFn:e=>nB(u,e),onSuccess:()=>{d.invalidateQueries({queryKey:H.check(u)}),d.invalidateQueries({queryKey:H.checks()})}}),x=(null===(n=nA(t.type))||void 0===n?void 0:n.icon)||ew.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:l?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:l?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nh.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(nn.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):c()}})})})]})})},iK=e=>{let{checks:n,selectedItem:t,onCheckSelected:l,onChecksReordered:s}=e,[a,c]=(0,j.useState)(!1),d=(0,b.NL)(),{mutate:u}=(0,n7.D)({mutationFn:e=>nB(e,{is_checked:!0}),onSuccess:(e,n)=>{d.invalidateQueries({queryKey:H.check(n)}),d.invalidateQueries({queryKey:H.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,eb.q)(),{markedAsApprovedToast:p}=iF(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iH.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(iH.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(ne.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iH._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,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)(iV,{check:e,selected:e.check_id===t,onSelect:l,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(Y.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{width:"400px",children:[(0,i.jsx)(en.x,{children:"Mark as Approved?"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(nx.i,{}),(0,i.jsxs)(r.xu,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(nn.X,{isChecked:a,onChange:e=>c(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nx.i,{}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(el.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(el.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};function iJ(){let e=(0,nW._)(["\n
","\n\n ","\n\n
"]);return iJ=function(){return e},e}let iB=()=>{let[,e]=(0,ek.TH)(),[,n]=(0,ek.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=tC(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:H.checks(),queryFn:nK,refetchOnMount:!0}),h=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,j.useState)(d||[]),{mutate:p}=(0,n7.D)({mutationFn:e=>nQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:H.checks()})}}),f=(0,j.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,j.useCallback)(async()=>{let e=await nH();t.invalidateQueries({queryKey:H.checks()}),h(e.check_id)},[t,h]),(0,j.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)(ta,{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)(ne.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nh.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nS.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tw.RI)(iJ(),tS(e),tz(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)(n1.T,{})})}),(0,i.jsx)(nx.i,{}),(0,i.jsx)(iK,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(ek.rs,{children:(0,i.jsx)(ek.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iW,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eQ.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};var iU=t(25356);async function iQ(e,n){return await ea("query",e,n)}async function iZ(e,n){return await ea("query_base",e,n)}async function iX(e,n){return await ea("query_diff",e,n)}var iG=t(67619),iY=t(58565),i$=t(49468);let i0=e=>{var n;let{defaultValues:t,suggestionList:r,onValuesChange:l}=e,[s,o]=(0,j.useState)(t||[]),[a,c]=(0,j.useState)(""),[d,u]=(0,j.useState)(!1),h=(0,j.useRef)(null),x=e=>{s.includes(e)||(c(""),o([...s,e]),l([...s,e]))};return(0,i.jsxs)(iG.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nC.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(n_.j,{width:"100%",children:(0,i.jsx)(nb.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[0]):""})}),(0,i.jsx)(te.h,{children:(0,i.jsxs)(nz.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nR.k,{children:(0,i.jsxs)(iY.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[s.map((n,t)=>(0,i.jsx)(iY.U,{children:(0,i.jsxs)(nZ.Vp,{size:e.size,children:[(0,i.jsx)(nZ.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(nZ.SD,{paddingRight:"8px",onClick:()=>{o(s.filter(e=>e!==n)),l(s.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iY.U,{width:"100%",children:(0,i.jsx)(nb.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)(tq.R,{}),(0,i.jsxs)(nR.k,{children:[""!==a&&!(null==r?void 0:r.includes(a))&&(0,i.jsxs)(nT.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)(nT.s,{onClick:()=>x(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(i$.x,{children:(0,i.jsx)(el.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===s.length,onClick:()=>{c(""),o([]),l([])},children:"Clear"})})]})},i1=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=eg(),s=(0,j.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)(eC.NI,{m:"4px 8px",children:[(0,i.jsxs)(e_.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nh.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",children:(0,i.jsx)(tH.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(i0,{unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name..."})]})})},i2=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nF();return(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(s.J,{as:eY.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ii({name:"hide"}),t()):(ii({name:"show"}),n())},children:e?"Hide":"Show"})]})},i5=()=>{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)(nh.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tH.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iU.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&l&&l(t),n(!e)}})]})},i4=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:l,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=eg(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nF(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iQ;case"query_base":return iZ;case"query_diff":return iX;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 ec(l)},{mutate:p,isPending:f}=(0,n7.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)(i2,{}),(0,i.jsx)(i5,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(i1,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(el.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)(tD,{value:u,baseValue:n,onChange:t,onChangeBase:l,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tE,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var i3=t(30148);let i9=e=>(0,i3.c4)("#!"+e),i6=()=>[(0,i3.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),i9];var i8=t(24681),i7=t(62843);let re=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:H.run(t),queryFn:async()=>ec(t)}),o=(null==s?void 0:s.type)?null===(n=nA(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tM,{isPending:r,error:l,run:s,RunResultView:o})},rn=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)(el.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},rt=e=>{let{children:n}=e;return(0,i.jsx)(tO.SV,{fallback:rn,children:n})};async function ri(){return(await U.post("/api/export")).data}async function rr(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await U.post("/api/import",t)).data}async function rl(){return 208===(await U.get("/api/sync")).status}async function rs(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,iC.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var ro=t(16021);function ra(){let e=(0,G.p)(),n=async()=>{try{let e=await ri(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,ip.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");iv()(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)(nh.u,{label:"Export",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:ro.tRY,boxSize:"1.2em"})})})}function rc(e){let{checksOnly:n}=e,t=(0,G.p)(),r=(0,b.NL)(),l=(0,j.useRef)(null),a=(0,j.useRef)(null),[c,d]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,eb.q)(),[m,p]=(0,ek.TH)(),[,f]=ev(),g=(0,j.useCallback)(async()=>{if(c){try{let{runs:e,checks:i}=await rr(c,n);f(),await r.invalidateQueries({queryKey:H.checks()}),await r.invalidateQueries({queryKey:H.runs()}),m.includes("/checks")&&p("/checks");let l=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:l,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[r,c,t,x,m,p,f,n]),v=n?"checks":"runs and checks";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nh.u,{label:"Import",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{l.current&&l.current.click()},icon:(0,i.jsx)(s.J,{as:ro.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:l,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(d(e.target.files[0]),h()),l.current&&(l.current.value="")}}),(0,i.jsx)(iz.a,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)($.Z,{children:(0,i.jsxs)(iz._,{children:[(0,i.jsx)(en.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(et.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)(tH.s,{color:"red.600"}),(0,i.jsx)(ei.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(ei.x,{children:["The current ",v," will be"," ",(0,i.jsx)(ei.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(el.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var rd=t(93126),ru=t(1026),rh=t(13154),rx=t(99434),rm=t(20143),rp=t(89830),rf=t(13276),rg=t(31610);function rv(e){let n=(0,rg.D)(e);return(0,ip.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function rj(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)(td.HC,{ml:"10px",children:[n,": ",t]},n)})}function ry(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=eg(),{isOpen:m,onOpen:p,onClose:f}=(0,eb.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)?rv(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?rv(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)(nh.u,{label:"Environment Info",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n4.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(Y.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{children:"Environment Information"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.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)(td.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(td.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&rj(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)(td.QI,{spacing:1,children:g&&rj(g)})]})}),(0,i.jsx)(nx.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)(rd.x,{children:(0,i.jsxs)(ru.i,{variant:"simple",children:[(0,i.jsx)(rh.h,{children:(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rm.Th,{}),(0,i.jsx)(rm.Th,{children:"base"}),(0,i.jsx)(rm.Th,{children:"current"})]})}),(0,i.jsxs)(rp.p,{children:[(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rf.Td,{children:"schema"}),(0,i.jsx)(rf.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(rf.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rf.Td,{children:"version"}),(0,i.jsx)(rf.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(rf.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rf.Td,{children:"timestamp"}),(0,i.jsx)(rf.Td,{children:k}),(0,i.jsx)(rf.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)(rd.x,{children:(0,i.jsxs)(ru.i,{variant:"simple",children:[(0,i.jsx)(rh.h,{children:(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rm.Th,{}),(0,i.jsx)(rm.Th,{children:"base"}),(0,i.jsx)(rm.Th,{children:"current"})]})}),(0,i.jsx)(rp.p,{children:(0,i.jsxs)(rx.Tr,{children:[(0,i.jsx)(rf.Td,{children:"Environment"}),(0,i.jsx)(rf.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(rf.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(el.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var rb=t(21166),rk=t(43399),rw=t(60057);function rC(){return(0,i.jsx)(nh.u,{label:"Syncing",children:(0,i.jsx)(el.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tL.$,{})})})}function r_(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[l,o]=(0,ek.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,eb.q)(),[u,h]=(0,j.useState)(""),x=(0,G.p)(),m=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await rs(e)).status){c(),n(!1);return}for(;await rl();)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)(rC,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nh.u,{label:"Sync with Cloud",children:(0,i.jsx)(nS.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:ro.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(Y.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{children:[(0,i.jsx)(en.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(et.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)(rb.E,{onChange:h,value:u,children:(0,i.jsxs)(tR.K,{direction:"column",children:[(0,i.jsxs)(rk.Y,{value:"merge",children:["Merge",(0,i.jsx)(nh.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rw.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rk.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nh.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:rw.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rk.Y,{value:"revert",children:["Revert",(0,i.jsx)(nh.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:rw.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(el.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(el.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}function rS(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iM,{viewMode:"changed_models",interactive:!0})})}async function rz(){return(await U.get("/api/flag")).data}async function rR(){try{await U.post("/api/onboarding/completed")}catch(e){}}var rT=()=>{let[e,n]=(0,j.useState)(!1);(0,j.useEffect)(()=>{rz().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),rR()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(Y.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)($.Z,{}),(0,i.jsxs)(ee.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(en.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ej.o,{}),(0,i.jsx)(et.f,{children:(0,i.jsxs)(tR.K,{spacing:4,children:[(0,i.jsxs)(td.aV,{spacing:2,children:[(0,i.jsx)(td.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(td.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(td.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nx.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(el.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},rE=t(1873);let rD=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,ip.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,ip.WU)(e,"HH:mm"):(0,ip.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)(tL.$,{size:"xs",color:"".concat(l,".400")}),(0,i.jsx)(ei.x,{fontWeight:500,color:"".concat(l,".400"),children:s}),(0,i.jsx)(ei.x,{children:"•"}),(0,i.jsx)(ei.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},rI=e=>{let n=iL.ZP.stringify(e,null,2);return(0,i.jsx)(tT.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}})},rO=e=>{var n,t,r;let{runId:l,onClose:s}=e,{runAction:a}=nF(),{error:c,run:d,onCancel:f,isRunning:g}=iq(l),[v,y]=(0,j.useState)(),k=(0,b.NL)(),[,w]=(0,ek.TH)(),[C,_]=(0,j.useState)(0),S=(null==d?void 0:d.type)?null===(n=nA(d.type))||void 0===n?void 0:n.RunResultView:void 0,z=(0,j.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,j.useCallback)(async()=>{R&&w("/checks/".concat(R))},[R,w]),E=(0,j.useCallback)(async()=>{if(!l)return;let e=await nV(l,v);k.invalidateQueries({queryKey:H.checks()}),w("/checks/".concat(e.check_id))},[l,w,k,v]),D=(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:O,onMouseEnter:M,onMouseLeave:A}=ib();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"}),D&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[d&&(0,i.jsx)(rD,{run:d}),(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(n0.n,{}),variant:"outline",isDisabled:!l||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(n1.T,{}),variant:"outline",isDisabled:!l||!(null==d?void 0:d.result)||!!c||0!==C,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:O,children:"Copy to Clipboard"}),(null==d?void 0:d.check_id)?(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(rE.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(el.z,{leftIcon:(0,i.jsx)(rE.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t2.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tM,{ref:I,error:c,run:d,onCancel:f,viewOptions:v,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(rI,{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)(tD,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tE,{value:(null==d?void 0:null===(r=d.params)||void 0===r?void 0:r.sql_template)||"",options:{readOnly:!0}}))]})},rM=e=>{let{onClose:n}=e,{runId:t}=nF();return(0,i.jsx)(rO,{runId:t,onClose:n})};var rA=t(22661);t(86777);let rL=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 ec(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nA(t.type))||void 0===n?void 0:n.icon)||ew.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)(nh.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(ei.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:tu.FJM})})}):(0,i.jsx)(nh.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(ei.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),ii({name:"add_to_checklist"}),c(t.run_id)},children:(0,i.jsx)(s.J,{as:tu.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(rD,{run:u||t})})]})},rN=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,ip.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})},rq=()=>{let{data:e,isLoading:n,isFetching:t,error:l,refetch:s}=(0,y.a)({queryKey:H.runs(),queryFn:async()=>await ex(),retry:!1}),{showRunId:a,runId:d}=nF(),x=e=>{ii({name:"click_run"}),a(e,!1)},[,m]=(0,ek.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!d)return;let e=await nV(d);p.invalidateQueries({queryKey:H.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,j.useCallback)(e=>{ii({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=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)(nS.h,{variant:"unstyled",icon:(0,i.jsx)(n0.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)(rA.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),r=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[r&&(0,i.jsx)(rN,{runAt:e.run_at},t),(0,i.jsx)(rL,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var rF=t(65627),rP=t(78032);let{definePartsStyle:rW,defineMultiStyleConfig:rH}=(0,rP.D)(rF.TB.keys),rV=rH({variants:{circular:rW({control:(0,rP.k0)({rounded:"full"})})},sizes:{xs:rW({icon:(0,rP.k0)({fontSize:"8px"}),control:(0,rP.k0)({boxSize:"16px",padding:"4px"}),label:(0,rP.k0)({fontSize:"xs"})})}}),rK=(0,t(62821).fj)({baseStyle:{borderRadius:"4px"}}),rJ=e=>{let{children:n,path:t}=e,[l]=(0,ek.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rB(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 rU(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eg(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.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)||{},v=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:eY.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:eY.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rB,{icon:tu.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rB,{icon:tu.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rB,{mr:"18px",icon:tu.MXt,href:"https://datarecce.io/docs"})]})}function rQ(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 rZ(){let{isDemoSite:e,reviewMode:n,cloudMode:t,isLoading:r}=eg(),[l,s]=(0,ek.TH)(),o=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(rQ,{queryKey:H.checks(),fetchCallback:nK,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],a=eR().findIndex(o,e=>{let{href:n}=e;return l.startsWith(n)});return(0,i.jsx)(x.m,{index:a,children:(0,i.jsxs)(m.t,{children:[o.map(e=>{let{name:n,href:t,badge:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{s(t)},children:[n,r]},n)}),(0,i.jsx)(h.L,{}),!r&&(0,i.jsxs)(i.Fragment,{children:[t&&(0,i.jsx)(r_,{}),!e&&!t&&(0,i.jsx)(rc,{}),!e&&t&&n&&(0,i.jsx)(rc,{checksOnly:!0}),(0,i.jsx)(ra,{})]}),(0,i.jsx)(ry,{})]})})}function rX(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nF(),[l]=(0,ek.TH)(),s=e&&!l.startsWith("/checks"),o=n&&!l.startsWith("/checks");return(0,i.jsxs)(ta,{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)(rq,{})}),(0,i.jsxs)(tc,{sizes:s?[50,50]:[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)(rt,{children:[(0,i.jsx)(rJ,{path:"/lineage",children:(0,i.jsx)(rS,{})}),(0,i.jsxs)(ek.rs,{children:[(0,i.jsx)(ek.AW,{path:"/query",children:(0,i.jsx)(i4,{})}),(0,i.jsx)(ek.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iB,{})}),(0,i.jsx)(ek.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(re,{runId:n})}}),(0,i.jsx)(ek.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(ek.AW,{children:(0,i.jsx)(ek.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(rM,{onClose:t}):(0,i.jsx)(r.xu,{})]})]})}let rG=(0,g.B1)({components:{Checkbox:rV,Tooltip:rK}});function rY(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=ie.env.AMPLITUDE_API_KEY;if(n&&t)try{t7.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,i8.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(i7.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rG,children:(0,i.jsx)(b.aH,{client:Q,children:(0,i.jsx)(ek.F0,{hook:i6,children:(0,i.jsx)(nP,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(rU,{}),(0,i.jsx)(rZ,{}),(0,i.jsx)(rT,{}),(0,i.jsx)(rX,{})]})})})})})})}},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,314,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/t9g3TyzSKWJz98HjtGkxP/_buildManifest.js b/recce/data/_next/static/uc8y5w_Kw4R3yjojwd83L/_buildManifest.js similarity index 100% rename from recce/data/_next/static/t9g3TyzSKWJz98HjtGkxP/_buildManifest.js rename to recce/data/_next/static/uc8y5w_Kw4R3yjojwd83L/_buildManifest.js diff --git a/recce/data/_next/static/t9g3TyzSKWJz98HjtGkxP/_ssgManifest.js b/recce/data/_next/static/uc8y5w_Kw4R3yjojwd83L/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/t9g3TyzSKWJz98HjtGkxP/_ssgManifest.js rename to recce/data/_next/static/uc8y5w_Kw4R3yjojwd83L/_ssgManifest.js diff --git a/recce/data/index.html b/recce/data/index.html index 025ca07b..ddb66a57 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 b196ad6f..ca3050bb 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,7 +1,7 @@ 2:I[60814,[],""] -3:I[18517,["634","static/chunks/7c9ab469-4a59ad69aea17b0a.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-08206da1a6d6157f.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","314","static/chunks/314-f03a14d882c8225f.js","931","static/chunks/app/page-e9463241ce30f70d.js"],""] +3:I[38827,["634","static/chunks/7c9ab469-4a59ad69aea17b0a.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-08206da1a6d6157f.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","314","static/chunks/314-f03a14d882c8225f.js","931","static/chunks/app/page-d238b14e32288b94.js"],""] 4:I[4737,[],""] 5:I[25587,[],""] -0:["t9g3TyzSKWJz98HjtGkxP",[[["",{"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:["uc8y5w_Kw4R3yjojwd83L",[[["",{"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