mage-ai 0.8.39__py3-none-any.whl → 0.8.40__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 mage-ai might be problematic. Click here for more details.
- mage_ai/data_preparation/models/pipeline.py +13 -12
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +2 -2
- mage_ai/server/frontend_dist/404.html.html +2 -2
- mage_ai/server/frontend_dist/_next/static/{ngCg1gM6urg83y2nV5KHK → UYQNglbviUz843DEKVYAI}/_buildManifest.js +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-aaf065c2c2a70e6e.js +1 -0
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +2 -2
- mage_ai/server/frontend_dist/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +2 -2
- mage_ai/server/frontend_dist/terminal.html +2 -2
- mage_ai/server/frontend_dist/test.html +3 -3
- mage_ai/server/frontend_dist/triggers.html +2 -2
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/METADATA +1 -1
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/RECORD +40 -40
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-017f6a2de38f8658.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{ngCg1gM6urg83y2nV5KHK → UYQNglbviUz843DEKVYAI}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{ngCg1gM6urg83y2nV5KHK → UYQNglbviUz843DEKVYAI}/_ssgManifest.js +0 -0
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.39.dist-info → mage_ai-0.8.40.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-aaf065c2c2a70e6e.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{62976:function(e,n,t){"use strict";t.d(n,{Z:function(){return D}});var i=t(82394),r=t(21831),o=t(82684),l=t(10919),c=t(12691),u=t.n(c),a=t(34376),s=t.n(a),d=t(9518),f=t(63068),p=t(44628),h=t(6508),m=t(67971),v=t(19711),g=t(23831),b=t(31969),x=function(){var e=document.createElement("div");e.setAttribute("style","width: 100px; height: 100px; overflow: scroll; position:absolute; top:-9999px;"),document.body.appendChild(e);var n=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),n},j=t(2005),y=t(31012),k=t(37391),Z=t(6753),_=t(49125),O=t(20567),C=t(24224),E=t(28598);function S(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function w(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?S(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):S(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var P=2*_.iI+y.dN,I=20*_.iI,T=d.default.div.withConfig({displayName:"DataTable__Styles",componentId:"sc-1arr863-0"})([""," "," "," .body > div{","}.table{border-spacing:0;display:inline-block;"," "," "," "," .tr{.td.td-index-column{","}}.th{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;","}.th,.td{"," font-family:",";margin:0;","}.td{padding:","px;}&.sticky{overflow:auto;}.header{overflow:hidden;}}"],(function(e){return e.disableScrolling&&"\n overflow: hidden;\n "}),(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,"px;\n ")}),k.w5,(function(e){return!e.noBorderBottom&&"\n border-bottom: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderLeft&&"\n border-left: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderRight&&"\n border-right: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return!e.noBorderTop&&"\n border-top: 1px solid ".concat((e.theme.borders||b.Z.borders).medium,";\n ")}),(function(e){return"\n color: ".concat((e.theme.content||b.Z.content).default,";\n ")}),(function(e){return"\n height: ".concat(e.columnHeaderHeight||P,"px;\n ")}),y.iD,j.ry,(function(e){return"\n background-color: ".concat((e.theme.background||b.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.borders||b.Z.borders).medium,";\n border-right: 1px solid ").concat((e.theme.borders||b.Z.borders).medium,";\n ")}),1*_.iI);function A(e){var n=e.original,t=8.5*Math.max.apply(Math,(0,r.Z)(n.map((function(e){return(null===e||void 0===e?void 0:e.length)||0})))),i=Math.ceil(t/(I-2*_.iI));return Math.max(i,1)*y.dN+2*_.iI}function R(e){var n=e.columnHeaderHeight,t=e.columns,i=e.data,c=e.disableScrolling,a=e.height,k=e.index,S=e.invalidValues,T=e.maxHeight,R=e.numberOfIndexes,D=e.previewIndexes,M=e.renderColumnHeader,N=e.width,L=(0,o.useContext)(d.ThemeContext),B=(0,o.useRef)(null),F=(0,o.useRef)(null);(0,o.useEffect)((function(){var e=function(e){var n;null===B||void 0===B||null===(n=B.current)||void 0===n||n.scroll(e.target.scrollLeft,0)};return F&&F.current.addEventListener("scroll",e),function(){var n;null===F||void 0===F||null===(n=F.current)||void 0===n||n.removeEventListener("scroll",e)}}),[B,F]);var U=(0,o.useMemo)((function(){return k&&i&&k.length===i.length}),[i,k]),H=(0,o.useMemo)((function(){var e=[];return(0,C.w6)(R).forEach((function(n,t){var o=8.7*String(null===i||void 0===i?void 0:i.length).length;if(U){var l=k.map((function(e){return R>=2?String(e[t]).length:String(e).length}));o=8.7*Math.max.apply(Math,(0,r.Z)(l))}e.push(o+2*_.iI)})),e}),[i,k,R,U]),z=t.map((function(e){return null===e||void 0===e?void 0:e.Header})).slice(1),W=(0,o.useMemo)((function(){return x()}),[]),G=(0,o.useMemo)((function(){var e=N-(Math.max.apply(Math,(0,r.Z)(H))+1.5*_.iI+W),n=t.length-1,i=I;return i*n<e&&(i=e/n),{width:i}}),[t,H,W,N]),V=(0,p.useTable)({columns:t,data:i,defaultColumn:G},p.useBlockLayout,h.useSticky),Q=V.getTableBodyProps,q=V.getTableProps,Y=V.headerGroups,K=V.prepareRow,X=V.rows,J=s().query.slug,$=void 0===J?[]:J,ee=new Set((null===D||void 0===D?void 0:D.removedRows)||[]),ne=(0,o.useCallback)((function(e){var n=e.index,t=e.style,i=X[n];K(i);var r=i.original,c=ee.has(n);return(0,E.jsx)("div",w(w({},i.getRowProps({style:w(w({},t),{},{width:"auto"})})),{},{className:"tr",children:i.cells.map((function(e,t){var i,a=t<=R-1,s=e.getCellProps(),d=e.column.id,f=null===S||void 0===S||null===(i=S[d])||void 0===i?void 0:i.includes(n),p=w({},s.style);a&&(p.fontFamily=j.Vp,p.left=0,p.position="sticky",p.textAlign=k?"right":"center",p.width=H[t]);var h,g=r[t-R],x=z.indexOf(d);if(f&&(p.color=b.Z.interactive.dangerBorder),c&&(p.backgroundColor=b.Z.background.danger),Array.isArray(g)||"object"===typeof g)try{g=JSON.stringify(g)}catch(y){g="Error: cannot display value"}return a&&(U?(h=k[n],Array.isArray(h)&&(h=h[t])):h=e.render("Cell")),(0,o.createElement)("div",w(w({},s),{},{className:"td ".concat(a?"td-index-column":""),key:"".concat(t,"-").concat(g),style:p}),h,!a&&(0,E.jsxs)(m.Z,{justifyContent:"space-between",children:[(0,E.jsxs)(v.ZP,{danger:f,default:!0,wordBreak:!0,children:[!0===g&&"true",!1===g&&"false",(null===g||"null"===g)&&"null",!0!==g&&!1!==g&&null!==g&&"null"!==g&&g]}),f&&(0,E.jsx)(u(),{as:(0,O.o_)(Z.mW,x),href:"/datasets/[...slug]",passHref:!0,children:(0,E.jsx)(l.Z,{danger:!0,children:"View all"})})]}))}))}))}),[k,S,H,R,K,X,$]),te=(0,o.useMemo)((function(){var e;return T?(e=(0,C.Sm)(X.map(A)),e+=n||P-y.dN):(e=a,e-=n||P),e}),[n,A,a,T,X]),ie=(0,o.useMemo)((function(){return(0,E.jsx)(f.S_,{estimatedItemSize:P,height:te,itemCount:null===X||void 0===X?void 0:X.length,itemSize:function(e){return A(X[e])},outerRef:F,style:{maxHeight:T,pointerEvents:c?"none":null},children:ne})}),[te,F,ne,X]);return(0,E.jsx)("div",w(w({},q()),{},{className:"table sticky",style:{width:N},children:(0,E.jsxs)("div",w(w({},Q()),{},{className:"body",children:[(0,E.jsx)("div",{className:"header",ref:B,children:Y.map((function(e,n){return(0,o.createElement)("div",w(w({},e.getHeaderGroupProps()),{},{className:"tr",key:"".concat(e.id,"_").concat(n)}),e.headers.map((function(e,n){var t,i=n<=R-1,r=e.getHeaderProps(),l=w({},r.style);return i?(l.fontFamily=j.Vp,l.left=0,l.position="sticky",l.textAlign="center",l.width=H[n],l.minWidth=H[n]):M?t=M(e,n-R,{width:G.width}):(t=e.render("Header"),l.color=(L||g.Z).content.default,l.padding=1*_.iI,l.minWidth=G.width),(0,o.createElement)("div",w(w({},r),{},{className:"th",key:e.id,style:l,title:i?"Row number":void 0}),t)})))}))}),ie]}))}))}var D=function(e){var n=e.columnHeaderHeight,t=e.columns,r=e.disableScrolling,l=e.height,c=e.index,u=e.invalidValues,a=e.maxHeight,s=e.noBorderBottom,d=e.noBorderLeft,f=e.noBorderRight,p=e.noBorderTop,h=e.previewIndexes,m=e.renderColumnHeader,v=e.rows,g=e.width,b=(0,o.useMemo)((function(){return null!==c&&void 0!==c&&c.length&&Array.isArray(c[0])?c[0].length:1}),[c]),x=(0,o.useMemo)((function(){return(0,C.w6)(b).map((function(e,n){return{Header:(0,C.w6)(n+1).map((function(){return" "})).join(" "),accessor:function(e,n){return n},sticky:"left"}})).concat(null===t||void 0===t?void 0:t.map((function(e){return{Header:String(e),accessor:String(e)}})))}),[t,b]);return(0,o.useMemo)((function(){return null===v||void 0===v?void 0:v.map((function(e){return e.reduce((function(e,n,r){return w(w({},e),{},(0,i.Z)({},t[r],n))}),{})}))}),[t,v]),(0,E.jsx)(T,{columnHeaderHeight:n,disableScrolling:r,height:l,maxHeight:(a||0)+37,noBorderBottom:s,noBorderLeft:d,noBorderRight:f,noBorderTop:p,children:(0,E.jsx)(R,{columnHeaderHeight:n,columns:x,data:v,disableScrolling:r,height:l,index:c,invalidValues:u,maxHeight:a,numberOfIndexes:b,previewIndexes:h,renderColumnHeader:m,width:g})})}},43032:function(e,n,t){"use strict";t.d(n,{Cl:function(){return c},Nk:function(){return u},ZG:function(){return l}});var i=t(9518),r=t(23831),o=t(49125),l=1.5*o.iI,c=1*l+o.iI/2,u=i.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-uvd91-0"})([".row:hover{","}"],(function(e){return"\n background-color: ".concat((e.theme.interactive||r.Z.interactive).hoverBackground,";\n ")}))},55106:function(e,n,t){"use strict";t.d(n,{Z:function(){return g}});var i=t(82394),r=t(75582),o=t(82684),l=t(83455),c=t(9518),u=t(77011),a=t(28598);function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function d(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var f=c.default.div.withConfig({displayName:"MultiFileInput__DropzoneStyle",componentId:"sc-1l6yd2y-0"})(["&:hover{cursor:pointer;}"]);var p=function(e){var n=e.children,t=e.inputOnChange,i=e.inputProps,r=e.onDragActiveChange,l=e.setFiles,c=(0,o.useCallback)((function(e){l(e)}),[l]),s=(0,u.uI)({onDrop:c}),p=s.getInputProps,h=s.getRootProps,m=s.isDragActive,v=p(),g=v.accept,b=v.autoComplete,x=v.multiple,j=v.onChange,y=v.onClick,k=v.ref,Z=v.style,_=v.tabIndex,O=v.type,C=d(d({},i),{},{accept:g,autoComplete:b,multiple:x,onChange:function(e){null===t||void 0===t||t(e),null===i||void 0===i||i.onChange(e),j(e)},onClick:y,ref:k,style:Z,tabIndex:_,type:O});return(0,o.useEffect)((function(){null===r||void 0===r||r(m)}),[m,r]),(0,a.jsxs)(f,d(d({},h()),{},{children:[(0,a.jsx)("input",d(d({},C),{},{directory:"",webkitdirectory:""})),n]}))},h=t(82531);function m(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function v(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?m(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var g=function(e){var n=e.children,t=e.directoryPath,c=e.onDragActiveChange,u=e.setFileUploadProgress,s=e.setUploadedFiles,d=(0,l.Db)(h.ZP.files.useCreate({onUploadProgress:function(e,n){var t,r=n.body,o=[null===r||void 0===r?void 0:r.dir_path,null===r||void 0===r||null===(t=r.file)||void 0===t?void 0:t.name].filter((function(e){return(null===e||void 0===e?void 0:e.length)>=1})).join("/");null===u||void 0===u||u((function(n){return v(v({},n),{},(0,i.Z)({},o,e.loaded/e.total))}))}})),f=(0,r.Z)(d,1)[0],m=(0,o.useCallback)((function(e){e.forEach((function(e){var n=e.name,r=e.path,o=[t],l=r.split("/").filter((function(e){return e&&e!==n})).join("/");l&&o.push(l);var c=[],a=o.join("/");(null===a||void 0===a?void 0:a.length)>=1&&o.push(a),c.push(n);var d=c.join("/");f({dir_path:a,file:e,overwrite:!1}).then((function(e){var n=e.data,t=n.error,r=n.file;s((function(e){return v(v({},e),{},(0,i.Z)({},d,r||t))}))})),u((function(e){return v(v({},e),{},(0,i.Z)({},d,0))}))}))}),[f,t,u,s]);return(0,a.jsx)(p,{onDragActiveChange:c,setFiles:m,children:n})}},64155:function(e,n,t){"use strict";t.d(n,{Eh:function(){return u},ht:function(){return s},t0:function(){return a}});var i=t(9518),r=t(82386),o=t(1286),l=t(31012),c=t(49125),u=(c.iI,o.O$+3*c.iI+l.dN),a=i.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-15ofupc-0"})(["position:relative;width:fit-content;"," ",""],(function(e){return"\n height: calc(100vh - ".concat(r.uX,"px - ").concat(e.heightOffset,"px);\n ")}),(function(e){return e.fullWidth&&"\n width: calc(100% - ".concat(e.widthOffset||0,"px);\n ")})),s=i.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-15ofupc-1"})(["padding:","px;",""],2*c.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "}))},68735:function(e,n,t){"use strict";var i=t(26304),r=t(21831),o=t(82394),l=t(82684),c=t(26226),u=t(9518),a=t(90948),s=t(84969),d=t(65743),f=t(85587),p=t(79487),h=t(52136),m=t(67778),v=t(29989),g=t(17066),b=t(84482),x=t(76771),j=t(98889),y=t(65376),k=t(61655),Z=t(97745),_=t(48072),O=t(10103),C=t(84181),E=t(24903),S=t(67971),w=t(86673),P=t(19711),I=t(52359),T=t(23831),A=t(80906),R=t(73899),D=t(2005),M=t(31012),N=t(49125),L=t(24224),B=t(344),F=t(45739),U=t(28598),H=["areaBetweenLines","data","events","height","lineLegendNames","margin","width","xAxisLabel","xLabelFormat","yAxisLabel","yLabelFormat"];function z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function W(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?z(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var G=W(W({},y.j),{},{backgroundColor:T.Z.background.muted,border:"none"}),V=(0,k.Z)((function(e){var n=e.areaBetweenLines,t=e.data,i=e.events,o=void 0!==i&&i,c=e.getX,k=e.getY,S=e.gridProps,w=void 0===S?{}:S,I=e.height,H=e.hideGridX,z=e.hideTooltip,V=e.increasedXTicks,Q=e.lineLegendNames,q=e.margin,Y=e.noCurve,K=e.numYTicks,X=e.renderXTooltipContent,J=e.renderYTooltipContent,$=e.showTooltip,ee=e.thickStroke,ne=e.tooltipData,te=e.tooltipLeft,ie=void 0===te?0:te,re=e.tooltipTop,oe=void 0===re?[]:re,le=e.width,ce=e.xLabelFormat,ue=e.xLabelRotate,ae=void 0===ue||ue,se=e.yLabelFormat,de=(0,l.useContext)(u.ThemeContext),fe=c||function(e){return null===e||void 0===e?void 0:e.x},pe=k||function(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null===e||void 0===e||null===(n=e.y)||void 0===n?void 0:n[t]},he=T.Z.monotone.gray,me=T.Z.brand.wind200,ve=T.Z.content.muted,ge=T.Z.monotone.gray,be=t.map((function(e){return Number(fe(e))}));if(le<10)return null;var xe=le-q.left-q.right,je=I-q.top-q.bottom,ye=xe/2,ke=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return(null===n||void 0===n?void 0:n.length)||0})))),Ze=(0,l.useMemo)((function(){return(0,C.Z)({domain:[Math.min.apply(Math,(0,r.Z)(be)),Math.max.apply(Math,(0,r.Z)(be))],range:[0,xe]})}),[xe,be]),_e=Math.min.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.min.apply(Math,(0,r.Z)(n||[]))})))),Oe=Math.max.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.max.apply(Math,(0,r.Z)(n||[]))})))),Ce=(0,l.useMemo)((function(){return(0,C.Z)({domain:[_e,Oe],nice:!0,range:[je,0]})}),[je,Oe,_e]),Ee=le>520?V?20:10:V?10:5,Se=(0,F.K)(de),we=ve,Pe=Se.map((function(e){return{stroke:e}})),Ie=(0,E.Z)({domain:Q||[],range:Pe.map((function(e){return e.stroke}))}),Te=(0,l.useCallback)((function(e){var n=((0,_.Z)(e)||{x:0}).x,i=Ze.invert(n-q.left),r=(0,L.ry)(be,(function(e){return i>=e})),o=t[r-1],l=t[r],c=o;l&&(i-fe(o)>fe(l)-i?c=l:(c=o,r-=1));var u=(0,O.range)(0,ke).map((function(e){return Ce(pe(c,e))}));pe(c)&&$({tooltipData:W(W({},c),{},{index:r}),tooltipLeft:n,tooltipTop:u})}),[t,fe,pe,q,$,Ze,Ce]),Ae={};return Y||(Ae.curve=Z.ZP),(0,U.jsxs)(U.Fragment,{children:[Q&&(0,U.jsx)("div",{style:{marginLeft:null===q||void 0===q?void 0:q.left},children:(0,U.jsx)(g.Z,{labelFormat:function(e){return e},scale:Ie,children:function(e){return(0,U.jsx)("div",{style:{display:"flex",flexDirection:A.qs.ROW},children:e.map((function(e,n){return(0,U.jsxs)(b.Z,{margin:"0 5px",onClick:function(){o&&alert("clicked: ".concat(JSON.stringify(e)))},children:[(0,U.jsx)("svg",{height:15,width:15,children:(0,U.jsx)("rect",{fill:e.value,height:15,width:15})}),(0,U.jsx)(x.Z,{align:"left",margin:"0 0 0 4px",children:(0,U.jsx)(P.ZP,{small:!0,children:e.text})})]},"legend-quantile-".concat(n))}))})}})}),(0,U.jsxs)("svg",{height:I,width:le,children:[!n&&(0,U.jsx)(d.Z,{fill:"transparent",height:I,onMouseLeave:function(){return z()},onMouseMove:Te,onTouchMove:Te,onTouchStart:Te,rx:14,width:le-(q.left+q.right),x:q.left,y:0}),(0,U.jsxs)(v.Z,{left:q.left,top:q.top,children:[!H&&(0,U.jsx)(h.Z,W({height:je,pointerEvents:"none",scale:Ze,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},w)),(0,U.jsx)(m.Z,W({height:je,pointerEvents:"none",scale:Ce,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},w)),(0,U.jsx)("line",{stroke:he,x1:xe,x2:xe,y1:0,y2:je}),(0,U.jsx)(a.Z,{numTicks:Ee,scale:Ze,stroke:we,tickFormat:function(e){return ce?ce(e):e},tickLabelProps:function(e){return{fill:ve,fontFamily:D.ry,fontSize:M.J5,textAnchor:"middle",transform:ae&&"rotate(-45, ".concat(Ze(e),", 0) translate(-32, 4)")}},tickStroke:we,top:je}),(0,U.jsx)(s.Z,{hideTicks:!0,numTicks:K,scale:Ce,stroke:we,tickFormat:function(e){return se?se(e):(0,B.P5)(e)},tickLabelProps:function(e){return{dx:String(e).length>4?3:0,fill:ve,fontFamily:D.ry,fontSize:M.J5,textAnchor:"end",transform:"translate(0,2.5)"}},tickStroke:we}),n&&n.map((function(e){var n=e[0],i=e[1];return(0,l.createElement)(j.Z,W(W({},Ae),{},{aboveAreaProps:{fill:T.Z.brand.earth400,fillOpacity:.3},belowAreaProps:{fill:me,fillOpacity:.2},clipAboveTo:0,clipBelowTo:je,data:t,id:"".concat(Math.random()),key:"".concat(n,"-").concat(i),x:function(e){return Ze(fe(e))},y0:function(e){return Ce("undefined"===typeof i?_e:pe(e,i))},y1:function(e){return Ce(pe(e,n))}}))})),(0,O.range)(0,ke).map((function(e){return(0,l.createElement)(f.Z,W(W({},Ae),{},{data:t.filter((function(e){return void 0!=e.y})),key:e,pointerEvents:"none",strokeWidth:ee?2:1,x:function(e){return Ze(fe(e))},y:function(n){return Ce(n.y&&(e>=n.y.length?_e:pe(n,e)))}},Pe[e]))}))]}),ne&&(0,U.jsxs)("g",{children:[(0,U.jsx)(p.Z,{from:{x:ie,y:q.top},pointerEvents:"none",stroke:R.Ej,strokeDasharray:"5,2",strokeWidth:1,to:{x:ie,y:je+q.top}}),oe.map((function(e,n){return(0,U.jsx)("circle",{cx:ie,cy:e+1+q.top,fill:Pe[n].stroke,fillOpacity:.1,pointerEvents:"none",r:4,stroke:ge,strokeOpacity:.1,strokeWidth:1},n)})),oe.map((function(e,n){return(0,U.jsx)("circle",{cx:ie,cy:e+q.top,fill:Pe[n].stroke,pointerEvents:"none",r:4,stroke:Pe[n].stroke,strokeWidth:2},n)}))]})]}),ne&&(0,U.jsxs)("div",{children:[oe.map((function(e,n){var t=pe(ne,n);return n>=1&&Math.abs(oe[n-1]-e)<5*N.iI&&(e+=3*N.iI),(0,U.jsxs)(y.Z,{left:ie>ye?ie-(0,B.Vs)(J,ne,n)*N.iI:ie+N.iI,style:G,top:e-2*N.iI,children:[J&&J(ne,n),!J&&(0,U.jsxs)(P.ZP,{center:!0,small:!0,children:[t.toFixed?t.toFixed(3):t," ",null===Q||void 0===Q?void 0:Q[n]]})]},n)})),(0,U.jsxs)(y.Z,{left:ie>ye?ie-4*(0,B.Vs)(X,ne):ie,style:W(W({},G),{},{transform:"translateX(-65%)"}),top:je+q.top,children:[X&&X(ne),!X&&(0,U.jsx)(P.ZP,{center:!0,small:!0,children:fe(ne).toFixed(3)})]})]})]})}));n.Z=function(e){var n=e.areaBetweenLines,t=e.data,r=(e.events,e.height),o=e.lineLegendNames,l=e.margin,u=void 0===l?{}:l,a=e.width,s=e.xAxisLabel,d=e.xLabelFormat,f=e.yAxisLabel,p=e.yLabelFormat,h=(0,i.Z)(e,H),m=W(W({},{bottom:3*N.iI,left:5*N.iI,right:3*N.iI,top:3*N.iI}),u);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{style:{display:"flex",height:r,marginBottom:N.iI,width:"100%"},children:[f&&(0,U.jsx)(S.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,U.jsx)(I.Z,{children:(0,U.jsx)(P.ZP,{center:!0,muted:!0,small:!0,children:f})})}),(0,U.jsx)(w.Z,{mr:1}),(0,U.jsx)("div",{style:{height:r,width:"undefined"===typeof a?"100%":a},children:(0,U.jsx)(c.Z,{children:function(e){var i=e.width,r=e.height;return(0,U.jsx)(V,W(W({},h),{},{areaBetweenLines:n,data:t,height:r,lineLegendNames:o,margin:m,width:i,xLabelFormat:d,yLabelFormat:p}))}})})]}),s&&(0,U.jsx)("div",{style:{paddingLeft:f?36:0,paddingTop:4},children:(0,U.jsx)(P.ZP,{center:!0,muted:!0,small:!0,children:s})})]})}},76096:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(33591)),l=t(28598),c=["children","fullHeight","gutter","style"];function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,u=e.style,s=void 0===u?{}:u,d=(0,r.Z)(e,c),f=a({},s);return i&&(f.paddingLeft=i,f.paddingRight=f.paddingLeft),t&&(f.height="100%"),(0,l.jsx)(o.Col,a(a({},d),{},{style:f,children:n}))}},97361:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=t(82684),l=t(33591),c=t(28598),u=["children","fullHeight","gutter","style"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.fullHeight,i=e.gutter,a=e.style,d=void 0===a?{}:a,f=(0,r.Z)(e,u),p=s({},d);return i&&(p.marginLeft=-1*i,p.marginRight=p.marginLeft),t&&(p.height="100%"),(0,c.jsx)(l.Row,s(s({},f),{},{style:p,children:o.Children.map(n,(function(e,n){return e&&o.cloneElement(e,{gutter:i,key:n})}))}))}},80906:function(e,n,t){"use strict";var i,r,o,l;t.d(n,{Q0:function(){return i},qs:function(){return r}}),function(e){e.ADD="add",e.AVERAGE="average",e.CLEAN_COLUMN_NAME="clean_column_name",e.COUNT="count",e.COUNT_DISTINCT="count_distinct",e.CUSTOM="custom",e.DIFF="diff",e.DROP_DUPLICATE="drop_duplicate",e.EXPAND_COLUMN="expand_column",e.EXPLODE="explode",e.FILTER="filter",e.FIRST="first",e.FIX_SYNTAX_ERRORS="fix_syntax_errors",e.GROUP="group",e.IMPUTE="impute",e.JOIN="join",e.LAST="last",e.LIMIT="limit",e.MAX="max",e.MEDIAN="median",e.MIN="min",e.MODE="mode",e.NORMALIZE="normalize",e.REFORMAT="reformat",e.REMOVE="remove",e.REMOVE_OUTLIERS="remove_outliers",e.SCALE="scale",e.SELECT="select",e.SHIFT_DOWN="shift_down",e.SHIFT_UP="shift_up",e.SORT="sort",e.STANDARDIZE="standardize",e.SUM="sum",e.UNION="union",e.UPDATE_TYPE="update_type",e.UPDATE_VALUE="update_value"}(i||(i={})),function(e){e.COLUMN="column",e.ROW="row"}(r||(r={})),function(e){e.NOT_APPLIED="not_applied",e.COMPLETED="completed"}(o||(o={})),function(e){e.FEATURE="feature"}(l||(l={}))},93348:function(e,n,t){"use strict";t.d(n,{TR:function(){return d},U5:function(){return u},Xm:function(){return o},Z4:function(){return s},fq:function(){return c},kJ:function(){return a}});var i,r,o,l=t(82394);!function(e){e.API="api",e.EVENT="event",e.TIME="time"}(o||(o={}));var c,u,a,s=(i={},(0,l.Z)(i,o.API,(function(){return"API"})),(0,l.Z)(i,o.EVENT,(function(){return"event"})),(0,l.Z)(i,o.TIME,(function(){return"schedule"})),i);!function(e){e.ACTIVE="active",e.INACTIVE="inactive"}(c||(c={})),function(e){e.ONCE="@once",e.HOURLY="@hourly",e.DAILY="@daily",e.WEEKLY="@weekly",e.MONTHLY="@monthly"}(u||(u={})),function(e){e.CREATED_AT="created_at",e.NAME="name",e.PIPELINE="pipeline_uuid",e.STATUS="status",e.TYPE="schedule_type"}(a||(a={}));var d=(r={},(0,l.Z)(r,a.CREATED_AT,"Created at"),(0,l.Z)(r,a.NAME,"Name"),(0,l.Z)(r,a.PIPELINE,"Pipeline"),(0,l.Z)(r,a.STATUS,"Status"),(0,l.Z)(r,a.TYPE,"Type"),r)},18283:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(9518)),l=t(23831),c=t(73942),u=t(2005),a=t(49125),s=t(31012),d=t(28598),f=["children"];function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var m=o.default.p.withConfig({displayName:"Badge__BadgeStyle",componentId:"sc-tfqsp0-0"})(["border-radius:","px;display:inline;font-family:",";margin:0;",";"," ",";",";"," "," "," "," ",""],c.BG,u.ry,s.iD,(function(e){return e.small&&"\n ".concat(s.HC,";\n ")}),(function(e){return!e.regular&&"\n padding: 2px 4px;\n "}),(function(e){return e.regular&&"\n padding: ".concat(1*a.iI,"px ").concat(1.25*a.iI,"px;\n ")}),(function(e){return e.noVerticalPadding&&"\n padding-bottom: 0;\n padding-top: 0;\n "}),(function(e){return!e.disabled&&"\n background-color: ".concat((e.theme||l.Z).background.row,";\n color: ").concat((e.theme||l.Z).content.muted,";\n ")}),(function(e){return e.cyan&&"\n background-color: ".concat((e.theme||l.Z).accent.cyan,";\n color: ").concat((e.theme||l.Z).monotone.black,";\n ")}),(function(e){return e.disabled&&"\n background-color: ".concat((e.theme||l.Z).feature.disabled,";\n color: ").concat((e.theme||l.Z).content.disabled,";\n ")}),(function(e){return e.quantifier&&"\n border-radius: 34px;\n line-height: 10px;\n padding: 4px 6px;\n "}));n.Z=function(e){var n=e.children,t=(0,r.Z)(e,f);return(0,d.jsx)(m,h(h({},t),{},{children:n}))}},30264:function(e,n,t){"use strict";var i=t(82394),r=t(26304),o=(t(82684),t(47999)),l=t(62084),c=t(28598),u=["children","items","open","onClickCallback","onClickOutside","parentRef","uuid"];function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.children,t=e.items,i=e.open,a=e.onClickCallback,d=e.onClickOutside,f=e.parentRef,p=e.uuid,h=(0,r.Z)(e,u),m=(0,c.jsxs)("div",{style:{position:"relative",zIndex:d?3:2},children:[(0,c.jsx)("div",{ref:f,children:n}),(0,c.jsx)(l.Z,s(s({},h),{},{items:t,onClickCallback:a,open:i,parentRef:f,uuid:p}))]});return d?(0,c.jsx)(o.Z,{onClickOutside:d,open:!0,children:m}):m}},29237:function(e,n,t){"use strict";var i=t(9518),r=t(67971),o=t(86673),l=t(19711),c=t(23831),u=t(73942),a=t(37391),s=t(49125),d=t(28598),f=(0,i.css)(["padding:","px;padding-bottom:","px;padding-top:","px;"],2*s.iI,1.5*s.iI,1.5*s.iI),p=i.default.div.withConfig({displayName:"Panel__PanelStyle",componentId:"sc-1ct8cgl-0"})(["border-radius:","px;overflow:hidden;"," "," "," "," "," "," "," "," "," ",""],u.n_,(function(e){return e.fullWidth&&"\n width: 100%;\n "}),(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return!e.dark&&"\n background-color: ".concat((e.theme.background||c.Z.background).panel,";\n ")}),(function(e){return e.dark&&"\n background-color: ".concat((e.theme.background||c.Z.background).content,";\n ")}),(function(e){return!e.fullHeight&&"\n height: fit-content;\n "}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,";\n ")}),(function(e){return e.maxWidth&&"\n max-width: ".concat(e.maxWidth,"px;\n ")}),(function(e){return e.minWidth&&"\n min-width: ".concat(e.minWidth,"px;\n\n @media (max-width: ").concat(e.minWidth,"px) {\n min-width: 0;\n }\n ")}),(function(e){return e.borderless&&"\n border: none;\n "}),(function(e){return e.overflowVisible&&"\n overflow: visible;\n "})),h=i.default.div.withConfig({displayName:"Panel__HeaderStyle",componentId:"sc-1ct8cgl-1"})(["border-top-left-radius:","px;border-top-right-radius:","px;"," "," "," ",""],u.n_,u.n_,(function(e){return"\n background-color: ".concat((e.theme.background||c.Z.background).chartBlock,";\n border-bottom: 1px solid ").concat((e.theme.interactive||c.Z.interactive).defaultBorder,";\n ")}),(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),f,(function(e){return e.headerPaddingVertical&&"\n padding-bottom: ".concat(e.headerPaddingVertical,"px;\n padding-top: ").concat(e.headerPaddingVertical,"px;\n ")})),m=i.default.div.withConfig({displayName:"Panel__ContentStyle",componentId:"sc-1ct8cgl-2"})(["overflow-y:auto;padding:","px;height:100%;"," "," "," "," ",""],1.75*s.iI,a.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return e.maxHeight&&"\n max-height: calc(".concat(e.maxHeight," - ").concat(15*s.iI,"px);\n ")}),(function(e){return e.noPadding&&"\n padding: 0;\n "}),(function(e){return e.overflowVisible&&"\n overflow: visible;\n "})),v=i.default.div.withConfig({displayName:"Panel__FooterStyle",componentId:"sc-1ct8cgl-3"})(["border-style:",";border-top-width:","px;padding:","px;"],u.M8,u.YF,1.75*s.iI);n.Z=function(e){var n=e.borderless,t=e.children,i=e.containerRef,c=e.contentContainerRef,u=e.dark,a=e.footer,s=e.fullHeight,f=void 0===s||s,g=e.fullWidth,b=void 0===g||g,x=e.header,j=e.headerHeight,y=e.headerIcon,k=e.headerPaddingVertical,Z=e.headerTitle,_=e.maxHeight,O=e.maxWidth,C=e.minWidth,E=e.noPadding,S=e.overflowVisible,w=e.subtitle;return(0,d.jsxs)(p,{borderless:n,dark:u,fullHeight:f,fullWidth:b,maxHeight:_,maxWidth:O,minWidth:C,overflowVisible:S,ref:i,children:[(x||Z)&&(0,d.jsxs)(h,{headerPaddingVertical:k,height:j,children:[x&&x,Z&&(0,d.jsx)(r.Z,{alignItems:"center",justifyContent:"space-between",children:(0,d.jsxs)(r.Z,{alignItems:"center",children:[y&&y,(0,d.jsx)(o.Z,{ml:y?1:0,children:(0,d.jsx)(l.ZP,{bold:!0,default:!0,children:Z})})]})})]}),(0,d.jsxs)(m,{maxHeight:_,noPadding:E,overflowVisible:S,ref:c,children:[w&&(0,d.jsx)(o.Z,{mb:2,children:(0,d.jsx)(l.ZP,{default:!0,children:w})}),t]}),a&&(0,d.jsx)(v,{children:a})]})}},946:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Xc}});var i=t(77837),r=t(21831),o=t(82394),l=t(75582),c=t(38860),u=t.n(c),a=t(56085),s=t(82684),d=t(83455),f=t(34376),p=(0,t(44152).r)({apiReloads:{}}).useGlobalState;var h=function(e){var n=e.children,t=e.uuid,i=e.uuids,o=void 0===i?[]:i,c=p("apiReloads"),u=(0,l.Z)(c,1)[0],a=(0,r.Z)(o);t&&a.push(t);var d=a.map((function(e){return String(u[e])||"-"})).join("_");return s.cloneElement(n,{key:d})},m=t(35490),v=t(86422),g=t(60328),b=t(38341),x=t(67971),j=t(11135),y=t(29237),k=t(98781),Z=t(86673),_=t(19711),O=t(82944),C=t(16115),E=t(11366),S=t(91427),w=t(51504),P=t(28598);var I,T,A,R,D=function(e){var n=e.block,t=e.defaultName,i=e.onClose,r=e.onSave,o=e.pipeline,l=(0,s.useRef)(null),c=(0,s.useState)(t),u=c[0],a=c[1],d=(0,s.useState)(!!(0,S.U2)(E.k)),f=d[0],p=d[1];(0,s.useEffect)((function(){var e;null===l||void 0===l||null===(e=l.current)||void 0===e||e.focus()}),[]);var h=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===o||void 0===o?void 0:o.type)}),[o]),m=(0,s.useMemo)((function(){var e=null===n||void 0===n?void 0:n.type;if(h){if(v.tf.DATA_LOADER===e)return"Source";if(v.tf.DATA_EXPORTER===e)return"Destination"}return v.V4[e]}),[n,h]);return(0,P.jsxs)(y.Z,{children:[(0,P.jsxs)(_.ZP,{bold:!0,children:[m," block name"]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(O.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(b.Z,{checked:f,label:(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,P.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,S.t8)(E.k,!f)}})})}),(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(j.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,w.y)([C.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},M=t(26304),N=t(9518),L=t(62084),B=t(16634);!function(e){e.JSON="json",e.PY="py",e.R="r",e.SQL="sql",e.TXT="txt",e.YAML="yaml",e.YML="yml"}(A||(A={})),function(e){e.INIT_PY="__init__.py",e.METADATA_YAML="metadata.yaml",e.REQS_TXT="requirements.txt"}(R||(R={}));var F,U,H=[A.PY,A.SQL],z=[A.JSON,A.PY,A.R,A.SQL,A.TXT,A.YAML,A.YML],W=new RegExp(z.map((function(e){return".".concat(e,"$")})).join("|")),G=z.concat(A.PY),V=new RegExp(G.map((function(e){return".".concat(e,"$")})).join("|")),Q="charts",q="pipelines",Y=(I={},(0,o.Z)(I,A.JSON,A.JSON),(0,o.Z)(I,A.PY,v.t6.PYTHON),(0,o.Z)(I,A.R,v.t6.R),(0,o.Z)(I,A.SQL,v.t6.SQL),(0,o.Z)(I,A.TXT,"text"),(0,o.Z)(I,A.YAML,v.t6.YAML),(0,o.Z)(I,A.YML,v.t6.YAML),I),K=(T={},(0,o.Z)(T,v.t6.PYTHON,A.PY),(0,o.Z)(T,v.t6.R,A.R),(0,o.Z)(T,v.t6.SQL,A.SQL),(0,o.Z)(T,v.t6.YAML,A.YAML),(0,o.Z)(T,"text",A.TXT),T),X=t(10503),J=t(43032),$=t(49125),ee=t(24224),ne="sideview";!function(e){e.CHARTS="charts",e.DATA="data",e.EXTENSIONS="power_ups",e.FILE_VERSIONS="file_versions",e.GRAPHS="graphs",e.REPORTS="reports",e.SECRETS="secrets",e.TERMINAL="terminal",e.TREE="tree",e.VARIABLES="variables"}(U||(U={}));var te=[U.CHARTS,U.DATA,U.EXTENSIONS,U.REPORTS,U.TREE],ie=[U.DATA,U.REPORTS,U.GRAPHS],re=[{key:U.TREE,label:"Tree"},{key:U.CHARTS,label:"Charts"},{key:U.VARIABLES,label:"Variables"},{key:U.SECRETS,label:"Secrets"},{key:U.EXTENSIONS,label:"Power ups"},{key:U.DATA,label:"Data"},{key:U.TERMINAL,label:"Terminal"}],oe=(0,ee.HK)(re,(function(e){return e.key})),le=(F={},(0,o.Z)(F,U.CHARTS,X.er),(0,o.Z)(F,U.DATA,X.t1),(0,o.Z)(F,U.EXTENSIONS,X.Bf),(0,o.Z)(F,U.GRAPHS,X.er),(0,o.Z)(F,U.REPORTS,X.Do),(0,o.Z)(F,U.SECRETS,X.EK),(0,o.Z)(F,U.TERMINAL,X.oI),(0,o.Z)(F,U.TREE,X.BJ),(0,o.Z)(F,U.VARIABLES,X.KJ),F),ce=t(44162),ue=t(90211);function ae(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=n||(t?null:null===e||void 0===e?void 0:e.name);if(null!==e&&void 0!==e&&e.parent){var r=[e.parent.name];return(null===i||void 0===i?void 0:i.length)>=1&&r.push(i),ae(e.parent,r.join("/"))}return i}function se(e){return null===e||void 0===e?void 0:e.split("/").slice(1).join("/")}function de(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=ae(e,n,t);return se(i)}function fe(e){var n,t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=ae(e,i).split("/");if(!r)return null;if(1===r.length)(r=null===e||void 0===e||null===(t=e.path)||void 0===t?void 0:t.split("/"))&&(n=r[0]===v.tf.CUSTOM?r[0]:(0,ue.C5)(r[0]||""));else if(r[1]===v.tf.CUSTOM)n=r[1];else{var o=r[1];n=v.tf.DBT===o?o:(0,ue.C5)(o||"")}if(!r)return null;var l="";l=r.length>=3?r.slice(2,r.length).join("/"):r[r.length-1];var c=["\\.".concat(A.PY),"\\.".concat(A.R),"\\.".concat(A.SQL),"\\.".concat(A.YAML),"\\.".concat(A.YML)].join("|"),u=new RegExp("".concat(c,"$"));if(v.$W.concat(v.tf.DBT).includes(n)&&l.match(u)){var a=l.split("."),s=a[1];return{language:Y[s],type:n,uuid:a[0]}}}function pe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=ae(e,n).split("/");if(t[1]){var i=(0,ue.C5)(t[n?0:1]);t[1]===v.tf.DBT&&(i=v.tf.DBT);var r=t[t.length-1],o=new RegExp(".".concat(A.YAML,"$")),l=new RegExp(".".concat(A.R,"$")),c=new RegExp(".".concat(A.SQL,"$"));if(r.match(o)&&v.VZ.includes(i))return{type:i,uuid:r.replace(o,"")};if(r.match(l)&&v.J8.includes(i))return{type:i,uuid:r.replace(l,"")};if(r.match(c)&&v.HX.includes(i)){var u=r.replace(/[.]/g,"_"),a=i===v.tf.DBT?t.slice(2,-1).join("_").concat("_".concat(u)):r.replace(c,"");return{type:i,uuid:a}}}}function he(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function me(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?he(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):he(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ve="default_repo";var ge=function e(n){var t=n.allowSelectingFolders,i=n.containerRef,r=n.disableContextMenu,o=n.file,l=n.isFileDisabled,c=n.level,u=n.onSelectBlockFile,a=n.onlyShowChildren,d=n.openFile,f=n.openPipeline,p=n.openSidekickView,h=n.pipelineBlockUuids,m=n.selectFile,g=n.setContextItem,b=n.setCoordinates,x=n.setDraggingFile,j=n.setSelectedFile,y=n.theme,k=n.timeout,Z=n.uncollapsed,O=n.useRootFolder,C=o.children,E=o.disabled,w=o.name,I=o.parent;w||(o.name=ve);var T,A=O?ae(o):de(o),R=(null===I||void 0===I?void 0:I.name)===q,D=(0,s.useMemo)((function(){return C?(0,ee.YC)(C,(function(e){return e.children?0:1})):C}),[C]),M=l?l(A,D):E||"__init__.py"===w||!(null===w||void 0===w||!w.match(/^\./))||!w.match(V)&&!C,N="".concat(c,"/").concat(w),L=(h.includes(function(e){var n=e.name.split("."),t=n[n.length-1];return H.includes(t)&&n.pop(),n.join("")}(o)),(0,s.useState)("undefined"===typeof Z?(0,S.U2)(N,!1):!Z)),F=L[0],z=L[1],G=X.iU;1===c&&w===q?G=X.B_:w===Q?G=X.er:D&&(G=X.gt),D&&v.$W.includes((0,ue.C5)(w))&&(0,ue.C5)(w)!==v.tf.CHART&&(T=(0,ce.qn)((0,ue.C5)(w),{theme:y}).accent);var Y=(0,s.useMemo)((function(){return null===D||void 0===D?void 0:D.map((function(n){return(0,P.jsx)(e,{allowSelectingFolders:t,containerRef:i,disableContextMenu:r,file:me(me({},n),{},{parent:o}),isFileDisabled:l,level:a?c:c+1,onSelectBlockFile:u,openFile:d,openPipeline:f,openSidekickView:p,pipelineBlockUuids:h,selectFile:m,setContextItem:g,setCoordinates:b,setDraggingFile:x,setSelectedFile:j,theme:y,timeout:k,uncollapsed:Z,useRootFolder:O},"".concat(N,"/").concat((null===n||void 0===n?void 0:n.name)||ve))}))}),[t,i,D,r,o,l,c,u,a,d,f,p,h,m,g,y,k,Z,O,N]);return(0,P.jsxs)(P.Fragment,{children:[!a&&(0,P.jsxs)("div",{className:"row",onClick:function(e){if(e.preventDefault(),!M){if((null===I||void 0===I?void 0:I.name)===Q){null===p||void 0===p||p(U.CHARTS);var n=fe(o);n&&(null===u||void 0===u||u(n.uuid,n.type,de(o)))}var i=pe(o);if(D)t?m(A):z((function(e){return(0,S.t8)(N,!e),!e}));else if(i)null===u||void 0===u||u(i.uuid,i.type,de(o));else if(w.match(W))d(A);else{var r=fe(o);r&&(null===u||void 0===u||u(r.uuid,r.type,de(o)))}}},onContextMenu:function(e){var n;clearTimeout(k.current),null!==i&&void 0!==i&&null!==(n=i.current)&&void 0!==n&&n.contains(e.target)&&!r&&(e.preventDefault(),b({x:e.pageX,y:e.pageY}),x(null),j(o))},onMouseDown:function(e){var n,t=o?fe(o):null;null===i||void 0===i||null===(n=i.current)||void 0===n||!n.contains(e.target)||!t||(null===D||void 0===D?void 0:D.length)>=1||r||M||R||(e.preventDefault(),clearTimeout(k.current),k.current=setTimeout((function(){b({x:e.pageX,y:e.pageY}),x(o),j(null)}),300))},style:{alignItems:"center",cursor:"default",display:"flex",minWidth:c*J.Cl+o.name.length*$.Fo+2*$.iI,paddingBottom:$.iI/4,paddingLeft:$.iI/4+J.Cl*c,paddingRight:$.iI/4,paddingTop:$.iI/4},children:[D&&!F&&(0,P.jsx)(X._M,{muted:!0,size:J.ZG}),D&&F&&(0,P.jsx)(X._Q,{muted:!0,size:J.ZG}),!D&&(0,P.jsx)("div",{style:{width:J.ZG}}),(0,P.jsxs)("div",{style:{marginLeft:$.iI/2,marginRight:$.iI/2},children:[!T&&(0,P.jsx)(G,{disabled:M,size:J.ZG}),T&&(0,P.jsx)(B.Z,{color:T,size:J.ZG,square:!0})]}),(0,P.jsx)(_.ZP,{color:T,default:!T&&!M,disabled:M,monospace:!0,small:!0,children:w})]}),(0,P.jsx)("div",{style:{display:F?"none":"block"},children:Y})]})},be=t(82531),xe=t(7715),je=t(96510);var ye=function(e){var n=e.fetchFileTree,t=e.file,i=e.onCancel,r=e.selectedFolder,o=e.setErrors,c=(0,s.useRef)(null),u=(0,xe.Qr)(t)?null:t,a=(0,s.useState)(u?de(u,null,!0):""),f=a[0],p=a[1],h=(0,s.useState)(u?null===u||void 0===u?void 0:u.name:""),m=h[0],v=h[1];(0,s.useEffect)((function(){var e;null===c||void 0===c||null===(e=c.current)||void 0===e||e.focus()}),[]),(0,s.useEffect)((function(){r&&p(de(r))}),[r]);var b=(0,d.Db)(be.ZP.files.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),k=(0,l.Z)(b,1)[0],_=(0,d.Db)(be.ZP.files.useUpdate(u&&encodeURIComponent(de(u))),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),E=(0,l.Z)(_,1)[0];return(0,P.jsxs)(y.Z,{footer:(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(j.ZP,{bold:!0,disabled:!m,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,w.y)([C.Uq],n)},onClick:function(){return u?E({file:{dir_path:f,name:m},file_json_only:!0}):k({file:{dir_path:f,name:m,overwrite:!1},file_json_only:!0})},primary:!0,tabIndex:0,uuid:"NewFile/create_file",children:[u?"Rename":"Create"," file"]}),(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:function(){return i()},tabIndex:0,children:"Cancel"})})]}),headerTitle:u?"Rename file":"New file",children:[(0,P.jsx)(O.Z,{disabled:!!u,label:"Directory",monospace:!0,onChange:function(e){return p(e.target.value)},setContentOnMount:!0,value:f}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(O.Z,{label:"Filename",monospace:!0,onChange:function(e){return v(e.target.value)},ref:c,required:!0,value:m})})]})},ke=t(55106),Ze=t(66176),_e=t(58180),Oe=t(23831),Ce=t(73942),Ee=($.iI,N.default.div.withConfig({displayName:"indexstyle__DropZoneStyle",componentId:"sc-1g3zz7z-0"})(["border-radius:","px;padding:","px;max-width:","px;min-width:","px;",""],Ce.n_,8*$.iI,100*$.iI,55*$.iI,(function(e){return"\n border: 1px dashed ".concat((e.theme.borders||Oe.Z.borders).contrast,";\n ")}))),Se=N.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-1g3zz7z-1"})(["max-width:","px;min-width:","px;"],100*$.iI,55*$.iI);var we=function(e){var n=e.fetchFileTree,t=e.onCancel,i=e.selectedFolder,r=(0,s.useState)(!1),o=r[0],c=r[1],u=(0,s.useState)({}),a=u[0],d=u[1],f=(0,s.useState)({}),p=f[0],h=f[1],m=!(0,xe.Qr)(a),v=(0,s.useMemo)((function(){var e=[];return(0,ee.YC)(Object.entries(a),(function(e){var n=(0,l.Z)(e,2),t=n[0];n[1];return t})).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],r=t[1],o=p[i],c=null===o||void 0===o?void 0:o.message;e.push([(0,P.jsxs)("div",{children:[(0,P.jsx)(_.ZP,{overflowWrap:!0,preWrap:!0,children:i}),c&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(_.ZP,{danger:!0,small:!0,children:c})})]},"name-".concat(i)),(0,P.jsx)(Ze.Z,{danger:!!c,progress:100*r},"progress-".concat(i))])})),(0,P.jsx)(_e.Z,{columnFlex:[1,4],columns:[{uuid:"Filename"},{uuid:"Upload progress"}],rows:e,uuid:"block-runs"})}),[a,p]);return(0,P.jsxs)(y.Z,{footer:(0,P.jsxs)(x.Z,{fullWidth:!0,children:[(0,P.jsx)(g.Z,{onClick:function(){return t()},children:"Close"}),m&&(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(g.Z,{onClick:function(){d({}),h({})},children:"Clear files and retry"})})]}),headerTitle:"Upload files",children:[m&&(0,P.jsx)(Se,{children:v}),!m&&(0,P.jsx)(ke.Z,{directoryPath:i?de(i):"",onDragActiveChange:c,setFileUploadProgress:d,setUploadedFiles:function(e){h(e),null===n||void 0===n||n()},children:(0,P.jsx)(Ee,{children:(0,P.jsxs)(_.ZP,{center:!0,children:[o&&"Drop to upload",!o&&"Click or drop files and folders to upload"]})})})]})},Pe=t(86585),Ie=function(e){var n=e[0];return n===v.tf.DBT||n===v.tf.CUSTOM?n:e[0].slice(0,-1)};function Te(){return new RegExp(Object.keys(Y).map((function(e){return".(".concat(e,")$")})).join("|"))}function Ae(e,n,t){var i,o,l=null===e||void 0===e||null===(i=e.path.match(Te())[0])||void 0===i?void 0:i.split(".")[1],c=t.type===k.qL.INTEGRATION,u=(0,ee.sE)(null===t||void 0===t?void 0:t.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),a=e.path.replace(n,"").split("/"),s=e.path.split("/")[0]===v.tf.DBT,d=(o=a)[0]===v.tf.DBT?o.slice(1).join("/"):function(e){return e.at(-1)}(o).split(".")[0];if(a.length>=3&&!s){var f=a.slice(1,a.length-1).join("/");d="".concat(f,"/").concat(d)}var p=Ie(e.path.split("/")),h={configuration:{file_path:s?d:null},language:Y[l],name:(0,ue.wE)(d),type:p};if(p===v.tf.CUSTOM&&(h.color=v.Lq.TEAL),c){var m=(0,ee.sE)(t.blocks,(function(e){var n=e.type;return v.tf.DATA_LOADER===n})),g=(0,ee.sE)(t.blocks,(function(e){var n=e.type;return v.tf.TRANSFORMER===n})),b=[];g?b.push(g.uuid):null!==u&&void 0!==u&&u.upstream_blocks?b.push.apply(b,(0,r.Z)(u.upstream_blocks)):m&&b.push(m.uuid),h.upstream_blocks=b}return h}var Re=t(83608),De=["addNewBlock","blocks","deleteBlockFile","deleteWidget","fetchFileTree","fetchPipeline","files","pipeline","setErrors","setSelectedBlock","widgets"];function Me(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ne(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Me(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Me(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Le,Be=20*$.iI;function Fe(e,n){var t=e.addNewBlock,i=e.blocks,r=void 0===i?[]:i,o=e.deleteBlockFile,c=e.deleteWidget,u=e.fetchFileTree,a=e.fetchPipeline,f=e.files,p=e.pipeline,h=e.setErrors,m=e.setSelectedBlock,g=e.widgets,b=void 0===g?[]:g,x=(0,M.Z)(e,De),j=(0,s.useRef)(null),y=(0,s.useContext)(N.ThemeContext),Z=(0,s.useState)(null),O=Z[0],C=Z[1],E=(0,s.useState)(null),S=E[0],w=E[1],I=(0,s.useState)(null),T=I[0],A=I[1],R=be.ZP.status.list().data,D=(0,s.useMemo)((function(){var e;return null===R||void 0===R||null===(e=R.status)||void 0===e?void 0:e.repo_path}),[R]),B=(0,d.Db)((function(e){return be.ZP.files.useDelete(e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===u||void 0===u||u()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),F=(0,l.Z)(B,1)[0],U=(0,ee.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),H=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid,null===U||void 0===U?void 0:U.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),z=(0,l.Z)(H,1)[0],W=(0,s.useCallback)((function(){return A(null)}),[A]);(0,s.useEffect)((function(){var e,i,r,o=function(e){if(clearTimeout(j.current),w(null),S&&p&&t){var i,r,o=(null===n||void 0===n||null===(i=n.current)||void 0===i||null===(r=i.getBoundingClientRect)||void 0===r?void 0:r.call(i))||{},l=o.width,c=o.x;if(e.pageX>c+l){var u=(null===p||void 0===p?void 0:p.type)===k.qL.INTEGRATION,a=Ae(Ne(Ne({},S),{},{path:de(S)}),D,p);null===t||void 0===t||t(a,(function(e){u&&U&&z({block:Ne(Ne({},U),{},{upstream_blocks:[e.uuid]})}),null===m||void 0===m||m(e)}))}}},l=function(e){S&&C({x:e.pageX,y:e.pageY})};return null===(e=document)||void 0===e||e.addEventListener("click",W),null===(i=document)||void 0===i||i.addEventListener("mousemove",l),null===(r=document)||void 0===r||r.addEventListener("mouseup",o),function(){var e,n,t;null===(e=document)||void 0===e||e.removeEventListener("click",W),null===(n=document)||void 0===n||n.removeEventListener("mousemove",l),null===(t=document)||void 0===t||t.removeEventListener("mouseup",o)}}),[t,U,S,W,p,n,D,m,j,z]);var G=(0,s.useMemo)((function(){return r.concat(b).map((function(e){return e.uuid}))}),[r,b]),V=(0,s.useMemo)((function(){return null===f||void 0===f?void 0:f.map((function(e){return(0,s.createElement)(ge,Ne(Ne({},x),{},{containerRef:n,file:e,key:e.name,level:0,pipelineBlockUuids:G,setCoordinates:C,setDraggingFile:w,setSelectedFile:A,theme:y,timeout:j}))}))}),[f,G,x,n,y,j]),Q=(0,s.useMemo)((function(){return T&&fe(T)}),[T]),q=(0,s.useMemo)((function(){return S&&fe(S)}),[S]),Y=(0,s.useMemo)((function(){return T&&"undefined"!==typeof(null===T||void 0===T?void 0:T.children)&&T}),[T]),K=(0,Re.dd)((function(){return(0,P.jsx)(we,{fetchFileTree:u,onCancel:te,selectedFolder:Y})}),{},[u,Y],{background:!0,uuid:"upload_files"}),X=(0,l.Z)(K,2),ne=X[0],te=X[1],ie=(0,Re.dd)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,P.jsx)(ye,{fetchFileTree:u,file:e,onCancel:le,selectedFolder:Y,setErrors:h})}),{},[u,Y,h],{background:!0,disableClickOutside:!0,uuid:"new_file"}),re=(0,l.Z)(ie,2),oe=re[0],le=re[1],ce=(0,s.useMemo)((function(){var e;if(!Q&&!T&&!Y)return(0,P.jsx)("div",{});var t=(null===n||void 0===n||null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect())||{},i=t.x,r=t.width,l=O||{},u=l.x,a=void 0===u?0:u,s=l.y,d=void 0===s?0:s,f=a;a+Be>=i+r&&(f=i+r-(Be+$.iI)),f<0&&(f=0);var p=[];return Y?p.push.apply(p,[{label:function(){return"Upload files"},onClick:function(){ne()},uuid:"upload_files"},{label:function(){return"New file"},onClick:function(){oe({})},uuid:"new_file"}]):Q?p.push({label:function(){return"Delete block file"},onClick:function(){Q.type===v.tf.CHART?window.confirm("Are you sure you want to delete widget ".concat(Q.uuid,"?"))&&c(Q):window.confirm("Are you sure you want to delete block ".concat(Q.uuid,"?"))&&o(Q)},uuid:"delete_block_file"}):T&&p.push.apply(p,[{label:function(){return"Rename file"},onClick:function(){oe(T)},uuid:"rename_file"},{label:function(){return"Delete file"},onClick:function(){var e=de(T);window.confirm("Are you sure you want to delete file ".concat(e,"?"))&&F(encodeURIComponent(e))},uuid:"delete_file"}]),(0,P.jsx)("div",{style:{left:f,position:"fixed",top:d+$.iI/2,zIndex:Pe.bf+100},children:(0,P.jsx)(L.Z,{items:p,open:!0,parentRef:void 0,uuid:"FileBrowser/ContextMenu",width:Be})})}),[O,o,F,c,n,ne,oe,Q,T,Y]);return(0,P.jsxs)(J.Nk,{ref:n,children:[V,(Q||T||Y)&&ce,q&&(0,P.jsx)("div",{style:{left:(null===O||void 0===O?void 0:O.x)-$.iI,position:"fixed",top:(null===O||void 0===O?void 0:O.y)-$.iI,zIndex:Pe.bf+100},children:(0,P.jsx)(_.ZP,{cursor:"grabbing",monospace:!0,children:null===q||void 0===q?void 0:q.uuid})})]})}!function(e){e.BLOCK_FILE="block_file",e.DISABLED="disabled",e.FILE="file",e.FOLDER="folder",e.PIPELINE="pipeline"}(Le||(Le={}));var Ue=s.forwardRef(Fe),He=t(93461),ze=N.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),We=N.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),Ge=function(e){var n=e.children,t=e.divider,i=s.Children.toArray(n).length;return(0,P.jsx)(ze,{children:(0,P.jsx)(x.Z,{children:s.Children.map(n,(function(e,n){return e&&(0,P.jsxs)(He.Z,{children:[n>=1&&t&&(0,P.jsx)(We,{}),s.cloneElement(e,{borderRadiusLeft:i>=2&&0===n,borderRadiusRight:i>=2&&n===i-1,halfPaddingLeft:i>=2&&0!==n,halfPaddingRight:i>=2&&n!==i-1,noBorder:i>=2&&n>0&&n<i-1,noBorderRight:i>=2&&n!==i-1})]},"button-group-child-".concat(n))}))})})},Ve=t(57722),Qe=t(41150);function qe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ye(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?qe(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ke,Xe=function(e){var n,t=e.active,i=e.addNewBlock,r=e.fetchPipeline,c=e.fetchVariables,u=e.filePath,a=e.openSidekickView,f=e.pipeline,h=e.selectedFilePath,m=e.sendTerminalMessage,b=e.setErrors,y=e.setFilesTouched,_=e.setSelectedBlock,O=p("apiReloads"),E=(0,l.Z)(O,2)[1],S=(0,s.useState)(null),I=S[0],T=S[1],D=(0,s.useState)(!1),M=D[0],N=(D[1],(0,s.useRef)(null)),L=be.ZP.status.list().data,B=null===L||void 0===L||null===(n=L.status)||void 0===n?void 0:n.repo_path,F=be.ZP.file_contents.detail(u).data;(0,s.useEffect)((function(){null!==F&&void 0!==F&&F.file_content&&T(F.file_content)}),[F]);var H=(0,s.useState)(null===I||void 0===I?void 0:I.content),z=H[0],W=H[1],G=(0,s.useState)(!1),V=G[0],Q=G[1];(0,s.useEffect)((function(){var e;h&&(null===N||void 0===N||null===(e=N.current)||void 0===e||e.scrollIntoView())}),[h]);var q=(0,d.Db)(be.ZP.file_contents.useUpdate((null===I||void 0===I?void 0:I.path)&&encodeURIComponent(null===I||void 0===I?void 0:I.path)),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){E((function(e){return Ye(Ye({},e),{},(0,o.Z)({},"FileVersions/".concat(null===I||void 0===I?void 0:I.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===b||void 0===b?void 0:b({errors:n,response:e})}})}}),K=(0,l.Z)(q,1)[0],X=(0,s.useCallback)((function(e,n){K({file_content:Ye(Ye({},n),{},{content:e})}).then((function(){decodeURIComponent(u).split("/").pop()===R.METADATA_YAML&&c()})),y((function(e){return Ye(Ye({},e),{},(0,o.Z)({},null===n||void 0===n?void 0:n.path,!1))})),Q(!1)}),[c,u,y,K]),J=(0,s.useMemo)((function(){return Te()}),[]),$=(0,s.useMemo)((function(){var e;return null===I||void 0===I||null===(e=I.path.match(J)[0])||void 0===e?void 0:e.split(".")[1]}),[J,I]),ne=(0,s.useMemo)((function(){if(null!==I&&void 0!==I&&I.path)return(0,P.jsx)(Ve.Z,{autoHeight:!0,language:Y[$],onSave:function(e){X(e,I)},onChange:function(e){W(e),y((function(e){return Ye(Ye({},e),{},(0,o.Z)({},null===I||void 0===I?void 0:I.path,!0))})),Q(!0)},selected:!0,textareaFocused:!0,value:(0,ue.Pb)(null===I||void 0===I?void 0:I.content)?JSON.stringify(JSON.parse(null===I||void 0===I?void 0:I.content),null,2):null===I||void 0===I?void 0:I.content,width:"100%"})}),[I,$,X,y]),te=(0,ee.sE)(null===f||void 0===f?void 0:f.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),ie=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===f||void 0===f?void 0:f.uuid,null===te||void 0===te?void 0:te.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===r||void 0===r||r()}})}}),re=(0,l.Z)(ie,1)[0],oe=($===A.PY||$===A.SQL||($===A.YAML||$===A.R)&&pe(I,null===I||void 0===I?void 0:I.path))&&Ie(I.path.split("/"))!==v.tf.SCRATCHPAD&&fe(I)&&(0,P.jsx)(g.Z,{onClick:function(){var e=f.type===k.qL.INTEGRATION,n=Ae(I,B,f);i(n,(function(n){e&&te&&re({block:Ye(Ye({},te),{},{upstream_blocks:[n.uuid]})}),_(n)}))},primary:!0,children:"Add to current pipeline"}),le=(0,P.jsx)(Z.Z,{m:2,children:(0,P.jsx)(j.ZP,{disabled:!B,inline:!0,loading:M,onClick:function(){a(U.TERMINAL),m(JSON.stringify(["stdin","pip install -r ".concat(B,"/requirements.txt\r")]))},title:B?"Pip install packages from your saved requirements.txt file (\u2318+S to save).":"Please use right panel terminal to install packages.",uuid:"FileEditor/InstallPackages",children:"Install packages"})}),ce="FileEditor/".concat(null===I||void 0===I?void 0:I.path),ae=(0,Qe.y)(),se=ae.registerOnKeyDown,de=ae.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){de(ce)}}),[de,ce]),se(ce,(function(e,n,i){if(t)if((0,w.y)([C.zX,C.Um],n)||(0,w.y)([C.PQ,C.Um],n))e.preventDefault(),X(z,I);else if(V&&(0,w.y)([C.zX,C.hS],n)){e.preventDefault();var r="".concat(I.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(r)&&location.reload()}}),[t,z,I,X,V]),(0,P.jsxs)("div",{ref:N,children:[(0,P.jsx)(Z.Z,{p:2,children:(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsxs)(Ge,{children:[oe,(0,P.jsx)(g.Z,{disabled:!z,onClick:function(e){e.preventDefault(),X(z,I)},title:z?null:"No changes have been made to this file.",children:"Save file content"})]}),(0,P.jsx)(Ge,{children:(0,P.jsx)(g.Z,{compact:!0,onClick:function(){a(U.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),ne,u===R.REQS_TXT&&le]})},Je=t(47999),$e=t(64318);!function(e){e.ANDROID="Android",e.CHROME_OS="ChromeOS",e.IOS="iOS",e.LINUX="Linux",e.MAC="macOS",e.WINDOWS="Windows"}(Ke||(Ke={}));var en=Ke;function nn(){return function(){var e,n,t,i,r,o,l,c=en.MAC,u=null===(e=window)||void 0===e||null===(n=e.navigator)||void 0===n?void 0:n.userAgent,a=(null===(t=window)||void 0===t||null===(i=t.navigator)||void 0===i||null===(r=i.userAgentData)||void 0===r?void 0:r.platform)||(null===(o=window)||void 0===o||null===(l=o.navigator)||void 0===l?void 0:l.platform);return a?["macOS","Macintosh","MacIntel","MacPPC","Mac68K"].includes(a)?c=en.MAC:["Win32","Win64","Windows","WinCE"].includes(a)?c=en.WINDOWS:["iPhone","iPad","iPod"].includes(a)&&(c=en.IOS):u&&(u.includes("Macintosh")?c=en.MAC:u.includes("Windows")?c=en.WINDOWS:u.includes("Linux")&&u.includes("X11")?c=en.LINUX:/(iPhone|iPad)/.test(u)?c=en.IOS:u.includes("Android")&&u.includes("Mobi")?c=en.ANDROID:u.includes("CrOS")&&(c=en.CHROME_OS)),c}()===en.MAC}function tn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function rn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var on=function(e){var n=e.cancelPipeline,t=e.createPipeline,i=e.executePipeline,r=e.interruptKernel,l=e.isPipelineExecuting,c=e.restartKernel,u=e.savePipelineContent,a=e.setMessages,d=(0,s.useState)(null),f=d[0],p=d[1],h=(0,s.useRef)(null),m=(0,s.useRef)(null),v=[{label:function(){return"New standard pipeline"},onClick:function(){return t({pipeline:{name:(0,ue.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return t({pipeline:{name:(0,ue.Y6)(),type:k.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{label:function(){return"Save pipeline"},keyTextGroups:[[nn()?C.RJ:C.hE,C.SS]],onClick:function(){return u()},uuid:"save_pipeline"}],g=(0,s.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[C.kA],[C.kA]],onClick:function(){return r()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[C.t_[C.OC]],[C.t_[C.OC]]],onClick:function(){return c()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return a((function(e){return Object.keys(e).reduce((function(e,n){return rn(rn({},e),{},(0,o.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return l?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):e.push({label:function(){return"Execute pipeline"},onClick:function(){return i()},uuid:"Execute pipeline"}),e}),[n,i,r,l,c,a]),b="FileHeaderMenu/index",j=(0,Qe.y)(),y=j.registerOnKeyDown,Z=j.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){Z(b)}}),[Z,b]),y(b,(function(e,n,t){null!==f&&(n[C.QK]?p((function(e){return 0===e?1:e-1})):n[C.DY]&&p((function(e){return 1===e?0:e+1})))}),[f,p]),(0,P.jsx)(Je.Z,{onClickOutside:function(){return p(null)},open:!0,style:{position:"relative"},children:(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)($e.u,{highlighted:0===f,onClick:function(){return p((function(e){return 0===e?null:0}))},onMouseEnter:function(){return p((function(e){return null!==e?0:null}))},ref:h,children:(0,P.jsx)(_.ZP,{children:"File"})}),(0,P.jsx)(L.Z,{items:v,onClickCallback:function(){return p(null)},open:0===f,parentRef:h,uuid:"FileHeaderMenu/file_items"})]}),(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)($e.u,{highlighted:1===f,onClick:function(){return p((function(e){return 1===e?null:1}))},onMouseEnter:function(){return p((function(e){return null!==e?1:null}))},ref:m,children:(0,P.jsx)(_.ZP,{children:"Run"})}),(0,P.jsx)(L.Z,{items:g,onClickCallback:function(){return p(null)},open:1===f,parentRef:m,uuid:"FileHeaderMenu/run_items"})]})]})})},ln=t(10919),cn=t(46261),un=t(82386),an=t(37391),sn=300,dn=N.default.div.withConfig({displayName:"indexstyle__PipelineContainerStyle",componentId:"sc-1sv9513-0"})([".pipeline-detail-enter-active{opacity:1;transition:opacity ","ms linear;}.pipeline-detail-enter-done{opacity:0;transition:opacity ","ms linear;}"],sn,sn),fn=N.default.div.withConfig({displayName:"indexstyle__OverlayStyle",componentId:"sc-1sv9513-1"})(["height:100vh;opacity:1;position:fixed;width:100vw;z-index:9999;",""],(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).codeArea,";\n ")})),pn=N.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],un.Wi,un.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||Oe.Z.borders).medium,";\n ")}),(function(e){return e.relativePosition&&"\n position: relative;\n "}),(function(e){return e.secondary&&"\n height: ".concat(37,"px;\n top: ").concat(un.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,an.y$)()),hn=N.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-left:1px solid transparent;height:100%;padding:","px ","px;"," "," "," ",""],$.iI,$.cd*$.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||Oe.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||Oe.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&"\n border-color: ".concat((e.theme.borders||Oe.Z.borders).light," !important;\n ")}),(function(e){return e.last&&"\n border-right: 1px solid transparent;\n "})),mn=t(33766);var vn,gn,bn=function(e){var n=e.filePaths,t=e.filesTouched,i=e.savePipelineContent,r=e.selectedFilePath,o=(0,s.useContext)(N.ThemeContext),l=(0,s.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]);return(0,P.jsx)(pn,{relativePosition:!0,secondary:!0,children:(0,P.jsx)(x.Z,{alignItems:"center",justifyContent:"flex-start",children:null===l||void 0===l?void 0:l.map((function(e,n){var c=r===encodeURIComponent(e);return(0,P.jsx)(x.Z,{flexDirection:"column",fullHeight:!0,onClick:function(n){n.preventDefault(),c||(i(),(0,mn.u7)({file_path:encodeURIComponent(e)}))},children:(0,P.jsx)(hn,{last:n===l.length-1,selected:c,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,children:[!t[e]&&(0,P.jsx)(X.iU,{muted:!c,size:1.5*$.iI}),t[e]&&(0,P.jsx)(cn.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,P.jsx)("div",{style:{padding:1},children:(0,P.jsx)(B.Z,{borderColor:(o||Oe.Z).borders.danger,size:1.25*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{muted:!c,children:e}),(0,P.jsx)(Z.Z,{mr:2}),c&&(0,P.jsx)(cn.Z,{appearAbove:!0,label:"Close",size:null,widthFitContent:!0,children:(0,P.jsx)(ln.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){var n=(0,ee.Od)(l,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,mn.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})},preventDefault:!0,children:(0,P.jsx)(X.x8,{size:1.25*$.iI})})}),!c&&(0,P.jsx)("div",{style:{width:1.25*$.iI}})]})})},e)}))})})},xn=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(vn||(vn={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(gn||(gn={}));var jn=t(90686),yn=["bold","defaultColor","description","disableWordBreak","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","tooltipProps","value"];function kn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Zn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?kn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):kn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var _n=N.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*$.iI),On=N.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var Cn,En=function(e){var n=e.bold,t=void 0===n||n,i=e.defaultColor,r=e.description,o=e.disableWordBreak,l=e.inputValue,c=e.inputWidth,u=e.invertedTheme,a=e.label,d=e.labelColor,f=e.menuOpen,p=void 0!==f&&f,h=e.monospace,m=e.muted,v=e.onClick,g=e.notRequired,b=e.selectedTextProps,j=e.small,y=e.stacked,k=e.tooltipProps,C=e.value,E=(0,M.Z)(e,yn),S=(0,s.useRef)(null),w=(0,s.useState)(!1),I=w[0],T=w[1],A=(0,s.useState)(!1),R=A[0],D=A[1],N=a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{bold:t,color:d,inverted:u,lineHeight:20,monospace:h,muted:m,small:j,children:a}),k&&(0,P.jsx)(Z.Z,{ml:1,children:(0,P.jsx)(cn.Z,Zn({muted:!0},k))})]}),L=(0,P.jsxs)(P.Fragment,{children:[C&&(0,P.jsx)(ln.Z,{block:!0,danger:null===b||void 0===b?void 0:b.danger,fullWidth:!0,muted:m,onClick:function(){v(),S.current&&S.current.focus(),T(!0)},preventDefault:!0,sameColorAsText:m||!(null!==b&&void 0!==b&&b.primary)&&!(null!==b&&void 0!==b&&b.danger)&&!(null!==b&&void 0!==b&&b.warning),underline:null===b||void 0===b?void 0:b.underline,warning:null===b||void 0===b?void 0:b.warning,children:(0,P.jsx)(_.ZP,Zn(Zn({inverted:u,muted:m},b),{},{disableWordBreak:o,monospace:h,small:j,width:c,children:C}))}),(0,P.jsx)(O.Z,Zn(Zn({},E),{},{basic:!0,defaultColor:i,invertedTheme:u,monospace:h,onBlur:function(e){T(!1),E.onBlur&&E.onBlur(e),R||D(!0)},onFocus:function(e){T(!0),E.onFocus&&E.onFocus(e)},ref:S,small:j,value:l,visible:!C}))]}),B=r&&(0,P.jsx)(On,{children:(0,P.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:h,muted:!0,small:j})});return(0,P.jsxs)(P.Fragment,{children:[y&&(0,P.jsxs)(P.Fragment,{children:[N&&(0,P.jsxs)(_n,{children:[(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:N}),B]}),L]}),!y&&(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,children:[N&&(0,P.jsxs)(P.Fragment,{children:[N,(0,P.jsx)(Z.Z,{ml:1})]}),(0,P.jsx)(He.Z,{flex:"1",children:L})]}),R&&!I&&!C&&!p&&!g&&(0,P.jsx)(_.ZP,{danger:!0,small:j,children:"This field is required."})]})};!function(e){e.EMR="emr"}(Cn||(Cn={}));var Sn=t(42305);var wn=function(e){e.filePaths,e.filesTouched;var n,t=e.isBusy,i=e.isPipelineUpdating,o=e.kernel,c=e.pipeline,u=e.pipelineContentTouched,a=e.pipelineLastSaved,f=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),p=e.setErrors,h=e.updatePipelineMetadata,m=(0,s.useContext)(N.ThemeContext),v=o||{},g=v.alive,b=(v.name,(0,s.useState)(!1)),y=b[0],O=b[1],E=(0,s.useState)(""),S=E[0],w=E[1],I=(0,s.useState)(Cn.EMR),T=I[0],A=(I[1],(0,s.useState)(!1)),R=A[0],D=A[1],M=(0,s.useState)(!1),F=M[0],U=M[1],H=(0,s.useRef)(null),z=be.ZP.clusters.detail(T),W=z.data,G=z.mutate,V=(0,s.useMemo)((function(){var e;return(null===W||void 0===W||null===(e=W.cluster)||void 0===e?void 0:e.clusters)||[]}),W),Q=(0,ee.sE)(V,(function(e){return e.is_active})),q=(0,d.Db)(be.ZP.clusters.useUpdate(T),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){G()},onErrorCallback:function(e,n){return p({errors:n,response:e})}})}}),Y=(0,l.Z)(q,2),K=Y[0];Y[1].isLoading,(0,s.useEffect)((function(){null!==c&&void 0!==c&&c.uuid&&w(c.uuid)}),[null===c||void 0===c?void 0:c.uuid]),n=u?"Unsaved changes":i?"Saving changes...":a?"Last saved ".concat((0,Sn.JX)(Number(a)/1e3)):"All changes saved";var J="KernelStatus",ne=(0,Qe.y)(),te=ne.registerOnKeyDown,ie=ne.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){ie(J)}}),[ie,J]),te(J,(function(e,n,t){y&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)&&((null===c||void 0===c?void 0:c.uuid)===S?e.target.blur():(h(S),O(!1)))}),[y,S,O,h]);var re=(0,s.useMemo)((function(){return(0,P.jsx)(En,{bold:!1,inputValue:S,notRequired:!0,onBlur:function(){return setTimeout((function(){return O(!1)}),300)},onChange:function(e){w(e.target.value),e.preventDefault()},onClick:function(){return O(!0)},onFocus:function(){return O(!0)},stacked:!0,value:y?null:(null===c||void 0===c?void 0:c.uuid)||""})}),[y,S,c]),oe=(0,s.useMemo)((function(){return(0,P.jsx)("div",{ref:H,style:{position:"relative"},children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(null===c||void 0===c?void 0:c.type)===k.qL.PYSPARK&&(0,P.jsxs)(Z.Z,{mr:1,children:[(0,P.jsxs)(ln.Z,{muted:!!Q,onClick:function(){return D(!0)},preventDefault:!0,sameColorAsText:!Q,underline:!Q,children:[Q&&Q.id,!Q&&"Select cluster"]}),(0,P.jsx)(Je.Z,{disableEscape:!0,onClickOutside:function(){return D(!1)},open:R,children:(0,P.jsx)(L.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)(V.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,P.jsx)(He.Z,{flex:1,children:(0,P.jsx)(_.ZP,{muted:!t&&gn.WAITING!==i,children:n})}),t&&(0,P.jsx)(X.Jr,{size:2*$.iI,success:!0}),!t&&(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||gn.WAITING!==i?null:function(){return K({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return D(!1)},open:R,parentRef:H,uuid:"KernelStatus/select_cluster",width:40*$.iI})})]}),(0,P.jsx)(j.ZP,{beforeElement:(0,P.jsx)(B.Z,{color:t?(m||Oe.Z).borders.info:g?(m||Oe.Z).borders.success:(m||Oe.Z).borders.danger,size:$.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return U(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===c||void 0===c?void 0:c.type)||k.qL.PYTHON}),(0,P.jsx)(Je.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,P.jsx)(L.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(k.a_).filter((function(e){return(null===c||void 0===c?void 0:c.type)!=e})).map((function(e){return{label:function(){return e},onClick:function(){return h(null===c||void 0===c?void 0:c.name,e)},uuid:e}})))),onClickCallback:function(){return U(!1)},open:F,parentRef:H,uuid:"KernelStatus/select_kernel",width:25*$.iI})})]})})}),[g,V,t,c,Q,D,U,R,F,m,K]),le=(0,s.useMemo)((function(){return(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsxs)(_.ZP,{children:["Pipeline:\xa0",f&&(null===c||void 0===c?void 0:c.uuid)]}),!f&&re,(0,P.jsx)(Z.Z,{mr:3})]})}),[g,t,c,re,f,m]);return(0,P.jsx)(pn,{relativePosition:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:(0,P.jsxs)(Z.Z,{px:$.cd,children:[f&&(0,P.jsx)(ln.Z,{noHoverUnderline:!0,noOutline:!0,onClick:f?function(){return(0,mn.u7)({file_path:null})}:null,preventDefault:!0,children:le}),!f&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[le,y&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(ln.Z,{onClick:function(){h(S),O(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]})}),(0,P.jsx)(Z.Z,{px:$.cd,children:(0,P.jsxs)(He.Z,{alignItems:"center",children:[oe,(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,P.jsx)(jn.Z,{inline:!0,keyText:nn()?C.RJ:C.hE}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,P.jsx)(jn.Z,{inline:!0,keyText:C.SS}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,P.jsx)("br",{})]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["Or, go to ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,P.jsx)(_.ZP,{muted:!0,children:n})})]})})]})})},Pn=t(82635),In=t(16910);var Tn,An,Rn,Dn,Mn,Nn,Ln=function(e){var n=e.size;return(0,P.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)("path",{d:"M245.121138,10.6473813 C251.139129,16.4340053 255.074133,24.0723342 256,32.4050489 C256,35.8769778 255.074133,38.1917867 252.990862,42.5895822 C250.907876,46.9873778 225.215147,91.4286933 217.57696,103.696213 C213.179164,110.871609 210.864356,119.435947 210.864356,127.768462 C210.864356,136.3328 213.179164,144.6656 217.57696,151.840996 C225.215147,164.108516 250.907876,208.781084 252.990862,213.179164 C255.074133,217.57696 256,219.659947 256,223.131876 C255.074133,231.464676 251.370667,239.103147 245.352676,244.658347 C239.565938,250.676338 231.927751,254.611342 223.826489,255.305671 C220.35456,255.305671 218.039751,254.379804 213.873493,252.296533 C209.706951,250.213262 164.340053,225.215147 152.072249,217.57696 C151.146382,217.113884 150.220516,216.419556 149.063396,215.95648 L88.4195556,180.079502 C89.8082133,191.652693 94.9006222,202.763093 103.233138,210.864356 C104.853618,212.484551 106.473813,213.873493 108.325547,215.262151 C106.936604,215.95648 105.316409,216.651093 103.927751,217.57696 C91.6599467,225.215147 46.9873778,250.907876 42.5895822,252.990862 C38.1917867,255.074133 36.1085156,256 32.4050489,256 C24.0723342,255.074133 16.4340053,251.370667 10.8788338,245.352676 C4.86075733,239.565938 0.925858133,231.927751 0,223.594951 C0.231464676,220.123022 1.1573248,216.651093 3.00905244,213.641956 C5.09223822,209.24416 30.7848533,164.571307 38.42304,152.303787 C42.82112,145.128391 45.1356444,136.795591 45.1356444,128.231538 C45.1356444,119.6672 42.82112,111.3344 38.42304,104.159004 C30.7848533,91.4286933 4.86075733,46.75584 3.00905244,42.3580444 C1.1573248,39.3489067 0.231464676,35.8769778 0,32.4050489 C0.925858133,24.0723342 4.62930489,16.4340053 10.6473813,10.6473813 C16.4340053,4.62930489 24.0723342,0.925858133 32.4050489,0 C35.8769778,0.231464676 39.3489067,1.1573248 42.5895822,3.00905244 C46.2930489,4.62930489 78.9293511,23.6094009 96.28928,33.7939911 L100.224284,36.1085156 C101.612942,37.0343822 102.770347,37.7287111 103.696213,38.1917867 L105.547947,39.3489067 L167.348907,75.9204978 C165.960249,62.0324978 158.784853,49.3019022 147.674453,40.7378489 C149.063396,40.04352 150.683591,39.3489067 152.072249,38.42304 C164.340053,30.7848533 209.012622,4.86075733 213.410418,3.00905244 C216.419556,1.1573248 219.891484,0.231464676 223.594951,0 C231.696213,0.925858133 239.334684,4.62930489 245.121138,10.6473813 Z M131.240391,144.434062 L144.434062,131.240391 C146.285796,129.388658 146.285796,126.611342 144.434062,124.759609 L131.240391,111.565938 C129.388658,109.714204 126.611342,109.714204 124.759609,111.565938 L111.565938,124.759609 C109.714204,126.611342 109.714204,129.388658 111.565938,131.240391 L124.759609,144.434062 C126.379804,146.054258 129.388658,146.054258 131.240391,144.434062 Z",fill:"#FF694A"})})},Bn=t(30264),Fn=t(80906),Un=$.cd*$.iI,Hn=N.default.div.withConfig({displayName:"indexstyle__IconContainerStyle",componentId:"sc-oyfjzc-0"})(["align-items:center;border-radius:","px;border:1px solid transparent;display:flex;justify-content:center;"," "," "," "," "," "," ",""],Ce.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||Oe.Z.content).active,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,ce.qn)(v.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,ce.qn)(v.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.teal&&"\n background-color: ".concat((0,ce.qn)(v.tf.EXTENSION,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,ce.qn)(v.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(Un+$.iI/2,"px;\n width: ").concat(Un+$.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(Un/2+$.iI,"px;\n width: ").concat(Un/2+$.iI,"px;\n ")})),zn=N.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],$.iI,$.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Wn=(Fn.Q0.AVERAGE,Fn.Q0.CLEAN_COLUMN_NAME,Fn.Q0.COUNT,Fn.Q0.COUNT_DISTINCT,Fn.Q0.CUSTOM,Fn.Q0.DIFF,Fn.Q0.FIRST,Fn.Q0.FIX_SYNTAX_ERRORS,Fn.Q0.IMPUTE,Fn.Q0.LAST,Fn.Q0.MAX,Fn.Q0.MEDIAN,Fn.Q0.MIN,Fn.Q0.NORMALIZE,Fn.Q0.REFORMAT,Fn.Q0.REMOVE,Fn.Q0.REMOVE_OUTLIERS,Fn.Q0.SELECT,Fn.Q0.SHIFT_DOWN,Fn.Q0.SHIFT_UP,Fn.Q0.STANDARDIZE,Fn.Q0.SUM,[Fn.Q0.DROP_DUPLICATE,Fn.Q0.FILTER,Fn.Q0.SORT,Fn.Q0.REMOVE]);!function(e){e.AGGREGATE="Aggregate",e.FORMATTING="Formatting",e.COLUMN_REMOVAL="Column removal",e.SHIFT_ROWS="Shift rows in a column",e.MISC="Miscellaneous",e.FEATURE_SCALING="Feature Scaling"}(Nn||(Nn={}));var Gn,Vn,Qn,qn=(An={},(0,o.Z)(An,Fn.qs.COLUMN,(Tn={},(0,o.Z)(Tn,Nn.AGGREGATE,[Fn.Q0.AVERAGE,Fn.Q0.COUNT,Fn.Q0.COUNT_DISTINCT,Fn.Q0.FIRST,Fn.Q0.LAST,Fn.Q0.MAX,Fn.Q0.MEDIAN,Fn.Q0.MIN,Fn.Q0.SUM]),(0,o.Z)(Tn,Nn.FORMATTING,[Fn.Q0.CLEAN_COLUMN_NAME,Fn.Q0.FIX_SYNTAX_ERRORS,Fn.Q0.REFORMAT]),(0,o.Z)(Tn,Nn.COLUMN_REMOVAL,[Fn.Q0.REMOVE,Fn.Q0.SELECT]),(0,o.Z)(Tn,Nn.SHIFT_ROWS,[Fn.Q0.SHIFT_DOWN,Fn.Q0.SHIFT_UP]),(0,o.Z)(Tn,Nn.MISC,[Fn.Q0.DIFF,Fn.Q0.IMPUTE,Fn.Q0.REMOVE_OUTLIERS]),(0,o.Z)(Tn,Nn.FEATURE_SCALING,[Fn.Q0.NORMALIZE,Fn.Q0.STANDARDIZE]),Tn)),(0,o.Z)(An,Fn.qs.ROW,(0,o.Z)({},Nn.MISC,[].concat(Wn))),An),Yn=Object.keys(qn[Fn.qs.COLUMN]),Kn=[Nn.MISC],Xn=(Mn={},(0,o.Z)(Mn,Fn.qs.COLUMN,(Rn={},(0,o.Z)(Rn,Fn.Q0.ADD,"Add column"),(0,o.Z)(Rn,Fn.Q0.AVERAGE,"Aggregate by average value"),(0,o.Z)(Rn,Fn.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,o.Z)(Rn,Fn.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,o.Z)(Rn,Fn.Q0.COUNT,"Aggregate by total count"),(0,o.Z)(Rn,Fn.Q0.DIFF,"Difference"),(0,o.Z)(Rn,Fn.Q0.FIRST,"Aggregate by first value"),(0,o.Z)(Rn,Fn.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,o.Z)(Rn,Fn.Q0.IMPUTE,"Fill in missing values"),(0,o.Z)(Rn,Fn.Q0.NORMALIZE,"Normalize Data"),(0,o.Z)(Rn,Fn.Q0.STANDARDIZE,"Standardize Data"),(0,o.Z)(Rn,Fn.Q0.LAST,"Aggregate by last value"),(0,o.Z)(Rn,Fn.Q0.MAX,"Aggregate by maximum value"),(0,o.Z)(Rn,Fn.Q0.MEDIAN,"Aggregate by median value"),(0,o.Z)(Rn,Fn.Q0.MIN,"Aggregate by mininum value"),(0,o.Z)(Rn,Fn.Q0.REFORMAT,"Reformat"),(0,o.Z)(Rn,Fn.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,o.Z)(Rn,Fn.Q0.REMOVE,"Remove column(s)"),(0,o.Z)(Rn,Fn.Q0.SELECT,"Keep columns"),(0,o.Z)(Rn,Fn.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,o.Z)(Rn,Fn.Q0.SHIFT_UP,"Shift rows up in a column"),(0,o.Z)(Rn,Fn.Q0.SUM,"Aggregate by sum of values"),Rn)),(0,o.Z)(Mn,Fn.qs.ROW,(Dn={},(0,o.Z)(Dn,Fn.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,o.Z)(Dn,Fn.Q0.FILTER,"Filter"),(0,o.Z)(Dn,Fn.Q0.SORT,"Sort"),(0,o.Z)(Dn,Fn.Q0.REMOVE,"Remove rows"),Dn)),Mn);!function(e){e.API="api",e.AZURE_BLOB_STORAGE="azure_blob_storage",e.AZURE_EVENT_HUB="azure_event_hub",e.BIGQUERY="bigquery",e.FILE="file",e.GENERIC="generic",e.GOOGLE_CLOUD_STORAGE="google_cloud_storage",e.KAFKA="kafka",e.KINESIS="kinesis",e.MYSQL="mysql",e.OPENSEARCH="opensearch",e.POSTGRES="postgres",e.RABBITMQ="rabbitmq",e.REDSHIFT="redshift",e.S3="s3",e.SNOWFLAKE="snowflake"}(Qn||(Qn={}));var Jn=(Gn={},(0,o.Z)(Gn,Qn.API,"API"),(0,o.Z)(Gn,Qn.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,o.Z)(Gn,Qn.AZURE_EVENT_HUB,"Azure Event Hub"),(0,o.Z)(Gn,Qn.BIGQUERY,"Google BigQuery"),(0,o.Z)(Gn,Qn.FILE,"Local file"),(0,o.Z)(Gn,Qn.GENERIC,"Generic (no template)"),(0,o.Z)(Gn,Qn.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,o.Z)(Gn,Qn.KAFKA,"Kafka"),(0,o.Z)(Gn,Qn.KINESIS,"Kinesis"),(0,o.Z)(Gn,Qn.MYSQL,"MySQL"),(0,o.Z)(Gn,Qn.OPENSEARCH,"OpenSearch"),(0,o.Z)(Gn,Qn.POSTGRES,"PostgreSQL"),(0,o.Z)(Gn,Qn.RABBITMQ,"RabbitMQ"),(0,o.Z)(Gn,Qn.REDSHIFT,"Amazon Redshift"),(0,o.Z)(Gn,Qn.S3,"Amazon S3"),(0,o.Z)(Gn,Qn.SNOWFLAKE,"Snowflake"),Gn),$n=(Vn={},(0,o.Z)(Vn,v.tf.DATA_LOADER,[Qn.GENERIC,Qn.FILE,Qn.API,Qn.AZURE_BLOB_STORAGE,Qn.BIGQUERY,Qn.GOOGLE_CLOUD_STORAGE,Qn.MYSQL,Qn.POSTGRES,Qn.RABBITMQ,Qn.REDSHIFT,Qn.S3,Qn.SNOWFLAKE]),(0,o.Z)(Vn,v.tf.DATA_EXPORTER,[Qn.GENERIC,Qn.FILE,Qn.AZURE_BLOB_STORAGE,Qn.BIGQUERY,Qn.GOOGLE_CLOUD_STORAGE,Qn.MYSQL,Qn.POSTGRES,Qn.REDSHIFT,Qn.S3,Qn.SNOWFLAKE]),(0,o.Z)(Vn,v.tf.TRANSFORMER,[Qn.BIGQUERY,Qn.POSTGRES,Qn.REDSHIFT,Qn.SNOWFLAKE]),(0,o.Z)(Vn,v.tf.SENSOR,[Qn.GENERIC,Qn.BIGQUERY,Qn.MYSQL,Qn.POSTGRES,Qn.REDSHIFT,Qn.S3,Qn.SNOWFLAKE]),Vn),et=Qn,nt=function(e,n,t){var i=t===k.qL.STREAMING&&(e===v.tf.DATA_LOADER||e===v.tf.DATA_EXPORTER);return(function(e){var n;return e===k.qL.STREAMING?(n={},(0,o.Z)(n,v.tf.DATA_LOADER,[et.AZURE_EVENT_HUB,et.KAFKA,et.KINESIS,et.RABBITMQ]),(0,o.Z)(n,v.tf.DATA_EXPORTER,[et.S3,et.KAFKA,et.KINESIS,et.OPENSEARCH]),(0,o.Z)(n,v.tf.TRANSFORMER,[et.GENERIC]),n):$n}(t)[e]||[]).map((function(t){return{indent:e===v.tf.TRANSFORMER,label:function(){return Jn[t]},onClick:function(){n({config:{data_source:t===et.GENERIC?null:t},language:i?v.t6.YAML:v.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))},tt=function(e,n){return[{label:function(){return"SQL"},onClick:function(){return e({language:v.t6.SQL,type:n})},uuid:"".concat(n,"/sql")},{label:function(){return"R"},onClick:function(){return e({language:v.t6.R,type:n})},uuid:"".concat(n,"/r")}]},it=function(e,n,t){var i=Object.fromEntries(v.Ut.map((function(n){return[n,nt(n,e,t)]})));return t===k.qL.PYSPARK||t===k.qL.PYTHON&&n===v.tf.TRANSFORMER||t===k.qL.STREAMING||n===v.tf.SENSOR?i[n]:[{items:i[n],label:function(){return"Python"},uuid:"".concat(n,"/python")}].concat((0,r.Z)(tt(e,n)))};function rt(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return Xn[n][e]},onClick:function(){t({config:{action_type:e,axis:n},language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"".concat(n,"_").concat(e)}})).sort((function(e,n){return e.label().localeCompare(n.label())}))}function ot(e,n,t){var i=[];return e.forEach((function(e){if(e!==Nn.MISC)i.push({indent:!0,items:rt(qn[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,ue.RA)(e))});else{var o=rt(qn[n][e],n,t);i.push.apply(i,(0,r.Z)(o))}})),i}var lt=function(e,n,t){return Object.values(v.Lq).map((function(i){return{label:function(){return(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.mm,{fill:(0,ce.qn)(v.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,P.jsx)(_.ZP,{children:(0,ue.kC)(i)})]})},leftAligned:!0,onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},ct=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function ut(e,n){var t=n;return v.tf.SCRATCHPAD===e.type&&(t='"""\nNOTE: Scratchpad blocks are used only for experimentation and testing out code.\nThe code written here will not be executed as part of the pipeline.\n"""\n'+(n||"")),t}function at(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function st(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?at(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var dt=function(e){var n=e.addNewBlock,t=e.blockIdx,i=e.compact,o=e.hideCustom,l=e.hideDataExporter,c=(e.hideDataLoader,e.hideDbt),u=(e.hideRecommendations,e.hideScratchpad),a=e.hideSensor,d=e.hideTransformer,f=e.hideTransformerDataSources,p=e.onClickAddSingleDBTModel,h=e.pipeline,m=e.setAddNewBlockMenuOpenIdx,g=e.setCreatingNewDBTModel,b=(e.setRecsWindowOpenBlockIdx,(0,s.useState)(null)),y=b[0],Z=b[1],_=(0,s.useRef)(null),O=(0,s.useRef)(null),C=(0,s.useRef)(null),E=(0,s.useRef)(null),S=(0,s.useRef)(null),w=(0,s.useRef)(null),I={compact:i,inline:!0},T=null===h||void 0===h?void 0:h.type,A=T===k.qL.STREAMING,R=i?Un/2:Un,D=25*$.iI,M=ot(Yn,Fn.qs.COLUMN,n),N=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:ot(Kn,Fn.qs.ROW,n),label:function(){return"Row actions"},uuid:"row_actions_grouping"},{isGroupingTitle:!0,label:function(){return"Column actions"},uuid:"column_actions_grouping"}].concat((0,r.Z)(M));f||N.splice(1,0,{bold:!0,items:it(n,v.tf.TRANSFORMER,T),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var L=(0,s.useCallback)((function(){return Z(null)}),[]),B=(0,s.useCallback)((function(e){return null===m||void 0===m?void 0:m((function(n){return null===n||y!==e?t:null}))}),[t,y,m]),F=k.qL.PYSPARK===T;return(0,P.jsx)(x.Z,{flexWrap:"wrap",inline:!0,children:(0,P.jsx)(Je.Z,{onClickOutside:L,open:!0,children:(0,P.jsxs)(x.Z,{flexWrap:"wrap",children:[!l&&(0,P.jsx)(zn,{increasedZIndex:0===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:it(n,v.tf.DATA_LOADER,T),onClickCallback:L,open:0===y,parentRef:_,uuid:"data_loader_button",children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{blue:!0,compact:i,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 0===e?null:0})),B(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!d&&(0,P.jsx)(zn,{increasedZIndex:1===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:F||k.qL.INTEGRATION===T?N:A?[{items:it(n,v.tf.TRANSFORMER,T),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:N,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,r.Z)(tt(n,v.tf.TRANSFORMER))),onClickCallback:L,open:1===y,parentRef:O,uuid:"transformer_button",children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{compact:i,purple:!0,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 1===e?null:1})),B(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!l&&(0,P.jsx)(zn,{increasedZIndex:2===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:it(n,v.tf.DATA_EXPORTER,T),onClickCallback:L,open:2===y,parentRef:C,uuid:"data_exporter_button",children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{compact:i,yellow:!0,children:(0,P.jsx)(X.mm,{inverted:!0,size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 2===e?null:2})),B(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!c&&(0,P.jsx)(zn,{increasedZIndex:3===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:[{label:function(){return"New model"},onClick:function(){null===g||void 0===g||g(!0),null===p||void 0===p||p(t)},uuid:"dbt/new_model"},{label:function(){return"Single model (from file)"},onClick:function(){return null===p||void 0===p?void 0:p(t)},uuid:"dbt/single_model"},{label:function(){return"All models (w/ optional exclusion)"},onClick:function(){return n({language:v.t6.YAML,type:v.tf.DBT})},uuid:"dbt/all_models"}],onClickCallback:L,open:3===y,parentRef:E,uuid:"dbt_button",children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Ln,{size:Un*(i?.75:1.25)}),onClick:function(e){e.preventDefault(),Z((function(e){return 3===e?null:3})),B(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!o&&(0,P.jsx)(zn,{increasedZIndex:4===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:[{items:lt(n,v.tf.CUSTOM,v.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:lt(n,v.tf.CUSTOM,v.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:L,open:4===y,parentRef:S,uuid:"custom_block_button",children:(0,P.jsx)(cn.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:D,size:null,children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{compact:i,children:(0,P.jsx)(X.I8,{size:R})}),onClick:function(e){e.preventDefault(),Z((function(e){return 4===e?null:4})),B(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!u&&(0,P.jsx)(zn,{children:(0,P.jsx)(cn.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:D,size:null,children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{border:!0,compact:i,children:(0,P.jsx)(X.mm,{size:R})}),onClick:function(e){e.preventDefault(),n({type:v.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!A&&!a&&(0,P.jsx)(zn,{increasedZIndex:6===y,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:it(n,v.tf.SENSOR,T),onClickCallback:L,open:6===y,parentRef:w,uuid:"sensor_button",children:(0,P.jsx)(j.ZP,st(st({},I),{},{beforeElement:(0,P.jsx)(Hn,{compact:i,children:(0,P.jsx)(X.LM,{pink:!0,size:Un*(i?.75:1.25)})}),onClick:function(e){e.preventDefault(),Z((function(e){return 6===e?null:6})),B(6)},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})})]})})})},ft=t(18283),pt=t(32316),ht=t(89565),mt=t.n(ht),vt=t(62976),gt=t(86532),bt=t(34744),xt=t(66166),jt=N.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-n38rkq-0"})([""," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;overflow:hidden;"," "," ",""],ce.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*$.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(Ce.n_,"px;\n border-bottom-right-radius: ").concat(Ce.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),yt=N.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat($.iI*$.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat($.iI*$.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(ce.oh,"px;\n padding-right: ").concat($.iI*$.cd,"px;\n ")})),kt=N.default.div.withConfig({displayName:"indexstyle__HTMLOutputStyle",componentId:"sc-n38rkq-2"})(["table{"," border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;}td,th{padding:0 8px;}a{","}"],ce.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||Oe.Z.interactive).linkPrimary,";\n ")})),Zt=N.default.div.withConfig({displayName:"indexstyle__ExtraInfoStyle",componentId:"sc-n38rkq-3"})([""," border-bottom-style:solid;border-bottom-width:2px;border-left-style:solid;border-left-width:2px;border-right-style:solid;border-right-width:2px;",""],ce.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||Oe.Z.borders).light,";\n border-bottom-left-radius: ").concat(Ce.n_,"px;\n border-bottom-right-radius: ").concat(Ce.n_,"px;\n ")})),_t=N.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],$.iI,ce.oh,$.iI*$.cd,$.iI),Ot=N.default.div.withConfig({displayName:"indexstyle__ExtraInfoBorderStyle",componentId:"sc-n38rkq-5"})(["height:1px;width:100%;",""],(function(e){return"\n border-top: 1px solid ".concat((e.theme.borders||Oe.Z.borders).medium,";\n ")})),Ct=/\[__internal_output__\]/,Et=/\[__internal_test__\]/,St={uuid:"Preview results"},wt={uuid:"Logs"},Pt={uuid:"SQL"},It={uuid:"Lineage"},Tt=[St,wt,Pt,It];function At(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Rt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?At(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):At(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Dt(e){var n={},t={};return null===e||void 0===e||e.forEach((function(e){var i=e.content,r=e.outputs,o=e.type,l=e.uuid;(null===r||void 0===r?void 0:r.length)>=1&&(n[l]=r.map((function(e){var n=e||{},t=n.sample_data,i=n.shape,r=n.text_data,o=n.type;return t?{data:Rt({shape:i},t),type:o}:r&&(0,ue.Pb)(r)?JSON.parse(r):r}))),t[o]||(t[o]={}),t[o][l]=i})),{content:t,messages:n}}function Mt(e,n,t){e.forEach((function(e){(0,S.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,S.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,S.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,S.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}function Nt(e){return"".concat(e,"/").concat(S.kP)}function Lt(e){return(0,S.U2)(Nt(e),[])}function Bt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ft(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Bt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Bt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ut,Ht=function(e){var n=e.block,t=e.blockMetadata,i=e.buttonTabs,o=e.collapsed,l=e.contained,c=void 0===l||l,u=e.dynamicBlock,a=e.dynamicChildBlock,d=e.hasError,f=e.hasOutput,p=e.hideExtraInfo,h=e.isInProgress,m=e.mainContainerWidth,b=e.messages,j=e.openSidekickView,y=e.pipeline,O=e.runCount,C=e.runEndTime,E=e.runStartTime,w=e.selected,I=e.selectedTab,T=e.setCollapsed,R=e.setOutputBlocks,D=e.setSelectedOutputBlock,M=e.setSelectedTab,N=n.status,L=n.type,F=(0,s.useMemo)((function(){return(null===b||void 0===b?void 0:b.length)||0}),[b]),H=v.DA.EXECUTED===N||!h&&0===O&&F>=1||!h&&O>=1&&C>=E,z=(0,s.useState)(),W=z[0],G=z[1],V=(0,s.useState)(),Q=V[0],q=V[1];(0,s.useEffect)((function(){h||q(100)}),[h]);var Y=function(e){return Array.isArray(e)?e.join("\n"):e},K=(0,s.useMemo)((function(){return b.reduce((function(e,n){var t=e.at(-1);if(Pn.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!Y(null===n||void 0===n?void 0:n.data).match(Ct)){if(Array.isArray(t.data))t.data.concat(n.data);else if("string"===typeof t.data){var i=Y(n.data)||"";t.data=[t.data,i].join("\n")}}else Pn.jU.includes(null===n||void 0===n?void 0:n.type)&&!Y(null===n||void 0===n?void 0:n.data).match(Ct)?e.push(Ft(Ft({},n),{},{data:Y(n.data)})):e.push(Ft({},n));return e}),[])}),[b]),J=(0,s.useMemo)((function(){return(0,P.jsx)(Ze.Z,{progress:Q})}),[Q]),ee=v.tf.DBT===(null===n||void 0===n?void 0:n.type),ne=(0,xt.Z)(d);(0,s.useEffect)((function(){ee&&!ne&&d&&M(wt)}),[d,ne,ee,M]);var te=(0,s.useMemo)((function(){var e=function(e,n){var t=e.columns,i=e.index,r=e.rows,o=e.shape,l=n.borderTop,c=n.selected;return o&&G(o),r.length>=1&&(0,P.jsx)(vt.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*$.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:m-(2+$.cd*$.iI*2+2+an.nn)},"data-table-".concat(i))},n=[],t=[],i=[];return null===K||void 0===K||K.forEach((function(o,l){var u=o.data,a=o.type;if(u&&0!==(null===u||void 0===u?void 0:u.length)){var s=[];s=(s=Array.isArray(u)?u:[u]).filter((function(e){return e}));var d=[];s.forEach((function(e){if(e&&"string"===typeof e){var n=e.split("\n");d.push.apply(d,(0,r.Z)(n))}else"object"===typeof d&&d.push(e)}));var f=d.length,p=[];d.forEach((function(n,r){var o,u={contained:c,first:0===l&&0===r,last:l===K.length-1&&r===f-1},s=l>=1;if("string"===typeof n&&n.match(Et)){var d=n.split("\n"),h=[];d.forEach((function(e){if(e.match(Et)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,ue.Pb)(r)&&i.push(JSON.parse(r))}else h.push(e);n=h.length>=1?h.join("\n"):null}))}if(null!==n){if("string"===typeof n&&n.match(Ct)){var m=n.split("[__internal_output__]"),v=m[m.length-1],g=v.split("FloatProgress");if(m.length>=2&&(v=g[0]),(0,ue.Pb)(v)){var b=JSON.parse(v),x=b.data,j=b.type;if(Pn.Gi.TABLE===j){!0;var y=e(x,{borderTop:s,selected:w});t.push(y),ee||(o=y)}}}else if(a===Pn.Gi.TABLE){!0;var k=e((0,ue.Pb)(n)?JSON.parse(n):n,{borderTop:s,selected:w});t.push(k),ee||(o=k)}else if(Pn.jU.includes(a)){var Z,O=null===(Z=n)||void 0===Z?void 0:Z.split("\\n");o=(0,P.jsx)(yt,Ft(Ft({},u),{},{children:O.map((function(e){return(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(mt(),{children:e})},e)}))}))}else if(a===Pn.Gi.TEXT_HTML)o=(0,P.jsx)(yt,Ft(Ft({},u),{},{children:(0,P.jsx)(kt,{children:(0,P.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(a===Pn.Gi.IMAGE_PNG)o=(0,P.jsx)("div",{style:{backgroundColor:"white"},children:(0,P.jsx)("img",{alt:"Image ".concat(l," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(a===Pn.Gi.PROGRESS){var C=parseInt(n);q(C>90?90:C)}o&&p.push((0,P.jsx)("div",{children:o},"code-output-".concat(l,"-").concat(r)))}})),p.length>=1&&n.push(p)}})),h&&(null===y||void 0===y?void 0:y.type)===k.qL.PYSPARK&&n.unshift([(0,P.jsx)(yt,{contained:!0,children:(0,P.jsx)(Z.Z,{mt:1,children:J})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[K,c,ee,h,m,y,J,w]),ie=te.content,re=te.tableContent,oe=te.testContent,le=(null===W||void 0===W?void 0:W[1])||0,ce=le>30?" (30 out of ".concat(le," columns displayed)"):"",ae=(0,s.useMemo)((function(){var e;if(ee&&I){var n=I.uuid;if(St.uuid===n)(null===re||void 0===re?void 0:re.length)>=1?e=re:h||(e=(0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(wt.uuid===n)(null===ie||void 0===ie?void 0:ie.length)>=1?e=ie:h||(e=(0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(Pt.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,P.jsx)(Ve.Z,{autoHeight:!0,language:A.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(It.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,P.jsx)(gt.Z,{disabled:!0,enablePorts:!1,height:55*$.iI,pannable:w,pipeline:Ft(Ft({},y),{},{blocks:c}),zoomable:w}):null}}else e=ie;return(0,P.jsxs)(P.Fragment,{children:[i,e]})}),[t,i,ie,d,ee,h,y,w,I,re]);return i||f?(0,P.jsxs)(P.Fragment,{children:[c&&(0,P.jsxs)(jt,{addBottomPadding:h&&(null===y||void 0===y?void 0:y.type)===k.qL.PYSPARK,blockType:L,dynamicBlock:u,dynamicChildBlock:a,executedAndIdle:H,hasError:d,selected:w,children:[!o&&(null===oe||void 0===oe?void 0:oe.length)>=1&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{py:2,children:(0,P.jsx)(yt,{contained:!0,children:oe.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,P.jsxs)(Z.Z,{mt:n>=1?3:0,children:[(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(mt(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,P.jsx)(_.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,P.jsx)(mt(),{children:e})},e)}))]},i)}))})}),(0,P.jsx)(Z.Z,{mb:d?2:0,children:(0,P.jsx)(bt.Z,{medium:!0})})]}),!o&&ae]}),!c&&ae,H&&!p&&(0,P.jsxs)(Zt,{blockType:L,dynamicBlock:u,dynamicChildBlock:a,hasError:d,selected:w,children:[(0,P.jsx)(Ot,{}),(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[T&&(0,P.jsx)(He.Z,{alignItems:"center",px:1,children:(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return T(!o)},transparent:!0,children:o?(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X._M,{muted:!0,size:2*$.iI}),"\xa0",(0,P.jsx)(_.ZP,{default:!0,children:"Expand output"})]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.Kh,{muted:!0,size:2*$.iI}),W&&(0,P.jsx)(Z.Z,{ml:2,children:(0,P.jsx)(_.ZP,{children:"".concat(W[0]," rows x ").concat(W[1]," columns").concat(ce)})})]})})}),(0,P.jsx)(_t,{children:(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,P.jsx)(cn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:O>=1&&E?"Last run at ".concat(new Date(E.valueOf()).toLocaleString()):d?"Block executed with errors":"Block executed successfully",size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[O>=1&&Number(C)>Number(E)&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{small:!0,children:[(Number(C)-Number(E))/1e3,"s"]}),(0,P.jsx)(Z.Z,{mr:1})]}),!d&&(0,P.jsx)(X.Jr,{size:2*$.iI,success:!0}),d&&(0,P.jsx)(B.Z,{danger:!0,size:2*$.iI,children:(0,P.jsx)(_.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})}),!d&&!v.Qj.includes(L)&&(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(g.Z,{afterIcon:(0,P.jsx)(X.M0,{muted:!0,size:1.75*$.iI}),basic:!0,noPadding:!0,onClick:function(){!function(e,n){var t=Lt(e);t.includes(n)||(0,S.t8)(Nt(e),[].concat((0,r.Z)(t),[n]))}(null===y||void 0===y?void 0:y.uuid,n.uuid),null===j||void 0===j||j(U.DATA),null===R||void 0===R||R((function(e){return e.find((function(e){return e.uuid===n.uuid}))?e:(null===D||void 0===D||D(n),e.concat(n))}))},transparent:!0,children:(0,P.jsx)(_.ZP,{default:!0,children:"Expand table"})})})]})})]})]})]}):null},zt="buckets",Wt="chart_style",Gt="group_by",Vt="height",Qt="index",qt="legend_labels",Yt="limit",Kt="metrics",Xt="time_interval",Jt="width_percentage",$t="x",ei="y",ni="y_sort_order",ti="data_provider",ii="data_provider_database",ri="data_provider_profile",oi="data_provider_schema",li="data_provider_table",ci="dbt_project_name",ui="dbt_profile_target",ai="export_write_policy",si="limit",di="use_raw_sql",fi=[$t,ei];!function(e){e.BAR_CHART="bar chart",e.HISTOGRAM="histogram",e.LINE_CHART="line chart",e.PIE_CHART="pie chart",e.TABLE="table",e.TIME_SERIES_BAR_CHART="time series bar chart",e.TIME_SERIES_LINE_CHART="time series line chart"}(Ut||(Ut={}));var pi,hi,mi=[Ut.BAR_CHART,Ut.HISTOGRAM,Ut.LINE_CHART,Ut.PIE_CHART,Ut.TABLE,Ut.TIME_SERIES_BAR_CHART,Ut.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(pi||(pi={})),function(e){e.AVERAGE="average",e.COUNT="count",e.COUNT_DISTINCT="count_distinct",e.MAX="max",e.MEDIAN="median",e.MIN="min",e.MODE="mode",e.SUM="sum"}(hi||(hi={}));var vi,gi,bi,xi,ji,yi,ki,Zi,_i,Oi=[hi.AVERAGE,hi.COUNT,hi.COUNT_DISTINCT,hi.MAX,hi.MEDIAN,hi.MIN,hi.MODE,hi.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(vi||(vi={})),function(e){e.DAY="day",e.HOUR="hour",e.MINUTE="minute",e.MONTH="month",e.ORIGINAL="original",e.SECOND="second",e.WEEK="week",e.YEAR="year"}(gi||(gi={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(_i||(_i={}));var Ci={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:_i.COLUMNS,uuid:Gt},{label:function(){return"time interval"},options:[gi.ORIGINAL,gi.SECOND,gi.MINUTE,gi.HOUR,gi.DAY,gi.WEEK,gi.MONTH,gi.YEAR],uuid:Xt},{label:function(){return"metrics"},type:_i.METRICS,uuid:Kt}]},Ei=(bi={},(0,o.Z)(bi,Ut.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:_i.COLUMNS,uuid:Gt},{label:function(){return"metrics"},type:_i.METRICS,uuid:Kt},{autoRun:!0,label:function(){return"chart style"},options:[pi.HORIZONTAL,pi.VERTICAL],uuid:Wt},{autoRun:!0,label:function(){return"sort direction"},options:[null,vi.ASCENDING,vi.DESCENDING],uuid:ni}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:$t},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ei}]}),(0,o.Z)(bi,Ut.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:_i.COLUMNS,uuid:Gt},{autoRun:!0,label:function(){return"Number of buckets"},type:_i.NUMBER,uuid:zt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:$t}]}),(0,o.Z)(bi,Ut.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:_i.COLUMNS,uuid:Gt},{label:function(){return"metrics"},type:_i.METRICS,uuid:Kt}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:$t},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ei},{label:function(){return"labels of lines in chart (comma separated)"},uuid:qt}]}),(0,o.Z)(bi,Ut.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:_i.COLUMNS,uuid:Gt},{autoRun:!0,label:function(){return"Number of slices"},type:_i.NUMBER,uuid:zt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:$t}]}),(0,o.Z)(bi,Ut.TABLE,{noCode:[{label:function(){return"columns"},type:_i.COLUMNS,uuid:Gt},{label:function(){return"max number of rows"},type:_i.NUMBER,uuid:Yt}],code:[{label:function(){return"variable name of columns"},monospace:!0,uuid:$t},{label:function(){return"variable name of rows"},monospace:!0,uuid:ei}]}),(0,o.Z)(bi,Ut.TIME_SERIES_BAR_CHART,Ci),(0,o.Z)(bi,Ut.TIME_SERIES_LINE_CHART,Ci),bi),Si=(xi={},(0,o.Z)(xi,Ut.BAR_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,$t,"x"),(0,o.Z)(n,ei,"y"),(0,o.Z)(n,Wt,pi.VERTICAL),n},content:function(e){return"columns = df_1.columns\nx = df_1.columns[:7]\ny = [[v] for v in [len(df_1[col].unique()) for col in x]]\n"}}),(0,o.Z)(xi,Ut.HISTOGRAM,{configuration:function(e){var n;return n={},(0,o.Z)(n,zt,10),(0,o.Z)(n,$t,"x"),n},content:function(e){return"columns = df_1.columns\ncol = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))[0]\nx = df_1[col]\n"}}),(0,o.Z)(xi,Ut.LINE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,$t,"x"),(0,o.Z)(n,ei,"y"),n},content:function(e){return"columns = df_1.columns\ncols = list(filter(lambda x: df_1[x].dtype == float or df_1[x].dtype == int, columns))\nx = df_1[cols[0]]\ny = [df_1[cols[1]]]\n"}}),(0,o.Z)(xi,Ut.PIE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,zt,7),(0,o.Z)(n,$t,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,o.Z)(xi,Ut.TABLE,{configuration:function(e){var n;return n={},(0,o.Z)(n,Yt,10),(0,o.Z)(n,$t,"x"),(0,o.Z)(n,ei,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,o.Z)(xi,Ut.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,o.Z)({},Xt,gi.ORIGINAL)}}),(0,o.Z)(xi,Ut.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,o.Z)({},Xt,gi.ORIGINAL)}}),xi),wi=(Zi={},(0,o.Z)(Zi,Ut.BAR_CHART,(ji={},(0,o.Z)(ji,$t,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,o.Z)(ji,ei,(function(){return"must be a list of lists containing integers or floats."})),ji)),(0,o.Z)(Zi,Ut.HISTOGRAM,(0,o.Z)({},$t,(function(){return"must be a list of integers or floats."}))),(0,o.Z)(Zi,Ut.LINE_CHART,(yi={},(0,o.Z)(yi,$t,(function(){return"must be a list of integers or floats."})),(0,o.Z)(yi,ei,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),yi)),(0,o.Z)(Zi,Ut.PIE_CHART,(0,o.Z)({},$t,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,o.Z)(Zi,Ut.TABLE,(ki={},(0,o.Z)(ki,$t,(function(){return"must be a list of strings."})),(0,o.Z)(ki,ei,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),ki)),Zi),Pi=[{label:function(){return"% of missing values"},widgetTemplate:function(e){var n,t=e.block;return{name:"missing values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,$t,"columns_with_mising_values"),(0,o.Z)(n,ei,"percentage_of_missing_values"),(0,o.Z)(n,Wt,pi.HORIZONTAL),(0,o.Z)(n,ni,vi.DESCENDING),(0,o.Z)(n,"chart_type",Ut.BAR_CHART),n),content:"number_of_rows = len(df_1.index)\ncolumns_with_mising_values = []\npercentage_of_missing_values = []\nfor col in df_1.columns:\n missing = df_1[col].isna().sum()\n if missing > 0:\n columns_with_mising_values.append(col)\n percentage_of_missing_values.append(100 * missing / number_of_rows)\n"}}},{label:function(){return"Unique values"},widgetTemplate:function(e){var n,t=e.block;return{name:"unique values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,$t,"columns"),(0,o.Z)(n,ei,"number_of_unique_values"),(0,o.Z)(n,Wt,pi.HORIZONTAL),(0,o.Z)(n,ni,vi.DESCENDING),(0,o.Z)(n,"chart_type",Ut.BAR_CHART),n),content:"columns = df_1.columns\nnumber_of_unique_values = [df_1[col].nunique() for col in columns]\n"}}},{label:function(){return"Most frequent values"},widgetTemplate:function(e){var n,t=e.block;return{name:"most frequent values for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Vt,3e3),(0,o.Z)(n,Qt,"column_index"),(0,o.Z)(n,$t,"columns"),(0,o.Z)(n,ei,"rows"),(0,o.Z)(n,"chart_type",Ut.TABLE),n),content:"columns = ['mode value', 'frequency', '% of values']\n\ncolumn_index = []\nrows = []\nfor col in df_1.columns:\n value_counts = df_1[col].value_counts()\n if len(value_counts.index) == 0:\n continue\n column_value = value_counts.index[0]\n value = value_counts[column_value]\n number_of_rows = df_1[col].count()\n column_index.append(col)\n rows.append([\n column_value,\n f'{round(100 * value / number_of_rows, 2)}%',\n value,\n ])\n"}}},{label:function(){return"Summary overview"},widgetTemplate:function(e){var n,t=e.block;return{name:"summary overview for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Vt,3e3),(0,o.Z)(n,Qt,"stats"),(0,o.Z)(n,$t,"headers"),(0,o.Z)(n,ei,"rows"),(0,o.Z)(n,"chart_type",Ut.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\n\n\nheaders = ['value']\nstats = ['Columns', 'Rows']\nrows = [[len(df_1.columns)], [len(df_1.index)]]\n\ncol_counts = {}\nfor col, col_type in infer_column_types(df_1).items():\n col_type_name = col_type.value\n if not col_counts.get(col_type_name):\n col_counts[col_type_name] = 0\n col_counts[col_type_name] += 1\n\nfor col_type, count in sorted(col_counts.items()):\n stats.append(f'# of {col_type}')\n rows.append([count])\n"}}},{label:function(){return"Feature profiles"},widgetTemplate:function(e){var n,t=e.block;return{name:"feature profiles for ".concat(null===t||void 0===t?void 0:t.uuid),configuration:(n={},(0,o.Z)(n,Vt,3e3),(0,o.Z)(n,Qt,"stats"),(0,o.Z)(n,$t,"columns"),(0,o.Z)(n,ei,"rows"),(0,o.Z)(n,"chart_type",Ut.TABLE),n),content:"from mage_ai.data_cleaner.column_types.column_type_detector import infer_column_types\nimport statistics\n\n\ncolumns_and_types = infer_column_types(df_1).items()\ncolumns = [t[0] for t in columns_and_types]\nstats = ['Type', 'Missing values', 'Unique values', 'Min', 'Max', 'Mean', 'Median', 'Mode']\nrows = [[] for _ in stats]\n\nfor col, col_type in columns_and_types:\n series = df_1[col]\n min_value = None\n max_value = None\n mean = None\n median = None\n\n not_null = series[series.notnull()]\n\n if col_type.value in ['number', 'number_with_decimals']:\n count = len(not_null.index)\n if count >= 1:\n mean = round(not_null.sum() / count, 2)\n median = sorted(not_null)[int(count / 2)]\n min_value = round(series.min(), 2)\n max_value = round(series.max(), 2)\n else:\n min_value = not_null.astype(str).min()\n max_value = not_null.astype(str).max()\n\n _, mode = sorted(\n [(v, k) for k, v in not_null.value_counts().items()],\n reverse=True,\n )[0]\n\n for idx, value in enumerate([\n col_type.value,\n len(series[series.isna()].index),\n len(series.unique()),\n min_value,\n max_value,\n mean,\n median,\n mode,\n ]):\n rows[idx].append(value)\n"}}}];function Ii(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ti(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ii(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ii(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ai=function(e){var n=e.addWidget,t=e.block,i=e.left,o=e.rightOffset,l=e.onClickCallback,c=e.open,u=e.parentRef,a=e.runBlock,d=e.topOffset,f=(0,s.useMemo)((function(){return mi.map((function(e){var i,r,o={configuration:{chart_type:e},language:t.language,type:v.tf.CHART,upstream_blocks:t?[t.uuid]:null},l=Si[e],c=(null===l||void 0===l||null===(i=l.configuration)||void 0===i?void 0:i.call(l,o))||{},u=v.t6.SQL===(null===t||void 0===t?void 0:t.language)?null:(null===l||void 0===l||null===(r=l.content)||void 0===r?void 0:r.call(l,o))||null,s=e;return t&&(s="".concat(s," for ").concat(t.uuid)),{label:function(){return(0,ue.vg)(e)},onClick:function(){return n(Ti(Ti({},o),{},{name:"".concat(s," ").concat((0,ue.Mp)()),configuration:Ti(Ti({},o.configuration),c),content:u}),{onCreateCallback:function(e){t&&v.t6.SQL!==t.language&&([v.DA.EXECUTED,v.DA.UPDATED].includes(t.status)?a({block:e,code:u,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:e}}))}),[mi,t,a]),p=(0,s.useMemo)((function(){return Pi.map((function(e){var i=e.label,r=Ti(Ti({},(0,e.widgetTemplate)({block:t})),{},{language:t.language,type:v.tf.CHART,upstream_blocks:t?[t.uuid]:null});return{label:i,onClick:function(){return n(r,{onCreateCallback:function(e){t&&v.t6.SQL!==t.language&&([v.DA.EXECUTED,v.DA.UPDATED].includes(t.status)?a({block:e,code:e.content,disableReset:!0}):a({block:t,runDownstream:!0}))}})},uuid:i()}}))}),[Pi,n,t,a]),h=[{isGroupingTitle:!0,label:function(){return"Custom charts"},uuid:"custom_charts"}].concat((0,r.Z)(f));return v.t6.SQL!==t.language&&h.push.apply(h,[{isGroupingTitle:!0,label:function(){return"Templates"},uuid:"chart_templates"}].concat((0,r.Z)(p))),(0,P.jsx)(L.Z,{items:h,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:o,topOffset:d,uuid:"CommandButtons/add_charts",width:25*$.iI})},Ri=t(40656),Di=N.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Mi=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Ri.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,P.jsxs)(Di,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,P.jsx)("path",{clipRule:"evenodd",d:"M2.5 1C1.67157 1 1 1.67157 1 2.5v.0625c0 .27614-.223858.5-.5.5s-.5-.22386-.5-.5V2.5C0 1.11929 1.11929 0 2.5 0h7C10.8807 0 12 1.11929 12 2.5v7c0 1.3807-1.1193 2.5-2.5 2.5h-7C1.11929 12 0 10.8807 0 9.5v-.0625c0-.27614.223858-.5.5-.5s.5.22386.5.5V9.5c0 .8284.67157 1.5 1.5 1.5h7c.8284 0 1.5-.6716 1.5-1.5v-7c0-.82843-.6716-1.5-1.5-1.5h-7z",fill:"url(#paint0_linear_1332_60037)",fillRule:"evenodd"}),(0,P.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.05806 3.55806c.24408-.24408.6398-.24408.88388 0l2 2c.24408.24408.24408.6398 0 .88388l-2 2c-.24408.24408-.6398.24408-.88388 0-.24408-.24408-.24408-.6398 0-.88388l.93306-.93306H1C.654822 6.625.375 6.34518.375 6s.279822-.625.625-.625h5.99112l-.93306-.93306c-.24408-.24408-.24408-.6398 0-.88388z",fill:"#fff"}),(0,P.jsx)("defs",{children:(0,P.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,P.jsx)("stop",{stopColor:"#FFCC19"}),(0,P.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,P.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},Ni=t(79749),Li=t(54283);function Bi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Fi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Bi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Bi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ui=function(e,n){var t=(null===n||void 0===n?void 0:n.upstream_blocks)||[];return v.tf.CHART===e.type||v.tf.SCRATCHPAD===e.type||v.tf.CHART===(null===n||void 0===n?void 0:n.type)||v.tf.SCRATCHPAD===(null===n||void 0===n?void 0:n.type)||v.tf.DATA_LOADER===(null===n||void 0===n?void 0:n.type)&&v.tf.SENSOR!==e.type||t.push(e.uuid),t},Hi=function(e,n,t,i){for(var r,o=[],l=n.findIndex((function(n){return n.uuid===e.uuid}));!r&&l>=0;){var c;r=n[l-1],v.tf.SCRATCHPAD===(null===(c=r)||void 0===c?void 0:c.type)&&(r=null),l-=1}return r&&o.push(r.uuid),v.Ut.map((function(n){return{label:function(){return"Convert to ".concat((0,ue.wX)(v.V4[n]))},onClick:function(){return i({converted_from_type:n,converted_from_uuid:e.uuid,type:n,upstream_blocks:o})},uuid:"".concat(t,"/convert_to/").concat(n)}}))},zi=function(e,n,t,i,r,o){var l=e||{},c=l.configuration,u=l.downstream_blocks,a=l.has_callback,s=l.upstream_blocks,d=c||{},f=d.dynamic,p=d.reduce_output,h=v.tf.DBT===(null===e||void 0===e?void 0:e.type),m=[];if(v.tf.EXTENSION===e.type);else{m.push({label:function(){return h?"Execute and run upstream blocks":"Execute with upstream blocks"},onClick:function(){return n({block:e,runUpstream:!0})},uuid:"execute_upstream"}),h||m.push({label:function(){return"Execute block and run tests"},onClick:function(){return n({block:e,runTests:!0})},uuid:"run_tests"});var g=o||{},b=g.blocksMapping,x=g.fetchFileTree,j=g.fetchPipeline,y=g.savePipelineContent,k=g.updatePipeline,Z=[];if(u.forEach((function(e){var n=null===b||void 0===b?void 0:b[e];n&&n.upstream_blocks.forEach((function(e){var n,t;null!==b&&void 0!==b&&null!==(n=b[e])&&void 0!==n&&null!==(t=n.configuration)&&void 0!==t&&t.dynamic&&Z.push(b[e])}))})),h&&m.unshift.apply(m,[{label:function(){return"Run model"},onClick:function(){return n({block:e,runSettings:{run_model:!0}})},tooltip:function(){return"Execute command dbt run."},uuid:"run_model"},{label:function(){return"Test model"},onClick:function(){return n({block:e,runSettings:{test_model:!0}})},tooltip:function(){return"Execute command dbt test."},uuid:"test_model"},{label:function(){return"Build model"},onClick:function(){return n({block:e,runSettings:{build_model:!0}})},tooltip:function(){return"Execute command dbt build."},uuid:"build_model"},{label:function(){return"Add upstream models"},onClick:function(){k({pipeline:{add_upstream_for_block_uuid:null===e||void 0===e?void 0:e.uuid}})},tooltip:function(){return"Add upstream models for this model to the pipeline."},uuid:"add_upstream_models"}]),h||!y||!f&&0!==Z.length||m.push({label:function(){return f?"Disable block as dynamic":"Set block as dynamic"},onClick:function(){return y({block:Fi(Fi({},e),{},{configuration:Fi(Fi({},c),{},{dynamic:!f})})})},uuid:"dynamic"}),b)(null===s||void 0===s?void 0:s.find((function(e){var n,t;return null===b||void 0===b||null===(n=b[e])||void 0===n||null===(t=n.configuration)||void 0===t?void 0:t.dynamic})))&&m.push({label:function(){return p?"Don\u2019t reduce output":"Reduce output"},onClick:function(){return y({block:Fi(Fi({},e),{},{configuration:Fi(Fi({},c),{},{reduce_output:!p})})})},uuid:"reduce_output"});m.push({label:function(){return a?"Remove callback":"Add callback"},onClick:function(){return y({block:Fi(Fi({},e),{},{has_callback:!a})}).then((function(){x(),j()}))},uuid:"has_callback"})}return m.push({label:function(){return"Delete block"},onClick:function(){t(e),i(!1)},uuid:"delete_block"}),r?[m.pop()]:m};function Wi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Gi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Wi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Wi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Vi,Qi=function(e){var n=e.addNewBlock,t=e.addWidget,i=e.block,r=e.blocks,o=e.deleteBlock,c=e.executionState,u=e.fetchFileTree,a=e.fetchPipeline,f=e.interruptKernel,p=e.pipeline,h=e.runBlock,m=e.savePipelineContent,b=e.setErrors,j=e.setOutputCollapsed,y=(e.visible,i.all_upstream_blocks_executed),O=void 0===y||y,E=i.color,S=i.type,w=i.uuid,I=(0,s.useRef)(null),T=(0,s.useRef)(null),A=(0,s.useRef)(null),R=(0,s.useRef)(null),D=null===p||void 0===p?void 0:p.type,M=(0,s.useState)(!1),F=M[0],U=M[1],H=(0,s.useState)(!1),z=H[0],W=H[1],G=(0,s.useState)(!1),V=G[0],Q=G[1],q=(0,s.useState)(!1),Y=q[0],K=q[1],J=(0,s.useContext)(N.ThemeContext),ne=Pn.uF.IDLE!==c,te=(0,ce.qn)(S,{blockColor:E,theme:J}).accent,ie=D===k.qL.STREAMING,re=(0,s.useMemo)((function(){return Hi(i,r,"CommandButtons",n).map((function(e){return Gi(Gi({},e),{},{onClick:function(){return m().then((function(){return e.onClick()}))}})}))}),[n,i,r,m]),oe=(0,s.useMemo)((function(){return(0,ee.HK)(r,(function(e){return e.uuid}))}),[r]),le=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]),ue=(0,d.Db)(be.ZP.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){a()},onErrorCallback:function(e,n){return b({errors:n,response:e})}})}}),ae=(0,l.Z)(ue,2),se=ae[0];return ae[1].isLoading,(0,P.jsxs)(x.Z,{alignItems:"center",children:[Pn.uF.QUEUED===c&&(0,P.jsx)(Li.Z,{color:(J||Oe.Z).content.active,type:"cylon"}),Pn.uF.BUSY===c&&(0,P.jsx)(Li.Z,{color:(J||Oe.Z).content.active}),h&&!ne&&!ie&&(0,P.jsxs)(P.Fragment,{children:[!le&&(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,P.jsxs)(_.ZP,{children:[le?"Compile and preview data":"Run block","\xa0 \xa0",(0,P.jsx)(Ni.Z,{inline:!0,keyTextGroups:[[nn()?C.RJ:C.hE,C.Lz]],monospace:!0,uuidForKey:w})]}),size:3*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){O?h({block:i}):Q(!0)},children:(0,P.jsx)(B.Z,{color:te,size:3*$.iI,children:(0,P.jsx)(X.Py,{black:!0,size:1.5*$.iI})})})}),le&&(0,P.jsx)(g.Z,{backgroundColor:te,beforeIcon:(0,P.jsx)(X.Py,{size:1.5*$.iI}),compact:!0,onClick:function(){O?h({block:i}):Q(!0)},small:!0,children:"Compile & preview"}),(0,P.jsx)(Je.Z,{disableEscape:!0,onClickOutside:function(){return Q(!1)},open:V,children:(0,P.jsx)(L.Z,{items:[{label:function(){return"Execute block"},onClick:function(){return h({block:i})},uuid:"execute_block"},{label:function(){return"Execute with upstream blocks"},onClick:function(){return h({block:i,runUpstream:!0})},uuid:"execute_upstream"}],onClickCallback:function(){return Q(!1)},open:V,parentRef:A,rightOffset:13.25*$.iI,topOffset:4.5*$.iI,uuid:"execute_actions",width:25*$.iI})})]}),ne&&(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,P.jsxs)(_.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,P.jsx)(Ni.Z,{inline:!0,keyTextGroups:[[C.kA],[C.kA]],monospace:!0,uuidForKey:w})]}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return f()},children:(0,P.jsx)(B.Z,{borderSize:1.5,size:2.5*$.iI,children:(0,P.jsx)(X.x8,{size:1*$.iI})})})})}),v.tf.SCRATCHPAD===i.type&&!ie&&(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(Bn.Z,{items:re,onClickCallback:function(){return W(!1)},onClickOutside:function(){return W(!1)},open:z,parentRef:T,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,P.jsx)(_.ZP,{children:"Convert block"}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return W(!z)},ref:T,children:(0,P.jsx)(Mi,{size:2.5*$.iI})})})})}),[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(i.type)&&!ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:$.cd,ref:I,children:(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return U((function(e){return!e}))},children:(0,P.jsx)(X.er,{size:2.25*$.iI})})})}),t&&(0,P.jsx)(Je.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,P.jsx)(Ai,{addWidget:t,block:i,onClickCallback:function(){return U(!1)},open:F,parentRef:I,rightOffset:9*$.iI,runBlock:h,topOffset:2*$.iI})})]}),(0,P.jsx)("div",{ref:R,children:(0,P.jsx)(Z.Z,{ml:$.cd,children:(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:(0,P.jsx)(_.ZP,{children:"More actions"}),size:2.5*$.iI,widthFitContent:!0,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return K((function(e){return!e}))},children:(0,P.jsx)(B.Z,{borderSize:1.5,size:2.5*$.iI,children:(0,P.jsx)(X.mH,{size:$.iI})})})})})}),(0,P.jsx)(Je.Z,{disableEscape:!0,onClickOutside:function(){return K(!1)},open:Y,children:(0,P.jsx)(L.Z,{items:zi(i,h,o,j,ie,{blocksMapping:oe,fetchFileTree:u,fetchPipeline:a,savePipelineContent:m,updatePipeline:se}),onClickCallback:function(){return K(!1)},open:Y,parentRef:R,rightOffset:4.75*$.iI,topOffset:2*$.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Vi||(Vi={}));var qi,Yi=[Vi.APPEND,Vi.FAIL,Vi.REPLACE];!function(e){e.BIGQUERY="bigquery",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake"}(qi||(qi={}));var Ki,Xi=t(55378);!function(e){e.DATA_EXPORTER="data_exporter",e.DATA_LOADER="data_loader",e.MAGE_LIBRARY="mage_library",e.TRANSFORMER="transformer",e.USER_LIBRARY="user_library"}(Ki||(Ki={}));var Ji=t(5677);function $i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function er(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$i(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function nr(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,ee.w6)(r).forEach((function(e,o){if(i)return i;var l=t.slice(0,r-o).join("/");i=n["".concat(l,".py")]})),i}function tr(e,n,t){var i,r,o;return((null===(i=t.outputs)||void 0===i||null===(r=i[0])||void 0===r||null===(o=r.sample_data)||void 0===o?void 0:o.columns)||[]).map((function(t){return{label:"".concat(t," column"),kind:e.languages.CompletionItemKind.Variable,insertText:"'".concat(t,"'"),range:n}}))}function ir(e,n){var t=e.word.split(""),i=new RegExp(t.reduce((function(e,n,i){var r=t[i+1],o=r?"^".concat(r):"";return e+"".concat(n,"[w ").concat(o,"]*")}),""));return n.reduce((function(e,n){return n.label.match(i)?e.concat(n):e}),[])}function rr(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,o=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,ee.HK)(n,(function(e){return e.id}));return function(t){return function(s,d){var f=[],p=s.getValueInRange({endColumn:d.column,endLineNumber:d.lineNumber,startColumn:1,startLineNumber:1}),h=s.getWordUntilPosition(d),m=h.endColumn,g=h.startColumn,b={endColumn:m,endLineNumber:d.lineNumber,startColumn:g,startLineNumber:d.lineNumber},x=function(e,n,t){var i=(0,Ji.Yn)(e),r=(0,Ji.M4)(e,n),o=i.find((function(e){var n=e.variableName;return r.match(new RegExp(n))}));if(o){var l=o.assignmentValue,c=(0,Ji.S0)(e)[l];if(c){var u,a=nr(c.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t),s=(0,Ji.rW)(c,l);return null===a||void 0===a||null===(u=a.methods_for_class)||void 0===u?void 0:u[s]}}return[]}(p,b,a);if((null===x||void 0===x?void 0:x.length)>=1){var j=ir(h,x.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Method,label:e,range:b}})));if(j.length>=1)return{suggestions:j}}var y=function(e,n,t){var i=(0,Ji.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,Ji.S0)(e)[i[1]];if(r){var o=nr(r.split(" as ")[0].replace("from ","").replace("import ","").split(" ").reduce((function(e,n){return n.trim()?e.concat(n):e}),[]).join(".").split("."),t);if(null!==o&&void 0!==o&&o.functions)return null===o||void 0===o?void 0:o.functions}}return[]}(p,b,a);if((null===y||void 0===y?void 0:y.length)>=1){var k=ir(h,y.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Function,label:e,range:b}})));if(k.length>=1)return{suggestions:k}}if((null===u||void 0===u?void 0:u.length)>=1){var Z=new RegExp("\n@".concat(c));p.match(Z)&&f.push.apply(f,(0,r.Z)(ir(h,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,ee.HK)(r,(function(e){return e.uuid}));return o.map((function(t,i){var r=l[t].type,o=0===i?"output_0":"args[".concat(i-1,"]");return{label:"df ".concat(t," ").concat(r," block"),kind:e.languages.CompletionItemKind.Variable,documentation:"Variable for ".concat(r," ").concat(t," data."),insertText:o,range:n}}))}(t,b,e))))}if(h.word.match(/i|f/)){var _=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,t=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o=(arguments.length>2?arguments[2]:void 0).word,c=new Set,u={};e.forEach((function(e){var n=e.group,t=e.id,i=e.imports;if([Ki.MAGE_LIBRARY,Ki.USER_LIBRARY].includes(n)){var r=t;r.match(/__init__.py/)&&(r=r.replace(/\/__init__.py/,"")),r=r.split(".py")[0].replaceAll("/","."),u[r]=e}var o=t.replace(".py","").replace("/__init__","").split("/");if(1===o.length)c.add("import ".concat(o[0]));else if(o.length>=2){var l=o.slice(0,o.length-1).join(".");c.add("from ".concat(l," import ").concat(o[o.length-1]))}i.forEach((function(e){return c.add(e)}))}));var a,s="i"===o,d="f"===o,f=s?"import":d?"from":"",p=(0,Ji.M4)(n,i);if(s&&p.match(/from/)&&(a=p.match(/from ([A-Za-z0-9_.]+) /)[1]),a&&u[a]){var h=u[a],m=h.classes,v=h.constants,g=h.files,b=h.functions,x=[];return[[v,t.languages.CompletionItemKind.Constant],[m,t.languages.CompletionItemKind.Class],[b,t.languages.CompletionItemKind.Function]].forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],r=n[1];t.forEach((function(e){x.push({filterText:"import ".concat(e),insertText:"import ".concat(e),kind:r,label:e,range:i})}))})),g.forEach((function(e){var n=e.split("/"),r=n[n.length-1].split(".py")[0];x.push({filterText:"import ".concat(r),insertText:"import ".concat(r),kind:t.languages.CompletionItemKind.Variable,label:r,range:i})})),x}return(0,r.Z)(c).map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.File,label:e,range:i}})).concat(Object.entries(u).map((function(e){var n=(0,l.Z)(e,2),r=n[0];return n[1],{filterText:"".concat(f," ").concat(r),insertText:"".concat(f," ").concat(r," "),kind:t.languages.CompletionItemKind.File,label:"".concat(r),range:er({},i)}})))}(n,p,h,t,b,e);f.push.apply(f,(0,r.Z)(_))}if(v.tf.CHART===c||v.tf.SCRATCHPAD===c){var O=[];if(v.tf.CHART===c?u.forEach((function(e,n){O.push({block:i.find((function(n){var t=n.uuid;return e===t})),matchIndex:0,variableName:"df_".concat(n+1)})})):v.tf.SCRATCHPAD===c&&function(e,n){return e.map((function(e){return{block:e,regex:new RegExp("([\\w_]+)[ ]*=[ ]*get_variable\\('".concat(n.uuid,"', '").concat(e.uuid,"', 'output_0'\\)"),"g")}}))}(i,o).forEach((function(e){var n=e.block,t=e.regex,i=p.matchAll(t);(0,r.Z)(i).forEach((function(e){var t=null===e||void 0===e?void 0:e.index,i=null===e||void 0===e?void 0:e[1];i&&O.push({block:n,matchIndex:t,variableName:i})}))})),O.length>=1){var C,E=null===(C=p.split("\n")[d.lineNumber-1])||void 0===C?void 0:C.slice(0,h.startColumn-1);if(E){var S=[];if(O.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));E.match(o)&&S.push({items:tr(t,b,n),matchIndex:i})})),S.length>=1)return{suggestions:ir(h,(0,ee.YC)(S,"matchIndex",{ascending:!1})[0].items)}}}1===g&&(v.tf.CHART===c?f.push.apply(f,(0,r.Z)(ir(h,u.map((function(e,n){var i="df_".concat(n+1);return{label:"".concat(i," ").concat(e," block"),kind:t.languages.CompletionItemKind.Snippet,insertText:i,range:b}}))))):v.tf.SCRATCHPAD===c&&f.push.apply(f,(0,r.Z)(ir(h,function(e,n,t){var i=t.block,r=t.blocks,o=t.pipeline;return r.reduce((function(t,r){var l=r.type,c=r.uuid;return i.uuid!==c&&[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(l)?t.concat({label:"df ".concat(c," ").concat(l," block"),kind:e.languages.CompletionItemKind.Snippet,documentation:"Get the data from ".concat(l," block ").concat(c,"."),insertText:"from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(o.uuid,"', '").concat(c,"', 'output_0')\n"),range:n}):t}),[])}(t,b,e)))))}var w=new Set;i.concat({content:p}).forEach((function(e){var n=e.content;(0,r.Z)(n.matchAll("([A-Za-z_0-9]+)","g")).forEach((function(e){return w.add(e[1])}))}));var P=(0,r.Z)(w);if(P.length){var I=P.map((function(e){return{filterText:e,insertText:e,kind:t.languages.CompletionItemKind.Variable,label:e,range:b}}));f.push.apply(f,(0,r.Z)(ir(h,I)))}return{suggestions:f}}}}var or=t(32365),lr=t(80636),cr=t(25958),ur=t(66653),ar=t(87323);function sr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function dr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?sr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):sr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function fr(e,n){var t,i,c,u,a,f=e.addNewBlock,p=e.addNewBlockMenuOpenIdx,h=e.addWidget,m=e.autocompleteItems,j=e.block,y=e.blockIdx,E=e.blockRefs,I=e.blocks,T=e.dataProviders,A=e.defaultValue,R=void 0===A?"":A,D=e.deleteBlock,M=e.executionState,L=e.extraContent,F=e.fetchFileTree,U=e.fetchPipeline,H=e.height,z=e.hideRunButton,W=e.interruptKernel,G=e.mainContainerRef,V=e.mainContainerWidth,Q=e.messages,q=void 0===Q?[]:Q,Y=e.noDivider,K=e.onCallbackChange,J=e.onChange,ne=e.onClickAddSingleDBTModel,te=e.openSidekickView,ie=e.pipeline,re=e.runBlock,oe=e.runningBlocks,le=e.savePipelineContent,ae=e.selected,se=e.setAddNewBlockMenuOpenIdx,de=e.setAnyInputFocused,fe=e.setCreatingNewDBTModel,pe=e.setEditingBlock,he=e.setErrors,me=e.setOutputBlocks,ve=e.setRecsWindowOpenBlockIdx,ge=e.setSelected,ye=e.setSelectedOutputBlock,ke=e.setTextareaFocused,Ze=e.textareaFocused,_e=e.widgets,Oe=(0,s.useContext)(N.ThemeContext),Ce=(0,s.useMemo)((function(){return(null===j||void 0===j?void 0:j.configuration)||{}}),[j]),Ee=(0,s.useState)(!1),Se=Ee[0],we=Ee[1],Pe=(0,s.useState)(null),Ie=Pe[0],Te=Pe[1],Ae=(0,s.useState)(!1),Re=Ae[0],De=Ae[1],Me=(0,s.useState)(!1),Ne=Me[0],Le=Me[1],Be=(0,s.useState)(R),Fe=Be[0],Ue=Be[1],ze=(0,s.useState)(null),We=ze[0],Ge=ze[1],qe=(0,s.useState)((t={},(0,o.Z)(t,ti,Ce.data_provider),(0,o.Z)(t,ii,Ce.data_provider_database),(0,o.Z)(t,ri,Ce.data_provider_profile),(0,o.Z)(t,oi,Ce.data_provider_schema),(0,o.Z)(t,li,Ce.data_provider_table),(0,o.Z)(t,ui,Ce.dbt_profile_target),(0,o.Z)(t,ci,Ce.dbt_project_name),(0,o.Z)(t,ai,Ce.export_write_policy||Vi.APPEND),(0,o.Z)(t,si,Ce.limit),(0,o.Z)(t,di,!!Ce.use_raw_sql),t)),Ye=qe[0],Ke=qe[1],Xe=(0,s.useState)(null),Je=Xe[0],$e=Xe[1],en=(0,s.useState)(!1),nn=en[0],tn=en[1],rn=(0,s.useState)(j.uuid),on=rn[0],un=rn[1],an=(0,s.useState)(!1),sn=an[0],dn=an[1],fn=(0,s.useState)(0),pn=fn[0],hn=fn[1],mn=(0,s.useState)(null),vn=mn[0],gn=mn[1],bn=(0,s.useState)(null),xn=bn[0],jn=bn[1],yn=(0,s.useState)(q),kn=yn[0],Zn=yn[1],_n=(0,s.useState)(Tt[0]),On=_n[0],Cn=_n[1],Sn=k.qL.STREAMING===(null===ie||void 0===ie?void 0:ie.type),wn=v.tf.DBT===(null===j||void 0===j?void 0:j.type),In=v.t6.SQL===(null===j||void 0===j?void 0:j.language),Tn=v.t6.R===(null===j||void 0===j?void 0:j.language),An=(0,s.useMemo)((function(){var e;return(null===j||void 0===j||null===(e=j.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[j]),Rn=(0,s.useMemo)((function(){return An.projects||{}}),[An]),Dn=(0,s.useMemo)((function(){return An.project||Ye.dbt_project_name}),[Ye,An]),Mn=(0,s.useMemo)((function(){return Rn[Dn]||{target:null,targets:[]}}),[Dn,Rn]),Nn=(0,s.useMemo)((function(){return Mn.targets||[]}),[Mn]),Ln=(0,s.useMemo)((function(){return Ye.dbt_profile_target}),[Ye]),Fn=(0,s.useState)(Ln&&!(null!==Nn&&void 0!==Nn&&Nn.includes(Ln))),Un=Fn[0],Hn=Fn[1],zn=j.callback_content,Wn=j.has_callback,Gn=(0,s.useState)(zn),Vn=Gn[0],qn=Gn[1];(0,s.useEffect)((function(){zn!==Vn&&qn(zn)}),[Vn,zn]);var Yn=(0,xt.Z)(j);(0,s.useEffect)((function(){if(JSON.stringify(j)!=JSON.stringify(Yn)){var e,n=Dt([j]).messages,t=null===n||void 0===n||null===(e=n[null===j||void 0===j?void 0:j.type])||void 0===e?void 0:e[null===j||void 0===j?void 0:j.uuid];(null===t||void 0===t?void 0:t.length)>=1&&Zn(t)}}),[j,Yn,Zn]);var Kn=(0,xt.Z)(q);(0,s.useEffect)((function(){"undefined"!==typeof q&&q.length!==(null===Kn||void 0===Kn?void 0:Kn.length)&&Zn(q)}),[q,Kn,Zn]);var Xn=(0,s.useMemo)((function(){var e=new Set;return null===T||void 0===T||T.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,r.Z)(e),(0,r.Z)(t)))})),(0,r.Z)(e)}),[T]),Jn=(0,s.useMemo)((function(){return"".concat(null===ie||void 0===ie?void 0:ie.uuid,"/").concat(null===j||void 0===j?void 0:j.uuid,"/codeCollapsed")}),[null===ie||void 0===ie?void 0:ie.uuid,null===j||void 0===j?void 0:j.uuid]),$n=(0,s.useMemo)((function(){return"".concat(null===ie||void 0===ie?void 0:ie.uuid,"/").concat(null===j||void 0===j?void 0:j.uuid,"/outputCollapsed")}),[null===ie||void 0===ie?void 0:ie.uuid,null===j||void 0===j?void 0:j.uuid]);(0,s.useEffect)((function(){Le((0,S.U2)(Jn,!1)),dn((0,S.U2)($n,!1))}),[Jn,$n]);var et=(0,s.useRef)(null),nt=(0,s.useMemo)((function(){return(0,ee.HK)(I,(function(e){return e.uuid}))}),[I]),tt=(0,s.useMemo)((function(){return!(null===_e||void 0===_e||!_e.find((function(e){return e.upstream_blocks.includes(j.uuid)})))}),[j,_e]),it=(0,s.useCallback)((function(e){var n=e||{},t=n.block,i=n.code,r=n.disableReset,o=n.runDownstream,l=n.runSettings,c=n.runUpstream,u=n.runTests;if(null===u||"undefined"===typeof u){var a=(t||{}).type;u=[v.tf.DATA_LOADER,v.tf.DATA_EXPORTER,v.tf.TRANSFORMER].includes(a)}wn&&wt!==On&&Cn(wt),re({block:t,code:i||Fe,runDownstream:o||tt,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(hn(1+Number(pn)),gn(null),dn(!1))}),[Fe,tt,wn,re,pn,On,hn,gn,Cn]),rt=!(null===oe||void 0===oe||!oe.find((function(e){return e.uuid===j.uuid})))||(null===kn||void 0===kn?void 0:kn.length)>=1&&M!==Pn.uF.IDLE;(0,s.useEffect)((function(){rt&&jn(Number(new Date))}),[rt,jn]);var ot=(0,xt.Z)(M);(0,s.useEffect)((function(){M===Pn.uF.IDLE&&M!==ot&&gn(Number(new Date))}),[M,ot,gn]);var lt=(0,s.useCallback)((function(e){var n=e.editorRect.top,t=e.position.lineNumberTop;if(null!==G&&void 0!==G&&G.current){var i=G.current.getBoundingClientRect().height;if(n+t>i){var r=G.current.scrollTop+(t-i+n);G.current.scrollTo(0,r)}else if(t+n<or.aU){var o=G.current.scrollTop+(t+n-or.aU);G.current.scrollTo(0,o)}}}),[G]),at=(0,s.useMemo)((function(){return(null===Je||void 0===Je?void 0:Je.length)>=0?Je.map((function(e){return{data:e,execution_state:Pn.uF.IDLE,type:Pn.Gi.TEXT_PLAIN}})):kn.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[Je,kn]),st=!!at.find((function(e){return e.error})),ht=(0,ce.qn)(j.type,{blockColor:j.color,theme:Oe}).accent,mt=(null===j||void 0===j||null===(i=j.upstream_blocks)||void 0===i?void 0:i.length)||0,vt=(0,ar.cU)([j],I)[0],gt=vt.dynamic,jt=vt.dynamicUpstreamBlock,yt=vt.reduceOutput,kt=vt.reduceOutputUpstreamBlock,Zt=(0,s.useMemo)((function(){var e=[];gt&&e.push({title:"Dynamic",description:"This block will create N blocks for each of its downstream blocks."});var n=jt&&!kt;return n&&(e.push({title:"Dynamic child",description:"This block is dynamically created by its upstream parent block that is dynamic."}),yt&&e.push({title:"Reduce output",description:"Reduce output from all dynamically created blocks into a single array output."})),{borderColorShareProps:{blockColor:null===j||void 0===j?void 0:j.color,blockType:null===j||void 0===j?void 0:j.type,dynamicBlock:gt,dynamicChildBlock:n,hasError:st,selected:ae},tags:e}}),[null===j||void 0===j?void 0:j.color,null===j||void 0===j?void 0:j.type,gt,jt,st,yt,kt,ae]),_t=Zt.borderColorShareProps,Ot=Zt.tags,Ct=at.length>=1,Et=(0,s.useCallback)((function(){ae||(null===de||void 0===de||de(!1),null===ge||void 0===ge||ge(!0))}),[ae,de,ge]),St=be.ZP.blocks.pipelines.detail(null===ie||void 0===ie?void 0:ie.uuid,It.uuid===(null===On||void 0===On?void 0:On.uuid)||Pt.uuid===(null===On||void 0===On?void 0:On.uuid)?encodeURIComponent(null===j||void 0===j?void 0:j.uuid):null,{_format:"dbt"},{revalidateOnFocus:!0}),At=St.data,Rt=St.mutate,Mt=(0,s.useMemo)((function(){var e;return(null===At||void 0===At||null===(e=At.block)||void 0===e?void 0:e.metadata)||{}}),[At]),Nt=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===ie||void 0===ie?void 0:ie.uuid,j.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){tn(!1),U(),F(),Ue(Fe)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){var n=(0,je.qQ)(e).messages;$e(n)}}),Lt=(0,l.Z)(Nt,1)[0],Bt="CodeBlock/".concat(j.uuid),Ft=(0,Qe.y)(),Ut=Ft.registerOnKeyDown,zt=Ft.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){zt(Bt)}}),[zt,Bt]),Ut(Bt,(function(e,n,t){nn&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)?j.uuid===on?e.target.blur():Lt({block:dr(dr({},j),{},{name:on})}):ae&&!z&&((0,w.y)([C.zX,C.Uq],n)||(0,w.y)([C.PQ,C.Uq],n)?it({block:j}):(0,w.y)([C.XR,C.Uq],n)&&f&&(e.preventDefault(),f({language:j.language,type:j.type,upstream_blocks:[j.uuid]}),it({block:j})))}),[f,j,z,nn,on,it,ae,Lt]),(0,s.useEffect)((function(){var e;return xn&&(e=setInterval((function(){return Ge(Number(new Date))}),1e3)),function(){return clearInterval(e)}}),[xn]);var Wt=(0,s.useCallback)((function(e){return(0,o.Z)({},v.tf.SCRATCHPAD,(0,r.Z)(Hi(e,I,"block_menu/scratchpad",f)).map((function(e){return dr(dr({},e),{},{onClick:function(){return le().then((function(){return e.onClick()}))}})})))[e.type]}),[f,I,le]),Gt=(0,s.useMemo)((function(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:Ie,block:j,height:H,language:j.language,onChange:function(e){Ue(e),null===J||void 0===J||J(e)},onDidChangeCursorPosition:lt,placeholder:v.tf.DBT===j.type&&v.t6.YAML===j.language?"e.g. --select ".concat(Dn||"project","/models --exclude ").concat(Dn||"project","/models/some_dir"):"Start typing here...",selected:ae,setSelected:ge,setTextareaFocused:ke,shortcuts:[function(e,n){return(0,lr.Q)(e,(function(){z||it({block:j,code:n.getValue()})}))}],textareaFocused:Ze,value:Fe,width:"100%"}),Wn&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(bt.Z,{}),(0,P.jsxs)(Z.Z,{mt:1,children:[(0,P.jsxs)(ce.y9,{children:[(0,P.jsx)(_.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:Ie,language:"python",onChange:function(e){qn(e),null===K||void 0===K||K(e)},onDidChangeCursorPosition:lt,placeholder:"Start typing here...",selected:ae,setSelected:ge,setTextareaFocused:ke,textareaFocused:Ze,value:Vn,width:"100%"})]})]})]})}),[Ie,j,Vn,Fe,Dn,Wn,H,z,K,J,lt,it,ae,Ue,ge,ke,Ze]);(0,s.useEffect)((function(){Te({python:rr({autocompleteItems:m,block:j,blocks:I,pipeline:ie})})}),[m,j,I,ie]);var Vt=(0,s.useMemo)((function(){return wn?(0,P.jsx)(Z.Z,{py:1,children:(0,P.jsx)(pt.Z,{onClickTab:function(e){Cn(e),It.uuid!==e.uuid&&Pt.uuid!==e.uuid||Rt()},selectedTabUUID:null===On||void 0===On?void 0:On.uuid,small:!0,tabs:Tt})}):null}),[Rt,wn,On]),Qt=(0,s.useMemo)((function(){return(0,P.jsx)(Ht,dr(dr({},_t),{},{block:j,blockMetadata:Mt,buttonTabs:Vt,collapsed:sn,hasOutput:Ct,isInProgress:rt,mainContainerWidth:V,messages:at,openSidekickView:te,pipeline:ie,runCount:pn,runEndTime:vn,runStartTime:xn,selected:ae,selectedTab:On,setCollapsed:function(e){dn((function(){return(0,S.t8)($n,e),e}))},setOutputBlocks:me,setSelectedOutputBlock:ye,setSelectedTab:Cn}))}),[j,Mt,_t,Vt,Ct,rt,V,at,te,sn,$n,ie,pn,vn,xn,ae,On,me,dn,ye]),qt=(0,s.useCallback)((function(){return De(!1)}),[]),Yt=(0,s.useRef)(null),Kt=(0,s.useCallback)((function(e){clearTimeout(Yt.current),Ke((function(n){return dr(dr({},n),e)})),Yt.current=setTimeout((function(){var n=dr(dr({},Ye),e);("undefined"!==typeof n.data_provider&&"undefined"!==n.data_provider_profile||"undefined"!==typeof n.dbt_profile_target||"undefined"!==typeof n.dbt_project_name||"undefined"!==typeof n.limit)&&le({block:{configuration:n,uuid:j.uuid}})}),1e3)}),[j,Ye,le]),Xt=Qn.BIGQUERY===Ye.data_provider||Qn.SNOWFLAKE===Ye.data_provider,Jt=(0,s.useMemo)((function(){return(null===I||void 0===I?void 0:I.length)||0}),[I]);return(0,P.jsxs)("div",{ref:n,style:{position:"relative",zIndex:y===p?Jt+9:null},children:[(0,P.jsxs)("div",{style:{position:"relative"},children:[(0,P.jsx)(ce.nz,dr(dr({},_t),{},{onClick:function(){return Et()},zIndex:Jt+1-(y||0),children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",flex:1,children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(ft.Z,{children:v.dO[j.language]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(B.Z,{color:ht,size:1.5*$.iI,square:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(Bn.Z,{items:Wt(j),onClickCallback:qt,onClickOutside:qt,open:Re,parentRef:et,uuid:"CodeBlock/block_menu",children:(0,P.jsx)(_.ZP,{color:ht,monospace:!0,children:null===(c=wn?v.tf.DBT:v.V4[j.type])||void 0===c?void 0:c.toUpperCase()})}),v.tf.SCRATCHPAD===j.type&&(0,P.jsxs)(P.Fragment,{children:["\xa0",(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return De(!0)},transparent:!0,children:(0,P.jsx)(X.K5,{muted:!0})})]}),(0,P.jsx)(Z.Z,{mr:1})]}),(0,P.jsx)(Z.Z,{mr:$.cd}),(0,P.jsx)(X.iU,{size:1.5*$.iI}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[wn&&v.t6.YAML!==j.language&&(0,P.jsx)(cn.Z,{block:!0,label:(0,cr.$)(j,{fullPath:!0}),size:null,children:(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:(0,cr.$)(j)})}),(!wn||v.t6.YAML===j.language)&&(0,P.jsx)(En,{bold:!1,inputValue:on,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){de(!1),tn(!1)}),300)},onChange:function(e){un(e.target.value),e.preventDefault()},onClick:function(){de(!0),tn(!0)},onFocus:function(){de(!0),tn(!0)},stacked:!0,value:!nn&&j.uuid}),nn&&!wn&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(ln.Z,{onClick:function(){return le({block:{name:on,uuid:j.uuid}}).then((function(){tn(!1),U(),F()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,P.jsx)(Z.Z,{mr:2}),!v.iZ.includes(j.type)&&(0,P.jsx)(cn.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,ue._6)("parent block",mt),". ").concat(0===mt?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:mt>=1,children:(0,P.jsx)(g.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){var e;ge(!0),pe({upstreamBlocks:{block:j,values:null===(e=j.upstream_blocks)||void 0===e?void 0:e.map((function(e){return{uuid:e}}))}})},children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsxs)(_.ZP,{monospace:mt>=1,small:mt>=1,underline:0===mt,children:[0===mt&&"Edit parent blocks",mt>=1&&(0,ue._6)("parent block",mt)]}),(0,P.jsx)(Z.Z,{mr:1}),0===mt&&(0,P.jsx)(X.Jj,{size:3*$.iI}),mt>=1&&(0,P.jsx)(X.eV,{size:3*$.iI})]})})})]}),(0,P.jsx)(Qi,{addNewBlock:f,addWidget:h,block:j,blocks:I,deleteBlock:D,executionState:M,fetchFileTree:F,fetchPipeline:U,interruptKernel:W,pipeline:ie,runBlock:z?null:it,savePipelineContent:le,setErrors:he,setOutputCollapsed:dn,visible:ae||rt}),(0,P.jsx)(Z.Z,{px:1,children:(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){Le((function(e){return(0,S.t8)(Jn,!e),!e})),Ne||dn((function(){return(0,S.t8)($n,!0),!0}))},transparent:!0,children:Ne?(0,P.jsx)(X._M,{muted:!0,size:2*$.iI}):(0,P.jsx)(X.Kh,{muted:!0,size:2*$.iI})})})]})})),(0,P.jsxs)(ce.Nk,{onClick:function(){return Et()},children:[(0,P.jsxs)(ce.jv,dr(dr({},_t),{},{className:ae&&Ze?"selected":null,hasOutput:!!Vt||Ct,children:[v.tf.DBT===j.type&&!Ne&&(0,P.jsxs)(ce.y9,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[v.t6.YAML===j.language&&(0,P.jsxs)(Xi.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){var n;Kt((n={},(0,o.Z)(n,ui,""),(0,o.Z)(n,ci,e.target.value),n)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},placeholder:"Project",small:!0,value:Ye.dbt_project_name||"",children:[(0,P.jsx)("option",{value:""}),Object.keys(Rn||{}).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),v.t6.YAML!==j.language&&(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:Dn}),(0,P.jsx)(Z.Z,{mr:2}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,P.jsx)("span",{children:"\xa0"}),!Un&&(0,P.jsxs)(Xi.Z,{compact:!0,disabled:!Dn,monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},ui,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},placeholder:Dn?In?null===Mn||void 0===Mn?void 0:Mn.target:null:"Select project first",small:!0,value:Ln||"",children:[(0,P.jsx)("option",{value:""}),null===Nn||void 0===Nn?void 0:Nn.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),Un&&(0,P.jsx)(O.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},ui,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},placeholder:Dn?In?null===Mn||void 0===Mn?void 0:Mn.target:null:"Select project first",small:!0,value:Ln||"",width:21*$.iI}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(cn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["Manually type the name of the target you want to use in the profile.",(0,P.jsx)("br",{}),"Interpolate environment variables and global variables using the following syntax:",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ env_var('NAME') }}"})," or ",(0,P.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ variables('NAME') }}"})]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(b.Z,{checked:Un,label:(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Manually enter target"}),onClick:function(e){(0,ur.j)(e),Hn(!Un)}}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(X.kI,{muted:!0})]})})})]}),v.t6.YAML!==j.language&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned when running this block in the notebook.",(0,P.jsx)("br",{}),"This limit won\u2019t affect the number of results returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.kI,{muted:!0}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,P.jsx)("span",{children:"\xa0"})]})}),(0,P.jsx)(O.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},si,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},small:!0,type:"number",value:Ye.limit||"",width:10*$.iI}),(0,P.jsx)(Z.Z,{mr:5})]})]}),v.t6.YAML===j.language&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsxs)(He.Z,{flex:1,children:[(0,P.jsxs)(_.ZP,{monospace:!0,default:!0,small:!0,children:["dbt run ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["(paths start from ",(null===Ye||void 0===Ye?void 0:Ye.dbt_project_name)||"project"," folder)"]})]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:(0,P.jsx)(ln.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,P.jsx)(Z.Z,{mr:5})]})})]}),In&&!Ne&&v.tf.DBT!==j.type&&(0,P.jsx)(ce.y9,{children:(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(Xi.Z,{compact:!0,label:"Connection",onChange:function(e){return Kt((0,o.Z)({},ti,e.target.value))},onClick:ur.j,small:!0,value:Ye.data_provider,children:[(0,P.jsx)("option",{value:""}),null===T||void 0===T?void 0:T.map((function(e){var n=e.id,t=e.value;return(0,P.jsx)("option",{value:t,children:n},n)}))]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(Xi.Z,{compact:!0,label:"Profile",onChange:function(e){return Kt((0,o.Z)({},ri,e.target.value))},onClick:ur.j,small:!0,value:Ye.data_provider_profile,children:[(0,P.jsx)("option",{value:""}),null===Xn||void 0===Xn?void 0:Xn.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(cn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,P.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,P.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,P.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(b.Z,{checked:Ye.use_raw_sql,label:(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,ur.j)(e),Kt((0,o.Z)({},di,!Ye.use_raw_sql))}}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(X.kI,{muted:!0})]})})}),!Ye.use_raw_sql&&(0,P.jsxs)(P.Fragment,{children:[Xt&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},ii,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},small:!0,value:Ye.data_provider_database,width:10*$.iI})})]}),(0,P.jsx)(Z.Z,{mr:1}),Ye.data_provider!==qi.MYSQL&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(cn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,P.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},oi,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},small:!0,value:Ye.data_provider_schema,width:10*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1})]}),(0,P.jsx)(cn.Z,{block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,P.jsx)("br",{}),"If blank, the default table name will be:",(0,P.jsx)("br",{}),(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[null===ie||void 0===ie?void 0:ie.uuid,"_",null===j||void 0===j?void 0:j.uuid]}),(0,P.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(O.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){de(!1)}),300)},onChange:function(e){Kt((0,o.Z)({},li,e.target.value)),e.preventDefault()},onClick:ur.j,onFocus:function(){de(!0)},small:!0,value:Ye.data_provider_table,width:20*$.iI})})})]})]}),!Ye.use_raw_sql&&(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(cn.Z,{appearBefore:!0,block:!0,description:(0,P.jsxs)(_.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",Xt?" database,":""," schema, and table name?",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,P.jsx)("br",{}),(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(X.kI,{muted:!0}),(0,P.jsx)("span",{children:"\xa0"}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,P.jsx)("span",{children:"\xa0"})]})}),(0,P.jsxs)(Xi.Z,{compact:!0,label:"strategy",onChange:function(e){return Kt((0,o.Z)({},ai,e.target.value))},onClick:ur.j,small:!0,value:Ye.export_write_policy,children:[(0,P.jsx)("option",{value:""}),null===Yi||void 0===Yi?void 0:Yi.map((function(e){return(0,P.jsx)("option",{value:e,children:(0,ue.kC)(e)},e)}))]}),(0,P.jsx)(Z.Z,{mr:5})]})]})}),Ot.length>=1&&(0,P.jsx)(ce.y9,{normalPadding:!0,children:(0,P.jsx)(x.Z,{children:Ot.map((function(e,n){var t=e.description,i=e.title;return(0,P.jsx)(Z.Z,{ml:n>=1?1:0,children:(0,P.jsx)(cn.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,P.jsx)(ft.Z,{children:i})})},i)}))})}),j.upstream_blocks.length>=1&&!Ne&&v.f2.includes(j.type)&&!Sn&&(0,P.jsxs)(ce.y9,{children:[(0,P.jsx)(Z.Z,{mr:5,children:(0,P.jsxs)(_.ZP,{small:!0,children:[!In&&"Positional arguments for ".concat(Tn?"":"decorated ","function:"),In&&'The interpolated tables below are available in queries from upstream blocks. For example, you can use the query "SELECT * FROM {{ df_1 }}" to insert all the rows from an upstream block into the designated database table.']})}),(0,P.jsxs)(Z.Z,{mt:1,children:[!In&&!Tn&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===j.type&&"@data_exporter",v.tf.DATA_LOADER===j.type&&"@data_loader",v.tf.TRANSFORMER===j.type&&"@transformer",v.tf.CUSTOM===j.type&&"@custom"]}),(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(v.tf.DATA_EXPORTER===j.type?"export_data":v.tf.DATA_LOADER===j.type&&"load_data")||v.tf.TRANSFORMER===j.type&&"transform"||v.tf.CUSTOM===j.type&&"transform_custom","(",j.upstream_blocks.map((function(e,n){return n>=1?"data_".concat(n+1):"data"})).join(", "),"):"]})]}),Tn&&(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===j.type?"export_data":v.tf.TRANSFORMER===j.type&&"transform","\xa0\u2190 function(",j.upstream_blocks.map((function(e,n){return"df_".concat(n+1)})).join(", "),"):"]})}),j.upstream_blocks.map((function(e,n){var t=nt[e],i=(0,ce.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:Oe}).accent,r="{{ df_".concat(n+1," }}");return(0,P.jsxs)("div",{children:[!In&&!Tn&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0data",n>=1?"_".concat(n+1):null]}),In&&(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:r}),Tn&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0","df".concat(n+1)]})," ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,P.jsx)(ln.Z,{color:i,onClick:function(){var e,n,i=null===E||void 0===E||null===(e=E.current)||void 0===e?void 0:e["".concat(null===t||void 0===t?void 0:t.type,"s/").concat(null===t||void 0===t?void 0:t.uuid,".py")];null===i||void 0===i||null===(n=i.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,P.jsx)(_.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!(null!==j&&void 0!==j&&j.error)&&(0,P.jsx)(P.Fragment,{children:Ne?(0,P.jsx)(Z.Z,{px:1,children:(0,P.jsxs)(_.ZP,{monospace:!0,muted:!0,children:["(",(0,ue._6)("line",null===Fe||void 0===Fe?void 0:Fe.split(/\r\n|\r|\n/).length)," collapsed)"]})}):Gt}),L&&s.cloneElement(L,{runBlockAndTrack:it}),(null===j||void 0===j?void 0:j.error)&&(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(_.ZP,{bold:!0,danger:!0,children:null===j||void 0===j||null===(u=j.error)||void 0===u?void 0:u.error}),(0,P.jsx)(_.ZP,{muted:!0,children:null===j||void 0===j||null===(a=j.error)||void 0===a?void 0:a.message})]}),rt&&We&&We>xn&&(0,P.jsx)(ce.HC,{children:(0,P.jsxs)(_.ZP,{muted:!0,children:["".concat(Math.round((We-xn)/1e3)),"s"]})})]})),Qt]})]}),!Y&&(0,P.jsxs)(ce.gE,{additionalZIndex:Jt-y,onMouseEnter:function(){return we(!0)},onMouseLeave:function(){we(!1),null===se||void 0===se||se(null)},children:[Se&&f&&(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(dt,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=Ui(j,e);return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(j.type)&&v.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(ie.uuid,"', '").concat(j.uuid,"', 'output_0')")),n=ut(e,n),v.t6.SQL===j.language&&(t=dr(dr({},(0,xe.GL)(j.configuration,[ti,ii,ri,oi,ai])),t)),v.t6.SQL===e.language&&(n=ct(n)),f(dr(dr({},e),{},{configuration:t,content:n,upstream_blocks:i}))},blockIdx:y,compact:!0,hideCustom:Sn,hideDbt:Sn,onClickAddSingleDBTModel:ne,pipeline:ie,setAddNewBlockMenuOpenIdx:se,setCreatingNewDBTModel:fe,setRecsWindowOpenBlockIdx:ve})}),(0,P.jsx)(ce.t1,{className:"block-divider-inner"})]})]})}var pr=s.forwardRef(fr),hr=t(90880),mr=6.25*$.iI,vr=($.iI,100*$.iI),gr=N.default.div.withConfig({displayName:"indexstyle__WindowContainerStyle",componentId:"sc-g0cszf-0"})(["border-radius:","px;width:100%;max-width:","px;z-index:101;position:absolute;overflow:hidden;top:50%;left:50%;transform:translate(-50%,-50%);",""],Ce.n_,vr,(function(e){return"\n box-shadow: ".concat((e.theme||Oe.Z).shadow.window,";\n background-color: ").concat((e.theme||Oe.Z).background.panel,";\n ")})),br=(0,N.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],mr,$.iI,$.cd*$.iI,(function(e){return"\n background-color: ".concat((e.theme||Oe.Z).background.output,";\n ")})),xr=N.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],br,Ce.n_,Ce.n_,(function(e){return"\n border-bottom: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")})),jr=N.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],$.iI,an.w5,(0,hr.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*$.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*mr,"px);\n ")})),yr=N.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],br,Ce.n_,Ce.n_,(function(e){return"\n border-top: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")})),kr=N.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*$.iI,2*$.iI,(function(e){return"\n border-bottom: ".concat(Ce.YF,"px ").concat(Ce.M8," ").concat((e.theme||Oe.Z).borders.medium,";\n ")}));function Zr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function _r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Zr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Or,Cr,Er,Sr,wr=function(e){var n=e.blocks,t=e.creatingNewDBTModel,i=e.dbtModelName,r=e.files,o=e.onClose,l=e.onOpenFile,c=e.setDbtModelName,u=(0,s.useState)(!1),a=u[0],d=u[1],f=(0,s.useState)(null),p=f[0],h=f[1],m=(0,s.useMemo)((function(){var e,n,t=null===(e=(0,ee.sE)((null===r||void 0===r||null===(n=r[0])||void 0===n?void 0:n.children)||[],(function(e){return"dbt"===e.name})))||void 0===e?void 0:e.children,i=[];return null===t||void 0===t||t.forEach((function(e){var n=e.children,t=(void 0===n?[]:n).filter((function(e){return"models"===e.name}));t.length>=1&&i.push(_r(_r({},e),{},{children:t}))})),i}),[r]),b=(0,s.useMemo)((function(){return(0,ee.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,P.jsxs)(gr,{children:[(0,P.jsxs)(xr,{children:[(0,P.jsx)(He.Z,{alignItems:"center",children:(0,P.jsx)(_.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new DBT model":"Select DBT model file"})}),(0,P.jsx)(g.Z,{iconOnly:!0,onClick:o,children:(0,P.jsx)(X.x8,{muted:!0})})]}),t&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(kr,{children:(0,P.jsx)(En,{inputValue:i,label:"Model name (cannot be changed):",labelColor:Oe.Z.accent.dbt,minWidth:38*$.iI,notRequired:!0,onBlur:function(){d(!1)},onChange:function(e){c(e.target.value),e.preventDefault()},onClick:function(){d(!0)},onFocus:function(){d(!0)},placeholder:"Enter name",required:!0,stacked:!0,value:!a&&i})}),(0,P.jsxs)(kr,{children:[(0,P.jsx)(_.ZP,{bold:!0,color:Oe.Z.accent.dbt,children:"Select folder location:"}),(0,P.jsx)(_.ZP,{bold:!0,muted:!p,children:p?"dbt/".concat(p):"Choose folder below"})]})]}),(0,P.jsx)(jr,{children:(0,P.jsx)(Ue,{allowSelectingFolders:t,disableContextMenu:!0,files:m,isFileDisabled:function(e,n){return t?!n||(null===n||void 0===n?void 0:n.some((function(e){return"models"===(null===e||void 0===e?void 0:e.name)}))):!!b[e]||!(null!==n&&void 0!==n&&n.length)&&!e.match(new RegExp(".".concat(v.t6.SQL,"$")))},openFile:l,selectFile:h,uncollapsed:!0,useRootFolder:!0})}),t&&(0,P.jsx)(yr,{children:(0,P.jsx)(g.Z,{backgroundColor:i&&p?Oe.Z.accent.dbt:Oe.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})},Pr=t(4804),Ir=t(65730),Tr=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(Cr||(Cr={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(Er||(Er={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(Sr||(Sr={}));var Ar,Rr="datetime",Dr=(Or={},(0,o.Z)(Or,Sr.DATE_TIME,Rr),(0,o.Z)(Or,Sr.UUID,Sr.UUID),Or);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(Ar||(Ar={}));var Mr,Nr,Lr,Br,Fr,Ur=[Ar.ARRAY,Ar.BOOLEAN,Rr,Ar.INTEGER,Ar.NULL,Ar.NUMBER,Ar.OBJECT,Ar.STRING,Sr.UUID];!function(e){e.PROPERTIES="properties"}(Mr||(Mr={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(Nr||(Nr={})),function(e){e.FORCED_REPLICATION_METHOD="forced-replication-method",e.KEY_PROPERTIES="table-key-properties",e.REPLICATION_KEYS="valid-replication-keys",e.SCHEMA_NAME="schema-name"}(Lr||(Lr={})),function(e){e.AMPLITUDE="amplitude",e.BIGQUERY="bigquery",e.CHARGEBEE="chargebee",e.GOOGLE_ADS="google_ads",e.GOOGLE_SEARCH_CONSOLE="google_search_console",e.GOOGLE_SHEETS="google_sheets",e.INTERCOM="intercom",e.MYSQL="mysql",e.PIPEDRIVE="pipedrive",e.POSTGRESQL="postgresql",e.REDSHIFT="redshift",e.SALESFORCE="salesforce",e.STRIPE="stripe"}(Br||(Br={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(Fr||(Fr={}));var Hr=t(31012),zr=N.default.div.withConfig({displayName:"Chip__ChipStyle",componentId:"sc-1ok73g-0"})(["display:inline-block;"," "," "," "," ",""],(function(e){return!e.primary&&"\n background-color: ".concat((e.theme.background||Oe.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||Oe.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat(($.iI+Hr.Al)/2,"px;\n height: ").concat(1.5*$.iI+Hr.Al,"px;\n padding: ").concat($.iI/1.5,"px ").concat(1.25*$.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat(($.iI/2+Hr.Al)/2,"px;\n height: ").concat(Hr.Al+$.iI/2+2,"px;\n padding: ").concat($.iI/4,"px ").concat($.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||Oe.Z.content).muted,";\n ")})),Wr=function(e){var n=e.border,t=e.children,i=e.label,r=e.onClick,o=e.primary,l=e.small;return(0,P.jsx)(zr,{border:n,primary:o,small:l,children:(0,P.jsx)(g.Z,{basic:!0,noPadding:!0,noBackground:!0,onClick:r,transparent:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[t,i&&(0,P.jsx)(_.ZP,{small:l,children:i}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(X.x8,{default:o,muted:!o,size:l?$.iI:1.25*$.iI})]})})})},Gr=t(70902),Vr=t(85307);function Qr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function qr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Qr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Yr="4px",Kr=[Fr.BIGQUERY,Fr.DELTA_LAKE_S3];var Xr=function(e){var n=e.bookmarkValues,t=e.destination,i=e.isLoadingLoadSampleData,r=e.isLoadingUpdateDestinationBlockState,c=e.loadSampleData,u=e.source,a=e.stream,d=e.streams,f=e.updateAllStreams,p=e.updateDestinationBlockState,h=e.updateMetadataForColumns,m=e.updateSchemaProperty,v=e.updateStream,j=(0,s.useRef)(null),k=a.bookmark_properties,C=a.destination_table,E=void 0===C?"":C,S=a.key_properties,w=a.metadata,I=a.partition_keys,T=a.replication_method,A=a.schema.properties,R=a.tap_stream_id,D=a.unique_constraints,M=a.unique_conflict_method,N=(0,s.useState)(E),L=N[0],B=N[1],F=(0,s.useState)(!1),U=F[0],H=F[1],z=(0,s.useState)(null),W=z[0],G=z[1],V=(0,s.useState)(!1),Q=V[0],q=V[1],Y=(0,s.useState)((0,o.Z)({},R,n||{})),K=Y[0],X=Y[1],J=(0,xt.Z)(R);(0,s.useEffect)((function(){J!==R&&(B(E),G(null))}),[E,T,R,J,M]),(0,s.useEffect)((function(){var e=null===K||void 0===K?void 0:K[R];(null===k||void 0===k?void 0:k.length)>0&&((0,xe.Qr)(e)||!(0,xe.Xy)(n,e))&&X((function(e){return qr(qr({},e),{},(0,o.Z)({},R,n))}))}),[null===k||void 0===k?void 0:k.length,n,R]);var ne=(0,s.useMemo)((function(){return(0,ee.HK)(w,(function(e){return e.breadcrumb.join("/")}))}),[w]),te=(0,s.useMemo)((function(){var e;return null===(e=(0,ee.sE)(w,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[w]),ie=(0,s.useMemo)((function(){return te[Lr.KEY_PROPERTIES]||[]}),[te]),re=(0,s.useMemo)((function(){return te[Lr.REPLICATION_KEYS]||[]}),[te]),oe=Kr.includes(t),le=d.length>1,ce=(0,s.useCallback)((function(e){var n=qr({},null===K||void 0===K?void 0:K[R]);n.hasOwnProperty(e)&&delete n[e],X((function(e){return qr(qr({},e),{},(0,o.Z)({},R,qr({},n)))})),p({block:{bookmark_values:n,destination_table:L,tap_stream_id:R}})}),[K,L,R,p]),ae=(0,s.useMemo)((function(){var e=[],n=[],i=(0,ee.mr)(Object.entries(A)).map((function(i,r){var o=(0,l.Z)(i,2),c=o[0],u=o[1],a=u.anyOf,s=void 0===a?[]:a,d=u.format,p=u.type,j=void 0===p?[]:p,y=new Set(Array.isArray(j)?j:[j]),O=new Set(y);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){y.add(e),O.add(e)})):(y.add(t),O.add(t),n&&O.add(n))}));var C=Array.from(y);d&&O.add(d);var E=(ne["properties/".concat(c)]||{}).metadata,w=(E.inclusion,E.selected);e.push(w),n.push(c);var T=Ur.reduce((function(e,n){return C.indexOf(n)>=0||Rr===String(n)&&Sr.DATE_TIME===d||Sr.UUID===String(n)&&Sr.UUID===d?e:e.concat((0,P.jsx)("option",{value:n,children:n},n))}),[]),A=C.findIndex((function(e){return e===Ar.STRING})),M=[(0,P.jsx)(b.Z,{checked:w,onClick:function(){h(R,[c],{selected:!w})}},"".concat(R,"/").concat(c,"/selected")),(0,P.jsx)(_.ZP,{children:c},"".concat(R,"/").concat(c,"/name")),(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(He.Z,{flex:1,children:(0,P.jsx)(x.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:C.map((function(e,n){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Wr,{border:!0,label:d&&Ar.STRING===e&&A===n?Dr[d]:e,onClick:function(){var n={format:d,type:C.filter((function(n){return n!==e}))};Sr.DATE_TIME!==d&&Sr.UUID!==d||Ar.STRING!==e||(n.format=null),m(R,c,n)},small:!0})},"".concat(R,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),T.length>=1&&(0,P.jsxs)(Xi.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:C};Rr===String(n)?(t.format=Sr.DATE_TIME,t.type.push(Ar.STRING)):Sr.UUID===String(n)?(t.format=Sr.UUID,t.type.push(Ar.STRING)):t.type.push(n),m(R,c,t)},primary:!0,small:!0,value:"",width:10*$.iI,children:[(0,P.jsx)("option",{value:""}),T]})]},"".concat(R,"/").concat(c,"/type")),(0,P.jsx)(b.Z,{checked:!(null===D||void 0===D||!D.includes(c)),disabled:ie.length>=1&&!ie.includes(c),onClick:ie.length>=1&&!ie.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,ee.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(R,"/").concat(c,"/unique")),(0,P.jsx)(b.Z,{checked:!(null===k||void 0===k||!k.includes(c)),disabled:re.length>=1&&!re.includes(c),onClick:re.length>=1&&!re.includes(c)?null:function(){return v(R,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(ce(c),e.bookmark_properties=(0,ee.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(R,"/").concat(c,"/bookmark")),(0,P.jsx)(b.Z,{checked:!(null===S||void 0===S||!S.includes(c)),onClick:function(){return v(R,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,ee.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(R,"/").concat(c,"/key_property"))];if(oe){var N=t!==Fr.DELTA_LAKE_S3,L=N&&(ie.includes(c)||!O.has(Sr.DATE_TIME));M.push((0,P.jsx)(b.Z,{checked:!(null===I||void 0===I||!I.includes(c)),disabled:L,onClick:L?null:function(){return v(R,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,ee.Od)(e.partition_keys,(function(e){return c===e})):N&&1===(null===(t=e.partition_keys)||void 0===t?void 0:t.length)?e.partition_keys=[c]:e.partition_keys=[c].concat(e.partition_keys||[]);return e}))}},"".concat(R,"/").concat(c,"/partition_key")))}if(le){var B=W===r;M.push((0,P.jsx)(g.Z,{compact:!0,disabled:B,onClick:function(){G(r),setTimeout((function(){return G(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==R&&null!==e&&void 0!==e&&null!==(n=e.schema)&&void 0!==n&&null!==(t=n.properties)&&void 0!==t&&t[c]){var i,r,o,l,u,a,s,f,p;e.schema.properties[c]={format:d||null,type:C};var h=null===(i=(0,ee.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,m=h[Lr.REPLICATION_KEYS]||[],v=h[Lr.KEY_PROPERTIES]||[];null===D||void 0===D||!D.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!v.includes(c)?null!==D&&void 0!==D&&D.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,ee.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===k||void 0===k||!k.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==k&&void 0!==k&&k.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,ee.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===S||void 0===S||!S.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==S&&void 0!==S&&S.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,ee.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===I||void 0===I||!I.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==I&&void 0!==I&&I.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,ee.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return qr({},e)}))},pill:!0,secondary:!0,children:(0,P.jsx)(_.ZP,{success:B,children:B?"Applied!":"Apply"})}))}return M})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,P.jsx)(b.Z,{checked:r,onClick:function(){h(R,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return oe&&(o.push(null),c.push({uuid:"Partition key"})),le&&(o.push(null),c.push({tooltipMessage:"This will apply this individual feature's schema settings to all selected streams that have the same feature. Unique features must be valid key properties in other streams. Bookmark features must be valid replication keys in other streams.",uuid:"All streams"})),(0,P.jsx)(Vr.cl,{children:(0,P.jsx)(_e.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[k,t,le,W,S,ne,I,A,oe,R,D,f,h,m,v,ie,re]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,P.jsx)(Tr.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:R})," schema"]}),(0,P.jsx)(Z.Z,{mb:3,children:(0,P.jsx)(y.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{children:"Destination table name"}),(0,P.jsx)(Z.Z,{ml:Yr}),(0,P.jsx)(cn.Z,{label:(0,P.jsxs)(_.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:R}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(O.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;B(n),clearTimeout(j.current),j.current=setTimeout((function(){v(R,(function(e){return qr(qr({},e),{},{destination_table:n})}))}),300)},value:L||"",width:45*$.iI})]})})}),(0,P.jsx)(Z.Z,{mb:3,children:(0,P.jsx)(y.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{children:"Replication method"}),(0,P.jsx)(Z.Z,{ml:Yr}),(0,P.jsx)(cn.Z,{label:(0,P.jsxs)(_.ZP,{children:["Do you want to synchronize the entire stream (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Cr.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Cr.INCREMENTAL}),")?",u===Br.POSTGRESQL&&(0,P.jsxs)(_.ZP,{children:["Log-based incremental replication (",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Cr.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsxs)(Xi.Z,{compact:!0,onChange:function(e){v(R,(function(n){return qr(qr({},n),{},{replication_method:e.target.value})}))},primary:!0,value:T,children:[(0,P.jsx)("option",{value:""}),Object.values(Cr).filter((function(e){return u===Br.POSTGRESQL||e!==Cr.LOG_BASED})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}),(0,P.jsx)(Z.Z,{ml:3}),(0,P.jsx)(_.ZP,{children:"Unique conflict method"}),(0,P.jsx)(Z.Z,{ml:Yr}),(0,P.jsx)(cn.Z,{label:(0,P.jsxs)(_.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,ue._6)("column",null===D||void 0===D?void 0:D.length),(null===D||void 0===D?void 0:D.length)>0&&(0,P.jsx)(P.Fragment,{children:"\xa0"}),null===D||void 0===D?void 0:D.sort().map((function(e,n){return(0,P.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===D||void 0===D?void 0:D.length)&&n===(null===D||void 0===D?void 0:D.length)-1?(0,P.jsx)(_.ZP,{inline:!0,children:" and "},e):n>=1&&(0,P.jsx)(P.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Er.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Er.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsxs)(Xi.Z,{compact:!0,inputWidth:11*$.iI,onChange:function(e){v(R,(function(n){return qr(qr({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:M,children:[(0,P.jsx)("option",{value:""}),(0,P.jsx)("option",{value:Er.IGNORE,children:Er.IGNORE}),(0,P.jsx)("option",{value:Er.UPDATE,children:Er.UPDATE})]})]}),le&&(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(_.ZP,{default:!0,children:"All streams"}),(0,P.jsx)(Z.Z,{ml:Yr}),(0,P.jsx)(cn.Z,{appearBefore:!0,label:(0,P.jsx)(_.ZP,{children:"This will apply this stream's replication method and unique conflict method settings to all selected streams."}),lightBackground:!0,primary:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(g.Z,{compact:!0,disabled:U,onClick:function(){H(!0),setTimeout((function(){return H(!1)}),2e3),f((function(e){return qr(qr({},e),{},{replication_method:T,unique_conflict_method:M})}))},pill:!0,secondary:!0,children:(0,P.jsx)(_.ZP,{bold:!U,success:U,children:U?"Applied!":"Apply"})})]})]})})}),(0,P.jsx)(y.Z,{headerTitle:"Features",noPadding:!0,children:ae}),(0,P.jsx)(Z.Z,{mt:2,children:(0,P.jsx)(g.Z,{loading:i,onClick:function(){return c(R)},primary:!0,small:!0,children:"Load sample data"})}),(0,P.jsxs)(Z.Z,{mt:5,children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),Cr.INCREMENTAL===T&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,P.jsxs)(_.ZP,{default:!0,children:["After each integration pipeline run, the last record that was successfully synchronized will be used as the bookmark. The properties listed below will be extracted from the last record and used as the bookmark.",(0,P.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==k&&void 0!==k&&k.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===k||void 0===k?void 0:k.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Wr,{label:e,onClick:function(){ce(e),v(R,(function(n){return qr(qr({},n),{},{bookmark_properties:(0,ee.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===k||void 0===k?void 0:k.length)>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{my:2,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,P.jsx)(_.ZP,{default:!0,children:'In order to override the bookmark values for the next sync, you must first select a destination. Then click the toggle to edit the values for the bookmark properties in the table below. Click the "Save" button to save your changes.'})]}),(0,P.jsx)(Gr.Z,{checked:Q,disabled:!t,onCheck:function(){return q((function(e){return!e}))}})]})}),Q&&!!t&&(0,P.jsx)(y.Z,{header:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsx)(_.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,P.jsx)(g.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===K||void 0===K?void 0:K[R])||{},destination_table:L,tap_stream_id:R}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:$.iI,noPadding:!0,overflowVisible:!0,children:(0,P.jsx)(_e.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:k.map((function(e){var n;return[(0,P.jsx)(_.ZP,{default:!0,monospace:!0,children:e},e),(0,P.jsx)(O.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),X((function(t){return qr(qr({},t),{},(0,o.Z)({},R,qr(qr({},t[R]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===K||void 0===K||null===(n=K[R])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,P.jsx)(_.ZP,{default:!0,children:"Multiple records (e.g. 2 or more) with the same values in the columns listed below will be considered duplicates."})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==D&&void 0!==D&&D.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===D||void 0===D?void 0:D.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Wr,{label:e,onClick:function(){v(R,(function(n){return qr(qr({},n),{},{unique_constraints:(0,ee.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,P.jsx)(_.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==S&&void 0!==S&&S.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===S||void 0===S?void 0:S.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Wr,{label:e,onClick:function(){v(R,(function(n){return qr(qr({},n),{},{key_properties:(0,ee.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),oe&&(0,P.jsxs)(Z.Z,{mb:3,children:[(0,P.jsxs)(Z.Z,{mb:1,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,P.jsx)(_.ZP,{default:!0,children:"One datetime column can be used to partition the table. (Note: Partition keys currently only work with BigQuery destinations. Support for other destinations is WIP.)"})]}),(0,P.jsxs)(x.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==I&&void 0!==I&&I.length)&&(0,P.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===I||void 0===I?void 0:I.sort().map((function(e){return(0,P.jsx)(Z.Z,{mb:1,mr:1,children:(0,P.jsx)(Wr,{label:e,onClick:function(){v(R,(function(n){return qr(qr({},n),{},{partition_keys:(0,ee.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},Jr=["catalog","pipeline","setErrors","setSelectedStream"];function $r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function eo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$r(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var no,to=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,M.Z)(e,Jr),u=(0,s.useState)(null),a=u[0],f=u[1],p=(0,s.useMemo)((function(){return(null===t||void 0===t?void 0:t.streams)||[]}),[t]),h=(0,s.useMemo)((function(){return(0,ee.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,ee.HK)(p,(function(e){return e.stream}))}),[p]),g=(0,s.useMemo)((function(){return m[null===a||void 0===a?void 0:a.uuid]}),[a,m]),b=(0,s.useMemo)((function(){return(0,ee.sE)((null===i||void 0===i?void 0:i.blocks)||[],(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[null===i||void 0===i?void 0:i.blocks]),x=g||{},j=x.destination_table,y=x.tap_stream_id,k=!(!y||!j),O=be.ZP.blocks.pipelines.detail(k?null===i||void 0===i?void 0:i.uuid:null,k?null===b||void 0===b?void 0:b.uuid:null,{destination_table:j,state_stream:y}),C=O.data,E=O.mutate,S=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,w=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===i||void 0===i?void 0:i.uuid,null===b||void 0===b?void 0:b.uuid,{query:{update_state:!0}}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===E||void 0===E||E()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(w,2),T=I[0],A=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,ee.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var R=(0,s.useMemo)((function(){var e=[{uuid:"Stream"},{uuid:"Columns Selected"},{uuid:"Replication Method"},{uuid:"Destination Table"},{uuid:"Bookmark Props"},{uuid:"Key Props"},{uuid:"Unique Constraints"},{uuid:"Unique Conflict Method"},{uuid:"Partition Keys"}];return(0,P.jsx)(Vr.cl,{children:(0,P.jsx)(_e.Z,{alignTop:!0,columnBorders:!0,columnFlex:e.map((function(e){return 1})),columns:e,rows:p.map((function(e){var n=e.replication_method,t=e.destination_table,i=e.bookmark_properties,r=e.key_properties,o=e.metadata,l=e.unique_constraints,c=e.unique_conflict_method,u=e.partition_keys,a=e.tap_stream_id,s=o.reduce((function(e,n){var t=n.breadcrumb,i=n.metadata.selected,r=(null===t||void 0===t?void 0:t.length)>0,o=i&&r?1:0,l=r?1:0;return{selectedCount:e.selectedCount+o,totalCount:e.totalCount+l}}),{selectedCount:0,totalCount:0}),d=(0,P.jsx)(_.ZP,{children:"".concat(s.selectedCount," of ").concat(s.totalCount," total")},"".concat(a,"_col_selected")),f=[a,n,t,i,r,l,c,u].map((function(e,n){return(0,P.jsx)(_.ZP,{bold:0===n,children:Array.isArray(e)?e.sort().join(", "):e},"".concat(a,"_cell_").concat(n))}));return f.slice(0,1).concat(d).concat(f.slice(1))})),stickyFirstColumn:!0,stickyHeader:!0,wrapColumns:!0})})}),[p]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(pt.Z,{allowScroll:!0,noPadding:!0,onClickTab:function(e){f(e),o(e.uuid)},selectedTabUUID:null===a||void 0===a?void 0:a.uuid,tabs:h}),g&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(Vr.dE,{children:(0,P.jsx)(Xr,eo(eo({},c),{},{bookmarkValues:S,isLoadingUpdateDestinationBlockState:A,stream:g,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(Vr.dE,{children:[(0,P.jsx)(Tr.Z,{level:4,children:"Streams Summary"}),(0,P.jsx)(Z.Z,{mt:1}),R]})})]})},io=t(18776);function ro(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function oo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function lo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?oo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.ALL="All",e.SELECTED="Selected",e.NOT_SELECTED="Not selected"}(no||(no={}));var co=45*$.iI;var uo=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,ee.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),c=(0,s.useState)(l),u=c[0],a=c[1],d=(0,s.useState)(null),f=d[0],p=d[1],h=(0,s.useState)(!1),m=h[0],v=h[1],j=(0,s.useState)(no.ALL),y=j[0],k=j[1],C=(0,s.useRef)(null),E=ro(u),S=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return y===no.SELECTED?E.includes(n):y!==no.NOT_SELECTED||!E.includes(n)})),f?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===f||void 0===f?void 0:f.toLowerCase())})):e}),[y,f,E,r]),w=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!u[n]}))}),[u,r]);return(0,P.jsxs)(io.Z,{children:[(0,P.jsx)(Vr.cv,{rounded:!0,children:(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,P.jsx)(Vr.cv,{padding:1.25*$.iI,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsx)(O.Z,{beforeIcon:(0,P.jsx)(X.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return p(e.target.value)},placeholder:"Search",value:f}),(0,P.jsx)(Z.Z,{pr:1,children:(0,P.jsx)(Bn.Z,{items:[{label:function(){return no.ALL},onClick:function(){return k(no.ALL)},uuid:"all_streams"},{label:function(){return no.SELECTED},onClick:function(){return k(no.SELECTED)},uuid:"selected"},{label:function(){return no.NOT_SELECTED},onClick:function(){return k(no.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return v(!1)},onClickOutside:function(){return v(!1)},open:m,parentRef:C,uuid:"SelectStreams/filter",children:(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.wn,{}),noBackground:!0,onClick:function(){return v((function(e){return!e}))},ref:C,children:(0,P.jsx)(_.ZP,{children:y})})})})]})}),(0,P.jsx)(Vr.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(co,"px"),children:(0,P.jsx)(_e.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,P.jsx)(b.Z,{checked:w,onClick:function(){var e=(0,ee.HK)(r||[],(function(e){return e.stream}));a(w?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:S.map((function(e){var n=e.stream,t=!!u[n];return[(0,P.jsx)(b.Z,{checked:t,onClick:function(){a((function(i){return lo(lo({},i),{},(0,o.Z)({},n,t?null:e))}))}},"selected-".concat(n)),(0,P.jsx)(_.ZP,{children:n},"stream-".concat(n))]})),stickyHeader:!0})}),(0,P.jsx)(bt.Z,{medium:!0}),(0,P.jsxs)(Z.Z,{p:2,children:[(null===E||void 0===E?void 0:E.length)>50&&(0,P.jsx)(Z.Z,{pb:2,children:(0,P.jsxs)(_.ZP,{danger:!0,maxWidth:co-4*$.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,P.jsx)("br",{}),"may cause app performance issues."]})}),(0,P.jsx)(x.Z,{justifyContent:"flex-end",children:(0,P.jsx)(g.Z,{loading:t,onClick:function(){return i(u)},primary:!0,children:"Confirm ".concat(ro(u).length," streams")})})]})]})};function ao(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function so(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ao(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var fo=function(e){var n=e.api,t=e.block,i=e.blockContent,r=e.onChangeCodeBlock,c=e.pipeline,u=(0,s.useState)(null),a=u[0],f=u[1];(0,s.useEffect)((function(){i&&!a&&f((0,Pr.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],b=(0,s.useState)(),j=b[0],y=b[1],k=(0,d.Db)(be.ZP[n].useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var t,i,r=(0,ue.C5)(n);m(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),y(null===e||void 0===e||null===(i=e[r])||void 0===i?void 0:i.error_message)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})}}),O=(0,l.Z)(k,2),C=O[0],E=O[1].isLoading;return t?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Vr.$W,{children:(0,P.jsx)(Ve.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,Pr.Pz)(so(so({},i),{},{config:(0,Pr.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,P.jsxs)(Z.Z,{mt:1,children:[(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{onClick:function(){C((0,o.Z)({},(0,ue.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),y(null)},small:!0,success:!0,children:"Test connection"}),(0,P.jsx)(Z.Z,{ml:1,children:E?(0,P.jsx)(Li.Z,{color:"white",small:!0}):(0,P.jsxs)(P.Fragment,{children:[h&&(0,P.jsx)(_.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,P.jsx)(_.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),j&&(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(_.ZP,{small:!0,warning:!0,children:j})})]})]}):null};function po(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ho(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?po(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var mo=function(e){var n,t,i,r=e.addNewBlockAtIndex,o=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,f=e.fetchSampleData,p=e.globalVariables,h=e.onChangeCodeBlock,m=e.openSidekickView,b=e.pipeline,j=e.savePipelineContent,y=e.setErrors,k=e.setIntegrationStreams,O=e.setOutputBlocks,C=e.setSelectedBlock,E=e.setSelectedOutputBlock,S=e.setSelectedStream,w=(0,s.useState)(!0),I=w[0],T=w[1],A=(0,s.useState)(!0),R=A[0],D=A[1],M=(0,s.useState)(!0),N=M[0],L=M[1],B=be.ZP.integration_sources.list().data,F=(0,s.useMemo)((function(){return(null===B||void 0===B?void 0:B.integration_sources)||[]}),[B]),H=(0,s.useMemo)((function(){return(0,ee.HK)(F,(function(e){return e.uuid}))}),[F]),z=be.ZP.integration_destinations.list().data,W=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.integration_destinations)||[]}),[z]),G=(0,s.useMemo)((function(){return(0,ee.HK)(W,(function(e){return e.uuid}))}),[W]),V=(0,s.useMemo)((function(){return(0,ee.sE)(o,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[o]),Q=(0,s.useMemo)((function(){return V?(0,Pr.Qc)(V.content):{}}),[V]),q=(0,s.useMemo)((function(){return(0,P.jsx)(fo,{api:"integration_sources",block:V,blockContent:Q,onChangeCodeBlock:h,pipeline:b})}),[V,Q,h,b]),Y=(0,s.useMemo)((function(){return(0,ee.sE)(o,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[o]),K=(0,s.useMemo)((function(){return Y?(0,Pr.Qc)(Y.content):{}}),[Y]),J=(0,s.useMemo)((function(){return(0,P.jsx)(fo,{api:"integration_destinations",block:Y,blockContent:K,onChangeCodeBlock:h,pipeline:b})}),[Y,K,h,b]),ne=(0,s.useMemo)((function(){var e;return(0,xe.Qr)(null===Q||void 0===Q?void 0:Q.catalog)?null===b||void 0===b||null===(e=b.data_integration)||void 0===e?void 0:e.catalog:null===Q||void 0===Q?void 0:Q.catalog}),[Q,null===b||void 0===b||null===(n=b.data_integration)||void 0===n?void 0:n.catalog]),te=((null===ne||void 0===ne?void 0:ne.streams)||[]).every((function(e){return e.auto_add_new_fields})),ie=((null===ne||void 0===ne?void 0:ne.streams)||[]).every((function(e){return e.disable_column_type_check})),re=(0,xt.Z)(ne);(0,s.useEffect)((function(){!re&&ne&&(O((function(){return E(V),[V]})),k((function(e){var n;return e||(null===ne||void 0===ne||null===(n=ne.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ne]);var oe=(0,s.useState)(),le=oe[0],ce=oe[1],ue=(0,d.Db)(be.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];O((function(){return E(V),[V]})),t.length>0&&S(t[0]),k((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(U.DATA),f()}else ce(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),ae=(0,l.Z)(ue,2),se=ae[0],de=ae[1].isLoading,fe=(0,d.Db)(be.ZP.integration_sources.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===ne||void 0===ne?void 0:ne.streams)||[]).filter((function(e){var n=e.tap_stream_id;return t.includes(n)})),o=r.map((function(e){return e.tap_stream_id})),l=i.filter((function(e){var n=e.tap_stream_id;return t.includes(n)&&!o.includes(n)}));l.forEach((function(e){e.metadata.forEach((function(n,t){var i=n.metadata;if(Nr.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=Cr.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Er.UPDATE),!e.destination_table)e.destination_table=null===e||void 0===e||null===(r=e.tap_stream_id)||void 0===r?void 0:r.replace(/\W+/g,"_");e.metadata[t]=ho(ho({},n),{},{metadata:ho(ho({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};k(Me.map((function(e){return e.tap_stream_id})));var s=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(s)||h(V.type,V.uuid,(0,Pr.Pz)(ho(ho({},Q),{},{catalog:{}})));var d={pipeline:ho(ho({},b),{},{data_integration:ho(ho({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:c})})};j(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),pe=(0,l.Z)(fe,2),he=pe[0],me=pe[1].isLoading,ve=(0,s.useState)(null),ge=ve[0],ye=ve[1],ke=(0,d.Db)(be.ZP.integration_source_streams.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){ye(e.integration_source_stream)},onErrorCallback:function(e,n){return y({errors:n,response:e})}})}}),Ze=(0,l.Z)(ke,2),Oe=Ze[0],Ce=Ze[1].isLoading,Ee=(0,s.useCallback)((function(e,n){var t=function(e,n){var t,i=[];return e.streams.forEach((function(e){e.tap_stream_id===n?t=e:i.push(e)})),{stream:t,streams:i}}(ne,e),i=t.stream,r=t.streams,o=ho(ho({},ne),{},{streams:r.concat(n(i))}),l=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(l)||h(V.type,V.uuid,(0,Pr.Pz)(ho(ho({},Q),{},{catalog:{}})));var c={pipeline:ho(ho({},b),{},{data_integration:ho(ho({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};j(c).then((function(){return a()}))}),[ne,V,Q,a,h,b,j]),Se=(0,s.useCallback)((function(e){if(null!==ne&&void 0!==ne&&ne.streams){var n=ho(ho({},ne),{},{streams:ne.streams.map((function(n){return e(n)}))}),t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(V.type,V.uuid,(0,Pr.Pz)(ho(ho({},Q),{},{catalog:{}})));var i={pipeline:ho(ho({},b),{},{data_integration:ho(ho({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};j(i).then((function(){return a()}))}}),[ne,V,Q,a,h,b,j]),we=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){return e.schema.properties[n]=t,e}))}),[Ee]),Pe=(0,s.useCallback)((function(e,n,t){Ee(e,(function(e){var i=e.metadata;return n.forEach((function(n){var r=i.findIndex((function(e){var t=e.breadcrumb,i=void 0===t?[]:t;return 2===i.length&&"properties"===i[0]&&i[1]===n}));if(r>=0){var o=i[r].metadata;e.metadata[r].metadata=ho(ho({},o),t)}})),e}))}),[Ee]),Ie=(0,d.Db)(be.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===Y||void 0===Y?void 0:Y.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return null===y||void 0===y?void 0:y({errors:n,response:e})}})}}),Te=(0,l.Z)(Ie,1)[0],Ae=(0,s.useMemo)((function(){var e=[];return null===p||void 0===p||p.forEach((function(n){var t=n.variables;return null===t||void 0===t?void 0:t.forEach((function(n){var t=n.uuid,i=n.value,r="\"{{ variables('".concat(t,"') }}\"");if(!t.startsWith("output"))return e.push([(0,P.jsx)(_.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,P.jsx)(_.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,P.jsx)(_.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,P.jsx)(Ir.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,P.jsx)(_e.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),De=(0,s.useCallback)((function(e){return(0,P.jsxs)(Z.Z,{mt:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,P.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,P.jsx)("br",{}),"For more information, check out the ",(0,P.jsx)(ln.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,P.jsx)(Z.Z,{mt:1,children:Ae})]})}),[Ae]),Me=(0,s.useMemo)((function(){return(null===ge||void 0===ge?void 0:ge.streams)||[]}),[ge]),Ne=(0,Re.dd)((function(){return(0,P.jsx)(uo,{catalog:ne,isLoading:me,onActionCallback:function(e){var n=Object.entries(e).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0];return t[1]?e.concat(i):e}),[]);if(n.length>0)he({integration_source:{streams:n}}),Fe();else{var t=null===Q||void 0===Q?void 0:Q.catalog;(0,xe.Qr)(t)||h(V.type,V.uuid,(0,Pr.Pz)(ho(ho({},Q),{},{catalog:{}}))),j({pipeline:ho(ho({},b),{},{data_integration:ho(ho({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),Fe()}},streams:Me})}),{},[ne,V,Q,a,me,h,j,Me],{background:!0,uuid:"select_streams"}),Le=(0,l.Z)(Ne,2),Be=Le[0],Fe=Le[1];return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{iconOnly:!0,onClick:function(){return D((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[R&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),!R&&(0,P.jsx)(X._M,{size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Tr.Z,{children:"Source"}),!R&&(0,P.jsxs)(Tr.Z,{default:!0,inline:!0,children:["\xa0",null===(t=H[null===Q||void 0===Q?void 0:Q.source])||void 0===t?void 0:t.name]})]})]})}),R&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsxs)(Vr.dE,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===F||void 0===F?void 0:F.length)>0?(0,P.jsxs)(Xi.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=H[i])||void 0===n||null===(t=n.templates)||void 0===t?void 0:t.config;o&&Object.keys(o).forEach((function(e){o[e]=o[e]||null})),V?h(V.type,V.uuid,(0,Pr.Pz)(ho(ho({},Q),{},{catalog:{},config:o,source:i}))):r({content:(0,Pr.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,C),ye(null),j().then((function(){a()}))}},primary:!0,value:null===Q||void 0===Q?void 0:Q.source,children:[(0,P.jsx)("option",{value:""}),F.map((function(e){var n=e.name,t=e.uuid;return(0,P.jsx)("option",{value:t,children:n},t)}))]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Li.Z,{inverted:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(Tr.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),V&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===Q||void 0===Q?void 0:Q.source)&&(0,P.jsxs)(Z.Z,{mb:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,P.jsxs)(ln.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(Q.source,"/README.md"),openNewWindow:!0,primary:!0,children:[Q.source," documentation"]})]}),De("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),q]}),(0,P.jsxs)("div",{children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,P.jsx)(g.Z,{loading:Ce,onClick:function(){j().then((function(){Oe().then((function(){return Be()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),le&&(0,P.jsx)(_.ZP,{warning:!0,children:le})]})]}),me&&(0,P.jsx)(Z.Z,{p:2,children:(0,P.jsx)(Li.Z,{})}),!me&&(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsx)(to,{catalog:ne,destination:null===K||void 0===K?void 0:K.destination,isLoadingLoadSampleData:de,loadSampleData:function(e){return se({integration_source:{action_type:"sample_data",pipeline_uuid:null===b||void 0===b?void 0:b.uuid,streams:[e]}})},pipeline:b,setErrors:y,setSelectedStream:S,source:null===Q||void 0===Q?void 0:Q.source,updateAllStreams:Se,updateMetadataForColumns:Pe,updateSchemaProperty:we,updateStream:Ee})})]}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{disabled:!V,iconOnly:!0,onClick:function(){return L((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[N&&V&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),(!N||!V)&&(0,P.jsx)(X._M,{disabled:!V,size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)(Tr.Z,{children:"Transformers"})})]})}),N&&V&&(0,P.jsx)(Z.Z,{mb:5,children:(0,P.jsxs)(Vr.dE,{children:[c.length>0&&(0,P.jsx)(Z.Z,{mb:1,children:c.map((function(e,n){return(0,P.jsx)(Z.Z,{mb:1,children:e},n)}))}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsx)(dt,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return V&&i.push(V.uuid),r(ho(ho({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){Y&&(Te({block:ho(ho({},Y),{},{upstream_blocks:[e.uuid]})}),C(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideRecommendations:!0,hideScratchpad:!0,hideSensor:!0,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(g.Z,{disabled:!V,iconOnly:!0,onClick:function(){return T((function(e){return!e}))},children:(0,P.jsxs)(P.Fragment,{children:[I&&V&&(0,P.jsx)(X.Kh,{size:1.5*$.iI}),(!I||!V)&&(0,P.jsx)(X._M,{disabled:!V,size:1.5*$.iI})]})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Tr.Z,{children:"Destination"}),!I&&(0,P.jsxs)(Tr.Z,{default:!0,inline:!0,children:["\xa0",null===(i=G[null===K||void 0===K?void 0:K.destination])||void 0===i?void 0:i.name]})]})]})}),I&&V&&(0,P.jsxs)(Vr.dE,{children:[(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===W||void 0===W?void 0:W.length)>0?(0,P.jsxs)(Xi.Z,{onChange:function(e){var n=e.target.value;if(n){if(Y)h(Y.type,Y.uuid,(0,Pr.Pz)(ho(ho({},K),{},{destination:n})));else{var t,i,l=null===(t=G[n])||void 0===t||null===(i=t.templates)||void 0===i?void 0:i.config;l&&(Object.keys(l).forEach((function(e){l[e]=l[e]||null})),l.hasOwnProperty("table")&&delete l.table);var c=[];if((null===o||void 0===o?void 0:o.length)>=2){var u=o.find((function(e){var n=e.uuid;return(null===V||void 0===V?void 0:V.uuid)!==n}));u&&c.push(u.uuid)}else V&&c.push(V.uuid);r({content:(0,Pr.Pz)({config:l,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,C)}j().then((function(){a()}))}},primary:!0,value:null===K||void 0===K?void 0:K.destination,children:[(0,P.jsx)("option",{value:""}),W.map((function(e){var n=e.name,t=e.uuid;return(0,P.jsx)("option",{value:t,children:n},t)}))]}):(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Li.Z,{inverted:!0}),(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(Tr.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),Y&&(0,P.jsxs)(Z.Z,{mb:5,children:[(0,P.jsx)(Tr.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===K||void 0===K?void 0:K.destination)&&(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(Z.Z,{mb:2,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,P.jsxs)(ln.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(K.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[K.destination," documentation"]}),".",(0,P.jsx)("br",{}),(0,P.jsx)("br",{}),"If your configuration contains a key named ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,P.jsx)("br",{}),"The table that\u2019s created in this destination will have a name corresponding to the stream\u2019s unique name (by default) or the value you entered under the input field labeled ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),De("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),J,(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,P.jsx)(_.ZP,{default:!0,children:"Turn the toggle on if you want new table columns in each data source stream to be automatically added and synced with the data destination."})]}),(0,P.jsx)(Gr.Z,{checked:!!te,disabled:!(null!==ne&&void 0!==ne&&ne.streams),onCheck:function(){return Se((function(e){return ho(ho({},e),{},{auto_add_new_fields:!te})}))}})]})}),(0,P.jsx)(Z.Z,{mt:3,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(Z.Z,{mr:2,children:[(0,P.jsx)(_.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,P.jsxs)(_.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,P.jsx)("br",{}),"If a value in a column doesn\u2019t match its type, an error will be raised and the process will be stopped.",(0,P.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,P.jsx)(Gr.Z,{checked:!!ie,disabled:!(null!==ne&&void 0!==ne&&ne.streams),onCheck:function(){return Se((function(e){return ho(ho({},e),{},{disable_column_type_check:!ie})}))}})]})})]})]})]})};function vo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function go(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?vo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):vo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var bo=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.anyInputFocused,r=e.autocompleteItems,l=e.blockRefs,c=e.blocks,u=void 0===c?[]:c,a=e.dataProviders,d=e.deleteBlock,f=e.disableShortcuts,p=e.fetchFileTree,h=e.fetchPipeline,m=e.fetchSampleData,g=e.files,b=e.globalVariables,x=e.interruptKernel,j=(e.isPipelineUpdating,e.kernel,e.mainContainerRef),y=e.mainContainerWidth,_=e.messages,O=e.onChangeCallbackBlock,E=e.onChangeCodeBlock,S=e.openSidekickView,I=e.pipeline,T=e.pipelineContentTouched,R=(e.pipelineLastSaved,e.restartKernel),D=e.runBlock,M=e.runningBlocks,N=void 0===M?[]:M,L=e.savePipelineContent,B=e.selectedBlock,F=e.setAnyInputFocused,U=e.setEditingBlock,H=e.setErrors,z=e.setIntegrationStreams,W=(e.setMessages,e.setOutputBlocks),G=e.setPipelineContentTouched,V=e.setRecsWindowOpenBlockIdx,Q=(e.setRunningBlocks,e.setSelectedBlock),q=e.setSelectedOutputBlock,Y=e.setSelectedStream,K=e.setTextareaFocused,X=e.textareaFocused,J=e.widgets,ee=(0,s.useState)(!1),ne=ee[0],te=ee[1],ie=(0,s.useState)(!1),re=ie[0],oe=ie[1],le=(0,s.useState)(!0),ce=le[0],ae=le[1],se=(0,s.useState)(null),de=se[0],fe=se[1],pe=(0,s.useState)(null),he=pe[0],me=pe[1],ve=(0,s.useState)(!1),ge=ve[0],be=ve[1],je=(0,s.useState)(""),ye=je[0],ke=je[1],Ze=(0,s.useMemo)((function(){return N.reduce((function(e,n,t){return go(go({},e),{},(0,o.Z)({},n.uuid,go(go({},n),{},{priority:t})))}),{})}),[N]),_e=(0,xt.Z)(B),Oe=(0,s.useMemo)((function(){return u.length}),[u]),Ce=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===I||void 0===I?void 0:I.type)}),[I]),Ee=(0,s.useMemo)((function(){return k.qL.STREAMING===(null===I||void 0===I?void 0:I.type)}),[I]),Se="PipelineDetail/index",we=(0,Qe.y)(),Pe=we.disableGlobalKeyboardShortcuts,Ie=we.registerOnKeyDown,Te=we.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Te(Se)}}),[Te,Se]),Ie(Se,(function(e,t,r){if(T&&(0,w.y)([C.zX,C.hS],t)){e.preventDefault();"undefined"!==typeof location&&window.confirm("You have changes that are unsaved. Click cancel and save your changes before reloading page.")&&location.reload()}if(!f&&!Pe)if((0,w.y)([C.zX,C.Um],t)||(0,w.y)([C.PQ,C.Um],t))e.preventDefault(),L();else if(X)t[C.vP]?K(!1):T||C.Z1.find((function(e){return t[e]}))||G(!0);else if(!Ce){if(B){var o=u.findIndex((function(e){var n=e.uuid;return B.uuid===n}));if(t[C.vP])Q(null),V(null);else if(r[0]===C.xD&&r[1]===C.xD)x();else if(r[0]===C.l1&&r[1]===C.l1&&-1!==o)d(B).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){o===u.length-1?Q(u[o-1]):u.length>=0?Q(u[o+1]):Q(null)}),100)}));else if(t[C.Bu]&&o>=1){var c=u[o-1];if(c){var a,s;Q(c);var p="".concat(c.type,"s/").concat(c.uuid,".py");null===(a=l.current[p])||void 0===a||null===(s=a.current)||void 0===s||s.scrollIntoView()}}else if(t[C.kD]&&o<=Oe-2){var h=u[o+1];if(h){var m,g;Q(h);var b="".concat(h.type,"s/").concat(h.uuid,".py");null===(m=l.current[b])||void 0===m||null===(g=m.current)||void 0===g||g.scrollIntoView()}}else(0,w.y)([C.Uq],t)?K(!0):!i&&(0,w.y)([C.zH],t)?n({type:v.tf.SCRATCHPAD},o,Q):!i&&(0,w.y)([C.Fv],t)&&n({type:v.tf.SCRATCHPAD},o+1,Q)}else _e&&t[C.Uq]&&Q(_e);r[0]===C.OC&&r[1]===C.OC&&R()}}),[n,i,l.current,u,x,Ce,Oe,T,R,L,B,_e,G,Q,K,X]),(0,s.useEffect)((function(){var e=setInterval((function(){T&&L()}),5e3);return function(){clearInterval(e)}}),[T,L]),(0,s.useEffect)((function(){setTimeout((function(){return oe(!0)}),600)}),[I]);var Ae=(0,s.useCallback)((function(e){te(!0),me(e)}),[te,me]),Re=(0,s.useCallback)((function(){te(!1),be(!1),ke("")}),[]),De=(0,s.useMemo)((function(){return u.filter((function(e){var n=e.type;return!Ce||v.tf.TRANSFORMER===n})).map((function(e,i){var o=e.type,c=e.uuid,f=(null===B||void 0===B?void 0:B.uuid)===c,m=Ze[c],v=m?0===m.priority?Pn.uF.BUSY:Pn.uF.QUEUED:Pn.uF.IDLE,g="".concat(o,"s/").concat(c,".py");return l.current[g]=(0,s.createRef)(),(0,P.jsx)(pr,{addNewBlock:function(e){return K(!0),n(e,i+1,Q)},addNewBlockMenuOpenIdx:de,addWidget:t,autocompleteItems:r,block:e,blockIdx:i,blockRefs:l,blocks:u,dataProviders:a,defaultValue:e.content,deleteBlock:function(e){d(e),F(!1)},executionState:v,fetchFileTree:p,fetchPipeline:h,hideRunButton:Ee,interruptKernel:x,mainContainerRef:j,mainContainerWidth:y,messages:_[c],noDivider:i===Oe-1||Ce,onCallbackChange:function(e){return O(o,c,e)},onChange:function(e){return E(o,c,e)},onClickAddSingleDBTModel:Ae,openSidekickView:S,pipeline:I,ref:l.current[g],runBlock:D,runningBlocks:N,savePipelineContent:L,selected:f,setAddNewBlockMenuOpenIdx:fe,setAnyInputFocused:F,setCreatingNewDBTModel:be,setEditingBlock:U,setErrors:H,setOutputBlocks:W,setRecsWindowOpenBlockIdx:V,setSelected:function(n){return Q(!0===n?e:null)},setSelectedOutputBlock:q,setTextareaFocused:K,textareaFocused:f&&X,widgets:J},c)}))}),[n,de,t,r,l,u,a,d,p,h,x,Ce,Ee,j,y,_,Oe,O,E,Ae,S,I,D,N,Ze,L,B,fe,F,U,H,W,V,Q,q,K,X,J]),Me=(0,s.useMemo)((function(){return(0,P.jsx)(mo,{addNewBlockAtIndex:n,blocks:u,codeBlocks:De,fetchFileTree:p,fetchPipeline:h,fetchSampleData:m,globalVariables:b,onChangeCodeBlock:E,openSidekickView:S,pipeline:I,savePipelineContent:L,setErrors:H,setIntegrationStreams:z,setOutputBlocks:W,setSelectedBlock:Q,setSelectedOutputBlock:q,setSelectedStream:Y})}),[n,u,De,p,h,m,b,E,S,I,L,H,z,W,Q,q,Y]),Ne=(0,s.useMemo)((function(){return(0,P.jsx)(dt,{addNewBlock:function(e){var t=u[u.length-1],i=null,r={},o=t?Ui(t,e):[];t&&([v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(t.type)&&v.tf.SCRATCHPAD===e.type&&(i="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(I.uuid,"', '").concat(t.uuid,"', 'output_0')\n")),v.t6.SQL===t.language&&(r=go(go({},(0,xe.GL)(t.configuration,[ti,ii,ri,oi,ai])),r))),v.t6.SQL===e.language&&(i=ct(i)),i=ut(e,i),n(go(go({},e),{},{configuration:r,content:i,upstream_blocks:o}),Oe,Q),K(!0)},hideCustom:Ce||Ee,hideDataExporter:Ce,hideDataLoader:Ce,hideDbt:Ce||Ee,hideRecommendations:Ce,hideScratchpad:Ce,hideSensor:Ce,onClickAddSingleDBTModel:Ae,pipeline:I,setCreatingNewDBTModel:be,setRecsWindowOpenBlockIdx:V})}),[n,u,Ce,Ee,Oe,Ae,I,V,Q,K]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(dn,{children:ce&&(0,P.jsx)(In.Z,{classNames:"pipeline-detail",in:re,onEntered:function(){return setTimeout((function(){return ae(!1)}),sn)},timeout:1,children:(0,P.jsx)(fn,{})})}),(0,P.jsxs)(Z.Z,{mt:1,px:$.cd,children:[Ce&&Me,!Ce&&(0,P.jsxs)(P.Fragment,{children:[De,(0,P.jsx)(Z.Z,{mt:$.cd,children:Ne})]}),ne&&(0,P.jsx)(Je.Z,{onClickOutside:Re,open:!0,children:(0,P.jsx)(wr,{blocks:u,creatingNewDBTModel:ge,dbtModelName:ye,files:g,onClose:Re,onOpenFile:function(e){var t=ge?"".concat(e,"/").concat((0,ue.RA)(ye||(0,ue.Y6)()),".").concat(A.SQL):e,i={configuration:{file_path:t},language:v.t6.SQL,name:(0,ue.wE)(t),type:v.tf.DBT};ge&&(i.content="--Docs: https://docs.mage.ai/dbt/sources\n");var r="undefined"===typeof he||null===he,o=u[r?u.length-1:he],l=o?Ui(o,i):[];n(go(go({},i),{},{upstream_blocks:l}),r?Oe:he+1,Q),Re(),K(!0)},setDbtModelName:ke})})]})]})},xo=t(49894),jo=t(12344),yo=t(32063),ko=t(70543),Zo=t(24141);function _o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Oo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?_o(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):_o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Co=function(e){var n=e.after,t=e.afterHeader,i=e.afterHidden,r=e.afterSubheader,o=e.before,c=e.beforeHeader,u=e.children,a=e.errors,d=e.headerOffset,f=e.mainContainerHeader,p=e.mainContainerRef,h=e.page,m=e.pipeline,v=e.setAfterHidden,g=e.setAfterWidthForChildren,b=e.setErrors,x=e.setMainContainerWidth,j=(0,Zo.i)().width,y=(0,s.useState)((0,S.U2)(S.L8,un.Zt)),k=y[0],Z=y[1],_=(0,s.useState)((0,S.U2)(S.J3,un.ve)),O=_[0],C=_[1],E=(0,s.useState)(!!(0,S.U2)(S.Uu)),w=E[0],I=E[1],T=(0,s.useState)(!1),A=T[0],R=T[1],D=(0,s.useState)(!1),M=D[0],N=D[1],L=i,B=v;if(!B){var F=(0,s.useState)(!!(0,S.U2)(S.zg)),U=(0,l.Z)(F,2);L=U[0],B=U[1]}(0,s.useEffect)((function(){null===p||void 0===p||!p.current||A||M||null===x||void 0===x||x(p.current.getBoundingClientRect().width)}),[A,M,L,k,w,O,p,x,j]),(0,s.useEffect)((function(){A||(null===g||void 0===g||g(k),(0,S.t8)(S.L8,k))}),[A,k,g]),(0,s.useEffect)((function(){M||(0,S.t8)(S.J3,O)}),[M,O]);var H=be.ZP.projects.list({},{revalidateOnFocus:!1}).data,z=null===H||void 0===H?void 0:H.projects,W=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return m&&(n.push.apply(n,[{bold:ko.b!==h,label:function(){return null===m||void 0===m?void 0:m.name},linkProps:{as:"/pipelines/".concat(null===m||void 0===m?void 0:m.uuid),href:"/pipelines/[pipeline]"}}]),ko.b===h&&n.push.apply(n,[{bold:!0,label:function(){return(0,ue.kC)(h)}}])),(0,P.jsx)(jo.Z,{breadcrumbs:n,project:null===z||void 0===z?void 0:z[0],version:null===z||void 0===z||null===(e=z[0])||void 0===e?void 0:e.version})}),[h,m,z]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(xn.Z,{title:null===m||void 0===m?void 0:m.name}),(0,P.jsx)(yo.Z,{after:n,afterHeader:t,afterHidden:L,afterMousedownActive:A,afterSubheader:r,afterWidth:k,before:o,beforeHeader:c,beforeHidden:w,beforeMousedownActive:M,beforeWidth:O,header:W,headerOffset:d,mainContainerHeader:f,mainContainerRef:p,setAfterHidden:B,setAfterMousedownActive:R,setAfterWidth:Z,setBeforeHidden:I,setBeforeMousedownActive:N,setBeforeWidth:C,children:u}),a&&(0,P.jsx)(Je.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return b(null)},children:(0,P.jsx)(xo.Z,Oo(Oo({},a),{},{onClose:function(){return b(null)}}))})]})},Eo=t(62609),So=t(41788),wo=t(70001),Po=t(26226),Io=t(29989),To=t(53655),Ao=t(84181),Ro=t(31969),Do=t(2005);function Mo(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function No(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Mo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Mo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Lo=N.default.div.withConfig({displayName:"HeatMap__YAxisLabelContainer",componentId:"sc-h2irj-0"})(["-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-o-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg);white-space:nowrap;"]);function Bo(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Fo(e,n){return Math.min.apply(Math,(0,r.Z)(e.map(n)))}var Uo=function(e){return e.bins},Ho=function(e){return e.count},zo={top:0,left:0,right:0,bottom:0};function Wo(e){var n=e.countMidpoint,t=e.data,i=(e.events,e.height),r=e.margin,o=void 0===r?{}:r,l=e.minCount,c=e.width,u=(e.yLabels,(0,s.useContext)(N.ThemeContext)),a=(u.monotone||Ro.Z.monotone).grey300,d=(u.brand||Ro.Z.brand).wind400,f=(u.content||Ro.Z.content).default,p=(u.monotone||Ro.Z.monotone).white,h=No(No({},zo),o),m=[];t[0].forEach((function(e,n){var i=t.map((function(e){return e[n]}));m.push({bin:n,bins:i.reverse().map((function(e,n){return{bin:n,count:e}}))})}));var v=Bo(m,(function(e){return Bo(Uo(e),Ho)})),g=Fo(m,(function(e){return Fo(Uo(e),Ho)})),b=Bo(m,(function(e){return Uo(e).length})),x="undefined"!==typeof n?n:0,j="undefined"!==typeof l?l:g,y=(0,Ao.Z)({domain:[0,m.length]}),k=(0,Ao.Z)({domain:[0,b]}),Z=(0,Ao.Z)({range:[a,d],domain:[x,v]}),_=(0,Ao.Z)({range:[.1,1],domain:[x,v]}),O=(0,Ao.Z)({range:[a,d],domain:[j,x]}),C=(0,Ao.Z)({range:[1,.1],domain:[j,x]}),E=c-(h.left+h.right),S=i-(h.bottom+h.top),w=E/m.length,I=S/b;return y.range([0,E]),k.range([S,0]),c<10?null:(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("svg",{width:c,height:i,children:(0,P.jsx)(Io.Z,{left:h.left,top:h.top,children:(0,P.jsx)(To.Z,{data:m,xScale:y,yScale:k,colorScale:Z,opacityScale:_,binWidth:w,binHeight:w,gap:0,children:function(e){return e.map((function(e){return e.map((function(e){var t=e.opacity,i=e.color;return"undefined"!==typeof n&&e.count<n&&(t=C(e.count),i=O(e.count)),(0,P.jsxs)("svg",{height:I,width:w,x:e.x,y:e.y-I,children:[(0,P.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:I,width:w}),(0,P.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*v?p:f,fontFamily:Do.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var Go=function(e){var n=e.countMidpoint,t=e.data,i=e.height,r=e.margin,o=e.minCount,l=e.xAxisLabel,c=e.xLabels,u=e.yAxisLabel,a=e.yLabels,s=function(e){return e.length>12?"".concat(e.substring(0,12),"..."):e},d=4*$.iI,f=8*$.iI,p=0;return u&&(p+=d+1*$.iI),a&&(p+=f+1*$.iI),(0,P.jsxs)(P.Fragment,{children:[(l||c)&&(0,P.jsx)("div",{style:{marginBottom:null===r||void 0===r?void 0:r.bottom,marginLeft:null===r||void 0===r?void 0:r.left,marginRight:null===r||void 0===r?void 0:r.right,marginTop:null===r||void 0===r?void 0:r.top,paddingLeft:p},children:(0,P.jsxs)(Z.Z,{mb:{xs:1},children:[l&&(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,P.jsx)(x.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,P.jsx)(He.Z,{flex:"1",justifyContent:"center",children:t?(0,P.jsx)(ln.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,P.jsx)(_.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,P.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,P.jsx)("div",{style:{marginRight:1*$.iI,width:d},children:(0,P.jsx)(x.Z,{alignItems:"center",justifyContent:"center",children:(0,P.jsx)(Lo,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,P.jsx)("div",{style:{marginRight:1*$.iI},children:(0,P.jsx)(x.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,P.jsx)(He.Z,{alignItems:"center",flex:"1",children:t?(0,P.jsx)(ln.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,P.jsx)(_.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,P.jsx)("div",{style:{height:i,width:"100%"},children:(0,P.jsx)(Po.Z,{children:function(e){var i=e.width,l=e.height;return(0,P.jsx)(Wo,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},Vo=t(11754);var Qo=function(e){var n=e.afterWidth,t=e.features,i=e.insightsOverview,r=e.statistics,o=i.correlations,c=void 0===o?[]:o,u=n-(2*$.cd*$.iI+an.nn),a=function(e){var n=[];return{heatmapData:null===e||void 0===e?void 0:e.map((function(e,t){var i=e.correlations,r=e.feature.uuid;n.push({label:r});var o=i[0].y.map((function(e){var n=e.value;return(0,ue.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,ee.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:1-n["".concat(e.uuid,"/null_value_rate")]}})),"value")}(t,r),p=function(e,n){return(0,ee.YC)(null===e||void 0===e?void 0:e.map((function(e){return{feature:e,value:n["".concat(e.uuid,"/count_distinct")]}})),"value")}(t,r),h=function(e,n){return(0,ee.YC)(null===e||void 0===e?void 0:e.map((function(e){var t=Object.entries(n["".concat(e.uuid,"/value_counts")]||{})[0]||[],i=(0,l.Z)(t,2),r=i[0],o=i[1];return{feature:e,percentage:Number(o)/n.count,value:r}})),"percentage")}(t,r);return(0,P.jsxs)(x.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,P.jsx)(Vo.Z,{headerTitle:"Data completion",width:u,children:(0,P.jsx)(wo.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,ue.T3)(n)," of rows have a value")},xNumTicks:2,ySerialize:function(e){return e.y}})}),(null===p||void 0===p?void 0:p.length)>=1&&(0,P.jsx)(Vo.Z,{headerTitle:"Number of unique values",width:u,children:(0,P.jsx)(wo.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.x;return"".concat(n," unique values")},xNumTicks:2,ySerialize:function(e){return e.y}})}),h.length>=1&&(0,P.jsx)(Vo.Z,{headerTitle:"Distribution of values",width:u,children:(0,P.jsx)(wo.Z,{data:h.map((function(e){var n=e.feature,t=e.percentage;return{feature:n,value:e.value,x:t,y:n.uuid}})),height:Math.max(3*h.length*$.iI,50*$.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,ue.T3)(t)," of all rows")},xNumTicks:2,ySerialize:function(e){return e.y}})}),c&&(null===s||void 0===s?void 0:s.length)>=1&&(0,P.jsx)(Vo.Z,{headerTitle:"Correlations",children:(0,P.jsx)(Z.Z,{p:1,children:(0,P.jsx)(Go,{countMidpoint:0,data:s,height:8*$.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})},qo=t(92083),Yo=t.n(qo),Ko=t(84969),Xo=t(90948),Jo=t(65743),$o=t(39048),el=t(79487),nl=t(61655),tl=t(16853),il=t(65376),rl=t(52359),ol=t(48072),ll=t(24903),cl=t(98677),ul=t(73899);function al(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function sl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?al(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):al(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var dl={bottom:$.iI*(3+$.cd),left:$.iI*$.cd,right:$.iI*$.cd,top:$.iI*$.cd};function fl(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function pl(e){var n=e.data,t=e.height,i=e.keyForYData,o=e.large,l=e.margin,c=void 0===l?{}:l,u=e.orientationVertical,a=void 0!==u&&u,d=e.showTooltip,f=e.width,p=e.yLabelFormat,h=(0,s.useContext)(N.ThemeContext),m=(0,s.useCallback)((function(e){return e[i]}),[i]),v=p;v||(v=function(e){return e.length>20?"".concat(e.substring(0,20),"..."):e});var g=o?Hr.iD:Hr.J5,b=sl(sl({},dl),c),x=n.slice(Math.max(0,n.length-50)),j=(0,s.useMemo)((function(){return Object.keys((null===x||void 0===x?void 0:x[0])||{}).filter((function(e){return e!==i}))}),[x,i]),y=(0,ll.Z)({domain:j,range:[ul.a$,ul.Ej,ul.hM,ul.ZA,ul.$R,ul.X_,ul.er,ul.hl,ul.nQ]}),k=(0,s.useMemo)((function(){return x.map(m)}),[x,m]),Z=(0,cl.Z)({domain:k,padding:.1}),_=(0,cl.Z)({domain:j,padding:.1}),O=(0,Ao.Z)({domain:[0,fl(x,(function(e){return fl(j,(function(n){return Number(e[n])}))}))]}),C={active:(null===h||void 0===h?void 0:h.content.default)||Oe.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||Oe.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||Oe.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||Oe.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||Oe.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||Oe.Z.background.navigation},E=k;a&&(E=x.reduce((function(e,n){return e.concat(j.map((function(e){var t=n[e];return(0,ue.HW)(t)?parseInt(String(t)):t})))}),[]));var S=Math.min(Math.max.apply(Math,(0,r.Z)(E.map((function(e){return String(e).length})))),20);b.left+=7*S;var w=f-(b.left+b.right),P=t-(b.top+b.bottom);a?(Z.rangeRound([0,w]),O.rangeRound([P,0])):(Z.rangeRound([P,0]),O.rangeRound([0,w])),_.rangeRound([0,Z.bandwidth()]);var I=x.map(m).length,T=0;a||(T=Z(E[I-1]));var A=(0,s.useCallback)((function(e){var n=(0,ol.Z)(e)||{x:0,y:0},t=n.x,i=n.y,r=t-b.left,o=i-b.top,l=0;l=a?(r-T/2)/(w-T):1-(o-T/2)/(P-T);var c=Math.floor(l*I),u=x[c];"undefined"===typeof u&&(u=x[c-1]),a?r>T&&r<w+b.left-T&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>T&&o<P-T&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[x,I,b.left,b.top,a,d,T,w,P]);return{colorScale:y,colors:C,data:x,fontSize:g,handleTooltip:A,margin:b,tempScale:O,tickValues:E,xKeys:j,xMax:w,y1Scale:_,yLabelFormat:v,yMax:P,yScale:Z,ySerialize:m}}var hl=["height","width","xAxisLabel","yAxisLabel"];function ml(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function vl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ml(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ml(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}$.iI,$.iI,$.iI;var gl=(0,nl.Z)((function(e){var n=e.data,t=e.height,i=e.hideTooltip,r=e.keyForYData,o=void 0===r?"__y":r,c=e.large,u=e.margin,a=void 0===u?{}:u,s=e.renderNoDataText,d=e.renderTooltipContent,f=e.showTooltip,p=e.tooltipData,h=e.tooltipLeft,m=e.tooltipOpen,v=e.tooltipTop,g=e.width,b=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=pl({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:g,yLabelFormat:j}),k=y.colorScale,Z=y.colors,O=y.data,C=y.fontSize,E=y.handleTooltip,S=y.margin,w=y.tempScale,I=y.tickValues,T=y.xKeys,A=y.xMax,R=y.y1Scale,D=y.yLabelFormat,M=y.yMax,N=y.yScale,L=y.ySerialize;return g<10?null:(0,P.jsxs)("div",{children:[(0,P.jsxs)("svg",{height:t,width:g,children:[s&&!(null!==O&&void 0!==O&&O.length)&&(0,P.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:Do.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,P.jsx)(Jo.Z,{fill:"transparent",height:t-(S.top+S.bottom),onMouseLeave:function(){return i()},onMouseMove:E,onTouchMove:E,onTouchStart:E,rx:14,width:g-(S.left+S.right),x:S.left,y:S.top}),(null===O||void 0===O?void 0:O.length)&&(0,P.jsxs)(Io.Z,{left:S.left,top:S.top,children:[(0,P.jsx)($o.Z,{color:k,data:O,keys:T,width:A,xScale:w,y0:L,y0Scale:N,y1Scale:R,children:function(e){return e.map((function(e){return(0,P.jsx)(Io.Z,{top:e.y0,children:e.bars.map((function(n){return(0,P.jsx)("g",{children:(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.y0))}))}}),(0,P.jsx)(Ko.Z,{hideTicks:!0,scale:N,stroke:Z.muted,tickFormat:function(e){return D(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:Do.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:I,top:2}),(0,P.jsx)(Xo.Z,{label:b,labelProps:{fill:Z.muted,fontFamily:Do.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:w,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:Do.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:M})]}),p&&(0,P.jsx)("g",{children:(0,P.jsx)(el.Z,{from:{x:S.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:A+S.left,y:v}})})]}),m&&p&&(0,P.jsxs)(tl.Z,{left:h,style:vl(vl({},il.j),{},{backgroundColor:Z.tooltipBackground}),top:v,children:[d&&d(p),!d&&Object.entries(p).map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];if(o!==t){var r=i;return(0,ue.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})}));var bl=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,M.Z)(e,hl);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?$.iI:null,width:"100%"},children:[o&&(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,P.jsx)(rl.Z,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,P.jsx)("div",{style:{height:t,width:n},children:(0,P.jsx)(Po.Z,{children:function(e){var n=e.width,t=e.height;return(0,P.jsx)(gl,vl(vl({},l),{},{height:t,width:n}))}})})]}),r&&(0,P.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},xl=t(95422),jl=["keyForYData"],yl=["height","width","xAxisLabel","yAxisLabel"];function kl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Zl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?kl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):kl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var _l=(0,nl.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,M.Z)(e,jl),r=i.height,o=i.hideTooltip,c=i.renderNoDataText,u=i.renderTooltipContent,a=i.tooltipData,s=i.tooltipLeft,d=i.tooltipOpen,f=i.tooltipTop,p=i.width,h=i.xLabelFormat,m=i.xNumTicks,v=i.yNumTicks,g=pl(Zl(Zl({},i),{},{keyForYData:t,orientationVertical:!0})),b=g.colorScale,x=g.colors,j=g.data,y=g.fontSize,k=g.handleTooltip,Z=g.margin,O=g.tempScale,C=(g.tickValues,g.xKeys),E=(g.xMax,g.y1Scale),S=g.yLabelFormat,w=g.yMax,I=g.yScale,T=g.ySerialize;return p<10?null:(0,P.jsxs)("div",{children:[(0,P.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,P.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:Do.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Jo.Z,{fill:"transparent",height:r-(Z.top+Z.bottom),onMouseLeave:function(){return o()},onMouseMove:k,onTouchMove:k,onTouchStart:k,rx:14,width:p-(Z.left+Z.right),x:Z.left,y:2*Z.top}),(0,P.jsxs)(Io.Z,{top:Z.top,children:[(0,P.jsx)(xl.Z,{color:b,data:j,height:w,keys:C,x0:T,x0Scale:I,x1Scale:E,yScale:O,children:function(e){return e.map((function(e){return(0,P.jsx)(Io.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,P.jsx)("g",{children:(0,P.jsx)("rect",{fill:n.color,height:n.height,pointerEvents:"none",rx:4,width:n.width,x:n.x,y:n.y})},"".concat(e.index,"-").concat(n.index,"-").concat(n.key))}))},"bar-group-horizontal-".concat(e.index,"-").concat(e.x0))}))}}),(0,P.jsx)(Ko.Z,{left:Z.left,numTicks:v,scale:O,stroke:x.muted,tickFormat:function(e){return S(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:Do.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,P.jsx)(Xo.Z,{hideTicks:!0,left:Z.left,numTicks:m,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:Do.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:w+Z.top})]})]}),a&&(0,P.jsx)("g",{children:(0,P.jsx)(el.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:w+2*Z.top}})})]}),d&&a&&(0,P.jsxs)(tl.Z,{left:s,style:Zl(Zl({},il.j),{},{backgroundColor:x.tooltipBackground}),top:f,children:[u&&u(a),!u&&Object.entries(a).map((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];if(t!==i){var o=r;return(0,ue.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,P.jsx)("br",{}),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var Ol=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,M.Z)(e,yl);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?$.iI:null,width:"100%"},children:[r&&(0,P.jsx)(x.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,P.jsx)(rl.Z,{children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,P.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,P.jsx)(Po.Z,{children:function(e){var n=e.height,t=e.width;return(0,P.jsx)(_l,Zl(Zl({},o),{},{height:n,width:t}))}})})]}),i&&(0,P.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,P.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},Cl=t(66872),El=t(68735),Sl=t(320),wl=40*$.iI,Pl=N.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],Ce.n_,.5*$.iI,.5*$.iI,1*$.iI,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).chartBlock,";\n ")})),Il=N.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*$.iI,1*$.iI),Tl=N.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],$.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||Oe.Z.background).codeTextarea,";\n ")})),Al=N.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],$.cd*$.iI,$.iI,$.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||Oe.Z.borders).medium,";\n ")}));function Rl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Dl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Rl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Rl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ml=function(e){var n,t=e.block,i=e.data,r=e.width,c=t.configuration,u=void 0===c?{}:c,a=u||{},s=a.chart_style,d=a.chart_type,f=a.y_sort_order,p=u.height||wl,h=(null===u||void 0===u||null===(n=u.metrics)||void 0===n?void 0:n.map((function(e){return"".concat((n=e).aggregation,"(").concat(n.column,")");var n})))||[],m=Sn.n1,v=u.time_interval;if([gi.HOUR,gi.MINUTE,gi.SECOND].includes(v)&&(m=Sn.OC),Ut.BAR_CHART===d||Ut.TIME_SERIES_BAR_CHART===d){var g=i.x,b=i.y,x=Ut.TIME_SERIES_BAR_CHART===d;if(g&&b&&Array.isArray(g)&&Array.isArray(b)){var j,y=null===(j=u.group_by)||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(ei);var Z=h[0],O=g.map((function(e,n){return Dl({__y:e},h.reduce((function(e,t,i){var r,l=null===b||void 0===b||null===(r=b[i])||void 0===r?void 0:r[n];return"undefined"===typeof l?e:Dl(Dl({},e),{},(0,o.Z)({},t,l))}),{}))}));vi.ASCENDING===f?O=(0,ee.YC)(O,(function(e){return e[Z]}),{ascending:!1}):vi.DESCENDING===f&&(O=(0,ee.YC)(O,(function(e){return e[Z]}),{ascending:!0}));var C={data:O,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return pi.HORIZONTAL===s?(0,P.jsx)(bl,Dl(Dl({},C),{},{xAxisLabel:k||u.y,yAxisLabel:y||u.x})):(0,P.jsx)(Ol,Dl(Dl({},C),{},{xAxisLabel:y,xLabelFormat:function(e){return x?Yo()(1e3*e).format(Sn.n1):e},xNumTicks:O.length,yAxisLabel:k,yNumTicks:5}))}}else if(Ut.HISTOGRAM===d){var E,S=i.x,w=i.y,I=null===(E=u.group_by)||void 0===E?void 0:E.join(", ");if(S&&w&&Array.isArray(S))return(0,P.jsx)(Cl.Z,{data:S.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===w||void 0===w||null===(t=w[n])||void 0===t?void 0:t.value,r]})),height:p,width:r,large:!0,margin:{left:5*$.iI,right:1*$.iI,top:3*$.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,P.jsxs)(_.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,P.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,ee.YC)(e,"[0]")},xAxisLabel:I||u.x,yAxisLabel:I?"count(".concat(I,")"):u.y})}else if(Ut.LINE_CHART===d||Ut.TIME_SERIES_LINE_CHART===d){var T=i.x,A=i.y,R=Ut.TIME_SERIES_LINE_CHART===d;if(T&&A&&Array.isArray(T)&&Array.isArray(A)&&Array.isArray(null===A||void 0===A?void 0:A[0])){var D,M=h;u.legend_labels&&(M=u.legend_labels.split(",").map((function(e){return e.trim()})));var N=T.map((function(e,n){return{x:e,y:(0,ee.w6)(A.length).map((function(e,t){var i=A[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(D=u.group_by)||void 0===D?void 0:D.join(", "),B=h.join(", ");return(0,P.jsx)(El.Z,{data:N,height:p,lineLegendNames:M,margin:{bottom:8*$.iI,left:5*$.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=u.x,i=n;return u.group_by&&(t=u.group_by.map(String).join(", ")),R&&(i=Yo()(1e3*n).format(m)),(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,P.jsxs)(_.ZP,{inverted:!0,small:!0,children:[M&&M[n]&&"".concat(M[n],": "),t&&(0,ue.x6)((0,ue.QV)(t[n],4))]})},width:r?r-3*$.iI:r,xAxisLabel:L||String(u.x),xLabelFormat:function(e){return R?Yo()(1e3*e).format(Sn.n1):e},yAxisLabel:B||String(u.y),yLabelFormat:function(e){return e}})}}else if(Ut.PIE_CHART===d){var F,U=i[String(u.x)],H=null===(F=u.group_by)||void 0===F?void 0:F.join(", ");if(U)return(0,P.jsx)(Sl.Z,{data:Object.entries(U),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,ue.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:H||String(u.x)})}else if(Ut.TABLE===d){var z=i.index,W=i.x,G=i.y;return Array.isArray(W)&&Array.isArray(G)&&Array.isArray(G[0])&&(0,P.jsx)(vt.Z,{columns:W,index:z,height:u.height?null:p,maxHeight:u.height?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:G,width:r})}return(0,P.jsx)("div",{})},Nl=t(76096);var Ll=function(e){var n=e.children,t=e.onChange,i=(0,s.useState)(s.Children.map(n,(function(){return null}))),r=i[0],o=i[1],l=(0,s.useState)(0),c=l[0],u=l[1];return(0,P.jsx)(x.Z,{children:s.Children.map(n,(function(e,n){return(0,P.jsx)(Z.Z,{ml:n>=1?1:0,style:{display:"flex",flex:1},children:s.cloneElement(e,{onChange:function(e){o((function(i){return i[n]=e.target.value,t(i,{resetValues:function(){return u((function(e){return e+1}))},setValues:o}),i}))},value:r[n]})},"multi-select-child-".concat(n,"-").concat(c))}))})};function Bl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Fl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Bl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Bl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ul(e,n){var t,i,r,c,u=e.autocompleteItems,a=e.block,f=e.blockRefs,p=e.blocks,h=e.deleteWidget,m=e.executionState,g=e.fetchPipeline,b=e.fetchFileTree,y=e.messages,k=void 0===y?[]:y,E=e.onChangeContent,S=e.pipeline,w=e.runBlock,I=e.runningBlocks,T=e.savePipelineContent,A=e.selected,R=e.setAnyInputFocused,D=e.setSelectedBlock,M=e.setTextareaFocused,L=e.textareaFocused,B=e.updateWidget,F=e.width,U=(0,s.useRef)(null),H=(0,s.useContext)(N.ThemeContext),z=be.ZP.blocks.pipelines.detail(null===S||void 0===S?void 0:S.uuid,null===a||void 0===a?void 0:a.upstream_blocks[0]).data,W=(null===z||void 0===z||null===(t=z.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],G=(0,s.useState)(null),V=G[0],Q=G[1],q=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),Y=q[0],K=q[1],J=(0,s.useState)(a.configuration),ne=J[0],te=J[1],ie=(0,s.useState)(a.content),re=ie[0],oe=ie[1],le=(0,s.useState)(!Y||0===W.length),ae=le[0],se=le[1],de=(0,s.useState)(!1),fe=de[0],pe=de[1],he=(0,s.useState)(null),me=he[0],ve=he[1],ge=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),ye=ge[0],ke=ge[1],Ze=(0,s.useState)((null===W||void 0===W?void 0:W.length)||0),_e=Ze[0],Ce=Ze[1],Ee=(0,s.useState)(a.uuid),Se=Ee[0],we=Ee[1],Pe=Ei[Y],Ie=Si[Y],Te=(0,s.useMemo)((function(){return null===p||void 0===p?void 0:p.filter((function(e){var n=e.type;return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(n)}))}),[p]),Ae=(0,s.useMemo)((function(){return(0,ee.HK)(Te,(function(e){return e.uuid}))}),[Te]),Re=!!I.find((function(e){return e.uuid===a.uuid}))||(null===k||void 0===k?void 0:k.length)>=1&&m!==Pn.uF.IDLE,De=(0,s.useMemo)((function(){return null===k||void 0===k?void 0:k.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[k]),Me=!!De.find((function(e){return e.error})),Ne=De.length>=1,Le=(0,s.useMemo)((function(){return{blockType:a.type,hasError:Me,selected:A}}),[a.type,Me,A]);if(null!==De&&void 0!==De&&De.length){var Be,Fe,Ue=De.length-1;c=null===De||void 0===De||null===(Be=De[Ue])||void 0===Be||null===(Fe=Be.data)||void 0===Fe?void 0:Fe[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,ue.Pb)(c)&&(r=JSON.parse(c))):(null===W||void 0===W?void 0:W.length)>=1&&(r={},W.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;Pn.Gi.TEXT===i&&(0,ue.Pb)(t)&&(r[o]=JSON.parse(t))})));var ze=(0,s.useCallback)((function(e){var n=Fl(Fl(Fl({},a),e),{},{configuration:Fl(Fl({},a.configuration),e.configuration)});T().then((function(){w({block:n,code:re,ignoreAlreadyRunning:!0,runUpstream:!!ye.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=Ae[e])||void 0===n?void 0:n.status)}))})})),Ce((function(e){return e+1}))}),[a,Ae,re,Ce,ye]),We=(0,s.useCallback)((function(e){oe(e),E(e)}),[E,oe]),Ge=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;te((function(n){return Fl(Fl({},n),e)}));var i=Fl(Fl({},a),{},{configuration:Fl(Fl(Fl({},ne),e),{},{chart_type:Y})});B(i);Object.keys(e);_e&&t&&ze(i)}),[a,Y,ne,_e,ze,te,B]);(0,s.useEffect)((function(){Q({python:rr({autocompleteItems:u,block:a,blocks:p,pipeline:S})})}),[u,a,p,S]);var qe=(0,s.useMemo)((function(){return(0,P.jsx)(Ve.Z,{autoHeight:!0,autocompleteProviders:V,onChange:We,selected:A,setSelected:function(e){return D(!0===e?a:null)},setTextareaFocused:M,showLineNumbers:!1,textareaFocused:L||Ut.TABLE===Y&&!ae,value:re,width:"100%"})}),[V,Y,re,ae,A,D,M,L,We]),Ye=(0,s.useMemo)((function(){return Me&&Ne&&(0,P.jsx)(Ht,Fl(Fl({},Le),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:Re,messages:De,selected:A}))}),[a,Le,Me,Ne,Re,De,A]),Ke=(0,xt.Z)(ae),Xe=(0,xt.Z)(F);(0,s.useEffect)((function(){var e,n=null===U||void 0===U||null===(e=U.current)||void 0===e?void 0:e.getBoundingClientRect();Ke!==ae||Xe!==F?(ve(0),setTimeout((function(){var e,n,t=null===U||void 0===U||null===(e=U.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&ve(t)}),100)):n&&ve(n.width)}),[ae,Ke,U.current,ve,F,Xe]);var Je=(0,s.useMemo)((function(){var e=[];return ye.forEach((function(n,t){var i=Ae[n],r=(0,ce.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:H}).accent;e.push((0,P.jsxs)(Z.Z,{ml:2,children:[(0,P.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,P.jsx)(ln.Z,{color:r,inline:!0,onClick:function(){var e,n,t=null===f||void 0===f||null===(e=f.current)||void 0===e?void 0:e["".concat(null===i||void 0===i?void 0:i.type,"s/").concat(null===i||void 0===i?void 0:i.uuid,".py")];null===t||void 0===t||null===(n=t.current)||void 0===n||n.scrollIntoView()},preventDefault:!0,small:!0,children:(0,P.jsx)(_.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[Ae,ye]),$e=(0,s.useMemo)((function(){var e,n=[],t=null===Pe||void 0===Pe||null===(e=Pe.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return fi.includes(t)?e.concat(t):e}),[]);null===t||void 0===t||t.length;return null===t||void 0===t||t.forEach((function(e,t){var i=ne[e];if(i){var r,o,l=null===(r=wi[Y])||void 0===r||null===(o=r[e])||void 0===o?void 0:o.call(r);n.push((0,P.jsxs)(Z.Z,{ml:2,children:[(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:i})," ",l&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,P.jsx)(_.ZP,{default:!0,inline:!0,small:!0,children:l})]})]},i))}})),n}),[ne,Pe]),en=(0,xt.Z)(Y),nn=(0,xt.Z)(ye);(0,s.useEffect)((function(){if((!en&&Y&&null!==ye&&void 0!==ye&&ye.length||(null===nn||void 0===nn||!nn.length)&&(null===ye||void 0===ye?void 0:ye.length)>=1&&Y)&&!re&&(0,xe.Qr)(ne)&&Ie){var e=Fl(Fl({},a),{},{upstream_blocks:ye});Ie.configuration&&Ge(Ie.configuration(e)),Ie.content&&We(Ie.content(e))}}),[a,Y,en,ne,re,Ge,We,ye,nn]);var tn=(0,s.useMemo)((function(){return ne.width_percentage||1}),[ne]),rn=(0,s.useMemo)((function(){return Object.entries(Pe||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return Fl(Fl({},e),{},(0,o.Z)({},i,r.map((function(e){var n,t=e.autoRun,i=e.label,r=e.monospace,l=e.options,c=e.settings,u=void 0===c?{}:c,s=e.type,d=e.uuid,f={fullWidth:!0,key:d,label:(0,ue.kC)(i()),monospace:r,onBlur:function(){return D(a)},onChange:function(e){return Ge((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return D(a)},value:(null===ne||void 0===ne?void 0:ne[d])||""},p=(null!==z&&void 0!==z&&z.block?[z.block]:[]).reduce((function(e,n){var t=n.outputs;return t?e.concat(t.reduce((function(e,n){var t=n.sample_data;return null!==t&&void 0!==t&&t.columns?e.concat(t.columns):e}),[])):e}),[]);if(_i.COLUMNS===s){var h=ne[d]||[];n=(0,P.jsxs)(P.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,P.jsxs)(Xi.Z,Fl(Fl({},f),{},{onChange:function(e){var n=ne[d]||[],i=e.target.value;n.includes(i)?n=(0,ee.Od)(n,(function(e){return e===i})):n.push(i),Ge((0,o.Z)({},d,n),{autoRun:t})},value:null,children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]})),h.map((function(e){return(0,P.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,P.jsx)(Wr,{label:e,onClick:function(){Ge((0,o.Z)({},d,(0,ee.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(_i.METRICS===s){var m=ne[d]||[];n=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_.ZP,{bold:!0,children:"Metrics"}),(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,P.jsxs)(Ll,{onChange:function(e,n){var i=n.resetValues,r=n.setValues;2===e.filter((function(e){return!!e})).length&&(m.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||(Ge((0,o.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,P.jsxs)(Xi.Z,Fl(Fl({},f),{},{label:"aggregation",children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(Oi,(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]})),(0,P.jsxs)(Xi.Z,Fl(Fl({},f),{},{label:"column",children:[(0,P.jsx)("option",{value:""}),(0,ee.YC)(p,(function(e){return e})).map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))]}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,P.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,P.jsx)(Wr,{label:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ge((0,o.Z)({},d,(0,ee.Od)(m,(function(e){var t=e.aggregation,r=e.column;return n===t&&i===r}))),{autoRun:t})}})},"".concat(n,"(").concat(i,")"))}))]})}else n=l?(0,P.jsx)(Xi.Z,Fl(Fl({},f),{},{children:l.map((function(e){return(0,P.jsx)("option",{value:e,children:e},e)}))})):(0,P.jsx)(O.Z,Fl(Fl({},f),{},{type:s}));return(0,P.jsx)(Z.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[Ae,ne,Pe,W,D,Ge,ye]),on=rn.code,un=rn.noCode,an=(0,d.Db)(be.ZP.widgets.pipelines.useUpdate(null===S||void 0===S?void 0:S.uuid,a.uuid),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){pe(!1),g(),b()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){(0,je.qQ)(e).messages}}),sn=(0,l.Z)(an,1)[0],dn="ChartBlock/".concat(a.uuid),fn=(0,Qe.y)(),pn=fn.registerOnKeyDown,hn=fn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){hn(dn)}}),[hn,dn]),pn(dn,(function(e,n,t){fe&&String(t[0])===String(C.Uq)&&String(t[1])!==String(C.zX)&&sn({widget:Fl(Fl({},a),{},{name:Se})})}),[a,fe,Se,sn]),(0,P.jsx)(Nl.Z,{sm:12,md:12*tn,children:(0,P.jsxs)(Pl,{ref:n,children:[(0,P.jsx)(Z.Z,{mt:1,pt:1,px:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{flex:1,style:{position:"relative"},children:[(0,P.jsx)(En,{bold:!1,fullWidth:!0,inputValue:Se,notRequired:!0,onBlur:function(){return setTimeout((function(){return pe(!1)}),300)},onChange:function(e){we(e.target.value),e.preventDefault()},onClick:function(){R(!0),pe(!0)},onFocus:function(){R(!0),pe(!0)},small:!0,stacked:!0,value:!fe&&a.uuid}),fe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(ln.Z,{noWrapping:!0,onClick:function(){return sn({widget:Fl(Fl({},a),{},{name:Se})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Xi.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=Fl(Fl({},a),{},{upstream_blocks:n});B(t),ze(t),ke(n)},placeholder:"Source block",small:!0,value:(null===ye||void 0===ye?void 0:ye[0])||"",children:null===Te||void 0===Te?void 0:Te.map((function(e){var n=e.uuid;return(0,P.jsx)("option",{value:n,children:n},n)}))}),(0,P.jsx)(Z.Z,{mr:1}),!Re&&(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return ze(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,P.jsx)(X.Py,{size:2*$.iI})})}),Pn.uF.QUEUED===m&&(0,P.jsx)(Li.Z,{color:(H||Oe.Z).content.active,small:!0,type:"cylon"}),Pn.uF.BUSY===m&&(0,P.jsx)(Li.Z,{color:(H||Oe.Z).content.active,small:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return se((function(e){return!e}))},selected:ae,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,P.jsx)(X.I8,{size:2*$.iI})})}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(cn.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,P.jsx)(X.rF,{size:2*$.iI})})})]})]})}),(0,P.jsx)(Z.Z,{mt:1}),(0,P.jsxs)(x.Z,{justifyContent:"space-between",fullWidth:!0,children:[(0,P.jsx)(He.Z,{flex:6,ref:U,children:r&&!(0,xe.Qr)(r)&&(0,P.jsx)(Z.Z,{pb:3,children:(0,P.jsx)(Ml,{block:Fl(Fl({},a),{},{configuration:Fl(Fl({},a.configuration),ne)}),data:r,width:me})})}),ae&&(0,P.jsx)(Il,{children:(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(Xi.Z,{onChange:function(e){var n=e.target.value,t=Fl(Fl({},a),{},{configuration:Fl(Fl({},ne),{},{chart_type:n})});B(t),ze(t),K(n)},placeholder:"Select chart type",value:Y,children:mi.map((function(e){return(0,P.jsx)("option",{value:e,children:(0,ue.kC)(e)},e)}))})}),(0,P.jsx)(Z.Z,{mb:1,children:(0,P.jsx)(Xi.Z,{onChange:function(e){return Ge((0,o.Z)({},Jt,e.target.value))},placeholder:"Chart width",value:(null===ne||void 0===ne?void 0:ne.width_percentage)||1,children:[["1/2 width",.5],["full width",1]].map((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return(0,P.jsx)("option",{value:i,children:t},t)}))})}),un]})})]}),ae&&!(null===on||void 0===on||!on.length)&&v.t6.SQL!==a.language&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{my:1,px:1,children:[(0,P.jsx)(_.ZP,{bold:!0,children:"Custom chart code"}),(0,P.jsxs)(_.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,P.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,P.jsxs)(Tl,{children:[ye.length>=1&&(0,P.jsxs)(Al,{children:[(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",Je]}),(0,P.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",$e]})]}),qe]})]}),Ye&&(0,P.jsx)(Z.Z,{px:1,children:Ye})]})})}var Hl=s.forwardRef(Ul),zl=t(97361),Wl=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Gl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Vl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Gl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Gl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ql,ql=function(e){var n=e.blockRefs,t=e.blocks,i=e.chartRefs,r=e.deleteWidget,l=e.messages,c=e.onChangeChartBlock,u=e.runBlock,a=e.runningBlocks,d=e.savePipelineContent,f=e.selectedBlock,p=e.setAnyInputFocused,h=e.setSelectedBlock,m=e.setTextareaFocused,v=e.textareaFocused,g=e.updateWidget,b=e.widgets,j=e.width,y=(0,M.Z)(e,Wl),k=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return Vl(Vl({},e),{},(0,o.Z)({},n.uuid,Vl(Vl({},n),{},{priority:t})))}),{})}),[a]);return(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[(0,P.jsx)(zl.Z,{fullHeight:!0,style:{marginLeft:.5*$.iI,marginRight:.5*$.iI},children:null===b||void 0===b?void 0:b.map((function(e){var o=e.uuid,b=k[o],x=b?0===b.priority?Pn.uF.BUSY:Pn.uF.QUEUED:Pn.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(Hl,Vl(Vl({},y),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:x,key:o,messages:l[o],onChangeContent:function(e){return c(o,e)},ref:i.current[o],runBlock:u,runningBlocks:a,savePipelineContent:d,selected:(null===f||void 0===f?void 0:f.uuid)===o,setAnyInputFocused:p,setSelectedBlock:h,setTextareaFocused:m,textareaFocused:v,updateWidget:g,width:j}))}))}),(0,P.jsx)("div",{style:{height:"80vh"}})]})},Yl=N.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),Kl=function(e){var n=e.size,t=void 0===n?20:n,i=e.viewBox,r=void 0===i?"0 0 358 305":i;return(0,P.jsxs)(Yl,{height:t*(305/358),viewBox:r,width:t,children:[(0,P.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M290 47H66c-3.866 0-7 3.134-7 7v200c0 3.866 3.134 7 7 7h224c3.866 0 7-3.134 7-7V54c0-3.866-3.134-7-7-7zM66 46c-4.4183 0-8 3.5817-8 8v200c0 4.418 3.5817 8 8 8h224c4.418 0 8-3.582 8-8V54c0-4.4183-3.582-8-8-8H66z",fill:"#000"}),(0,P.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,P.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,P.jsx)("rect",{x:"209.651",y:"17.1125",width:"1.0163",height:"14.2284",rx:".5082",transform:"rotate(24.933 209.651 17.1125)",fill:"#2AB2FE"}),(0,P.jsx)("path",{fill:"#2AB2FE",d:"M207.788 23.5313l35.4813 16.4949-.4285.9215-35.4812-16.4948zM247.033 31.9316c.946-2.0359 3.364-2.9191 5.4-1.9726l31.795 14.7811-11.383 24.4836-31.794-14.7811c-2.036-.9465-2.92-3.3642-1.973-5.4002l7.955-17.1108z"}),(0,P.jsx)("path",{d:"M284.228 44.7401l31.795 14.7811c2.036.9465 2.919 3.3642 1.972 5.4001l-7.954 17.1109c-.947 2.0359-3.365 2.9191-5.401 1.9726l-31.795-14.7811 11.383-24.4836z",fill:"#0093E4"}),(0,P.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M352.959 83.7347a.5082.5082 0 00-.675.2466l-2.571 5.5296-35.481-16.4949-.428.9216 35.481 16.4949-2.571 5.5295a.5081.5081 0 00.247.675.5082.5082 0 00.675-.2466l5.57-11.9806a.5083.5083 0 00-.247-.6751z",fill:"#2AB2FE"}),(0,P.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,P.jsx)("path",{d:"M337.354 256.065a38.3848 38.3848 0 01-10.816 21.271 38.3722 38.3722 0 01-21.293 10.768 38.3787 38.3787 0 01-23.542-3.895 38.3764 38.3764 0 01-16.691-17.054l17.208-8.494a19.1932 19.1932 0 0020.117 10.475 19.189 19.189 0 0010.647-5.385c2.886-2.88 4.78-6.605 5.407-10.635l18.963 2.949z",fill:"#FF3C3C"}),(0,P.jsx)("path",{d:"M294.876 288.277a38.3849 38.3849 0 01-21.64-10.056 38.3818 38.3818 0 01-11.516-20.899 38.3896 38.3896 0 013.06-23.666 38.386 38.386 0 0116.453-17.283l9.098 16.897a19.1904 19.1904 0 00-9.757 20.474 19.1937 19.1937 0 005.758 10.45 19.194 19.194 0 0010.82 5.028l-2.276 19.055z",fill:"#2ECDF7"}),(0,P.jsx)("path",{d:"M275.892 219.85a38.3804 38.3804 0 0145.342-1.268 38.3803 38.3803 0 0114.45 18.989 38.3873 38.3873 0 01.436 23.858l-18.346-5.631a19.1827 19.1827 0 00-.218-11.929 19.1907 19.1907 0 00-7.225-9.495 19.1875 19.1875 0 00-11.439-3.39 19.192 19.192 0 00-11.232 4.024l-11.768-15.158z",fill:"#885EFF"}),(0,P.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M259.206 102.57c.241.135.327.439.193.68l-39.314 70.576c-.613 1.1-1.962 1.565-3.124 1.093-3.766-1.53-13.762-5.285-26.356-7.597-12.6-2.314-27.762-3.177-41.881 1.037-16.112 4.81-27.78 14.07-35.424 22.135-3.822 4.032-6.635 7.763-8.491 10.483-.928 1.36-1.616 2.467-2.072 3.232-.228.383-.397.68-.509.881-.057.1-.098.177-.126.227l-.03.057-.008.014-.001.003a.5008.5008 0 01-.676.21.5005.5005 0 01-.209-.676l.442.233-.442-.233.001-.001.002-.005.009-.016.033-.062c.03-.055.073-.135.132-.239.116-.208.29-.513.523-.904.465-.782 1.165-1.906 2.105-3.285 1.881-2.756 4.727-6.53 8.591-10.607 7.727-8.153 19.539-17.532 35.864-22.405 14.331-4.278 29.668-3.391 42.347-1.063 12.685 2.329 22.748 6.109 26.552 7.654.699.284 1.51.002 1.875-.653l39.313-70.575a.5008.5008 0 01.681-.194z",fill:"#7D55EC"}),(0,P.jsx)("path",{d:"M221.651 176.111c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM157.778 166.428c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873zM106.428 204.191c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.8726-1.734-3.8726-3.873 0-2.139 1.7336-3.873 3.8726-3.873s3.873 1.734 3.873 3.873zM262.35 104.459c0 2.139-1.734 3.873-3.873 3.873-2.139 0-3.873-1.734-3.873-3.873 0-2.139 1.734-3.873 3.873-3.873 2.139 0 3.873 1.734 3.873 3.873z",fill:"#7D55EC"}),(0,P.jsx)("path",{d:"M8.5523 214.855c-.3562-1.045.2025-2.181 1.248-2.538l13.7251-4.677c1.0456-.356 2.1819.203 2.5382 1.248l29.6737 87.084-17.5112 5.967-29.6738-87.084z",fill:"#4776FF"}),(0,P.jsx)("path",{d:"M45.0935 264.735c-.3562-1.045.2025-2.182 1.2481-2.538l13.725-4.677c1.0455-.356 2.1819.203 2.5382 1.248l10.6438 31.237-17.5112 5.967-10.6439-31.237z",fill:"#FFCC19"}),(0,P.jsx)("path",{d:"M54.4607 234.868c-.3563-1.046.2025-2.182 1.248-2.538l13.7251-4.677c1.0455-.356 2.1819.202 2.5382 1.248l18.7879 55.137-17.5113 5.967-18.7879-55.137z",fill:"#4776FF"})]})};function Xl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Jl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}!function(e){e.GREAT_EXPECTATIONS="great_expectations"}(Ql||(Ql={}));var $l=function(e){var n,t,i=e.block,r=e.blocks,o=e.onUpdateCallback,c=e.pipeline,u=e.runBlockAndTrack,a=e.setErrors,f=(0,s.useContext)(N.ThemeContext),p=(0,s.useState)(""),h=p[0],m=p[1],j=(0,s.useState)(!1),y=j[0],k=j[1],C=(0,s.useState)(null),E=C[0],S=C[1],w=(0,s.useMemo)((function(){return(0,ee.HK)(r,(function(e){return e.uuid}))}),[r]);(0,s.useEffect)((function(){E||S((0,ee.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,E]);var I=(0,d.Db)((function(e){var n=e.upstream_blocks;return be.ZP.blocks.pipelines.useUpdate(null===c||void 0===c?void 0:c.uuid,encodeURIComponent(null===i||void 0===i?void 0:i.uuid),{query:{extension_uuid:null===i||void 0===i?void 0:i.extension_uuid}})({block:{upstream_blocks:n}})}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){null===o||void 0===o||o(),k(!1)},onErrorCallback:function(e,n){return null===a||void 0===a?void 0:a({errors:n,response:e})}})}}),T=(0,l.Z)(I,2),A=T[0],R=T[1].isLoading,D=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.filter((function(e){var n=e.name,t=e.type,i=e.uuid;return((null===n||void 0===n?void 0:n.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase())))&&[v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.TRANSFORMER].includes(t)})))||[]}),[h,r]),M=(0,s.useMemo)((function(){var e=[];return null===D||void 0===D||D.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,ce.qn)(o,{blockColor:i,theme:f}).accent;t>=1&&e.push((0,P.jsx)(bt.Z,{light:!0},"divider-".concat(l)));var u=!(null===E||void 0===E||!E[l]),a=![v.t6.PYTHON].includes(r);e.push((0,P.jsx)(Z.Z,{px:2,py:1,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(B.Z,{color:c,size:1.5*$.iI,square:!0}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(_.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,P.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,P.jsx)(b.Z,{checked:!a&&u,disabled:a,onClick:function(){S((function(e){var n=Jl({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[D,f,E]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Je.Z,{onClickOutside:function(){return k(!1)},open:!0,children:[(0,P.jsx)(O.Z,{beforeIcon:(0,P.jsx)(X.HN,{}),borderless:!0,compact:!0,onChange:function(e){return m(e.target.value)},onClick:function(e){(0,ur.j)(e),k(!0)},onFocus:function(e){(0,ur.j)(e),k(!0)},placeholder:"Select blocks to run expectations on",small:!0,value:h}),y&&(0,P.jsxs)(P.Fragment,{children:[M,(0,P.jsx)(Z.Z,{mx:1,children:(0,P.jsx)(x.Z,{justifyContent:"flex-end",children:(0,P.jsx)(g.Z,{compact:!0,loading:R,onClick:function(){A({upstream_blocks:Object.keys(E)})},small:!0,children:"Save selected blocks"})})})]})]}),!y&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,P.jsxs)(Z.Z,{pb:1,pr:1,children:[(0,P.jsx)(Z.Z,{mt:1,pl:1,children:(0,P.jsx)(_.ZP,{muted:!0,small:!0,children:"Click a block name below to run expectations on it."})}),(0,P.jsx)(x.Z,{alignItems:"center",children:null===i||void 0===i||null===(t=i.upstream_blocks)||void 0===t?void 0:t.map((function(e){var n=null===w||void 0===w?void 0:w[e];if(!n)return(0,P.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,ce.qn)(r,{blockColor:t,theme:f}).accent;return(0,P.jsx)(Z.Z,{ml:1,mt:1,children:(0,P.jsx)(g.Z,{backgroundColor:o,compact:!0,disabled:!u,onClick:function(){null===u||void 0===u||u({block:Jl(Jl({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})};function ec(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function nc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ec(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ec(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var tc=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,l=e.blocksInNotebook,c=e.deleteBlock,u=e.extensionOption,a=e.fetchFileTree,d=e.fetchPipeline,f=e.interruptKernel,p=e.messages,h=e.onChangeCallbackBlock,m=e.onChangeCodeBlock,g=e.pipeline,b=e.runBlock,x=e.runningBlocks,y=e.savePipelineContent,k=e.selectedBlock,O=e.setAnyInputFocused,E=e.setErrors,S=e.setSelectedBlock,I=e.setTextareaFocused,T=e.textareaFocused,A=(0,s.useRef)(null),R=(0,s.useState)(!1),D=R[0],M=R[1],N=(u||{}).uuid,L=(g||{}).extensions,B=(0,s.useMemo)((function(){return(null===u||void 0===u?void 0:u.templates)||[]}),[u]),F=(0,s.useMemo)((function(){return null===L||void 0===L?void 0:L[N]}),[N,L]),U=(0,s.useMemo)((function(){return(null===F||void 0===F?void 0:F.blocks)||[]}),[F]),H=(0,s.useMemo)((function(){return(0,ee.HK)(U,(function(e){return e.uuid}))}),[U]),z=(0,s.useMemo)((function(){return N===(null===k||void 0===k?void 0:k.extension_uuid)&&H[null===k||void 0===k?void 0:k.uuid]}),[H,N,k]),W=(0,s.useMemo)((function(){return x.reduce((function(e,n,t){return nc(nc({},e),{},(0,o.Z)({},n.uuid,nc(nc({},n),{},{priority:t})))}),{})}),[x]),G=(0,s.useMemo)((function(){return U.map((function(e,n){var o=nc(nc({},e),{},{extension_uuid:N}),u=o.type,v=o.uuid,j=(null===k||void 0===k?void 0:k.uuid)===v,_=W[v],C=_?0===_.priority?Pn.uF.BUSY:Pn.uF.QUEUED:Pn.uF.IDLE,w="".concat(u,"s/").concat(v,".py");return i.current[w]=(0,s.createRef)(),(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(pr,{autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){c(nc(nc({},e),{},{extension_uuid:N})),O(!1)},executionState:C,extraContent:(0,P.jsx)($l,{block:o,blocks:l,onUpdateCallback:d,pipeline:g,setErrors:E}),fetchFileTree:a,fetchPipeline:d,hideRunButton:!0,interruptKernel:f,messages:p[v],noDivider:!0,onCallbackChange:function(e){return h(u,v,e)},onChange:function(e){return m(u,v,e)},pipeline:g,ref:i.current[w],runBlock:b,runningBlocks:x,savePipelineContent:y,selected:j,setAnyInputFocused:O,setErrors:E,setSelected:function(e){return S(!0===e?o:null)},setTextareaFocused:I,textareaFocused:j&&T})},v)}))}),[t,i,r,l,c,U,N,a,d,f,p,h,m,g,b,x,W,y,k,O,E,S,I,T]),V="Extensions/GreatExpectations/index",Q=(0,Qe.y)(),q=Q.disableGlobalKeyboardShortcuts,Y=Q.registerOnKeyDown,K=Q.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){K(V)}}),[K,V]),Y(V,(function(e,n){!q&&z&&((0,w.y)([C.zX,C.Um],n)||(0,w.y)([C.PQ,C.Um],n))&&(e.preventDefault(),y())}),[z,y]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(_.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["When a block in your pipeline runs, it\u2019ll run any tests you define in its code. All associated extension blocks will also run during that phase. Learn more about the ",(0,P.jsx)(ln.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,P.jsx)(ln.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),G,(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(Je.Z,{onClickOutside:function(){return M(!1)},open:!0,children:(0,P.jsx)(Bn.Z,{disableKeyboardShortcuts:!0,items:null===B||void 0===B?void 0:B.map((function(e){var t=e.description,i=e.name,r=e.path;return{label:function(){return i},onClick:function(){return n({config:{template_path:r},extension_uuid:N,type:v.tf.EXTENSION},(null===U||void 0===U?void 0:U.length)||0)},tooltip:function(){return t},uuid:e.uuid}})),onClickCallback:function(){return M(!1)},open:D,parentRef:A,uuid:"Extension",children:(0,P.jsx)(j.ZP,{beforeElement:(0,P.jsx)(Hn,{teal:!0,children:(0,P.jsx)(X.mm,{size:Un})}),inline:!0,onClick:function(e){e.preventDefault(),M(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},ic=t(59e3),rc=["pipeline"];function oc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function lc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?oc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var cc=function(e){var n=e.pipeline,t=(0,M.Z)(e,rc),i=(0,f.useRouter)(),r=be.ZP.extension_options.list().data,o=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.extension_options)||[]}),[r]),l=(0,s.useMemo)((function(){return(0,ee.HK)(o,(function(e){return e.uuid}))}),[o]),c=(0,s.useState)(null),u=c[0],a=c[1],d=(0,s.useMemo)((function(){return l[u]}),[l,u]),p=(0,s.useMemo)((function(){return lc(lc({},t),{},{pipeline:n})}),[n,t]);return(0,s.useEffect)((function(){var e;a(null===(e=(0,ic.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]),(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(Z.Z,{p:$.cd,children:[!u&&(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,P.jsx)(ln.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,P.jsx)(Z.Z,{mt:1,children:(0,P.jsxs)(_.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,P.jsx)(Li.Z,{}),Ql.GREAT_EXPECTATIONS===u&&n&&(0,P.jsx)(tc,lc(lc({},p),{},{extensionOption:d})),!u&&(null===o||void 0===o?void 0:o.map((function(e){var n=e.description,t=e.name,i=e.uuid;return(0,P.jsx)(ln.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,mn.u7)({extension:i},{pushHistory:!0})},preventDefault:!0,children:(0,P.jsx)(y.Z,{dark:!0,children:(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(io.Z,{fullWidth:!1,children:(0,P.jsx)(Z.Z,{p:$.cd,children:(0,P.jsx)(x.Z,{alignItems:"center",children:(0,P.jsx)("img",{alt:t,height:3*$.iI,src:"/images/extensions/".concat(i,"/logo.png"),width:3*$.iI})})})}),(0,P.jsx)(Z.Z,{mr:$.cd}),(0,P.jsxs)(He.Z,{flexDirection:"column",children:[(0,P.jsx)(_.ZP,{bold:!0,children:t}),(0,P.jsx)(_.ZP,{default:!0,small:!0,children:n})]})]}),(0,P.jsx)(X._Q,{})]})})},i)})))]})})},uc=t(88560),ac=(N.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],Ce.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||Ro.Z.interactive).defaultBorder,";\n ")})),N.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||Ro.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||Ro.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||Ro.Z.interactive).defaultBorder,";\n ")}))),sc=(N.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],ul.Uq,1.75*$.iI,$.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Ro.Z.interactive).defaultBorder,";\n ")}),Ce.TR,Ce.TR),N.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Ro.Z.interactive).defaultBorder,";\n ")}))),dc=(N.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],Ce.TR,Ce.TR),N.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),$.iI)),fc=N.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],an.w5);function pc(e,n){return{average:e["".concat(n,"/average")],avg_string_length:e["".concat(n,"/avg_string_length")],avg_word_count:e["".concat(n,"/avg_word_count")],completeness:e["".concat(n,"/completeness")],count:e["".concat(n,"/count")],count_distinct:e["".concat(n,"/count_distinct")],invalid_indices:e["".concat(n,"/invalid_indices")],invalid_value_count:e["".concat(n,"/invalid_value_count")],invalid_value_rate:e["".concat(n,"/invalid_value_rate")],invalid_values:e["".concat(n,"/invalid_values")],max:e["".concat(n,"/max")],max_character_count:e["".concat(n,"/max_character_count")],max_null_seq:e["".concat(n,"/max_null_seq")],max_word_count:e["".concat(n,"/max_word_count")],median:e["".concat(n,"/median")],min:e["".concat(n,"/min")],min_character_count:e["".concat(n,"/min_character_count")],min_word_count:e["".concat(n,"/min_word_count")],mode:e["".concat(n,"/mode")],null_value_count:e["".concat(n,"/null_value_count")],null_value_rate:e["".concat(n,"/null_value_rate")],outlier_count:e["".concat(n,"/outlier_count")],outlier_ratio:e["".concat(n,"/outlier_ratio")],outliers:e["".concat(n,"/outliers")],quality:e["".concat(n,"/quality")],skew:e["".concat(n,"/skew")],std:e["".concat(n,"/std")],sum:e["".concat(n,"/sum")],unique_value_rate:e["".concat(n,"/unique_value_rate")],validity:e["".concat(n,"/validity")],value_counts:e["".concat(n,"/value_counts")]}}var hc=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],mc={Missing:0,Invalid:0,Outliers:0,Unique:.9};function vc(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(N.ThemeContext),l=t.columnType,c=t.uuid,u=pc(r,c),a=u.average,d=u.avg_string_length,f=u.avg_word_count,p=u.count,h=u.count_distinct,m=u.invalid_value_count,v=u.invalid_value_rate,g=u.max,b=u.max_character_count,j=u.max_word_count,y=u.min,k=u.min_character_count,O=u.min_word_count,C=u.median,E=u.mode,S=u.null_value_count,w=u.null_value_rate,I=u.outlier_count,T=u.skew,A=u.std,R=u.unique_value_rate,D=[l,S,h,y,g,a,C,E,m,I,T,A],M={Min:O,Max:j,Mean:f},L={Min:"".concat((0,ue._6)("character",k)),Max:"".concat((0,ue._6)("character",b)),Mean:"".concat((0,ue._6)("character",(0,ue.QV)(d)))},B={Invalid:(0,ue.T3)(v),Missing:(0,ue.T3)(w),Unique:(0,ue.T3)(R)},F=Pe.T5[l],U=[o.background.row,o.background.row2],H=U[0],z=U[1],W=i?ln.Z:_.ZP;return(0,P.jsxs)(He.Z,{flexDirection:"column",children:[(0,P.jsx)(sc,{children:(0,P.jsx)(Z.Z,{px:1,py:2,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[F&&(0,P.jsxs)(He.Z,{title:uc.Rp[l],children:[(0,P.jsx)(F,{size:2*$.iI}),"\xa0"]}),(0,P.jsx)(W,{inline:!0,onClick:i?function(){return(0,mn.u7)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,P.jsx)(_.ZP,{bold:!0,default:!i,maxWidth:25*$.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),D.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=hc[n],i=l===uc.RL.TEXT&&t in M,r=i?M[t]:e,o=isNaN(r)?r:(0,ue.QV)(r),c=t in mc&&o/p>mc[t];return(0,P.jsx)(dc,{backgroundColor:n%2===0?H:z,children:(0,P.jsxs)(_.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?L[t]:"",children:[i?"".concat((0,ue._6)("word",o)):o,t in B&&" (".concat(B[t],")")]})},n)}))]})}var gc=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(N.ThemeContext),l=(0,s.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,P.jsx)(Vo.Z,{headerTitle:"Feature profiles",children:(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(ac,{children:(0,P.jsxs)(He.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,P.jsx)(Z.Z,{mr:1.25*$.iI,mt:"".concat(53,"px")}),hc.map((function(e,n){return(0,P.jsx)(dc,{children:(0,P.jsx)(_.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,P.jsx)(fc,{children:(0,P.jsx)(x.Z,{children:t.map((function(e,n){return(0,P.jsx)(sc,{children:(0,P.jsx)(vc,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(n))}))})})]})})};function bc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function xc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?bc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):bc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jc=function(e){var n=e.onActionCallback,t=e.selectedBlock,i=e.selectedFilePath,r=e.setErrors,c=e.width,u=p("apiReloads"),a=(0,l.Z)(u,2)[1],f=be.ZP.file_versions.files.list(i&&encodeURIComponent(i)),h=f.data,m=f.mutate,v=(0,s.useMemo)((function(){return(null===h||void 0===h?void 0:h.file_versions)||[]}),[h]),b=(0,s.useState)(null),j=b[0],y=b[1],k=(0,s.useMemo)((function(){return null===v||void 0===v?void 0:v[j]}),[j,v]),O=be.ZP.file_contents.detail(k?encodeURIComponent(k.path):null).data,C=(0,s.useMemo)((function(){return null===O||void 0===O?void 0:O.file_content}),[O]),E=(0,s.useMemo)((function(){return Te()}),[]),S=(0,s.useMemo)((function(){var e,n,t;return null===i||void 0===i||null===(e=i.match(E))||void 0===e||null===(n=e[0])||void 0===n||null===(t=n.split("."))||void 0===t?void 0:t[1]}),[i,E]),w=(0,d.Db)(be.ZP.file_contents.useUpdate(i&&encodeURIComponent(i)),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var t;i&&m();var r=null===e||void 0===e||null===(t=e.file_content)||void 0===t?void 0:t.path,l="FileEditor/".concat(r);if(r){var c=r.split("/");if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join("/");l="PipelineDetail/".concat(u)}}a((function(e){return xc(xc({},e),{},(0,o.Z)({},l,Number(new Date)))})),y((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return r({errors:n,response:e})}})}}),I=(0,l.Z)(w,2),T=I[0],A=I[1].isLoading,R=(0,s.useMemo)((function(){var e=v.map((function(e){var n=e.name,t=e.path;return[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{flex:1,children:[(0,P.jsx)(_.ZP,{default:!0,monospace:!0,children:(0,Sn.JX)(n,{withSeconds:!0})}),(0,P.jsx)(Z.Z,{px:2*$.cd,children:(0,P.jsx)(_.ZP,{monospace:!0,children:n})})]}),k&&(null===k||void 0===k?void 0:k.path)===t&&(0,P.jsx)(g.Z,{compact:!0,loading:A,onClick:function(e){(0,ur.j)(e),T({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(k){var n=(0,P.jsx)(Z.Z,{p:$.cd,children:(0,P.jsx)(Li.Z,{},"spinner")});if(C&&(null===C||void 0===C?void 0:C.path)===(null===k||void 0===k?void 0:k.path)){var t=C.content,i=void 0===t?"":t;n=(0,P.jsx)(Ve.Z,{autoHeight:!0,language:Y[S],padding:!0,readOnly:!0,value:(0,ue.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:c})}e=(0,ee.Hk)([n],j+1,e)}return e}),[C,S,v,A,k,j,T,c]);return(0,P.jsxs)("div",{style:{width:c},children:[(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Tr.Z,{level:5,children:"File versions"}),(0,P.jsx)(_.ZP,{inline:!0,monospace:!0,children:i?decodeURIComponent(i):null===t||void 0===t?void 0:t.uuid})]}),(0,P.jsx)(_e.Z,{buildRowProps:function(e){if(k&&j+1===e)return{renderCell:function(e){return e},renderRow:function(e){return e}}},columnFlex:[1],columns:[{uuid:"Version"}],isSelectedRow:function(e){var n;return(null===(n=v[e])||void 0===n?void 0:n.name)===(null===k||void 0===k?void 0:k.name)},onClickRow:function(e){k?e===j?y(null):e<j?y(e):e>j+1&&y(e-1):y(e)},rows:R})]})},yc=t(21764),kc=t(22673),Zc=t(1286),_c=($.iI,Zc.O$,$.iI,Hr.dN,N.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],un.Wi,an.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),N.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*$.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),N.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Oc=N.default.td.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-cr39lf-3"})(["display:flex;align-items:center;justify-content:space-between;border:1px solid #1C1C1C;height:100%;",""],(function(e){return!e.noPadding&&"\n padding: 0 ".concat(2*$.iI,"px;\n ")})),Cc=t(19963);var Ec=function(e){var n=e.copyText,t=e.deleteVariable,i=e.fetchVariables,r=e.hideEdit,o=e.obfuscate,c=e.pipelineUUID,u=e.variable,a=u.uuid,f=(u.type,u.value),p=(0,s.useRef)(null),h=(0,s.useState)(!1),m=h[0],v=h[1],g=(0,s.useState)(a),b=g[0],x=g[1],y=(0,s.useState)(f),k=y[0],Z=y[1],C=(0,s.useState)(!1),E=C[0],S=C[1],w=(0,d.Db)(be.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){S(!1),i()}})}}),I=(0,l.Z)(w,1)[0],T=(0,s.useCallback)((function(e){if("Enter"===e.key){var n=k;try{n=JSON.parse(k)}catch(t){}I({variable:{name:b,value:n}})}else"Escape"===e.key&&S(!1)}),[b,k]);(0,s.useEffect)((function(){var e;E&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[E,p]);var A=n||"kwargs['".concat(a,"']");return(0,P.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,P.jsxs)(zl.Z,{children:[(0,P.jsx)(Nl.Z,{md:1,hiddenSmDown:!0,children:(0,P.jsx)(Oc,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Cc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(A),yc.Am.success("Successfully copied to clipboard.",{position:yc.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Nl.Z,{md:4,children:E?(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"variable",small:!0,value:b})}):(0,P.jsx)(Oc,{children:(0,P.jsx)(_.ZP,{color:ul.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,P.jsx)(Nl.Z,{md:7,children:E?(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){Z(e.target.value),e.preventDefault()},onKeyDown:T,paddingHorizontal:0,placeholder:"enter value",ref:p,small:!0,value:k})}):(0,P.jsxs)(Oc,{children:[o?(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:"********"}):(0,P.jsx)(_.ZP,{monospace:!0,small:!0,children:f}),(0,P.jsxs)(He.Z,{children:[!r&&m&&(0,P.jsx)(j.ZP,{backgroundColor:Cc.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){S(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,P.jsx)(X.I8,{size:2.5*$.iI})}),t&&m&&(0,P.jsx)(j.ZP,{backgroundColor:Cc.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,P.jsx)(X.rF,{size:2.5*$.iI})})]})]})})]})})},Sc=t(93348),wc=t(58122);var Pc=function(e){e.blocks;var n=e.fetchVariables,t=e.pipeline,i=e.selectedBlock,r=e.setErrorMessages,o=e.variables,c=e.width,u=(0,s.useState)(!1),a=u[0],f=u[1],p=(0,s.useState)(),h=p[0],m=p[1],g=(0,s.useState)(),b=g[0],y=g[1],k=null===t||void 0===t?void 0:t.uuid,C=(0,d.Db)(be.ZP.variables.pipelines.useCreate(k),{onSuccess:function(e){return(0,je.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),E=(0,l.Z)(C,1)[0],S=(0,d.Db)((function(e){return be.ZP.variables.pipelines.useDelete(k,e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),w=(0,l.Z)(S,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=b;try{t=JSON.parse(b)}catch(i){}E({variable:{name:h,value:t}}).then((function(){n(),m(null),y(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[E,n,h,b]),T=(0,s.useMemo)((function(){return c-4*$.iI}),[c]),A=(0,s.useMemo)((function(){return(0,wc.wx)(o,(function(e){return"global"===e.uuid}))}),[o]),R=(0,s.useMemo)((function(){return(0,wc.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),D=(0,s.useMemo)((function(){return(0,P.jsxs)(_c,{width:T,children:[a&&(0,P.jsxs)(zl.Z,{children:[(0,P.jsx)(Nl.Z,{md:1,children:(0,P.jsx)(Oc,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Cc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),yc.Am.success("Successfully copied to clipboard.",{position:yc.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Nl.Z,{md:4,children:(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){m(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"variable",small:!0,value:h})})}),(0,P.jsx)(Nl.Z,{md:7,children:(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){y(e.target.value),e.preventDefault()},onKeyDown:I,paddingHorizontal:0,placeholder:"enter value",small:!0,value:b})})})]}),null===A||void 0===A?void 0:A.map((function(e){return(0,P.jsx)(Ec,{deleteVariable:function(){return w(e.uuid)},fetchVariables:n,pipelineUUID:k,variable:e})}))]})}),[w,A,h,b,k,m,y,f,a,T]),M=(0,s.useMemo)((function(){return(0,P.jsx)(_c,{width:T,children:null===R||void 0===R?void 0:R.map((function(e){return(0,P.jsx)(Ec,{copyText:(n=e.uuid,"from mage_ai.data_preparation.variable_manager import (\n get_variable,\n)\n\n".concat(function(e,n,t){return"\n".concat(t," = get_variable('").concat(e,"', '").concat(n,"', '").concat(t,"')\n")}(k,null===i||void 0===i?void 0:i.uuid,n))),hideEdit:!0,pipelineUUID:k,variable:e});var n}))})}),[R,i,T]);return(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Tr.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(j.ZP,{Icon:X.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:D}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"Global variables will be passed into all non-scratchpad blocks as keyword arguments (Python), interpolated variables (SQL), or vector elements (R). To load a global variable, use the following syntax:"})}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For Python (",(0,P.jsx)(ln.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(kc.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For SQL (",(0,P.jsx)(ln.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(kc.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsxs)(_.ZP,{bold:!0,large:!0,children:["For R (",(0,P.jsx)(ln.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,P.jsx)(kc.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(Tr.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,P.jsx)(Z.Z,{mb:$.cd}),(0,P.jsx)(_.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(Sc.Xm).map((function(e){var n;return(0,P.jsxs)(Z.Z,{mb:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{large:!0,monospace:!0,children:(0,ue.vg)(null===(n=Sc.Z4[e])||void 0===n?void 0:n.call(Sc.Z4))})}),(0,wc.JZ)([],e).map((function(e){return(0,P.jsx)(Ec,{hideEdit:!0,variable:e,pipelineUUID:k})}))]})})),R&&R.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{my:2,children:(0,P.jsx)(Tr.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,P.jsx)(Z.Z,{mb:2,children:M}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{children:["Output variables can be used in any ",(0,P.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:v.tf.SCRATCHPAD})," block."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"To load the variable, use the following syntax:"})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(kc.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.variable_manager import (\n get_variable,\n )\n\n\n df = get_variable(\n 'pipeline_uuid',\n 'block_uuid',\n 'variable_name',\n )\n"})})]})]})},Ic=t(37771);function Tc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ac(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Tc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Tc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Rc=function(e){var n=e.cancelPipeline,t=e.checkIfPipelineRunning,i=e.executePipeline,r=e.isPipelineExecuting,o=e.pipelineExecutionHidden,l=e.pipelineMessages,c=e.setPipelineExecutionHidden,u=(0,s.useMemo)((function(){return(null===l||void 0===l?void 0:l.length)||0}),[l]),a=(0,s.useMemo)((function(){return u>100?l.slice(-100):l}),[u,l]),d=(0,s.useCallback)((function(){var e=!o;c(e),(0,S.t8)(S.Q9,e)}),[o,c]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,P.jsxs)(He.Z,{children:[(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.JM,{inverted:!0,size:2*$.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,P.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,P.jsx)(Z.Z,{ml:1}),r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(g.Z,{beforeIcon:(0,P.jsx)(X.x8,{inverted:!0,size:2*$.iI}),onClick:n,success:!0,children:(0,P.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,P.jsx)(Z.Z,{ml:1})]}),(0,P.jsx)(g.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,P.jsxs)(He.Z,{alignItems:"center",children:[(0,P.jsx)(Z.Z,{ml:1}),(0,P.jsx)(_.ZP,{children:"Hide"}),(0,P.jsx)(Z.Z,{mr:1}),(0,P.jsx)(Gr.Z,{checked:o,onCheck:d})]})]}),!o&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Z.Z,{mb:1}),(0,P.jsx)(Ic.k,{noScrollbarTrackBackground:!0,children:(0,P.jsx)(jt,{executedAndIdle:!0,hasError:!1,selected:!0,children:a.map((function(e,n){var t=e.data,i=e.type,r=[],o=(r=(r=Array.isArray(t)?t:[t]).filter((function(e){return e}))).length;return r.map((function(e,t){var r,l={first:0===n&&0===t,last:n===u-1&&t===o-1};return Pn.jU.includes(i)?r=(0,P.jsx)(yt,Ac(Ac({},l),{},{children:(0,P.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,P.jsx)(mt(),{children:e})})})):i===Pn.Gi.IMAGE_PNG&&(r=(0,P.jsx)("div",{style:{backgroundColor:"white"},children:(0,P.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,P.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var Dc=function(e){var n=e.fetchSecrets,t=e.pipelineUUID,i=e.secrets,r=e.setErrorMessages,o=e.width,c=(0,s.useState)(!1),u=c[0],a=c[1],f=(0,s.useState)(),p=f[0],h=f[1],m=(0,s.useState)(),v=m[0],g=m[1],b=(0,s.useMemo)((function(){return o-$.cd*$.iI*2}),[o]),y=(0,d.Db)(be.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{onErrorCallback:function(e){var n=e.error,t=n.message,i=n.exception;r((function(e){var n=e||[];return i&&(n=n.concat(i)),t&&(n=n.concat(t)),n}))}})}}),k=(0,l.Z)(y,1)[0],C=(0,d.Db)((function(e){return be.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),E=(0,l.Z)(C,1)[0],S=(0,s.useCallback)((function(e){"Enter"===e.key?(k({secret:{name:p,value:v}}).then((function(){n(),h(null),g(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[k,n,p,v]);return(0,P.jsxs)(Z.Z,{p:$.cd,children:[(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(x.Z,{alignItems:"center",children:[(0,P.jsx)(Tr.Z,{level:4,monospace:!0,children:"Secrets"}),(0,P.jsx)(Z.Z,{ml:2}),(0,P.jsx)(j.ZP,{Icon:X.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{children:[(0,P.jsx)(_.ZP,{inline:!0,warning:!0,children:"WARNING:"})," the encryption key is stored in a file on your machine. If you need more secure encryption, we recommend using a secrets manager."]})}),u&&(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,P.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsxs)(_c,{width:b,children:[u&&(0,P.jsxs)(zl.Z,{children:[(0,P.jsx)(Nl.Z,{md:1,children:(0,P.jsx)(Oc,{noPadding:!0,children:(0,P.jsx)(j.ZP,{backgroundColor:Cc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),yc.Am.success("Successfully copied to clipboard.",{position:yc.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,P.jsx)(X.CK,{size:2.5*$.iI})})})}),(0,P.jsx)(Nl.Z,{md:4,children:(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,P.jsx)(Nl.Z,{md:7,children:(0,P.jsx)(Oc,{children:(0,P.jsx)(O.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){g(e.target.value),e.preventDefault()},onKeyDown:S,paddingHorizontal:0,placeholder:"secret value",small:!0,value:v})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,P.jsx)(Ec,{deleteVariable:function(){return E(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"Secrets are not editable, they can only be created and deleted. Secrets are shared across the project, and can be used in configuration fields. To reference a secret, use the following templating syntax:"})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(kc.Z,{language:"yaml",small:!0,source:"\n {{ mage_secret_var('<secret_name>') }}\n ",maxWidth:b})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(_.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,P.jsx)(Z.Z,{mb:$.cd,children:(0,P.jsx)(kc.Z,{language:"python",small:!0,source:"\n from mage_ai.data_preparation.shared.secrets import get_secret_value\n\n get_secret_value('<secret_name>')\n ",maxWidth:b})})]})},Mc=t(66607),Nc=t(33699),Lc=t(15270),Bc=t(64155),Fc=t(72454);function Uc(e){var n=e.activeView,t=e.pipelineUUID;return re.map((function(e){var i=e.key,r=e.label;return{Icon:le[i],id:i,isSelected:function(){return n===i},label:function(){return r},linkProps:{as:"/pipelines/".concat(t,"/edit?").concat(ne,"=").concat(i),href:"/pipelines/[pipeline]/edit"}}}))}var Hc=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,r=e.autocompleteItems,o=e.blockRefs,l=e.blocks,c=e.blocksInNotebook,u=e.cancelPipeline,a=e.chartRefs,d=e.checkIfPipelineRunning,f=e.deleteBlock,p=e.deleteWidget,m=e.editingBlock,v=e.executePipeline,b=e.fetchFileTree,j=e.fetchPipeline,y=e.fetchSecrets,O=e.fetchVariables,C=e.globalVariables,E=e.insights,w=e.interruptKernel,I=e.isPipelineExecuting,T=e.lastTerminalMessage,A=e.messages,R=e.metadata,D=e.onChangeCallbackBlock,M=e.onChangeChartBlock,N=e.onChangeCodeBlock,L=e.pipeline,B=e.pipelineMessages,F=e.runBlock,H=e.runningBlocks,z=e.sampleData,W=e.savePipelineContent,G=e.secrets,V=e.selectedBlock,Q=e.selectedFilePath,q=e.sendTerminalMessage,Y=e.setActiveSidekickView,K=e.setAnyInputFocused,J=e.setDisableShortcuts,ne=e.setEditingBlock,re=e.setErrors,oe=e.setSelectedBlock,le=e.setTextareaFocused,ce=e.statistics,ue=e.textareaFocused,ae=e.updateWidget,se=e.widgets,de=(0,Zo.i)().height,fe=un.uX,pe=(0,s.useState)([]),he=pe[0],me=pe[1],ve=(0,s.useState)(!!(0,S.U2)(S.Q9)),ge=ve[0],be=ve[1],je=Fc.k1,ye=(0,s.useMemo)((function(){return i-je}),[i,je]),ke=((null===m||void 0===m?void 0:m.upstreamBlocks)||{}).block,Ze=((null===z||void 0===z?void 0:z.columns)||[]).slice(0,100),_e=(null===z||void 0===z?void 0:z.rows)||[],Oe=(null===R||void 0===R?void 0:R.column_types)||{},Ce=null===Ze||void 0===Ze?void 0:Ze.map((function(e){return{columnType:Oe[e],uuid:e}})),Ee=(null===E||void 0===E?void 0:E[1])||{},Se=(0,s.useMemo)((function(){return(0,ee.HK)((null===E||void 0===E?void 0:E[0])||[],(function(e){return e.feature.uuid}))}),[E]),we=(0,wc.v0)({statistics:ce}),Pe=(0,wc.CL)({columnTypes:Oe,statistics:ce}),Ie=!!z,Te=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===L||void 0===L?void 0:L.type)}),[L]),Ae=k.qL.STREAMING!==(null===L||void 0===L?void 0:L.type)?-78:ge?-22:Ic.N,Re=(0,s.useCallback)((0,Zc.Fk)({columnTypes:Oe,columns:Ze,insightsByFeatureUUID:Se,insightsOverview:Ee,noColumnLinks:!0,statistics:ce}),[Oe,Ze,Se,Ee,ce]),De=(0,s.useMemo)((function(){return(0,P.jsx)(Pc,{blocks:l,fetchVariables:O,pipeline:L,selectedBlock:V,setErrorMessages:me,variables:C,width:ye})}),[ye,l,O,C,L,V]),Me=(0,s.useMemo)((function(){return(0,P.jsx)(jc,{selectedBlock:V,selectedFilePath:Q,setErrors:re,width:ye>an.nn?ye-an.nn:ye})}),[ye,V,Q,re]),Ne=(0,s.useMemo)((function(){return(0,P.jsx)(Dc,{fetchSecrets:y,pipelineUUID:null===L||void 0===L?void 0:L.uuid,secrets:G,setErrorMessages:me,width:ye})}),[ye,y,L,G]);return(0,P.jsxs)(P.Fragment,{children:[(null===he||void 0===he?void 0:he.length)>=1&&(0,P.jsxs)(Z.Z,{mb:3,mt:2,mx:2,children:[(0,P.jsxs)(x.Z,{justifyContent:"space-between",children:[(0,P.jsx)(_.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,P.jsx)(g.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return me([])},transparent:!0,children:(0,P.jsx)(X.x8,{muted:!0})})]}),null===he||void 0===he?void 0:he.map((function(e){return(0,P.jsx)(Z.Z,{pb:1,children:(0,P.jsx)(_.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,P.jsxs)(x.Z,{children:[(0,P.jsxs)(Bc.t0,{fullWidth:te.includes(n),heightOffset:U.TERMINAL===n?0:an.nn,onBlur:function(){return J(!1)},onFocus:function(){return J(!0)},widthOffset:je,children:[n===U.TREE&&(0,P.jsx)(h,{uuid:"PipelineDetail/".concat(null===L||void 0===L?void 0:L.uuid),children:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(gt.Z,{blockRefs:o,editingBlock:m,enablePorts:!Te,fetchPipeline:j,height:de-fe-Ae,pipeline:L,runningBlocks:H,selectedBlock:V,setEditingBlock:ne,setErrors:re,setSelectedBlock:oe}),!ke&&k.qL.STREAMING===(null===L||void 0===L?void 0:L.type)&&(0,P.jsx)(Z.Z,{p:1,children:(0,P.jsx)(Rc,{cancelPipeline:u,checkIfPipelineRunning:d,executePipeline:v,isPipelineExecuting:I,pipelineExecutionHidden:ge,pipelineMessages:B,setPipelineExecutionHidden:be})})]})}),n===U.DATA&&Ze.length>0&&(0,P.jsx)(vt.Z,{columnHeaderHeight:(0,xe.Qr)(Oe)&&(0,xe.Qr)(Se)&&(0,xe.Qr)(Ee)?0:Bc.Eh,columns:Ze,height:de-fe-un.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:Re,rows:_e,width:ye}),n===U.REPORTS&&(0,P.jsx)(Bc.ht,{noPadding:!V||!Ie,children:(0,P.jsxs)(x.Z,{flexDirection:"column",fullWidth:!0,children:[we&&(0,P.jsx)(Mc.Z,{stats:we,title:"Quality metrics"}),Pe&&(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(Mc.Z,{stats:Pe,title:"Statistics"})}),Ce.length>0&&(0,P.jsx)(Z.Z,{mt:$.cd,children:(0,P.jsx)(gc,{features:Ce,statistics:ce})})]})}),n===U.GRAPHS&&(0,P.jsx)(Bc.ht,{noPadding:!V||!Ie,children:(0,P.jsx)(Qo,{afterWidth:ye,features:Ce,insightsOverview:Ee,statistics:ce})}),U.SECRETS===n&&Ne,U.VARIABLES===n&&De,U.FILE_VERSIONS===n&&(0,P.jsx)(h,{uuid:"FileVersions/".concat(Q?decodeURIComponent(Q):""),children:Me}),Te||V&&Ie||!V&&Ie&&n===U.DATA?null:ie.includes(n)&&(0,P.jsx)(x.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:fe,width:ye,children:(0,P.jsx)(_.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:V?!Ie&&"No data or insights available":"Select a block for insights"})}),U.CHARTS===n&&(se.length>0?(0,P.jsx)(ql,{autocompleteItems:r,blockRefs:o,blocks:l,chartRefs:a,deleteWidget:p,fetchFileTree:b,fetchPipeline:j,messages:A,onChangeChartBlock:M,pipeline:L,runBlock:F,runningBlocks:H,savePipelineContent:W,selectedBlock:V,setAnyInputFocused:K,setSelectedBlock:oe,setTextareaFocused:le,textareaFocused:ue,updateWidget:ae,widgets:se,width:ye}):(0,P.jsxs)(x.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:fe,width:ye,children:[(0,P.jsx)(Z.Z,{pl:1}),(0,P.jsx)(Kl,{size:358}),(0,P.jsx)(Z.Z,{pr:1})]})),U.TERMINAL===n&&(0,P.jsx)("div",{style:{height:"100%",position:"relative",width:ye},children:(0,P.jsx)(Nc.Z,{interruptKernel:w,lastMessage:T,onFocus:function(){return oe(null)},sendMessage:q,width:ye})}),U.EXTENSIONS===n&&(0,P.jsx)(cc,{addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:o,blocks:l,blocksInNotebook:c,deleteBlock:f,fetchFileTree:b,fetchPipeline:j,interruptKernel:w,messages:A,onChangeCallbackBlock:D,onChangeCodeBlock:N,pipeline:L,runBlock:F,runningBlocks:H,savePipelineContent:W,selectedBlock:V,setAnyInputFocused:K,setErrors:re,setSelectedBlock:oe,setTextareaFocused:le,textareaFocused:ue})]}),(0,P.jsx)(Fc.lm,{borderLeft:!0,children:(0,P.jsx)(Lc.Z,{aligned:"right",navigationItems:Uc({activeView:n,pipelineUUID:null===L||void 0===L?void 0:L.uuid,setActiveSidekickView:Y})})})]})]})},zc=t(12691),Wc=t.n(zc);var Gc=function(e){var n=e.activeView,t=e.pipeline,i=null===t||void 0===t?void 0:t.uuid,r=(0,ic.iV)(),o=oe[n],l=(0,P.jsx)(_.ZP,{bold:!0,children:null===o||void 0===o?void 0:o.label}),c=U.EXTENSIONS===n&&(null===r||void 0===r?void 0:r.extension),u=be.ZP.extension_options.list({},{},{pauseFetch:!c}).data,a=(0,s.useMemo)((function(){return(null===u||void 0===u?void 0:u.extension_options)||[]}),[u]),d=(0,s.useMemo)((function(){return(0,ee.HK)(a,(function(e){return e.uuid}))}),[a]);if(!n)return(0,P.jsx)("div",{});if(c){var f=d[null===r||void 0===r?void 0:r.extension];l=(0,P.jsxs)(x.Z,{children:[(0,P.jsx)(Wc(),{as:"/pipelines/".concat(i,"/edit?").concat(ne,"=").concat(U.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,P.jsx)(ln.Z,{default:!0,children:null===o||void 0===o?void 0:o.label})}),(0,P.jsx)(_.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,P.jsx)(_.ZP,{bold:!0,children:null===f||void 0===f?void 0:f.name})]})}return(0,P.jsx)(Z.Z,{px:$.cd,children:l})},Vc=t(94353),Qc=t(28799);function qc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?qc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Kc(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),p=(0,Zo.i)().height,b=(0,s.useState)(!!(0,S.U2)(S.zg)),y=b[0],_=b[1],O=(0,s.useState)(null),C=O[0],w=O[1],I=(0,s.useState)(null),T=I[0],A=I[1],M=(0,s.useState)(null),N=M[0],L=M[1],B=(0,s.useState)(null),F=B[0],H=B[1],z=(0,s.useState)([]),W=z[0],G=z[1],V=(0,s.useState)({}),Q=V[0],q=V[1],Y=(0,s.useState)(!1),J=Y[0],te=Y[1],ie=(0,s.useState)(!1),re=ie[0],oe=ie[1],le=(0,s.useState)(!1),ce=le[0],ae=le[1],se=(0,s.useRef)(null),de=(0,s.useState)({}),fe=de[0],pe=de[1],he=(0,s.useState)([]),me=he[0],ve=he[1],ge=be.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),ye=ge.data,ke=ge.mutate,Ze=null===ye||void 0===ye?void 0:ye.kernels,_e=(null===Ze||void 0===Ze?void 0:Ze.find((function(e){return e.name===k.a_[null===De||void 0===De?void 0:De.type]})))||(null===Ze||void 0===Ze?void 0:Ze[0]),Oe=c.uuid,Ce=(0,xt.Z)(Oe),Ee=be.ZP.pipelines.detail(Oe,{includes_outputs:(0,xe.Qr)(fe)},{refreshInterval:6e4}),Se=Ee.data,we=Ee.mutate,Pe=be.ZP.files.list(),Ie=Pe.data,Te=Pe.mutate,Ae=(0,s.useMemo)((function(){return(null===Ie||void 0===Ie?void 0:Ie.files)||[]}),[Ie]),De=null===Se||void 0===Se?void 0:Se.pipeline,Me=(0,s.useMemo)((function(){return k.qL.INTEGRATION===(null===De||void 0===De?void 0:De.type)}),[De]),Ne=(0,s.useState)(null),Le=Ne[0],Be=Ne[1],Fe=(0,s.useState)((0,Sn.Tz)({dateObj:!0})),He=Fe[0],ze=Fe[1],We=(0,s.useState)(!1),Ge=We[0],Ve=We[1],Qe=(0,Re.dd)((function(){return(0,P.jsx)(Eo.Z,{centerOnScreen:!0,neutral:!0,onClick:Ke,subtitle:"Please refresh your page to have the most up-to-date data before making any changes.",title:"Your pipeline may be stale.",width:34*$.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),qe=(0,l.Z)(Qe,2),Ye=qe[0],Ke=qe[1];(0,s.useEffect)((function(){var e,n;null!==Se&&void 0!==Se&&null!==(e=Se.pipeline)&&void 0!==e&&e.updated_at&&(null===Le||void 0===Le?void 0:Le.toISOString())!==new Date(null===Se||void 0===Se||null===(n=Se.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&Be(new Date(Se.pipeline.updated_at)),Le&&Number(Le)>Number(He)&&Ye()}),[null===Se||void 0===Se||null===(n=Se.pipeline)||void 0===n?void 0:n.updated_at,Le,He,Ye]),(0,s.useEffect)((function(){null!==Se&&void 0!==Se&&Se.error&&A({errors:(0,je.QZ)(Se),response:Se})}),[Se]);var Je=(0,ic.iV)(),$e=Je.sideview,en=Je.block_uuid,nn=Je.file_path,tn=(0,s.useMemo)((function(){var e=Je["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[Je]),rn=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(0,ic.iV)().sideview!==e&&(0,mn.u7)((0,o.Z)({},ne,e),{pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){$e||rn(U.TREE,!1)}),[$e,rn]);var ln=(0,s.useCallback)((function(e,n){rn(e,n),_(!1)}),[rn]),cn=(0,s.useRef)({}),un=(0,s.useRef)({}),an=(0,s.useRef)({}),sn=(0,s.useRef)({}),dn=(0,s.useRef)({}),fn=(0,s.useCallback)((function(e,n,t){var i=an.current||{};an.current=Yc(Yc({},i),{},(0,o.Z)({},e,Yc(Yc({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[an]),pn=(0,s.useCallback)((function(e,n,t){var i=sn.current||{};sn.current=Yc(Yc({},i),{},(0,o.Z)({},e,Yc(Yc({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[sn]),hn=(0,s.useCallback)((function(e,n,t){fn(e,n,t),Ve(!0)}),[fn,Ve]),vn=(0,s.useCallback)((function(e,n,t){pn(e,n,t),Ve(!0)}),[pn,Ve]),gn=(0,s.useCallback)((function(e){dn.current=Yc(Yc({},dn.current),e)}),[dn]),jn=(0,s.useCallback)((function(e,n){gn((0,o.Z)({},e,n)),Ve(!0)}),[gn,Ve]),yn=(0,s.useState)(null),kn=yn[0],Zn=yn[1],_n=be.ZP.data_providers.list({},{revalidateOnFocus:!0}).data,On=null===_n||void 0===_n?void 0:_n.data_providers,Cn=be.ZP.variables.pipelines.list(Oe),En=Cn.data,In=Cn.mutate,Tn=null===En||void 0===En?void 0:En.variables,An=be.ZP.secrets.list(),Rn=An.data,Dn=An.mutate,Mn=null===Rn||void 0===Rn?void 0:Rn.secrets,Nn=(0,s.useState)([]),Ln=Nn[0],Bn=Nn[1],Fn=(0,s.useState)([]),Un=Fn[0],Hn=Fn[1],zn=(0,s.useRef)({}),Wn=(0,s.useCallback)((function(e){var n;Ve(!0);var t=zn.current[e.uuid]||{},i=t.upstream_blocks;(null===e||void 0===e||null===(n=e.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(i=e.upstream_blocks),zn.current[e.uuid]=Yc(Yc(Yc({},t),e),{},{configuration:Yc(Yc({},t.configuration),e.configuration),upstream_blocks:i})}),[Ve,zn]),Gn=(0,s.useState)(!1),Vn=Gn[0],Qn=Gn[1],qn=(0,s.useState)({upstreamBlocks:null}),Yn=qn[0],Kn=qn[1],Xn=(0,s.useState)([]),Jn=Xn[0],$n=Xn[1],et=(0,s.useState)(null),nt=et[0],tt=et[1],it=(0,s.useState)(null),rt=(it[0],it[1]),ot=function(e,n){var t=(0,ee.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}(Lt(Oe),Ln),lt=(0,s.useState)(ot),ct=lt[0],ut=lt[1],at=(0,s.useState)(),st=at[0],dt=at[1],ft=(0,s.useState)(),pt=ft[0],ht=ft[1],mt=(0,s.useState)(null),vt=mt[0],gt=mt[1],bt=(0,xt.Z)(ct),jt=(0,s.useCallback)((function(){Kn({upstreamBlocks:{block:null,values:[]}}),pe({}),Ve(!1),$n([]),tt(null)}),[]);(0,s.useEffect)((function(){Oe!==Ce&&(an.current={},sn.current={})}),[Oe,Ce]);var yt=be.ZP.blocks.pipelines.outputs.detail(!y&&Oe,(null===vt||void 0===vt?void 0:vt.type)!==v.tf.SCRATCHPAD&&(null===vt||void 0===vt?void 0:vt.type)!==v.tf.CHART&&(null===vt||void 0===vt?void 0:vt.uuid)&&encodeURIComponent(null===vt||void 0===vt?void 0:vt.uuid)),kt=yt.data,Zt=yt.mutate,_t=(0,s.useMemo)((function(){var e,n,t;return Me?null===(e=(0,ee.sE)(null===kt||void 0===kt?void 0:kt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,ue.kE)(pt))})))||void 0===e?void 0:e.sample_data:null===kt||void 0===kt||null===(n=kt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[kt,Me,pt]),Ot=be.ZP.blocks.pipelines.analyses.detail(!y&&Oe,(null===vt||void 0===vt?void 0:vt.type)!==v.tf.SCRATCHPAD&&(null===vt||void 0===vt?void 0:vt.type)!==v.tf.CHART&&(null===vt||void 0===vt?void 0:vt.uuid)&&encodeURIComponent(null===vt||void 0===vt?void 0:vt.uuid)),Et=Ot.data,St=Ot.mutate,wt=(null===Et||void 0===Et||null===(t=Et.analyses)||void 0===t?void 0:t[0])||{},Pt=wt.insights,It=void 0===Pt?{}:Pt,Tt=wt.metadata,At=void 0===Tt?{}:Tt,Rt=wt.statistics,Bt=void 0===Rt?{}:Rt;(0,s.useEffect)((function(){0===Jn.length&&(St(),Zt(),In())}),[St,Zt,In,Jn]),(0,s.useEffect)((function(){if(0===ct.length)gt(null);else if((null===bt||void 0===bt?void 0:bt.length)!==(null===ct||void 0===ct?void 0:ct.length)&&(null===ct||void 0===ct?void 0:ct.length)<(null===bt||void 0===bt?void 0:bt.length)){var e=bt.findIndex((function(e){return e.uuid===(null===vt||void 0===vt?void 0:vt.uuid)})),n=bt.length-1===e?e-1:e+1;gt(bt[Math.max(0,n)])}}),[ct,bt,null===vt||void 0===vt?void 0:vt.uuid]),(0,s.useEffect)((function(){var e;null!==(e=Yn.upstreamBlocks)&&void 0!==e&&e.block&&(_(!1),rn(U.TREE))}),[Yn.upstreamBlocks,rn]);var Ft=be.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!0}),Ut=Ft.data,Ht=Ft.mutate,zt=null===Ut||void 0===Ut?void 0:Ut.autocomplete_items;(0,s.useEffect)((function(){H(nn)}),[nn]),(0,s.useEffect)((function(){(0,ee.fS)(tn,W)||G(tn)}),[tn,W]);var Wt=(0,d.Db)(be.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.pipeline.uuid;u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),Te()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),Gt=(0,l.Z)(Wt,1)[0],Vt=(0,d.Db)(be.ZP.pipelines.useUpdate(Oe,{update_content:!0}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Ve(!1),we()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),Qt=(0,l.Z)(Vt,2),qt=Qt[0],Yt=Qt[1].isLoading,Kt=(0,s.useCallback)((function(e,n){var t=e||{},i=t.block,r=t.pipeline,o=void 0===r?{extensions:{}}:r,c=(n||{}).contentOnly;if(!(Le&&Number(Le)>Number(He))){var u=(0,Sn.Tz)({dateObj:!0}),a=(0,Sn.Tz)();ze(u);var s={},d=[];Ln.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,f=null===(n=sn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof f&&(f=e.content);var p,h=null===(t=an.current[u])||void 0===t?void 0:t[a];"undefined"===typeof h&&(h=e.callback_content);var m=null===(r=fe[a])||void 0===r?void 0:r.filter((function(e){return!!e})),g=null===m||void 0===m?void 0:m.find((function(e){return e.error}));if(m){var b=[];m.forEach((function(n){var t=n.data,i=n.type;(v.tf.SCRATCHPAD===e.type||g||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Ct)?e:e.concat(n)}),[])),b.push(n))})),p=b.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(a,"_").concat(n)}}))}var x=Yc(Yc({},e),{},{callback_content:h,content:f,outputs:p});if((null===i||void 0===i?void 0:i.uuid)===a&&Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];"object"===typeof i&&!Array.isArray(i)&&i?Object.entries(i).forEach((function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];x[t]||(x[t]={}),x[t][i]=r})):x[t]=i})),c)return d.push({callback_content:x.callback_content,content:x.content,outputs:x.outputs,uuid:x.uuid});[v.tf.EXTENSION].includes(u)?(s[o]||(s[o]=[]),s[o].push(x)):d.push(x)}));var f=Yc(Yc({},null===De||void 0===De?void 0:De.extensions),null===o||void 0===o?void 0:o.extensions);return Object.entries(s).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];f[t]||(f[t]={}),f[t].blocks=i})),qt({pipeline:Yc(Yc(Yc({},De),o),{},{blocks:d,extensions:f,updated_at:a,widgets:Un.map((function(e){var n,t,i=dn.current[e.uuid],r=zn.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=fe[e.uuid])||void 0===n?void 0:n.filter((function(e){return!!e})),l=null===o||void 0===o?void 0:o.find((function(e){return e.error}));if(o){var c=[];o.forEach((function(n){var t=n.data,i=n.type;(v.tf.SCRATCHPAD===e.type||l||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Ct)?e:e.concat(n)}),[])),c.push(n))})),t=c.map((function(n,t){return{text_data:JSON.stringify(n),variable_uuid:"".concat(e.uuid,"_").concat(t)}}))}return Yc(Yc(Yc({},e),r),{},{configuration:Yc(Yc({},e.configuration),r.configuration),content:i,outputs:t})}))})})}Ye()}),[Ln,fe,De,Le,He,Ye,qt,Un]),Xt=(0,s.useCallback)((function(e){Kt();var n=encodeURIComponent(e),t=(0,ic.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,mn.u7)({file_path:n,"file_paths[]":t})}),[Kt]),Jt=(0,s.useMemo)((function(){var e=[],n=[];return Ln.forEach((function(t){v.tf.EXTENSION===t.type?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[Ln]),$t=Jt.blocksInNotebook,ei=Jt.blocksInSidekick,ni=(0,s.useCallback)((function(e,n){return Kt({pipeline:{name:e,type:n}}).then((function(e){var t,i;if(null!==e&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.pipeline){var r=e.data.pipeline.uuid;Oe!==r?window.location.href="/pipelines/".concat(r,"/edit"):(Te(),n!==(null===De||void 0===De?void 0:De.type)&&we(),Mt($t,Oe,r),Mt(ei,Oe,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&A((function(e){return Yc(Yc({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Xt("pipelines/".concat(Oe,"/").concat(R.METADATA_YAML)),A(null)}}]})}))}))}),[$t,ei,Te,we,Xt,null===De||void 0===De?void 0:De.type,Oe,Kt]),ti=(0,d.Db)((function(e){var n=e.extension_uuid,t=e.uuid,i={};return n&&(i.extension_uuid=n),be.ZP.blocks.pipelines.useDelete(Oe,encodeURIComponent(t),i)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;Bn((function(e){return(0,ee.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),we(),tt(null),t===v.tf.SCRATCHPAD&&Te()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;A({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&pe((function(e){return Yc(Yc({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Pn.Gi.TEXT_PLAIN}}))))}))}})}}),ii=(0,l.Z)(ti,1)[0],ri=(0,d.Db)((function(e){var n=e.uuid;return be.ZP.widgets.pipelines.useDelete(Oe,n)()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(e){var n=e.widget.uuid;Hn((function(e){return(0,ee.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),we(),Te()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;A({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&pe((function(e){return Yc(Yc({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Pn.Gi.TEXT_PLAIN}}))))}))}})}}),oi=(0,l.Z)(ri,1)[0],li=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&K[n]&&(r="".concat(r,".").concat(K[n].toLowerCase())),be.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){Ht(),we(),Te()},onErrorCallback:function(e,n){return A({displayMessage:"Error deleting block file. Check that there are no downstream blocks, then try again.",errors:n,response:e})}})}}),ci=(0,l.Z)(li,1)[0],ui=(0,d.Db)(be.ZP.kernels.useUpdate(null===_e||void 0===_e?void 0:_e.id),{onSuccess:function(e){return(0,je.wD)(e,{callback:function(){return ke()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),ai=(0,l.Z)(ui,1)[0],si=(0,s.useCallback)((function(){return ai({kernel:{action_type:"restart"}})}),[ai]),di=(0,s.useCallback)((function(){return ai({kernel:{action_type:"interrupt"}})}),[ai]),fi=(0,d.Db)(be.ZP.blocks.pipelines.useCreate(Oe)),pi=(0,l.Z)(fi,1)[0],hi=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ue.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=sn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(Me){var s=(0,ee.HK)((null===De||void 0===De?void 0:De.blocks)||[],(function(e){return e.type})),d=s[v.tf.DATA_EXPORTER],f=s[v.tf.DATA_LOADER],p=s[v.tf.TRANSFORMER];if(v.tf.DATA_LOADER===a){if(v.t6.YAML!==u)return void A({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void A({displayMessage:"Pipeline ".concat(null===De||void 0===De?void 0:De.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(v.tf.TRANSFORMER===a){if(p)return void A({displayMessage:"Pipeline ".concat(null===De||void 0===De?void 0:De.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(v.tf.DATA_EXPORTER===a){if(v.t6.YAML!==u)return void A({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void A({displayMessage:"Pipeline ".concat(null===De||void 0===De?void 0:De.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return pi({block:Yc({content:i,name:c,priority:n},e)}).then((function(e){(0,je.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),rt(null),Te(),we().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return Bn((function(e){var n=(0,r.Z)(t);Object.entries(i||{}).forEach((function(e){var t=(0,l.Z)(e,2),i=t[0],o=t[1].blocks;o&&n.push.apply(n,(0,r.Z)(o.map((function(e){return Yc(Yc({},e),{},{extension_uuid:i})}))))}));var o=(0,ee.HK)(e,(function(e){return e.uuid})),c=[];return n.forEach((function(e){var n=o[e.uuid];n?c.push(n):c.push(e)})),c}))}))},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}))}),[pi,Te,we,Me,Bn,A,De]),mi=(0,s.useState)(!1),vi=mi[0],gi=mi[1];(0,s.useEffect)((function(){gi(!!(0,S.U2)(E.k))}),[]);var bi=(0,Re.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,ue.Y6)():i,o=e.onCreateCallback;return(0,P.jsx)(D,{block:n,defaultName:r,onClose:yi,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return hi(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return yi()}))},pipeline:De})}),{},[hi,De],{background:!0,uuid:"configure_block_name_and_create"}),xi=(0,l.Z)(bi,2),ji=xi[0],yi=xi[1],ki=(0,d.Db)(be.ZP.widgets.pipelines.useCreate(Oe)),Zi=(0,l.Z)(ki,1)[0],_i=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,ue.Y6)();return Zi({widget:Yc({name:i,priority:n,type:v.tf.CHART},e)}).then((function(e){return(0,je.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),Te(),we(),rn(U.CHARTS),L(n)},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}))}),[Te,we,Zi,rn]);(0,s.useEffect)((function(){if(N){var e,n=null===(e=un.current[N.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),L(null))}}),[N,L]),(0,s.useEffect)((function(){Ce!==Oe&&(Bn([]),Hn([]),ut([]),ve([]))}),[Oe,Ce]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===De||void 0===De?void 0:De.blocks)||"undefined"!==typeof(null===De||void 0===De?void 0:De.extensions)){var e=[];"undefined"!==typeof(null===De||void 0===De?void 0:De.blocks)&&e.push.apply(e,(0,r.Z)(null===De||void 0===De?void 0:De.blocks)),"undefined"!==typeof(null===De||void 0===De?void 0:De.extensions)&&Object.entries((null===De||void 0===De?void 0:De.extensions)||{}).forEach((function(n){var t=(0,l.Z)(n,2),i=t[0],o=t[1].blocks;o&&e.push.apply(e,(0,r.Z)(o.map((function(e){return Yc(Yc({},e),{},{extension_uuid:i})}))))})),Bn(e)}}),[null===De||void 0===De?void 0:De.blocks,null===De||void 0===De?void 0:De.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===De||void 0===De?void 0:De.widgets)&&Hn(De.widgets)}),[null===De||void 0===De?void 0:De.widgets]),(0,s.useEffect)((function(){(null===ot||void 0===ot?void 0:ot.length)>0&&0===(null===ct||void 0===ct?void 0:ct.length)&&(ut(ot),gt(ot[0]))}),[ct,ot]);var Oi=(0,xt.Z)(Ln);(0,s.useEffect)((function(){if("undefined"!==typeof(null===De||void 0===De?void 0:De.blocks)&&(!Ln.length||!(0,ee.fS)(null===Oi||void 0===Oi?void 0:Oi.map((function(e){return e.uuid})).sort(),null===Ln||void 0===Ln?void 0:Ln.map((function(e){return e.uuid})).sort()))){var e=Dt(De.blocks),n=e.content,t=e.messages;sn.current=n,pe((function(e){return Yc(Yc({},t),e)}))}}),[Ln,Oi,null===De||void 0===De?void 0:De.blocks,pe]),(0,s.useEffect)((function(){if(!Un.length&&"undefined"!==typeof(null===De||void 0===De?void 0:De.widgets)){var e=Dt(De.widgets),n=e.content,t=e.messages;dn.current=n,pe((function(e){return Yc(Yc({},t),e)}))}}),[null===De||void 0===De?void 0:De.widgets,pe,Un]);var Ci=(0,s.useCallback)((function(e,n,t){var i=Ln.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(tt(i),null!==cn&&void 0!==cn&&cn.current){var r,o=cn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,mn.u7)({file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=Un.find((function(n){return n.uuid===e}));if(l&&(tt(l),null!==un&&void 0!==un&&un.current)){var c,u=un.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&Xt(t)}),[Ln,Xt,Un]);(0,s.useEffect)((function(){if(en&&!nt){var e=Ln.find((function(e){var n=e.uuid;return en===n}));e&&Ci(e.uuid,e.type,null)}else(null===Oi||void 0===Oi?void 0:Oi.length)!==(null===Ln||void 0===Ln?void 0:Ln.length)&&nt&&Ci(nt.uuid,nt.type,null)}),[en,null===Oi||void 0===Oi?void 0:Oi.length,Ln,Ci,nt]);var Ei=(0,s.useMemo)((function(){return new m.Z}),[]),Si=(0,s.useMemo)((function(){return{api_key:Vc.l,token:Ei.decodedToken.token}}),[Ei]),wi=(0,a.ZP)((0,Qc.Ib)(),{onClose:function(){return console.log("socketUrlPublish closed")},onMessage:function(e){if(e){var n=JSON.parse(e.data),t=n.block_type,i=n.execution_state,l=n.msg_type,c=n.uuid,u=Ln.find((function(e){var n=e.type,i=e.uuid;return t===n&&c===i}));"stream_pipeline"!==l?pe((function(e){var t=e[c]||[];return Yc(Yc({},e),{},(0,o.Z)({},c,t.concat(n)))})):(ve((function(e){return[].concat((0,r.Z)(e),[n])})),Pn.uF.IDLE===i&&($n([]),we(),c||Qn(!1))),Pn.uF.BUSY===i?$n((function(e){return e.find((function(e){var n=e.uuid;return c===n}))||!u?e:e.concat(u)})):Pn.uF.IDLE===i&&$n((function(e){return e.filter((function(e){var n=e.uuid;return c!==n}))})),Ve(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,Pi=(0,s.useCallback)((function(){Kt().then((function(){Qn(!0),ve([]),wi(JSON.stringify(Yc(Yc({},Si),{},{execute_pipeline:!0,pipeline_uuid:Oe})))}))}),[Oe,Kt,wi,Si]),Ii=(0,s.useCallback)((function(){wi(JSON.stringify(Yc(Yc({},Si),{},{cancel_pipeline:!0,pipeline_uuid:Oe})))}),[Oe,wi,Si]),Ti=(0,s.useCallback)((function(){wi(JSON.stringify(Yc(Yc({},Si),{},{cancel_pipeline:!0,pipeline_uuid:Oe,skip_publish_message:!0})))}),[Oe,wi,Si]),Ai=(0,s.useCallback)((function(){wi(JSON.stringify(Yc(Yc({},Si),{},{check_if_pipeline_running:!0,pipeline_uuid:Oe})))}),[Oe,wi,Si]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",Ti),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",Ti),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",Ti),window.removeEventListener("pagehide",Ti)}}),[Ti,null===u||void 0===u?void 0:u.events]);var Ri=(0,s.useCallback)((function(e){var n=e.block,t=e.code,i=e.ignoreAlreadyRunning,r=e.runDownstream,o=void 0!==r&&r,l=e.runSettings,c=void 0===l?{}:l,u=e.runUpstream,a=void 0!==u&&u,s=e.runTests,d=void 0!==s&&s,f=n.extension_uuid,p=n.upstream_blocks,h=n.uuid;Jn.find((function(e){var n=e.uuid;return h===n}))&&!i||(wi(JSON.stringify(Yc(Yc({},Si),{},{code:t,extension_uuid:f,pipeline_uuid:null===De||void 0===De?void 0:De.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,upstream_blocks:p,uuid:h}))),pe((function(e){return delete e[h],e})),te(!1),$n((function(e){return e.find((function(e){var n=e.uuid;return h===n}))?e:e.concat(n)}))),we()}),[we,De,Jn,wi,pe,$n,te,Si]),Di=(0,s.useCallback)((function(e){var n=e.block;return Kt({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return Ri(e)}))}),[Ri,Kt]),Mi=(0,a.ZP)((0,Qc.Ib)("terminal"),{shouldReconnect:function(){return!0},queryParams:Si}),Ni=Mi.lastMessage,Li=Mi.sendMessage,Bi=(0,s.useMemo)((function(){return(0,P.jsx)(Hc,{activeView:$e,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return ji({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:C,autocompleteItems:zt,blockRefs:cn,blocks:Ln,blocksInNotebook:$t,cancelPipeline:Ii,chartRefs:un,checkIfPipelineRunning:Ai,deleteBlock:ii,deleteWidget:oi,editingBlock:Yn,executePipeline:Pi,fetchFileTree:Te,fetchPipeline:we,fetchSecrets:Dn,fetchVariables:In,globalVariables:Tn,insights:It,interruptKernel:di,isPipelineExecuting:Vn,lastTerminalMessage:Ni,messages:fe,metadata:At,onChangeCallbackBlock:hn,onChangeChartBlock:jn,onChangeCodeBlock:vn,pipeline:De,pipelineMessages:me,runBlock:Di,runningBlocks:Jn,sampleData:_t,savePipelineContent:Kt,secrets:Mn,selectedBlock:nt,selectedFilePath:F,sendTerminalMessage:Li,setActiveSidekickView:rn,setAnyInputFocused:oe,setDisableShortcuts:ae,setEditingBlock:Kn,setErrors:A,setSelectedBlock:tt,setTextareaFocused:te,statistics:Bt,textareaFocused:J,updateWidget:Wn,widgets:Un})}),[$e,C,zt,cn,Ln,$t,Ii,Ai,ii,oi,Yn,Pi,Te,we,Dn,In,Tn,It,di,Vn,Ni,fe,At,hn,jn,vn,De,me,Di,Jn,_t,Kt,Mn,nt,F,Li,rn,oe,Kn,A,te,ji,Bt,J,Wn,Un]),Fi=(0,s.useMemo)((function(){return(0,P.jsx)(bo,{addNewBlockAtIndex:vi?hi:function(e,n,t,i){return new Promise((function(r,o){v.tf.DBT===(null===e||void 0===e?void 0:e.type)&&v.t6.SQL===(null===e||void 0===e?void 0:e.language)?hi(e,n,t,i):ji({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return _i(e,Un.length,t)},anyInputFocused:re,autocompleteItems:zt,blockRefs:cn,blocks:$t,dataProviders:On,deleteBlock:ii,disableShortcuts:ce,fetchFileTree:Te,fetchPipeline:we,fetchSampleData:Zt,files:Ae,globalVariables:Tn,interruptKernel:di,isPipelineUpdating:Yt,kernel:_e,mainContainerRef:se,mainContainerWidth:kn,messages:fe,onChangeCallbackBlock:hn,onChangeCodeBlock:vn,openSidekickView:ln,pipeline:De,pipelineContentTouched:Ge,pipelineLastSaved:Le,restartKernel:si,runBlock:Di,runningBlocks:Jn,savePipelineContent:Kt,selectedBlock:nt,setAnyInputFocused:oe,setEditingBlock:Kn,setErrors:A,setIntegrationStreams:dt,setMessages:pe,setOutputBlocks:ut,setPipelineContentTouched:Ve,setRecsWindowOpenBlockIdx:rt,setRunningBlocks:$n,setSelectedBlock:tt,setSelectedOutputBlock:gt,setSelectedStream:ht,setTextareaFocused:te,textareaFocused:J,widgets:Un})}),[hi,_i,re,zt,vi,cn,$t,On,ii,ce,Te,we,Zt,Ae,Tn,di,Yt,_e,se,kn,fe,hn,vn,ln,De,Ge,Le,si,Di,Jn,Kt,nt,oe,Kn,A,pe,Ve,$n,tt,te,ji,J,Un]),Ui=(0,s.useMemo)((function(){if(i===ko.b)return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(wn,{filePaths:W,filesTouched:Q,isBusy:Jn.length>=1,isPipelineUpdating:Yt,kernel:_e,pipeline:De,pipelineContentTouched:Ge,pipelineLastSaved:Le,restartKernel:si,savePipelineContent:Kt,selectedFilePath:F,setErrors:A,updatePipelineMetadata:ni}),(null===W||void 0===W?void 0:W.length)>0&&(0,P.jsx)(bn,{filePaths:W,filesTouched:Q,savePipelineContent:Kt,selectedFilePath:F})]})}),[Q,Yt,_e,i,De,Ge,Le,si,Jn,Kt,F,W,A,ni]),Hi=(0,s.useMemo)((function(){var e;return null===st||void 0===st||null===(e=st.filter((function(e){return(0,ee.sE)(null===kt||void 0===kt?void 0:kt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,ue.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(j.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return ht(e)},selected:pt===e,uuid:e,children:e})},e)}))}),[kt,st,pt]),zi=(0,s.useRef)(null),Wi=(0,s.useMemo)((function(){return(0,P.jsx)(Ue,{addNewBlock:function(e,n){hi(e,Ln.length,n,e.name),(null===tn||void 0===tn?void 0:tn.length)>=1&&u.push("/pipelines/".concat(Oe,"/edit"))},blocks:Ln,deleteBlockFile:ci,deleteWidget:oi,fetchFileTree:Te,fetchPipeline:we,files:Ae,onSelectBlockFile:Ci,openFile:Xt,openPipeline:function(e){jt(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:ln,pipeline:De,ref:zi,setErrors:A,setSelectedBlock:tt,widgets:Un})}),[hi,Ln,ci,oi,Te,we,null===tn||void 0===tn?void 0:tn.length,Ae,Ci,Xt,ln,De,Oe,jt,u,A,tt,Un]),Gi=(0,s.useMemo)((function(){if(i===ko.b)return(0,P.jsx)(on,{cancelPipeline:Ii,createPipeline:Gt,executePipeline:Pi,interruptKernel:di,isPipelineExecuting:Vn,restartKernel:si,savePipelineContent:Kt,setMessages:pe})}),[Ii,Gt,Pi,di,Vn,i,si,Kt,pe]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(xn.Z,{title:null===De||void 0===De?void 0:De.name}),(0,P.jsxs)(Co,{after:Bi,afterHeader:(0,P.jsx)(Gc,{activeView:$e,pipeline:De}),afterHidden:y,afterSubheader:(null===ct||void 0===ct?void 0:ct.length)>0&&$e===U.DATA&&(0,P.jsxs)(x.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!Me&&ct.map((function(e){var n=e.uuid,t=(null===vt||void 0===vt?void 0:vt.uuid)===n;return(0,P.jsx)(Z.Z,{pl:1,children:(0,P.jsx)(j.ZP,{afterElement:t?(0,P.jsx)(g.Z,{basic:!0,highlightOnHover:!0,onClick:function(){!function(e,n){var t=Lt(e).filter((function(e){return e!==n}));(0,S.t8)(Nt(e),t)}(Oe,e.uuid),ut((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,P.jsx)(X.x8,{muted:!0,size:1.25*$.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return gt(e)},selected:t,uuid:n,children:n})},n)})),Me&&Hi]}),before:Wi,beforeHeader:Gi,errors:T,headerOffset:(null===W||void 0===W?void 0:W.length)>0?36:0,mainContainerHeader:Ui,mainContainerRef:se,page:i,pipeline:De,setAfterHidden:_,setAfterWidthForChildren:w,setErrors:A,setMainContainerWidth:Zn,children:[(0,P.jsx)("div",{style:{height:F?0:null,opacity:F?0:null,visibility:F?"hidden":null},children:(0,P.jsx)(h,{uuid:"PipelineDetail/".concat(Oe),children:Fi})}),null===tn||void 0===tn?void 0:tn.map((function(e){return(0,P.jsx)("div",{style:{display:F===e?null:"none"},children:(0,P.jsx)(h,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,P.jsx)(Xe,{active:F===e,addNewBlock:function(e,n){hi(e,Ln.length,n,e.name),u.push("/pipelines/".concat(Oe,"/edit"))},fetchPipeline:we,fetchVariables:In,filePath:e,openSidekickView:ln,pipeline:De,selectedFilePath:F,sendTerminalMessage:Li,setErrors:A,setFilesTouched:q,setSelectedBlock:tt})})},e)})),(0,P.jsx)(Z.Z,{pb:nn?0:Math.max(Math.floor(p*(2/3)/$.iI),0)})]})]})}Kc.getInitialProps=function(){var e=(0,i.Z)(u().mark((function e(n){var t,i,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.query.pipeline,i=ko.b,r={page:i,pipeline:{uuid:t}},e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();var Xc=(0,So.Z)(Kc)},11366:function(e,n,t){"use strict";t.d(n,{k:function(){return i}});var i="automatically_name_blocks"},42305:function(e,n,t){"use strict";t.d(n,{A5:function(){return f},AY:function(){return p},BP:function(){return d},JX:function(){return s},OC:function(){return o},Pc:function(){return h},Tz:function(){return a},d$:function(){return u},lJ:function(){return m},n1:function(){return c}});var i=t(92083),r=t.n(i),o="YYYY-MM-DD HH:mm:ss",l="YYYY-MM-DD HH:mm",c="YYYY-MM-DD";function u(e,n){var t=n.dayAgo,i=n.includeSeconds,c=n.utcFormat,u=r()(e),a=l;return c&&(u=u.utc()),t&&(u=u.subtract(1,"days")),i&&(a=o),u.format(a)}function a(e){var n=u((new Date).toISOString(),{includeSeconds:!0,utcFormat:!0});return null!==e&&void 0!==e&&e.dateObj?new Date(n):n}function s(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r().unix(e).format(null!==n&&void 0!==n&&n.withSeconds?o:l)}function d(e,n,t){return r()(e).utc().hours(+n).minutes(+t).format()}function f(e){return r()(e).unix()}function p(e,n,t){return"".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t)}function h(e){var n=r().unix(+e).utc();return{date:n.toDate(),hour:String(n.hour()),minute:String(n.minute())}}function m(e){return e.padStart(2,"0")}},33766:function(e,n,t){"use strict";t.d(n,{g_:function(){return f},u7:function(){return d}});var i=t(75582),r=t(82394),o=t(34376),l=t.n(o),c=t(59e3),u=t(24224);function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){(0,r.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function d(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.replaceParams,o=t.pushHistory,u=r?{}:(0,c.iV)();n=window.location.pathname;var a=o?l().push:l().replace,d=s(s({},u),e);Object.entries(e).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1];"undefined"!==typeof r&&null!==r||delete d[t]}));var f=(0,c.uM)(d);f.length>=1&&(f="?".concat(f));var p="".concat(n.split("?")[0]).concat(f);return a(l().router.pathname,p,{shallow:!0})}function f(e,n,t){var r=t.addingMultipleValues,o=t.isList,l=t.itemsPerPage,c=t.pushHistory,a=void 0!==c&&c,f=t.resetLimitParams,p=s({},e);r?Object.entries(n).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1];if(Array.isArray(r)){var o="".concat(t,"[]");p[o]=r.map(String)}})):o?Object.entries(n).forEach((function(e){var n=(0,i.Z)(e,2),t=n[0],r=n[1],o=String(r),l="".concat(t,"[]"),c=p[l];c&&Array.isArray(c)?(c=c.map(String)).includes(o)?p[l]=(0,u.Od)(c,(function(e){return e===o})):p[l]=c.concat(o):p[l]=[o]})):p=s(s({},p),n),f&&(p._limit=l||20,p._offset=0),d(p,{pushHistory:a})}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(946)}])}},function(e){e.O(0,[3662,3850,2083,5896,4804,1774,5872,2524,9565,2714,2125,7011,6085,8789,4538,2344,9386,6166,8180,6532,1286,4261,5141,839,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|