recce-nightly 1.10.0.20250625__py3-none-any.whl → 1.30.0.20251221__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.

Files changed (229) hide show
  1. recce/VERSION +1 -1
  2. recce/__init__.py +5 -0
  3. recce/adapter/dbt_adapter/__init__.py +343 -245
  4. recce/apis/check_api.py +20 -14
  5. recce/apis/check_events_api.py +353 -0
  6. recce/apis/check_func.py +5 -5
  7. recce/apis/run_func.py +32 -3
  8. recce/artifact.py +76 -3
  9. recce/cli.py +705 -82
  10. recce/config.py +2 -2
  11. recce/connect_to_cloud.py +1 -1
  12. recce/core.py +3 -3
  13. recce/data/404/index.html +2 -0
  14. recce/data/404.html +2 -22
  15. recce/data/__next.@lineage.!KHNsb3Qp.__PAGE__.txt +7 -0
  16. recce/data/__next.@lineage.!KHNsb3Qp.txt +4 -0
  17. recce/data/__next.__PAGE__.txt +6 -0
  18. recce/data/__next._full.txt +32 -0
  19. recce/data/__next._head.txt +8 -0
  20. recce/data/__next._index.txt +14 -0
  21. recce/data/__next._tree.txt +8 -0
  22. recce/data/_next/static/chunks/025a7e3e3f9f40ae.js +1 -0
  23. recce/data/_next/static/chunks/0ce56d67ef5779ca.js +4 -0
  24. recce/data/_next/static/chunks/1a6a78780155dac7.js +48 -0
  25. recce/data/_next/static/chunks/1de8485918b9182a.css +2 -0
  26. recce/data/_next/static/chunks/1e4b1b50d1e34993.js +1 -0
  27. recce/data/_next/static/chunks/206d5d181e4c738e.js +1 -0
  28. recce/data/_next/static/chunks/2c357efc34c5b859.js +25 -0
  29. recce/data/_next/static/chunks/2e9d95d2d48c479c.js +1 -0
  30. recce/data/_next/static/chunks/2f016dc4a3edad2e.js +2 -0
  31. recce/data/_next/static/chunks/313251962d698f7c.js +1 -0
  32. recce/data/_next/static/chunks/3a9f021f38eb5574.css +1 -0
  33. recce/data/_next/static/chunks/40079da8d2b8f651.js +1 -0
  34. recce/data/_next/static/chunks/4599182bffb64661.js +38 -0
  35. recce/data/_next/static/chunks/4e62f6e184173580.js +1 -0
  36. recce/data/_next/static/chunks/5c4dfb0d09eaa401.js +1 -0
  37. recce/data/_next/static/chunks/69e4f06ccfdfc3ac.js +1 -0
  38. recce/data/_next/static/chunks/6b206cb4707d6bee.js +1 -0
  39. recce/data/_next/static/chunks/6d8557f062aa4386.css +1 -0
  40. recce/data/_next/static/chunks/7fbe3650bd83b6b5.js +1 -0
  41. recce/data/_next/static/chunks/83fa823a825674f6.js +1 -0
  42. recce/data/_next/static/chunks/848a6c9b5f55f7ed.js +1 -0
  43. recce/data/_next/static/chunks/859462b0858aef88.css +2 -0
  44. recce/data/_next/static/chunks/923964f18c87d0f1.css +1 -0
  45. recce/data/_next/static/chunks/939390f911895d7c.js +48 -0
  46. recce/data/_next/static/chunks/99a9817237a07f43.js +1 -0
  47. recce/data/_next/static/chunks/9fed8b4b2b924054.js +5 -0
  48. recce/data/_next/static/chunks/b6949f6c5892110c.js +1 -0
  49. recce/data/_next/static/chunks/b851a1d3f8149828.js +1 -0
  50. recce/data/_next/static/chunks/c734f9ad957de0b4.js +1 -0
  51. recce/data/_next/static/chunks/cdde321b0ec75717.js +2 -0
  52. recce/data/_next/static/chunks/d0f91117d77ff844.css +1 -0
  53. recce/data/_next/static/chunks/d6c8667911c2500f.js +1 -0
  54. recce/data/_next/static/chunks/da8dab68c02752cf.js +74 -0
  55. recce/data/_next/static/chunks/dc074049c9d12d97.js +109 -0
  56. recce/data/_next/static/chunks/ee7f1a8227342421.js +1 -0
  57. recce/data/_next/static/chunks/fa2f4e56c2fccc73.js +1 -0
  58. recce/data/_next/static/chunks/turbopack-1fad664f62979b93.js +3 -0
  59. recce/data/_next/static/media/favicon.a8d38d84.ico +0 -0
  60. recce/data/_next/static/media/montserrat-cyrillic-800-normal.d80d830d.woff2 +0 -0
  61. recce/data/_next/static/media/{montserrat-cyrillic-800-normal.bd5c9f50.woff → montserrat-cyrillic-800-normal.f9d58125.woff} +0 -0
  62. recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.076c2a93.woff2 +0 -0
  63. recce/data/_next/static/media/montserrat-latin-800-normal.cde454cc.woff2 +0 -0
  64. recce/data/_next/static/media/{montserrat-latin-800-normal.fc315020.woff → montserrat-latin-800-normal.d5761935.woff} +0 -0
  65. recce/data/_next/static/media/montserrat-latin-ext-800-normal.40ec0659.woff2 +0 -0
  66. recce/data/_next/static/media/{montserrat-latin-ext-800-normal.2e5381b2.woff → montserrat-latin-ext-800-normal.b671449b.woff} +0 -0
  67. recce/data/_next/static/media/{montserrat-vietnamese-800-normal.20c545e6.woff → montserrat-vietnamese-800-normal.9f7b8541.woff} +0 -0
  68. recce/data/_next/static/media/montserrat-vietnamese-800-normal.f9eb854e.woff2 +0 -0
  69. recce/data/_next/static/nX-Uz0AH6Tc6hIQUFGqaB/_buildManifest.js +11 -0
  70. recce/data/_next/static/nX-Uz0AH6Tc6hIQUFGqaB/_clientMiddlewareManifest.json +1 -0
  71. recce/data/_not-found/__next._full.txt +24 -0
  72. recce/data/_not-found/__next._head.txt +8 -0
  73. recce/data/_not-found/__next._index.txt +13 -0
  74. recce/data/_not-found/__next._not-found.__PAGE__.txt +5 -0
  75. recce/data/_not-found/__next._not-found.txt +4 -0
  76. recce/data/_not-found/__next._tree.txt +6 -0
  77. recce/data/_not-found/index.html +2 -0
  78. recce/data/_not-found/index.txt +24 -0
  79. recce/data/auth_callback.html +1 -1
  80. recce/data/checks/__next.@lineage.__DEFAULT__.txt +7 -0
  81. recce/data/checks/__next._full.txt +39 -0
  82. recce/data/checks/__next._head.txt +8 -0
  83. recce/data/checks/__next._index.txt +14 -0
  84. recce/data/checks/__next._tree.txt +8 -0
  85. recce/data/checks/__next.checks.__PAGE__.txt +10 -0
  86. recce/data/checks/__next.checks.txt +4 -0
  87. recce/data/checks/index.html +2 -0
  88. recce/data/checks/index.txt +39 -0
  89. recce/data/index.html +2 -27
  90. recce/data/index.txt +32 -8
  91. recce/data/lineage/__next.@lineage.__DEFAULT__.txt +7 -0
  92. recce/data/lineage/__next._full.txt +39 -0
  93. recce/data/lineage/__next._head.txt +8 -0
  94. recce/data/lineage/__next._index.txt +14 -0
  95. recce/data/lineage/__next._tree.txt +8 -0
  96. recce/data/lineage/__next.lineage.__PAGE__.txt +10 -0
  97. recce/data/lineage/__next.lineage.txt +4 -0
  98. recce/data/lineage/index.html +2 -0
  99. recce/data/lineage/index.txt +39 -0
  100. recce/data/query/__next.@lineage.__DEFAULT__.txt +7 -0
  101. recce/data/query/__next._full.txt +37 -0
  102. recce/data/query/__next._head.txt +8 -0
  103. recce/data/query/__next._index.txt +14 -0
  104. recce/data/query/__next._tree.txt +8 -0
  105. recce/data/query/__next.query.__PAGE__.txt +9 -0
  106. recce/data/query/__next.query.txt +4 -0
  107. recce/data/query/index.html +2 -0
  108. recce/data/query/index.txt +37 -0
  109. recce/event/CONFIG.bak +1 -0
  110. recce/event/__init__.py +9 -8
  111. recce/event/collector.py +6 -2
  112. recce/event/track.py +10 -0
  113. recce/github.py +1 -1
  114. recce/mcp_server.py +725 -0
  115. recce/models/check.py +433 -15
  116. recce/models/types.py +61 -2
  117. recce/pull_request.py +1 -1
  118. recce/run.py +37 -17
  119. recce/server.py +216 -21
  120. recce/state/__init__.py +31 -0
  121. recce/state/cloud.py +644 -0
  122. recce/state/const.py +26 -0
  123. recce/state/local.py +56 -0
  124. recce/state/state.py +119 -0
  125. recce/state/state_loader.py +174 -0
  126. recce/summary.py +25 -3
  127. recce/tasks/dataframe.py +63 -1
  128. recce/tasks/query.py +40 -3
  129. recce/tasks/rowcount.py +4 -1
  130. recce/tasks/schema.py +4 -1
  131. recce/tasks/utils.py +147 -0
  132. recce/tasks/valuediff.py +85 -57
  133. recce/util/api_token.py +11 -2
  134. recce/util/breaking.py +10 -1
  135. recce/util/cll.py +1 -2
  136. recce/util/cloud/__init__.py +15 -0
  137. recce/util/cloud/base.py +115 -0
  138. recce/util/cloud/check_events.py +190 -0
  139. recce/util/cloud/checks.py +242 -0
  140. recce/util/io.py +2 -2
  141. recce/util/lineage.py +19 -18
  142. recce/util/perf_tracking.py +85 -0
  143. recce/util/recce_cloud.py +254 -5
  144. recce/util/startup_perf.py +121 -0
  145. recce/yaml/__init__.py +2 -2
  146. {recce_nightly-1.10.0.20250625.dist-info → recce_nightly-1.30.0.20251221.dist-info}/METADATA +91 -71
  147. recce_nightly-1.30.0.20251221.dist-info/RECORD +183 -0
  148. {recce_nightly-1.10.0.20250625.dist-info → recce_nightly-1.30.0.20251221.dist-info}/WHEEL +1 -2
  149. recce/data/_next/static/abCX3x3UoIdRLEDWxx4xd/_buildManifest.js +0 -1
  150. recce/data/_next/static/chunks/181-acc61ddada3bc0ca.js +0 -43
  151. recce/data/_next/static/chunks/1bff33f1-1ef85cf5e658a751.js +0 -1
  152. recce/data/_next/static/chunks/217-879a84d70f7a907c.js +0 -2
  153. recce/data/_next/static/chunks/29e3cc0d-60045b2e47aa3916.js +0 -1
  154. recce/data/_next/static/chunks/36e1c10d-8e7be4a6c1f6ab2d.js +0 -1
  155. recce/data/_next/static/chunks/3998a672-03adacad07b346ac.js +0 -1
  156. recce/data/_next/static/chunks/3a92ee20-1081c360214f9602.js +0 -1
  157. recce/data/_next/static/chunks/42-cd3c06533f5fd47c.js +0 -9
  158. recce/data/_next/static/chunks/450c323b-fd94e7ffaa4a5efa.js +0 -1
  159. recce/data/_next/static/chunks/47d8844f-929aed9b1c73a905.js +0 -1
  160. recce/data/_next/static/chunks/608-3b079b544e5d5f5e.js +0 -15
  161. recce/data/_next/static/chunks/6dc81886-adbfa45836061d79.js +0 -1
  162. recce/data/_next/static/chunks/7a8a3e83-edf6dc64b5d5f0a5.js +0 -1
  163. recce/data/_next/static/chunks/7f27ae6c-d5f0438edd5c2a5b.js +0 -1
  164. recce/data/_next/static/chunks/86730205-cfb14e3f051bab35.js +0 -1
  165. recce/data/_next/static/chunks/8d700b6a.8bb140898499c512.js +0 -1
  166. recce/data/_next/static/chunks/92-607cd1af83c41f43.js +0 -1
  167. recce/data/_next/static/chunks/9746af58-a42b7d169cacadf0.js +0 -1
  168. recce/data/_next/static/chunks/a30376cd-de84559016d7e133.js +0 -1
  169. recce/data/_next/static/chunks/app/_not-found/page-01ed58b7f971d311.js +0 -1
  170. recce/data/_next/static/chunks/app/layout-177a410a97e0d018.js +0 -1
  171. recce/data/_next/static/chunks/app/page-da6e046a8235dbfc.js +0 -1
  172. recce/data/_next/static/chunks/b63b1b3f-4282bdcf459e075c.js +0 -1
  173. recce/data/_next/static/chunks/bbda5537-9ec25eb1dd62348a.js +0 -1
  174. recce/data/_next/static/chunks/c132bf7d-08cb668a789d6afd.js +0 -1
  175. recce/data/_next/static/chunks/ce84277d-2e5d1d46910cf052.js +0 -1
  176. recce/data/_next/static/chunks/febdd86e-c6b525341634b860.js +0 -54
  177. recce/data/_next/static/chunks/fee69bc6-2dbccaf9b90474e6.js +0 -1
  178. recce/data/_next/static/chunks/framework-ded83d71b51ce901.js +0 -1
  179. recce/data/_next/static/chunks/main-app-39061b0166c47f55.js +0 -1
  180. recce/data/_next/static/chunks/main-b5b3ae20a1405261.js +0 -1
  181. recce/data/_next/static/chunks/pages/_app-437c455677d62394.js +0 -1
  182. recce/data/_next/static/chunks/pages/_error-e7650df18ca04bde.js +0 -1
  183. recce/data/_next/static/chunks/webpack-7b49d5ba7e3a434d.js +0 -1
  184. recce/data/_next/static/css/17a96168e3a9db13.css +0 -1
  185. recce/data/_next/static/css/1b121dc4d36aeb4d.css +0 -3
  186. recce/data/_next/static/css/35c6679a098e1e34.css +0 -1
  187. recce/data/_next/static/css/951e2e0eea2d4a5b.css +0 -14
  188. recce/data/_next/static/media/montserrat-cyrillic-800-normal.22628180.woff2 +0 -0
  189. recce/data/_next/static/media/montserrat-cyrillic-ext-800-normal.94a63aea.woff2 +0 -0
  190. recce/data/_next/static/media/montserrat-latin-800-normal.6f8fa298.woff2 +0 -0
  191. recce/data/_next/static/media/montserrat-latin-ext-800-normal.013b84f9.woff2 +0 -0
  192. recce/data/_next/static/media/montserrat-vietnamese-800-normal.c0035377.woff2 +0 -0
  193. recce/data/_next/static/media/reload-image.79aabb7d.svg +0 -4
  194. recce/state.py +0 -786
  195. recce_nightly-1.10.0.20250625.dist-info/RECORD +0 -154
  196. recce_nightly-1.10.0.20250625.dist-info/top_level.txt +0 -2
  197. tests/__init__.py +0 -0
  198. tests/adapter/__init__.py +0 -0
  199. tests/adapter/dbt_adapter/__init__.py +0 -0
  200. tests/adapter/dbt_adapter/conftest.py +0 -17
  201. tests/adapter/dbt_adapter/dbt_test_helper.py +0 -298
  202. tests/adapter/dbt_adapter/test_dbt_adapter.py +0 -25
  203. tests/adapter/dbt_adapter/test_dbt_cll.py +0 -384
  204. tests/adapter/dbt_adapter/test_selector.py +0 -202
  205. tests/tasks/__init__.py +0 -0
  206. tests/tasks/conftest.py +0 -4
  207. tests/tasks/test_histogram.py +0 -129
  208. tests/tasks/test_lineage.py +0 -55
  209. tests/tasks/test_preset_checks.py +0 -64
  210. tests/tasks/test_profile.py +0 -397
  211. tests/tasks/test_query.py +0 -151
  212. tests/tasks/test_row_count.py +0 -135
  213. tests/tasks/test_schema.py +0 -122
  214. tests/tasks/test_top_k.py +0 -77
  215. tests/tasks/test_valuediff.py +0 -85
  216. tests/test_cli.py +0 -133
  217. tests/test_config.py +0 -43
  218. tests/test_connect_to_cloud.py +0 -82
  219. tests/test_core.py +0 -29
  220. tests/test_dbt.py +0 -36
  221. tests/test_pull_request.py +0 -130
  222. tests/test_server.py +0 -104
  223. tests/test_state.py +0 -134
  224. tests/test_summary.py +0 -65
  225. /recce/data/_next/static/chunks/{polyfills-42372ed130431b0a.js → a6dad97d9634a72d.js} +0 -0
  226. /recce/data/_next/static/media/{montserrat-cyrillic-ext-800-normal.e6e0d8d0.woff → montserrat-cyrillic-ext-800-normal.a4fa76b5.woff} +0 -0
  227. /recce/data/_next/static/{abCX3x3UoIdRLEDWxx4xd → nX-Uz0AH6Tc6hIQUFGqaB}/_ssgManifest.js +0 -0
  228. {recce_nightly-1.10.0.20250625.dist-info → recce_nightly-1.30.0.20251221.dist-info}/entry_points.txt +0 -0
  229. {recce_nightly-1.10.0.20250625.dist-info → recce_nightly-1.30.0.20251221.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{48614:function(e,n,i){Promise.resolve().then(i.bind(i,12767))},12767:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return lc}});var t=i(26415),l=i(85534),o=i(81983),r=i(2585),s=i(60657),a=i(32173),c=i(34282),d=i(31680),u=i(64287),h=i(78398),x=i(28733),p=i(17146),m=i(99182),f=i(45168),g=i(39055),v=i(88815),j=i(97129),y=i(87270),b=i(66908),w=i.n(b),k=i(63003);i(50758);var _=i(94725),C=i(88894);async function S(e,n){let i=(0,C.rM)()?{breaking_change_analysis:!0}:{};return(await k.U.post("/api/checks",{run_id:e,view_options:n,track_props:i})).data}async function z(){return(await k.U.get("/api/checks")).data}async function D(e){return(await k.U.get("/api/checks/".concat(e))).data}async function R(e,n){return(await k.U.patch("/api/checks/".concat(e),n)).data}async function I(e){return(await k.U.delete("/api/checks/".concat(e))).data}async function T(e){return await k.U.post("/api/checks/reorder",e)}var q=i(22672),N=i(9678),E=i(70291),L=i(15981),F=i(77622),O=i(47796),A=i(35690),M=i(97230),J=i(16177),P=i(59362),V=i(19730),W=i(34283),H=i(24332),K=i(79558),U=i(90838),Q=i(26861),B=i(8078),$=i(96463),X=i(93089),Z=i(70620),G=i(58759),Y=i(18979),ee=i(8624),en=i(70274),ei=i(74378),et=i(10550),el=i(87589),eo=i(67479),er=i(34992),es=i(61333),ea=i(68969),ec=i(63260),ed=i(8685),eu=i(67702);function eh(e){let{name:n,setName:i}=e,[o,r]=(0,j.useState)(!1),[s,a]=(0,j.useState)(n),c=(0,j.useRef)(null),d=(0,j.useCallback)(()=>{i(s),r(!1)},[i,r,s]);return(0,j.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return o&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o,c,d]),(0,t.jsx)(ea.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",className:"no-track-pii-safe",separator:(0,t.jsx)(eu.X,{color:"gray.500"}),overflow:"hidden",children:(0,t.jsx)(ec.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:o?(0,t.jsx)(ed.I,{ref:c,value:s,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(i(s),r(!1)):"Escape"===e.key&&(a(n),r(!1))},size:"sm",w:"100%"}):(0,t.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),r(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var ex=i(5849),ep=i(88736),em=i(96043),ef=i(19692),eg=i(56199);i(28350);var ev=i(22363),ej=i(70986),ey=i(92784),eb=i(5045),ew=i(31294),ek=i(65374);let e_=(0,j.createContext)(void 0),eC=()=>{let e=(0,j.useContext)(e_);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},eS=()=>(0,j.useContext)(e_);function ez(e){let{model:n,row:i,singleEnv:o,cllRunning:s}=e,a=eS(),{runAction:c}=(0,ev.$q)(),{readOnly:u}=(0,ek.$)(),{name:h,baseType:x,currentType:m,baseIndex:f,currentIndex:g}=i,v=null!=m?m:x,j=()=>{c("profile_diff",{model:n.name,columns:[h]},{showForm:!1})},y=()=>{c("histogram_diff",{model:n.name,column_name:h,column_type:v},{showForm:!1})},b=()=>{c("top_k_diff",{model:n.name,column_name:h,k:50},{showForm:!1})},w=!x||!m;return(0,t.jsx)(A.u,{label:"View column lineage",placement:"top",hasArrow:!0,isDisabled:void 0===a||void 0!==f&&void 0===g,children:(0,t.jsxs)(d.k,{alignItems:"center",gap:"3px",children:[(0,t.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:h}),(0,t.jsx)(p.L,{}),s&&(0,t.jsx)(ej.$,{size:"xs",color:"gray.400"}),!o&&"source"!==n.resource_type&&(0,t.jsx)(J.v,{children:e=>{let{isOpen:n}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.j,{display:"flex",className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:V.h,icon:(0,t.jsx)(r.J,{as:ex.D_A}),variant:"unstyled",size:"sm",color:"gray",_hover:{color:"black"},isDisabled:u,onClick:e=>{e.stopPropagation()}}),(0,t.jsx)(ey.h,{children:(0,t.jsx)(W.q,{lineHeight:"20px",children:(0,t.jsxs)(eb.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,t.jsx)(H.s,{fontSize:"10pt",onClick:j,isDisabled:w,children:"Profile Diff"}),(0,t.jsx)(H.s,{fontSize:"10pt",onClick:y,isDisabled:w||!v||!(0,ew.d)(v),children:"Histogram Diff"}),(0,t.jsx)(H.s,{fontSize:"10pt",onClick:b,isDisabled:w,children:"Top-k Diff"})]})})})]})}})]})})}function eD(e,n,i){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 o(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:o,column:r}=e;return n?(0,t.jsx)(ez,{model:n,row:o,cllRunning:null!==(l=null==i?void 0:i.get(o.name))&&void 0!==l&&l}):o.name},cellClass:function(){return"schema-column"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:o},{key:"currentType",name:"Current Type",resizable:!0,cellClass:o}],rows:Object.values(e)}}var eR=i(36495),eI=i(74744),eT=i(85658);let eq=(0,j.forwardRef)(function(e,n){let i,l,{base:o,current:r,enableScreenshot:s=!1}=e,a=eS(),[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]:{},i={};return Object.entries((0,eg.Z)(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,t]=e;i[n]={name:n,reordered:"reordered"===t}}),Object.entries(e).map((e,n)=>{let[t,l]=e;i[t].baseIndex=n+1,i[t].baseType=l.type}),Object.entries(n).map((e,n)=>{let[t,l]=e;i[t].currentIndex=n+1,i[t].currentType=l.type}),i}(null==o?void 0:o.columns,null==r?void 0:r.columns),i=null!==(e=null==r?void 0:r.resource_type)&&void 0!==e?e:null==o?void 0:o.resource_type;return i&&["model","seed","snapshot","source"].includes(i)?eD(n,null!=r?r:o,c):eD(n)},[o,r,c]),{lineageGraph:p}=(0,ef.kJ)(),m=!(null==p?void 0:p.catalogMetadata.base),f=!(null==p?void 0:p.catalogMetadata.current);m&&f?i="catalog.json is missing on both current and base environments.":m?i="catalog.json is missing on base environment.":f&&(i="catalog.json is missing on current environment.");let g=o&&void 0===o.columns,v=r&&void 0===r.columns;g&&v?l="Schema information is missing on both current and base environments.":g?l="Schema information is missing on base environment.":v&&(l="Schema information is missing on current environment.");let y=async e=>{var n;(0,C.KB)({action:"view",source:"schema_column"}),u(n=>new Map(n).set(e,!0));let i=null!==(n=null==r?void 0:r.id)&&void 0!==n?n:null==o?void 0:o.id;i&&await (null==a?void 0:a.showColumnLevelLineage(i,e)),u(n=>new Map(n).set(e,!1))},b=null==a?void 0:a.viewOptions.column_level_lineage,w=b?new Set(["".concat(b.node,"-").concat(b.column)]):new Set;return(0,t.jsxs)(d.k,{direction:"column",children:[i?(0,t.jsxs)(eR.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(eI.z,{}),i]}):l?(0,t.jsxs)(eR.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(eI.z,{}),l]}):(0,t.jsx)(t.Fragment,{}),x.length>0&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(eT.o,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:h,rows:x,renderers:{noRowsFallback:(0,t.jsx)(eT.W,{})},className:"rdg-light no-track-pii-safe",enableScreenshot:s,ref:n,rowKeyGetter:e=>{var n;let i=null!==(n=null==r?void 0:r.id)&&void 0!==n?n:null==o?void 0:o.id;return"".concat(i,"-").concat(e.name)},selectedRows:w,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}})})]})}),eN=(0,j.forwardRef)(function(e,n){let i,l,{current:o}=e,r=eS(),[s,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,i=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:o,column:r}=e;return n?(0,t.jsx)(ez,{model:n,row:o,cllRunning:null!==(l=null==i?void 0:i.get(o.name))&&void 0!==l&&l,singleEnv:!0}):o.name},cellClass:"schema-column"},{key:"type",name:"Type",resizable:!0,cellClass:"schema-column"}],rows:Object.entries(e).map((e,n)=>{let[i,t]=e;return{name:i,index:n+1,type:t.type}})}})(null==o?void 0:o.columns,o,s),[o,s]),{lineageGraph:h}=(0,ef.kJ)();(null==h?void 0:h.catalogMetadata.current)||(i="catalog.json is missing."),o&&void 0===o.columns&&(l="Schema information is missing.");let x=async e=>{(0,C.KB)({action:"view",source:"schema_column"}),a(n=>new Map(n).set(e,!0));let n=null==o?void 0:o.id;n&&await (null==r?void 0:r.showColumnLevelLineage(n,e)),a(n=>new Map(n).set(e,!1))},p=null==r?void 0:r.viewOptions.column_level_lineage,m=p?new Set(["".concat(p.node,"-").concat(p.column)]):new Set;return(0,t.jsxs)(d.k,{direction:"column",children:[i?(0,t.jsxs)(eR.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(eI.z,{}),i]}):l?(0,t.jsxs)(eR.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(eI.z,{}),l]}):(0,t.jsx)(t.Fragment,{}),u.length>0&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(eT.o,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:c,rows:u,renderers:{noRowsFallback:(0,t.jsx)(eT.W,{})},className:"rdg-light",enableScreenshot:!1,ref:n,rowKeyGetter:e=>{let n=null==o?void 0:o.id;return"".concat(n,"-").concat(e.name)},selectedRows:m,onSelectedRowsChange:()=>{},onCellClick:async e=>{await x(e.row.name)},rowClass:()=>void 0!==r?"row-normal row-selectable":"row-normal"})})]})});async function eE(e){return(await k.U.post("/api/select",e)).data}var eL=i(36550);i(84351);let eF=e=>{let{style:n,children:i,gutterSize:l=5,...o}=e;return(0,t.jsx)(eL.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...o,children:i})},eO=e=>{let{style:n,children:i,gutterSize:l=5,...o}=e;return(0,t.jsx)(eL.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...o,children:i})};var eA=i(92257),eM=i(73489),eJ=i(24072);let eP=ex.Nbv,eV=ex.sFB,eW=ex.UGs;function eH(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:eP}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:eV}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:eW}:{color:"inherit",backgroundColor:"white",icon:void 0}}function eK(e){if("model"===e)return{color:"#c0eafd",icon:eM.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:eJ._MV};if("source"===e)return{color:"#a6dda6",icon:eM.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:eJ.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:eJ.R1C};if("seed"===e)return{color:"#a6dda6",icon:eM.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:eM.Dmm};else return{color:"inherit",icon:void 0}}function eU(e,n){if(!e||!n)return;let i=Object.keys(e),t=Object.keys(n);if(i.length!==t.length)return!0;for(let e=0;e<i.length;e++)if(i[e]!==t[e])return!0;for(let i of t)if(!e[i]||e[i].type!==n[i].type)return!0;return!1}var eQ=i(72752);let eB=e=>{let n,i,{node:o,selected:s,onSelect:a,schemaChanged:c}=e,{icon:u}=eK(o.resourceType),{base:h,current:x}=o.data;if(c){var p;n=null===(p=(0,eQ.N)("schema_diff"))||void 0===p?void 0:p.icon,i=eH("modified").color}else!h&&x?(n=eH("added").icon,i=eH("added").color):h&&!x&&(n=eH("removed").icon,i=eH("removed").color);return(0,t.jsxs)(d.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:s?"gray.100":"inherit",onClick:()=>{a(o.id)},alignItems:"center",gap:"5px",children:[(0,t.jsx)(r.J,{as:u}),(0,t.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:o.name}),n&&i&&(0,t.jsx)(r.J,{as:n,color:i})]})},e$=(0,j.forwardRef)(function(e,n){let{check:i}=e,{lineageGraph:l}=(0,ef.kJ)(),o=i.params,r=[..._.V.check(i.check_id),"select"],{isLoading:s,error:a,refetch:c,data:d}=(0,y.a)({queryKey:r,queryFn:async()=>eE({select:o.select,exclude:o.exclude,packages:o.packages,view_mode:o.view_mode}),refetchOnMount:!0,enabled:!o.node_id}),[u,h]=(0,j.useMemo)(()=>{var e,n,i;let t=[],r=[],s=[],a=[];if(o.node_id)for(let e of o.node_id instanceof Array?o.node_id:[o.node_id]){let n=null==l?void 0:l.nodes[e];n&&t.push(n)}else for(let n of null!==(e=null==d?void 0:d.nodes)&&void 0!==e?e:[]){let e=null==l?void 0:l.nodes[n];e&&t.push(e)}let c=t.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of c)eU(null===(n=e.data.base)||void 0===n?void 0:n.columns,null===(i=e.data.current)||void 0===i?void 0:i.columns)?r.push(e.id):!e.data.base&&e.data.current?s.push(e.id):e.data.base&&!e.data.current&&a.push(e.id);function u(e){return r.includes(e.id)?3:s.includes(e.id)?2:a.includes(e.id)?1:0}return c.sort((e,n)=>{let i=u(e),t=u(n);return i!==t?t-i:e.name.localeCompare(n.name)}),[c,r]},[o.node_id,null==d?void 0:d.nodes,l]),[x,p]=(0,j.useState)(0);if(s)return(0,t.jsx)(q.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,t.jsxs)(q.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",a.message]});if(0==u.length)return(0,t.jsx)(q.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x<u.length){let e=u[x];return(0,t.jsxs)(eF,{sizes:[80,20],minSize:30,style:{height:"100%"},children:[(0,t.jsx)(eq,{base:e.data.base,current:e.data.current,enableScreenshot:!0,ref:n}),(0,t.jsx)(eA.aV,{overflow:"auto",backgroundColor:"white",children:u.map((e,n)=>(0,t.jsx)(eB,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{p(n)}},n))})]})}return(0,t.jsx)(t.Fragment,{})});var eX=i(93737),eZ=i(89280);function eG(e){let{value:n,onChange:i}=e,{readOnly:l}=(0,ek.$)(),[r,s]=(0,j.useState)(!1),[a,c]=(0,j.useState)(),u=(0,j.useRef)(null),h=()=>{i&&(i(a),s(!1))};return((0,j.useEffect)(()=>{if(r&&u.current){let e=u.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[r]),r)?(0,t.jsxs)(d.k,{direction:"column",align:"flex-end",height:"100%",className:"no-track-pii-safe",children:[(0,t.jsx)(eZ.g,{value:a,onChange:e=>{c(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),h())},ref:u,flex:1}),(0,t.jsxs)(d.k,{gap:"12px",alignItems:"flex-end",children:[(0,t.jsx)(o.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,t.jsx)(Q.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:h,children:"Update"})]})]}):(0,t.jsx)(K.x,{className:"no-track-pii-safe",height:"100%",overflow:"auto",fontSize:"11pt",onClick:l?void 0:()=>{c(null!=n?n:""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var eY=i(44482);function e0(){let e=(0,s.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,i){e({title:n,description:"".concat(i),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}function e1(){let e=(0,L._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return e1=function(){return e},e}function e2(e){return e.description?e.description:"_(no description)_"}var e5=i(81994),e4=i(50054),e8=i(81083),e3=i(60105),e6=i(32985),e9=i(56891),e7=i(8567),ne=i(1820),nn=i(87121),ni=i(80794),nt=i(19078),nl=i(17227),no=i(22750),nr=i(64315),ns=i(50577),na=i.n(ns);function nc(e){let n=(0,nt.D)(e);return(0,nl.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function nd(e){let n=(0,nt.D)(e);return(0,no.B)(n,new Date,{addSuffix:!0})}function nu(e){let n=new Set,i=new Set;if(null==e?void 0:e.nodes)for(let o of Object.values(e.nodes)){var t,l;(null===(t=o.data.base)||void 0===t?void 0:t.schema)&&n.add(o.data.base.schema),(null===(l=o.data.current)||void 0===l?void 0:l.schema)&&i.add(o.data.current.schema)}return[n,i]}function nh(e){return Object.values(e).every(e=>null===e)?[(0,t.jsx)(d.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,i]=e;return"url"!==n&&null!=i}).map(e=>{let[n,i]=e;return(0,t.jsxs)(eA.HC,{ml:"10px",children:[n,": ",i]},n)})}function nx(){var e,n,i,l;let{envInfo:s,reviewMode:a,lineageGraph:c}=(0,ef.kJ)(),{isOpen:u,onOpen:x,onClose:p}=(0,F.q)(),m=null==s?void 0:s.git,f=null==s?void 0:s.pullRequest,g={...m,...f},v=null==s?void 0:null===(e=s.dbt)||void 0===e?void 0:e.base,j=null==s?void 0:null===(n=s.dbt)||void 0===n?void 0:n.current,y=(null==v?void 0:v.generated_at)?nc(v.generated_at):"",b=(null==j?void 0:j.generated_at)?nc(j.generated_at):"",w="",k="";v&&(w=v.generated_at?nd(v.generated_at):""),j&&(k=j.generated_at?nd(j.generated_at):"");let[_,C]=nu(c);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.u,{label:"Environment Info",placement:"bottom-end",children:(0,t.jsxs)("div",{className:"flex items-center hover:cursor-pointer hover:text-black",onClick:x,children:[(0,t.jsxs)("div",{className:"hidden text-sm lg:flex lg:flex-col",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"no-track-pii-safe",children:Array.from(_).join(", ")})," (",w,")"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"no-track-pii-safe",children:Array.from(C).join(", ")})," (",k,")"]})]}),(0,t.jsx)(V.h,{size:"sm",variant:"unstyled","aria-label":"Environment Info",icon:(0,t.jsx)(r.J,{verticalAlign:"middle",as:nr.aU,boxSize:"16px"})})]})}),(0,t.jsxs)(X.u_,{isOpen:u,onClose:p,size:"3xl",children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{children:"Environment Information"}),(0,t.jsx)(Y.o,{}),(0,t.jsx)(ee.f,{children:(0,t.jsxs)(d.k,{direction:"column",gap:"5px",children:[a?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(h.X,{size:"sm",children:"Review Information"}),(0,t.jsxs)(eA.QI,{spacing:1,children:[g.url&&(0,t.jsxs)(eA.HC,{ml:"10px",children:["url:"," ",(0,t.jsx)(o.r,{href:g.url,color:"blue.500",isExternal:!0,children:g.url})]}),!na()(g)&&nh(g)]})]})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(h.X,{size:"sm",children:"Dev Information"}),(0,t.jsx)(eA.QI,{spacing:1,children:m&&nh(m)})]})}),(0,t.jsx)(E.i,{}),(null==s?void 0:s.adapterType)==="dbt"&&(0,t.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(h.X,{size:"sm",children:"DBT"}),(0,t.jsx)(e8.x,{children:(0,t.jsxs)(e3.i,{variant:"simple",children:[(0,t.jsx)(e6.h,{children:(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(e7.Th,{}),(0,t.jsx)(e7.Th,{children:"base"}),(0,t.jsx)(e7.Th,{children:"current"})]})}),(0,t.jsxs)(ne.p,{children:[(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(nn.Td,{children:"schema"}),(0,t.jsx)(nn.Td,{className:"no-track-pii-safe",children:JSON.stringify(Array.from(_))}),(0,t.jsx)(nn.Td,{className:"no-track-pii-safe",children:JSON.stringify(Array.from(C))})]}),(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(nn.Td,{children:"version"}),(0,t.jsx)(nn.Td,{children:null==v?void 0:v.dbt_version}),(0,t.jsx)(nn.Td,{children:null==j?void 0:j.dbt_version})]}),(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(nn.Td,{children:"timestamp"}),(0,t.jsx)(nn.Td,{children:y}),(0,t.jsx)(nn.Td,{children:b})]})]})]})})]}),(null==s?void 0:s.adapterType)==="sqlmesh"&&(0,t.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(h.X,{size:"sm",children:"SQLMesh"}),(0,t.jsx)(e8.x,{children:(0,t.jsxs)(e3.i,{variant:"simple",children:[(0,t.jsx)(e6.h,{children:(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(e7.Th,{}),(0,t.jsx)(e7.Th,{children:"base"}),(0,t.jsx)(e7.Th,{children:"current"})]})}),(0,t.jsx)(ne.p,{children:(0,t.jsxs)(e9.Tr,{children:[(0,t.jsx)(nn.Td,{children:"Environment"}),(0,t.jsx)(nn.Td,{className:"no-track-pii-safe",children:null===(i=s.sqlmesh)||void 0===i?void 0:i.base_env}),(0,t.jsx)(nn.Td,{className:"no-track-pii-safe",children:null===(l=s.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,t.jsx)(ni.m,{children:(0,t.jsx)(Q.z,{colorScheme:"blue",mr:3,onClick:p,children:"Close"})})]})]})]})}function np(e){var n;let{value:i,onChange:l,onRun:o,onRunBase:s,onRunDiff:a,label:c,CustomEditor:u,options:h={},manifestData:x,schemas:m,...f}=e,{readOnly:g}=(0,ek.$)(),v="";return x&&(v=x.generated_at?nd(x.generated_at):""),(0,t.jsxs)(t.Fragment,{children:[(null!==(n=null!=c?c:o)&&void 0!==n?n:s)&&(0,t.jsxs)(d.k,{backgroundColor:"#EDF2F880",height:"40px",minH:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",flex:"0 0 40px",children:[(0,t.jsx)(K.x,{as:"strong",children:c?c.toUpperCase():""}),x&&(0,t.jsxs)("span",{className:"ml-1",children:["(",m&&(0,t.jsxs)("span",{children:[m,", "]}),(0,t.jsx)("span",{children:v}),")"]}),(0,t.jsx)(p.L,{}),(null!=o?o:s)&&(0,t.jsx)(Q.z,{size:"sm",variant:"outline",onClick:null!=o?o:s,backgroundColor:"white",leftIcon:(0,t.jsx)(r.J,{as:eJ.gmG}),padding:"6px 12px",isDisabled:g,children:"Run Query"})]}),null!=u?u:(0,t.jsx)(e4.ML,{className:"no-track-pii-safe",language:"sql",theme:"vs",value:i,onChange:e=>{void 0!==e&&l&&l(e)},onMount:(e,n)=>{o&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,o),s&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,s),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{extraEditorClassName:"no-track-pii-safe",tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...h}})]})}function nm(e){var n;let i,l,{value:o,baseValue:r,onChange:s,onChangeBase:a,onRun:c,onRunBase:u,onRunDiff:h,options:x={},labels:p,BaseEnvironmentSetupGuide:m,...f}=e,g=p?p[0]:"Base",v=p?p[1]:"Current",{envInfo:j,lineageGraph:y}=(0,ef.kJ)();(null==j?void 0:null===(n=j.dbt)||void 0===n?void 0:n.base)&&j.dbt.current&&(i=j.dbt.base,l=j.dbt.current);let[b,w]=nu(y);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(d.k,{height:"100%",gap:0,children:[(0,t.jsx)(e5.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,t.jsx)(np,{label:g,value:null!=r?r:"",onChange:a,onRunBase:u,options:x,CustomEditor:m,manifestData:null!=i?i:void 0,schemas:Array.from(b).join(", "),...f})}),(0,t.jsx)(e5.K,{height:"100%",width:"50%",gap:0,children:(0,t.jsx)(np,{label:v,value:o,onChange:s,onRun:c,options:x,manifestData:null!=l?l:void 0,schemas:Array.from(w).join(", "),...f})})]})})}var nf=i(64625),ng=i(34272),nv=i(73038),nj=i(6487);let ny=(0,ng.G)((e,n)=>{var i,o,r,s,a;let{isRunning:c,isAborting:u,progress:h,error:x,run:p,onCancel:m,viewOptions:f,onViewOptionsChanged:g,RunResultView:v,children:j,onExecuteRun:y}=e,b=null!==(r=null==x?void 0:null===(o=x.response)||void 0===o?void 0:null===(i=o.data)||void 0===i?void 0:i.detail)&&void 0!==r?r:null==p?void 0:p.error;if(b)return(0,t.jsxs)(eR.b,{status:"error",children:[(0,t.jsx)(eI.z,{}),"Error: ",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?void 0:null===(s=p.progress)||void 0===s?void 0:s.message)&&(e=p.progress.message),(0,t.jsx)(q.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,t.jsxs)(N.g,{children:[(0,t.jsxs)(d.k,{alignItems:"center",children:[(null==h?void 0:h.percentage)==null?(0,t.jsx)(nv.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,t.jsx)(nv.D,{size:"20px",value:100*h.percentage,mr:"8px"}),u?(0,t.jsx)(t.Fragment,{children:"Aborting..."}):(0,t.jsx)(t.Fragment,{children:e})]}),!u&&(0,t.jsx)(Q.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!p)return(0,t.jsx)(q.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(j&&v)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!j&&!v)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,t.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",className:"no-track-pii-safe",children:[v&&(null!==(a=p.error)&&void 0!==a?a:p.result)&&(0,t.jsx)(nj.SV,{children:(0,t.jsx)(v,{ref:n,run:p,viewOptions:f,onViewOptionsChanged:g})}),null==j?void 0:j({run:p,viewOptions:f,onViewOptionsChanged:g})]})});var nb=i(66068),nw=i(61655),nk=i(21862),n_=i(32889),nC=i(2893),nS=i(31138),nz=i(99921);i(9602),i(53893);var nD=i(34062),nR=i(48862),nI=i(88571),nT=i(19126),nq=i(19981),nN=i(55120);function nE(e){let{node:n}=e,{icon:i}=eK(n.resourceType);return(0,t.jsx)(A.u,{hasArrow:!0,label:"Type of resource",children:(0,t.jsxs)(M.Vp,{children:[(0,t.jsx)(M.AD,{as:i}),(0,t.jsx)(M.Sn,{children:n.resourceType})]})})}function nL(e){let{rowCount:n}=e,i=n.base,l=n.curr,o=null===n.base?"N/A":"".concat(n.base," rows"),s=null===n.curr?"N/A":"".concat(n.curr," rows");return null===i&&null===l?(0,t.jsx)(t.Fragment,{children:" Failed to load"}):null===i||null===l?(0,t.jsxs)(x.U,{children:[(0,t.jsx)(K.x,{children:o}),(0,t.jsx)(r.J,{as:nT.Rgz}),(0,t.jsx)(K.x,{children:s})]}):i===l?(0,t.jsxs)(x.U,{children:[(0,t.jsx)(K.x,{children:s}),(0,t.jsx)(r.J,{as:nq.lxc,color:"gray.500"}),(0,t.jsx)(K.x,{color:"gray.500",children:"No Change"})]}):i<l?(0,t.jsxs)(x.U,{children:[(0,t.jsx)(K.x,{children:s}),(0,t.jsx)(r.J,{as:nq.Tvk,color:"green.500"}),(0,t.jsx)(K.x,{color:"green.500",children:(0,nN.T)(i,l)})]}):(0,t.jsxs)(x.U,{children:[(0,t.jsx)(K.x,{children:s}),(0,t.jsx)(r.J,{as:nq.ebp,color:"red.500"}),(0,t.jsx)(K.x,{color:"red.500",children:(0,nN.T)(i,l)})]})}function nF(e){var n,i,l,o;let r,{rowCount:s,node:a,onRefresh:c,isFetching:d}=e,{readOnly:u}=(0,ek.$)(),{runsAggregated:h}=(0,ef.kJ)(),x=null==h?void 0:null===(n=h[a.id])||void 0===n?void 0:n.row_count_diff.result,p=null===(i=(0,eQ.N)("row_count_diff"))||void 0===i?void 0:i.icon,m=null!=s?s:x;if(m){let e=null!==(l=m.base)&&void 0!==l?l:"N/A",n=null!==(o=m.curr)&&void 0!==o?o:"N/A";r="".concat(e," -> ").concat(n," rows")}return(0,t.jsx)(A.u,{label:r,children:(0,t.jsxs)(M.Vp,{children:[(0,t.jsx)(M.AD,{as:p}),(0,t.jsx)(M.Sn,{children:m||d?(0,t.jsx)(nI.N,{isLoaded:!d,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,t.jsx)(nL,{rowCount:m}):"row count"}):(0,t.jsx)(t.Fragment,{children:"row count"})}),c&&(0,t.jsx)(M.bq,{as:V.h,isLoading:d,"aria-label":"Query Row Count",icon:(0,t.jsx)(eo.n,{}),size:"xs",onClick:c,isDisabled:u})]})})}function nO(e){var n,i,l;let o,{rowCount:r,node:s,onRefresh:a,isFetching:c}=e,{runsAggregated:d,refetchRunsAggregated:u}=(0,ef.kJ)(),h=null==d?void 0:null===(n=d[s.id])||void 0===n?void 0:n.row_count.result,x=null===(i=(0,eQ.N)("row_count"))||void 0===i?void 0:i.icon,p=null!=r?r:h;if(p){let e=null!==(l=p.curr)&&void 0!==l?l:"N/A";o="".concat(e," rows")}return(0,t.jsxs)(M.Vp,{children:[(0,t.jsx)(M.AD,{as:x}),(0,t.jsx)(M.Sn,{children:p||c?(0,t.jsx)(nI.N,{isLoaded:!c,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:p?"".concat(o):"row count"}):(0,t.jsx)(t.Fragment,{children:"row count"})}),a&&(0,t.jsx)(M.bq,{as:V.h,isLoading:c,"aria-label":"Query Row Count",icon:(0,t.jsx)(eo.n,{}),size:"xs",onClick:a,disabled:"base"===s.from})]})}let nA=e=>{let{node:n,action:i}=e,{status:o,skipReason:r,run:s}=i;if("pending"===o)return(0,t.jsx)(nv.D,{size:"20px",value:0});if("skipped"===o)return(0,t.jsx)(M.Vp,{backgroundColor:"gray.100",children:(0,t.jsxs)(d.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,t.jsx)(l.x,{children:"Skipped"}),r&&(0,t.jsx)(A.u,{label:r,children:(0,t.jsx)(nD.s,{})})]})});if(!s)return(0,t.jsx)(nv.D,{isIndeterminate:!0,size:"20px"});let{error:a,result:c,run_id:u,progress:h}=s;if("running"===o)return(null==h?void 0:h.percentage)===void 0?(0,t.jsx)(nv.D,{isIndeterminate:!0,size:"20px"}):(0,t.jsx)(nv.D,{size:"20px",value:100*h.percentage});if(a)return(0,t.jsxs)(d.k,{fontSize:"10pt",color:"gray",children:[(0,t.jsx)(l.x,{children:"Error"}),r&&(0,t.jsx)(A.u,{label:a,children:(0,t.jsx)(nR.a,{})})]});if("value_diff"===s.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,t.jsx)(M.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,t.jsx)(M.Sn,{children:(0,t.jsx)(d.k,{fontSize:"10pt",color:e>0?"red":"green",alignItems:"center",gap:"3px",children:e>0?"".concat(e," columns mismatched"):"All columns match"})})})}if("row_count_diff"===s.type){let e=s.result;return(0,t.jsx)(nF,{rowCount:e[n.name],node:n})}if("row_count"===s.type){let e=s.result;return(0,t.jsx)(nO,{rowCount:e[n.name],node:n})}return(0,t.jsx)(t.Fragment,{children:u})};function nM(e){var n;let i,l,{rowCount:o}=e,r=o.base,s=o.curr,a=null===o.base?"N/A":"".concat(o.base," Rows"),c=null===o.curr?"N/A":"".concat(o.curr," Rows");return null===r&&null===s?(i="Failed to load",l="gray"):null===r||null===s?(i="".concat(a," -> ").concat(c),l=null===r?"green":"red"):r===s?(i="=",l="gray"):r!==s&&(i="".concat((0,nN.T)(r,s)," Rows"),l=r<s?"green":"red"),(0,t.jsxs)(M.Vp,{colorScheme:l,children:[(0,t.jsx)(M.AD,{as:null===(n=(0,eQ.N)("row_count_diff"))||void 0===n?void 0:n.icon}),(0,t.jsx)(M.Sn,{children:i})]})}let nJ={breaking:"Breaking",non_breaking:"Non Breaking",partial_breaking:"Partial Breaking",unknown:"Unknown"},nP=e=>{var n;let i,o,{id:s,inverted:a}=e,{lineageGraph:c,runsAggregated:u}=(0,ef.kJ)(),h=null==u?void 0:u[s],x=null==c?void 0:c.nodes[s];if(!h&&!x)return(0,t.jsx)(t.Fragment,{});if((null==x?void 0:x.data.base)&&x.data.current&&(i=eU(x.data.base.columns,x.data.current.columns)),null==h?void 0:h.row_count_diff){let e=h.row_count_diff;o=e.result.curr!==e.result.base}let m=a?"white":eH("modified").color;return(0,t.jsxs)(d.k,{flex:"1",children:[void 0!==i&&(0,t.jsx)(A.u,{label:"Schema (".concat(i?"changed":"no change",")"),openDelay:500,children:(0,t.jsx)(l.x,{height:"16px",children:(0,t.jsx)(r.J,{as:null===(n=(0,eQ.N)("schema_diff"))||void 0===n?void 0:n.icon,color:i?m:a?"gray":"lightgray"})})}),(0,t.jsx)(p.L,{}),(null==h?void 0:h.row_count_diff)&&void 0!==o&&(0,t.jsx)(A.u,{label:"Row count (".concat(o?"changed":"=",")"),openDelay:500,children:(0,t.jsx)(l.x,{children:(0,t.jsx)(nM,{rowCount:h.row_count_diff.result})})})]})},nV=e=>{let{checked:n,onClick:i}=e;return(0,t.jsx)(d.k,{onClick:i,alignSelf:"center",alignItems:"center",cursor:"pointer",children:n?(0,t.jsx)(r.J,{boxSize:"20px",as:eM.xik}):(0,t.jsx)(r.J,{boxSize:"20px",as:eM.hGI})})},nW=e=>{let{name:n,color:i,resourceType:o}=e;return(0,t.jsx)(l.x,{flex:"1",color:i,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:(0,t.jsx)(A.u,{label:"model"===o?n:"".concat(n," (").concat(o,")"),placement:"top",children:n})})};var nH=i(35134),nK=i(56761),nU=i(89884),nQ=i(78933);async function nB(e){return(await k.U.post("/api/checks",{type:"schema_diff",params:e})).data}let n$={add_or_remove:"Unavailable for added or removed resources."};var nX=i(43172);let nZ=e=>{var n;let[i,t]=(0,j.useState)(!1),[l,o]=(0,j.useState)(!1),[,r]=(0,ef.P)(),{error:s,data:a}=(0,y.a)({queryKey:_.V.run(null!=e?e:""),queryFn:async()=>(0,nf.Qp)(null!=e?e:"",i?2:0),enabled:!!e,refetchInterval:!!i&&50,retry:!1});(0,j.useEffect)(()=>{(s||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(i&&t(!1),((null==a?void 0:a.type)==="row_count_diff"||(null==a?void 0:a.type)==="row_count")&&r()),(null==a?void 0:a.status)==="running"&&t(!0)},[a,s,i,r]);let c=(0,j.useCallback)(async()=>{o(!0),e&&await (0,nf.Eg)(e)},[e,o]),d=(null==a?void 0:a.type)?null===(n=(0,eQ.N)(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:i,aborting:l,error:s,onCancel:c,RunResultView:d}};var nG=i(62717),nY=i(99770),n0=i(96300),n1=i(5718),n2=i.n(n1),n5=i(62155),n4=i(8939),n8=i.n(n4);let n3="ignore-screenshot";function n6(e){let{renderLibrary:n="html2canvas",imageType:i="png",backgroundColor:l=null,boardEffect:o=!0,shadowEffect:r=!1,borderStyle:s="solid 1px #ccc",borderRadius:a="10px",onSuccess:c,onError:h,ignoreElements:x}=e,[p,m]=(0,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:i}=(0,F.q)(),[l,o]=(0,j.useState)();return{onOpen:n,setImgBlob:o,ImageDownloadModal:function(){let[n,o]=(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?void 0:n.result)!=null&&o(e.target.result)}},[o]),(0,t.jsxs)(X.u_,{size:"3xl",isOpen:e,onClose:i,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{children:"Screenshot Preview"}),(0,t.jsx)(Y.o,{}),(0,t.jsxs)(ee.f,{children:[(0,t.jsxs)(d.k,{px:"10px",gap:"10px",direction:"column",children:[(0,t.jsxs)(d.k,{alignItems:"center",gap:"5px",children:[(0,t.jsx)(nD.s,{color:"red.600"}),(0,t.jsx)(K.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,t.jsx)(K.x,{children:"Please download it directly"})]}),(0,t.jsx)(u.E,{src:n,alt:"screenshot"})]}),(0,t.jsxs)(ni.m,{children:[(0,t.jsx)(Q.z,{mr:3,onClick:i,children:"Close"}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,nl.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");n8()(l,n),i()},children:"Download"})]})]})]})}}}(),b=async()=>{var e,i;if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let t=null!==(e=f.current.element)&&void 0!==e?e:f.current,c=t.style.overflow,d=t.style.border,u=t.style.borderRadius,h=t.style.backgroundColor,p=t.style.height;try{t.style.overflow="hidden",t.style.border=o?s:"",t.style.borderRadius=o?a:"",t.style.backgroundColor=null!=l?l:"",t.style.height="".concat(String(t.offsetHeight),"px");let e=document.createElement("style");document.head.appendChild(e),null===(i=e.sheet)||void 0===i||i.insertRule("body > div:last-child img { display: inline-block; }"),m("loading");let c="html2canvas"===n?await n2()(t,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,n5.rT)(t,{filter:x?e=>!x(e):void 0});e.remove();let d=r?document.createElement("canvas"):c;if(r){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{t.style.overflow=c,t.style.border=d,t.style.borderRadius=u,t.style.backgroundColor=h,t.style.height=p}};return{status:p,isLoading:"loading"===p,isErrored:"error"===p,isSuccess:"success"===p,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(i)]:b()})]),m("success"),c&&c()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),m("success")):(m("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function n9(e){var n;let{successToast:i,failToast:l}=e0(),{isLoading:o,copyToClipboard:r,ImageDownloadModal:s,ref:a}=n6({imageType:"png",shadowEffect:!0,backgroundColor:null!==(n=null==e?void 0:e.backgroundColor)&&void 0!==n?n:null,onSuccess:()=>{i("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)&&void 0!==e?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)&&void 0!==e?e:a.current).style.boxShadow=""}},[a]),u=(0,j.useCallback)(async()=>{if(a.current){var e;await r(),(null!==(e=a.current.element)&&void 0!==e?e:a.current).style.boxShadow=""}else l("Failed to copy image to clipboard","No content to copy")},[a,r,l]);return{ref:a,CopyToClipboardButton:function(e){let{imageType:n="png",...i}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.z,{size:"sm",leftIcon:(0,t.jsx)(ei.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:o,onMouseEnter:c,onMouseLeave:d,onClick:u,children:"Copy to Clipboard"}),(0,t.jsx)(s,{})]})},onMouseEnter:c,onMouseLeave:d,onCopyToClipboard:u}}function n7(e){let n=new Date,i=new Date;return(i.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,nl.WU)(e,"HH:mm"):i.toDateString()===e.toDateString()?"Yesterday, "+(0,nl.WU)(e,"HH:mm"):(0,nl.WU)(e,"MMM d, HH:mm")}let ie=e=>{let{run:n}=e,i="running"===n.status,l=n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let o="",r="";"successful"===l||"finished"===l?(o="green",r="Finished"):"failed"===l?(o="red",r="Failed"):"cancelled"===l?(o="gray",r="Cancelled"):"running"===l?(o="blue",r="Running"):(o="green",r="Finished");let s=n.run_at?n7(new Date(n.run_at)):null;return(0,t.jsxs)(d.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[i&&(0,t.jsx)(ej.$,{size:"xs",color:"".concat(o,".400")}),(0,t.jsx)(K.x,{fontWeight:500,color:"".concat(o,".400"),children:r}),(0,t.jsx)(K.x,{children:"•"}),(0,t.jsx)(K.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:s})]})},ii=e=>{var n;return(0,t.jsxs)(d.k,{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)&&void 0!==n?n:"center",gap:"12px",children:[(0,t.jsx)(r.J,{as:nT.H33,width:"20px",height:"20px",color:"blue.900"}),e.children,(0,t.jsx)(p.L,{}),(0,t.jsx)(nK.P,{onClick:e.onClose})]})},it=()=>(0,t.jsx)(o.r,{href:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",isExternal:!0,color:"rgba(49, 130, 206, 1)",fontWeight:"bold",textDecoration:"underline",children:"Learn how"});var il=i(27462),io=i(34101),ir=i(23851),is=i(17437),ia={src:"/_next/static/media/reload-image.79aabb7d.svg"};async function ic(){return(await k.U.post("/api/connect")).data}function id(e){var n;let{handleParentClose:i,ignoreCookie:l=!1}=e,{authed:o}=(0,ek.$)(),{isOpen:r,onOpen:s,onClose:a}=(0,F.q)({defaultIsOpen:!o}),c=null!==(n=ir.Z.get("authState"))&&void 0!==n?n:"pending",[d,h]=(0,j.useState)(l?"pending":c);function x(){i&&i(),a()}let p=(0,j.useCallback)(()=>{i&&i(),a()},[i,a]),m=(0,j.useCallback)(()=>{o||"pending"!==d?o&&p():s()},[d,o,p,s]);return((0,j.useEffect)(()=>{m()},[m]),"ignored"===d&&!l||o)?null:(0,t.jsxs)(X.u_,{size:"lg",isCentered:!0,isOpen:r,onClose:x,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{borderRadius:"2xl",children:["authenticating"!==d&&(0,t.jsx)(G.x,{className:"text-center",fontSize:"2xl",children:"Use Recce Cloud for Free"}),"authenticating"===d&&(0,t.jsxs)(G.x,{className:"text-center",children:[(0,t.jsx)(u.E,{className:"mx-auto mb-2",src:ia.src}),(0,t.jsx)("div",{children:"Reload to Finish"})]}),"authenticating"!==d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee.f,{className:"space-y-2 font-light",children:(0,t.jsxs)("ul",{className:"list-inside list-disc",children:[(0,t.jsx)("li",{children:"Share your work with teammates, no setup needed"}),(0,t.jsx)("li",{children:"Reviewers can access it with a link."}),(0,t.jsx)("li",{children:"It’s recommended, but optional."})]})}),(0,t.jsx)(ni.m,{children:(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,t.jsx)(Q.z,{className:"w-full !rounded-lg !font-medium",colorScheme:"brand",rightIcon:(0,t.jsx)(is.$OI,{}),onClick:async()=>{h("authenticating");let{connection_url:e}=await ic();window.open(e,"_blank")},children:"Use Recce Cloud"}),(0,t.jsx)(Q.z,{className:"!rounded-lg !font-medium",variant:"solid",colorScheme:"gray",size:"sm",onClick:()=>{x()},children:"Skip"}),(0,t.jsx)(Q.z,{className:"!font-medium !text-black",variant:"link",size:"sm",onClick:()=>{ir.Z.set("authState","ignored",{expires:30}),h("ignored")},children:"Snooze for 30 days"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee.f,{className:"space-y-2 self-center font-light",children:(0,t.jsx)("p",{children:"Reload to complete connection to Recce Cloud"})}),(0,t.jsx)(ni.m,{children:(0,t.jsx)(Q.z,{className:"w-full",colorScheme:"brand",onClick:()=>{window.location.reload()},children:"Reload"})})]})]})]})}let iu=e=>{let n=nG.ZP.stringify(e,null,2);return(0,t.jsx)(e4.ML,{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}})},ih=e=>{let{runType:n}=e,{isOpen:i,onClose:l}=(0,F.q)({defaultIsOpen:!0});if(!i)return(0,t.jsx)(t.Fragment,{});switch(n){case"row_count":return(0,t.jsx)(ii,{onClose:l,children:(0,t.jsxs)(K.x,{children:["Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,t.jsx)(it,{})]})});case"profile":return(0,t.jsx)(ii,{onClose:l,children:(0,t.jsxs)(K.x,{children:["Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,t.jsx)(it,{})]})});default:return(0,t.jsx)(t.Fragment,{})}},ix=e=>{let{disableCopyToClipboard:n,onCopyToClipboard:i,onMouseEnter:l,onMouseLeave:o}=e,{authed:r}=(0,ek.$)(),{handleShareClick:s}=(0,io.z)(),[a,c]=(0,j.useState)(!1);return(0,t.jsxs)(J.v,{children:[(0,t.jsx)(P.j,{as:Q.z,size:"sm",rightIcon:(0,t.jsx)(nY.v,{}),variant:"outline",children:"Share"}),(0,t.jsxs)(W.q,{minW:"0",children:[(0,t.jsx)(H.s,{fontSize:"14px",icon:(0,t.jsx)(ei.T,{}),onClick:i,onMouseEnter:l,onMouseLeave:o,isDisabled:n,children:"Copy to Clipboard"}),(0,t.jsx)(U.R,{}),r?(0,t.jsx)(H.s,{fontSize:"14px",icon:(0,t.jsx)(il.eOs,{}),onClick:async()=>{await s(),(0,C.v4)({name:"create"})},children:"Share to Cloud"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H.s,{fontSize:"14px",icon:(0,t.jsx)(il.eOs,{}),onClick:()=>{c(!0)},children:"Share"}),a&&(0,t.jsx)(id,{handleParentClose:()=>{c(!1)},ignoreCookie:!0})]})]})]})},ip=e=>{var n,i,l,o;let{runId:r,onClose:s,isSingleEnvironment:a}=e,{readOnly:c}=(0,ek.$)(),{runAction:u}=(0,ev.$q)(),{error:h,run:v,onCancel:y,isRunning:b}=nZ(r),[w,k]=(0,j.useState)(),z=(0,ep.NL)(),[,D]=(0,eX.TH)(),[R,I]=(0,j.useState)(0),T=(null==v?void 0:v.type)?null===(n=(0,eQ.N)(v.type))||void 0===n?void 0:n.RunResultView:void 0,q=(0,j.useCallback)(()=>{var e;u(null!==(e=null==v?void 0:v.type)&&void 0!==e?e:"",null==v?void 0:v.params)},[v,u]),N=null==v?void 0:v.check_id,E=(0,j.useCallback)(()=>{N&&D("/checks/".concat(N))},[N,D]),L=(0,j.useCallback)(async()=>{if(!r)return;let e=await S(r,w);await z.invalidateQueries({queryKey:_.V.checks()}),D("/checks/".concat(e.check_id))},[r,D,z,w]),F=(null==v?void 0:v.type)==="query"||(null==v?void 0:v.type)==="query_diff"||(null==v?void 0:v.type)==="query_base",{ref:O,onCopyToClipboard:A,onMouseEnter:M,onMouseLeave:J}=n9(),P=!r||!(null==v?void 0:v.result)||!!h||0!==R;return(0,t.jsxs)(d.k,{direction:"column",children:[a&&(0,t.jsx)(ih,{runType:null==v?void 0:v.type}),(0,t.jsx)(m.m,{tabIndex:R,onChange:I,flexDirection:"column",mb:"1px",children:(0,t.jsxs)(f.t,{height:"50px",children:[(0,t.jsx)(g.O,{children:"Result"}),(0,t.jsx)(g.O,{children:"Params"}),F&&(0,t.jsx)(g.O,{children:"Query"}),(0,t.jsx)(p.L,{}),(0,t.jsxs)(x.U,{overflow:"hidden",children:[v&&(0,t.jsx)(ie,{run:v}),(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(eo.n,{}),variant:"outline",isDisabled:!r||b||c,size:"sm",onClick:q,children:"Rerun"}),a||c?(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(ei.T,{}),variant:"outline",isDisabled:!r||!(null==v?void 0:v.result)||!!h||0!==R,onMouseEnter:M,onMouseLeave:J,size:"sm",onClick:A,children:"Copy to Clipboard"}):(0,t.jsx)(ix,{disableCopyToClipboard:P,onCopyToClipboard:async()=>{var e;await A(),(0,C.nO)({type:null!==(e=null==v?void 0:v.type)&&void 0!==e?e:"unknown",from:"run"})},onMouseEnter:M,onMouseLeave:J}),(0,t.jsx)(function(){return a?(0,t.jsx)(t.Fragment,{}):(null==v?void 0:v.check_id)?(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(n0.n,{}),isDisabled:!r||!v.result||!!h,size:"sm",colorScheme:"blue",onClick:E,children:"Go to Check"}):(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(n0.n,{}),isDisabled:!r||!(null==v?void 0:v.result)||!!h,size:"sm",colorScheme:"blue",onClick:L,children:"Add to Checklist"})},{}),(0,t.jsx)(nK.P,{onClick:()=>{s&&s()}})]})]})}),0===R&&(0,t.jsx)(ny,{ref:O,error:h,run:v,onCancel:y,viewOptions:w,onViewOptionsChanged:k,RunResultView:T}),1===R&&v&&(0,t.jsx)(iu,{type:v.type,params:v.params}),2===R&&v&&((null===(i=v.params)||void 0===i?void 0:i.base_sql_template)?(0,t.jsx)(nm,{value:v.params.sql_template,baseValue:v.params.base_sql_template,options:{readOnly:!0}}):(0,t.jsx)(np,{value:null!==(o=null===(l=v.params)||void 0===l?void 0:l.sql_template)&&void 0!==o?o:"",options:{readOnly:!0}}))]})},im=e=>{let{onClose:n,isSingleEnvironment:i}=e,{runId:l}=(0,ev.$q)();return(0,t.jsx)(ip,{runId:l,onClose:n,isSingleEnvironment:i})};async function ig(e,n){return await (0,nf.g9)("query",e,n)}async function iv(e,n){return await (0,nf.g9)("query_base",e,n)}async function ij(e,n){return await (0,nf.g9)("query_diff",e,n)}var iy=i(47762),ib=i(69716),iw=i(175);let ik=e=>{var n;let{defaultValues:i,suggestionList:o,onValuesChange:s,className:a}=e,[c,d]=(0,j.useState)(null!=i?i:[]),[u,h]=(0,j.useState)(""),[x,p]=(0,j.useState)(!1),m=(0,j.useRef)(null),f=e=>{c.includes(e)||(h(""),d([...c,e]),s([...c,e]))},g=null!==(n=null==o?void 0:o.filter(e=>""===u||e.includes(u)).filter(e=>!c.includes(e)))&&void 0!==n?n:[];return(0,t.jsxs)(iy.B,{size:e.size,width:e.width,className:a,children:[(0,t.jsxs)(J.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,t.jsxs)(P.j,{width:"100%",children:[(0,t.jsx)(ed.I,{className:"no-track-pii-safe",placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:c.length>1?"".concat(c.length," ").concat(e.unitName,"s selected"):1===c.length?c[0]:"",onChange:()=>{},backgroundColor:"white"}),0===c.length&&(0,t.jsx)(ib.x,{children:(0,t.jsx)(r.J,{as:eJ.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,t.jsx)(ey.h,{children:(0,t.jsxs)(W.q,{zIndex:"popover",fontSize:e.size,width:e.width,className:"no-track-pii-safe",children:[(0,t.jsx)(eb.k,{children:(0,t.jsxs)(iw.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[c.map((n,i)=>(0,t.jsx)(iw.U,{children:(0,t.jsxs)(M.Vp,{size:e.size,children:[(0,t.jsx)(M.Sn,{paddingLeft:"8px",children:n}),(0,t.jsx)(M.SD,{paddingRight:"8px",onClick:()=>{d(c.filter(e=>e!==n)),s(c.filter(e=>e!==n))}})]},n)},"tag-".concat(i))),(0,t.jsx)(iw.U,{width:"100%",children:(0,t.jsx)(ed.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:u,onChange:e=>{h(e.target.value),p(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":f(n),h("");break;case"Backspace":""===e.currentTarget.value&&c.length>0&&(d(c.slice(0,-1)),s(c.slice(0,-1)))}},onBlur:()=>{m.current&&x&&m.current.focus()}})})]})}),(0,t.jsx)(U.R,{}),(0,t.jsxs)(eb.k,{children:[""!==u&&!(null==o?void 0:o.includes(u))&&(0,t.jsxs)(H.s,{onClick:()=>{f(u),p(!1)},children:["Add '",u,"' to the list"]},"custom-value-by-filter"),g.map((e,n)=>(0,t.jsx)(H.s,{onClick:()=>{f(e)},children:e},"option-".concat(n))).slice(0,10),g.length>10&&(0,t.jsx)(A.u,{label:"Please use filter to find more items",placement:"top",children:(0,t.jsxs)(l.x,{px:"12px",color:"gray",fontSize:"8pt",children:["and ",g.length-10," more items..."]})})]})]})})]}),c.length>0&&(0,t.jsx)(ib.x,{children:(0,t.jsx)(Q.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{h(""),d([]),s([])},children:"Clear"})})]})};var i_=i(91155),iC=i(94389);let iS=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:i,...l}=e,{lineageGraph:o,isActionAvailable:r}=(0,ef.kJ)(),s=(0,j.useMemo)(()=>{if(!o)return[];let e=new Set;for(let t in o.nodes){var n,i;let l=o.nodes[t],r=null===(n=l.data.base)||void 0===n?void 0:n.columns,s=null===(i=l.data.current)||void 0===i?void 0:i.columns;for(let n in r)e.add(n);for(let n in s)e.add(n)}return Array.from(e).sort()},[o]);return(0,t.jsx)(d.k,{...l,children:(0,t.jsxs)(i_.NI,{m:"4px 8px",children:[(0,t.jsxs)(iC.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,t.jsx)(A.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,t.jsx)(nD.s,{color:"gray.600",boxSize:"3"})})]}),(0,t.jsx)(ik,{className:"no-track-pii-safe",unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:i,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!r("query_diff_with_primary_key")})]})})};var iz=i(366),iD=i(92447);function iR(e){let{description:n,onLike:i,onDislike:l,onClickLink:r,externalLink:s,externalLinkText:a}=e;return(0,t.jsxs)(d.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,t.jsx)(V.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,t.jsx)(u.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:i}),(0,t.jsx)(V.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,t.jsx)(u.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:l}),s&&a&&(0,t.jsx)(o.r,{href:s,isExternal:!0,textDecoration:"underline",onClick:r,children:a})]})}let iI="recce-",iT={bypassSaveOverwrite:"".concat(iI,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(iI,"-preview-change-feedback"),prepareEnvGuideID:"".concat(iI,"-prepare-env")};function iq(e){let{current:n,primaryKeys:i,setPrimaryKeys:o,onRunResultOpen:s,runQuery:a,isPending:c}=e;return(0,t.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,t.jsxs)(l.x,{children:[(0,t.jsxs)(h.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,t.jsx)(r.J,{as:iz.vc4,boxSize:"1.2em"}),"Sandbox"]}),(0,t.jsxs)(K.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model ",(0,t.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,t.jsx)(p.L,{}),(0,t.jsx)(iS,{defaultPrimaryKeys:i,onPrimaryKeysChange:o}),(0,t.jsx)(A.u,{label:"Run diff to see the changes",children:(0,t.jsx)(Q.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{s(),a()},colorScheme:"blue",isLoading:c,children:"Run Diff"})})]})}function iN(e){var n,i,l,o;let{currentModelID:r,height:s="32px",flex:a="0 0 auto"}=e,{lineageGraph:c,envInfo:u}=(0,ef.kJ)(),h="0 16px",x=nc(null!==(l=null==u?void 0:null===(i=u.dbt)||void 0===i?void 0:null===(n=i.current)||void 0===n?void 0:n.generated_at)&&void 0!==l?l:""),p=(0,nb.Q)(x,{addSuffix:!0}),m="N/A";if(null==c?void 0:c.nodes[r]){let e=c.nodes[r];(null===(o=e.data.current)||void 0===o?void 0:o.schema)&&(m=e.data.current.schema)}return(0,t.jsxs)(d.k,{gap:0,height:s,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,t.jsx)(e5.K,{width:"50%",children:(0,t.jsxs)(K.x,{as:"b",margin:h,children:["ORIGINAL (Schema: ",m,", Last Updated: ",p,")"]})}),(0,t.jsx)(e5.K,{width:"50%",children:(0,t.jsx)(K.x,{as:"b",margin:h,children:"SANDBOX EDITOR"})})]})}function iE(e){var n;let{current:i,onChange:o}=e,r=function(e,n){let i=(0,j.useRef)(null);return(0,j.useEffect)(()=>{i.current&&e!==i.current.getValue()&&i.current.setValue(e)},[e]),{onMount(e){let t=e.getModifiedEditor();i.current=t,t.onDidChangeModelContent(()=>{n(t.getValue())})}}}(null!==(n=null==i?void 0:i.raw_code)&&void 0!==n?n:"",o);return(0,t.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,t.jsx)(e4.SV,{language:"sql",theme:"vs",original:null==i?void 0:i.raw_code,modified:null==i?void 0:i.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:r.onMount})})}function iL(e){var n,i;let{isOpen:r,onClose:c,current:p}=e,{isOpen:m,onClose:f,onOpen:g}=(0,F.q)(),[v,y]=(0,j.useState)(null!==(n=null==p?void 0:p.raw_code)&&void 0!==n?n:""),{showRunId:b,clearRunResult:w}=(0,ev.$q)(),{primaryKeys:k,setPrimaryKeys:_}=(0,nU.rV)(),{data:S,isLoading:z}=(0,nX.P)(),D=async()=>{var e;let n={current_model:null!==(e=null==p?void 0:p.name)&&void 0!==e?e:"",primary_keys:k,sql_template:v},{run_id:i}=await ij(n,{nowait:!0});return b(i),await (0,nf.Qp)(i)},{mutate:R,isPending:I}=(0,em.D)({mutationFn:D,onSuccess(e,n){e.error?(0,C.B2)({action:"run",node:null==p?void 0:p.name,status:"failure"}):((0,C.B2)({action:"run",node:null==p?void 0:p.name,status:"success"}),setTimeout(()=>{T()},1e3),!z&&(null==S?void 0:S.single_env_onboarding)&&setTimeout(()=>{N()},2e3))}}),{feedbackToast:T,closeToast:q}=function(e){let n=(0,s.p)(),{feedbackId:i,description:l,onFeedbackSubmit:o,externalLink:r,externalLinkText:a}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=localStorage.getItem(i);!n.isActive(i)&&("true"!==s||e)&&n({id:i,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:s}=e;return(0,t.jsx)(eR.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,t.jsx)(iD.X,{fontSize:"md",children:(0,t.jsxs)(x.U,{children:[(0,t.jsx)(iR,{description:l,onLike:()=>{o("like"),s(),localStorage.setItem(i,"true")},onDislike:()=>{o("dislike"),s(),localStorage.setItem(i,"true")},externalLink:r,externalLinkText:a,onClickLink:()=>{o("link")}}),(0,t.jsx)(nK.P,{onClick:()=>{s()}})]})})})}})},closeToast:()=>{n.closeAll()}}}({feedbackId:iT.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":(0,C.FF)({feedback:"like",node:null==p?void 0:p.name});break;case"dislike":(0,C.FF)({feedback:"dislike",node:null==p?void 0:p.name});break;case"link":(0,C.FF)({feedback:"form",node:null==p?void 0:p.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:N,closeGuideToast:E}=function(e){let n=(0,s.p)(),{guideId:i,description:l,externalLink:r,externalLinkText:a,onExternalLinkClick:c}=e;return{guideToast:function(){n.isActive(i)||n({id:i,position:"bottom-right",duration:3e3,description:"some text",render:e=>{let{id:n,onClose:i}=e;return(0,t.jsx)(eR.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,t.jsx)(iD.X,{fontSize:"md",children:(0,t.jsxs)(x.U,{children:[(0,t.jsxs)(K.x,{children:[l," ",(0,t.jsx)(o.r,{textDecor:"underline",isExternal:!0,href:r,onClick:()=>{c&&c(),i()},children:a})]}),(0,t.jsx)(nK.P,{onClick:()=>{i()}})]})})})}})},closeGuideToast:()=>{n.closeAll()}}}({guideId:iT.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,C.BA)({action:"external_link",from:"preview_changes",node:null==p?void 0:p.name})}});return(0,j.useEffect)(()=>{if(r){var e;y(null!==(e=null==p?void 0:p.raw_code)&&void 0!==e?e:"")}},[r,p]),(0,t.jsx)(X.u_,{isOpen:r,size:"full",onClose:()=>{c(),f(),w(),q(),E(),(0,C.B2)({action:"close",node:null==p?void 0:p.name})},children:(0,t.jsxs)(Z.h,{height:"100%",children:[(0,t.jsx)(G.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,t.jsxs)(d.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,t.jsx)(u.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,t.jsx)(h.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,t.jsx)(Y.o,{}),(0,t.jsx)(ee.f,{p:0,children:(0,t.jsxs)(eO,{sizes:m?[50,50]:[100,0],minSize:m?100:0,gutterSize:m?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,t.jsxs)(d.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,t.jsx)(iq,{current:p,primaryKeys:null!=k?k:[],setPrimaryKeys:_,onRunResultOpen:g,runQuery:R,isPending:I}),(0,t.jsx)(iN,{height:"32pxs",flex:"0 0 auto",currentModelID:null!==(i=null==p?void 0:p.id)&&void 0!==i?i:""}),(0,t.jsx)(iE,{current:p,onChange:y})]}),m?(0,t.jsx)(im,{onClose:f,disableAddToChecklist:!0}):(0,t.jsx)(l.x,{})]})}),(0,t.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,t.jsx)(A.u,{label:"Give us feedback",children:(0,t.jsx)(V.h,{"aria-label":"feedback",icon:(0,t.jsx)(ex.xJq,{}),variant:"ghost",size:"md",onClick:()=>{T(!0)}})})})]})})}let iF=e=>{var n,i,o,r,s,a;let{node:c}=e,{isOpen:d,onOpen:u,onClose:x}=(0,F.q)(),[p,m]=(0,j.useState)(!1),{data:f,isLoading:g}=(0,nX.P)(),v=null==f?void 0:f.single_env_onboarding;if(g)return(0,t.jsx)(t.Fragment,{});if("model"!==c.resourceType&&"snapshot"!==c.resourceType)return"Not available";let y={readOnly:!0,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,wordWrap:"off",minimap:{enabled:!1}},b={readOnly:!0,lineNumbers:"on",automaticLayout:!0,wordWrap:"off",minimap:{enabled:!1}},w=null===(n=c.data.base)||void 0===n?void 0:n.raw_code,k=null===(i=c.data.current)||void 0===i?void 0:i.raw_code,_=null!==(a=null!==(s=null===(o=c.data.base)||void 0===o?void 0:o.name)&&void 0!==s?s:null===(r=c.data.current)||void 0===r?void 0:r.name)&&void 0!==a?a:"";return(0,t.jsxs)(l.x,{className:"no-track-pii-safe",style:{position:"relative"},height:"100%",onMouseEnter:()=>{m(!0)},onMouseLeave:()=>{m(!1)},children:[v?(0,t.jsx)(np,{language:"sql",theme:"vs",value:null!=w?w:"",options:b}):(0,t.jsx)(e4.SV,{language:"sql",theme:"vs",original:w,modified:k,options:{...y,renderSideBySide:!1}}),(0,t.jsx)(V.h,{icon:(0,t.jsx)(eM.Tlm,{}),onClick:u,size:"md","aria-label":"",variant:"ghost",style:{position:"absolute",top:"5px",right:"20px",opacity:p?.5:.1,transition:"opacity 0.3s ease-in-out"}}),(0,t.jsxs)(X.u_,{isOpen:d,onClose:x,size:"6xl",children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{overflowY:"auto",height:"75%",children:[(0,t.jsx)(G.x,{children:v?(0,t.jsxs)(h.X,{as:"h1",size:"md",children:[(0,t.jsx)("code",{children:_})," Model Code"]}):(0,t.jsxs)(h.X,{as:"h1",size:"md",children:[(0,t.jsx)("code",{children:_})," Model Code Diff"]})}),(0,t.jsx)(Y.o,{}),(0,t.jsx)(ee.f,{children:v?(0,t.jsx)(e4.ML,{language:"sql",theme:"vs",value:null!=w?w:"",options:{...b,fontSize:16}}):(0,t.jsx)(e4.SV,{language:"sql",theme:"vs",original:w,modified:k,options:{...y,fontSize:16}})})]})]})]})};function iO(e,n){let i=(0,eg._)(e,n);if(0===i.length)return[];if(0===e.length||0===n.length)return i.map((e,n)=>n===i.length-1?e:e+",");let t="";return i.forEach(i=>{e.includes(i)&&n.includes(i)&&(t=i)}),i.map((l,o)=>{let r;return(r=e.includes(l)?n.includes(l)?l:"--- ".concat(l," (Removed)"):"--- ".concat(l," (Added)"),l===t||o===i.length-1)?r:r+","})}function iA(e){var n,i,o,s;let{node:a,onCloseNode:c}=e,[,u]=(0,eX.TH)(),{setSqlQuery:v,setPrimaryKeys:y}=(0,nU.rV)(),b="model"===a.resourceType||"seed"===a.resourceType||"source"===a.resourceType||"snapshot"===a.resourceType,{isOpen:w,onOpen:k,onClose:_}=(0,F.q)(),{isOpen:S,onClose:z}=(0,F.q)({defaultIsOpen:!0}),{runAction:D}=(0,ev.$q)(),{envInfo:R,isActionAvailable:I}=(0,ef.kJ)(),{primaryKey:T}=(0,nQ.ZP)(a.name),q=()=>{D("row_count",{node_names:[a.name]},{showForm:!1,showLast:!1})},N=()=>{D("row_count_diff",{node_names:[a.name]},{showForm:!1,showLast:!1})},{data:E}=(0,nX.P)(),L=null==E?void 0:E.single_env_onboarding,O=(0,j.useCallback)(async()=>{let e=a.id,n=await nB({node_id:e});u("/checks/".concat(n.check_id))},[a,u]),M=(e,n)=>e?n$.add_or_remove:I(n)?"":"This action is not supported yet.",V="added"===a.changeStatus||"removed"===a.changeStatus,X=Object.keys(null!==(o=null===(n=a.data.base)||void 0===n?void 0:n.columns)&&void 0!==o?o:{}),Z=Object.keys(null!==(s=null===(i=a.data.current)||void 0===i?void 0:i.columns)&&void 0!==s?s:{});return(0,t.jsxs)(nH.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,t.jsxs)(x.U,{children:[(0,t.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,t.jsx)(h.X,{size:"sm",className:"no-track-pii-safe",children:a.name})}),(0,t.jsx)(p.L,{}),L?(0,t.jsx)(function(){var e,n,i;let l=iO(X,Z),o='select * from {{ ref("'.concat(a.name,'") }}');return(l.length&&(o="select \n ".concat(l.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}')),"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType)?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(J.v,{children:[(0,t.jsx)(P.j,{as:Q.z,size:"xs",variant:"outline",rightIcon:(0,t.jsx)(nY.v,{}),children:"Explore"}),(0,t.jsxs)(W.q,{children:[(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(e=(0,eQ.N)("query"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==R?void 0:R.adapterType)==="dbt"?v(o):(null==R?void 0:R.adapterType)==="sqlmesh"&&v("select * from ".concat(a.name)),u("/query")},children:"Query"}),(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(n=(0,eQ.N)("row_count"))||void 0===n?void 0:n.icon}),fontSize:"14px",onClick:()=>{q()},children:"Row Count"}),(0,t.jsx)(A.u,{label:M(V,"profile"),placement:"left",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(i=(0,eQ.N)("profile"))||void 0===i?void 0:i.icon}),fontSize:"14px",isDisabled:V,onClick:()=>{D("profile",{model:a.name},{showForm:!0,showLast:!1})},children:"Profile"})})]})]})},{}):(0,t.jsx)(function(){var e,n,i,l,o,s,c,d;let h=iO(X,Z),x='select * from {{ ref("'.concat(a.name,'") }}');h.length&&(x="select \n ".concat(h.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}'));let{readOnly:p}=(0,ek.$)();return"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(J.v,{children:[(0,t.jsx)(P.j,{as:Q.z,size:"xs",variant:"outline",rightIcon:(0,t.jsx)(nY.v,{}),isDisabled:p,children:"Explore"}),(0,t.jsxs)(W.q,{children:[(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(e=(0,eQ.N)("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==R?void 0:R.adapterType)==="dbt"?v(x):(null==R?void 0:R.adapterType)==="sqlmesh"&&v("select * from ".concat(a.name)),I("query_diff_with_primary_key")&&y(void 0!==T?[T]:void 0),u("/query")},children:"Query"}),(0,t.jsx)(H.s,{fontSize:"14px",icon:(0,t.jsx)(r.J,{as:null===(n=(0,eQ.N)("sandbox"))||void 0===n?void 0:n.icon}),onClick:()=>{I("query_diff_with_primary_key")&&y(void 0!==T?[T]:void 0),k(),(0,C.B2)({action:"explore",node:a.name})},children:"Sandbox (Experiment)"}),(0,t.jsx)(U.R,{}),(0,t.jsxs)(eb.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(i=(0,eQ.N)("row_count_diff"))||void 0===i?void 0:i.icon}),fontSize:"14px",onClick:()=>{N()},children:"Row Count Diff"}),(0,t.jsx)(A.u,{label:M(V,"profile_diff"),placement:"left",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(l=(0,eQ.N)("profile_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",isDisabled:V,onClick:()=>{D("profile_diff",{model:a.name},{showForm:!0,showLast:!1})},children:"Profile Diff"})}),(0,t.jsx)(A.u,{label:M(V,"value_diff"),placement:"left",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(o=(0,eQ.N)("value_diff"))||void 0===o?void 0:o.icon}),fontSize:"14px",isDisabled:V,onClick:()=>{D("value_diff",{model:a.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,t.jsx)(A.u,{label:M(V,"top_k_diff"),placement:"left",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(s=(0,eQ.N)("top_k_diff"))||void 0===s?void 0:s.icon}),fontSize:"14px",isDisabled:V,onClick:()=>{D("top_k_diff",{model:a.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,t.jsx)(A.u,{label:M(V,"histogram_diff"),placement:"left",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(c=(0,eQ.N)("histogram_diff"))||void 0===c?void 0:c.icon}),fontSize:"14px",isDisabled:V,onClick:()=>{D("histogram_diff",{model:a.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,t.jsx)(U.R,{}),(0,t.jsx)(eb.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,t.jsx)(H.s,{icon:(0,t.jsx)(r.J,{as:null===(d=(0,eQ.N)("schema_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",onClick:()=>{O()},children:"Schema Diff"})})]})]})},{}),(0,t.jsx)(l.x,{flex:"0 1 1%",children:(0,t.jsx)(nK.P,{onClick:c})})]}),(0,t.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,t.jsxs)(x.U,{spacing:"8px",children:[(0,t.jsx)(nE,{node:a}),("model"===a.resourceType||"snapshot"===a.resourceType||"seed"===a.resourceType)&&(L?(0,t.jsx)(nO,{node:a,onRefresh:q}):(0,t.jsx)(nF,{node:a,onRefresh:N}))]})}),b&&(0,t.jsxs)(m.m,{overflow:"auto",as:d.k,children:[L&&S&&(0,t.jsx)(l.x,{p:"12px",children:(0,t.jsx)(ii,{onClose:z,align:"flex-start",children:(0,t.jsxs)(K.x,{children:["Enable the Recce Checklist and start adding checks for better data validation and review.",(0,t.jsx)("br",{}),(0,t.jsx)(it,{})]})})}),(0,t.jsxs)(f.t,{children:[(0,t.jsx)(g.O,{children:"Columns"}),(0,t.jsx)(g.O,{children:"Code"})]}),(0,t.jsxs)(B.n,{overflow:"auto",height:"calc(100% - 42px)",children:[(0,t.jsx)($.x,{p:0,overflowY:"auto",height:"100%",children:L?(0,t.jsx)(eN,{current:a.data.current}):(0,t.jsx)(eq,{base:a.data.base,current:a.data.current})}),(0,t.jsx)($.x,{height:"100%",p:0,children:(0,t.jsx)(iF,{node:a})})]})]}),(0,t.jsx)(iL,{isOpen:w,onClose:_,current:a.data.current})]})}function iM(e){var n,i;let{onClose:o}=e,{cancel:r,actionState:s}=eC();return(0,t.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,t.jsxs)(x.U,{p:"5px 15px",mt:"4",divider:(0,t.jsx)(nk.c,{borderColor:"gray.200"}),spacing:4,children:[(0,t.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===s.mode?"".concat(s.completed," / ").concat(s.total):(null===(i=s.currentRun)||void 0===i?void 0:null===(n=i.progress)||void 0===n?void 0:n.percentage)?"".concat(100*s.currentRun.progress.percentage,"%"):"completed"===s.status?"100%":"0%"," ","canceled"===s.status?" (canceled)":""]}),"running"===s.status||"canceling"===s.status?(0,t.jsx)(Q.z,{size:"xs",variant:"outline",onClick:r,isLoading:"canceling"===s.status,loadingText:"Canceling",children:"Cancel"}):(0,t.jsx)(x.U,{children:(0,t.jsx)(Q.z,{size:"xs",variant:"outline",onClick:o,children:"Close"})})]})})}var iJ=i(78828),iP=i(74152);let iV=()=>(0,t.jsxs)(N.g,{align:"start",spacing:0,children:[(0,t.jsx)(K.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,t.jsxs)(K.x,{fontSize:"8pt",children:[(0,t.jsx)(c.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,t.jsxs)(K.x,{fontSize:"8pt",children:[(0,t.jsx)(c.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,t.jsxs)(K.x,{fontSize:"8pt",children:[(0,t.jsx)(c.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,t.jsxs)(K.x,{fontSize:"8pt",children:[(0,t.jsx)(c.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),iW=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:i}=(0,ev.$q)();return(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(r.J,{as:ex.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?((0,C.U8)({name:"hide"}),i()):((0,C.U8)({name:"show"}),n())},children:e?"Hide":"Show"})},iH=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:o}=eC(),s=null!==(n=l.view_mode)&&void 0!==n?n:"changed_models",a=e=>{o({...l,view_mode:e})};return(0,t.jsxs)(J.v,{children:[(0,t.jsx)(P.j,{as:Q.z,minWidth:"100px",leftIcon:(0,t.jsx)(r.J,{as:eK("model").icon}),size:"xs",variant:"outline",isDisabled:i,rightIcon:(0,t.jsx)(nY.v,{}),children:"changed_models"===s?"Changed Models":"All"}),(0,t.jsxs)(W.q,{title:"packages",children:[(0,t.jsx)(H.s,{as:iJ.X,size:"sm",isChecked:"changed_models"===s,onChange:()=>{a("changed_models")},children:"Changed Models"}),(0,t.jsx)(H.s,{as:iJ.X,size:"sm",isChecked:"all"===s,onChange:()=>{a("all")},children:"All"})]})]})},iK=e=>{var n,i;let{isDisabled:l}=e,{lineageGraph:o}=(0,ef.kJ)(),{viewOptions:s,onViewOptionsChanged:a}=eC(),c=new Set;for(let e of Object.values(null!==(i=null==o?void 0:o.nodes)&&void 0!==i?i:{}))e.packageName&&c.add(e.packageName);let d=null==o?void 0:null===(n=o.manifestMetadata.current)||void 0===n?void 0:n.project_name,u=s.packages?new Set(s.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"),m=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...s,packages:Array.from(n)})};return(0,t.jsxs)(J.v,{closeOnSelect:!1,children:[(0,t.jsx)(P.j,{as:Q.z,minWidth:"100px",leftIcon:(0,t.jsx)(r.J,{as:nT.zFh}),size:"xs",variant:"outline",isDisabled:l,rightIcon:(0,t.jsx)(nY.v,{}),children:p}),(0,t.jsx)(W.q,{title:"packages",children:(0,t.jsxs)(eb.k,{title:"Select Packages",children:[(0,t.jsx)(H.s,{as:iJ.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...s,packages:[]}):a({...s,packages:Array.from(c)})},children:"Select All"}),(0,t.jsx)(U.R,{}),Array.from(c).map(e=>(0,t.jsx)(H.s,{as:iJ.X,size:"sm",isChecked:u.has(e),onChange:()=>{m(e)},children:e},e))]})})]})},iU=e=>{let[n,i]=(0,j.useState)(e.value),{data:l}=(0,nX.P)(),o=(0,j.useRef)(null);return(0,j.useEffect)(()=>{o.current&&(o.current.value=e.value)},[e.value]),(0,t.jsx)(A.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==l?void 0:l.single_env_onboarding),children:(0,t.jsx)(ed.I,{ref:o,height:"24px",fontSize:"10pt",placeholder:"with selectors",isDisabled:e.isDisabled,value:n,onChange:e=>{i(e.target.value)},onKeyUp:t=>{"Enter"===t.key?e.onChange(n):"Escape"===t.key&&(t.preventDefault(),i(e.value),o.current&&o.current.blur())},onBlur:()=>{i(e.value)}})})},iQ=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:o}=eC();return(0,t.jsx)(iU,{isDisabled:i,value:null!==(n=l.select)&&void 0!==n?n:"",onChange:e=>{o({...l,select:e||void 0})},tooltipComponent:(0,t.jsx)(iV,{})})},iB=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:o}=eC();return(0,t.jsx)(iU,{isDisabled:i,value:null!==(n=l.exclude)&&void 0!==n?n:"",onChange:e=>{o({...l,exclude:e||void 0})}})},i$=e=>(0,t.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,t.jsx)(l.x,{fontSize:"8pt",children:e.label||(0,t.jsx)(t.Fragment,{children:"\xa0"})}),e.children]}),iX=()=>{var e,n,i,l,o;let{deselect:s,focusedNode:a,selectedNodes:c,...d}=eC(),{readOnly:u}=(0,ek.$)(),{data:h}=(0,nX.P)(),m=null==h?void 0:h.single_env_onboarding,f=!!a,g=c.length>0,v=!f&&!g;return(0,t.jsx)(x.U,{width:"100%",padding:"4pt 8pt",children:(0,t.jsxs)(x.U,{flex:"1",children:[(0,t.jsx)(i$,{label:"History",style:{flexShrink:"1"},children:(0,t.jsx)(iW,{})}),(0,t.jsx)(i$,{label:"Mode",style:{flexShrink:"1"},children:(0,t.jsx)(iH,{isDisabled:g})}),(0,t.jsx)(i$,{label:"Package",style:{flexShrink:"1"},children:(0,t.jsx)(iK,{isDisabled:g})}),(0,t.jsx)(i$,{label:"Select",style:{flex:"100 1 auto"},children:(0,t.jsx)(iQ,{isDisabled:g})}),(0,t.jsx)(i$,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,t.jsx)(iB,{isDisabled:g})}),(0,t.jsx)(p.L,{}),g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i$,{label:"",style:{flexShrink:"0"},children:(0,t.jsx)(K.x,{fontSize:"9pt",color:"gray.500",children:c.length>1?"".concat(c.length," nodes selected"):"".concat(c.length," node selected")})}),(0,t.jsx)(i$,{label:"",children:(0,t.jsx)(Q.z,{variant:"outline",size:"xs",fontSize:"9pt",onClick:()=>{s()},children:"Deselect"})}),m&&(0,t.jsx)(i$,{label:"Explore",children:(0,t.jsx)(iP.h,{isAttached:!0,variant:"outline",children:(0,t.jsxs)(J.v,{placement:"bottom-end",children:[(0,t.jsx)(P.j,{as:Q.z,size:"xs",rightIcon:(0,t.jsx)(nY.v,{}),children:"Actions"}),(0,t.jsx)(W.q,{children:(0,t.jsx)(H.s,{as:K.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,t.jsx)(r.J,{as:null===(e=(0,eQ.N)("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:async()=>{await d.runRowCount()},children:"Row Count"})})]})})})]}),!m&&(0,t.jsx)(i$,{label:"Explore",children:(0,t.jsx)(iP.h,{isAttached:!0,variant:"outline",children:(0,t.jsxs)(J.v,{placement:"bottom-end",children:[(0,t.jsx)(P.j,{as:Q.z,size:"xs",rightIcon:(0,t.jsx)(nY.v,{}),isDisabled:u,children:"Actions"}),(0,t.jsxs)(W.q,{children:[(0,t.jsxs)(eb.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,t.jsx)(H.s,{as:K.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,t.jsx)(r.J,{as:null===(n=(0,eQ.N)("row_count_diff"))||void 0===n?void 0:n.icon}),onClick:async()=>{await d.runRowCountDiff()},children:"Row Count Diff"}),(0,t.jsx)(A.u,{placement:"left",children:(0,t.jsx)(H.s,{as:K.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,t.jsx)(r.J,{as:null===(i=(0,eQ.N)("value_diff"))||void 0===i?void 0:i.icon}),onClick:async()=>{await d.runValueDiff()},children:"Value Diff"})})]}),(0,t.jsx)(U.R,{}),(0,t.jsxs)(eb.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,t.jsx)(H.s,{as:K.x,size:"sm",fontSize:"10pt",isDisabled:!(v||g&&c.length>1),icon:(0,t.jsx)(r.J,{as:null===(l=(0,eQ.N)("lineage_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,t.jsx)(H.s,{as:K.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,t.jsx)(r.J,{as:null===(o=(0,eQ.N)("schema_diff"))||void 0===o?void 0:o.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};var iZ=i(54651);async function iG(e){return(await k.U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function iY(){return(0,t.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[i,l]]=e,{icon:o,color:s}=eH(n);return(0,t.jsx)(A.u,{label:l,placement:"right",children:(0,t.jsxs)(d.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,t.jsx)(r.J,{color:s,as:o})," ",i]})},n)})})}var i0=i(54076);let i1={mode:"per_node",status:"pending",completed:0,total:0,actions:{}},i2=(e,n)=>{let{onActionStarted:i,onActionNodeUpdated:t,onActionCompleted:l}=n,o=(0,j.useRef)({...i1}).current,{showRunId:r}=(0,ev.$q)(),s=async(n,s,a)=>{o.mode="multi_nodes",o.actions={};let c=o.mode,d=o.actions;i(),o.status="running";let u=[];for(let n of e){let e=s(n);e?(d[n.id]={mode:c,status:"skipped",skipReason:e},t(n)):(d[n.id]={mode:c,status:"pending"},u.push(n))}let h=a(u);try{let{run_id:e}=await (0,nf.g9)(n,h,{nowait:!0});for(r(e),o.currentRun={run_id:e},o.total=1;;){let n=await (0,nf.Qp)(e,2);o.currentRun=n;let i=n.error?"failure":n.result?"success":"running";for(let e of u)d[e.id]={mode:c,status:i,run:n},t(e);if(n.error||n.result)break}}catch(e){}if(o.completed=1,"canceling"===o.status){o.status="canceled",l();return}o.status="completed",l()},a=async(n,r)=>{o.mode="per_node",o.actions={};let s=o.mode,a=o.actions;for(let n of(i(),o.status="running",e))a[n.id]={mode:s,status:"pending"},t(n);for(let i of(o.completed=0,o.total=e.length,e)){let{params:e,skipReason:c}=r(i);if(c)a[i.id]={mode:s,status:"skipped",skipReason:c},t(i);else try{let{run_id:l}=await (0,nf.g9)(n,e,{nowait:!0});for(o.currentRun={run_id:l},a[i.id]={mode:s,status:"running"},t(i);;){let e=await (0,nf.Qp)(l,2);o.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(a[i.id]={mode:s,status:n,run:e},t(i),e.error||e.result)break}}catch(e){}finally{o.currentRun=void 0}if(o.completed++,"canceling"===o.status){o.status="canceled",l();return}}o.status="completed",l()},c=async()=>{let n=[];for(let i of e)"model"!==i.resourceType?(o.actions[i.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},t(i)):n.push(i.name);await s("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 i of e)"model"!==i.resourceType?(o.actions[i.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},t(i)):n.push(i.name);await s("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},u=async()=>{var e;o.status="canceling",(null===(e=o.currentRun)||void 0===e?void 0:e.run_id)&&await (0,nf.Eg)(o.currentRun.run_id)};return{actionState:o,runRowCount:c,runRowCountDiff:d,runValueDiff:async()=>{await a("value_diff",e=>{var n;let i=null===(n=e.data.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await iG({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await nB({node_id:e[0].id});else{let i=e.map(e=>e.id);n=await nB({node_id:i})}return n},cancel:u,reset:()=>{Object.assign(o,i1)}}};var i5=i(46255),i4=function(){let{isOpen:e,onOpen:n,onClose:i}=(0,F.q)(),[o,r]=(0,j.useState)(0),[s,a]=(0,j.useState)(),c=(0,j.useRef)(),u=(0,j.useCallback)(e=>(r(e),new Promise(e=>{a(()=>e),n()})),[n]),h=()=>{null==s||s(!1),i()};return{confirm:u,AlertDialog:(0,t.jsx)(i5.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,t.jsx)(O.Z,{children:(0,t.jsxs)(i5._T,{children:[(0,t.jsxs)(G.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",o," nodes"]}),(0,t.jsx)(ee.f,{gap:"20px",as:d.k,direction:"column",children:(0,t.jsxs)(l.x,{children:["Value diff will be executed on ",o," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,t.jsxs)(ni.m,{children:[(0,t.jsx)(Q.z,{ref:c,onClick:h,children:"Cancel"}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:()=>{null==s||s(!0),i()},ml:3,children:"Execute"})]})]})})})}},i8=i(92382),i3=i(39176);let i6="recce",i9={recommendationIgnored:"".concat(i6,"-recommendation-ignored"),recommendationShowed:"".concat(i6,"-recommendation-showed"),prevRefreshTimeStamp:"".concat(i6,"-prev-refresh-timestamp"),lineageNotificationDismissed:"".concat(i6,"-lineage-notification-dismissed")},i7=()=>{var e;let n=(0,y.a)({queryKey:_.V.checks(),queryFn:z}),i=(0,j.useMemo)(()=>{if("success"===n.status&&n.data.length>0){let e=n.data.filter(e=>e.is_preset).findLast(e=>"row_count_diff"===e.type);if(e)return e}},[n]),t=(0,y.a)({queryKey:(null==i?void 0:i.check_id)?_.V.check(i.check_id):[],queryFn:async()=>{if(null==i?void 0:i.check_id)return D(i.check_id)},enabled:!!(null==i?void 0:i.check_id)}),l=(0,y.a)({queryKey:(null==i?void 0:i.check_id)?[..._.V.check(i.check_id),"select"]:[],queryFn:async()=>{var e,n;return eE({select:null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.select,exclude:null==i?void 0:null===(n=i.params)||void 0===n?void 0:n.exclude})},enabled:!!(null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.select)}),o=(0,j.useMemo)(()=>{if(i){var e,n;if(null===(e=i.params)||void 0===e?void 0:e.node_names)return i.params.node_names;if(null===(n=i.params)||void 0===n?void 0:n.node_ids)return i.params.node_ids}if("success"===l.status&&l.data)return l.data.nodes},[i,l]);return{recommendedCheck:t.data,selectedNodes:o}},te=()=>{let{readOnly:e}=(0,ek.$)(),{lineageGraph:n,envInfo:i}=(0,ef.kJ)(),{showRunId:l}=(0,ev.$q)(),{data:o}=(0,nX.P)(),r=(0,ep.NL)(),{recommendedCheck:s,selectedNodes:a}=i7(),[c,u]=(0,j.useState)(),[h,m]=(0,j.useState)(!1),[f,g]=(0,j.useState)(!1),[v,y]=(0,j.useState)(!1),{isOpen:b,onOpen:w,onClose:k}=(0,F.q)(),S=i9.recommendationIgnored,z=i9.recommendationShowed,D=i9.prevRefreshTimeStamp;(0,j.useEffect)(()=>{sessionStorage.getItem(S)&&g(!0)},[S]),(0,j.useEffect)(()=>{var e,t,l,o,r,c,d,h,x,p;if(!s||!a)return;if(null===(e=s.last_run)||void 0===e?void 0:e.run_id){let e=new Date(s.last_run.run_at).getTime(),n=null==i?void 0:i.dbt,t=Math.max((null==n?void 0:null===(o=n.current)||void 0===o?void 0:o.generated_at)?new Date(n.current.generated_at).getTime():0,(null==n?void 0:null===(r=n.base)||void 0===r?void 0:r.generated_at)?new Date(n.base.generated_at).getTime():0);if(e>=t){m(!0);return}m(!1),y(!0);let l=sessionStorage.getItem(D);(null===l||parseInt(l)!==t)&&(sessionStorage.setItem(D,t.toString()),sessionStorage.removeItem(S),sessionStorage.removeItem(z),g(!1))}let f=e=>e.map(e=>{var i;return null==n?void 0:null===(i=n.nodes[e])||void 0===i?void 0:i.name}).join(", ");if(a.length>0&&a.length<=3){if(null===(c=s.params)||void 0===c?void 0:c.node_names){let e=null===(h=s.params)||void 0===h?void 0:h.node_names.join(", ");u("'".concat(e,"'"))}else if(null===(d=s.params)||void 0===d?void 0:d.node_ids){let e=f(null===(x=s.params)||void 0===x?void 0:x.node_ids);u("'".concat(e,"'"))}else if(a){let e=f(a);u("'".concat(e,"'"))}}else(null==n?void 0:n.modifiedSet.length)===a.length?u("modified and potentially impacted models"):(null===(t=s.params)||void 0===t?void 0:t.select)&&!(null===(l=s.params)||void 0===l?void 0:l.exclude)?u("'".concat(null===(p=s.params)||void 0===p?void 0:p.select,"'")):u("".concat(a.length," models"));if(!sessionStorage.getItem(z)){let e=sessionStorage.getItem(D);sessionStorage.setItem(z,"true"),(0,C.P6)({action:"recommend",from:null===e?"initial":"rerun"})}},[s,a,n,S,z,D,i]);let R=(0,j.useCallback)(async()=>{s&&(l((await (0,nf.rf)(s.check_id,{nowait:!0})).run_id),await r.invalidateQueries({queryKey:_.V.check(s.check_id)}))},[s,l,r]);if(!s||!a||(null==o?void 0:o.single_env_onboarding))return(0,t.jsx)(t.Fragment,{});let I=a.length;return!f&&!h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"blue.50",children:(0,t.jsxs)(x.U,{flex:"1",fontSize:"10pt",color:"blue.600",children:[v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i3.i,{}),(0,t.jsx)(K.x,{children:"New dbt build detected - Re-run row count checks to maintain result accuracy"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i8.h,{}),(0,t.jsxs)(K.x,{children:["First Check: Perform a row count diff of ",c," for basic impact assessment"]})]}),(0,t.jsx)(p.L,{}),(0,t.jsx)(Q.z,{size:"xs",onClick:()=>{g(!0),sessionStorage.setItem(S,"true"),(0,C.P6)({action:"ignore",from:v?"rerun":"initial",nodes:I})},children:"Ignore"}),(0,t.jsx)(Q.z,{colorScheme:"blue",size:"xs",onClick:()=>{w(),(0,C.P6)({action:"perform",from:v?"rerun":"initial",nodes:I})},isDisabled:e,children:"Perform"})]})}),(0,t.jsxs)(X.u_,{isOpen:b,onClose:()=>{k(),(0,C.P6)({action:"close",from:v?"rerun":"initial",nodes:I})},isCentered:!0,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{children:"Row Count Check"}),(0,t.jsx)(ee.f,{children:(0,t.jsxs)(e5.K,{spacing:"4",children:[(0,t.jsxs)(K.x,{children:["Perform a row count check of the ",I," node(s) displayed in the lineage diff DAG."]}),(0,t.jsxs)(d.k,{bg:"blue.100",color:"blue.700",children:[(0,t.jsx)(i8.h,{mt:"10px",ml:"5px"}),(0,t.jsx)(K.x,{margin:"5px",paddingX:"3px",children:"This is a recommended first check based on the preset checks defined in your recce.yml file."})]})]})}),(0,t.jsxs)(ni.m,{gap:"5px",children:[(0,t.jsx)(Q.z,{onClick:()=>{k(),(0,C.P6)({action:"close",from:v?"rerun":"initial",nodes:I})},children:"Cancel"}),(0,t.jsxs)(Q.z,{colorScheme:"blue",onClick:()=>{k(),R(),m(!0),(0,C.P6)({action:"execute",from:v?"rerun":"initial",nodes:I})},children:["Execute on ",I," models"]})]})]})]})]})};var tn=i(87963),ti=i(95388),tt=i(6651),tl=i(60278),to=i(3232);let tr=e=>{let{enabled:n,onChanged:i}=e,l=(0,nX.P)();return!l.data||l.data.single_env_onboarding?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(d.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",alignSelf:"flex-start",children:[(0,t.jsx)(tn.r,{isChecked:n,onChange:e=>{i(e.target.checked)},alignItems:"center"}),(0,t.jsx)(d.k,{alignItems:"center",children:(0,t.jsx)(K.x,{fontSize:"10pt",lineHeight:"1",children:"Breaking Change Analysis"})}),(0,t.jsxs)(ti.J,{trigger:"hover",placement:"top-start",children:[(0,t.jsx)(tt.x,{children:(0,t.jsx)(r.J,{boxSize:"10px",as:i8.h,color:"gray.500",cursor:"pointer"})}),(0,t.jsx)(tl.y,{bg:"black",color:"white",children:(0,t.jsxs)(to.b,{fontSize:"sm",children:["Breaking changes are determined by analyzing SQL for changes that may impact downstream models."," ",(0,t.jsx)(o.r,{href:"https://docs.datarecce.io/features/breaking-change-analysis/",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})]})]})},ts=e=>{let{changeStatus:n}=e;if(!n)return(0,t.jsx)(t.Fragment,{});let{color:i,icon:l}=eH(n);return(0,t.jsx)(r.J,{boxSize:"14px",display:"inline-flex",color:i,as:l})},ta=e=>{let{transformationType:n,legend:i}=e,l="U",o="red";return("passthrough"===n?(l="P",o="gray"):"renamed"===n?(l="R",o="orange"):"derived"===n?(l="D",o="orange"):"source"===n?(l="S",o="blue"):(l="U",o="red"),n)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(M.Vp,{fontSize:"8pt",size:"xs",colorScheme:o,borderRadius:"full",paddingX:"4px",children:(0,t.jsx)(M.Sn,{children:l})})}):(0,t.jsx)(t.Fragment,{})};var tc=i(4367);let td=e=>{let{node:n,column:i,reset:l}=e,{lineageGraph:s}=(0,ef.kJ)(),{centerNode:a}=eC();if(!s)return(0,t.jsx)(t.Fragment,{});let u=s.nodes[n].name;return(0,t.jsxs)(d.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",fontSize:"10pt",children:[(0,t.jsxs)(K.x,{children:[i?"Column Lineage":"Impact Radius"," for"]}),(0,t.jsxs)(c.E,{onClick:()=>{a(i?"".concat(n,"_").concat(i):n)},cursor:"pointer",children:[u,i?".".concat(i):""]}),(0,t.jsxs)(ti.J,{trigger:"hover",placement:"top-start",children:[(0,t.jsx)(tt.x,{children:(0,t.jsx)(r.J,{boxSize:"10px",as:i8.h,color:"gray.500",cursor:"pointer"})}),(0,t.jsx)(tl.y,{bg:"black",color:"white",children:(0,t.jsxs)(to.b,{fontSize:"sm",children:["Column-Level Lineage provides visibility into the upstream and downstream relationships of a column."," ",(0,t.jsx)(o.r,{href:"https://docs.datarecce.io/features/column-level-lineage/",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})]}),l&&(0,t.jsx)(V.h,{icon:(0,t.jsx)(tc.T,{}),"aria-label":"",onClick:l,size:"xs"})]})};function tu(){return(0,t.jsx)(l.x,{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,[i,l]]=e;return(0,t.jsx)(A.u,{label:l,placement:"right",children:(0,t.jsxs)(d.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,t.jsx)(ta,{legend:!0,transformationType:n})," ",i]})},n)})})}function th(e){let{notification:n,type:i}=e,l=i9.lineageNotificationDismissed,[o,r]=(0,j.useState)(!0);return((0,j.useEffect)(()=>{"true"===sessionStorage.getItem(l)&&r(!1)},[l]),null!==n&&o)?(0,t.jsxs)(d.k,{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"}[i],children:[n,(0,t.jsx)(p.L,{}),(0,t.jsx)(nK.P,{onClick:()=>{sessionStorage.setItem(l,"true"),r(!1)}})]}):null}function tx(){return(0,t.jsx)(d.k,{flex:"1",h:"100%",minH:0,m:"2",p:"4",bg:"blue.50",borderRadius:"lg",boxShadow:"md",justifyContent:"center",children:(0,t.jsxs)(d.k,{w:"80%",direction:"column",overflowY:"auto",gap:6,px:8,pb:8,children:[(0,t.jsxs)(d.k,{direction:"column",alignItems:"center",gap:4,children:[(0,t.jsx)(d.k,{p:2,bg:"white",borderRadius:"full",alignItems:"center",justifyContent:"center",boxShadow:"md",children:(0,t.jsx)(r.J,{as:nq.NJc,boxSize:7,color:"blue.500"})}),(0,t.jsx)(h.X,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,t.jsxs)(K.x,{fontSize:"md",textAlign:"center",children:["Recce is currently running in"," ",(0,t.jsx)(K.x,{fontWeight:"bold",as:"span",children:"limited functionality mode"})," ","so you can run queries but"," ",(0,t.jsx)(K.x,{fontWeight:"bold",as:"span",children:"can't diff the results yet!"})]})]}),(0,t.jsxs)(d.k,{direction:"column",gap:2,children:[(0,t.jsx)(K.x,{fontSize:"md",children:"To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison."}),(0,t.jsx)(K.x,{children:"Once configured, you'll be able to:"}),(0,t.jsxs)(eA.QI,{children:[(0,t.jsx)(eA.HC,{children:(0,t.jsx)(K.x,{children:"Run statistical data diffs"})}),(0,t.jsx)(eA.HC,{children:(0,t.jsx)(K.x,{children:"Run query diffs"})}),(0,t.jsx)(eA.HC,{children:(0,t.jsx)(K.x,{children:"Save checks to your Recce Checklist"})}),(0,t.jsx)(eA.HC,{children:(0,t.jsx)(K.x,{children:"...and more!"})})]}),(0,t.jsx)(K.x,{fontSize:"md",children:"Take the next step toward better data impact assessment."})]}),(0,t.jsx)(d.k,{w:"100%",direction:"column",mt:6,children:(0,t.jsx)(Q.z,{colorScheme:"blue",size:"lg",onClick:()=>{window.open("https://docs.datarecce.io/get-started/#prepare-dbt-artifacts","_blank")},children:"Start Now"})})]})})}function tp(){return(0,t.jsxs)(d.k,{direction:"row",gap:"10px",alignItems:"flex-start",children:[(0,t.jsx)(r.J,{as:nq.LyC,color:"blue.500",boxSize:"5"}),(0,t.jsxs)(d.k,{direction:"column",gap:"5px",children:[(0,t.jsxs)(K.x,{fontWeight:"bold",children:["Single Environment Mode"," ",(0,t.jsx)(K.x,{color:"red",as:"span",children:"Limited Functionality"})]}),(0,t.jsx)(K.x,{fontSize:"sm",children:"Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments."}),(0,t.jsx)(K.x,{fontSize:"sm",children:"To set up full environment comparison:"}),(0,t.jsxs)(eA.QI,{children:[(0,t.jsx)(eA.HC,{children:(0,t.jsx)(K.x,{fontSize:"sm",children:"Run `recce debug` for setup assistance"})}),(0,t.jsx)(eA.HC,{children:(0,t.jsxs)(K.x,{fontSize:"sm",children:["Visit"," ",(0,t.jsxs)(o.r,{color:"blue.500",fontSize:"sm",fontWeight:"medium",isExternal:!0,href:"https://docs.datarecce.io/configure-diff/",children:["docs"," "]}),"for configuration details"]})})]})]})]})}async function tm(e){return(await k.U.post("/api/cll",e)).data}var tf=i(75532);let tg=e=>{let{menuItems:n,isOpen:i,onClose:l,x:o,y:r}=e;return(0,t.jsx)(J.v,{isOpen:i,onClose:l,children:(0,t.jsx)(W.q,{fontSize:"10pt",position:"absolute",width:"250px",style:{left:"".concat(o,"px"),top:"".concat(r,"px")},children:0===n.length?(0,t.jsx)(H.s,{isDisabled:!0,children:"No action available"},"no action"):n.map(e=>e.isSeparator?(0,t.jsx)(U.R,{},e.label):(0,t.jsx)(H.s,{icon:e.icon,isDisabled:e.isDisabled,onClick:()=>{e.action&&e.action(),l()},children:e.label},e.label))})})},tv=e=>{var n,i,l,o,s,a,c,d,u,h,x;let{isOpen:p,onClose:m,x:f,y:g,node:v}=e,j=[],{selectParentNodes:y,selectChildNodes:b,getNodeColumnSet:w,selectMode:k,viewOptions:_,showColumnLevelLineage:C}=eC(),{runAction:S}=(0,ev.$q)(),{isActionAvailable:z}=(0,ef.kJ)(),{data:D}=(0,nX.P)(),R=null!==(i=null==D?void 0:D.single_env_onboarding)&&void 0!==i&&i,{primaryKey:I}=(0,nQ.ZP)(null==v?void 0:null===(n=v.data)||void 0===n?void 0:n.name),{setSqlQuery:T,setPrimaryKeys:q}=(0,nU.rV)(),[,N]=(0,eX.TH)();if(!(null==v?void 0:v.data))return(0,t.jsx)(t.Fragment,{});let E=v.data,L=E.resourceType,F=Array.from(w(v.id)),O={source:"lineage_model_node"};if("modified"===E.changeStatus&&j.push({label:"Show Impact Radius",icon:(0,t.jsx)(eM.hKE,{}),action:()=>{C(v.id)}}),!k&&L&&["model","seed","snapshot"].includes(L)){j.length>0&&j.push({label:"select group",isSeparator:!0});let e=(0,eQ.N)(R?"query":"query_diff"),n=iO(Object.keys(null!==(s=null===(l=E.data.base)||void 0===l?void 0:l.columns)&&void 0!==s?s:{}),Object.keys(null!==(a=null===(o=E.data.current)||void 0===o?void 0:o.columns)&&void 0!==a?a:{})),i='select * from {{ ref("'.concat(E.name,'") }}');if(n.length&&(i="select \n ".concat(n.join("\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),j.push({label:"Query",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{T(i),z("query_diff_with_primary_key")&&q(void 0!==I?[I]:void 0),N("/query")}}),F.length>0){if(void 0!==_.column_level_lineage){let n=new Set;I&&n.add(I),F.forEach(e=>{n.add(e)}),j.push({label:"Query Related Columns",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{T("select \n ".concat(Array.from(n).join(",\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),z("query_diff_with_primary_key")&&q(void 0!==I?[I]:void 0),N("/query")}})}else{let n=Object.entries(null!==(d=null===(c=E.change)||void 0===c?void 0:c.columns)&&void 0!==d?d:{}).filter(e=>{let[,n]=e;return"modified"===n}).map(e=>{let[n]=e;return n});if(n.length>0){let i=new Set;I&&i.add(I),n.forEach(e=>{i.add(e)}),j.push({label:"Query Modified Columns",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{T("select \n ".concat(Array.from(i).join(",\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),z("query_diff_with_primary_key")&&q(void 0!==I?[I]:void 0),N("/query")}})}}}e=(0,eQ.N)(R?"row_count":"row_count_diff"),j.push({label:null!==(u=null==e?void 0:e.title)&&void 0!==u?u:"Row count",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{S(R?"row_count":"row_count_diff",{node_names:[E.name]},{showForm:!1,trackProps:O})}}),e=(0,eQ.N)(R?"profile":"profile_diff"),j.push({label:null!==(h=null==e?void 0:e.title)&&void 0!==h?h:"Profile",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{let e=Array.from(w(v.id));S(R?"profile":"profile_diff",{model:E.name,columns:e},{showForm:!0,trackProps:O})}}),R||(e=(0,eQ.N)("value_diff"),j.push({label:null!==(x=null==e?void 0:e.title)&&void 0!==x?x:"Value Diff",icon:(0,t.jsx)(r.J,{as:null==e?void 0:e.icon}),action:()=>{let e=Array.from(w(v.id));S("value_diff",{model:E.name,columns:e},{showForm:!0,trackProps:O})}}))}return R||(j.length>0&&j.push({label:"select group",isSeparator:!0}),j.push({label:"Select Parent Nodes",icon:(0,t.jsx)(tf.Cv2,{}),action:()=>{y(v.id,1)}}),j.push({label:"Select Child Nodes",icon:(0,t.jsx)(tf.IMj,{}),action:()=>{b(v.id,1)}}),j.push({label:"Select All Upstream Nodes",icon:(0,t.jsx)(tf.Cv2,{}),action:()=>{y(v.id)}}),j.push({label:"Select All Downstream Nodes",icon:(0,t.jsx)(tf.IMj,{}),action:()=>{b(v.id)}})),(0,t.jsx)(tg,{x:f,y:g,menuItems:j,isOpen:p,onClose:m})},tj=e=>{var n,i,l,o,s,a,c,d;let{isOpen:u,onClose:h,x,y:p,node:m}=e,f=[],{runAction:g}=(0,ev.$q)(),{isActionAvailable:v}=(0,ef.kJ)(),{data:j}=(0,nX.P)(),y=null!==(s=null==j?void 0:j.single_env_onboarding)&&void 0!==s&&s;if((null==m?void 0:m.data)===void 0)return(0,t.jsx)(t.Fragment,{});let b=m.data,w=b.node,k=b.column,_=b.type,C={source:"lineage_column_node"},S=(null===(i=w.data.base)||void 0===i?void 0:null===(n=i.columns)||void 0===n?void 0:n[k])===void 0||(null===(o=w.data.current)||void 0===o?void 0:null===(l=o.columns)||void 0===l?void 0:l[k])===void 0,z=(0,eQ.N)(y?"profile":"profile_diff");return f.push({label:null!==(a=null==z?void 0:z.title)&&void 0!==a?a:"Profile",icon:(0,t.jsx)(r.J,{as:null==z?void 0:z.icon}),action:()=>{g("profile_diff",{model:w.name,columns:[k]},{showForm:!1,trackProps:C})},isDisabled:S||!v("profile_diff")}),y||(z=(0,eQ.N)("histogram_diff"),f.push({label:null!==(c=null==z?void 0:z.title)&&void 0!==c?c:"Histogram Diff",icon:(0,t.jsx)(r.J,{as:null==z?void 0:z.icon}),action:()=>{g("histogram_diff",{model:w.name,column_name:k,column_type:_},{showForm:!1,trackProps:C})},isDisabled:S||!_||!(0,ew.d)(_)}),z=(0,eQ.N)("top_k_diff"),f.push({label:null!==(d=null==z?void 0:z.title)&&void 0!==d?d:"Top-K Diff",icon:(0,t.jsx)(r.J,{as:null==z?void 0:z.icon}),action:()=>{g("top_k_diff",{model:w.name,column_name:k,k:50},{showForm:!1,trackProps:C})},isDisabled:S})),(0,t.jsx)(tg,{x:x,y:p,menuItems:f,isOpen:u,onClose:h})},ty=e=>{let{isOpen:n,onClose:i,x:l,y:o,node:r}=e,{readOnly:s}=(0,ek.$)();if(s);else if((null==r?void 0:r.type)==="customNode")return(0,t.jsx)(tv,{x:l,y:o,isOpen:n,onClose:i,node:r});else if((null==r?void 0:r.type)==="customColumnNode")return(0,t.jsx)(tj,{x:l,y:o,isOpen:n,onClose:i,node:r})},tb=()=>{let{isOpen:e,onClose:n,onOpen:i}=(0,F.q)(),[t,l]=(0,j.useState)({x:0,y:0}),[o,r]=(0,j.useState)();return{props:{x:t.x,y:t.y,node:o,isOpen:e,onClose:n},showContextMenu:(e,n,t)=>{l({x:e,y:n}),r(t),i()},closeContextMenu:()=>{l({x:0,y:0}),r(void 0),n()}}},tw={customNode:function(e){var n,i,o;let{data:s}=e,{id:a,resourceType:c,changeStatus:u,change:h}=s,m=null==h?void 0:h.category,f=(0,n_.oR)(e=>e.transform[2]>.3),{icon:g}=eK(c),[v,y]=(0,j.useState)(!1),{interactive:b,selectNode:w,selectMode:k,focusedNode:_,getNodeAction:C,getNodeColumnSet:S,isNodeHighlighted:z,isNodeSelected:D,isNodeShowingChangeAnalysis:R,showContextMenu:I,viewOptions:T}=eC(),{lineageGraph:q}=(0,ef.kJ)(),N="modified"===u&&(null==q?void 0:q.nonBreakingSet.has(a)),E=z(a),L=D(a),F=(null===(n=T.column_level_lineage)||void 0===n?void 0:n.node)===a&&void 0===T.column_level_lineage.column,O=(null==_?void 0:_.id)===a||F,A=R(a),{icon:M,color:J,backgroundColor:P}=u?eH(u):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},V=A&&N?"dashed":"solid",W=s.name,H=S(s.id),K=H.size>0,U="action_result"===k?C(s.id):void 0,Q=f?"selecting"===k?L?J:"white":"action_result"!==k?O||L||v?P:"white":U?O||L||v?P:J:"white":O||L||v?J:P,B="selecting"===k?L?"white":"inherit":"action_result"===k&&U&&!L?"white":"inherit",$="selecting"===k?L?"white":"inherit":"action_result"===k&&U&&!L?"white":"inherit",X="selecting"===k?L?"white":J:"action_result"===k?U&&!L?"white":"inherit":J;return(0,t.jsxs)(d.k,{cursor:"selecting"===k?"pointer":"inherit",direction:"column",width:"300px",transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===k?U?"none":"opacity(0.2) grayscale(50%)":E||O||L||v?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},children:[(0,t.jsxs)(d.k,{borderColor:J,borderWidth:"2px",borderStyle:V,borderTopRadius:8,borderBottomRadius:K?0:8,backgroundColor:Q,height:"60px",children:[(0,t.jsx)(d.k,{bg:J,padding:b?"8px":"2px",borderRightWidth:"2px",borderColor:"selecting"===k?"#00000020":J,borderStyle:V,alignItems:"top",visibility:f?"inherit":"hidden",children:b&&(0,t.jsx)(nV,{checked:"selecting"===k&&L||"action_result"===k&&!!U,onClick:e=>{"action_result"!==k&&(e.stopPropagation(),w(s.id))}})}),(0,t.jsxs)(d.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,t.jsxs)(d.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:f?"inherit":"hidden",children:[(0,t.jsx)(nW,{name:W,color:B,resourceType:c}),v?(0,t.jsx)(r.J,{as:ex.D_A,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),I(n,e)}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.J,{boxSize:"16px",color:$,as:g}),u&&(0,t.jsx)(r.J,{color:X,as:M})]})]}),(0,t.jsx)(d.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:f?"inherit":"hidden",children:(0,t.jsxs)(x.U,{spacing:"8px",children:[A?(0,t.jsx)(l.x,{height:"20px",color:"gray",fontSize:"9pt",margin:0,fontWeight:600,children:m?nJ[m]:""}):"action_result"!==k&&"model"===s.resourceType?(0,t.jsx)(nP,{id:s.id,inverted:"selecting"===k&&!!L}):(0,t.jsx)(t.Fragment,{}),U?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.L,{}),(0,t.jsx)(nA,{node:s,action:U})]}):(0,t.jsx)(t.Fragment,{})]})})]})]}),K&&(0,t.jsx)(l.x,{p:"10px 10px",borderColor:J,borderWidth:"2px",borderTopWidth:0,borderStyle:V,borderBottomRadius:8,children:(0,t.jsx)(l.x,{height:"".concat(H.size*nw.O$,"px"),overflow:"auto"})}),Object.keys(null!==(i=s.parents)&&void 0!==i?i:{}).length>0&&(0,t.jsx)(n_.HH,{type:"target",position:n_.Ly.Left,isConnectable:!1}),Object.keys(null!==(o=s.children)&&void 0!==o?o:{}).length>0&&(0,t.jsx)(n_.HH,{type:"source",position:n_.Ly.Right,isConnectable:!1})]})},customColumnNode:function(e){var n,i;let{id:o,data:s}=e,{id:a}=s.node,{column:c,type:u,transformationType:h,changeStatus:x}=s,m=(0,n_.oR)(e=>e.transform[2]>.3),{viewOptions:f,showContextMenu:g,isNodeHighlighted:v,isNodeShowingChangeAnalysis:y}=eC(),b=null===(n=f.column_level_lineage)||void 0===n?void 0:n.node,w=c===(null===(i=f.column_level_lineage)||void 0===i?void 0:i.column)&&a===b,[k,_]=j.useState(!1),C=v(o),S=y(a);return m?(0,t.jsxs)(d.k,{width:"280px",padding:"0px 10px",border:"1px solid gray",backgroundColor:w?"#f0f0f0":"inherit",_hover:{backgroundColor:"#f0f0f0"},onMouseEnter:()=>{_(!0)},onMouseLeave:()=>{_(!1)},filter:C?"none":"opacity(0.2) grayscale(50%)",children:[(0,t.jsxs)(d.k,{fontSize:"11px",color:"black",width:"100%",gap:"3px",alignItems:"center",height:"".concat(nw.O$-1,"px"),children:[S?(0,t.jsx)(ts,{changeStatus:x}):(0,t.jsx)(ta,{transformationType:h}),(0,t.jsx)(l.x,{height:"".concat(nw.O$+1,"px"),children:c}),(0,t.jsx)(p.L,{}),k?(0,t.jsx)(r.J,{as:ex.D_A,boxSize:"14px",display:"inline-flex",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),g(n,e)}}):(0,t.jsx)(l.x,{height:"".concat(nw.O$+1," px"),children:u})]}),(0,t.jsx)(n_.HH,{type:"target",position:n_.Ly.Left,isConnectable:!1,style:{left:0,visibility:"hidden"}}),(0,t.jsx)(n_.HH,{type:"source",position:n_.Ly.Right,isConnectable:!1,style:{right:0,visibility:"hidden"}})]}):(0,t.jsx)(t.Fragment,{})}},tk=[],t_={customEdge:function(e){let{source:n,target:i,sourceX:l,sourceY:o,targetX:r,targetY:s,sourcePosition:a,targetPosition:c,style:d={},markerEnd:u,data:h}=e,x={...d},{isEdgeHighlighted:p}=eC();(null==h?void 0:h.changeStatus)&&(x.stroke=eH(h.changeStatus).color,x.strokeDasharray="5"),p(n,i)||(x.filter="opacity(0.2) grayscale(50%)");let[m]=(0,n_.OQ)({sourceX:l,sourceY:o,sourcePosition:a,targetX:r,targetY:s,targetPosition:c});return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(n_.u5,{path:m,markerEnd:u,style:{...x,...d}})})}},tC=e=>e.data.changeStatus?eH(e.data.changeStatus).color:"lightgray",tS=(e,n)=>{let i=e.current,t=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let i of e){let e=i.contentRect.width,l=i.contentRect.height;(Math.abs(l-t.current.height)>10||Math.abs(e-t.current.width)>10)&&t.current.height>0&&l>0&&t.current.width>0&&e>0&&n(),t.current={width:e,height:l}}});return i&&e.observe(i),()=>{i&&e.unobserve(i)}},[i,t,n])},tz=()=>{let[,e]=(0,eX.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},tD=(0,j.forwardRef)(function(e,n){var i,o;let{interactive:a=!1,...c}=e,u=(0,n_._K)(),h=(0,j.useRef)(null),{successToast:x,failToast:p}=e0(),{copyToClipboard:m,ImageDownloadModal:f,ref:g}=n6({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(n3))},onSuccess:()=>{x("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),p("Failed to copy image to clipboard",e)}}),[v,y,b]=(0,n_.Rr)(tk),[w,k,_]=(0,n_.ll)([]),{lineageGraph:S,retchLineageGraph:z,isLoading:D,error:R,refetchRunsAggregated:I}=(0,ef.kJ)(),{data:T}=(0,nX.P)(),{runId:E,showRunId:L,closeRunResult:F,runAction:O,isRunResultOpen:A}=(0,ev.$q)(),{run:M}=nZ(E),[J,P]=(0,j.useState)({...c.viewOptions}),V=e=>v.find(n=>n.data.name===e);(0,j.useImperativeHandle)(n,()=>({copyToClipboard:m}));let W=(0,j.useMemo)(()=>!!S&&S.modifiedSet.length>0,[S]),H=null!==(i=J.view_mode)&&void 0!==i?i:"changed_models",U=(0,j.useMemo)(()=>v.filter(e=>"customNode"===e.type).map(e=>e.id),[v]),B=(0,j.useMemo)(()=>S?U.map(e=>S.nodes[e]):[],[S,U]),[$,X]=(0,j.useState)(),Z=$?null==S?void 0:S.nodes[$]:void 0,[G,Y]=(0,j.useState)(),[ee,en]=(0,j.useState)(new Set),ei=(0,j.useMemo)(()=>S?Array.from(ee).map(e=>S.nodes[e]):[],[S,ee]),et=i2(ei.length>0?ei:B,{onActionStarted:()=>{Y("action_result")},onActionNodeUpdated:e=>{y(n=>n.map(n=>n.id===e.id?{...n}:n))},onActionCompleted:()=>{}}),el=null!==(o=J.breaking_change_enabled)&&void 0!==o&&o,[eo,er]=(0,j.useState)(),[es,ea]=(0,j.useState)(),ec=(0,j.useMemo)(()=>{if(!S)return new Set;if(J.column_level_lineage)return null!=es?es:new Set;let e=new Set,n=new Set(e="action_result"===G?new Set(Object.keys(et.actionState.actions)):Z?(0,iZ.G0)((0,nw.cr)(S,[Z.id]),(0,nw._e)(S,[Z.id])):W?el?S.impactedSet:(0,nw._e)(S,S.modifiedSet):new Set(U));return eo&&Object.entries(eo).forEach(i=>{let[t,l]=i;e.has(t)&&l.forEach(e=>{n.add("".concat(t,"_").concat(e))})}),n},[S,J.column_level_lineage,G,Z,W,eo,es,et.actionState.actions,el,U]),ed=tb(),eu=(0,s.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!S)return;if(J.node_ids)e=J.node_ids;else{var n,i;let t=null===(n=S.manifestMetadata.current)||void 0===n?void 0:n.project_name,l={view_mode:null!==(i=J.view_mode)&&void 0!==i?i:W?"changed_models":"all",packages:t?[t]:void 0,...c.viewOptions};try{e=(await eE({select:l.select,exclude:l.exclude,packages:l.packages,view_mode:l.view_mode})).nodes}catch(n){l.view_mode="all",e=(await eE({select:l.select,exclude:l.exclude,packages:l.packages,view_mode:l.view_mode})).nodes}P(l),er(void 0)}let[t,l,o]=(0,nw.mF)(S,{selectedNodes:e,breakingChangeEnabled:el});(0,nw.bK)(t,l),y(t),k(l),er(o)})()},[S]);let eh=()=>{X(void 0)},ex=e=>{let n=v.find(n=>n.id===e);if(n){if(n.parentId){var i;let e=n.parentId;n=null!==(i=v.find(n=>n.id===e))&&void 0!==i?i:n}if(n.width&&n.height){let e=n.position.x+n.width/2,i=n.position.y+n.height/2,t=u.getZoom();u.setCenter(e,i,{zoom:t,duration:200})}}},ep=tz();tS(h,()=>{"selecting"!==G&&($?ex($):u.fitView({nodes:v,duration:200}))});let em=(e,n)=>{G||(J.column_level_lineage?(0,C.KB)({action:"view",source:"cll_column"}):(0,C.KB)({action:"view",source:"changed_column"}),$&&X(n.parentId),eb({...J,column_level_lineage:{node:n.data.node.id,column:n.data.column}},!1))},eg=(e,n)=>{if(a&&S){if("customColumnNode"===n.type){em(e,n);return}if(eC(),G){if("action_result"===G){var i;let e=et.actionState.actions[n.id];(null===(i=e.run)||void 0===i?void 0:i.run_id)&&L(e.run.run_id),X(n.id)}else{let e=new Set(ee);ee.has(n.id)?e.delete(n.id):e.add(n.id),en(e),0===e.size&&Y(void 0)}}else X(n.id)}},ey=async e=>{var n,i,t,l,o;let r,s;let{viewOptions:a=J,fitView:c}=e;if(!S)return;if(J.select!==a.select||J.exclude!==a.exclude||J.packages!==a.packages||J.view_mode!==a.view_mode){try{let e=await eE({select:a.select,exclude:a.exclude,packages:a.packages,view_mode:a.view_mode});a.column_level_lineage=void 0,s=e.nodes}catch(e){e instanceof i0.d7&&eu({title:"Select node error",description:null!==(t=null===(i=e.response)||void 0===i?void 0:i.data.detail)&&void 0!==t?t:e.message,status:"error",isClosable:!0,position:"bottom-right"});return}X(void 0)}else s=v.map(e=>e.id);if(a.column_level_lineage)try{let e={node_id:a.column_level_lineage.node,column:a.column_level_lineage.column,change_analysis:!a.column_level_lineage.column,upstream:!!a.column_level_lineage.column,downstream:!0,cll:!0};r=await tm(e)}catch(e){if(e instanceof i0.d7){eu({title:"Column Level Lineage error",description:null!==(o=null===(l=e.response)||void 0===l?void 0:l.data.detail)&&void 0!==o?o:e.message,status:"error",isClosable:!0,position:"bottom-right"});return}}let[d,h,x]=(0,nw.mF)(S,{selectedNodes:s,columnLevelLineage:a.column_level_lineage,cll:r,breakingChangeEnabled:a.breaking_change_enabled});if(void 0!=a.column_level_lineage&&void 0!=r){let e=new Set;Object.keys(r.current.nodes).forEach(n=>{e.add(n)}),Object.keys(r.current.columns).forEach(n=>{e.add(n)}),ea(e)}y(d),k(h),er(x),(null==M?void 0:null===(n=M.params)||void 0===n?void 0:n.model)&&!V(M.params.model)&&F(),c&&(await new Promise(e=>setTimeout(e,1)),u.fitView({nodes:d,duration:200}))},eb=async function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];P(e),await ey({viewOptions:e,fitView:n})},ew=async e=>{let n={...J,breaking_change_enabled:e};P(n),await ey({viewOptions:n}),(0,C.Je)({enabled:e})},ek=i4();(0,j.useEffect)(()=>{let e=null==M?void 0:M.type;if(!(!a||!A||!e||["query_diff","query","row_count"].includes(e))&&!G){var n;let e=null===(n=M.params)||void 0===n?void 0:n.model,i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});if(e){let n=V(e);n?Z!==n.data&&eg(i,n):eb({...J,view_mode:"all"})}else eh()}},[M,J,A,G]);let eC=()=>{ed.closeContextMenu()},eS=(e,n)=>{if(!a||"action_result"===G)return;e.preventDefault();let i=g.current,t=i.getBoundingClientRect(),l=e.clientX-t.left,o=e.clientY-t.top+i.offsetTop;ed.showContextMenu(l,o,n)},ez=()=>{Y(void 0),en(new Set),X(void 0),F(),null==I||I()},eD={interactive:a,nodes:v,focusedNode:Z,selectedNodes:ei,viewOptions:J,showContextMenu:eS,onViewOptionsChanged:eb,selectMode:G,selectNode:e=>{if(G){if("selecting"===G){let n=new Set(ee);ee.has(e)?n.delete(e):n.add(e),en(n),0===n.size&&Y(void 0)}}else{if(!S)return;en(new Set([e])),Y("selecting"),X(void 0),J.column_level_lineage&&eb({...J,column_level_lineage:void 0}),et.reset()}},selectParentNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===G||void 0===S)return;!G&&(Y("selecting"),et.reset(),J.column_level_lineage&&eb({...J,column_level_lineage:void 0}));let i=(0,nw.cr)(S,[e],n);en((0,iZ.G0)(ee,i))},selectChildNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===G||void 0===S)return;!G&&(Y("selecting"),et.reset(),J.column_level_lineage&&eb({...J,column_level_lineage:void 0}));let i=(0,nw._e)(S,[e],n);en((0,iZ.G0)(ee,i))},deselect:ez,breakingChangeEnabled:el,isNodeHighlighted:e=>ec.has(e),isNodeSelected:e=>ee.has(e),isEdgeHighlighted:(e,n)=>J.column_level_lineage?!!es&&es.has(e)&&es.has(n):ec.has(e)&&ec.has(n),isNodeShowingChangeAnalysis:e=>{if(!S)return!1;let n=S.nodes[e];if(J.column_level_lineage){let i=J.column_level_lineage;return!i.column&&i.node===e&&"modified"===n.changeStatus}return!!el&&"modified"===n.changeStatus},getNodeAction:e=>et.actionState.actions[e],getNodeColumnSet:e=>{var n;return eo&&null!==(n=eo[e])&&void 0!==n?n:new Set},runRowCount:async()=>{"selecting"===G?(await et.runRowCount(),(0,C.oq)({type:"row_count",selected:"multi"})):Z?(O("row_count",{node_names:[Z.name]},{showForm:!1,showLast:!1}),(0,C.oq)({type:"row_count",selected:"single"})):(O("row_count",{select:J.select,exclude:J.exclude,packages:J.packages,view_mode:J.view_mode}),(0,C.oq)({type:"row_count",selected:"none"}))},runRowCountDiff:async()=>{"selecting"===G?(await et.runRowCountDiff(),(0,C.oq)({type:"row_count_diff",selected:"multi"})):Z?(O("row_count_diff",{node_names:[Z.name]},{showForm:!1,showLast:!1}),(0,C.oq)({type:"row_count_diff",selected:"single"})):(O("row_count_diff",{select:J.select,exclude:J.exclude,packages:J.packages,view_mode:J.view_mode}),(0,C.oq)({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(Z)O("value_diff",{model:Z.name},{showForm:!0,showLast:!1}),(0,C.oq)({type:"value_diff",selected:"single"});else{let e="selecting"===G?ei.length:U.length;await ek.confirm(e)&&(await et.runValueDiff(),(0,C.oq)({type:"value_diff",selected:"selecting"===G?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"selecting"===G?(e=await et.addLineageDiffCheck(),ez(),(0,C.oq)({type:"lineage_diff",selected:"multi"})):Z||(e=await iG(J),(0,C.oq)({type:"lineage_diff",selected:"none"})),e&&ep(e)},addSchemaDiffCheck:async()=>{let e;"selecting"===G?ei.length>0&&(e=await et.addSchemaDiffCheck(),ez(),(0,C.oq)({type:"schema_diff",selected:"multi"})):Z?(e=await nB({node_id:Z.id}),(0,C.oq)({type:"schema_diff",selected:"single"})):(e=await nB({select:J.select,exclude:J.exclude,packages:J.packages,view_mode:J.view_mode}),(0,C.oq)({type:"schema_diff",selected:"none"})),e&&ep(e)},cancel:et.cancel,actionState:et.actionState,centerNode:ex,showColumnLevelLineage:async(e,n)=>{await eb({...J,column_level_lineage:{node:e,column:n}},!1),X(e)},resetColumnLevelLineage:()=>{X(void 0),eb({...J,column_level_lineage:void 0},!1)}};return D?(0,t.jsx)(d.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,t.jsx)(ej.$,{size:"xl"})}):R?(0,t.jsx)(q.M,{h:"100%",children:(0,t.jsxs)(N.g,{children:[(0,t.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,t.jsxs)(l.x,{children:["[Reason: ",R,"]"]}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:()=>{z&&z()},children:"Retry"})]})}):S&&v!=tk?"changed_models"!==H||S.modifiedSet.length?(0,t.jsxs)(e_.Provider,{value:eD,children:[(0,t.jsxs)(eF,{sizes:Z?[70,30]:[100,0],minSize:Z?400:0,gutterSize:Z?5:0,style:{height:"100%",width:"100%"},children:[(0,t.jsxs)(N.g,{ref:h,divider:(0,t.jsx)(nk.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(iX,{}),(0,t.jsx)(te,{})]}),(0,t.jsxs)(n_.x$,{proOptions:{hideAttribution:!0},nodeTypes:tw,edgeTypes:t_,nodes:v,edges:w,onNodesChange:b,onEdgesChange:_,onNodeClick:eg,onNodeContextMenu:eS,onClick:eC,onInit:()=>{if(W)u.fitView();else{let e=(0,n_.RX)(v);u.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:.1,nodesDraggable:a,ref:g,children:[(0,t.jsx)(nC.A,{color:"#ccc"}),(0,t.jsx)(nS.Z,{showInteractive:!1,position:"top-right",className:n3,children:(0,t.jsx)(nS.B,{title:"copy image",onClick:async()=>{await m(),(0,C.nO)({type:H,from:"lineage_view"})},children:(0,t.jsx)(r.J,{as:nT.C3L})})}),(0,t.jsx)(f,{}),(0,t.jsx)(n_.s_,{position:"bottom-left",children:(0,t.jsxs)(d.k,{direction:"column",gap:"5px",children:[W&&(0,t.jsx)(iY,{}),J.column_level_lineage&&(0,t.jsx)(tu,{})]})}),(0,t.jsx)(n_.s_,{position:"top-center",children:(0,t.jsx)(th,{notification:(null==T?void 0:T.single_env_onboarding)?(0,t.jsx)(tp,{}):null,type:"info"})}),(0,t.jsx)(n_.s_,{position:"top-left",children:(0,t.jsxs)(d.k,{direction:"column",gap:"5px",children:[(0,t.jsx)(tr,{enabled:el,onChanged:ew}),J.column_level_lineage&&(0,t.jsx)(td,{node:J.column_level_lineage.node,column:J.column_level_lineage.column,reset:a?()=>{X(void 0),eb({...J,column_level_lineage:void 0})}:void 0}),0==v.length&&(0,t.jsx)(K.x,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,t.jsx)(nz.a,{nodeColor:tC,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===G&&(0,t.jsx)(n_.s_,{position:"bottom-center",className:n3,children:(0,t.jsx)(iM,{onClose:()=>{ez()}})})]}),(0,t.jsx)(ty,{...ed.props})]}),Z?(0,t.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,t.jsx)(iA,{node:Z,onCloseNode:eh})}):(0,t.jsx)(l.x,{})]}),ek.AlertDialog]}):(0,t.jsx)(q.M,{h:"100%",children:(0,t.jsxs)(N.g,{children:[(0,t.jsx)(t.Fragment,{children:"No change detected"}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:async()=>{await eb({...J,view_mode:"all"})},children:"Show all nodes"})]})}):(0,t.jsx)(t.Fragment,{})}),tR=(0,j.forwardRef)(function(e,n){let{check:i}=e,l={...i.params,...i.view_options};return(0,t.jsx)(d.k,{direction:"column",height:"100%",children:(0,t.jsx)(n_.tV,{children:(0,t.jsx)(tD,{viewOptions:l,interactive:!1,ref:n})})})});function tI(e){let{yamlTemplate:n}=e;return(0,t.jsx)(e4.ML,{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 tT(){let e=(0,s.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function tq(){let e=(0,L._)(["\n <details><summary>","</summary>\n\n ","\n\n </details>"]);return tq=function(){return e},e}let tN=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!n.error),tE=e=>{var n,i,o,s,a,c,u,v,b,w,k,S,z;let{checkId:T,refreshCheckList:E}=e,{readOnly:L}=(0,ek.$)(),ea=(0,ep.NL)(),[,ec]=(0,eX.TH)(),{successToast:ed,failToast:eu}=e0(),{markedAsApprovedToast:ef}=tT(),[eg,ev]=(0,j.useState)(),[ej,ey]=(0,j.useState)(),[eb,ew]=(0,j.useState)(!1),[e_,eC]=(0,j.useState)(""),{isOpen:eS,onOpen:ez,onClose:eD}=(0,F.q)(),eR=()=>(0,t.jsx)(O.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[eI,eT]=(0,j.useState)((0,t.jsx)(eR,{})),{isLoading:eq,error:eN,data:eE}=(0,y.a)({queryKey:_.V.check(T),queryFn:async()=>D(T),refetchOnMount:!0}),eL=null!=eg?eg:null==eE?void 0:null===(n=eE.last_run)||void 0===n?void 0:n.run_id,{run:eF,error:eA}=nZ(eL),eM=eg?!eF||"running"===eF.status:(null==eF?void 0:eF.status)==="running",eJ=(null==eE?void 0:eE.type)?(0,eQ.N)(eE.type):void 0,eP=null!==(c=null==eE?void 0:eE.is_preset)&&void 0!==c&&c,eV=(0,j.useRef)(null),{mutate:eW}=(0,em.D)({mutationFn:e=>R(T,e),onSuccess:async()=>{await ea.invalidateQueries({queryKey:_.V.check(T)}),await ea.invalidateQueries({queryKey:_.V.checks()})}}),{mutate:eH}=(0,em.D)({mutationFn:()=>I(T),onSuccess:async()=>{await ea.invalidateQueries({queryKey:_.V.checks()}),ec("/checks")}}),eK=(0,j.useCallback)(async()=>{(null==eE?void 0:eE.type)&&(ev((await (0,nf.rf)(T,{nowait:!0})).run_id),await ea.invalidateQueries({queryKey:_.V.check(T)}),E&&E())},[eE,T,ev,ea,E]),eU=(0,j.useCallback)(async()=>{if(ew(!0),eL)return await (0,nf.Eg)(eL)},[eL]),eB=async()=>{var e;if(!eE)return;let n=(e=eE,(0,eY.RI)(tq(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(e2(e),"\n\n").concat((0,eY.Pn)(e1(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return e2(e)}(e)));if(!window.isSecureContext){eu("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(n),ed("Copied the check to the clipboard")}catch(e){eu("Failed to copy the check to clipboard",e)}},eZ=(0,j.useCallback)(()=>{let e=null==eE?void 0:eE.is_checked;eW({is_checked:!e}),e||ef()},[null==eE?void 0:eE.is_checked,eW,ef]),[e5,e4]=(0,j.useState)(0),{ref:e8,onCopyToClipboard:e3,onMouseEnter:e6,onMouseLeave:e9}=n9();if((0,j.useEffect)(()=>{var e,n,i;eC(function(e){let{name:n,description:i,type:t,params:l,viewOptions:o}=e,r={name:n,description:i,type:t,params:l};return o&&(r.view_options=o),nG.ZP.stringify({checks:[r]})}({name:null!==(e=null==eE?void 0:eE.name)&&void 0!==e?e:"",description:null!==(n=null==eE?void 0:eE.description)&&void 0!==n?n:"",type:null!==(i=null==eE?void 0:eE.type)&&void 0!==i?i:"",params:null==eE?void 0:eE.params,viewOptions:null==eE?void 0:eE.view_options}))},[eE]),eq)return(0,t.jsx)(q.M,{h:"100%",children:"Loading"});if(eN)return(0,t.jsxs)(q.M,{h:"100%",children:["Error: ",eN.message]});let e7=(null==eF?void 0:eF.run_at)?(0,nb.Q)(new Date(eF.run_at),{addSuffix:!0}):null;return(0,t.jsxs)(eO,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,t.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,t.jsxs)(d.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,t.jsx)(eh,{name:null!==(u=null==eE?void 0:eE.name)&&void 0!==u?u:"",setName:e=>{eW({name:e})}}),eP&&(0,t.jsx)(A.u,{label:"Preset Check defined in recce config",children:(0,t.jsxs)(M.Vp,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,t.jsx)(M.AD,{boxSize:"14px",as:er.bX4}),"Preset"]})}),(0,t.jsx)(p.L,{}),(0,t.jsxs)(x.U,{mr:"10px",children:[e7&&(0,t.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:e7}),(0,t.jsxs)(J.v,{children:[(0,t.jsx)(P.j,{isRound:!0,as:V.h,icon:(0,t.jsx)(r.J,{as:ex.D_A}),variant:"ghost",size:"sm"}),(0,t.jsxs)(W.q,{children:[(0,t.jsx)(H.s,{as:K.x,fontSize:"10pt",icon:(0,t.jsx)(es.ovA,{}),onClick:()=>{eT((0,t.jsx)(eR,{})),ez()},children:"Get Preset Check Template"}),(0,t.jsx)(H.s,{as:K.x,fontSize:"10pt",icon:(0,t.jsx)(ei.T,{}),onClick:()=>eB(),children:"Copy Markdown"}),(0,t.jsx)(U.R,{}),(0,t.jsx)(H.s,{as:K.x,fontSize:"10pt",icon:(0,t.jsx)(et.p,{}),color:"red",onClick:()=>{eH()},isDisabled:L,children:"Delete"})]})]}),(0,t.jsx)(A.u,{label:tN(null!==(v=null==eE?void 0:eE.type)&&void 0!==v?v:"",eF)?"Run the check first":(null==eE?void 0:eE.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,t.jsx)(Q.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==eE?void 0:eE.is_checked)?"green":"gray",variant:(null==eE?void 0:eE.is_checked)?"solid":"outline",leftIcon:(null==eE?void 0:eE.is_checked)?(0,t.jsx)(el.r,{}):(0,t.jsx)(r.J,{as:ex.Rbx,color:"lightgray"}),onClick:()=>{eZ()},isDisabled:tN(null!==(b=null==eE?void 0:eE.type)&&void 0!==b?b:"",eF)||L,children:(null==eE?void 0:eE.is_checked)?"Approved":"Mark as Approved"})})]})]}),(0,t.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,t.jsx)(eG,{value:null==eE?void 0:eE.description,onChange:e=>{eW({description:e})}},null==eE?void 0:eE.check_id)})]}),(0,t.jsx)(l.x,{style:{contain:"strict"},children:(0,t.jsxs)(m.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:e5,onChange:e4,children:[(0,t.jsxs)(f.t,{height:"50px",children:[(0,t.jsx)(g.O,{fontSize:"10pt",children:"Result"}),((null==eE?void 0:eE.type)==="query"||(null==eE?void 0:eE.type)==="query_diff")&&(0,t.jsx)(g.O,{fontSize:"10pt",children:"Query"}),(0,t.jsx)(p.L,{}),(0,t.jsxs)(x.U,{mr:"10px",children:[(null==eJ?void 0:eJ.RunResultView)&&(0,t.jsx)(A.u,{label:"Rerun",children:(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(eo.n,{}),variant:"outline",isLoading:eM,size:"sm",onClick:()=>eK(),isDisabled:L,children:"Rerun"})}),(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(ei.T,{}),variant:"outline",isDisabled:tN(null!==(w=null==eE?void 0:eE.type)&&void 0!==w?w:"",eF)||0!==e5,onMouseEnter:e6,onMouseLeave:e9,size:"sm",onClick:async()=>{var e,n;(null==eE?void 0:eE.type)==="lineage_diff"?null===(e=eV.current)||void 0===e||e.copyToClipboard():await e3(),(0,C.nO)({type:null!==(n=null==eE?void 0:eE.type)&&void 0!==n?n:"unknown",from:"check"})},children:"Copy to Clipboard"})]})]}),(0,t.jsxs)(B.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,t.jsxs)($.x,{p:0,width:"100%",height:"100%",children:[(null==eJ?void 0:eJ.RunResultView)&&((null==eE?void 0:eE.last_run)||eL?(0,t.jsx)(ny,{ref:e8,isRunning:eM,isAborting:eb,run:eL?eF:null==eE?void 0:eE.last_run,error:eA,progress:ej,RunResultView:eJ.RunResultView,viewOptions:null==eE?void 0:eE.view_options,onViewOptionsChanged:e=>{eW({view_options:e})},onCancel:eU,onExecuteRun:eK}):(0,t.jsx)(q.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,t.jsxs)(N.g,{spacing:4,children:[(0,t.jsx)(l.x,{children:"This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here."}),(0,t.jsx)(Q.z,{onClick:eK,colorScheme:"blue",size:"sm",isDisabled:L,children:"Run Query"})]})})),eE&&"schema_diff"===eE.type&&(0,t.jsx)(e$,{check:eE,ref:e8}),eE&&"lineage_diff"===eE.type&&(0,t.jsx)(tR,{check:eE,ref:eV})]}),((null==eE?void 0:eE.type)==="query"||(null==eE?void 0:eE.type)==="query_diff"||(null==eE?void 0:eE.type)==="query_base")&&(0,t.jsx)($.x,{p:0,height:"100%",width:"100%",children:(null===(i=eE.params)||void 0===i?void 0:i.base_sql_template)?(0,t.jsx)(nm,{value:null!==(k=null===(o=eE.params)||void 0===o?void 0:o.sql_template)&&void 0!==k?k:"",baseValue:null!==(S=null===(s=eE.params)||void 0===s?void 0:s.base_sql_template)&&void 0!==S?S:"",options:{readOnly:!0}}):(0,t.jsx)(np,{value:null!==(z=null===(a=eE.params)||void 0===a?void 0:a.sql_template)&&void 0!==z?z:"",options:{readOnly:!0}})})]})]})}),(0,t.jsxs)(X.u_,{isOpen:eS,onClose:eD,isCentered:!0,size:"6xl",children:[eI,(0,t.jsxs)(Z.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,t.jsx)(G.x,{children:"Preset Check Template"}),(0,t.jsx)(Y.o,{}),(0,t.jsxs)(ee.f,{children:[(0,t.jsxs)(h.X,{size:"sm",fontWeight:"bold",children:["Please"," ",(0,t.jsx)(K.x,{as:"span",cursor:"pointer",_hover:{textDecoration:"underline"},color:"blue.500",onClick:async()=>{await navigator.clipboard.writeText(e_),ed("Copied the template to the clipboard")},children:"copy"})," ","the following template and paste it into the"," ",(0,t.jsx)(en.y,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"recce.yml"})," ","file."]}),(0,t.jsx)("br",{}),(0,t.jsx)(tI,{yamlTemplate:e_})]})]})]})]})};var tL=i(19155);let tF=e=>{var n,i,o,s,a;let{check:c,selected:u,onSelect:h,onMarkAsApproved:x}=e,{readOnly:p}=(0,ek.$)(),m=(0,ep.NL)(),f=c.check_id,{mutate:g}=(0,em.D)({mutationFn:e=>R(f,e),onSuccess:async()=>{await m.invalidateQueries({queryKey:_.V.check(f)}),await m.invalidateQueries({queryKey:_.V.checks()})}}),{run:v}=nZ(null===(n=c.last_run)||void 0===n?void 0:n.run_id),j=null!==(o=null===(i=(0,eQ.N)(c.type))||void 0===i?void 0:i.icon)&&void 0!==o?o:il.WzH,y=tN(null!==(s=c.type)&&void 0!==s?s:"",v)||p,b=tN(null!==(a=c.type)&&void 0!==a?a:"",v);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(d.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:u?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:u?"orange":"transparent",onClick:()=>{h(c.check_id)},alignItems:"center",gap:"5px",children:[(0,t.jsx)(r.J,{as:j}),(0,t.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:c.name}),(0,t.jsx)(A.u,{label:b?"Run the check first":"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,t.jsx)(d.k,{children:(0,t.jsx)(iJ.X,{isChecked:c.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;n?x():g({is_checked:n})},disabled:y})})})]})})},tO=e=>{let{checks:n,selectedItem:i,onCheckSelected:o,onChecksReordered:r}=e,[s,a]=(0,j.useState)(!1),c=(0,ep.NL)(),{mutate:u}=(0,em.D)({mutationFn:e=>R(e,{is_checked:!0}),onSuccess:async(e,n)=>{await c.invalidateQueries({queryKey:_.V.check(n)}),await c.invalidateQueries({queryKey:_.V.checks()})}}),{isOpen:h,onOpen:x,onClose:p}=(0,F.q)(),{markedAsApprovedToast:m}=tT(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(i),m()):x()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tL.Z5,{onDragEnd:e=>{e.destination&&r(e.source.index,e.destination.index)},children:(0,t.jsx)(tL.bK,{droppableId:"checklist",children:e=>(0,t.jsxs)(N.g,{...e.droppableProps,ref:e.innerRef,className:"no-track-pii-safe",w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,t.jsx)(tL._l,{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},i=e.style.left-n.x,t=e.style.top-n.y;e.style.left=i,e.style.top=t}}return(0,t.jsx)(d.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,t.jsx)(tF,{check:e,selected:e.check_id===i,onSelect:o,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,t.jsxs)(X.u_,{isOpen:h,onClose:p,isCentered:!0,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{width:"400px",children:[(0,t.jsx)(G.x,{children:"Mark as Approved?"}),(0,t.jsx)(Y.o,{}),(0,t.jsx)(E.i,{}),(0,t.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,t.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,t.jsx)(iJ.X,{isChecked:s,onChange:e=>{a(e.target.checked)},fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,t.jsx)(E.i,{}),(0,t.jsxs)(ni.m,{children:[(0,t.jsx)(Q.z,{variant:"outline",size:"xs",mr:2,onClick:p,children:"Cancel"}),(0,t.jsx)(Q.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(i),s&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),m(),p()},children:"Mark as approved"})]})]})]})]})};var tA=i(69069);function tM(e){let{checksOnly:n=!0}=e,{readOnly:i}=(0,ek.$)(),l=(0,s.p)(),o=(0,ep.NL)(),a=(0,j.useRef)(null),c=(0,j.useRef)(null),[u,h]=(0,j.useState)(null),{isOpen:x,onOpen:p,onClose:m}=(0,F.q)(),[f,g]=(0,eX.TH)(),[,v]=(0,ef.P)(),y=(0,j.useCallback)(async()=>{if(u){try{let{runs:e,checks:i}=await (0,tA.V5)(u,n);v(),await o.invalidateQueries({queryKey:_.V.checks()}),await o.invalidateQueries({queryKey:_.V.runs()}),f.includes("/checks")&&g("/checks");let t=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");l({description:t,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),l({title:"Import failed",description:String(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}m()}},[o,u,l,m,f,g,v,n]),b=()=>{a.current&&a.current.click()},w=n?"checks":"runs and checks",{isDemoSite:k}=(0,ef.kJ)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.u,{label:"Import Checklist from State File"+(k?" (Disabled in the demo site)":""),children:(0,t.jsx)(V.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{b(),(0,C.lH)({name:"import"})},icon:(0,t.jsx)(r.J,{as:nr.Vs}),isDisabled:i||k})}),(0,t.jsx)("input",{type:"file",style:{display:"none"},ref:a,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(h(e.target.files[0]),p()),a.current&&(a.current.value="")}}),(0,t.jsx)(i5.aR,{isOpen:x,leastDestructiveRef:c,onClose:m,size:"xl",children:(0,t.jsx)(O.Z,{children:(0,t.jsxs)(i5._T,{children:[(0,t.jsx)(G.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,t.jsx)(ee.f,{children:(0,t.jsxs)(d.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,t.jsxs)(d.k,{alignItems:"center",gap:"5px",children:[(0,t.jsx)(nD.s,{color:"red.600"}),(0,t.jsx)(K.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,t.jsx)(d.k,{children:(0,t.jsxs)(K.x,{children:["The current ",w," will be"," ",(0,t.jsx)(K.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,t.jsxs)(ni.m,{children:[(0,t.jsx)(Q.z,{ref:c,onClick:m,children:"Cancel"}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:y,ml:"5px",children:"Import"})]})]})})})]})}var tJ=i(22301);let tP=()=>{let[,e]=(0,eX.TH)(),[,n]=(0,eX.yj)("/checks/:checkId"),{latestSelectedCheckId:i,setLatestSelectedCheckId:o}=(0,tJ.p)(),r=(0,ep.NL)(),s=null==n?void 0:n.checkId;s&&o(s);let{isLoading:a,error:c,data:u,status:h,refetch:x}=(0,y.a)({queryKey:_.V.checks(),queryFn:z,refetchOnMount:!0}),p=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,f]=(0,j.useState)(null!=u?u:[]),{mutate:g}=(0,em.D)({mutationFn:e=>T(e),onSuccess:async()=>{await r.invalidateQueries({queryKey:_.V.checks()})}}),v=(0,j.useCallback)((e,n)=>{let i=[...m],[t]=i.splice(e,1);i.splice(n,0,t),g({source:e,destination:n}),f(i)},[m,f,g]);return((0,j.useEffect)(()=>{"success"===h&&(!s&&u.length>0&&(i?e("/checks/".concat(i)):e("/checks/".concat(u[0].check_id))),f(u))},[h,s,u,f,e,i]),a)?(0,t.jsx)(t.Fragment,{}):c?(0,t.jsxs)(t.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,t.jsxs)(eF,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,t.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,t.jsxs)(N.g,{spacing:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,t.jsx)(d.k,{justifyContent:"right",padding:"0px 10px",children:(0,t.jsx)(tM,{checksOnly:!0})}),(0,t.jsx)(E.i,{}),(0,t.jsx)(tO,{checks:m,selectedItem:s,onCheckSelected:p,onChecksReordered:v})]})}),(0,t.jsx)(l.x,{height:"100%",children:(0,t.jsx)(eX.rs,{children:(0,t.jsx)(eX.AW,{path:"/checks/:checkId",children:e=>(0,t.jsx)(tE,{checkId:e.checkId,refreshCheckList:x},e.checkId)})})})]}):(0,t.jsx)(q.M,{h:"100%",children:(0,t.jsx)(l.x,{children:"No checks"})})},tV=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:i}=(0,ev.$q)();return(0,t.jsxs)(l.x,{children:[(0,t.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,t.jsx)(Q.z,{leftIcon:(0,t.jsx)(r.J,{as:ex.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?((0,C.U8)({name:"hide"}),i()):((0,C.U8)({name:"show"}),n())},children:e?"Hide":"Show"})]})},tW=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:i,setBaseSqlQuery:o}=(0,nU.rV)();return(0,t.jsxs)(l.x,{children:[(0,t.jsxs)(l.x,{fontSize:"8pt",children:["Custom Queries"," ",(0,t.jsx)(A.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,t.jsx)(nD.s,{color:"gray.600",boxSize:"3"})})]}),(0,t.jsx)(tn.r,{size:"sm",isChecked:e,onChange:()=>{!e&&o&&o(i),n(!e)}})]})},tH=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:i,setBaseSqlQuery:o,primaryKeys:r,setPrimaryKeys:s,isCustomQueries:a}=(0,nU.rV)(),{lineageGraph:c,envInfo:u}=(0,ef.kJ)(),{readOnly:h}=(0,ek.$)(),{data:x}=(0,nX.P)(),m=e;(null==u?void 0:u.adapterType)==="sqlmesh"&&e===nU.nw&&(m="select * from db.mymodel"),h&&(m="--- Would like to do query here? Book a demo with us at https://datarecce.io/\n".concat(m));let{showRunId:f}=(0,ev.$q)(),g=async e=>{let i="query_base"===e?null!=n?n:"":m,t=function(e){switch(e){case"query":return ig;case"query_base":return iv;case"query_diff":return ij;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:i};"query_diff"===e&&(l.primary_keys=r,a&&(l.base_sql_template=n));let{run_id:o}=await t(l,{nowait:!0});return f(o),await (0,nf.Qp)(o)},{mutate:v,isPending:y}=(0,em.D)({mutationFn:g}),b=(0,j.useMemo)(()=>{let e={};for(let i in null==c?void 0:c.nodes){var n;let t=null===(n=c.nodes[i].data.current)||void 0===n?void 0:n.schema;t&&(e[t]=(e[t]||0)+1)}return Object.keys(e).reduce((n,i)=>e[i]>(e[n]||0)?i:n,"N/A")},[null==c?void 0:c.nodes]);return(null==x?void 0:x.single_env_onboarding)?(0,t.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",children:[(0,t.jsx)(tV,{}),(0,t.jsx)(p.L,{}),(0,t.jsx)(A.u,{label:"Please configure the base environment before running the diff",placement:"left",children:(0,t.jsx)(Q.z,{colorScheme:"blue",isDisabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})})]}),(0,t.jsx)(nm,{value:m,onChange:i,onRun:()=>{v("query")},labels:["base (production)","current (".concat(b,")")],BaseEnvironmentSetupGuide:(0,t.jsx)(tx,{})})]}):(0,t.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,t.jsx)(tV,{}),(0,t.jsx)(tW,{}),(0,t.jsx)(p.L,{}),(0,t.jsx)(iS,{defaultPrimaryKeys:r,onPrimaryKeysChange:s}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:()=>{v("query_diff")},isDisabled:y||h,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,t.jsx)(l.x,{width:"100%",flex:"1",children:a?(0,t.jsx)(nm,{value:m,baseValue:n,onChange:i,onChangeBase:o,onRun:()=>{v("query")},onRunBase:()=>{v("query_base")},onRunDiff:()=>{v("query_diff")}}):(0,t.jsx)(np,{value:m,onChange:i,onRun:()=>{v("query")},onRunDiff:()=>{v("query_diff")}})})]})},tK=e=>{var n;let{runId:i}=e,{isPending:l,error:o,data:r}=(0,y.a)({queryKey:_.V.run(i),queryFn:async()=>(0,nf.Qp)(i)}),s=(null==r?void 0:r.type)?null===(n=(0,eQ.N)(r.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,t.jsx)(ny,{isPending:l,error:o,run:r,RunResultView:s})},tU=e=>{let{error:n,resetError:i}=e;return(0,t.jsx)(q.M,{height:"100%",backgroundColor:"gray.50",children:(0,t.jsxs)(d.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,t.jsx)(h.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,t.jsx)(l.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,t.jsx)(Q.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{i()},children:"Reset"})]})})},tQ=e=>{let{children:n}=e;return(0,t.jsx)(nj.SV,{fallback:tU,children:n})};function tB(){let{readOnly:e}=(0,ek.$)(),n=(0,s.p)(),i=async()=>{try{let e=await (0,tA.xq)(),n=JSON.stringify(e,null,2),i=new Blob([n],{type:"application/json"}),t=new Date,l="recce-state-".concat((0,nl.WU)(t,"yyyy-MM-dd-HH-mm-ss"),".json");n8()(i,l)}catch(e){console.error("Export failed",e),n({title:"Export failed",description:String(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,t.jsx)(A.u,{label:"Export",children:(0,t.jsx)(V.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:async()=>{await i(),(0,C.lH)({name:"export"})},icon:(0,t.jsx)(r.J,{as:nr.b8,verticalAlign:"middle",boxSize:"16px"}),isDisabled:e})})}function t$(){return(0,t.jsx)(n_.tV,{children:(0,t.jsx)(tD,{interactive:!0})})}i(72729);var tX=i(89755);i(2231);let tZ=e=>{var n,i;let{run:o,isSelected:s,onSelectRun:a,onAddToChecklist:c,onGoToCheck:u}=e,{readOnly:h,singleEnv:x}=(0,ek.$)(),{data:p}=(0,y.a)({queryKey:_.V.run(o.run_id),queryFn:async()=>await (0,nf.Qp)(o.run_id),enabled:"running"===o.status,retry:!1}),m=null!==(i=null===(n=(0,eQ.N)(o.type))||void 0===n?void 0:n.icon)&&void 0!==i?i:il.WzH,f=o.check_id;return(0,t.jsxs)(d.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:s?"orange.400":"transparent",backgroundColor:s?"orange.50":"transparent",onClick:()=>{a(o.run_id)},_hover:{bg:s?"orange.50":"gray.200"},children:[(0,t.jsxs)(d.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,t.jsx)(r.J,{as:m}),(0,t.jsx)(l.x,{className:"no-track-pii-safe",flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:o.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:o.name||"<no name>"}),f?(0,t.jsx)(A.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,t.jsx)(K.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),u(f)},children:(0,t.jsx)(r.J,{color:"green",as:eM.FJM})})}):h||x?null:(0,t.jsx)(A.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,t.jsx)(K.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),(0,C.U8)({name:"add_to_checklist"}),c(o.run_id)},children:(0,t.jsx)(r.J,{as:eM.wO})})})]}),(0,t.jsx)(d.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,t.jsx)(ie,{run:null!=p?p:o})})]})},tG=e=>{let{runAt:n}=e,i=n?function(e){let n=new Date,i=new Date;return(i.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":i.toDateString()===e.toDateString()?"Yesterday":(0,nl.WU)(e,"MMM d")}(new Date(n)):null;return(0,t.jsx)(d.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:i})},tY=()=>{let{data:e,isLoading:n,isFetching:i,error:o,refetch:r}=(0,y.a)({queryKey:_.V.runs(),queryFn:async()=>await (0,nf.sw)(),retry:!1}),{showRunId:s,runId:a}=(0,ev.$q)(),c=e=>{(0,C.U8)({name:"click_run"}),s(e,!1)},[,u]=(0,eX.TH)(),m=(0,ep.NL)(),f=(0,j.useCallback)(async()=>{if(!a)return;let e=await S(a);await m.invalidateQueries({queryKey:_.V.checks()}),u("/checks/".concat(e.check_id))},[a,u,m]),g=(0,j.useCallback)(e=>{(0,C.U8)({name:"go_to_check"}),u("/checks/".concat(e))},[u]),v=null;return(0,t.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(x.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,t.jsx)(h.X,{size:"md",children:"History"}),(0,t.jsx)(p.L,{}),(0,t.jsx)(V.h,{variant:"unstyled",icon:(0,t.jsx)(eo.n,{}),"aria-label":"Search database",onClick:async()=>{await r()}})]}),(0,t.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,t.jsx)(q.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,t.jsx)(tX.Z,{style:{minHeight:"100%",height:0},children:(null!=e?e:[]).map((e,n)=>{let i=new Date(e.run_at).toDateString(),l=null!=v&&v!==i;return v=i,(0,t.jsxs)(t.Fragment,{children:[l&&(0,t.jsx)(tG,{runAt:e.run_at},i),(0,t.jsx)(tZ,{run:e,isSelected:e.run_id===a,onSelectRun:c,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var t0=i(98579);let t1=()=>{let e=(0,s.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,i)=>{let t=n;if(null!=i){if(i instanceof i0.d7){var l,o;t="".concat(n,". ").concat(String(null===(o=i.response)||void 0===o?void 0:null===(l=o.data)||void 0===l?void 0:l.detail))}else t="".concat(n,". ").concat(i)}e({description:t,status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},t2=e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},t5=()=>{var e,n;let i;let{readOnly:o}=(0,ek.$)(),{fileName:s,cloudMode:a,isDemoSite:c,envInfo:u}=(0,ef.kJ)(),h=(0,F.q)(),x=(0,F.q)(),p=!s&&!a&&!c,{data:m}=(0,y.a)({queryKey:_.V.checks(),queryFn:z,enabled:p}),f=void 0!=m&&m.filter(e=>!e.is_preset).length>0;t2(p&&f);let[{newFileName:g,errorMessage:v,modified:b,overwriteWithMethod:w,bypass:k},C]=(0,j.useState)({newFileName:null!=s?s:"recce_state.json"}),S=(0,j.useRef)(null),{toastSuccess:D,toastError:R}=t1(),I=(0,ep.NL)(),T=async(e,n)=>{if(!g)return;let i="true"===localStorage.getItem(iT.bypassSaveOverwrite);try{"save"===e?await (0,tA.po)({filename:g,overwrite:null!=n?n:i}):await (0,tA.PQ)({filename:g,overwrite:null!=n?n:i}),D("save"===e?"Save file successfully":"Rename file successfully"),await I.invalidateQueries({queryKey:_.V.lineage()}),k&&localStorage.setItem(iT.bypassSaveOverwrite,"true")}catch(n){if(n instanceof i0.d7){var t;if((null===(t=n.response)||void 0===t?void 0:t.status)===409){C(n=>({...n,overwriteWithMethod:e})),x.onOpen();return}}R("save"===e?"Save file failed":"Rename file failed",n)}finally{h.onClose()}};if(a||c)return(0,t.jsx)(t.Fragment,{});if(o&&s){let n=null==u?void 0:null===(e=u.stateMetadata)||void 0===e?void 0:e.generated_at,t=n?n7(new Date(n)):null;i=t?"".concat(s," (").concat(t,")"):null}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d.k,{justifyContent:"center",alignItems:"center",children:[(0,t.jsx)(l.x,{fontWeight:"600",children:null!==(n=null!=i?i:s)&&void 0!==n?n:"New Instance"+(f?" (unsaved)":"")}),!o&&(0,t.jsx)(A.u,{label:s?"Change Filename":"Save",openDelay:1e3,children:(0,t.jsx)(V.h,{onClick:()=>{C({newFileName:null!=s?s:"recce_state.json",modified:!s}),h.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,t.jsx)(r.J,{as:s?nr.yl:nr.kx,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,t.jsxs)(X.u_,{isOpen:h.isOpen,onClose:h.onClose,isCentered:!0,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{children:s?"Change Filename":"Save File"}),(0,t.jsx)(Y.o,{}),(0,t.jsx)(ee.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,t.jsxs)(i_.NI,{isInvalid:!!v,children:[(0,t.jsx)(iC.l,{children:"File name:"}),(0,t.jsx)(ed.I,{ref:S,value:g,placeholder:"Enter filename",onChange:e=>{let n;let i=e.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?s&&i===s&&(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.",C(e=>({...e,modified:!0,newFileName:i,errorMessage:n}))},onKeyDown:e=>{"Enter"===e.key?v||(s?T("rename"):T("save")):"Escape"===e.key&&h.onClose()}}),(0,t.jsx)(t0.J1,{children:v})]})}),(0,t.jsxs)(ni.m,{gap:"5px",children:[(0,t.jsx)(Q.z,{size:"sm",colorScheme:s?void 0:"blue",onClick:async()=>{await T("save")},isDisabled:!g||!!v||!b,children:s?"Save as New File":"Confirm"}),s&&(0,t.jsx)(Q.z,{size:"sm",colorScheme:"blue",onClick:async()=>{await T("rename")},isDisabled:!g||!!v||!b,children:"Rename"})]})]})]}),(0,t.jsxs)(X.u_,{isOpen:x.isOpen,onClose:x.onClose,initialFocusRef:S,isCentered:!0,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{children:"Overwrite File?"}),(0,t.jsx)(Y.o,{}),(0,t.jsxs)(ee.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,t.jsx)(l.x,{fontSize:"12pt",children:"save"===w?"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,t.jsx)(iJ.X,{isChecked:k,onChange:e=>{C(n=>({...n,bypass:e.target.checked}))},fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,t.jsxs)(ni.m,{gap:"5px",children:[(0,t.jsx)(Q.z,{variant:"outline",onClick:()=>{x.onClose(),h.onOpen(),C(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,t.jsx)(Q.z,{size:"sm",colorScheme:"blue",onClick:()=>{w&&(T(w,!0),x.onClose())},children:"Overwrite"})]})]})]})]})};var t4=i(15791),t8=i(11989);function t3(){return(0,t.jsx)(A.u,{label:"Syncing",children:(0,t.jsx)(Q.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,t.jsx)(ej.$,{})})})}function t6(){let[e,n]=(0,j.useState)(!1),i=(0,ep.NL)(),[o,a]=(0,eX.TH)(),{isOpen:c,onOpen:d,onClose:u}=(0,F.q)(),[h,x]=(0,j.useState)(""),p=(0,s.p)(),m=(0,j.useCallback)(async e=>{if(u(),n(!0),"conflict"===(await (0,tA.mB)(e)).status){d(),n(!1);return}for(;await (0,tA.tw)();)await new Promise(e=>setTimeout(e,1e3));p({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),x(""),await i.invalidateQueries({queryKey:_.V.lineage()}),await i.invalidateQueries({queryKey:_.V.checks()}),await i.invalidateQueries({queryKey:_.V.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(o)&&a("/checks")},[i,o,a,p,d,u]);return e?(0,t.jsx)(t3,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.u,{label:"Sync with Cloud",children:(0,t.jsx)(V.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,t.jsx)(r.J,{as:nr.JK,verticalAlign:"middle",boxSize:"16px"})})}),(0,t.jsxs)(X.u_,{isOpen:c,onClose:u,children:[(0,t.jsx)(O.Z,{}),(0,t.jsxs)(Z.h,{children:[(0,t.jsx)(G.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,t.jsxs)(ee.f,{children:[(0,t.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,t.jsx)(l.x,{mt:"5px",children:(0,t.jsx)(t4.E,{onChange:x,value:h,children:(0,t.jsxs)(e5.K,{direction:"column",children:[(0,t.jsxs)(t8.Y,{value:"merge",children:["Merge",(0,t.jsx)(A.u,{label:"This will merge the local and remote states.",children:(0,t.jsx)("span",{children:(0,t.jsx)(r.J,{as:i8.h,ml:2,cursor:"pointer"})})})]}),(0,t.jsxs)(t8.Y,{value:"overwrite",children:["Overwrite",(0,t.jsx)(A.u,{label:"This will overwrite the remote state file with the local state.",children:(0,t.jsx)("span",{children:(0,t.jsx)(r.J,{as:i8.h,ml:2,cursor:"pointer"})})})]}),(0,t.jsxs)(t8.Y,{value:"revert",children:["Revert",(0,t.jsx)(A.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,t.jsx)("span",{children:(0,t.jsx)(r.J,{as:i8.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,t.jsxs)(ni.m,{children:[(0,t.jsx)(Q.z,{onClick:u,mr:3,children:"Cancel"}),(0,t.jsx)(Q.z,{colorScheme:"blue",onClick:()=>m({method:h}),isDisabled:!h,children:"Sync"})]})]})]})]})}var t9=i(94082);function t7(){let{successToast:e,failToast:n}=e0(),{onCopy:i}=(0,t9.V)(""),{authed:l}=(0,ek.$)(),{shareUrl:o,isLoading:r,error:s,handleShareClick:a}=(0,io.z)(),[c,u]=(0,j.useState)(!1),h=()=>{try{i(o),e("Copied the link to clipboard")}catch(e){n("Failed to copy the link",e)}};return l?(0,t.jsxs)(d.k,{flex:"1",alignItems:"center",gap:"5px",children:[(0,t.jsx)(Q.z,{size:"sm",variant:"outline",onClick:async()=>{await a(),(0,C.v4)({name:"create"})},leftIcon:(0,t.jsx)(il.eOs,{}),rightIcon:o?(0,t.jsx)(el.r,{color:"green"}):void 0,isLoading:r,children:"Share"}),(0,t.jsxs)(d.k,{gap:"5px",alignItems:"center",children:[o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.k,{overflowX:"auto",whiteSpace:"nowrap",maxWidth:"350px",children:(0,t.jsx)(K.x,{fontSize:"14",children:o})}),(0,t.jsx)(V.h,{size:"xs","aria-label":"Copy the share URL",icon:(0,t.jsx)(ei.T,{}),onClick:()=>{h(),(0,C.v4)({name:"copy"})}})]}),s&&(0,t.jsx)(K.x,{fontSize:"14",color:"red.500",children:s})]})]}):(0,t.jsxs)(d.k,{flex:"1",alignItems:"center",children:[(0,t.jsx)(Q.z,{size:"sm",variant:"outline",leftIcon:(0,t.jsx)(il.eOs,{}),onClick:()=>{u(!0)},children:"Share"}),c&&(0,t.jsx)(id,{handleParentClose:()=>{u(!1)},ignoreCookie:!0})]})}let le={TOAST_ID:"lifetime-countdown",WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>"The server will be closed in ".concat(e," seconds."),STYLE:{fontFamily:"monospace"}},ln=e=>{let{children:n,path:i}=e,[o]=(0,eX.yj)(i);return(0,t.jsx)(l.x,{display:o?"block":"none",height:"100%",children:n})};function li(e){let{icon:n,href:i,...l}=e;return(0,t.jsx)(o.r,{height:"20px",color:"white",href:i,isExternal:!0,...l,children:(0,t.jsx)(r.J,{color:"white",boxSize:"20px",as:n})})}function lt(){let{version:e,latestVersion:n}=function(){let[e,n]=(0,j.useState)(""),[i,t]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let{version:e,latestVersion:i}=(await k.U.get("/api/version")).data;n(e),t(i)}catch(e){console.error("Error fetching version number:",e)}})()},[]),{version:e,latestVersion:i}}(),i=(0,s.p)(),l="recce-update-available";return RegExp("^\\d+\\.\\d+\\.\\d+$").test(e)?(e===n||i.isActive(l)||i({id:l,title:"Update available",position:"top-right",description:(0,t.jsxs)("span",{children:["A new version of Recce (v",n,") is available.",(0,t.jsx)("br",{}),"Please run ",(0,t.jsx)(c.E,{children:"pip install --upgrade recce"})," to update Recce.",(0,t.jsx)("br",{}),(0,t.jsx)(o.r,{color:"rgb(255, 215, 0)",fontWeight:"bold",href:"https://github.com/DataRecce/recce/releases/tag/v".concat(n),isExternal:!0,_hover:{textDecoration:"underline"},target:"_blank",children:"Click here to view the detail of latest release"})]}),containerStyle:{background:"rgba(20, 20, 20, 0.6)",color:"white",backdropFilter:"blur(10px)",borderRadius:"8px"},variant:"unstyled",isClosable:!0}),(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,t.jsx)(o.r,{href:"https://github.com/DataRecce/recce/releases/tag/v".concat(e),isExternal:!0,_hover:{textDecoration:"none"},children:e})})):(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:e})}function ll(){var e;let{reviewMode:n,isDemoSite:i,envInfo:c,cloudMode:m}=(0,ef.kJ)(),{readOnly:f,lifetimeExpiredAt:g}=(0,ek.$)(),{url:v,id:y}=null!==(e=null==c?void 0:c.pullRequest)&&void 0!==e?e:{},b=v?v.split("/").pop():null;return!function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,s.p)(),t=(0,j.useRef)(),l=(0,j.useRef)(),o=(0,j.useMemo)(()=>{var e,i,t;return{position:null!==(e=n.position)&&void 0!==e?e:"bottom-right",variant:null!==(i=n.variant)&&void 0!==i?i:"left-accent",status:null!==(t=n.status)&&void 0!==t?t:"warning",duration:null,isClosable:!0,containerStyle:le.STYLE}},[n.position,n.variant,n.status]),r=(0,j.useCallback)(()=>{if(!e)return 0;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},[e]),a=(0,j.useCallback)(()=>{t.current&&(i.close(t.current),t.current=void 0),l.current&&(clearInterval(l.current),l.current=void 0)},[i]),c=(0,j.useCallback)(()=>{if(!t.current)return;let e=r();if(e<=0){a();return}i.update(t.current,{...o,description:le.MESSAGE(e)})},[i,o,r,a]),d=(0,j.useCallback)(()=>{if(!e)return;a();let n=r();n<=0||(t.current=i({id:le.TOAST_ID,description:le.MESSAGE(n),...o}),l.current=setInterval(c,le.UPDATE_INTERVAL))},[e,i,r,o,c,a]);(0,j.useEffect)(()=>{if(!e)return;let n=r();if(n-le.WARNING_THRESHOLD<0)d();else{let e=setTimeout(d,(n-le.WARNING_THRESHOLD)*1e3);return()=>{clearTimeout(e),a()}}return a},[e,r,d,a])}(g),(0,t.jsxs)(d.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,t.jsx)(u.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,t.jsx)(h.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,t.jsx)(lt,{}),(f||n)&&(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:f?"read only":"review mode"}),m&&y&&(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,t.jsxs)(x.U,{children:[(0,t.jsx)(l.x,{children:"cloud mode"}),(0,t.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,t.jsxs)(o.r,{href:v,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,t.jsx)(r.J,{as:ex.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(String(y))]})})]})}),i&&v&&b&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,t.jsxs)(x.U,{children:[(0,t.jsx)(l.x,{children:"demo mode"}),(0,t.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,t.jsxs)(o.r,{href:v,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,t.jsx)(r.J,{as:ex.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(b)]})})]})})}),(0,t.jsx)(p.L,{}),(0,t.jsx)(li,{icon:eM.hJX,href:"https://github.com/DataRecce/recce"}),(0,t.jsx)(li,{icon:eM.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,t.jsx)(li,{mr:"18px",icon:eM.MXt,href:"https://docs.datarecce.io"})]})}function lo(e){let{queryKey:n,fetchCallback:i,selectCallback:o}=e,{data:r,isLoading:s,error:a}=(0,y.a)({queryKey:n,queryFn:i,select:o});return s||a||0===r?(0,t.jsx)(t.Fragment,{}):(0,t.jsx)(l.x,{ml:"2px",maxH:"20px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:r})}function lr(){let{isDemoSite:e,cloudMode:n,isLoading:i}=(0,ef.kJ)(),{readOnly:o}=(0,ek.$)(),[r,s]=(0,eX.TH)(),{data:a,isLoading:c}=(0,nX.P)(),u=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,t.jsx)(lo,{queryKey:_.V.checks(),fetchCallback:z,selectCallback:e=>e.filter(e=>!e.is_checked).length}),disable:(null==a?void 0:a.single_env_onboarding)===!0}],h=w().findIndex(u,e=>{let{href:n}=e;return r.startsWith(n)});return(0,t.jsx)(m.m,{index:h,children:(0,t.jsxs)(f.t,{children:[(0,t.jsx)(l.x,{flex:"1",display:"flex",children:u.map(e=>{let{name:n,href:l,badge:o,disable:r}=e;return(0,t.jsxs)(g.O,{onClick:()=>{s(l)},isDisabled:!!i||c||r,hidden:r,children:[n,o]},n)})}),(0,t.jsx)(d.k,{flex:"3",justifyContent:"right",alignItems:"center",children:!i&&!e&&(0,t.jsx)(t5,{})}),(0,t.jsx)(d.k,{flex:"3",justifyContent:"left",alignItems:"center",children:!i&&!e&&!(null==a?void 0:a.single_env_onboarding)&&!o&&(0,t.jsx)(t7,{})}),!i&&(0,t.jsxs)(d.k,{flex:"3",justifyContent:"right",alignItems:"center",mr:"8px",children:[(0,t.jsx)(nx,{}),n&&(0,t.jsx)(t6,{}),(0,t.jsx)(tB,{})]})]})})}function ls(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:i}=(0,ev.$q)(),{data:o}=(0,nX.P)(),[r]=(0,eX.TH)(),s=e&&!r.startsWith("/checks"),a=n&&!r.startsWith("/checks");return(0,t.jsxs)(eF,{sizes:[0,100],minSize:a?300:0,gutterSize:a?5:0,style:{height:"100%"},children:[(0,t.jsx)(l.x,{style:{contain:"size"},children:a&&(0,t.jsx)(tY,{})}),(0,t.jsxs)(eO,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,t.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,t.jsxs)(tQ,{children:[(0,t.jsx)(ln,{path:"/lineage",children:(0,t.jsx)(t$,{})}),(0,t.jsxs)(eX.rs,{children:[(0,t.jsx)(eX.AW,{path:"/query",children:(0,t.jsx)(tH,{})}),(0,t.jsx)(eX.AW,{path:"/checks/:slug*",children:(0,t.jsx)(tP,{})}),(0,t.jsx)(eX.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,t.jsx)(tK,{runId:n})}}),(0,t.jsx)(eX.AW,{path:"/ssr",children:(0,t.jsx)(v.E,{size:"xs",isIndeterminate:!0})}),(0,t.jsx)(eX.AW,{children:(0,t.jsx)(eX.l_,{to:"/lineage"})})]})]})}),s?(0,t.jsx)(im,{onClose:i,isSingleEnvironment:!!(null==o?void 0:o.single_env_onboarding)}):(0,t.jsx)(l.x,{})]})]})}function la(e){let{children:n}=e;return(0,t.jsx)(d.k,{direction:"column",height:"100vh",overflow:"hidden",children:n})}function lc(){let{isDemoSite:e,isLoading:n}=(0,ef.kJ)(),{readOnly:i}=(0,ek.$)();return(0,j.useEffect)(()=>{(0,C.JY)()},[]),(0,t.jsxs)(la,{children:[(0,t.jsx)(ll,{}),(0,t.jsx)(lr,{}),(0,t.jsx)(ls,{}),!n&&!e&&!i&&(0,t.jsx)(id,{})]})}},53893:function(){},28350:function(){},84351:function(){}},function(e){e.O(0,[951,220,531,509,989,147,495,376,678,20,413,648,995,739,283,303,22,25,355,599,63,42,181,92,275,217,744],function(){return e(e.s=48614)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{75532:function(t,n,r){r.d(n,{Cv2:function(){return u},IMj:function(){return e}});var a=r(25281);function u(t){return(0,a.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 18h12v2H6zm6-14.414-6.707 6.707 1.414 1.414L11 7.414V16h2V7.414l4.293 4.293 1.414-1.414z"}}]})(t)}function e(t){return(0,a.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 18h12v2H6zm5-14v8.586L6.707 8.293 5.293 9.707 12 16.414l6.707-6.707-1.414-1.414L13 12.586V4z"}}]})(t)}}}]);