From c20174042e3ff6654f29062a6fde96bfa99e72ec Mon Sep 17 00:00:00 2001 From: popcornylu Date: Wed, 22 Jan 2025 08:04:21 +0000 Subject: [PATCH] AUTO-COMMIT - build js statics to recce data/ --- recce/data/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 recce/data/_next/static/chunks/app/page-2d7acb049c85a3ee.js | 1 + recce/data/_next/static/chunks/app/page-ce314ab95f8c9bf7.js | 1 - recce/data/index.html | 4 ++-- recce/data/index.txt | 4 ++-- 7 files changed, 6 insertions(+), 6 deletions(-) rename recce/data/_next/static/{ICnbYsopIqcOeo_6p-aHK => ET1s0HXNQYFRZkI_EwdVV}/_buildManifest.js (100%) rename recce/data/_next/static/{ICnbYsopIqcOeo_6p-aHK => ET1s0HXNQYFRZkI_EwdVV}/_ssgManifest.js (100%) create mode 100644 recce/data/_next/static/chunks/app/page-2d7acb049c85a3ee.js delete mode 100644 recce/data/_next/static/chunks/app/page-ce314ab95f8c9bf7.js diff --git a/recce/data/404.html b/recce/data/404.html index 0d757b52..9f9dc6b1 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/ICnbYsopIqcOeo_6p-aHK/_buildManifest.js b/recce/data/_next/static/ET1s0HXNQYFRZkI_EwdVV/_buildManifest.js similarity index 100% rename from recce/data/_next/static/ICnbYsopIqcOeo_6p-aHK/_buildManifest.js rename to recce/data/_next/static/ET1s0HXNQYFRZkI_EwdVV/_buildManifest.js diff --git a/recce/data/_next/static/ICnbYsopIqcOeo_6p-aHK/_ssgManifest.js b/recce/data/_next/static/ET1s0HXNQYFRZkI_EwdVV/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/ICnbYsopIqcOeo_6p-aHK/_ssgManifest.js rename to recce/data/_next/static/ET1s0HXNQYFRZkI_EwdVV/_ssgManifest.js diff --git a/recce/data/_next/static/chunks/app/page-2d7acb049c85a3ee.js b/recce/data/_next/static/chunks/app/page-2d7acb049c85a3ee.js new file mode 100644 index 00000000..6881c30e --- /dev/null +++ b/recce/data/_next/static/chunks/app/page-2d7acb049c85a3ee.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{53770:function(e,n,t){Promise.resolve().then(t.bind(t,17149))},17149:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rT}});var i=t(9651),l=t(25752),r=t(68345),s=t(10037),o=t(80474),a=t(29626),d=t(52764),c=t(29455),u=t(72875),h=t(90037),x=t(95644),m=t(80735),p=t(22183),f=t(95170),g=t(33899),v=t(31794),j=t(56233),y=t(58714),b=t(38756);let k='select * from {{ ref("mymodel") }}',w=(0,j.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=j.useState(k),[r,s]=j.useState(k),[o,a]=j.useState(!1),[d,c]=j.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:l,sqlQuery:t,setPrimaryKeys:c,primaryKeys:d,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:r,setBaseSqlQuery:s},children:n})}let _=()=>(0,j.useContext)(w),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=j.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:l},children:n})}var R=t(70867);function E(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,l={},r=(e,t)=>{if(!(t<0)&&(void 0===l[e]||!(l[e]>=t))){for(let i of(l[e]=t,n(e)))r(i,t-1);i.add(e)}};for(let n of e)r(n,t);return i}function T(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var I=t(85688),D=t.n(I);function L(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function O(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function M(e,n){return n?e.impactedSet:O(e,e.modifiedSet)}function A(e,n){let t=[],i=[];function l(e){return"base"===e?0:"current"===e?2:1}function r(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(r))(!s||s.has(n.id))&&t.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(r))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return F(t,i),[t,i]}let F=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(D()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),D().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function q(e,n,t){let i=new Set(e),l=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}))]}function N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function V(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function H(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let W={lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"],flag:()=>["flag"]};var K=t(26363),B=t(94916);let J=B.env.NEXT_PUBLIC_API_URL?B.env.NEXT_PUBLIC_API_URL:window.location.origin;var U=t(93192);let Q=K.default.create({baseURL:J}),Z=new U.S;async function X(){return(await Q.get("/api/info")).data}async function G(e){return(await Q.get("/api/model/".concat(e))).data}var Y=t(81614),$=t(73263),ee=t(76931),en=t(52344),et=t(71106),ei=t(82043),el=t(29978),er=t(19563),es=t(65185),eo=t(89243),ea=t(6393),ed=t.n(ea),ec=t(91501),eu=t(94916);function eh(e){ec.j("[Web] multi_nodes_action",e)}function ex(e){ec.j("[Web] history_action",e)}function em(e){ec.j("[Experiment] preview_change",e)}function ep(e){ec.j("[Experiment] preview_change",e)}function ef(e){ec.j("[Experiment] single_environment",e)}function eg(e){ec.j("[Experiment] recommend_preset_check",e)}let ev=!1;async function ej(e,n,t){let i=ev?{breaking_change_analysis:!0}:{};return(await Q.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait,track_props:i})).data}async function ey(e,n){return(await Q.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function eb(e){return await Q.post("/api/runs/".concat(e,"/cancel"))}async function ek(e,n){return(await Q.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ew(e,n,t){return(await Q.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function eC(){return(await Q.get("/api/runs")).data}async function e_(){return(await Q.post("/api/runs/aggregate",{})).data}async function eS(){return(await Q.get("/api/flag")).data}async function ez(){try{await Q.post("/api/onboarding/completed")}catch(e){}}async function eR(){try{await Q.post("/api/relaunch-hint/completed")}catch(e){}}let eE=()=>(0,y.a)({queryKey:W.flag(),queryFn:eS}),eT=(0,j.createContext)({isActionAvailable:()=>!0});function eI(e){var n,t,l;let{children:r}=e,s=(0,y.a)({queryKey:W.lineage(),queryFn:X}),o=(0,y.a)({queryKey:W.runsAggregated(),queryFn:e_}),a=(0,j.useMemo)(()=>{var e;let n=null===(e=s.data)||void 0===e?void 0:e.lineage;if(n&&n.base&&n.current)return function(e,n,t){let i={},l={},r=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,t]of Object.entries(e.nodes))i[n]=r(n,"base"),t&&(i[n].data.base=t,i[n].name=null==t?void 0:t.name,i[n].resourceType=null==t?void 0:t.resource_type,i[n].packageName=null==t?void 0:t.package_name);for(let[e,t]of Object.entries(n.nodes))i[e]?i[e].from="both":i[e]=r(e,"current"),t&&(i[e].data.current=n.nodes&&n.nodes[e],i[e].name=null==t?void 0:t.name,i[e].resourceType=null==t?void 0:t.resource_type,i[e].packageName=null==t?void 0:t.package_name);for(let[n,t]of Object.entries(e.parent_map))for(let e of t){let t=i[n],r=i[e],s="".concat(e,"_").concat(n);if(!t||!r)continue;l[s]={id:s,from:"base",parent:r,child:t};let o=l[s];t.parents[e]=o,r.children[n]=o}for(let[e,t]of Object.entries(n.parent_map))for(let n of t){let t=i[e],r=i[n],s="".concat(n,"_").concat(e);if(!t||!r)continue;l[s]?l[s].from="both":l[s]={id:s,from:"current",parent:r,child:t};let o=l[s];t.parents[n]=o,r.children[e]=o}let s=[],o=[],a=[];for(let[e,n]of Object.entries(i))if(t){let i=t[e];i&&(n.changeStatus=i.change_status,s.push(e),"non-breaking"===i.change_category?o.push(e):a.push(e))}else if("base"===n.from)n.changeStatus="removed",s.push(n.id);else if("current"===n.from)n.changeStatus="added",s.push(n.id);else{var d,c,u,h,x,m;let t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(c=u.base)||void 0===c?void 0:null===(d=c.checksum)||void 0===d?void 0:d.checksum,i=null==n?void 0:null===(m=n.data)||void 0===m?void 0:null===(x=m.current)||void 0===x?void 0:null===(h=x.checksum)||void 0===h?void 0:h.checksum;t&&i&&t!==i&&(n.changeStatus="modified",s.push(n.id),a.push(e))}for(let[e,n]of Object.entries(l))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");let p=T(new Set(s),E(a,e=>void 0===i[e]?[]:Object.keys(i[e].children)));return{nodes:i,edges:l,modifiedSet:s,nonBreakingSet:new Set(o),impactedSet:p,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}}}(n.base,n.current,n.diff)},[s.data]),d=null===(n=s.error)||void 0===n?void 0:n.message,{lineage:c,sqlmesh:u,demo:h,review_mode:x,cloud_mode:m,file_mode:p,filename:f,adapter_type:g,git:v,pull_request:k,support_tasks:w}=s.data||{},C=null==c?void 0:null===(t=c.base)||void 0===t?void 0:t.manifest_metadata,_=null==c?void 0:null===(l=c.current)||void 0===l?void 0:l.manifest_metadata,{connectionStatus:S,connect:z,envStatus:R}=function(){let e=(0,Y.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending"),[l,r]=(0,j.useState)(void 0);n.current.status=t;let s=(0,b.NL)(),o=()=>{s.invalidateQueries({queryKey:W.lineage()}),s.invalidateQueries({queryKey:W.checks()}),s.invalidateQueries({queryKey:W.runs()})},a=()=>{let t=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&o(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[l,r]=i.split("/").slice(-2),s=ed().parse(r).name,a="".concat(l,"-").concat(s,"-").concat(t);e.isActive(a)||e({id:a,description:"Detected ".concat(l," ").concat(s," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),o()}else"relaunch"===n.command&&r("relaunch")}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return a(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:a,envStatus:l}}(),{data:I,isLoading:D}=eE(),{onClose:L}=(0,$.q)(),[O,M]=(0,j.useState)(!1),A=(0,b.NL)(),F=(0,j.useCallback)(e=>{if(w){var n;return null===(n=w[e])||void 0===n||n}return!0},[w]);return(0,j.useEffect)(()=>{D||("relaunch"===R&&(null==I?void 0:I.single_env_onboarding)&&(null==I?void 0:I.show_relaunch_hint)?(M(!0),ef({action:"target_base_added"})):M(!1))},[I,R,D]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eT.Provider,{value:{lineageGraph:a,retchLineageGraph:()=>{o.refetch()},envInfo:{adapterType:g,git:v,pullRequest:k,dbt:{base:C,current:_},sqlmesh:u},reviewMode:x,cloudMode:m,fileMode:p,fileName:f,isDemoSite:h,error:d,supportTasks:w,isActionAvailable:F,isLoading:s.isLoading,runsAggregated:o.data,refetchRunsAggregated:()=>{o.refetch()}},children:r}),(0,i.jsxs)(ee.u_,{isOpen:"disconnected"===S,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Server Disconnected"}),(0,i.jsx)(el.f,{children:(0,i.jsx)(er.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{z()},children:"Retry"})})]})]}),(null==I?void 0:I.single_env_onboarding)&&(0,i.jsxs)(ee.u_,{isOpen:O,onClose:()=>{L(),eR(),A.invalidateQueries({queryKey:W.flag()})},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Target-base Added"}),(0,i.jsx)(el.f,{children:(0,i.jsx)(er.x,{children:"Please restart the Recce server."})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{L(),eR(),A.invalidateQueries({queryKey:W.flag()})},children:"Got it!"})})]})]})]})}let eD=()=>(0,j.useContext)(eT),eL=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eD();return[e,n]};var eO=t(23164);let eM=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:d,RunForm:c}=e,[u,h]=(0,j.useState)(d),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ei.x,{children:a}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(l.x,{style:{contain:"layout"},children:c&&(0,i.jsx)(c,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(eo.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var eA=t(50393),eF=t(38257),eq=t(96084),eN=t(42274),eV=t(46075),eH=t(45837),eP=t.n(eH);function eW(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 eK=e=>{var n;let{lineageGraph:t}=eD(),[i,l]=(0,j.useState)([]),[r,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[d,c]=(0,j.useState)(null),u=eP().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eW(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await G(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){l([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);l(eW(n,t))}catch(e){c(e)}};h.length>0?(l(h),s(x)):(null==u?void 0:u.id)===void 0?l([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:r,isLoading:o,error:d}};function eB(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eJ(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eU=t(2992),eQ=t(45637),eZ=t(14715);function eX(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 eG(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,l=n>=1e9,r=n>=1e15;if(r||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:r?0:2}).format(e/1e12).replace("L","T");if(l||i||n>=1e3){let n={base:l?1e9:i?1e6:1e3,unit:l?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eY="#63B3ED",e$="#F6AD55",e0="".concat(eY,"A5"),e1="".concat(e$,"A5");function e5(e){let{color:n}=e;return(0,i.jsx)(l.x,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function e2(e){let{data:n,hideAxis:t=!1,animation:l=!1}=e;eQ.kL.register(eQ.ZL,eQ.RM,eQ.f$,eQ.uw,eQ.Dx,eQ.De,eQ.u);let r=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:i,datasets:l,type:r,samples:s=0,binEdges:o}=e,[a,d]=l,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{reverse:!0},title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=e6(o,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,l=0===n?d.counts:a.counts,r=eX(l[t]/s),o=l[t];return"".concat(i,": ").concat(o," (").concat(r,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:l,binEdges:r}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,d=Math.max(...a.counts,...o.counts),c=r.map((e,n)=>e6(r,n)).slice(0,-1);return{x:"datetime"===l?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>c[n]},stacked:!0},y:{display:!s,type:"linear",max:d,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eG(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:l}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[l,r]=n,s=e4(t,i,"Current",e0,r),o=e4(t,i,"Base",e1,l);return{labels:i.map((e,n)=>e6(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eZ.kL,{type:"bar",options:r,data:s,plugins:[]})}function e4(e,n,t,i,l){let{counts:r=[]}=l;return{label:t,data:"datetime"===e?r.map((e,t)=>({x:n[t],y:e})):r,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function e6(e,n){let t=e[n],i=e[n+1],l=eG(t),r=eG(i);return"".concat(l," - ").concat(r)}let e3=(0,eU.G)((e,n)=>{let{backgroundColor:t="white",blockSize:r,children:s,...o}=e;return(0,i.jsx)(l.x,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(l.x,{backgroundColor:t,height:"100%",blockSize:r,children:s})})}),e9=(0,eU.G)(function(e,n){var t,r,s,a,d,c;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(r=x.result)||void 0===r?void 0:r.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(d=x.result)||void 0===d?void 0:d.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(e3,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.x,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(e2,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(c=x.params)||void 0===c?void 0:c.column_type)||"",datasets:[p,f],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var e8=t(45697);t(94095);var e7=t(42922);let ne=(0,eU.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e7.ZP,{ref:n,...t})})});function nn(){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)(er.x,{fontWeight:"600",children:" No rows"})})}t(74229);var nt=t(95347);function ni(e,n){let t=function(e,n){let t=[...e],i=[...n],l=[];for(;t.length>0&&i.length>0;)if(l.includes(t[0]))t.shift();else if(l.includes(i[0]))i.shift();else if(t[0]===i[0])l.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{l.includes(e)||l.push(e)}),i.forEach(e=>{l.includes(e)||l.push(e)}),l}(e,n),i={};for(let l of t)e.includes(l)?n.includes(l)?i[l]=void 0:i[l]="removed":i[l]="added";let l={};e.forEach((e,n)=>{l[e]=n});let r=-1;for(let e of t){let n=l[e];void 0!==n&&(n>r?r=n:i[e]="reordered")}return i}function nl(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 nr(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}function ns(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&r&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?nt.ven:nt.MhP,onClick:h?()=>{let e=c.filter(e=>e!==n);r&&r(e)}:()=>{let e=[...c.filter(e=>"index"!==e),n];r&&r(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?nt.$kI:nt.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let no=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]},na=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(er.x,{style:{color:"gray"},children:"-"});let[l,r]=no(n[t.key]);return(0,i.jsx)(er.x,{style:{color:r?"gray":"inherit"},children:l})};function nd(e,n,t){let l=e||{columns:[],data:[]},r=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,d=[],c=function(e,n){let t={};return Object.entries(ni(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[l,r]=i;t[l]={status:r,baseColumnIndex:e.columns.findIndex(e=>e.name===l),currentColumnIndex:n.columns.findIndex(e=>e.name===l)}}),t}(l,r),u={},h={},x=!1,m=!1;if(0===s.length)l.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nl(l.columns,s);l.data.forEach((n,t)=>{let i=nr(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nl(r.columns,s),r.data.forEach((n,t)=>{let i=nr(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=ni(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(c))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eP().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eP().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(ns,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"}]}};return 0===s.length?d.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=c[e].status||"";d.push({key:"".concat(e),name:(0,i.jsx)(ns,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:na})}),o.forEach(e=>{let n=c[e].status||"";"index"===e||s.includes(e)||d.push(v(e,n))}),Object.entries(c).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||d.push(v(n,i))}),{columns:d,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let nc=(0,eU.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==d?void 0:d.name)||"column_name",u=(0,j.useMemo)(()=>nd(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}),[o,c,a,r,s]);return 0===u.columns.length?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function nu(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{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?nt.$kI:nt.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nh(e,n,t){let l=(null==t?void 0:t.pinnedColumns)||[],r=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},d={};if(0===n.length)throw Error("Primary keys are required");let c=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}(e.columns,c,n);n[u]&&(a[i]=n),n[h]&&(d[i]=n)});let x=ni(Object.keys(a),Object.keys(d)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,l]=t,r=a[i],s=d[i],c=JSON.parse(i);if(r&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["base__".concat(e.name)]=r[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["current__".concat(e.name)]=s[t])}),r){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(eP().isEqual(r[t.index],s[t.index])||(c.__status="modified",t.status="modified"));else c.__status="removed",m.removed++}else c.__status="added",m.added++;return"modified"===c.__status&&m.modified++,c});r&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eP().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(nu,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(nu,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:na})}),l.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||l.includes(t)||r&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nx=t(27904),nm=t(41152),np=t(65906);let nf=e=>{let{run:n,warnings:t,viewOptions:r,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nm.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.x,{children:[(0,i.jsx)(nx.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(np.X,{isChecked:null==r?void 0:r.changed_only,onChange:()=>{let e=!(null==r?void 0:r.changed_only);a&&a({...r,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(eo.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},ng=(e,n)=>{var t,l,r,s,a,d;let{run:c,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x,baseTitle:m,currentTitle:p}=e,f=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),g=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),v=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),y=(0,j.useMemo)(()=>{var e,n;return nd(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:g,primaryKeys:f,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:v,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})},baseTitle:m,currentTitle:p})},[c,h,g,f,v,x,m,p]),b=(0,j.useMemo)(()=>{let e=f.join(", ");return y.invalidPKeyBase&&y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):y.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[y.invalidPKeyBase,y.invalidPKeyCurrent,f]),k=(null===(l=c.result)||void 0===l?void 0:null===(t=l.current)||void 0===t?void 0:t.limit)||0,w=k>0&&((null==c?void 0:null===(s=c.result)||void 0===s?void 0:null===(r=s.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(d=c.result)||void 0===d?void 0:null===(a=d.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(k.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,C=[];return(b&&C.push(b),w&&C.push(w),0===y.columns.length)?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):g&&0===y.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:C}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:C}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:y.columns,rows:y.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nv=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:d,viewOptions:c,onViewOptionsChanged:u,baseTitle:h,currentTitle:x}=e,m=(0,j.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),p=(0,j.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),f=(0,j.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nh(null==a?void 0:a.result.diff,t,{changedOnly:m,pinnedColumns:p,onPinnedColumnsChange:e=>{u&&u({...c,pinned_columns:e})},baseTitle:h,currentTitle:x})},[a,c,m,p,u,h,x]),g=(null===(l=a.result)||void 0===l?void 0:null===(t=l.diff)||void 0===t?void 0:t.limit)||0,v=g>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(r=s.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(g.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,y=[];return(v&&y.push(v),0===f.columns.length)?(0,i.jsx)(e8.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)(nf,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:y}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:y}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:f.columns,rows:f.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nj=(0,eU.G)((e,n)=>{var t,l,r;let s,o;if((null===(t=e.run)||void 0===t?void 0:t.params)&&(null===(l=e.run)||void 0===l?void 0:l.params).current_model&&(s="Original",o="Editor"),(null===(r=e.run)||void 0===r?void 0:r.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eU.G)(nv);return(0,i.jsx)(t,{...e,ref:n,baseTitle:s,currentTitle:o})}{let t=(0,eU.G)(ng);return(0,i.jsx)(t,{...e,ref:n,baseTitle:s,currentTitle:o})}});function ny(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:r=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(l.x,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?nt.$kI:nt.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let nb=(0,eU.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,d=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),c=null==t?void 0:t.result,u=(0,j.useMemo)(()=>c?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(ny,{name:t,...n}),width:"auto",renderCell:na});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eP().findIndex(e.columns,e=>e.name===n);i<0||t.push(r(i,n))}),e.columns.forEach((e,n)=>{l.includes(e.name)||t.push(r(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(c,{pinnedColumns:d,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}):{rows:[],columns:[]},[c,d,r,s]);if(0===u.columns.length)return(0,i.jsx)(e8.M,{height:"100%",children:"No data"});let x=(null==c?void 0:c.limit)||0,m=x>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nx.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.x,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(eo.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function nk(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 nw=t(51818),nC=t.n(nw);let n_=(0,eU.G)(function(e,n){let{run:t}=e;function l(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nC()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nC()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="=";return null!==t&&null!==i?l=t!==i?nk(t,i):"=":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===s.length?(0,i.jsx)(e8.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)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:l},{key:"base",name:"Base Rows",cellClass:l},{key:"current",name:"Current Rows",cellClass:l},{key:"delta",name:"Delta",cellClass:l}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},className:"rdg-light",enableScreenshot:!0})})})});var nS=t(88692),nz=t(60287);let nR="#63B3ED";function nE(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),l=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([l]).map((n,t)=>{let r;let s=t===i.length,o=s?l:i[t],a=!1;return s?(r="(others)",a=!0):null==n?(r="(null)",a=!0):"string"==typeof n&&0===n.length?(r="(empty)",a=!0):r=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:r,count:o,displayCount:eG(o),displayRatio:eX(o/e.valids)||"N/A"}})}function nT(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nS.u,{label:(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(er.x,{children:[(0,i.jsx)(e5,{color:eY}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(er.x,{children:[(0,i.jsx)(e5,{color:e$}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function nI(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=nE(n.current,t),s=nE(n.base,t);return(0,i.jsxs)(l.x,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(er.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e5,{color:e$})," Base"]}),(0,i.jsxs)(er.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e5,{color:eY})," Current"]}),(0,i.jsx)(h.L,{})]}),r.map((e,t)=>{let l=s[t];return e.isLastItemOthers&&0===e.count&&0===l.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(j.Fragment,{children:[(0,i.jsx)(nT,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(er.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)(nD,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eY}),(0,i.jsx)(er.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(er.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nD,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:e$}),(0,i.jsx)(er.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(er.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(nz.i,{})]},t)})]})}function nD(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=nR}=e;eQ.kL.register(eQ.uw,eQ.ZL,eQ.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,l,{animation:r}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nR}=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)(eZ.$Q,{data:a,options:o,plugins:[]})}let nL=(0,eU.G)((e,n)=>{let{run:t}=e,[l,s]=(0,j.useState)(!0),a=t.result,c=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e3,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(d.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",c.model,".",c.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nI,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:l}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(r.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:l?"View More Items":"View Only Top-10"})})]})}),nO=(0,eU.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:d}=e,c=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nh(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:u,onPinnedColumnsChange:e=>{d&&d({...a,pinned_columns:e})}})},[r,a,c,u,d]),x=(null===(t=r.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==r?void 0:null===(l=r.result)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):c&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nM=t(51609),nA=t(56662);function nF(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,j.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,d=null==n?void 0:n.primary_key,{columns:c,primaryKey:u,isLoading:h,error:x}=eK(n.model);(0,j.useEffect)(()=>{!d&&u&&t({...n,primary_key:u})},[d,u,n,t]),(0,j.useEffect)(()=>{r(!!d&&!!a)},[d,a,r]);let m=c.map(e=>e.name),p=Array.isArray(d)?d:d?[d]:void 0;return h?(0,i.jsx)(l.x,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nm.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Model"}),(0,i.jsx)(nM.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Primary key"}),(0,i.jsx)(nA.Ph,{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)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Columns"}),(0,i.jsx)(np.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nA.Ph,{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 nq=t(43215),nN=t(55055),nV=t(60651),nH=t(38371),nP=t(62885),nW=t(88936),nK=t(11636);function nB(e){let{params:n,column:t}=e,{runAction:r}=n0(),a=(e,t)=>{r("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nH.h,{children:(0,i.jsx)(nP.q,{lineHeight:"20px",children:(0,i.jsxs)(nW.k,{title:"Action",as:l.x,fontSize:"8pt",children:[(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nK.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}let nJ=(0,eU.G)(function(e,n){let{run:t}=e,r=t.result,a=t.params,d=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e8.M,{height:"100%",children:c.includes(n[0])&&(0,i.jsx)(s.J,{as:nt.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nB,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:d},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,r=t[n.key];return(0,i.jsx)(l.x,{textAlign:"end",children:void 0!=r&&null!==r?"".concat((100*r).toFixed(2)," %"):"N/A"})},cellClass:d}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(l.x,{px:"16px",children:["Model: ",a.model,", ",r.summary.total," total (",r.summary.total-r.summary.added-r.summary.removed," ","common, ",r.summary.added," added, ",r.summary.removed," removed)"]}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nU=t(54517),nQ=t(27342);let nZ={lineage_diff:{title:"Lineage Diff",icon:eF.Ks7},schema_diff:{title:"Schema Diff",icon:nQ.C8A},query:{title:"Query",icon:eF.r2i,RunResultView:nb},query_base:{title:"Query Base",icon:eF.r2i,RunResultView:nb},query_diff:{title:"Query Diff",icon:eF.r2i,RunResultView:nj},row_count_diff:{title:"Row Count Diff",icon:nQ.QUK,RunResultView:n_},profile_diff:{title:"Profile Diff",icon:eF.KA6,RunResultView:nc},value_diff:{title:"Value Diff",icon:eF.pRi,RunResultView:nJ,RunForm:nF},value_diff_detail:{title:"Value Diff Detail",icon:eF.pRi,RunResultView:nO,RunForm:nF},top_k_diff:{title:"Top-K Diff",icon:nU.Pkc,RunResultView:nL,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eK(n.model),d=s.map(e=>e.name);return((0,j.useEffect)(()=>{r(!!n.column_name)},[n,r]),o)?(0,i.jsx)(l.x,{children:"Loading..."}):0===d.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eV.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:d.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:eF.dku,RunResultView:e9,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eK(n.model),d=s.filter(e=>!eB(e.type)&&!eJ(e.type));return o?(0,i.jsx)(l.x,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eV.P,{placeholder:0!==d.length?"Select column":"No numeric column is available",isDisabled:0===d.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let l=e.target.value;r(!!l);let s=(null===(i=d.find(e=>e.name===l))||void 0===i?void 0:i.type)||"";t({...n,column_name:l,column_type:s})},children:d.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}},sandbox:{title:"Sandbox",icon:eF.iQd}},nX=e=>nZ[e],nG=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{},clearRunResult:()=>{}}),nY=e=>{let[n]=(0,eA.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function n$(e){var n;let{children:t}=e,[l,r]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,$.q)(),{isOpen:d,onOpen:c,onClose:u}=(0,$.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,$.q)(),p=(0,Y.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eA.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),c(),!1!==n&&k.invalidateQueries({queryKey:W.runs()})},[g,c,k]),C=(0,j.useCallback)(()=>{g(void 0),u()},[u,g]),_=(0,j.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ew(e,n,1);1===t.length&&(i=t[0])}let s=nX(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:d,RunForm:c}=s;if(void 0===d)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==c&&(null==t?void 0:t.showForm))r({session:l,title:a,type:e,params:n,lastRun:i,options:t,RunForm:c}),o();else{let{run_id:t}=await ej(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:W.runs()}),v.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[r,o,w,p,v,y,k]);nY(a);let S=async(e,n)=>{try{a();let{run_id:t}=await ej(e,n,{nowait:!0});w(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nG.Provider,{value:{runAction:_,runId:f,showRunId:w,isRunResultOpen:d,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x,clearRunResult:C},children:[l&&(0,i.jsx)(eM,{isOpen:s,onClose:a,onExecute:S,title:l.title,type:l.type,params:l.params,initialRun:l.lastRun,RunForm:(null===(n=l.options)||void 0===n?void 0:n.showForm)&&l.RunForm?l.RunForm:void 0},l.session),t]})}let n0=()=>(0,j.useContext)(nG);function n1(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eI,{children:(0,i.jsx)(z,{children:(0,i.jsx)(n$,{children:n})})})})})}async function n5(){return(await Q.post("/api/checks",{type:"simple"})).data}async function n2(e,n){let t=ev?{breaking_change_analysis:!0}:{};return(await Q.post("/api/checks",{run_id:e,view_options:n,track_props:t})).data}async function n4(){return(await Q.get("/api/checks")).data}async function n6(e){return(await Q.get("/api/checks/".concat(e))).data}async function n3(e,n){return(await Q.patch("/api/checks/".concat(e),n)).data}async function n9(e){return(await Q.delete("/api/checks/".concat(e))).data}async function n8(e){return await Q.post("/api/checks/reorder",e)}var n7=t(37983),te=t(50437),tn=t(32392),tt=t(74917),ti=t(10649),tl=t(83890),tr=t(95133),ts=t(28378),to=t(62004),ta=t(74327),td=t(16725),tc=t(64863),tu=t(49431),th=t(64529),tx=t(77138);function tm(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),d=(0,j.useRef)(null),c=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,d,c]),(0,i.jsx)(tu.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(tx.X,{color:"gray.500"}),overflow:"hidden",children:(0,i.jsx)(th.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(nM.I,{ref:d,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:"100%"}):(0,i.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var tp=t(98702);function tf(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:d}=n0(),c=a||r,u=()=>{d("histogram_diff",{model:n,column_name:t,column_type:c},{showForm:!1})},x=()=>{d("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!r||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nH.h,{children:(0,i.jsx)(nP.q,{lineHeight:"20px",children:(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:u,isDisabled:m||!c||!(!eB(c)&&!eJ(c)),children:"Histogram Diff"}),(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tg(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function l(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:l}=e;return n?(0,i.jsx)(tf,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:l},{key:"currentType",name:"Current Type",resizable:!0,cellClass:l}],rows:Object.values(e)}}t(54351);var tv=t(30028),tj=t(22593);let ty=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:a=!1}=e,{columns:d,rows:c}=(0,j.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(ni(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,l]=e;t[i].baseIndex=n+1,t[i].baseType=l.type}),Object.entries(n).map((e,n)=>{let[i,l]=e;t[i].currentIndex=n+1,t[i].currentType=l.type}),t}(null==r?void 0:r.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tg(e,(null==s?void 0:s.name)||(null==r?void 0:r.name)):tg(e)},[r,s]),{lineageGraph:u}=eD(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=r&&void 0===r.columns,p=s&&void 0===s.columns;return m&&p?l="Schema information is missing on both current and base environments.":m?l="Schema information is missing on base environment.":p&&(l="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(tv.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tj.z,{}),t]}):l?(0,i.jsxs)(tv.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tj.z,{}),l]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(ne,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:d,rows:c,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tb(e){return(await Q.post("/api/select",e)).data}var tk=t(39556);t(57920);let tw=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tk.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},tC=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tk.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var t_=t(15240),tS=t(57038),tz=t(45584);let tR=nt.Nbv,tE=nt.sFB,tT=nt.UGs;function tI(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:tR}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tE}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tT}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tD(e){if("model"===e)return{color:"#c0eafd",icon:tS.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tz._MV};if("source"===e)return{color:"#a6dda6",icon:tS.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tz.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tz.R1C};if("seed"===e)return{color:"#a6dda6",icon:tS.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tS.Dmm};else return{color:"inherit",icon:void 0}}function tL(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:r,selected:a,onSelect:d,schemaChanged:c}=e,{icon:u}=tD(r.resourceType),{base:h,current:x}=r.data;if(c){var m;n=null===(m=nX("schema_diff"))||void 0===m?void 0:m.icon,t=tI("modified").color}else!h&&x?(n=tI("added").icon,t=tI("added").color):h&&!x&&(n=tI("removed").icon,t=tI("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:()=>d(r.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})},tM=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=eD(),r=t.params,s=[...W.check(t.check_id),"select"],{isLoading:o,error:a,refetch:d,data:c}=(0,y.a)({queryKey:s,queryFn:async()=>tb({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude,packages:null==r?void 0:r.packages,view_mode:null==r?void 0:r.view_mode}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==r?void 0:r.node_id)for(let n of r.node_id instanceof Array?r.node_id:[r.node_id]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}else for(let n of(null==c?void 0:c.nodes)||[]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tL(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function d(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=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,l]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tO,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tA=t(60772);function tF(e){let{value:n,onChange:t}=e,[l,s]=(0,j.useState)(!1),[a,d]=(0,j.useState)(),c=(0,j.useRef)(null),u=()=>{t&&(t(a),s(!1))};return((0,j.useEffect)(()=>{if(l&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[l]),l)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tA.g,{value:a,onChange:e=>{d(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),u())},ref:c,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(eo.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:u,children:"Update"})]})]}):(0,i.jsx)(er.x,{height:"100%",overflow:"auto",fontSize:"11pt",onClick:()=>{d(n||""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tq=t(54238);function tN(){let e=(0,Y.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}function tV(){let e=(0,n7._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tV=function(){return e},e}function tH(e){return e.description?e.description:"_(no description)_"}var tP=t(35852),tW=t(92071);let tK=e=>{let{value:n,onChange:t,onRun:l,onRunBase:r,onRunDiff:a,label:d,options:c={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(d||l||r)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(er.x,{as:"b",children:d?d.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(eo.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tz.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tW.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,l),r&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,r),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...c}})]})},tB=e=>{let{value:n,baseValue:t,onChange:l,onChangeBase:r,onRun:s,onRunBase:a,onRunDiff:d,options:c={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tP.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tK,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:c,...u})}),(0,i.jsx)(tP.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tK,{label:"Current",value:n,onChange:l,onRun:s,options:c,...u})})]})})};var tJ=t(86562),tU=t(36807);let tQ=(0,eU.G)((e,n)=>{var t,r,s,a;let{isRunning:d,isAborting:c,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(r=h.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tv.b,{status:"error",children:[(0,i.jsx)(tj.z,{}),"Error: ",y]});if(void 0!==d?d:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(e8.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nm.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)(tJ.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tJ.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)(eo.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tU.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tZ=t(28376),tX=t(87704),tG=t(72581),tY=t(76675),t$=t(17810),t0=t(99413);t(34336),t(92075);var t1=t(96054),t5=t(53009),t2=t(19867),t4=t(33059);function t6(e){let{node:n}=e,{icon:t}=tD(n.resourceType);return(0,i.jsx)(nS.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(te.Vp,{children:[(0,i.jsx)(te.AD,{as:t}),(0,i.jsx)(te.Sn,{children:n.resourceType})]})})}function t3(e){let{rowCount:n}=e,t=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===l?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(er.x,{children:r}),(0,i.jsx)(s.J,{as:t2.Rgz}),(0,i.jsx)(er.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(er.x,{children:o}),(0,i.jsx)(s.J,{as:t4.lxc,color:"gray.500"}),(0,i.jsx)(er.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nS.u,{label:r,children:(0,i.jsxs)(te.Vp,{children:[(0,i.jsx)(te.AD,{as:x}),(0,i.jsx)(te.Sn,{children:m||d?(0,i.jsx)(t5.N,{isLoaded:!d,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(t3,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(te.bq,{as:nV.h,isLoading:d,"aria-label":"Query Row Count",icon:(0,i.jsx)(ta.n,{}),size:"xs",onClick:a})]})})}let t8=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tJ.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsx)(te.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.x,{children:"Skipped"}),s&&(0,i.jsx)(nS.u,{label:s,children:(0,i.jsx)(t1.s,{})})]})});if(!a)return(0,i.jsx)(tJ.D,{isIndeterminate:!0,size:"20px"});let{error:d,result:c,run_id:u,progress:h}=a;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tJ.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tJ.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(d)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.x,{children:"Error"}),s&&(0,i.jsx)(nS.u,{label:d,children:(0,i.jsx)(nx.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(te.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(te.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)(t9,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},t7=(0,j.createContext)(void 0),ie=()=>{let e=(0,j.useContext)(t7);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e};function it(e){var n;let t,l,{rowCount:r}=e,s=r.base,o=r.curr,a=null===r.base?"N/A":"".concat(r.base," Rows"),d=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===s&&null===o?(t="Failed to load",l="gray"):null===s||null===o?(t="".concat(a," -> ").concat(d),l=null===s?"green":"red"):s===o?(t="=",l="gray"):s!==o&&(t="".concat(nk(s,o)," Rows"),l=s{var n,t,r;let a,d,{id:c,inverted:u}=e,{lineageGraph:x,runsAggregated:m}=eD(),p=null==m?void 0:m[c],f=null==x?void 0:x.nodes[c];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(a=tL(null===(t=f.data.base)||void 0===t?void 0:t.columns,null===(r=f.data.current)||void 0===r?void 0:r.columns)),p&&p.row_count_diff){let e=p.row_count_diff;d=e.result.curr!==e.result.base}let g=u?"white":tI("modified").color;return(0,i.jsxs)(o.k,{flex:"1",children:[void 0!==a&&(0,i.jsx)(nS.u,{label:"Schema (".concat(a?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nX("schema_diff"))||void 0===n?void 0:n.icon,color:a?g:u?"gray":"lightgray"})})}),(0,i.jsx)(h.L,{}),p&&p.row_count_diff&&void 0!==d&&(0,i.jsx)(nS.u,{label:"Row count (".concat(d?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(l.x,{children:(0,i.jsx)(it,{rowCount:p.row_count_diff.result})})})]})},il=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tS.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tS.hGI})})};var ir=t(76810),is=t(77712),io=t(46929);function ia(e){let{base:n,current:t}=e;return(0,i.jsx)(tW.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"}})}function id(e){let{current:n,onChange:t}=e,r=function(e,n){let t=(0,j.useRef)(null);return(0,j.useEffect)(()=>{t.current&&e!==t.current.getValue()&&t.current.setValue(e)},[e]),{onMount(e){let i=e.getModifiedEditor();t.current=i,i.onDidChangeModelContent(()=>{n(i.getValue())})}}}((null==n?void 0:n.raw_code)||"",t);return(0,i.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,i.jsx)(tW.SV,{language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==n?void 0:n.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,wordWrap:"on",wrappingIndent:"same",renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:r.onMount})})}async function ic(e){return(await Q.post("/api/checks",{type:"schema_diff",params:e})).data}let iu={audit_helper:"Require the dbt package 'dbt-labs/audit_helper'. Please install it and re-run dbt to activate this feature.",dbt_profiler:"Require the dbt package 'data-mie/dbt_profiler'. Please install it and re-run dbt to activate this feature.",add_or_remove:"Unavailable for added or removed resources."},ih=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=eL(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ey(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let d=(0,j.useCallback)(async()=>{if(r(!0),e)return await eb(e)},[e,r]),c=(null==a?void 0:a.type)?null===(n=nX(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:d,RunResultView:c}};var ix=t(2607),im=t(16947),ip=t(89258),ig=t.n(ip),iv=t(85027),ij=t(40892),iy=t(24766),ib=t.n(iy);let ik="ignore-screenshot";function iw(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:d="solid 1px #ccc",borderRadius:c="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,$.q)(),[l,r]=(0,j.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,j.useState)();return(0,j.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&r(e.target.result)}},[r]),(0,i.jsxs)(ee.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Screenshot Preview"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.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)(t1.s,{color:"red.600"}),(0,i.jsx)(er.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(er.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,ij.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");ib()(l,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=r?d:"",e.style.borderRadius=r?c:"",e.style.backgroundColor=l||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await ig()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,iv.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function iC(e){let{successToast:n,failToast:t}=tN(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=iw({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,j.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},[o]),d=(0,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),c=(0,j.useCallback)(async()=>{o.current?(await r(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,r,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eo.z,{size:"sm",leftIcon:(0,i.jsx)(tr.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:l,onMouseEnter:a,onMouseLeave:d,onClick:c,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:d,onCopyToClipboard:c}}let i_=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",l=null==n?void 0:n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",s="";"successful"===l||"finished"===l?(r="green",s="Finished"):"failed"===l?(r="red",s="Failed"):"cancelled"===l?(r="gray",s="Cancelled"):"running"===l?(r="blue",s="Running"):(r="green",s="Finished");let a=(null==n?void 0:n.run_at)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,ij.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,ij.WU)(e,"HH:mm"):(0,ij.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tX.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(er.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(er.x,{children:"•"}),(0,i.jsx)(er.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},iS=e=>{let n=ix.ZP.stringify(e,null,2);return(0,i.jsx)(tW.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}})},iz=e=>{var n,t,l;let{runId:r,onClose:s,disableAddToChecklist:a}=e,{runAction:d}=n0(),{error:c,run:f,onCancel:g,isRunning:v}=ih(r),[y,k]=(0,j.useState)(),w=(0,b.NL)(),[,C]=(0,eA.TH)(),[_,S]=(0,j.useState)(0),z=(null==f?void 0:f.type)?null===(n=nX(f.type))||void 0===n?void 0:n.RunResultView:void 0,R=(0,j.useCallback)(()=>{d((null==f?void 0:f.type)||"",null==f?void 0:f.params)},[f,d]),E=null==f?void 0:f.check_id,T=(0,j.useCallback)(async()=>{E&&C("/checks/".concat(E))},[E,C]),I=(0,j.useCallback)(async()=>{if(!r)return;let e=await n2(r,y);w.invalidateQueries({queryKey:W.checks()}),C("/checks/".concat(e.check_id))},[r,C,w,y]),D=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:L,onCopyToClipboard:O,onMouseEnter:M,onMouseLeave:A}=iC();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:_,onChange:S,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),D&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[f&&(0,i.jsx)(i_,{run:f}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ta.n,{}),variant:"outline",isDisabled:!r||v,size:"sm",onClick:R,children:"Rerun"}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(tr.T,{}),variant:"outline",isDisabled:!r||!(null==f?void 0:f.result)||!!c||0!==_,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:O,children:"Copy to Clipboard"}),(0,i.jsx)(function(){return a?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(im.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(im.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:I,children:"Add to Checklist"})},{}),(0,i.jsx)(io.P,{onClick:()=>{s&&s()}})]})]})}),0===_&&(0,i.jsx)(tQ,{ref:L,error:c,run:f,onCancel:g,viewOptions:y,onViewOptionsChanged:k,RunResultView:z}),1===_&&f&&(0,i.jsx)(iS,{type:f.type,params:f.params}),2===_&&f&&((null===(t=f.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tB,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tK,{value:(null==f?void 0:null===(l=f.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},iR=e=>{let{onClose:n,disableAddToChecklist:t}=e,{runId:l}=n0();return(0,i.jsx)(iz,{runId:l,onClose:n,disableAddToChecklist:t})};async function iE(e,n){return await ej("query",e,n)}async function iT(e,n){return await ej("query_base",e,n)}async function iI(e,n){return await ej("query_diff",e,n)}var iD=t(17879),iL=t(67891),iO=t(83868);let iM=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r,isDisabled:o}=e,[a,d]=(0,j.useState)(t||[]),[c,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),m=(0,j.useRef)(null),p=e=>{a.includes(e)||(u(""),d([...a,e]),r([...a,e]))};return o?(0,i.jsx)(nS.u,{label:iu.audit_helper,children:(0,i.jsx)(nM.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})}):(0,i.jsxs)(iD.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nq.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null==m?void 0:null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,i.jsxs)(nN.j,{width:"100%",children:[(0,i.jsx)(nM.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?"".concat(a[0]):"",onChange:()=>{},backgroundColor:"white"}),0===a.length&&(0,i.jsx)(iL.x,{children:(0,i.jsx)(s.J,{as:tz.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,i.jsx)(nH.h,{children:(0,i.jsxs)(nP.q,{zIndex:"popover",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nW.k,{children:(0,i.jsxs)(iO.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(iO.U,{children:(0,i.jsxs)(te.Vp,{size:e.size,children:[(0,i.jsx)(te.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(te.SD,{paddingRight:"8px",onClick:()=>{d(a.filter(e=>e!==n)),r(a.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iO.U,{width:"100%",children:(0,i.jsx)(nM.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:c,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":p(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(d(a.slice(0,-1)),r(a.slice(0,-1)))}},onBlur:()=>{var e;m&&h&&(null==m||null===(e=m.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{children:[""!==c&&!(null==l?void 0:l.includes(c))&&(0,i.jsxs)(nK.s,{onClick:()=>{p(c),x(!1)},children:["Add '",c,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===c||e.includes(c)).filter(e=>!a.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nK.s,{onClick:()=>p(e),children:e},"option-".concat(n)))]})]})})]}),a.length>0&&(0,i.jsx)(iL.x,{children:(0,i.jsx)(eo.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{u(""),d([]),r([])},children:"Clear"})})]})},iA=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=eD(),a=(0,j.useMemo)(()=>{if(!r)return[];let e=new Set;for(let i in r.nodes){var n,t;let l=r.nodes[i],s=null===(n=l.data.base)||void 0===n?void 0:n.columns,o=null===(t=l.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[r]);return(0,i.jsx)(o.k,{...l,children:(0,i.jsxs)(eq.NI,{m:"4px 8px",children:[(0,i.jsxs)(eN.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nS.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,i.jsx)(t1.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iM,{unitName:"key",defaultValues:n,suggestionList:a,onValuesChange:t,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!s("query_diff_with_primary_key")})]})})};var iF=t(17429),iq=t(302);function iN(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:d,externalLinkText:c}=e;return(0,i.jsxs)(o.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(nV.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:t}),(0,i.jsx)(nV.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:l}),d&&c&&(0,i.jsx)(r.r,{href:d,isExternal:!0,textDecoration:"underline",onClick:s,children:c})]})}let iV="recce-",iH={bypassSaveOverwrite:"".concat(iV,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(iV,"-preview-change-feedback"),prepareEnvGuideID:"".concat(iV,"-prepare-env")};var iP=t(29260),iW=t(30997),iK=t(21257),iB=t(32501),iJ=t(1363),iU=t(23260),iQ=t(35757),iZ=t(7090);let iX=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25070)",children:(0,i.jsx)("path",{d:"M15.625 0.25H14.759C14.5484 0.25 14.3791 0.423375 14.3841 0.633937L14.4575 3.71441C13.0691 1.62634 10.6955 0.25 8 0.25C4.21291 0.25 1.06041 2.96638 0.38425 6.557C0.340875 6.78728 0.518875 7 0.753219 7H1.64622C1.82353 7 1.97566 6.87556 2.013 6.70222C2.60753 3.9415 5.05991 1.875 8 1.875C10.4858 1.875 12.6232 3.35256 13.5836 5.47819L9.63394 5.38416C9.42341 5.37916 9.25 5.54844 9.25 5.75906V6.625C9.25 6.83209 9.41791 7 9.625 7H15.625C15.8321 7 16 6.83209 16 6.625V0.625C16 0.417906 15.8321 0.25 15.625 0.25ZM15.2468 9H14.3538C14.1765 9 14.0243 9.12444 13.987 9.29778C13.3925 12.0585 10.9401 14.125 8 14.125C5.51419 14.125 3.37681 12.6474 2.41637 10.5218L6.36606 10.6158C6.57659 10.6208 6.75 10.4516 6.75 10.2409V9.375C6.75 9.16791 6.58209 9 6.375 9H0.375C0.167906 9 0 9.16791 0 9.375V15.375C0 15.5821 0.167906 15.75 0.375 15.75H1.24097C1.45156 15.75 1.62088 15.5766 1.61588 15.3661L1.54253 12.2856C2.93087 14.3737 5.3045 15.75 8 15.75C11.7871 15.75 14.9396 13.0336 15.6158 9.443C15.6591 9.21272 15.4811 9 15.2468 9Z",fill:"currentColor"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1479_25070",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),iG=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25102)",children:(0,i.jsx)("path",{d:"M-1.88399 8.72062L0.358816 6.46094C0.594752 6.22344 1.00006 6.39031 1.00006 6.725V8.2525H4.00005V4.12438C4.00005 3.7275 4.16161 3.34313 4.44286 3.06219L7.06441 0.440625C7.34566 0.159375 7.72691 0 8.12347 0H14.5003C15.3281 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.3281 16 14.5003 16H5.50223C4.67411 16 4.00005 15.3281 4.00005 14.5003V11.2522H5.50005V14.5003H14.5003V1.50281H9.50128V4.75219C9.50128 5.16781 9.1669 5.50187 8.75128 5.50187H5.50005V8.25219H10.625C10.8322 8.25219 11 8.42 11 8.62719V9.37719C11 9.58438 10.8322 9.75219 10.625 9.75219H1.00006V11.2797C1.00006 11.6144 0.594752 11.7813 0.358816 11.5438L-1.88399 9.28406C-2.03867 9.12813 -2.03867 8.87656 -1.88399 8.72062ZM8.0016 4.00219V1.62469L5.62379 4.00219H8.0016Z",fill:"currentColor"})}),(0,i.jsx)("g",{"clip-path":"url(#clip1_1479_25102)",children:(0,i.jsx)("path",{d:"M0.103056 8.72062L2.09667 6.46094C2.30639 6.22344 2.66667 6.39031 2.66667 6.725V8.2525H5.33333V4.12438C5.33333 3.7275 5.47694 3.34313 5.72694 3.06219L8.05722 0.440625C8.30722 0.159375 8.64611 0 8.99861 0H14.6669C15.4028 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.4028 16 14.6669 16H6.66861C5.9325 16 5.33333 15.3281 5.33333 14.5003V11.2522H6.66667V14.5003H14.6669V1.50281H10.2233V4.75219C10.2233 5.16781 9.92611 5.50187 9.55667 5.50187H6.66667V8.25219H11.2222C11.4064 8.25219 11.5556 8.42 11.5556 8.62719V9.37719C11.5556 9.58438 11.4064 9.75219 11.2222 9.75219H2.66667V11.2797C2.66667 11.6144 2.30639 11.7813 2.09667 11.5438L0.103056 9.28406C-0.0344448 9.12813 -0.0344448 8.87656 0.103056 8.72062ZM8.89028 4.00219V1.62469L6.77666 4.00219H8.89028Z",fill:"currentColor"})}),(0,i.jsxs)("defs",{children:[(0,i.jsx)("clipPath",{id:"clip0_1479_25102",children:(0,i.jsx)("rect",{width:"13",height:"16",fill:"white",transform:"matrix(-1 0 0 1 16 0)"})}),(0,i.jsx)("clipPath",{id:"clip1_1479_25102",children:(0,i.jsx)("rect",{width:"3",height:"16",fill:"white"})})]})]}),iY=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1426_8619)",children:(0,i.jsx)("path",{d:"M15.5572 3.06188L12.9356 0.440625C12.6544 0.159375 12.2731 0 11.8766 0H5.49969C4.67188 0.003125 4 0.675 4 1.50281V8.25219H0.375C0.167812 8.25219 0 8.42 0 8.62719V9.37719C0 9.58438 0.167812 9.75219 0.375 9.75219H9V11.2797C9 11.6144 9.40531 11.7812 9.64125 11.5437L11.8841 9.28406C12.0388 9.12813 12.0388 8.87656 11.8841 8.72062L9.64125 6.46094C9.40531 6.22344 9 6.39031 9 6.725V8.2525H5.49969V1.50281H10.4987V4.75219C10.4987 5.16781 10.8331 5.50187 11.2487 5.50187H14.5V14.5003H5.49969V11.2522H4V14.5003C4 15.3281 4.67188 16 5.49969 16H14.4978C15.3259 16 16 15.3281 16 14.5003V4.12406C16 3.7275 15.8384 3.34313 15.5572 3.06188ZM11.9984 4.00219V1.62469L14.3763 4.00219H11.9984Z",fill:"black"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1426_8619",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),i$=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M14.5607 4.06066L11.9393 1.43934C11.658 1.15804 11.2765 1 10.8787 1H2.5C1.67156 1 1 1.67156 1 2.5V13.5C1 14.3284 1.67156 15 2.5 15H13.5C14.3284 15 15 14.3284 15 13.5V5.12131C15 4.72349 14.842 4.34196 14.5607 4.06066ZM9.5 2.5V5H5.5V2.5H9.5ZM13.3125 13.5H2.6875C2.63777 13.5 2.59008 13.4802 2.55492 13.4451C2.51975 13.4099 2.5 13.3622 2.5 13.3125V2.6875C2.5 2.63777 2.51975 2.59008 2.55492 2.55492C2.59008 2.51975 2.63777 2.5 2.6875 2.5H4V5.75C4 6.16422 4.33578 6.5 4.75 6.5H10.25C10.6642 6.5 11 6.16422 11 5.75V2.62131L13.4451 5.06641C13.4625 5.08382 13.4763 5.10449 13.4857 5.12724C13.4952 5.14999 13.5 5.17438 13.5 5.199V13.3125C13.5 13.3622 13.4802 13.4099 13.4451 13.4451C13.4099 13.4802 13.3622 13.5 13.3125 13.5ZM8 7.25C6.48366 7.25 5.25 8.48366 5.25 10C5.25 11.5163 6.48366 12.75 8 12.75C9.51634 12.75 10.75 11.5163 10.75 10C10.75 8.48366 9.51634 7.25 8 7.25ZM8 11.25C7.31075 11.25 6.75 10.6892 6.75 10C6.75 9.31075 7.31075 8.75 8 8.75C8.68925 8.75 9.25 9.31075 9.25 10C9.25 10.6892 8.68925 11.25 8 11.25Z",fill:"currentColor"})}),i0=e=>(0,i.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M15.9143 1.75812L14.7422 0.585938C14.3515 0.195312 13.8397 0 13.3278 0C12.8159 0 12.304 0.195312 11.9137 0.585625L9.58593 2.91344L8.5 3.99938L0.901592 11.5975L0.504719 15.1669C0.454719 15.6163 0.80878 16 1.24847 16C1.27628 16 1.3044 15.9984 1.33253 15.9953L4.89939 15.6012L12.5006 8L13.5862 6.91437L15.914 4.58656C16.6953 3.80531 16.6953 2.53906 15.9143 1.75812ZM4.21095 14.1684L2.09909 14.4016L2.3344 12.2863L9.56062 5.06L10.53 4.09062L12.4094 5.97L11.44 6.93937L4.21095 14.1684ZM14.8534 3.52562L13.4697 4.90938L11.5906 3.03L12.9744 1.64625C13.1019 1.51875 13.2506 1.49969 13.3278 1.49969C13.405 1.49969 13.554 1.51875 13.6812 1.64625L14.8534 2.81844C15.0484 3.01375 15.0484 3.33094 14.8534 3.52562Z",fill:"currentColor"})}),i1=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M7.26326 6.5462H8.71794V12.3642H7.26326V6.5462ZM7.9906 3.1102C7.43278 3.1102 6.97888 3.5641 6.97888 4.12192C6.97888 4.67974 7.43278 5.13364 7.9906 5.13364C8.54842 5.13364 9.00232 4.67974 9.00232 4.12192C9.00232 3.5641 8.54842 3.1102 7.9906 3.1102ZM16 8C16 12.411 12.411 16 8 16C3.589 16 0 12.411 0 8C0 3.589 3.589 0 8 0C12.411 0 16 3.589 16 8ZM14.5453 8C14.5453 4.3906 11.6093 1.4546 7.99992 1.4546C4.39052 1.4546 1.45452 4.3914 1.45452 8.0006C1.45452 11.6098 4.39052 14.546 7.99992 14.546C11.6093 14.546 14.5453 11.6092 14.5453 8.0006V8Z",fill:"currentColor"})});function i5(e){let n=(0,iZ.D)(e);return(0,ij.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function i2(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)(t_.HC,{ml:"10px",children:[n,": ",t]},n)})}function i4(){var e,n,t,l,a,c;let{envInfo:u,reviewMode:h,lineageGraph:x}=eD(),{isOpen:m,onOpen:p,onClose:f}=(0,$.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)?i5(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?i5(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===(c=e.data.current)||void 0===c?void 0:c.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Environment Info",placement:"bottom-end",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{verticalAlign:"middle",as:i1,boxSize:"16px"})})}),(0,i.jsxs)(ee.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Environment Information"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.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)(d.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(t_.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(t_.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&i2(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(t_.QI,{spacing:1,children:g&&i2(g)})]})}),(0,i.jsx)(nz.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"DBT"}),(0,i.jsx)(iP.x,{children:(0,i.jsxs)(iW.i,{variant:"simple",children:[(0,i.jsx)(iK.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iJ.Th,{}),(0,i.jsx)(iJ.Th,{children:"base"}),(0,i.jsx)(iJ.Th,{children:"current"})]})}),(0,i.jsxs)(iU.p,{children:[(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Td,{children:"schema"}),(0,i.jsx)(iQ.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(iQ.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Td,{children:"version"}),(0,i.jsx)(iQ.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(iQ.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Td,{children:"timestamp"}),(0,i.jsx)(iQ.Td,{children:k}),(0,i.jsx)(iQ.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)(d.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(iP.x,{children:(0,i.jsxs)(iW.i,{variant:"simple",children:[(0,i.jsx)(iK.h,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iJ.Th,{}),(0,i.jsx)(iJ.Th,{children:"base"}),(0,i.jsx)(iJ.Th,{children:"current"})]})}),(0,i.jsx)(iU.p,{children:(0,i.jsxs)(iB.Tr,{children:[(0,i.jsx)(iQ.Td,{children:"Environment"}),(0,i.jsx)(iQ.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(iQ.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}function i6(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:a,runQuery:c,isPending:u}=e;return(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(d.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:iF.vc4,boxSize:"1.2em"}),"Sandbox"]}),(0,i.jsxs)(er.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model"," ",(0,i.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iA,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(nS.u,{label:"Run diff to see the changes",children:(0,i.jsx)(eo.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{a(),c()},colorScheme:"blue",isLoading:u,children:"Run Diff"})})]})}function i3(e){var n,t,l;let{currentModelID:r,height:s="32px",flex:a="0 0 auto"}=e,{lineageGraph:d,envInfo:c}=eD(),u="0 16px",h=i5((null==c?void 0:null===(t=c.dbt)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.generated_at)||""),x=(0,tZ.Q)(h,{addSuffix:!0}),m="N/A";if((null==d?void 0:d.nodes)&&(null==d?void 0:d.nodes[r])){let e=null==d?void 0:d.nodes[r];(null===(l=e.data.current)||void 0===l?void 0:l.schema)&&(m=e.data.current.schema)}return(0,i.jsxs)(o.k,{gap:0,height:s,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(tP.K,{width:"50%",children:(0,i.jsxs)(er.x,{as:"b",margin:u,children:["ORIGINAL (Schema: ",m,", Last Updated: ",x,")"]})}),(0,i.jsx)(tP.K,{width:"50%",children:(0,i.jsx)(er.x,{as:"b",margin:u,children:"SANDBOX EDITOR"})})]})}function i9(e){let{isOpen:n,onClose:t,current:s}=e,{isOpen:h,onClose:x,onOpen:m}=(0,$.q)(),[p,f]=(0,j.useState)((null==s?void 0:s.raw_code)||""),{showRunId:g,clearRunResult:v}=n0(),{primaryKeys:y,setPrimaryKeys:b}=_(),{data:k,isLoading:w}=eE(),C=async()=>{let e={current_model:(null==s?void 0:s.name)||"",primary_keys:y,sql_template:p},{run_id:n}=await iI(e,{nowait:!0});return g(n),await ey(n)},{mutate:S,isPending:z}=(0,tp.D)({mutationFn:C,onSuccess(e,n){e.error?em({action:"run",node:null==s?void 0:s.name,status:"failure"}):(em({action:"run",node:null==s?void 0:s.name,status:"success"}),setTimeout(()=>R(),1e3),!w&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>T(),2e3))}}),{feedbackToast:R,closeToast:E}=function(e){let n=(0,Y.p)(),{feedbackId:t,description:l,onFeedbackSubmit:r,externalLink:s,externalLinkText:o}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=localStorage.getItem(t);n.isActive(t)||"true"===a&&!1===e||n({id:t,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:a}=e;return(0,i.jsx)(tv.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iq.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(iN,{description:l,onLike:()=>{r("like"),a(),localStorage.setItem(t,"true")},onDislike:()=>{r("dislike"),a(),localStorage.setItem(t,"true")},externalLink:s,externalLinkText:o,onClickLink:()=>{r("link")}}),(0,i.jsx)(io.P,{onClick:()=>{a()}})]})})})}})},closeToast:()=>n.closeAll()}}({feedbackId:iH.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":ep({feedback:"like",node:null==s?void 0:s.name});break;case"dislike":ep({feedback:"dislike",node:null==s?void 0:s.name});break;case"link":ep({feedback:"form",node:null==s?void 0:s.name});break;default:console.log("Not support feedback type")}},externalLink:"https://docs.google.com/forms/d/e/1FAIpQLSd7Lei7Ijwo7MinWaI0K6rzZi_21gV1BKetmiNEX254kDziDA/viewform?usp=header",externalLinkText:"Give us feedback"}),{guideToast:T,closeGuideToast:I}=function(e){let n=(0,Y.p)(),{guideId:t,description:l,externalLink:s,externalLinkText:o,onExternalLinkClick:a}=e;return{guideToast:function(){n.isActive(t)||n({id:t,position:"bottom-right",duration:3e3,description:"some text",render:e=>{let{id:n,onClose:t}=e;return(0,i.jsx)(tv.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iq.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(er.x,{children:[l," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:s,onClick:()=>{a&&a(),t()},children:o})]}),(0,i.jsx)(io.P,{onClick:()=>{t()}})]})})})}})},closeGuideToast:()=>n.closeAll()}}({guideId:iH.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>ef({action:"external_link",from:"preview_changes",node:null==s?void 0:s.name})});return(0,j.useEffect)(()=>{n&&f((null==s?void 0:s.raw_code)||"")},[n,s]),(0,i.jsx)(ee.u_,{isOpen:n,size:"full",onClose:()=>{t(),x(),v(),E(),I(),em({action:"close",node:null==s?void 0:s.name})},children:(0,i.jsxs)(et.h,{height:"100%",children:[(0,i.jsx)(ei.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,i.jsxs)(o.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{p:0,children:(0,i.jsxs)(tC,{sizes:h?[50,50]:[100,0],minSize:h?100:0,gutterSize:h?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(o.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(i6,{current:s,primaryKeys:null!=y?y:[],setPrimaryKeys:b,onRunResultOpen:m,runQuery:S,isPending:z}),(0,i.jsx)(i3,{height:"32pxs",flex:"0 0 auto",currentModelID:(null==s?void 0:s.id)||""}),(0,i.jsx)(id,{current:s,onChange:f})]}),h?(0,i.jsx)(iR,{onClose:x,disableAddToChecklist:!0}):(0,i.jsx)(l.x,{})]})}),(0,i.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(nS.u,{label:"Give us feedback",children:(0,i.jsx)(nV.h,{"aria-label":"feedback",icon:(0,i.jsx)(nt.xJq,{}),variant:"ghost",size:"md",onClick:()=>{R(!0)}})})})]})})}function i8(e){let{node:n,onCloseNode:t}=e,[,r]=(0,eA.TH)(),{setSqlQuery:a,setPrimaryKeys:c}=_(),f="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType||"snapshot"===n.resourceType,{isOpen:g,onOpen:v,onClose:y}=(0,$.q)(),{isOpen:b,onOpen:k,onClose:w}=(0,$.q)(),{runAction:C}=n0(),{envInfo:S,isActionAvailable:z}=eD(),{primaryKey:R}=eK(n.name),E=()=>{C("row_count_diff",{node_names:[n.name]},{showForm:!1,showLast:!1})},{data:T}=eE(),I=null==T?void 0:T.single_env_onboarding,D=(0,j.useCallback)(async()=>{let e=n.id,t=await ic({node_id:e});r("/checks/".concat(t.check_id))},[n,r]),L=(e,n)=>e?iu.add_or_remove:z(n)?"":"value_diff"===n?iu.audit_helper:"profile_diff"===n?iu.dbt_profiler:"This action is not supported yet.",O="added"===n.changeStatus||"removed"===n.changeStatus;return(0,i.jsxs)(is.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(d.X,{size:"sm",children:n.name})}),(0,i.jsx)(h.L,{}),I?(0,i.jsx)(function(){return(0,i.jsx)(eo.z,{as:eo.z,size:"sm",colorScheme:"blue",onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),k(),ef({action:"preview_changes",node:n.name})},children:"Sandbox"})},{}):(0,i.jsx)(function(){var e,t,l,o,d,u,h,x;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{as:eo.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(e=nX("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?a('select * from {{ ref("'.concat(n.name,'") }}')):(null==S?void 0:S.adapterType)==="sqlmesh"&&a("select * from ".concat(n.name)),z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),r("/query")},children:"Query"}),(0,i.jsx)(nK.s,{fontSize:"14px",icon:(0,i.jsx)(s.J,{as:null===(t=nX("sandbox"))||void 0===t?void 0:t.icon}),onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),k(),em({action:"explore",node:n.name})},children:"Sandbox (Experiment)"}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===n.resourceType||"snapshot"===n.resourceType)&&(0,i.jsx)(nK.s,{onClick:v,icon:(0,i.jsx)(tS.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nX("row_count_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",onClick:()=>E(),children:"Row Count Diff"}),(0,i.jsx)(nS.u,{label:L(O,"profile_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(o=nX("profile_diff"))||void 0===o?void 0:o.icon}),fontSize:"14px",isDisabled:O||!z("profile_diff"),onClick:()=>{C("profile_diff",{model:n.name},{showForm:!1,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"value_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nX("value_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:O||!z("value_diff"),onClick:()=>{C("value_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"top_k_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(u=nX("top_k_diff"))||void 0===u?void 0:u.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"histogram_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nX("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nW.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(x=nX("schema_diff"))||void 0===x?void 0:x.icon}),fontSize:"14px",onClick:D,children:"Schema Diff"})})]})]})},{}),(0,i.jsx)(l.x,{flex:"0 1 1%",children:(0,i.jsx)(io.P,{onClick:t})})]}),(0,i.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(t6,{node:n}),("model"===n.resourceType||"snapshot"===n.resourceType||"seed"===n.resourceType)&&(0,i.jsx)(t9,{node:n,onRefresh:E})]})}),f&&(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)(tt.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(ti.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(ty,{base:n.data.base,current:n.data.current})})})]}),(0,i.jsxs)(ee.u_,{isOpen:g,onClose:y,size:"6xl",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ei.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{children:(0,i.jsx)(ia,{base:n.data.base,current:n.data.current})})]})]}),(0,i.jsx)(i9,{isOpen:b,onClose:w,current:n.data.current})]})}function i7(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=ie();return(0,i.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tG.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(eo.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(eo.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var le=t(63988),ln=t(12767),lt=t(29901);let li=()=>(0,i.jsxs)(nm.g,{align:"start",spacing:0,children:[(0,i.jsx)(er.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(le.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(le.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(le.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(le.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),ll=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n0();return(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(s.J,{as:nt.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ex({name:"hide"}),t()):(ex({name:"show"}),n())},children:e?"Hide":"Show"})},lr=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l,selectMode:r}=ie(),o=t.view_mode||"changed_models",a=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{as:eo.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tD("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nP.q,{title:"packages",children:[(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},ls=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=eD(),{viewOptions:o,onViewOptionsChanged:a}=ie(),d=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&d.add(e.packageName);let c=null==r?void 0:null===(t=r.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.packages):c?new Set([c]):d,h=u.size===d.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nq.v,{closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{as:eo.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t2.zFh}),size:"xs",variant:"outline",isDisabled:l,children:m}),(0,i.jsx)(nP.q,{title:"packages",children:(0,i.jsxs)(nW.k,{title:"Select Packages",children:[(0,i.jsx)(nK.s,{as:np.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(d)})},children:"Select All"}),(0,i.jsx)(tn.R,{}),Array.from(d).map(e=>(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},lo=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=eE(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nS.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",defaultIsOpen:!0,color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(nM.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})})},la=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=ie();return(0,i.jsx)(lo,{isDisabled:n,value:t.select||"",onChange:e=>{l({...t,select:e||void 0})},tooltipComponent:(0,i.jsx)(li,{})})},ld=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=ie();return(0,i.jsx)(lo,{isDisabled:n,value:t.exclude||"",onChange:e=>{l({...t,exclude:e||void 0})}})},lc=e=>(0,i.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),lu=()=>{var e,n,t,l;let{nodes:r,deselect:o,selectMode:a,...d}=ie(),{isActionAvailable:c}=eD(),x=(0,j.useMemo)(()=>r.filter(e=>e.data.isSelected),[r]),{data:m}=eE(),p=null==m?void 0:m.single_env_onboarding,f="single"===a&&1===x.length,g="multi"===a&&x.length>=1,v="single"===a&&0===x.length,y="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(lc,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(ll,{})}),(0,i.jsx)(lc,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(lr,{isDisabled:y})}),(0,i.jsx)(lc,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(ls,{isDisabled:y})}),(0,i.jsx)(lc,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(la,{isDisabled:y})}),(0,i.jsx)(lc,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(ld,{isDisabled:y})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lc,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(er.x,{fontSize:"9pt",color:"gray.500",children:x.length>1?"".concat(x.length," nodes selected"):"".concat(x.length," node selected")})}),(0,i.jsx)(lc,{label:"",children:(0,i.jsx)(eo.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),!p&&(0,i.jsx)(lc,{label:"Explore",children:(0,i.jsx)(ln.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nq.v,{placement:"bottom-end",children:[(0,i.jsx)(nN.j,{as:eo.z,size:"xs",rightIcon:(0,i.jsx)(lt.v,{}),children:"Actions"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(e=nX("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{d.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nS.u,{label:c("value_diff")?null:iu.audit_helper,placement:"left",children:(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g)||!c("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(n=nX("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{d.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||g&&x.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nX("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(l=nX("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};async function lh(e){return(await Q.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function lx(){return(0,i.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,l]]=e,{icon:r,color:a}=tI(n);return(0,i.jsx)(nS.u,{label:l,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:r})," ",t]})},n)})})}var lm=t(88500);let lp={mode:"per_node",status:"pending",completed:0,total:0},lf=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...lp}).current,{showRunId:s}=n0(),o=async(n,o,a)=>{let d="multi_nodes";r.mode=d,t(),r.status="running";let c=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:d,status:"skipped",skipReason:e},i(n)):(n.action={mode:d,status:"pending"},c.push(n))}let u=a(c);try{let{run_id:e}=await ej(n,u,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await ey(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of c)e.action={mode:d,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{let o="per_node";for(let n of(r.mode=o,t(),r.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:l}=await ej(n,e,{nowait:!0});for(r.currentRun={run_id:l},t.action={mode:o,status:"running"},i(t);;){let e=await ey(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},d=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await eb(r.currentRun.run_id)};return{actionState:r,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await lh({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await ic({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await ic({node_id:t})}return n},cancel:d,reset:()=>{Object.assign(r,lp)}}};var lg=t(42154),lv=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,$.q)(),[r,s]=(0,j.useState)(0),[a,d]=(0,j.useState)(),c=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{d(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(lg.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,i.jsx)(en.Z,{children:(0,i.jsxs)(lg._T,{children:[(0,i.jsxs)(ei.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",r," nodes"]}),(0,i.jsx)(el.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(l.x,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{ref:c,onClick:h,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}},lj=t(95534),ly=t(51366);let lb="recce",lk={recommendationIgnored:"".concat(lb,"-recommendation-ignored"),recommendationShowed:"".concat(lb,"-recommendation-showed"),prevRefreshTimeStamp:"".concat(lb,"-prev-refresh-timestamp")},lw=()=>{var e;let n=(0,y.a)({queryKey:W.checks(),queryFn:n4}),t=(0,j.useMemo)(()=>{if("success"===n.status&&n.data.length>0){let e=n.data.filter(e=>e.is_preset).findLast(e=>"row_count_diff"===e.type);if(e)return e}},[n]),i=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?W.check(t.check_id):[],queryFn:async()=>{if(null==t?void 0:t.check_id)return n6(t.check_id)},enabled:!!(null==t?void 0:t.check_id)}),l=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?[...W.check(t.check_id),"select"]:[],queryFn:async()=>{var e,n;return tb({select:null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select,exclude:null==t?void 0:null===(n=t.params)||void 0===n?void 0:n.exclude})},enabled:!!(null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select)}),r=(0,j.useMemo)(()=>{if(t){var e,n;if(null===(e=t.params)||void 0===e?void 0:e.node_names)return t.params.node_names;if(null===(n=t.params)||void 0===n?void 0:n.node_ids)return t.params.node_ids}if("success"===l.status&&l.data)return l.data.nodes},[t,l]);return{recommendedCheck:i.data,selectedNodes:r}},lC=()=>{let{lineageGraph:e,envInfo:n}=eD(),{showRunId:t}=n0(),{data:l}=eE(),r=(0,b.NL)(),{recommendedCheck:s,selectedNodes:a}=lw(),[d,c]=(0,j.useState)(),[x,m]=(0,j.useState)(!1),[p,f]=(0,j.useState)(!1),[g,v]=(0,j.useState)(!1),{isOpen:y,onOpen:k,onClose:w}=(0,$.q)(),C=lk.recommendationIgnored,_=lk.recommendationShowed,S=lk.prevRefreshTimeStamp;(0,j.useEffect)(()=>{sessionStorage.getItem(C)&&f(!0)},[C]),(0,j.useEffect)(()=>{var t,i,l,r,o,d,u,h,x,p,g,j;if(!s||!a)return;if(null===(t=s.last_run)||void 0===t?void 0:t.run_id){let e=new Date(null===(o=s.last_run)||void 0===o?void 0:o.run_at).getTime(),t=null==n?void 0:n.dbt,i=Math.max((null==t?void 0:null===(d=t.current)||void 0===d?void 0:d.generated_at)?new Date(t.current.generated_at).getTime():0,(null==t?void 0:null===(u=t.base)||void 0===u?void 0:u.generated_at)?new Date(t.base.generated_at).getTime():0);if(e>=i){m(!0);return}m(!1),v(!0);let l=sessionStorage.getItem(S);(null===l||parseInt(l)!==i)&&(sessionStorage.setItem(S,i.toString()),sessionStorage.removeItem(C),sessionStorage.removeItem(_),f(!1))}let y=n=>n.map(n=>{var t;return null==e?void 0:null===(t=e.nodes[n])||void 0===t?void 0:t.name}).join(", ");if(a.length>0&&a.length<=3){if(null===(h=s.params)||void 0===h?void 0:h.node_names){let e=null===(p=s.params)||void 0===p?void 0:p.node_names.join(", ");c("'".concat(e,"'"))}else if(null===(x=s.params)||void 0===x?void 0:x.node_ids){let e=y(null===(g=s.params)||void 0===g?void 0:g.node_ids);c("'".concat(e,"'"))}else if(a){let e=y(a);c("'".concat(e,"'"))}}else(null==e?void 0:null===(i=e.modifiedSet)||void 0===i?void 0:i.length)===a.length?c("modified and potentially impacted models"):(null===(l=s.params)||void 0===l?void 0:l.select)&&!(null===(r=s.params)||void 0===r?void 0:r.exclude)?c("'".concat(null===(j=s.params)||void 0===j?void 0:j.select,"'")):c("".concat(a.length," models"));if(!sessionStorage.getItem(_)){let e=sessionStorage.getItem(S);sessionStorage.setItem(_,"true"),eg({action:"recommend",from:null===e?"initial":"rerun"})}},[s,a,e,C,_,S,n]);let z=(0,j.useCallback)(async()=>{s&&(t((await ek(s.check_id,{nowait:!0})).run_id),r.invalidateQueries({queryKey:W.check(s.check_id)}))},[s,t,r]);if(!s||!a||(null==l?void 0:l.single_env_onboarding))return(0,i.jsx)(i.Fragment,{});let R=a.length;return!p&&!x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"blue.50",children:(0,i.jsxs)(u.U,{flex:"1",fontSize:"10pt",color:"blue.600",children:[g?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ly.i,{}),(0,i.jsx)(er.x,{children:"New dbt build detected - Re-run row count checks to maintain result accuracy"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lj.h,{}),(0,i.jsxs)(er.x,{children:["First Check: Perform a row count diff of ",d," for basic impact assessment"]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(eo.z,{size:"xs",onClick:()=>{f(!0),sessionStorage.setItem(C,"true"),eg({action:"ignore",from:g?"rerun":"initial",nodes:R})},children:"Ignore"}),(0,i.jsx)(eo.z,{colorScheme:"blue",size:"xs",onClick:()=>{k(),eg({action:"perform",from:g?"rerun":"initial",nodes:R})},children:"Perform"})]})}),(0,i.jsxs)(ee.u_,{isOpen:y,onClose:()=>{w(),eg({action:"close",from:g?"rerun":"initial",nodes:R})},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Row Count Check"}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:"4",children:[(0,i.jsxs)(er.x,{children:["Perform a row count check of the ",R," node(s) displayed in the lineage diff DAG."]}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(lj.h,{mt:"10px",ml:"5px"}),(0,i.jsx)(er.x,{margin:"5px",paddingX:"3px",children:"This is a recommended first check based on the preset checks defined in your recce.yml file."})]})]})}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{onClick:()=>{w(),eg({action:"close",from:g?"rerun":"initial",nodes:R})},children:"Cancel"}),(0,i.jsxs)(eo.z,{colorScheme:"blue",onClick:()=>{w(),z(),m(!0),eg({action:"execute",from:g?"rerun":"initial",nodes:R})},children:["Execute on ",R," models"]})]})]})]})]})};var l_=t(71736),lS=t(29128),lz=t(11359),lR=t(55329),lE=t(32554);let lT=e=>{let{enabled:n,onChanged:t}=e,l=eE();return!l.data||l.data.single_env_onboarding?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",children:[(0,i.jsx)(l_.r,{isChecked:n,onChange:e=>{t(e.target.checked)},alignItems:"center"}),(0,i.jsx)(o.k,{alignItems:"center",children:(0,i.jsx)(er.x,{fontSize:"10pt",lineHeight:"1",children:"Breaking Change Analysis"})}),(0,i.jsxs)(lS.J,{trigger:"hover",placement:"top-start",children:[(0,i.jsx)(lz.x,{children:(0,i.jsx)(s.J,{boxSize:"10px",as:lj.h,color:"gray.500",cursor:"pointer"})}),(0,i.jsx)(lR.y,{bg:"black",color:"white",children:(0,i.jsxs)(lE.b,{fontSize:"sm",children:["Breaking changes are determined by analyzing SQL for changes that may impact downstream models."," ",(0,i.jsx)(r.r,{href:"https://datarecce.io/docs/features/breaking-change-analysis/",target:"_blank",children:"Learn more"}),"."]})})]}),(0,i.jsx)(c.C,{color:"gray",children:"Experiment"})]})},lI={customNode:function(e){var n,t;let{data:r}=e,{id:a,isHighlighted:d,isSelected:c,resourceType:x,changeStatus:m}=r,p=(0,R.oR)(e=>e.transform[2]>.3),{icon:f}=tD(x),[g,v]=(0,j.useState)(!1),{interactive:y,selectNodeMulti:b,selectMode:k,advancedImpactRadius:w}=ie(),{lineageGraph:C}=eD(),_=w&&"modified"===m&&(null==C?void 0:C.nonBreakingSet.has(a)),{icon:S,color:z,backgroundColor:E}=m?tI(m):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},T=_?"dashed":"solid";r.isSelected;let I=null==r?void 0:r.name;return(0,i.jsx)(nS.u,{label:"model"===x?I:"".concat(I," (").concat(x,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:z,borderWidth:"2px",borderStyle:T,borderRadius:8,backgroundColor:p?"multi"===k?c?z:"white":"action_result"!==k?c?E:"white":r.action?c?E:z:"white":c?z:E,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===k?(null==r?void 0:r.action)?"none":"opacity(0.2) grayscale(50%)":d||c?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[(0,i.jsx)(o.k,{bg:z,padding:y?"8px":"2px",borderRightWidth:"2px",borderColor:"multi"===k?"#00000020":z,borderStyle:T,alignItems:"top",visibility:p?"inherit":"hidden",children:y&&(0,i.jsx)(il,{checked:"multi"===k&&c||"action_result"===k&&!!r.action,onClick:e=>{"action_result"!==k&&(e.stopPropagation(),b(r.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:p?"inherit":"hidden",children:[(0,i.jsx)(l.x,{flex:"1",color:"multi"===k?c?"white":"inherit":"action_result"===k&&r.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:I}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===k?c?"white":"inherit":"action_result"===k&&r.action&&!c?"white":"inherit",as:f}),S&&(0,i.jsx)(s.J,{color:"multi"===k?c?"white":z:"action_result"===k?r.action&&!c?"white":"inherit":z,as:S})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:p?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==k&&"model"===r.resourceType&&(0,i.jsx)(ii,{id:r.id,inverted:"multi"===k&&!!c}),r.isActionMode&&(r.action?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(t8,{node:r,action:r.action})]}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==r?void 0:r.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==r?void 0:r.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},lD={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:l,targetY:r,sourcePosition:s,targetPosition:o,style:a={},markerEnd:d,data:c}=e,u={...a};(null==c?void 0:c.changeStatus)&&(u.stroke=tI(null==c?void 0:c.changeStatus).color,u.strokeDasharray="5"),(null==c?void 0:c.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:l,targetY:r,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:d,style:{...u,...a}})})}},lL=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tI(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},lO=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,l=t.contentRect.height;(Math.abs(l-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&l>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:l}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])},lM=()=>{let[,e]=(0,eA.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},lA=(0,j.forwardRef)(function(e,n){var t;let{interactive:r=!1,...a}=e,d=(0,R._K)(),c=(0,j.useRef)(null),{successToast:h,failToast:x}=tN(),{copyToClipboard:m,ImageDownloadModal:p,ref:f}=iw({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(ik))},onSuccess:()=>{h("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),x("Failed to copy image to clipboard",e)}}),[g,v,y]=(0,R.Rr)([]),[b,k,w]=(0,R.ll)([]),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:E}=eD(),{showRunId:I,closeRunResult:D,runAction:W}=n0(),[K,B]=(0,j.useState)({...a.viewOptions});(0,j.useImperativeHandle)(n,()=>({copyToClipboard:m}));let J=K.view_mode||"changed_models",[U,Q]=(0,j.useState)("single"),Z=(0,j.useMemo)(()=>{var e;if("single"===U)return null===(e=g.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[U,g]),X=(0,j.useMemo)(()=>g.filter(e=>e.data.isSelected).map(e=>e.data),[g]),G=(0,j.useMemo)(()=>g.map(e=>e.data),[g]),[$,ee]=(0,j.useState)(!1),[en,et]=(0,j.useState)({x:0,y:0}),[ei,el]=(0,j.useState)(!1),es=(0,Y.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(K.node_ids)e=K.node_ids;else{var n,t;let i=null===(n=C.manifestMetadata.current)||void 0===n?void 0:n.project_name,l=C&&(null==C?void 0:null===(t=C.modifiedSet)||void 0===t?void 0:t.length)>0,r={view_mode:K.view_mode?K.view_mode:l?"changed_models":"all",packages:i?[i]:void 0,...a.viewOptions};B(r),e=(await tb({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode})).nodes}let[i,l]=A(C,e),r=M(C,ei);[i,l]=q(Array.from(r),i,l),F(i,l),v(i),k(l)})()},[C]);let ea=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ei;if(!C)return;let[n,t]=q(Array.from(M(C,e)),g,b);v(P(n)),k(t)},ed=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=d.getZoom();d.setCenter(n,t,{zoom:i,duration:200})}},eu=lM();lO(c,async()=>{if("single"===U||"action_result"===U){let e=g.find(e=>e.data.isSelected);e?ed(e):d.fitView({nodes:g,duration:200})}});let ex=(0,j.useCallback)(e=>{v(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[v]),em=async e=>{let n;if(!C)return;try{n=(await tb({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof lm.d7){var t,i;es({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[l,r]=A(C,n),s=M(C,ei);[l,r]=q(Array.from(s),l,r),F(l,r),v(l),k(r),B(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{d.fitView({nodes:l,duration:200})})()},ep=lf("multi"===U?X:G,{onActionStarted:()=>{Q("action_result")},onActionNodeUpdated:ex,onActionCompleted:()=>{}}),ef=lv();if(S)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tX.$,{size:"xl"})});let eg=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=en.selectedNode;"action_result"!==U&&void 0!==n&&void 0!==C&&("single"===U&&(v(P(g,!0)),Q("multi"),ep.reset()),v(H([...L(C,[n.id],e)],g,"single"===U)))},ej=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=en.selectedNode;"action_result"!==U&&void 0!==n&&void 0!==C&&("single"===U&&(v(P(g,!0)),Q("multi"),ep.reset()),v(H([...O(C,[n.id],e)],g,"single"===U)))},ey=()=>{ee(!1),et({x:0,y:0})};if(z)return(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsxs)(nm.g,{children:[(0,i.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(l.x,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})});if("changed_models"===J&&!(null==C?void 0:null===(t=C.modifiedSet)||void 0===t?void 0:t.length))return(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsxs)(nm.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{em({...K,view_mode:"all"})},children:"Show all nodes"})]})});let eb=()=>{Q("single"),v(P(g)),D(),null==E||E()},ek={interactive:r,selectMode:U,nodes:g,viewOptions:K,onViewOptionsChanged:em,selectNodeMulti:e=>{if("multi"!==U){if(!C)return;let[n,t]=q(Array.from(O(C,C.modifiedSet)),g,b);v(n=N(e,n=P(n,!0))),k(t),Q("multi"),ep.reset()}else{let n=V(e,g);n.find(e=>e.data.isSelected)||(Q("single"),n=P(n)),v(n)}},deselect:eb,advancedImpactRadius:ei,setAdvancedImpactRadius:el,runRowCountDiff:async()=>{"multi"===U?(await ep.runRowCountDiff(),eh({type:"row_count_diff",selected:"multi"})):Z?(await W("row_count_diff",{node_names:[Z.name]},{showForm:!1,showLast:!1}),eh({type:"row_count_diff",selected:"single"})):(await W("row_count_diff",{select:K.select,exclude:K.exclude,packages:K.packages,view_mode:K.view_mode}),eh({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(Z)await W("value_diff",{model:Z.name},{showForm:!0,showLast:!1}),eh({type:"value_diff",selected:"single"});else{let e="multi"===U?X.length:G.length;await ef.confirm(e)&&(await ep.runValueDiff(),eh({type:"value_diff",selected:"multi"===U?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===U?(e=await ep.addLineageDiffCheck(),eb(),eh({type:"lineage_diff",selected:"multi"})):Z||(e=await lh(K),eh({type:"lineage_diff",selected:"none"})),e&&eu(e)},addSchemaDiffCheck:async()=>{let e;"multi"===U?X.length>0&&(e=await ep.addSchemaDiffCheck(),eb(),eh({type:"schema_diff",selected:"multi"})):Z?(e=await ic({node_id:Z.id}),eh({type:"schema_diff",selected:"single"})):(e=await ic({select:K.select,exclude:K.exclude,packages:K.packages,view_mode:K.view_mode}),eh({type:"schema_diff",selected:"none"})),e&&eu(e)},cancel:ep.cancel,actionState:ep.actionState};return(0,i.jsxs)(t7.Provider,{value:ek,children:[(0,i.jsxs)(tw,{sizes:Z?[70,30]:[100,0],minSize:Z?400:0,gutterSize:Z?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nm.g,{ref:c,divider:(0,i.jsx)(tG.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lu,{}),(0,i.jsx)(lC,{})]}),(0,i.jsxs)(R.x$,{nodeTypes:lI,edgeTypes:lD,nodes:g,edges:b,onNodesChange:y,onEdgesChange:w,onNodeClick:(e,n)=>{if(!1!==r&&C){if(ey(),"single"===U){Z||ed(n);let[e,t]=q(Array.from(T(L(C,[n.id]),O(C,[n.id]))),g,b);v(N(n.id,e)),k(t)}else if("action_result"===U){var t,i,l,s;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&I(null===(s=n.data.action)||void 0===s?void 0:null===(l=s.run)||void 0===l?void 0:l.run_id),ed(n),v(N(n.id,g))}else{let e=V(n.id,g);e.find(e=>e.data.isSelected)||(Q("single"),e=P(e)),v(e)}}},onNodeMouseEnter:(e,n)=>{if(!C||Z||"single"!==U)return;let[t,i]=q(Array.from(T(L(C,[n.id]),O(C,[n.id]))),g,b);v(t),k(i)},onNodeMouseLeave:(e,n)=>{Z||ea()},onNodeContextMenu:(e,n)=>{if(!r||"action_result"===U)return;e.preventDefault();let t=f.current.getBoundingClientRect(),i=f.current.offsetTop;et({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),ee(!0)},onClick:ey,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:r,ref:f,children:[(0,i.jsx)(tY.A,{color:"#ccc"}),(0,i.jsx)(t$.Z,{showInteractive:!1,position:"top-right",className:ik,children:(0,i.jsx)(t$.B,{title:"copy image",onClick:async()=>{m()},children:(0,i.jsx)(s.J,{as:t2.C3L})})}),(0,i.jsx)(p,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(lx,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(lT,{enabled:ei,onChanged:e=>{var n;el(e),ea(e),n={enabled:e},ec.j("[Experiment] breaking_change_analysis",n),ev=n.enabled}}),0==g.length&&(0,i.jsx)(er.x,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,i.jsx)(t0.a,{nodeColor:lL,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===U&&(0,i.jsx)(R.s_,{position:"bottom-center",className:ik,children:(0,i.jsx)(i7,{onClose:()=>{eb()}})})]}),$&&(0,i.jsx)(nq.v,{isOpen:!0,onClose:ey,children:(0,i.jsxs)(nP.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(en.x,"px"),top:"".concat(en.y,"px")},children:[(0,i.jsx)(nK.s,{icon:(0,i.jsx)(ir.Cv2,{}),onClick:()=>{eg(1)},children:"Select parent nodes"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(ir.IMj,{}),onClick:()=>{ej(1)},children:"Select child nodes"}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(ir.Cv2,{}),onClick:()=>{eg()},children:"Select all upstream nodes"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(ir.IMj,{}),onClick:()=>{ej()},children:"Select all downstream nodes"})]})})]}),"single"===U&&Z?(0,i.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(i8,{node:Z,onCloseNode:()=>{ea()}})}):(0,i.jsx)(l.x,{})]}),ef.AlertDialog]})}),lF=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(lA,{viewOptions:l,interactive:!1,ref:n})})})});function lq(e){let{name:n,description:t,type:l,params:r,viewOptions:s}=e,o={name:n,description:t,type:l,params:r};s&&(o.view_options=s);let a=ix.ZP.stringify({checks:[o]});return(0,i.jsx)(tW.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 lN(){let e=(0,Y.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function lV(){let e=(0,n7._)(["\n
","\n\n ","\n\n
"]);return lV=function(){return e},e}let lH=e=>{var n,t,r,a,c,f,g,v;let{checkId:k}=e,w=(0,b.NL)(),[,C]=(0,eA.TH)(),{successToast:_,failToast:S}=tN(),{markedAsApprovedToast:z}=lN(),[R,E]=(0,j.useState)(),[T,I]=(0,j.useState)(),[D,L]=(0,j.useState)(!1),{isOpen:O,onOpen:M,onClose:A}=(0,$.q)(),F=()=>(0,i.jsx)(en.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[q,N]=(0,j.useState)((0,i.jsx)(F,{})),{isLoading:V,error:H,data:P}=(0,y.a)({queryKey:W.check(k),queryFn:async()=>n6(k),refetchOnMount:!0}),K=R||(null==P?void 0:null===(n=P.last_run)||void 0===n?void 0:n.run_id),{run:B,error:J}=ih(K),U=R?!B||"running"===B.status:(null==B?void 0:B.status)==="running",Q=(null==P?void 0:P.type)?nX(null==P?void 0:P.type):void 0,Z=(null==P?void 0:P.is_preset)||!1,X=(0,j.useRef)(null),{mutate:G}=(0,tp.D)({mutationFn:e=>n3(k,e),onSuccess:()=>{w.invalidateQueries({queryKey:W.check(k)}),w.invalidateQueries({queryKey:W.checks()})}}),{mutate:Y}=(0,tp.D)({mutationFn:()=>n9(k),onSuccess:()=>{w.invalidateQueries({queryKey:W.checks()}),C("/checks")}}),es=(0,j.useCallback)(async()=>{(null==P?void 0:P.type)&&(E((await ek(k,{nowait:!0})).run_id),w.invalidateQueries({queryKey:W.check(k)}))},[P,k,E,w]),ea=(0,j.useCallback)(async()=>{if(L(!0),K)return await eb(K)},[K]),ed=async()=>{var e;if(!P)return;let n=(e=P,(0,tq.RI)(lV(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tH(e),"\n\n").concat((0,tq.Pn)(tV(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tH(e)}(e)));if(!navigator.clipboard){S("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(n),_("Copied the check to the clipboard")}catch(e){S("Failed to copy the check to clipboard",e)}},ec=(0,j.useCallback)(()=>{let e=null==P?void 0:P.is_checked;G({is_checked:!e}),!0==!e&&z()},[null==P?void 0:P.is_checked,G,z]),eu=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!(null==n?void 0:n.error)),[eh,ex]=(0,j.useState)(0),{ref:em,onCopyToClipboard:ep,onMouseEnter:ef,onMouseLeave:eg}=iC();if(V)return(0,i.jsx)(e8.M,{h:"100%",children:"Loading"});if(H)return(0,i.jsxs)(e8.M,{h:"100%",children:["Error: ",H.message]});let ev=(null==B?void 0:B.run_at)?(0,tZ.Q)(new Date(B.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tC,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)(tm,{name:(null==P?void 0:P.name)||"",setName:e=>{G({name:e})}}),Z&&(0,i.jsx)(nS.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(te.Vp,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,i.jsx)(te.AD,{boxSize:"14px",as:td.bX4}),"Preset"]})}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{mr:"10px",children:[ev&&(0,i.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ev}),(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{isRound:!0,as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"ghost",size:"sm"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(tc.ovA,{}),onClick:()=>{N((0,i.jsx)(F,{})),M()},children:"Get Preset Check Template"}),(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(tr.T,{}),onClick:()=>ed(),children:"Copy Markdown"}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(ts.p,{}),color:"red",onClick:()=>Y(),children:"Delete"})]})]}),(0,i.jsx)(nS.u,{label:eu(null!==(f=null==P?void 0:P.type)&&void 0!==f?f:"",B)?"Run the check first":(null==P?void 0:P.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(eo.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==P?void 0:P.is_checked)?"green":"gray",variant:(null==P?void 0:P.is_checked)?"solid":"outline",leftIcon:(null==P?void 0:P.is_checked)?(0,i.jsx)(to.r,{}):(0,i.jsx)(s.J,{as:nt.Rbx,color:"lightgray"}),onClick:()=>ec(),isDisabled:eu(null!==(g=null==P?void 0:P.type)&&void 0!==g?g:"",B),children:(null==P?void 0:P.is_checked)?"Approved":"Mark as Approved"})})]})]}),(0,i.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tF,{value:null==P?void 0:P.description,onChange:e=>{G({description:e})}},null==P?void 0:P.check_id)})]}),(0,i.jsx)(l.x,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:eh,onChange:ex,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==P?void 0:P.type)==="query"||(null==P?void 0:P.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{mr:"10px",children:[(null==Q?void 0:Q.RunResultView)&&(0,i.jsx)(nS.u,{label:"Rerun",children:(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ta.n,{}),variant:"outline",isLoading:U,size:"sm",onClick:()=>es(),children:"Rerun"})}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(tr.T,{}),variant:"outline",isDisabled:eu(null!==(v=null==P?void 0:P.type)&&void 0!==v?v:"",B)||0!==eh,onMouseEnter:ef,onMouseLeave:eg,size:"sm",onClick:()=>{if((null==P?void 0:P.type)==="lineage_diff"){var e;null===(e=X.current)||void 0===e||e.copyToClipboard()}else ep()},children:"Copy to Clipboard"})]})]}),(0,i.jsxs)(tt.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(ti.x,{p:0,width:"100%",height:"100%",children:[(null==Q?void 0:Q.RunResultView)&&((null==P?void 0:P.last_run)||K?(0,i.jsx)(tQ,{ref:em,isRunning:U,isAborting:D,run:K?B:null==P?void 0:P.last_run,error:J,progress:T,RunResultView:Q.RunResultView,viewOptions:null==P?void 0:P.view_options,onViewOptionsChanged:e=>{G({view_options:e})},onCancel:ea,onExecuteRun:es}):(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsxs)(nm.g,{spacing:4,children:[(0,i.jsx)(l.x,{children:"This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here."}),(0,i.jsx)(eo.z,{onClick:es,colorScheme:"blue",size:"sm",children:"Run Query"})]})})),P&&"schema_diff"===P.type&&(0,i.jsx)(tM,{check:P,ref:em}),P&&"lineage_diff"===P.type&&(0,i.jsx)(lF,{check:P,ref:X})]}),((null==P?void 0:P.type)==="query"||(null==P?void 0:P.type)==="query_diff"||(null==P?void 0:P.type)==="query_base")&&(0,i.jsx)(ti.x,{p:0,height:"100%",width:"100%",children:(null===(t=P.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tB,{value:(null==P?void 0:null===(r=P.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==P?void 0:null===(a=P.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tK,{value:(null==P?void 0:null===(c=P.params)||void 0===c?void 0:c.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(ee.u_,{isOpen:O,onClose:A,isCentered:!0,size:"6xl",children:[q,(0,i.jsxs)(et.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ei.x,{children:"Preset Check Template"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.f,{children:[(0,i.jsx)(d.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(tl.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)(lq,{name:(null==P?void 0:P.name)||"",description:(null==P?void 0:P.description)||"",type:(null==P?void 0:P.type)||"",params:null==P?void 0:P.params,viewOptions:null==P?void 0:P.view_options})]})]})]})]})};var lP=t(35019);let lW=e=>{var n;let{check:t,selected:r,onSelect:a,onMarkAsApproved:d}=e,c=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,tp.D)({mutationFn:e=>n3(u,e),onSuccess:()=>{c.invalidateQueries({queryKey:W.check(u)}),c.invalidateQueries({queryKey:W.checks()})}}),x=(null===(n=nX(t.type))||void 0===n?void 0:n.icon)||eF.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:r?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:r?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nS.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(np.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):d()}})})})]})})},lK=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[a,d]=(0,j.useState)(!1),c=(0,b.NL)(),{mutate:u}=(0,tp.D)({mutationFn:e=>n3(e,{is_checked:!0}),onSuccess:(e,n)=>{c.invalidateQueries({queryKey:W.check(n)}),c.invalidateQueries({queryKey:W.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,$.q)(),{markedAsApprovedToast:p}=lN(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lP.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(lP.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nm.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(lP._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,l=e.style.top-t.y;e.style.left=i,e.style.top=l}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(lW,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(ee.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{width:"400px",children:[(0,i.jsx)(ei.x,{children:"Mark as Approved?"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(nz.i,{}),(0,i.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(np.X,{isChecked:a,onChange:e=>d(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nz.i,{}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};async function lB(e){return(await Q.post("/api/save-as",e)).data}async function lJ(e){return(await Q.post("/api/rename",e)).data}async function lU(){return(await Q.post("/api/export")).data}async function lQ(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await Q.post("/api/import",t)).data}async function lZ(){return 208===(await Q.get("/api/sync")).status}async function lX(e){try{let n=await Q.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,lm.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}function lG(e){let{checksOnly:n=!0}=e,t=(0,Y.p)(),l=(0,b.NL)(),r=(0,j.useRef)(null),a=(0,j.useRef)(null),[d,c]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,$.q)(),[m,p]=(0,eA.TH)(),[,f]=eL(),g=(0,j.useCallback)(async()=>{if(d){try{let{runs:e,checks:i}=await lQ(d,n);f(),await l.invalidateQueries({queryKey:W.checks()}),await l.invalidateQueries({queryKey:W.runs()}),m.includes("/checks")&&p("/checks");let r=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:r,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[l,d,t,x,m,p,f,n]),v=n?"checks":"runs and checks",{isDemoSite:y}=eD();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Import Checklist from State File"+(y?" (Disabled in the demo site)":""),children:(0,i.jsx)(nV.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{r.current&&r.current.click()},icon:(0,i.jsx)(s.J,{as:iY}),isDisabled:y})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(c(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,i.jsx)(lg.aR,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(en.Z,{children:(0,i.jsxs)(lg._T,{children:[(0,i.jsx)(ei.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(el.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)(t1.s,{color:"red.600"}),(0,i.jsx)(er.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(er.x,{children:["The current ",v," will be"," ",(0,i.jsx)(er.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}let lY=()=>{let[,e]=(0,eA.TH)(),[,n]=(0,eA.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=tN(),a=null==n?void 0:n.checkId,{isLoading:d,error:c,data:u,status:h}=(0,y.a)({queryKey:W.checks(),queryFn:n4,refetchOnMount:!0}),x=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,p]=(0,j.useState)(u||[]),{mutate:f}=(0,tp.D)({mutationFn:e=>n8(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.checks()})}}),g=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),f({source:e,destination:n}),p(t)},[m,p,f]);return((0,j.useCallback)(async()=>{let e=await n5();t.invalidateQueries({queryKey:W.checks()}),x(e.check_id)},[t,x]),(0,j.useEffect)(()=>{"success"===h&&(!a&&u.length>0&&e("/checks/".concat(u[0].check_id)),p(u))},[h,a,u,p,e]),d)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,i.jsxs)(tw,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nm.g,{spacing:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(o.k,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(lG,{checksOnly:!0})}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(lK,{checks:m,selectedItem:a,onCheckSelected:x,onChecksReordered:g})]})}),(0,i.jsx)(l.x,{height:"100%",children:(0,i.jsx)(eA.rs,{children:(0,i.jsx)(eA.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(lH,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsx)(l.x,{children:"No checks"})})},l$=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n0();return(0,i.jsxs)(l.x,{children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(s.J,{as:nt.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ex({name:"hide"}),t()):(ex({name:"show"}),n())},children:e?"Hide":"Show"})]})},l0=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=_();return(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(l.x,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nS.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(t1.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(l_.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},l1=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:d}=_(),{envInfo:c}=eD(),u=e;(null==c?void 0:c.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=n0(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iE;case"query_base":return iT;case"query_diff":return iI;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,d&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return x(r),await ey(r)},{mutate:p,isPending:f}=(0,tp.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(l$,{}),(0,i.jsx)(l0,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iA,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(l.x,{width:"100%",flex:"1",children:d?(0,i.jsx)(tB,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tK,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var l5=t(58172);let l2=e=>(0,l5.c4)("#!"+e),l4=()=>[(0,l5.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),l2];var l6=t(98907),l3=t(55263);let l9=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ey(t)}),o=(null==s?void 0:s.type)?null===(n=nX(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tQ,{isPending:l,error:r,run:s,RunResultView:o})},l8=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e8.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)(d.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(eo.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},l7=e=>{let{children:n}=e;return(0,i.jsx)(tU.SV,{fallback:l8,children:n})};function re(){let e=(0,Y.p)(),n=async()=>{try{let e=await lU(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,ij.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");ib()(t,l)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nS.u,{label:"Export",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:iG,verticalAlign:"middle",boxSize:"16px"})})})}function rn(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(lA,{interactive:!0})})}t(94167);let rt=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(ei.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:4,children:[(0,i.jsxs)(t_.aV,{spacing:2,children:[(0,i.jsx)(t_.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(t_.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(t_.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})},ri=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{maxW:"40vw",h:"300px",children:[(0,i.jsx)(ei.x,{children:"All nodes displayed"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:4,children:[(0,i.jsx)(er.x,{children:"In a single environment with only a target, no nodes are marked as changed."}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(lj.h,{mt:"10px",ml:"5px"}),(0,i.jsxs)(er.x,{margin:"5px",paddingX:"3px",children:["To see changed nodes, configure a target-base."," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",onClick:()=>ef({action:"external_link",from:"onboarding"}),children:"Learn how."})]})]})]})}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})};var rl=()=>{let[e,n]=(0,j.useState)(!1),[t,l]=(0,j.useState)(!1),{data:r,isLoading:s}=eE();(0,j.useEffect)(()=>{if(!s&&r){let e=r.show_onboarding_guide;if(r.single_env_onboarding&&e){l(!0),ef({action:"onboarding"});return}!localStorage.getItem("hasVisited")&&e&&(n(!0),localStorage.setItem("hasVisited","true"))}},[r,s]);let o=()=>{n(!1),l(!1),ez()};return s?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rt,{isGuideOpen:e,closeGuide:o}),(0,i.jsx)(ri,{isGuideOpen:t,closeGuide:o})]})},rr=t(23899);t(55180);let rs=e=>{var n;let{run:t,isSelected:r,onSelectRun:a,onAddToChecklist:d,onGoToCheck:c}=e,{data:u}=(0,y.a)({queryKey:W.run(t.run_id),queryFn:async()=>await ey(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nX(t.type))||void 0===n?void 0:n.icon)||eF.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:r?"orange.400":"transparent",backgroundColor:r?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:r?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nS.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(er.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(x)},children:(0,i.jsx)(s.J,{color:"green",as:tS.FJM})})}):(0,i.jsx)(nS.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(er.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),ex({name:"add_to_checklist"}),d(t.run_id)},children:(0,i.jsx)(s.J,{as:tS.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(i_,{run:u||t})})]})},ro=e=>{let{runAt:n}=e,t=n?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":t.toDateString()===e.toDateString()?"Yesterday":(0,ij.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(o.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},ra=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:W.runs(),queryFn:async()=>await eC(),retry:!1}),{showRunId:a,runId:c}=n0(),x=e=>{ex({name:"click_run"}),a(e,!1)},[,m]=(0,eA.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!c)return;let e=await n2(c);p.invalidateQueries({queryKey:W.checks()}),m("/checks/".concat(e.check_id))},[c,m,p]),g=(0,j.useCallback)(e=>{ex({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=null;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(d.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nV.h,{variant:"unstyled",icon:(0,i.jsx)(ta.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(e8.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(rr.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(ro,{runAt:e.run_at},t),(0,i.jsx)(rs,{run:e,isSelected:e.run_id===c,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var rd=t(45828),rc=t(12415);let{definePartsStyle:ru,defineMultiStyleConfig:rh}=(0,rc.D)(rd.TB.keys),rx=rh({variants:{circular:ru({control:(0,rc.k0)({rounded:"full"})})},sizes:{xs:ru({icon:(0,rc.k0)({fontSize:"8px"}),control:(0,rc.k0)({boxSize:"16px",padding:"4px"}),label:(0,rc.k0)({fontSize:"xs"})})}}),rm=(0,t(2809).fj)({baseStyle:{borderRadius:"4px"}});var rp=t(25301);let rf=()=>{let e=(0,Y.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,t)=>{var i,l;e({description:t?t instanceof lm.d7?"".concat(n,". ").concat(null==t?void 0:null===(l=t.response)||void 0===l?void 0:null===(i=l.data)||void 0===i?void 0:i.detail):"".concat(n,". ").concat(t):"".concat(n),status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},rg=e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},rv=()=>{let{fileName:e,cloudMode:n,isDemoSite:t,isLoading:r}=eD(),a=(0,$.q)(),d=(0,$.q)(),c=!e&&!n&&!t,{data:u}=(0,y.a)({queryKey:W.checks(),queryFn:n4,enabled:c}),h=void 0!=u&&u.filter(e=>!e.is_preset).length>0;rg(c&&h);let[{newFileName:x,errorMessage:m,modified:p,overwriteWithMethod:f,bypass:g},v]=(0,j.useState)({newFileName:e||"recce_state.json"}),k=(0,j.useRef)(null),{toastSuccess:w,toastError:C}=rf(),_=(0,b.NL)(),S=async(e,n)=>{if(!x)return;let t="true"===localStorage.getItem(iH.bypassSaveOverwrite);try{"save"===e?await lB({filename:x,overwrite:n||t}):await lJ({filename:x,overwrite:n||t}),w("save"===e?"Save file successfully":"Rename file successfully"),_.invalidateQueries({queryKey:W.lineage()}),g&&localStorage.setItem(iH.bypassSaveOverwrite,"true")}catch(n){if(n instanceof lm.d7){var i;if((null===(i=n.response)||void 0===i?void 0:i.status)===409){v(n=>({...n,overwriteWithMethod:e})),d.onOpen();return}}C("save"===e?"Save file failed":"Rename file failed",n)}finally{a.onClose()}};return n||t?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{flex:"1",justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.x,{fontWeight:"600",children:e||(n?"cloud":"New Instance"+(h?" (unsaved)":""))}),(0,i.jsx)(nS.u,{label:e?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(nV.h,{onClick:()=>{v({newFileName:e||"recce_state.json",modified:!e}),a.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,i.jsx)(s.J,{as:e?i0:i$,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsxs)(ee.u_,{isOpen:a.isOpen,onClose:a.onClose,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:e?"Change Filename":"Save File"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(eq.NI,{isInvalid:!!m,children:[(0,i.jsx)(eN.l,{children:"File name:"}),(0,i.jsx)(nM.I,{ref:k,value:x,placeholder:"Enter filename",onChange:n=>{let t;let i=n.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?e&&i===e&&(t="Filename is the same as the current one."):t="Invalid filename. Only alphanumeric, space, _ and - are allowed.":t="Filename must end with .json.":t="Filename cannot be empty.",v(e=>({...e,modified:!0,newFileName:i,errorMessage:t}))},onKeyDown:n=>{"Enter"===n.key?m||(e?S("rename"):S("save")):"Escape"===n.key&&a.onClose()}}),(0,i.jsx)(rp.J1,{children:m})]})}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{size:"sm",colorScheme:e?void 0:"blue",onClick:()=>{S("save")},isDisabled:!x||!!m||!p,children:e?"Save as New File":"Confirm"}),e&&(0,i.jsx)(eo.z,{size:"sm",colorScheme:"blue",onClick:()=>{S("rename")},isDisabled:!x||!!m||!p,children:"Rename"})]})]})]}),(0,i.jsxs)(ee.u_,{isOpen:d.isOpen,onClose:d.onClose,initialFocusRef:k,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Overwrite File?"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.x,{fontSize:"12pt",children:"save"===f?"Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?":"Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?"}),(0,i.jsx)(np.X,{isChecked:g,onChange:e=>v(n=>({...n,bypass:e.target.checked})),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{variant:"outline",onClick:()=>{d.onClose(),a.onOpen(),v(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(eo.z,{size:"sm",colorScheme:"blue",onClick:()=>{f&&(S(f,!0),d.onClose())},children:"Overwrite"})]})]})]})]})};var rj=t(68883),ry=t(16375);function rb(){return(0,i.jsx)(nS.u,{label:"Syncing",children:(0,i.jsx)(eo.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,i.jsx)(tX.$,{})})})}function rk(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[r,o]=(0,eA.TH)(),{isOpen:a,onOpen:d,onClose:c}=(0,$.q)(),[u,h]=(0,j.useState)(""),x=(0,Y.p)(),m=(0,j.useCallback)(async e=>{if(c(),n(!0),"conflict"===(await lX(e)).status){d(),n(!1);return}for(;await lZ();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:W.lineage()}),t.invalidateQueries({queryKey:W.checks()}),t.invalidateQueries({queryKey:W.runs()}),/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(r)&&o("/checks")},[t,r,o,x,d,c]);return e?(0,i.jsx)(rb,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Sync with Cloud",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:iX,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsxs)(ee.u_,{isOpen:a,onClose:c,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(el.f,{children:[(0,i.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.x,{mt:"5px",children:(0,i.jsx)(rj.E,{onChange:h,value:u,children:(0,i.jsxs)(tP.K,{direction:"column",children:[(0,i.jsxs)(ry.Y,{value:"merge",children:["Merge",(0,i.jsx)(nS.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lj.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(ry.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nS.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:lj.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(ry.Y,{value:"revert",children:["Revert",(0,i.jsx)(nS.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:lj.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{onClick:c,mr:3,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let rw=e=>{let{children:n,path:t}=e,[r]=(0,eA.yj)(t);return(0,i.jsx)(l.x,{display:r?"block":"none",height:"100%",children:n})};function rC(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.r,{height:"20px",color:"white",href:t,isExternal:!0,...l,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function r_(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eD(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await Q.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},v=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"cloud mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:nt.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"demo mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:nt.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rC,{icon:tS.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rC,{icon:tS.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rC,{mr:"18px",icon:tS.MXt,href:"https://datarecce.io/docs"})]})}function rS(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.x,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function rz(){let{isDemoSite:e,reviewMode:n,fileMode:t,cloudMode:r,isLoading:s}=eD(),[a,d]=(0,eA.TH)(),{data:c,isLoading:u}=eE(),h=(0,i.jsx)(rS,{queryKey:W.checks(),fetchCallback:n4,selectCallback:e=>e.filter(e=>!e.is_checked).length}),f=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query",disable:(null==c?void 0:c.single_env_onboarding)===!0},{name:"Checklist",href:"/checks",badge:h,disable:(null==c?void 0:c.single_env_onboarding)===!0}],g=eP().findIndex(f,e=>{let{href:n}=e;return a.startsWith(n)});return(0,i.jsx)(x.m,{index:g,children:(0,i.jsxs)(m.t,{children:[(0,i.jsx)(l.x,{flex:"1",display:"flex",children:f.map(e=>{let{name:n,href:t,badge:l,disable:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{d(t)},isDisabled:s||u||r,hidden:r,children:[n,l]},n)})}),!s&&!e&&(0,i.jsx)(rv,{}),!s&&(0,i.jsxs)(o.k,{flex:"1",justifyContent:"right",alignItems:"center",mr:"8px",children:[r&&(0,i.jsx)(rk,{}),(0,i.jsx)(re,{}),(0,i.jsx)(i4,{})]})]})})}function rR(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=n0(),[r]=(0,eA.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(tw,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(l.x,{style:{contain:"size"},children:o&&(0,i.jsx)(ra,{})}),(0,i.jsxs)(tC,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,i.jsxs)(l7,{children:[(0,i.jsx)(rw,{path:"/lineage",children:(0,i.jsx)(rn,{})}),(0,i.jsxs)(eA.rs,{children:[(0,i.jsx)(eA.AW,{path:"/query",children:(0,i.jsx)(l1,{})}),(0,i.jsx)(eA.AW,{path:"/checks/:slug*",children:(0,i.jsx)(lY,{})}),(0,i.jsx)(eA.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(l9,{runId:n})}}),(0,i.jsx)(eA.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eA.AW,{children:(0,i.jsx)(eA.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(iR,{onClose:t}):(0,i.jsx)(l.x,{})]})]})}let rE=(0,g.B1)({components:{Checkbox:rx,Tooltip:rm}});function rT(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=eu.env.AMPLITUDE_API_KEY;if(n&&t)try{ec.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,l6.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(l3.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rE,children:(0,i.jsx)(b.aH,{client:Z,children:(0,i.jsx)(eA.F0,{hook:l4,children:(0,i.jsx)(n1,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(r_,{}),(0,i.jsx)(rz,{}),(0,i.jsx)(rl,{}),(0,i.jsx)(rR,{})]})})})})})})}},92075:function(){},74229:function(){},54351:function(){},57920:function(){}},function(e){e.O(0,[32,524,434,678,509,648,989,147,995,739,283,303,22,25,355,495,599,852,323,95,312,744],function(){return e(e.s=53770)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/app/page-ce314ab95f8c9bf7.js b/recce/data/_next/static/chunks/app/page-ce314ab95f8c9bf7.js deleted file mode 100644 index 29565459..00000000 --- a/recce/data/_next/static/chunks/app/page-ce314ab95f8c9bf7.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{53770:function(e,n,t){Promise.resolve().then(t.bind(t,53202))},53202:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rE}});var i=t(9651),l=t(25752),r=t(68345),s=t(10037),o=t(80474),a=t(29626),d=t(52764),c=t(29455),u=t(72875),h=t(90037),x=t(95644),m=t(80735),p=t(22183),f=t(95170),g=t(33899),v=t(31794),j=t(56233),y=t(58714),b=t(38756);let k='select * from {{ ref("mymodel") }}',w=(0,j.createContext)({sqlQuery:k,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:k,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=j.useState(k),[r,s]=j.useState(k),[o,a]=j.useState(!1),[d,c]=j.useState();return(0,i.jsx)(w.Provider,{value:{setSqlQuery:l,sqlQuery:t,setPrimaryKeys:c,primaryKeys:d,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:r,setBaseSqlQuery:s},children:n})}let _=()=>(0,j.useContext)(w),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=j.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:l},children:n})}var R=t(70867);function E(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,l={},r=(e,t)=>{if(!(t<0)&&(void 0===l[e]||!(l[e]>=t))){for(let i of(l[e]=t,n(e)))r(i,t-1);i.add(e)}};for(let n of e)r(n,t);return i}function T(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var I=t(85688),D=t.n(I);function L(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function O(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function M(e,n){return n?e.impactedSet:O(e,e.modifiedSet)}function A(e,n){let t=[],i=[];function l(e){return"base"===e?0:"current"===e?2:1}function r(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(r))(!s||s.has(n.id))&&t.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(r))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return F(t,i),[t,i]}let F=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(D()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),D().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function q(e,n,t){let i=new Set(e),l=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}))]}function N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function V(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function H(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function P(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let W={lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"],flag:()=>["flag"]};var K=t(26363),B=t(94916);let J=B.env.NEXT_PUBLIC_API_URL?B.env.NEXT_PUBLIC_API_URL:window.location.origin;var U=t(93192);let Q=K.default.create({baseURL:J}),Z=new U.S;async function X(){return(await Q.get("/api/info")).data}async function G(e){return(await Q.get("/api/model/".concat(e))).data}var Y=t(81614),$=t(73263),ee=t(76931),en=t(52344),et=t(71106),ei=t(82043),el=t(29978),er=t(19563),es=t(65185),eo=t(89243),ea=t(6393),ed=t.n(ea),ec=t(91501),eu=t(94916);function eh(e){ec.j("[Web] multi_nodes_action",e)}function ex(e){ec.j("[Web] history_action",e)}function em(e){ec.j("[Experiment] preview_change",e)}function ep(e){ec.j("[Experiment] preview_change",e)}function ef(e){ec.j("[Experiment] single_environment",e)}function eg(e){ec.j("[Experiment] recommend_preset_check",e)}let ev=!1;async function ej(e,n,t){let i=ev?{breaking_change_analysis:!0}:{};return(await Q.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait,track_props:i})).data}async function ey(e,n){return(await Q.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function eb(e){return await Q.post("/api/runs/".concat(e,"/cancel"))}async function ek(e,n){return(await Q.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ew(e,n,t){return(await Q.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function eC(){return(await Q.get("/api/runs")).data}async function e_(){return(await Q.post("/api/runs/aggregate",{})).data}async function eS(){return(await Q.get("/api/flag")).data}async function ez(){try{await Q.post("/api/onboarding/completed")}catch(e){}}async function eR(){try{await Q.post("/api/relaunch-hint/completed")}catch(e){}}let eE=()=>(0,y.a)({queryKey:W.flag(),queryFn:eS}),eT=(0,j.createContext)({isActionAvailable:()=>!0});function eI(e){var n,t,l;let{children:r}=e,s=(0,y.a)({queryKey:W.lineage(),queryFn:X}),o=(0,y.a)({queryKey:W.runsAggregated(),queryFn:e_}),a=(0,j.useMemo)(()=>{var e;let n=null===(e=s.data)||void 0===e?void 0:e.lineage;if(n&&n.base&&n.current)return function(e,n,t){let i={},l={},r=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,t]of Object.entries(e.nodes))i[n]=r(n,"base"),t&&(i[n].data.base=t,i[n].name=null==t?void 0:t.name,i[n].resourceType=null==t?void 0:t.resource_type,i[n].packageName=null==t?void 0:t.package_name);for(let[e,t]of Object.entries(n.nodes))i[e]?i[e].from="both":i[e]=r(e,"current"),t&&(i[e].data.current=n.nodes&&n.nodes[e],i[e].name=null==t?void 0:t.name,i[e].resourceType=null==t?void 0:t.resource_type,i[e].packageName=null==t?void 0:t.package_name);for(let[n,t]of Object.entries(e.parent_map))for(let e of t){let t=i[n],r=i[e],s="".concat(e,"_").concat(n);if(!t||!r)continue;l[s]={id:s,from:"base",parent:r,child:t};let o=l[s];t.parents[e]=o,r.children[n]=o}for(let[e,t]of Object.entries(n.parent_map))for(let n of t){let t=i[e],r=i[n],s="".concat(n,"_").concat(e);if(!t||!r)continue;l[s]?l[s].from="both":l[s]={id:s,from:"current",parent:r,child:t};let o=l[s];t.parents[n]=o,r.children[e]=o}let s=[],o=[],a=[];for(let[e,n]of Object.entries(i))if(t){let i=t[e];i&&(n.changeStatus=i.change_status,s.push(e),"non-breaking"===i.change_category?o.push(e):a.push(e))}else if("base"===n.from)n.changeStatus="removed",s.push(n.id);else if("current"===n.from)n.changeStatus="added",s.push(n.id);else{var d,c,u,h,x,m;let t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(c=u.base)||void 0===c?void 0:null===(d=c.checksum)||void 0===d?void 0:d.checksum,i=null==n?void 0:null===(m=n.data)||void 0===m?void 0:null===(x=m.current)||void 0===x?void 0:null===(h=x.checksum)||void 0===h?void 0:h.checksum;t&&i&&t!==i&&(n.changeStatus="modified",s.push(n.id),a.push(e))}for(let[e,n]of Object.entries(l))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");let p=T(new Set(s),E(a,e=>void 0===i[e]?[]:Object.keys(i[e].children)));return{nodes:i,edges:l,modifiedSet:s,nonBreakingSet:new Set(o),impactedSet:p,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}}}(n.base,n.current,n.diff)},[s.data]),d=null===(n=s.error)||void 0===n?void 0:n.message,{lineage:c,sqlmesh:u,demo:h,review_mode:x,cloud_mode:m,file_mode:p,filename:f,adapter_type:g,git:v,pull_request:k,support_tasks:w}=s.data||{},C=null==c?void 0:null===(t=c.base)||void 0===t?void 0:t.manifest_metadata,_=null==c?void 0:null===(l=c.current)||void 0===l?void 0:l.manifest_metadata,{connectionStatus:S,connect:z,envStatus:R}=function(){let e=(0,Y.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending"),[l,r]=(0,j.useState)(void 0);n.current.status=t;let s=(0,b.NL)(),o=()=>{s.invalidateQueries({queryKey:W.lineage()}),s.invalidateQueries({queryKey:W.checks()}),s.invalidateQueries({queryKey:W.runs()})},a=()=>{let t=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&o(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[l,r]=i.split("/").slice(-2),s=ed().parse(r).name,a="".concat(l,"-").concat(s,"-").concat(t);e.isActive(a)||e({id:a,description:"Detected ".concat(l," ").concat(s," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),o()}else"relaunch"===n.command&&r("relaunch")}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return a(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:a,envStatus:l}}(),{data:I,isLoading:D}=eE(),{onClose:L}=(0,$.q)(),[O,M]=(0,j.useState)(!1),A=(0,b.NL)(),F=(0,j.useCallback)(e=>{if(w){var n;return null===(n=w[e])||void 0===n||n}return!0},[w]);return(0,j.useEffect)(()=>{D||("relaunch"===R&&(null==I?void 0:I.single_env_onboarding)&&(null==I?void 0:I.show_relaunch_hint)?(M(!0),ef({action:"target_base_added"})):M(!1))},[I,R,D]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eT.Provider,{value:{lineageGraph:a,retchLineageGraph:()=>{o.refetch()},envInfo:{adapterType:g,git:v,pullRequest:k,dbt:{base:C,current:_},sqlmesh:u},reviewMode:x,cloudMode:m,fileMode:p,fileName:f,isDemoSite:h,error:d,supportTasks:w,isActionAvailable:F,isLoading:s.isLoading,runsAggregated:o.data,refetchRunsAggregated:()=>{o.refetch()}},children:r}),(0,i.jsxs)(ee.u_,{isOpen:"disconnected"===S,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Server Disconnected"}),(0,i.jsx)(el.f,{children:(0,i.jsx)(er.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{z()},children:"Retry"})})]})]}),(null==I?void 0:I.single_env_onboarding)&&(0,i.jsxs)(ee.u_,{isOpen:O,onClose:()=>{L(),eR(),A.invalidateQueries({queryKey:W.flag()})},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Target-base Added"}),(0,i.jsx)(el.f,{children:(0,i.jsx)(er.x,{children:"Please restart the Recce server."})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{L(),eR(),A.invalidateQueries({queryKey:W.flag()})},children:"Got it!"})})]})]})]})}let eD=()=>(0,j.useContext)(eT),eL=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eD();return[e,n]};var eO=t(23164);let eM=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:d,RunForm:c}=e,[u,h]=(0,j.useState)(d),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ei.x,{children:a}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(l.x,{style:{contain:"layout"},children:c&&(0,i.jsx)(c,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(eo.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var eA=t(50393),eF=t(38257),eq=t(96084),eN=t(42274),eV=t(46075),eH=t(45837),eP=t.n(eH);function eW(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 eK=e=>{var n;let{lineageGraph:t}=eD(),[i,l]=(0,j.useState)([]),[r,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[d,c]=(0,j.useState)(null),u=eP().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eW(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await G(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){l([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);l(eW(n,t))}catch(e){c(e)}};h.length>0?(l(h),s(x)):(null==u?void 0:u.id)===void 0?l([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:r,isLoading:o,error:d}};function eB(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eJ(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}var eU=t(2992),eQ=t(45637),eZ=t(14715);function eX(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 eG(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,l=n>=1e9,r=n>=1e15;if(r||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:r?0:2}).format(e/1e12).replace("L","T");if(l||i||n>=1e3){let n={base:l?1e9:i?1e6:1e3,unit:l?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eY="#63B3ED",e$="#F6AD55",e0="".concat(eY,"A5"),e1="".concat(e$,"A5");function e5(e){let{color:n}=e;return(0,i.jsx)(l.x,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function e2(e){let{data:n,hideAxis:t=!1,animation:l=!1}=e;eQ.kL.register(eQ.ZL,eQ.RM,eQ.f$,eQ.uw,eQ.Dx,eQ.De,eQ.u);let r=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:i,datasets:l,type:r,samples:s=0,binEdges:o}=e,[a,d]=l,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{reverse:!0},title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=e6(o,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,l=0===n?d.counts:a.counts,r=eX(l[t]/s),o=l[t];return"".concat(i,": ").concat(o," (").concat(r,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:l,binEdges:r}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,d=Math.max(...a.counts,...o.counts),c=r.map((e,n)=>e6(r,n)).slice(0,-1);return{x:"datetime"===l?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>c[n]},stacked:!0},y:{display:!s,type:"linear",max:d,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eG(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:l}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[l,r]=n,s=e4(t,i,"Current",e0,r),o=e4(t,i,"Base",e1,l);return{labels:i.map((e,n)=>e6(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eZ.kL,{type:"bar",options:r,data:s,plugins:[]})}function e4(e,n,t,i,l){let{counts:r=[]}=l;return{label:t,data:"datetime"===e?r.map((e,t)=>({x:n[t],y:e})):r,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function e6(e,n){let t=e[n],i=e[n+1],l=eG(t),r=eG(i);return"".concat(l," - ").concat(r)}let e3=(0,eU.G)((e,n)=>{let{backgroundColor:t="white",blockSize:r,children:s,...o}=e;return(0,i.jsx)(l.x,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(l.x,{backgroundColor:t,height:"100%",blockSize:r,children:s})})}),e9=(0,eU.G)(function(e,n){var t,r,s,a,d,c;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(r=x.result)||void 0===r?void 0:r.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(d=x.result)||void 0===d?void 0:d.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(e3,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.x,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(e2,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(c=x.params)||void 0===c?void 0:c.column_type)||"",datasets:[p,f],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var e8=t(45697);t(94095);var e7=t(42922);let ne=(0,eU.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e7.ZP,{ref:n,...t})})});function nn(){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)(er.x,{fontWeight:"600",children:" No rows"})})}t(74229);var nt=t(95347);function ni(e,n){let t=function(e,n){let t=[...e],i=[...n],l=[];for(;t.length>0&&i.length>0;)if(l.includes(t[0]))t.shift();else if(l.includes(i[0]))i.shift();else if(t[0]===i[0])l.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{l.includes(e)||l.push(e)}),i.forEach(e=>{l.includes(e)||l.push(e)}),l}(e,n),i={};for(let l of t)e.includes(l)?n.includes(l)?i[l]=void 0:i[l]="removed":i[l]="added";let l={};e.forEach((e,n)=>{l[e]=n});let r=-1;for(let e of t){let n=l[e];void 0!==n&&(n>r?r=n:i[e]="reordered")}return i}function nl(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 nr(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}function ns(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&r&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?nt.ven:nt.MhP,onClick:h?()=>{let e=c.filter(e=>e!==n);r&&r(e)}:()=>{let e=[...c.filter(e=>"index"!==e),n];r&&r(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?nt.$kI:nt.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let no=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]},na=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(er.x,{style:{color:"gray"},children:"-"});let[l,r]=no(n[t.key]);return(0,i.jsx)(er.x,{style:{color:r?"gray":"inherit"},children:l})};function nd(e,n,t){let l=e||{columns:[],data:[]},r=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,d=[],c=function(e,n){let t={};return Object.entries(ni(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[l,r]=i;t[l]={status:r,baseColumnIndex:e.columns.findIndex(e=>e.name===l),currentColumnIndex:n.columns.findIndex(e=>e.name===l)}}),t}(l,r),u={},h={},x=!1,m=!1;if(0===s.length)l.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nl(l.columns,s);l.data.forEach((n,t)=>{let i=nr(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nl(r.columns,s),r.data.forEach((n,t)=>{let i=nr(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=ni(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(c))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eP().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eP().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(ns,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"}]}};return 0===s.length?d.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=c[e].status||"";d.push({key:"".concat(e),name:(0,i.jsx)(ns,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:na})}),o.forEach(e=>{let n=c[e].status||"";"index"===e||s.includes(e)||d.push(v(e,n))}),Object.entries(c).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||d.push(v(n,i))}),{columns:d,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let nc=(0,eU.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==d?void 0:d.name)||"column_name",u=(0,j.useMemo)(()=>nd(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}),[o,c,a,r,s]);return 0===u.columns.length?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function nu(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{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?nt.$kI:nt.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nh(e,n,t){let l=(null==t?void 0:t.pinnedColumns)||[],r=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},d={};if(0===n.length)throw Error("Primary keys are required");let c=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}(e.columns,c,n);n[u]&&(a[i]=n),n[h]&&(d[i]=n)});let x=ni(Object.keys(a),Object.keys(d)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,l]=t,r=a[i],s=d[i],c=JSON.parse(i);if(r&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["base__".concat(e.name)]=r[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["current__".concat(e.name)]=s[t])}),r){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(eP().isEqual(r[t.index],s[t.index])||(c.__status="modified",t.status="modified"));else c.__status="removed",m.removed++}else c.__status="added",m.added++;return"modified"===c.__status&&m.modified++,c});r&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eP().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(nu,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e7.Ug,headerCellClass:l,cellClass:r,renderCell:na,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(nu,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:na})}),l.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||l.includes(t)||r&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nx=t(27904),nm=t(41152),np=t(65906);let nf=e=>{let{run:n,warnings:t,viewOptions:r,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nm.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.x,{children:[(0,i.jsx)(nx.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(np.X,{isChecked:null==r?void 0:r.changed_only,onChange:()=>{let e=!(null==r?void 0:r.changed_only);a&&a({...r,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(eo.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},ng=(e,n)=>{var t,l,r,s,a,d;let{run:c,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x,baseTitle:m,currentTitle:p}=e,f=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),g=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),v=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),y=(0,j.useMemo)(()=>{var e,n;return nd(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:g,primaryKeys:f,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:v,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})},baseTitle:m,currentTitle:p})},[c,h,g,f,v,x,m,p]),b=(0,j.useMemo)(()=>{let e=f.join(", ");return y.invalidPKeyBase&&y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):y.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[y.invalidPKeyBase,y.invalidPKeyCurrent,f]),k=(null===(l=c.result)||void 0===l?void 0:null===(t=l.current)||void 0===t?void 0:t.limit)||0,w=k>0&&((null==c?void 0:null===(s=c.result)||void 0===s?void 0:null===(r=s.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(d=c.result)||void 0===d?void 0:null===(a=d.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(k.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,C=[];return(b&&C.push(b),w&&C.push(w),0===y.columns.length)?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):g&&0===y.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:C}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:C}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:y.columns,rows:y.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nv=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:d,viewOptions:c,onViewOptionsChanged:u,baseTitle:h,currentTitle:x}=e,m=(0,j.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),p=(0,j.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),f=(0,j.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nh(null==a?void 0:a.result.diff,t,{changedOnly:m,pinnedColumns:p,onPinnedColumnsChange:e=>{u&&u({...c,pinned_columns:e})},baseTitle:h,currentTitle:x})},[a,c,m,p,u,h,x]),g=(null===(l=a.result)||void 0===l?void 0:null===(t=l.diff)||void 0===t?void 0:t.limit)||0,v=g>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(r=s.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(g.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,y=[];return(v&&y.push(v),0===f.columns.length)?(0,i.jsx)(e8.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)(nf,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:y}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:y}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:f.columns,rows:f.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nj=(0,eU.G)((e,n)=>{var t,l,r;let s,o;if((null===(t=e.run)||void 0===t?void 0:t.params)&&(null===(l=e.run)||void 0===l?void 0:l.params).current_model&&(s="Original",o="Editor"),(null===(r=e.run)||void 0===r?void 0:r.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eU.G)(nv);return(0,i.jsx)(t,{...e,ref:n,baseTitle:s,currentTitle:o})}{let t=(0,eU.G)(ng);return(0,i.jsx)(t,{...e,ref:n,baseTitle:s,currentTitle:o})}});function ny(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:r=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(l.x,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?nt.$kI:nt.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let nb=(0,eU.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,d=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),c=null==t?void 0:t.result,u=(0,j.useMemo)(()=>c?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(ny,{name:t,...n}),width:"auto",renderCell:na});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eP().findIndex(e.columns,e=>e.name===n);i<0||t.push(r(i,n))}),e.columns.forEach((e,n)=>{l.includes(e.name)||t.push(r(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(c,{pinnedColumns:d,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}):{rows:[],columns:[]},[c,d,r,s]);if(0===u.columns.length)return(0,i.jsx)(e8.M,{height:"100%",children:"No data"});let x=(null==c?void 0:c.limit)||0,m=x>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nx.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.x,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(eo.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function nk(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 nw=t(51818),nC=t.n(nw);let n_=(0,eU.G)(function(e,n){let{run:t}=e;function l(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nC()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nC()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="=";return null!==t&&null!==i?l=t!==i?nk(t,i):"=":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===s.length?(0,i.jsx)(e8.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)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:l},{key:"base",name:"Base Rows",cellClass:l},{key:"current",name:"Current Rows",cellClass:l},{key:"delta",name:"Delta",cellClass:l}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},className:"rdg-light",enableScreenshot:!0})})})});var nS=t(88692),nz=t(60287);let nR="#63B3ED";function nE(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),l=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([l]).map((n,t)=>{let r;let s=t===i.length,o=s?l:i[t],a=!1;return s?(r="(others)",a=!0):null==n?(r="(null)",a=!0):"string"==typeof n&&0===n.length?(r="(empty)",a=!0):r=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:r,count:o,displayCount:eG(o),displayRatio:eX(o/e.valids)||"N/A"}})}function nT(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nS.u,{label:(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(er.x,{children:[(0,i.jsx)(e5,{color:eY}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(er.x,{children:[(0,i.jsx)(e5,{color:e$}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function nI(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=nE(n.current,t),s=nE(n.base,t);return(0,i.jsxs)(l.x,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(er.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e5,{color:e$})," Base"]}),(0,i.jsxs)(er.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e5,{color:eY})," Current"]}),(0,i.jsx)(h.L,{})]}),r.map((e,t)=>{let l=s[t];return e.isLastItemOthers&&0===e.count&&0===l.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(j.Fragment,{children:[(0,i.jsx)(nT,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(er.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)(nD,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eY}),(0,i.jsx)(er.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(er.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nD,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:e$}),(0,i.jsx)(er.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(er.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(nz.i,{})]},t)})]})}function nD(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=nR}=e;eQ.kL.register(eQ.uw,eQ.ZL,eQ.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,l,{animation:r}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nR}=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)(eZ.$Q,{data:a,options:o,plugins:[]})}let nL=(0,eU.G)((e,n)=>{let{run:t}=e,[l,s]=(0,j.useState)(!0),a=t.result,c=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e3,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(d.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",c.model,".",c.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nI,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:l}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(r.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:l?"View More Items":"View Only Top-10"})})]})}),nO=(0,eU.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:d}=e,c=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nh(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:u,onPinnedColumnsChange:e=>{d&&d({...a,pinned_columns:e})}})},[r,a,c,u,d]),x=(null===(t=r.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==r?void 0:null===(l=r.result)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(e8.M,{height:"100%",children:"No data"}):c&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e8.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nf,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nM=t(51609),nA=t(56662);function nF(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,j.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,d=null==n?void 0:n.primary_key,{columns:c,primaryKey:u,isLoading:h,error:x}=eK(n.model);(0,j.useEffect)(()=>{!d&&u&&t({...n,primary_key:u})},[d,u,n,t]),(0,j.useEffect)(()=>{r(!!d&&!!a)},[d,a,r]);let m=c.map(e=>e.name),p=Array.isArray(d)?d:d?[d]:void 0;return h?(0,i.jsx)(l.x,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nm.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Model"}),(0,i.jsx)(nM.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Primary key"}),(0,i.jsx)(nA.Ph,{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)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Columns"}),(0,i.jsx)(np.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nA.Ph,{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 nq=t(43215),nN=t(55055),nV=t(60651),nH=t(38371),nP=t(62885),nW=t(88936),nK=t(11636);function nB(e){let{params:n,column:t}=e,{runAction:r}=n0(),a=(e,t)=>{r("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nH.h,{children:(0,i.jsx)(nP.q,{lineHeight:"20px",children:(0,i.jsxs)(nW.k,{title:"Action",as:l.x,fontSize:"8pt",children:[(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nK.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}let nJ=(0,eU.G)(function(e,n){let{run:t}=e,r=t.result,a=t.params,d=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e8.M,{height:"100%",children:c.includes(n[0])&&(0,i.jsx)(s.J,{as:nt.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nB,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:d},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,r=t[n.key];return(0,i.jsx)(l.x,{textAlign:"end",children:void 0!=r&&null!==r?"".concat((100*r).toFixed(2)," %"):"N/A"})},cellClass:d}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(l.x,{px:"16px",children:["Model: ",a.model,", ",r.summary.total," total (",r.summary.total-r.summary.added-r.summary.removed," ","common, ",r.summary.added," added, ",r.summary.removed," removed)"]}),(0,i.jsx)(ne,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nU=t(54517),nQ=t(27342);let nZ={lineage_diff:{title:"Lineage Diff",icon:eF.Ks7},schema_diff:{title:"Schema Diff",icon:nQ.C8A},query:{title:"Query",icon:eF.r2i,RunResultView:nb},query_base:{title:"Query Base",icon:eF.r2i,RunResultView:nb},query_diff:{title:"Query Diff",icon:eF.r2i,RunResultView:nj},row_count_diff:{title:"Row Count Diff",icon:nQ.QUK,RunResultView:n_},profile_diff:{title:"Profile Diff",icon:eF.KA6,RunResultView:nc},value_diff:{title:"Value Diff",icon:eF.pRi,RunResultView:nJ,RunForm:nF},value_diff_detail:{title:"Value Diff Detail",icon:eF.pRi,RunResultView:nO,RunForm:nF},top_k_diff:{title:"Top-K Diff",icon:nU.Pkc,RunResultView:nL,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eK(n.model),d=s.map(e=>e.name);return((0,j.useEffect)(()=>{r(!!n.column_name)},[n,r]),o)?(0,i.jsx)(l.x,{children:"Loading..."}):0===d.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eV.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:d.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:eF.dku,RunResultView:e9,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eK(n.model),d=s.filter(e=>!eB(e.type)&&!eJ(e.type));return o?(0,i.jsx)(l.x,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eq.NI,{children:[(0,i.jsx)(eN.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eV.P,{placeholder:0!==d.length?"Select column":"No numeric column is available",isDisabled:0===d.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let l=e.target.value;r(!!l);let s=(null===(i=d.find(e=>e.name===l))||void 0===i?void 0:i.type)||"";t({...n,column_name:l,column_type:s})},children:d.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}},sandbox:{title:"Sandbox",icon:eF.iQd}},nX=e=>nZ[e],nG=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{},clearRunResult:()=>{}}),nY=e=>{let[n]=(0,eA.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function n$(e){var n;let{children:t}=e,[l,r]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,$.q)(),{isOpen:d,onOpen:c,onClose:u}=(0,$.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,$.q)(),p=(0,Y.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eA.TH)(),k=(0,b.NL)(),w=(0,j.useCallback)((e,n)=>{g(e),c(),!1!==n&&k.invalidateQueries({queryKey:W.runs()})},[g,c,k]),C=(0,j.useCallback)(()=>{g(void 0),u()},[u,g]),_=(0,j.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ew(e,n,1);1===t.length&&(i=t[0])}let s=nX(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:d,RunForm:c}=s;if(void 0===d)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==c&&(null==t?void 0:t.showForm))r({session:l,title:a,type:e,params:n,lastRun:i,options:t,RunForm:c}),o();else{let{run_id:t}=await ej(e,n,{nowait:!0});w(t),k.invalidateQueries({queryKey:W.runs()}),v.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[r,o,w,p,v,y,k]);nY(a);let S=async(e,n)=>{try{a();let{run_id:t}=await ej(e,n,{nowait:!0});w(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nG.Provider,{value:{runAction:_,runId:f,showRunId:w,isRunResultOpen:d,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x,clearRunResult:C},children:[l&&(0,i.jsx)(eM,{isOpen:s,onClose:a,onExecute:S,title:l.title,type:l.type,params:l.params,initialRun:l.lastRun,RunForm:(null===(n=l.options)||void 0===n?void 0:n.showForm)&&l.RunForm?l.RunForm:void 0},l.session),t]})}let n0=()=>(0,j.useContext)(nG);function n1(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eI,{children:(0,i.jsx)(z,{children:(0,i.jsx)(n$,{children:n})})})})})}async function n5(){return(await Q.post("/api/checks",{type:"simple"})).data}async function n2(e,n){let t=ev?{breaking_change_analysis:!0}:{};return(await Q.post("/api/checks",{run_id:e,view_options:n,track_props:t})).data}async function n4(){return(await Q.get("/api/checks")).data}async function n6(e){return(await Q.get("/api/checks/".concat(e))).data}async function n3(e,n){return(await Q.patch("/api/checks/".concat(e),n)).data}async function n9(e){return(await Q.delete("/api/checks/".concat(e))).data}async function n8(e){return await Q.post("/api/checks/reorder",e)}var n7=t(37983),te=t(50437),tn=t(32392),tt=t(74917),ti=t(10649),tl=t(83890),tr=t(95133),ts=t(28378),to=t(62004),ta=t(74327),td=t(16725),tc=t(64863),tu=t(49431),th=t(64529),tx=t(77138);function tm(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),d=(0,j.useRef)(null),c=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,d,c]),(0,i.jsx)(tu.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(tx.X,{color:"gray.500"}),overflow:"hidden",children:(0,i.jsx)(th.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(nM.I,{ref:d,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:"100%"}):(0,i.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var tp=t(98702);function tf(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:d}=n0(),c=a||r,u=()=>{d("histogram_diff",{model:n,column_name:t,column_type:c},{showForm:!1})},x=()=>{d("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!r||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nq.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nN.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nH.h,{children:(0,i.jsx)(nP.q,{lineHeight:"20px",children:(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:u,isDisabled:m||!c||!(!eB(c)&&!eJ(c)),children:"Histogram Diff"}),(0,i.jsx)(nK.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tg(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function l(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:l}=e;return n?(0,i.jsx)(tf,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:l},{key:"currentType",name:"Current Type",resizable:!0,cellClass:l}],rows:Object.values(e)}}t(54351);var tv=t(30028),tj=t(22593);let ty=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:a=!1}=e,{columns:d,rows:c}=(0,j.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(ni(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,l]=e;t[i].baseIndex=n+1,t[i].baseType=l.type}),Object.entries(n).map((e,n)=>{let[i,l]=e;t[i].currentIndex=n+1,t[i].currentType=l.type}),t}(null==r?void 0:r.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tg(e,(null==s?void 0:s.name)||(null==r?void 0:r.name)):tg(e)},[r,s]),{lineageGraph:u}=eD(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=r&&void 0===r.columns,p=s&&void 0===s.columns;return m&&p?l="Schema information is missing on both current and base environments.":m?l="Schema information is missing on base environment.":p&&(l="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(tv.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tj.z,{}),t]}):l?(0,i.jsxs)(tv.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tj.z,{}),l]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(ne,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:d,rows:c,renderers:{noRowsFallback:(0,i.jsx)(nn,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tb(e){return(await Q.post("/api/select",e)).data}var tk=t(39556);t(57920);let tw=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tk.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},tC=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tk.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var t_=t(15240),tS=t(57038),tz=t(45584);let tR=nt.Nbv,tE=nt.sFB,tT=nt.UGs;function tI(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:tR}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tE}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tT}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tD(e){if("model"===e)return{color:"#c0eafd",icon:tS.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tz._MV};if("source"===e)return{color:"#a6dda6",icon:tS.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tz.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tz.R1C};if("seed"===e)return{color:"#a6dda6",icon:tS.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tS.Dmm};else return{color:"inherit",icon:void 0}}function tL(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:r,selected:a,onSelect:d,schemaChanged:c}=e,{icon:u}=tD(r.resourceType),{base:h,current:x}=r.data;if(c){var m;n=null===(m=nX("schema_diff"))||void 0===m?void 0:m.icon,t=tI("modified").color}else!h&&x?(n=tI("added").icon,t=tI("added").color):h&&!x&&(n=tI("removed").icon,t=tI("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:()=>d(r.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})},tM=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=eD(),r=t.params,s=[...W.check(t.check_id),"select"],{isLoading:o,error:a,refetch:d,data:c}=(0,y.a)({queryKey:s,queryFn:async()=>tb({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude,packages:null==r?void 0:r.packages,view_mode:null==r?void 0:r.view_mode}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==r?void 0:r.node_id)for(let n of r.node_id instanceof Array?r.node_id:[r.node_id]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}else for(let n of(null==c?void 0:c.nodes)||[]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tL(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function d(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=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,l]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tO,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tA=t(60772);function tF(e){let{value:n,onChange:t}=e,[l,s]=(0,j.useState)(!1),[a,d]=(0,j.useState)(),c=(0,j.useRef)(null),u=()=>{t&&(t(a),s(!1))};return((0,j.useEffect)(()=>{if(l&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[l]),l)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tA.g,{value:a,onChange:e=>{d(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),u())},ref:c,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(eo.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:u,children:"Update"})]})]}):(0,i.jsx)(er.x,{height:"100%",overflow:"auto",fontSize:"11pt",onClick:()=>{d(n||""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tq=t(54238);function tN(){let e=(0,Y.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}function tV(){let e=(0,n7._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tV=function(){return e},e}function tH(e){return e.description?e.description:"_(no description)_"}var tP=t(35852),tW=t(92071);let tK=e=>{let{value:n,onChange:t,onRun:l,onRunBase:r,onRunDiff:a,label:d,options:c={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(d||l||r)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(er.x,{as:"b",children:d?d.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(eo.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tz.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tW.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,l),r&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,r),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...c}})]})},tB=e=>{let{value:n,baseValue:t,onChange:l,onChangeBase:r,onRun:s,onRunBase:a,onRunDiff:d,options:c={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tP.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tK,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:c,...u})}),(0,i.jsx)(tP.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tK,{label:"Current",value:n,onChange:l,onRun:s,options:c,...u})})]})})};var tJ=t(86562),tU=t(36807);let tQ=(0,eU.G)((e,n)=>{var t,r,s,a;let{isRunning:d,isAborting:c,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(r=h.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tv.b,{status:"error",children:[(0,i.jsx)(tj.z,{}),"Error: ",y]});if(void 0!==d?d:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(e8.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nm.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)(tJ.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tJ.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)(eo.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tU.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tZ=t(28376),tX=t(87704),tG=t(72581),tY=t(71736),t$=t(29128),t0=t(11359),t1=t(55329),t5=t(32554),t2=t(95534),t4=t(76675),t6=t(17810),t3=t(99413);t(34336),t(92075);var t9=t(96054),t8=t(53009),t7=t(19867),ie=t(33059);function it(e){let{node:n}=e,{icon:t}=tD(n.resourceType);return(0,i.jsx)(nS.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(te.Vp,{children:[(0,i.jsx)(te.AD,{as:t}),(0,i.jsx)(te.Sn,{children:n.resourceType})]})})}function ii(e){let{rowCount:n}=e,t=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===l?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(er.x,{children:r}),(0,i.jsx)(s.J,{as:t7.Rgz}),(0,i.jsx)(er.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(er.x,{children:o}),(0,i.jsx)(s.J,{as:ie.lxc,color:"gray.500"}),(0,i.jsx)(er.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nS.u,{label:r,children:(0,i.jsxs)(te.Vp,{children:[(0,i.jsx)(te.AD,{as:x}),(0,i.jsx)(te.Sn,{children:m||d?(0,i.jsx)(t8.N,{isLoaded:!d,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(ii,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(te.bq,{as:nV.h,isLoading:d,"aria-label":"Query Row Count",icon:(0,i.jsx)(ta.n,{}),size:"xs",onClick:a})]})})}let ir=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tJ.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsx)(te.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.x,{children:"Skipped"}),s&&(0,i.jsx)(nS.u,{label:s,children:(0,i.jsx)(t9.s,{})})]})});if(!a)return(0,i.jsx)(tJ.D,{isIndeterminate:!0,size:"20px"});let{error:d,result:c,run_id:u,progress:h}=a;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tJ.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tJ.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(d)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.x,{children:"Error"}),s&&(0,i.jsx)(nS.u,{label:d,children:(0,i.jsx)(nx.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(te.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(te.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)(il,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},is=(0,j.createContext)(void 0),io=()=>{let e=(0,j.useContext)(is);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e};function ia(e){var n;let t,l,{rowCount:r}=e,s=r.base,o=r.curr,a=null===r.base?"N/A":"".concat(r.base," Rows"),d=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===s&&null===o?(t="Failed to load",l="gray"):null===s||null===o?(t="".concat(a," -> ").concat(d),l=null===s?"green":"red"):s===o?(t="=",l="gray"):s!==o&&(t="".concat(nk(s,o)," Rows"),l=s{var n,t,r;let a,d,{id:c,inverted:u}=e,{lineageGraph:x,runsAggregated:m}=eD(),p=null==m?void 0:m[c],f=null==x?void 0:x.nodes[c];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(a=tL(null===(t=f.data.base)||void 0===t?void 0:t.columns,null===(r=f.data.current)||void 0===r?void 0:r.columns)),p&&p.row_count_diff){let e=p.row_count_diff;d=e.result.curr!==e.result.base}let g=u?"white":tI("modified").color;return(0,i.jsxs)(o.k,{flex:"1",children:[void 0!==a&&(0,i.jsx)(nS.u,{label:"Schema (".concat(a?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nX("schema_diff"))||void 0===n?void 0:n.icon,color:a?g:u?"gray":"lightgray"})})}),(0,i.jsx)(h.L,{}),p&&p.row_count_diff&&void 0!==d&&(0,i.jsx)(nS.u,{label:"Row count (".concat(d?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(l.x,{children:(0,i.jsx)(ia,{rowCount:p.row_count_diff.result})})})]})},ic=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tS.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tS.hGI})})};var iu=t(76810),ih=t(77712),ix=t(46929);function im(e){let{base:n,current:t}=e;return(0,i.jsx)(tW.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"}})}function ip(e){let{current:n,onChange:t}=e,r=function(e,n){let t=(0,j.useRef)(null);return(0,j.useEffect)(()=>{t.current&&e!==t.current.getValue()&&t.current.setValue(e)},[e]),{onMount(e){let i=e.getModifiedEditor();t.current=i,i.onDidChangeModelContent(()=>{n(i.getValue())})}}}((null==n?void 0:n.raw_code)||"",t);return(0,i.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,i.jsx)(tW.SV,{language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==n?void 0:n.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,wordWrap:"on",wrappingIndent:"same",renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:r.onMount})})}async function ig(e){return(await Q.post("/api/checks",{type:"schema_diff",params:e})).data}let iv={audit_helper:"Require the dbt package 'dbt-labs/audit_helper'. Please install it and re-run dbt to activate this feature.",dbt_profiler:"Require the dbt package 'data-mie/dbt_profiler'. Please install it and re-run dbt to activate this feature.",add_or_remove:"Unavailable for added or removed resources."},ij=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=eL(),{error:o,data:a}=(0,y.a)({queryKey:W.run(e||""),queryFn:async()=>ey(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let d=(0,j.useCallback)(async()=>{if(r(!0),e)return await eb(e)},[e,r]),c=(null==a?void 0:a.type)?null===(n=nX(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:d,RunResultView:c}};var iy=t(2607),ib=t(16947),ik=t(89258),iw=t.n(ik),iC=t(85027),i_=t(40892),iS=t(24766),iz=t.n(iS);let iR="ignore-screenshot";function iE(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:d="solid 1px #ccc",borderRadius:c="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,$.q)(),[l,r]=(0,j.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,j.useState)();return(0,j.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&r(e.target.result)}},[r]),(0,i.jsxs)(ee.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Screenshot Preview"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.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)(t9.s,{color:"red.600"}),(0,i.jsx)(er.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(er.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,i_.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");iz()(l,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=r?d:"",e.style.borderRadius=r?c:"",e.style.backgroundColor=l||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await iw()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,iC.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function iT(e){let{successToast:n,failToast:t}=tN(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=iE({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,j.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},[o]),d=(0,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),c=(0,j.useCallback)(async()=>{o.current?(await r(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,r,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eo.z,{size:"sm",leftIcon:(0,i.jsx)(tr.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:l,onMouseEnter:a,onMouseLeave:d,onClick:c,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:d,onCopyToClipboard:c}}let iI=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",l=null==n?void 0:n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",s="";"successful"===l||"finished"===l?(r="green",s="Finished"):"failed"===l?(r="red",s="Failed"):"cancelled"===l?(r="gray",s="Cancelled"):"running"===l?(r="blue",s="Running"):(r="green",s="Finished");let a=(null==n?void 0:n.run_at)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,i_.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,i_.WU)(e,"HH:mm"):(0,i_.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tX.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(er.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(er.x,{children:"•"}),(0,i.jsx)(er.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},iD=e=>{let n=iy.ZP.stringify(e,null,2);return(0,i.jsx)(tW.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}})},iL=e=>{var n,t,l;let{runId:r,onClose:s,disableAddToChecklist:a}=e,{runAction:d}=n0(),{error:c,run:f,onCancel:g,isRunning:v}=ij(r),[y,k]=(0,j.useState)(),w=(0,b.NL)(),[,C]=(0,eA.TH)(),[_,S]=(0,j.useState)(0),z=(null==f?void 0:f.type)?null===(n=nX(f.type))||void 0===n?void 0:n.RunResultView:void 0,R=(0,j.useCallback)(()=>{d((null==f?void 0:f.type)||"",null==f?void 0:f.params)},[f,d]),E=null==f?void 0:f.check_id,T=(0,j.useCallback)(async()=>{E&&C("/checks/".concat(E))},[E,C]),I=(0,j.useCallback)(async()=>{if(!r)return;let e=await n2(r,y);w.invalidateQueries({queryKey:W.checks()}),C("/checks/".concat(e.check_id))},[r,C,w,y]),D=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:L,onCopyToClipboard:O,onMouseEnter:M,onMouseLeave:A}=iT();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:_,onChange:S,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),D&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[f&&(0,i.jsx)(iI,{run:f}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ta.n,{}),variant:"outline",isDisabled:!r||v,size:"sm",onClick:R,children:"Rerun"}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(tr.T,{}),variant:"outline",isDisabled:!r||!(null==f?void 0:f.result)||!!c||0!==_,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:O,children:"Copy to Clipboard"}),(0,i.jsx)(function(){return a?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ib.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ib.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:I,children:"Add to Checklist"})},{}),(0,i.jsx)(ix.P,{onClick:()=>{s&&s()}})]})]})}),0===_&&(0,i.jsx)(tQ,{ref:L,error:c,run:f,onCancel:g,viewOptions:y,onViewOptionsChanged:k,RunResultView:z}),1===_&&f&&(0,i.jsx)(iD,{type:f.type,params:f.params}),2===_&&f&&((null===(t=f.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tB,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tK,{value:(null==f?void 0:null===(l=f.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},iO=e=>{let{onClose:n,disableAddToChecklist:t}=e,{runId:l}=n0();return(0,i.jsx)(iL,{runId:l,onClose:n,disableAddToChecklist:t})};async function iM(e,n){return await ej("query",e,n)}async function iA(e,n){return await ej("query_base",e,n)}async function iF(e,n){return await ej("query_diff",e,n)}var iq=t(17879),iN=t(67891),iV=t(83868);let iH=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r,isDisabled:o}=e,[a,d]=(0,j.useState)(t||[]),[c,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),m=(0,j.useRef)(null),p=e=>{a.includes(e)||(u(""),d([...a,e]),r([...a,e]))};return o?(0,i.jsx)(nS.u,{label:iv.audit_helper,children:(0,i.jsx)(nM.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})}):(0,i.jsxs)(iq.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nq.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null==m?void 0:null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,i.jsxs)(nN.j,{width:"100%",children:[(0,i.jsx)(nM.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?"".concat(a[0]):"",onChange:()=>{},backgroundColor:"white"}),0===a.length&&(0,i.jsx)(iN.x,{children:(0,i.jsx)(s.J,{as:tz.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,i.jsx)(nH.h,{children:(0,i.jsxs)(nP.q,{zIndex:"popover",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nW.k,{children:(0,i.jsxs)(iV.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(iV.U,{children:(0,i.jsxs)(te.Vp,{size:e.size,children:[(0,i.jsx)(te.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(te.SD,{paddingRight:"8px",onClick:()=>{d(a.filter(e=>e!==n)),r(a.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iV.U,{width:"100%",children:(0,i.jsx)(nM.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:c,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":p(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(d(a.slice(0,-1)),r(a.slice(0,-1)))}},onBlur:()=>{var e;m&&h&&(null==m||null===(e=m.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{children:[""!==c&&!(null==l?void 0:l.includes(c))&&(0,i.jsxs)(nK.s,{onClick:()=>{p(c),x(!1)},children:["Add '",c,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===c||e.includes(c)).filter(e=>!a.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nK.s,{onClick:()=>p(e),children:e},"option-".concat(n)))]})]})})]}),a.length>0&&(0,i.jsx)(iN.x,{children:(0,i.jsx)(eo.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{u(""),d([]),r([])},children:"Clear"})})]})},iP=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=eD(),a=(0,j.useMemo)(()=>{if(!r)return[];let e=new Set;for(let i in r.nodes){var n,t;let l=r.nodes[i],s=null===(n=l.data.base)||void 0===n?void 0:n.columns,o=null===(t=l.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[r]);return(0,i.jsx)(o.k,{...l,children:(0,i.jsxs)(eq.NI,{m:"4px 8px",children:[(0,i.jsxs)(eN.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nS.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,i.jsx)(t9.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iH,{unitName:"key",defaultValues:n,suggestionList:a,onValuesChange:t,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!s("query_diff_with_primary_key")})]})})};var iW=t(17429),iK=t(302);function iB(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:d,externalLinkText:c}=e;return(0,i.jsxs)(o.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(nV.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:t}),(0,i.jsx)(nV.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:l}),d&&c&&(0,i.jsx)(r.r,{href:d,isExternal:!0,textDecoration:"underline",onClick:s,children:c})]})}let iJ="recce-",iU={bypassSaveOverwrite:"".concat(iJ,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(iJ,"-preview-change-feedback"),prepareEnvGuideID:"".concat(iJ,"-prepare-env")};var iQ=t(29260),iZ=t(30997),iX=t(21257),iG=t(32501),iY=t(1363),i$=t(23260),i0=t(35757),i1=t(7090);let i5=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25070)",children:(0,i.jsx)("path",{d:"M15.625 0.25H14.759C14.5484 0.25 14.3791 0.423375 14.3841 0.633937L14.4575 3.71441C13.0691 1.62634 10.6955 0.25 8 0.25C4.21291 0.25 1.06041 2.96638 0.38425 6.557C0.340875 6.78728 0.518875 7 0.753219 7H1.64622C1.82353 7 1.97566 6.87556 2.013 6.70222C2.60753 3.9415 5.05991 1.875 8 1.875C10.4858 1.875 12.6232 3.35256 13.5836 5.47819L9.63394 5.38416C9.42341 5.37916 9.25 5.54844 9.25 5.75906V6.625C9.25 6.83209 9.41791 7 9.625 7H15.625C15.8321 7 16 6.83209 16 6.625V0.625C16 0.417906 15.8321 0.25 15.625 0.25ZM15.2468 9H14.3538C14.1765 9 14.0243 9.12444 13.987 9.29778C13.3925 12.0585 10.9401 14.125 8 14.125C5.51419 14.125 3.37681 12.6474 2.41637 10.5218L6.36606 10.6158C6.57659 10.6208 6.75 10.4516 6.75 10.2409V9.375C6.75 9.16791 6.58209 9 6.375 9H0.375C0.167906 9 0 9.16791 0 9.375V15.375C0 15.5821 0.167906 15.75 0.375 15.75H1.24097C1.45156 15.75 1.62088 15.5766 1.61588 15.3661L1.54253 12.2856C2.93087 14.3737 5.3045 15.75 8 15.75C11.7871 15.75 14.9396 13.0336 15.6158 9.443C15.6591 9.21272 15.4811 9 15.2468 9Z",fill:"currentColor"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1479_25070",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),i2=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25102)",children:(0,i.jsx)("path",{d:"M-1.88399 8.72062L0.358816 6.46094C0.594752 6.22344 1.00006 6.39031 1.00006 6.725V8.2525H4.00005V4.12438C4.00005 3.7275 4.16161 3.34313 4.44286 3.06219L7.06441 0.440625C7.34566 0.159375 7.72691 0 8.12347 0H14.5003C15.3281 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.3281 16 14.5003 16H5.50223C4.67411 16 4.00005 15.3281 4.00005 14.5003V11.2522H5.50005V14.5003H14.5003V1.50281H9.50128V4.75219C9.50128 5.16781 9.1669 5.50187 8.75128 5.50187H5.50005V8.25219H10.625C10.8322 8.25219 11 8.42 11 8.62719V9.37719C11 9.58438 10.8322 9.75219 10.625 9.75219H1.00006V11.2797C1.00006 11.6144 0.594752 11.7813 0.358816 11.5438L-1.88399 9.28406C-2.03867 9.12813 -2.03867 8.87656 -1.88399 8.72062ZM8.0016 4.00219V1.62469L5.62379 4.00219H8.0016Z",fill:"currentColor"})}),(0,i.jsx)("g",{"clip-path":"url(#clip1_1479_25102)",children:(0,i.jsx)("path",{d:"M0.103056 8.72062L2.09667 6.46094C2.30639 6.22344 2.66667 6.39031 2.66667 6.725V8.2525H5.33333V4.12438C5.33333 3.7275 5.47694 3.34313 5.72694 3.06219L8.05722 0.440625C8.30722 0.159375 8.64611 0 8.99861 0H14.6669C15.4028 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.4028 16 14.6669 16H6.66861C5.9325 16 5.33333 15.3281 5.33333 14.5003V11.2522H6.66667V14.5003H14.6669V1.50281H10.2233V4.75219C10.2233 5.16781 9.92611 5.50187 9.55667 5.50187H6.66667V8.25219H11.2222C11.4064 8.25219 11.5556 8.42 11.5556 8.62719V9.37719C11.5556 9.58438 11.4064 9.75219 11.2222 9.75219H2.66667V11.2797C2.66667 11.6144 2.30639 11.7813 2.09667 11.5438L0.103056 9.28406C-0.0344448 9.12813 -0.0344448 8.87656 0.103056 8.72062ZM8.89028 4.00219V1.62469L6.77666 4.00219H8.89028Z",fill:"currentColor"})}),(0,i.jsxs)("defs",{children:[(0,i.jsx)("clipPath",{id:"clip0_1479_25102",children:(0,i.jsx)("rect",{width:"13",height:"16",fill:"white",transform:"matrix(-1 0 0 1 16 0)"})}),(0,i.jsx)("clipPath",{id:"clip1_1479_25102",children:(0,i.jsx)("rect",{width:"3",height:"16",fill:"white"})})]})]}),i4=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1426_8619)",children:(0,i.jsx)("path",{d:"M15.5572 3.06188L12.9356 0.440625C12.6544 0.159375 12.2731 0 11.8766 0H5.49969C4.67188 0.003125 4 0.675 4 1.50281V8.25219H0.375C0.167812 8.25219 0 8.42 0 8.62719V9.37719C0 9.58438 0.167812 9.75219 0.375 9.75219H9V11.2797C9 11.6144 9.40531 11.7812 9.64125 11.5437L11.8841 9.28406C12.0388 9.12813 12.0388 8.87656 11.8841 8.72062L9.64125 6.46094C9.40531 6.22344 9 6.39031 9 6.725V8.2525H5.49969V1.50281H10.4987V4.75219C10.4987 5.16781 10.8331 5.50187 11.2487 5.50187H14.5V14.5003H5.49969V11.2522H4V14.5003C4 15.3281 4.67188 16 5.49969 16H14.4978C15.3259 16 16 15.3281 16 14.5003V4.12406C16 3.7275 15.8384 3.34313 15.5572 3.06188ZM11.9984 4.00219V1.62469L14.3763 4.00219H11.9984Z",fill:"black"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1426_8619",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),i6=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M14.5607 4.06066L11.9393 1.43934C11.658 1.15804 11.2765 1 10.8787 1H2.5C1.67156 1 1 1.67156 1 2.5V13.5C1 14.3284 1.67156 15 2.5 15H13.5C14.3284 15 15 14.3284 15 13.5V5.12131C15 4.72349 14.842 4.34196 14.5607 4.06066ZM9.5 2.5V5H5.5V2.5H9.5ZM13.3125 13.5H2.6875C2.63777 13.5 2.59008 13.4802 2.55492 13.4451C2.51975 13.4099 2.5 13.3622 2.5 13.3125V2.6875C2.5 2.63777 2.51975 2.59008 2.55492 2.55492C2.59008 2.51975 2.63777 2.5 2.6875 2.5H4V5.75C4 6.16422 4.33578 6.5 4.75 6.5H10.25C10.6642 6.5 11 6.16422 11 5.75V2.62131L13.4451 5.06641C13.4625 5.08382 13.4763 5.10449 13.4857 5.12724C13.4952 5.14999 13.5 5.17438 13.5 5.199V13.3125C13.5 13.3622 13.4802 13.4099 13.4451 13.4451C13.4099 13.4802 13.3622 13.5 13.3125 13.5ZM8 7.25C6.48366 7.25 5.25 8.48366 5.25 10C5.25 11.5163 6.48366 12.75 8 12.75C9.51634 12.75 10.75 11.5163 10.75 10C10.75 8.48366 9.51634 7.25 8 7.25ZM8 11.25C7.31075 11.25 6.75 10.6892 6.75 10C6.75 9.31075 7.31075 8.75 8 8.75C8.68925 8.75 9.25 9.31075 9.25 10C9.25 10.6892 8.68925 11.25 8 11.25Z",fill:"currentColor"})}),i3=e=>(0,i.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M15.9143 1.75812L14.7422 0.585938C14.3515 0.195312 13.8397 0 13.3278 0C12.8159 0 12.304 0.195312 11.9137 0.585625L9.58593 2.91344L8.5 3.99938L0.901592 11.5975L0.504719 15.1669C0.454719 15.6163 0.80878 16 1.24847 16C1.27628 16 1.3044 15.9984 1.33253 15.9953L4.89939 15.6012L12.5006 8L13.5862 6.91437L15.914 4.58656C16.6953 3.80531 16.6953 2.53906 15.9143 1.75812ZM4.21095 14.1684L2.09909 14.4016L2.3344 12.2863L9.56062 5.06L10.53 4.09062L12.4094 5.97L11.44 6.93937L4.21095 14.1684ZM14.8534 3.52562L13.4697 4.90938L11.5906 3.03L12.9744 1.64625C13.1019 1.51875 13.2506 1.49969 13.3278 1.49969C13.405 1.49969 13.554 1.51875 13.6812 1.64625L14.8534 2.81844C15.0484 3.01375 15.0484 3.33094 14.8534 3.52562Z",fill:"currentColor"})}),i9=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M7.26326 6.5462H8.71794V12.3642H7.26326V6.5462ZM7.9906 3.1102C7.43278 3.1102 6.97888 3.5641 6.97888 4.12192C6.97888 4.67974 7.43278 5.13364 7.9906 5.13364C8.54842 5.13364 9.00232 4.67974 9.00232 4.12192C9.00232 3.5641 8.54842 3.1102 7.9906 3.1102ZM16 8C16 12.411 12.411 16 8 16C3.589 16 0 12.411 0 8C0 3.589 3.589 0 8 0C12.411 0 16 3.589 16 8ZM14.5453 8C14.5453 4.3906 11.6093 1.4546 7.99992 1.4546C4.39052 1.4546 1.45452 4.3914 1.45452 8.0006C1.45452 11.6098 4.39052 14.546 7.99992 14.546C11.6093 14.546 14.5453 11.6092 14.5453 8.0006V8Z",fill:"currentColor"})});function i8(e){let n=(0,i1.D)(e);return(0,i_.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function i7(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)(t_.HC,{ml:"10px",children:[n,": ",t]},n)})}function le(){var e,n,t,l,a,c;let{envInfo:u,reviewMode:h,lineageGraph:x}=eD(),{isOpen:m,onOpen:p,onClose:f}=(0,$.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)?i8(null==y?void 0:y.generated_at):"",w=(null==b?void 0:b.generated_at)?i8(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===(c=e.data.current)||void 0===c?void 0:c.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Environment Info",placement:"bottom-end",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{verticalAlign:"middle",as:i9,boxSize:"16px"})})}),(0,i.jsxs)(ee.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Environment Information"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.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)(d.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(t_.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(t_.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&i7(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(t_.QI,{spacing:1,children:g&&i7(g)})]})}),(0,i.jsx)(nz.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"DBT"}),(0,i.jsx)(iQ.x,{children:(0,i.jsxs)(iZ.i,{variant:"simple",children:[(0,i.jsx)(iX.h,{children:(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(iY.Th,{}),(0,i.jsx)(iY.Th,{children:"base"}),(0,i.jsx)(iY.Th,{children:"current"})]})}),(0,i.jsxs)(i$.p,{children:[(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(i0.Td,{children:"schema"}),(0,i.jsx)(i0.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(i0.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(i0.Td,{children:"version"}),(0,i.jsx)(i0.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(i0.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(i0.Td,{children:"timestamp"}),(0,i.jsx)(i0.Td,{children:k}),(0,i.jsx)(i0.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)(d.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(iQ.x,{children:(0,i.jsxs)(iZ.i,{variant:"simple",children:[(0,i.jsx)(iX.h,{children:(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(iY.Th,{}),(0,i.jsx)(iY.Th,{children:"base"}),(0,i.jsx)(iY.Th,{children:"current"})]})}),(0,i.jsx)(i$.p,{children:(0,i.jsxs)(iG.Tr,{children:[(0,i.jsx)(i0.Td,{children:"Environment"}),(0,i.jsx)(i0.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(i0.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}function ln(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:a,runQuery:c,isPending:u}=e;return(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(d.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:iW.vc4,boxSize:"1.2em"}),"Sandbox"]}),(0,i.jsxs)(er.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model"," ",(0,i.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iP,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(nS.u,{label:"Run diff to see the changes",children:(0,i.jsx)(eo.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{a(),c()},colorScheme:"blue",isLoading:u,children:"Run Diff"})})]})}function lt(e){var n,t,l;let{currentModelID:r,height:s="32px",flex:a="0 0 auto"}=e,{lineageGraph:d,envInfo:c}=eD(),u="0 16px",h=i8((null==c?void 0:null===(t=c.dbt)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.generated_at)||""),x=(0,tZ.Q)(h,{addSuffix:!0}),m="N/A";if((null==d?void 0:d.nodes)&&(null==d?void 0:d.nodes[r])){let e=null==d?void 0:d.nodes[r];(null===(l=e.data.current)||void 0===l?void 0:l.schema)&&(m=e.data.current.schema)}return(0,i.jsxs)(o.k,{gap:0,height:s,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(tP.K,{width:"50%",children:(0,i.jsxs)(er.x,{as:"b",margin:u,children:["ORIGINAL (Schema: ",m,", Last Updated: ",x,")"]})}),(0,i.jsx)(tP.K,{width:"50%",children:(0,i.jsx)(er.x,{as:"b",margin:u,children:"SANDBOX EDITOR"})})]})}function li(e){let{isOpen:n,onClose:t,current:s}=e,{isOpen:h,onClose:x,onOpen:m}=(0,$.q)(),[p,f]=(0,j.useState)((null==s?void 0:s.raw_code)||""),{showRunId:g,clearRunResult:v}=n0(),{primaryKeys:y,setPrimaryKeys:b}=_(),{data:k,isLoading:w}=eE(),C=async()=>{let e={current_model:(null==s?void 0:s.name)||"",primary_keys:y,sql_template:p},{run_id:n}=await iF(e,{nowait:!0});return g(n),await ey(n)},{mutate:S,isPending:z}=(0,tp.D)({mutationFn:C,onSuccess(e,n){e.error?em({action:"run",node:null==s?void 0:s.name,status:"failure"}):(em({action:"run",node:null==s?void 0:s.name,status:"success"}),setTimeout(()=>R(),1e3),!w&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>T(),2e3))}}),{feedbackToast:R,closeToast:E}=function(e){let n=(0,Y.p)(),{feedbackId:t,description:l,onFeedbackSubmit:r,externalLink:s,externalLinkText:o}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=localStorage.getItem(t);n.isActive(t)||"true"===a&&!1===e||n({id:t,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:a}=e;return(0,i.jsx)(tv.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iK.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(iB,{description:l,onLike:()=>{r("like"),a(),localStorage.setItem(t,"true")},onDislike:()=>{r("dislike"),a(),localStorage.setItem(t,"true")},externalLink:s,externalLinkText:o,onClickLink:()=>{r("link")}}),(0,i.jsx)(ix.P,{onClick:()=>{a()}})]})})})}})},closeToast:()=>n.closeAll()}}({feedbackId:iU.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":ep({feedback:"like",node:null==s?void 0:s.name});break;case"dislike":ep({feedback:"dislike",node:null==s?void 0:s.name});break;case"link":ep({feedback:"form",node:null==s?void 0:s.name});break;default:console.log("Not support feedback type")}},externalLink:"https://docs.google.com/forms/d/e/1FAIpQLSd7Lei7Ijwo7MinWaI0K6rzZi_21gV1BKetmiNEX254kDziDA/viewform?usp=header",externalLinkText:"Give us feedback"}),{guideToast:T,closeGuideToast:I}=function(e){let n=(0,Y.p)(),{guideId:t,description:l,externalLink:s,externalLinkText:o,onExternalLinkClick:a}=e;return{guideToast:function(){n.isActive(t)||n({id:t,position:"bottom-right",duration:3e3,description:"some text",render:e=>{let{id:n,onClose:t}=e;return(0,i.jsx)(tv.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iK.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(er.x,{children:[l," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:s,onClick:()=>{a&&a(),t()},children:o})]}),(0,i.jsx)(ix.P,{onClick:()=>{t()}})]})})})}})},closeGuideToast:()=>n.closeAll()}}({guideId:iU.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>ef({action:"external_link",from:"preview_changes",node:null==s?void 0:s.name})});return(0,j.useEffect)(()=>{n&&f((null==s?void 0:s.raw_code)||"")},[n,s]),(0,i.jsx)(ee.u_,{isOpen:n,size:"full",onClose:()=>{t(),x(),v(),E(),I(),em({action:"close",node:null==s?void 0:s.name})},children:(0,i.jsxs)(et.h,{height:"100%",children:[(0,i.jsx)(ei.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,i.jsxs)(o.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{p:0,children:(0,i.jsxs)(tC,{sizes:h?[50,50]:[100,0],minSize:h?100:0,gutterSize:h?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(o.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(ln,{current:s,primaryKeys:null!=y?y:[],setPrimaryKeys:b,onRunResultOpen:m,runQuery:S,isPending:z}),(0,i.jsx)(lt,{height:"32pxs",flex:"0 0 auto",currentModelID:(null==s?void 0:s.id)||""}),(0,i.jsx)(ip,{current:s,onChange:f})]}),h?(0,i.jsx)(iO,{onClose:x,disableAddToChecklist:!0}):(0,i.jsx)(l.x,{})]})}),(0,i.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(nS.u,{label:"Give us feedback",children:(0,i.jsx)(nV.h,{"aria-label":"feedback",icon:(0,i.jsx)(nt.xJq,{}),variant:"ghost",size:"md",onClick:()=>{R(!0)}})})})]})})}function ll(e){let{node:n,onCloseNode:t}=e,[,r]=(0,eA.TH)(),{setSqlQuery:a,setPrimaryKeys:c}=_(),f="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType||"snapshot"===n.resourceType,{isOpen:g,onOpen:v,onClose:y}=(0,$.q)(),{isOpen:b,onOpen:k,onClose:w}=(0,$.q)(),{runAction:C}=n0(),{envInfo:S,isActionAvailable:z}=eD(),{primaryKey:R}=eK(n.name),E=()=>{C("row_count_diff",{node_names:[n.name]},{showForm:!1,showLast:!1})},{data:T}=eE(),I=null==T?void 0:T.single_env_onboarding,D=(0,j.useCallback)(async()=>{let e=n.id,t=await ig({node_id:e});r("/checks/".concat(t.check_id))},[n,r]),L=(e,n)=>e?iv.add_or_remove:z(n)?"":"value_diff"===n?iv.audit_helper:"profile_diff"===n?iv.dbt_profiler:"This action is not supported yet.",O="added"===n.changeStatus||"removed"===n.changeStatus;return(0,i.jsxs)(ih.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(d.X,{size:"sm",children:n.name})}),(0,i.jsx)(h.L,{}),I?(0,i.jsx)(function(){return(0,i.jsx)(eo.z,{as:eo.z,size:"sm",colorScheme:"blue",onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),k(),ef({action:"preview_changes",node:n.name})},children:"Sandbox"})},{}):(0,i.jsx)(function(){var e,t,l,o,d,u,h,x;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{as:eo.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(e=nX("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?a('select * from {{ ref("'.concat(n.name,'") }}')):(null==S?void 0:S.adapterType)==="sqlmesh"&&a("select * from ".concat(n.name)),z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),r("/query")},children:"Query"}),(0,i.jsx)(nK.s,{fontSize:"14px",icon:(0,i.jsx)(s.J,{as:null===(t=nX("sandbox"))||void 0===t?void 0:t.icon}),onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),k(),em({action:"explore",node:n.name})},children:"Sandbox (Experiment)"}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===n.resourceType||"snapshot"===n.resourceType)&&(0,i.jsx)(nK.s,{onClick:v,icon:(0,i.jsx)(tS.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nX("row_count_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",onClick:()=>E(),children:"Row Count Diff"}),(0,i.jsx)(nS.u,{label:L(O,"profile_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(o=nX("profile_diff"))||void 0===o?void 0:o.icon}),fontSize:"14px",isDisabled:O||!z("profile_diff"),onClick:()=>{C("profile_diff",{model:n.name},{showForm:!1,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"value_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nX("value_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:O||!z("value_diff"),onClick:()=>{C("value_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"top_k_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(u=nX("top_k_diff"))||void 0===u?void 0:u.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nS.u,{label:L(O,"histogram_diff"),placement:"left",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nX("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nW.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nK.s,{icon:(0,i.jsx)(s.J,{as:null===(x=nX("schema_diff"))||void 0===x?void 0:x.icon}),fontSize:"14px",onClick:D,children:"Schema Diff"})})]})]})},{}),(0,i.jsx)(l.x,{flex:"0 1 1%",children:(0,i.jsx)(ix.P,{onClick:t})})]}),(0,i.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(it,{node:n}),("model"===n.resourceType||"snapshot"===n.resourceType||"seed"===n.resourceType)&&(0,i.jsx)(il,{node:n,onRefresh:E})]})}),f&&(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)(tt.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(ti.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(ty,{base:n.data.base,current:n.data.current})})})]}),(0,i.jsxs)(ee.u_,{isOpen:g,onClose:y,size:"6xl",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(ei.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{children:(0,i.jsx)(im,{base:n.data.base,current:n.data.current})})]})]}),(0,i.jsx)(li,{isOpen:b,onClose:w,current:n.data.current})]})}function lr(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=io();return(0,i.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tG.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(eo.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(eo.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var ls=t(63988),lo=t(12767),la=t(29901);let ld=()=>(0,i.jsxs)(nm.g,{align:"start",spacing:0,children:[(0,i.jsx)(er.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(ls.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(ls.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(ls.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(er.x,{fontSize:"8pt",children:[(0,i.jsx)(ls.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),lc=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n0();return(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(s.J,{as:nt.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ex({name:"hide"}),t()):(ex({name:"show"}),n())},children:e?"Hide":"Show"})},lu=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l,selectMode:r}=io(),o=t.view_mode||"changed_models",a=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{as:eo.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tD("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nP.q,{title:"packages",children:[(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},lh=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=eD(),{viewOptions:o,onViewOptionsChanged:a}=io(),d=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&d.add(e.packageName);let c=null==r?void 0:null===(t=r.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.packages):c?new Set([c]):d,h=u.size===d.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nq.v,{closeOnSelect:!1,children:[(0,i.jsx)(nN.j,{as:eo.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t7.zFh}),size:"xs",variant:"outline",isDisabled:l,children:m}),(0,i.jsx)(nP.q,{title:"packages",children:(0,i.jsxs)(nW.k,{title:"Select Packages",children:[(0,i.jsx)(nK.s,{as:np.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(d)})},children:"Select All"}),(0,i.jsx)(tn.R,{}),Array.from(d).map(e=>(0,i.jsx)(nK.s,{as:np.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},lx=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=eE(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nS.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",defaultIsOpen:!0,color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(nM.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})})},lm=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=io();return(0,i.jsx)(lx,{isDisabled:n,value:t.select||"",onChange:e=>{l({...t,select:e||void 0})},tooltipComponent:(0,i.jsx)(ld,{})})},lp=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=io();return(0,i.jsx)(lx,{isDisabled:n,value:t.exclude||"",onChange:e=>{l({...t,exclude:e||void 0})}})},lf=e=>(0,i.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),lg=()=>{var e,n,t,l;let{nodes:r,deselect:o,selectMode:a,...d}=io(),{isActionAvailable:c}=eD(),x=(0,j.useMemo)(()=>r.filter(e=>e.data.isSelected),[r]),{data:m}=eE(),p=null==m?void 0:m.single_env_onboarding,f="single"===a&&1===x.length,g="multi"===a&&x.length>=1,v="single"===a&&0===x.length,y="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(lf,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(lc,{})}),(0,i.jsx)(lf,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(lu,{isDisabled:y})}),(0,i.jsx)(lf,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(lh,{isDisabled:y})}),(0,i.jsx)(lf,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(lm,{isDisabled:y})}),(0,i.jsx)(lf,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(lp,{isDisabled:y})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lf,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(er.x,{fontSize:"9pt",color:"gray.500",children:x.length>1?"".concat(x.length," nodes selected"):"".concat(x.length," node selected")})}),(0,i.jsx)(lf,{label:"",children:(0,i.jsx)(eo.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),!p&&(0,i.jsx)(lf,{label:"Explore",children:(0,i.jsx)(lo.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nq.v,{placement:"bottom-end",children:[(0,i.jsx)(nN.j,{as:eo.z,size:"xs",rightIcon:(0,i.jsx)(la.v,{}),children:"Actions"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsxs)(nW.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(e=nX("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{d.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nS.u,{label:c("value_diff")?null:iv.audit_helper,placement:"left",children:(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g)||!c("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(n=nX("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{d.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(tn.R,{}),(0,i.jsxs)(nW.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||g&&x.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nX("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nK.s,{as:er.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(l=nX("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};async function lv(e){return(await Q.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function lj(){return(0,i.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,l]]=e,{icon:r,color:a}=tI(n);return(0,i.jsx)(nS.u,{label:l,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:r})," ",t]})},n)})})}var ly=t(88500);let lb={mode:"per_node",status:"pending",completed:0,total:0},lk=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...lb}).current,{showRunId:s}=n0(),o=async(n,o,a)=>{let d="multi_nodes";r.mode=d,t(),r.status="running";let c=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:d,status:"skipped",skipReason:e},i(n)):(n.action={mode:d,status:"pending"},c.push(n))}let u=a(c);try{let{run_id:e}=await ej(n,u,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await ey(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of c)e.action={mode:d,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{let o="per_node";for(let n of(r.mode=o,t(),r.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:l}=await ej(n,e,{nowait:!0});for(r.currentRun={run_id:l},t.action={mode:o,status:"running"},i(t);;){let e=await ey(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},d=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await eb(r.currentRun.run_id)};return{actionState:r,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await lv({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await ig({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await ig({node_id:t})}return n},cancel:d,reset:()=>{Object.assign(r,lb)}}};var lw=t(42154),lC=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,$.q)(),[r,s]=(0,j.useState)(0),[a,d]=(0,j.useState)(),c=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{d(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(lw.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,i.jsx)(en.Z,{children:(0,i.jsxs)(lw._T,{children:[(0,i.jsxs)(ei.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",r," nodes"]}),(0,i.jsx)(el.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(l.x,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{ref:c,onClick:h,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}},l_=t(51366);let lS="recce",lz={recommendationIgnored:"".concat(lS,"-recommendation-ignored"),recommendationShowed:"".concat(lS,"-recommendation-showed"),prevRefreshTimeStamp:"".concat(lS,"-prev-refresh-timestamp")},lR=()=>{var e;let n=(0,y.a)({queryKey:W.checks(),queryFn:n4}),t=(0,j.useMemo)(()=>{if("success"===n.status&&n.data.length>0){let e=n.data.filter(e=>e.is_preset).findLast(e=>"row_count_diff"===e.type);if(e)return e}},[n]),i=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?W.check(t.check_id):[],queryFn:async()=>{if(null==t?void 0:t.check_id)return n6(t.check_id)},enabled:!!(null==t?void 0:t.check_id)}),l=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?[...W.check(t.check_id),"select"]:[],queryFn:async()=>{var e,n;return tb({select:null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select,exclude:null==t?void 0:null===(n=t.params)||void 0===n?void 0:n.exclude})},enabled:!!(null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select)}),r=(0,j.useMemo)(()=>{if(t){var e,n;if(null===(e=t.params)||void 0===e?void 0:e.node_names)return t.params.node_names;if(null===(n=t.params)||void 0===n?void 0:n.node_ids)return t.params.node_ids}if("success"===l.status&&l.data)return l.data.nodes},[t,l]);return{recommendedCheck:i.data,selectedNodes:r}},lE=()=>{let{lineageGraph:e,envInfo:n}=eD(),{showRunId:t}=n0(),{data:l}=eE(),r=(0,b.NL)(),{recommendedCheck:s,selectedNodes:a}=lR(),[d,c]=(0,j.useState)(),[x,m]=(0,j.useState)(!1),[p,f]=(0,j.useState)(!1),[g,v]=(0,j.useState)(!1),{isOpen:y,onOpen:k,onClose:w}=(0,$.q)(),C=lz.recommendationIgnored,_=lz.recommendationShowed,S=lz.prevRefreshTimeStamp;(0,j.useEffect)(()=>{sessionStorage.getItem(C)&&f(!0)},[C]),(0,j.useEffect)(()=>{var t,i,l,r,o,d,u,h,x,p,g,j;if(!s||!a)return;if(null===(t=s.last_run)||void 0===t?void 0:t.run_id){let e=new Date(null===(o=s.last_run)||void 0===o?void 0:o.run_at).getTime(),t=null==n?void 0:n.dbt,i=Math.max((null==t?void 0:null===(d=t.current)||void 0===d?void 0:d.generated_at)?new Date(t.current.generated_at).getTime():0,(null==t?void 0:null===(u=t.base)||void 0===u?void 0:u.generated_at)?new Date(t.base.generated_at).getTime():0);if(e>=i){m(!0);return}m(!1),v(!0);let l=sessionStorage.getItem(S);(null===l||parseInt(l)!==i)&&(sessionStorage.setItem(S,i.toString()),sessionStorage.removeItem(C),sessionStorage.removeItem(_),f(!1))}let y=n=>n.map(n=>{var t;return null==e?void 0:null===(t=e.nodes[n])||void 0===t?void 0:t.name}).join(", ");if(a.length>0&&a.length<=3){if(null===(h=s.params)||void 0===h?void 0:h.node_names){let e=null===(p=s.params)||void 0===p?void 0:p.node_names.join(", ");c("'".concat(e,"'"))}else if(null===(x=s.params)||void 0===x?void 0:x.node_ids){let e=y(null===(g=s.params)||void 0===g?void 0:g.node_ids);c("'".concat(e,"'"))}else if(a){let e=y(a);c("'".concat(e,"'"))}}else(null==e?void 0:null===(i=e.modifiedSet)||void 0===i?void 0:i.length)===a.length?c("modified and potentially impacted models"):(null===(l=s.params)||void 0===l?void 0:l.select)&&!(null===(r=s.params)||void 0===r?void 0:r.exclude)?c("'".concat(null===(j=s.params)||void 0===j?void 0:j.select,"'")):c("".concat(a.length," models"));if(!sessionStorage.getItem(_)){let e=sessionStorage.getItem(S);sessionStorage.setItem(_,"true"),eg({action:"recommend",from:null===e?"initial":"rerun"})}},[s,a,e,C,_,S,n]);let z=(0,j.useCallback)(async()=>{s&&(t((await ek(s.check_id,{nowait:!0})).run_id),r.invalidateQueries({queryKey:W.check(s.check_id)}))},[s,t,r]);if(!s||!a||(null==l?void 0:l.single_env_onboarding))return(0,i.jsx)(i.Fragment,{});let R=a.length;return!p&&!x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"blue.50",children:(0,i.jsxs)(u.U,{flex:"1",fontSize:"10pt",color:"blue.600",children:[g?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l_.i,{}),(0,i.jsx)(er.x,{children:"New dbt build detected - Re-run row count checks to maintain result accuracy"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t2.h,{}),(0,i.jsxs)(er.x,{children:["First Check: Perform a row count diff of ",d," for basic impact assessment"]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(eo.z,{size:"xs",onClick:()=>{f(!0),sessionStorage.setItem(C,"true"),eg({action:"ignore",from:g?"rerun":"initial",nodes:R})},children:"Ignore"}),(0,i.jsx)(eo.z,{colorScheme:"blue",size:"xs",onClick:()=>{k(),eg({action:"perform",from:g?"rerun":"initial",nodes:R})},children:"Perform"})]})}),(0,i.jsxs)(ee.u_,{isOpen:y,onClose:()=>{w(),eg({action:"close",from:g?"rerun":"initial",nodes:R})},isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Row Count Check"}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:"4",children:[(0,i.jsxs)(er.x,{children:["Perform a row count check of the ",R," node(s) displayed in the lineage diff DAG."]}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(t2.h,{mt:"10px",ml:"5px"}),(0,i.jsx)(er.x,{margin:"5px",paddingX:"3px",children:"This is a recommended first check based on the preset checks defined in your recce.yml file."})]})]})}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{onClick:()=>{w(),eg({action:"close",from:g?"rerun":"initial",nodes:R})},children:"Cancel"}),(0,i.jsxs)(eo.z,{colorScheme:"blue",onClick:()=>{w(),z(),m(!0),eg({action:"execute",from:g?"rerun":"initial",nodes:R})},children:["Execute on ",R," models"]})]})]})]})]})},lT={customNode:function(e){var n,t;let{data:r}=e,{id:a,isHighlighted:d,isSelected:c,resourceType:x,changeStatus:m}=r,p=(0,R.oR)(e=>e.transform[2]>.3),{icon:f}=tD(x),[g,v]=(0,j.useState)(!1),{interactive:y,selectNodeMulti:b,selectMode:k,advancedImpactRadius:w}=io(),{lineageGraph:C}=eD(),_=w&&"modified"===m&&(null==C?void 0:C.nonBreakingSet.has(a)),{icon:S,color:z,backgroundColor:E}=m?tI(m):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},T=_?"dashed":"solid";r.isSelected;let I=null==r?void 0:r.name;return(0,i.jsx)(nS.u,{label:"model"===x?I:"".concat(I," (").concat(x,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:z,borderWidth:"2px",borderStyle:T,borderRadius:8,backgroundColor:p?"multi"===k?c?z:"white":"action_result"!==k?c?E:"white":r.action?c?E:z:"white":c?z:E,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===k?(null==r?void 0:r.action)?"none":"opacity(0.2) grayscale(50%)":d||c?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[(0,i.jsx)(o.k,{bg:z,padding:y?"8px":"2px",borderRightWidth:"2px",borderColor:"multi"===k?"#00000020":z,borderStyle:T,alignItems:"top",visibility:p?"inherit":"hidden",children:y&&(0,i.jsx)(ic,{checked:"multi"===k&&c||"action_result"===k&&!!r.action,onClick:e=>{"action_result"!==k&&(e.stopPropagation(),b(r.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:p?"inherit":"hidden",children:[(0,i.jsx)(l.x,{flex:"1",color:"multi"===k?c?"white":"inherit":"action_result"===k&&r.action&&!c?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:I}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===k?c?"white":"inherit":"action_result"===k&&r.action&&!c?"white":"inherit",as:f}),S&&(0,i.jsx)(s.J,{color:"multi"===k?c?"white":z:"action_result"===k?r.action&&!c?"white":"inherit":z,as:S})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:p?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==k&&"model"===r.resourceType&&(0,i.jsx)(id,{id:r.id,inverted:"multi"===k&&!!c}),r.isActionMode&&(r.action?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(ir,{node:r,action:r.action})]}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==r?void 0:r.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==r?void 0:r.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},lI={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:l,targetY:r,sourcePosition:s,targetPosition:o,style:a={},markerEnd:d,data:c}=e,u={...a};(null==c?void 0:c.changeStatus)&&(u.stroke=tI(null==c?void 0:c.changeStatus).color,u.strokeDasharray="5"),(null==c?void 0:c.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:l,targetY:r,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:d,style:{...u,...a}})})}},lD=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tI(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},lL=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,l=t.contentRect.height;(Math.abs(l-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&l>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:l}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])},lO=()=>{let[,e]=(0,eA.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},lM=(0,j.forwardRef)(function(e,n){var t,a;let{interactive:d=!1,...h}=e,x=(0,R._K)(),m=(0,j.useRef)(null),{successToast:p,failToast:f}=tN(),{copyToClipboard:g,ImageDownloadModal:v,ref:y}=iE({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iR))},onSuccess:()=>{p("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),f("Failed to copy image to clipboard",e)}}),[b,k,w]=(0,R.Rr)([]),[C,_,S]=(0,R.ll)([]),{lineageGraph:z,retchLineageGraph:E,isLoading:I,error:D,refetchRunsAggregated:W}=eD(),{showRunId:K,closeRunResult:B,runAction:J}=n0(),U=z&&(null==z?void 0:null===(t=z.modifiedSet)||void 0===t?void 0:t.length)>0,[Q,Z]=(0,j.useState)({view_mode:U?"changed_models":"all",...h.viewOptions});(0,j.useImperativeHandle)(n,()=>({copyToClipboard:g}));let X=Q.view_mode||"changed_models",[G,$]=(0,j.useState)("single"),ee=(0,j.useMemo)(()=>{var e;if("single"===G)return null===(e=b.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[G,b]),en=(0,j.useMemo)(()=>b.filter(e=>e.data.isSelected).map(e=>e.data),[b]),et=(0,j.useMemo)(()=>b.map(e=>e.data),[b]),[ei,el]=(0,j.useState)(!1),[es,ea]=(0,j.useState)({x:0,y:0}),[ed,eu]=(0,j.useState)(!1),ex=(0,Y.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!z)return;if(Q.node_ids)e=Q.node_ids;else{var n;let t=null===(n=z.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:Q.view_mode,packages:t?[t]:void 0,...h.viewOptions};Z(i),e=(await tb({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=A(z,e),l=M(z,ed);[t,i]=q(Array.from(l),t,i),F(t,i),k(t),_(i)})()},[z]);let em=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ed;if(!z)return;let[n,t]=q(Array.from(M(z,e)),b,C);k(P(n)),_(t)},ep=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=x.getZoom();x.setCenter(n,t,{zoom:i,duration:200})}},ef=lO();lL(m,async()=>{if("single"===G||"action_result"===G){let e=b.find(e=>e.data.isSelected);e?ep(e):x.fitView({nodes:b,duration:200})}});let eg=(0,j.useCallback)(e=>{k(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[k]),ej=async e=>{let n;if(!z)return;try{n=(await tb({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof ly.d7){var t,i;ex({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[l,r]=A(z,n);F(l,r),k(l),_(r),Z(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{x.fitView({nodes:l,duration:200})})()},ey=lk("multi"===G?en:et,{onActionStarted:()=>{$("action_result")},onActionNodeUpdated:eg,onActionCompleted:()=>{}}),eb=lC();if(I)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tX.$,{size:"xl"})});let ek=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=es.selectedNode;"action_result"!==G&&void 0!==n&&void 0!==z&&("single"===G&&(k(P(b,!0)),$("multi"),ey.reset()),k(H([...L(z,[n.id],e)],b,"single"===G)))},ew=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=es.selectedNode;"action_result"!==G&&void 0!==n&&void 0!==z&&("single"===G&&(k(P(b,!0)),$("multi"),ey.reset()),k(H([...O(z,[n.id],e)],b,"single"===G)))},eC=()=>{el(!1),ea({x:0,y:0})};if(D)return(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsxs)(nm.g,{children:[(0,i.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(l.x,{children:["[Reason: ",D,"]"]}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{E&&E()},children:"Retry"})]})});if("changed_models"===X&&!(null==z?void 0:null===(a=z.modifiedSet)||void 0===a?void 0:a.length))return(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsxs)(nm.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>{ej({...Q,view_mode:"all"})},children:"Show all nodes"})]})});let e_=()=>{$("single"),k(P(b)),B(),null==W||W()},eS={interactive:d,selectMode:G,nodes:b,viewOptions:Q,onViewOptionsChanged:ej,selectNodeMulti:e=>{if("multi"!==G){if(!z)return;let[n,t]=q(Array.from(O(z,z.modifiedSet)),b,C);k(n=N(e,n=P(n,!0))),_(t),$("multi"),ey.reset()}else{let n=V(e,b);n.find(e=>e.data.isSelected)||($("single"),n=P(n)),k(n)}},deselect:e_,advancedImpactRadius:ed,setAdvancedImpactRadius:eu,runRowCountDiff:async()=>{"multi"===G?(await ey.runRowCountDiff(),eh({type:"row_count_diff",selected:"multi"})):ee?(await J("row_count_diff",{node_names:[ee.name]},{showForm:!1,showLast:!1}),eh({type:"row_count_diff",selected:"single"})):(await J("row_count_diff",{select:Q.select,exclude:Q.exclude,packages:Q.packages,view_mode:Q.view_mode}),eh({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(ee)await J("value_diff",{model:ee.name},{showForm:!0,showLast:!1}),eh({type:"value_diff",selected:"single"});else{let e="multi"===G?en.length:et.length;await eb.confirm(e)&&(await ey.runValueDiff(),eh({type:"value_diff",selected:"multi"===G?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===G?(e=await ey.addLineageDiffCheck(),e_(),eh({type:"lineage_diff",selected:"multi"})):ee||(e=await lv(Q),eh({type:"lineage_diff",selected:"none"})),e&&ef(e)},addSchemaDiffCheck:async()=>{let e;"multi"===G?en.length>0&&(e=await ey.addSchemaDiffCheck(),e_(),eh({type:"schema_diff",selected:"multi"})):ee?(e=await ig({node_id:ee.id}),eh({type:"schema_diff",selected:"single"})):(e=await ig({select:Q.select,exclude:Q.exclude,packages:Q.packages,view_mode:Q.view_mode}),eh({type:"schema_diff",selected:"none"})),e&&ef(e)},cancel:ey.cancel,actionState:ey.actionState};return(0,i.jsxs)(is.Provider,{value:eS,children:[(0,i.jsxs)(tw,{sizes:ee?[70,30]:[100,0],minSize:ee?400:0,gutterSize:ee?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nm.g,{ref:m,divider:(0,i.jsx)(tG.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lg,{}),(0,i.jsx)(lE,{})]}),(0,i.jsxs)(R.x$,{nodeTypes:lT,edgeTypes:lI,nodes:b,edges:C,onNodesChange:w,onEdgesChange:S,onNodeClick:(e,n)=>{if(!1!==d&&z){if(eC(),"single"===G){ee||ep(n);let[e,t]=q(Array.from(T(L(z,[n.id]),O(z,[n.id]))),b,C);k(N(n.id,e)),_(t)}else if("action_result"===G){var t,i,l,r;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&K(null===(r=n.data.action)||void 0===r?void 0:null===(l=r.run)||void 0===l?void 0:l.run_id),ep(n),k(N(n.id,b))}else{let e=V(n.id,b);e.find(e=>e.data.isSelected)||($("single"),e=P(e)),k(e)}}},onNodeMouseEnter:(e,n)=>{if(!z||ee||"single"!==G)return;let[t,i]=q(Array.from(T(L(z,[n.id]),O(z,[n.id]))),b,C);k(t),_(i)},onNodeMouseLeave:(e,n)=>{ee||em()},onNodeContextMenu:(e,n)=>{if(!d||"action_result"===G)return;e.preventDefault();let t=y.current.getBoundingClientRect(),i=y.current.offsetTop;ea({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),el(!0)},onClick:eC,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:d,ref:y,children:[(0,i.jsx)(t4.A,{color:"#ccc"}),(0,i.jsx)(t6.Z,{showInteractive:!1,position:"top-right",className:iR,children:(0,i.jsx)(t6.B,{title:"copy image",onClick:async()=>{g()},children:(0,i.jsx)(s.J,{as:t7.C3L})})}),(0,i.jsx)(v,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(lj,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsxs)(o.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",children:[(0,i.jsx)(tY.r,{isChecked:ed,onChange:e=>{var n;let t=e.target.checked;eu(t),em(t),n={enabled:t},ec.j("[Experiment] breaking_change_analysis",n),ev=n.enabled},alignItems:"center"}),(0,i.jsx)(o.k,{alignItems:"center",children:(0,i.jsx)(er.x,{fontSize:"10pt",lineHeight:"1",children:"Breaking Change Analysis"})}),(0,i.jsxs)(t$.J,{trigger:"hover",placement:"top-start",children:[(0,i.jsx)(t0.x,{children:(0,i.jsx)(s.J,{boxSize:"10px",as:t2.h,color:"gray.500",cursor:"pointer"})}),(0,i.jsx)(t1.y,{bg:"black",color:"white",children:(0,i.jsxs)(t5.b,{fontSize:"sm",children:["Breaking changes are determined by analyzing SQL for changes that may impact downstream models."," ",(0,i.jsx)(r.r,{href:"https://datarecce.io/docs/features/breaking-change-analysis/",target:"_blank",children:"Learn more"}),"."]})})]}),(0,i.jsx)(c.C,{color:"gray",children:"Experiment"})]}),0==b.length&&(0,i.jsx)(er.x,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,i.jsx)(t3.a,{nodeColor:lD,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===G&&(0,i.jsx)(R.s_,{position:"bottom-center",className:iR,children:(0,i.jsx)(lr,{onClose:()=>{e_()}})})]}),ei&&(0,i.jsx)(nq.v,{isOpen:!0,onClose:eC,children:(0,i.jsxs)(nP.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(es.x,"px"),top:"".concat(es.y,"px")},children:[(0,i.jsx)(nK.s,{icon:(0,i.jsx)(iu.Cv2,{}),onClick:()=>{ek(1)},children:"Select parent nodes"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(iu.IMj,{}),onClick:()=>{ew(1)},children:"Select child nodes"}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(iu.Cv2,{}),onClick:()=>{ek()},children:"Select all upstream nodes"}),(0,i.jsx)(nK.s,{icon:(0,i.jsx)(iu.IMj,{}),onClick:()=>{ew()},children:"Select all downstream nodes"})]})})]}),"single"===G&&ee?(0,i.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(ll,{node:ee,onCloseNode:()=>{em()}})}):(0,i.jsx)(l.x,{})]}),eb.AlertDialog]})}),lA=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(lM,{viewOptions:l,interactive:!1,ref:n})})})});function lF(e){let{name:n,description:t,type:l,params:r,viewOptions:s}=e,o={name:n,description:t,type:l,params:r};s&&(o.view_options=s);let a=iy.ZP.stringify({checks:[o]});return(0,i.jsx)(tW.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 lq(){let e=(0,Y.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function lN(){let e=(0,n7._)(["\n
","\n\n ","\n\n
"]);return lN=function(){return e},e}let lV=e=>{var n,t,r,a,c,f,g,v;let{checkId:k}=e,w=(0,b.NL)(),[,C]=(0,eA.TH)(),{successToast:_,failToast:S}=tN(),{markedAsApprovedToast:z}=lq(),[R,E]=(0,j.useState)(),[T,I]=(0,j.useState)(),[D,L]=(0,j.useState)(!1),{isOpen:O,onOpen:M,onClose:A}=(0,$.q)(),F=()=>(0,i.jsx)(en.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[q,N]=(0,j.useState)((0,i.jsx)(F,{})),{isLoading:V,error:H,data:P}=(0,y.a)({queryKey:W.check(k),queryFn:async()=>n6(k),refetchOnMount:!0}),K=R||(null==P?void 0:null===(n=P.last_run)||void 0===n?void 0:n.run_id),{run:B,error:J}=ij(K),U=R?!B||"running"===B.status:(null==B?void 0:B.status)==="running",Q=(null==P?void 0:P.type)?nX(null==P?void 0:P.type):void 0,Z=(null==P?void 0:P.is_preset)||!1,X=(0,j.useRef)(null),{mutate:G}=(0,tp.D)({mutationFn:e=>n3(k,e),onSuccess:()=>{w.invalidateQueries({queryKey:W.check(k)}),w.invalidateQueries({queryKey:W.checks()})}}),{mutate:Y}=(0,tp.D)({mutationFn:()=>n9(k),onSuccess:()=>{w.invalidateQueries({queryKey:W.checks()}),C("/checks")}}),es=(0,j.useCallback)(async()=>{(null==P?void 0:P.type)&&(E((await ek(k,{nowait:!0})).run_id),w.invalidateQueries({queryKey:W.check(k)}))},[P,k,E,w]),ea=(0,j.useCallback)(async()=>{if(L(!0),K)return await eb(K)},[K]),ed=async()=>{var e;if(!P)return;let n=(e=P,(0,tq.RI)(lN(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tH(e),"\n\n").concat((0,tq.Pn)(tV(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tH(e)}(e)));if(!navigator.clipboard){S("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(n),_("Copied the check to the clipboard")}catch(e){S("Failed to copy the check to clipboard",e)}},ec=(0,j.useCallback)(()=>{let e=null==P?void 0:P.is_checked;G({is_checked:!e}),!0==!e&&z()},[null==P?void 0:P.is_checked,G,z]),eu=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!(null==n?void 0:n.error)),[eh,ex]=(0,j.useState)(0),{ref:em,onCopyToClipboard:ep,onMouseEnter:ef,onMouseLeave:eg}=iT();if(V)return(0,i.jsx)(e8.M,{h:"100%",children:"Loading"});if(H)return(0,i.jsxs)(e8.M,{h:"100%",children:["Error: ",H.message]});let ev=(null==B?void 0:B.run_at)?(0,tZ.Q)(new Date(B.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tC,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)(tm,{name:(null==P?void 0:P.name)||"",setName:e=>{G({name:e})}}),Z&&(0,i.jsx)(nS.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(te.Vp,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,i.jsx)(te.AD,{boxSize:"14px",as:td.bX4}),"Preset"]})}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{mr:"10px",children:[ev&&(0,i.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ev}),(0,i.jsxs)(nq.v,{children:[(0,i.jsx)(nN.j,{isRound:!0,as:nV.h,icon:(0,i.jsx)(s.J,{as:nt.D_A}),variant:"ghost",size:"sm"}),(0,i.jsxs)(nP.q,{children:[(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(tc.ovA,{}),onClick:()=>{N((0,i.jsx)(F,{})),M()},children:"Get Preset Check Template"}),(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(tr.T,{}),onClick:()=>ed(),children:"Copy Markdown"}),(0,i.jsx)(tn.R,{}),(0,i.jsx)(nK.s,{as:er.x,fontSize:"10pt",icon:(0,i.jsx)(ts.p,{}),color:"red",onClick:()=>Y(),children:"Delete"})]})]}),(0,i.jsx)(nS.u,{label:eu(null!==(f=null==P?void 0:P.type)&&void 0!==f?f:"",B)?"Run the check first":(null==P?void 0:P.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(eo.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==P?void 0:P.is_checked)?"green":"gray",variant:(null==P?void 0:P.is_checked)?"solid":"outline",leftIcon:(null==P?void 0:P.is_checked)?(0,i.jsx)(to.r,{}):(0,i.jsx)(s.J,{as:nt.Rbx,color:"lightgray"}),onClick:()=>ec(),isDisabled:eu(null!==(g=null==P?void 0:P.type)&&void 0!==g?g:"",B),children:(null==P?void 0:P.is_checked)?"Approved":"Mark as Approved"})})]})]}),(0,i.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tF,{value:null==P?void 0:P.description,onChange:e=>{G({description:e})}},null==P?void 0:P.check_id)})]}),(0,i.jsx)(l.x,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:eh,onChange:ex,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==P?void 0:P.type)==="query"||(null==P?void 0:P.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{mr:"10px",children:[(null==Q?void 0:Q.RunResultView)&&(0,i.jsx)(nS.u,{label:"Rerun",children:(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(ta.n,{}),variant:"outline",isLoading:U,size:"sm",onClick:()=>es(),children:"Rerun"})}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(tr.T,{}),variant:"outline",isDisabled:eu(null!==(v=null==P?void 0:P.type)&&void 0!==v?v:"",B)||0!==eh,onMouseEnter:ef,onMouseLeave:eg,size:"sm",onClick:()=>{if((null==P?void 0:P.type)==="lineage_diff"){var e;null===(e=X.current)||void 0===e||e.copyToClipboard()}else ep()},children:"Copy to Clipboard"})]})]}),(0,i.jsxs)(tt.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(ti.x,{p:0,width:"100%",height:"100%",children:[(null==Q?void 0:Q.RunResultView)&&((null==P?void 0:P.last_run)||K?(0,i.jsx)(tQ,{ref:em,isRunning:U,isAborting:D,run:K?B:null==P?void 0:P.last_run,error:J,progress:T,RunResultView:Q.RunResultView,viewOptions:null==P?void 0:P.view_options,onViewOptionsChanged:e=>{G({view_options:e})},onCancel:ea,onExecuteRun:es}):(0,i.jsx)(e8.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsxs)(nm.g,{spacing:4,children:[(0,i.jsx)(l.x,{children:"This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here."}),(0,i.jsx)(eo.z,{onClick:es,colorScheme:"blue",size:"sm",children:"Run Query"})]})})),P&&"schema_diff"===P.type&&(0,i.jsx)(tM,{check:P,ref:em}),P&&"lineage_diff"===P.type&&(0,i.jsx)(lA,{check:P,ref:X})]}),((null==P?void 0:P.type)==="query"||(null==P?void 0:P.type)==="query_diff"||(null==P?void 0:P.type)==="query_base")&&(0,i.jsx)(ti.x,{p:0,height:"100%",width:"100%",children:(null===(t=P.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tB,{value:(null==P?void 0:null===(r=P.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==P?void 0:null===(a=P.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tK,{value:(null==P?void 0:null===(c=P.params)||void 0===c?void 0:c.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(ee.u_,{isOpen:O,onClose:A,isCentered:!0,size:"6xl",children:[q,(0,i.jsxs)(et.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(ei.x,{children:"Preset Check Template"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.f,{children:[(0,i.jsx)(d.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(tl.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)(lF,{name:(null==P?void 0:P.name)||"",description:(null==P?void 0:P.description)||"",type:(null==P?void 0:P.type)||"",params:null==P?void 0:P.params,viewOptions:null==P?void 0:P.view_options})]})]})]})]})};var lH=t(35019);let lP=e=>{var n;let{check:t,selected:r,onSelect:a,onMarkAsApproved:d}=e,c=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,tp.D)({mutationFn:e=>n3(u,e),onSuccess:()=>{c.invalidateQueries({queryKey:W.check(u)}),c.invalidateQueries({queryKey:W.checks()})}}),x=(null===(n=nX(t.type))||void 0===n?void 0:n.icon)||eF.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:r?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:r?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nS.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(np.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):d()}})})})]})})},lW=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[a,d]=(0,j.useState)(!1),c=(0,b.NL)(),{mutate:u}=(0,tp.D)({mutationFn:e=>n3(e,{is_checked:!0}),onSuccess:(e,n)=>{c.invalidateQueries({queryKey:W.check(n)}),c.invalidateQueries({queryKey:W.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,$.q)(),{markedAsApprovedToast:p}=lq(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lH.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(lH.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nm.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(lH._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,l=e.style.top-t.y;e.style.left=i,e.style.top=l}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(lP,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(ee.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{width:"400px",children:[(0,i.jsx)(ei.x,{children:"Mark as Approved?"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(nz.i,{}),(0,i.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(np.X,{isChecked:a,onChange:e=>d(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nz.i,{}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};async function lK(e){return(await Q.post("/api/save-as",e)).data}async function lB(e){return(await Q.post("/api/rename",e)).data}async function lJ(){return(await Q.post("/api/export")).data}async function lU(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await Q.post("/api/import",t)).data}async function lQ(){return 208===(await Q.get("/api/sync")).status}async function lZ(e){try{let n=await Q.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,ly.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}function lX(e){let{checksOnly:n=!0}=e,t=(0,Y.p)(),l=(0,b.NL)(),r=(0,j.useRef)(null),a=(0,j.useRef)(null),[d,c]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,$.q)(),[m,p]=(0,eA.TH)(),[,f]=eL(),g=(0,j.useCallback)(async()=>{if(d){try{let{runs:e,checks:i}=await lU(d,n);f(),await l.invalidateQueries({queryKey:W.checks()}),await l.invalidateQueries({queryKey:W.runs()}),m.includes("/checks")&&p("/checks");let r=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:r,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[l,d,t,x,m,p,f,n]),v=n?"checks":"runs and checks",{isDemoSite:y}=eD();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Import Checklist from State File"+(y?" (Disabled in the demo site)":""),children:(0,i.jsx)(nV.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{r.current&&r.current.click()},icon:(0,i.jsx)(s.J,{as:i4}),isDisabled:y})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(c(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,i.jsx)(lw.aR,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(en.Z,{children:(0,i.jsxs)(lw._T,{children:[(0,i.jsx)(ei.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(el.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)(t9.s,{color:"red.600"}),(0,i.jsx)(er.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(er.x,{children:["The current ",v," will be"," ",(0,i.jsx)(er.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}let lG=()=>{let[,e]=(0,eA.TH)(),[,n]=(0,eA.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=tN(),a=null==n?void 0:n.checkId,{isLoading:d,error:c,data:u,status:h}=(0,y.a)({queryKey:W.checks(),queryFn:n4,refetchOnMount:!0}),x=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,p]=(0,j.useState)(u||[]),{mutate:f}=(0,tp.D)({mutationFn:e=>n8(e),onSuccess:()=>{t.invalidateQueries({queryKey:W.checks()})}}),g=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),f({source:e,destination:n}),p(t)},[m,p,f]);return((0,j.useCallback)(async()=>{let e=await n5();t.invalidateQueries({queryKey:W.checks()}),x(e.check_id)},[t,x]),(0,j.useEffect)(()=>{"success"===h&&(!a&&u.length>0&&e("/checks/".concat(u[0].check_id)),p(u))},[h,a,u,p,e]),d)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,i.jsxs)(tw,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nm.g,{spacing:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(o.k,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(lX,{checksOnly:!0})}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(lW,{checks:m,selectedItem:a,onCheckSelected:x,onChecksReordered:g})]})}),(0,i.jsx)(l.x,{height:"100%",children:(0,i.jsx)(eA.rs,{children:(0,i.jsx)(eA.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(lV,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e8.M,{h:"100%",children:(0,i.jsx)(l.x,{children:"No checks"})})},lY=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n0();return(0,i.jsxs)(l.x,{children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,i.jsx)(eo.z,{leftIcon:(0,i.jsx)(s.J,{as:nt.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ex({name:"hide"}),t()):(ex({name:"show"}),n())},children:e?"Hide":"Show"})]})},l$=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=_();return(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(l.x,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nS.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(t9.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(tY.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},l0=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:d}=_(),{envInfo:c}=eD(),u=e;(null==c?void 0:c.adapterType)==="sqlmesh"&&e===k&&(u="select * from db.mymodel");let{showRunId:x}=n0(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iM;case"query_base":return iA;case"query_diff":return iF;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,d&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return x(r),await ey(r)},{mutate:p,isPending:f}=(0,tp.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(lY,{}),(0,i.jsx)(l$,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iP,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(l.x,{width:"100%",flex:"1",children:d?(0,i.jsx)(tB,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tK,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var l1=t(58172);let l5=e=>(0,l1.c4)("#!"+e),l2=()=>[(0,l1.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),l5];var l4=t(98907),l6=t(55263);let l3=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:W.run(t),queryFn:async()=>ey(t)}),o=(null==s?void 0:s.type)?null===(n=nX(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tQ,{isPending:l,error:r,run:s,RunResultView:o})},l9=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e8.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)(d.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(eo.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},l8=e=>{let{children:n}=e;return(0,i.jsx)(tU.SV,{fallback:l9,children:n})};function l7(){let e=(0,Y.p)(),n=async()=>{try{let e=await lJ(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,i_.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");iz()(t,l)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nS.u,{label:"Export",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:i2,verticalAlign:"middle",boxSize:"16px"})})})}function re(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(lM,{interactive:!0})})}t(94167);let rn=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(ei.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:4,children:[(0,i.jsxs)(t_.aV,{spacing:2,children:[(0,i.jsx)(t_.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(t_.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(t_.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})},rt=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)(ee.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{maxW:"40vw",h:"300px",children:[(0,i.jsx)(ei.x,{children:"All nodes displayed"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(el.f,{children:(0,i.jsxs)(tP.K,{spacing:4,children:[(0,i.jsx)(er.x,{children:"In a single environment with only a target, no nodes are marked as changed."}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(t2.h,{mt:"10px",ml:"5px"}),(0,i.jsxs)(er.x,{margin:"5px",paddingX:"3px",children:["To see changed nodes, configure a target-base."," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",onClick:()=>ef({action:"external_link",from:"onboarding"}),children:"Learn how."})]})]})]})}),(0,i.jsx)(nz.i,{}),(0,i.jsx)(es.m,{children:(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})};var ri=()=>{let[e,n]=(0,j.useState)(!1),[t,l]=(0,j.useState)(!1),{data:r,isLoading:s}=eE();(0,j.useEffect)(()=>{if(!s&&r){let e=r.show_onboarding_guide;if(r.single_env_onboarding&&e){l(!0),ef({action:"onboarding"});return}!localStorage.getItem("hasVisited")&&e&&(n(!0),localStorage.setItem("hasVisited","true"))}},[r,s]);let o=()=>{n(!1),l(!1),ez()};return s?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rn,{isGuideOpen:e,closeGuide:o}),(0,i.jsx)(rt,{isGuideOpen:t,closeGuide:o})]})},rl=t(23899);t(55180);let rr=e=>{var n;let{run:t,isSelected:r,onSelectRun:a,onAddToChecklist:d,onGoToCheck:c}=e,{data:u}=(0,y.a)({queryKey:W.run(t.run_id),queryFn:async()=>await ey(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nX(t.type))||void 0===n?void 0:n.icon)||eF.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:r?"orange.400":"transparent",backgroundColor:r?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:r?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nS.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(er.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(x)},children:(0,i.jsx)(s.J,{color:"green",as:tS.FJM})})}):(0,i.jsx)(nS.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(er.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),ex({name:"add_to_checklist"}),d(t.run_id)},children:(0,i.jsx)(s.J,{as:tS.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(iI,{run:u||t})})]})},rs=e=>{let{runAt:n}=e,t=n?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":t.toDateString()===e.toDateString()?"Yesterday":(0,i_.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(o.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},ro=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:W.runs(),queryFn:async()=>await eC(),retry:!1}),{showRunId:a,runId:c}=n0(),x=e=>{ex({name:"click_run"}),a(e,!1)},[,m]=(0,eA.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!c)return;let e=await n2(c);p.invalidateQueries({queryKey:W.checks()}),m("/checks/".concat(e.check_id))},[c,m,p]),g=(0,j.useCallback)(e=>{ex({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=null;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(d.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nV.h,{variant:"unstyled",icon:(0,i.jsx)(ta.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(e8.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(rl.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(rs,{runAt:e.run_at},t),(0,i.jsx)(rr,{run:e,isSelected:e.run_id===c,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var ra=t(45828),rd=t(12415);let{definePartsStyle:rc,defineMultiStyleConfig:ru}=(0,rd.D)(ra.TB.keys),rh=ru({variants:{circular:rc({control:(0,rd.k0)({rounded:"full"})})},sizes:{xs:rc({icon:(0,rd.k0)({fontSize:"8px"}),control:(0,rd.k0)({boxSize:"16px",padding:"4px"}),label:(0,rd.k0)({fontSize:"xs"})})}}),rx=(0,t(2809).fj)({baseStyle:{borderRadius:"4px"}});var rm=t(25301);let rp=()=>{let e=(0,Y.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,t)=>{var i,l;e({description:t?t instanceof ly.d7?"".concat(n,". ").concat(null==t?void 0:null===(l=t.response)||void 0===l?void 0:null===(i=l.data)||void 0===i?void 0:i.detail):"".concat(n,". ").concat(t):"".concat(n),status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},rf=e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},rg=()=>{let{fileName:e,cloudMode:n,isDemoSite:t,isLoading:r}=eD(),a=(0,$.q)(),d=(0,$.q)(),c=!e&&!n&&!t,{data:u}=(0,y.a)({queryKey:W.checks(),queryFn:n4,enabled:c}),h=void 0!=u&&u.filter(e=>!e.is_preset).length>0;rf(c&&h);let[{newFileName:x,errorMessage:m,modified:p,overwriteWithMethod:f,bypass:g},v]=(0,j.useState)({newFileName:e||"recce_state.json"}),k=(0,j.useRef)(null),{toastSuccess:w,toastError:C}=rp(),_=(0,b.NL)(),S=async(e,n)=>{if(!x)return;let t="true"===localStorage.getItem(iU.bypassSaveOverwrite);try{"save"===e?await lK({filename:x,overwrite:n||t}):await lB({filename:x,overwrite:n||t}),w("save"===e?"Save file successfully":"Rename file successfully"),_.invalidateQueries({queryKey:W.lineage()}),g&&localStorage.setItem(iU.bypassSaveOverwrite,"true")}catch(n){if(n instanceof ly.d7){var i;if((null===(i=n.response)||void 0===i?void 0:i.status)===409){v(n=>({...n,overwriteWithMethod:e})),d.onOpen();return}}C("save"===e?"Save file failed":"Rename file failed",n)}finally{a.onClose()}};return n||t?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{flex:"1",justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.x,{fontWeight:"600",children:e||(n?"cloud":"New Instance"+(h?" (unsaved)":""))}),(0,i.jsx)(nS.u,{label:e?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(nV.h,{onClick:()=>{v({newFileName:e||"recce_state.json",modified:!e}),a.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,i.jsx)(s.J,{as:e?i3:i6,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsxs)(ee.u_,{isOpen:a.isOpen,onClose:a.onClose,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:e?"Change Filename":"Save File"}),(0,i.jsx)(eO.o,{}),(0,i.jsx)(el.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(eq.NI,{isInvalid:!!m,children:[(0,i.jsx)(eN.l,{children:"File name:"}),(0,i.jsx)(nM.I,{ref:k,value:x,placeholder:"Enter filename",onChange:n=>{let t;let i=n.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?e&&i===e&&(t="Filename is the same as the current one."):t="Invalid filename. Only alphanumeric, space, _ and - are allowed.":t="Filename must end with .json.":t="Filename cannot be empty.",v(e=>({...e,modified:!0,newFileName:i,errorMessage:t}))},onKeyDown:n=>{"Enter"===n.key?m||(e?S("rename"):S("save")):"Escape"===n.key&&a.onClose()}}),(0,i.jsx)(rm.J1,{children:m})]})}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{size:"sm",colorScheme:e?void 0:"blue",onClick:()=>{S("save")},isDisabled:!x||!!m||!p,children:e?"Save as New File":"Confirm"}),e&&(0,i.jsx)(eo.z,{size:"sm",colorScheme:"blue",onClick:()=>{S("rename")},isDisabled:!x||!!m||!p,children:"Rename"})]})]})]}),(0,i.jsxs)(ee.u_,{isOpen:d.isOpen,onClose:d.onClose,initialFocusRef:k,isCentered:!0,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{children:"Overwrite File?"}),(0,i.jsx)(eO.o,{}),(0,i.jsxs)(el.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.x,{fontSize:"12pt",children:"save"===f?"Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?":"Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?"}),(0,i.jsx)(np.X,{isChecked:g,onChange:e=>v(n=>({...n,bypass:e.target.checked})),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsxs)(es.m,{gap:"5px",children:[(0,i.jsx)(eo.z,{variant:"outline",onClick:()=>{d.onClose(),a.onOpen(),v(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(eo.z,{size:"sm",colorScheme:"blue",onClick:()=>{f&&(S(f,!0),d.onClose())},children:"Overwrite"})]})]})]})]})};var rv=t(68883),rj=t(16375);function ry(){return(0,i.jsx)(nS.u,{label:"Syncing",children:(0,i.jsx)(eo.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,i.jsx)(tX.$,{})})})}function rb(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[r,o]=(0,eA.TH)(),{isOpen:a,onOpen:d,onClose:c}=(0,$.q)(),[u,h]=(0,j.useState)(""),x=(0,Y.p)(),m=(0,j.useCallback)(async e=>{if(c(),n(!0),"conflict"===(await lZ(e)).status){d(),n(!1);return}for(;await lQ();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:W.lineage()}),t.invalidateQueries({queryKey:W.checks()}),t.invalidateQueries({queryKey:W.runs()}),/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(r)&&o("/checks")},[t,r,o,x,d,c]);return e?(0,i.jsx)(ry,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nS.u,{label:"Sync with Cloud",children:(0,i.jsx)(nV.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:i5,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsxs)(ee.u_,{isOpen:a,onClose:c,children:[(0,i.jsx)(en.Z,{}),(0,i.jsxs)(et.h,{children:[(0,i.jsx)(ei.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(el.f,{children:[(0,i.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.x,{mt:"5px",children:(0,i.jsx)(rv.E,{onChange:h,value:u,children:(0,i.jsxs)(tP.K,{direction:"column",children:[(0,i.jsxs)(rj.Y,{value:"merge",children:["Merge",(0,i.jsx)(nS.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:t2.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rj.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nS.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:t2.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rj.Y,{value:"revert",children:["Revert",(0,i.jsx)(nS.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:t2.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(es.m,{children:[(0,i.jsx)(eo.z,{onClick:c,mr:3,children:"Cancel"}),(0,i.jsx)(eo.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let rk=e=>{let{children:n,path:t}=e,[r]=(0,eA.yj)(t);return(0,i.jsx)(l.x,{display:r?"block":"none",height:"100%",children:n})};function rw(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.r,{height:"20px",color:"white",href:t,isExternal:!0,...l,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function rC(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eD(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await Q.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},v=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"cloud mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:nt.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"demo mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:nt.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rw,{icon:tS.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rw,{icon:tS.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rw,{mr:"18px",icon:tS.MXt,href:"https://datarecce.io/docs"})]})}function r_(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.x,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function rS(){let{isDemoSite:e,reviewMode:n,fileMode:t,cloudMode:r,isLoading:s}=eD(),[a,d]=(0,eA.TH)(),{data:c,isLoading:u}=eE(),h=(0,i.jsx)(r_,{queryKey:W.checks(),fetchCallback:n4,selectCallback:e=>e.filter(e=>!e.is_checked).length}),f=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query",disable:(null==c?void 0:c.single_env_onboarding)===!0},{name:"Checklist",href:"/checks",badge:h,disable:(null==c?void 0:c.single_env_onboarding)===!0}],g=eP().findIndex(f,e=>{let{href:n}=e;return a.startsWith(n)});return(0,i.jsx)(x.m,{index:g,children:(0,i.jsxs)(m.t,{children:[(0,i.jsx)(l.x,{flex:"1",display:"flex",children:f.map(e=>{let{name:n,href:t,badge:l,disable:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{d(t)},isDisabled:s||u||r,hidden:r,children:[n,l]},n)})}),!s&&!e&&(0,i.jsx)(rg,{}),!s&&(0,i.jsxs)(o.k,{flex:"1",justifyContent:"right",alignItems:"center",mr:"8px",children:[r&&(0,i.jsx)(rb,{}),(0,i.jsx)(l7,{}),(0,i.jsx)(le,{})]})]})})}function rz(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=n0(),[r]=(0,eA.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(tw,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(l.x,{style:{contain:"size"},children:o&&(0,i.jsx)(ro,{})}),(0,i.jsxs)(tC,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,i.jsxs)(l8,{children:[(0,i.jsx)(rk,{path:"/lineage",children:(0,i.jsx)(re,{})}),(0,i.jsxs)(eA.rs,{children:[(0,i.jsx)(eA.AW,{path:"/query",children:(0,i.jsx)(l0,{})}),(0,i.jsx)(eA.AW,{path:"/checks/:slug*",children:(0,i.jsx)(lG,{})}),(0,i.jsx)(eA.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(l3,{runId:n})}}),(0,i.jsx)(eA.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eA.AW,{children:(0,i.jsx)(eA.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(iO,{onClose:t}):(0,i.jsx)(l.x,{})]})]})}let rR=(0,g.B1)({components:{Checkbox:rh,Tooltip:rx}});function rE(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=eu.env.AMPLITUDE_API_KEY;if(n&&t)try{ec.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,l4.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(l6.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rR,children:(0,i.jsx)(b.aH,{client:Z,children:(0,i.jsx)(eA.F0,{hook:l2,children:(0,i.jsx)(n1,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(rC,{}),(0,i.jsx)(rS,{}),(0,i.jsx)(ri,{}),(0,i.jsx)(rz,{})]})})})})})})}},92075:function(){},74229:function(){},54351:function(){},57920:function(){}},function(e){e.O(0,[32,524,434,678,509,648,989,147,995,739,283,303,22,25,355,495,599,852,323,95,312,744],function(){return e(e.s=53770)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/index.html b/recce/data/index.html index af7a6562..c38b218c 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 1d3da989..46e6f300 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,7 +1,7 @@ 2:I[38443,[],"ClientPageRoot"] -3:I[53202,["524","static/chunks/b3b1872b-97ea0be5bd9b42bc.js","434","static/chunks/868e7b5c-36d94ba5a58a2e6a.js","678","static/chunks/3998a672-e71829c331c77ccb.js","509","static/chunks/9746af58-daab848e55b5faf7.js","648","static/chunks/ce84277d-ced9559f73764a27.js","989","static/chunks/47d8844f-ccb4e71fbabd12f3.js","147","static/chunks/a30376cd-ea4617387c84b12e.js","995","static/chunks/fee69bc6-2cf346c884a74e9d.js","739","static/chunks/7a8a3e83-f7fe5f14c56108bf.js","283","static/chunks/450c323b-79414be6f43ef15c.js","303","static/chunks/36e1c10d-3bcdd9bb8564108c.js","22","static/chunks/29e3cc0d-490dbff344996865.js","25","static/chunks/b63b1b3f-13deddaaba264453.js","355","static/chunks/7f27ae6c-c484e79185298424.js","495","static/chunks/6dc81886-03da5372308c376d.js","599","static/chunks/c132bf7d-740a7144e614cb2d.js","852","static/chunks/cf0511cf-88e5bf54e88504a3.js","323","static/chunks/323-9565a741f1447d32.js","931","static/chunks/app/page-ce314ab95f8c9bf7.js"],"default",1] +3:I[17149,["524","static/chunks/b3b1872b-97ea0be5bd9b42bc.js","434","static/chunks/868e7b5c-36d94ba5a58a2e6a.js","678","static/chunks/3998a672-e71829c331c77ccb.js","509","static/chunks/9746af58-daab848e55b5faf7.js","648","static/chunks/ce84277d-ced9559f73764a27.js","989","static/chunks/47d8844f-ccb4e71fbabd12f3.js","147","static/chunks/a30376cd-ea4617387c84b12e.js","995","static/chunks/fee69bc6-2cf346c884a74e9d.js","739","static/chunks/7a8a3e83-f7fe5f14c56108bf.js","283","static/chunks/450c323b-79414be6f43ef15c.js","303","static/chunks/36e1c10d-3bcdd9bb8564108c.js","22","static/chunks/29e3cc0d-490dbff344996865.js","25","static/chunks/b63b1b3f-13deddaaba264453.js","355","static/chunks/7f27ae6c-c484e79185298424.js","495","static/chunks/6dc81886-03da5372308c376d.js","599","static/chunks/c132bf7d-740a7144e614cb2d.js","852","static/chunks/cf0511cf-88e5bf54e88504a3.js","323","static/chunks/323-9565a741f1447d32.js","931","static/chunks/app/page-2d7acb049c85a3ee.js"],"default",1] 4:I[60299,[],""] 5:I[43276,[],""] -0:["ICnbYsopIqcOeo_6p-aHK",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d7428fe54fca42f.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"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":[]}]}]}]],null],null],["$L6",null]]]] +0:["ET1s0HXNQYFRZkI_EwdVV",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d7428fe54fca42f.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"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":[]}]}]}]],null],null],["$L6",null]]]] 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