recce-nightly 1.22.0.20251028__py3-none-any.whl → 1.23.0.20251030__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of recce-nightly might be problematic. Click here for more details.

@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{3870:()=>{},50543:()=>{},50837:()=>{},84944:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>iI});var i=t(87259),l=t(20029),r=t(16766),s=t(13544),o=t(76976),a=t(85560),c=t(59773),d=t(77480),u=t(58676),h=t(68018),x=t(11469),p=t(50274),m=t(23866),f=t(2667),j=t(80715),g=t(73295),v=t(82206);t(42104);var y=t(16873),b=t(69504);async function w(e,n){let t=(0,b.XJ)()?{breaking_change_analysis:!0}:{};return(await v.g.post("/api/checks",{run_id:e,view_options:n,track_props:t})).data}async function k(){return(await v.g.get("/api/checks")).data}async function C(e){return(await v.g.get("/api/checks/".concat(e))).data}async function _(e,n){return(await v.g.patch("/api/checks/".concat(e),n)).data}async function S(e){return(await v.g.delete("/api/checks/".concat(e))).data}async function z(e){return await v.g.post("/api/checks/reorder",e)}var E=t(16131),D=t(21104),I=t(44336),R=t(29868),T=t(17618),N=t(94741),F=t(79100),q=t(38201),A=t(87442),L=t(45633),M=t(83683),O=t(95076),P=t(29677),X=t(27353),K=t(62217),Q=t(43888),W=t(33798);function $(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,c,d]),(0,i.jsx)(Q.Yl,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",className:"no-track-pii-safe",overflow:"hidden",children:(0,i.jsx)(Q.J5,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(W.p,{ref:c,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"100%"}):(0,i.jsx)(l.a,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var B=t(96719),V=t(86942),Z=t(72179),H=t(55155),U=t(5748);t(50837);var G=t(54064),J=t(48496),Y=t(36501),ee=t(12865);let en=(0,j.createContext)(void 0),et=()=>{let e=(0,j.useContext)(en);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},ei=()=>(0,j.useContext)(en);var el=t(21851);function er(e){let{model:n,row:t,singleEnv:r,cllRunning:o}=e,a=ei(),{runAction:c}=(0,G.tr)(),{featureToggles:u}=(0,ee.c)(),{name:h,baseType:x,currentType:m,baseIndex:f,currentIndex:j}=t,g=null!=m?m:x,v=!x||!m;return(0,i.jsx)(el.m,{content:"View column lineage",positioning:{placement:"top"},showArrow:!0,disabled:void 0===a||void 0!==f&&void 0===j,children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.a,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:h}),(0,i.jsx)(p.h,{}),o&&(0,i.jsx)(J.y,{size:"xs",color:"gray.400"}),!r&&"source"!==n.resource_type&&(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(A.K,{display:"flex",className:"row-context-menu",variant:"plain",size:"sm",color:"gray",_hover:{color:"black"},disabled:u.disableDatabaseQuery,onClick:e=>{e.stopPropagation()},children:(0,i.jsx)(s.I,{as:B.EUt})})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{lineHeight:"20px",children:(0,i.jsxs)(q.Uh,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(q.Dr,{value:"profile-diff",fontSize:"10pt",onClick:()=>{c("profile_diff",{model:n.name,columns:[h]},{showForm:!1})},disabled:v,children:"Profile Diff"}),(0,i.jsx)(q.Dr,{value:"histogram-diff",fontSize:"10pt",onClick:()=>{c("histogram_diff",{model:n.name,column_name:h,column_type:g},{showForm:!1})},disabled:v||!g||!(0,Y.c)(g),children:"Histogram Diff"}),(0,i.jsx)(q.Dr,{value:"top-k-diff",fontSize:"10pt",onClick:()=>{c("top_k_diff",{model:n.name,column_name:h,k:50},{showForm:!1})},disabled:v,children:"Top-k Diff"})]})})})})]})]})})}function es(e,n,t){function l(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&!0===e.reordered?"column-index-reordered schema-column schema-column-index":"schema-column schema-column-index"}function r(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&e.baseType!==e.currentType?"column-body-type-changed schema-column":"schema-column"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:s}=e;return n?(0,i.jsx)(er,{model:n,row:r,cllRunning:null!=(l=null==t?void 0:t.get(r.name))&&l}):r.name},cellClass:function(){return"schema-column"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:r},{key:"currentType",name:"Current Type",resizable:!0,cellClass:r}],rows:Object.values(e)}}var eo=t(68168),ea=t(20989);let ec=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:o=!1}=e,a=ei(),[c,u]=(0,j.useState)(new Map),{columns:h,rows:x}=(0,j.useMemo)(()=>{var e;let n=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((0,U.l)(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),t=null!=(e=null==s?void 0:s.resource_type)?e:null==r?void 0:r.resource_type;return t&&["model","seed","snapshot","source"].includes(t)?es(n,null!=s?s:r,c):es(n)},[r,s,c]),{lineageGraph:p}=(0,H.cE)(),m=!(null==p?void 0:p.catalogMetadata.base),f=!(null==p?void 0:p.catalogMetadata.current);m&&f?t="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":m?t="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":f&&(t="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let g=r&&void 0===r.columns,v=s&&void 0===s.columns;g&&v?l="catalog.json is outdated on both environments. Update catalog.json to get schema information.":g?l="catalog.json is outdated on base environment. Update catalog.json to get schema information.":v&&(l="catalog.json is outdated on current environment. Update catalog.json to get schema information.");let y=async e=>{var n;(0,b.vD)({action:"view",source:"schema_column"}),u(n=>new Map(n).set(e,!0));let t=null!=(n=null==s?void 0:s.id)?n:null==r?void 0:r.id;t&&await (null==a?void 0:a.showColumnLevelLineage({node_id:t,column:e})),u(n=>new Map(n).set(e,!1))},w=null==a?void 0:a.viewOptions.column_level_lineage,k=w?new Set(["".concat(w.node_id,"-").concat(w.column)]):new Set;return(0,i.jsxs)(d.s,{direction:"column",children:[t?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:t})]}):l?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:l})]}):(0,i.jsx)(i.Fragment,{}),x.length>0&&(0,i.jsx)(ea.z,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"0.8rem",borderWidth:1},columns:h,rows:x,rowHeight:35,renderers:{noRowsFallback:(0,i.jsx)(ea.a,{})},className:"rdg-light no-track-pii-safe",ref:n,rowKeyGetter:e=>{var n;let t=null!=(n=null==s?void 0:s.id)?n:null==r?void 0:r.id;return"".concat(t,"-").concat(e.name)},selectedRows:k,onSelectedRowsChange:()=>{},onCellClick:async e=>{(void 0===e.row.baseIndex||void 0!==e.row.currentIndex)&&await y(e.row.name)},rowClass:e=>{let n;if(void 0===e.baseIndex)n="row-added";else{if(void 0===e.currentIndex)return"row-removed";n="row-normal"}return void 0!==a&&(n+=" row-selectable"),n}})]})}),ed=(0,j.forwardRef)(function(e,n){let t,l,{current:r}=e,s=ei(),[o,a]=(0,j.useState)(new Map),{columns:c,rows:u}=(0,j.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;return{columns:[{key:"index",name:"",resizable:!0,minWidth:35,width:35,cellClass:"schema-column schema-column-index"},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:s}=e;return n?(0,i.jsx)(er,{model:n,row:r,cllRunning:null!=(l=null==t?void 0:t.get(r.name))&&l,singleEnv:!0}):r.name},cellClass:"schema-column"},{key:"type",name:"Type",resizable:!0,cellClass:"schema-column"}],rows:Object.entries(e).map((e,n)=>{let[t,i]=e;return{name:t,index:n+1,type:i.type}})}})(null==r?void 0:r.columns,r,o),[r,o]),{lineageGraph:h}=(0,H.cE)();(null==h?void 0:h.catalogMetadata.current)||(t="catalog.json not found. Run `recce debug` to troubleshoot."),r&&void 0===r.columns&&(l="catalog.json is outdated. Update catalog.json to get schema information.");let x=async e=>{(0,b.vD)({action:"view",source:"schema_column"}),a(n=>new Map(n).set(e,!0));let n=null==r?void 0:r.id;n&&await (null==s?void 0:s.showColumnLevelLineage({node_id:n,column:e})),a(n=>new Map(n).set(e,!1))},p=null==s?void 0:s.viewOptions.column_level_lineage,m=p?new Set(["".concat(p.node_id,"-").concat(p.column)]):new Set;return(0,i.jsxs)(d.s,{direction:"column",children:[t?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:t})]}):l?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:l})]}):(0,i.jsx)(i.Fragment,{}),u.length>0&&(0,i.jsx)(ea.z,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:u,renderers:{noRowsFallback:(0,i.jsx)(ea.a,{})},className:"rdg-light",ref:n,rowKeyGetter:e=>{let n=null==r?void 0:r.id;return"".concat(n,"-").concat(e.name)},selectedRows:m,onSelectedRowsChange:()=>{},onCellClick:async e=>{await x(e.row.name)},rowClass:()=>void 0!==s?"row-normal row-selectable":"row-normal"})]})});async function eu(e){return(await v.g.post("/api/select",e)).data}var eh=t(81865);t(50543);let ex=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(eh.A,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},ep=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(eh.A,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var em=t(22322),ef=t(31138),ej=t(44468),eg=t(64153);let ev=B.gAg,ey=B.GKh,eb=B.f6c;function ew(e){return"added"===e?{color:"green.solid",hexColor:String(eg.q.token("colors.green.solid")),backgroundColor:"green.subtle",hexBackgroundColor:String(eg.q.token("colors.green.subtle")),icon:ev}:"removed"===e?{color:"red.solid",hexColor:String(eg.q.token("colors.red.solid")),backgroundColor:"red.subtle",hexBackgroundColor:String(eg.q.token("colors.red.subtle")),icon:ey}:"modified"===e?{color:"orange.emphasized",hexColor:String(eg.q.token("colors.orange.emphasized")),backgroundColor:"orange.subtle",hexBackgroundColor:String(eg.q.token("colors.orange.subtle")),icon:eb}:{color:"gray.focusRing",hexColor:String(eg.q.token("colors.gray.focusRing")),backgroundColor:"white",hexBackgroundColor:String(eg.q.token("colors.white")),icon:void 0}}function ek(e){if("model"===e)return{color:String(eg.q.token("colors.cyan.subtle")),icon:ef.$ZR};if("metric"===e)return{color:String(eg.q.token("colors.rose.subtle")),icon:ej.mJh};if("source"===e)return{color:String(eg.q.token("colors.green.muted")),icon:ef.nBS};if("exposure"===e)return{color:String(eg.q.token("colors.rose.subtle")),icon:ej.nM$};if("semantic_model"===e)return{color:String(eg.q.token("colors.rose.focusRing")),icon:ej.Z4p};else if("seed"===e)return{color:String(eg.q.token("colors.green.emphasized")),icon:ef.b9F};else if("snapshot"===e)return{color:String(eg.q.token("colors.green.emphasized")),icon:ef.p5B};else return{color:"inherit",icon:void 0}}function eC(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<t.length;e++)if(t[e]!==i[e])return!0;for(let t of i)if(!e[t]||e[t].type!==n[t].type)return!0;return!1}var e_=t(65909);let eS=e=>{let n,t,{node:r,selected:o,onSelect:a,schemaChanged:c}=e,{icon:u}=ek(r.resourceType),{base:h,current:x}=r.data;if(c){var p;n=null==(p=(0,e_.C)("schema_diff"))?void 0:p.icon,t=ew("modified").color}else!h&&x?(n=ew("added").icon,t=ew("added").color):h&&!x&&(n=ew("removed").icon,t=ew("removed").color);return(0,i.jsx)(em.ck,{children:(0,i.jsxs)(d.s,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:o?"gray.100":"inherit",onClick:()=>{a(r.id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:u}),(0,i.jsx)(l.a,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.I,{as:n,color:t})]})})},ez=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=(0,H.cE)(),r=t.params,s=[...y.X.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,g.I)({queryKey:s,queryFn:async()=>eu({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode}),refetchOnMount:!0,enabled:!r.node_id}),[u,h]=(0,j.useMemo)(()=>{var e,n,t;let i=[],s=[],o=[],a=[];if(r.node_id)for(let e of r.node_id instanceof Array?r.node_id:[r.node_id]){let n=null==l?void 0:l.nodes[e];n&&i.push(n)}else for(let n of null!=(e=null==d?void 0:d.nodes)?e:[]){let e=null==l?void 0:l.nodes[n];e&&i.push(e)}let c=i.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of c)eC(null==(n=e.data.base)?void 0:n.columns,null==(t=e.data.current)?void 0:t.columns)?s.push(e.id):!e.data.base&&e.data.current?o.push(e.id):e.data.base&&!e.data.current&&a.push(e.id);function u(e){return s.includes(e.id)?3:o.includes(e.id)?2:+!!a.includes(e.id)}return c.sort((e,n)=>{let t=u(e),i=u(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[c,s]},[r.node_id,null==d?void 0:d.nodes,l]),[x,p]=(0,j.useState)(0);if(o)return(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(I.o,{bg:"rgb(249,249,249)",height:"100%",className:"no-track-pii-safe",children:["Error: ",a.message]});if(0==u.length)return(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x<u.length){let e=u[x];return(0,i.jsxs)(ex,{sizes:[80,20],minSize:30,style:{height:"100%"},children:[(0,i.jsx)(ec,{base:e.data.base,current:e.data.current,enableScreenshot:!0,ref:n}),(0,i.jsx)(em.$z,{overflow:"auto",backgroundColor:"white",as:"ul",listStyle:"none",children:u.map((e,n)=>(0,i.jsx)(eS,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{p(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var eE=t(39947),eD=t(72499);function eI(e){let{value:n,onChange:t}=e,{featureToggles:l}=(0,ee.c)(),[s,o]=(0,j.useState)(!1),[a,u]=(0,j.useState)(),h=(0,j.useRef)(null),x=()=>{t&&(t(a),o(!1))};return((0,j.useEffect)(()=>{if(s&&h.current){let e=h.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[s]),s)?(0,i.jsxs)(d.s,{direction:"column",align:"flex-end",height:"100%",className:"no-track-pii-safe",children:[(0,i.jsx)(eD.T,{value:a,onChange:e=>{u(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&o(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),x())},ref:h,flex:1}),(0,i.jsxs)(d.s,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.N,{onClick:()=>{setTimeout(()=>{o(!1)},100)},colorPalette:"blue",children:"cancel"}),(0,i.jsx)(M.$,{mt:"8px",size:"sm",colorPalette:"blue",onClick:x,children:"Update"})]})]}):(0,i.jsx)(c.E,{className:"no-track-pii-safe",height:"100%",overflow:"auto",fontSize:"11pt",onClick:l.disableUpdateChecklist?void 0:()=>{u(null!=n?n:""),o(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var eR=t(94585),eT=t(17634);function eN(){return{successToast:function(e){eT.X.create({description:e,type:"info",duration:5e3,closable:!0})},failToast:function(e,n){eT.X.create({title:e,description:"".concat(n),type:"error",duration:5e3,closable:!0})}}}function eF(){let e=(0,R._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return eF=function(){return e},e}function eq(e){return e.description?e.description:"_(no description)_"}var eA=t(18249),eL=t(91008),eM=t(36444),eO=t(46678),eP=t(33392),eX=t(10798),eK=t(63180),eQ=t(73311),eW=t.n(eQ),e$=t(99412);function eB(e){let n=(0,eO.H)(e);return(0,eP.GP)(n,"yyyy-MM-dd'T'HH:mm:ss")}function eV(e){let n=(0,eO.H)(e);return(0,eX.B)(n,new Date,{addSuffix:!0})}function eZ(e){let n=new Set,t=new Set;if(null==e?void 0:e.nodes)for(let r of Object.values(e.nodes)){var i,l;(null==(i=r.data.base)?void 0:i.schema)&&n.add(r.data.base.schema),(null==(l=r.data.current)?void 0:l.schema)&&t.add(r.data.current.schema)}return[n,t]}function eH(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(d.s,{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)(em.ck,{ml:"10px",children:[n,": ",t]},n)})}function eU(){var e,n,t,l;let{envInfo:o,reviewMode:a,lineageGraph:c}=(0,H.cE)(),{open:u,onOpen:x,onClose:p}=(0,T.j)(),m=null==o?void 0:o.git,f=null==o?void 0:o.pullRequest,j={...m,...f},g=null==o||null==(e=o.dbt)?void 0:e.base,v=null==o||null==(n=o.dbt)?void 0:n.current,y=(null==g?void 0:g.generated_at)?eB(g.generated_at):"",b=(null==v?void 0:v.generated_at)?eB(v.generated_at):"",w="",k="";g&&(w=g.generated_at?eV(g.generated_at):""),v&&(k=v.generated_at?eV(v.generated_at):"");let[C,_]=eZ(c);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Environment Info",positioning:{placement:"bottom-end"},children:(0,i.jsxs)("div",{className:"flex items-center hover:cursor-pointer hover:text-black",onClick:x,children:[(0,i.jsxs)("div",{className:"hidden text-sm lg:flex lg:flex-col",children:[(0,i.jsxs)("div",{className:"flex gap-1",children:[(0,i.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(C).join(", ")})," ","(",w,")"]}),(0,i.jsxs)("div",{className:"flex gap-1",children:[(0,i.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(_).join(", ")})," ","(",k,")"]})]}),(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Environment Info",children:(0,i.jsx)(s.I,{verticalAlign:"middle",as:eK.G_,boxSize:"16px"})})]})}),(0,i.jsx)(N.Dz,{open:u,onOpenChange:p,size:"lg",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Environment Information"})}),(0,i.jsx)(N.R4,{children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[a?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"Review Information"}),(0,i.jsxs)(em.$z,{children:[j.url&&(0,i.jsxs)(em.ck,{ml:"10px",children:["url:"," ",(0,i.jsxs)(r.N,{href:j.url,color:"blue.500",target:"_blank",children:[j.url," ",(0,i.jsx)(e$.TdP,{})]})]}),!eW()(j)&&eH(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"Dev Information"}),(0,i.jsx)(em.$z,{children:m&&eH(m)})]})}),(0,i.jsx)(D.w,{}),(null==o?void 0:o.adapterType)==="dbt"&&(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"DBT"}),(0,i.jsx)(eM.Rz,{borderWidth:"1px",height:"30rem",children:(0,i.jsxs)(eM.jq,{size:"sm",variant:"line",stickyHeader:!0,children:[(0,i.jsx)(eM.A0,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.ug,{}),(0,i.jsx)(eM.ug,{children:"base"}),(0,i.jsx)(eM.ug,{children:"current"})]})}),(0,i.jsxs)(eM.BF,{children:[(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"schema"}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:Array.from(C).map(e=>(0,i.jsx)(el.m,{content:e,positioning:{placement:"bottom"},children:(0,i.jsx)("div",{className:"max-w-72 truncate",children:e})},e))}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:Array.from(_).map(e=>(0,i.jsx)(el.m,{content:e,positioning:{placement:"bottom"},children:(0,i.jsx)("div",{className:"max-w-72 truncate",children:e})},e))})]}),(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"version"}),(0,i.jsx)(eM.nA,{children:null==g?void 0:g.dbt_version}),(0,i.jsx)(eM.nA,{children:null==v?void 0:v.dbt_version})]}),(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"timestamp"}),(0,i.jsx)(eM.nA,{children:y}),(0,i.jsx)(eM.nA,{children:b})]})]})]})})]}),(null==o?void 0:o.adapterType)==="sqlmesh"&&(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(eM.Rz,{borderWidth:"1px",height:"30rem",children:(0,i.jsxs)(eM.jq,{variant:"line",stickyHeader:!0,children:[(0,i.jsx)(eM.A0,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.ug,{}),(0,i.jsx)(eM.ug,{children:"base"}),(0,i.jsx)(eM.ug,{children:"current"})]})}),(0,i.jsx)(eM.BF,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"Environment"}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:null==(t=o.sqlmesh)?void 0:t.base_env}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:null==(l=o.sqlmesh)?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(N.Es,{children:(0,i.jsx)(M.$,{colorPalette:"blue",mr:3,onClick:p,children:"Close"})}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})}function eG(e){var n;let{value:t,onChange:l,onRun:r,onRunBase:s,onRunDiff:o,label:a,CustomEditor:u,options:h={},manifestData:x,schemas:m,...f}=e,{featureToggles:j}=(0,ee.c)(),g="";return x&&(g=x.generated_at?eV(x.generated_at):""),(0,i.jsxs)(i.Fragment,{children:[(null!=(n=null!=a?a:r)?n:s)&&(0,i.jsxs)(d.s,{backgroundColor:"#EDF2F880",height:"40px",minH:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",flex:"0 0 40px",children:[(0,i.jsx)(c.E,{as:"strong",className:"no-track-pii-safe",children:a?a.toUpperCase():""}),x&&(0,i.jsxs)("span",{className:"ml-1",children:["(",m&&(0,i.jsxs)("span",{className:"no-track-pii-safe",children:[m,", "]}),(0,i.jsx)("span",{children:g}),")"]}),(0,i.jsx)(p.h,{}),(null!=r?r:s)&&(0,i.jsxs)(M.$,{size:"xs",variant:"outline",onClick:null!=r?r:s,backgroundColor:"white",padding:"6px 12px",disabled:j.disableDatabaseQuery,children:[(0,i.jsx)(ej.gSK,{})," Run Query"]})]}),null!=u?u:(0,i.jsx)(eL.KE,{className:"no-track-pii-safe",language:"sql",theme:"vs",value:t,onChange:e=>{void 0!==e&&l&&l(e)},onMount:(e,n)=>{r&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,r),s&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,s),o&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,o)},options:{extraEditorClassName:"no-track-pii-safe",tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...h}})]})}function eJ(e){var n;let t,l,{value:r,baseValue:s,onChange:o,onChangeBase:a,onRun:c,onRunBase:u,onRunDiff:h,options:x={},labels:p,SetupGuide:m,...f}=e,j=p?p[0]:"Base",g=p?p[1]:"Current",{envInfo:v,lineageGraph:y}=(0,H.cE)();(null==v||null==(n=v.dbt)?void 0:n.base)&&v.dbt.current&&(t=v.dbt.base,l=v.dbt.current);let[b,w]=eZ(y);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{height:"100%",gap:0,children:[(0,i.jsx)(eA.B,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(eG,{label:j,value:null!=s?s:"",onChange:a,onRunBase:u,options:x,CustomEditor:m,manifestData:null!=t?t:void 0,schemas:Array.from(b).join(", "),...f})}),(0,i.jsx)(eA.B,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(eG,{label:g,value:r,onChange:o,onRun:c,options:x,manifestData:null!=l?l:void 0,schemas:Array.from(w).join(", "),...f})})]})})}var eY=t(43463),e0=t(22729),e1=t(5302);let e2=(0,j.forwardRef)((e,n)=>{var t,r,s,o,a;let{isRunning:c,isAborting:u,progress:h,error:x,run:p,onCancel:m,viewOptions:f,onViewOptionsChanged:j,RunResultView:g,children:v,onExecuteRun:y}=e,b=null!=(s=null==x||null==(r=x.response)||null==(t=r.data)?void 0:t.detail)?s:null==p?void 0:p.error;if(b)return(0,i.jsxs)(eo.Bm,{status:"error",title:"Error: ".concat(b),children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsxs)(eo.XL,{children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:b})]})]});if(null!=c?c:(null==p?void 0:p.status)==="running"){let e="Loading...";return(null==h?void 0:h.message)?e=h.message:(null==p||null==(o=p.progress)?void 0:o.message)&&(e=p.progress.message),(0,i.jsx)(I.o,{p:"1rem",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(E.T,{children:[(0,i.jsxs)(d.s,{alignItems:"center",children:[(null==h?void 0:h.percentage)==null?(0,i.jsx)(e0.QU,{value:null,size:"md",mr:"0.5rem",children:(0,i.jsx)(e0.Au,{})}):(0,i.jsx)(e0.QU,{value:100*h.percentage,size:"md",mr:"0.5rem",children:(0,i.jsx)(e0.Au,{})}),u?(0,i.jsx)("span",{children:"Aborting..."}):(0,i.jsx)("span",{className:"no-track-pii-safe",children:e})]}),!u&&(0,i.jsx)(M.$,{onClick:m,colorPalette:"blue",size:"sm",children:"Cancel"})]})})}if(!p)return(0,i.jsx)(I.o,{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.a,{h:"100%",style:{contain:"size layout"},overflow:"auto",className:"no-track-pii-safe",children:[g&&(null!=(a=p.error)?a:p.result)&&(0,i.jsx)(e1.tH,{children:(0,i.jsx)(g,{ref:n,run:p,viewOptions:f,onViewOptionsChanged:j})}),null==v?void 0:v({run:p,viewOptions:f,onViewOptionsChanged:j})]})});var e5=t(52531),e4=t(42496),e3=t(19462),e8=t(40735),e6=t(82361),e7=t(65986),e9=t(19829);t(1474),t(3870);var ne=t(92156),nn=t(9418),nt=t(5334),ni=t(75887),nl=t(29580),nr=t(46288),ns=t(6652);function no(e){let{children:n,display:t}=e,[s,o]=(0,j.useState)(!1),a=(0,j.useRef)(null),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{a.current&&(clearTimeout(a.current),a.current=null),o(!0)},[]),u=(0,j.useCallback)(()=>{a.current=setTimeout(()=>{o(!1)},100)},[]);if(!t)return n;let h=(0,j.cloneElement)(n,{ref:c});return(0,i.jsxs)(ns.yt,{open:s,onFocusOutside:()=>{o(!1)},positioning:{getAnchorRect:()=>{var e,n;return null!=(n=null==(e=c.current)?void 0:e.getBoundingClientRect())?n:null}},lazyMount:!0,unmountOnExit:!0,size:"xs",autoFocus:!1,children:[(0,i.jsx)(ns.Wv,{asChild:!0,children:(0,i.jsx)(l.a,{onMouseEnter:d,onMouseLeave:u,display:"contents",children:h})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(ns.Ug,{children:(0,i.jsx)(ns.hl,{bg:"gray.600",color:"white",zIndex:"popover",width:"auto",onMouseEnter:d,onMouseLeave:u,children:(0,i.jsxs)(ns.ej,{children:["Connect to a data warehouse to unlock Diff."," ",(0,i.jsx)(r.N,{href:nr.Q,color:"white",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})})})]})}function na(e){let{node:n}=e,{icon:t}=ek(n.resourceType);return(0,i.jsx)(el.m,{showArrow:!0,content:"Type of resource",children:(0,i.jsxs)(F.f8,{children:[t&&(0,i.jsx)(F.FV,{children:(0,i.jsx)(t,{})}),(0,i.jsx)(F.d1,{children:n.resourceType})]})})}function nc(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)(x.z,{children:[(0,i.jsx)(c.E,{children:r}),(0,i.jsx)(s.I,{as:nn.dyV}),(0,i.jsx)(c.E,{children:o})]}):t===l?(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.lso,color:"gray.500"}),(0,i.jsx)(c.E,{color:"gray.500",children:"No Change"})]}):t<l?(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.euc,color:"green.500"}),(0,i.jsx)(c.E,{color:"green.500",children:(0,ni.Q)(t,l)})]}):(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.p1_,color:"red.500"}),(0,i.jsx)(c.E,{color:"red.500",children:(0,ni.Q)(t,l)})]})}function nd(e){var n,t;let{rowCount:l,node:r,onRefresh:s,isFetching:o}=e,{featureToggles:a}=(0,ee.c)(),{runsAggregated:u}=(0,H.cE)(),h=null==u||null==(n=u[r.id])?void 0:n.row_count_diff.result,x=null==(t=(0,e_.C)("row_count_diff"))?void 0:t.icon,[p,m]=(0,j.useState)(),[f,g]=(0,j.useState)("");return(0,j.useEffect)(()=>{let e=null!=l?l:h;if(e){var n,t;let i=null!=(n=e.base)?n:"N/A",l=null!=(t=e.curr)?t:"N/A";g("".concat(i," -> ").concat(l," rows")),m(e)}},[l,h]),(0,i.jsx)(el.m,{content:f,children:(0,i.jsx)(no,{display:"metadata only"===a.mode,children:(0,i.jsx)(F.f8,{asChild:!0,children:(0,i.jsx)(c.E,{fontSize:"xs",children:(0,i.jsxs)(d.s,{direction:"row",alignItems:"center",gap:"1",children:[x&&(0,i.jsx)(x,{}),null!=p||o?(0,i.jsx)(ne.rr,{loading:!1,noOfLines:1,minWidth:"30px",children:null!=p?(0,i.jsx)(nc,{rowCount:p}):"row count"}):(0,i.jsx)("span",{children:"row count"}),s&&(0,i.jsx)(A.K,{loading:o,"aria-label":"Query Row Count",size:"2xs",p:"0",variant:"ghost",onClick:s,disabled:a.disableDatabaseQuery,children:(0,i.jsx)(nl.fZv,{})})]})})})})})}function nu(e){var n,t,l;let r,{rowCount:s,node:o,onRefresh:a,isFetching:c}=e,{runsAggregated:d,refetchRunsAggregated:u}=(0,H.cE)(),h=null==d||null==(n=d[o.id])?void 0:n.row_count.result,x=null==(t=(0,e_.C)("row_count"))?void 0:t.icon,p=null!=s?s:h;if(p){let e=null!=(l=p.curr)?l:"N/A";r="".concat(e," rows")}return(0,i.jsxs)(F.f8,{children:[x&&(0,i.jsx)(F.FV,{children:(0,i.jsx)(x,{})}),(0,i.jsx)(F.d1,{children:p||c?(0,i.jsx)(ne.rr,{loading:c,lineClamp:1,height:2,minWidth:"30px",children:p?"".concat(r):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(A.K,{loading:c,"aria-label":"Query Row Count",size:"2xs",p:"0",variant:"ghost",onClick:a,disabled:"base"===o.from,children:(0,i.jsx)(nl.fZv,{})})]})}let nh=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:o}=t;if("pending"===r)return(0,i.jsx)(e0.QU,{value:0,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});if("skipped"===r)return(0,i.jsx)(F.f8,{backgroundColor:"gray.100",children:(0,i.jsx)(F.d1,{children:(0,i.jsxs)(d.s,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.a,{children:"Skipped"}),s&&(0,i.jsx)(el.m,{content:s,children:(0,i.jsx)(nl.GLE,{})})]})})});if(!o)return(0,i.jsx)(e0.QU,{value:null,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});let{error:a,result:c,run_id:u,progress:h}=o;if("running"===r)if((null==h?void 0:h.percentage)===void 0)return(0,i.jsx)(e0.QU,{value:null,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});else return(0,i.jsx)(e0.QU,{value:100*h.percentage,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});if(a)return(0,i.jsxs)(d.s,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.a,{children:"Error"}),s&&(0,i.jsx)(el.m,{content:a,children:(0,i.jsx)(nl.e5t,{})})]});if("value_diff"===o.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(F.f8,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(F.d1,{children:(0,i.jsx)(d.s,{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"===o.type){let e=o.result;return(0,i.jsx)(nd,{rowCount:e[n.name],node:n})}if("row_count"===o.type){let e=o.result;return(0,i.jsx)(nu,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})};function nx(e){var n;let t,l,{rowCount:r}=e,o=r.base,a=r.curr,c=null===r.base?"N/A":"".concat(r.base," Rows"),u=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===o&&null===a?(t="Failed to load",l="gray"):null===o||null===a?(t="".concat(c," -> ").concat(u),l=null===o?"green":"red"):o===a?(t="=",l="gray"):o!==a&&(t="".concat((0,ni.Q)(o,a)," Rows"),l=o<a?"green":"red"),(0,i.jsx)(F.f8,{colorPalette:l,children:(0,i.jsxs)(d.s,{gap:1,alignItems:"center",children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count_diff"))?void 0:n.icon}),(0,i.jsx)(F.d1,{children:t})]})})}let np={breaking:"Breaking",non_breaking:"Non Breaking",partial_breaking:"Partial Breaking",unknown:"Unknown"},nm=e=>{var n;let t,r,{id:o,inverted:a}=e,{lineageGraph:c,runsAggregated:u}=(0,H.cE)(),h=null==u?void 0:u[o],x=null==c?void 0:c.nodes[o];if(!h&&!x)return(0,i.jsx)(i.Fragment,{});if((null==x?void 0:x.data.base)&&x.data.current&&(t=eC(x.data.base.columns,x.data.current.columns)),null==h?void 0:h.row_count_diff){let e=h.row_count_diff;r=e.result.curr!==e.result.base}let m=a?"white":ew("modified").color;return(0,i.jsxs)(d.s,{flex:"1",children:[void 0!==t&&(0,i.jsx)(el.m,{content:"Schema (".concat(t?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.a,{height:"16px",children:(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("schema_diff"))?void 0:n.icon,color:t?m:a?"gray":"gray.100"})})}),(0,i.jsx)(p.h,{}),(null==h?void 0:h.row_count_diff)&&void 0!==r&&(0,i.jsx)(el.m,{content:"Row count (".concat(r?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(l.a,{children:(0,i.jsx)(nx,{rowCount:h.row_count_diff.result})})})]})},nf=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(d.s,{onClick:t,alignSelf:"center",alignItems:"center",cursor:"pointer",children:n?(0,i.jsx)(s.I,{boxSize:"20px",as:ef.Hcz}):(0,i.jsx)(s.I,{boxSize:"20px",as:ef.PVM})})},nj=e=>{let{name:n,color:t,resourceType:r}=e;return(0,i.jsx)(l.a,{flex:"1",color:t,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:(0,i.jsx)(el.m,{content:"model"===r?n:"".concat(n," (").concat(r,")"),positioning:{placement:"top"},children:(0,i.jsx)("span",{children:n})})})};var ng=t(95230),nv=t(53516),ny=t(32282);async function nb(e){return(await v.g.post("/api/checks",{type:"schema_diff",params:e})).data}let nw={add_or_remove:"Unavailable for added or removed resources."},nk=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=(0,H.JL)(),{error:o,data:a}=(0,g.I)({queryKey:y.X.run(null!=e?e:""),queryFn:async()=>(0,eY.Zc)(null!=e?e:"",2*!!t),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"||(null==a?void 0:a.type)==="row_count")&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let c=(0,j.useCallback)(async()=>{r(!0),e&&await (0,eY.Su)(e)},[e,r]),d=(null==a?void 0:a.type)?null==(n=(0,e_.C)(a.type))?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:c,RunResultView:d}};var nC=t(56157),n_=t(13875),nS=t.n(n_),nz=t(70229),nE=t(60640),nD=t.n(nE);let nI="ignore-screenshot";function nR(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:o="solid 1px #ccc",borderRadius:a="10px",onSuccess:h,onError:x,ignoreElements:p}=e,[m,f]=(0,j.useState)("idle"),g=(0,j.useRef)(null),{onOpen:v,setImgBlob:y,ImageDownloadModal:b}=function(){let{open:e,onOpen:n,onClose:t}=(0,T.j)(),[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;(null==(n=e.target)?void 0:n.result)!=null&&r(e.target.result)}},[r]),(0,i.jsx)(N.Dz,{size:"xl",open:e,onOpenChange:t,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Screenshot Preview"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsxs)(d.s,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(d.s,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(nl.GLE,{color:"red.600"}),(0,i.jsx)(c.E,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(c.E,{children:"Please download it directly"})]}),(0,i.jsx)(u._,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,eP.GP)(e,"yyyy-MM-dd-HH-mm-ss"),".png");nD()(l,n),t()},children:"Download"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})}}}(),w=async()=>{var e,t;if(!g.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let i=null!=(e=g.current.element)?e:g.current,c=i.style.overflow,d=i.style.border,u=i.style.borderRadius,h=i.style.backgroundColor,x=i.style.height;try{i.style.overflow="hidden",i.style.border=r?o:"",i.style.borderRadius=r?a:"",i.style.backgroundColor=null!=l?l:"",i.style.height="".concat(String(i.offsetHeight),"px");let e=document.createElement("style");document.head.appendChild(e),null==(t=e.sheet)||t.insertRule("body > div:last-child img { display: inline-block; }"),f("loading");let c="html2canvas"===n?await nS()(i,{logging:!1,backgroundColor:null,ignoreElements:p}):await (0,nz.mo)(i,{filter:p?e=>!p(e):void 0});e.remove();let d=s?document.createElement("canvas"):c;if(s){d.width=c.width+80,d.height=c.height+80;let e=d.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(c,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let u=await fetch(d.toDataURL());return await u.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{i.style.overflow=c,i.style.border=d,i.style.borderRadius=u,i.style.backgroundColor=h,i.style.height=x}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:w()})]),f("success"),h&&h()}catch(e){"ClipboardItem is not defined"===e.message?(y(await w()),v(),f("success")):(f("error"),console.error("Error copying to clipboard",e),x&&x(e))}},ImageDownloadModal:b,ref:g}}function nT(e){var n;let{successToast:t,failToast:l}=eN(),{isLoading:r,copyToClipboard:s,ImageDownloadModal:o,ref:a}=nR({imageType:"png",shadowEffect:!0,backgroundColor:null!=(n=null==e?void 0:e.backgroundColor)?n:null,onSuccess:()=>{t("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),l("Failed to copy image to clipboard",e)}}),c=(0,j.useCallback)(()=>{if(a.current){var e;let n=null!=(e=a.current.element)?e:a.current;n.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",n.style.transition="box-shadow 0.5s ease-in-out"}},[a]),d=(0,j.useCallback)(()=>{if(a.current){var e;(null!=(e=a.current.element)?e:a.current).style.boxShadow=""}},[a]),u=(0,j.useCallback)(async()=>{if(a.current){var e;await s(),(null!=(e=a.current.element)?e:a.current).style.boxShadow=""}else l("Failed to copy image to clipboard","No content to copy")},[a,s,l]);return{ref:a,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(M.$,{size:"sm",style:{position:"absolute",bottom:"16px",right:"16px"},loading:r,onMouseEnter:c,onMouseLeave:d,onClick:u,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}),(0,i.jsx)(o,{})]})},onMouseEnter:c,onMouseLeave:d,onCopyToClipboard:u}}function nN(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,eP.GP)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,eP.GP)(e,"HH:mm"):(0,eP.GP)(e,"MMM d, HH:mm")}let nF=e=>{let{run:n}=e,t="running"===n.status,l=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 o=n.run_at?nN(new Date(n.run_at)):null;return(0,i.jsxs)(d.s,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(J.y,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(c.E,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(c.E,{children:"•"}),(0,i.jsx)(c.E,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:o})]})},nq=e=>{var n;return(0,i.jsxs)(d.s,{flex:"1",minH:"48px",m:"4px",px:"16px",py:"12px",bg:"blue.50",border:"1px",borderRadius:"4px",borderColor:"blue.400",align:null!=(n=e.align)?n:"center",gap:"12px",children:[(0,i.jsx)(s.I,{as:nn.S8s,width:"20px",height:"20px",color:"blue.900"}),e.children,(0,i.jsx)(p.h,{}),(0,i.jsx)(P.J,{onClick:e.onClose})]})},nA=()=>(0,i.jsxs)(r.N,{href:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",target:"_blank",color:"rgba(49, 130, 206, 1)",fontWeight:"bold",textDecoration:"underline",children:["Learn how ",(0,i.jsx)(e$.TdP,{})]});var nL=t(61315),nM=t(39074),nO=t(5484);let nP={src:"/_next/static/media/reload-image.79aabb7d.svg"};async function nX(){return(await v.g.post("/api/connect")).data}function nK(e){var n;let{handleParentClose:t,parentOpen:l=!1,ignoreCookie:s=!1,variant:o="auth"}=e,{authed:a}=(0,ee.c)(),[d,h]=(0,j.useState)(l||!a),x=null!=(n=nO.A.get("authState"))?n:"pending",[p,m]=(0,j.useState)(s?"pending":x);if("ignored"===p&&!s||a)return null;let f={auth:{title:"Configure Cloud Token",action:"Get token and configure"},"enable-share":{title:"Enable Sharing with Cloud",action:"Enable sharing"},"user-profile":{title:"Configure Cloud Token",action:"Get token and configure"}}[o];return(0,i.jsx)(N.Dz,{size:"lg",placement:"center",lazyMount:!0,open:d,onOpenChange:e=>{h(e.open),t&&t(e.open)},children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{borderRadius:"2xl",children:["authenticating"!==p&&(0,i.jsx)(N.c7,{className:"text-center",fontSize:"2xl",children:(0,i.jsx)(N.L3,{children:f.title})}),"authenticating"!==p?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.R4,{className:"space-y-2 font-light",children:[(0,i.jsx)(c.E,{children:"To enable sharing, get your token from Recce Cloud and launch your local instance with it."}),(0,i.jsxs)("ul",{className:"list-inside list-disc",children:[(0,i.jsx)("li",{children:"Share your instance with teammates via Recce Cloud."}),(0,i.jsx)("li",{children:"Your instance will be securely and freely hosted for sharing."}),"auth"===o&&(0,i.jsx)("li",{children:"This step is recommended but optional."})]}),(0,i.jsxs)(c.E,{display:"flex",gap:1,children:["More directions",(0,i.jsxs)(r.N,{variant:"underline",color:"blue.500",_focus:{outline:"none"},href:"https://cloud.datarecce.io/connect-to-cloud",target:"_blank",children:["here ",(0,i.jsx)(e$.TdP,{})]})]})]}),(0,i.jsx)(N.Es,{children:(0,i.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,i.jsxs)(M.$,{className:"w-full !rounded-lg !font-medium",colorPalette:"brand",onClick:async()=>{m("authenticating");let{connection_url:e}=await nX();window.open(e,"_blank")},children:[f.action," ",(0,i.jsx)(e$.TdP,{})]}),(0,i.jsx)(N.Tt,{asChild:!0,children:(0,i.jsx)(M.$,{className:"!rounded-lg !font-medium",variant:"subtle",colorPalette:"gray",size:"sm",children:"auth"===o?"Skip":"Cancel"})}),"auth"===o&&(0,i.jsx)(N.Tt,{asChild:!0,children:(0,i.jsx)(M.$,{width:"100%",className:"!rounded-lg !font-medium !text-black",variant:"ghost",size:"sm",onClick:()=>{nO.A.set("authState","ignored",{expires:30}),m("ignored")},children:"Snooze for 30 days"})})]})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(N.R4,{className:"space-y-2 self-center font-light",children:(0,i.jsxs)(E.T,{gap:4,paddingTop:"1rem",children:[(0,i.jsx)(u._,{className:"mx-auto mb-2",h:"6rem",fit:"contain",src:nP.src}),(0,i.jsx)(c.E,{fontSize:"2xl",fontWeight:"medium",children:"Reload to Finish"}),(0,i.jsx)(c.E,{children:"Reload to complete connection to Recce Cloud"})]})}),(0,i.jsx)(N.Es,{children:(0,i.jsx)(M.$,{className:"w-full",colorPalette:"brand",onClick:()=>{window.location.reload()},children:"Reload"})})]})]})})]})})}let nQ=e=>{let n=nC.Ay.stringify(e,null,2);return(0,i.jsx)(eL.KE,{className:"no-track-pii-safe",height:"100%",language:"yaml",theme:"vs",value:n,options:{extraEditorClassName:"no-track-pii-safe",readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},nW=e=>{let{runType:n}=e,{open:t,onClose:l}=(0,T.j)({defaultOpen:!0});if(!t)return(0,i.jsx)(i.Fragment,{});switch(n){case"row_count":return(0,i.jsx)(nq,{onClose:l,children:(0,i.jsxs)(c.E,{children:["Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(nA,{})]})});case"profile":return(0,i.jsx)(nq,{onClose:l,children:(0,i.jsxs)(c.E,{children:["Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(nA,{})]})});default:return(0,i.jsx)(i.Fragment,{})}},n$=e=>{let{disableCopyToClipboard:n,onCopyToClipboard:t,onMouseEnter:l,onMouseLeave:r}=e,{authed:s}=(0,ee.c)(),{handleShareClick:o}=(0,nM.l)(),[a,c]=(0,j.useState)(!1);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"xs",variant:"outline",colorPalette:"gray",children:["Share ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{minW:"0",children:[(0,i.jsxs)(q.Dr,{value:"copy-to-clipboard",onClick:t,onMouseEnter:l,onMouseLeave:r,disabled:n,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}),(0,i.jsx)(q.bX,{}),s?(0,i.jsxs)(q.Dr,{value:"share-to-cloud",onClick:async()=>{await o(),(0,b.o$)({name:"create"})},children:[(0,i.jsx)(nL.Fsk,{})," Share to Cloud"]}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(q.Dr,{value:"share",onClick:()=>{c(!0)},children:[(0,i.jsx)(nL.Fsk,{})," Share"]})})]})})})]}),a&&(0,i.jsx)(nK,{parentOpen:a,handleParentClose:c,ignoreCookie:!0,variant:"enable-share"})]})},nB=e=>{var n,t,l,r;let{runId:s,onClose:o,isSingleEnvironment:a}=e,{featureToggles:c}=(0,ee.c)(),{runAction:u}=(0,G.tr)(),{error:h,run:f,onCancel:g,isRunning:v}=nk(s),[k,C]=(0,j.useState)(),_=(0,V.jE)(),[,S]=(0,eE.zy)(),[z,E]=(0,j.useState)("result"),D=(null==f?void 0:f.type)?null==(n=(0,e_.C)(f.type))?void 0:n.RunResultView:void 0,I=(0,j.useCallback)(()=>{var e;u(null!=(e=null==f?void 0:f.type)?e:"",null==f?void 0:f.params)},[f,u]),R=null==f?void 0:f.check_id,T=(0,j.useCallback)(()=>{R&&S("/checks/".concat(R))},[R,S]),N=(0,j.useCallback)(async()=>{if(!s)return;let e=await w(s,k);await _.invalidateQueries({queryKey:y.X.checks()}),S("/checks/".concat(e.check_id))},[s,S,_,k]),F=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:q,onCopyToClipboard:A,onMouseEnter:L,onMouseLeave:O}=nT(),X=!s||!(null==f?void 0:f.result)||!!h||"result"!==z;return(0,i.jsxs)(d.s,{direction:"column",children:[a&&(0,i.jsx)(nW,{runType:null==f?void 0:f.type}),(0,i.jsx)(m.pK,{size:"lg",colorPalette:"iochmara",value:z,onValueChange:e=>{E(e.value)},flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.j7,{children:[(0,i.jsx)(m.Xi,{value:"result",children:"Result"}),(0,i.jsx)(m.Xi,{value:"params",children:"Params"}),F&&(0,i.jsx)(m.Xi,{value:"query",children:"Query"}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{overflow:"hidden",children:[f&&(0,i.jsx)(nF,{run:f}),(0,i.jsxs)(M.$,{variant:"outline",colorPalette:"gray",disabled:!s||v||c.disableDatabaseQuery,size:"xs",onClick:I,children:[(0,i.jsx)(nl.fZv,{})," Rerun"]}),c.disableShare?(0,i.jsxs)(M.$,{variant:"outline",disabled:!s||!(null==f?void 0:f.result)||!!h||"result"!==z,onMouseEnter:L,onMouseLeave:O,size:"sm",onClick:A,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}):(0,i.jsx)(n$,{disableCopyToClipboard:X,onCopyToClipboard:async()=>{var e;await A(),(0,b.uH)({type:null!=(e=null==f?void 0:f.type)?e:"unknown",from:"run"})},onMouseEnter:L,onMouseLeave:O}),(0,i.jsx)(function(){return c.disableUpdateChecklist?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsxs)(M.$,{disabled:!s||!f.result||!!h,size:"sm",colorPalette:"iochmara",onClick:T,children:[(0,i.jsx)(nl.wiW,{})," Go to Check"]}):(0,i.jsxs)(M.$,{disabled:!s||!(null==f?void 0:f.result)||!!h,size:"xs",colorPalette:"iochmara",onClick:N,children:[(0,i.jsx)(nl.wiW,{})," Add to Checklist"]})},{}),(0,i.jsx)(P.J,{size:"sm",onClick:()=>{o&&o()}})]})]})}),"result"===z&&(0,i.jsx)(e2,{ref:q,error:h,run:f,onCancel:g,viewOptions:k,onViewOptionsChanged:C,RunResultView:D}),"params"===z&&f&&(0,i.jsx)(nQ,{type:f.type,params:f.params}),"query"===z&&f&&((null==(t=f.params)?void 0:t.base_sql_template)?(0,i.jsx)(eJ,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(eG,{value:null!=(r=null==(l=f.params)?void 0:l.sql_template)?r:"",options:{readOnly:!0}}))]})},nV=e=>{let{onClose:n,isSingleEnvironment:t}=e,{runId:l}=(0,G.tr)();return(0,i.jsx)(nB,{runId:l,onClose:n,isSingleEnvironment:t})};async function nZ(e,n){return await (0,eY.AU)("query",e,n)}async function nH(e,n){return await (0,eY.AU)("query_base",e,n)}async function nU(e,n){return await (0,eY.AU)("query_diff",e,n)}var nG=t(56384),nJ=t(64054);let nY=e=>{var n;let{defaultValues:t,suggestionList:r,onValuesChange:s,className:o}=e,[a,c]=(0,j.useState)(null!=t?t:[]),[d,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),p=(0,j.useRef)(null),m=e=>{a.includes(e)||(u(""),c([...a,e]),s([...a,e]))},f=d.toLowerCase(),g=null!=(n=null==r?void 0:r.filter(e=>""===f||e.toLowerCase().includes(f)).filter(e=>!a.includes(e)))?n:[],v=a.length>0?(0,i.jsx)(M.$,{size:"2xs",variant:"ghost",color:"#3182CE",fontSize:e.size,paddingTop:"0",me:-2,onClick:()=>{u(""),c([]),s([])},children:"Clear"}):void 0;return(0,i.jsx)(nG.M,{width:e.width,className:o,endElement:v,children:(0,i.jsxs)(q.il,{size:"sm",lazyMount:!0,closeOnSelect:!1,onOpenChange:()=>{var e;return null==(e=p.current)?void 0:e.focus()},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(M.$,{width:"100%",size:"2xs",colorPalette:"gray",variant:"outline",justifyContent:"flex-start",children:(n=>n.length>1?"".concat(n.length," ").concat(e.unitName,"s selected"):1===n.length?n[0]:"")(a)})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{zIndex:"popover",fontSize:e.size,width:e.width,className:"no-track-pii-safe",children:[(0,i.jsx)(q.Uh,{children:(0,i.jsxs)(nJ.B,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(nJ.Q,{children:(0,i.jsxs)(F.f8,{paddingX:"0.5rem",size:"sm"===e.size||"md"===e.size||"lg"===e.size?e.size:"md",children:[(0,i.jsx)(F.d1,{children:n}),(0,i.jsx)(F.Cs,{children:(0,i.jsx)(F.TG,{onClick:()=>{c(a.filter(e=>e!==n)),s(a.filter(e=>e!==n))}})})]},n)},"tag-".concat(t))),(0,i.jsx)(nJ.Q,{width:"100%",children:(0,i.jsx)(W.p,{ref:p,placeholder:"Filter or add custom keys",variant:"subtle",size:e.size,value:d,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":m(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(c(a.slice(0,-1)),s(a.slice(0,-1)))}},onBlur:()=>{p.current&&h&&p.current.focus()}})})]})}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{children:[""!==d&&!(null==r?void 0:r.includes(d))&&(0,i.jsxs)(q.Dr,{value:"custom-value-by-filter",onClick:()=>{m(d),x(!1)},children:["Add '",d,"' to the list"]},"custom-value-by-filter"),g.map((e,n)=>(0,i.jsx)(q.Dr,{value:"option-".concat(n),onClick:()=>{m(e)},children:e},"option-".concat(n))).slice(0,10),g.length>10&&(0,i.jsx)(el.m,{content:"Please use filter to find more items",positioning:{placement:"top"},children:(0,i.jsxs)(l.a,{px:"12px",color:"gray",fontSize:"8pt",children:["and ",g.length-10," more items..."]})})]})]})})})]})})};var n0=t(12187);let n1=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=(0,H.cE)(),o=(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.columns,o=null==(t=l.data.current)?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)(d.s,{...l,children:(0,i.jsxs)(n0.XO,{m:"0 0.5rem",gap:0,children:[(0,i.jsxs)(n0.dh,{fontSize:"0.625rem",margin:0,children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(el.m,{content:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",positioning:{placement:"bottom-end"},children:(0,i.jsx)(nl.GLE,{color:"gray.600"})})]}),(0,i.jsx)(nY,{className:"no-track-pii-safe",unitName:"key",defaultValues:n,suggestionList:o,onValuesChange:t,size:"2xs",width:"240px",placeholder:"Select or type to add keys",disabled:!s("query_diff_with_primary_key")})]})})};var n2=t(20503);function n5(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:o,externalLinkText:a}=e;return(0,i.jsxs)(d.s,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(A.K,{"aria-label":"thumbs up",variant:"ghost",width:"32px",height:"32px",onClick:t,children:(0,i.jsx)(u._,{src:"/imgs/feedback/thumbs-up.png",alt:"like"})}),(0,i.jsx)(A.K,{"aria-label":"thumbs down",variant:"ghost",width:"32px",height:"32px",onClick:l,children:(0,i.jsx)(u._,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"})}),o&&a&&(0,i.jsxs)(r.N,{href:o,target:"_blank",textDecoration:"underline",onClick:s,children:[a," ",(0,i.jsx)(e$.TdP,{})]})]})}let n4="recce-",n3={bypassSaveOverwrite:"".concat(n4,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(n4,"-preview-change-feedback"),prepareEnvGuideID:"".concat(n4,"-prepare-env")};var n8=t(71859);function n6(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:o,runQuery:a,isPending:u}=e;return(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.a,{children:[(0,i.jsxs)(h.D,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:n2.czL,boxSize:"1.2em"}),"Sandbox"]}),(0,i.jsxs)(c.E,{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)(p.h,{}),(0,i.jsx)(n1,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(el.m,{content:"Run diff to see the changes",children:(0,i.jsx)(M.$,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{o(),a()},colorPalette:"blue",loading:u,children:"Run Diff"})})]})}function n7(e){var n,t,l,r;let{currentModelID:s,height:o="32px",flex:a="0 0 auto"}=e,{lineageGraph:u,envInfo:h}=(0,H.cE)(),x="0 16px",p=eB(null!=(l=null==h||null==(t=h.dbt)||null==(n=t.current)?void 0:n.generated_at)?l:""),m=(0,e5.m)(p,{addSuffix:!0}),f="N/A";if(null==u?void 0:u.nodes[s]){let e=u.nodes[s];(null==(r=e.data.current)?void 0:r.schema)&&(f=e.data.current.schema)}return(0,i.jsxs)(d.s,{gap:0,height:o,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(eA.B,{width:"50%",children:(0,i.jsxs)(c.E,{as:"b",margin:x,children:["ORIGINAL (Schema: ",f,", Last Updated: ",m,")"]})}),(0,i.jsx)(eA.B,{width:"50%",children:(0,i.jsx)(c.E,{as:"b",margin:x,children:"SANDBOX EDITOR"})})]})}function n9(e){var n;let{current:t,onChange:r}=e,s=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=null==t?void 0:t.raw_code)?n:"",r);return(0,i.jsx)(l.a,{flex:1,overflowY:"auto",children:(0,i.jsx)(eL.zC,{language:"sql",theme:"vs",original:null==t?void 0:t.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:s.onMount})})}function te(e){var n,t;let{isOpen:r,onClose:s,current:o}=e,{open:c,onClose:h,onOpen:p}=(0,T.j)(),[m,f]=(0,j.useState)(null!=(n=null==o?void 0:o.raw_code)?n:""),{showRunId:g,clearRunResult:v}=(0,G.tr)(),{primaryKeys:y,setPrimaryKeys:w}=(0,nv.vr)(),{data:k,isLoading:C}=(0,n8.T)(),_=async()=>{var e;let n={current_model:null!=(e=null==o?void 0:o.name)?e:"",primary_keys:y,sql_template:m},{run_id:t}=await nU(n,{nowait:!0});return g(t),await (0,eY.Zc)(t)},{mutate:S,isPending:z}=(0,Z.n)({mutationFn:_,onSuccess(e,n){e.error?(0,b.In)({action:"run",node:null==o?void 0:o.name,status:"failure"}):((0,b.In)({action:"run",node:null==o?void 0:o.name,status:"success"}),setTimeout(()=>{E()},1e3),!C&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>{I()},2e3))}}),{feedbackToast:E,closeToast:D}=function(e){let{feedbackId:n,description:t,onFeedbackSubmit:l,externalLink:r,externalLinkText:s}=e,[o,a]=(0,j.useState)(void 0);return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],c=localStorage.getItem(n);null==o&&("true"!==c||e)&&a(eT.X.create({id:n,duration:void 0,type:"success",description:(0,i.jsx)(x.z,{children:(0,i.jsx)(n5,{description:t,onLike:()=>{l("like"),eT.X.dismiss(o),localStorage.setItem(n,"true")},onDislike:()=>{l("dislike"),eT.X.dismiss(o),localStorage.setItem(n,"true")},externalLink:r,externalLinkText:s,onClickLink:()=>{l("link")}})})}))},closeToast:()=>{eT.X.dismiss(o)}}}({feedbackId:n3.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":(0,b.Ly)({feedback:"like",node:null==o?void 0:o.name});break;case"dislike":(0,b.Ly)({feedback:"dislike",node:null==o?void 0:o.name});break;case"link":(0,b.Ly)({feedback:"form",node:null==o?void 0:o.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:I,closeGuideToast:R}=function(e){let[n,t]=(0,j.useState)(void 0),{guideId:i,description:l,externalLink:r,externalLinkText:s,onExternalLinkClick:o}=e;return{guideToast:function(){null==n&&t(eT.X.create({id:i,duration:3e3,type:"success",description:l,action:{label:null!=s?s:"link",onClick:()=>{o&&o()}}}))},closeGuideToast:()=>{eT.X.dismiss(n)}}}({guideId:n3.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>{(0,b.TL)({action:"external_link",from:"preview_changes",node:null==o?void 0:o.name})}});return(0,j.useEffect)(()=>{if(r){var e;f(null!=(e=null==o?void 0:o.raw_code)?e:"")}},[r,o]),(0,i.jsx)(N.Dz,{open:r,size:"cover",onOpenChange:()=>{s(),h(),v(),D(),R(),(0,b.In)({action:"close",node:null==o?void 0:o.name})},children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{height:"100%",children:[(0,i.jsxs)(N.c7,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:[(0,i.jsxs)(d.s,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(u._,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(N.L3,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",children:"Experiment"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]}),(0,i.jsx)(N.R4,{p:0,children:(0,i.jsxs)(ep,{sizes:c?[50,50]:[100,0],minSize:100*!!c,gutterSize:5*!!c,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(d.s,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(n6,{current:o,primaryKeys:null!=y?y:[],setPrimaryKeys:w,onRunResultOpen:p,runQuery:S,isPending:z}),(0,i.jsx)(n7,{height:"32pxs",flex:"0 0 auto",currentModelID:null!=(t=null==o?void 0:o.id)?t:""}),(0,i.jsx)(n9,{current:o,onChange:f})]}),c?(0,i.jsx)(nV,{onClose:h,disableAddToChecklist:!0}):(0,i.jsx)(l.a,{})]})}),(0,i.jsx)(l.a,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(el.m,{content:"Give us feedback",children:(0,i.jsx)(A.K,{"aria-label":"feedback",variant:"ghost",size:"md",onClick:()=>{E(!0)},children:(0,i.jsx)(B.Kyq,{})})})})]})})]})})}let tn=e=>{var n,t,r,s,o,a;let{node:c}=e,{open:d,onOpen:u,onClose:h}=(0,T.j)(),[x,p]=(0,j.useState)(!1),{data:m,isLoading:f}=(0,n8.T)(),g=null==m?void 0:m.single_env_onboarding;if(f)return(0,i.jsx)(i.Fragment,{});if("model"!==c.resourceType&&"snapshot"!==c.resourceType)return"Not available";let v={readOnly:!0,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,wordWrap:"off",minimap:{enabled:!1}},y={readOnly:!0,lineNumbers:"on",automaticLayout:!0,wordWrap:"off",minimap:{enabled:!1}},b=null==(n=c.data.base)?void 0:n.raw_code,w=null==(t=c.data.current)?void 0:t.raw_code,k=null!=(a=null!=(o=null==(r=c.data.base)?void 0:r.name)?o:null==(s=c.data.current)?void 0:s.name)?a:"";return(0,i.jsxs)(l.a,{className:"no-track-pii-safe",style:{position:"relative"},height:"100%",onMouseEnter:()=>{p(!0)},onMouseLeave:()=>{p(!1)},children:[g?(0,i.jsx)(eG,{language:"sql",theme:"light",value:null!=b?b:"",options:y}):(0,i.jsx)(eL.zC,{language:"sql",theme:"light",original:b,modified:w,options:{...v,renderSideBySide:!1}}),(0,i.jsx)(A.K,{onClick:u,size:"md","aria-label":"Expand",variant:"ghost",style:{position:"absolute",top:"5px",right:"20px",opacity:x?.5:.1,transition:"opacity 0.3s ease-in-out"},children:(0,i.jsx)(ef.xKl,{})}),(0,i.jsx)(N.Dz,{open:d,onOpenChange:h,size:"xl",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{overflowY:"auto",height:"75%",children:[(0,i.jsxs)(N.c7,{children:[g?(0,i.jsxs)(N.L3,{children:[(0,i.jsx)("code",{children:k})," Model Code"]}):(0,i.jsxs)(N.L3,{children:[(0,i.jsx)("code",{children:k})," Model Code Diff"]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]}),(0,i.jsx)(N.R4,{children:g?(0,i.jsx)(eL.KE,{language:"sql",theme:"light",value:null!=b?b:"",options:{...y,fontSize:16}}):(0,i.jsx)(eL.zC,{language:"sql",theme:"light",original:b,modified:w,options:{...v,fontSize:16}})})]})})]})})]})};function tt(e,n){let t=(0,U.Z)(e,n);if(0===t.length)return[];if(0===e.length||0===n.length)return t.map((e,n)=>n===t.length-1?e:e+",");let i="";return t.forEach(t=>{e.includes(t)&&n.includes(t)&&(i=t)}),t.map((l,r)=>{let s;return(s=e.includes(l)?n.includes(l)?l:"--- ".concat(l," (Removed)"):"--- ".concat(l," (Added)"),l===i||r===t.length-1)?s:s+","})}function ti(e){var n,t,r,o;let{node:a,onCloseNode:d}=e,[,u]=(0,eE.zy)(),{setSqlQuery:f,setPrimaryKeys:g}=(0,nv.vr)(),v="model"===a.resourceType||"seed"===a.resourceType||"source"===a.resourceType||"snapshot"===a.resourceType,{open:y,onOpen:w,onClose:k}=(0,T.j)(),{open:C,onClose:_}=(0,T.j)({defaultOpen:!0}),{runAction:S}=(0,G.tr)(),{envInfo:z,isActionAvailable:E}=(0,H.cE)(),{primaryKey:D}=(0,ny.Ay)(a.name),I=()=>{S("row_count",{node_names:[a.name]},{showForm:!1,showLast:!1})},R=()=>{S("row_count_diff",{node_names:[a.name]},{showForm:!1,showLast:!1})},{featureToggles:N,singleEnv:F}=(0,ee.c)(),A="metadata only"===N.mode,O=(0,j.useCallback)(async()=>{let e=a.id,n=await nb({node_id:e});u("/checks/".concat(n.check_id))},[a,u]),X=(e,n)=>e?nw.add_or_remove:E(n)?"":"This action is not supported yet.",K="added"===a.changeStatus||"removed"===a.changeStatus,Q=Object.keys(null!=(r=null==(n=a.data.base)?void 0:n.columns)?r:{}),W=Object.keys(null!=(o=null==(t=a.data.current)?void 0:t.columns)?o:{});return(0,i.jsxs)(ng.x,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(h.D,{size:"sm",className:"no-track-pii-safe",children:a.name})}),(0,i.jsx)(p.h,{}),F?(0,i.jsx)(function(){var e,n,t;let l=tt(Q,W),r='select * from {{ ref("'.concat(a.name,'") }}');return(l.length&&(r="select \n ".concat(l.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}')),"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType)?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"xs",variant:"outline",children:["Explore ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsxs)(q.Dr,{value:"label",fontSize:"14px",onClick:()=>{(null==z?void 0:z.adapterType)==="dbt"?f(r):(null==z?void 0:z.adapterType)==="sqlmesh"&&f("select * from ".concat(a.name)),u("/query")},children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("query"))?void 0:e.icon})," Query"]}),(0,i.jsxs)(q.Dr,{value:"row-count",fontSize:"14px",onClick:()=>{I()},children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count"))?void 0:n.icon})," Row Count"]}),(0,i.jsx)(el.m,{content:X(K,"profile"),positioning:{placement:"left"},children:(0,i.jsxs)(q.Dr,{value:"profile",fontSize:"14px",disabled:K,onClick:()=>{S("profile",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("profile"))?void 0:t.icon})," Profile"]})})]})})})]})},{}):(0,i.jsx)(function(){var e,n,t,l,r,o,c,d;let h=tt(Q,W),x='select * from {{ ref("'.concat(a.name,'") }}');h.length&&(x="select \n ".concat(h.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}'));let p=(e,n)=>{if(A)return(0,i.jsx)(no,{display:!0,children:e});let t=X(K,n);return(0,i.jsx)(el.m,{disabled:""===t,content:t,positioning:{placement:"left"},children:e})};return"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",variant:"outline",disabled:N.disableNodeActionDropdown,children:["Explore ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"query",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{(null==z?void 0:z.adapterType)==="dbt"?f(x):(null==z?void 0:z.adapterType)==="sqlmesh"&&f("select * from ".concat(a.name)),E("query_diff_with_primary_key")&&g(void 0!==D?[D]:void 0),u("/query")},children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("query_diff"))?void 0:e.icon})," Query"]})}),(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"sandbox",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{E("query_diff_with_primary_key")&&g(void 0!==D?[D]:void 0),w(),(0,b.In)({action:"explore",node:a.name})},children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("sandbox"))?void 0:n.icon})," Sandbox (Experiment)"]})}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",p:"0",children:[(0,i.jsx)(q.QC,{children:"Diff"}),(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"row-count-diff",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{R()},children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("row_count_diff"))?void 0:t.icon})," Row Count Diff"]})}),p((0,i.jsxs)(q.Dr,{value:"profile-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("profile_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(l=(0,e_.C)("profile_diff"))?void 0:l.icon})," Profile Diff"]}),"profile_diff"),p((0,i.jsxs)(q.Dr,{value:"value-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("value_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(r=(0,e_.C)("value_diff"))?void 0:r.icon})," Value Diff"]}),"value_diff"),p((0,i.jsxs)(q.Dr,{value:"top-k-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("top_k_diff",{model:a.name,column_name:"",k:50},{showForm:!0})},children:[(0,i.jsx)(s.I,{as:null==(o=(0,e_.C)("top_k_diff"))?void 0:o.icon})," Top-K Diff"]}),"top_k_diff"),p((0,i.jsxs)(q.Dr,{value:"histogram-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("histogram_diff",{model:a.name,column_name:"",column_type:""},{showForm:!0})},children:[(0,i.jsx)(s.I,{as:null==(c=(0,e_.C)("histogram_diff"))?void 0:c.icon})," Histogram Diff"]}),"histogram_diff")]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",p:"4px 12px",children:[(0,i.jsx)(q.QC,{children:"Add to Checklist"}),(0,i.jsxs)(q.Dr,{value:"schema-diff",fontSize:"14px",onClick:()=>{O()},children:[(0,i.jsx)(s.I,{as:null==(d=(0,e_.C)("schema_diff"))?void 0:d.icon})," Schema Diff"]})]})]})})})]})},{}),(0,i.jsx)(l.a,{flex:"0 1 1%",children:(0,i.jsx)(P.J,{size:"2xs",onClick:d})})]}),(0,i.jsx)(l.a,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(x.z,{gap:"8px",children:[(0,i.jsx)(na,{node:a}),("model"===a.resourceType||"snapshot"===a.resourceType||"seed"===a.resourceType)&&(F?(0,i.jsx)(nu,{node:a,onRefresh:I}):(0,i.jsx)(nd,{node:a,onRefresh:R}))]})}),v&&(0,i.jsxs)(m.pK,{defaultValue:"columns",overflow:"auto",children:[F&&C&&(0,i.jsx)(l.a,{p:"12px",children:(0,i.jsx)(nq,{onClose:_,align:"flex-start",children:(0,i.jsxs)(c.E,{children:["Enable the Recce Checklist and start adding checks for better data validation and review.",(0,i.jsx)("br",{}),(0,i.jsx)(nA,{})]})})}),(0,i.jsxs)(m.j7,{children:[(0,i.jsx)(m.Xi,{value:"columns",children:"Columns"}),(0,i.jsx)(m.Xi,{value:"code",children:"Code"})]}),(0,i.jsxs)(m.T$,{overflow:"auto",height:"calc(100% - 42px)",children:[(0,i.jsx)(m.av,{value:"columns",p:0,overflowY:"auto",height:"100%",children:F?(0,i.jsx)(ed,{current:a.data.current}):(0,i.jsx)(ec,{base:a.data.base,current:a.data.current})}),(0,i.jsx)(m.av,{value:"code",height:"100%",p:0,children:(0,i.jsx)(tn,{node:a})})]})]}),(0,i.jsx)(te,{isOpen:y,onClose:k,current:a.data.current})]})}function tl(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=et();return(0,i.jsx)(l.a,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(x.z,{p:"5px 15px",mt:"4",separator:(0,i.jsx)(e3.k,{borderColor:"gray.200"}),gap:4,children:[(0,i.jsxs)(l.a,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null==(t=o.currentRun)||null==(n=t.progress)?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)(M.$,{size:"xs",variant:"outline",onClick:s,loading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(x.z,{children:(0,i.jsx)(M.$,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var tr=t(53835),ts=t(83576);function to(){let{isHistoryOpen:e,setHistoryOpen:n,showHistory:t,closeHistory:r}=(0,G.tr)();if(!e)return(0,i.jsxs)(l.a,{children:[(0,i.jsx)(l.a,{fontSize:"8pt",children:"History"}),(0,i.jsxs)(M.$,{size:"2xs",variant:"outline",onClick:()=>{(0,b.iZ)({name:"show"}),t()},children:[(0,i.jsx)(B.XVG,{})," Show"]})]})}let ta=()=>(0,i.jsxs)(E.T,{align:"start",gap:0,children:[(0,i.jsx)(c.E,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),tc=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et(),o=null!=(n=l.view_mode)?n:"changed_models";return(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{minWidth:"100px",size:"2xs",variant:"outline",disabled:t,children:[(0,i.jsx)(s.I,{as:ek("model").icon})," ","changed_models"===o?"Changed Models":"All"," ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsxs)(q.x0,{value:o,onValueChange:e=>{var n;n=e.value,r({...l,view_mode:n})},children:[(0,i.jsx)(q.QC,{children:"mode"}),(0,i.jsxs)(q.iD,{value:"changed_models",children:["Changed Models",(0,i.jsx)(q.S3,{})]}),(0,i.jsxs)(q.iD,{value:"all",children:["All",(0,i.jsx)(q.S3,{})]})]})})})})]})},td=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=(0,H.cE)(),{viewOptions:o,onViewOptionsChanged:a}=et(),c=new Set;for(let e of Object.values(null!=(t=null==r?void 0:r.nodes)?t:{}))e.packageName&&c.add(e.packageName);let d=null==r||null==(n=r.manifestMetadata.current)?void 0:n.project_name,u=o.packages?new Set(o.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,p=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages");return(0,i.jsxs)(q.il,{closeOnSelect:!1,children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{minWidth:"100px",size:"2xs",variant:"outline",disabled:l,children:[(0,i.jsx)(s.I,{as:nn.est})," ",p," ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsxs)(q.Uh,{children:[(0,i.jsx)(q.QC,{children:"Select Packages"}),(0,i.jsx)(q.Dr,{value:"",asChild:!0,children:(0,i.jsxs)(tr.y8,{checked:h||x?h:"indeterminate",onCheckedChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(c)})},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{children:"Select All"})]})}),(0,i.jsx)(q.bX,{}),Array.from(c).map(e=>(0,i.jsx)(q.Dr,{value:e,children:(0,i.jsxs)(tr.y8,{checked:u.has(e),onCheckedChange:()=>{(e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})})(e)},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{className:"no-track-pii-safe",children:e})]})},e))]})})})})]})},tu=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=(0,n8.T)(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(el.m,{contentProps:{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",color:"black",backgroundColor:"white"},content:e.tooltipComponent,positioning:{placement:"bottom-start"},closeOnClick:!1,disabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(W.p,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",disabled: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)}})})},th=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et();return(0,i.jsx)(tu,{isDisabled:t,value:null!=(n=l.select)?n:"",onChange:e=>{r({...l,select:e||void 0})},tooltipComponent:(0,i.jsx)(ta,{})})},tx=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et();return(0,i.jsx)(tu,{isDisabled:t,value:null!=(n=l.exclude)?n:"",onChange:e=>{r({...l,exclude:e||void 0})}})},tp=e=>(0,i.jsxs)(l.a,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.a,{fontSize:"8pt",children:e.label||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),tm=()=>{var e,n,t,l,r;let{deselect:o,focusedNode:a,selectedNodes:d,...u}=et(),{featureToggles:h}=(0,ee.c)(),{data:m}=(0,n8.T)(),f=null==m?void 0:m.single_env_onboarding,j=d.length>0,g=!a&&!j;return(0,i.jsx)(x.z,{width:"100%",padding:"4pt 8pt",className:"chakra-style-reset",children:(0,i.jsxs)(x.z,{flex:"1",children:[(0,i.jsx)(to,{}),(0,i.jsx)(tp,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(tc,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(td,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(th,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(tx,{isDisabled:j})}),(0,i.jsx)(p.h,{}),j&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tp,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(c.E,{fontSize:"9pt",color:"gray.500",children:d.length>1?"".concat(d.length," nodes selected"):"".concat(d.length," node selected")})}),(0,i.jsx)(tp,{label:"",children:(0,i.jsx)(M.$,{variant:"outline",size:"2xs",fontSize:"9pt",onClick:()=>{o()},children:"Deselect"})}),f&&(0,i.jsx)(tp,{label:"Explore",children:(0,i.jsx)(ts.e,{attached:!0,variant:"outline",children:(0,i.jsxs)(q.il,{positioning:{placement:"bottom-end"},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",children:["Actions ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsx)(q.Dr,{value:"row-count",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runRowCount()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("row_count_diff"))?void 0:e.icon})," Row Count"]})})})})})]})})})]}),!f&&(0,i.jsx)(tp,{label:"Explore",children:(0,i.jsx)(ts.e,{attached:!0,variant:"outline",children:(0,i.jsxs)(q.il,{positioning:{placement:"bottom-end"},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",disabled:h.disableViewActionDropdown,children:["Actions ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsxs)(q.Uh,{m:"0",p:"4px 12px",children:[(0,i.jsx)(q.QC,{children:"Diff"}),(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(q.Dr,{value:"row-count-diff",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runRowCountDiff()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count_diff"))?void 0:n.icon})," Row Count Diff"]})})}),(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(q.Dr,{value:"value-diff",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runValueDiff()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("value_diff"))?void 0:t.icon})," Value Diff"]})})})]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",px:"12px",children:[(0,i.jsx)(q.QC,{children:"Add to Checklist"}),(0,i.jsx)(q.Dr,{value:"lineage-diff",disabled:!(g||j&&d.length>1),onClick:()=>{u.addLineageDiffCheck(u.viewOptions.view_mode)},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(l=(0,e_.C)("lineage_diff"))?void 0:l.icon})," Lineage Diff"]})}),(0,i.jsx)(q.Dr,{value:"schema-diff",disabled:!1,onClick:()=>{u.addSchemaDiffCheck()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(r=(0,e_.C)("schema_diff"))?void 0:r.icon})," Schema Diff"]})})]})]})})})]})})})]})})};var tf=t(53169);async function tj(e){return(await v.g.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function tg(){return(0,i.jsx)(l.a,{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:o}=ew(n);return(0,i.jsx)(el.m,{content:l,positioning:{placement:"right"},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.I,{color:o,as:r})," ",t]})},n)})})}var tv=t(50369);let ty={mode:"per_node",status:"pending",completed:0,total:0,actions:{}},tb=function(){let{open:e,onOpen:n,onClose:t}=(0,T.j)(),[r,s]=(0,j.useState)(0),[o,a]=(0,j.useState)(),c=(0,j.useRef)(null),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{a(()=>e),n()})),[n]),h=()=>{null==o||o(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(N.Dz,{size:"xl",open:e,role:"alertdialog",initialFocusEl:()=>c.current,onOpenChange:h,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsxs)(N.L3,{children:["Value Diff on ",r," nodes"]})}),(0,i.jsx)(N.R4,{gap:"20px",as:d.s,direction:"column",children:(0,i.jsxs)(l.a,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(N.Es,{gap:1,children:[(0,i.jsx)(M.$,{ref:c,onClick:h,variant:"outline",colorPalette:"gray",children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"iochmara",onClick:()=>{null==o||o(!0),t()},ml:3,children:"Execute"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})}},tw=e=>{let{changeStatus:n}=e;if(!n)return(0,i.jsx)(i.Fragment,{});let{color:t,icon:l}=ew(n);return(0,i.jsx)(s.I,{boxSize:"14px",display:"inline-flex",color:t,as:l})},tk=e=>{let{transformationType:n,legend:t}=e,l="U",r="red";return("passthrough"===n?(l="P",r="gray"):"renamed"===n?(l="R",r="orange"):"derived"===n?(l="D",r="orange"):"source"===n?(l="S",r="blue"):(l="U",r="red"),n)?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(F.f8,{fontSize:"8pt",size:"sm",colorPalette:r,borderRadius:"full",paddingX:"4px",children:(0,i.jsx)(F.d1,{children:l})})}):(0,i.jsx)(i.Fragment,{})},tC=()=>{let{lineageGraph:e}=(0,H.cE)(),{centerNode:n,viewOptions:t,cll:l}=et(),r=t.column_level_lineage;if(!e)return(0,i.jsx)(i.Fragment,{});if(!r)return"Default View";if(void 0===r.node_id)return(0,i.jsx)(c.E,{as:"span",children:"Impact Radius for All Changed Models"});let s=r.node_id in e.nodes?e.nodes[r.node_id].name:r.node_id;if(r.column){let e="".concat(r.node_id,"_").concat(r.column);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.E,{as:"span",mr:"5px",children:["Column Lineage for"," "]}),(0,i.jsxs)(o.C,{onClick:()=>{n(e)},cursor:"pointer",children:[s,".",r.column]})]})}{let e=r.node_id;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.E,{as:"span",mr:"5px",children:"Impact Radius for"}),(0,i.jsx)(o.C,{onClick:()=>{n(e)},cursor:"pointer",children:s})]})}},t_=e=>{var n;let{action:t}=e,{showColumnLevelLineage:r,resetColumnLevelLineage:o,interactive:a,viewOptions:u}=et(),{data:h}=(0,n8.T)(),x=null!=(n=null==h?void 0:h.single_env_onboarding)&&n,{lineageGraph:p}=(0,H.cE)(),m=!(null==p?void 0:p.catalogMetadata.current);return(0,i.jsxs)(d.s,{direction:"row",gap:"5px",children:[!x&&(0,i.jsx)(l.a,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",children:(0,i.jsx)(el.m,{openDelay:50,content:"Please provide catalog.json to enable Impact Radius",disabled:!m,positioning:{placement:"top"},children:(0,i.jsxs)(M.$,{size:"sm",variant:"ghost",whiteSpace:"nowrap",display:"inline-flex",disabled:!a||m,onClick:()=>{r({no_upstream:!0,change_analysis:!0})},children:[(0,i.jsx)(ef.JwZ,{})," Impact Radius"]})})}),u.column_level_lineage&&(0,i.jsxs)(d.s,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",fontSize:"0.8rem",p:"0 0.625rem",alignItems:"center",children:[(0,i.jsx)(tC,{}),t.isError&&(0,i.jsx)(el.m,{content:"Error: ".concat(t.error.message),positioning:{placement:"bottom"},children:(0,i.jsx)(c.E,{as:"span",color:"red.500",ml:"2px",display:"inline-flex",alignItems:"center",children:(0,i.jsx)(s.I,{as:nl.GLE,color:"red.500",boxSize:"14px"})})}),t.isPending?(0,i.jsx)(J.y,{size:"xs",ml:"2px"}):(0,i.jsx)(A.K,{variant:"ghost",size:"xs",ml:"2px","aria-label":"Reset Column Level Lineage",onClick:()=>{o()},children:(0,i.jsx)(nl.yBK,{size:"10px"})})]})]})};function tS(){return(0,i.jsx)(l.a,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({passthrough:["Pass Through","The column is directly selected from the upstream table."],renamed:["Renamed","The column is selected from the upstream table but with a different name."],derived:["Derived","The column is created through transformations applied to upstream columns, such as calculations, conditions, functions, or aggregations."],source:["Source","The column is not derived from any upstream data. It may originate from a seed/source node, literal value, or data generation function."],unknown:["Unknown","We have no information about the transformation type. This could be due to a parse error, or other unknown reason."]}).map(e=>{let[n,[t,l]]=e;return(0,i.jsx)(el.m,{content:l,positioning:{placement:"right"},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(tk,{legend:!0,transformationType:n})," ",t]})},n)})})}let tz={lineageNotificationDismissed:"".concat("recce","-lineage-notification-dismissed")};function tE(e){let{notification:n,type:t}=e,l=tz.lineageNotificationDismissed,[r,s]=(0,j.useState)(!0);return((0,j.useEffect)(()=>{"true"===sessionStorage.getItem(l)&&s(!1)},[l]),null!==n&&r)?(0,i.jsxs)(d.s,{w:"100%",direction:"row",p:"5px 10px",gap:"5px",alignItems:"flex-start",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:{info:"blue.50",success:"green.50",warning:"yellow.50",error:"red.50"}[t],children:[n,(0,i.jsx)(p.h,{}),(0,i.jsx)(P.J,{onClick:()=>{sessionStorage.setItem(l,"true"),s(!1)}})]}):null}function tD(){return(0,i.jsx)(d.s,{flex:"1",h:"100%",minH:0,m:"2",p:"4",bg:"blue.50",borderRadius:"lg",boxShadow:"md",justifyContent:"center",children:(0,i.jsxs)(d.s,{w:"80%",direction:"column",overflowY:"auto",gap:6,px:8,pb:8,children:[(0,i.jsxs)(d.s,{direction:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(d.s,{p:2,bg:"white",borderRadius:"full",alignItems:"center",justifyContent:"center",boxShadow:"md",children:(0,i.jsx)(s.I,{as:nt.JVA,boxSize:7,color:"blue.500"})}),(0,i.jsx)(h.D,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,i.jsxs)(c.E,{fontSize:"md",textAlign:"center",children:["Recce is currently running in"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"limited functionality mode"})," ","so you can run queries but"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"can't diff the results yet!"})]})]}),(0,i.jsxs)(d.s,{direction:"column",gap:2,children:[(0,i.jsx)(c.E,{fontSize:"md",children:"To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison."}),(0,i.jsx)(c.E,{children:"Once configured, you'll be able to:"}),(0,i.jsxs)(em.$z,{children:[(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Run statistical data diffs"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Run query diffs"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Save checks to your Recce Checklist"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"...and more!"})})]}),(0,i.jsx)(c.E,{fontSize:"md",children:"Take the next step toward better data impact assessment."})]}),(0,i.jsx)(d.s,{w:"100%",direction:"column",mt:6,children:(0,i.jsx)(M.$,{colorPalette:"blue",size:"lg",onClick:()=>{window.open("https://docs.datarecce.io/get-started/#prepare-dbt-artifacts","_blank")},children:"Start Now"})})]})})}function tI(){return(0,i.jsxs)(d.s,{direction:"row",gap:"10px",alignItems:"flex-start",children:[(0,i.jsx)(s.I,{as:nt.yHN,color:"blue.500",boxSize:"5"}),(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[(0,i.jsxs)(c.E,{fontWeight:"bold",children:["Single Environment Mode"," ",(0,i.jsx)(c.E,{color:"red",as:"span",children:"Limited Functionality"})]}),(0,i.jsx)(c.E,{fontSize:"sm",children:"Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments."}),(0,i.jsx)(c.E,{fontSize:"sm",children:"To set up full environment comparison:"}),(0,i.jsxs)(em.$z,{ps:"4",children:[(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{fontSize:"sm",children:"Run `recce debug` for setup assistance"})}),(0,i.jsx)(em.ck,{children:(0,i.jsxs)(c.E,{fontSize:"sm",children:["Visit"," ",(0,i.jsx)(r.N,{color:"blue.500",fontSize:"sm",fontWeight:"medium",target:"_blank",href:"https://docs.datarecce.io/configure-diff/",children:"docs"})," ","for configuration details"]})})]})]})]})}async function tR(e){return(await v.g.post("/api/cll",e)).data}var tT=t(48230);let tN=e=>{let{menuItems:n,open:t,onClose:l,x:r,y:s}=e,{featureToggles:o}=(0,ee.c)();return(0,i.jsx)(q.il,{open:t,onOpenChange:l,children:(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{fontSize:"10pt",position:"absolute",width:"250px",style:{left:"".concat(r,"px"),top:"".concat(s,"px")},children:0===n.length?(0,i.jsx)(q.Dr,{value:"no-action",disabled:!0,children:"No action available"},"no action"):n.map(e=>{let{isSeparator:n,label:t,isDisabled:r,action:s,itemIcon:a}=e;if(n)return(0,i.jsx)(q.bX,{},t);{let e=(0,i.jsxs)(q.Dr,{value:String(t),disabled:r,onClick:()=>{s&&s(),l()},children:[a," ",t]},t);return r?(0,i.jsx)(no,{display:"metadata only"===o.mode,children:e}):e}})})})})})},tF=e=>{var n,t,l,r,o,a,c,d,u,h,x;let{isOpen:p,onClose:m,x:f,y:j,node:g}=e,v=[],{selectParentNodes:y,selectChildNodes:b,getNodeColumnSet:w,selectMode:k,cll:C,showColumnLevelLineage:_}=et(),{runAction:S}=(0,G.tr)(),{featureToggles:z}=(0,ee.c)(),{isActionAvailable:E}=(0,H.cE)(),{data:D}=(0,n8.T)(),{lineageGraph:I}=(0,H.cE)(),R=!(null==I?void 0:I.catalogMetadata.current),T=null!=(t=null==D?void 0:D.single_env_onboarding)&&t,N=z.disableDatabaseQuery,{primaryKey:F}=(0,ny.Ay)(null==g||null==(n=g.data)?void 0:n.name),{setSqlQuery:q,setPrimaryKeys:A}=(0,nv.vr)(),[,L]=(0,eE.zy)();if(!(null==g?void 0:g.data))return(0,i.jsx)(i.Fragment,{});let M=g.data,O=M.resourceType,P=Array.from(w(g.id)),X={source:"lineage_model_node"};if("modified"===M.changeStatus&&v.push({label:"Show Impact Radius",itemIcon:(0,i.jsx)(ef.JwZ,{}),isDisabled:R,action:()=>{_({node_id:g.id,change_analysis:!0,no_upstream:!0})}}),!k&&O&&["model","seed","snapshot"].includes(O)){v.length>0&&v.push({label:"select group one",isSeparator:!0});let e=(0,e_.C)(T?"query":"query_diff"),n=tt(Object.keys(null!=(o=null==(l=M.data.base)?void 0:l.columns)?o:{}),Object.keys(null!=(a=null==(r=M.data.current)?void 0:r.columns)?a:{})),t='select * from {{ ref("'.concat(M.name,'") }}');if(n.length&&(t="select \n ".concat(n.join("\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),v.push({label:"Query",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q(t),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}}),P.length>0)if(void 0!==C){let n=new Set;F&&n.add(F),P.forEach(e=>{n.add(e)}),v.push({label:"Query Related Columns",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q("select \n ".concat(Array.from(n).join(",\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}})}else{let n=Object.entries(null!=(d=null==(c=M.change)?void 0:c.columns)?d:{}).filter(e=>{let[,n]=e;return"modified"===n}).map(e=>{let[n]=e;return n});if(n.length>0){let t=new Set;F&&t.add(F),n.forEach(e=>{t.add(e)}),v.push({label:"Query Modified Columns",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q("select \n ".concat(Array.from(t).join(",\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}})}}e=(0,e_.C)(T?"row_count":"row_count_diff"),v.push({label:null!=(u=null==e?void 0:e.title)?u:"Row count",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{S(T?"row_count":"row_count_diff",{node_names:[M.name]},{showForm:!1,trackProps:X})}}),e=(0,e_.C)(T?"profile":"profile_diff"),v.push({label:null!=(h=null==e?void 0:e.title)?h:"Profile",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{let e=Array.from(w(g.id));S(T?"profile":"profile_diff",{model:M.name,columns:e},{showForm:!0,trackProps:X})}}),T||(e=(0,e_.C)("value_diff"),v.push({label:null!=(x=null==e?void 0:e.title)?x:"Value Diff",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{let e=Array.from(w(g.id));S("value_diff",{model:M.name,columns:e},{showForm:!0,trackProps:X})}}))}return T||(v.length>0&&v.push({label:"select group two",isSeparator:!0}),v.push({label:"Select Parent Nodes",itemIcon:(0,i.jsx)(tT.iXB,{}),action:()=>{y(g.id,1)}}),v.push({label:"Select Child Nodes",itemIcon:(0,i.jsx)(tT.pnF,{}),action:()=>{b(g.id,1)}}),v.push({label:"Select All Upstream Nodes",itemIcon:(0,i.jsx)(tT.iXB,{}),action:()=>{y(g.id)}}),v.push({label:"Select All Downstream Nodes",itemIcon:(0,i.jsx)(tT.pnF,{}),action:()=>{b(g.id)}})),(0,i.jsx)(tN,{x:f,y:j,menuItems:v,open:p,onClose:m})},tq=e=>{var n,t,l,r,o,a,c,d;let{isOpen:u,onClose:h,x,y:p,node:m}=e,f=[],{runAction:j}=(0,G.tr)(),{isActionAvailable:g}=(0,H.cE)(),{featureToggles:v}=(0,ee.c)(),{data:y}=(0,n8.T)(),b=null!=(o=null==y?void 0:y.single_env_onboarding)&&o,w=v.disableDatabaseQuery;if((null==m?void 0:m.data)===void 0)return(0,i.jsx)(i.Fragment,{});let k=m.data,C=k.node,_=k.column,S=k.type,z={source:"lineage_column_node"},E=(null==(t=C.data.base)||null==(n=t.columns)?void 0:n[_])===void 0||(null==(r=C.data.current)||null==(l=r.columns)?void 0:l[_])===void 0,D=(0,e_.C)(b?"profile":"profile_diff");return f.push({label:null!=(a=null==D?void 0:D.title)?a:"Profile",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("profile_diff",{model:C.name,columns:[_]},{showForm:!1,trackProps:z})},isDisabled:E||!g("profile_diff")||w}),b||(D=(0,e_.C)("histogram_diff"),f.push({label:null!=(c=null==D?void 0:D.title)?c:"Histogram Diff",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("histogram_diff",{model:C.name,column_name:_,column_type:S},{showForm:!1,trackProps:z})},isDisabled:E||!S||!(0,Y.c)(S)||w}),D=(0,e_.C)("top_k_diff"),f.push({label:null!=(d=null==D?void 0:D.title)?d:"Top-K Diff",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("top_k_diff",{model:C.name,column_name:_,k:50},{showForm:!1,trackProps:z})},isDisabled:E||w})),(0,i.jsx)(tN,{x:x,y:p,menuItems:f,open:u,onClose:h})},tA=e=>{let{isOpen:n,onClose:t,x:l,y:r,node:s}=e,{featureToggles:o}=(0,ee.c)();return o.disableViewActionDropdown?(0,i.jsx)(tN,{menuItems:[],open:n,onClose:t,x:l,y:r}):(null==s?void 0:s.type)==="customNode"?(0,i.jsx)(tF,{x:l,y:r,isOpen:n,onClose:t,node:s}):(null==s?void 0:s.type)==="customColumnNode"?(0,i.jsx)(tq,{x:l,y:r,isOpen:n,onClose:t,node:s}):void 0};function tL(){let{featureToggles:e}=(0,ee.c)();return"metadata only"!==e.mode?null:(0,i.jsx)("div",{className:"flex items-center w-full px-2 py-0.5 bg-cyan-50",children:(0,i.jsxs)(x.z,{flex:"1",fontSize:"sm",color:"cyan.600",children:[(0,i.jsx)(nl.GLE,{}),(0,i.jsx)(c.E,{children:"Query functions disabled without a data warehouse connection."}),(0,i.jsx)(M.$,{bgColor:"iochmara.400",size:"2xs",onClick:()=>{window.open(nr.Q,"_blank")},children:"Connect to Data Warehouse"})]})})}let tM={customNode:function(e){var n,t,r,o;let{data:a}=e,{id:c,resourceType:u,changeStatus:h}=a,m=(0,e8.Pj)(e=>e.transform[2]>.3),{icon:f}=ek(u),[g,v]=(0,j.useState)(!1),{interactive:y,selectNode:b,selectMode:w,focusedNode:k,getNodeAction:C,getNodeColumnSet:_,isNodeHighlighted:S,isNodeSelected:z,isNodeShowingChangeAnalysis:E,showContextMenu:D,viewOptions:R,cll:T,showColumnLevelLineage:N}=et(),F=null==T||null==(n=T.current.nodes[c])?void 0:n.change_category,q=S(c),A=z(c),L=(null==(t=R.column_level_lineage)?void 0:t.node_id)===c&&void 0===R.column_level_lineage.column,M=(null==k?void 0:k.id)===c||L,O=E(c),{icon:P,color:X,backgroundColor:K}=h?ew(h):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},Q=a.name,W=_(a.id),$=W.size>0,V="action_result"===w?C(a.id):void 0,Z=m?"selecting"===w?A?X:"white":"action_result"!==w?M||A||g?K:"white":V?M||A||g?K:X:"white":M||A||g?X:K,H="selecting"===w?A?"white":"inherit":"action_result"===w&&V&&!A?"white":"inherit",U="selecting"===w?A?"white":"inherit":"action_result"===w&&V&&!A?"white":"inherit",G="selecting"===w?A?"white":X:"action_result"===w?V&&!A?"white":"inherit":X;return(0,i.jsxs)(d.s,{cursor:"selecting"===w?"pointer":"inherit",direction:"column",width:"300px",transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===w?V?"none":"opacity(0.2) grayscale(50%)":q||M||A||g?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},children:[(0,i.jsxs)(d.s,{borderColor:X,borderWidth:"2px",borderTopRadius:8,borderBottomRadius:8*!$,backgroundColor:Z,height:"60px",children:[(0,i.jsx)(d.s,{bg:X,padding:y?"8px":"2px",borderRightWidth:"2px",borderColor:"selecting"===w?"#00000020":X,alignItems:"top",visibility:m?"inherit":"hidden",children:y&&(0,i.jsx)(nf,{checked:"selecting"===w&&A||"action_result"===w&&!!V,onClick:e=>{"action_result"!==w&&(e.stopPropagation(),b(a.id))}})}),(0,i.jsxs)(d.s,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(d.s,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(nj,{name:Q,color:H,resourceType:u}),g?(0,i.jsxs)(i.Fragment,{children:["modified"===h&&(0,i.jsx)(el.m,{content:"Show Impact Radius",positioning:{placement:"top"},openDelay:500,children:(0,i.jsx)(I.o,{children:(0,i.jsx)(s.I,{boxSize:"14px",as:ef.JwZ,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:e=>{e.preventDefault(),e.stopPropagation(),N({node_id:c,change_analysis:!0,no_upstream:!0})}})})}),(0,i.jsx)(s.I,{as:B.EUt,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),D(n,e)}})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.I,{boxSize:"16px",color:U,as:f}),h&&(0,i.jsx)(s.I,{color:G,as:P})]})]}),(0,i.jsx)(d.s,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsx)(x.z,{gap:"8px",children:V?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.h,{}),(0,i.jsx)(nh,{node:a,action:V})]}):O?(0,i.jsx)(l.a,{height:"20px",color:"gray",fontSize:"9pt",margin:0,fontWeight:600,children:F?np[F]:""}):"action_result"!==w&&"model"===a.resourceType?(0,i.jsx)(nm,{id:a.id,inverted:"selecting"===w&&!!A}):(0,i.jsx)(i.Fragment,{})})})]})]}),$&&(0,i.jsx)(l.a,{p:"10px 10px",borderColor:X,borderWidth:"2px",borderTopWidth:0,borderBottomRadius:8,children:(0,i.jsx)(l.a,{height:"".concat(W.size*e4.$M,"px"),overflow:"auto"})}),Object.keys(null!=(r=a.parents)?r:{}).length>0&&(0,i.jsx)(e8.h7,{type:"target",position:e8.yX.Left,isConnectable:!1}),Object.keys(null!=(o=a.children)?o:{}).length>0&&(0,i.jsx)(e8.h7,{type:"source",position:e8.yX.Right,isConnectable:!1})]})},customColumnNode:function(e){var n,t;let{id:r,data:o}=e,{id:a}=o.node,{column:c,type:u,transformationType:h,changeStatus:x}=o,m=(0,e8.Pj)(e=>e.transform[2]>.3),{viewOptions:f,showContextMenu:g,isNodeHighlighted:v,isNodeShowingChangeAnalysis:y}=et(),b=null==(n=f.column_level_lineage)?void 0:n.node_id,w=c===(null==(t=f.column_level_lineage)?void 0:t.column)&&a===b,[k,C]=j.useState(!1),_=v(r),S=y(a);return m?(0,i.jsxs)(d.s,{width:"280px",padding:"0px 10px",border:"1px solid gray",backgroundColor:w?"#f0f0f0":"inherit",_hover:{backgroundColor:"#f0f0f0"},onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)},filter:_?"none":"opacity(0.2) grayscale(50%)",cursor:"pointer",children:[(0,i.jsxs)(d.s,{fontSize:"11px",color:"black",width:"100%",gap:"3px",alignItems:"center",height:"".concat(e4.$M-1,"px"),children:[S&&x?(0,i.jsx)(tw,{changeStatus:x}):(0,i.jsx)(tk,{transformationType:h}),(0,i.jsx)(l.a,{height:"".concat(e4.$M+1,"px"),children:c}),(0,i.jsx)(p.h,{}),k?(0,i.jsx)(s.I,{as:B.EUt,boxSize:"14px",display:"inline-flex",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),g(n,e)}}):(0,i.jsx)(l.a,{height:"".concat(e4.$M+1," px"),children:u})]}),(0,i.jsx)(e8.h7,{type:"target",position:e8.yX.Left,isConnectable:!1,style:{left:0,visibility:"hidden"}}),(0,i.jsx)(e8.h7,{type:"source",position:e8.yX.Right,isConnectable:!1,style:{right:0,visibility:"hidden"}})]}):(0,i.jsx)(i.Fragment,{})}},tO=[],tP={customEdge:function(e){let{source:n,target:t,sourceX:l,sourceY:r,targetX:s,targetY:o,sourcePosition:a,targetPosition:c,style:d={},markerEnd:u,data:h}=e,x={...d},{isEdgeHighlighted:p}=et();(null==h?void 0:h.changeStatus)&&(x.stroke=ew(h.changeStatus).hexColor,x.strokeDasharray="5"),p(n,t)||(x.filter="opacity(0.2) grayscale(50%)");let[m]=(0,e8.Fp)({sourceX:l,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:c});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e8.tE,{path:m,markerEnd:u,style:{...x,...d}})})}},tX=e=>e.data.changeStatus?ew(e.data.changeStatus).hexColor:"lightgray",tK=(0,j.forwardRef)(function(e,n){let{interactive:t=!1,...r}=e,o=(0,e8.VH)(),a=(0,j.useRef)(null),{successToast:u,failToast:h}=eN(),{copyToClipboard:x,ImageDownloadModal:p,ref:m}=nR({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{try{return e.classList.contains(nI)}catch(n){if(e.className&&"string"==typeof e.className)return e.className.includes(nI);return!1}},onSuccess:()=>{u("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),h("Failed to copy image to clipboard",e)}}),[f,g,v]=(0,e8.ck)(tO),[y,w,k]=(0,e8.fM)([]),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:D}=(0,H.cE)(),{featureToggles:R,singleEnv:N}=(0,ee.c)(),{runId:F,showRunId:q,closeRunResult:A,runAction:L,isRunResultOpen:O}=(0,G.tr)(),{run:P}=nk(F),[X,K]=(0,j.useState)({...r.viewOptions}),Q=(0,j.useRef)([]).current,[W,$]=(0,j.useState)(void 0),B=(0,Z.n)({mutationFn:tR}),[V,U]=(0,j.useState)({}),Y=e=>f.find(n=>n.data.name===e);(0,j.useImperativeHandle)(n,()=>({copyToClipboard:x}));let et=(0,j.useMemo)(()=>!!C&&C.modifiedSet.length>0,[C]),ei=null!=(ew=X.view_mode)?ew:"changed_models",el=(0,j.useMemo)(()=>f.filter(e=>"customNode"===e.type).map(e=>e.id),[f]),er=(0,j.useMemo)(()=>C?el.map(e=>C.nodes[e]):[],[C,el]),[es,eo]=(0,j.useState)(),ea=es?null==C?void 0:C.nodes[es]:void 0,[ec,ed]=(0,j.useState)(),[eh,ep]=(0,j.useState)(new Set),em=(0,j.useMemo)(()=>C?Array.from(eh).map(e=>C.nodes[e]):[],[C,eh]),ef=((e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...ty}).current,{showRunId:s}=(0,G.tr)(),o=async(n,o,a)=>{r.mode="multi_nodes",r.actions={};let c=r.mode,d=r.actions;t(),r.status="running";let u=[];for(let n of e){let e=o(n);e?(d[n.id]={mode:c,status:"skipped",skipReason:e},i(n)):(d[n.id]={mode:c,status:"pending"},u.push(n))}let h=a(u);try{let{run_id:e}=await (0,eY.AU)(n,h,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await (0,eY.Zc)(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of u)d[e.id]={mode:c,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{r.mode="per_node",r.actions={};let o=r.mode,a=r.actions;for(let n of(t(),r.status="running",e))a[n.id]={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:c}=s(t);if(c)a[t.id]={mode:o,status:"skipped",skipReason:c},i(t);else try{let{run_id:l}=await (0,eY.AU)(n,e,{nowait:!0});for(r.currentRun={run_id:l},a[t.id]={mode:o,status:"running"},i(t);;){let e=await (0,eY.Zc)(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(a[t.id]={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},c=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(r.actions[t.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},d=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(r.actions[t.id]={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)}))},u=async()=>{var e;r.status="canceling",(null==(e=r.currentRun)?void 0:e.run_id)&&await (0,eY.Su)(r.currentRun.run_id)};return{actionState:r,runRowCount:c,runRowCountDiff:d,runValueDiff:async()=>{await a("value_diff",e=>{var n;let t=null==(n=e.data.current)?void 0:n.primary_key;return t?{params:{model:e.name,primary_key:t}}:{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 tj({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await nb({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await nb({node_id:t})}return n},cancel:u,reset:()=>{Object.assign(r,ty)}}})(em.length>0?em:er,{onActionStarted:()=>{ed("action_result")},onActionNodeUpdated:e=>{g(n=>n.map(n=>n.id===e.id?{...n}:n))},onActionCompleted:()=>{}}),ej=(0,j.useMemo)(()=>{if(!C)return new Set;let e=new Set;if(W){for(let[n,t]of Object.entries(W.current.nodes))!1!==t.impacted&&e.add(n);for(let n of Object.keys(W.current.columns))e.add(n)}else e="action_result"===ec?new Set(Object.keys(ef.actionState.actions)):ea?(0,tf.KC)((0,e4.Qf)(C,[ea.id]),(0,e4.Ve)(C,[ea.id])):et?(0,e4.Ve)(C,C.modifiedSet):new Set(el);return new Set(e)},[C,W,ec,ea,et,ef.actionState.actions,el]),eg=(()=>{let{open:e,onClose:n,onOpen:t}=(0,T.j)(),[i,l]=(0,j.useState)({x:0,y:0}),[r,s]=(0,j.useState)();return{props:{x:i.x,y:i.y,node:r,isOpen:e,onClose:n},showContextMenu:(e,n,i)=>{l({x:e,y:n}),s(i),t()},closeContextMenu:()=>{l({x:0,y:0}),s(void 0),n()}}})();(0,j.useLayoutEffect)(()=>{(async()=>{var e,n,t,i;let l,s;if(!C)return;if(X.node_ids)s=X.node_ids;else{let t=null==(e=C.manifestMetadata.current)?void 0:e.project_name,i={view_mode:null!=(n=X.view_mode)?n:et?"changed_models":"all",packages:t?[t]:void 0,...r.viewOptions};try{s=(await eu({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}catch(e){i.view_mode="all",s=(await eu({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}K(i)}if(X.column_level_lineage)try{l=await B.mutateAsync(X.column_level_lineage)}catch(e){if(e instanceof tv.pe)return void eT.X.create({title:"Column Level Lineage error",description:null!=(i=null==(t=e.response)?void 0:t.data.detail)?i:e.message,type:"error",closable:!0})}let[o,a,c]=(0,e4.X2)(C,{selectedNodes:s,cll:l});(0,e4.Zp)(o,a),g(o),w(a),U(c),$(l)})()},[C]);let ev=()=>{eo(void 0)},ey=e=>{let n=f.find(n=>n.id===e);if(n){if(n.parentId){var t;let e=n.parentId;n=null!=(t=f.find(n=>n.id===e))?t:n}if(n.width&&n.height){let e=n.position.x+n.width/2,t=n.position.y+n.height/2,i=o.getZoom();o.setCenter(e,t,{zoom:i,duration:200})}}},eb=(()=>{let[,e]=(0,eE.zy)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])})();var ew,ek=()=>{"selecting"!==ec&&(es?ey(es):o.fitView({nodes:f,duration:200}))};let eC=a.current,e_=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let n of e){let e=n.contentRect.width,t=n.contentRect.height;(Math.abs(t-e_.current.height)>10||Math.abs(e-e_.current.width)>10)&&e_.current.height>0&&t>0&&e_.current.width>0&&e>0&&ek(),e_.current={width:e,height:t}}});return eC&&e.observe(eC),()=>{eC&&e.unobserve(eC)}},[eC,e_,ek]);let eS=async function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=X.column_level_lineage;await eR({...X,column_level_lineage:e},!1),n||Q.push(t),(null==e?void 0:e.node_id)?eo(e.node_id):eo(void 0)},ez=async e=>{if(e){if(0===Q.length)return;let e=Q.pop();e?await eS(e,!0):await eS(void 0,!0)}else await eS(void 0,!0)},eD=(e,n)=>{if(t&&C){var i;if("customColumnNode"===n.type)return void(!ec&&eS({node_id:n.data.node.id,column:n.data.column}));if(eq(),ec)if("action_result"===ec){let e=ef.actionState.actions[n.id];(null==(i=e.run)?void 0:i.run_id)&&q(e.run.run_id),eo(n.id)}else{let e=new Set(eh);eh.has(n.id)?e.delete(n.id):e.add(n.id),ep(e),0===e.size&&ed(void 0)}else eo(n.id)}},eI=async e=>{var n,t,i,l,r;let s,a,{viewOptions:c=X,fitView:d}=e;if(!C)return;if(X.select!==c.select||X.exclude!==c.exclude||X.packages!==c.packages||X.view_mode!==c.view_mode){try{let e=await eu({select:c.select,exclude:c.exclude,packages:c.packages,view_mode:c.view_mode});c.column_level_lineage=void 0,a=e.nodes}catch(e){e instanceof tv.pe&&eT.X.create({title:"Select node error",description:null!=(i=null==(t=e.response)?void 0:t.data.detail)?i:e.message,type:"error",closable:!0});return}eo(void 0)}else a=f.map(e=>e.id);if(c.column_level_lineage)try{s=await B.mutateAsync(c.column_level_lineage)}catch(e){if(e instanceof tv.pe)return void eT.X.create({title:"Column Level Lineage error",description:null!=(r=null==(l=e.response)?void 0:l.data.detail)?r:e.message,type:"error",closable:!0})}let[u,h,x]=(0,e4.X2)(C,{selectedNodes:a,cll:s});g(u),w(h),U(x),$(s),(null==P||null==(n=P.params)?void 0:n.model)&&!Y(P.params.model)&&A(),d&&(await new Promise(e=>setTimeout(e,1)),o.fitView({nodes:u,duration:200}))},eR=async function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];K(e),await eI({viewOptions:e,fitView:n})},eF=tb();(0,j.useEffect)(()=>{let e=null==P?void 0:P.type;if(t&&O&&!(!e||["query_diff","query","row_count"].includes(e))&&!ec){var n;let e=null==(n=P.params)?void 0:n.model,t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});if(e){let n=Y(e);n?ea!==n.data&&eD(t,n):eR({...X,view_mode:"all"})}else ev()}},[P,X,O,ec]);let eq=()=>{eg.closeContextMenu()},eA=(e,n)=>{if(!t||"action_result"===ec)return;e.preventDefault();let i=m.current,l=i.getBoundingClientRect(),r=e.clientX-l.left,s=e.clientY-l.top+i.offsetTop;eg.showContextMenu(r,s,n)},eL=()=>{ed(void 0),ep(new Set),eo(void 0),A(),null==D||D()},eM={interactive:t,nodes:f,focusedNode:ea,selectedNodes:em,viewOptions:X,showContextMenu:eA,onViewOptionsChanged:eR,selectMode:ec,selectNode:e=>{if(ec){if("selecting"===ec){let n=new Set(eh);eh.has(e)?n.delete(e):n.add(e),ep(n),0===n.size&&ed(void 0)}}else C&&(ep(new Set([e])),ed("selecting"),eo(void 0),ef.reset())},selectParentNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===ec||void 0===C)return;!ec&&(ed("selecting"),ef.reset(),X.column_level_lineage&&eR({...X,column_level_lineage:void 0}));let t=(0,e4.Qf)(C,[e],n);ep((0,tf.KC)(eh,t))},selectChildNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===ec||void 0===C)return;!ec&&(ed("selecting"),ef.reset(),X.column_level_lineage&&eR({...X,column_level_lineage:void 0}));let t=(0,e4.Ve)(C,[e],n);ep((0,tf.KC)(eh,t))},deselect:eL,isNodeHighlighted:e=>ej.has(e),isNodeSelected:e=>eh.has(e),isEdgeHighlighted:(e,n)=>W?e in W.current.parent_map&&n in W.current.parent_map[e]:ej.has(e)&&ej.has(n),isNodeShowingChangeAnalysis:e=>{var n;if(!C)return!1;let t=e in C.nodes?C.nodes[e]:void 0;if(null==(n=X.column_level_lineage)?void 0:n.change_analysis){let n=X.column_level_lineage;return n.node_id&&!n.column?n.node_id===e&&!!(null==t?void 0:t.changeStatus):!!(null==t?void 0:t.changeStatus)}return!1},getNodeAction:e=>ef.actionState.actions[e],getNodeColumnSet:e=>e in V?new Set(V[e]):new Set,runRowCount:async()=>{"selecting"===ec?(await ef.runRowCount(),(0,b.yk)({type:"row_count",selected:"multi"})):ea?(L("row_count",{node_names:[ea.name]},{showForm:!1,showLast:!1}),(0,b.yk)({type:"row_count",selected:"single"})):(L("row_count",{select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"row_count",selected:"none"}))},runRowCountDiff:async()=>{"selecting"===ec?(await ef.runRowCountDiff(),(0,b.yk)({type:"row_count_diff",selected:"multi"})):ea?(L("row_count_diff",{node_names:[ea.name]},{showForm:!1,showLast:!1}),(0,b.yk)({type:"row_count_diff",selected:"single"})):(L("row_count_diff",{select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(ea)L("value_diff",{model:ea.name},{showForm:!0,showLast:!1}),(0,b.yk)({type:"value_diff",selected:"single"});else{let e="selecting"===ec?em.length:el.length;await eF.confirm(e)&&(await ef.runValueDiff(),(0,b.yk)({type:"value_diff",selected:"selecting"===ec?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"selecting"===ec?(e=await ef.addLineageDiffCheck(),eL(),(0,b.yk)({type:"lineage_diff",selected:"multi"})):ea||(e=await tj(X),(0,b.yk)({type:"lineage_diff",selected:"none"})),e&&eb(e)},addSchemaDiffCheck:async()=>{let e;"selecting"===ec?em.length>0&&(e=await ef.addSchemaDiffCheck(),eL(),(0,b.yk)({type:"schema_diff",selected:"multi"})):ea?(e=await nb({node_id:ea.id}),(0,b.yk)({type:"schema_diff",selected:"single"})):(e=await nb({select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"schema_diff",selected:"none"})),e&&eb(e)},cancel:ef.cancel,actionState:ef.actionState,centerNode:ey,cll:W,showColumnLevelLineage:eS,resetColumnLevelLineage:ez};return S?(0,i.jsx)(d.s,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(J.y,{size:"xl"})}):z?(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsxs)(E.T,{children:[(0,i.jsx)(l.a,{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.a,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):C&&f!=tO?"changed_models"!==ei||C.modifiedSet.length?(0,i.jsxs)(en.Provider,{value:eM,children:[(0,i.jsxs)(ex,{sizes:ea?[70,30]:[100,0],minSize:400*!!ea,gutterSize:5*!!ea,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(E.T,{ref:a,separator:(0,i.jsx)(e3.k,{borderColor:"gray.200"}),gap:0,style:{contain:"strict"},position:"relative",children:[t&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tm,{}),"metadata only"===R.mode&&(0,i.jsx)(tL,{})]}),(0,i.jsxs)(e8.Gc,{proOptions:{hideAttribution:!0},nodeTypes:tM,edgeTypes:tP,nodes:f,edges:y,onNodesChange:v,onEdgesChange:k,onNodeClick:eD,onNodeContextMenu:eA,onClick:eq,onInit:()=>{if(et)o.fitView();else{let e=(0,e8.Jo)(f);o.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:.1,nodesDraggable:t,ref:m,children:[(0,i.jsx)(e6.V,{color:"#ccc"}),(0,i.jsx)(e7.H,{showInteractive:!1,position:"top-right",className:nI,children:(0,i.jsx)(e7.a,{title:"copy image",onClick:async()=>{await x(),(0,b.uH)({type:ei,from:"lineage_view"})},children:(0,i.jsx)(s.I,{as:nn.nxz})})}),(0,i.jsx)(p,{}),(0,i.jsx)(e8.Zk,{position:"bottom-left",children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[et&&(0,i.jsx)(tg,{}),X.column_level_lineage&&(0,i.jsx)(tS,{})]})}),(0,i.jsx)(e8.Zk,{position:"top-center",children:(0,i.jsx)(tE,{notification:N?(0,i.jsx)(tI,{}):null,type:"info"})}),(0,i.jsx)(e8.Zk,{position:"top-left",children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[(0,i.jsx)(t_,{action:B}),0==f.length&&(0,i.jsx)(c.E,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,i.jsx)(e9.o,{nodeColor:tX,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===ec&&(0,i.jsx)(e8.Zk,{position:"bottom-center",className:nI,children:(0,i.jsx)(tl,{onClose:()=>{eL()}})})]}),(0,i.jsx)(tA,{...eg.props})]}),ea?(0,i.jsx)(l.a,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(ti,{node:ea,onCloseNode:ev})}):(0,i.jsx)(l.a,{})]}),eF.AlertDialog]}):(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsxs)(E.T,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:async()=>{await eR({...X,view_mode:"all"})},children:"Show all nodes"})]})}):(0,i.jsx)(i.Fragment,{})}),tQ=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(d.s,{direction:"column",height:"100%",children:(0,i.jsx)(e8.Ln,{children:(0,i.jsx)(tK,{viewOptions:l,interactive:!1,ref:n})})})});function tW(e){let{yamlTemplate:n}=e;return(0,i.jsx)(eL.KE,{height:"300px",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}function t$(){return{markedAsApprovedToast:function(){eT.X.create({title:"Marked as approved",type:"success",duration:2e3})}}}var tB=t(6408);function tV(){let e=(0,R._)(["\n <details><summary>","</summary>\n\n ","\n\n </details>"]);return tV=function(){return e},e}let tZ=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!n.error),tH=e=>{var n,t,r,o,a,u,f,v,w,k,z,D,R;let{checkId:Q,refreshCheckList:W}=e,{featureToggles:H}=(0,ee.c)(),{setLatestSelectedCheckId:U}=(0,tB.J)(),G=(0,V.jE)(),[,J]=(0,eE.zy)(),{successToast:Y,failToast:en}=eN(),{markedAsApprovedToast:et}=t$(),[ei,er]=(0,j.useState)(),[es]=(0,j.useState)(),[eo,ea]=(0,j.useState)(!1),[ec,ed]=(0,j.useState)(""),{open:eu,onOpen:eh,onClose:ex}=(0,T.j)(),em=()=>(0,i.jsx)(N.Xi,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[ef,ej]=(0,j.useState)((0,i.jsx)(em,{})),{isLoading:eg,error:ev,data:ey}=(0,g.I)({queryKey:y.X.check(Q),queryFn:async()=>C(Q),refetchOnMount:!0}),eb=null!=ei?ei:null==ey||null==(n=ey.last_run)?void 0:n.run_id,{run:ew,error:ek}=nk(eb),eC=ei?!ew||"running"===ew.status:(null==ew?void 0:ew.status)==="running",eS=(null==ey?void 0:ey.type)?(0,e_.C)(ey.type):void 0,eD=null!=(u=null==ey?void 0:ey.is_preset)&&u,eT=(0,j.useRef)(null),{mutate:eA}=(0,Z.n)({mutationFn:e=>_(Q,e),onSuccess:async()=>{await G.invalidateQueries({queryKey:y.X.check(Q)}),await G.invalidateQueries({queryKey:y.X.checks()})}}),{mutate:eL}=(0,Z.n)({mutationFn:()=>S(Q),onSuccess:async()=>{U(""),await G.invalidateQueries({queryKey:y.X.checks()}),J("/checks")}}),eM=(0,j.useCallback)(async()=>{(null==ey?void 0:ey.type)&&(er((await (0,eY.gM)(Q,{nowait:!0})).run_id),await G.invalidateQueries({queryKey:y.X.check(Q)}),W&&W())},[ey,Q,er,G,W]),eO=(0,j.useCallback)(async()=>{if(ea(!0),eb)return await (0,eY.Su)(eb)},[eb]),eP=async()=>{if(!ey)return;let e=function(e){return(0,eR.mi)(tV(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(eq(e),"\n\n").concat((0,eR.dx)(eF(),null==(n=e.params)?void 0:n.sql_template))}return eq(e)}(e))}(ey);if(!window.isSecureContext)return void en("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));try{await navigator.clipboard.writeText(e),Y("Copied the check to the clipboard")}catch(e){en("Failed to copy the check to clipboard",e)}},eX=(0,j.useCallback)(()=>{let e=null==ey?void 0:ey.is_checked;eA({is_checked:!e}),e||et()},[null==ey?void 0:ey.is_checked,eA,et]),[eK,eQ]=(0,j.useState)("result"),{ref:eW,onCopyToClipboard:e$,onMouseEnter:eB,onMouseLeave:eV}=nT();if((0,j.useEffect)(()=>{var e,n,t;ed(function(e){let{name:n,description:t,type:i,params:l,viewOptions:r}=e,s={name:n,description:t,type:i,params:l};return r&&(s.view_options=r),nC.Ay.stringify({checks:[s]})}({name:null!=(e=null==ey?void 0:ey.name)?e:"",description:null!=(n=null==ey?void 0:ey.description)?n:"",type:null!=(t=null==ey?void 0:ey.type)?t:"",params:null==ey?void 0:ey.params,viewOptions:null==ey?void 0:ey.view_options}))},[ey]),eg)return(0,i.jsx)(I.o,{h:"100%",children:"Loading"});if(ev)return(0,i.jsxs)(I.o,{h:"100%",children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:ev.message})]});let eZ=(null==ew?void 0:ew.run_at)?(0,e5.m)(new Date(ew.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(ep,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.a,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(d.s,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)($,{name:null!=(f=null==ey?void 0:ey.name)?f:"",setName:e=>{eA({name:e})}}),eD&&(0,i.jsx)(el.m,{content:"Preset Check defined in recce config",children:(0,i.jsxs)(F.f8,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,i.jsx)(F.FV,{children:(0,i.jsx)(X.NaU,{size:"14px"})}),(0,i.jsx)(F.d1,{children:"Preset"})]})}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{mr:"10px",children:[eZ&&(0,i.jsx)(l.a,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:eZ}),(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(A.K,{rounded:"full",variant:"ghost",size:"sm",children:(0,i.jsx)(s.I,{as:B.EUt})})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsx)(q.Dr,{value:"preset-check-template",onClick:()=>{ej((0,i.jsx)(em,{})),eh()},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(K.EFr,{})," Get Preset Check Template"]})}),(0,i.jsx)(q.Dr,{value:"copy-markdown",onClick:()=>eP(),children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(nl.hX7,{})," Copy Markdown"]})}),(0,i.jsx)(q.bX,{}),(0,i.jsx)(q.Dr,{value:"delete",color:"red.solid",onClick:()=>{eL()},disabled:H.disableUpdateChecklist,children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(nl.tS8,{})," Delete"]})})]})})})]}),(0,i.jsx)(el.m,{content:tZ(null!=(v=null==ey?void 0:ey.type)?v:"",ew)?"Run the check first":(null==ey?void 0:ey.is_checked)?"Mark as Pending":"Mark as Approved",positioning:{placement:"bottom-end"},children:(0,i.jsxs)(M.$,{flex:"0 0 auto",size:"sm",colorPalette:(null==ey?void 0:ey.is_checked)?"green":"gray",variant:(null==ey?void 0:ey.is_checked)?"solid":"outline",onClick:()=>{eX()},disabled:tZ(null!=(w=null==ey?void 0:ey.type)?w:"",ew)||H.disableUpdateChecklist,children:[(null==ey?void 0:ey.is_checked)?(0,i.jsx)(nl.Ykz,{}):(0,i.jsx)(s.I,{as:B.MKj,color:"lightgray"})," ",(null==ey?void 0:ey.is_checked)?"Approved":"Mark as Approved"]})})]})]}),(0,i.jsx)(l.a,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(eI,{value:null==ey?void 0:ey.description,onChange:e=>{eA({description:e})}},null==ey?void 0:ey.check_id)})]}),(0,i.jsx)(l.a,{style:{contain:"strict"},children:(0,i.jsxs)(m.pK,{height:"100%",display:"flex",flexDirection:"column",value:eK,onValueChange:e=>{eQ(e.value)},children:[(0,i.jsxs)(m.j7,{height:"50px",children:[(0,i.jsx)(m.Xi,{value:"result",fontSize:"0.75rem",children:"Result"}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff")&&(0,i.jsx)(m.Xi,{value:"query",fontSize:"0.75rem",children:"Query"}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{mr:"10px",children:[(null==eS?void 0:eS.RunResultView)&&(0,i.jsx)(el.m,{content:"Rerun",children:(0,i.jsxs)(M.$,{variant:"outline",loading:eC,size:"sm",onClick:()=>eM(),disabled:H.disableDatabaseQuery,children:[(0,i.jsx)(nl.fZv,{})," Rerun"]})}),(0,i.jsxs)(M.$,{variant:"outline",disabled:tZ(null!=(k=null==ey?void 0:ey.type)?k:"",ew)||"result"!==eK,onMouseEnter:eB,onMouseLeave:eV,size:"sm",onClick:async()=>{var e,n;(null==ey?void 0:ey.type)==="lineage_diff"?null==(e=eT.current)||e.copyToClipboard():await e$(),(0,b.uH)({type:null!=(n=null==ey?void 0:ey.type)?n:"unknown",from:"check"})},children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]})]})]}),(0,i.jsxs)(m.T$,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(m.av,{value:"result",p:0,width:"100%",height:"100%",children:[(null==eS?void 0:eS.RunResultView)&&((null==ey?void 0:ey.last_run)||eb?(0,i.jsx)(e2,{ref:eW,isRunning:eC,isAborting:eo,run:eb?ew:null==ey?void 0:ey.last_run,error:ek,progress:es,RunResultView:eS.RunResultView,viewOptions:null==ey?void 0:ey.view_options,onViewOptionsChanged:e=>{eA({view_options:e})},onCancel:eO,onExecuteRun:eM}):(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsxs)(E.T,{gap:4,children:[(0,i.jsx)(l.a,{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)(no,{display:"metadata only"===H.mode,children:(0,i.jsx)(M.$,{onClick:eM,colorPalette:"blue",size:"sm",disabled:H.disableDatabaseQuery,children:"Run Query"})})]})})),ey&&"schema_diff"===ey.type&&(0,i.jsx)(ez,{check:ey,ref:eW}),ey&&"lineage_diff"===ey.type&&(0,i.jsx)(tQ,{check:ey,ref:eT})]}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff"||(null==ey?void 0:ey.type)==="query_base")&&(0,i.jsx)(m.av,{value:"query",p:0,height:"100%",width:"100%",children:(null==(t=ey.params)?void 0:t.base_sql_template)?(0,i.jsx)(eJ,{value:null!=(z=null==(r=ey.params)?void 0:r.sql_template)?z:"",baseValue:null!=(D=null==(o=ey.params)?void 0:o.base_sql_template)?D:"",options:{readOnly:!0}}):(0,i.jsx)(eG,{value:null!=(R=null==(a=ey.params)?void 0:a.sql_template)?R:"",options:{readOnly:!0}})})]})]})}),(0,i.jsx)(N.Dz,{open:eu,onOpenChange:ex,placement:"center",size:"xl",children:(0,i.jsxs)(L.Z,{children:[ef,(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Preset Check Template"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsxs)(h.D,{size:"sm",fontWeight:"bold",children:["Please"," ",(0,i.jsx)(c.E,{as:"span",cursor:"pointer",_hover:{textDecoration:"underline"},color:"blue.500",onClick:async()=>{await navigator.clipboard.writeText(ec),Y("Copied the template to the clipboard")},children:"copy"})," ","the following template and paste it into the"," ",(0,i.jsx)(O.f,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"recce.yml"})," ","file."]}),(0,i.jsx)("br",{}),(0,i.jsx)(tW,{yamlTemplate:ec})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var tU=t(38731);let tG=e=>{var n,t,r,o;let{check:a,selected:c,onSelect:u,onMarkAsApproved:h}=e,{featureToggles:x}=(0,ee.c)(),p=(0,V.jE)(),m=a.check_id,{mutate:f}=(0,Z.n)({mutationFn:e=>_(m,e),onSuccess:async()=>{await p.invalidateQueries({queryKey:y.X.check(m)}),await p.invalidateQueries({queryKey:y.X.checks()})}}),{run:j}=nk(null==(n=a.last_run)?void 0:n.run_id),g=null!=(r=null==(t=(0,e_.C)(a.type))?void 0:t.icon)?r:nL.XJv,v=null!=(o=a.type)?o:"",b=tZ(v,j)||x.disableUpdateChecklist,w=tZ(v,j);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:c?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:c?"orange":"transparent",onClick:()=>{u(a.check_id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:g}),(0,i.jsx)(l.a,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",className:"no-track-pii-safe",children:a.name}),(0,i.jsx)(el.m,{content:w?"Run the check first":"Click to mark as approved",positioning:{placement:"top"},showArrow:!0,children:(0,i.jsx)(d.s,{children:(0,i.jsxs)(tr.y8,{checked:a.is_checked,colorPalette:"green",variant:"solid",size:"sm",onCheckedChange:e=>{e.checked?h():f({is_checked:e.checked})},disabled:b,children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{borderColor:"border.inverted",backgroundColor:b?"bg.emphasized":void 0})]})})})]})})},tJ=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[o,a]=(0,j.useState)(!1),c=(0,V.jE)(),{mutate:u}=(0,Z.n)({mutationFn:e=>_(e,{is_checked:!0}),onSuccess:async(e,n)=>{await c.invalidateQueries({queryKey:y.X.check(n)}),await c.invalidateQueries({queryKey:y.X.checks()})}}),{open:h,onOpen:x,onClose:p}=(0,T.j)(),{markedAsApprovedToast:m}=t$(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),m()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tU.JY,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(tU.gL,{droppableId:"checklist",children:e=>(0,i.jsxs)(E.T,{...e.droppableProps,ref:e.innerRef,className:"no-track-pii-safe",w:"full",gap:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(tU.sx,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps;if(null!=e.style&&"left"in e.style){let n={x:0,y:80},t=e.style.left-n.x,i=e.style.top-n.y;e.style.left=t,e.style.top=i}}return(0,i.jsx)(d.s,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(tG,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsx)(N.Dz,{open:h,onOpenChange:p,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{width:"400px",children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Mark as Approved?"})}),(0,i.jsx)(D.w,{}),(0,i.jsxs)(l.a,{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.jsxs)(tr.y8,{checked:o,onCheckedChange:e=>{a(!!e.checked)},fontWeight:"bold",size:"sm",pt:"8px",children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{children:"Don't show this again"})]})]}),(0,i.jsx)(D.w,{}),(0,i.jsxs)(N.Es,{gap:0,children:[(0,i.jsx)(M.$,{variant:"outline",size:"xs",mr:2,onClick:p,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"iochmara",size:"xs",onClick:()=>{u(t),o&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),m(),p()},children:"Mark as approved"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var tY=t(24082);function t0(e){let{checksOnly:n=!0}=e,{featureToggles:t}=(0,ee.c)(),l=(0,V.jE)(),r=(0,j.useRef)(null),o=(0,j.useRef)(null),[a,u]=(0,j.useState)(null),{open:h,onOpen:x,onClose:p}=(0,T.j)(),[m,f]=(0,eE.zy)(),[,g]=(0,H.JL)(),v=(0,j.useCallback)(async()=>{if(a){try{let{runs:e,checks:t}=await (0,tY.N_)(a,n);g(),await l.invalidateQueries({queryKey:y.X.checks()}),await l.invalidateQueries({queryKey:y.X.runs()}),m.includes("/checks")&&f("/checks");let i=n?"".concat(t," checks imported successfully"):"".concat(e," runs and ").concat(t," checks imported successfully");eT.X.create({description:i,type:"info",duration:5e3,closable:!0})}catch(e){console.error("Import failed",e),eT.X.create({title:"Import failed",description:String(e),type:"error",duration:5e3,closable:!0})}p()}},[l,a,p,m,f,g,n]),w=n?"checks":"runs and checks",{isDemoSite:k}=(0,H.cE)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Import Checklist from State File"+(k?" (Disabled in the demo site)":""),children:(0,i.jsx)(A.K,{pt:"6px",variant:"plain","aria-label":"Import state",onClick:()=>{r.current&&r.current.click(),(0,b.vM)({name:"import"})},disabled:t.disableImportStateFile||k,children:(0,i.jsx)(s.I,{as:eK.Th})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null==(n=e.target.files)?void 0:n.length)===1&&(u(e.target.files[0]),x()),r.current&&(r.current.value="")}}),(0,i.jsx)(N.Dz,{open:h,role:"alertdialog",initialFocusEl:()=>o.current,onOpenChange:p,size:"xl",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsx)(N.L3,{children:"Import state"})}),(0,i.jsx)(N.R4,{children:(0,i.jsxs)(d.s,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(d.s,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(nl.GLE,{color:"red.600"}),(0,i.jsx)(c.E,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(d.s,{children:(0,i.jsxs)(c.E,{children:["The current ",w," will be"," ",(0,i.jsx)(c.E,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{ref:o,onClick:p,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:v,ml:"5px",children:"Import"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})}let t1=()=>{let e=(0,V.jE)(),[,n]=(0,eE.zy)(),{mutate:t,isPending:l}=(0,Z.n)({mutationFn:()=>nb({select:"state:modified"}),onSuccess:async t=>{await e.invalidateQueries({queryKey:y.X.checks()}),n("/checks/".concat(t.check_id))}});return(0,i.jsx)(I.o,{h:"100%",w:"100%",children:(0,i.jsxs)(E.T,{gap:6,textAlign:"center",maxW:"400px",children:[(0,i.jsx)(s.I,{as:nL.XJv,boxSize:16,color:"gray.400"}),(0,i.jsxs)(E.T,{gap:2,children:[(0,i.jsx)(h.D,{size:"lg",color:"gray.600",children:"No checks yet"}),(0,i.jsx)(c.E,{color:"gray.500",fontSize:"md",children:"Checks help you validate data quality and catch issues."})]}),(0,i.jsxs)(E.T,{gap:3,w:"100%",children:[(0,i.jsx)(c.E,{fontSize:"sm",color:"gray.600",fontWeight:"medium",children:"Get started with your first check:"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{t()},loading:l,size:"lg",w:"100%",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(s.I,{as:nL.r2j}),(0,i.jsx)(c.E,{children:"Create Schema Diff Check"})]})}),(0,i.jsx)(c.E,{fontSize:"xs",color:"gray.400",mt:2,children:"The schema checks compare modified models between environments to detect changes, additions, or removals."})]})]})})},t2=()=>{let[,e]=(0,eE.zy)(),[,n]=(0,eE.lq)("/checks/:checkId"),{latestSelectedCheckId:t,setLatestSelectedCheckId:r}=(0,tB.J)(),s=(0,V.jE)(),o=null==n?void 0:n.checkId;(0,j.useEffect)(()=>{o&&r(o)},[o,r]);let{isLoading:a,error:c,data:u,status:h,refetch:x}=(0,g.I)({queryKey:y.X.checks(),queryFn:k,refetchOnMount:!0}),p=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,f]=(0,j.useState)(null!=u?u:[]),{mutate:v}=(0,Z.n)({mutationFn:e=>z(e),onSuccess:async()=>{await s.invalidateQueries({queryKey:y.X.checks()})}}),b=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),v({source:e,destination:n}),f(t)},[m,f,v]);return((0,j.useEffect)(()=>{"success"===h&&(!o&&u.length>0&&(t?e("/checks/".concat(t)):e("/checks/".concat(u[0].check_id))),f(u))},[h,o,u,f,e,t]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:c.message})]}):(null==u?void 0:u.length)?(0,i.jsxs)(ex,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.a,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(E.T,{gap:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(d.s,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(t0,{checksOnly:!0})}),(0,i.jsx)(D.w,{}),(0,i.jsx)(tJ,{checks:m,selectedItem:o,onCheckSelected:p,onChecksReordered:b})]})}),(0,i.jsx)(l.a,{height:"100%",children:(0,i.jsx)(eE.dO,{children:(0,i.jsx)(eE.qh,{path:"/checks/:checkId",children:e=>(0,i.jsx)(tH,{checkId:e.checkId,refreshCheckList:x},e.checkId)})})})]}):(0,i.jsxs)(ex,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.a,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(E.T,{gap:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(d.s,{justifyContent:"flex-end",padding:"0px 10px",children:(0,i.jsx)(t0,{checksOnly:!0})}),(0,i.jsx)(D.w,{}),(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsx)(l.a,{textAlign:"center",color:"gray.500",children:"No checks"})})]})}),(0,i.jsx)(l.a,{children:(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsx)(t1,{})})})]})};var t5=t(91843);function t4(){return(0,i.jsx)("div",{className:"flex flex-1 h-full min-h-0 m-2 p-4 bg-blue-50 rounded-lg shadow-md justify-center",children:(0,i.jsxs)("div",{className:"w-4/5 flex flex-col overflow-y-auto gap-6 px-8 pb-8",children:[(0,i.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,i.jsx)("div",{className:"p-2 bg-white rounded-full flex items-center justify-center shadow-md",children:(0,i.jsx)(s.I,{as:nt.JVA,boxSize:7,color:"blue.500"})}),(0,i.jsx)(h.D,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,i.jsxs)(c.E,{fontSize:"md",textAlign:"center",children:["Query functions disabled without a"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"data warehouse connection"})]})]}),(0,i.jsx)("div",{className:"w-1/2 flex flex-col mt-6 mx-auto",children:(0,i.jsx)(M.$,{colorPalette:"blue",size:"lg",onClick:()=>{window.open(nr.Q,"_blank")},children:"Connect to Data Warehouse"})})]})})}let t3=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=(0,nv.vr)();return(0,i.jsxs)(l.a,{children:[(0,i.jsxs)(d.s,{fontSize:"0.75rem",gap:1,alignItems:"center",children:["Custom Queries"," ",(0,i.jsx)(el.m,{content:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(nl.H2l,{color:"gray.600",fontSize:"1rem"})})]}),(0,i.jsxs)(t5.lq,{size:"sm",colorPalette:"iochmara",checked:e,onCheckedChange:()=>{!e&&r&&r(t),n(!e)},children:[(0,i.jsx)(t5.tD,{}),(0,i.jsx)(t5.oO,{}),(0,i.jsx)(t5.$X,{})]})]})},t8=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:o,isCustomQueries:a}=(0,nv.vr)(),{lineageGraph:c,envInfo:u}=(0,H.cE)(),{featureToggles:h,singleEnv:x}=(0,ee.c)(),m=e;(null==u?void 0:u.adapterType)==="sqlmesh"&&e===nv.I&&(m="select * from db.mymodel"),"read only"===h.mode&&(m="--- Would like to do query here? Book a demo with us at ".concat(nr.Q,"\n").concat(m));let{showRunId:f}=(0,G.tr)(),g=async e=>{let t="query_base"===e?null!=n?n:"":m,i=function(e){switch(e){case"query":return nZ;case"query_base":return nH;case"query_diff":return nU;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,a&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return f(r),await (0,eY.Zc)(r)},{mutate:v,isPending:y}=(0,Z.n)({mutationFn:g}),b=(0,j.useMemo)(()=>{let e={};for(let t in null==c?void 0:c.nodes){var n;let i=null==(n=c.nodes[t].data.current)?void 0:n.schema;i&&(e[i]=(e[i]||0)+1)}return Object.keys(e).reduce((n,t)=>e[t]>(e[n]||0)?t:n,"N/A")},[null==c?void 0:c.nodes]);return x||"metadata only"===h.mode?(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",children:[(0,i.jsx)(to,{}),(0,i.jsx)(p.h,{}),x?(0,i.jsx)(el.m,{content:"Please configure the base environment before running the diff",positioning:{placement:"left"},children:(0,i.jsx)(M.$,{colorPalette:"iochmara",disabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})}):(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(M.$,{colorPalette:"iochmara",disabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})})]}),(0,i.jsx)(eJ,{value:m,onChange:t,onRun:()=>{v("query")},labels:["base (production)","current (".concat(b,")")],SetupGuide:"metadata only"===h.mode?(0,i.jsx)(t4,{}):(0,i.jsx)(tD,{})})]}):(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"flex-end",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(to,{}),(0,i.jsx)(t3,{}),(0,i.jsx)(p.h,{}),(0,i.jsx)(n1,{defaultPrimaryKeys:s,onPrimaryKeysChange:o}),(0,i.jsx)(M.$,{colorPalette:"iochmara",onClick:()=>{v("query_diff")},disabled:y||h.disableDatabaseQuery,size:"2xs",children:"Run Diff"})]}),(0,i.jsx)(l.a,{width:"100%",flex:"1",children:a?(0,i.jsx)(eJ,{value:m,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>{v("query")},onRunBase:()=>{v("query_base")},onRunDiff:()=>{v("query_diff")}}):(0,i.jsx)(eG,{value:m,onChange:t,onRun:()=>{v("query")},onRunDiff:()=>{v("query_diff")}})})]})},t6=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,g.I)({queryKey:y.X.run(t),queryFn:async()=>(0,eY.Zc)(t)}),o=(null==s?void 0:s.type)?null==(n=(0,e_.C)(s.type))?void 0:n.RunResultView:void 0;return(0,i.jsx)(e2,{error:r,run:s,RunResultView:o})},t7=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(I.o,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(d.s,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(h.D,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.a,{flex:"1",fontSize:"10pt",children:String(n)}),(0,i.jsx)(M.$,{justifySelf:"center",alignSelf:"center",mt:"20px",colorPalette:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},t9=e=>{let{children:n}=e;return(0,i.jsx)(e1.tH,{fallback:t7,children:n})};function ie(){let{featureToggles:e}=(0,ee.c)(),n=async()=>{try{let e=await (0,tY.sp)(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,eP.GP)(i,"yyyy-MM-dd-HH-mm-ss"),".json");nD()(t,l)}catch(e){console.error("Export failed",e),eT.X.create({title:"Export failed",description:String(e),type:"error",duration:5e3,closable:!0})}};return(0,i.jsx)(el.m,{content:"Export",children:(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Export state",onClick:async()=>{await n(),(0,b.vM)({name:"export"})},disabled:e.disableExportStateFile,children:(0,i.jsx)(s.I,{as:eK.gY,verticalAlign:"middle",boxSize:"16px"})})})}function it(){return(0,i.jsx)(e8.Ln,{children:(0,i.jsx)(tK,{interactive:!0})})}t(17461);let ii=()=>{var e,n;let t,{featureToggles:r}=(0,ee.c)(),{fileName:o,cloudMode:a,isDemoSite:c,envInfo:u}=(0,H.cE)(),h=(0,T.j)(),x=(0,T.j)(),p=!o&&!a&&!c,{data:m}=(0,g.I)({queryKey:y.X.checks(),queryFn:k,enabled:p}),f=void 0!=m&&m.filter(e=>!e.is_preset).length>0;(e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])})(p&&f);let[{newFileName:v,errorMessage:b,modified:w,overwriteWithMethod:C,bypass:_},S]=(0,j.useState)({newFileName:null!=o?o:"recce_state.json"}),z=(0,j.useRef)(null),{toastSuccess:E,toastError:D}={toastSuccess:e=>{eT.X.create({description:e,type:"success",duration:5e3,closable:!0})},toastError:(e,n)=>{let t=e;if(null!=n)if(n instanceof tv.pe){var i,l;t="".concat(e,". ").concat(String(null==(l=n.response)||null==(i=l.data)?void 0:i.detail))}else t="".concat(e,". ").concat(n);eT.X.create({description:t,type:"error",duration:5e3,closable:!0})}},I=(0,V.jE)(),R=async(e,n)=>{if(!v)return;let t="true"===localStorage.getItem(n3.bypassSaveOverwrite);try{"save"===e?await (0,tY.Uh)({filename:v,overwrite:null!=n?n:t}):await (0,tY.$w)({filename:v,overwrite:null!=n?n:t}),E("save"===e?"Save file successfully":"Rename file successfully"),await I.invalidateQueries({queryKey:y.X.lineage()}),_&&localStorage.setItem(n3.bypassSaveOverwrite,"true")}catch(n){if(n instanceof tv.pe){var i;if((null==(i=n.response)?void 0:i.status)===409){S(n=>({...n,overwriteWithMethod:e})),x.onOpen();return}}D("save"===e?"Save file failed":"Rename file failed",n)}finally{h.onClose()}};if(a||c)return(0,i.jsx)(i.Fragment,{});if(r.disableSaveToFile&&o){let n=null==u||null==(e=u.stateMetadata)?void 0:e.generated_at,i=n?nN(new Date(n)):null;t=i?"".concat(o," (").concat(i,")"):null}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.s,{justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.a,{fontWeight:"600",children:null!=(n=null!=t?t:o)?n:"New Instance"+(f?" (unsaved)":"")}),!r.disableSaveToFile&&(0,i.jsx)(el.m,{content:o?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(A.K,{onClick:()=>{S({newFileName:null!=o?o:"recce_state.json",modified:!o}),h.onOpen()},"aria-label":o?"Change Filename":"Save",variant:"ghost",size:"sm",colorPalette:"gray",children:(0,i.jsx)(s.I,{as:o?eK.GI:eK.FS,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsx)(N.Dz,{open:h.open,onOpenChange:h.onClose,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:o?"Change Filename":"Save File"})}),(0,i.jsx)(N.R4,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(n0.XO,{invalid:!!b,children:[(0,i.jsx)(n0.dh,{children:"File name:"}),(0,i.jsx)(W.p,{ref:z,value:v,placeholder:"Enter filename",onChange:e=>{let n,t=e.target.value;t?t.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(t)?o&&t===o&&(n="Filename is the same as the current one."):n="Invalid filename. Only alphanumeric, space, _ and - are allowed.":n="Filename must end with .json.":n="Filename cannot be empty.",S(e=>({...e,modified:!0,newFileName:t,errorMessage:n}))},onKeyDown:e=>{"Enter"===e.key?b||(o?R("rename"):R("save")):"Escape"===e.key&&h.onClose()}}),(0,i.jsx)(n0.wp,{children:b})]})}),(0,i.jsxs)(N.Es,{gap:"5px",children:[(0,i.jsx)(M.$,{size:"sm",colorPalette:o?void 0:"blue",onClick:async()=>{await R("save")},disabled:!v||!!b||!w,children:o?"Save as New File":"Confirm"}),o&&(0,i.jsx)(M.$,{size:"sm",colorPalette:"blue",onClick:async()=>{await R("rename")},disabled:!v||!!b||!w,children:"Rename"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})}),(0,i.jsx)(N.Dz,{open:x.open,onOpenChange:x.onClose,initialFocusEl:()=>z.current,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Overwrite File?"})}),(0,i.jsxs)(N.R4,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.a,{fontSize:"12pt",children:"save"===C?"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.jsxs)(tr.y8,{size:"xs",checked:_,onCheckedChange:e=>{S(n=>({...n,bypass:!!e.checked}))},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{fontWeight:"bold",pt:"8px",children:"Don't show this again"})]})]}),(0,i.jsxs)(N.Es,{gap:"5px",children:[(0,i.jsx)(M.$,{variant:"outline",onClick:()=>{x.onClose(),h.onOpen(),S(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(M.$,{size:"sm",colorPalette:"blue",onClick:()=>{C&&(R(C,!0),x.onClose())},children:"Overwrite"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var il=t(21865),ir=t(58128);function is(){return(0,i.jsx)(el.m,{content:"Syncing",children:(0,i.jsx)(l.a,{mx:"10px",children:(0,i.jsx)(J.y,{size:"sm"})})})}function io(){let[e,n]=(0,j.useState)(!1),t=(0,V.jE)(),[r,o]=(0,eE.zy)(),{open:a,onOpen:c,onClose:d}=(0,T.j)(),[u,h]=(0,j.useState)(""),{data:x}=(0,ir.h)(),p=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await (0,tY.Z3)(e)).status){c(),n(!1);return}for(;await (0,tY.$k)();)await new Promise(e=>setTimeout(e,1e3));eT.X.create({description:"Sync Completed",type:"success",duration:5e3,closable:!0}),n(!1),h(""),await t.invalidateQueries({queryKey:y.X.lineage()}),await t.invalidateQueries({queryKey:y.X.checks()}),await t.invalidateQueries({queryKey:y.X.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,c,d]);return e?(0,i.jsx)(is,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Sync with Cloud",children:(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Sync state",onClick:()=>p((null==x?void 0:x.session_id)?{method:"merge"}:{}),children:(0,i.jsx)(s.I,{as:eK.nU,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsx)(N.Dz,{open:a,onOpenChange:d,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsxs)(N.f5,{children:[(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsx)(N.L3,{children:"Sync with Cloud"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsx)(l.a,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.a,{mt:"5px",children:(0,i.jsx)(il.Bz,{onValueChange:e=>{h(String(e.value))},value:u,children:(0,i.jsxs)(eA.B,{direction:"column",children:[(0,i.jsxs)(il.CU,{value:"merge",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Merge",(0,i.jsx)(el.m,{content:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]}),(0,i.jsxs)(il.CU,{value:"overwrite",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Overwrite",(0,i.jsx)(el.m,{content:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]}),(0,i.jsxs)(il.CU,{value:"revert",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Revert",(0,i.jsx)(el.m,{content:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]})]})})})]}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>p({method:u}),disabled:!u,children:"Sync"})]})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})]})})]})}var ia=t(34643);let ic=["Processing...","Still processing, please wait...","Almost there, thanks for your patience..."];function id(){let{successToast:e,failToast:n}=eN(),[,t]=(0,ia.Cj)(),{authed:l}=(0,ee.c)(),{shareUrl:r,isLoading:s,error:o,handleShareClick:a}=(0,nM.l)(),[u,h]=(0,j.useState)(!1),[x,p]=(0,j.useState)(0);(0,ia.$$)(()=>{p(e=>Math.min(e+1,ic.length-1))},s?3e4:null),(0,j.useEffect)(()=>{s||p(0)},[s]);let m=async()=>{try{await t(String(r)),e("Copied the link to clipboard")}catch(e){n("Failed to copy the link",e)}};return l?(0,i.jsxs)(d.s,{flex:"1",alignItems:"center",gap:"5px",children:[(0,i.jsxs)(M.$,{size:"xs",variant:"outline",colorPalette:"gray",onClick:async()=>{await a(),(0,b.o$)({name:"create"})},loading:s,children:[(0,i.jsx)(nL.Fsk,{})," Share ",r?(0,i.jsx)(nl.Ykz,{color:"green"}):void 0]}),s&&(0,i.jsx)(c.E,{fontSize:"14",color:"gray.500",children:ic[x]}),(0,i.jsxs)(d.s,{gap:"5px",alignItems:"center",children:[r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.s,{overflowX:"auto",whiteSpace:"nowrap",maxWidth:"350px",children:(0,i.jsx)(c.E,{fontSize:"14",children:r})}),(0,i.jsx)(A.K,{size:"2xs","aria-label":"Copy the share URL",onClick:async()=>{await m(),(0,b.o$)({name:"copy"})},children:(0,i.jsx)(nl.hX7,{})})]}),o&&(0,i.jsx)(c.E,{fontSize:"14",color:"red.500",children:o})]})]}):(0,i.jsxs)(d.s,{flex:"1",alignItems:"center",children:[(0,i.jsxs)(M.$,{size:"xs",colorPalette:"gray",variant:"outline",onClick:()=>{h(!0)},children:[(0,i.jsx)(nL.Fsk,{})," Share"]}),u&&(0,i.jsx)(nK,{parentOpen:u,handleParentClose:h,ignoreCookie:!0,variant:"enable-share"})]})}let iu={TOAST_ID:"lifetime-countdown",WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>"The server will be closed in ".concat(e," seconds.")};var ih=t(62254);t(77081);let ix=e=>{var n,t;let{run:r,isSelected:o,onSelectRun:a,onAddToChecklist:u,onGoToCheck:h}=e,{featureToggles:x}=(0,ee.c)(),{data:p}=(0,g.I)({queryKey:y.X.run(r.run_id),queryFn:async()=>await (0,eY.Zc)(r.run_id),enabled:"running"===r.status,retry:!1}),m=null!=(t=null==(n=(0,e_.C)(r.type))?void 0:n.icon)?t:nL.XJv,f=r.check_id,j=x.disableUpdateChecklist;return(0,i.jsxs)(d.s,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:o?"orange.400":"transparent",backgroundColor:o?"orange.50":"transparent",onClick:()=>{a(r.run_id)},_hover:{bg:o?"orange.50":"gray.200"},children:[(0,i.jsxs)(d.s,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.I,{as:m}),(0,i.jsx)(l.a,{className:"no-track-pii-safe",flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:r.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:r.name||"<no name>"}),f?(0,i.jsx)(el.m,{content:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(c.E,{onClick:e=>{e.preventDefault(),e.stopPropagation(),h(f)},children:(0,i.jsx)(s.I,{color:"green",as:ef.A7C})})}):j?null:(0,i.jsx)(el.m,{content:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(c.E,{onClick:e=>{e.preventDefault(),e.stopPropagation(),(0,b.iZ)({name:"add_to_checklist"}),u(r.run_id)},children:(0,i.jsx)(s.I,{as:ef.yjt})})})]}),(0,i.jsx)(d.s,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(nF,{run:null!=p?p:r})})]})},ip=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,eP.GP)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(d.s,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},im=()=>{let{closeHistory:e}=(0,G.tr)(),{data:n,isLoading:t,isFetching:r,error:s,refetch:o}=(0,g.I)({queryKey:y.X.runs(),queryFn:async()=>await (0,eY.v)(),retry:!1}),{showRunId:a,runId:c}=(0,G.tr)(),u=e=>{(0,b.iZ)({name:"click_run"}),a(e,!1)},[,m]=(0,eE.zy)(),f=(0,V.jE)(),v=(0,j.useCallback)(async()=>{if(!c)return;let e=await w(c);await f.invalidateQueries({queryKey:y.X.checks()}),m("/checks/".concat(e.check_id))},[c,m,f]),k=(0,j.useCallback)(e=>{(0,b.iZ)({name:"go_to_check"}),m("/checks/".concat(e))},[m]),C=null;return(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(x.z,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(h.D,{size:"md",children:"History"}),(0,i.jsx)(p.h,{}),(0,i.jsx)(A.K,{variant:"ghost","aria-label":"Close History",onClick:()=>{(0,b.iZ)({name:"hide"}),e()},children:(0,i.jsx)(nl.yBK,{})})]}),(0,i.jsx)(l.a,{flex:"1 1 auto",children:t?"Loading...":(null==n?void 0:n.length)===0?(0,i.jsx)(I.o,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(ih.A,{style:{minHeight:"100%",height:0},children:(null!=n?n:[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=C&&C!==t;return C=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(ip,{runAt:e.run_at},t),(0,i.jsx)(ix,{run:e,isSelected:e.run_id===c,onSelectRun:u,onGoToCheck:k,onAddToChecklist:v},e.run_id)]})})})})]})};var ij=t(27919);async function ig(){try{return(await v.g.get("/api/users")).data}catch(e){throw console.error("Error fetching user data:",e),e}}async function iv(e){try{return(await ij.A.get("https://api.github.com/user/".concat(e))).data.avatar_url}catch(e){return console.warn("Failed to fetch GitHub avatar:",e),null}}var iy=t(74822);function ib(){var e;let{data:n,isLoading:t,error:r}=(0,g.I)({queryKey:y.X.user(),queryFn:ig,retry:!1}),{data:o}=(0,g.I)({queryKey:["github-avatar",null==n?void 0:n.id],queryFn:()=>n?iv(n.id):Promise.resolve(null),enabled:!!(null==n?void 0:n.id)&&"github"===n.login_type,retry:!1,staleTime:3e5}),a=(0,j.useRef)(null),d=!t&&!r&&n;return(0,i.jsxs)(q.il,{positioning:{getAnchorRect:()=>{var e,n;return null!=(n=null==(e=a.current)?void 0:e.getBoundingClientRect())?n:null}},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:t?(0,i.jsx)(l.a,{width:"32px",height:"32px",borderRadius:"full",bg:"white",color:"brand.500",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",children:(0,i.jsx)(J.y,{size:"sm"})}):(0,i.jsxs)(iy.Cy,{outlineStyle:"solid",outlineWidth:"1px",outlineColor:"white",ref:a,size:"xs",cursor:"pointer",children:[(0,i.jsx)(iy.q5,{name:null!=(e=null==n?void 0:n.login)?e:"U"}),o&&(0,i.jsx)(iy.BK,{src:o})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{bg:"white",borderColor:"gray.200",boxShadow:"lg",minW:"180px",children:[(0,i.jsxs)(l.a,{px:3,py:2,children:[t&&(0,i.jsxs)(l.a,{display:"flex",alignItems:"center",gap:2,children:[(0,i.jsx)(c.E,{fontSize:"sm",color:"gray.800",children:"Loading..."}),(0,i.jsx)(J.y,{size:"sm"})]}),r&&(0,i.jsx)(c.E,{fontSize:"xs",color:"red.500",children:"Failed to load user information"}),d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.E,{fontWeight:"semibold",fontSize:"sm",color:"gray.800",children:n.login}),n.email&&(0,i.jsx)(c.E,{fontSize:"xs",color:"gray.400",children:n.email})]})]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Dr,{value:"recce cloud",onClick:()=>window.open("https://cloud.datarecce.io/","_blank"),children:[(0,i.jsx)(s.I,{as:ef.tmj,mr:2}),"Recce Cloud"]}),(0,i.jsxs)(q.Dr,{value:"get live support",onClick:()=>window.open(nr.Q,"_blank"),children:[(0,i.jsx)(s.I,{as:ef.x$1,mr:2}),"Get live support"]})]})})})]})}let iw=e=>{let{children:n,path:t}=e,[r]=(0,eE.lq)(t);return(0,i.jsx)(l.a,{display:r?"block":"none",height:"100%",children:n})};function ik(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.N,{height:"20px",color:"white",href:t,target:"_blank",...l,children:(0,i.jsx)(s.I,{color:"white",boxSize:"20px",as:n})})}function iC(){let{version:e,latestVersion:n}=function(){let[e,n]=(0,j.useState)(""),[t,i]=(0,j.useState)("");return(0,j.useEffect)(()=>{!async function(){try{let{version:e,latestVersion:t}=(await v.g.get("/api/version")).data;n(e),i(t)}catch(e){console.error("Error fetching version number:",e)}}()},[]),{version:e,latestVersion:t}}(),t=(0,j.useMemo)(()=>RegExp("^\\d+\\.\\d+\\.\\d+$"),[]);return((0,j.useEffect)(()=>{if(t.test(e)&&e!==n){let e="recce-update-toast-shown";sessionStorage.getItem(e)||setTimeout(()=>{eT.X.create({id:"recce-update-available",title:"Update available",description:(0,i.jsxs)("span",{children:["A new version of Recce (v",n,") is available.",(0,i.jsx)("br",{}),"Please run ",(0,i.jsx)(o.C,{children:"pip install --upgrade recce"})," to update Recce.",(0,i.jsx)("br",{}),(0,i.jsx)(r.N,{color:"brand.700",fontWeight:"bold",href:"https://github.com/DataRecce/recce/releases/tag/v".concat(n),_hover:{textDecoration:"underline"},target:"_blank",children:"Click here to view the detail of latest release"})]}),duration:6e4,closable:!0}),sessionStorage.setItem(e,"true")},0)}},[e,n,t]),t.test(e))?(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsx)(r.N,{href:"https://github.com/DataRecce/recce/releases/tag/v".concat(e),_hover:{textDecoration:"none"},children:(0,i.jsx)(c.E,{color:"white/80",children:e})})}):(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:e})}function i_(){var e,n,t;let{reviewMode:o,isDemoSite:m,envInfo:f,cloudMode:g}=(0,H.cE)(),{featureToggles:v,lifetimeExpiredAt:y,authed:b}=(0,ee.c)(),{url:w,id:k}=null!=(e=null==f?void 0:f.pullRequest)?e:{},C=w?w.split("/").pop():null,_=g||b?"https://cloud.datarecce.io/":"https://reccehq.com/",[S,z]=(0,j.useState)(!1);return!function(e){let n=eT.X,[t,i]=(0,j.useState)(null),l=(0,j.useRef)(void 0),r=(0,j.useCallback)(()=>{if(!e)return 0;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},[e]),s=(0,j.useCallback)(()=>{null!=t&&(n.remove(t),i(null))},[n,t]),o=(0,j.useCallback)(()=>{if(null==t)return;let e=r();if(e<=0)return void s();n.update(t,{description:iu.MESSAGE(e)})},[t,r,n,s]),a=(0,j.useCallback)(()=>{if(!e)return;s();let t=r();t<=0||(i(n.create({id:iu.TOAST_ID,description:iu.MESSAGE(t)})),l.current=setInterval(o,iu.UPDATE_INTERVAL))},[e,n,r,o,s]);(0,j.useEffect)(()=>{if(!e)return;let n=r();if(n-iu.WARNING_THRESHOLD<0)a();else{let e=setTimeout(a,(n-iu.WARNING_THRESHOLD)*1e3);return()=>{clearTimeout(e),s()}}return s},[e,r,a,s])}(y),(0,i.jsxs)(d.s,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(r.N,{href:_,target:"_blank",_hover:{textDecoration:"none"},children:(0,i.jsxs)(d.s,{gap:"10px",alignItems:"center",children:[(0,i.jsx)(u._,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(h.D,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"})]})}),(0,i.jsx)(iC,{}),(null!=(n=v.mode)?n:o)&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:null!=(t=v.mode)?t:"review mode"}),g&&k&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{children:"cloud mode"}),(0,i.jsx)(l.a,{borderLeftWidth:"1px",borderLeftColor:"white/80",paddingLeft:"8px",children:(0,i.jsxs)(r.N,{href:w,_hover:{textDecoration:"none"},target:"_blank",children:[(0,i.jsx)(s.I,{color:"white/80",as:B.XaX,boxSize:"3",marginRight:.5,fontWeight:"extrabold",strokeWidth:"1"}),(0,i.jsx)(c.E,{color:"white/80",children:"#".concat(String(k))})]})})]})}),m&&w&&C&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{children:"demo mode"}),(0,i.jsx)(l.a,{borderLeftWidth:"1px",borderLeftColor:"white/80",paddingLeft:"8px",children:(0,i.jsxs)(r.N,{href:w,_hover:{textDecoration:"none"},target:"_blank",children:[(0,i.jsx)(s.I,{color:"white/80",as:B.XaX,boxSize:"3",marginRight:.5,fontWeight:"extrabold",strokeWidth:"1"}),(0,i.jsx)(c.E,{color:"white/80",children:"#".concat(C)})]})})]})}),(0,i.jsx)(p.h,{}),(m||"read only"===v.mode)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ik,{icon:ef.hL4,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(ik,{icon:ef.iWS,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(ik,{mr:2,icon:ef.gZZ,href:"https://docs.datarecce.io"})]}),!m&&"read only"!==v.mode&&(0,i.jsx)(i.Fragment,{children:b||g?(0,i.jsx)(l.a,{mr:2,children:(0,i.jsx)(ib,{})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.a,{as:"button",color:"white",fontSize:"sm",fontWeight:"semibold",bg:"brand.700",borderRadius:"md",px:3,py:1,mr:2,cursor:"pointer",onClick:()=>{z(!0)},children:"Connect to Cloud"}),S&&(0,i.jsx)(nK,{parentOpen:S,handleParentClose:z,ignoreCookie:!0,variant:"user-profile"})]})})]})}function iS(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,g.I)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.a,{ml:"2px",maxH:"20px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function iz(){let{isDemoSite:e,cloudMode:n,isLoading:t}=(0,H.cE)(),{featureToggles:r}=(0,ee.c)(),[s,o]=(0,eE.zy)(),[a,c]=(0,j.useState)("/lineage"),{data:u,isLoading:h}=(0,n8.T)(),x=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(iS,{queryKey:y.X.checks(),fetchCallback:k,selectCallback:e=>e.filter(e=>!e.is_checked).length}),disable:(null==u?void 0:u.single_env_onboarding)===!0}];return(0,j.useEffect)(()=>{c("/".concat(s.split("/")[1]))},[s]),(0,i.jsx)(m.pK,{colorPalette:"iochmara",defaultValue:"/lineage",value:a,onValueChange:e=>{c(e.value)},children:(0,i.jsxs)(m.j7,{children:[(0,i.jsx)(l.a,{flex:"1",display:"flex",children:x.map(e=>{let{name:n,href:l,badge:r,disable:s}=e;return(0,i.jsxs)(m.Xi,{value:l,onClick:()=>{o(l)},disabled:!!t||h||s,hidden:s,children:[n,r]},l)})}),(0,i.jsx)(d.s,{flex:"3",justifyContent:"right",alignItems:"center",children:!t&&!e&&(0,i.jsx)(ii,{})}),(0,i.jsx)(d.s,{flex:"3",justifyContent:"left",alignItems:"center",children:!t&&!e&&!(null==u?void 0:u.single_env_onboarding)&&!r.disableShare&&(0,i.jsx)(id,{})}),!t&&(0,i.jsxs)(d.s,{flex:"3",justifyContent:"right",alignItems:"center",mr:"8px",children:[(0,i.jsx)(eU,{}),n&&(0,i.jsx)(io,{}),(0,i.jsx)(ie,{})]})]})})}function iE(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=(0,G.tr)(),{data:r}=(0,n8.T)(),[s]=(0,eE.zy)(),o=e&&!s.startsWith("/checks"),a=n&&!s.startsWith("/checks");return(0,i.jsxs)(ex,{sizes:[0,100],minSize:300*!!a,gutterSize:5*!!a,style:{height:"100%"},children:[(0,i.jsx)(l.a,{style:{contain:"size"},children:a&&(0,i.jsx)(im,{})}),(0,i.jsxs)(ep,{sizes:o?[50,50]:[100,0],minSize:100*!!o,gutterSize:5*!!o,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.a,{p:0,style:{contain:"content"},children:(0,i.jsxs)(t9,{children:[(0,i.jsx)(iw,{path:"/lineage",children:(0,i.jsx)(it,{})}),(0,i.jsxs)(eE.dO,{children:[(0,i.jsx)(eE.qh,{path:"/query",children:(0,i.jsx)(t8,{})}),(0,i.jsx)(eE.qh,{path:"/checks/:slug?",children:(0,i.jsx)(t2,{})}),(0,i.jsx)(eE.qh,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(t6,{runId:n})}}),(0,i.jsx)(eE.qh,{path:"/ssr",children:(0,i.jsx)(f.wi,{size:"xs",value:null,colorPalette:"iochmara",children:(0,i.jsx)(f.XL,{children:(0,i.jsx)(f.Fx,{})})})}),(0,i.jsx)(eE.qh,{children:(0,i.jsx)(eE.rd,{to:"/lineage"})})]})]})}),o?(0,i.jsx)(nV,{onClose:t,isSingleEnvironment:!!(null==r?void 0:r.single_env_onboarding)}):(0,i.jsx)(l.a,{})]})]})}function iD(e){let{children:n}=e;return(0,i.jsx)(d.s,{direction:"column",height:"100vh",overflow:"hidden",children:n})}function iI(){let{isDemoSite:e,isLoading:n,isCodespace:t}=(0,H.cE)(),{featureToggles:l}=(0,ee.c)();return(0,j.useEffect)(()=>{(0,b.uz)()},[]),(0,i.jsxs)(iD,{children:[(0,i.jsx)(i_,{}),(0,i.jsx)(iz,{}),(0,i.jsx)(iE,{}),!n&&!e&&!t&&null===l.mode&&(0,i.jsx)(nK,{})]})}},97942:(e,n,t)=>{Promise.resolve().then(t.bind(t,84944))}},e=>{e.O(0,[778,890,540,863,99,969,11,265,138,459,598,916,991,149,699,478,432,103,504,67,90,452,970,547,677,704,619,358],()=>e(e.s=97942)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{3870:()=>{},50543:()=>{},50837:()=>{},84944:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>iI});var i=t(87259),l=t(20029),r=t(16766),s=t(13544),o=t(76976),a=t(85560),c=t(59773),d=t(77480),u=t(58676),h=t(68018),x=t(11469),p=t(50274),m=t(23866),f=t(2667),j=t(80715),g=t(73295),v=t(82206);t(42104);var y=t(16873),b=t(69504);async function w(e,n){let t=(0,b.XJ)()?{breaking_change_analysis:!0}:{};return(await v.g.post("/api/checks",{run_id:e,view_options:n,track_props:t})).data}async function k(){return(await v.g.get("/api/checks")).data}async function C(e){return(await v.g.get("/api/checks/".concat(e))).data}async function _(e,n){return(await v.g.patch("/api/checks/".concat(e),n)).data}async function S(e){return(await v.g.delete("/api/checks/".concat(e))).data}async function z(e){return await v.g.post("/api/checks/reorder",e)}var E=t(16131),D=t(21104),I=t(44336),R=t(29868),T=t(17618),N=t(94741),F=t(79100),q=t(38201),A=t(87442),L=t(45633),M=t(83683),O=t(95076),P=t(29677),X=t(27353),K=t(62217),Q=t(43888),W=t(33798);function $(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,c,d]),(0,i.jsx)(Q.Yl,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",className:"no-track-pii-safe",overflow:"hidden",children:(0,i.jsx)(Q.J5,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(W.p,{ref:c,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"100%"}):(0,i.jsx)(l.a,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var B=t(96719),V=t(86942),Z=t(72179),H=t(55155),U=t(5748);t(50837);var G=t(54064),J=t(48496),Y=t(36501),ee=t(12865);let en=(0,j.createContext)(void 0),et=()=>{let e=(0,j.useContext)(en);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},ei=()=>(0,j.useContext)(en);var el=t(21851);function er(e){let{model:n,row:t,singleEnv:r,cllRunning:o}=e,a=ei(),{runAction:c}=(0,G.tr)(),{featureToggles:u}=(0,ee.c)(),{name:h,baseType:x,currentType:m,baseIndex:f,currentIndex:j}=t,g=null!=m?m:x,v=!x||!m;return(0,i.jsx)(el.m,{content:"View column lineage",positioning:{placement:"top"},showArrow:!0,disabled:void 0===a||void 0!==f&&void 0===j,children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.a,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:h}),(0,i.jsx)(p.h,{}),o&&(0,i.jsx)(J.y,{size:"xs",color:"gray.400"}),!r&&"source"!==n.resource_type&&(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(A.K,{display:"flex",className:"row-context-menu",variant:"plain",size:"sm",color:"gray",_hover:{color:"black"},disabled:u.disableDatabaseQuery,onClick:e=>{e.stopPropagation()},children:(0,i.jsx)(s.I,{as:B.EUt})})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{lineHeight:"20px",children:(0,i.jsxs)(q.Uh,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(q.Dr,{value:"profile-diff",fontSize:"10pt",onClick:()=>{c("profile_diff",{model:n.name,columns:[h]},{showForm:!1})},disabled:v,children:"Profile Diff"}),(0,i.jsx)(q.Dr,{value:"histogram-diff",fontSize:"10pt",onClick:()=>{c("histogram_diff",{model:n.name,column_name:h,column_type:g},{showForm:!1})},disabled:v||!g||!(0,Y.c)(g),children:"Histogram Diff"}),(0,i.jsx)(q.Dr,{value:"top-k-diff",fontSize:"10pt",onClick:()=>{c("top_k_diff",{model:n.name,column_name:h,k:50},{showForm:!1})},disabled:v,children:"Top-k Diff"})]})})})})]})]})})}function es(e,n,t){function l(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&!0===e.reordered?"column-index-reordered schema-column schema-column-index":"schema-column schema-column-index"}function r(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&e.baseType!==e.currentType?"column-body-type-changed schema-column":"schema-column"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:s}=e;return n?(0,i.jsx)(er,{model:n,row:r,cllRunning:null!=(l=null==t?void 0:t.get(r.name))&&l}):r.name},cellClass:function(){return"schema-column"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:r},{key:"currentType",name:"Current Type",resizable:!0,cellClass:r}],rows:Object.values(e)}}var eo=t(68168),ea=t(20989);let ec=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:o=!1}=e,a=ei(),[c,u]=(0,j.useState)(new Map),{columns:h,rows:x}=(0,j.useMemo)(()=>{var e;let n=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((0,U.l)(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),t=null!=(e=null==s?void 0:s.resource_type)?e:null==r?void 0:r.resource_type;return t&&["model","seed","snapshot","source"].includes(t)?es(n,null!=s?s:r,c):es(n)},[r,s,c]),{lineageGraph:p}=(0,H.cE)(),m=!(null==p?void 0:p.catalogMetadata.base),f=!(null==p?void 0:p.catalogMetadata.current);m&&f?t="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":m?t="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":f&&(t="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let g=r&&void 0===r.columns,v=s&&void 0===s.columns;g&&v?l="catalog.json is outdated on both environments. Update catalog.json to get schema information.":g?l="catalog.json is outdated on base environment. Update catalog.json to get schema information.":v&&(l="catalog.json is outdated on current environment. Update catalog.json to get schema information.");let y=async e=>{var n;(0,b.vD)({action:"view",source:"schema_column"}),u(n=>new Map(n).set(e,!0));let t=null!=(n=null==s?void 0:s.id)?n:null==r?void 0:r.id;t&&await (null==a?void 0:a.showColumnLevelLineage({node_id:t,column:e})),u(n=>new Map(n).set(e,!1))},w=null==a?void 0:a.viewOptions.column_level_lineage,k=w?new Set(["".concat(w.node_id,"-").concat(w.column)]):new Set;return(0,i.jsxs)(d.s,{direction:"column",children:[t?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:t})]}):l?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:l})]}):(0,i.jsx)(i.Fragment,{}),x.length>0&&(0,i.jsx)(ea.z,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"0.8rem",borderWidth:1},columns:h,rows:x,rowHeight:35,renderers:{noRowsFallback:(0,i.jsx)(ea.a,{})},className:"rdg-light no-track-pii-safe",ref:n,rowKeyGetter:e=>{var n;let t=null!=(n=null==s?void 0:s.id)?n:null==r?void 0:r.id;return"".concat(t,"-").concat(e.name)},selectedRows:k,onSelectedRowsChange:()=>{},onCellClick:async e=>{(void 0===e.row.baseIndex||void 0!==e.row.currentIndex)&&await y(e.row.name)},rowClass:e=>{let n;if(void 0===e.baseIndex)n="row-added";else{if(void 0===e.currentIndex)return"row-removed";n="row-normal"}return void 0!==a&&(n+=" row-selectable"),n}})]})}),ed=(0,j.forwardRef)(function(e,n){let t,l,{current:r}=e,s=ei(),[o,a]=(0,j.useState)(new Map),{columns:c,rows:u}=(0,j.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;return{columns:[{key:"index",name:"",resizable:!0,minWidth:35,width:35,cellClass:"schema-column schema-column-index"},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:s}=e;return n?(0,i.jsx)(er,{model:n,row:r,cllRunning:null!=(l=null==t?void 0:t.get(r.name))&&l,singleEnv:!0}):r.name},cellClass:"schema-column"},{key:"type",name:"Type",resizable:!0,cellClass:"schema-column"}],rows:Object.entries(e).map((e,n)=>{let[t,i]=e;return{name:t,index:n+1,type:i.type}})}})(null==r?void 0:r.columns,r,o),[r,o]),{lineageGraph:h}=(0,H.cE)();(null==h?void 0:h.catalogMetadata.current)||(t="catalog.json not found. Run `recce debug` to troubleshoot."),r&&void 0===r.columns&&(l="catalog.json is outdated. Update catalog.json to get schema information.");let x=async e=>{(0,b.vD)({action:"view",source:"schema_column"}),a(n=>new Map(n).set(e,!0));let n=null==r?void 0:r.id;n&&await (null==s?void 0:s.showColumnLevelLineage({node_id:n,column:e})),a(n=>new Map(n).set(e,!1))},p=null==s?void 0:s.viewOptions.column_level_lineage,m=p?new Set(["".concat(p.node_id,"-").concat(p.column)]):new Set;return(0,i.jsxs)(d.s,{direction:"column",children:[t?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:t})]}):l?(0,i.jsxs)(eo.Bm,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsx)(eo.TN,{children:l})]}):(0,i.jsx)(i.Fragment,{}),u.length>0&&(0,i.jsx)(ea.z,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:u,renderers:{noRowsFallback:(0,i.jsx)(ea.a,{})},className:"rdg-light",ref:n,rowKeyGetter:e=>{let n=null==r?void 0:r.id;return"".concat(n,"-").concat(e.name)},selectedRows:m,onSelectedRowsChange:()=>{},onCellClick:async e=>{await x(e.row.name)},rowClass:()=>void 0!==s?"row-normal row-selectable":"row-normal"})]})});async function eu(e){return(await v.g.post("/api/select",e)).data}var eh=t(81865);t(50543);let ex=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(eh.A,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},ep=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(eh.A,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var em=t(22322),ef=t(31138),ej=t(44468),eg=t(64153);let ev=B.gAg,ey=B.GKh,eb=B.f6c;function ew(e){return"added"===e?{color:"green.solid",hexColor:String(eg.q.token("colors.green.solid")),backgroundColor:"green.subtle",hexBackgroundColor:String(eg.q.token("colors.green.subtle")),icon:ev}:"removed"===e?{color:"red.solid",hexColor:String(eg.q.token("colors.red.solid")),backgroundColor:"red.subtle",hexBackgroundColor:String(eg.q.token("colors.red.subtle")),icon:ey}:"modified"===e?{color:"orange.emphasized",hexColor:String(eg.q.token("colors.orange.emphasized")),backgroundColor:"orange.subtle",hexBackgroundColor:String(eg.q.token("colors.orange.subtle")),icon:eb}:{color:"gray.focusRing",hexColor:String(eg.q.token("colors.gray.focusRing")),backgroundColor:"white",hexBackgroundColor:String(eg.q.token("colors.white")),icon:void 0}}function ek(e){if("model"===e)return{color:String(eg.q.token("colors.cyan.subtle")),icon:ef.$ZR};if("metric"===e)return{color:String(eg.q.token("colors.rose.subtle")),icon:ej.mJh};if("source"===e)return{color:String(eg.q.token("colors.green.muted")),icon:ef.nBS};if("exposure"===e)return{color:String(eg.q.token("colors.rose.subtle")),icon:ej.nM$};if("semantic_model"===e)return{color:String(eg.q.token("colors.rose.focusRing")),icon:ej.Z4p};else if("seed"===e)return{color:String(eg.q.token("colors.green.emphasized")),icon:ef.b9F};else if("snapshot"===e)return{color:String(eg.q.token("colors.green.emphasized")),icon:ef.p5B};else return{color:"inherit",icon:void 0}}function eC(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<t.length;e++)if(t[e]!==i[e])return!0;for(let t of i)if(!e[t]||e[t].type!==n[t].type)return!0;return!1}var e_=t(65909);let eS=e=>{let n,t,{node:r,selected:o,onSelect:a,schemaChanged:c}=e,{icon:u}=ek(r.resourceType),{base:h,current:x}=r.data;if(c){var p;n=null==(p=(0,e_.C)("schema_diff"))?void 0:p.icon,t=ew("modified").color}else!h&&x?(n=ew("added").icon,t=ew("added").color):h&&!x&&(n=ew("removed").icon,t=ew("removed").color);return(0,i.jsx)(em.ck,{children:(0,i.jsxs)(d.s,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:o?"gray.100":"inherit",onClick:()=>{a(r.id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:u}),(0,i.jsx)(l.a,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.I,{as:n,color:t})]})})},ez=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=(0,H.cE)(),r=t.params,s=[...y.X.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,g.I)({queryKey:s,queryFn:async()=>eu({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode}),refetchOnMount:!0,enabled:!r.node_id}),[u,h]=(0,j.useMemo)(()=>{var e,n,t;let i=[],s=[],o=[],a=[];if(r.node_id)for(let e of r.node_id instanceof Array?r.node_id:[r.node_id]){let n=null==l?void 0:l.nodes[e];n&&i.push(n)}else for(let n of null!=(e=null==d?void 0:d.nodes)?e:[]){let e=null==l?void 0:l.nodes[n];e&&i.push(e)}let c=i.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of c)eC(null==(n=e.data.base)?void 0:n.columns,null==(t=e.data.current)?void 0:t.columns)?s.push(e.id):!e.data.base&&e.data.current?o.push(e.id):e.data.base&&!e.data.current&&a.push(e.id);function u(e){return s.includes(e.id)?3:o.includes(e.id)?2:+!!a.includes(e.id)}return c.sort((e,n)=>{let t=u(e),i=u(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[c,s]},[r.node_id,null==d?void 0:d.nodes,l]),[x,p]=(0,j.useState)(0);if(o)return(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(I.o,{bg:"rgb(249,249,249)",height:"100%",className:"no-track-pii-safe",children:["Error: ",a.message]});if(0==u.length)return(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x<u.length){let e=u[x];return(0,i.jsxs)(ex,{sizes:[80,20],minSize:30,style:{height:"100%"},children:[(0,i.jsx)(ec,{base:e.data.base,current:e.data.current,enableScreenshot:!0,ref:n}),(0,i.jsx)(em.$z,{overflow:"auto",backgroundColor:"white",as:"ul",listStyle:"none",children:u.map((e,n)=>(0,i.jsx)(eS,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{p(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var eE=t(39947),eD=t(72499);function eI(e){let{value:n,onChange:t}=e,{featureToggles:l}=(0,ee.c)(),[s,o]=(0,j.useState)(!1),[a,u]=(0,j.useState)(),h=(0,j.useRef)(null),x=()=>{t&&(t(a),o(!1))};return((0,j.useEffect)(()=>{if(s&&h.current){let e=h.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[s]),s)?(0,i.jsxs)(d.s,{direction:"column",align:"flex-end",height:"100%",className:"no-track-pii-safe",children:[(0,i.jsx)(eD.T,{value:a,onChange:e=>{u(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&o(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),x())},ref:h,flex:1}),(0,i.jsxs)(d.s,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.N,{onClick:()=>{setTimeout(()=>{o(!1)},100)},colorPalette:"blue",children:"cancel"}),(0,i.jsx)(M.$,{mt:"8px",size:"sm",colorPalette:"blue",onClick:x,children:"Update"})]})]}):(0,i.jsx)(c.E,{className:"no-track-pii-safe",height:"100%",overflow:"auto",fontSize:"11pt",onClick:l.disableUpdateChecklist?void 0:()=>{u(null!=n?n:""),o(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var eR=t(94585),eT=t(17634);function eN(){return{successToast:function(e){eT.X.create({description:e,type:"info",duration:5e3,closable:!0})},failToast:function(e,n){eT.X.create({title:e,description:"".concat(n),type:"error",duration:5e3,closable:!0})}}}function eF(){let e=(0,R._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return eF=function(){return e},e}function eq(e){return e.description?e.description:"_(no description)_"}var eA=t(18249),eL=t(91008),eM=t(36444),eO=t(46678),eP=t(33392),eX=t(10798),eK=t(63180),eQ=t(73311),eW=t.n(eQ),e$=t(99412);function eB(e){let n=(0,eO.H)(e);return(0,eP.GP)(n,"yyyy-MM-dd'T'HH:mm:ss")}function eV(e){let n=(0,eO.H)(e);return(0,eX.B)(n,new Date,{addSuffix:!0})}function eZ(e){let n=new Set,t=new Set;if(null==e?void 0:e.nodes)for(let r of Object.values(e.nodes)){var i,l;(null==(i=r.data.base)?void 0:i.schema)&&n.add(r.data.base.schema),(null==(l=r.data.current)?void 0:l.schema)&&t.add(r.data.current.schema)}return[n,t]}function eH(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(d.s,{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)(em.ck,{ml:"10px",children:[n,": ",t]},n)})}function eU(){var e,n,t,l;let{envInfo:o,reviewMode:a,lineageGraph:c}=(0,H.cE)(),{open:u,onOpen:x,onClose:p}=(0,T.j)(),m=null==o?void 0:o.git,f=null==o?void 0:o.pullRequest,j={...m,...f},g=null==o||null==(e=o.dbt)?void 0:e.base,v=null==o||null==(n=o.dbt)?void 0:n.current,y=(null==g?void 0:g.generated_at)?eB(g.generated_at):"",b=(null==v?void 0:v.generated_at)?eB(v.generated_at):"",w="",k="";g&&(w=g.generated_at?eV(g.generated_at):""),v&&(k=v.generated_at?eV(v.generated_at):"");let[C,_]=eZ(c);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Environment Info",positioning:{placement:"bottom-end"},children:(0,i.jsxs)("div",{className:"flex items-center hover:cursor-pointer hover:text-black",onClick:x,children:[(0,i.jsxs)("div",{className:"hidden text-sm lg:flex lg:flex-col",children:[(0,i.jsxs)("div",{className:"flex gap-1",children:[(0,i.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(C).join(", ")})," ","(",w,")"]}),(0,i.jsxs)("div",{className:"flex gap-1",children:[(0,i.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(_).join(", ")})," ","(",k,")"]})]}),(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Environment Info",children:(0,i.jsx)(s.I,{verticalAlign:"middle",as:eK.G_,boxSize:"16px"})})]})}),(0,i.jsx)(N.Dz,{open:u,onOpenChange:p,size:"lg",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Environment Information"})}),(0,i.jsx)(N.R4,{children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[a?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"Review Information"}),(0,i.jsxs)(em.$z,{children:[j.url&&(0,i.jsxs)(em.ck,{ml:"10px",children:["url:"," ",(0,i.jsxs)(r.N,{href:j.url,color:"blue.500",target:"_blank",children:[j.url," ",(0,i.jsx)(e$.TdP,{})]})]}),!eW()(j)&&eH(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"Dev Information"}),(0,i.jsx)(em.$z,{children:m&&eH(m)})]})}),(0,i.jsx)(D.w,{}),(null==o?void 0:o.adapterType)==="dbt"&&(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"DBT"}),(0,i.jsx)(eM.Rz,{borderWidth:"1px",height:"30rem",children:(0,i.jsxs)(eM.jq,{size:"sm",variant:"line",stickyHeader:!0,children:[(0,i.jsx)(eM.A0,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.ug,{}),(0,i.jsx)(eM.ug,{children:"base"}),(0,i.jsx)(eM.ug,{children:"current"})]})}),(0,i.jsxs)(eM.BF,{children:[(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"schema"}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:Array.from(C).map(e=>(0,i.jsx)(el.m,{content:e,positioning:{placement:"bottom"},children:(0,i.jsx)("div",{className:"max-w-72 truncate",children:e})},e))}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:Array.from(_).map(e=>(0,i.jsx)(el.m,{content:e,positioning:{placement:"bottom"},children:(0,i.jsx)("div",{className:"max-w-72 truncate",children:e})},e))})]}),(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"version"}),(0,i.jsx)(eM.nA,{children:null==g?void 0:g.dbt_version}),(0,i.jsx)(eM.nA,{children:null==v?void 0:v.dbt_version})]}),(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"timestamp"}),(0,i.jsx)(eM.nA,{children:y}),(0,i.jsx)(eM.nA,{children:b})]})]})]})})]}),(null==o?void 0:o.adapterType)==="sqlmesh"&&(0,i.jsxs)(d.s,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.D,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(eM.Rz,{borderWidth:"1px",height:"30rem",children:(0,i.jsxs)(eM.jq,{variant:"line",stickyHeader:!0,children:[(0,i.jsx)(eM.A0,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.ug,{}),(0,i.jsx)(eM.ug,{children:"base"}),(0,i.jsx)(eM.ug,{children:"current"})]})}),(0,i.jsx)(eM.BF,{children:(0,i.jsxs)(eM.Hj,{children:[(0,i.jsx)(eM.nA,{children:"Environment"}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:null==(t=o.sqlmesh)?void 0:t.base_env}),(0,i.jsx)(eM.nA,{className:"no-track-pii-safe",children:null==(l=o.sqlmesh)?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(N.Es,{children:(0,i.jsx)(M.$,{colorPalette:"blue",mr:3,onClick:p,children:"Close"})}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})}function eG(e){var n;let{value:t,onChange:l,onRun:r,onRunBase:s,onRunDiff:o,label:a,CustomEditor:u,options:h={},manifestData:x,schemas:m,...f}=e,{featureToggles:j}=(0,ee.c)(),g="";return x&&(g=x.generated_at?eV(x.generated_at):""),(0,i.jsxs)(i.Fragment,{children:[(null!=(n=null!=a?a:r)?n:s)&&(0,i.jsxs)(d.s,{backgroundColor:"#EDF2F880",height:"40px",minH:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",flex:"0 0 40px",children:[(0,i.jsx)(c.E,{as:"strong",className:"no-track-pii-safe",children:a?a.toUpperCase():""}),x&&(0,i.jsxs)("span",{className:"ml-1",children:["(",m&&(0,i.jsxs)("span",{className:"no-track-pii-safe",children:[m,", "]}),(0,i.jsx)("span",{children:g}),")"]}),(0,i.jsx)(p.h,{}),(null!=r?r:s)&&(0,i.jsxs)(M.$,{size:"xs",variant:"outline",onClick:null!=r?r:s,backgroundColor:"white",padding:"6px 12px",disabled:j.disableDatabaseQuery,children:[(0,i.jsx)(ej.gSK,{})," Run Query"]})]}),null!=u?u:(0,i.jsx)(eL.KE,{className:"no-track-pii-safe",language:"sql",theme:"vs",value:t,onChange:e=>{void 0!==e&&l&&l(e)},onMount:(e,n)=>{r&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,r),s&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,s),o&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,o)},options:{extraEditorClassName:"no-track-pii-safe",tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...h}})]})}function eJ(e){var n;let t,l,{value:r,baseValue:s,onChange:o,onChangeBase:a,onRun:c,onRunBase:u,onRunDiff:h,options:x={},labels:p,SetupGuide:m,...f}=e,j=p?p[0]:"Base",g=p?p[1]:"Current",{envInfo:v,lineageGraph:y}=(0,H.cE)();(null==v||null==(n=v.dbt)?void 0:n.base)&&v.dbt.current&&(t=v.dbt.base,l=v.dbt.current);let[b,w]=eZ(y);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{height:"100%",gap:0,children:[(0,i.jsx)(eA.B,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(eG,{label:j,value:null!=s?s:"",onChange:a,onRunBase:u,options:x,CustomEditor:m,manifestData:null!=t?t:void 0,schemas:Array.from(b).join(", "),...f})}),(0,i.jsx)(eA.B,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(eG,{label:g,value:r,onChange:o,onRun:c,options:x,manifestData:null!=l?l:void 0,schemas:Array.from(w).join(", "),...f})})]})})}var eY=t(43463),e0=t(22729),e1=t(5302);let e2=(0,j.forwardRef)((e,n)=>{var t,r,s,o,a;let{isRunning:c,isAborting:u,progress:h,error:x,run:p,onCancel:m,viewOptions:f,onViewOptionsChanged:j,RunResultView:g,children:v,onExecuteRun:y}=e,b=null!=(s=null==x||null==(r=x.response)||null==(t=r.data)?void 0:t.detail)?s:null==p?void 0:p.error;if(b)return(0,i.jsxs)(eo.Bm,{status:"error",title:"Error: ".concat(b),children:[(0,i.jsx)(eo.mZ,{}),(0,i.jsxs)(eo.XL,{children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:b})]})]});if(null!=c?c:(null==p?void 0:p.status)==="running"){let e="Loading...";return(null==h?void 0:h.message)?e=h.message:(null==p||null==(o=p.progress)?void 0:o.message)&&(e=p.progress.message),(0,i.jsx)(I.o,{p:"1rem",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(E.T,{children:[(0,i.jsxs)(d.s,{alignItems:"center",children:[(null==h?void 0:h.percentage)==null?(0,i.jsx)(e0.QU,{value:null,size:"md",mr:"0.5rem",children:(0,i.jsx)(e0.Au,{})}):(0,i.jsx)(e0.QU,{value:100*h.percentage,size:"md",mr:"0.5rem",children:(0,i.jsx)(e0.Au,{})}),u?(0,i.jsx)("span",{children:"Aborting..."}):(0,i.jsx)("span",{className:"no-track-pii-safe",children:e})]}),!u&&(0,i.jsx)(M.$,{onClick:m,colorPalette:"blue",size:"sm",children:"Cancel"})]})})}if(!p)return(0,i.jsx)(I.o,{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.a,{h:"100%",style:{contain:"size layout"},overflow:"auto",className:"no-track-pii-safe",children:[g&&(null!=(a=p.error)?a:p.result)&&(0,i.jsx)(e1.tH,{children:(0,i.jsx)(g,{ref:n,run:p,viewOptions:f,onViewOptionsChanged:j})}),null==v?void 0:v({run:p,viewOptions:f,onViewOptionsChanged:j})]})});var e5=t(52531),e4=t(42496),e3=t(19462),e8=t(40735),e6=t(82361),e7=t(65986),e9=t(19829);t(1474),t(3870);var ne=t(92156),nn=t(9418),nt=t(5334),ni=t(75887),nl=t(29580),nr=t(46288),ns=t(6652);function no(e){let{children:n,display:t}=e,[s,o]=(0,j.useState)(!1),a=(0,j.useRef)(null),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{a.current&&(clearTimeout(a.current),a.current=null),o(!0)},[]),u=(0,j.useCallback)(()=>{a.current=setTimeout(()=>{o(!1)},100)},[]);if(!t)return n;let h=(0,j.cloneElement)(n,{ref:c});return(0,i.jsxs)(ns.yt,{open:s,onFocusOutside:()=>{o(!1)},positioning:{getAnchorRect:()=>{var e,n;return null!=(n=null==(e=c.current)?void 0:e.getBoundingClientRect())?n:null}},lazyMount:!0,unmountOnExit:!0,size:"xs",autoFocus:!1,children:[(0,i.jsx)(ns.Wv,{asChild:!0,children:(0,i.jsx)(l.a,{onMouseEnter:d,onMouseLeave:u,display:"contents",children:h})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(ns.Ug,{children:(0,i.jsx)(ns.hl,{bg:"gray.600",color:"white",zIndex:"popover",width:"auto",onMouseEnter:d,onMouseLeave:u,children:(0,i.jsxs)(ns.ej,{children:["Connect to a data warehouse to unlock Diff."," ",(0,i.jsx)(r.N,{href:nr.Q,color:"white",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})})})]})}function na(e){let{node:n}=e,{icon:t}=ek(n.resourceType);return(0,i.jsx)(el.m,{showArrow:!0,content:"Type of resource",children:(0,i.jsxs)(F.f8,{children:[t&&(0,i.jsx)(F.FV,{children:(0,i.jsx)(t,{})}),(0,i.jsx)(F.d1,{children:n.resourceType})]})})}function nc(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)(x.z,{children:[(0,i.jsx)(c.E,{children:r}),(0,i.jsx)(s.I,{as:nn.dyV}),(0,i.jsx)(c.E,{children:o})]}):t===l?(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.lso,color:"gray.500"}),(0,i.jsx)(c.E,{color:"gray.500",children:"No Change"})]}):t<l?(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.euc,color:"green.500"}),(0,i.jsx)(c.E,{color:"green.500",children:(0,ni.Q)(t,l)})]}):(0,i.jsxs)(x.z,{children:[(0,i.jsx)(c.E,{children:o}),(0,i.jsx)(s.I,{as:nt.p1_,color:"red.500"}),(0,i.jsx)(c.E,{color:"red.500",children:(0,ni.Q)(t,l)})]})}function nd(e){var n,t;let{rowCount:l,node:r,onRefresh:s,isFetching:o}=e,{featureToggles:a}=(0,ee.c)(),{runsAggregated:u}=(0,H.cE)(),h=null==u||null==(n=u[r.id])?void 0:n.row_count_diff.result,x=null==(t=(0,e_.C)("row_count_diff"))?void 0:t.icon,[p,m]=(0,j.useState)(),[f,g]=(0,j.useState)("");return(0,j.useEffect)(()=>{let e=null!=l?l:h;if(e){var n,t;let i=null!=(n=e.base)?n:"N/A",l=null!=(t=e.curr)?t:"N/A";g("".concat(i," -> ").concat(l," rows")),m(e)}},[l,h]),(0,i.jsx)(el.m,{content:f,children:(0,i.jsx)(no,{display:"metadata only"===a.mode,children:(0,i.jsx)(F.f8,{asChild:!0,children:(0,i.jsx)(c.E,{fontSize:"xs",children:(0,i.jsxs)(d.s,{direction:"row",alignItems:"center",gap:"1",children:[x&&(0,i.jsx)(x,{}),null!=p||o?(0,i.jsx)(ne.rr,{loading:!1,noOfLines:1,minWidth:"30px",children:null!=p?(0,i.jsx)(nc,{rowCount:p}):"row count"}):(0,i.jsx)("span",{children:"row count"}),s&&(0,i.jsx)(A.K,{loading:o,"aria-label":"Query Row Count",size:"2xs",p:"0",variant:"ghost",onClick:s,disabled:a.disableDatabaseQuery,children:(0,i.jsx)(nl.fZv,{})})]})})})})})}function nu(e){var n,t,l;let r,{rowCount:s,node:o,onRefresh:a,isFetching:c}=e,{runsAggregated:d,refetchRunsAggregated:u}=(0,H.cE)(),h=null==d||null==(n=d[o.id])?void 0:n.row_count.result,x=null==(t=(0,e_.C)("row_count"))?void 0:t.icon,p=null!=s?s:h;if(p){let e=null!=(l=p.curr)?l:"N/A";r="".concat(e," rows")}return(0,i.jsxs)(F.f8,{children:[x&&(0,i.jsx)(F.FV,{children:(0,i.jsx)(x,{})}),(0,i.jsx)(F.d1,{children:p||c?(0,i.jsx)(ne.rr,{loading:c,lineClamp:1,height:2,minWidth:"30px",children:p?"".concat(r):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(A.K,{loading:c,"aria-label":"Query Row Count",size:"2xs",p:"0",variant:"ghost",onClick:a,disabled:"base"===o.from,children:(0,i.jsx)(nl.fZv,{})})]})}let nh=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:o}=t;if("pending"===r)return(0,i.jsx)(e0.QU,{value:0,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});if("skipped"===r)return(0,i.jsx)(F.f8,{backgroundColor:"gray.100",children:(0,i.jsx)(F.d1,{children:(0,i.jsxs)(d.s,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.a,{children:"Skipped"}),s&&(0,i.jsx)(el.m,{content:s,children:(0,i.jsx)(nl.GLE,{})})]})})});if(!o)return(0,i.jsx)(e0.QU,{value:null,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});let{error:a,result:c,run_id:u,progress:h}=o;if("running"===r)if((null==h?void 0:h.percentage)===void 0)return(0,i.jsx)(e0.QU,{value:null,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});else return(0,i.jsx)(e0.QU,{value:100*h.percentage,size:"xs",children:(0,i.jsxs)(e0.Au,{children:[(0,i.jsx)(e0.JU,{}),(0,i.jsx)(e0.nM,{})]})});if(a)return(0,i.jsxs)(d.s,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.a,{children:"Error"}),s&&(0,i.jsx)(el.m,{content:a,children:(0,i.jsx)(nl.e5t,{})})]});if("value_diff"===o.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(F.f8,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(F.d1,{children:(0,i.jsx)(d.s,{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"===o.type){let e=o.result;return(0,i.jsx)(nd,{rowCount:e[n.name],node:n})}if("row_count"===o.type){let e=o.result;return(0,i.jsx)(nu,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})};function nx(e){var n;let t,l,{rowCount:r}=e,o=r.base,a=r.curr,c=null===r.base?"N/A":"".concat(r.base," Rows"),u=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===o&&null===a?(t="Failed to load",l="gray"):null===o||null===a?(t="".concat(c," -> ").concat(u),l=null===o?"green":"red"):o===a?(t="=",l="gray"):o!==a&&(t="".concat((0,ni.Q)(o,a)," Rows"),l=o<a?"green":"red"),(0,i.jsx)(F.f8,{colorPalette:l,children:(0,i.jsxs)(d.s,{gap:1,alignItems:"center",children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count_diff"))?void 0:n.icon}),(0,i.jsx)(F.d1,{children:t})]})})}let np={breaking:"Breaking",non_breaking:"Non Breaking",partial_breaking:"Partial Breaking",unknown:"Unknown"},nm=e=>{var n;let t,r,{id:o,inverted:a}=e,{lineageGraph:c,runsAggregated:u}=(0,H.cE)(),h=null==u?void 0:u[o],x=null==c?void 0:c.nodes[o];if(!h&&!x)return(0,i.jsx)(i.Fragment,{});if((null==x?void 0:x.data.base)&&x.data.current&&(t=eC(x.data.base.columns,x.data.current.columns)),null==h?void 0:h.row_count_diff){let e=h.row_count_diff;r=e.result.curr!==e.result.base}let m=a?"white":ew("modified").color;return(0,i.jsxs)(d.s,{flex:"1",children:[void 0!==t&&(0,i.jsx)(el.m,{content:"Schema (".concat(t?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.a,{height:"16px",children:(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("schema_diff"))?void 0:n.icon,color:t?m:a?"gray":"gray.100"})})}),(0,i.jsx)(p.h,{}),(null==h?void 0:h.row_count_diff)&&void 0!==r&&(0,i.jsx)(el.m,{content:"Row count (".concat(r?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(l.a,{children:(0,i.jsx)(nx,{rowCount:h.row_count_diff.result})})})]})},nf=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(d.s,{onClick:t,alignSelf:"center",alignItems:"center",cursor:"pointer",children:n?(0,i.jsx)(s.I,{boxSize:"20px",as:ef.Hcz}):(0,i.jsx)(s.I,{boxSize:"20px",as:ef.PVM})})},nj=e=>{let{name:n,color:t,resourceType:r}=e;return(0,i.jsx)(l.a,{flex:"1",color:t,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:(0,i.jsx)(el.m,{content:"model"===r?n:"".concat(n," (").concat(r,")"),positioning:{placement:"top"},children:(0,i.jsx)("span",{children:n})})})};var ng=t(95230),nv=t(53516),ny=t(32282);async function nb(e){return(await v.g.post("/api/checks",{type:"schema_diff",params:e})).data}let nw={add_or_remove:"Unavailable for added or removed resources."},nk=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=(0,H.JL)(),{error:o,data:a}=(0,g.I)({queryKey:y.X.run(null!=e?e:""),queryFn:async()=>(0,eY.Zc)(null!=e?e:"",2*!!t),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"||(null==a?void 0:a.type)==="row_count")&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let c=(0,j.useCallback)(async()=>{r(!0),e&&await (0,eY.Su)(e)},[e,r]),d=(null==a?void 0:a.type)?null==(n=(0,e_.C)(a.type))?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:c,RunResultView:d}};var nC=t(56157),n_=t(13875),nS=t.n(n_),nz=t(70229),nE=t(60640),nD=t.n(nE);let nI="ignore-screenshot";function nR(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:o="solid 1px #ccc",borderRadius:a="10px",onSuccess:h,onError:x,ignoreElements:p}=e,[m,f]=(0,j.useState)("idle"),g=(0,j.useRef)(null),{onOpen:v,setImgBlob:y,ImageDownloadModal:b}=function(){let{open:e,onOpen:n,onClose:t}=(0,T.j)(),[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;(null==(n=e.target)?void 0:n.result)!=null&&r(e.target.result)}},[r]),(0,i.jsx)(N.Dz,{size:"xl",open:e,onOpenChange:t,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Screenshot Preview"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsxs)(d.s,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(d.s,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(nl.GLE,{color:"red.600"}),(0,i.jsx)(c.E,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(c.E,{children:"Please download it directly"})]}),(0,i.jsx)(u._,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,eP.GP)(e,"yyyy-MM-dd-HH-mm-ss"),".png");nD()(l,n),t()},children:"Download"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})}}}(),w=async()=>{var e,t;if(!g.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let i=null!=(e=g.current.element)?e:g.current,c=i.style.overflow,d=i.style.border,u=i.style.borderRadius,h=i.style.backgroundColor,x=i.style.height;try{i.style.overflow="hidden",i.style.border=r?o:"",i.style.borderRadius=r?a:"",i.style.backgroundColor=null!=l?l:"",i.style.height="".concat(String(i.offsetHeight),"px");let e=document.createElement("style");document.head.appendChild(e),null==(t=e.sheet)||t.insertRule("body > div:last-child img { display: inline-block; }"),f("loading");let c="html2canvas"===n?await nS()(i,{logging:!1,backgroundColor:null,ignoreElements:p}):await (0,nz.mo)(i,{filter:p?e=>!p(e):void 0});e.remove();let d=s?document.createElement("canvas"):c;if(s){d.width=c.width+80,d.height=c.height+80;let e=d.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(c,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let u=await fetch(d.toDataURL());return await u.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{i.style.overflow=c,i.style.border=d,i.style.borderRadius=u,i.style.backgroundColor=h,i.style.height=x}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:w()})]),f("success"),h&&h()}catch(e){"ClipboardItem is not defined"===e.message?(y(await w()),v(),f("success")):(f("error"),console.error("Error copying to clipboard",e),x&&x(e))}},ImageDownloadModal:b,ref:g}}function nT(e){var n;let{successToast:t,failToast:l}=eN(),{isLoading:r,copyToClipboard:s,ImageDownloadModal:o,ref:a}=nR({imageType:"png",shadowEffect:!0,backgroundColor:null!=(n=null==e?void 0:e.backgroundColor)?n:null,onSuccess:()=>{t("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),l("Failed to copy image to clipboard",e)}}),c=(0,j.useCallback)(()=>{if(a.current){var e;let n=null!=(e=a.current.element)?e:a.current;n.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",n.style.transition="box-shadow 0.5s ease-in-out"}},[a]),d=(0,j.useCallback)(()=>{if(a.current){var e;(null!=(e=a.current.element)?e:a.current).style.boxShadow=""}},[a]),u=(0,j.useCallback)(async()=>{if(a.current){var e;await s(),(null!=(e=a.current.element)?e:a.current).style.boxShadow=""}else l("Failed to copy image to clipboard","No content to copy")},[a,s,l]);return{ref:a,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(M.$,{size:"sm",style:{position:"absolute",bottom:"16px",right:"16px"},loading:r,onMouseEnter:c,onMouseLeave:d,onClick:u,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}),(0,i.jsx)(o,{})]})},onMouseEnter:c,onMouseLeave:d,onCopyToClipboard:u}}function nN(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,eP.GP)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,eP.GP)(e,"HH:mm"):(0,eP.GP)(e,"MMM d, HH:mm")}let nF=e=>{let{run:n}=e,t="running"===n.status,l=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 o=n.run_at?nN(new Date(n.run_at)):null;return(0,i.jsxs)(d.s,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(J.y,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(c.E,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(c.E,{children:"•"}),(0,i.jsx)(c.E,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:o})]})},nq=e=>{var n;return(0,i.jsxs)(d.s,{flex:"1",minH:"48px",m:"4px",px:"16px",py:"12px",bg:"blue.50",border:"1px",borderRadius:"4px",borderColor:"blue.400",align:null!=(n=e.align)?n:"center",gap:"12px",children:[(0,i.jsx)(s.I,{as:nn.S8s,width:"20px",height:"20px",color:"blue.900"}),e.children,(0,i.jsx)(p.h,{}),(0,i.jsx)(P.J,{onClick:e.onClose})]})},nA=()=>(0,i.jsxs)(r.N,{href:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",target:"_blank",color:"rgba(49, 130, 206, 1)",fontWeight:"bold",textDecoration:"underline",children:["Learn how ",(0,i.jsx)(e$.TdP,{})]});var nL=t(61315),nM=t(39074),nO=t(5484);let nP={src:"/_next/static/media/reload-image.79aabb7d.svg"};async function nX(){return(await v.g.post("/api/connect")).data}function nK(e){var n;let{handleParentClose:t,parentOpen:l=!1,ignoreCookie:s=!1,variant:o="auth"}=e,{authed:a}=(0,ee.c)(),[d,h]=(0,j.useState)(l||!a),x=null!=(n=nO.A.get("authState"))?n:"pending",[p,m]=(0,j.useState)(s?"pending":x);if("ignored"===p&&!s||a)return null;let f={auth:{title:"Configure Cloud Token",action:"Get token and configure"},"enable-share":{title:"Enable Sharing with Cloud",action:"Enable sharing"},"user-profile":{title:"Configure Cloud Token",action:"Get token and configure"}}[o];return(0,i.jsx)(N.Dz,{size:"lg",placement:"center",lazyMount:!0,open:d,onOpenChange:e=>{h(e.open),t&&t(e.open)},children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{borderRadius:"2xl",children:["authenticating"!==p&&(0,i.jsx)(N.c7,{className:"text-center",fontSize:"2xl",children:(0,i.jsx)(N.L3,{children:f.title})}),"authenticating"!==p?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.R4,{className:"space-y-2 font-light",children:[(0,i.jsx)(c.E,{children:"To enable sharing, get your token from Recce Cloud and launch your local instance with it."}),(0,i.jsxs)("ul",{className:"list-inside list-disc",children:[(0,i.jsx)("li",{children:"Share your instance with teammates via Recce Cloud."}),(0,i.jsx)("li",{children:"Your instance will be securely and freely hosted for sharing."}),"auth"===o&&(0,i.jsx)("li",{children:"This step is recommended but optional."})]}),(0,i.jsxs)(c.E,{display:"flex",gap:1,children:["More directions",(0,i.jsxs)(r.N,{variant:"underline",color:"blue.500",_focus:{outline:"none"},href:"https://cloud.datarecce.io/connect-to-cloud",target:"_blank",children:["here ",(0,i.jsx)(e$.TdP,{})]})]})]}),(0,i.jsx)(N.Es,{children:(0,i.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,i.jsxs)(M.$,{className:"w-full !rounded-lg !font-medium",colorPalette:"brand",onClick:async()=>{m("authenticating");let{connection_url:e}=await nX();window.open(e,"_blank")},children:[f.action," ",(0,i.jsx)(e$.TdP,{})]}),(0,i.jsx)(N.Tt,{asChild:!0,children:(0,i.jsx)(M.$,{className:"!rounded-lg !font-medium",variant:"subtle",colorPalette:"gray",size:"sm",children:"auth"===o?"Skip":"Cancel"})}),"auth"===o&&(0,i.jsx)(N.Tt,{asChild:!0,children:(0,i.jsx)(M.$,{width:"100%",className:"!rounded-lg !font-medium !text-black",variant:"ghost",size:"sm",onClick:()=>{nO.A.set("authState","ignored",{expires:30}),m("ignored")},children:"Snooze for 30 days"})})]})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(N.R4,{className:"space-y-2 self-center font-light",children:(0,i.jsxs)(E.T,{gap:4,paddingTop:"1rem",children:[(0,i.jsx)(u._,{className:"mx-auto mb-2",h:"6rem",fit:"contain",src:nP.src}),(0,i.jsx)(c.E,{fontSize:"2xl",fontWeight:"medium",children:"Reload to Finish"}),(0,i.jsx)(c.E,{children:"Reload to complete connection to Recce Cloud"})]})}),(0,i.jsx)(N.Es,{children:(0,i.jsx)(M.$,{className:"w-full",colorPalette:"brand",onClick:()=>{window.location.reload()},children:"Reload"})})]})]})})]})})}let nQ=e=>{let n=nC.Ay.stringify(e,null,2);return(0,i.jsx)(eL.KE,{className:"no-track-pii-safe",height:"100%",language:"yaml",theme:"vs",value:n,options:{extraEditorClassName:"no-track-pii-safe",readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},nW=e=>{let{runType:n}=e,{open:t,onClose:l}=(0,T.j)({defaultOpen:!0});if(!t)return(0,i.jsx)(i.Fragment,{});switch(n){case"row_count":return(0,i.jsx)(nq,{onClose:l,children:(0,i.jsxs)(c.E,{children:["Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(nA,{})]})});case"profile":return(0,i.jsx)(nq,{onClose:l,children:(0,i.jsxs)(c.E,{children:["Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(nA,{})]})});default:return(0,i.jsx)(i.Fragment,{})}},n$=e=>{let{disableCopyToClipboard:n,onCopyToClipboard:t,onMouseEnter:l,onMouseLeave:r}=e,{authed:s}=(0,ee.c)(),{handleShareClick:o}=(0,nM.l)(),[a,c]=(0,j.useState)(!1);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"xs",variant:"outline",colorPalette:"gray",children:["Share ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{minW:"0",children:[(0,i.jsxs)(q.Dr,{value:"copy-to-clipboard",onClick:t,onMouseEnter:l,onMouseLeave:r,disabled:n,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}),(0,i.jsx)(q.bX,{}),s?(0,i.jsxs)(q.Dr,{value:"share-to-cloud",onClick:async()=>{await o(),(0,b.o$)({name:"create"})},children:[(0,i.jsx)(nL.Fsk,{})," Share to Cloud"]}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(q.Dr,{value:"share",onClick:()=>{c(!0)},children:[(0,i.jsx)(nL.Fsk,{})," Share"]})})]})})})]}),a&&(0,i.jsx)(nK,{parentOpen:a,handleParentClose:c,ignoreCookie:!0,variant:"enable-share"})]})},nB=e=>{var n,t,l,r;let{runId:s,onClose:o,isSingleEnvironment:a}=e,{featureToggles:c}=(0,ee.c)(),{runAction:u}=(0,G.tr)(),{error:h,run:f,onCancel:g,isRunning:v}=nk(s),[k,C]=(0,j.useState)(),_=(0,V.jE)(),[,S]=(0,eE.zy)(),[z,E]=(0,j.useState)("result"),D=(null==f?void 0:f.type)?null==(n=(0,e_.C)(f.type))?void 0:n.RunResultView:void 0,I=(0,j.useCallback)(()=>{var e;u(null!=(e=null==f?void 0:f.type)?e:"",null==f?void 0:f.params)},[f,u]),R=null==f?void 0:f.check_id,T=(0,j.useCallback)(()=>{R&&S("/checks/".concat(R))},[R,S]),N=(0,j.useCallback)(async()=>{if(!s)return;let e=await w(s,k);await _.invalidateQueries({queryKey:y.X.checks()}),S("/checks/".concat(e.check_id))},[s,S,_,k]),F=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:q,onCopyToClipboard:A,onMouseEnter:L,onMouseLeave:O}=nT(),X=!s||!(null==f?void 0:f.result)||!!h||"result"!==z;return(0,i.jsxs)(d.s,{direction:"column",children:[a&&(0,i.jsx)(nW,{runType:null==f?void 0:f.type}),(0,i.jsx)(m.pK,{size:"lg",colorPalette:"iochmara",value:z,onValueChange:e=>{E(e.value)},flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.j7,{children:[(0,i.jsx)(m.Xi,{value:"result",children:"Result"}),(0,i.jsx)(m.Xi,{value:"params",children:"Params"}),F&&(0,i.jsx)(m.Xi,{value:"query",children:"Query"}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{overflow:"hidden",children:[f&&(0,i.jsx)(nF,{run:f}),(0,i.jsxs)(M.$,{variant:"outline",colorPalette:"gray",disabled:!s||v||c.disableDatabaseQuery,size:"xs",onClick:I,children:[(0,i.jsx)(nl.fZv,{})," Rerun"]}),c.disableShare?(0,i.jsxs)(M.$,{variant:"outline",disabled:!s||!(null==f?void 0:f.result)||!!h||"result"!==z,onMouseEnter:L,onMouseLeave:O,size:"sm",onClick:A,children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]}):(0,i.jsx)(n$,{disableCopyToClipboard:X,onCopyToClipboard:async()=>{var e;await A(),(0,b.uH)({type:null!=(e=null==f?void 0:f.type)?e:"unknown",from:"run"})},onMouseEnter:L,onMouseLeave:O}),(0,i.jsx)(function(){return c.disableUpdateChecklist?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsxs)(M.$,{disabled:!s||!f.result||!!h,size:"sm",colorPalette:"iochmara",onClick:T,children:[(0,i.jsx)(nl.wiW,{})," Go to Check"]}):(0,i.jsxs)(M.$,{disabled:!s||!(null==f?void 0:f.result)||!!h,size:"xs",colorPalette:"iochmara",onClick:N,children:[(0,i.jsx)(nl.wiW,{})," Add to Checklist"]})},{}),(0,i.jsx)(P.J,{size:"sm",onClick:()=>{o&&o()}})]})]})}),"result"===z&&(0,i.jsx)(e2,{ref:q,error:h,run:f,onCancel:g,viewOptions:k,onViewOptionsChanged:C,RunResultView:D}),"params"===z&&f&&(0,i.jsx)(nQ,{type:f.type,params:f.params}),"query"===z&&f&&((null==(t=f.params)?void 0:t.base_sql_template)?(0,i.jsx)(eJ,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(eG,{value:null!=(r=null==(l=f.params)?void 0:l.sql_template)?r:"",options:{readOnly:!0}}))]})},nV=e=>{let{onClose:n,isSingleEnvironment:t}=e,{runId:l}=(0,G.tr)();return(0,i.jsx)(nB,{runId:l,onClose:n,isSingleEnvironment:t})};async function nZ(e,n){return await (0,eY.AU)("query",e,n)}async function nH(e,n){return await (0,eY.AU)("query_base",e,n)}async function nU(e,n){return await (0,eY.AU)("query_diff",e,n)}var nG=t(56384),nJ=t(64054);let nY=e=>{var n;let{defaultValues:t,suggestionList:r,onValuesChange:s,className:o}=e,[a,c]=(0,j.useState)(null!=t?t:[]),[d,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),p=(0,j.useRef)(null),m=e=>{a.includes(e)||(u(""),c([...a,e]),s([...a,e]))},f=d.toLowerCase(),g=null!=(n=null==r?void 0:r.filter(e=>""===f||e.toLowerCase().includes(f)).filter(e=>!a.includes(e)))?n:[],v=a.length>0?(0,i.jsx)(M.$,{size:"2xs",variant:"ghost",color:"#3182CE",fontSize:e.size,paddingTop:"0",me:-2,onClick:()=>{u(""),c([]),s([])},children:"Clear"}):void 0;return(0,i.jsx)(nG.M,{width:e.width,className:o,endElement:v,children:(0,i.jsxs)(q.il,{size:"sm",lazyMount:!0,closeOnSelect:!1,onOpenChange:()=>{var e;return null==(e=p.current)?void 0:e.focus()},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(M.$,{width:"100%",size:"2xs",colorPalette:"gray",variant:"outline",justifyContent:"flex-start",children:(n=>n.length>1?"".concat(n.length," ").concat(e.unitName,"s selected"):1===n.length?n[0]:"")(a)})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{zIndex:"popover",fontSize:e.size,width:e.width,className:"no-track-pii-safe",children:[(0,i.jsx)(q.Uh,{children:(0,i.jsxs)(nJ.B,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(nJ.Q,{children:(0,i.jsxs)(F.f8,{paddingX:"0.5rem",size:"sm"===e.size||"md"===e.size||"lg"===e.size?e.size:"md",children:[(0,i.jsx)(F.d1,{children:n}),(0,i.jsx)(F.Cs,{children:(0,i.jsx)(F.TG,{onClick:()=>{c(a.filter(e=>e!==n)),s(a.filter(e=>e!==n))}})})]},n)},"tag-".concat(t))),(0,i.jsx)(nJ.Q,{width:"100%",children:(0,i.jsx)(W.p,{ref:p,placeholder:"Filter or add custom keys",variant:"subtle",size:e.size,value:d,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":m(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(c(a.slice(0,-1)),s(a.slice(0,-1)))}},onBlur:()=>{p.current&&h&&p.current.focus()}})})]})}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{children:[""!==d&&!(null==r?void 0:r.includes(d))&&(0,i.jsxs)(q.Dr,{value:"custom-value-by-filter",onClick:()=>{m(d),x(!1)},children:["Add '",d,"' to the list"]},"custom-value-by-filter"),g.map((e,n)=>(0,i.jsx)(q.Dr,{value:"option-".concat(n),onClick:()=>{m(e)},children:e},"option-".concat(n))).slice(0,10),g.length>10&&(0,i.jsx)(el.m,{content:"Please use filter to find more items",positioning:{placement:"top"},children:(0,i.jsxs)(l.a,{px:"12px",color:"gray",fontSize:"8pt",children:["and ",g.length-10," more items..."]})})]})]})})})]})})};var n0=t(12187);let n1=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=(0,H.cE)(),o=(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.columns,o=null==(t=l.data.current)?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)(d.s,{...l,children:(0,i.jsxs)(n0.XO,{m:"0 0.5rem",gap:0,children:[(0,i.jsxs)(n0.dh,{fontSize:"0.625rem",margin:0,children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(el.m,{content:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",positioning:{placement:"bottom-end"},children:(0,i.jsx)(nl.GLE,{color:"gray.600"})})]}),(0,i.jsx)(nY,{className:"no-track-pii-safe",unitName:"key",defaultValues:n,suggestionList:o,onValuesChange:t,size:"2xs",width:"240px",placeholder:"Select or type to add keys",disabled:!s("query_diff_with_primary_key")})]})})};var n2=t(20503);function n5(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:o,externalLinkText:a}=e;return(0,i.jsxs)(d.s,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(A.K,{"aria-label":"thumbs up",variant:"ghost",width:"32px",height:"32px",onClick:t,children:(0,i.jsx)(u._,{src:"/imgs/feedback/thumbs-up.png",alt:"like"})}),(0,i.jsx)(A.K,{"aria-label":"thumbs down",variant:"ghost",width:"32px",height:"32px",onClick:l,children:(0,i.jsx)(u._,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"})}),o&&a&&(0,i.jsxs)(r.N,{href:o,target:"_blank",textDecoration:"underline",onClick:s,children:[a," ",(0,i.jsx)(e$.TdP,{})]})]})}let n4="recce-",n3={bypassSaveOverwrite:"".concat(n4,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(n4,"-preview-change-feedback"),prepareEnvGuideID:"".concat(n4,"-prepare-env")};var n8=t(71859);function n6(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:o,runQuery:a,isPending:u}=e;return(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.a,{children:[(0,i.jsxs)(h.D,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:n2.czL,boxSize:"1.2em"}),"Sandbox"]}),(0,i.jsxs)(c.E,{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)(p.h,{}),(0,i.jsx)(n1,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(el.m,{content:"Run diff to see the changes",children:(0,i.jsx)(M.$,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{o(),a()},colorPalette:"blue",loading:u,children:"Run Diff"})})]})}function n7(e){var n,t,l,r;let{currentModelID:s,height:o="32px",flex:a="0 0 auto"}=e,{lineageGraph:u,envInfo:h}=(0,H.cE)(),x="0 16px",p=eB(null!=(l=null==h||null==(t=h.dbt)||null==(n=t.current)?void 0:n.generated_at)?l:""),m=(0,e5.m)(p,{addSuffix:!0}),f="N/A";if(null==u?void 0:u.nodes[s]){let e=u.nodes[s];(null==(r=e.data.current)?void 0:r.schema)&&(f=e.data.current.schema)}return(0,i.jsxs)(d.s,{gap:0,height:o,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(eA.B,{width:"50%",children:(0,i.jsxs)(c.E,{as:"b",margin:x,children:["ORIGINAL (Schema: ",f,", Last Updated: ",m,")"]})}),(0,i.jsx)(eA.B,{width:"50%",children:(0,i.jsx)(c.E,{as:"b",margin:x,children:"SANDBOX EDITOR"})})]})}function n9(e){var n;let{current:t,onChange:r}=e,s=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=null==t?void 0:t.raw_code)?n:"",r);return(0,i.jsx)(l.a,{flex:1,overflowY:"auto",children:(0,i.jsx)(eL.zC,{language:"sql",theme:"vs",original:null==t?void 0:t.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:s.onMount})})}function te(e){var n,t;let{isOpen:r,onClose:s,current:o}=e,{open:c,onClose:h,onOpen:p}=(0,T.j)(),[m,f]=(0,j.useState)(null!=(n=null==o?void 0:o.raw_code)?n:""),{showRunId:g,clearRunResult:v}=(0,G.tr)(),{primaryKeys:y,setPrimaryKeys:w}=(0,nv.vr)(),{data:k,isLoading:C}=(0,n8.T)(),_=async()=>{var e;let n={current_model:null!=(e=null==o?void 0:o.name)?e:"",primary_keys:y,sql_template:m},{run_id:t}=await nU(n,{nowait:!0});return g(t),await (0,eY.Zc)(t)},{mutate:S,isPending:z}=(0,Z.n)({mutationFn:_,onSuccess(e,n){e.error?(0,b.In)({action:"run",node:null==o?void 0:o.name,status:"failure"}):((0,b.In)({action:"run",node:null==o?void 0:o.name,status:"success"}),setTimeout(()=>{E()},1e3),!C&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>{I()},2e3))}}),{feedbackToast:E,closeToast:D}=function(e){let{feedbackId:n,description:t,onFeedbackSubmit:l,externalLink:r,externalLinkText:s}=e,[o,a]=(0,j.useState)(void 0);return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],c=localStorage.getItem(n);null==o&&("true"!==c||e)&&a(eT.X.create({id:n,duration:void 0,type:"success",description:(0,i.jsx)(x.z,{children:(0,i.jsx)(n5,{description:t,onLike:()=>{l("like"),eT.X.dismiss(o),localStorage.setItem(n,"true")},onDislike:()=>{l("dislike"),eT.X.dismiss(o),localStorage.setItem(n,"true")},externalLink:r,externalLinkText:s,onClickLink:()=>{l("link")}})})}))},closeToast:()=>{eT.X.dismiss(o)}}}({feedbackId:n3.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":(0,b.Ly)({feedback:"like",node:null==o?void 0:o.name});break;case"dislike":(0,b.Ly)({feedback:"dislike",node:null==o?void 0:o.name});break;case"link":(0,b.Ly)({feedback:"form",node:null==o?void 0:o.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:I,closeGuideToast:R}=function(e){let[n,t]=(0,j.useState)(void 0),{guideId:i,description:l,externalLink:r,externalLinkText:s,onExternalLinkClick:o}=e;return{guideToast:function(){null==n&&t(eT.X.create({id:i,duration:3e3,type:"success",description:l,action:{label:null!=s?s:"link",onClick:()=>{o&&o()}}}))},closeGuideToast:()=>{eT.X.dismiss(n)}}}({guideId:n3.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>{(0,b.TL)({action:"external_link",from:"preview_changes",node:null==o?void 0:o.name})}});return(0,j.useEffect)(()=>{if(r){var e;f(null!=(e=null==o?void 0:o.raw_code)?e:"")}},[r,o]),(0,i.jsx)(N.Dz,{open:r,size:"cover",onOpenChange:()=>{s(),h(),v(),D(),R(),(0,b.In)({action:"close",node:null==o?void 0:o.name})},children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{height:"100%",children:[(0,i.jsxs)(N.c7,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:[(0,i.jsxs)(d.s,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(u._,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(N.L3,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",children:"Experiment"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]}),(0,i.jsx)(N.R4,{p:0,children:(0,i.jsxs)(ep,{sizes:c?[50,50]:[100,0],minSize:100*!!c,gutterSize:5*!!c,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(d.s,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(n6,{current:o,primaryKeys:null!=y?y:[],setPrimaryKeys:w,onRunResultOpen:p,runQuery:S,isPending:z}),(0,i.jsx)(n7,{height:"32pxs",flex:"0 0 auto",currentModelID:null!=(t=null==o?void 0:o.id)?t:""}),(0,i.jsx)(n9,{current:o,onChange:f})]}),c?(0,i.jsx)(nV,{onClose:h,disableAddToChecklist:!0}):(0,i.jsx)(l.a,{})]})}),(0,i.jsx)(l.a,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(el.m,{content:"Give us feedback",children:(0,i.jsx)(A.K,{"aria-label":"feedback",variant:"ghost",size:"md",onClick:()=>{E(!0)},children:(0,i.jsx)(B.Kyq,{})})})})]})})]})})}let tn=e=>{var n,t,r,s,o,a;let{node:c}=e,{open:d,onOpen:u,onClose:h}=(0,T.j)(),[x,p]=(0,j.useState)(!1),{data:m,isLoading:f}=(0,n8.T)(),g=null==m?void 0:m.single_env_onboarding;if(f)return(0,i.jsx)(i.Fragment,{});if("model"!==c.resourceType&&"snapshot"!==c.resourceType)return"Not available";let v={readOnly:!0,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,wordWrap:"off",minimap:{enabled:!1}},y={readOnly:!0,lineNumbers:"on",automaticLayout:!0,wordWrap:"off",minimap:{enabled:!1}},b=null==(n=c.data.base)?void 0:n.raw_code,w=null==(t=c.data.current)?void 0:t.raw_code,k=null!=(a=null!=(o=null==(r=c.data.base)?void 0:r.name)?o:null==(s=c.data.current)?void 0:s.name)?a:"";return(0,i.jsxs)(l.a,{className:"no-track-pii-safe",style:{position:"relative"},height:"100%",onMouseEnter:()=>{p(!0)},onMouseLeave:()=>{p(!1)},children:[g?(0,i.jsx)(eG,{language:"sql",theme:"light",value:null!=b?b:"",options:y}):(0,i.jsx)(eL.zC,{language:"sql",theme:"light",original:b,modified:w,options:{...v,renderSideBySide:!1}}),(0,i.jsx)(A.K,{onClick:u,size:"md","aria-label":"Expand",variant:"ghost",style:{position:"absolute",top:"5px",right:"20px",opacity:x?.5:.1,transition:"opacity 0.3s ease-in-out"},children:(0,i.jsx)(ef.xKl,{})}),(0,i.jsx)(N.Dz,{open:d,onOpenChange:h,size:"xl",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{overflowY:"auto",height:"75%",children:[(0,i.jsxs)(N.c7,{children:[g?(0,i.jsxs)(N.L3,{children:[(0,i.jsx)("code",{children:k})," Model Code"]}):(0,i.jsxs)(N.L3,{children:[(0,i.jsx)("code",{children:k})," Model Code Diff"]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]}),(0,i.jsx)(N.R4,{children:g?(0,i.jsx)(eL.KE,{language:"sql",theme:"light",value:null!=b?b:"",options:{...y,fontSize:16}}):(0,i.jsx)(eL.zC,{language:"sql",theme:"light",original:b,modified:w,options:{...v,fontSize:16}})})]})})]})})]})};function tt(e,n){let t=(0,U.Z)(e,n);if(0===t.length)return[];if(0===e.length||0===n.length)return t.map((e,n)=>n===t.length-1?e:e+",");let i="";return t.forEach(t=>{e.includes(t)&&n.includes(t)&&(i=t)}),t.map((l,r)=>{let s;return(s=e.includes(l)?n.includes(l)?l:"--- ".concat(l," (Removed)"):"--- ".concat(l," (Added)"),l===i||r===t.length-1)?s:s+","})}function ti(e){var n,t,r,o;let{node:a,onCloseNode:d}=e,[,u]=(0,eE.zy)(),{setSqlQuery:f,setPrimaryKeys:g}=(0,nv.vr)(),v="model"===a.resourceType||"seed"===a.resourceType||"source"===a.resourceType||"snapshot"===a.resourceType,{open:y,onOpen:w,onClose:k}=(0,T.j)(),{open:C,onClose:_}=(0,T.j)({defaultOpen:!0}),{runAction:S}=(0,G.tr)(),{envInfo:z,isActionAvailable:E}=(0,H.cE)(),{primaryKey:D}=(0,ny.Ay)(a.name),I=()=>{S("row_count",{node_names:[a.name]},{showForm:!1,showLast:!1})},R=()=>{S("row_count_diff",{node_names:[a.name]},{showForm:!1,showLast:!1})},{featureToggles:N,singleEnv:F}=(0,ee.c)(),A="metadata only"===N.mode,O=(0,j.useCallback)(async()=>{let e=a.id,n=await nb({node_id:e});u("/checks/".concat(n.check_id))},[a,u]),X=(e,n)=>e?nw.add_or_remove:E(n)?"":"This action is not supported yet.",K="added"===a.changeStatus||"removed"===a.changeStatus,Q=Object.keys(null!=(r=null==(n=a.data.base)?void 0:n.columns)?r:{}),W=Object.keys(null!=(o=null==(t=a.data.current)?void 0:t.columns)?o:{});return(0,i.jsxs)(ng.x,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(h.D,{size:"sm",className:"no-track-pii-safe",children:a.name})}),(0,i.jsx)(p.h,{}),F?(0,i.jsx)(function(){var e,n,t;let l=tt(Q,W),r='select * from {{ ref("'.concat(a.name,'") }}');return(l.length&&(r="select \n ".concat(l.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}')),"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType)?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"xs",variant:"outline",children:["Explore ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsxs)(q.Dr,{value:"label",fontSize:"14px",onClick:()=>{(null==z?void 0:z.adapterType)==="dbt"?f(r):(null==z?void 0:z.adapterType)==="sqlmesh"&&f("select * from ".concat(a.name)),u("/query")},children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("query"))?void 0:e.icon})," Query"]}),(0,i.jsxs)(q.Dr,{value:"row-count",fontSize:"14px",onClick:()=>{I()},children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count"))?void 0:n.icon})," Row Count"]}),(0,i.jsx)(el.m,{content:X(K,"profile"),positioning:{placement:"left"},children:(0,i.jsxs)(q.Dr,{value:"profile",fontSize:"14px",disabled:K,onClick:()=>{S("profile",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("profile"))?void 0:t.icon})," Profile"]})})]})})})]})},{}):(0,i.jsx)(function(){var e,n,t,l,r,o,c,d;let h=tt(Q,W),x='select * from {{ ref("'.concat(a.name,'") }}');h.length&&(x="select \n ".concat(h.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}'));let p=(e,n)=>{if(A)return(0,i.jsx)(no,{display:!0,children:e});let t=X(K,n);return(0,i.jsx)(el.m,{disabled:""===t,content:t,positioning:{placement:"left"},children:e})};return"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",variant:"outline",disabled:N.disableNodeActionDropdown,children:["Explore ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"query",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{(null==z?void 0:z.adapterType)==="dbt"?f(x):(null==z?void 0:z.adapterType)==="sqlmesh"&&f("select * from ".concat(a.name)),E("query_diff_with_primary_key")&&g(void 0!==D?[D]:void 0),u("/query")},children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("query_diff"))?void 0:e.icon})," Query"]})}),(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"sandbox",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{E("query_diff_with_primary_key")&&g(void 0!==D?[D]:void 0),w(),(0,b.In)({action:"explore",node:a.name})},children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("sandbox"))?void 0:n.icon})," Sandbox (Experiment)"]})}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",p:"0",children:[(0,i.jsx)(q.QC,{children:"Diff"}),(0,i.jsx)(no,{display:A,children:(0,i.jsxs)(q.Dr,{value:"row-count-diff",fontSize:"14px",disabled:N.disableDatabaseQuery,onClick:()=>{R()},children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("row_count_diff"))?void 0:t.icon})," Row Count Diff"]})}),p((0,i.jsxs)(q.Dr,{value:"profile-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("profile_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(l=(0,e_.C)("profile_diff"))?void 0:l.icon})," Profile Diff"]}),"profile_diff"),p((0,i.jsxs)(q.Dr,{value:"value-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("value_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,i.jsx)(s.I,{as:null==(r=(0,e_.C)("value_diff"))?void 0:r.icon})," Value Diff"]}),"value_diff"),p((0,i.jsxs)(q.Dr,{value:"top-k-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("top_k_diff",{model:a.name,column_name:"",k:50},{showForm:!0})},children:[(0,i.jsx)(s.I,{as:null==(o=(0,e_.C)("top_k_diff"))?void 0:o.icon})," Top-K Diff"]}),"top_k_diff"),p((0,i.jsxs)(q.Dr,{value:"histogram-diff",fontSize:"14px",disabled:K||N.disableDatabaseQuery,onClick:()=>{S("histogram_diff",{model:a.name,column_name:"",column_type:""},{showForm:!0})},children:[(0,i.jsx)(s.I,{as:null==(c=(0,e_.C)("histogram_diff"))?void 0:c.icon})," Histogram Diff"]}),"histogram_diff")]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",p:"4px 12px",children:[(0,i.jsx)(q.QC,{children:"Add to Checklist"}),(0,i.jsxs)(q.Dr,{value:"schema-diff",fontSize:"14px",onClick:()=>{O()},children:[(0,i.jsx)(s.I,{as:null==(d=(0,e_.C)("schema_diff"))?void 0:d.icon})," Schema Diff"]})]})]})})})]})},{}),(0,i.jsx)(l.a,{flex:"0 1 1%",children:(0,i.jsx)(P.J,{size:"2xs",onClick:d})})]}),(0,i.jsx)(l.a,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(x.z,{gap:"8px",children:[(0,i.jsx)(na,{node:a}),("model"===a.resourceType||"snapshot"===a.resourceType||"seed"===a.resourceType)&&(F?(0,i.jsx)(nu,{node:a,onRefresh:I}):(0,i.jsx)(nd,{node:a,onRefresh:R}))]})}),v&&(0,i.jsxs)(m.pK,{defaultValue:"columns",overflow:"auto",children:[F&&C&&(0,i.jsx)(l.a,{p:"12px",children:(0,i.jsx)(nq,{onClose:_,align:"flex-start",children:(0,i.jsxs)(c.E,{children:["Enable the Recce Checklist and start adding checks for better data validation and review.",(0,i.jsx)("br",{}),(0,i.jsx)(nA,{})]})})}),(0,i.jsxs)(m.j7,{children:[(0,i.jsx)(m.Xi,{value:"columns",children:"Columns"}),(0,i.jsx)(m.Xi,{value:"code",children:"Code"})]}),(0,i.jsxs)(m.T$,{overflow:"auto",height:"calc(100% - 42px)",children:[(0,i.jsx)(m.av,{value:"columns",p:0,overflowY:"auto",height:"100%",children:F?(0,i.jsx)(ed,{current:a.data.current}):(0,i.jsx)(ec,{base:a.data.base,current:a.data.current})}),(0,i.jsx)(m.av,{value:"code",height:"100%",p:0,children:(0,i.jsx)(tn,{node:a})})]})]}),(0,i.jsx)(te,{isOpen:y,onClose:k,current:a.data.current})]})}function tl(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=et();return(0,i.jsx)(l.a,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(x.z,{p:"5px 15px",mt:"4",separator:(0,i.jsx)(e3.k,{borderColor:"gray.200"}),gap:4,children:[(0,i.jsxs)(l.a,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null==(t=o.currentRun)||null==(n=t.progress)?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)(M.$,{size:"xs",variant:"outline",onClick:s,loading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(x.z,{children:(0,i.jsx)(M.$,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var tr=t(53835),ts=t(83576);function to(){let{isHistoryOpen:e,setHistoryOpen:n,showHistory:t,closeHistory:r}=(0,G.tr)();if(!e)return(0,i.jsxs)(l.a,{children:[(0,i.jsx)(l.a,{fontSize:"8pt",children:"History"}),(0,i.jsxs)(M.$,{size:"2xs",variant:"outline",onClick:()=>{(0,b.iZ)({name:"show"}),t()},children:[(0,i.jsx)(B.XVG,{})," Show"]})]})}let ta=()=>(0,i.jsxs)(E.T,{align:"start",gap:0,children:[(0,i.jsx)(c.E,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(c.E,{fontSize:"8pt",children:[(0,i.jsx)(o.C,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),tc=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et(),o=null!=(n=l.view_mode)?n:"changed_models";return(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{minWidth:"100px",size:"2xs",variant:"outline",disabled:t,children:[(0,i.jsx)(s.I,{as:ek("model").icon})," ","changed_models"===o?"Changed Models":"All"," ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsxs)(q.x0,{value:o,onValueChange:e=>{var n;n=e.value,r({...l,view_mode:n})},children:[(0,i.jsx)(q.QC,{children:"mode"}),(0,i.jsxs)(q.iD,{value:"changed_models",children:["Changed Models",(0,i.jsx)(q.S3,{})]}),(0,i.jsxs)(q.iD,{value:"all",children:["All",(0,i.jsx)(q.S3,{})]})]})})})})]})},td=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=(0,H.cE)(),{viewOptions:o,onViewOptionsChanged:a}=et(),c=new Set;for(let e of Object.values(null!=(t=null==r?void 0:r.nodes)?t:{}))e.packageName&&c.add(e.packageName);let d=null==r||null==(n=r.manifestMetadata.current)?void 0:n.project_name,u=o.packages?new Set(o.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,p=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages");return(0,i.jsxs)(q.il,{closeOnSelect:!1,children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{minWidth:"100px",size:"2xs",variant:"outline",disabled:l,children:[(0,i.jsx)(s.I,{as:nn.est})," ",p," ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsxs)(q.Uh,{children:[(0,i.jsx)(q.QC,{children:"Select Packages"}),(0,i.jsx)(q.Dr,{value:"",asChild:!0,children:(0,i.jsxs)(tr.y8,{checked:h||x?h:"indeterminate",onCheckedChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(c)})},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{children:"Select All"})]})}),(0,i.jsx)(q.bX,{}),Array.from(c).map(e=>(0,i.jsx)(q.Dr,{value:e,children:(0,i.jsxs)(tr.y8,{checked:u.has(e),onCheckedChange:()=>{(e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})})(e)},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{className:"no-track-pii-safe",children:e})]})},e))]})})})})]})},tu=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=(0,n8.T)(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(el.m,{contentProps:{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",color:"black",backgroundColor:"white"},content:e.tooltipComponent,positioning:{placement:"bottom-start"},closeOnClick:!1,disabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(W.p,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",disabled: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)}})})},th=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et();return(0,i.jsx)(tu,{isDisabled:t,value:null!=(n=l.select)?n:"",onChange:e=>{r({...l,select:e||void 0})},tooltipComponent:(0,i.jsx)(ta,{})})},tx=e=>{var n;let{isDisabled:t}=e,{viewOptions:l,onViewOptionsChanged:r}=et();return(0,i.jsx)(tu,{isDisabled:t,value:null!=(n=l.exclude)?n:"",onChange:e=>{r({...l,exclude:e||void 0})}})},tp=e=>(0,i.jsxs)(l.a,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.a,{fontSize:"8pt",children:e.label||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),tm=()=>{var e,n,t,l,r;let{deselect:o,focusedNode:a,selectedNodes:d,...u}=et(),{featureToggles:h}=(0,ee.c)(),{data:m}=(0,n8.T)(),f=null==m?void 0:m.single_env_onboarding,j=d.length>0,g=!a&&!j;return(0,i.jsx)(x.z,{width:"100%",padding:"4pt 8pt",className:"chakra-style-reset",children:(0,i.jsxs)(x.z,{flex:"1",children:[(0,i.jsx)(to,{}),(0,i.jsx)(tp,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(tc,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(td,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(th,{isDisabled:j})}),(0,i.jsx)(tp,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(tx,{isDisabled:j})}),(0,i.jsx)(p.h,{}),j&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tp,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(c.E,{fontSize:"9pt",color:"gray.500",children:d.length>1?"".concat(d.length," nodes selected"):"".concat(d.length," node selected")})}),(0,i.jsx)(tp,{label:"",children:(0,i.jsx)(M.$,{variant:"outline",size:"2xs",fontSize:"9pt",onClick:()=>{o()},children:"Deselect"})}),f&&(0,i.jsx)(tp,{label:"Explore",children:(0,i.jsx)(ts.e,{attached:!0,variant:"outline",children:(0,i.jsxs)(q.il,{positioning:{placement:"bottom-end"},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",children:["Actions ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{children:(0,i.jsx)(q.Dr,{value:"row-count",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runRowCount()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(e=(0,e_.C)("row_count_diff"))?void 0:e.icon})," Row Count"]})})})})})]})})})]}),!f&&(0,i.jsx)(tp,{label:"Explore",children:(0,i.jsx)(ts.e,{attached:!0,variant:"outline",children:(0,i.jsxs)(q.il,{positioning:{placement:"bottom-end"},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsxs)(M.$,{size:"2xs",disabled:h.disableViewActionDropdown,children:["Actions ",(0,i.jsx)(nl.RQe,{})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsxs)(q.Uh,{m:"0",p:"4px 12px",children:[(0,i.jsx)(q.QC,{children:"Diff"}),(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(q.Dr,{value:"row-count-diff",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runRowCountDiff()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(n=(0,e_.C)("row_count_diff"))?void 0:n.icon})," Row Count Diff"]})})}),(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(q.Dr,{value:"value-diff",disabled:h.disableDatabaseQuery,onClick:async()=>{await u.runValueDiff()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(t=(0,e_.C)("value_diff"))?void 0:t.icon})," Value Diff"]})})})]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Uh,{m:"0",px:"12px",children:[(0,i.jsx)(q.QC,{children:"Add to Checklist"}),(0,i.jsx)(q.Dr,{value:"lineage-diff",disabled:!(g||j&&d.length>1),onClick:()=>{u.addLineageDiffCheck(u.viewOptions.view_mode)},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(l=(0,e_.C)("lineage_diff"))?void 0:l.icon})," Lineage Diff"]})}),(0,i.jsx)(q.Dr,{value:"schema-diff",disabled:!1,onClick:()=>{u.addSchemaDiffCheck()},children:(0,i.jsxs)(c.E,{textStyle:"sm",children:[(0,i.jsx)(s.I,{as:null==(r=(0,e_.C)("schema_diff"))?void 0:r.icon})," Schema Diff"]})})]})]})})})]})})})]})})};var tf=t(53169);async function tj(e){return(await v.g.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function tg(){return(0,i.jsx)(l.a,{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:o}=ew(n);return(0,i.jsx)(el.m,{content:l,positioning:{placement:"right"},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.I,{color:o,as:r})," ",t]})},n)})})}var tv=t(50369);let ty={mode:"per_node",status:"pending",completed:0,total:0,actions:{}},tb=function(){let{open:e,onOpen:n,onClose:t}=(0,T.j)(),[r,s]=(0,j.useState)(0),[o,a]=(0,j.useState)(),c=(0,j.useRef)(null),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{a(()=>e),n()})),[n]),h=()=>{null==o||o(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(N.Dz,{size:"xl",open:e,role:"alertdialog",initialFocusEl:()=>c.current,onOpenChange:h,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsxs)(N.L3,{children:["Value Diff on ",r," nodes"]})}),(0,i.jsx)(N.R4,{gap:"20px",as:d.s,direction:"column",children:(0,i.jsxs)(l.a,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(N.Es,{gap:1,children:[(0,i.jsx)(M.$,{ref:c,onClick:h,variant:"outline",colorPalette:"gray",children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"iochmara",onClick:()=>{null==o||o(!0),t()},ml:3,children:"Execute"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})}},tw=e=>{let{changeStatus:n}=e;if(!n)return(0,i.jsx)(i.Fragment,{});let{color:t,icon:l}=ew(n);return(0,i.jsx)(s.I,{boxSize:"14px",display:"inline-flex",color:t,as:l})},tk=e=>{let{transformationType:n,legend:t}=e,l="U",r="red";return("passthrough"===n?(l="P",r="gray"):"renamed"===n?(l="R",r="orange"):"derived"===n?(l="D",r="orange"):"source"===n?(l="S",r="blue"):(l="U",r="red"),n)?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(F.f8,{fontSize:"8pt",size:"sm",colorPalette:r,borderRadius:"full",paddingX:"4px",children:(0,i.jsx)(F.d1,{children:l})})}):(0,i.jsx)(i.Fragment,{})},tC=()=>{let{lineageGraph:e}=(0,H.cE)(),{centerNode:n,viewOptions:t,cll:l}=et(),r=t.column_level_lineage;if(!e)return(0,i.jsx)(i.Fragment,{});if(!r)return"Default View";if(void 0===r.node_id)return(0,i.jsx)(c.E,{as:"span",children:"Impact Radius for All Changed Models"});let s=r.node_id in e.nodes?e.nodes[r.node_id].name:r.node_id;if(r.column){let e="".concat(r.node_id,"_").concat(r.column);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.E,{as:"span",mr:"5px",children:["Column Lineage for"," "]}),(0,i.jsxs)(o.C,{onClick:()=>{n(e)},cursor:"pointer",children:[s,".",r.column]})]})}{let e=r.node_id;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.E,{as:"span",mr:"5px",children:"Impact Radius for"}),(0,i.jsx)(o.C,{onClick:()=>{n(e)},cursor:"pointer",children:s})]})}},t_=e=>{var n;let{action:t}=e,{showColumnLevelLineage:r,resetColumnLevelLineage:o,interactive:a,viewOptions:u}=et(),{data:h}=(0,n8.T)(),x=null!=(n=null==h?void 0:h.single_env_onboarding)&&n,{lineageGraph:p}=(0,H.cE)(),m=!(null==p?void 0:p.catalogMetadata.current);return(0,i.jsxs)(d.s,{direction:"row",gap:"5px",children:[!x&&(0,i.jsx)(l.a,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",children:(0,i.jsx)(el.m,{openDelay:50,content:"Please provide catalog.json to enable Impact Radius",disabled:!m,positioning:{placement:"top"},children:(0,i.jsxs)(M.$,{size:"sm",variant:"ghost",whiteSpace:"nowrap",display:"inline-flex",disabled:!a||m,onClick:()=>{r({no_upstream:!0,change_analysis:!0})},children:[(0,i.jsx)(ef.JwZ,{})," Impact Radius"]})})}),u.column_level_lineage&&(0,i.jsxs)(d.s,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",fontSize:"0.8rem",p:"0 0.625rem",alignItems:"center",children:[(0,i.jsx)(tC,{}),t.isError&&(0,i.jsx)(el.m,{content:"Error: ".concat(t.error.message),positioning:{placement:"bottom"},children:(0,i.jsx)(c.E,{as:"span",color:"red.500",ml:"2px",display:"inline-flex",alignItems:"center",children:(0,i.jsx)(s.I,{as:nl.GLE,color:"red.500",boxSize:"14px"})})}),t.isPending?(0,i.jsx)(J.y,{size:"xs",ml:"2px"}):(0,i.jsx)(A.K,{variant:"ghost",size:"xs",ml:"2px","aria-label":"Reset Column Level Lineage",onClick:()=>{o()},children:(0,i.jsx)(nl.yBK,{size:"10px"})})]})]})};function tS(){return(0,i.jsx)(l.a,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({passthrough:["Pass Through","The column is directly selected from the upstream table."],renamed:["Renamed","The column is selected from the upstream table but with a different name."],derived:["Derived","The column is created through transformations applied to upstream columns, such as calculations, conditions, functions, or aggregations."],source:["Source","The column is not derived from any upstream data. It may originate from a seed/source node, literal value, or data generation function."],unknown:["Unknown","We have no information about the transformation type. This could be due to a parse error, or other unknown reason."]}).map(e=>{let[n,[t,l]]=e;return(0,i.jsx)(el.m,{content:l,positioning:{placement:"right"},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(tk,{legend:!0,transformationType:n})," ",t]})},n)})})}let tz={lineageNotificationDismissed:"".concat("recce","-lineage-notification-dismissed")};function tE(e){let{notification:n,type:t}=e,l=tz.lineageNotificationDismissed,[r,s]=(0,j.useState)(!0);return((0,j.useEffect)(()=>{"true"===sessionStorage.getItem(l)&&s(!1)},[l]),null!==n&&r)?(0,i.jsxs)(d.s,{w:"100%",direction:"row",p:"5px 10px",gap:"5px",alignItems:"flex-start",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:{info:"blue.50",success:"green.50",warning:"yellow.50",error:"red.50"}[t],children:[n,(0,i.jsx)(p.h,{}),(0,i.jsx)(P.J,{onClick:()=>{sessionStorage.setItem(l,"true"),s(!1)}})]}):null}function tD(){return(0,i.jsx)(d.s,{flex:"1",h:"100%",minH:0,m:"2",p:"4",bg:"blue.50",borderRadius:"lg",boxShadow:"md",justifyContent:"center",children:(0,i.jsxs)(d.s,{w:"80%",direction:"column",overflowY:"auto",gap:6,px:8,pb:8,children:[(0,i.jsxs)(d.s,{direction:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(d.s,{p:2,bg:"white",borderRadius:"full",alignItems:"center",justifyContent:"center",boxShadow:"md",children:(0,i.jsx)(s.I,{as:nt.JVA,boxSize:7,color:"blue.500"})}),(0,i.jsx)(h.D,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,i.jsxs)(c.E,{fontSize:"md",textAlign:"center",children:["Recce is currently running in"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"limited functionality mode"})," ","so you can run queries but"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"can't diff the results yet!"})]})]}),(0,i.jsxs)(d.s,{direction:"column",gap:2,children:[(0,i.jsx)(c.E,{fontSize:"md",children:"To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison."}),(0,i.jsx)(c.E,{children:"Once configured, you'll be able to:"}),(0,i.jsxs)(em.$z,{children:[(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Run statistical data diffs"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Run query diffs"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"Save checks to your Recce Checklist"})}),(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{children:"...and more!"})})]}),(0,i.jsx)(c.E,{fontSize:"md",children:"Take the next step toward better data impact assessment."})]}),(0,i.jsx)(d.s,{w:"100%",direction:"column",mt:6,children:(0,i.jsx)(M.$,{colorPalette:"blue",size:"lg",onClick:()=>{window.open("https://docs.datarecce.io/get-started/#prepare-dbt-artifacts","_blank")},children:"Start Now"})})]})})}function tI(){return(0,i.jsxs)(d.s,{direction:"row",gap:"10px",alignItems:"flex-start",children:[(0,i.jsx)(s.I,{as:nt.yHN,color:"blue.500",boxSize:"5"}),(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[(0,i.jsxs)(c.E,{fontWeight:"bold",children:["Single Environment Mode"," ",(0,i.jsx)(c.E,{color:"red",as:"span",children:"Limited Functionality"})]}),(0,i.jsx)(c.E,{fontSize:"sm",children:"Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments."}),(0,i.jsx)(c.E,{fontSize:"sm",children:"To set up full environment comparison:"}),(0,i.jsxs)(em.$z,{ps:"4",children:[(0,i.jsx)(em.ck,{children:(0,i.jsx)(c.E,{fontSize:"sm",children:"Run `recce debug` for setup assistance"})}),(0,i.jsx)(em.ck,{children:(0,i.jsxs)(c.E,{fontSize:"sm",children:["Visit"," ",(0,i.jsx)(r.N,{color:"blue.500",fontSize:"sm",fontWeight:"medium",target:"_blank",href:"https://docs.datarecce.io/configure-diff/",children:"docs"})," ","for configuration details"]})})]})]})]})}async function tR(e){return(await v.g.post("/api/cll",e)).data}var tT=t(48230);let tN=e=>{let{menuItems:n,open:t,onClose:l,x:r,y:s}=e,{featureToggles:o}=(0,ee.c)();return(0,i.jsx)(q.il,{open:t,onOpenChange:l,children:(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsx)(q.rm,{fontSize:"10pt",position:"absolute",width:"250px",style:{left:"".concat(r,"px"),top:"".concat(s,"px")},children:0===n.length?(0,i.jsx)(q.Dr,{value:"no-action",disabled:!0,children:"No action available"},"no action"):n.map(e=>{let{isSeparator:n,label:t,isDisabled:r,action:s,itemIcon:a}=e;if(n)return(0,i.jsx)(q.bX,{},t);{let e=(0,i.jsxs)(q.Dr,{value:String(t),disabled:r,onClick:()=>{s&&s(),l()},children:[a," ",t]},t);return r?(0,i.jsx)(no,{display:"metadata only"===o.mode,children:e}):e}})})})})})},tF=e=>{var n,t,l,r,o,a,c,d,u,h,x;let{isOpen:p,onClose:m,x:f,y:j,node:g}=e,v=[],{selectParentNodes:y,selectChildNodes:b,getNodeColumnSet:w,selectMode:k,cll:C,showColumnLevelLineage:_}=et(),{runAction:S}=(0,G.tr)(),{featureToggles:z}=(0,ee.c)(),{isActionAvailable:E}=(0,H.cE)(),{data:D}=(0,n8.T)(),{lineageGraph:I}=(0,H.cE)(),R=!(null==I?void 0:I.catalogMetadata.current),T=null!=(t=null==D?void 0:D.single_env_onboarding)&&t,N=z.disableDatabaseQuery,{primaryKey:F}=(0,ny.Ay)(null==g||null==(n=g.data)?void 0:n.name),{setSqlQuery:q,setPrimaryKeys:A}=(0,nv.vr)(),[,L]=(0,eE.zy)();if(!(null==g?void 0:g.data))return(0,i.jsx)(i.Fragment,{});let M=g.data,O=M.resourceType,P=Array.from(w(g.id)),X={source:"lineage_model_node"};if("modified"===M.changeStatus&&v.push({label:"Show Impact Radius",itemIcon:(0,i.jsx)(ef.JwZ,{}),isDisabled:R,action:()=>{_({node_id:g.id,change_analysis:!0,no_upstream:!0})}}),!k&&O&&["model","seed","snapshot"].includes(O)){v.length>0&&v.push({label:"select group one",isSeparator:!0});let e=(0,e_.C)(T?"query":"query_diff"),n=tt(Object.keys(null!=(o=null==(l=M.data.base)?void 0:l.columns)?o:{}),Object.keys(null!=(a=null==(r=M.data.current)?void 0:r.columns)?a:{})),t='select * from {{ ref("'.concat(M.name,'") }}');if(n.length&&(t="select \n ".concat(n.join("\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),v.push({label:"Query",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q(t),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}}),P.length>0)if(void 0!==C){let n=new Set;F&&n.add(F),P.forEach(e=>{n.add(e)}),v.push({label:"Query Related Columns",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q("select \n ".concat(Array.from(n).join(",\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}})}else{let n=Object.entries(null!=(d=null==(c=M.change)?void 0:c.columns)?d:{}).filter(e=>{let[,n]=e;return"modified"===n}).map(e=>{let[n]=e;return n});if(n.length>0){let t=new Set;F&&t.add(F),n.forEach(e=>{t.add(e)}),v.push({label:"Query Modified Columns",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{q("select \n ".concat(Array.from(t).join(",\n "),'\nfrom {{ ref("').concat(M.name,'") }}')),E("query_diff_with_primary_key")&&A(void 0!==F?[F]:void 0),L("/query")}})}}e=(0,e_.C)(T?"row_count":"row_count_diff"),v.push({label:null!=(u=null==e?void 0:e.title)?u:"Row count",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{S(T?"row_count":"row_count_diff",{node_names:[M.name]},{showForm:!1,trackProps:X})}}),e=(0,e_.C)(T?"profile":"profile_diff"),v.push({label:null!=(h=null==e?void 0:e.title)?h:"Profile",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{let e=Array.from(w(g.id));S(T?"profile":"profile_diff",{model:M.name,columns:e},{showForm:!0,trackProps:X})}}),T||(e=(0,e_.C)("value_diff"),v.push({label:null!=(x=null==e?void 0:e.title)?x:"Value Diff",itemIcon:(0,i.jsx)(s.I,{as:null==e?void 0:e.icon}),isDisabled:N,action:()=>{let e=Array.from(w(g.id));S("value_diff",{model:M.name,columns:e},{showForm:!0,trackProps:X})}}))}return T||(v.length>0&&v.push({label:"select group two",isSeparator:!0}),v.push({label:"Select Parent Nodes",itemIcon:(0,i.jsx)(tT.iXB,{}),action:()=>{y(g.id,1)}}),v.push({label:"Select Child Nodes",itemIcon:(0,i.jsx)(tT.pnF,{}),action:()=>{b(g.id,1)}}),v.push({label:"Select All Upstream Nodes",itemIcon:(0,i.jsx)(tT.iXB,{}),action:()=>{y(g.id)}}),v.push({label:"Select All Downstream Nodes",itemIcon:(0,i.jsx)(tT.pnF,{}),action:()=>{b(g.id)}})),(0,i.jsx)(tN,{x:f,y:j,menuItems:v,open:p,onClose:m})},tq=e=>{var n,t,l,r,o,a,c,d;let{isOpen:u,onClose:h,x,y:p,node:m}=e,f=[],{runAction:j}=(0,G.tr)(),{isActionAvailable:g}=(0,H.cE)(),{featureToggles:v}=(0,ee.c)(),{data:y}=(0,n8.T)(),b=null!=(o=null==y?void 0:y.single_env_onboarding)&&o,w=v.disableDatabaseQuery;if((null==m?void 0:m.data)===void 0)return(0,i.jsx)(i.Fragment,{});let k=m.data,C=k.node,_=k.column,S=k.type,z={source:"lineage_column_node"},E=(null==(t=C.data.base)||null==(n=t.columns)?void 0:n[_])===void 0||(null==(r=C.data.current)||null==(l=r.columns)?void 0:l[_])===void 0,D=(0,e_.C)(b?"profile":"profile_diff");return f.push({label:null!=(a=null==D?void 0:D.title)?a:"Profile",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("profile_diff",{model:C.name,columns:[_]},{showForm:!1,trackProps:z})},isDisabled:E||!g("profile_diff")||w}),b||(D=(0,e_.C)("histogram_diff"),f.push({label:null!=(c=null==D?void 0:D.title)?c:"Histogram Diff",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("histogram_diff",{model:C.name,column_name:_,column_type:S},{showForm:!1,trackProps:z})},isDisabled:E||!S||!(0,Y.c)(S)||w}),D=(0,e_.C)("top_k_diff"),f.push({label:null!=(d=null==D?void 0:D.title)?d:"Top-K Diff",itemIcon:(0,i.jsx)(s.I,{as:null==D?void 0:D.icon}),action:()=>{j("top_k_diff",{model:C.name,column_name:_,k:50},{showForm:!1,trackProps:z})},isDisabled:E||w})),(0,i.jsx)(tN,{x:x,y:p,menuItems:f,open:u,onClose:h})},tA=e=>{let{isOpen:n,onClose:t,x:l,y:r,node:s}=e,{featureToggles:o}=(0,ee.c)();return o.disableViewActionDropdown?(0,i.jsx)(tN,{menuItems:[],open:n,onClose:t,x:l,y:r}):(null==s?void 0:s.type)==="customNode"?(0,i.jsx)(tF,{x:l,y:r,isOpen:n,onClose:t,node:s}):(null==s?void 0:s.type)==="customColumnNode"?(0,i.jsx)(tq,{x:l,y:r,isOpen:n,onClose:t,node:s}):void 0};function tL(){let{featureToggles:e}=(0,ee.c)();return"metadata only"!==e.mode?null:(0,i.jsx)("div",{className:"flex items-center w-full px-2 py-0.5 bg-cyan-50",children:(0,i.jsxs)(x.z,{flex:"1",fontSize:"sm",color:"cyan.600",children:[(0,i.jsx)(nl.GLE,{}),(0,i.jsx)(c.E,{children:"Query functions disabled without a data warehouse connection."}),(0,i.jsx)(M.$,{bgColor:"iochmara.400",size:"2xs",onClick:()=>{window.open(nr.Q,"_blank")},children:"Connect to Data Warehouse"})]})})}let tM={customNode:function(e){var n,t,r,o;let{data:a}=e,{id:c,resourceType:u,changeStatus:h}=a,m=(0,e8.Pj)(e=>e.transform[2]>.3),{icon:f}=ek(u),[g,v]=(0,j.useState)(!1),{interactive:y,selectNode:b,selectMode:w,focusedNode:k,getNodeAction:C,getNodeColumnSet:_,isNodeHighlighted:S,isNodeSelected:z,isNodeShowingChangeAnalysis:E,showContextMenu:D,viewOptions:R,cll:T,showColumnLevelLineage:N}=et(),F=null==T||null==(n=T.current.nodes[c])?void 0:n.change_category,q=S(c),A=z(c),L=(null==(t=R.column_level_lineage)?void 0:t.node_id)===c&&void 0===R.column_level_lineage.column,M=(null==k?void 0:k.id)===c||L,O=E(c),{icon:P,color:X,backgroundColor:K}=h?ew(h):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},Q=a.name,W=_(a.id),$=W.size>0,V="action_result"===w?C(a.id):void 0,Z=m?"selecting"===w?A?X:"white":"action_result"!==w?M||A||g?K:"white":V?M||A||g?K:X:"white":M||A||g?X:K,H="selecting"===w?A?"white":"inherit":"action_result"===w&&V&&!A?"white":"inherit",U="selecting"===w?A?"white":"inherit":"action_result"===w&&V&&!A?"white":"inherit",G="selecting"===w?A?"white":X:"action_result"===w?V&&!A?"white":"inherit":X;return(0,i.jsxs)(d.s,{cursor:"selecting"===w?"pointer":"inherit",direction:"column",width:"300px",transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===w?V?"none":"opacity(0.2) grayscale(50%)":q||M||A||g?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},children:[(0,i.jsxs)(d.s,{borderColor:X,borderWidth:"2px",borderTopRadius:8,borderBottomRadius:8*!$,backgroundColor:Z,height:"60px",children:[(0,i.jsx)(d.s,{bg:X,padding:y?"8px":"2px",borderRightWidth:"2px",borderColor:"selecting"===w?"#00000020":X,alignItems:"top",visibility:m?"inherit":"hidden",children:y&&(0,i.jsx)(nf,{checked:"selecting"===w&&A||"action_result"===w&&!!V,onClick:e=>{"action_result"!==w&&(e.stopPropagation(),b(a.id))}})}),(0,i.jsxs)(d.s,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(d.s,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(nj,{name:Q,color:H,resourceType:u}),g?(0,i.jsxs)(i.Fragment,{children:["modified"===h&&(0,i.jsx)(el.m,{content:"Show Impact Radius",positioning:{placement:"top"},openDelay:500,children:(0,i.jsx)(I.o,{children:(0,i.jsx)(s.I,{boxSize:"14px",as:ef.JwZ,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:e=>{e.preventDefault(),e.stopPropagation(),N({node_id:c,change_analysis:!0,no_upstream:!0})}})})}),(0,i.jsx)(s.I,{as:B.EUt,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),D(n,e)}})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.I,{boxSize:"16px",color:U,as:f}),h&&(0,i.jsx)(s.I,{color:G,as:P})]})]}),(0,i.jsx)(d.s,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsx)(x.z,{gap:"8px",children:V?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.h,{}),(0,i.jsx)(nh,{node:a,action:V})]}):O?(0,i.jsx)(l.a,{height:"20px",color:"gray",fontSize:"9pt",margin:0,fontWeight:600,children:F?np[F]:""}):"action_result"!==w&&"model"===a.resourceType?(0,i.jsx)(nm,{id:a.id,inverted:"selecting"===w&&!!A}):(0,i.jsx)(i.Fragment,{})})})]})]}),$&&(0,i.jsx)(l.a,{p:"10px 10px",borderColor:X,borderWidth:"2px",borderTopWidth:0,borderBottomRadius:8,children:(0,i.jsx)(l.a,{height:"".concat(W.size*e4.$M,"px"),overflow:"auto"})}),Object.keys(null!=(r=a.parents)?r:{}).length>0&&(0,i.jsx)(e8.h7,{type:"target",position:e8.yX.Left,isConnectable:!1}),Object.keys(null!=(o=a.children)?o:{}).length>0&&(0,i.jsx)(e8.h7,{type:"source",position:e8.yX.Right,isConnectable:!1})]})},customColumnNode:function(e){var n,t;let{id:r,data:o}=e,{id:a}=o.node,{column:c,type:u,transformationType:h,changeStatus:x}=o,m=(0,e8.Pj)(e=>e.transform[2]>.3),{viewOptions:f,showContextMenu:g,isNodeHighlighted:v,isNodeShowingChangeAnalysis:y}=et(),b=null==(n=f.column_level_lineage)?void 0:n.node_id,w=c===(null==(t=f.column_level_lineage)?void 0:t.column)&&a===b,[k,C]=j.useState(!1),_=v(r),S=y(a);return m?(0,i.jsxs)(d.s,{width:"280px",padding:"0px 10px",border:"1px solid gray",backgroundColor:w?"#f0f0f0":"inherit",_hover:{backgroundColor:"#f0f0f0"},onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)},filter:_?"none":"opacity(0.2) grayscale(50%)",cursor:"pointer",children:[(0,i.jsxs)(d.s,{fontSize:"11px",color:"black",width:"100%",gap:"3px",alignItems:"center",height:"".concat(e4.$M-1,"px"),children:[S&&x?(0,i.jsx)(tw,{changeStatus:x}):(0,i.jsx)(tk,{transformationType:h}),(0,i.jsx)(l.a,{height:"".concat(e4.$M+1,"px"),children:c}),(0,i.jsx)(p.h,{}),k?(0,i.jsx)(s.I,{as:B.EUt,boxSize:"14px",display:"inline-flex",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),g(n,e)}}):(0,i.jsx)(l.a,{height:"".concat(e4.$M+1," px"),children:u})]}),(0,i.jsx)(e8.h7,{type:"target",position:e8.yX.Left,isConnectable:!1,style:{left:0,visibility:"hidden"}}),(0,i.jsx)(e8.h7,{type:"source",position:e8.yX.Right,isConnectable:!1,style:{right:0,visibility:"hidden"}})]}):(0,i.jsx)(i.Fragment,{})}},tO=[],tP={customEdge:function(e){let{source:n,target:t,sourceX:l,sourceY:r,targetX:s,targetY:o,sourcePosition:a,targetPosition:c,style:d={},markerEnd:u,data:h}=e,x={...d},{isEdgeHighlighted:p}=et();(null==h?void 0:h.changeStatus)&&(x.stroke=ew(h.changeStatus).hexColor,x.strokeDasharray="5"),p(n,t)||(x.filter="opacity(0.2) grayscale(50%)");let[m]=(0,e8.Fp)({sourceX:l,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:c});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e8.tE,{path:m,markerEnd:u,style:{...x,...d}})})}},tX=e=>e.data.changeStatus?ew(e.data.changeStatus).hexColor:"lightgray",tK=(0,j.forwardRef)(function(e,n){let{interactive:t=!1,...r}=e,o=(0,e8.VH)(),a=(0,j.useRef)(null),{successToast:u,failToast:h}=eN(),{copyToClipboard:x,ImageDownloadModal:p,ref:m}=nR({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{try{return e.classList.contains(nI)}catch(n){if(e.className&&"string"==typeof e.className)return e.className.includes(nI);return!1}},onSuccess:()=>{u("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),h("Failed to copy image to clipboard",e)}}),[f,g,v]=(0,e8.ck)(tO),[y,w,k]=(0,e8.fM)([]),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:D}=(0,H.cE)(),{featureToggles:R,singleEnv:N}=(0,ee.c)(),{runId:F,showRunId:q,closeRunResult:A,runAction:L,isRunResultOpen:O}=(0,G.tr)(),{run:P}=nk(F),[X,K]=(0,j.useState)({...r.viewOptions}),Q=(0,j.useRef)([]).current,[W,$]=(0,j.useState)(void 0),B=(0,Z.n)({mutationFn:tR}),[V,U]=(0,j.useState)({}),Y=e=>f.find(n=>n.data.name===e);(0,j.useImperativeHandle)(n,()=>({copyToClipboard:x}));let et=(0,j.useMemo)(()=>!!C&&C.modifiedSet.length>0,[C]),ei=null!=(ew=X.view_mode)?ew:"changed_models",el=(0,j.useMemo)(()=>f.filter(e=>"customNode"===e.type).map(e=>e.id),[f]),er=(0,j.useMemo)(()=>C?el.map(e=>C.nodes[e]):[],[C,el]),[es,eo]=(0,j.useState)(),ea=es?null==C?void 0:C.nodes[es]:void 0,[ec,ed]=(0,j.useState)(),[eh,ep]=(0,j.useState)(new Set),em=(0,j.useMemo)(()=>C?Array.from(eh).map(e=>C.nodes[e]):[],[C,eh]),ef=((e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...ty}).current,{showRunId:s}=(0,G.tr)(),o=async(n,o,a)=>{r.mode="multi_nodes",r.actions={};let c=r.mode,d=r.actions;t(),r.status="running";let u=[];for(let n of e){let e=o(n);e?(d[n.id]={mode:c,status:"skipped",skipReason:e},i(n)):(d[n.id]={mode:c,status:"pending"},u.push(n))}let h=a(u);try{let{run_id:e}=await (0,eY.AU)(n,h,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await (0,eY.Zc)(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of u)d[e.id]={mode:c,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{r.mode="per_node",r.actions={};let o=r.mode,a=r.actions;for(let n of(t(),r.status="running",e))a[n.id]={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:c}=s(t);if(c)a[t.id]={mode:o,status:"skipped",skipReason:c},i(t);else try{let{run_id:l}=await (0,eY.AU)(n,e,{nowait:!0});for(r.currentRun={run_id:l},a[t.id]={mode:o,status:"running"},i(t);;){let e=await (0,eY.Zc)(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(a[t.id]={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},c=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(r.actions[t.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},d=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(r.actions[t.id]={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)}))},u=async()=>{var e;r.status="canceling",(null==(e=r.currentRun)?void 0:e.run_id)&&await (0,eY.Su)(r.currentRun.run_id)};return{actionState:r,runRowCount:c,runRowCountDiff:d,runValueDiff:async()=>{await a("value_diff",e=>{var n;let t=null==(n=e.data.current)?void 0:n.primary_key;return t?{params:{model:e.name,primary_key:t}}:{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 tj({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await nb({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await nb({node_id:t})}return n},cancel:u,reset:()=>{Object.assign(r,ty)}}})(em.length>0?em:er,{onActionStarted:()=>{ed("action_result")},onActionNodeUpdated:e=>{g(n=>n.map(n=>n.id===e.id?{...n}:n))},onActionCompleted:()=>{}}),ej=(0,j.useMemo)(()=>{if(!C)return new Set;let e=new Set;if(W){for(let[n,t]of Object.entries(W.current.nodes))!1!==t.impacted&&e.add(n);for(let n of Object.keys(W.current.columns))e.add(n)}else e="action_result"===ec?new Set(Object.keys(ef.actionState.actions)):ea?(0,tf.KC)((0,e4.Qf)(C,[ea.id]),(0,e4.Ve)(C,[ea.id])):et?(0,e4.Ve)(C,C.modifiedSet):new Set(el);return new Set(e)},[C,W,ec,ea,et,ef.actionState.actions,el]),eg=(()=>{let{open:e,onClose:n,onOpen:t}=(0,T.j)(),[i,l]=(0,j.useState)({x:0,y:0}),[r,s]=(0,j.useState)();return{props:{x:i.x,y:i.y,node:r,isOpen:e,onClose:n},showContextMenu:(e,n,i)=>{l({x:e,y:n}),s(i),t()},closeContextMenu:()=>{l({x:0,y:0}),s(void 0),n()}}})();(0,j.useLayoutEffect)(()=>{(async()=>{var e,n,t,i;let l,s;if(!C)return;if(X.node_ids)s=X.node_ids;else{let t=null==(e=C.manifestMetadata.current)?void 0:e.project_name,i={view_mode:null!=(n=X.view_mode)?n:et?"changed_models":"all",packages:t?[t]:void 0,...r.viewOptions};try{s=(await eu({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}catch(e){i.view_mode="all",s=(await eu({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}K(i)}if(X.column_level_lineage)try{l=await B.mutateAsync(X.column_level_lineage)}catch(e){if(e instanceof tv.pe)return void eT.X.create({title:"Column Level Lineage error",description:null!=(i=null==(t=e.response)?void 0:t.data.detail)?i:e.message,type:"error",closable:!0})}let[o,a,c]=(0,e4.X2)(C,{selectedNodes:s,cll:l});(0,e4.Zp)(o,a),g(o),w(a),U(c),$(l)})()},[C]);let ev=()=>{eo(void 0)},ey=e=>{let n=f.find(n=>n.id===e);if(n){if(n.parentId){var t;let e=n.parentId;n=null!=(t=f.find(n=>n.id===e))?t:n}if(n.width&&n.height){let e=n.position.x+n.width/2,t=n.position.y+n.height/2,i=o.getZoom();o.setCenter(e,t,{zoom:i,duration:200})}}},eb=(()=>{let[,e]=(0,eE.zy)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])})();var ew,ek=()=>{"selecting"!==ec&&(es?ey(es):o.fitView({nodes:f,duration:200}))};let eC=a.current,e_=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let n of e){let e=n.contentRect.width,t=n.contentRect.height;(Math.abs(t-e_.current.height)>10||Math.abs(e-e_.current.width)>10)&&e_.current.height>0&&t>0&&e_.current.width>0&&e>0&&ek(),e_.current={width:e,height:t}}});return eC&&e.observe(eC),()=>{eC&&e.unobserve(eC)}},[eC,e_,ek]);let eS=async function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=X.column_level_lineage;await eR({...X,column_level_lineage:e},!1),n||Q.push(t),(null==e?void 0:e.node_id)?eo(e.node_id):eo(void 0)},ez=async e=>{if(e){if(0===Q.length)return;let e=Q.pop();e?await eS(e,!0):await eS(void 0,!0)}else await eS(void 0,!0)},eD=(e,n)=>{if(t&&C){var i;if("customColumnNode"===n.type)return void(!ec&&eS({node_id:n.data.node.id,column:n.data.column}));if(eq(),ec)if("action_result"===ec){let e=ef.actionState.actions[n.id];(null==(i=e.run)?void 0:i.run_id)&&q(e.run.run_id),eo(n.id)}else{let e=new Set(eh);eh.has(n.id)?e.delete(n.id):e.add(n.id),ep(e),0===e.size&&ed(void 0)}else eo(n.id)}},eI=async e=>{var n,t,i,l,r;let s,a,{viewOptions:c=X,fitView:d}=e;if(!C)return;if(X.select!==c.select||X.exclude!==c.exclude||X.packages!==c.packages||X.view_mode!==c.view_mode){try{let e=await eu({select:c.select,exclude:c.exclude,packages:c.packages,view_mode:c.view_mode});c.column_level_lineage=void 0,a=e.nodes}catch(e){e instanceof tv.pe&&eT.X.create({title:"Select node error",description:null!=(i=null==(t=e.response)?void 0:t.data.detail)?i:e.message,type:"error",closable:!0});return}eo(void 0)}else a=f.map(e=>e.id);if(c.column_level_lineage)try{s=await B.mutateAsync(c.column_level_lineage)}catch(e){if(e instanceof tv.pe)return void eT.X.create({title:"Column Level Lineage error",description:null!=(r=null==(l=e.response)?void 0:l.data.detail)?r:e.message,type:"error",closable:!0})}let[u,h,x]=(0,e4.X2)(C,{selectedNodes:a,cll:s});g(u),w(h),U(x),$(s),(null==P||null==(n=P.params)?void 0:n.model)&&!Y(P.params.model)&&A(),d&&(await new Promise(e=>setTimeout(e,1)),o.fitView({nodes:u,duration:200}))},eR=async function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];K(e),await eI({viewOptions:e,fitView:n})},eF=tb();(0,j.useEffect)(()=>{let e=null==P?void 0:P.type;if(t&&O&&!(!e||["query_diff","query","row_count"].includes(e))&&!ec){var n;let e=null==(n=P.params)?void 0:n.model,t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});if(e){let n=Y(e);n?ea!==n.data&&eD(t,n):eR({...X,view_mode:"all"})}else ev()}},[P,X,O,ec]);let eq=()=>{eg.closeContextMenu()},eA=(e,n)=>{if(!t||"action_result"===ec)return;e.preventDefault();let i=m.current,l=i.getBoundingClientRect(),r=e.clientX-l.left,s=e.clientY-l.top+i.offsetTop;eg.showContextMenu(r,s,n)},eL=()=>{ed(void 0),ep(new Set),eo(void 0),A(),null==D||D()},eM={interactive:t,nodes:f,focusedNode:ea,selectedNodes:em,viewOptions:X,showContextMenu:eA,onViewOptionsChanged:eR,selectMode:ec,selectNode:e=>{if(ec){if("selecting"===ec){let n=new Set(eh);eh.has(e)?n.delete(e):n.add(e),ep(n),0===n.size&&ed(void 0)}}else C&&(ep(new Set([e])),ed("selecting"),eo(void 0),ef.reset())},selectParentNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===ec||void 0===C)return;!ec&&(ed("selecting"),ef.reset(),X.column_level_lineage&&eR({...X,column_level_lineage:void 0}));let t=(0,e4.Qf)(C,[e],n);ep((0,tf.KC)(eh,t))},selectChildNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===ec||void 0===C)return;!ec&&(ed("selecting"),ef.reset(),X.column_level_lineage&&eR({...X,column_level_lineage:void 0}));let t=(0,e4.Ve)(C,[e],n);ep((0,tf.KC)(eh,t))},deselect:eL,isNodeHighlighted:e=>ej.has(e),isNodeSelected:e=>eh.has(e),isEdgeHighlighted:(e,n)=>W?e in W.current.parent_map&&n in W.current.parent_map[e]:ej.has(e)&&ej.has(n),isNodeShowingChangeAnalysis:e=>{var n;if(!C)return!1;let t=e in C.nodes?C.nodes[e]:void 0;if(null==(n=X.column_level_lineage)?void 0:n.change_analysis){let n=X.column_level_lineage;return n.node_id&&!n.column?n.node_id===e&&!!(null==t?void 0:t.changeStatus):!!(null==t?void 0:t.changeStatus)}return!1},getNodeAction:e=>ef.actionState.actions[e],getNodeColumnSet:e=>e in V?new Set(V[e]):new Set,runRowCount:async()=>{"selecting"===ec?(await ef.runRowCount(),(0,b.yk)({type:"row_count",selected:"multi"})):ea?(L("row_count",{node_names:[ea.name]},{showForm:!1,showLast:!1}),(0,b.yk)({type:"row_count",selected:"single"})):(L("row_count",{select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"row_count",selected:"none"}))},runRowCountDiff:async()=>{"selecting"===ec?(await ef.runRowCountDiff(),(0,b.yk)({type:"row_count_diff",selected:"multi"})):ea?(L("row_count_diff",{node_names:[ea.name]},{showForm:!1,showLast:!1}),(0,b.yk)({type:"row_count_diff",selected:"single"})):(L("row_count_diff",{select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(ea)L("value_diff",{model:ea.name},{showForm:!0,showLast:!1}),(0,b.yk)({type:"value_diff",selected:"single"});else{let e="selecting"===ec?em.length:el.length;await eF.confirm(e)&&(await ef.runValueDiff(),(0,b.yk)({type:"value_diff",selected:"selecting"===ec?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"selecting"===ec?(e=await ef.addLineageDiffCheck(),eL(),(0,b.yk)({type:"lineage_diff",selected:"multi"})):ea||(e=await tj(X),(0,b.yk)({type:"lineage_diff",selected:"none"})),e&&eb(e)},addSchemaDiffCheck:async()=>{let e;"selecting"===ec?em.length>0&&(e=await ef.addSchemaDiffCheck(),eL(),(0,b.yk)({type:"schema_diff",selected:"multi"})):ea?(e=await nb({node_id:ea.id}),(0,b.yk)({type:"schema_diff",selected:"single"})):(e=await nb({select:X.select,exclude:X.exclude,packages:X.packages,view_mode:X.view_mode}),(0,b.yk)({type:"schema_diff",selected:"none"})),e&&eb(e)},cancel:ef.cancel,actionState:ef.actionState,centerNode:ey,cll:W,showColumnLevelLineage:eS,resetColumnLevelLineage:ez};return S?(0,i.jsx)(d.s,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(J.y,{size:"xl"})}):z?(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsxs)(E.T,{children:[(0,i.jsx)(l.a,{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.a,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):C&&f!=tO?"changed_models"!==ei||C.modifiedSet.length?(0,i.jsxs)(en.Provider,{value:eM,children:[(0,i.jsxs)(ex,{sizes:ea?[70,30]:[100,0],minSize:400*!!ea,gutterSize:5*!!ea,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(E.T,{ref:a,separator:(0,i.jsx)(e3.k,{borderColor:"gray.200"}),gap:0,style:{contain:"strict"},position:"relative",children:[t&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tm,{}),"metadata only"===R.mode&&(0,i.jsx)(tL,{})]}),(0,i.jsxs)(e8.Gc,{proOptions:{hideAttribution:!0},nodeTypes:tM,edgeTypes:tP,nodes:f,edges:y,onNodesChange:v,onEdgesChange:k,onNodeClick:eD,onNodeContextMenu:eA,onClick:eq,onInit:()=>{if(et)o.fitView();else{let e=(0,e8.Jo)(f);o.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:.1,nodesDraggable:t,ref:m,children:[(0,i.jsx)(e6.V,{color:"#ccc"}),(0,i.jsx)(e7.H,{showInteractive:!1,position:"top-right",className:nI,children:(0,i.jsx)(e7.a,{title:"copy image",onClick:async()=>{await x(),(0,b.uH)({type:ei,from:"lineage_view"})},children:(0,i.jsx)(s.I,{as:nn.nxz})})}),(0,i.jsx)(p,{}),(0,i.jsx)(e8.Zk,{position:"bottom-left",children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[et&&(0,i.jsx)(tg,{}),X.column_level_lineage&&(0,i.jsx)(tS,{})]})}),(0,i.jsx)(e8.Zk,{position:"top-center",children:(0,i.jsx)(tE,{notification:N?(0,i.jsx)(tI,{}):null,type:"info"})}),(0,i.jsx)(e8.Zk,{position:"top-left",children:(0,i.jsxs)(d.s,{direction:"column",gap:"5px",children:[(0,i.jsx)(t_,{action:B}),0==f.length&&(0,i.jsx)(c.E,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,i.jsx)(e9.o,{nodeColor:tX,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===ec&&(0,i.jsx)(e8.Zk,{position:"bottom-center",className:nI,children:(0,i.jsx)(tl,{onClose:()=>{eL()}})})]}),(0,i.jsx)(tA,{...eg.props})]}),ea?(0,i.jsx)(l.a,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(ti,{node:ea,onCloseNode:ev})}):(0,i.jsx)(l.a,{})]}),eF.AlertDialog]}):(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsxs)(E.T,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:async()=>{await eR({...X,view_mode:"all"})},children:"Show all nodes"})]})}):(0,i.jsx)(i.Fragment,{})}),tQ=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(d.s,{direction:"column",height:"100%",children:(0,i.jsx)(e8.Ln,{children:(0,i.jsx)(tK,{viewOptions:l,interactive:!1,ref:n})})})});function tW(e){let{yamlTemplate:n}=e;return(0,i.jsx)(eL.KE,{height:"300px",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}function t$(){return{markedAsApprovedToast:function(){eT.X.create({title:"Marked as approved",type:"success",duration:2e3})}}}var tB=t(6408);function tV(){let e=(0,R._)(["\n <details><summary>","</summary>\n\n ","\n\n </details>"]);return tV=function(){return e},e}let tZ=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!n.error),tH=e=>{var n,t,r,o,a,u,f,v,w,k,z,D,R;let{checkId:Q,refreshCheckList:W}=e,{featureToggles:H}=(0,ee.c)(),{setLatestSelectedCheckId:U}=(0,tB.J)(),G=(0,V.jE)(),[,J]=(0,eE.zy)(),{successToast:Y,failToast:en}=eN(),{markedAsApprovedToast:et}=t$(),[ei,er]=(0,j.useState)(),[es]=(0,j.useState)(),[eo,ea]=(0,j.useState)(!1),[ec,ed]=(0,j.useState)(""),{open:eu,onOpen:eh,onClose:ex}=(0,T.j)(),em=()=>(0,i.jsx)(N.Xi,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[ef,ej]=(0,j.useState)((0,i.jsx)(em,{})),{isLoading:eg,error:ev,data:ey}=(0,g.I)({queryKey:y.X.check(Q),queryFn:async()=>C(Q),refetchOnMount:!0}),eb=null!=ei?ei:null==ey||null==(n=ey.last_run)?void 0:n.run_id,{run:ew,error:ek}=nk(eb),eC=ei?!ew||"running"===ew.status:(null==ew?void 0:ew.status)==="running",eS=(null==ey?void 0:ey.type)?(0,e_.C)(ey.type):void 0,eD=null!=(u=null==ey?void 0:ey.is_preset)&&u,eT=(0,j.useRef)(null),{mutate:eA}=(0,Z.n)({mutationFn:e=>_(Q,e),onSuccess:async()=>{await G.invalidateQueries({queryKey:y.X.check(Q)}),await G.invalidateQueries({queryKey:y.X.checks()})}}),{mutate:eL}=(0,Z.n)({mutationFn:()=>S(Q),onSuccess:async()=>{U(""),await G.invalidateQueries({queryKey:y.X.checks()}),J("/checks")}}),eM=(0,j.useCallback)(async()=>{(null==ey?void 0:ey.type)&&(er((await (0,eY.gM)(Q,{nowait:!0})).run_id),await G.invalidateQueries({queryKey:y.X.check(Q)}),W&&W())},[ey,Q,er,G,W]),eO=(0,j.useCallback)(async()=>{if(ea(!0),eb)return await (0,eY.Su)(eb)},[eb]),eP=async()=>{if(!ey)return;let e=function(e){return(0,eR.mi)(tV(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(eq(e),"\n\n").concat((0,eR.dx)(eF(),null==(n=e.params)?void 0:n.sql_template))}return eq(e)}(e))}(ey);if(!window.isSecureContext)return void en("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));try{await navigator.clipboard.writeText(e),Y("Copied the check to the clipboard")}catch(e){en("Failed to copy the check to clipboard",e)}},eX=(0,j.useCallback)(()=>{let e=null==ey?void 0:ey.is_checked;eA({is_checked:!e}),e||et()},[null==ey?void 0:ey.is_checked,eA,et]),[eK,eQ]=(0,j.useState)("result"),{ref:eW,onCopyToClipboard:e$,onMouseEnter:eB,onMouseLeave:eV}=nT();if((0,j.useEffect)(()=>{var e,n,t;ed(function(e){let{name:n,description:t,type:i,params:l,viewOptions:r}=e,s={name:n,description:t,type:i,params:l};return r&&(s.view_options=r),nC.Ay.stringify({checks:[s]})}({name:null!=(e=null==ey?void 0:ey.name)?e:"",description:null!=(n=null==ey?void 0:ey.description)?n:"",type:null!=(t=null==ey?void 0:ey.type)?t:"",params:null==ey?void 0:ey.params,viewOptions:null==ey?void 0:ey.view_options}))},[ey]),eg)return(0,i.jsx)(I.o,{h:"100%",children:"Loading"});if(ev)return(0,i.jsxs)(I.o,{h:"100%",children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:ev.message})]});let eZ=(null==ew?void 0:ew.run_at)?(0,e5.m)(new Date(ew.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(ep,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.a,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(d.s,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)($,{name:null!=(f=null==ey?void 0:ey.name)?f:"",setName:e=>{eA({name:e})}}),eD&&(0,i.jsx)(el.m,{content:"Preset Check defined in recce config",children:(0,i.jsxs)(F.f8,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,i.jsx)(F.FV,{children:(0,i.jsx)(X.NaU,{size:"14px"})}),(0,i.jsx)(F.d1,{children:"Preset"})]})}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{mr:"10px",children:[eZ&&(0,i.jsx)(l.a,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:eZ}),(0,i.jsxs)(q.il,{children:[(0,i.jsx)(q.cQ,{asChild:!0,children:(0,i.jsx)(A.K,{rounded:"full",variant:"ghost",size:"sm",children:(0,i.jsx)(s.I,{as:B.EUt})})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{children:[(0,i.jsx)(q.Dr,{value:"preset-check-template",onClick:()=>{ej((0,i.jsx)(em,{})),eh()},children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(K.EFr,{})," Get Preset Check Template"]})}),(0,i.jsx)(q.Dr,{value:"copy-markdown",onClick:()=>eP(),children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(nl.hX7,{})," Copy Markdown"]})}),(0,i.jsx)(q.bX,{}),(0,i.jsx)(q.Dr,{value:"delete",color:"red.solid",onClick:()=>{eL()},disabled:H.disableUpdateChecklist,children:(0,i.jsxs)(d.s,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,i.jsx)(nl.tS8,{})," Delete"]})})]})})})]}),(0,i.jsx)(el.m,{content:tZ(null!=(v=null==ey?void 0:ey.type)?v:"",ew)?"Run the check first":(null==ey?void 0:ey.is_checked)?"Mark as Pending":"Mark as Approved",positioning:{placement:"bottom-end"},children:(0,i.jsxs)(M.$,{flex:"0 0 auto",size:"sm",colorPalette:(null==ey?void 0:ey.is_checked)?"green":"gray",variant:(null==ey?void 0:ey.is_checked)?"solid":"outline",onClick:()=>{eX()},disabled:tZ(null!=(w=null==ey?void 0:ey.type)?w:"",ew)||H.disableUpdateChecklist,children:[(null==ey?void 0:ey.is_checked)?(0,i.jsx)(nl.Ykz,{}):(0,i.jsx)(s.I,{as:B.MKj,color:"lightgray"})," ",(null==ey?void 0:ey.is_checked)?"Approved":"Mark as Approved"]})})]})]}),(0,i.jsx)(l.a,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(eI,{value:null==ey?void 0:ey.description,onChange:e=>{eA({description:e})}},null==ey?void 0:ey.check_id)})]}),(0,i.jsx)(l.a,{style:{contain:"strict"},children:(0,i.jsxs)(m.pK,{height:"100%",display:"flex",flexDirection:"column",value:eK,onValueChange:e=>{eQ(e.value)},children:[(0,i.jsxs)(m.j7,{height:"50px",children:[(0,i.jsx)(m.Xi,{value:"result",fontSize:"0.75rem",children:"Result"}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff")&&(0,i.jsx)(m.Xi,{value:"query",fontSize:"0.75rem",children:"Query"}),(0,i.jsx)(p.h,{}),(0,i.jsxs)(x.z,{mr:"10px",children:[(null==eS?void 0:eS.RunResultView)&&(0,i.jsx)(el.m,{content:"Rerun",children:(0,i.jsxs)(M.$,{variant:"outline",loading:eC,size:"sm",onClick:()=>eM(),disabled:H.disableDatabaseQuery,children:[(0,i.jsx)(nl.fZv,{})," Rerun"]})}),(0,i.jsxs)(M.$,{variant:"outline",disabled:tZ(null!=(k=null==ey?void 0:ey.type)?k:"",ew)||"result"!==eK,onMouseEnter:eB,onMouseLeave:eV,size:"sm",onClick:async()=>{var e,n;(null==ey?void 0:ey.type)==="lineage_diff"?null==(e=eT.current)||e.copyToClipboard():await e$(),(0,b.uH)({type:null!=(n=null==ey?void 0:ey.type)?n:"unknown",from:"check"})},children:[(0,i.jsx)(nl.hX7,{})," Copy to Clipboard"]})]})]}),(0,i.jsxs)(m.T$,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(m.av,{value:"result",p:0,width:"100%",height:"100%",children:[(null==eS?void 0:eS.RunResultView)&&((null==ey?void 0:ey.last_run)||eb?(0,i.jsx)(e2,{ref:eW,isRunning:eC,isAborting:eo,run:eb?ew:null==ey?void 0:ey.last_run,error:ek,progress:es,RunResultView:eS.RunResultView,viewOptions:null==ey?void 0:ey.view_options,onViewOptionsChanged:e=>{eA({view_options:e})},onCancel:eO,onExecuteRun:eM}):(0,i.jsx)(I.o,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsxs)(E.T,{gap:4,children:[(0,i.jsx)(l.a,{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)(no,{display:"metadata only"===H.mode,children:(0,i.jsx)(M.$,{onClick:eM,colorPalette:"blue",size:"sm",disabled:H.disableDatabaseQuery,children:"Run Query"})})]})})),ey&&"schema_diff"===ey.type&&(0,i.jsx)(ez,{check:ey,ref:eW}),ey&&"lineage_diff"===ey.type&&(0,i.jsx)(tQ,{check:ey,ref:eT})]}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff"||(null==ey?void 0:ey.type)==="query_base")&&(0,i.jsx)(m.av,{value:"query",p:0,height:"100%",width:"100%",children:(null==(t=ey.params)?void 0:t.base_sql_template)?(0,i.jsx)(eJ,{value:null!=(z=null==(r=ey.params)?void 0:r.sql_template)?z:"",baseValue:null!=(D=null==(o=ey.params)?void 0:o.base_sql_template)?D:"",options:{readOnly:!0}}):(0,i.jsx)(eG,{value:null!=(R=null==(a=ey.params)?void 0:a.sql_template)?R:"",options:{readOnly:!0}})})]})]})}),(0,i.jsx)(N.Dz,{open:eu,onOpenChange:ex,placement:"center",size:"xl",children:(0,i.jsxs)(L.Z,{children:[ef,(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Preset Check Template"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsxs)(h.D,{size:"sm",fontWeight:"bold",children:["Please"," ",(0,i.jsx)(c.E,{as:"span",cursor:"pointer",_hover:{textDecoration:"underline"},color:"blue.500",onClick:async()=>{await navigator.clipboard.writeText(ec),Y("Copied the template to the clipboard")},children:"copy"})," ","the following template and paste it into the"," ",(0,i.jsx)(O.f,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"recce.yml"})," ","file."]}),(0,i.jsx)("br",{}),(0,i.jsx)(tW,{yamlTemplate:ec})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var tU=t(38731);let tG=e=>{var n,t,r,o;let{check:a,selected:c,onSelect:u,onMarkAsApproved:h}=e,{featureToggles:x}=(0,ee.c)(),p=(0,V.jE)(),m=a.check_id,{mutate:f}=(0,Z.n)({mutationFn:e=>_(m,e),onSuccess:async()=>{await p.invalidateQueries({queryKey:y.X.check(m)}),await p.invalidateQueries({queryKey:y.X.checks()})}}),{run:j}=nk(null==(n=a.last_run)?void 0:n.run_id),g=null!=(r=null==(t=(0,e_.C)(a.type))?void 0:t.icon)?r:nL.XJv,v=null!=(o=a.type)?o:"",b=tZ(v,j)||x.disableUpdateChecklist,w=tZ(v,j);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.s,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:c?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:c?"orange":"transparent",onClick:()=>{u(a.check_id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.I,{as:g}),(0,i.jsx)(l.a,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",className:"no-track-pii-safe",children:a.name}),(0,i.jsx)(el.m,{content:w?"Run the check first":"Click to mark as approved",positioning:{placement:"top"},showArrow:!0,children:(0,i.jsx)(d.s,{children:(0,i.jsxs)(tr.y8,{checked:a.is_checked,colorPalette:"green",variant:"solid",size:"sm",onCheckedChange:e=>{e.checked?h():f({is_checked:e.checked})},disabled:b,children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{borderColor:"border.inverted",backgroundColor:b?"bg.emphasized":void 0})]})})})]})})},tJ=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[o,a]=(0,j.useState)(!1),c=(0,V.jE)(),{mutate:u}=(0,Z.n)({mutationFn:e=>_(e,{is_checked:!0}),onSuccess:async(e,n)=>{await c.invalidateQueries({queryKey:y.X.check(n)}),await c.invalidateQueries({queryKey:y.X.checks()})}}),{open:h,onOpen:x,onClose:p}=(0,T.j)(),{markedAsApprovedToast:m}=t$(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),m()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tU.JY,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(tU.gL,{droppableId:"checklist",children:e=>(0,i.jsxs)(E.T,{...e.droppableProps,ref:e.innerRef,className:"no-track-pii-safe",w:"full",gap:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(tU.sx,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps;if(null!=e.style&&"left"in e.style){let n={x:0,y:80},t=e.style.left-n.x,i=e.style.top-n.y;e.style.left=t,e.style.top=i}}return(0,i.jsx)(d.s,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(tG,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsx)(N.Dz,{open:h,onOpenChange:p,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{width:"400px",children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Mark as Approved?"})}),(0,i.jsx)(D.w,{}),(0,i.jsxs)(l.a,{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.jsxs)(tr.y8,{checked:o,onCheckedChange:e=>{a(!!e.checked)},fontWeight:"bold",size:"sm",pt:"8px",children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{children:"Don't show this again"})]})]}),(0,i.jsx)(D.w,{}),(0,i.jsxs)(N.Es,{gap:0,children:[(0,i.jsx)(M.$,{variant:"outline",size:"xs",mr:2,onClick:p,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"iochmara",size:"xs",onClick:()=>{u(t),o&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),m(),p()},children:"Mark as approved"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var tY=t(24082);function t0(e){let{checksOnly:n=!0}=e,{featureToggles:t}=(0,ee.c)(),l=(0,V.jE)(),r=(0,j.useRef)(null),o=(0,j.useRef)(null),[a,u]=(0,j.useState)(null),{open:h,onOpen:x,onClose:p}=(0,T.j)(),[m,f]=(0,eE.zy)(),[,g]=(0,H.JL)(),v=(0,j.useCallback)(async()=>{if(a){try{let{runs:e,checks:t}=await (0,tY.N_)(a,n);g(),await l.invalidateQueries({queryKey:y.X.checks()}),await l.invalidateQueries({queryKey:y.X.runs()}),m.includes("/checks")&&f("/checks");let i=n?"".concat(t," checks imported successfully"):"".concat(e," runs and ").concat(t," checks imported successfully");eT.X.create({description:i,type:"info",duration:5e3,closable:!0})}catch(e){console.error("Import failed",e),eT.X.create({title:"Import failed",description:String(e),type:"error",duration:5e3,closable:!0})}p()}},[l,a,p,m,f,g,n]),w=n?"checks":"runs and checks",{isDemoSite:k}=(0,H.cE)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Import Checklist from State File"+(k?" (Disabled in the demo site)":""),children:(0,i.jsx)(A.K,{pt:"6px",variant:"plain","aria-label":"Import state",onClick:()=>{r.current&&r.current.click(),(0,b.vM)({name:"import"})},disabled:t.disableImportStateFile||k,children:(0,i.jsx)(s.I,{as:eK.Th})})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null==(n=e.target.files)?void 0:n.length)===1&&(u(e.target.files[0]),x()),r.current&&(r.current.value="")}}),(0,i.jsx)(N.Dz,{open:h,role:"alertdialog",initialFocusEl:()=>o.current,onOpenChange:p,size:"xl",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsx)(N.L3,{children:"Import state"})}),(0,i.jsx)(N.R4,{children:(0,i.jsxs)(d.s,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(d.s,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(nl.GLE,{color:"red.600"}),(0,i.jsx)(c.E,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(d.s,{children:(0,i.jsxs)(c.E,{children:["The current ",w," will be"," ",(0,i.jsx)(c.E,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{ref:o,onClick:p,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:v,ml:"5px",children:"Import"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})}let t1=()=>{let e=(0,V.jE)(),[,n]=(0,eE.zy)(),{mutate:t,isPending:l}=(0,Z.n)({mutationFn:()=>nb({select:"state:modified"}),onSuccess:async t=>{await e.invalidateQueries({queryKey:y.X.checks()}),n("/checks/".concat(t.check_id))}});return(0,i.jsx)(I.o,{h:"100%",w:"100%",children:(0,i.jsxs)(E.T,{gap:6,textAlign:"center",maxW:"400px",children:[(0,i.jsx)(s.I,{as:nL.XJv,boxSize:16,color:"gray.400"}),(0,i.jsxs)(E.T,{gap:2,children:[(0,i.jsx)(h.D,{size:"lg",color:"gray.600",children:"No checks yet"}),(0,i.jsx)(c.E,{color:"gray.500",fontSize:"md",children:"Checks help you validate data quality and catch issues."})]}),(0,i.jsxs)(E.T,{gap:3,w:"100%",children:[(0,i.jsx)(c.E,{fontSize:"sm",color:"gray.600",fontWeight:"medium",children:"Get started with your first check:"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>{t()},loading:l,size:"lg",w:"100%",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(s.I,{as:nL.r2j}),(0,i.jsx)(c.E,{children:"Create Schema Diff Check"})]})}),(0,i.jsx)(c.E,{fontSize:"xs",color:"gray.400",mt:2,children:"The schema checks compare modified models between environments to detect changes, additions, or removals."})]})]})})},t2=()=>{let[,e]=(0,eE.zy)(),[,n]=(0,eE.lq)("/checks/:checkId"),{latestSelectedCheckId:t,setLatestSelectedCheckId:r}=(0,tB.J)(),s=(0,V.jE)(),o=null==n?void 0:n.checkId;(0,j.useEffect)(()=>{o&&r(o)},[o,r]);let{isLoading:a,error:c,data:u,status:h,refetch:x}=(0,g.I)({queryKey:y.X.checks(),queryFn:k,refetchOnMount:!0}),p=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,f]=(0,j.useState)(null!=u?u:[]),{mutate:v}=(0,Z.n)({mutationFn:e=>z(e),onSuccess:async()=>{await s.invalidateQueries({queryKey:y.X.checks()})}}),b=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),v({source:e,destination:n}),f(t)},[m,f,v]);return((0,j.useEffect)(()=>{"success"===h&&(!o&&u.length>0&&(t?e("/checks/".concat(t)):e("/checks/".concat(u[0].check_id))),f(u))},[h,o,u,f,e,t]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",(0,i.jsx)("span",{className:"no-track-pii-safe",children:c.message})]}):(null==u?void 0:u.length)?(0,i.jsxs)(ex,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.a,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(E.T,{gap:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(d.s,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(t0,{checksOnly:!0})}),(0,i.jsx)(D.w,{}),(0,i.jsx)(tJ,{checks:m,selectedItem:o,onCheckSelected:p,onChecksReordered:b})]})}),(0,i.jsx)(l.a,{height:"100%",children:(0,i.jsx)(eE.dO,{children:(0,i.jsx)(eE.qh,{path:"/checks/:checkId",children:e=>(0,i.jsx)(tH,{checkId:e.checkId,refreshCheckList:x},e.checkId)})})})]}):(0,i.jsxs)(ex,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.a,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(E.T,{gap:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(d.s,{justifyContent:"flex-end",padding:"0px 10px",children:(0,i.jsx)(t0,{checksOnly:!0})}),(0,i.jsx)(D.w,{}),(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsx)(l.a,{textAlign:"center",color:"gray.500",children:"No checks"})})]})}),(0,i.jsx)(l.a,{children:(0,i.jsx)(I.o,{h:"100%",children:(0,i.jsx)(t1,{})})})]})};var t5=t(91843);function t4(){return(0,i.jsx)("div",{className:"flex flex-1 h-full min-h-0 m-2 p-4 bg-blue-50 rounded-lg shadow-md justify-center",children:(0,i.jsxs)("div",{className:"w-4/5 flex flex-col overflow-y-auto gap-6 px-8 pb-8",children:[(0,i.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,i.jsx)("div",{className:"p-2 bg-white rounded-full flex items-center justify-center shadow-md",children:(0,i.jsx)(s.I,{as:nt.JVA,boxSize:7,color:"blue.500"})}),(0,i.jsx)(h.D,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,i.jsxs)(c.E,{fontSize:"md",textAlign:"center",children:["Query functions disabled without a"," ",(0,i.jsx)(c.E,{fontWeight:"bold",as:"span",children:"data warehouse connection"})]})]}),(0,i.jsx)("div",{className:"w-1/2 flex flex-col mt-6 mx-auto",children:(0,i.jsx)(M.$,{colorPalette:"blue",size:"lg",onClick:()=>{window.open(nr.Q,"_blank")},children:"Connect to Data Warehouse"})})]})})}let t3=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=(0,nv.vr)();return(0,i.jsxs)(l.a,{children:[(0,i.jsxs)(d.s,{fontSize:"0.75rem",gap:1,alignItems:"center",children:["Custom Queries"," ",(0,i.jsx)(el.m,{content:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(nl.H2l,{color:"gray.600",fontSize:"1rem"})})]}),(0,i.jsxs)(t5.lq,{size:"sm",colorPalette:"iochmara",checked:e,onCheckedChange:()=>{!e&&r&&r(t),n(!e)},children:[(0,i.jsx)(t5.tD,{}),(0,i.jsx)(t5.oO,{}),(0,i.jsx)(t5.$X,{})]})]})},t8=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:o,isCustomQueries:a}=(0,nv.vr)(),{lineageGraph:c,envInfo:u}=(0,H.cE)(),{featureToggles:h,singleEnv:x}=(0,ee.c)(),m=e;(null==u?void 0:u.adapterType)==="sqlmesh"&&e===nv.I&&(m="select * from db.mymodel"),"read only"===h.mode&&(m="--- Would like to do query here? Book a demo with us at ".concat(nr.Q,"\n").concat(m));let{showRunId:f}=(0,G.tr)(),g=async e=>{let t="query_base"===e?null!=n?n:"":m,i=function(e){switch(e){case"query":return nZ;case"query_base":return nH;case"query_diff":return nU;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,a&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return f(r),await (0,eY.Zc)(r)},{mutate:v,isPending:y}=(0,Z.n)({mutationFn:g}),b=(0,j.useMemo)(()=>{let e={};for(let t in null==c?void 0:c.nodes){var n;let i=null==(n=c.nodes[t].data.current)?void 0:n.schema;i&&(e[i]=(e[i]||0)+1)}return Object.keys(e).reduce((n,t)=>e[t]>(e[n]||0)?t:n,"N/A")},[null==c?void 0:c.nodes]);return x||"metadata only"===h.mode?(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",children:[(0,i.jsx)(to,{}),(0,i.jsx)(p.h,{}),x?(0,i.jsx)(el.m,{content:"Please configure the base environment before running the diff",positioning:{placement:"left"},children:(0,i.jsx)(M.$,{colorPalette:"iochmara",disabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})}):(0,i.jsx)(no,{display:"metadata only"===h.mode,children:(0,i.jsx)(M.$,{colorPalette:"iochmara",disabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})})]}),(0,i.jsx)(eJ,{value:m,onChange:t,onRun:()=>{v("query")},labels:["base (production)","current (".concat(b,")")],SetupGuide:"metadata only"===h.mode?(0,i.jsx)(t4,{}):(0,i.jsx)(tD,{})})]}):(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"flex-end",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(to,{}),(0,i.jsx)(t3,{}),(0,i.jsx)(p.h,{}),(0,i.jsx)(n1,{defaultPrimaryKeys:s,onPrimaryKeysChange:o}),(0,i.jsx)(M.$,{colorPalette:"iochmara",onClick:()=>{v("query_diff")},disabled:y||h.disableDatabaseQuery,size:"2xs",children:"Run Diff"})]}),(0,i.jsx)(l.a,{width:"100%",flex:"1",children:a?(0,i.jsx)(eJ,{value:m,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>{v("query")},onRunBase:()=>{v("query_base")},onRunDiff:()=>{v("query_diff")}}):(0,i.jsx)(eG,{value:m,onChange:t,onRun:()=>{v("query")},onRunDiff:()=>{v("query_diff")}})})]})},t6=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,g.I)({queryKey:y.X.run(t),queryFn:async()=>(0,eY.Zc)(t)}),o=(null==s?void 0:s.type)?null==(n=(0,e_.C)(s.type))?void 0:n.RunResultView:void 0;return(0,i.jsx)(e2,{error:r,run:s,RunResultView:o})},t7=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(I.o,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(d.s,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(h.D,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.a,{flex:"1",fontSize:"10pt",children:String(n)}),(0,i.jsx)(M.$,{justifySelf:"center",alignSelf:"center",mt:"20px",colorPalette:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},t9=e=>{let{children:n}=e;return(0,i.jsx)(e1.tH,{fallback:t7,children:n})};function ie(){let{featureToggles:e}=(0,ee.c)(),n=async()=>{try{let e=await (0,tY.sp)(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,eP.GP)(i,"yyyy-MM-dd-HH-mm-ss"),".json");nD()(t,l)}catch(e){console.error("Export failed",e),eT.X.create({title:"Export failed",description:String(e),type:"error",duration:5e3,closable:!0})}};return(0,i.jsx)(el.m,{content:"Export",children:(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Export state",onClick:async()=>{await n(),(0,b.vM)({name:"export"})},disabled:e.disableExportStateFile,children:(0,i.jsx)(s.I,{as:eK.gY,verticalAlign:"middle",boxSize:"16px"})})})}function it(){return(0,i.jsx)(e8.Ln,{children:(0,i.jsx)(tK,{interactive:!0})})}t(17461);let ii=()=>{var e,n;let t,{featureToggles:r}=(0,ee.c)(),{fileName:o,cloudMode:a,isDemoSite:c,envInfo:u}=(0,H.cE)(),h=(0,T.j)(),x=(0,T.j)(),p=!o&&!a&&!c,{data:m}=(0,g.I)({queryKey:y.X.checks(),queryFn:k,enabled:p}),f=void 0!=m&&m.filter(e=>!e.is_preset).length>0;(e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])})(p&&f);let[{newFileName:v,errorMessage:b,modified:w,overwriteWithMethod:C,bypass:_},S]=(0,j.useState)({newFileName:null!=o?o:"recce_state.json"}),z=(0,j.useRef)(null),{toastSuccess:E,toastError:D}={toastSuccess:e=>{eT.X.create({description:e,type:"success",duration:5e3,closable:!0})},toastError:(e,n)=>{let t=e;if(null!=n)if(n instanceof tv.pe){var i,l;t="".concat(e,". ").concat(String(null==(l=n.response)||null==(i=l.data)?void 0:i.detail))}else t="".concat(e,". ").concat(n);eT.X.create({description:t,type:"error",duration:5e3,closable:!0})}},I=(0,V.jE)(),R=async(e,n)=>{if(!v)return;let t="true"===localStorage.getItem(n3.bypassSaveOverwrite);try{"save"===e?await (0,tY.Uh)({filename:v,overwrite:null!=n?n:t}):await (0,tY.$w)({filename:v,overwrite:null!=n?n:t}),E("save"===e?"Save file successfully":"Rename file successfully"),await I.invalidateQueries({queryKey:y.X.lineage()}),_&&localStorage.setItem(n3.bypassSaveOverwrite,"true")}catch(n){if(n instanceof tv.pe){var i;if((null==(i=n.response)?void 0:i.status)===409){S(n=>({...n,overwriteWithMethod:e})),x.onOpen();return}}D("save"===e?"Save file failed":"Rename file failed",n)}finally{h.onClose()}};if(a||c)return(0,i.jsx)(i.Fragment,{});if(r.disableSaveToFile&&o){let n=null==u||null==(e=u.stateMetadata)?void 0:e.generated_at,i=n?nN(new Date(n)):null;t=i?"".concat(o," (").concat(i,")"):null}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.s,{justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.a,{fontWeight:"600",children:null!=(n=null!=t?t:o)?n:"New Instance"+(f?" (unsaved)":"")}),!r.disableSaveToFile&&(0,i.jsx)(el.m,{content:o?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(A.K,{onClick:()=>{S({newFileName:null!=o?o:"recce_state.json",modified:!o}),h.onOpen()},"aria-label":o?"Change Filename":"Save",variant:"ghost",size:"sm",colorPalette:"gray",children:(0,i.jsx)(s.I,{as:o?eK.GI:eK.FS,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsx)(N.Dz,{open:h.open,onOpenChange:h.onClose,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:o?"Change Filename":"Save File"})}),(0,i.jsx)(N.R4,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(n0.XO,{invalid:!!b,children:[(0,i.jsx)(n0.dh,{children:"File name:"}),(0,i.jsx)(W.p,{ref:z,value:v,placeholder:"Enter filename",onChange:e=>{let n,t=e.target.value;t?t.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(t)?o&&t===o&&(n="Filename is the same as the current one."):n="Invalid filename. Only alphanumeric, space, _ and - are allowed.":n="Filename must end with .json.":n="Filename cannot be empty.",S(e=>({...e,modified:!0,newFileName:t,errorMessage:n}))},onKeyDown:e=>{"Enter"===e.key?b||(o?R("rename"):R("save")):"Escape"===e.key&&h.onClose()}}),(0,i.jsx)(n0.wp,{children:b})]})}),(0,i.jsxs)(N.Es,{gap:"5px",children:[(0,i.jsx)(M.$,{size:"sm",colorPalette:o?void 0:"blue",onClick:async()=>{await R("save")},disabled:!v||!!b||!w,children:o?"Save as New File":"Confirm"}),o&&(0,i.jsx)(M.$,{size:"sm",colorPalette:"blue",onClick:async()=>{await R("rename")},disabled:!v||!!b||!w,children:"Rename"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})}),(0,i.jsx)(N.Dz,{open:x.open,onOpenChange:x.onClose,initialFocusEl:()=>z.current,placement:"center",children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsx)(N.f5,{children:(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{children:(0,i.jsx)(N.L3,{children:"Overwrite File?"})}),(0,i.jsxs)(N.R4,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.a,{fontSize:"12pt",children:"save"===C?"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.jsxs)(tr.y8,{size:"xs",checked:_,onCheckedChange:e=>{S(n=>({...n,bypass:!!e.checked}))},children:[(0,i.jsx)(tr.Ks,{}),(0,i.jsx)(tr.v7,{}),(0,i.jsx)(tr.Sb,{fontWeight:"bold",pt:"8px",children:"Don't show this again"})]})]}),(0,i.jsxs)(N.Es,{gap:"5px",children:[(0,i.jsx)(M.$,{variant:"outline",onClick:()=>{x.onClose(),h.onOpen(),S(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(M.$,{size:"sm",colorPalette:"blue",onClick:()=>{C&&(R(C,!0),x.onClose())},children:"Overwrite"})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})})]})})]})};var il=t(21865),ir=t(58128);function is(){return(0,i.jsx)(el.m,{content:"Syncing",children:(0,i.jsx)(l.a,{mx:"10px",children:(0,i.jsx)(J.y,{size:"sm"})})})}function io(){let[e,n]=(0,j.useState)(!1),t=(0,V.jE)(),[r,o]=(0,eE.zy)(),{open:a,onOpen:c,onClose:d}=(0,T.j)(),[u,h]=(0,j.useState)(""),{data:x}=(0,ir.h)(),p=(0,j.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await (0,tY.Z3)(e)).status){c(),n(!1);return}for(;await (0,tY.$k)();)await new Promise(e=>setTimeout(e,1e3));eT.X.create({description:"Sync Completed",type:"success",duration:5e3,closable:!0}),n(!1),h(""),await t.invalidateQueries({queryKey:y.X.lineage()}),await t.invalidateQueries({queryKey:y.X.checks()}),await t.invalidateQueries({queryKey:y.X.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,c,d]);return e?(0,i.jsx)(is,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(el.m,{content:"Sync with Cloud",children:(0,i.jsx)(A.K,{size:"sm",variant:"plain","aria-label":"Sync state",onClick:()=>p((null==x?void 0:x.session_id)?{method:"merge"}:{}),children:(0,i.jsx)(s.I,{as:eK.nU,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsx)(N.Dz,{open:a,onOpenChange:d,children:(0,i.jsxs)(L.Z,{children:[(0,i.jsx)(N.Xi,{}),(0,i.jsxs)(N.f5,{children:[(0,i.jsxs)(N.Cf,{children:[(0,i.jsx)(N.c7,{fontSize:"lg",fontWeight:"bold",children:(0,i.jsx)(N.L3,{children:"Sync with Cloud"})}),(0,i.jsxs)(N.R4,{children:[(0,i.jsx)(l.a,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.a,{mt:"5px",children:(0,i.jsx)(il.Bz,{onValueChange:e=>{h(String(e.value))},value:u,children:(0,i.jsxs)(eA.B,{direction:"column",children:[(0,i.jsxs)(il.CU,{value:"merge",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Merge",(0,i.jsx)(el.m,{content:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]}),(0,i.jsxs)(il.CU,{value:"overwrite",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Overwrite",(0,i.jsx)(el.m,{content:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]}),(0,i.jsxs)(il.CU,{value:"revert",children:[(0,i.jsx)(il.GS,{}),(0,i.jsx)(il.rB,{}),(0,i.jsxs)(il.JZ,{children:["Revert",(0,i.jsx)(el.m,{content:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.I,{as:nl.GLE,ml:2,cursor:"pointer"})})})]})]})]})})})]}),(0,i.jsxs)(N.Es,{children:[(0,i.jsx)(M.$,{onClick:d,mr:3,children:"Cancel"}),(0,i.jsx)(M.$,{colorPalette:"blue",onClick:()=>p({method:u}),disabled:!u,children:"Sync"})]})]}),(0,i.jsx)(N.tK,{asChild:!0,children:(0,i.jsx)(P.J,{size:"sm"})})]})]})})]})}var ia=t(34643);let ic=["Processing...","Still processing, please wait...","Almost there, thanks for your patience..."];function id(){let{successToast:e,failToast:n}=eN(),[,t]=(0,ia.Cj)(),{authed:l}=(0,ee.c)(),{shareUrl:r,isLoading:s,error:o,handleShareClick:a}=(0,nM.l)(),[u,h]=(0,j.useState)(!1),[x,p]=(0,j.useState)(0);(0,ia.$$)(()=>{p(e=>Math.min(e+1,ic.length-1))},s?3e4:null),(0,j.useEffect)(()=>{s||p(0)},[s]);let m=async()=>{try{await t(String(r)),e("Copied the link to clipboard")}catch(e){n("Failed to copy the link",e)}};return l?(0,i.jsxs)(d.s,{flex:"1",alignItems:"center",gap:"5px",children:[(0,i.jsxs)(M.$,{size:"xs",variant:"outline",colorPalette:"gray",onClick:async()=>{await a(),(0,b.o$)({name:"create"})},loading:s,children:[(0,i.jsx)(nL.Fsk,{})," Share ",r?(0,i.jsx)(nl.Ykz,{color:"green"}):void 0]}),s&&(0,i.jsx)(c.E,{fontSize:"14",color:"gray.500",children:ic[x]}),(0,i.jsxs)(d.s,{gap:"5px",alignItems:"center",children:[r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.s,{overflowX:"auto",whiteSpace:"nowrap",maxWidth:"350px",children:(0,i.jsx)(c.E,{fontSize:"14",children:r})}),(0,i.jsx)(A.K,{size:"2xs","aria-label":"Copy the share URL",onClick:async()=>{await m(),(0,b.o$)({name:"copy"})},children:(0,i.jsx)(nl.hX7,{})})]}),o&&(0,i.jsx)(c.E,{fontSize:"14",color:"red.500",children:o})]})]}):(0,i.jsxs)(d.s,{flex:"1",alignItems:"center",children:[(0,i.jsxs)(M.$,{size:"xs",colorPalette:"gray",variant:"outline",onClick:()=>{h(!0)},children:[(0,i.jsx)(nL.Fsk,{})," Share"]}),u&&(0,i.jsx)(nK,{parentOpen:u,handleParentClose:h,ignoreCookie:!0,variant:"enable-share"})]})}let iu={TOAST_ID:"lifetime-countdown",WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>"The server will be closed in ".concat(e," seconds.")};var ih=t(62254);t(77081);let ix=e=>{var n,t;let{run:r,isSelected:o,onSelectRun:a,onAddToChecklist:u,onGoToCheck:h}=e,{featureToggles:x}=(0,ee.c)(),{data:p}=(0,g.I)({queryKey:y.X.run(r.run_id),queryFn:async()=>await (0,eY.Zc)(r.run_id),enabled:"running"===r.status,retry:!1}),m=null!=(t=null==(n=(0,e_.C)(r.type))?void 0:n.icon)?t:nL.XJv,f=r.check_id,j=x.disableUpdateChecklist;return(0,i.jsxs)(d.s,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:o?"orange.400":"transparent",backgroundColor:o?"orange.50":"transparent",onClick:()=>{a(r.run_id)},_hover:{bg:o?"orange.50":"gray.200"},children:[(0,i.jsxs)(d.s,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.I,{as:m}),(0,i.jsx)(l.a,{className:"no-track-pii-safe",flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:r.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:r.name||"<no name>"}),f?(0,i.jsx)(el.m,{content:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(c.E,{onClick:e=>{e.preventDefault(),e.stopPropagation(),h(f)},children:(0,i.jsx)(s.I,{color:"green",as:ef.A7C})})}):j?null:(0,i.jsx)(el.m,{content:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(c.E,{onClick:e=>{e.preventDefault(),e.stopPropagation(),(0,b.iZ)({name:"add_to_checklist"}),u(r.run_id)},children:(0,i.jsx)(s.I,{as:ef.yjt})})})]}),(0,i.jsx)(d.s,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(nF,{run:null!=p?p:r})})]})},ip=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,eP.GP)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(d.s,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},im=()=>{let{closeHistory:e}=(0,G.tr)(),{data:n,isLoading:t,isFetching:r,error:s,refetch:o}=(0,g.I)({queryKey:y.X.runs(),queryFn:async()=>await (0,eY.v)(),retry:!1}),{showRunId:a,runId:c}=(0,G.tr)(),u=e=>{(0,b.iZ)({name:"click_run"}),a(e,!1)},[,m]=(0,eE.zy)(),f=(0,V.jE)(),v=(0,j.useCallback)(async()=>{if(!c)return;let e=await w(c);await f.invalidateQueries({queryKey:y.X.checks()}),m("/checks/".concat(e.check_id))},[c,m,f]),k=(0,j.useCallback)(e=>{(0,b.iZ)({name:"go_to_check"}),m("/checks/".concat(e))},[m]),C=null;return(0,i.jsxs)(d.s,{direction:"column",height:"100%",children:[(0,i.jsxs)(x.z,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(h.D,{size:"md",children:"History"}),(0,i.jsx)(p.h,{}),(0,i.jsx)(A.K,{variant:"ghost","aria-label":"Close History",onClick:()=>{(0,b.iZ)({name:"hide"}),e()},children:(0,i.jsx)(nl.yBK,{})})]}),(0,i.jsx)(l.a,{flex:"1 1 auto",children:t?"Loading...":(null==n?void 0:n.length)===0?(0,i.jsx)(I.o,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(ih.A,{style:{minHeight:"100%",height:0},children:(null!=n?n:[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=C&&C!==t;return C=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(ip,{runAt:e.run_at},t),(0,i.jsx)(ix,{run:e,isSelected:e.run_id===c,onSelectRun:u,onGoToCheck:k,onAddToChecklist:v},e.run_id)]})})})})]})};var ij=t(27919);async function ig(){try{return(await v.g.get("/api/users")).data}catch(e){throw console.error("Error fetching user data:",e),e}}async function iv(e){try{return(await ij.A.get("https://api.github.com/user/".concat(e))).data.avatar_url}catch(e){return console.warn("Failed to fetch GitHub avatar:",e),null}}var iy=t(74822);function ib(){var e;let{data:n,isLoading:t,error:r}=(0,g.I)({queryKey:y.X.user(),queryFn:ig,retry:!1}),{data:o}=(0,g.I)({queryKey:["github-avatar",null==n?void 0:n.id],queryFn:()=>n?iv(n.id):Promise.resolve(null),enabled:!!(null==n?void 0:n.id)&&"github"===n.login_type,retry:!1,staleTime:3e5}),a=(0,j.useRef)(null),d=!t&&!r&&n;return(0,i.jsxs)(q.il,{positioning:{getAnchorRect:()=>{var e,n;return null!=(n=null==(e=a.current)?void 0:e.getBoundingClientRect())?n:null}},children:[(0,i.jsx)(q.cQ,{asChild:!0,children:t?(0,i.jsx)(l.a,{width:"32px",height:"32px",borderRadius:"full",bg:"white",color:"brand.500",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",children:(0,i.jsx)(J.y,{size:"sm"})}):(0,i.jsxs)(iy.Cy,{outlineStyle:"solid",outlineWidth:"1px",outlineColor:"white",ref:a,size:"xs",cursor:"pointer",children:[(0,i.jsx)(iy.q5,{name:null!=(e=null==n?void 0:n.login)?e:"U"}),o&&(0,i.jsx)(iy.BK,{src:o})]})}),(0,i.jsx)(L.Z,{children:(0,i.jsx)(q.y3,{children:(0,i.jsxs)(q.rm,{bg:"white",borderColor:"gray.200",boxShadow:"lg",minW:"180px",children:[(0,i.jsxs)(l.a,{px:3,py:2,children:[t&&(0,i.jsxs)(l.a,{display:"flex",alignItems:"center",gap:2,children:[(0,i.jsx)(c.E,{fontSize:"sm",color:"gray.800",children:"Loading..."}),(0,i.jsx)(J.y,{size:"sm"})]}),r&&(0,i.jsx)(c.E,{fontSize:"xs",color:"red.500",children:"Failed to load user information"}),d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.E,{fontWeight:"semibold",fontSize:"sm",color:"gray.800",children:n.login}),n.email&&(0,i.jsx)(c.E,{fontSize:"xs",color:"gray.400",children:n.email})]})]}),(0,i.jsx)(q.bX,{}),(0,i.jsxs)(q.Dr,{value:"recce cloud",onClick:()=>window.open("https://cloud.datarecce.io/","_blank"),children:[(0,i.jsx)(s.I,{as:ef.tmj,mr:2}),"Recce Cloud"]}),(0,i.jsxs)(q.Dr,{value:"get live support",onClick:()=>window.open(nr.Q,"_blank"),children:[(0,i.jsx)(s.I,{as:ef.x$1,mr:2}),"Get live support"]})]})})})]})}let iw=e=>{let{children:n,path:t}=e,[r]=(0,eE.lq)(t);return(0,i.jsx)(l.a,{display:r?"block":"none",height:"100%",children:n})};function ik(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.N,{height:"20px",color:"white",href:t,target:"_blank",...l,children:(0,i.jsx)(s.I,{color:"white",boxSize:"20px",as:n})})}function iC(){let{version:e,latestVersion:n}=function(){let[e,n]=(0,j.useState)(""),[t,i]=(0,j.useState)("");return(0,j.useEffect)(()=>{!async function(){try{let{version:e,latestVersion:t}=(await v.g.get("/api/version")).data;n(e),i(t)}catch(e){console.error("Error fetching version number:",e)}}()},[]),{version:e,latestVersion:t}}(),t=(0,j.useMemo)(()=>RegExp("^\\d+\\.\\d+\\.\\d+$"),[]);return((0,j.useEffect)(()=>{if(t.test(e)&&e!==n){let e="recce-update-toast-shown";sessionStorage.getItem(e)||setTimeout(()=>{eT.X.create({id:"recce-update-available",title:"Update available",description:(0,i.jsxs)("span",{children:["A new version of Recce (v",n,") is available.",(0,i.jsx)("br",{}),"Please run ",(0,i.jsx)(o.C,{children:"pip install --upgrade recce"})," to update Recce.",(0,i.jsx)("br",{}),(0,i.jsx)(r.N,{color:"brand.700",fontWeight:"bold",href:"https://github.com/DataRecce/recce/releases/tag/v".concat(n),_hover:{textDecoration:"underline"},target:"_blank",children:"Click here to view the detail of latest release"})]}),duration:6e4,closable:!0}),sessionStorage.setItem(e,"true")},0)}},[e,n,t]),t.test(e))?(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsx)(r.N,{href:"https://github.com/DataRecce/recce/releases/tag/v".concat(e),_hover:{textDecoration:"none"},children:(0,i.jsx)(c.E,{color:"white/80",children:e})})}):(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:e})}function i_(){var e,n,t;let{reviewMode:o,isDemoSite:m,envInfo:f,cloudMode:g}=(0,H.cE)(),{featureToggles:v,lifetimeExpiredAt:y,authed:b}=(0,ee.c)(),{url:w,id:k}=null!=(e=null==f?void 0:f.pullRequest)?e:{},C=w?w.split("/").pop():null,_=g||b?"https://cloud.datarecce.io/":"https://reccehq.com/",[S,z]=(0,j.useState)(!1);return!function(e){let n=eT.X,[t,i]=(0,j.useState)(null),l=(0,j.useRef)(void 0),r=(0,j.useCallback)(()=>{if(!e)return 0;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},[e]),s=(0,j.useCallback)(()=>{null!=t&&(n.remove(t),i(null))},[n,t]),o=(0,j.useCallback)(()=>{if(null==t)return;let e=r();if(e<=0)return void s();n.update(t,{description:iu.MESSAGE(e)})},[t,r,n,s]),a=(0,j.useCallback)(()=>{if(!e)return;s();let t=r();t<=0||(i(n.create({id:iu.TOAST_ID,description:iu.MESSAGE(t)})),l.current=setInterval(o,iu.UPDATE_INTERVAL))},[e,n,r,o,s]);(0,j.useEffect)(()=>{if(!e)return;let n=r();if(n-iu.WARNING_THRESHOLD<0)a();else{let e=setTimeout(a,(n-iu.WARNING_THRESHOLD)*1e3);return()=>{clearTimeout(e),s()}}return s},[e,r,a,s])}(y),(0,i.jsxs)(d.s,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(r.N,{href:_,target:"_blank",_hover:{textDecoration:"none"},children:(0,i.jsxs)(d.s,{gap:"10px",alignItems:"center",children:[(0,i.jsx)(u._,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(h.D,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"})]})}),(0,i.jsx)(iC,{}),(null!=(n=v.mode)?n:o)&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:null!=(t=v.mode)?t:"review mode"}),g&&k&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{children:"cloud mode"}),(0,i.jsx)(l.a,{borderLeftWidth:"1px",borderLeftColor:"white/80",paddingLeft:"8px",children:(0,i.jsxs)(r.N,{href:w,_hover:{textDecoration:"none"},target:"_blank",children:[(0,i.jsx)(s.I,{color:"white/80",as:B.XaX,boxSize:"3",marginRight:.5,fontWeight:"extrabold",strokeWidth:"1"}),(0,i.jsx)(c.E,{color:"white/80",children:"#".concat(String(k))})]})})]})}),m&&w&&C&&(0,i.jsx)(a.Ex,{fontSize:"sm",color:"white/80",variant:"outline",textTransform:"uppercase",children:(0,i.jsxs)(x.z,{children:[(0,i.jsx)(l.a,{children:"demo mode"}),(0,i.jsx)(l.a,{borderLeftWidth:"1px",borderLeftColor:"white/80",paddingLeft:"8px",children:(0,i.jsxs)(r.N,{href:w,_hover:{textDecoration:"none"},target:"_blank",children:[(0,i.jsx)(s.I,{color:"white/80",as:B.XaX,boxSize:"3",marginRight:.5,fontWeight:"extrabold",strokeWidth:"1"}),(0,i.jsx)(c.E,{color:"white/80",children:"#".concat(C)})]})})]})}),(0,i.jsx)(p.h,{}),(m||"read only"===v.mode)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ik,{icon:ef.hL4,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(ik,{icon:ef.iWS,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(ik,{mr:2,icon:ef.gZZ,href:"https://docs.datarecce.io"})]}),!m&&"read only"!==v.mode&&(0,i.jsx)(i.Fragment,{children:b||g?(0,i.jsx)(l.a,{mr:2,children:(0,i.jsx)(ib,{})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.a,{as:"button",color:"white",fontSize:"sm",fontWeight:"semibold",bg:"brand.700",borderRadius:"md",px:3,py:1,mr:2,cursor:"pointer",onClick:()=>{z(!0)},children:"Connect to Cloud"}),S&&(0,i.jsx)(nK,{parentOpen:S,handleParentClose:z,ignoreCookie:!0,variant:"user-profile"})]})})]})}function iS(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,g.I)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.a,{ml:"2px",maxH:"20px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function iz(){let{isDemoSite:e,cloudMode:n,isLoading:t}=(0,H.cE)(),{featureToggles:r}=(0,ee.c)(),[s,o]=(0,eE.zy)(),[a,c]=(0,j.useState)("/lineage"),{data:u,isLoading:h}=(0,n8.T)(),x=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(iS,{queryKey:y.X.checks(),fetchCallback:k,selectCallback:e=>e.filter(e=>!e.is_checked).length}),disable:(null==u?void 0:u.single_env_onboarding)===!0}];return(0,j.useEffect)(()=>{c("/".concat(s.split("/")[1]))},[s]),(0,i.jsx)(m.pK,{colorPalette:"iochmara",defaultValue:"/lineage",value:a,onValueChange:e=>{c(e.value)},children:(0,i.jsxs)(m.j7,{display:"grid",gridTemplateColumns:"1fr auto 1fr",alignItems:"center",children:[(0,i.jsx)(l.a,{display:"flex",children:x.map(e=>{let{name:n,href:l,badge:r,disable:s}=e;return(0,i.jsxs)(m.Xi,{value:l,onClick:()=>{o(l)},disabled:!!t||h||s,hidden:s,children:[n,r]},l)})}),(0,i.jsxs)(d.s,{alignItems:"center",gap:"12px",justifyContent:"center",children:[!t&&!e&&(0,i.jsx)(ii,{}),!t&&!e&&!(null==u?void 0:u.single_env_onboarding)&&!r.disableShare&&(0,i.jsx)(id,{})]}),!t&&(0,i.jsxs)(d.s,{justifyContent:"right",alignItems:"center",mr:"8px",children:[(0,i.jsx)(eU,{}),n&&(0,i.jsx)(io,{}),(0,i.jsx)(ie,{})]})]})})}function iE(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=(0,G.tr)(),{data:r}=(0,n8.T)(),[s]=(0,eE.zy)(),o=e&&!s.startsWith("/checks"),a=n&&!s.startsWith("/checks");return(0,i.jsxs)(ex,{sizes:[0,100],minSize:300*!!a,gutterSize:5*!!a,style:{height:"100%"},children:[(0,i.jsx)(l.a,{style:{contain:"size"},children:a&&(0,i.jsx)(im,{})}),(0,i.jsxs)(ep,{sizes:o?[50,50]:[100,0],minSize:100*!!o,gutterSize:5*!!o,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.a,{p:0,style:{contain:"content"},children:(0,i.jsxs)(t9,{children:[(0,i.jsx)(iw,{path:"/lineage",children:(0,i.jsx)(it,{})}),(0,i.jsxs)(eE.dO,{children:[(0,i.jsx)(eE.qh,{path:"/query",children:(0,i.jsx)(t8,{})}),(0,i.jsx)(eE.qh,{path:"/checks/:slug?",children:(0,i.jsx)(t2,{})}),(0,i.jsx)(eE.qh,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(t6,{runId:n})}}),(0,i.jsx)(eE.qh,{path:"/ssr",children:(0,i.jsx)(f.wi,{size:"xs",value:null,colorPalette:"iochmara",children:(0,i.jsx)(f.XL,{children:(0,i.jsx)(f.Fx,{})})})}),(0,i.jsx)(eE.qh,{children:(0,i.jsx)(eE.rd,{to:"/lineage"})})]})]})}),o?(0,i.jsx)(nV,{onClose:t,isSingleEnvironment:!!(null==r?void 0:r.single_env_onboarding)}):(0,i.jsx)(l.a,{})]})]})}function iD(e){let{children:n}=e;return(0,i.jsx)(d.s,{direction:"column",height:"100vh",overflow:"hidden",children:n})}function iI(){let{isDemoSite:e,isLoading:n,isCodespace:t}=(0,H.cE)(),{featureToggles:l}=(0,ee.c)();return(0,j.useEffect)(()=>{(0,b.uz)()},[]),(0,i.jsxs)(iD,{children:[(0,i.jsx)(i_,{}),(0,i.jsx)(iz,{}),(0,i.jsx)(iE,{}),!n&&!e&&!t&&null===l.mode&&(0,i.jsx)(nK,{})]})}},97942:(e,n,t)=>{Promise.resolve().then(t.bind(t,84944))}},e=>{e.O(0,[778,890,540,863,99,969,11,265,138,459,598,916,991,149,699,478,432,103,504,67,90,452,970,547,677,704,619,358],()=>e(e.s=97942)),_N_E=e.O()}]);