From adaaf1d0cce7428c37459dc3aa89667f7834fd8a Mon Sep 17 00:00:00 2001 From: popcornylu Date: Tue, 3 Dec 2024 07:49:51 +0000 Subject: [PATCH] AUTO-COMMIT - build js statics to recce data/ --- recce/data/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 recce/data/_next/static/chunks/app/page-0714a6eda477b882.js | 1 + recce/data/_next/static/chunks/app/page-29cfb245a1734f65.js | 1 - recce/data/index.html | 4 ++-- recce/data/index.txt | 4 ++-- 7 files changed, 6 insertions(+), 6 deletions(-) rename recce/data/_next/static/{FGdX4o1OUrZsieYxbbY-A => 9Er9jEAeZsFoezU1ifSCK}/_buildManifest.js (100%) rename recce/data/_next/static/{FGdX4o1OUrZsieYxbbY-A => 9Er9jEAeZsFoezU1ifSCK}/_ssgManifest.js (100%) create mode 100644 recce/data/_next/static/chunks/app/page-0714a6eda477b882.js delete mode 100644 recce/data/_next/static/chunks/app/page-29cfb245a1734f65.js diff --git a/recce/data/404.html b/recce/data/404.html index f2750b2d..96e46e96 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/FGdX4o1OUrZsieYxbbY-A/_buildManifest.js b/recce/data/_next/static/9Er9jEAeZsFoezU1ifSCK/_buildManifest.js similarity index 100% rename from recce/data/_next/static/FGdX4o1OUrZsieYxbbY-A/_buildManifest.js rename to recce/data/_next/static/9Er9jEAeZsFoezU1ifSCK/_buildManifest.js diff --git a/recce/data/_next/static/FGdX4o1OUrZsieYxbbY-A/_ssgManifest.js b/recce/data/_next/static/9Er9jEAeZsFoezU1ifSCK/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/FGdX4o1OUrZsieYxbbY-A/_ssgManifest.js rename to recce/data/_next/static/9Er9jEAeZsFoezU1ifSCK/_ssgManifest.js diff --git a/recce/data/_next/static/chunks/app/page-0714a6eda477b882.js b/recce/data/_next/static/chunks/app/page-0714a6eda477b882.js new file mode 100644 index 00000000..3f21c5d8 --- /dev/null +++ b/recce/data/_next/static/chunks/app/page-0714a6eda477b882.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,18517))},18517:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rG}});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}var E=t(28482),D=t.n(E);function I(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 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].children),t)}function M(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 A(t,i),L(Array.from(O(e,e.modifiedSet)),t,i)}let A=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(D()).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)}),D().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function L(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 N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function F(e,n){return n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let W={rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var H=t(62330),V=t(39588);let K=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var J=t(94614);let B=H.default.create({baseURL:K}),U=new J.S;async function Q(){return(await B.get("/api/info")).data}async function Z(e){return(await B.get("/api/model/".concat(e))).data}var X=t(99873),G=t(17695),Y=t(62628),$=t(6533),ee=t(96985),en=t(7797),et=t(79481),ei=t(13844),er=t(64653),el=t(85929),es=t.n(el);async function eo(e,n,t){return(await B.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ea(e,n){return(await B.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function ec(e){return await B.post("/api/runs/".concat(e,"/cancel"))}async function ed(e,n){return(await B.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function eu(e,n,t){return(await B.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function eh(){return(await B.get("/api/runs")).data}async function ex(){return(await B.post("/api/runs/aggregate",{})).data}let em=(0,j.createContext)({});function ep(e){var n,t;let{children:r}=e,{data:l,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:W.lineage(),queryFn:Q}),{data:c,refetch:d}=(0,y.a)({queryKey:W.runsAggregated(),queryFn:ex}),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,X.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:W.lineage()}),r.invalidateQueries({queryKey:W.checks()}),r.invalidateQueries({queryKey:W.runs()})},s=()=>{let t=new WebSocket("".concat(K.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=es().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)(em.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)(G.u_,{isOpen:"disconnected"===C,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Server Disconnected"}),(0,i.jsx)(en.f,{children:(0,i.jsx)(et.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{_()},children:"Retry"})})]})]})]})}let ef=()=>(0,j.useContext)(em),eg=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ef();return[e,n]};var ev=t(69384);let ej=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)(G.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ee.x,{children:a}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.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)(ei.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(er.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var ey=t(25612),eb=t(76330),ek=t(53152),ew=t(18222),eC=t(30678),e_=t(2838),eS=t(13156),ez=t.n(eS);function eR(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eT=e=>{var n;let{lineageGraph:t}=ef(),[i,r]=(0,j.useState)([]),[l,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[c,d]=(0,j.useState)(null),u=ez().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 eR(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await Z(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){r([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);r(eR(n,t))}catch(e){d(e)}};h.length>0?(r(h),s(x)):(null==u?void 0:u.id)===void 0?r([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:l,isLoading:o,error:c}};function eE(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eD(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eI=t(85813),eO=t(81945),eM=t(14827);function eA(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eL(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,r=n>=1e9,l=n>=1e15;if(l||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:l?0:2}).format(e/1e12).replace("L","T");if(r||i||n>=1e3){let n={base:r?1e9:i?1e6:1e3,unit:r?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eN="#63B3ED",eq="#F6AD55",eF="".concat(eN,"A5"),eP="".concat(eq,"A5");function eW(e){let{color:n}=e;return(0,i.jsx)(r.xu,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function eH(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eO.kL.register(eO.ZL,eO.RM,eO.f$,eO.uw,eO.Dx,eO.De,eO.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=eK(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=eA(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)=>eK(l,n)).slice(0,-1);return{x:"datetime"===r?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>d[n]},stacked:!0},y:{display:!s,type:"linear",max:c,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eL(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:r}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[r,l]=n,s=eV(t,i,"Current",eF,l),o=eV(t,i,"Base",eP,r);return{labels:i.map((e,n)=>eK(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eM.kL,{type:"bar",options:l,data:s,plugins:[]})}function eV(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 eK(e,n){let t=e[n],i=e[n+1],r=eL(t),l=eL(i);return"".concat(r," - ").concat(l)}let eJ=(0,eI.G)((e,n)=>{let{backgroundColor:t="white",blockSize:l,children:s,...o}=e;return(0,i.jsx)(r.xu,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.xu,{backgroundColor:t,height:"100%",blockSize:l,children:s})})}),eB=(0,eI.G)(function(e,n){var t,l,s,a,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)(eJ,{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)(eH,{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 eU=t(24112);t(63156);var eQ=t(22204);let eZ=(0,eI.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eQ.ZP,{ref:n,...t})})});function eX(){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)(et.x,{fontWeight:"600",children:" No rows"})})}t(87679);var eG=t(52091);function eY(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 e$(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 e0(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 e1(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?eG.ven:eG.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?eG.$kI:eG.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let e2=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]},e5=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(et.x,{style:{color:"gray"},children:"-"});let[r,l]=e2(n[t.key]);return(0,i.jsx)(et.x,{style:{color:l?"gray":"inherit"},children:r})};function e4(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(eY(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=e$(r.columns,s);r.data.forEach((n,t)=>{let i=e0(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e$(l.columns,s),l.data.forEach((n,t)=>{let i=e0(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=eY(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(d))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||ez().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e1,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,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)(e1,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e5})}),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 e3=(0,eI.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)(()=>e4(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)(eU.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ,{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 e9(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?eG.$kI:eG.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 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=eY(Object.keys(a),Object.keys(c)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,r]=t,l=a[i],s=c[i],d=JSON.parse(i);if(l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=l[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=s[t])}),l){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(ez().isEqual(l[t.index],s[t.index])||(d.__status="modified",t.status="modified"));else d.__status="removed",m.removed++}else d.__status="added",m.added++;return"modified"===d.__status&&m.modified++,d});l&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e9,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(e9,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e5})}),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 e8=t(93998),e7=t(25773),ne=t(63352);let nn=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)(e7.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(e8.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(ne.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)(er.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},nt=(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 e4(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)(eU.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)(nn,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},ni=(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 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===(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)(eU.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)(nn,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nr=(0,eI.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eI.G)(ni);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eI.G)(nt);return(0,i.jsx)(t,{...e,ref:n})}});function nl(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?eG.$kI:eG.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let ns=(0,eI.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)(nl,{name:t,...n}),width:"auto",renderCell:e5});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=ez().findIndex(e.columns,e=>e.name===n);i<0||t.push(l(i,n))}),e.columns.forEach((e,n)=>{r.includes(e.name)||t.push(l(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,l,s]);if(0===u.columns.length)return(0,i.jsx)(eU.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)(e8.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.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)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function no(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 na=t(68844),nc=t.n(na);let nd=(0,eI.G)(function(e,n){let{run:t}=e;function r(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let l=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=l[e],t=nc()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nc()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,r="No Change";return null!==t&&null!==i?r=t!==i?no(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)(eU.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)(eZ,{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)(eX,{})},className:"rdg-light",enableScreenshot:!0})})})});var nu=t(32088),nh=t(96124);let nx="#63B3ED";function nm(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),r=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([r]).map((n,t)=>{let l;let s=t===i.length,o=s?r:i[t],a=!1;return s?(l="(others)",a=!0):null==n?(l="(null)",a=!0):"string"==typeof n&&0===n.length?(l="(empty)",a=!0):l=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:l,count:o,displayCount:eL(o),displayRatio:eA(o/e.valids)||"N/A"}})}function np(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nu.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(et.x,{children:[(0,i.jsx)(eW,{color:eN}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(et.x,{children:[(0,i.jsx)(eW,{color:eq}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nf(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=nm(n.current,t),s=nm(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)(et.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eq})," Base"]}),(0,i.jsxs)(et.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eN})," 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)(np,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(et.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)(ng,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eN}),(0,i.jsx)(et.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(et.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(ng,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eq}),(0,i.jsx)(et.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(et.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nh.i,{})]},t)})]})}function ng(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nx}=e;eO.kL.register(eO.uw,eO.ZL,eO.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=nx}=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 nv=(0,eI.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)(eJ,{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)(nf,{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"})})]})}),nj=(0,eI.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 e6(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)(eU.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)(nn,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var ny=t(93960),nb=t(66011);function nk(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}=eT(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)(e7.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Model"}),(0,i.jsx)(ny.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Primary key"}),(0,i.jsx)(nb.Z,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Columns"}),(0,i.jsx)(ne.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nb.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 nw=t(49801),nC=t(50104),n_=t(39171),nS=t(39226),nz=t(70949),nR=t(34510);function nT(e){let{params:n,column:t}=e,{runAction:l}=nq(),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)(nw.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nS.q,{lineHeight:"20px",children:(0,i.jsxs)(nz.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nR.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nE=(0,eI.G)(function(e,n){let{run:t}=e,l=t.result,a=t.params,c=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},d=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(eU.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:eG.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nT,{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)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:l.data.data,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nD=t(18502),nI=t(63594);let nO={lineage_diff:{title:"Lineage Diff",icon:ek.Ks7},schema_diff:{title:"Schema Diff",icon:nI.C8A},query:{title:"Query",icon:ek.r2i,RunResultView:ns},query_base:{title:"Query Base",icon:ek.r2i,RunResultView:ns},query_diff:{title:"Query Diff",icon:ek.r2i,RunResultView:nr},row_count_diff:{title:"Row Count Diff",icon:nI.QUK,RunResultView:nd},profile_diff:{title:"Profile Diff",icon:ek.KA6,RunResultView:e3},value_diff:{title:"Value Diff",icon:ek.pRi,RunResultView:nE,RunForm:nk},value_diff_detail:{title:"Value Diff Detail",icon:ek.pRi,RunResultView:nj,RunForm:nk},top_k_diff:{title:"Top-K Diff",icon:nD.Pkc,RunResultView:nv,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.map(e=>e.name);return((0,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)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(e_.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:c.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:ek.dku,RunResultView:eB,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.filter(e=>!eE(e.type)&&!eD(e.type));return o?(0,i.jsx)(r.xu,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(e_.P,{placeholder:0!==c.length?"Select column":"No numeric column is available",isDisabled:0===c.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let r=e.target.value;l(!!r);let s=(null===(i=c.find(e=>e.name===r))||void 0===i?void 0:i.type)||"";t({...n,column_name:r,column_type:s})},children:c.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}}},nM=e=>nO[e],nA=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nL=e=>{let[n]=(0,eb.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nN(e){var n;let{children:t}=e,[r,l]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ey.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),p=(0,X.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eb.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:W.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 eu(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))l({session:r,title:a,type:e,params:n,lastRun:i,options:t,RunForm:d}),o();else{let{run_id:t}=await eo(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:W.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]);nL(a);let _=async(e,n)=>{try{a();let{run_id:t}=await eo(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)(nA.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[r&&(0,i.jsx)(ej,{isOpen:s,onClose:a,onExecute:_,title:r.title,type:r.type,params:r.params,initialRun:r.lastRun,RunForm:(null===(n=r.options)||void 0===n?void 0:n.showForm)&&r.RunForm?r.RunForm:void 0},r.session),t]})}let nq=()=>(0,j.useContext)(nA);function nF(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ep,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nN,{children:n})})})})})}var nP=t(81600);async function nW(){return(await B.post("/api/checks",{type:"simple"})).data}async function nH(e,n){return(await B.post("/api/checks",{run_id:e,view_options:n})).data}async function nV(){return(await B.get("/api/checks")).data}async function nK(e){return(await B.get("/api/checks/".concat(e))).data}async function nJ(e,n){return(await B.patch("/api/checks/".concat(e),n)).data}async function nB(e){return(await B.delete("/api/checks/".concat(e))).data}async function nU(e){return await B.post("/api/checks/reorder",e)}var nQ=t(94734),nZ=t(71738),nX=t(38414),nG=t(29598),nY=t(62216),n$=t(42675),n0=t(20074),n1=t(54097),n2=t(95862),n5=t(82960),n4=t(69879),n3=t(618),n9=t(77153);function n6(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)(n4.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n9.X,{color:"gray.500"}),children:[(0,i.jsx)(n3.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(n3.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(ny.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 n8=t(94019);t(81974);var n7=t(78439);function te(e){let{model:n,name:t,baseType:l,currentType:a}=e,{runAction:c}=nq(),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)(nw.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(n7.h,{children:(0,i.jsx)(nS.q,{lineHeight:"20px",children:(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eE(d)&&!eD(d)),children:"Histogram Diff"}),(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tn(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)(te,{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 tt=t(89725),ti=t(13965);let tr=(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(eY(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)?tn(e,(null==s?void 0:s.name)||(null==l?void 0:l.name)):tn(e)},[l,s]),{lineageGraph:u}=ef(),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)(tt.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(ti.z,{}),t]}):r?(0,i.jsxs)(tt.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(ti.z,{}),r]}):(0,i.jsx)(i.Fragment,{}),d.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:d,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tl(e){return(await B.post("/api/select",e)).data}var ts=t(12282);t(15080);let to=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(ts.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},ta=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(ts.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var tc=t(79898),td=t(68630),tu=t(91363);let th=eG.Nbv,tx=eG.sFB,tm=eG.UGs;function tp(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:th}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tx}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tm}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tf(e){if("model"===e)return{color:"#c0eafd",icon:td.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tu._MV};if("source"===e)return{color:"#a6dda6",icon:td.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tu.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tu.R1C};if("seed"===e)return{color:"#a6dda6",icon:td.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:td.Dmm};else return{color:"inherit",icon:void 0}}function tg(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}=tf(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nM("schema_diff"))||void 0===m?void 0:m.icon,t=tp("modified").color}else!h&&x?(n=tp("added").icon,t=tp("added").color):h&&!x&&(n=tp("removed").icon,t=tp("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})]})},tj=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:r}=ef(),l=t.params,s=[...W.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,y.a)({queryKey:s,queryFn:async()=>tl({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;tg(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)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tv,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var ty=t(51643);function tb(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)(ty.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)(er.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(et.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tk=t(40902);function tw(){let e=(0,X.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 tC(){let e=(0,nP._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tC=function(){return e},e}function t_(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tS(e){return e.description?e.description:"_(no description)_"}var tz=t(23256),tR=t(31265);let tT=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)(et.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(r||l)&&(0,i.jsx)(er.z,{size:"sm",variant:"outline",onClick:r||l,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tu.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tR.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}})]})},tE=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)(tz.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tT,{label:"Base",value:t||"",onChange:l,onRunBase:a,options:d,...u})}),(0,i.jsx)(tz.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tT,{label:"Current",value:n,onChange:r,onRun:s,options:d,...u})})]})})};var tD=t(23567),tI=t(20085);let tO=(0,eI.G)((e,n)=>{var t,l,s,a;let{isRunning:c,isAborting:d,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(l=h.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tt.b,{status:"error",children:[(0,i.jsx)(ti.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)(eU.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(e7.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)(tD.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tD.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)(eU.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)(tI.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),tA=t(29012),tL=t(25783),tN=t(49110),tq=t(55415),tF=t(24432);t(90548),t(91074);var tP=t(48289),tW=t(66633),tH=t(83143),tV=t(29937);function tK(e){let{node:n}=e,{icon:t}=tf(n.resourceType);return(0,i.jsx)(nu.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nQ.Vp,{children:[(0,i.jsx)(nQ.AD,{as:t}),(0,i.jsx)(nQ.Sn,{children:n.resourceType})]})})}function tJ(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)(et.x,{children:l}),(0,i.jsx)(s.J,{as:tH.Rgz}),(0,i.jsx)(et.x,{children:o})]}):t===r?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(et.x,{children:o}),(0,i.jsx)(s.J,{as:tV.lxc,color:"gray.500"}),(0,i.jsx)(et.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nu.u,{label:l,children:(0,i.jsxs)(nQ.Vp,{children:[(0,i.jsx)(nQ.AD,{as:x}),(0,i.jsx)(nQ.Sn,{children:m||c?(0,i.jsx)(tW.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tJ,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nQ.bq,{as:n_.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n$.n,{}),size:"xs",onClick:a})]})})}let tU=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tD.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsx)(nQ.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)(nu.u,{label:s,children:(0,i.jsx)(tP.s,{})})]})});if(!a)return(0,i.jsx)(tD.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)(tD.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tD.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)(nu.u,{label:c,children:(0,i.jsx)(e8.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nQ.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(nQ.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)(tB,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tQ=(0,j.createContext)(void 0),tZ=()=>{let e=(0,j.useContext)(tQ);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},tX=e=>{var n,t,l,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ef(),m=null==x?void 0:x[u],p=null==h?void 0:h.nodes[u];if(!m&&!p)return(0,i.jsx)(i.Fragment,{});if((null==p?void 0:p.data.base)&&(null==p?void 0:p.data.current)&&(c=tg(null===(l=p.data.base)||void 0===l?void 0:l.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nu.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=nM("schema_diff"))||void 0===n?void 0:n.icon,color:c?tp("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nu.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=nM("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tp("modified").color:"lightgray"})})})]})},tG=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:td.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:td.hGI})})};var tY=t(13358),t$=t(15196),t0=t(28023),t1=t(84963);function t2(e){let{base:n,current:t}=e;return(0,i.jsx)(tR.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 t5(e){return(await B.post("/api/checks",{type:"schema_diff",params:e})).data}function t4(e){var n,t,l,a,d,f,g;let{node:v,onCloseNode:y}=e,[,b]=(0,eb.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,ey.q)(),{runAction:T}=nq(),{envInfo:E}=ef(),{primaryKey:D}=eT(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 t5({node_id:e});b("/checks/".concat(n.check_id))},[v,b]),M="added"===v.changeStatus||"removed"===v.changeStatus;return(0,i.jsxs)(t$.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)(nw.v,{children:[(0,i.jsx)(nC.j,{as:er.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsx)(nR.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)),w(void 0!==D?[D]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(t0.R,{}),(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsx)(nR.s,{onClick:z,icon:(0,i.jsx)(td.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nM("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>I(),children:"Row Count Diff"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nM("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)(t0.R,{}),(0,i.jsx)(nz.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nM("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)(t1.P,{onClick:y})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(tK,{node:v}),("model"===v.resourceType||"snapshot"===v.resourceType||"seed"===v.resourceType)&&(0,i.jsx)(tB,{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)(nZ.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nX.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tr,{base:v.data.base,current:v.data.current})})})]}),(0,i.jsxs)(G.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ee.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.f,{children:(0,i.jsx)(t2,{base:v.data.base,current:v.data.current})})]})]})]})}function t3(e){var n,t;let{onClose:l}=e,{cancel:s,actionState:o}=tZ();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)(tL.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)(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:l,children:"Close"})})]})})}var t9=t(27547),t6=t(35052),t8=t(57489),t7=t(39588);function ie(e){t8.j("[Web] multi_nodes_action",e)}function it(e){t8.j("[Web] history_action",e)}let ii=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nq();return(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eG.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(it({name:"hide"}),t()):(it({name:"show"}),n())},children:e?"Hide":"Show"})},ir=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r,selectMode:l}=tZ(),o=t.view_mode||"changed_models",a=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nw.v,{children:[(0,i.jsx)(nC.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tf("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nS.q,{title:"packages",children:[(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},il=e=>{var n,t;let{isDisabled:r}=e,{lineageGraph:l}=ef(),{viewOptions:o,onViewOptionsChanged:a}=tZ(),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)(nw.v,{closeOnSelect:!1,children:[(0,i.jsx)(nC.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tH.zFh}),size:"xs",variant:"outline",isDisabled:r,children:m}),(0,i.jsx)(nS.q,{title:"packages",children:(0,i.jsxs)(nz.k,{title:"Select Packages",children:[(0,i.jsx)(nR.s,{as:ne.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)(t0.R,{}),Array.from(c).map(e=>(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},is=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)(ny.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)})},io=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tZ();return(0,i.jsx)(is,{isDisabled:n,value:t.select||"",onChange:e=>{r({...t,select:e||void 0})}})},ia=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tZ();return(0,i.jsx)(is,{isDisabled:n,value:t.exclude||"",onChange:e=>{r({...t,exclude:e||void 0})}})},ic=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]}),id=()=>{var e,n,t,r;let{nodes:l,deselect:o,selectMode:a,...c}=tZ(),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)(ic,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(ii,{})}),(0,i.jsx)(ic,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(ir,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(il,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(io,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ia,{isDisabled:f})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ic,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(et.x,{fontSize:"9pt",color:"gray.500",children:d.length>1?"".concat(d.length," nodes selected"):"".concat(d.length," node selected")})}),(0,i.jsx)(ic,{label:"",children:(0,i.jsx)(er.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),(0,i.jsx)(ic,{label:"Explore",children:(0,i.jsx)(t9.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nw.v,{placement:"bottom-end",children:[(0,i.jsx)(nC.j,{as:er.z,size:"xs",rightIcon:(0,i.jsx)(t6.v,{}),children:"Actions"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),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)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),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)(t0.R,{}),(0,i.jsxs)(nz.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||m&&d.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)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),icon:(0,i.jsx)(s.J,{as:null===(r=nM("schema_diff"))||void 0===r?void 0:r.icon}),onClick:()=>{c.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};var iu=t(81737),ih=t.n(iu),ix=t(77249),im=t(50228),ip=t(67605),ig=t.n(ip);let iv="ignore-screenshot";function ij(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,ey.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)(G.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Screenshot Preview"}),(0,i.jsx)(ev.o,{}),(0,i.jsxs)(en.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)(tP.s,{color:"red.600"}),(0,i.jsx)(et.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(et.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(ei.m,{children:[(0,i.jsx)(er.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,im.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");ig()(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 ih()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,ix.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 iy(e){let{successToast:n,failToast:t}=tw(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=ij({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)(er.z,{size:"sm",leftIcon:(0,i.jsx)(n0.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 ib(e){return(await B.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function ik(){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}=tp(n);return(0,i.jsx)(nu.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 iw=t(11978);let iC={mode:"per_node",status:"pending",completed:0,total:0},i_=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:r}=n,l=(0,j.useRef)({...iC}).current,{showRunId:s}=nq(),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 eo(n,u,{nowait:!0});for(s(e),l.currentRun={run_id:e},l.total=1;;){let n=await ea(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 eo(n,e,{nowait:!0});for(l.currentRun={run_id:r},t.action={mode:o,status:"running"},i(t);;){let e=await ea(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 ec(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 ib({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await t5({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await t5({node_id:t})}return n},cancel:c,reset:()=>{Object.assign(l,iC)}}};var iS=t(65475),iz=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ey.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)(iS.a,{size:"xl",isOpen:e,leastDestructiveRef:d,onClose:h,children:(0,i.jsx)(Y.Z,{children:(0,i.jsxs)(iS._,{children:[(0,i.jsxs)(ee.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",l," nodes"]}),(0,i.jsx)(en.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)(ei.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 iR={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}=tf(d),[f,g]=(0,j.useState)(!1),{selectNodeMulti:v,selectMode:y}=tZ(),{icon:b,color:k,backgroundColor:w}=x?tp(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},C="solid";l.isSelected;let _=null==l?void 0:l.name;return(0,i.jsx)(nu.u,{label:"model"===d?_:"".concat(_," (").concat(d,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:k,borderWidth:1,borderStyle:C,backgroundColor:m?"multi"===y?c?k:"white":"action_result"!==y?c?w:"white":l.action?c?w:k:"white":c?k:w,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===y?(null==l?void 0:l.action)?"none":"opacity(0.2) grayscale(50%)":a?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:k,padding:2,borderRightWidth:1,borderColor:"multi"===y?"#00000020":k,borderStyle:C,alignItems:"top",visibility:m?"inherit":"hidden",children:(0,i.jsx)(tG,{checked:"multi"===y&&c||"action_result"===y&&!!l.action,onClick:e=>{"action_result"!==y&&(e.stopPropagation(),v(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"===y?c?"white":"inherit":"action_result"===y&&l.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:_}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===y?c?"white":"inherit":"action_result"===y&&l.action&&!c?"white":"inherit",as:p}),b&&(0,i.jsx)(s.J,{color:"multi"===y?c?"white":k:"action_result"===y?l.action&&!c?"white":"inherit":k,as:b})]}),(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:[!l.isActionMode&&"model"===l.resourceType&&(0,i.jsx)(tX,{id:l.id}),(0,i.jsx)(h.L,{}),l.isActionMode&&(l.action?(0,i.jsx)(tU,{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})]})})}},iT={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=tp(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}})})}},iE=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tp(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iD=(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])},iI=()=>{let[,e]=(0,eb.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},iO=(0,j.forwardRef)(function(e,n){var t;let{...l}=e,a=(0,R._K)(),c=(0,j.useRef)(null),{successToast:d,failToast:h}=tw(),{copyToClipboard:x,ImageDownloadModal:m,ref:p}=ij({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iv))},onSuccess:()=>{d("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),h("Failed to copy image to clipboard",e)}}),[f,g,v]=(0,R.Rr)([]),[y,b,k]=(0,R.ll)([]),[w,C]=(0,j.useState)({view_mode:"changed_models",...l.viewOptions}),{lineageGraph:_,retchLineageGraph:S,isLoading:z,error:T,refetchRunsAggregated:E}=ef(),{showRunId:D,closeRunResult:W,runAction:H}=nq();(0,j.useImperativeHandle)(n,()=>({copyToClipboard:x}));let V=w.view_mode||l.viewMode||"changed_models",[K,J]=(0,j.useState)("single"),B=(0,j.useMemo)(()=>{var e;if("single"===K)return null===(e=f.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[K,f]),U=(0,j.useMemo)(()=>f.filter(e=>e.data.isSelected).map(e=>e.data),[f]),Q=(0,j.useMemo)(()=>f.map(e=>e.data),[f]),[Z,G]=(0,j.useState)(!1),[Y,$]=(0,j.useState)({x:0,y:0}),ee=(0,X.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!_)return;if(w.node_ids)e=w.node_ids;else{var n;let t=null===(n=_.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:w.view_mode,packages:t?[t]:void 0,...l.viewOptions};C(i),e=(await tl({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=M(_,e);A(t,i),g(t),b(i)})()},[_]);let en=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=a.getZoom();a.setCenter(n,t,{zoom:i,duration:200})}},ei=iI();iD(c,async()=>{if("single"===K||"action_result"===K){let e=f.find(e=>e.data.isSelected);e?en(e):a.fitView({nodes:f,duration:200})}});let el=(0,j.useCallback)(e=>{g(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[g]),es=async e=>{let n;if(!_)return;try{n=(await tl({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof iw.d7){var t,i;ee({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]=M(_,n);A(r,l),g(r),b(l),C(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{a.fitView({nodes:r,duration:200})})()},eo=i_("multi"===K?U:Q,{onActionStarted:()=>{J("action_result")},onActionNodeUpdated:el,onActionCompleted:()=>{}}),ea=iz();if(z)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tA.$,{size:"xl"})});let ec=()=>{G(!1),$({x:0,y:0})};if(T)return(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsxs)(e7.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: ",T,"]"]}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{S&&S()},children:"Retry"})]})});if("changed_models"===V&&!(null==_?void 0:null===(t=_.modifiedSet)||void 0===t?void 0:t.length))return(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsxs)(e7.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{es({...w,view_mode:"all"})},children:"Show all nodes"})]})});let ed=()=>{J("single"),g(P(f)),W(),null==E||E()},eu={selectMode:K,nodes:f,viewOptions:w,onViewOptionsChanged:es,selectNodeMulti:e=>{if("multi"!==K){if(!_)return;let[n,t]=L(Array.from(O(_,_.modifiedSet)),f,y);g(n=N(e,n=P(n,!0))),b(t),J("multi"),eo.reset()}else{let n=q(e,f);n.find(e=>e.data.isSelected)||(J("single"),n=P(n)),g(n)}},deselect:ed,runRowCountDiff:async()=>{"multi"===K?(await eo.runRowCountDiff(),ie({type:"row_count_diff",selected:"multi"})):B?(await H("row_count_diff",{node_names:[B.name]},{showForm:!1,showLast:!1}),ie({type:"row_count_diff",selected:"single"})):(await H("row_count_diff",{select:w.select,exclude:w.exclude,packages:w.packages,view_mode:w.view_mode}),ie({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(B)await H("value_diff",{model:B.name},{showForm:!0,showLast:!1}),ie({type:"value_diff",selected:"single"});else{let e="multi"===K?U.length:Q.length;await ea.confirm(e)&&(await eo.runValueDiff(),ie({type:"value_diff",selected:"multi"===K?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===K?(e=await eo.addLineageDiffCheck(),ed(),ie({type:"lineage_diff",selected:"multi"})):B||(e=await ib(w),ie({type:"lineage_diff",selected:"none"})),e&&ei(e)},addSchemaDiffCheck:async()=>{let e;"multi"===K?U.length>0&&(e=await eo.addSchemaDiffCheck(),ed(),ie({type:"schema_diff",selected:"multi"})):B?(e=await t5({node_id:B.id}),ie({type:"schema_diff",selected:"single"})):(e=await t5({select:w.select,exclude:w.exclude,packages:w.packages,view_mode:w.view_mode}),ie({type:"schema_diff",selected:"none"})),e&&ei(e)},cancel:eo.cancel,actionState:eo.actionState};return(0,i.jsxs)(tQ.Provider,{value:eu,children:[(0,i.jsxs)(to,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(e7.g,{ref:c,divider:(0,i.jsx)(tL.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[l.interactive&&(0,i.jsx)(id,{}),(0,i.jsxs)(R.x$,{nodeTypes:iR,edgeTypes:iT,nodes:f,edges:y,onNodesChange:v,onEdgesChange:k,onNodeClick:(e,n)=>{if(!1!==l.interactive){if(ec(),"single"===K)B||en(n),g(N(n.id,f));else if("action_result"===K){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)&&D(null===(s=n.data.action)||void 0===s?void 0:null===(r=s.run)||void 0===r?void 0:r.run_id),en(n),g(N(n.id,f))}else{let e=q(n.id,f);e.find(e=>e.data.isSelected)||(J("single"),e=P(e)),g(e)}}},onNodeMouseEnter:(e,n)=>{if(!_||"single"!==K)return;let[t,i]=L(Array.from(function(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}(I(_,[n.id]),O(_,[n.id]))),f,y);g(t),b(i)},onNodeMouseLeave:(e,n)=>{if(!_)return;let[t,i]=L(Array.from(O(_,_.modifiedSet)),f,y);g(t),b(i)},onNodeContextMenu:(e,n)=>{"multi"===K&&(e.preventDefault(),$({x:e.clientX,y:e.clientY,selectedNode:n}),G(!0))},onClick:ec,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:l.interactive,ref:p,children:[(0,i.jsx)(tN.A,{color:"#ccc"}),(0,i.jsx)(tq.Z,{showInteractive:!1,position:"top-right",className:iv,children:(0,i.jsx)(tq.B,{title:"copy image",onClick:async()=>{x()},children:(0,i.jsx)(s.J,{as:tH.C3L})})}),(0,i.jsx)(m,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(ik,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(et.x,{fontSize:"xl",color:"grey",opacity:.5,children:f.length>0?"":"No nodes"})}),(0,i.jsx)(tF.a,{nodeColor:iE,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===K&&(0,i.jsx)(R.s_,{position:"bottom-center",className:iv,children:(0,i.jsx)(t3,{onClose:()=>{ed()}})})]})]}),"single"===K&&B?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(t4,{node:B,onCloseNode:()=>{g(P(f))}})}):(0,i.jsx)(r.xu,{})]}),Z&&(0,i.jsx)(nw.v,{isOpen:!0,onClose:ec,children:(0,i.jsxs)(nS.q,{style:{position:"absolute",left:"".concat(Y.x,"px"),top:"".concat(Y.y,"px")},children:[(0,i.jsx)(nR.s,{icon:(0,i.jsx)(tY.Cv2,{}),onClick:()=>{let e=Y.selectedNode;"multi"===K&&void 0!==e&&void 0!==_&&g(F([...I(_,[e.id])],f))},children:"Select parent nodes"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(tY.IMj,{}),onClick:()=>{let e=Y.selectedNode;"multi"===K&&void 0!==e&&void 0!==_&&g(F([...O(_,[e.id])],f))},children:"Select child nodes"})]})}),ea.AlertDialog]})}),iM=(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)(iO,{viewOptions:r,interactive:!1,ref:n})})})});var iA=t(19339);function iL(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=iA.ZP.stringify({checks:[o]});return(0,i.jsx)(tR.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 iN=e=>{var n;let[t,i]=(0,j.useState)(!1),[r,l]=(0,j.useState)(!1),[,s]=eg(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ea(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 ec(e)},[e,l]),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:r,error:o,onCancel:c,RunResultView:d}};function iq(){let e=(0,X.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function iF(){let e=(0,nP._)(["\n
","\n\n ","\n\n
"]);return iF=function(){return e},e}let iP=e=>{var n,t,l,a,d,f,g;let{checkId:v}=e,k=(0,b.NL)(),[,w]=(0,eb.TH)(),{successToast:C,failToast:_}=tw(),{markedAsApprovedToast:S}=iq(),[z,R]=(0,j.useState)(),[T,E]=(0,j.useState)(),[D,I]=(0,j.useState)(!1),{isOpen:O,onOpen:M,onClose:A}=(0,ey.q)(),L=()=>(0,i.jsx)(Y.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[N,q]=(0,j.useState)((0,i.jsx)(L,{})),{isLoading:F,error:P,data:H}=(0,y.a)({queryKey:W.check(v),queryFn:async()=>nK(v),refetchOnMount:!0}),V=z||(null==H?void 0:null===(n=H.last_run)||void 0===n?void 0:n.run_id),{run:K,error:J}=iN(V),B=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==H?void 0:H.type)?nM(null==H?void 0:H.type):void 0,Q=(null==H?void 0:H.is_preset)||!1,Z=(0,j.useRef)(null),{mutate:X}=(0,n8.D)({mutationFn:e=>nJ(v,e),onSuccess:()=>{k.invalidateQueries({queryKey:W.check(v)}),k.invalidateQueries({queryKey:W.checks()})}}),{mutate:et}=(0,n8.D)({mutationFn:()=>nB(v),onSuccess:()=>{k.invalidateQueries({queryKey:W.checks()}),w("/checks")}}),ei=(0,j.useCallback)(async()=>{(null==H?void 0:H.type)&&R((await ed(v,{nowait:!0})).run_id)},[H,v,R]),el=(0,j.useCallback)(async()=>{if(I(!0),V)return await ec(V)},[V]),es=async()=>{if(!H)return;let e=(0,tk.RI)(iF(),t_(H),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tS(e),"\n\n").concat((0,tk.Pn)(tC(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tS(e)}(H));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==H?void 0:H.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==H?void 0:H.is_checked,X,S]),[ea,eu]=(0,j.useState)(0),{ref:eh,onCopyToClipboard:ex,onMouseEnter:em,onMouseLeave:ep}=iy();if(F)return(0,i.jsx)(eU.M,{h:"100%",children:"Loading"});if(P)return(0,i.jsxs)(eU.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)(ta,{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)(n6,{name:(null==H?void 0:H.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Q&&(0,i.jsx)(nu.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nQ.Vp,{size:"sm",children:[(0,i.jsx)(nQ.AD,{boxSize:"14px",as:n2.bX4}),"Preset"]})}),(0,i.jsxs)(nw.v,{children:[(0,i.jsx)(nC.j,{isRound:!0,as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"ghost"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsx)(nR.s,{icon:(0,i.jsx)(n5.ovA,{}),onClick:()=>{q((0,i.jsx)(L,{})),M()},children:"Get Preset Check Template"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(nY.p,{}),onClick:()=>et(),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)(nu.u,{label:"Rerun",children:(0,i.jsx)(n_.h,{isRound:!0,isLoading:B,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n$.n,{}),onClick:()=>ei()})}),(0,i.jsx)(nu.u,{label:"Copy markdown",children:(0,i.jsx)(n_.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(n0.T,{}),onClick:()=>es()})}),(0,i.jsx)(nu.u,{label:(null==H?void 0:H.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(er.z,{size:"sm",colorScheme:(null==H?void 0:H.is_checked)?"green":"gray",variant:(null==H?void 0:H.is_checked)?"solid":"outline",leftIcon:(0,i.jsx)(n1.r,{color:(null==H?void 0:H.is_checked)?"inherit":"green"}),onClick:()=>eo(),children:(null==H?void 0:H.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tb,{value:null==H?void 0:H.description,onChange:e=>{X({description:e})}},null==H?void 0:H.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:eu,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.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)(n0.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==H?void 0:H.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==H?void 0:H.type)==="lineage_diff"){var e;null===(e=Z.current)||void 0===e||e.copyToClipboard()}else ex()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(nZ.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nX.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==H?void 0:H.last_run)||V?(0,i.jsx)(tO,{ref:eh,isRunning:B,isAborting:D,run:V?K:null==H?void 0:H.last_run,error:J,progress:T,RunResultView:U.RunResultView,viewOptions:null==H?void 0:H.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:el,onExecuteRun:ei}):(0,i.jsx)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(er.z,{onClick:ei,colorScheme:"blue",size:"sm",children:"Run Query"})})),H&&"schema_diff"===H.type&&(0,i.jsx)(tj,{check:H,ref:eh}),H&&"lineage_diff"===H.type&&(0,i.jsx)(iM,{check:H,ref:Z})]}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff"||(null==H?void 0:H.type)==="query_base")&&(0,i.jsx)(nX.x,{p:0,height:"100%",width:"100%",children:(null===(t=H.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tE,{value:(null==H?void 0:null===(l=H.params)||void 0===l?void 0:l.sql_template)||"",baseValue:(null==H?void 0:null===(a=H.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tT,{value:(null==H?void 0:null===(d=H.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(G.u_,{isOpen:O,onClose:A,isCentered:!0,size:"6xl",children:[N,(0,i.jsxs)($.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ee.x,{children:"Preset Check Template"}),(0,i.jsx)(ev.o,{}),(0,i.jsxs)(en.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(nG.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)(iL,{name:(null==H?void 0:H.name)||"",description:(null==H?void 0:H.description)||"",type:(null==H?void 0:H.type)||"",params:null==H?void 0:H.params,viewOptions:null==H?void 0:H.view_options})]})]})]})]})};var iW=t(53924);let iH=e=>{var n;let{check:t,selected:l,onSelect:a,onMarkAsApproved:c}=e,d=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,n8.D)({mutationFn:e=>nJ(u,e),onSuccess:()=>{d.invalidateQueries({queryKey:W.check(u)}),d.invalidateQueries({queryKey:W.checks()})}}),x=(null===(n=nM(t.type))||void 0===n?void 0:n.icon)||ek.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)(nu.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(ne.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()}})})})]})})},iV=e=>{let{checks:n,selectedItem:t,onCheckSelected:l,onChecksReordered:s}=e,[a,c]=(0,j.useState)(!1),d=(0,b.NL)(),{mutate:u}=(0,n8.D)({mutationFn:e=>nJ(e,{is_checked:!0}),onSuccess:(e,n)=>{d.invalidateQueries({queryKey:W.check(n)}),d.invalidateQueries({queryKey:W.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),{markedAsApprovedToast:p}=iq(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iW.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(iW.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(e7.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iW._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)(iH,{check:e,selected:e.check_id===t,onSelect:l,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(G.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{width:"400px",children:[(0,i.jsx)(ee.x,{children:"Mark as Approved?"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(nh.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)(ne.X,{isChecked:a,onChange:e=>c(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nh.i,{}),(0,i.jsxs)(ei.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 iK(){let e=(0,nP._)(["\n
","\n\n ","\n\n
"]);return iK=function(){return e},e}let iJ=()=>{let[,e]=(0,eb.TH)(),[,n]=(0,eb.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=tw(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:W.checks(),queryFn:nV,refetchOnMount:!0}),h=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,j.useState)(d||[]),{mutate:p}=(0,n8.D)({mutationFn:e=>nU(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.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 nW();t.invalidateQueries({queryKey:W.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)(to,{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)(e7.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nu.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(n_.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tk.RI)(iK(),t_(e),tS(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)(n0.T,{})})}),(0,i.jsx)(nh.i,{}),(0,i.jsx)(iV,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(eb.rs,{children:(0,i.jsx)(eb.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iP,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};var iB=t(25356);async function iU(e,n){return await eo("query",e,n)}async function iQ(e,n){return await eo("query_base",e,n)}async function iZ(e,n){return await eo("query_diff",e,n)}var iX=t(67619),iG=t(58565),iY=t(49468);let i$=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)(iX.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nw.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(nC.j,{width:"100%",children:(0,i.jsx)(ny.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)(n7.h,{children:(0,i.jsxs)(nS.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nz.k,{children:(0,i.jsxs)(iG.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[s.map((n,t)=>(0,i.jsx)(iG.U,{children:(0,i.jsxs)(nQ.Vp,{size:e.size,children:[(0,i.jsx)(nQ.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(nQ.SD,{paddingRight:"8px",onClick:()=>{o(s.filter(e=>e!==n)),l(s.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iG.U,{width:"100%",children:(0,i.jsx)(ny.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)(t0.R,{}),(0,i.jsxs)(nz.k,{children:[""!==a&&!(null==r?void 0:r.includes(a))&&(0,i.jsxs)(nR.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)(nR.s,{onClick:()=>x(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(iY.x,{children:(0,i.jsx)(er.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===s.length,onClick:()=>{c(""),o([]),l([])},children:"Clear"})})]})},i0=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=ef(),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)(ew.NI,{m:"4px 8px",children:[(0,i.jsxs)(eC.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nu.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",children:(0,i.jsx)(tP.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(i$,{unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name..."})]})})},i1=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nq();return(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eG.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(it({name:"hide"}),t()):(it({name:"show"}),n())},children:e?"Hide":"Show"})]})},i2=()=>{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)(nu.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tP.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iB.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&l&&l(t),n(!e)}})]})},i5=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:l,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=ef(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nq(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iU;case"query_base":return iQ;case"query_diff":return iZ;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 ea(l)},{mutate:p,isPending:f}=(0,n8.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)(i1,{}),(0,i.jsx)(i2,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(i0,{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)(r.xu,{width:"100%",flex:"1",children:c?(0,i.jsx)(tE,{value:u,baseValue:n,onChange:t,onChangeBase:l,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tT,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var i4=t(30148);let i3=e=>(0,i4.c4)("#!"+e),i9=()=>[(0,i4.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),i3];var i6=t(24681),i8=t(62843);let i7=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ea(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)(tO,{isPending:r,error:l,run:s,RunResultView:o})},re=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(eU.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)(er.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},rn=e=>{let{children:n}=e;return(0,i.jsx)(tI.SV,{fallback:re,children:n})};async function rt(){return(await B.post("/api/export")).data}async function ri(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await B.post("/api/import",t)).data}async function rr(){return 208===(await B.get("/api/sync")).status}async function rl(e){try{let n=await B.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,iw.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var rs=t(16021);function ro(){let e=(0,X.p)(),n=async()=>{try{let e=await rt(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,im.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");ig()(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)(nu.u,{label:"Export",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:rs.tRY,boxSize:"1.2em"})})})}function ra(e){let{checksOnly:n}=e,t=(0,X.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,ey.q)(),[m,p]=(0,eb.TH)(),[,f]=eg(),g=(0,j.useCallback)(async()=>{if(c){try{let{runs:e,checks:i}=await ri(c,n);f(),await r.invalidateQueries({queryKey:W.checks()}),await r.invalidateQueries({queryKey:W.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)(nu.u,{label:"Import",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{l.current&&l.current.click()},icon:(0,i.jsx)(s.J,{as:rs.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)(iS.a,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(Y.Z,{children:(0,i.jsxs)(iS._,{children:[(0,i.jsx)(ee.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(en.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)(tP.s,{color:"red.600"}),(0,i.jsx)(et.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(et.x,{children:["The current ",v," will be"," ",(0,i.jsx)(et.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(ei.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 rc=t(93126),rd=t(1026),ru=t(13154),rh=t(99434),rx=t(20143),rm=t(89830),rp=t(13276),rf=t(31610);function rg(e){let n=(0,rf.D)(e);return(0,im.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function rv(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)(tc.HC,{ml:"10px",children:[n,": ",t]},n)})}function rj(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ef(),{isOpen:m,onOpen:p,onClose:f}=(0,ey.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,k=(null==y?void 0:y.generated_at)?rg(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?rg(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)(nu.u,{label:"Environment Info",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n5.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(G.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Environment Information"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.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)(tc.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tc.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&rv(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)(tc.QI,{spacing:1,children:g&&rv(g)})]})}),(0,i.jsx)(nh.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)(rc.x,{children:(0,i.jsxs)(rd.i,{variant:"simple",children:[(0,i.jsx)(ru.h,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rx.Th,{}),(0,i.jsx)(rx.Th,{children:"base"}),(0,i.jsx)(rx.Th,{children:"current"})]})}),(0,i.jsxs)(rm.p,{children:[(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"schema"}),(0,i.jsx)(rp.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(rp.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"version"}),(0,i.jsx)(rp.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(rp.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"timestamp"}),(0,i.jsx)(rp.Td,{children:k}),(0,i.jsx)(rp.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)(rc.x,{children:(0,i.jsxs)(rd.i,{variant:"simple",children:[(0,i.jsx)(ru.h,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rx.Th,{}),(0,i.jsx)(rx.Th,{children:"base"}),(0,i.jsx)(rx.Th,{children:"current"})]})}),(0,i.jsx)(rm.p,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"Environment"}),(0,i.jsx)(rp.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(rp.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var ry=t(21166),rb=t(43399),rk=t(60057);function rw(){return(0,i.jsx)(nu.u,{label:"Syncing",children:(0,i.jsx)(er.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tA.$,{})})})}function rC(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[l,o]=(0,eb.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ey.q)(),[u,h]=(0,j.useState)(""),x=(0,X.p)(),m=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await rl(e)).status){c(),n(!1);return}for(;await rr();)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:W.lineage()}),t.invalidateQueries({queryKey:W.checks()}),t.invalidateQueries({queryKey:W.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)(rw,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nu.u,{label:"Sync with Cloud",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:rs.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(G.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(en.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)(ry.E,{onChange:h,value:u,children:(0,i.jsxs)(tz.K,{direction:"column",children:[(0,i.jsxs)(rb.Y,{value:"merge",children:["Merge",(0,i.jsx)(nu.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rk.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rb.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nu.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:rk.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rb.Y,{value:"revert",children:["Revert",(0,i.jsx)(nu.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:rk.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(ei.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 r_(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iO,{viewMode:"changed_models",interactive:!0})})}async function rS(){return(await B.get("/api/flag")).data}async function rz(){try{await B.post("/api/onboarding/completed")}catch(e){}}var rR=()=>{let[e,n]=(0,j.useState)(!1);(0,j.useEffect)(()=>{rS().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),rz()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(G.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(ee.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.f,{children:(0,i.jsxs)(tz.K,{spacing:4,children:[(0,i.jsxs)(tc.aV,{spacing:2,children:[(0,i.jsx)(tc.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tc.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tc.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nh.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},rT=t(1873);let rE=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,im.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,im.WU)(e,"HH:mm"):(0,im.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)(tA.$,{size:"xs",color:"".concat(l,".400")}),(0,i.jsx)(et.x,{fontWeight:500,color:"".concat(l,".400"),children:s}),(0,i.jsx)(et.x,{children:"•"}),(0,i.jsx)(et.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},rD=e=>{let n=iA.ZP.stringify(e,null,2);return(0,i.jsx)(tR.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}})},rI=e=>{var n,t,r;let{runId:l,onClose:s}=e,{runAction:a}=nq(),{error:c,run:d,onCancel:f,isRunning:g}=iN(l),[v,y]=(0,j.useState)(),k=(0,b.NL)(),[,w]=(0,eb.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(!l)return;let e=await nH(l,v);k.invalidateQueries({queryKey:W.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}=iy();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)(rE,{run:d}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n$.n,{}),variant:"outline",isDisabled:!l||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n0.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)(er.z,{leftIcon:(0,i.jsx)(rT.n,{}),isDisabled:!l||!(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)(rT.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t1.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tO,{ref:I,error:c,run:d,onCancel:f,viewOptions:v,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(rD,{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)(tE,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tT,{value:(null==d?void 0:null===(r=d.params)||void 0===r?void 0:r.sql_template)||"",options:{readOnly:!0}}))]})},rO=e=>{let{onClose:n}=e,{runId:t}=nq();return(0,i.jsx)(rI,{runId:t,onClose:n})};var rM=t(22661);t(86777);let rA=e=>{var n;let{run:t,isSelected:l,onSelectRun:a,onAddToChecklist:c,onGoToCheck:d}=e,{data:u}=(0,y.a)({queryKey:W.run(t.run_id),queryFn:async()=>await ea(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)||ek.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:l?"orange.400":"transparent",backgroundColor:l?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:l?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nu.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(et.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:td.FJM})})}):(0,i.jsx)(nu.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(et.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),it({name:"add_to_checklist"}),c(t.run_id)},children:(0,i.jsx)(s.J,{as:td.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(rE,{run:u||t})})]})},rL=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,im.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})},rN=()=>{let{data:e,isLoading:n,isFetching:t,error:l,refetch:s}=(0,y.a)({queryKey:W.runs(),queryFn:async()=>await eh(),retry:!1}),{showRunId:a,runId:d}=nq(),x=e=>{it({name:"click_run"}),a(e,!1)},[,m]=(0,eb.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!d)return;let e=await nH(d);p.invalidateQueries({queryKey:W.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,j.useCallback)(e=>{it({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)(n_.h,{variant:"unstyled",icon:(0,i.jsx)(n$.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)(eU.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(rM.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)(rL,{runAt:e.run_at},t),(0,i.jsx)(rA,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var rq=t(65627),rF=t(78032);let{definePartsStyle:rP,defineMultiStyleConfig:rW}=(0,rF.D)(rq.TB.keys),rH=rW({variants:{circular:rP({control:(0,rF.k0)({rounded:"full"})})},sizes:{xs:rP({icon:(0,rF.k0)({fontSize:"8px"}),control:(0,rF.k0)({boxSize:"16px",padding:"4px"}),label:(0,rF.k0)({fontSize:"xs"})})}}),rV=(0,t(62821).fj)({baseStyle:{borderRadius:"4px"}}),rK=e=>{let{children:n,path:t}=e,[l]=(0,eb.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rJ(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 rB(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=ef(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await B.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:eG.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:eG.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rJ,{icon:td.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rJ,{icon:td.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rJ,{mr:"18px",icon:td.MXt,href:"https://datarecce.io/docs"})]})}function rU(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 rQ(){let{isDemoSite:e,reviewMode:n,cloudMode:t,isLoading:r}=ef(),[l,s]=(0,eb.TH)(),o=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(rU,{queryKey:W.checks(),fetchCallback:nV,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],a=ez().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)(rC,{}),!e&&!t&&(0,i.jsx)(ra,{}),!e&&t&&n&&(0,i.jsx)(ra,{checksOnly:!0}),(0,i.jsx)(ro,{})]}),(0,i.jsx)(rj,{})]})})}function rZ(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nq(),[l]=(0,eb.TH)(),s=e&&!l.startsWith("/checks"),o=n&&!l.startsWith("/checks");return(0,i.jsxs)(to,{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)(rN,{})}),(0,i.jsxs)(ta,{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)(rn,{children:[(0,i.jsx)(rK,{path:"/lineage",children:(0,i.jsx)(r_,{})}),(0,i.jsxs)(eb.rs,{children:[(0,i.jsx)(eb.AW,{path:"/query",children:(0,i.jsx)(i5,{})}),(0,i.jsx)(eb.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iJ,{})}),(0,i.jsx)(eb.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(i7,{runId:n})}}),(0,i.jsx)(eb.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eb.AW,{children:(0,i.jsx)(eb.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(rO,{onClose:t}):(0,i.jsx)(r.xu,{})]})]})}let rX=(0,g.B1)({components:{Checkbox:rH,Tooltip:rV}});function rG(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=t7.env.AMPLITUDE_API_KEY;if(n&&t)try{t8.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,i6.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(i8.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rX,children:(0,i.jsx)(b.aH,{client:U,children:(0,i.jsx)(eb.F0,{hook:i9,children:(0,i.jsx)(nF,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(rB,{}),(0,i.jsx)(rQ,{}),(0,i.jsx)(rR,{}),(0,i.jsx)(rZ,{})]})})})})})})}},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-29cfb245a1734f65.js b/recce/data/_next/static/chunks/app/page-29cfb245a1734f65.js deleted file mode 100644 index a47844b9..00000000 --- a/recce/data/_next/static/chunks/app/page-29cfb245a1734f65.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 rG}});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}var E=t(28482),D=t.n(E);function I(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 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].children),t)}function M(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 A(t,i),L(Array.from(O(e,e.modifiedSet)),t,i)}let A=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(D()).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)}),D().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function L(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 N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function F(e,n){return n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let W={rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var H=t(62330),V=t(39588);let K=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var J=t(94614);let B=H.default.create({baseURL:K}),U=new J.S;async function Q(){return(await B.get("/api/info")).data}async function Z(e){return(await B.get("/api/model/".concat(e))).data}var X=t(99873),G=t(17695),Y=t(62628),$=t(6533),ee=t(96985),en=t(7797),et=t(79481),ei=t(13844),er=t(64653),el=t(85929),es=t.n(el);async function eo(e,n,t){return(await B.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ea(e,n){return(await B.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function ec(e){return await B.post("/api/runs/".concat(e,"/cancel"))}async function ed(e,n){return(await B.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function eu(e,n,t){return(await B.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function eh(){return(await B.get("/api/runs")).data}async function ex(){return(await B.post("/api/runs/aggregate",{})).data}let em=(0,j.createContext)({});function ep(e){var n,t;let{children:r}=e,{data:l,isLoading:s,error:o,refetch:a}=(0,y.a)({queryKey:W.lineage(),queryFn:Q}),{data:c,refetch:d}=(0,y.a)({queryKey:W.runsAggregated(),queryFn:ex}),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,X.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:W.lineage()}),r.invalidateQueries({queryKey:W.checks()}),r.invalidateQueries({queryKey:W.runs()})},s=()=>{let t=new WebSocket("".concat(K.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=es().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)(em.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)(G.u_,{isOpen:"disconnected"===C,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Server Disconnected"}),(0,i.jsx)(en.f,{children:(0,i.jsx)(et.x,{children:"The server connection has been lost. Please click the button below to reconnect."})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{_()},children:"Reconnect"})})]})]})]})}let ef=()=>(0,j.useContext)(em),eg=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ef();return[e,n]};var ev=t(69384);let ej=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)(G.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ee.x,{children:a}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.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)(ei.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(er.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var ey=t(25612),eb=t(76330),ek=t(53152),ew=t(18222),eC=t(30678),e_=t(2838),eS=t(13156),ez=t.n(eS);function eR(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eT=e=>{var n;let{lineageGraph:t}=ef(),[i,r]=(0,j.useState)([]),[l,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[c,d]=(0,j.useState)(null),u=ez().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 eR(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await Z(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){r([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);r(eR(n,t))}catch(e){d(e)}};h.length>0?(r(h),s(x)):(null==u?void 0:u.id)===void 0?r([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:l,isLoading:o,error:c}};function eE(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eD(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eI=t(85813),eO=t(81945),eM=t(14827);function eA(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eL(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,r=n>=1e9,l=n>=1e15;if(l||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:l?0:2}).format(e/1e12).replace("L","T");if(r||i||n>=1e3){let n={base:r?1e9:i?1e6:1e3,unit:r?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eN="#63B3ED",eq="#F6AD55",eF="".concat(eN,"A5"),eP="".concat(eq,"A5");function eW(e){let{color:n}=e;return(0,i.jsx)(r.xu,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function eH(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eO.kL.register(eO.ZL,eO.RM,eO.f$,eO.uw,eO.Dx,eO.De,eO.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=eK(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=eA(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)=>eK(l,n)).slice(0,-1);return{x:"datetime"===r?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>d[n]},stacked:!0},y:{display:!s,type:"linear",max:c,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eL(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:r}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[r,l]=n,s=eV(t,i,"Current",eF,l),o=eV(t,i,"Base",eP,r);return{labels:i.map((e,n)=>eK(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eM.kL,{type:"bar",options:l,data:s,plugins:[]})}function eV(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 eK(e,n){let t=e[n],i=e[n+1],r=eL(t),l=eL(i);return"".concat(r," - ").concat(l)}let eJ=(0,eI.G)((e,n)=>{let{backgroundColor:t="white",blockSize:l,children:s,...o}=e;return(0,i.jsx)(r.xu,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.xu,{backgroundColor:t,height:"100%",blockSize:l,children:s})})}),eB=(0,eI.G)(function(e,n){var t,l,s,a,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)(eJ,{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)(eH,{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 eU=t(24112);t(63156);var eQ=t(22204);let eZ=(0,eI.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eQ.ZP,{ref:n,...t})})});function eX(){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)(et.x,{fontWeight:"600",children:" No rows"})})}t(87679);var eG=t(52091);function eY(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 e$(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 e0(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 e1(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?eG.ven:eG.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?eG.$kI:eG.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let e2=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]},e5=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(et.x,{style:{color:"gray"},children:"-"});let[r,l]=e2(n[t.key]);return(0,i.jsx)(et.x,{style:{color:l?"gray":"inherit"},children:r})};function e4(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(eY(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=e$(r.columns,s);r.data.forEach((n,t)=>{let i=e0(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e$(l.columns,s),l.data.forEach((n,t)=>{let i=e0(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=eY(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(d))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||ez().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e1,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,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)(e1,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e5})}),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 e3=(0,eI.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)(()=>e4(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)(eU.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ,{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 e9(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?eG.$kI:eG.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 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=eY(Object.keys(a),Object.keys(c)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,r]=t,l=a[i],s=c[i],d=JSON.parse(i);if(l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=l[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=s[t])}),l){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(ez().isEqual(l[t.index],s[t.index])||(d.__status="modified",t.status="modified"));else d.__status="removed",m.removed++}else d.__status="added",m.added++;return"modified"===d.__status&&m.modified++,d});l&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,l=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!ez().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e9,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:eQ.Ug,headerCellClass:r,cellClass:l,renderCell:e5,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(e9,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:e5})}),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 e8=t(93998),e7=t(25773),ne=t(63352);let nn=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)(e7.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(e8.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(ne.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)(er.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},nt=(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 e4(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)(eU.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)(nn,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:d,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:k}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},ni=(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 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===(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)(eU.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)(nn,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:a,viewOptions:d,onAddToChecklist:c,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nr=(0,eI.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eI.G)(ni);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eI.G)(nt);return(0,i.jsx)(t,{...e,ref:n})}});function nl(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?eG.$kI:eG.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let ns=(0,eI.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)(nl,{name:t,...n}),width:"auto",renderCell:e5});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=ez().findIndex(e.columns,e=>e.name===n);i<0||t.push(l(i,n))}),e.columns.forEach((e,n)=>{r.includes(e.name)||t.push(l(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,l,s]);if(0===u.columns.length)return(0,i.jsx)(eU.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)(e8.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.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)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function no(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 na=t(68844),nc=t.n(na);let nd=(0,eI.G)(function(e,n){let{run:t}=e;function r(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let l=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=l[e],t=nc()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nc()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,r="No Change";return null!==t&&null!==i?r=t!==i?no(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)(eU.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)(eZ,{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)(eX,{})},className:"rdg-light",enableScreenshot:!0})})})});var nu=t(32088),nh=t(96124);let nx="#63B3ED";function nm(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),r=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([r]).map((n,t)=>{let l;let s=t===i.length,o=s?r:i[t],a=!1;return s?(l="(others)",a=!0):null==n?(l="(null)",a=!0):"string"==typeof n&&0===n.length?(l="(empty)",a=!0):l=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:l,count:o,displayCount:eL(o),displayRatio:eA(o/e.valids)||"N/A"}})}function np(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nu.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(et.x,{children:[(0,i.jsx)(eW,{color:eN}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(et.x,{children:[(0,i.jsx)(eW,{color:eq}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nf(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=nm(n.current,t),s=nm(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)(et.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eq})," Base"]}),(0,i.jsxs)(et.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eW,{color:eN})," 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)(np,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(et.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)(ng,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eN}),(0,i.jsx)(et.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(et.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(ng,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eq}),(0,i.jsx)(et.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(et.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nh.i,{})]},t)})]})}function ng(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nx}=e;eO.kL.register(eO.uw,eO.ZL,eO.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=nx}=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 nv=(0,eI.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)(eJ,{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)(nf,{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"})})]})}),nj=(0,eI.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 e6(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)(eU.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)(nn,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eU.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nn,{run:l,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:c,warnings:p}),(0,i.jsx)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var ny=t(93960),nb=t(66011);function nk(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}=eT(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)(e7.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Model"}),(0,i.jsx)(ny.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Primary key"}),(0,i.jsx)(nb.Z,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Columns"}),(0,i.jsx)(ne.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nb.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 nw=t(49801),nC=t(50104),n_=t(39171),nS=t(39226),nz=t(70949),nR=t(34510);function nT(e){let{params:n,column:t}=e,{runAction:l}=nq(),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)(nw.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nS.q,{lineHeight:"20px",children:(0,i.jsxs)(nz.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nR.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nE=(0,eI.G)(function(e,n){let{run:t}=e,l=t.result,a=t.params,c=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},d=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(eU.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:eG.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nT,{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)(eZ,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:l.data.data,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nD=t(18502),nI=t(63594);let nO={lineage_diff:{title:"Lineage Diff",icon:ek.Ks7},schema_diff:{title:"Schema Diff",icon:nI.C8A},query:{title:"Query",icon:ek.r2i,RunResultView:ns},query_base:{title:"Query Base",icon:ek.r2i,RunResultView:ns},query_diff:{title:"Query Diff",icon:ek.r2i,RunResultView:nr},row_count_diff:{title:"Row Count Diff",icon:nI.QUK,RunResultView:nd},profile_diff:{title:"Profile Diff",icon:ek.KA6,RunResultView:e3},value_diff:{title:"Value Diff",icon:ek.pRi,RunResultView:nE,RunForm:nk},value_diff_detail:{title:"Value Diff Detail",icon:ek.pRi,RunResultView:nj,RunForm:nk},top_k_diff:{title:"Top-K Diff",icon:nD.Pkc,RunResultView:nv,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.map(e=>e.name);return((0,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)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(e_.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:c.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:ek.dku,RunResultView:eB,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eT(n.model),c=s.filter(e=>!eE(e.type)&&!eD(e.type));return o?(0,i.jsx)(r.xu,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ew.NI,{children:[(0,i.jsx)(eC.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(e_.P,{placeholder:0!==c.length?"Select column":"No numeric column is available",isDisabled:0===c.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let r=e.target.value;l(!!r);let s=(null===(i=c.find(e=>e.name===r))||void 0===i?void 0:i.type)||"";t({...n,column_name:r,column_type:s})},children:c.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}}},nM=e=>nO[e],nA=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{}}),nL=e=>{let[n]=(0,eb.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nN(e){var n;let{children:t}=e,[r,l]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ey.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ey.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),p=(0,X.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eb.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),d(),!1!==n&&k.invalidateQueries({queryKey:W.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 eu(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))l({session:r,title:a,type:e,params:n,lastRun:i,options:t,RunForm:d}),o();else{let{run_id:t}=await eo(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:W.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]);nL(a);let _=async(e,n)=>{try{a();let{run_id:t}=await eo(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)(nA.Provider,{value:{runAction:C,runId:f,showRunId:w,isRunResultOpen:c,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x},children:[r&&(0,i.jsx)(ej,{isOpen:s,onClose:a,onExecute:_,title:r.title,type:r.type,params:r.params,initialRun:r.lastRun,RunForm:(null===(n=r.options)||void 0===n?void 0:n.showForm)&&r.RunForm?r.RunForm:void 0},r.session),t]})}let nq=()=>(0,j.useContext)(nA);function nF(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(ep,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nN,{children:n})})})})})}var nP=t(81600);async function nW(){return(await B.post("/api/checks",{type:"simple"})).data}async function nH(e,n){return(await B.post("/api/checks",{run_id:e,view_options:n})).data}async function nV(){return(await B.get("/api/checks")).data}async function nK(e){return(await B.get("/api/checks/".concat(e))).data}async function nJ(e,n){return(await B.patch("/api/checks/".concat(e),n)).data}async function nB(e){return(await B.delete("/api/checks/".concat(e))).data}async function nU(e){return await B.post("/api/checks/reorder",e)}var nQ=t(94734),nZ=t(71738),nX=t(38414),nG=t(29598),nY=t(62216),n$=t(42675),n0=t(20074),n1=t(54097),n2=t(95862),n5=t(82960),n4=t(69879),n3=t(618),n9=t(77153);function n6(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)(n4.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n9.X,{color:"gray.500"}),children:[(0,i.jsx)(n3.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(n3.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(ny.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 n8=t(94019);t(81974);var n7=t(78439);function te(e){let{model:n,name:t,baseType:l,currentType:a}=e,{runAction:c}=nq(),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)(nw.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nC.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(n7.h,{children:(0,i.jsx)(nS.q,{lineHeight:"20px",children:(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:u,isDisabled:m||!d||!(!eE(d)&&!eD(d)),children:"Histogram Diff"}),(0,i.jsx)(nR.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tn(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)(te,{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 tt=t(89725),ti=t(13965);let tr=(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(eY(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)?tn(e,(null==s?void 0:s.name)||(null==l?void 0:l.name)):tn(e)},[l,s]),{lineageGraph:u}=ef(),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)(tt.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(ti.z,{}),t]}):r?(0,i.jsxs)(tt.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(ti.z,{}),r]}):(0,i.jsx)(i.Fragment,{}),d.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(eZ,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:d,renderers:{noRowsFallback:(0,i.jsx)(eX,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tl(e){return(await B.post("/api/select",e)).data}var ts=t(12282);t(15080);let to=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(ts.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},ta=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(ts.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var tc=t(79898),td=t(68630),tu=t(91363);let th=eG.Nbv,tx=eG.sFB,tm=eG.UGs;function tp(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:th}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tx}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tm}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tf(e){if("model"===e)return{color:"#c0eafd",icon:td.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tu._MV};if("source"===e)return{color:"#a6dda6",icon:td.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tu.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tu.R1C};if("seed"===e)return{color:"#a6dda6",icon:td.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:td.Dmm};else return{color:"inherit",icon:void 0}}function tg(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}=tf(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nM("schema_diff"))||void 0===m?void 0:m.icon,t=tp("modified").color}else!h&&x?(n=tp("added").icon,t=tp("added").color):h&&!x&&(n=tp("removed").icon,t=tp("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})]})},tj=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:r}=ef(),l=t.params,s=[...W.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,y.a)({queryKey:s,queryFn:async()=>tl({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;tg(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)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tv,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var ty=t(51643);function tb(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)(ty.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)(er.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(et.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tk=t(40902);function tw(){let e=(0,X.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 tC(){let e=(0,nP._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tC=function(){return e},e}function t_(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tS(e){return e.description?e.description:"_(no description)_"}var tz=t(23256),tR=t(31265);let tT=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)(et.x,{as:"b",children:c?c.toUpperCase():""}),(0,i.jsx)(h.L,{}),(r||l)&&(0,i.jsx)(er.z,{size:"sm",variant:"outline",onClick:r||l,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tu.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tR.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}})]})},tE=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)(tz.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tT,{label:"Base",value:t||"",onChange:l,onRunBase:a,options:d,...u})}),(0,i.jsx)(tz.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tT,{label:"Current",value:n,onChange:r,onRun:s,options:d,...u})})]})})};var tD=t(23567),tI=t(20085);let tO=(0,eI.G)((e,n)=>{var t,l,s,a;let{isRunning:c,isAborting:d,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(l=h.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tt.b,{status:"error",children:[(0,i.jsx)(ti.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)(eU.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(e7.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)(tD.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tD.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)(eU.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)(tI.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),tA=t(29012),tL=t(25783),tN=t(49110),tq=t(55415),tF=t(24432);t(90548),t(91074);var tP=t(48289),tW=t(66633),tH=t(83143),tV=t(29937);function tK(e){let{node:n}=e,{icon:t}=tf(n.resourceType);return(0,i.jsx)(nu.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nQ.Vp,{children:[(0,i.jsx)(nQ.AD,{as:t}),(0,i.jsx)(nQ.Sn,{children:n.resourceType})]})})}function tJ(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)(et.x,{children:l}),(0,i.jsx)(s.J,{as:tH.Rgz}),(0,i.jsx)(et.x,{children:o})]}):t===r?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(et.x,{children:o}),(0,i.jsx)(s.J,{as:tV.lxc,color:"gray.500"}),(0,i.jsx)(et.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nu.u,{label:l,children:(0,i.jsxs)(nQ.Vp,{children:[(0,i.jsx)(nQ.AD,{as:x}),(0,i.jsx)(nQ.Sn,{children:m||c?(0,i.jsx)(tW.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tJ,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nQ.bq,{as:n_.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n$.n,{}),size:"xs",onClick:a})]})})}let tU=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tD.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsx)(nQ.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)(nu.u,{label:s,children:(0,i.jsx)(tP.s,{})})]})});if(!a)return(0,i.jsx)(tD.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)(tD.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tD.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)(nu.u,{label:c,children:(0,i.jsx)(e8.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nQ.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(nQ.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)(tB,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tQ=(0,j.createContext)(void 0),tZ=()=>{let e=(0,j.useContext)(tQ);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},tX=e=>{var n,t,l,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ef(),m=null==x?void 0:x[u],p=null==h?void 0:h.nodes[u];if(!m&&!p)return(0,i.jsx)(i.Fragment,{});if((null==p?void 0:p.data.base)&&(null==p?void 0:p.data.current)&&(c=tg(null===(l=p.data.base)||void 0===l?void 0:l.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nu.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=nM("schema_diff"))||void 0===n?void 0:n.icon,color:c?tp("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nu.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=nM("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tp("modified").color:"lightgray"})})})]})},tG=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:td.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:td.hGI})})};var tY=t(13358),t$=t(15196),t0=t(28023),t1=t(84963);function t2(e){let{base:n,current:t}=e;return(0,i.jsx)(tR.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 t5(e){return(await B.post("/api/checks",{type:"schema_diff",params:e})).data}function t4(e){var n,t,l,a,d,f,g;let{node:v,onCloseNode:y}=e,[,b]=(0,eb.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,ey.q)(),{runAction:T}=nq(),{envInfo:E}=ef(),{primaryKey:D}=eT(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 t5({node_id:e});b("/checks/".concat(n.check_id))},[v,b]),M="added"===v.changeStatus||"removed"===v.changeStatus;return(0,i.jsxs)(t$.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)(nw.v,{children:[(0,i.jsx)(nC.j,{as:er.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsx)(nR.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)),w(void 0!==D?[D]:void 0),b("/query")},children:"Query"}),(0,i.jsx)(t0.R,{}),(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===v.resourceType||"snapshot"===v.resourceType)&&(0,i.jsx)(nR.s,{onClick:z,icon:(0,i.jsx)(td.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nM("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>I(),children:"Row Count Diff"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nM("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)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nM("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)(t0.R,{}),(0,i.jsx)(nz.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nR.s,{icon:(0,i.jsx)(s.J,{as:null===(g=nM("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)(t1.P,{onClick:y})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(tK,{node:v}),("model"===v.resourceType||"snapshot"===v.resourceType||"seed"===v.resourceType)&&(0,i.jsx)(tB,{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)(nZ.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nX.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tr,{base:v.data.base,current:v.data.current})})})]}),(0,i.jsxs)(G.u_,{isOpen:S,onClose:R,size:"6xl",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ee.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.f,{children:(0,i.jsx)(t2,{base:v.data.base,current:v.data.current})})]})]})]})}function t3(e){var n,t;let{onClose:l}=e,{cancel:s,actionState:o}=tZ();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)(tL.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)(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:l,children:"Close"})})]})})}var t9=t(27547),t6=t(35052),t8=t(57489),t7=t(39588);function ie(e){t8.j("[Web] multi_nodes_action",e)}function it(e){t8.j("[Web] history_action",e)}let ii=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nq();return(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eG.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(it({name:"hide"}),t()):(it({name:"show"}),n())},children:e?"Hide":"Show"})},ir=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r,selectMode:l}=tZ(),o=t.view_mode||"changed_models",a=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nw.v,{children:[(0,i.jsx)(nC.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tf("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nS.q,{title:"packages",children:[(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},il=e=>{var n,t;let{isDisabled:r}=e,{lineageGraph:l}=ef(),{viewOptions:o,onViewOptionsChanged:a}=tZ(),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)(nw.v,{closeOnSelect:!1,children:[(0,i.jsx)(nC.j,{as:er.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tH.zFh}),size:"xs",variant:"outline",isDisabled:r,children:m}),(0,i.jsx)(nS.q,{title:"packages",children:(0,i.jsxs)(nz.k,{title:"Select Packages",children:[(0,i.jsx)(nR.s,{as:ne.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)(t0.R,{}),Array.from(c).map(e=>(0,i.jsx)(nR.s,{as:ne.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},is=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)(ny.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)})},io=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tZ();return(0,i.jsx)(is,{isDisabled:n,value:t.select||"",onChange:e=>{r({...t,select:e||void 0})}})},ia=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tZ();return(0,i.jsx)(is,{isDisabled:n,value:t.exclude||"",onChange:e=>{r({...t,exclude:e||void 0})}})},ic=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]}),id=()=>{var e,n,t,r;let{nodes:l,deselect:o,selectMode:a,...c}=tZ(),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)(ic,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(ii,{})}),(0,i.jsx)(ic,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(ir,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(il,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(io,{isDisabled:f})}),(0,i.jsx)(ic,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ia,{isDisabled:f})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ic,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(et.x,{fontSize:"9pt",color:"gray.500",children:d.length>1?"".concat(d.length," nodes selected"):"".concat(d.length," node selected")})}),(0,i.jsx)(ic,{label:"",children:(0,i.jsx)(er.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),(0,i.jsx)(ic,{label:"Explore",children:(0,i.jsx)(t9.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nw.v,{placement:"bottom-end",children:[(0,i.jsx)(nC.j,{as:er.z,size:"xs",rightIcon:(0,i.jsx)(t6.v,{}),children:"Actions"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsxs)(nz.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),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)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),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)(t0.R,{}),(0,i.jsxs)(nz.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||m&&d.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)(nR.s,{as:et.x,size:"sm",fontSize:"10pt",isDisabled:!(p||x||m),icon:(0,i.jsx)(s.J,{as:null===(r=nM("schema_diff"))||void 0===r?void 0:r.icon}),onClick:()=>{c.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};var iu=t(81737),ih=t.n(iu),ix=t(77249),im=t(50228),ip=t(67605),ig=t.n(ip);let iv="ignore-screenshot";function ij(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,ey.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)(G.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Screenshot Preview"}),(0,i.jsx)(ev.o,{}),(0,i.jsxs)(en.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)(tP.s,{color:"red.600"}),(0,i.jsx)(et.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(et.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(ei.m,{children:[(0,i.jsx)(er.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,im.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");ig()(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 ih()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,ix.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 iy(e){let{successToast:n,failToast:t}=tw(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=ij({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)(er.z,{size:"sm",leftIcon:(0,i.jsx)(n0.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 ib(e){return(await B.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function ik(){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}=tp(n);return(0,i.jsx)(nu.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 iw=t(11978);let iC={mode:"per_node",status:"pending",completed:0,total:0},i_=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:r}=n,l=(0,j.useRef)({...iC}).current,{showRunId:s}=nq(),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 eo(n,u,{nowait:!0});for(s(e),l.currentRun={run_id:e},l.total=1;;){let n=await ea(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 eo(n,e,{nowait:!0});for(l.currentRun={run_id:r},t.action={mode:o,status:"running"},i(t);;){let e=await ea(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 ec(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 ib({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await t5({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await t5({node_id:t})}return n},cancel:c,reset:()=>{Object.assign(l,iC)}}};var iS=t(65475),iz=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ey.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)(iS.a,{size:"xl",isOpen:e,leastDestructiveRef:d,onClose:h,children:(0,i.jsx)(Y.Z,{children:(0,i.jsxs)(iS._,{children:[(0,i.jsxs)(ee.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",l," nodes"]}),(0,i.jsx)(en.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)(ei.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 iR={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}=tf(d),[f,g]=(0,j.useState)(!1),{selectNodeMulti:v,selectMode:y}=tZ(),{icon:b,color:k,backgroundColor:w}=x?tp(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},C="solid";l.isSelected;let _=null==l?void 0:l.name;return(0,i.jsx)(nu.u,{label:"model"===d?_:"".concat(_," (").concat(d,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:k,borderWidth:1,borderStyle:C,backgroundColor:m?"multi"===y?c?k:"white":"action_result"!==y?c?w:"white":l.action?c?w:k:"white":c?k:w,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===y?(null==l?void 0:l.action)?"none":"opacity(0.2) grayscale(50%)":a?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:k,padding:2,borderRightWidth:1,borderColor:"multi"===y?"#00000020":k,borderStyle:C,alignItems:"top",visibility:m?"inherit":"hidden",children:(0,i.jsx)(tG,{checked:"multi"===y&&c||"action_result"===y&&!!l.action,onClick:e=>{"action_result"!==y&&(e.stopPropagation(),v(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"===y?c?"white":"inherit":"action_result"===y&&l.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:_}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===y?c?"white":"inherit":"action_result"===y&&l.action&&!c?"white":"inherit",as:p}),b&&(0,i.jsx)(s.J,{color:"multi"===y?c?"white":k:"action_result"===y?l.action&&!c?"white":"inherit":k,as:b})]}),(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:[!l.isActionMode&&"model"===l.resourceType&&(0,i.jsx)(tX,{id:l.id}),(0,i.jsx)(h.L,{}),l.isActionMode&&(l.action?(0,i.jsx)(tU,{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})]})})}},iT={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=tp(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}})})}},iE=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tp(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},iD=(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])},iI=()=>{let[,e]=(0,eb.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},iO=(0,j.forwardRef)(function(e,n){var t;let{...l}=e,a=(0,R._K)(),c=(0,j.useRef)(null),{successToast:d,failToast:h}=tw(),{copyToClipboard:x,ImageDownloadModal:m,ref:p}=ij({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iv))},onSuccess:()=>{d("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),h("Failed to copy image to clipboard",e)}}),[f,g,v]=(0,R.Rr)([]),[y,b,k]=(0,R.ll)([]),[w,C]=(0,j.useState)({view_mode:"changed_models",...l.viewOptions}),{lineageGraph:_,retchLineageGraph:S,isLoading:z,error:T,refetchRunsAggregated:E}=ef(),{showRunId:D,closeRunResult:W,runAction:H}=nq();(0,j.useImperativeHandle)(n,()=>({copyToClipboard:x}));let V=w.view_mode||l.viewMode||"changed_models",[K,J]=(0,j.useState)("single"),B=(0,j.useMemo)(()=>{var e;if("single"===K)return null===(e=f.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[K,f]),U=(0,j.useMemo)(()=>f.filter(e=>e.data.isSelected).map(e=>e.data),[f]),Q=(0,j.useMemo)(()=>f.map(e=>e.data),[f]),[Z,G]=(0,j.useState)(!1),[Y,$]=(0,j.useState)({x:0,y:0}),ee=(0,X.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!_)return;if(w.node_ids)e=w.node_ids;else{var n;let t=null===(n=_.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:w.view_mode,packages:t?[t]:void 0,...l.viewOptions};C(i),e=(await tl({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=M(_,e);A(t,i),g(t),b(i)})()},[_]);let en=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=a.getZoom();a.setCenter(n,t,{zoom:i,duration:200})}},ei=iI();iD(c,async()=>{if("single"===K||"action_result"===K){let e=f.find(e=>e.data.isSelected);e?en(e):a.fitView({nodes:f,duration:200})}});let el=(0,j.useCallback)(e=>{g(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[g]),es=async e=>{let n;if(!_)return;try{n=(await tl({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof iw.d7){var t,i;ee({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]=M(_,n);A(r,l),g(r),b(l),C(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{a.fitView({nodes:r,duration:200})})()},eo=i_("multi"===K?U:Q,{onActionStarted:()=>{J("action_result")},onActionNodeUpdated:el,onActionCompleted:()=>{}}),ea=iz();if(z)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tA.$,{size:"xl"})});let ec=()=>{G(!1),$({x:0,y:0})};if(T)return(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsxs)(e7.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: ",T,"]"]}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{S&&S()},children:"Retry"})]})});if("changed_models"===V&&!(null==_?void 0:null===(t=_.modifiedSet)||void 0===t?void 0:t.length))return(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsxs)(e7.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(er.z,{colorScheme:"blue",onClick:()=>{es({...w,view_mode:"all"})},children:"Show all nodes"})]})});let ed=()=>{J("single"),g(P(f)),W(),null==E||E()},eu={selectMode:K,nodes:f,viewOptions:w,onViewOptionsChanged:es,selectNodeMulti:e=>{if("multi"!==K){if(!_)return;let[n,t]=L(Array.from(O(_,_.modifiedSet)),f,y);g(n=N(e,n=P(n,!0))),b(t),J("multi"),eo.reset()}else{let n=q(e,f);n.find(e=>e.data.isSelected)||(J("single"),n=P(n)),g(n)}},deselect:ed,runRowCountDiff:async()=>{"multi"===K?(await eo.runRowCountDiff(),ie({type:"row_count_diff",selected:"multi"})):B?(await H("row_count_diff",{node_names:[B.name]},{showForm:!1,showLast:!1}),ie({type:"row_count_diff",selected:"single"})):(await H("row_count_diff",{select:w.select,exclude:w.exclude,packages:w.packages,view_mode:w.view_mode}),ie({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(B)await H("value_diff",{model:B.name},{showForm:!0,showLast:!1}),ie({type:"value_diff",selected:"single"});else{let e="multi"===K?U.length:Q.length;await ea.confirm(e)&&(await eo.runValueDiff(),ie({type:"value_diff",selected:"multi"===K?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===K?(e=await eo.addLineageDiffCheck(),ed(),ie({type:"lineage_diff",selected:"multi"})):B||(e=await ib(w),ie({type:"lineage_diff",selected:"none"})),e&&ei(e)},addSchemaDiffCheck:async()=>{let e;"multi"===K?U.length>0&&(e=await eo.addSchemaDiffCheck(),ed(),ie({type:"schema_diff",selected:"multi"})):B?(e=await t5({node_id:B.id}),ie({type:"schema_diff",selected:"single"})):(e=await t5({select:w.select,exclude:w.exclude,packages:w.packages,view_mode:w.view_mode}),ie({type:"schema_diff",selected:"none"})),e&&ei(e)},cancel:eo.cancel,actionState:eo.actionState};return(0,i.jsxs)(tQ.Provider,{value:eu,children:[(0,i.jsxs)(to,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(e7.g,{ref:c,divider:(0,i.jsx)(tL.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[l.interactive&&(0,i.jsx)(id,{}),(0,i.jsxs)(R.x$,{nodeTypes:iR,edgeTypes:iT,nodes:f,edges:y,onNodesChange:v,onEdgesChange:k,onNodeClick:(e,n)=>{if(!1!==l.interactive){if(ec(),"single"===K)B||en(n),g(N(n.id,f));else if("action_result"===K){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)&&D(null===(s=n.data.action)||void 0===s?void 0:null===(r=s.run)||void 0===r?void 0:r.run_id),en(n),g(N(n.id,f))}else{let e=q(n.id,f);e.find(e=>e.data.isSelected)||(J("single"),e=P(e)),g(e)}}},onNodeMouseEnter:(e,n)=>{if(!_||"single"!==K)return;let[t,i]=L(Array.from(function(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}(I(_,[n.id]),O(_,[n.id]))),f,y);g(t),b(i)},onNodeMouseLeave:(e,n)=>{if(!_)return;let[t,i]=L(Array.from(O(_,_.modifiedSet)),f,y);g(t),b(i)},onNodeContextMenu:(e,n)=>{"multi"===K&&(e.preventDefault(),$({x:e.clientX,y:e.clientY,selectedNode:n}),G(!0))},onClick:ec,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:l.interactive,ref:p,children:[(0,i.jsx)(tN.A,{color:"#ccc"}),(0,i.jsx)(tq.Z,{showInteractive:!1,position:"top-right",className:iv,children:(0,i.jsx)(tq.B,{title:"copy image",onClick:async()=>{x()},children:(0,i.jsx)(s.J,{as:tH.C3L})})}),(0,i.jsx)(m,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(ik,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(et.x,{fontSize:"xl",color:"grey",opacity:.5,children:f.length>0?"":"No nodes"})}),(0,i.jsx)(tF.a,{nodeColor:iE,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===K&&(0,i.jsx)(R.s_,{position:"bottom-center",className:iv,children:(0,i.jsx)(t3,{onClose:()=>{ed()}})})]})]}),"single"===K&&B?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(t4,{node:B,onCloseNode:()=>{g(P(f))}})}):(0,i.jsx)(r.xu,{})]}),Z&&(0,i.jsx)(nw.v,{isOpen:!0,onClose:ec,children:(0,i.jsxs)(nS.q,{style:{position:"absolute",left:"".concat(Y.x,"px"),top:"".concat(Y.y,"px")},children:[(0,i.jsx)(nR.s,{icon:(0,i.jsx)(tY.Cv2,{}),onClick:()=>{let e=Y.selectedNode;"multi"===K&&void 0!==e&&void 0!==_&&g(F([...I(_,[e.id])],f))},children:"Select parent nodes"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(tY.IMj,{}),onClick:()=>{let e=Y.selectedNode;"multi"===K&&void 0!==e&&void 0!==_&&g(F([...O(_,[e.id])],f))},children:"Select child nodes"})]})}),ea.AlertDialog]})}),iM=(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)(iO,{viewOptions:r,interactive:!1,ref:n})})})});var iA=t(19339);function iL(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=iA.ZP.stringify({checks:[o]});return(0,i.jsx)(tR.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 iN=e=>{var n;let[t,i]=(0,j.useState)(!1),[r,l]=(0,j.useState)(!1),[,s]=eg(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ea(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 ec(e)},[e,l]),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:r,error:o,onCancel:c,RunResultView:d}};function iq(){let e=(0,X.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function iF(){let e=(0,nP._)(["\n
","\n\n ","\n\n
"]);return iF=function(){return e},e}let iP=e=>{var n,t,l,a,d,f,g;let{checkId:v}=e,k=(0,b.NL)(),[,w]=(0,eb.TH)(),{successToast:C,failToast:_}=tw(),{markedAsApprovedToast:S}=iq(),[z,R]=(0,j.useState)(),[T,E]=(0,j.useState)(),[D,I]=(0,j.useState)(!1),{isOpen:O,onOpen:M,onClose:A}=(0,ey.q)(),L=()=>(0,i.jsx)(Y.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[N,q]=(0,j.useState)((0,i.jsx)(L,{})),{isLoading:F,error:P,data:H}=(0,y.a)({queryKey:W.check(v),queryFn:async()=>nK(v),refetchOnMount:!0}),V=z||(null==H?void 0:null===(n=H.last_run)||void 0===n?void 0:n.run_id),{run:K,error:J}=iN(V),B=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==H?void 0:H.type)?nM(null==H?void 0:H.type):void 0,Q=(null==H?void 0:H.is_preset)||!1,Z=(0,j.useRef)(null),{mutate:X}=(0,n8.D)({mutationFn:e=>nJ(v,e),onSuccess:()=>{k.invalidateQueries({queryKey:W.check(v)}),k.invalidateQueries({queryKey:W.checks()})}}),{mutate:et}=(0,n8.D)({mutationFn:()=>nB(v),onSuccess:()=>{k.invalidateQueries({queryKey:W.checks()}),w("/checks")}}),ei=(0,j.useCallback)(async()=>{(null==H?void 0:H.type)&&R((await ed(v,{nowait:!0})).run_id)},[H,v,R]),el=(0,j.useCallback)(async()=>{if(I(!0),V)return await ec(V)},[V]),es=async()=>{if(!H)return;let e=(0,tk.RI)(iF(),t_(H),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tS(e),"\n\n").concat((0,tk.Pn)(tC(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tS(e)}(H));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==H?void 0:H.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==H?void 0:H.is_checked,X,S]),[ea,eu]=(0,j.useState)(0),{ref:eh,onCopyToClipboard:ex,onMouseEnter:em,onMouseLeave:ep}=iy();if(F)return(0,i.jsx)(eU.M,{h:"100%",children:"Loading"});if(P)return(0,i.jsxs)(eU.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)(ta,{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)(n6,{name:(null==H?void 0:H.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Q&&(0,i.jsx)(nu.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nQ.Vp,{size:"sm",children:[(0,i.jsx)(nQ.AD,{boxSize:"14px",as:n2.bX4}),"Preset"]})}),(0,i.jsxs)(nw.v,{children:[(0,i.jsx)(nC.j,{isRound:!0,as:n_.h,icon:(0,i.jsx)(s.J,{as:eG.D_A}),variant:"ghost"}),(0,i.jsxs)(nS.q,{children:[(0,i.jsx)(nR.s,{icon:(0,i.jsx)(n5.ovA,{}),onClick:()=>{q((0,i.jsx)(L,{})),M()},children:"Get Preset Check Template"}),(0,i.jsx)(nR.s,{icon:(0,i.jsx)(nY.p,{}),onClick:()=>et(),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)(nu.u,{label:"Rerun",children:(0,i.jsx)(n_.h,{isRound:!0,isLoading:B,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n$.n,{}),onClick:()=>ei()})}),(0,i.jsx)(nu.u,{label:"Copy markdown",children:(0,i.jsx)(n_.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(n0.T,{}),onClick:()=>es()})}),(0,i.jsx)(nu.u,{label:(null==H?void 0:H.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(er.z,{size:"sm",colorScheme:(null==H?void 0:H.is_checked)?"green":"gray",variant:(null==H?void 0:H.is_checked)?"solid":"outline",leftIcon:(0,i.jsx)(n1.r,{color:(null==H?void 0:H.is_checked)?"inherit":"green"}),onClick:()=>eo(),children:(null==H?void 0:H.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tb,{value:null==H?void 0:H.description,onChange:e=>{X({description:e})}},null==H?void 0:H.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:eu,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.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)(n0.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==H?void 0:H.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==H?void 0:H.type)==="lineage_diff"){var e;null===(e=Z.current)||void 0===e||e.copyToClipboard()}else ex()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(nZ.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nX.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==H?void 0:H.last_run)||V?(0,i.jsx)(tO,{ref:eh,isRunning:B,isAborting:D,run:V?K:null==H?void 0:H.last_run,error:J,progress:T,RunResultView:U.RunResultView,viewOptions:null==H?void 0:H.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:el,onExecuteRun:ei}):(0,i.jsx)(eU.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(er.z,{onClick:ei,colorScheme:"blue",size:"sm",children:"Run Query"})})),H&&"schema_diff"===H.type&&(0,i.jsx)(tj,{check:H,ref:eh}),H&&"lineage_diff"===H.type&&(0,i.jsx)(iM,{check:H,ref:Z})]}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff"||(null==H?void 0:H.type)==="query_base")&&(0,i.jsx)(nX.x,{p:0,height:"100%",width:"100%",children:(null===(t=H.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tE,{value:(null==H?void 0:null===(l=H.params)||void 0===l?void 0:l.sql_template)||"",baseValue:(null==H?void 0:null===(a=H.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tT,{value:(null==H?void 0:null===(d=H.params)||void 0===d?void 0:d.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(G.u_,{isOpen:O,onClose:A,isCentered:!0,size:"6xl",children:[N,(0,i.jsxs)($.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ee.x,{children:"Preset Check Template"}),(0,i.jsx)(ev.o,{}),(0,i.jsxs)(en.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(nG.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)(iL,{name:(null==H?void 0:H.name)||"",description:(null==H?void 0:H.description)||"",type:(null==H?void 0:H.type)||"",params:null==H?void 0:H.params,viewOptions:null==H?void 0:H.view_options})]})]})]})]})};var iW=t(53924);let iH=e=>{var n;let{check:t,selected:l,onSelect:a,onMarkAsApproved:c}=e,d=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,n8.D)({mutationFn:e=>nJ(u,e),onSuccess:()=>{d.invalidateQueries({queryKey:W.check(u)}),d.invalidateQueries({queryKey:W.checks()})}}),x=(null===(n=nM(t.type))||void 0===n?void 0:n.icon)||ek.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)(nu.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(ne.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()}})})})]})})},iV=e=>{let{checks:n,selectedItem:t,onCheckSelected:l,onChecksReordered:s}=e,[a,c]=(0,j.useState)(!1),d=(0,b.NL)(),{mutate:u}=(0,n8.D)({mutationFn:e=>nJ(e,{is_checked:!0}),onSuccess:(e,n)=>{d.invalidateQueries({queryKey:W.check(n)}),d.invalidateQueries({queryKey:W.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,ey.q)(),{markedAsApprovedToast:p}=iq(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iW.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(iW.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(e7.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(iW._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)(iH,{check:e,selected:e.check_id===t,onSelect:l,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(G.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{width:"400px",children:[(0,i.jsx)(ee.x,{children:"Mark as Approved?"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(nh.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)(ne.X,{isChecked:a,onChange:e=>c(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nh.i,{}),(0,i.jsxs)(ei.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 iK(){let e=(0,nP._)(["\n
","\n\n ","\n\n
"]);return iK=function(){return e},e}let iJ=()=>{let[,e]=(0,eb.TH)(),[,n]=(0,eb.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=tw(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:W.checks(),queryFn:nV,refetchOnMount:!0}),h=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,j.useState)(d||[]),{mutate:p}=(0,n8.D)({mutationFn:e=>nU(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.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 nW();t.invalidateQueries({queryKey:W.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)(to,{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)(e7.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nu.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(n_.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tk.RI)(iK(),t_(e),tS(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)(n0.T,{})})}),(0,i.jsx)(nh.i,{}),(0,i.jsx)(iV,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(eb.rs,{children:(0,i.jsx)(eb.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(iP,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(eU.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};var iB=t(25356);async function iU(e,n){return await eo("query",e,n)}async function iQ(e,n){return await eo("query_base",e,n)}async function iZ(e,n){return await eo("query_diff",e,n)}var iX=t(67619),iG=t(58565),iY=t(49468);let i$=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)(iX.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nw.v,{isLazy:!0,closeOnSelect:!1,children:[(0,i.jsx)(nC.j,{width:"100%",children:(0,i.jsx)(ny.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)(n7.h,{children:(0,i.jsxs)(nS.q,{zIndex:"dropdown",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nz.k,{children:(0,i.jsxs)(iG.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[s.map((n,t)=>(0,i.jsx)(iG.U,{children:(0,i.jsxs)(nQ.Vp,{size:e.size,children:[(0,i.jsx)(nQ.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(nQ.SD,{paddingRight:"8px",onClick:()=>{o(s.filter(e=>e!==n)),l(s.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iG.U,{width:"100%",children:(0,i.jsx)(ny.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)(t0.R,{}),(0,i.jsxs)(nz.k,{children:[""!==a&&!(null==r?void 0:r.includes(a))&&(0,i.jsxs)(nR.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)(nR.s,{onClick:()=>x(e),children:e},"option-".concat(n)))]})]})})]}),(0,i.jsx)(iY.x,{children:(0,i.jsx)(er.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",hidden:0===s.length,onClick:()=>{c(""),o([]),l([])},children:"Clear"})})]})},i0=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=ef(),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)(ew.NI,{m:"4px 8px",children:[(0,i.jsxs)(eC.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nu.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",children:(0,i.jsx)(tP.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(i$,{unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:t,size:"xs",width:"240px",placeholder:"Start by typing key name..."})]})})},i1=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nq();return(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:"History"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(s.J,{as:eG.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(it({name:"hide"}),t()):(it({name:"show"}),n())},children:e?"Hide":"Show"})]})},i2=()=>{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)(nu.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tP.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iB.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&l&&l(t),n(!e)}})]})},i5=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:l,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:c}=_(),{envInfo:d}=ef(),u=e;(null==d?void 0:d.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=nq(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iU;case"query_base":return iQ;case"query_diff":return iZ;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 ea(l)},{mutate:p,isPending:f}=(0,n8.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)(i1,{}),(0,i.jsx)(i2,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(i0,{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)(r.xu,{width:"100%",flex:"1",children:c?(0,i.jsx)(tE,{value:u,baseValue:n,onChange:t,onChangeBase:l,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tT,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var i4=t(30148);let i3=e=>(0,i4.c4)("#!"+e),i9=()=>[(0,i4.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),i3];var i6=t(24681),i8=t(62843);let i7=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ea(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)(tO,{isPending:r,error:l,run:s,RunResultView:o})},re=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(eU.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)(er.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},rn=e=>{let{children:n}=e;return(0,i.jsx)(tI.SV,{fallback:re,children:n})};async function rt(){return(await B.post("/api/export")).data}async function ri(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await B.post("/api/import",t)).data}async function rr(){return 208===(await B.get("/api/sync")).status}async function rl(e){try{let n=await B.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,iw.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var rs=t(16021);function ro(){let e=(0,X.p)(),n=async()=>{try{let e=await rt(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,im.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");ig()(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)(nu.u,{label:"Export",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:rs.tRY,boxSize:"1.2em"})})})}function ra(e){let{checksOnly:n}=e,t=(0,X.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,ey.q)(),[m,p]=(0,eb.TH)(),[,f]=eg(),g=(0,j.useCallback)(async()=>{if(c){try{let{runs:e,checks:i}=await ri(c,n);f(),await r.invalidateQueries({queryKey:W.checks()}),await r.invalidateQueries({queryKey:W.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)(nu.u,{label:"Import",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{l.current&&l.current.click()},icon:(0,i.jsx)(s.J,{as:rs.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)(iS.a,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(Y.Z,{children:(0,i.jsxs)(iS._,{children:[(0,i.jsx)(ee.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(en.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)(tP.s,{color:"red.600"}),(0,i.jsx)(et.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(et.x,{children:["The current ",v," will be"," ",(0,i.jsx)(et.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(ei.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 rc=t(93126),rd=t(1026),ru=t(13154),rh=t(99434),rx=t(20143),rm=t(89830),rp=t(13276),rf=t(31610);function rg(e){let n=(0,rf.D)(e);return(0,im.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function rv(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)(tc.HC,{ml:"10px",children:[n,": ",t]},n)})}function rj(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ef(),{isOpen:m,onOpen:p,onClose:f}=(0,ey.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,k=(null==y?void 0:y.generated_at)?rg(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?rg(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)(nu.u,{label:"Environment Info",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n5.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(G.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{children:"Environment Information"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.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)(tc.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tc.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&rv(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)(tc.QI,{spacing:1,children:g&&rv(g)})]})}),(0,i.jsx)(nh.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)(rc.x,{children:(0,i.jsxs)(rd.i,{variant:"simple",children:[(0,i.jsx)(ru.h,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rx.Th,{}),(0,i.jsx)(rx.Th,{children:"base"}),(0,i.jsx)(rx.Th,{children:"current"})]})}),(0,i.jsxs)(rm.p,{children:[(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"schema"}),(0,i.jsx)(rp.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(rp.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"version"}),(0,i.jsx)(rp.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(rp.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"timestamp"}),(0,i.jsx)(rp.Td,{children:k}),(0,i.jsx)(rp.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)(rc.x,{children:(0,i.jsxs)(rd.i,{variant:"simple",children:[(0,i.jsx)(ru.h,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rx.Th,{}),(0,i.jsx)(rx.Th,{children:"base"}),(0,i.jsx)(rx.Th,{children:"current"})]})}),(0,i.jsx)(rm.p,{children:(0,i.jsxs)(rh.Tr,{children:[(0,i.jsx)(rp.Td,{children:"Environment"}),(0,i.jsx)(rp.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(rp.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var ry=t(21166),rb=t(43399),rk=t(60057);function rw(){return(0,i.jsx)(nu.u,{label:"Syncing",children:(0,i.jsx)(er.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tA.$,{})})})}function rC(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[l,o]=(0,eb.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ey.q)(),[u,h]=(0,j.useState)(""),x=(0,X.p)(),m=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await rl(e)).status){c(),n(!1);return}for(;await rr();)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:W.lineage()}),t.invalidateQueries({queryKey:W.checks()}),t.invalidateQueries({queryKey:W.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)(rw,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nu.u,{label:"Sync with Cloud",children:(0,i.jsx)(n_.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:rs.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(G.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{children:[(0,i.jsx)(ee.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(en.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)(ry.E,{onChange:h,value:u,children:(0,i.jsxs)(tz.K,{direction:"column",children:[(0,i.jsxs)(rb.Y,{value:"merge",children:["Merge",(0,i.jsx)(nu.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rk.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rb.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nu.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:rk.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rb.Y,{value:"revert",children:["Revert",(0,i.jsx)(nu.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:rk.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(ei.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 r_(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(iO,{viewMode:"changed_models",interactive:!0})})}async function rS(){return(await B.get("/api/flag")).data}async function rz(){try{await B.post("/api/onboarding/completed")}catch(e){}}var rR=()=>{let[e,n]=(0,j.useState)(!1);(0,j.useEffect)(()=>{rS().then(e=>{let t=e.show_onboarding_guide;!localStorage.getItem("hasVisited")&&t&&(n(!0),localStorage.setItem("hasVisited","true"))})},[]);let t=()=>{n(!1),rz()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(G.u_,{isOpen:e,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(Y.Z,{}),(0,i.jsxs)($.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(ee.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(ev.o,{}),(0,i.jsx)(en.f,{children:(0,i.jsxs)(tz.K,{spacing:4,children:[(0,i.jsxs)(tc.aV,{spacing:2,children:[(0,i.jsx)(tc.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tc.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tc.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nh.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(ei.m,{children:(0,i.jsx)(er.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})})},rT=t(1873);let rE=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,im.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,im.WU)(e,"HH:mm"):(0,im.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)(tA.$,{size:"xs",color:"".concat(l,".400")}),(0,i.jsx)(et.x,{fontWeight:500,color:"".concat(l,".400"),children:s}),(0,i.jsx)(et.x,{children:"•"}),(0,i.jsx)(et.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},rD=e=>{let n=iA.ZP.stringify(e,null,2);return(0,i.jsx)(tR.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}})},rI=e=>{var n,t,r;let{runId:l,onClose:s}=e,{runAction:a}=nq(),{error:c,run:d,onCancel:f,isRunning:g}=iN(l),[v,y]=(0,j.useState)(),k=(0,b.NL)(),[,w]=(0,eb.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(!l)return;let e=await nH(l,v);k.invalidateQueries({queryKey:W.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}=iy();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)(rE,{run:d}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n$.n,{}),variant:"outline",isDisabled:!l||g,size:"sm",onClick:z,children:"Rerun"}),(0,i.jsx)(er.z,{leftIcon:(0,i.jsx)(n0.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)(er.z,{leftIcon:(0,i.jsx)(rT.n,{}),isDisabled:!l||!(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)(rT.n,{}),isDisabled:!l||!(null==d?void 0:d.result)||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Add to Checklist"}),(0,i.jsx)(t1.P,{onClick:()=>{s&&s()}})]})]})}),0===C&&(0,i.jsx)(tO,{ref:I,error:c,run:d,onCancel:f,viewOptions:v,onViewOptionsChanged:y,RunResultView:S}),1===C&&d&&(0,i.jsx)(rD,{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)(tE,{value:d.params.sql_template,baseValue:d.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tT,{value:(null==d?void 0:null===(r=d.params)||void 0===r?void 0:r.sql_template)||"",options:{readOnly:!0}}))]})},rO=e=>{let{onClose:n}=e,{runId:t}=nq();return(0,i.jsx)(rI,{runId:t,onClose:n})};var rM=t(22661);t(86777);let rA=e=>{var n;let{run:t,isSelected:l,onSelectRun:a,onAddToChecklist:c,onGoToCheck:d}=e,{data:u}=(0,y.a)({queryKey:W.run(t.run_id),queryFn:async()=>await ea(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)||ek.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:l?"orange.400":"transparent",backgroundColor:l?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:l?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nu.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(et.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(x)},children:(0,i.jsx)(s.J,{color:"green",as:td.FJM})})}):(0,i.jsx)(nu.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(et.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),it({name:"add_to_checklist"}),c(t.run_id)},children:(0,i.jsx)(s.J,{as:td.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(rE,{run:u||t})})]})},rL=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,im.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})},rN=()=>{let{data:e,isLoading:n,isFetching:t,error:l,refetch:s}=(0,y.a)({queryKey:W.runs(),queryFn:async()=>await eh(),retry:!1}),{showRunId:a,runId:d}=nq(),x=e=>{it({name:"click_run"}),a(e,!1)},[,m]=(0,eb.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!d)return;let e=await nH(d);p.invalidateQueries({queryKey:W.checks()}),m("/checks/".concat(e.check_id))},[d,m,p]),g=(0,j.useCallback)(e=>{it({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)(n_.h,{variant:"unstyled",icon:(0,i.jsx)(n$.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)(eU.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(rM.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)(rL,{runAt:e.run_at},t),(0,i.jsx)(rA,{run:e,isSelected:e.run_id===d,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var rq=t(65627),rF=t(78032);let{definePartsStyle:rP,defineMultiStyleConfig:rW}=(0,rF.D)(rq.TB.keys),rH=rW({variants:{circular:rP({control:(0,rF.k0)({rounded:"full"})})},sizes:{xs:rP({icon:(0,rF.k0)({fontSize:"8px"}),control:(0,rF.k0)({boxSize:"16px",padding:"4px"}),label:(0,rF.k0)({fontSize:"xs"})})}}),rV=(0,t(62821).fj)({baseStyle:{borderRadius:"4px"}}),rK=e=>{let{children:n,path:t}=e,[l]=(0,eb.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rJ(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 rB(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=ef(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await B.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:eG.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:eG.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rJ,{icon:td.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rJ,{icon:td.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rJ,{mr:"18px",icon:td.MXt,href:"https://datarecce.io/docs"})]})}function rU(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 rQ(){let{isDemoSite:e,reviewMode:n,cloudMode:t,isLoading:r}=ef(),[l,s]=(0,eb.TH)(),o=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(rU,{queryKey:W.checks(),fetchCallback:nV,selectCallback:e=>e.filter(e=>!e.is_checked).length})}],a=ez().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)(rC,{}),!e&&!t&&(0,i.jsx)(ra,{}),!e&&t&&n&&(0,i.jsx)(ra,{checksOnly:!0}),(0,i.jsx)(ro,{})]}),(0,i.jsx)(rj,{})]})})}function rZ(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nq(),[l]=(0,eb.TH)(),s=e&&!l.startsWith("/checks"),o=n&&!l.startsWith("/checks");return(0,i.jsxs)(to,{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)(rN,{})}),(0,i.jsxs)(ta,{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)(rn,{children:[(0,i.jsx)(rK,{path:"/lineage",children:(0,i.jsx)(r_,{})}),(0,i.jsxs)(eb.rs,{children:[(0,i.jsx)(eb.AW,{path:"/query",children:(0,i.jsx)(i5,{})}),(0,i.jsx)(eb.AW,{path:"/checks/:slug*",children:(0,i.jsx)(iJ,{})}),(0,i.jsx)(eb.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(i7,{runId:n})}}),(0,i.jsx)(eb.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eb.AW,{children:(0,i.jsx)(eb.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(rO,{onClose:t}):(0,i.jsx)(r.xu,{})]})]})}let rX=(0,g.B1)({components:{Checkbox:rH,Tooltip:rV}});function rG(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=t7.env.AMPLITUDE_API_KEY;if(n&&t)try{t8.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,i6.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(i8.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rX,children:(0,i.jsx)(b.aH,{client:U,children:(0,i.jsx)(eb.F0,{hook:i9,children:(0,i.jsx)(nF,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(rB,{}),(0,i.jsx)(rQ,{}),(0,i.jsx)(rR,{}),(0,i.jsx)(rZ,{})]})})})})})})}},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/index.html b/recce/data/index.html index a86cc5f0..a0751f5a 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 f480a4fd..2eca47f3 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-29cfb245a1734f65.js"],""] +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-0714a6eda477b882.js"],""] 4:I[4737,[],""] 5:I[25587,[],""] -0:["FGdX4o1OUrZsieYxbbY-A",[[["",{"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:["9Er9jEAeZsFoezU1ifSCK",[[["",{"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