diff --git a/recce/data/404.html b/recce/data/404.html index fab76226..efa7a342 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/FVKFEVpAaj9eCK1kKWvsK/_buildManifest.js b/recce/data/_next/static/XWZYyxLIzM2aLMynOggAS/_buildManifest.js similarity index 100% rename from recce/data/_next/static/FVKFEVpAaj9eCK1kKWvsK/_buildManifest.js rename to recce/data/_next/static/XWZYyxLIzM2aLMynOggAS/_buildManifest.js diff --git a/recce/data/_next/static/FVKFEVpAaj9eCK1kKWvsK/_ssgManifest.js b/recce/data/_next/static/XWZYyxLIzM2aLMynOggAS/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/FVKFEVpAaj9eCK1kKWvsK/_ssgManifest.js rename to recce/data/_next/static/XWZYyxLIzM2aLMynOggAS/_ssgManifest.js diff --git a/recce/data/_next/static/chunks/app/page-a45ba089836f5014.js b/recce/data/_next/static/chunks/app/page-e01eee4993747e94.js similarity index 65% rename from recce/data/_next/static/chunks/app/page-a45ba089836f5014.js rename to recce/data/_next/static/chunks/app/page-e01eee4993747e94.js index 9fb0e35f..498d53ef 100644 --- a/recce/data/_next/static/chunks/app/page-a45ba089836f5014.js +++ b/recce/data/_next/static/chunks/app/page-e01eee4993747e94.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,53819))},53819:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ra}});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(26138),h=t(79481),x=t(78939),m=t(63993),p=t(83246),f=t(19046),g=t(50068),v=t(66518),j=t(57489),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,v.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{}});function C(e){let{children:n}=e,[t,r]=v.useState(k),[l,s]=v.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:r,sqlQuery:t,setPrimaryKeys:s,primaryKeys:l},children:n})}let _=()=>(0,v.useContext)(w),S=(0,v.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,r]=v.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:r},children:n})}var R=t(48510);function T(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,r={},l=(e,t)=>{if(!(t<0)&&(void 0===r[e]||!(r[e]>=t))){for(let i of(r[e]=t,n(e)))l(i,t-1);i.add(e)}};for(let n of e)l(n,t);return i}function E(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var O=t(28482),I=t.n(O);function A(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function N(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,t){let i=[],r=[];function l(e){return"base"===e?0:"current"===e?2:1}function s(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let o=n?function(e,n){var t;let i=Object.values(e.nodes);if("changed_models"===(n.view_mode||"changed_models")){let n=E(A(e,e.modifiedSet,1),N(e,e.modifiedSet));i=i.filter(e=>n.has(e.id))}if(void 0!==n.node_ids){let e=new Set(n.node_ids);i=i.filter(n=>e.has(n.id))}let r=void 0!==n.packages?n.packages:(null===(t=e.manifestMetadata.current)||void 0===t?void 0:t.project_name)?[e.manifestMetadata.current.project_name]:void 0;return void 0!==r&&(i=i.filter(e=>!!e.packageName&&r.includes(e.packageName))),new Set(i.map(e=>e.id))}(e,n):void 0;for(let n of(null!=t&&(o=o?function(){for(var e=arguments.length,n=Array(e),t=0;te.has(n)));return i}(o,new Set(t)):new Set(t)),Object.values(e.nodes).sort(s)))(!o||o.has(n.id))&&i.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(s))(!o||o.has(n.parent.id)&&o.has(n.child.id))&&r.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return D(i,r),L(Array.from(N(e,e.modifiedSet)),i,r)}let D=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(I()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),I().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function 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 F(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=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],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var H=t(62330),V=t(39588);let J=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var K=t(94614);let U=H.default.create({baseURL:J}),B=new K.S;async function Q(){return(await U.get("/api/info")).data}async function Z(e){return(await U.get("/api/model/".concat(e))).data}var X=t(99873),Y=t(85929),$=t.n(Y);async function G(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ee(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function en(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function et(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ei(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function er(){return(await U.post("/api/runs/aggregate",{})).data}let el=(0,v.createContext)({});function es(e){let{refetch:n}=e,t=(0,X.p)(),[r,l]=(0,v.useState)(),s=(0,b.NL)();return(0,v.useEffect)(()=>{let e=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));return l(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:i}=n.event,[r,l]=i.split("/").slice(-2),o=$().parse(l).name;t({description:"Detected ".concat(r," ").concat(o," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),s.invalidateQueries({queryKey:W.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,s]),(0,i.jsx)(i.Fragment,{})}function eo(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:er}),u=(0,v.useMemo)(()=>{let e=null==l?void 0:l.lineage;if(e&&e.base&&e.current)return function(e,n){let t={},i={},r=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=r(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=r(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,r]of Object.entries(e.parent_map))for(let e of r){let r=t[n],l=t[e],s="".concat(e,"_").concat(n);if(!r||!l)continue;i[s]={id:s,from:"base",parent:l,child:r};let o=i[s];r.parents[e]=o,l.children[n]=o}for(let[e,r]of Object.entries(n.parent_map))for(let n of r){let r=t[e],l=t[n],s="".concat(n,"_").concat(e);if(!r||!l)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:l,child:r};let o=i[s];r.parents[n]=o,l.children[e]=o}let l=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",l.push(n.id);else if("current"===n.from)n.changeStatus="added",l.push(n.id);else{var s,o,a,c,d,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(d=u.current)||void 0===d?void 0:null===(c=d.checksum)||void 0===c?void 0:c.checksum;e&&t&&e!==t&&(n.changeStatus="modified",l.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:l,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(e.base,e.current)},[l]),h=null==o?void 0:o.message,x=null==l?void 0:l.lineage,m=null==l?void 0:l.demo,p=null==l?void 0:l.review_mode,f=null==l?void 0:l.cloud_mode,g=null==l?void 0:l.file_mode,j=null==l?void 0:l.adapter_type,b=null==l?void 0:l.git,k={adapterType:j,git:b,pullRequest:null==l?void 0:l.pull_request,dbt:{base:null==x?void 0:null===(n=x.base)||void 0===n?void 0:n.manifest_metadata,current:null==x?void 0:null===(t=x.current)||void 0===t?void 0:t.manifest_metadata},sqlmesh:null==l?void 0:l.sqlmesh};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es,{refetch:a}),(0,i.jsx)(el.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:k,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,refetchRunsAggregated:()=>{d()}},children:r})]})}let ea=()=>(0,v.useContext)(el),ec=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ea();return[e,n]};var ed=t(17695),eu=t(62628),eh=t(68830),ex=t(96985),em=t(69384),ep=t(7797),ef=t(13844),eg=t(64653);let ev=e=>{let{isOpen:n,onClose:t,onExecute:l,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,v.useState)(c),[x,m]=(0,v.useState)(!1);return(0,i.jsxs)(ed.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ex.x,{children:a}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.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)(ef.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(eg.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var ej=t(65952),ey=t(76330),eb=t(53152),ek=t(18222),ew=t(30678),eC=t(2838),e_=t(13156),eS=t.n(e_);function ez(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 eR=e=>{var n;let{lineageGraph:t}=ea(),[i,r]=(0,v.useState)([]),[l,s]=(0,v.useState)(),[o,a]=(0,v.useState)(!0),[c,d]=(0,v.useState)(null),u=eS().find(null==t?void 0:t.nodes,{name:e}),h=(0,v.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return ez(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,v.useEffect)(()=>{let e=async()=>{try{let e=(await 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(ez(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}},eT=t(68825),eE=t(81945),eO=t(14827);function eI(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 eA(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",eM="#F6AD55",eD="".concat(eN,"A5"),eL="".concat(eM,"A5");function eF(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 eq(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eE.kL.register(eE.ZL,eE.RM,eE.f$,eE.uw,eE.u);let l=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasets:i,type:r,samples:l=0,binEdges:s}=e,[o,a]=i,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eW(s,n);return"".concat(c?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,r=0===n?a.counts:o.counts,s=eI(r[t]/l),c=r[t];return"".concat(i,": ").concat(c," (").concat(s,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:r,binEdges:l}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,c=Math.max(...a.counts,...o.counts),d=l.map((e,n)=>eW(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 eA(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=eP(t,i,"Current",eD,l),o=eP(t,i,"Base",eL,r);return{labels:i.map((e,n)=>eW(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(u.L,{}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eL})," Base"]}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eD})," Current"]}),(0,i.jsx)(u.L,{})]}),(0,i.jsx)(eO.kL,{type:"bar",options:l,data:s,plugins:[]})]})}function eP(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 eW(e,n){let t=e[n],i=e[n+1],r=eA(t),l=eA(i);return"".concat(r," - ").concat(l)}var eH=t(20074),eV=t(48289),eJ=t(81737),eK=t.n(eJ),eU=t(77249);function eB(){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})}}}var eQ=t(50228),eZ=t(67605),eX=t.n(eZ);let eY="ignore-screenshot";function e$(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:x,ignoreElements:m}=e,[p,f]=(0,v.useState)("idle"),g=(0,v.useRef)(null),{onOpen:j,setImgBlob:y,ImageDownloadModal:b}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ej.q)(),[r,l]=(0,v.useState)();return{onOpen:n,setImgBlob:l,ImageDownloadModal:function(){let[n,l]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!r)return;let e=new FileReader;e.readAsDataURL(r),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&l(e.target.result)}},[l]),(0,i.jsxs)(ed.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{children:"Screenshot Preview"}),(0,i.jsx)(em.o,{}),(0,i.jsxs)(ep.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)(eV.s,{color:"red.600"}),(0,i.jsx)(h.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(h.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,eQ.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");eX()(r,n),t()},children:"Download"})]})]})]})}}}(),k=async()=>{if(!g.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=g.current.element||g.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; }"),f("loading");let i="html2canvas"===n?await eK()(e,{logging:!1,backgroundColor:null,ignoreElements:m}):await (0,eU.rT)(e,{filter:m?e=>!m(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:p,isLoading:"loading"===p,isErrored:"error"===p,isSuccess:"success"===p,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:k()})]),f("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(y(await k()),j(),f("success")):(f("error"),console.error("Error copying to clipboard",e),x&&x(e))}},ImageDownloadModal:b,ref:g}}function eG(e){let{successToast:n,failToast:t}=eB(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=e$({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)}});return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eg.z,{size:"sm",leftIcon:(0,i.jsx)(eH.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:r,onMouseEnter:()=>{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"}},onMouseLeave:()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},onClick:async()=>{o.current&&(await l(),(o.current.element||o.current).style.boxShadow="")},children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})}}}let e0=e=>{let{backgroundColor:n="white",blockSize:t,children:l,...s}=e,{ref:o,CopyToClipboardButton:a}=eG({backgroundColor:n});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.xu,{ref:o,...s,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.xu,{backgroundColor:n,height:"100%",blockSize:t,children:l})}),(0,i.jsx)(a,{imageType:"png"})]})};var e1=t(24112);t(63156);var e2=t(22204);function e5(e){let{enableScreenshot:n=!0,...t}=e,{ref:r,CopyToClipboardButton:l}=eG();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e2.ZP,{ref:r,...t}),n&&(0,i.jsx)(l,{imageType:"png"})]})}function e4(){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)(h.x,{fontWeight:"600",children:" No rows"})})}t(87679);var e9=t(52091);function e3(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 e6(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 e8(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 e7(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?e9.ven:e9.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?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let ne=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]},nn=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(h.x,{style:{color:"gray"},children:"-"});let[r,l]=ne(n[t.key]);return(0,i.jsx)(h.x,{style:{color:l?"gray":"inherit"},children:r})};function nt(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(e3(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=e6(r.columns,s);r.data.forEach((n,t)=>{let i=e8(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e6(l.columns,s),l.data.forEach((n,t)=>{let i=e8(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=e3(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||eS().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(!eS().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e7,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,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)(e7,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nn})}),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}}function ni(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?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nr(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=e3(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))&&(eS().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(!eS().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nn})}),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 nl=t(93998),ns=t(18454),no=t(25773),na=t(16257),nc=t(32088),nd=t(39171);let nu=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)(no.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(nl.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(u.L,{minHeight:"32px"}),(0,i.jsx)(na.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)(nc.u,{label:"Add to Checklist",children:(0,i.jsx)(nd.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,i.jsx)(ns.d,{}),onClick:()=>s(n)})})]})},nh=e=>{var n,t,r,l,s,a;let{run:c,onAddToChecklist:d,viewOptions:u,onViewOptionsChanged:h}=e,x=(0,v.useMemo)(()=>(null==u?void 0:u.primary_keys)||[],[u]),m=(0,v.useMemo)(()=>(null==u?void 0:u.changed_only)||!1,[u]),p=(0,v.useMemo)(()=>(null==u?void 0:u.pinned_columns)||[],[u]),f=(0,v.useMemo)(()=>{var e,n;return nt(null==c?void 0:null===(e=c.result)||void 0===e?void 0:e.base,null==c?void 0:null===(n=c.result)||void 0===n?void 0:n.current,{changedOnly:m,primaryKeys:x,onPrimaryKeyChange:e=>{h&&h({...u,primary_keys:e})},pinnedColumns:p,onPinnedColumnsChange:e=>{h&&h({...u,pinned_columns:e})}})},[c,u,m,x,p,h]),g=(0,v.useMemo)(()=>{let e=x.join(", ");return f.invalidPKeyBase&&f.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):f.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):f.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[f.invalidPKeyBase,f.invalidPKeyCurrent,x]),j=(null===(t=c.result)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.limit)||0,y=j>0&&((null==c?void 0:null===(l=c.result)||void 0===l?void 0:null===(r=l.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(a=c.result)||void 0===a?void 0:null===(s=a.base)||void 0===s?void 0:s.more))?"Warning: Displayed results are limited to ".concat(j.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,b=[];return(g&&b.push(g),y&&b.push(y),0===f.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):m&&0===f.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:c,viewOptions:u,onAddToChecklist:d,onViewOptionsChanged:h,warnings:b}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:c,viewOptions:u,onAddToChecklist:d,onViewOptionsChanged:h,warnings:b}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:f.columns,rows:f.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nx=e=>{var n,t,r,l;let{run:s,onAddToChecklist:a,viewOptions:c,onViewOptionsChanged:d}=e,u=(0,v.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),h=(0,v.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),x=(0,v.useMemo)(()=>{var e,n;if(!(null===(e=s.result)||void 0===e?void 0:e.diff)||!(null==s?void 0:null===(n=s.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=s.params.primary_keys;return nr(null==s?void 0:s.result.diff,t,{changedOnly:u,pinnedColumns:h,onPinnedColumnsChange:e=>{d&&d({...c,pinned_columns:e})}})},[s,c,u,h,d]),m=(null===(t=s.result)||void 0===t?void 0:null===(n=t.diff)||void 0===n?void 0:n.limit)||0,p=m>0&&(null==s?void 0:null===(l=s.result)||void 0===l?void 0:null===(r=l.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(m.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,f=[];return(p&&f.push(p),0===x.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):u&&0===x.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:s,viewOptions:c,onAddToChecklist:a,onViewOptionsChanged:d,warnings:f}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:s,viewOptions:c,onAddToChecklist:a,onViewOptionsChanged:d,warnings:f}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nm=e=>{var n;return(null===(n=e.run)||void 0===n?void 0:n.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff?(0,i.jsx)(nx,{...e}):(0,i.jsx)(nh,{...e})};function np(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?e9.$kI:e9.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let nf=e=>{let{run:n,viewOptions:t,onViewOptionsChanged:l,onAddToChecklist:s}=e,a=(0,v.useMemo)(()=>(null==t?void 0:t.pinned_columns)||[],[t]),c=null==n?void 0:n.result,d=(0,v.useMemo)(()=>c?function(e,n){let t=[],r=n.pinnedColumns||[],l=(e,t)=>({key:String(e),name:(0,i.jsx)(np,{name:t,...n}),width:"auto",renderCell:nn});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=eS().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}}(c,{pinnedColumns:a,onPinnedColumnsChange:e=>{l&&l({...t,pinned_columns:e})}}):{rows:[],columns:[]},[c,a,t,l]);if(0===d.columns.length)return(0,i.jsx)(e1.M,{height:"100%",children:"No data"});let h=(null==c?void 0:c.limit)||0,x=h>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(h.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,m=s||x;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[m&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:x?"orange.100":"inherit",children:[x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nl.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.xu,{children:x})]}),(0,i.jsx)(u.L,{minHeight:"32px"}),s&&(0,i.jsx)(nc.u,{label:"Add to Checklist",children:(0,i.jsx)(nd.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,i.jsx)(ns.d,{}),onClick:()=>s(n)})})]}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};function ng(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 nv=t(96124);let nj="#63B3ED";function ny(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:eA(o),displayRatio:eI(o/e.valids)||"N/A"}})}function nb(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nc.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(h.x,{children:[(0,i.jsx)(eF,{color:eN}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(h.x,{children:[(0,i.jsx)(eF,{color:eM}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nk(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=ny(n.current,t),s=ny(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)(u.L,{}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eM})," Base"]}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eN})," Current"]}),(0,i.jsx)(u.L,{})]}),l.map((e,t)=>{let r=s[t];return e.isLastItemOthers&&0===e.count&&0===r.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(v.Fragment,{children:[(0,i.jsx)(nb,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(h.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)(nw,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eN}),(0,i.jsx)(h.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(h.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nw,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eM}),(0,i.jsx)(h.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(h.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nv.i,{})]},t)})]})}function nw(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nj}=e;eE.kL.register(eE.uw,eE.ZL,eE.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=nj}=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)(eO.$Q,{data:a,options:o,plugins:[]})}var nC=t(93960),n_=t(66011);function nS(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,[s,o]=(0,v.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,c=null==n?void 0:n.primary_key,{columns:d,primaryKey:u,isLoading:h,error:x}=eR(n.model);(0,v.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,v.useEffect)(()=>{l(!!c&&!!a)},[c,a,l]);let m=d.map(e=>e.name),p=Array.isArray(c)?c:c?[c]:void 0;return h?(0,i.jsx)(r.xu,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(no.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Model"}),(0,i.jsx)(nC.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Primary key"}),(0,i.jsx)(n_.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)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Columns"}),(0,i.jsx)(na.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(n_.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 nz=t(49801),nR=t(50104),nT=t(78439),nE=t(39226),nO=t(70949),nI=t(34510);function nA(e){let{params:n,column:t,containerRef:l}=e,{runAction:a}=nW(),c=(e,t)=>{a("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)(u.L,{}),(0,i.jsx)(nz.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nR.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nd.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nT.h,{containerRef:l,children:(0,i.jsx)(nE.q,{lineHeight:"20px",children:(0,i.jsxs)(nO.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nI.s,{fontSize:"10pt",onClick:()=>c({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nI.s,{fontSize:"10pt",onClick:()=>c({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}var nN=t(18502),nM=t(63594);let nD={lineage_diff:{title:"Lineage Diff",icon:eb.Ks7},schema_diff:{title:"Schema Diff",icon:nM.C8A},query:{title:"Query",icon:eb.r2i,RunResultView:nf},query_diff:{title:"Query Diff",icon:eb.r2i,RunResultView:nm},row_count_diff:{title:"Row Count Diff",icon:nM.QUK,RunResultView:function(e){let{run:n}=e;function t(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=n.result||{},l=Object.keys(n.result||{}).map(e=>{let n=r[e],t=(null==n?void 0:n.base)||null,i=(null==n?void 0:n.curr)||null,l="No Change";return null!==t&&null!==i?l=t!==i?ng(t,i):"No Change":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===l.length?(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:t},{key:"base",name:"Base Rows",cellClass:t},{key:"current",name:"Current Rows",cellClass:t},{key:"delta",name:"Delta",cellClass:t}],rows:l,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},className:"rdg-light",enableScreenshot:!0})})})}},profile_diff:{title:"Profile Diff",icon:eb.KA6,RunResultView:function(e){var n;let{run:t,viewOptions:r,onViewOptionsChanged:l}=e,s=t.result;t.params;let o=(0,v.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),a=((null==s?void 0:null===(n=s.current)||void 0===n?void 0:n.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==a?void 0:a.name)||"column_name",d=(0,v.useMemo)(()=>nt(null==s?void 0:s.base,null==s?void 0:s.current,{primaryKeys:[c],pinnedColumns:o,onPinnedColumnsChange:e=>{l&&l({...r,pinned_columns:e})}}),[s,c,o,r,l]);return 0===d.columns.length?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})}},value_diff:{title:"Value Diff",icon:eb.pRi,RunResultView:function(e){let{run:n}=e,t=n.result,l=n.params,a=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=(0,v.useRef)(),d=Array.isArray(l.primary_key)?l.primary_key:[l.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e1.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:e9.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nA,{column:n[t.key],params:l,containerRef:c})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:a},{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:a}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",ref:c,children:[(0,i.jsxs)(r.xu,{px:"16px",children:["Model: ",l.model,", ",t.summary.total," total (",t.summary.total-t.summary.added-t.summary.removed," ","common, ",t.summary.added," added, ",t.summary.removed," removed)"]}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:t.data.data,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})},RunForm:nS},value_diff_detail:{title:"Value Diff Detail",icon:eb.pRi,RunResultView:e=>{var n,t;let{run:r,onAddToChecklist:l,viewOptions:s,onViewOptionsChanged:a}=e,c=(0,v.useMemo)(()=>(null==s?void 0:s.changed_only)||!1,[s]),d=(0,v.useMemo)(()=>(null==s?void 0:s.pinned_columns)||[],[s]),u=(0,v.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nr(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:d,onPinnedColumnsChange:e=>{a&&a({...s,pinned_columns:e})}})},[r,s,c,d,a]),h=(null===(n=r.result)||void 0===n?void 0:n.limit)||0,x=h>0&&(null==r?void 0:null===(t=r.result)||void 0===t?void 0:t.more)?"Warning: Displayed results are limited to ".concat(h.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,m=[];return(x&&m.push(x),0===u.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):c&&0===u.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:r,viewOptions:s,onAddToChecklist:l,onViewOptionsChanged:a,warnings:m}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:r,viewOptions:s,onAddToChecklist:l,onViewOptionsChanged:a,warnings:m}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},RunForm:nS},top_k_diff:{title:"Top-K Diff",icon:nN.Pkc,RunResultView:function(e){let{run:n}=e,[t,r]=(0,v.useState)(!0),s=n.result,a=n.params,d=s.base,h=s.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e0,{blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",children:["Model ",a.model,".",a.column_name]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(u.L,{}),(0,i.jsx)(nk,{topKDiff:s,valids:h.valids||0,isDisplayTopTen:t}),(0,i.jsx)(u.L,{})]})]}),(0,i.jsx)(u.L,{}),(d.values.length>10||h.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(l.r,{onClick:()=>r(e=>!e),textColor:"blue.500",children:t?"View More Items":"View Only Top-10"})})]})},RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eR(n.model),c=s.map(e=>e.name);return((0,v.useEffect)(()=>{l(!!n.column_name)},[n,l]),o)?(0,i.jsx)(r.xu,{children:"Loading..."}):0===c.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eC.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:eb.dku,RunResultView:function(e){var n,t,l,s,a,d;let{run:h}=e,x=h.params,m=null===(n=h.result)||void 0===n?void 0:n.base,p=null===(t=h.result)||void 0===t?void 0:t.current,f=null===(l=h.result)||void 0===l?void 0:l.min,g=null===(s=h.result)||void 0===s?void 0:s.max,v=null===(a=h.result)||void 0===a?void 0:a.bin_edges;return m&&p?(0,i.jsx)(o.k,{direction:"column",height:"500px",children:(0,i.jsxs)(e0,{height:"100%",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:"4",textAlign:"center",children:["Model ",x.model,".",x.column_name]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(u.L,{}),(0,i.jsx)(r.xu,{w:"80%",h:"300px",m:"4",children:(0,i.jsx)(eq,{data:{type:(null===(d=h.params)||void 0===d?void 0:d.column_type)||"",datasets:[p,m],min:f,max:g,samples:m.total,binEdges:v}})}),(0,i.jsx)(u.L,{})]})]})}):(0,i.jsx)("div",{children:"Loading..."})},RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eR(n.model),c=s.filter(e=>!["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.type.toUpperCase())&&!["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.type.toUpperCase()));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)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eC.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))})]})})}}},nL=e=>nD[e],nF=(0,v.createContext)({runAction:()=>{},showRunId:e=>{},isOpen:!1,close:()=>{}}),nq=e=>{let[n]=(0,ey.TH)();(0,v.useEffect)(()=>{e()},[e,n])};function nP(e){var n;let{children:t}=e,[r,l]=(0,v.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ej.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ej.q)(),h=(0,X.p)(),[x,m]=(0,v.useState)(),[p,f]=(0,ey.TH)(),g=(0,v.useCallback)(e=>{m(e),d()},[m,d]),j=(0,v.useCallback)(async(e,n,t)=>{try{let i;let r=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ei(e,n,1);1===t.length&&(i=t[0])}let s=nL(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 G(e,n,{nowait:!0});g(t),p.startsWith("/lineage")&&f("/lineage")}}catch(e){h({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[l,o,g,h,p,f]);nq(a);let y=async(e,n)=>{try{a();let{run_id:t}=await G(e,n,{nowait:!0});g(t)}catch(e){h({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,v.useEffect)(()=>{x&&!p.startsWith("/lineage")&&f("/lineage")},[x]),(0,i.jsxs)(nF.Provider,{value:{runAction:j,runId:x,showRunId:g,isOpen:c,close:u},children:[r&&(0,i.jsx)(ev,{isOpen:s,onClose:a,onExecute:y,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 nW=()=>(0,v.useContext)(nF);function nH(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eo,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nP,{children:n})})})})})}var nV=t(81600);async function nJ(){return(await U.post("/api/checks",{type:"simple"})).data}async function nK(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function nU(){return(await U.get("/api/checks")).data}async function nB(e){return(await U.get("/api/checks/".concat(e))).data}async function nQ(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function nZ(e){return(await U.delete("/api/checks/".concat(e))).data}async function nX(e){return await U.post("/api/checks/reorder",e)}var nY=t(94734),n$=t(71738),nG=t(38414),n0=t(29598),n1=t(62216),n2=t(42675),n5=t(54097),n4=t(95862),n9=t(82960),n3=t(69879),n6=t(618),n8=t(77153);function n7(e){let{name:n,setName:t}=e,[l,s]=(0,v.useState)(!1),[o,a]=(0,v.useState)(n),c=(0,v.useRef)(null),d=(0,v.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,v.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l,c,d]),(0,i.jsxs)(n3.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n8.X,{color:"gray.500"}),children:[(0,i.jsx)(n6.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(n6.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(nC.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 te=t(94019);t(81974);var tn=t(89725),tt=t(13965);function ti(e){let n,t,{base:r,current:l,enableScreenshot:s=!1}=e,{columns:a,rows:c}=(0,v.useMemo)(()=>(function(e){function n(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 t(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:n},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:n},{key:"name",name:"Name",resizable:!0,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:t},{key:"currentType",name:"Current Type",resizable:!0,cellClass:t}],rows:Object.values(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(e3(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,r]=e;t[i].baseIndex=n+1,t[i].baseType=r.type}),Object.entries(n).map((e,n)=>{let[i,r]=e;t[i].currentIndex=n+1,t[i].currentType=r.type}),t}(null==r?void 0:r.columns,null==l?void 0:l.columns)),[r,l]),{lineageGraph:d}=ea(),u=!(null==d?void 0:d.catalogMetadata.base),h=!(null==d?void 0:d.catalogMetadata.current);u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let x=r&&void 0===r.columns,m=l&&void 0===l.columns;return x&&m?t="Schema information is missing on both current and base environments.":x?t="Schema information is missing on base environment.":m&&(t="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[n?(0,i.jsxs)(tn.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tt.z,{}),n]}):t?(0,i.jsxs)(tn.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tt.z,{}),t]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:a,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},className:"rdg-light",enableScreenshot:s})})]})}async function tr(e){return(await U.post("/api/select",e)).data}var tl=t(12282);t(15080);let ts=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tl.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},to=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tl.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var ta=t(79898),tc=t(68630),td=t(91363);let tu=e9.Nbv,th=e9.sFB,tx=e9.UGs;function tm(e){return"added"===e?{color:"#1dce00",icon:tu}:"removed"===e?{color:"#ff4444",icon:th}:"modified"===e?{color:"#ffa502",icon:tx}:{color:"inherit",icon:void 0}}function tp(e){if("model"===e)return{color:"#c0eafd",icon:tc.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:td._MV};if("source"===e)return{color:"#a6dda6",icon:tc.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:td.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:td.R1C};if("seed"===e)return{color:"#a6dda6",icon:tc.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tc.Dmm};else return{color:"inherit",icon:void 0}}function tf(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}=tp(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nL("schema_diff"))||void 0===m?void 0:m.icon,t=tm("modified").color}else!h&&x?(n=tm("added").icon,t=tm("added").color):h&&!x&&(n=tm("removed").icon,t=tm("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>c(l.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:l.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})};function tv(e){let{check:n}=e,{lineageGraph:t}=ea(),r=n.params,l=[...W.check(n.check_id),"select"],{isLoading:s,error:o,refetch:a,data:c}=(0,y.a)({queryKey:l,queryFn:async()=>tr({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[d,u]=(0,v.useMemo)(()=>{let e=[],n=[],i=[],l=[];if(null==r?void 0:r.node_id){let n=null==t?void 0:t.nodes[r.node_id];n&&e.push(n)}else for(let n of(null==c?void 0:c.nodes)||[]){let i=null==t?void 0:t.nodes[n];i&&e.push(i)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tf(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?i.push(e.id):e.data.base&&!e.data.current&&l.push(e.id)}function d(e){return n.includes(e.id)?3:i.includes(e.id)?2:l.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==c?void 0:c.nodes,t]),[h,x]=(0,v.useState)(0);if(s)return(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(o)return(0,i.jsxs)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==o?void 0:o.message]});if(0==d.length)return(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(h(0,i.jsx)(tg,{node:e,schemaChanged:u.includes(e.id),selected:n===h,onSelect:()=>{x(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})}var tj=t(51643);function ty(e){let{value:n,onChange:t}=e,[r,s]=(0,v.useState)(!1),[a,c]=(0,v.useState)(),d=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(r&&d.current){let e=d.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[r]),r)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tj.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)(eg.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(h.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tb=t(40902);function tk(){let e=(0,nV._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tk=function(){return e},e}function tw(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tC(e){return e.description?e.description:"_(no description)_"}var t_=t(31265),tS=e=>{let{value:n,onChange:t,onRun:r,onRunDiff:l,options:s={},...o}=e;return(0,i.jsx)(t_.ZP,{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.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,l)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...s}})},tz=t(23567);let tR=e=>{var n,t,l,s;let{isPending:a,isAborting:c,isCheckDetail: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===(t=h.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tn.b,{status:"error",children:[(0,i.jsx)(tt.z,{}),"Error: ",y]});if(a){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(l=x.progress)||void 0===l?void 0:l.message)?null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message:"Loading...";return(0,i.jsx)(e1.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(no.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)(tz.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tz.D,{size:"20px",value:100*u.percentage,mr:"8px"}),c?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!c&&(0,i.jsx)(eg.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return d?(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(eg.z,{onClick:j,colorScheme:"blue",size:"sm",children:"Run Query"})}):(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No Data"});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&&(0,i.jsx)(g,{run:x,viewOptions:p,onViewOptionsChanged:f}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})};var tT=t(65674),tE=t(29012),tO=t(25783),tI=t(43361),tA=t(49110),tN=t(55415),tM=t(24432);t(90548),t(91074);var tD=t(66633),tL=t(83143),tF=t(29937);function tq(e){let{node:n}=e,{icon:t}=tp(n.resourceType);return(0,i.jsx)(nc.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nY.Vp,{children:[(0,i.jsx)(nY.AD,{as:t}),(0,i.jsx)(nY.Sn,{children:n.resourceType})]})})}function tP(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)(eT.U,{children:[(0,i.jsx)(h.x,{children:l}),(0,i.jsx)(s.J,{as:tL.Rgz}),(0,i.jsx)(h.x,{children:o})]}):t===r?(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(h.x,{children:o}),(0,i.jsx)(s.J,{as:tF.lxc,color:"gray.500"}),(0,i.jsx)(h.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nc.u,{label:l,children:(0,i.jsxs)(nY.Vp,{children:[(0,i.jsx)(nY.AD,{as:x}),(0,i.jsx)(nY.Sn,{children:m||c?(0,i.jsx)(tD.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tP,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nY.bq,{as:nd.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n2.n,{}),size:"xs",onClick:a})]})})}let tH=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tz.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Skipped"}),s&&(0,i.jsx)(nc.u,{label:s,children:(0,i.jsx)(eV.s,{})})]});if(!a)return(0,i.jsx)(tz.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)(tz.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tz.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(c)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Error"}),s&&(0,i.jsx)(nc.u,{label:c,children:(0,i.jsx)(nl.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nY.Vp,{children:(0,i.jsx)(nY.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)(tW,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tV=e=>{var n,t,l,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ea(),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=tf(null===(l=p.data.base)||void 0===l?void 0:l.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nc.u,{label:"Schema (".concat(c?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nL("schema_diff"))||void 0===n?void 0:n.icon,color:c?tm("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nc.u,{label:"Row count (".concat(d?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tm("modified").color:"lightgray"})})})]})};var tJ=t(13358),tK=t(15196),tU=t(28023),tB=t(84963);function tQ(e){let{base:n,current:t}=e;return(0,i.jsx)(t_.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 tZ(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}function tX(e){var n,t,l,a,d,h,f;let{node:g,onCloseNode:j}=e,[,y]=(0,ey.TH)(),{setSqlQuery:b,setPrimaryKeys:k}=_(),w="model"===g.resourceType||"seed"===g.resourceType||"source"===g.resourceType||"snapshot"===g.resourceType,{isOpen:C,onOpen:S,onClose:z}=(0,ej.q)(),{runAction:R}=nW(),{envInfo:T}=ea(),{primaryKey:E}=eR(g.name),O=()=>{R("row_count_diff",{node_names:[g.name]},{showForm:!1,showLast:!1})},I=(0,v.useCallback)(async()=>{let e=g.id,n=await tZ({node_id:e});y("/checks/".concat(n.check_id))},[g,y]),A="added"===g.changeStatus||"removed"===g.changeStatus;return(0,i.jsxs)(tK.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(r.xu,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(c.X,{size:"sm",children:g.name})}),(0,i.jsx)(u.L,{}),("model"===g.resourceType||"seed"===g.resourceType||"snapshot"===g.resourceType)&&(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{as:eg.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nL("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==T?void 0:T.adapterType)==="dbt"?b('select * from {{ ref("'.concat(g.name,'") }}')):(null==T?void 0:T.adapterType)==="sqlmesh"&&b("select * from ".concat(g.name)),k(void 0!==E?[E]:void 0),y("/query")},children:"Query"}),(0,i.jsx)(tU.R,{}),(0,i.jsxs)(nO.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===g.resourceType||"snapshot"===g.resourceType)&&(0,i.jsx)(nI.s,{onClick:S,icon:(0,i.jsx)(tc.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>O(),children:"Row Count Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nL("profile_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("profile_diff",{model:g.name},{showForm:!1,showLast:!1})},children:"Profile Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nL("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("value_diff",{model:g.name},{showForm:!0,showLast:!1})},children:"Value Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nL("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("top_k_diff",{model:g.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nL("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("histogram_diff",{model:g.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]}),(0,i.jsx)(tU.R,{}),(0,i.jsx)(nO.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nL("schema_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",onClick:I,children:"Schema Diff"})})]})]}),(0,i.jsx)(r.xu,{flex:"0 1 1%",children:(0,i.jsx)(tB.P,{onClick:j})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(eT.U,{spacing:"8px",children:[(0,i.jsx)(tq,{node:g}),("model"===g.resourceType||"snapshot"===g.resourceType||"seed"===g.resourceType)&&(0,i.jsx)(tW,{node:g,onRefresh:O})]})}),w&&(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)(n$.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nG.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(ti,{base:g.data.base,current:g.data.current})})})]}),(0,i.jsxs)(ed.u_,{isOpen:C,onClose:z,size:"6xl",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ex.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.f,{children:(0,i.jsx)(tQ,{base:g.data.base,current:g.data.current})})]})]})]})}var tY=t(88989),t$=t(12867),tG=t(27547);async function t0(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function t1(e){var n;let{nodes:t,onFinish:r}=e,[,l]=(0,ey.TH)();return(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e;1===t.length?e=await tZ({node_id:t[0].id}):await Promise.all(t.map(async e=>{await tZ({node_id:e.id})})),r(),e?l("/checks/".concat(e.check_id)):l("/checks")},children:[(0,i.jsx)(s.J,{as:null===(n=nL("schema_diff"))||void 0===n?void 0:n.icon}),"Add schema check"]})}function t2(e){var n;let{viewMode:t,nodes:r,onFinish:l,isDisabled:o,withIcon:a}=e,[,c]=(0,ey.TH)();return(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",backgroundColor:"white",isDisabled:0===r.length||o,onClick:async()=>{let e=r.map(e=>e.id),n=await t0({view_mode:t,node_ids:e});l(),n?c("/checks/".concat(n.check_id)):c("/checks")},children:[a&&(0,i.jsx)(s.J,{as:null===(n=nL("lineage_diff"))||void 0===n?void 0:n.icon}),"Add lineage diff check"]})}function t5(e){var n,t,l,o,a,c;let{viewMode:d,nodes:u,onClose:h,onActionStarted:x,onActionNodeUpdated:m,onActionCompleted:p}=e,[f,g]=(0,v.useState)({mode:"per_node",status:"pending",completed:0,total:0}),j=(0,b.NL)(),[,y]=(0,ey.TH)(),k=async(e,n,t)=>{let i="multi_nodes";f.mode=i,x(),f.status="running";let r=[];for(let e of u){let t=n(e);t?(e.action={mode:i,status:"skipped",skipReason:t},m(e)):(e.action={mode:i,status:"pending"},r.push(e))}let l=t(r);try{let{run_id:n}=await G(e,l,{nowait:!0});for(f.currentRun={run_id:n},f.total=1;;){let e=await ee(n,2);f.currentRun=e;let t=e.error?"failure":e.result?"success":"running";for(let n of r)n.action={mode:i,status:t,run:e},m(n);if(e.error||e.result)break}}catch(e){}if(f.completed=1,"canceling"===f.status){f.status="canceled",p();return}f.status="completed",p()},w=async(e,n)=>{let t="per_node";for(let e of(f.mode=t,x(),f.status="running",u))e.action={mode:t,status:"pending"},m(e);for(let i of(f.completed=0,f.total=u.length,u)){let{params:r,skipReason:l}=n(i);if(l)i.action={mode:t,status:"skipped",skipReason:l},m(i);else try{let{run_id:n}=await G(e,r,{nowait:!0});for(f.currentRun={run_id:n},i.action={mode:t,status:"running"},m(i);;){let e=await ee(n,2);f.currentRun=e;let r=e.error?"failure":e.result?"success":"running";if(i.action={mode:t,status:r,run:e},m(i),e.error||e.result)break}}catch(e){}finally{f.currentRun=void 0}if(f.completed++,"canceling"===f.status){f.status="canceled",p();return}}f.status="completed",p()},C=async()=>{let e=[];for(let n of u)"model"!==n.resourceType?(n.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},m(n)):e.push(n.name);k("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},_=async()=>{w("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."}})},S=async()=>{var e;f.status="canceling",(null===(e=f.currentRun)||void 0===e?void 0:e.run_id)&&en(f.currentRun.run_id)},z=(0,v.useCallback)(async()=>{var e;let n=null===(e=f.currentRun)||void 0===e?void 0:e.run_id;if(!n)return;let t=await nK(n);j.invalidateQueries({queryKey:W.checks()}),y("/checks/".concat(t.check_id))},[null===(n=f.currentRun)||void 0===n?void 0:n.run_id,y,j]);return(0,t$.z)(()=>{"running"===f.status&&S()}),(0,i.jsxs)(r.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:["pending"===f.status&&(0,i.jsxs)(eT.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(tG.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:h,children:[(0,i.jsxs)(eg.z,{children:[u.length," selected"]}),(0,i.jsx)(nd.h,{"aria-label":"Exit select Mode",icon:(0,i.jsx)(tY.D,{})})]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(t1,{nodes:u,onFinish:h}),(0,i.jsx)(t2,{viewMode:d,nodes:u,onFinish:h,withIcon:!0})]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===u.length,onClick:C,children:[(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon}),"Row count diff"]}),(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===u.length,onClick:_,children:[(0,i.jsx)(s.J,{as:null===(l=nL("value_diff"))||void 0===l?void 0:l.icon}),"Value diff"]})]})]}),"pending"!==f.status&&(0,i.jsxs)(eT.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(r.xu,{fontSize:"10pt",children:["Progress: ","per_node"===f.mode?"".concat(f.completed," / ").concat(f.total):(null===(c=f.currentRun)||void 0===c?void 0:null===(a=c.progress)||void 0===a?void 0:a.percentage)?"".concat(100*f.currentRun.progress.percentage,"%"):"completed"===f.status?"100%":"0%"," ","canceled"===f.status?" (canceled)":""]}),"running"===f.status||"canceling"===f.status?(0,i.jsx)(eg.z,{size:"xs",variant:"outline",onClick:S,isLoading:"canceling"===f.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsxs)(eT.U,{children:["multi_nodes"===f.mode&&(null===(o=f.currentRun)||void 0===o?void 0:o.result)&&(0,i.jsx)(eg.z,{display:"none",size:"xs",variant:"outline",onClick:z,children:"Add to checklist"}),(0,i.jsx)(eg.z,{size:"xs",variant:"outline",onClick:h,children:"Close"})]})]})]})}let t4=e=>{let{isDisabled:n,viewOptions:t,onViewOptionsChanged:r}=e,l=t.view_mode||"changed_models",o=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{as:eg.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tp("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===l?"Changed Models":"All"}),(0,i.jsxs)(nE.q,{title:"packages",children:[(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:"changed_models"===l,onChange:()=>o("changed_models"),children:"Changed Models"}),(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:"all"===l,onChange:()=>o("all"),children:"All"})]})]})},t9=e=>{var n,t;let{viewOptions:r,onViewOptionsChanged:l,isDisabled:o}=e,{lineageGraph:a}=ea(),c=new Set;for(let e of Object.values((null==a?void 0:a.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==a?void 0:null===(t=a.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=r.packages?new Set(r.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),l({...r,packages:Array.from(n)})};return(0,i.jsxs)(nz.v,{closeOnSelect:!1,children:[(0,i.jsx)(nR.j,{as:eg.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tL.zFh}),size:"xs",variant:"outline",isDisabled:o,children:m}),(0,i.jsx)(nE.q,{title:"packages",children:(0,i.jsxs)(nO.k,{title:"Select Packages",children:[(0,i.jsx)(nI.s,{as:na.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?l({...r,packages:[]}):l({...r,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(tU.R,{}),Array.from(c).map(e=>(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},t3=e=>{let[n,t]=(0,v.useState)(e.value),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nC.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})},t6=e=>(0,i.jsx)(t3,{isDisabled:e.isDisabled,value:e.viewOptions.select||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,select:n||void 0})}}),t8=e=>(0,i.jsx)(t3,{isDisabled:e.isDisabled,value:e.viewOptions.exclude||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,exclude:n||void 0})}}),t7=e=>(0,i.jsxs)(r.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:e.label}),e.children]}),ie=e=>{let[,n]=(0,ey.TH)(),{runAction:t}=nW(),r=(0,v.useCallback)(e=>{e.check_id&&n("/checks/".concat(e.check_id))},[n]);return(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{as:eg.z,size:"xs",isDisabled:e.isDisabled,children:"..."}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nO.k,{title:"Diff",m:"0",p:"4px 12px",children:(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:()=>{t("row_count_diff",{select:e.viewOptions.select,exclude:e.viewOptions.exclude})},children:"Row Count Diff by Selector"})}),(0,i.jsx)(tU.R,{}),(0,i.jsxs)(nO.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await t0(e.viewOptions);n&&r(n)},children:"Lineage Diff"}),(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await tZ({select:e.viewOptions.select,exclude:e.viewOptions.exclude});n&&r(n)},children:"Schema Diff by Selector"})]})]})]})},it=e=>(0,i.jsx)(eT.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(eT.U,{flex:"1",children:[(0,i.jsx)(t7,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(t4,{...e})}),(0,i.jsx)(t7,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(t9,{...e})}),(0,i.jsx)(t7,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(t6,{...e})}),(0,i.jsx)(t7,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(t8,{...e})}),(0,i.jsx)(u.L,{}),(0,i.jsx)(t7,{label:"Actions",action:!0,children:(0,i.jsxs)(tG.h,{isAttached:!0,variant:"outline",children:[(0,i.jsx)(eg.z,{size:"xs",fontSize:"9pt",onClick:e.onSelectNodesClicked,isDisabled:e.isDisabled,children:"Select nodes"}),(0,i.jsx)(ie,{...e})]})})]})});function ii(){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}=tm(n);return(0,i.jsx)(nc.u,{label:r,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:l})," ",t]})},n)})})}var ir=t(11978);let il={customNode:function(e){var n,t;let l,{data:a}=e,{isHighlighted:c,isSelected:d,resourceType:h,changeStatus:x}=a,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tp(h),f="gray.400",g="solid";x&&(l=tm(x).icon,f=tm(x).color);let v=f,j=a.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",y=null==a?void 0:a.name;return(0,i.jsx)(nc.u,{label:"model"===h?y:"".concat(y," (").concat(h,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",_hover:{backgroundColor:m?"gray.100":f},borderColor:v,borderWidth:1,borderStyle:g,backgroundColor:m?"white":f,borderRadius:3,boxShadow:j,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===c?"node-highlight":!0===d?"node-highlight":!1===c?"node-unhighlight":void 0,children:[(0,i.jsx)(o.k,{backgroundColor:f,padding:2,borderRightWidth:1,borderColor:v,borderStyle:g,alignItems:"top",visibility:m?"inherit":"hidden",children:(0,i.jsx)(s.J,{as:p})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(r.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:y}),l&&(0,i.jsx)(o.k,{children:(0,i.jsx)(s.J,{color:f,as:l,flex:"0 0 20px"})})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(eT.U,{spacing:"8px",children:[(0,i.jsx)(u.L,{}),a.isActionMode?a.action?(0,i.jsx)(tH,{node:a,action:a.action}):(0,i.jsx)(i.Fragment,{}):"model"===a.resourceType?(0,i.jsx)(tV,{id:a.id}):(0,i.jsx)(i.Fragment,{})]})})]}),Object.keys(null!==(n=null==a?void 0:a.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==a?void 0:a.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},is={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=tm(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}})})}},io=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tm(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},ia=(e,n)=>{let t=null==e?void 0:e.current,i=(0,v.useRef)({width:0,height:0});(0,v.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,r=t.contentRect.height;(Math.abs(r-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&r>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:r}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])};function ic(e){var n;let{...t}=e,l=(0,R._K)(),a=(0,v.useRef)(null),{successToast:c,failToast:d}=eB(),{copyToClipboard:u,ImageDownloadModal:x,ref:m}=e$({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(eY))},onSuccess:()=>{c("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),d("Failed to copy image to clipboard",e)}}),[p,f,g]=(0,R.Rr)([]),[j,y,b]=(0,R.ll)([]),[k,w]=(0,v.useState)(t.viewOptions||{}),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:T}=ea(),{showRunId:O,close:I}=nW(),H=k.view_mode||t.viewMode||"changed_models",[V,J]=(0,v.useState)("detail"),[K,U]=(0,v.useState)("normal"),[B,Q]=(0,v.useState)(),[Z,Y]=(0,v.useState)(!1),[$,G]=(0,v.useState)(!1),[ee,en]=(0,v.useState)({x:0,y:0});[...W.lineage(),k.select,k.exclude];let et=(0,X.p)();(0,v.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(k.select||k.exclude)try{e=(await tr({select:k.select,exclude:k.exclude})).nodes}catch(e){}let[n,t]=M(C,k,e);D(n,t),f(n),y(t)})()},[f,y,C]);let ei=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=l.getZoom();l.setCenter(n,t,{zoom:i,duration:200})}};ia(a,async()=>{if("detail"===V||"action_result"===V){let e=p.find(e=>e.data.isSelected);e&&ei(e)}});let er=(0,v.useCallback)(e=>{f(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[f]),el=async e=>{let n;if(!C)return;try{n=(await tr({select:e.select,exclude:e.exclude})).nodes}catch(e){if(e instanceof ir.d7){var t,i;et({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[r,s]=M(C,e,n);D(r,s),f(r),y(s),w(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{l.fitView({nodes:r,duration:200})})()};if(S)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tE.$,{size:"xl"})});let es=()=>{G(!1),en({x:0,y:0})};return z?(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsxs)(no.g,{children:[(0,i.jsx)(r.xu,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(r.xu,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):"changed_models"!==H||(null==C?void 0:null===(n=C.modifiedSet)||void 0===n?void 0:n.length)?(0,i.jsxs)(ts,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(no.g,{ref:a,divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[t.interactive&&(0,i.jsx)(it,{isDisabled:"normal"!==K,viewOptions:k,onViewOptionsChanged:el,onSelectNodesClicked:()=>{let e="detail"===V?"action":"detail";Q(void 0),Y(!1),f(P(p,"action"===e)),J(e),U("selector")}}),(0,i.jsxs)(R.x$,{nodeTypes:il,edgeTypes:is,nodes:p,edges:j,onNodesChange:g,onEdgesChange:b,onNodeClick:(e,n)=>{if(!1!==t.interactive){var i,r,l,s,o;(es(),"detail"===V)?(Q(n.data),Z||Y(!0),ei(n),f(F(n.id,p))):"action_result"===V?((null===(r=n.data.action)||void 0===r?void 0:null===(i=r.run)||void 0===i?void 0:i.run_id)&&O(null===(s=n.data.action)||void 0===s?void 0:null===(l=s.run)||void 0===l?void 0:l.run_id),ei(n),f(F(n.id,p))):f((o=n.id,p.map(e=>{let n=e.id===o;return{...e,data:{...e.data,isSelected:e.data.isSelected!==n}}})))}},onNodeMouseEnter:(e,n)=>{if(!C)return;let[t,i]=L(Array.from(E(A(C,[n.id]),N(C,[n.id]))),p,j);f(t),y(i)},onNodeMouseLeave:(e,n)=>{if(!C)return;let[t,i]=L(Array.from(N(C,C.modifiedSet)),p,j);f(t),y(i)},onNodeContextMenu:(e,n)=>{"action"===V&&(e.preventDefault(),en({x:e.clientX,y:e.clientY,selectedNode:n}),G(!0))},onClick:es,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:t.interactive,ref:m,children:[(0,i.jsx)(tA.A,{color:"#ccc"}),(0,i.jsx)(tN.Z,{showInteractive:!1,position:"top-right",className:eY,children:(0,i.jsx)(tN.B,{title:"copy image",onClick:async()=>{u()},children:(0,i.jsx)(s.J,{as:tL.C3L})})}),(0,i.jsx)(x,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(eT.U,{children:(0,i.jsx)(ii,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(h.x,{fontSize:"xl",color:"grey",opacity:.5,children:p.length>0?"":"No nodes"})}),(0,i.jsx)(tM.a,{nodeColor:io,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),(0,i.jsx)(R.s_,{position:"bottom-center",className:eY,children:(0,i.jsx)(tI.R,{in:"selector"===K,unmountOnExit:!0,style:{zIndex:10},children:(0,i.jsx)(t5,{viewMode:H,nodes:p.map(e=>e.data).filter(e=>e.isSelected),onClose:()=>{J("detail"),U("normal");let e=P(p);Q(void 0),Y(!1),f(e),I(),null==T||T()},onActionStarted:()=>{J("action_result")},onActionNodeUpdated:er,onActionCompleted:()=>{}})})})]})]}),"detail"===V&&B?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(tX,{node:B,onCloseNode:()=>{Q(void 0),Y(!1),f(P(p))}})}):(0,i.jsx)(r.xu,{}),$&&(0,i.jsx)(nz.v,{isOpen:!0,onClose:es,children:(0,i.jsxs)(nE.q,{style:{position:"absolute",left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(tJ.Cv2,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(q([...A(C,[e.id])],p))},children:"Select parent nodes"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(tJ.IMj,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(q([...N(C,[e.id])],p))},children:"Select child nodes"})]})})]}):(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsxs)(no.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{U("normal"),el({...k,view_mode:"all"})},children:"Show all nodes"})]})})}function id(e){let{check:n}=e,t={...n.params,...n.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(ic,{viewOptions:t,interactive:!1})})})}var iu=t(19339);function ih(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=iu.ZP.stringify({checks:[o]});return(0,i.jsx)(t_.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}})}function ix(){let e=(0,nV._)(["\n
","\n\n ","\n\n
"]);return ix=function(){return e},e}let im=e=>{let{runId:n,isPending:t,setAborting:i}=e;(0,v.useEffect)(()=>()=>{i(!1),n&&t&&en(n)},[t,n,i])},ip=e=>{var n;let{checkId:t}=e,l=(0,b.NL)(),[,a]=(0,ey.TH)(),{successToast:d,failToast:h}=eB(),[f,g]=(0,v.useState)(),[j,k]=(0,v.useState)(),[w,C]=(0,v.useState)(!1),{isOpen:_,onOpen:S,onClose:z}=(0,ej.q)(),R=()=>(0,i.jsx)(eu.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[T,E]=(0,v.useState)((0,i.jsx)(R,{})),{isLoading:O,error:I,refetch:A,data:N}=(0,y.a)({queryKey:W.check(t),queryFn:async()=>nB(t),refetchOnMount:!1,staleTime:3e5}),M=(null==N?void 0:N.type)?nL(null==N?void 0:N.type):void 0,D=(null==N?void 0:N.is_preset)||!1,{mutate:L}=(0,te.D)({mutationFn:e=>nQ(t,e),onSuccess:()=>{l.invalidateQueries({queryKey:W.check(t)}),l.invalidateQueries({queryKey:W.checks()})}}),{mutate:F}=(0,te.D)({mutationFn:()=>nZ(t),onSuccess:()=>{l.invalidateQueries({queryKey:W.checks()}),a("/checks")}}),q=async()=>{if(!(null==N?void 0:N.type))return;let{run_id:e}=await et(t,{nowait:!0});for(g(e);;){let n=await ee(e,2);if(k(n.progress),n.result||n.error)return C(!1),k(void 0),n}},{data:P,mutate:H,error:V,isIdle:J,isPending:K}=(0,te.D)({mutationFn:q,onSuccess:e=>{A()}}),U=async()=>{H()},B=(0,v.useCallback)(async()=>{if(C(!0),f)return await en(f)},[f]);im({runId:f,isPending:K,setAborting:C});let Q=async()=>{if(!N)return;let e=(0,tb.RI)(ix(),tw(N),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tC(e),"\n\n").concat((0,tb.Pn)(tk(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tC(e)}(N));if(!navigator.clipboard){h("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),d("Copied the check to the clipboard")}catch(e){h("Failed to copy the check to clipboard",e)}},Z=(0,v.useCallback)(()=>{L({is_checked:!(null==N?void 0:N.is_checked)})},[null==N?void 0:N.is_checked,L]);if(O)return(0,i.jsx)(e1.M,{h:"100%",children:"Loading"});if(I)return(0,i.jsxs)(e1.M,{h:"100%",children:["Error: ",I.message]});let X=J?null==N?void 0:N.last_run:P,Y=(null==X?void 0:X.run_at)?(0,tT.Q)(new Date(X.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(to,{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)(n7,{name:(null==N?void 0:N.name)||"",setName:e=>{L({name:e})}}),(0,i.jsx)(u.L,{}),D&&(0,i.jsx)(nc.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nY.Vp,{size:"sm",children:[(0,i.jsx)(nY.AD,{boxSize:"14px",as:n4.bX4}),"Preset"]})}),(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{isRound:!0,as:nd.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"ghost"}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(n9.ovA,{}),onClick:()=>{E((0,i.jsx)(R,{})),S()},children:"Get Preset Check Template"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(n1.p,{}),onClick:()=>F(),children:"Delete"})]})]}),Y&&(0,i.jsx)(r.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:Y}),(null==M?void 0:M.RunResultView)&&(0,i.jsx)(nc.u,{label:"Rerun",children:(0,i.jsx)(nd.h,{isRound:!0,isLoading:K,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n2.n,{}),onClick:()=>U()})}),(0,i.jsx)(nc.u,{label:"Copy markdown",children:(0,i.jsx)(nd.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(eH.T,{}),onClick:()=>Q()})}),(0,i.jsx)(nc.u,{label:(null==N?void 0:N.is_checked)?"Mark as pending":"Mark as approved",children:(0,i.jsx)(eg.z,{size:"sm",colorScheme:(null==N?void 0:N.is_checked)?"green":"gray",leftIcon:(0,i.jsx)(n5.r,{}),onClick:()=>Z(),children:(null==N?void 0:N.is_checked)?"Approved":"Pending"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(ty,{value:null==N?void 0:N.description,onChange:e=>{L({description:e})}},null==N?void 0:N.check_id)})]}),(0,i.jsx)(r.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",children:[(0,i.jsxs)(m.t,{children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==N?void 0:N.type)==="query"||(null==N?void 0:N.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"})]}),(0,i.jsxs)(n$.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nG.x,{p:0,width:"100%",height:"100%",children:[(null==M?void 0:M.RunResultView)&&(0,i.jsx)(tR,{isPending:K,isAborting:w,isCheckDetail:!0,run:X,error:V,progress:j,RunResultView:M.RunResultView,viewOptions:null==N?void 0:N.view_options,onViewOptionsChanged:e=>{L({view_options:e})},onCancel:B,onExecuteRun:U}),N&&"schema_diff"===N.type&&(0,i.jsx)(tv,{check:N}),N&&"lineage_diff"===N.type&&(0,i.jsx)(id,{check:N})]}),((null==N?void 0:N.type)==="query"||(null==N?void 0:N.type)==="query_diff")&&(0,i.jsx)(nG.x,{p:0,height:"100%",width:"100%",children:(0,i.jsx)(tS,{value:(null==N?void 0:null===(n=N.params)||void 0===n?void 0:n.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(ed.u_,{isOpen:_,onClose:z,isCentered:!0,size:"6xl",children:[T,(0,i.jsxs)(eh.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ex.x,{children:"Preset Check Template"}),(0,i.jsx)(em.o,{}),(0,i.jsxs)(ep.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(n0.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)(ih,{name:(null==N?void 0:N.name)||"",description:(null==N?void 0:N.description)||"",type:(null==N?void 0:N.type)||"",params:null==N?void 0:N.params,viewOptions:null==N?void 0:N.view_options})]})]})]})]})};var ig=t(53924);let iv=e=>{var n;let{check:t,selected:l,onSelect:a}=e,c=(0,b.NL)(),d=t.check_id,{mutate:u}=(0,te.D)({mutationFn:e=>nQ(d,e),onSuccess:()=>{c.invalidateQueries({queryKey:W.check(d)}),c.invalidateQueries({queryKey:W.checks()})}}),h=(null===(n=nL(t.type))||void 0===n?void 0:n.icon)||eb.WzH;return(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:l?"gray.100":"inherit",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),t.is_checked&&(0,i.jsx)(s.J,{color:"green",as:tc.FJM})]})},ij=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:l}=e;return(0,i.jsx)(ig.Z5,{onDragEnd:e=>{e.destination&&l(e.source.index,e.destination.index)},children:(0,i.jsx)(ig.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(no.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(ig._l,{draggableId:e.check_id,index:n,children:n=>(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(iv,{check:e,selected:e.check_id===t,onSelect:r},e.check_id)})},e.check_id)),e.placeholder]})})})};function iy(){let e=(0,nV._)(["\n
","\n\n ","\n\n
"]);return iy=function(){return e},e}let ib=()=>{let[,e]=(0,ey.TH)(),[,n]=(0,ey.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=eB(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:W.checks(),queryFn:nU,refetchOnMount:!0}),h=(0,v.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,v.useState)(d||[]),{mutate:p}=(0,te.D)({mutationFn:e=>nX(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.checks()})}}),f=(0,v.useCallback)((e,n)=>{let t=[...x],[i]=t.splice(e,1);t.splice(n,0,i),p({source:e,destination:n}),m(t)},[x,m,p]);return((0,v.useCallback)(async()=>{let e=await nJ();t.invalidateQueries({queryKey:W.checks()}),h(e.check_id)},[t,h]),(0,v.useEffect)(()=>{"success"===u&&(!o&&d.length>0&&e("/checks/".concat(d[0].check_id)),m(d))},[u,o,d,m,e]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==d?void 0:d.length)?(0,i.jsxs)(ts,{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)(no.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nc.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nd.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tb.RI)(iy(),tw(e),tC(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)(eH.T,{})})}),(0,i.jsx)(nv.i,{mb:"8px"}),(0,i.jsx)(ij,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(ey.rs,{children:(0,i.jsx)(ey.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(ip,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};async function ik(e,n){return await G("query",e,n)}async function iw(e,n){return await G("query_diff",e,n)}var iC=t(66070);let i_=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=ea(),s=(0,v.useMemo)(()=>{if(!l)return[];let e=new Set;for(let i in l.nodes){var n,t;let r=l.nodes[i],s=null===(n=r.data.base)||void 0===n?void 0:n.columns,o=null===(t=r.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[l]);return(0,i.jsx)(o.k,{...r,children:(0,i.jsxs)(ek.NI,{m:"4px 8px",children:[(0,i.jsxs)(ew.l,{children:["Primary key"," ",(0,i.jsx)(nc.u,{label:"When a primary key is present, the query difference is computed in the warehouse. Otherwise, it's computed on the client side.",children:(0,i.jsx)(eV.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsxs)(iC.Qc,{restoreOnBlurIfEmpty:!1,multiple:!0,creatable:!0,filter:(e,n)=>n.startsWith(e),onChange:e=>t(e),defaultValues:void 0!==n&&0!==n.length?n:void 0,children:[(0,i.jsx)(iC.Vp,{placeholder:"Select primary key...",variant:"outline",children:e=>{let{tags:n}=e;return n.map((e,n)=>(0,i.jsx)(iC.Y4,{label:e.label,onRemove:e.onRemove},n))}}),(0,i.jsxs)(iC.Jm,{children:[s.map((e,n)=>(0,i.jsx)(iC.Gb,{value:e,children:e},"option-".concat(n))),(0,i.jsx)(iC.JU,{children:e=>{let{value:n}=e;return(0,i.jsxs)(o.k,{children:["Add '",n,"' to List"]})}})]})]})]})})},iS=()=>{let{sqlQuery:e,setSqlQuery:n,primaryKeys:t,setPrimaryKeys:l}=_(),{envInfo:s}=ea(),a=e;(null==s?void 0:s.adapterType)==="sqlmesh"&&e===k&&(a="select * from db.mymodel");let[c,d]=(0,v.useState)(),[u,h]=(0,v.useState)(),[x,m]=(0,v.useState)({}),p=(0,b.NL)(),[,f]=(0,ey.TH)(),g=async e=>{d(e);let{run_id:n}="query"===e?await ik({sql_template:a},{nowait:!0}):await iw({sql_template:a,primary_keys:t},{nowait:!0});return h(n),await ee(n)},{data:j,mutate:y,error:w,isPending:C}=(0,te.D)({mutationFn:g,onSuccess:e=>{m({})}}),S=(0,v.useCallback)(async()=>{if(u)return await en(u)},[u]),z=(0,v.useCallback)(async e=>{if(!(null==e?void 0:e.run_id))return;let n=await nK(e.run_id,x);p.invalidateQueries({queryKey:W.checks()}),f("/checks/".concat(n.check_id))},[f,x,p]);return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",padding:"5px",gap:"5px",children:[(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>y("query_diff"),isDisabled:C,size:"sm",children:"Run Diff"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>y("query"),isDisabled:C,size:"sm",children:"Run"})]}),(0,i.jsxs)(to,{sizes:[40,60],minSize:100,style:{height:"100%",borderTop:"1px solid #CBD5E0"},children:[(0,i.jsxs)(ts,{sizes:[90,10],minSize:300,children:[(0,i.jsx)(r.xu,{width:"70%",border:"1px solid #CBD5E0",children:(0,i.jsx)(tS,{value:a,onChange:n,onRun:()=>y("query"),onRunDiff:()=>y("query_diff")})}),(0,i.jsx)(i_,{p:"5px",border:"1px",borderColor:"gray.300",defaultPrimaryKeys:t,onPrimaryKeysChange:l})]}),(0,i.jsx)(o.k,{flex:"1",direction:"column",children:"query"===c?(0,i.jsx)(tR,{run:j,error:w,isPending:C,onCancel:S,children:e=>(0,i.jsx)(nf,{...e,onAddToChecklist:z})},u):(0,i.jsx)(tR,{isPending:C,run:j,error:w,viewOptions:x,onViewOptionsChanged:m,onCancel:S,children:e=>(0,i.jsx)(nm,{...e,onAddToChecklist:z})},u)})]})]})};var iz=t(30148);let iR=e=>(0,iz.c4)("#!"+e),iT=()=>[(0,iz.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),iR];var iE=t(24681),iO=t(62843);let iI=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ee(t)}),o=(null==s?void 0:s.type)?null===(n=nL(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tR,{isPending:r,error:l,run:s,RunResultView:o})};var iA=t(20085);let iN=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e1.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)(eg.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},iM=e=>{let{children:n}=e;return(0,i.jsx)(iA.SV,{fallback:iN,children:n})};async function iD(){return(await U.post("/api/export")).data}async function iL(e){let n=new FormData;return n.append("file",e),(await U.post("/api/import",n)).data}async function iF(){return 208===(await U.get("/api/sync")).status}async function iq(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,ir.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var iP=t(16021);function iW(){let e=(0,X.p)(),n=async()=>{try{let e=await iD(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,eQ.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");eX()(t,r)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nc.u,{label:"Export",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:iP.tRY,boxSize:"1.2em"})})})}var iH=t(65475);function iV(){let e=(0,X.p)(),n=(0,b.NL)(),t=(0,v.useRef)(null),r=(0,v.useRef)(null),[l,a]=(0,v.useState)(null),{isOpen:c,onOpen:d,onClose:u}=(0,ej.q)(),[x,m]=(0,ey.TH)(),[,p]=ec(),f=(0,v.useCallback)(async()=>{if(l){try{let{runs:t,checks:i}=await iL(l);p(),await n.invalidateQueries({queryKey:W.checks()}),x.includes("/checks")&&m("/checks"),e({description:"".concat(t," runs and ").concat(i," checks imported successfully"),status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(n){console.error("Import failed",n),e({title:"Import failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}u()}},[n,l,e,u,x,m,p]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Import",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{t.current&&t.current.click()},icon:(0,i.jsx)(s.J,{as:iP.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:t,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(a(e.target.files[0]),d())}}),(0,i.jsx)(iH.a,{isOpen:c,leastDestructiveRef:r,onClose:u,size:"xl",children:(0,i.jsx)(eu.Z,{children:(0,i.jsxs)(iH._,{children:[(0,i.jsx)(ex.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ep.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)(eV.s,{color:"red.600"}),(0,i.jsx)(h.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(h.x,{children:["The current runs and checks will be"," ",(0,i.jsx)(h.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{ref:r,onClick:u,children:"Cancel"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:f,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var iJ=t(93126),iK=t(1026),iU=t(13154),iB=t(99434),iQ=t(20143),iZ=t(89830),iX=t(13276),iY=t(31610);function i$(e){let n=(0,iY.D)(e);return(0,eQ.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function iG(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)(ta.HC,{ml:"10px",children:[n,": ",t]},n)})}function i0(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ea(),{isOpen:m,onOpen:p,onClose:f}=(0,ej.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)?i$(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?i$(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(d=e.data.current)||void 0===d?void 0:d.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Environment Info",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n9.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(ed.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{children:"Environment Information"}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.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)(ta.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(ta.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&iG(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)(ta.QI,{spacing:1,children:g&&iG(g)})]})}),(0,i.jsx)(nv.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)(iJ.x,{children:(0,i.jsxs)(iK.i,{variant:"simple",children:[(0,i.jsx)(iU.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Th,{}),(0,i.jsx)(iQ.Th,{children:"base"}),(0,i.jsx)(iQ.Th,{children:"current"})]})}),(0,i.jsxs)(iZ.p,{children:[(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"schema"}),(0,i.jsx)(iX.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(iX.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"version"}),(0,i.jsx)(iX.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(iX.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"timestamp"}),(0,i.jsx)(iX.Td,{children:k}),(0,i.jsx)(iX.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)(iJ.x,{children:(0,i.jsxs)(iK.i,{variant:"simple",children:[(0,i.jsx)(iU.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Th,{}),(0,i.jsx)(iQ.Th,{children:"base"}),(0,i.jsx)(iQ.Th,{children:"current"})]})}),(0,i.jsx)(iZ.p,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"Environment"}),(0,i.jsx)(iX.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(iX.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(ef.m,{children:(0,i.jsx)(eg.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var i1=t(21166),i2=t(23256),i5=t(43399),i4=t(60057);function i9(){return(0,i.jsx)(nc.u,{label:"Syncing",children:(0,i.jsx)(eg.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tE.$,{})})})}function i3(){let[e,n]=(0,v.useState)(!1),t=(0,b.NL)(),[l,o]=(0,ey.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ej.q)(),[u,h]=(0,v.useState)(""),x=(0,X.p)(),m=(0,v.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await iq(e)).status){c(),n(!1);return}for(;await iF();)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()}),/^\/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)(i9,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Sync with Cloud",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:iP.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(ed.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ep.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)(i1.E,{onChange:h,value:u,children:(0,i.jsxs)(i2.K,{direction:"column",children:[(0,i.jsxs)(i5.Y,{value:"merge",children:["Merge",(0,i.jsx)(nc.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(i5.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nc.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(i5.Y,{value:"revert",children:["Revert",(0,i.jsx)(nc.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let i6=e=>{var n;let[t,i]=(0,v.useState)(!1),[r,l]=(0,v.useState)(!1),[,s]=ec(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ee(e||"",2),enabled:!!e,refetchInterval:!!t&&50});(0,v.useEffect)(()=>{o||(null==a?void 0:a.result)||(null==a?void 0:a.error)?t&&(i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()):i(!0)},[a,o,t,s]);let c=(0,v.useCallback)(async()=>{if(l(!0),e)return await en(e)},[e,l]),d=(null==a?void 0:a.type)?null===(n=nL(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isPending:t,aborting:r,error:o,onCancel:c,RunResultView:d}},i8=e=>{let n=iu.ZP.stringify(e,null,2);return(0,i.jsx)(t_.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}})},i7=e=>{var n;let{runId:t,onClose:r}=e,{runAction:l}=nW(),{isPending:s,error:a,run:c,onCancel:d}=i6(t),h=(0,v.useRef)(!1);h.current=s,(0,v.useEffect)(()=>()=>{h.current&&d()},[h]);let[f,g]=(0,v.useState)(),j=(0,b.NL)(),[,y]=(0,ey.TH)(),[k,w]=(0,v.useState)(0),C=(null==c?void 0:c.type)?null===(n=nL(c.type))||void 0===n?void 0:n.RunResultView:void 0,_=(0,v.useCallback)(()=>{l((null==c?void 0:c.type)||"",null==c?void 0:c.params)},[c,l]),S=(0,v.useCallback)(async()=>{if(!t)return;let e=await nK(t,f);j.invalidateQueries({queryKey:W.checks()}),y("/checks/".concat(e.check_id))},[t,y,j,f]);return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:k,onChange:w,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"}),(0,i.jsx)(u.L,{}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(eg.z,{isDisabled:!t||s,size:"sm",colorScheme:"blue",onClick:_,children:"Rerun"}),(0,i.jsx)(eg.z,{isDisabled:!t||!(null==c?void 0:c.result),size:"sm",colorScheme:"blue",onClick:S,children:"Add to Checklist"}),(0,i.jsx)(tB.P,{onClick:()=>{r&&r()}})]})]})}),0===k&&(0,i.jsx)(tR,{isPending:s,error:a,run:c,onCancel:d,viewOptions:f,onViewOptionsChanged:g,RunResultView:C}),1===k&&c&&(0,i.jsx)(i8,{type:c.type,params:c.params})]})},re=e=>{let{onClose:n}=e,{runId:t}=nW();return(0,i.jsx)(i7,{runId:t,onClose:n})};function rn(){let{isOpen:e,close:n}=nW();return(0,i.jsx)(R.tV,{children:(0,i.jsxs)(to,{sizes:e?[50,50]:[100,0],minSize:e?100:0,style:{height:"100%",borderTop:"1px solid #CBD5E0"},children:[(0,i.jsx)(r.xu,{children:(0,i.jsx)(ic,{viewMode:"changed_models",interactive:!0})}),e?(0,i.jsx)(re,{onClose:n}):(0,i.jsx)(r.xu,{})]})})}var rt=t(39588);let ri=e=>{let{children:n,path:t}=e,[l]=(0,ey.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rr(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 rl(){var e;let{reviewMode:n,isDemoSite:t,envInfo:r,cloudMode:s,isLoading:x}=ea(),m=function(){let[e,n]=(0,v.useState)("");return(0,v.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),p=null==r?void 0:null===(e=r.pullRequest)||void 0===e?void 0:e.url;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:m}),n&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),s&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"cloud mode"}),(0,i.jsx)(u.L,{}),t&&p&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eV.s,{}),(0,i.jsxs)(h.x,{children:["Please check"," ",(0,i.jsx)(l.r,{textDecoration:"underline",fontWeight:"600",href:p,isExternal:!0,children:"this Pull Request"})," ","comment for context about this Recce instance"]})]}),(0,i.jsx)(u.L,{}),(0,i.jsx)(rr,{icon:tc.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rr,{icon:tc.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rr,{mr:"18px",icon:tc.MXt,href:"https://datarecce.io/docs"})]})}function rs(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 ro(){let{isDemoSite:e,cloudMode:n,isLoading:t}=ea(),[r,l]=(0,ey.TH)(),s=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checks",href:"/checks"}],o=e=>e.filter(e=>!e.is_checked).length,a=eS().findIndex(s,e=>{let{href:n}=e;return r.startsWith(n)});return(0,i.jsx)(x.m,{index:a,children:(0,i.jsxs)(m.t,{children:[s.map(e=>{let{name:n,href:t}=e;return(0,i.jsxs)(p.O,{onClick:()=>{l(t)},children:[n,"Checks"===n&&(0,i.jsx)(rs,{queryKey:W.checks(),fetchCallback:nU,selectCallback:o})]},n)}),(0,i.jsx)(u.L,{}),!t&&(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(i3,{}),!e&&!n&&(0,i.jsx)(iV,{}),(0,i.jsx)(iW,{})]}),(0,i.jsx)(i0,{})]})})}function ra(){(0,v.useLayoutEffect)(()=>{var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"";if(n&&rt.env.AMPLITUDE_API_KEY)try{j.S1(rt.env.AMPLITUDE_API_KEY,n,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,iE.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(iO.Z,{theme:e,children:(0,i.jsx)(f.x,{children:(0,i.jsx)(b.aH,{client:B,children:(0,i.jsx)(ey.F0,{hook:iT,children:(0,i.jsx)(nH,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",children:[(0,i.jsx)(rl,{}),(0,i.jsx)(ro,{}),(0,i.jsx)(iM,{children:(0,i.jsxs)(r.xu,{p:0,overflow:"auto",flex:"1",style:{contain:"size"},children:[(0,i.jsx)(ri,{path:"/lineage",children:(0,i.jsx)(rn,{})}),(0,i.jsxs)(ey.rs,{children:[(0,i.jsx)(ey.AW,{path:"/query",children:(0,i.jsx)(iS,{})}),(0,i.jsx)(ey.AW,{path:"/checks/:slug*",children:(0,i.jsx)(ib,{})}),(0,i.jsx)(ey.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(iI,{runId:n})}}),(0,i.jsx)(ey.AW,{path:"/ssr",children:(0,i.jsx)(g.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(ey.AW,{children:(0,i.jsx)(ey.l_,{to:"/lineage"})})]})]})})]})})})})})})}},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,378,132,584,744],function(){return e(e.s=27709)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{27709:function(e,n,t){Promise.resolve().then(t.bind(t,53819))},53819:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ra}});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(26138),h=t(79481),x=t(78939),m=t(63993),p=t(83246),f=t(19046),g=t(50068),v=t(66518),j=t(57489),y=t(39944),b=t(55465);let k='select * from {{ ref("mymodel") }}',w=(0,v.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{}});function C(e){let{children:n}=e,[t,r]=v.useState(k),[l,s]=v.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:r,sqlQuery:t,setPrimaryKeys:s,primaryKeys:l},children:n})}let _=()=>(0,v.useContext)(w),S=(0,v.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,r]=v.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:r},children:n})}var R=t(48510);function T(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,r={},l=(e,t)=>{if(!(t<0)&&(void 0===r[e]||!(r[e]>=t))){for(let i of(r[e]=t,n(e)))l(i,t-1);i.add(e)}};for(let n of e)l(n,t);return i}function E(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var O=t(28482),I=t.n(O);function A(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return T(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function N(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,t){let i=[],r=[];function l(e){return"base"===e?0:"current"===e?2:1}function s(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let o=n?function(e,n){var t;let i=Object.values(e.nodes);if("changed_models"===(n.view_mode||"changed_models")){let n=E(A(e,e.modifiedSet,1),N(e,e.modifiedSet));i=i.filter(e=>n.has(e.id))}if(void 0!==n.node_ids){let e=new Set(n.node_ids);i=i.filter(n=>e.has(n.id))}let r=void 0!==n.packages?n.packages:(null===(t=e.manifestMetadata.current)||void 0===t?void 0:t.project_name)?[e.manifestMetadata.current.project_name]:void 0;return void 0!==r&&(i=i.filter(e=>!!e.packageName&&r.includes(e.packageName))),new Set(i.map(e=>e.id))}(e,n):void 0;for(let n of(null!=t&&(o=o?function(){for(var e=arguments.length,n=Array(e),t=0;te.has(n)));return i}(o,new Set(t)):new Set(t)),Object.values(e.nodes).sort(s)))(!o||o.has(n.id))&&i.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(s))(!o||o.has(n.parent.id)&&o.has(n.child.id))&&r.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return D(i,r),L(Array.from(N(e,e.modifiedSet)),i,r)}let D=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(I()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),I().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function 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 F(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function P(e,n){return n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}})}function q(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],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"]};var H=t(62330),V=t(39588);let J=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var K=t(94614);let U=H.default.create({baseURL:J}),B=new K.S;async function Q(){return(await U.get("/api/info")).data}async function Z(e){return(await U.get("/api/model/".concat(e))).data}var X=t(99873),Y=t(85929),$=t.n(Y);async function G(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ee(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function en(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function et(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ei(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function er(){return(await U.post("/api/runs/aggregate",{})).data}let el=(0,v.createContext)({});function es(e){let{refetch:n}=e,t=(0,X.p)(),[r,l]=(0,v.useState)(),s=(0,b.NL)();return(0,v.useEffect)(()=>{let e=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));return l(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:i}=n.event,[r,l]=i.split("/").slice(-2),o=$().parse(l).name;t({description:"Detected ".concat(r," ").concat(o," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),s.invalidateQueries({queryKey:W.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,s]),(0,i.jsx)(i.Fragment,{})}function eo(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:er}),u=(0,v.useMemo)(()=>{let e=null==l?void 0:l.lineage;if(e&&e.base&&e.current)return function(e,n){let t={},i={},r=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=r(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=r(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,r]of Object.entries(e.parent_map))for(let e of r){let r=t[n],l=t[e],s="".concat(e,"_").concat(n);if(!r||!l)continue;i[s]={id:s,from:"base",parent:l,child:r};let o=i[s];r.parents[e]=o,l.children[n]=o}for(let[e,r]of Object.entries(n.parent_map))for(let n of r){let r=t[e],l=t[n],s="".concat(n,"_").concat(e);if(!r||!l)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:l,child:r};let o=i[s];r.parents[n]=o,l.children[e]=o}let l=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",l.push(n.id);else if("current"===n.from)n.changeStatus="added",l.push(n.id);else{var s,o,a,c,d,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(d=u.current)||void 0===d?void 0:null===(c=d.checksum)||void 0===c?void 0:c.checksum;e&&t&&e!==t&&(n.changeStatus="modified",l.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:l,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(e.base,e.current)},[l]),h=null==o?void 0:o.message,x=null==l?void 0:l.lineage,m=null==l?void 0:l.demo,p=null==l?void 0:l.review_mode,f=null==l?void 0:l.cloud_mode,g=null==l?void 0:l.file_mode,j=null==l?void 0:l.adapter_type,b=null==l?void 0:l.git,k={adapterType:j,git:b,pullRequest:null==l?void 0:l.pull_request,dbt:{base:null==x?void 0:null===(n=x.base)||void 0===n?void 0:n.manifest_metadata,current:null==x?void 0:null===(t=x.current)||void 0===t?void 0:t.manifest_metadata},sqlmesh:null==l?void 0:l.sqlmesh};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es,{refetch:a}),(0,i.jsx)(el.Provider,{value:{lineageGraph:u,retchLineageGraph:()=>{a()},envInfo:k,reviewMode:p,cloudMode:f,fileMode:g,isDemoSite:m,error:h,isLoading:s,runsAggregated:c,refetchRunsAggregated:()=>{d()}},children:r})]})}let ea=()=>(0,v.useContext)(el),ec=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=ea();return[e,n]};var ed=t(17695),eu=t(62628),eh=t(68830),ex=t(96985),em=t(69384),ep=t(7797),ef=t(13844),eg=t(64653);let ev=e=>{let{isOpen:n,onClose:t,onExecute:l,type:s,title:a,params:c,RunForm:d}=e,[u,h]=(0,v.useState)(c),[x,m]=(0,v.useState)(!1);return(0,i.jsxs)(ed.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ex.x,{children:a}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.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)(ef.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(eg.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var ej=t(65952),ey=t(76330),eb=t(53152),ek=t(18222),ew=t(30678),eC=t(2838),e_=t(13156),eS=t.n(e_);function ez(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 eR=e=>{var n;let{lineageGraph:t}=ea(),[i,r]=(0,v.useState)([]),[l,s]=(0,v.useState)(),[o,a]=(0,v.useState)(!0),[c,d]=(0,v.useState)(null),u=eS().find(null==t?void 0:t.nodes,{name:e}),h=(0,v.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return ez(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,v.useEffect)(()=>{let e=async()=>{try{let e=(await 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(ez(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}},eT=t(68825),eE=t(81945),eO=t(14827);function eI(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 eA(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",eM="#F6AD55",eD="".concat(eN,"A5"),eL="".concat(eM,"A5");function eF(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 eP(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eE.kL.register(eE.ZL,eE.RM,eE.f$,eE.uw,eE.u);let l=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasets:i,type:r,samples:l=0,binEdges:s}=e,[o,a]=i,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=eW(s,n);return"".concat(c?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,r=0===n?a.counts:o.counts,s=eI(r[t]/l),c=r[t];return"".concat(i,": ").concat(c," (").concat(s,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:r,binEdges:l}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,c=Math.max(...a.counts,...o.counts),d=l.map((e,n)=>eW(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 eA(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=eq(t,i,"Current",eD,l),o=eq(t,i,"Base",eL,r);return{labels:i.map((e,n)=>eW(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(u.L,{}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eL})," Base"]}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eD})," Current"]}),(0,i.jsx)(u.L,{})]}),(0,i.jsx)(eO.kL,{type:"bar",options:l,data:s,plugins:[]})]})}function eq(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 eW(e,n){let t=e[n],i=e[n+1],r=eA(t),l=eA(i);return"".concat(r," - ").concat(l)}var eH=t(20074),eV=t(48289),eJ=t(81737),eK=t.n(eJ),eU=t(77249);function eB(){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})}}}var eQ=t(50228),eZ=t(67605),eX=t.n(eZ);let eY="ignore-screenshot";function e$(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:x,ignoreElements:m}=e,[p,f]=(0,v.useState)("idle"),g=(0,v.useRef)(null),{onOpen:j,setImgBlob:y,ImageDownloadModal:b}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,ej.q)(),[r,l]=(0,v.useState)();return{onOpen:n,setImgBlob:l,ImageDownloadModal:function(){let[n,l]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!r)return;let e=new FileReader;e.readAsDataURL(r),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&l(e.target.result)}},[l]),(0,i.jsxs)(ed.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{children:"Screenshot Preview"}),(0,i.jsx)(em.o,{}),(0,i.jsxs)(ep.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)(eV.s,{color:"red.600"}),(0,i.jsx)(h.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(h.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,eQ.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");eX()(r,n),t()},children:"Download"})]})]})]})}}}(),k=async()=>{if(!g.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=g.current.element||g.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; }"),f("loading");let i="html2canvas"===n?await eK()(e,{logging:!1,backgroundColor:null,ignoreElements:m}):await (0,eU.rT)(e,{filter:m?e=>!m(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:p,isLoading:"loading"===p,isErrored:"error"===p,isSuccess:"success"===p,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:k()})]),f("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(y(await k()),j(),f("success")):(f("error"),console.error("Error copying to clipboard",e),x&&x(e))}},ImageDownloadModal:b,ref:g}}function eG(e){let{successToast:n,failToast:t}=eB(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=e$({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)}});return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eg.z,{size:"sm",leftIcon:(0,i.jsx)(eH.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:r,onMouseEnter:()=>{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"}},onMouseLeave:()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},onClick:async()=>{o.current&&(await l(),(o.current.element||o.current).style.boxShadow="")},children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})}}}let e0=e=>{let{backgroundColor:n="white",blockSize:t,children:l,...s}=e,{ref:o,CopyToClipboardButton:a}=eG({backgroundColor:n});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.xu,{ref:o,...s,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.xu,{backgroundColor:n,height:"100%",blockSize:t,children:l})}),(0,i.jsx)(a,{imageType:"png"})]})};var e1=t(24112);t(63156);var e2=t(22204);function e5(e){let{enableScreenshot:n=!0,...t}=e,{ref:r,CopyToClipboardButton:l}=eG();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e2.ZP,{ref:r,...t}),n&&(0,i.jsx)(l,{imageType:"png"})]})}function e4(){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)(h.x,{fontWeight:"600",children:" No rows"})})}t(87679);var e9=t(52091);function e3(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 e6(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 e8(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 e7(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?e9.ven:e9.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?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let ne=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]},nn=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(h.x,{style:{color:"gray"},children:"-"});let[r,l]=ne(n[t.key]);return(0,i.jsx)(h.x,{style:{color:l?"gray":"inherit"},children:r})};function nt(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(e3(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=e6(r.columns,s);r.data.forEach((n,t)=>{let i=e8(r.columns,e,n);i in u&&(x=!0),u[i]=n}),e=e6(l.columns,s),l.data.forEach((n,t)=>{let i=e8(l.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=e3(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||eS().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(!eS().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(e7,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,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)(e7,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nn})}),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}}function ni(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?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nr(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=e3(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))&&(eS().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(!eS().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:r,name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e2.Ug,headerCellClass:r,cellClass:l,renderCell:nn,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nn})}),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 nl=t(93998),ns=t(18454),no=t(25773),na=t(16257),nc=t(32088),nd=t(39171);let nu=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)(no.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(nl.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(u.L,{minHeight:"32px"}),(0,i.jsx)(na.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)(nc.u,{label:"Add to Checklist",children:(0,i.jsx)(nd.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,i.jsx)(ns.d,{}),onClick:()=>s(n)})})]})},nh=e=>{var n,t,r,l,s,a;let{run:c,onAddToChecklist:d,viewOptions:u,onViewOptionsChanged:h}=e,x=(0,v.useMemo)(()=>(null==u?void 0:u.primary_keys)||[],[u]),m=(0,v.useMemo)(()=>(null==u?void 0:u.changed_only)||!1,[u]),p=(0,v.useMemo)(()=>(null==u?void 0:u.pinned_columns)||[],[u]),f=(0,v.useMemo)(()=>{var e,n;return nt(null==c?void 0:null===(e=c.result)||void 0===e?void 0:e.base,null==c?void 0:null===(n=c.result)||void 0===n?void 0:n.current,{changedOnly:m,primaryKeys:x,onPrimaryKeyChange:e=>{h&&h({...u,primary_keys:e})},pinnedColumns:p,onPinnedColumnsChange:e=>{h&&h({...u,pinned_columns:e})}})},[c,u,m,x,p,h]),g=(0,v.useMemo)(()=>{let e=x.join(", ");return f.invalidPKeyBase&&f.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):f.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):f.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[f.invalidPKeyBase,f.invalidPKeyCurrent,x]),j=(null===(t=c.result)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.limit)||0,y=j>0&&((null==c?void 0:null===(l=c.result)||void 0===l?void 0:null===(r=l.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(a=c.result)||void 0===a?void 0:null===(s=a.base)||void 0===s?void 0:s.more))?"Warning: Displayed results are limited to ".concat(j.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,b=[];return(g&&b.push(g),y&&b.push(y),0===f.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):m&&0===f.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:c,viewOptions:u,onAddToChecklist:d,onViewOptionsChanged:h,warnings:b}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:c,viewOptions:u,onAddToChecklist:d,onViewOptionsChanged:h,warnings:b}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:f.columns,rows:f.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nx=e=>{var n,t,r,l;let{run:s,onAddToChecklist:a,viewOptions:c,onViewOptionsChanged:d}=e,u=(0,v.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),h=(0,v.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),x=(0,v.useMemo)(()=>{var e,n;if(!(null===(e=s.result)||void 0===e?void 0:e.diff)||!(null==s?void 0:null===(n=s.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=s.params.primary_keys;return nr(null==s?void 0:s.result.diff,t,{changedOnly:u,pinnedColumns:h,onPinnedColumnsChange:e=>{d&&d({...c,pinned_columns:e})}})},[s,c,u,h,d]),m=(null===(t=s.result)||void 0===t?void 0:null===(n=t.diff)||void 0===n?void 0:n.limit)||0,p=m>0&&(null==s?void 0:null===(l=s.result)||void 0===l?void 0:null===(r=l.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(m.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,f=[];return(p&&f.push(p),0===x.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):u&&0===x.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:s,viewOptions:c,onAddToChecklist:a,onViewOptionsChanged:d,warnings:f}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:s,viewOptions:c,onAddToChecklist:a,onViewOptionsChanged:d,warnings:f}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nm=e=>{var n;return(null===(n=e.run)||void 0===n?void 0:n.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff?(0,i.jsx)(nx,{...e}):(0,i.jsx)(nh,{...e})};function np(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?e9.$kI:e9.oJP,onClick:a?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}let nf=e=>{let{run:n,viewOptions:t,onViewOptionsChanged:l,onAddToChecklist:s}=e,a=(0,v.useMemo)(()=>(null==t?void 0:t.pinned_columns)||[],[t]),c=null==n?void 0:n.result,d=(0,v.useMemo)(()=>c?function(e,n){let t=[],r=n.pinnedColumns||[],l=(e,t)=>({key:String(e),name:(0,i.jsx)(np,{name:t,...n}),width:"auto",renderCell:nn});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),r.forEach(n=>{let i=eS().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}}(c,{pinnedColumns:a,onPinnedColumnsChange:e=>{l&&l({...t,pinned_columns:e})}}):{rows:[],columns:[]},[c,a,t,l]);if(0===d.columns.length)return(0,i.jsx)(e1.M,{height:"100%",children:"No data"});let h=(null==c?void 0:c.limit)||0,x=h>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(h.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,m=s||x;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[m&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:x?"orange.100":"inherit",children:[x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nl.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.xu,{children:x})]}),(0,i.jsx)(u.L,{minHeight:"32px"}),s&&(0,i.jsx)(nc.u,{label:"Add to Checklist",children:(0,i.jsx)(nd.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,i.jsx)(ns.d,{}),onClick:()=>s(n)})})]}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};function ng(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 nv=t(96124);let nj="#63B3ED";function ny(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:eA(o),displayRatio:eI(o/e.valids)||"N/A"}})}function nb(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nc.u,{label:(0,i.jsxs)(r.xu,{children:[(0,i.jsxs)(h.x,{children:[(0,i.jsx)(eF,{color:eN}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(h.x,{children:[(0,i.jsx)(eF,{color:eM}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nk(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=ny(n.current,t),s=ny(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)(u.L,{}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eM})," Base"]}),(0,i.jsxs)(h.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eF,{color:eN})," Current"]}),(0,i.jsx)(u.L,{})]}),l.map((e,t)=>{let r=s[t];return e.isLastItemOthers&&0===e.count&&0===r.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(v.Fragment,{children:[(0,i.jsx)(nb,{base:r,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(h.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)(nw,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eN}),(0,i.jsx)(h.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(h.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nw,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eM}),(0,i.jsx)(h.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(h.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nv.i,{})]},t)})]})}function nw(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nj}=e;eE.kL.register(eE.uw,eE.ZL,eE.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=nj}=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)(eO.$Q,{data:a,options:o,plugins:[]})}var nC=t(93960),n_=t(66011);function nS(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,[s,o]=(0,v.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,c=null==n?void 0:n.primary_key,{columns:d,primaryKey:u,isLoading:h,error:x}=eR(n.model);(0,v.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,v.useEffect)(()=>{l(!!c&&!!a)},[c,a,l]);let m=d.map(e=>e.name),p=Array.isArray(c)?c:c?[c]:void 0;return h?(0,i.jsx)(r.xu,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(no.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Model"}),(0,i.jsx)(nC.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Primary key"}),(0,i.jsx)(n_.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)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Columns"}),(0,i.jsx)(na.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(n_.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 nz=t(49801),nR=t(50104),nT=t(78439),nE=t(39226),nO=t(70949),nI=t(34510);function nA(e){let{params:n,column:t,containerRef:l}=e,{runAction:a}=nW(),c=(e,t)=>{a("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)(u.L,{}),(0,i.jsx)(nz.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nR.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nd.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nT.h,{containerRef:l,children:(0,i.jsx)(nE.q,{lineHeight:"20px",children:(0,i.jsxs)(nO.k,{title:"Action",as:r.xu,fontSize:"8pt",children:[(0,i.jsx)(nI.s,{fontSize:"10pt",onClick:()=>c({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nI.s,{fontSize:"10pt",onClick:()=>c({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}var nN=t(18502),nM=t(63594);let nD={lineage_diff:{title:"Lineage Diff",icon:eb.Ks7},schema_diff:{title:"Schema Diff",icon:nM.C8A},query:{title:"Query",icon:eb.r2i,RunResultView:nf},query_diff:{title:"Query Diff",icon:eb.r2i,RunResultView:nm},row_count_diff:{title:"Row Count Diff",icon:nM.QUK,RunResultView:function(e){let{run:n}=e;function t(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=n.result||{},l=Object.keys(n.result||{}).map(e=>{let n=r[e],t=(null==n?void 0:n.base)||null,i=(null==n?void 0:n.curr)||null,l="No Change";return null!==t&&null!==i?l=t!==i?ng(t,i):"No Change":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===l.length?(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:t},{key:"base",name:"Base Rows",cellClass:t},{key:"current",name:"Current Rows",cellClass:t},{key:"delta",name:"Delta",cellClass:t}],rows:l,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},className:"rdg-light",enableScreenshot:!0})})})}},profile_diff:{title:"Profile Diff",icon:eb.KA6,RunResultView:function(e){var n;let{run:t,viewOptions:r,onViewOptionsChanged:l}=e,s=t.result;t.params;let o=(0,v.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),a=((null==s?void 0:null===(n=s.current)||void 0===n?void 0:n.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==a?void 0:a.name)||"column_name",d=(0,v.useMemo)(()=>nt(null==s?void 0:s.base,null==s?void 0:s.current,{primaryKeys:[c],pinnedColumns:o,onPinnedColumnsChange:e=>{l&&l({...r,pinned_columns:e})}}),[s,c,o,r,l]);return 0===d.columns.length?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})}},value_diff:{title:"Value Diff",icon:eb.pRi,RunResultView:function(e){let{run:n}=e,t=n.result,l=n.params,a=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=(0,v.useRef)(),d=Array.isArray(l.primary_key)?l.primary_key:[l.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e1.M,{height:"100%",children:d.includes(n[0])&&(0,i.jsx)(s.J,{as:e9.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nA,{column:n[t.key],params:l,containerRef:c})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:a},{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:a}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",ref:c,children:[(0,i.jsxs)(r.xu,{px:"16px",children:["Model: ",l.model,", ",t.summary.total," total (",t.summary.total-t.summary.added-t.summary.removed," ","common, ",t.summary.added," added, ",t.summary.removed," removed)"]}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:t.data.data,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})},RunForm:nS},value_diff_detail:{title:"Value Diff Detail",icon:eb.pRi,RunResultView:e=>{var n,t;let{run:r,onAddToChecklist:l,viewOptions:s,onViewOptionsChanged:a}=e,c=(0,v.useMemo)(()=>(null==s?void 0:s.changed_only)||!1,[s]),d=(0,v.useMemo)(()=>(null==s?void 0:s.pinned_columns)||[],[s]),u=(0,v.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nr(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:d,onPinnedColumnsChange:e=>{a&&a({...s,pinned_columns:e})}})},[r,s,c,d,a]),h=(null===(n=r.result)||void 0===n?void 0:n.limit)||0,x=h>0&&(null==r?void 0:null===(t=r.result)||void 0===t?void 0:t.more)?"Warning: Displayed results are limited to ".concat(h.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,m=[];return(x&&m.push(x),0===u.columns.length)?(0,i.jsx)(e1.M,{height:"100%",children:"No data"}):c&&0===u.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:r,viewOptions:s,onAddToChecklist:l,onViewOptionsChanged:a,warnings:m}),(0,i.jsx)(e1.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nu,{run:r,viewOptions:s,onAddToChecklist:l,onViewOptionsChanged:a,warnings:m}),(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},RunForm:nS},top_k_diff:{title:"Top-K Diff",icon:nN.Pkc,RunResultView:function(e){let{run:n}=e,[t,r]=(0,v.useState)(!0),s=n.result,a=n.params,d=s.base,h=s.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e0,{blockSize:"auto",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",children:["Model ",a.model,".",a.column_name]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(u.L,{}),(0,i.jsx)(nk,{topKDiff:s,valids:h.valids||0,isDisplayTopTen:t}),(0,i.jsx)(u.L,{})]})]}),(0,i.jsx)(u.L,{}),(d.values.length>10||h.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(l.r,{onClick:()=>r(e=>!e),textColor:"blue.500",children:t?"View More Items":"View Only Top-10"})})]})},RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eR(n.model),c=s.map(e=>e.name);return((0,v.useEffect)(()=>{l(!!n.column_name)},[n,l]),o)?(0,i.jsx)(r.xu,{children:"Loading..."}):0===c.length||a?(0,i.jsx)(r.xu,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.xu,{m:"16px",children:(0,i.jsxs)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eC.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:eb.dku,RunResultView:function(e){var n,t,l,s,a,d;let{run:h}=e,x=h.params,m=null===(n=h.result)||void 0===n?void 0:n.base,p=null===(t=h.result)||void 0===t?void 0:t.current,f=null===(l=h.result)||void 0===l?void 0:l.min,g=null===(s=h.result)||void 0===s?void 0:s.max,v=null===(a=h.result)||void 0===a?void 0:a.bin_edges;return m&&p?(0,i.jsx)(o.k,{direction:"column",height:"500px",children:(0,i.jsxs)(e0,{height:"100%",children:[(0,i.jsxs)(c.X,{as:"h1",size:"md",paddingTop:"4",textAlign:"center",children:["Model ",x.model,".",x.column_name]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(u.L,{}),(0,i.jsx)(r.xu,{w:"80%",h:"300px",m:"4",children:(0,i.jsx)(eP,{data:{type:(null===(d=h.params)||void 0===d?void 0:d.column_type)||"",datasets:[p,m],min:f,max:g,samples:m.total,binEdges:v}})}),(0,i.jsx)(u.L,{})]})]})}):(0,i.jsx)("div",{children:"Loading..."})},RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eR(n.model),c=s.filter(e=>!["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.type.toUpperCase())&&!["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.type.toUpperCase()));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)(ek.NI,{children:[(0,i.jsx)(ew.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eC.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))})]})})}}},nL=e=>nD[e],nF=(0,v.createContext)({runAction:()=>{},showRunId:e=>{},isOpen:!1,close:()=>{}}),nP=e=>{let[n]=(0,ey.TH)();(0,v.useEffect)(()=>{e()},[e,n])};function nq(e){var n;let{children:t}=e,[r,l]=(0,v.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,ej.q)(),{isOpen:c,onOpen:d,onClose:u}=(0,ej.q)(),h=(0,X.p)(),[x,m]=(0,v.useState)(),[p,f]=(0,ey.TH)(),g=(0,v.useCallback)(e=>{m(e),d()},[m,d]),j=(0,v.useCallback)(async(e,n,t)=>{try{let i;let r=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ei(e,n,1);1===t.length&&(i=t[0])}let s=nL(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 G(e,n,{nowait:!0});g(t),p.startsWith("/lineage")&&f("/lineage")}}catch(e){h({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[l,o,g,h,p,f]);nP(a);let y=async(e,n)=>{try{a();let{run_id:t}=await G(e,n,{nowait:!0});g(t)}catch(e){h({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,v.useEffect)(()=>{x&&!p.startsWith("/lineage")&&f("/lineage")},[x]),(0,i.jsxs)(nF.Provider,{value:{runAction:j,runId:x,showRunId:g,isOpen:c,close:u},children:[r&&(0,i.jsx)(ev,{isOpen:s,onClose:a,onExecute:y,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 nW=()=>(0,v.useContext)(nF);function nH(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eo,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nq,{children:n})})})})})}var nV=t(81600);async function nJ(){return(await U.post("/api/checks",{type:"simple"})).data}async function nK(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function nU(){return(await U.get("/api/checks")).data}async function nB(e){return(await U.get("/api/checks/".concat(e))).data}async function nQ(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function nZ(e){return(await U.delete("/api/checks/".concat(e))).data}async function nX(e){return await U.post("/api/checks/reorder",e)}var nY=t(94734),n$=t(71738),nG=t(38414),n0=t(29598),n1=t(62216),n2=t(42675),n5=t(54097),n4=t(95862),n9=t(82960),n3=t(69879),n6=t(618),n8=t(77153);function n7(e){let{name:n,setName:t}=e,[l,s]=(0,v.useState)(!1),[o,a]=(0,v.useState)(n),c=(0,v.useRef)(null),d=(0,v.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,v.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l,c,d]),(0,i.jsxs)(n3.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(n8.X,{color:"gray.500"}),children:[(0,i.jsx)(n6.g,{children:(0,i.jsx)(r.xu,{children:"Checklist"})}),(0,i.jsx)(n6.g,{flex:"0 1",cursor:"pointer",children:l?(0,i.jsx)(nC.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 te=t(94019);t(81974);var tn=t(89725),tt=t(13965);function ti(e){let n,t,{base:r,current:l,enableScreenshot:s=!1}=e,{columns:a,rows:c}=(0,v.useMemo)(()=>(function(e){function n(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 t(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:n},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:n},{key:"name",name:"Name",resizable:!0,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:t},{key:"currentType",name:"Current Type",resizable:!0,cellClass:t}],rows:Object.values(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(e3(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,r]=e;t[i].baseIndex=n+1,t[i].baseType=r.type}),Object.entries(n).map((e,n)=>{let[i,r]=e;t[i].currentIndex=n+1,t[i].currentType=r.type}),t}(null==r?void 0:r.columns,null==l?void 0:l.columns)),[r,l]),{lineageGraph:d}=ea(),u=!(null==d?void 0:d.catalogMetadata.base),h=!(null==d?void 0:d.catalogMetadata.current);u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let x=r&&void 0===r.columns,m=l&&void 0===l.columns;return x&&m?t="Schema information is missing on both current and base environments.":x?t="Schema information is missing on base environment.":m&&(t="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[n?(0,i.jsxs)(tn.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tt.z,{}),n]}):t?(0,i.jsxs)(tn.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tt.z,{}),t]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e5,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:a,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e4,{})},className:"rdg-light",enableScreenshot:s})})]})}async function tr(e){return(await U.post("/api/select",e)).data}var tl=t(12282);t(15080);let ts=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tl.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},to=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tl.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var ta=t(79898),tc=t(68630),td=t(91363);let tu=e9.Nbv,th=e9.sFB,tx=e9.UGs;function tm(e){return"added"===e?{color:"#1dce00",icon:tu}:"removed"===e?{color:"#ff4444",icon:th}:"modified"===e?{color:"#ffa502",icon:tx}:{color:"inherit",icon:void 0}}function tp(e){if("model"===e)return{color:"#c0eafd",icon:tc.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:td._MV};if("source"===e)return{color:"#a6dda6",icon:tc.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:td.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:td.R1C};if("seed"===e)return{color:"#a6dda6",icon:tc.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tc.Dmm};else return{color:"inherit",icon:void 0}}function tf(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}=tp(l.resourceType),{base:h,current:x}=l.data;if(d){var m;n=null===(m=nL("schema_diff"))||void 0===m?void 0:m.icon,t=tm("modified").color}else!h&&x?(n=tm("added").icon,t=tm("added").color):h&&!x&&(n=tm("removed").icon,t=tm("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>c(l.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:l.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})};function tv(e){let{check:n}=e,{lineageGraph:t}=ea(),r=n.params,l=[...W.check(n.check_id),"select"],{isLoading:s,error:o,refetch:a,data:c}=(0,y.a)({queryKey:l,queryFn:async()=>tr({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[d,u]=(0,v.useMemo)(()=>{let e=[],n=[],i=[],l=[];if(null==r?void 0:r.node_id){let n=null==t?void 0:t.nodes[r.node_id];n&&e.push(n)}else for(let n of(null==c?void 0:c.nodes)||[]){let i=null==t?void 0:t.nodes[n];i&&e.push(i)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tf(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?i.push(e.id):e.data.base&&!e.data.current&&l.push(e.id)}function d(e){return n.includes(e.id)?3:i.includes(e.id)?2:l.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==c?void 0:c.nodes,t]),[h,x]=(0,v.useState)(0);if(s)return(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(o)return(0,i.jsxs)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==o?void 0:o.message]});if(0==d.length)return(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(h(0,i.jsx)(tg,{node:e,schemaChanged:u.includes(e.id),selected:n===h,onSelect:()=>{x(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})}var tj=t(51643);function ty(e){let{value:n,onChange:t}=e,[r,s]=(0,v.useState)(!1),[a,c]=(0,v.useState)(),d=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(r&&d.current){let e=d.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[r]),r)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tj.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)(eg.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(a),s(!1))},children:"Update"})]})]}):(0,i.jsx)(h.x,{overflow:"auto",fontSize:"11pt",onClick:()=>{c(n||""),s(!0)},whiteSpace:"pre",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tb=t(40902);function tk(){let e=(0,nV._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tk=function(){return e},e}function tw(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function tC(e){return e.description?e.description:"_(no description)_"}var t_=t(31265),tS=e=>{let{value:n,onChange:t,onRun:r,onRunDiff:l,options:s={},...o}=e;return(0,i.jsx)(t_.ZP,{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.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,l)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...s}})},tz=t(23567);let tR=e=>{var n,t,l,s;let{isPending:a,isAborting:c,isCheckDetail: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===(t=h.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tn.b,{status:"error",children:[(0,i.jsx)(tt.z,{}),"Error: ",y]});if(a){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(l=x.progress)||void 0===l?void 0:l.message)?null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message:"Loading...";return(0,i.jsx)(e1.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(no.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)(tz.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tz.D,{size:"20px",value:100*u.percentage,mr:"8px"}),c?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!c&&(0,i.jsx)(eg.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return d?(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(eg.z,{onClick:j,colorScheme:"blue",size:"sm",children:"Run Query"})}):(0,i.jsx)(e1.M,{bg:"rgb(249,249,249)",height:"100%",children:"No Data"});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&&(0,i.jsx)(g,{run:x,viewOptions:p,onViewOptionsChanged:f}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})};var tT=t(65674),tE=t(29012),tO=t(25783),tI=t(43361),tA=t(49110),tN=t(55415),tM=t(24432);t(90548),t(91074);var tD=t(66633),tL=t(83143),tF=t(29937);function tP(e){let{node:n}=e,{icon:t}=tp(n.resourceType);return(0,i.jsx)(nc.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(nY.Vp,{children:[(0,i.jsx)(nY.AD,{as:t}),(0,i.jsx)(nY.Sn,{children:n.resourceType})]})})}function tq(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)(eT.U,{children:[(0,i.jsx)(h.x,{children:l}),(0,i.jsx)(s.J,{as:tL.Rgz}),(0,i.jsx)(h.x,{children:o})]}):t===r?(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(h.x,{children:o}),(0,i.jsx)(s.J,{as:tF.lxc,color:"gray.500"}),(0,i.jsx)(h.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nc.u,{label:l,children:(0,i.jsxs)(nY.Vp,{children:[(0,i.jsx)(nY.AD,{as:x}),(0,i.jsx)(nY.Sn,{children:m||c?(0,i.jsx)(tD.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(tq,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(nY.bq,{as:nd.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,i.jsx)(n2.n,{}),size:"xs",onClick:a})]})})}let tH=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:a}=t;if("pending"===l)return(0,i.jsx)(tz.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Skipped"}),s&&(0,i.jsx)(nc.u,{label:s,children:(0,i.jsx)(eV.s,{})})]});if(!a)return(0,i.jsx)(tz.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)(tz.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tz.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(c)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.xu,{children:"Error"}),s&&(0,i.jsx)(nc.u,{label:c,children:(0,i.jsx)(nl.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,i.jsx)(nY.Vp,{children:(0,i.jsx)(nY.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)(tW,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},tV=e=>{var n,t,l,a;let c,d,{id:u}=e,{lineageGraph:h,runsAggregated:x}=ea(),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=tf(null===(l=p.data.base)||void 0===l?void 0:l.columns,null===(a=p.data.current)||void 0===a?void 0:a.columns)),m&&m.row_count_diff){let e=m.row_count_diff;d=e.result.curr!==e.result.base}return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==c&&(0,i.jsx)(nc.u,{label:"Schema (".concat(c?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nL("schema_diff"))||void 0===n?void 0:n.icon,color:c?tm("modified").color:"lightgray"})})}),void 0!==d&&(0,i.jsx)(nc.u,{label:"Row count (".concat(d?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.xu,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon,color:d?tm("modified").color:"lightgray"})})})]})};var tJ=t(13358),tK=t(15196),tU=t(28023),tB=t(84963);function tQ(e){let{base:n,current:t}=e;return(0,i.jsx)(t_.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 tZ(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}function tX(e){var n,t,l,a,d,h,f;let{node:g,onCloseNode:j}=e,[,y]=(0,ey.TH)(),{setSqlQuery:b,setPrimaryKeys:k}=_(),w="model"===g.resourceType||"seed"===g.resourceType||"source"===g.resourceType||"snapshot"===g.resourceType,{isOpen:C,onOpen:S,onClose:z}=(0,ej.q)(),{runAction:R}=nW(),{envInfo:T}=ea(),{primaryKey:E}=eR(g.name),O=()=>{R("row_count_diff",{node_names:[g.name]},{showForm:!1,showLast:!1})},I=(0,v.useCallback)(async()=>{let e=g.id,n=await tZ({node_id:e});y("/checks/".concat(n.check_id))},[g,y]),A="added"===g.changeStatus||"removed"===g.changeStatus;return(0,i.jsxs)(tK.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(r.xu,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(c.X,{size:"sm",children:g.name})}),(0,i.jsx)(u.L,{}),("model"===g.resourceType||"seed"===g.resourceType||"snapshot"===g.resourceType)&&(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{as:eg.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(n=nL("query_diff"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{(null==T?void 0:T.adapterType)==="dbt"?b('select * from {{ ref("'.concat(g.name,'") }}')):(null==T?void 0:T.adapterType)==="sqlmesh"&&b("select * from ".concat(g.name)),k(void 0!==E?[E]:void 0),y("/query")},children:"Query"}),(0,i.jsx)(tU.R,{}),(0,i.jsxs)(nO.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===g.resourceType||"snapshot"===g.resourceType)&&(0,i.jsx)(nI.s,{onClick:S,icon:(0,i.jsx)(tc.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>O(),children:"Row Count Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nL("profile_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("profile_diff",{model:g.name},{showForm:!1,showLast:!1})},children:"Profile Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(a=nL("value_diff"))||void 0===a?void 0:a.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("value_diff",{model:g.name},{showForm:!0,showLast:!1})},children:"Value Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nL("top_k_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("top_k_diff",{model:g.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nL("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:A,onClick:()=>{R("histogram_diff",{model:g.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]}),(0,i.jsx)(tU.R,{}),(0,i.jsx)(nO.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nI.s,{icon:(0,i.jsx)(s.J,{as:null===(f=nL("schema_diff"))||void 0===f?void 0:f.icon}),fontSize:"14px",onClick:I,children:"Schema Diff"})})]})]}),(0,i.jsx)(r.xu,{flex:"0 1 1%",children:(0,i.jsx)(tB.P,{onClick:j})})]}),(0,i.jsx)(r.xu,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(eT.U,{spacing:"8px",children:[(0,i.jsx)(tP,{node:g}),("model"===g.resourceType||"snapshot"===g.resourceType||"seed"===g.resourceType)&&(0,i.jsx)(tW,{node:g,onRefresh:O})]})}),w&&(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)(n$.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(nG.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(ti,{base:g.data.base,current:g.data.current})})})]}),(0,i.jsxs)(ed.u_,{isOpen:C,onClose:z,size:"6xl",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ex.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.f,{children:(0,i.jsx)(tQ,{base:g.data.base,current:g.data.current})})]})]})]})}var tY=t(88989),t$=t(12867),tG=t(27547);async function t0(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function t1(e){var n;let{nodes:t,onFinish:r}=e,[,l]=(0,ey.TH)();return(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e;1===t.length?e=await tZ({node_id:t[0].id}):await Promise.all(t.map(async e=>{await tZ({node_id:e.id})})),r(),e?l("/checks/".concat(e.check_id)):l("/checks")},children:[(0,i.jsx)(s.J,{as:null===(n=nL("schema_diff"))||void 0===n?void 0:n.icon}),"Add schema check"]})}function t2(e){var n;let{viewMode:t,nodes:r,onFinish:l,isDisabled:o,withIcon:a}=e,[,c]=(0,ey.TH)();return(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",backgroundColor:"white",isDisabled:0===r.length||o,onClick:async()=>{let e=r.map(e=>e.id),n=await t0({view_mode:t,node_ids:e});l(),n?c("/checks/".concat(n.check_id)):c("/checks")},children:[a&&(0,i.jsx)(s.J,{as:null===(n=nL("lineage_diff"))||void 0===n?void 0:n.icon}),"Add lineage diff check"]})}function t5(e){var n,t,l,o,a,c;let{viewMode:d,nodes:u,onClose:h,onActionStarted:x,onActionNodeUpdated:m,onActionCompleted:p}=e,[f,g]=(0,v.useState)({mode:"per_node",status:"pending",completed:0,total:0}),j=(0,b.NL)(),[,y]=(0,ey.TH)(),k=async(e,n,t)=>{let i="multi_nodes";f.mode=i,x(),f.status="running";let r=[];for(let e of u){let t=n(e);t?(e.action={mode:i,status:"skipped",skipReason:t},m(e)):(e.action={mode:i,status:"pending"},r.push(e))}let l=t(r);try{let{run_id:n}=await G(e,l,{nowait:!0});for(f.currentRun={run_id:n},f.total=1;;){let e=await ee(n,2);f.currentRun=e;let t=e.error?"failure":e.result?"success":"running";for(let n of r)n.action={mode:i,status:t,run:e},m(n);if(e.error||e.result)break}}catch(e){}if(f.completed=1,"canceling"===f.status){f.status="canceled",p();return}f.status="completed",p()},w=async(e,n)=>{let t="per_node";for(let e of(f.mode=t,x(),f.status="running",u))e.action={mode:t,status:"pending"},m(e);for(let i of(f.completed=0,f.total=u.length,u)){let{params:r,skipReason:l}=n(i);if(l)i.action={mode:t,status:"skipped",skipReason:l},m(i);else try{let{run_id:n}=await G(e,r,{nowait:!0});for(f.currentRun={run_id:n},i.action={mode:t,status:"running"},m(i);;){let e=await ee(n,2);f.currentRun=e;let r=e.error?"failure":e.result?"success":"running";if(i.action={mode:t,status:r,run:e},m(i),e.error||e.result)break}}catch(e){}finally{f.currentRun=void 0}if(f.completed++,"canceling"===f.status){f.status="canceled",p();return}}f.status="completed",p()},C=async()=>{let e=[];for(let n of u)"model"!==n.resourceType?(n.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},m(n)):e.push(n.name);k("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},_=async()=>{w("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."}})},S=async()=>{var e;f.status="canceling",(null===(e=f.currentRun)||void 0===e?void 0:e.run_id)&&en(f.currentRun.run_id)},z=(0,v.useCallback)(async()=>{var e;let n=null===(e=f.currentRun)||void 0===e?void 0:e.run_id;if(!n)return;let t=await nK(n);j.invalidateQueries({queryKey:W.checks()}),y("/checks/".concat(t.check_id))},[null===(n=f.currentRun)||void 0===n?void 0:n.run_id,y,j]);return(0,t$.z)(()=>{"running"===f.status&&S()}),(0,i.jsxs)(r.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:["pending"===f.status&&(0,i.jsxs)(eT.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(tG.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:h,children:[(0,i.jsxs)(eg.z,{children:[u.length," selected"]}),(0,i.jsx)(nd.h,{"aria-label":"Exit select Mode",icon:(0,i.jsx)(tY.D,{})})]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(t1,{nodes:u,onFinish:h}),(0,i.jsx)(t2,{viewMode:d,nodes:u,onFinish:h,withIcon:!0})]}),(0,i.jsxs)(eT.U,{children:[(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===u.length,onClick:C,children:[(0,i.jsx)(s.J,{as:null===(t=nL("row_count_diff"))||void 0===t?void 0:t.icon}),"Row count diff"]}),(0,i.jsxs)(eg.z,{size:"xs",variant:"outline",isDisabled:0===u.length,onClick:_,children:[(0,i.jsx)(s.J,{as:null===(l=nL("value_diff"))||void 0===l?void 0:l.icon}),"Value diff"]})]})]}),"pending"!==f.status&&(0,i.jsxs)(eT.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(r.xu,{fontSize:"10pt",children:["Progress: ","per_node"===f.mode?"".concat(f.completed," / ").concat(f.total):(null===(c=f.currentRun)||void 0===c?void 0:null===(a=c.progress)||void 0===a?void 0:a.percentage)?"".concat(100*f.currentRun.progress.percentage,"%"):"completed"===f.status?"100%":"0%"," ","canceled"===f.status?" (canceled)":""]}),"running"===f.status||"canceling"===f.status?(0,i.jsx)(eg.z,{size:"xs",variant:"outline",onClick:S,isLoading:"canceling"===f.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsxs)(eT.U,{children:["multi_nodes"===f.mode&&(null===(o=f.currentRun)||void 0===o?void 0:o.result)&&(0,i.jsx)(eg.z,{display:"none",size:"xs",variant:"outline",onClick:z,children:"Add to checklist"}),(0,i.jsx)(eg.z,{size:"xs",variant:"outline",onClick:h,children:"Close"})]})]})]})}let t4=e=>{let{isDisabled:n,viewOptions:t,onViewOptionsChanged:r}=e,l=t.view_mode||"changed_models",o=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{as:eg.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tp("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===l?"Changed Models":"All"}),(0,i.jsxs)(nE.q,{title:"packages",children:[(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:"changed_models"===l,onChange:()=>o("changed_models"),children:"Changed Models"}),(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:"all"===l,onChange:()=>o("all"),children:"All"})]})]})},t9=e=>{var n,t;let{viewOptions:r,onViewOptionsChanged:l,isDisabled:o}=e,{lineageGraph:a}=ea(),c=new Set;for(let e of Object.values((null==a?void 0:a.nodes)||{}))e.packageName&&c.add(e.packageName);let d=null==a?void 0:null===(t=a.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=r.packages?new Set(r.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),l({...r,packages:Array.from(n)})};return(0,i.jsxs)(nz.v,{closeOnSelect:!1,children:[(0,i.jsx)(nR.j,{as:eg.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tL.zFh}),size:"xs",variant:"outline",isDisabled:o,children:m}),(0,i.jsx)(nE.q,{title:"packages",children:(0,i.jsxs)(nO.k,{title:"Select Packages",children:[(0,i.jsx)(nI.s,{as:na.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?l({...r,packages:[]}):l({...r,packages:Array.from(c)})},children:"Select All"}),(0,i.jsx)(tU.R,{}),Array.from(c).map(e=>(0,i.jsx)(nI.s,{as:na.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},t3=e=>{let[n,t]=(0,v.useState)(e.value),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nC.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})},t6=e=>(0,i.jsx)(t3,{isDisabled:e.isDisabled,value:e.viewOptions.select||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,select:n||void 0})}}),t8=e=>(0,i.jsx)(t3,{isDisabled:e.isDisabled,value:e.viewOptions.exclude||"",onChange:n=>{e.onViewOptionsChanged({...e.viewOptions,exclude:n||void 0})}}),t7=e=>(0,i.jsxs)(r.xu,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(r.xu,{fontSize:"8pt",children:e.label}),e.children]}),ie=e=>{let[,n]=(0,ey.TH)(),{runAction:t}=nW(),r=(0,v.useCallback)(e=>{e.check_id&&n("/checks/".concat(e.check_id))},[n]);return(0,i.jsxs)(nz.v,{placement:"bottom-end",children:[(0,i.jsx)(nR.j,{as:eg.z,size:"xs",isDisabled:e.isDisabled,children:"..."}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nO.k,{title:"Diff",m:"0",p:"4px 12px",children:(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:()=>{t("row_count_diff",{select:e.viewOptions.select,exclude:e.viewOptions.exclude})},children:"Row Count Diff by Selector"})}),(0,i.jsx)(tU.R,{}),(0,i.jsxs)(nO.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await t0(e.viewOptions);n&&r(n)},children:"Lineage Diff"}),(0,i.jsx)(nI.s,{as:h.x,size:"sm",fontSize:"10pt",onClick:async()=>{let n=await tZ({select:e.viewOptions.select,exclude:e.viewOptions.exclude});n&&r(n)},children:"Schema Diff by Selector"})]})]})]})},it=e=>(0,i.jsx)(eT.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(eT.U,{flex:"1",children:[(0,i.jsx)(t7,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(t4,{...e})}),(0,i.jsx)(t7,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(t9,{...e})}),(0,i.jsx)(t7,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(t6,{...e})}),(0,i.jsx)(t7,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(t8,{...e})}),(0,i.jsx)(u.L,{}),(0,i.jsx)(t7,{label:"Actions",action:!0,children:(0,i.jsxs)(tG.h,{isAttached:!0,variant:"outline",children:[(0,i.jsx)(eg.z,{size:"xs",fontSize:"9pt",onClick:e.onSelectNodesClicked,isDisabled:e.isDisabled,children:"Select nodes"}),(0,i.jsx)(ie,{...e})]})})]})});function ii(){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}=tm(n);return(0,i.jsx)(nc.u,{label:r,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:l})," ",t]})},n)})})}var ir=t(11978);let il={customNode:function(e){var n,t;let l,{data:a}=e,{isHighlighted:c,isSelected:d,resourceType:h,changeStatus:x}=a,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tp(h),f="gray.400",g="solid";x&&(l=tm(x).icon,f=tm(x).color);let v=f,j=a.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",y=null==a?void 0:a.name;return(0,i.jsx)(nc.u,{label:"model"===h?y:"".concat(y," (").concat(h,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",_hover:{backgroundColor:m?"gray.100":f},borderColor:v,borderWidth:1,borderStyle:g,backgroundColor:m?"white":f,borderRadius:3,boxShadow:j,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===c?"node-highlight":!0===d?"node-highlight":!1===c?"node-unhighlight":void 0,children:[(0,i.jsx)(o.k,{backgroundColor:f,padding:2,borderRightWidth:1,borderColor:v,borderStyle:g,alignItems:"top",visibility:m?"inherit":"hidden",children:(0,i.jsx)(s.J,{as:p})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(r.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:y}),l&&(0,i.jsx)(o.k,{children:(0,i.jsx)(s.J,{color:f,as:l,flex:"0 0 20px"})})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(eT.U,{spacing:"8px",children:[(0,i.jsx)(u.L,{}),a.isActionMode?a.action?(0,i.jsx)(tH,{node:a,action:a.action}):(0,i.jsx)(i.Fragment,{}):"model"===a.resourceType?(0,i.jsx)(tV,{id:a.id}):(0,i.jsx)(i.Fragment,{})]})})]}),Object.keys(null!==(n=null==a?void 0:a.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==a?void 0:a.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},is={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=tm(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}})})}},io=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tm(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},ia=(e,n)=>{let t=null==e?void 0:e.current,i=(0,v.useRef)({width:0,height:0});(0,v.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,r=t.contentRect.height;(Math.abs(r-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&r>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:r}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])};function ic(e){var n;let{...t}=e,l=(0,R._K)(),a=(0,v.useRef)(null),{successToast:c,failToast:d}=eB(),{copyToClipboard:u,ImageDownloadModal:x,ref:m}=e$({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(eY))},onSuccess:()=>{c("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),d("Failed to copy image to clipboard",e)}}),[p,f,g]=(0,R.Rr)([]),[j,y,b]=(0,R.ll)([]),[k,w]=(0,v.useState)(t.viewOptions||{}),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:T}=ea(),{showRunId:O,close:I}=nW(),H=k.view_mode||t.viewMode||"changed_models",[V,J]=(0,v.useState)("detail"),[K,U]=(0,v.useState)("normal"),[B,Q]=(0,v.useState)(),[Z,Y]=(0,v.useState)(!1),[$,G]=(0,v.useState)(!1),[ee,en]=(0,v.useState)({x:0,y:0});[...W.lineage(),k.select,k.exclude];let et=(0,X.p)();(0,v.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(k.select||k.exclude)try{e=(await tr({select:k.select,exclude:k.exclude})).nodes}catch(e){}let[n,t]=M(C,k,e);D(n,t),f(n),y(t)})()},[f,y,C]);let ei=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=l.getZoom();l.setCenter(n,t,{zoom:i,duration:200})}};ia(a,async()=>{if("detail"===V||"action_result"===V){let e=p.find(e=>e.data.isSelected);e&&ei(e)}});let er=(0,v.useCallback)(e=>{f(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[f]),el=async e=>{let n;if(!C)return;try{n=(await tr({select:e.select,exclude:e.exclude})).nodes}catch(e){if(e instanceof ir.d7){var t,i;et({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[r,s]=M(C,e,n);D(r,s),f(r),y(s),w(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{l.fitView({nodes:r,duration:200})})()};if(S)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tE.$,{size:"xl"})});let es=()=>{G(!1),en({x:0,y:0})};return z?(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsxs)(no.g,{children:[(0,i.jsx)(r.xu,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(r.xu,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):"changed_models"!==H||(null==C?void 0:null===(n=C.modifiedSet)||void 0===n?void 0:n.length)?(0,i.jsxs)(ts,{sizes:B?[70,30]:[100,0],minSize:B?400:0,gutterSize:B?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(no.g,{ref:a,divider:(0,i.jsx)(tO.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},children:[t.interactive&&(0,i.jsx)(it,{isDisabled:"normal"!==K,viewOptions:k,onViewOptionsChanged:el,onSelectNodesClicked:()=>{let e="detail"===V?"action":"detail";Q(void 0),Y(!1),f(q(p,"action"===e)),J(e),U("selector")}}),(0,i.jsxs)(R.x$,{nodeTypes:il,edgeTypes:is,nodes:p,edges:j,onNodesChange:g,onEdgesChange:b,onNodeClick:(e,n)=>{if(!1!==t.interactive){var i,r,l,s,o;(es(),"detail"===V)?(Q(n.data),Z||Y(!0),ei(n),f(F(n.id,p))):"action_result"===V?((null===(r=n.data.action)||void 0===r?void 0:null===(i=r.run)||void 0===i?void 0:i.run_id)&&O(null===(s=n.data.action)||void 0===s?void 0:null===(l=s.run)||void 0===l?void 0:l.run_id),ei(n),f(F(n.id,p))):f((o=n.id,p.map(e=>{let n=e.id===o;return{...e,data:{...e.data,isSelected:e.data.isSelected!==n}}})))}},onNodeMouseEnter:(e,n)=>{if(!C)return;let[t,i]=L(Array.from(E(A(C,[n.id]),N(C,[n.id]))),p,j);f(t),y(i)},onNodeMouseLeave:(e,n)=>{if(!C)return;let[t,i]=L(Array.from(N(C,C.modifiedSet)),p,j);f(t),y(i)},onNodeContextMenu:(e,n)=>{"action"===V&&(e.preventDefault(),en({x:e.clientX,y:e.clientY,selectedNode:n}),G(!0))},onClick:es,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:t.interactive,ref:m,children:[(0,i.jsx)(tA.A,{color:"#ccc"}),(0,i.jsx)(tN.Z,{showInteractive:!1,position:"top-right",className:eY,children:(0,i.jsx)(tN.B,{title:"copy image",onClick:async()=>{u()},children:(0,i.jsx)(s.J,{as:tL.C3L})})}),(0,i.jsx)(x,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(eT.U,{children:(0,i.jsx)(ii,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(h.x,{fontSize:"xl",color:"grey",opacity:.5,children:p.length>0?"":"No nodes"})}),(0,i.jsx)(tM.a,{nodeColor:io,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),(0,i.jsx)(R.s_,{position:"bottom-center",className:eY,children:(0,i.jsx)(tI.R,{in:"selector"===K,unmountOnExit:!0,style:{zIndex:10},children:(0,i.jsx)(t5,{viewMode:H,nodes:p.map(e=>e.data).filter(e=>e.isSelected),onClose:()=>{J("detail"),U("normal");let e=q(p);Q(void 0),Y(!1),f(e),I(),null==T||T()},onActionStarted:()=>{J("action_result")},onActionNodeUpdated:er,onActionCompleted:()=>{}})})})]})]}),"detail"===V&&B?(0,i.jsx)(r.xu,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(tX,{node:B,onCloseNode:()=>{Q(void 0),Y(!1),f(q(p))}})}):(0,i.jsx)(r.xu,{}),$&&(0,i.jsx)(nz.v,{isOpen:!0,onClose:es,children:(0,i.jsxs)(nE.q,{style:{position:"absolute",left:"".concat(ee.x,"px"),top:"".concat(ee.y,"px")},children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(tJ.Cv2,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(P([...A(C,[e.id])],p))},children:"Select parent nodes"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(tJ.IMj,{}),onClick:()=>{let e=ee.selectedNode;"action"===V&&void 0!==e&&void 0!==C&&f(P([...N(C,[e.id])],p))},children:"Select child nodes"})]})})]}):(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsxs)(no.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>{U("normal"),el({...k,view_mode:"all"})},children:"Show all nodes"})]})})}function id(e){let{check:n}=e,t={...n.params,...n.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(ic,{viewOptions:t,interactive:!1})})})}var iu=t(19339);function ih(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=iu.ZP.stringify({checks:[o]});return(0,i.jsx)(t_.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}})}function ix(){let e=(0,nV._)(["\n
","\n\n ","\n\n
"]);return ix=function(){return e},e}let im=e=>{let{runId:n,isPending:t,setAborting:i}=e;(0,v.useEffect)(()=>()=>{i(!1),n&&t&&en(n)},[t,n,i])},ip=e=>{var n;let{checkId:t}=e,l=(0,b.NL)(),[,a]=(0,ey.TH)(),{successToast:d,failToast:h}=eB(),[f,g]=(0,v.useState)(),[j,k]=(0,v.useState)(),[w,C]=(0,v.useState)(!1),{isOpen:_,onOpen:S,onClose:z}=(0,ej.q)(),R=()=>(0,i.jsx)(eu.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[T,E]=(0,v.useState)((0,i.jsx)(R,{})),{isLoading:O,error:I,refetch:A,data:N}=(0,y.a)({queryKey:W.check(t),queryFn:async()=>nB(t),refetchOnMount:!1,staleTime:3e5}),M=(null==N?void 0:N.type)?nL(null==N?void 0:N.type):void 0,D=(null==N?void 0:N.is_preset)||!1,{mutate:L}=(0,te.D)({mutationFn:e=>nQ(t,e),onSuccess:()=>{l.invalidateQueries({queryKey:W.check(t)}),l.invalidateQueries({queryKey:W.checks()})}}),{mutate:F}=(0,te.D)({mutationFn:()=>nZ(t),onSuccess:()=>{l.invalidateQueries({queryKey:W.checks()}),a("/checks")}}),P=async()=>{if(!(null==N?void 0:N.type))return;let{run_id:e}=await et(t,{nowait:!0});for(g(e);;){let n=await ee(e,2);if(k(n.progress),n.result||n.error)return C(!1),k(void 0),n}},{data:q,mutate:H,error:V,isIdle:J,isPending:K}=(0,te.D)({mutationFn:P,onSuccess:e=>{A()}}),U=async()=>{H()},B=(0,v.useCallback)(async()=>{if(C(!0),f)return await en(f)},[f]);im({runId:f,isPending:K,setAborting:C});let Q=async()=>{if(!N)return;let e=(0,tb.RI)(ix(),tw(N),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tC(e),"\n\n").concat((0,tb.Pn)(tk(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tC(e)}(N));if(!navigator.clipboard){h("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),d("Copied the check to the clipboard")}catch(e){h("Failed to copy the check to clipboard",e)}},Z=(0,v.useCallback)(()=>{L({is_checked:!(null==N?void 0:N.is_checked)})},[null==N?void 0:N.is_checked,L]);if(O)return(0,i.jsx)(e1.M,{h:"100%",children:"Loading"});if(I)return(0,i.jsxs)(e1.M,{h:"100%",children:["Error: ",I.message]});let X=J?null==N?void 0:N.last_run:q,Y=(null==X?void 0:X.run_at)?(0,tT.Q)(new Date(X.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(to,{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)(n7,{name:(null==N?void 0:N.name)||"",setName:e=>{L({name:e})}}),(0,i.jsx)(u.L,{}),D&&(0,i.jsx)(nc.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(nY.Vp,{size:"sm",children:[(0,i.jsx)(nY.AD,{boxSize:"14px",as:n4.bX4}),"Preset"]})}),(0,i.jsxs)(nz.v,{children:[(0,i.jsx)(nR.j,{isRound:!0,as:nd.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"ghost"}),(0,i.jsxs)(nE.q,{children:[(0,i.jsx)(nI.s,{icon:(0,i.jsx)(n9.ovA,{}),onClick:()=>{E((0,i.jsx)(R,{})),S()},children:"Get Preset Check Template"}),(0,i.jsx)(nI.s,{icon:(0,i.jsx)(n1.p,{}),onClick:()=>F(),children:"Delete"})]})]}),Y&&(0,i.jsx)(r.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:Y}),(null==M?void 0:M.RunResultView)&&(0,i.jsx)(nc.u,{label:"Rerun",children:(0,i.jsx)(nd.h,{isRound:!0,isLoading:K,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(n2.n,{}),onClick:()=>U()})}),(0,i.jsx)(nc.u,{label:"Copy markdown",children:(0,i.jsx)(nd.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,i.jsx)(eH.T,{}),onClick:()=>Q()})}),(0,i.jsx)(nc.u,{label:(null==N?void 0:N.is_checked)?"Mark as pending":"Mark as approved",placement:"bottom-end",children:(0,i.jsx)(eg.z,{size:"sm",colorScheme:(null==N?void 0:N.is_checked)?"green":"gray",leftIcon:(0,i.jsx)(n5.r,{}),onClick:()=>Z(),children:(null==N?void 0:N.is_checked)?"Approved":"Pending"})})]}),(0,i.jsx)(r.xu,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(ty,{value:null==N?void 0:N.description,onChange:e=>{L({description:e})}},null==N?void 0:N.check_id)})]}),(0,i.jsx)(r.xu,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",children:[(0,i.jsxs)(m.t,{children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==N?void 0:N.type)==="query"||(null==N?void 0:N.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"})]}),(0,i.jsxs)(n$.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(nG.x,{p:0,width:"100%",height:"100%",children:[(null==M?void 0:M.RunResultView)&&(0,i.jsx)(tR,{isPending:K,isAborting:w,isCheckDetail:!0,run:X,error:V,progress:j,RunResultView:M.RunResultView,viewOptions:null==N?void 0:N.view_options,onViewOptionsChanged:e=>{L({view_options:e})},onCancel:B,onExecuteRun:U}),N&&"schema_diff"===N.type&&(0,i.jsx)(tv,{check:N}),N&&"lineage_diff"===N.type&&(0,i.jsx)(id,{check:N})]}),((null==N?void 0:N.type)==="query"||(null==N?void 0:N.type)==="query_diff")&&(0,i.jsx)(nG.x,{p:0,height:"100%",width:"100%",children:(0,i.jsx)(tS,{value:(null==N?void 0:null===(n=N.params)||void 0===n?void 0:n.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(ed.u_,{isOpen:_,onClose:z,isCentered:!0,size:"6xl",children:[T,(0,i.jsxs)(eh.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ex.x,{children:"Preset Check Template"}),(0,i.jsx)(em.o,{}),(0,i.jsxs)(ep.f,{children:[(0,i.jsx)(c.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(n0.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)(ih,{name:(null==N?void 0:N.name)||"",description:(null==N?void 0:N.description)||"",type:(null==N?void 0:N.type)||"",params:null==N?void 0:N.params,viewOptions:null==N?void 0:N.view_options})]})]})]})]})};var ig=t(53924);let iv=e=>{var n;let{check:t,selected:l,onSelect:a}=e,c=(0,b.NL)(),d=t.check_id,{mutate:u}=(0,te.D)({mutationFn:e=>nQ(d,e),onSuccess:()=>{c.invalidateQueries({queryKey:W.check(d)}),c.invalidateQueries({queryKey:W.checks()})}}),h=(null===(n=nL(t.type))||void 0===n?void 0:n.icon)||eb.WzH;return(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:l?"gray.100":"inherit",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),t.is_checked&&(0,i.jsx)(s.J,{color:"green",as:tc.FJM})]})},ij=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:l}=e;return(0,i.jsx)(ig.Z5,{onDragEnd:e=>{e.destination&&l(e.source.index,e.destination.index)},children:(0,i.jsx)(ig.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(no.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(ig._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,r=e.style.top-t.y;e.style.left=i,e.style.top=r}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(iv,{check:e,selected:e.check_id===t,onSelect:r},e.check_id)})}},e.check_id)),e.placeholder]})})})};function iy(){let e=(0,nV._)(["\n
","\n\n ","\n\n
"]);return iy=function(){return e},e}let ib=()=>{let[,e]=(0,ey.TH)(),[,n]=(0,ey.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:l,failToast:s}=eB(),o=null==n?void 0:n.checkId,{isLoading:a,error:c,data:d,status:u}=(0,y.a)({queryKey:W.checks(),queryFn:nU,refetchOnMount:!0}),h=(0,v.useCallback)(n=>{e("/checks/".concat(n))},[e]),[x,m]=(0,v.useState)(d||[]),{mutate:p}=(0,te.D)({mutationFn:e=>nX(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.checks()})}}),f=(0,v.useCallback)((e,n)=>{let t=[...x],[i]=t.splice(e,1);t.splice(n,0,i),p({source:e,destination:n}),m(t)},[x,m,p]);return((0,v.useCallback)(async()=>{let e=await nJ();t.invalidateQueries({queryKey:W.checks()}),h(e.check_id)},[t,h]),(0,v.useEffect)(()=>{"success"===u&&(!o&&d.length>0&&e("/checks/".concat(d[0].check_id)),m(d))},[u,o,d,m,e]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==d?void 0:d.length)?(0,i.jsxs)(ts,{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)(no.g,{spacing:0,align:"flex-end",h:"100%",style:{contain:"strict"},children:[(0,i.jsx)(nc.u,{label:"Copy checklist to the clipboard",children:(0,i.jsx)(nd.h,{mr:"10px",variant:"unstyled","aria-label":"Copy checklist to the clipboard",onClick:async()=>{let e=d.map(e=>(0,tb.RI)(iy(),tw(e),tC(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)(eH.T,{})})}),(0,i.jsx)(nv.i,{mb:"8px"}),(0,i.jsx)(ij,{checks:x,selectedItem:o,onCheckSelected:h,onChecksReordered:f})]})}),(0,i.jsx)(r.xu,{height:"100%",children:(0,i.jsx)(ey.rs,{children:(0,i.jsx)(ey.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(ip,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e1.M,{h:"100%",children:(0,i.jsx)(r.xu,{children:"No checks"})})};async function ik(e,n){return await G("query",e,n)}async function iw(e,n){return await G("query_diff",e,n)}var iC=t(66070);let i_=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l}=ea(),s=(0,v.useMemo)(()=>{if(!l)return[];let e=new Set;for(let i in l.nodes){var n,t;let r=l.nodes[i],s=null===(n=r.data.base)||void 0===n?void 0:n.columns,o=null===(t=r.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[l]);return(0,i.jsx)(o.k,{...r,children:(0,i.jsxs)(ek.NI,{m:"4px 8px",children:[(0,i.jsxs)(ew.l,{children:["Primary key"," ",(0,i.jsx)(nc.u,{label:"When a primary key is present, the query difference is computed in the warehouse. Otherwise, it's computed on the client side.",children:(0,i.jsx)(eV.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsxs)(iC.Qc,{restoreOnBlurIfEmpty:!1,multiple:!0,creatable:!0,filter:(e,n)=>n.startsWith(e),onChange:e=>t(e),defaultValues:void 0!==n&&0!==n.length?n:void 0,children:[(0,i.jsx)(iC.Vp,{placeholder:"Select primary key...",variant:"outline",children:e=>{let{tags:n}=e;return n.map((e,n)=>(0,i.jsx)(iC.Y4,{label:e.label,onRemove:e.onRemove},n))}}),(0,i.jsxs)(iC.Jm,{children:[s.map((e,n)=>(0,i.jsx)(iC.Gb,{value:e,children:e},"option-".concat(n))),(0,i.jsx)(iC.JU,{children:e=>{let{value:n}=e;return(0,i.jsxs)(o.k,{children:["Add '",n,"' to List"]})}})]})]})]})})},iS=()=>{let{sqlQuery:e,setSqlQuery:n,primaryKeys:t,setPrimaryKeys:l}=_(),{envInfo:s}=ea(),a=e;(null==s?void 0:s.adapterType)==="sqlmesh"&&e===k&&(a="select * from db.mymodel");let[c,d]=(0,v.useState)(),[u,h]=(0,v.useState)(),[x,m]=(0,v.useState)({}),p=(0,b.NL)(),[,f]=(0,ey.TH)(),g=async e=>{d(e);let{run_id:n}="query"===e?await ik({sql_template:a},{nowait:!0}):await iw({sql_template:a,primary_keys:t},{nowait:!0});return h(n),await ee(n)},{data:j,mutate:y,error:w,isPending:C}=(0,te.D)({mutationFn:g,onSuccess:e=>{m({})}}),S=(0,v.useCallback)(async()=>{if(u)return await en(u)},[u]),z=(0,v.useCallback)(async e=>{if(!(null==e?void 0:e.run_id))return;let n=await nK(e.run_id,x);p.invalidateQueries({queryKey:W.checks()}),f("/checks/".concat(n.check_id))},[f,x,p]);return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",padding:"5px",gap:"5px",children:[(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>y("query_diff"),isDisabled:C,size:"sm",children:"Run Diff"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>y("query"),isDisabled:C,size:"sm",children:"Run"})]}),(0,i.jsxs)(to,{sizes:[40,60],minSize:100,style:{height:"100%",borderTop:"1px solid #CBD5E0"},children:[(0,i.jsxs)(ts,{sizes:[90,10],minSize:300,children:[(0,i.jsx)(r.xu,{width:"70%",border:"1px solid #CBD5E0",children:(0,i.jsx)(tS,{value:a,onChange:n,onRun:()=>y("query"),onRunDiff:()=>y("query_diff")})}),(0,i.jsx)(i_,{p:"5px",border:"1px",borderColor:"gray.300",defaultPrimaryKeys:t,onPrimaryKeysChange:l})]}),(0,i.jsx)(o.k,{flex:"1",direction:"column",children:"query"===c?(0,i.jsx)(tR,{run:j,error:w,isPending:C,onCancel:S,children:e=>(0,i.jsx)(nf,{...e,onAddToChecklist:z})},u):(0,i.jsx)(tR,{isPending:C,run:j,error:w,viewOptions:x,onViewOptionsChanged:m,onCancel:S,children:e=>(0,i.jsx)(nm,{...e,onAddToChecklist:z})},u)})]})]})};var iz=t(30148);let iR=e=>(0,iz.c4)("#!"+e),iT=()=>[(0,iz.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),iR];var iE=t(24681),iO=t(62843);let iI=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ee(t)}),o=(null==s?void 0:s.type)?null===(n=nL(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tR,{isPending:r,error:l,run:s,RunResultView:o})};var iA=t(20085);let iN=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e1.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)(eg.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},iM=e=>{let{children:n}=e;return(0,i.jsx)(iA.SV,{fallback:iN,children:n})};async function iD(){return(await U.post("/api/export")).data}async function iL(e){let n=new FormData;return n.append("file",e),(await U.post("/api/import",n)).data}async function iF(){return 208===(await U.get("/api/sync")).status}async function iP(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,ir.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}var iq=t(16021);function iW(){let e=(0,X.p)(),n=async()=>{try{let e=await iD(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,eQ.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");eX()(t,r)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nc.u,{label:"Export",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:iq.tRY,boxSize:"1.2em"})})})}var iH=t(65475);function iV(){let e=(0,X.p)(),n=(0,b.NL)(),t=(0,v.useRef)(null),r=(0,v.useRef)(null),[l,a]=(0,v.useState)(null),{isOpen:c,onOpen:d,onClose:u}=(0,ej.q)(),[x,m]=(0,ey.TH)(),[,p]=ec(),f=(0,v.useCallback)(async()=>{if(l){try{let{runs:t,checks:i}=await iL(l);p(),await n.invalidateQueries({queryKey:W.checks()}),x.includes("/checks")&&m("/checks"),e({description:"".concat(t," runs and ").concat(i," checks imported successfully"),status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(n){console.error("Import failed",n),e({title:"Import failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}u()}},[n,l,e,u,x,m,p]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Import",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{t.current&&t.current.click()},icon:(0,i.jsx)(s.J,{as:iq.wQf,boxSize:"1.2em"})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:t,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(a(e.target.files[0]),d())}}),(0,i.jsx)(iH.a,{isOpen:c,leastDestructiveRef:r,onClose:u,size:"xl",children:(0,i.jsx)(eu.Z,{children:(0,i.jsxs)(iH._,{children:[(0,i.jsx)(ex.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ep.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)(eV.s,{color:"red.600"}),(0,i.jsx)(h.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(h.x,{children:["The current runs and checks will be"," ",(0,i.jsx)(h.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{ref:r,onClick:u,children:"Cancel"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:f,ml:"5px",children:"Import"})]})]})})})]})}t(97770);var iJ=t(93126),iK=t(1026),iU=t(13154),iB=t(99434),iQ=t(20143),iZ=t(89830),iX=t(13276),iY=t(31610);function i$(e){let n=(0,iY.D)(e);return(0,eQ.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function iG(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)(ta.HC,{ml:"10px",children:[n,": ",t]},n)})}function i0(){var e,n,t,r,a,d;let{envInfo:u,reviewMode:h,lineageGraph:x}=ea(),{isOpen:m,onOpen:p,onClose:f}=(0,ej.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)?i$(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?i$(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(d=e.data.current)||void 0===d?void 0:d.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Environment Info",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{as:n9.lS4,boxSize:"1.5em",color:"gray.500"})})}),(0,i.jsxs)(ed.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{children:"Environment Information"}),(0,i.jsx)(em.o,{}),(0,i.jsx)(ep.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)(ta.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(ta.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&iG(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)(ta.QI,{spacing:1,children:g&&iG(g)})]})}),(0,i.jsx)(nv.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)(iJ.x,{children:(0,i.jsxs)(iK.i,{variant:"simple",children:[(0,i.jsx)(iU.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Th,{}),(0,i.jsx)(iQ.Th,{children:"base"}),(0,i.jsx)(iQ.Th,{children:"current"})]})}),(0,i.jsxs)(iZ.p,{children:[(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"schema"}),(0,i.jsx)(iX.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(iX.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"version"}),(0,i.jsx)(iX.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(iX.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"timestamp"}),(0,i.jsx)(iX.Td,{children:k}),(0,i.jsx)(iX.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)(iJ.x,{children:(0,i.jsxs)(iK.i,{variant:"simple",children:[(0,i.jsx)(iU.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Th,{}),(0,i.jsx)(iQ.Th,{children:"base"}),(0,i.jsx)(iQ.Th,{children:"current"})]})}),(0,i.jsx)(iZ.p,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iX.Td,{children:"Environment"}),(0,i.jsx)(iX.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(iX.Td,{children:null==u?void 0:null===(r=u.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(ef.m,{children:(0,i.jsx)(eg.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}var i1=t(21166),i2=t(23256),i5=t(43399),i4=t(60057);function i9(){return(0,i.jsx)(nc.u,{label:"Syncing",children:(0,i.jsx)(eg.z,{pt:"6px",variant:"unstyled",boxSize:"1.2em",children:(0,i.jsx)(tE.$,{})})})}function i3(){let[e,n]=(0,v.useState)(!1),t=(0,b.NL)(),[l,o]=(0,ey.TH)(),{isOpen:a,onOpen:c,onClose:d}=(0,ej.q)(),[u,h]=(0,v.useState)(""),x=(0,X.p)(),m=(0,v.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await iP(e)).status){c(),n(!1);return}for(;await iF();)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()}),/^\/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)(i9,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.u,{label:"Sync with Cloud",children:(0,i.jsx)(nd.h,{pt:"6px",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:iq.jq8,boxSize:"1.2em"})})}),(0,i.jsxs)(ed.u_,{isOpen:a,onClose:d,children:[(0,i.jsx)(eu.Z,{}),(0,i.jsxs)(eh.h,{children:[(0,i.jsx)(ex.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ep.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)(i1.E,{onChange:h,value:u,children:(0,i.jsxs)(i2.K,{direction:"column",children:[(0,i.jsxs)(i5.Y,{value:"merge",children:["Merge",(0,i.jsx)(nc.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(i5.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nc.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(i5.Y,{value:"revert",children:["Revert",(0,i.jsx)(nc.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i4.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(ef.m,{children:[(0,i.jsx)(eg.z,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(eg.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let i6=e=>{var n;let[t,i]=(0,v.useState)(!1),[r,l]=(0,v.useState)(!1),[,s]=ec(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ee(e||"",2),enabled:!!e,refetchInterval:!!t&&50});(0,v.useEffect)(()=>{o||(null==a?void 0:a.result)||(null==a?void 0:a.error)?t&&(i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()):i(!0)},[a,o,t,s]);let c=(0,v.useCallback)(async()=>{if(l(!0),e)return await en(e)},[e,l]),d=(null==a?void 0:a.type)?null===(n=nL(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isPending:t,aborting:r,error:o,onCancel:c,RunResultView:d}},i8=e=>{let n=iu.ZP.stringify(e,null,2);return(0,i.jsx)(t_.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}})},i7=e=>{var n;let{runId:t,onClose:r}=e,{runAction:l}=nW(),{isPending:s,error:a,run:c,onCancel:d}=i6(t),h=(0,v.useRef)(!1);h.current=s,(0,v.useEffect)(()=>()=>{h.current&&d()},[h]);let[f,g]=(0,v.useState)(),j=(0,b.NL)(),[,y]=(0,ey.TH)(),[k,w]=(0,v.useState)(0),C=(null==c?void 0:c.type)?null===(n=nL(c.type))||void 0===n?void 0:n.RunResultView:void 0,_=(0,v.useCallback)(()=>{l((null==c?void 0:c.type)||"",null==c?void 0:c.params)},[c,l]),S=(0,v.useCallback)(async()=>{if(!t)return;let e=await nK(t,f);j.invalidateQueries({queryKey:W.checks()}),y("/checks/".concat(e.check_id))},[t,y,j,f]);return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:k,onChange:w,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"}),(0,i.jsx)(u.L,{}),(0,i.jsxs)(eT.U,{children:[(0,i.jsx)(eg.z,{isDisabled:!t||s,size:"sm",colorScheme:"blue",onClick:_,children:"Rerun"}),(0,i.jsx)(eg.z,{isDisabled:!t||!(null==c?void 0:c.result),size:"sm",colorScheme:"blue",onClick:S,children:"Add to Checklist"}),(0,i.jsx)(tB.P,{onClick:()=>{r&&r()}})]})]})}),0===k&&(0,i.jsx)(tR,{isPending:s,error:a,run:c,onCancel:d,viewOptions:f,onViewOptionsChanged:g,RunResultView:C}),1===k&&c&&(0,i.jsx)(i8,{type:c.type,params:c.params})]})},re=e=>{let{onClose:n}=e,{runId:t}=nW();return(0,i.jsx)(i7,{runId:t,onClose:n})};function rn(){let{isOpen:e,close:n}=nW();return(0,i.jsx)(R.tV,{children:(0,i.jsxs)(to,{sizes:e?[50,50]:[100,0],minSize:e?100:0,style:{height:"100%",borderTop:"1px solid #CBD5E0"},children:[(0,i.jsx)(r.xu,{children:(0,i.jsx)(ic,{viewMode:"changed_models",interactive:!0})}),e?(0,i.jsx)(re,{onClose:n}):(0,i.jsx)(r.xu,{})]})})}var rt=t(39588);let ri=e=>{let{children:n,path:t}=e,[l]=(0,ey.yj)(t);return(0,i.jsx)(r.xu,{display:l?"block":"none",height:"100%",children:n})};function rr(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 rl(){var e;let{reviewMode:n,isDemoSite:t,envInfo:r,cloudMode:s,isLoading:x}=ea(),m=function(){let[e,n]=(0,v.useState)("");return(0,v.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),p=null==r?void 0:null===(e=r.pullRequest)||void 0===e?void 0:e.url;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:m}),n&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),s&&(0,i.jsx)(d.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"cloud mode"}),(0,i.jsx)(u.L,{}),t&&p&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eV.s,{}),(0,i.jsxs)(h.x,{children:["Please check"," ",(0,i.jsx)(l.r,{textDecoration:"underline",fontWeight:"600",href:p,isExternal:!0,children:"this Pull Request"})," ","comment for context about this Recce instance"]})]}),(0,i.jsx)(u.L,{}),(0,i.jsx)(rr,{icon:tc.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rr,{icon:tc.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rr,{mr:"18px",icon:tc.MXt,href:"https://datarecce.io/docs"})]})}function rs(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 ro(){let{isDemoSite:e,cloudMode:n,isLoading:t}=ea(),[r,l]=(0,ey.TH)(),s=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checks",href:"/checks"}],o=e=>e.filter(e=>!e.is_checked).length,a=eS().findIndex(s,e=>{let{href:n}=e;return r.startsWith(n)});return(0,i.jsx)(x.m,{index:a,children:(0,i.jsxs)(m.t,{children:[s.map(e=>{let{name:n,href:t}=e;return(0,i.jsxs)(p.O,{onClick:()=>{l(t)},children:[n,"Checks"===n&&(0,i.jsx)(rs,{queryKey:W.checks(),fetchCallback:nU,selectCallback:o})]},n)}),(0,i.jsx)(u.L,{}),!t&&(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(i3,{}),!e&&!n&&(0,i.jsx)(iV,{}),(0,i.jsx)(iW,{})]}),(0,i.jsx)(i0,{})]})})}function ra(){(0,v.useLayoutEffect)(()=>{var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"";if(n&&rt.env.AMPLITUDE_API_KEY)try{j.S1(rt.env.AMPLITUDE_API_KEY,n,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,iE.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(iO.Z,{theme:e,children:(0,i.jsx)(f.x,{children:(0,i.jsx)(b.aH,{client:B,children:(0,i.jsx)(ey.F0,{hook:iT,children:(0,i.jsx)(nH,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",children:[(0,i.jsx)(rl,{}),(0,i.jsx)(ro,{}),(0,i.jsx)(iM,{children:(0,i.jsxs)(r.xu,{p:0,overflow:"auto",flex:"1",style:{contain:"size"},children:[(0,i.jsx)(ri,{path:"/lineage",children:(0,i.jsx)(rn,{})}),(0,i.jsxs)(ey.rs,{children:[(0,i.jsx)(ey.AW,{path:"/query",children:(0,i.jsx)(iS,{})}),(0,i.jsx)(ey.AW,{path:"/checks/:slug*",children:(0,i.jsx)(ib,{})}),(0,i.jsx)(ey.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(iI,{runId:n})}}),(0,i.jsx)(ey.AW,{path:"/ssr",children:(0,i.jsx)(g.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(ey.AW,{children:(0,i.jsx)(ey.l_,{to:"/lineage"})})]})]})})]})})})})})})}},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,378,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 4abddbab..b66a4d11 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 57e06ec5..1fdecc8c 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,7 +1,7 @@ 2:I[60814,[],""] -3:I[53819,["634","static/chunks/7c9ab469-d59c34a146c2259a.js","145","static/chunks/fb2d5402-b112ee94f359fd91.js","170","static/chunks/526a6206-32f749a24b66f800.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-8331ae1631cd15d6.js","710","static/chunks/2d02f0f7-61a3e84400641ea7.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","378","static/chunks/378-208cddece3e4d704.js","931","static/chunks/app/page-a45ba089836f5014.js"],""] +3:I[53819,["634","static/chunks/7c9ab469-d59c34a146c2259a.js","145","static/chunks/fb2d5402-b112ee94f359fd91.js","170","static/chunks/526a6206-32f749a24b66f800.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-8331ae1631cd15d6.js","710","static/chunks/2d02f0f7-61a3e84400641ea7.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","378","static/chunks/378-208cddece3e4d704.js","931","static/chunks/app/page-e01eee4993747e94.js"],""] 4:I[4737,[],""] 5:I[25587,[],""] -0:["FVKFEVpAaj9eCK1kKWvsK",[[["",{"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/8336a103f0ad961c.css","precedence":"next","crossOrigin":""}]]}]}]}],null]],[null,"$L6"]]]] +0:["XWZYyxLIzM2aLMynOggAS",[[["",{"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/8336a103f0ad961c.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