mage-ai 0.8.48__py3-none-any.whl → 0.8.49__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/api/resources/DataProviderResource.py +12 -1
- mage_ai/data_preparation/models/block/sql/__init__.py +5 -7
- mage_ai/data_preparation/models/pipeline.py +36 -3
- mage_ai/data_preparation/templates/repo/io_config.yaml +6 -0
- mage_ai/io/sql.py +4 -1
- 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/{MxJEQAsVYkCzpf7Sf1BKY → I2bRLK9B7Lap2LvCicTKv}/_buildManifest.js +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{2249-50d2156ae3ce5933.js → 2249-59feb0a0585ef7c1.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2407-35c362852abff411.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{3014-26ba07eb6a78e31c.js → 3014-a01e16bc067500ad.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4506-ce5fa63b65f6fa5f.js → 4506-a3c53b0033972626.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4741-a90063795b0eae44.js → 4741-5fbecd08232ba3f9.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{5477-793cd2120261d023.js → 5477-b439f211b6146a11.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{5872-103815a4a043489b.js → 5872-1767c45ee6690ae5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{5896-f84e336fb8877027.js → 5896-10a676bcc86978cc.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{7400-acab00d6265bd4dc.js → 7400-033fb12e7c46f62e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{9832-c8b8970bb522f302.js → 9832-f97919376d52e3bf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{manage-68a4afe10fa0958c.js → manage-8a7b2b707c7038fb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-24c7b51521b5da92.js → [...slug]-c48a45cea6df6192.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{backfills-f0f726599529789c.js → backfills-dd637dcb042ff771.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-5541c3e13297ddbc.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{logs-a26b3d2b4806cb75.js → logs-caa9fade2bc783b9.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/{[run]-534e4fdf17255583.js → [run]-5f78885afc7758df.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{runs-a9636cb88ec885bd.js → runs-43f2c1658cd3d03d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{settings-3719bc2024f5d031.js → settings-8fb53eb8dd0267e1.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{syncs-93f1a008086f516a.js → syncs-c92351b1a81f7a13.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/{[...slug]-e9c39e78b4406d9b.js → [...slug]-ca76f5938bdff8a7.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-57af43cc439b2b43.js → triggers-4e9518882c8730b1.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{pipelines-3156eaf5f09ebf39.js → pipelines-c46347f0308ab09a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{preferences-25735fdf80f95015.js → preferences-45c40fb24c8a5139.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{sync-data-abfaa2b15eef72a0.js → sync-data-6e80afa0c9b90cdf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{terminal-24eb5df948cc9a7e.js → terminal-cc54b4d4e5295101.js} +1 -1
- 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]/settings.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 +2 -2
- mage_ai/server/frontend_dist/triggers.html +2 -2
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/METADATA +1 -1
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/RECORD +69 -69
- mage_ai/server/frontend_dist/_next/static/chunks/4538-8a3c3e47be976ede.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-f68a5f454656d7a4.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{MxJEQAsVYkCzpf7Sf1BKY → I2bRLK9B7Lap2LvCicTKv}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{MxJEQAsVYkCzpf7Sf1BKY → I2bRLK9B7Lap2LvCicTKv}/_ssgManifest.js +0 -0
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/LICENSE +0 -0
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/WHEEL +0 -0
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.8.48.dist-info → mage_ai-0.8.49.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-f68a5f454656d7a4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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),O=t(49125),_=t(20567),C=t(24224),S=t(28598);function w(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 E(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var P=2*O.iI+y.dN,I=20*O.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*O.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*O.iI));return Math.max(i,1)*y.dN+2*O.iI}function R(e){var n=e.columnHeaderHeight,t=e.columns,i=e.data,c=e.disableScrolling,a=e.height,k=e.index,w=e.invalidValues,T=e.maxHeight,R=e.numberOfIndexes,D=e.previewIndexes,M=e.renderColumnHeader,N=e.width,B=(0,o.useContext)(d.ThemeContext),L=(0,o.useRef)(null),F=(0,o.useRef)(null);(0,o.useEffect)((function(){var e=function(e){var n;null===L||void 0===L||null===(n=L.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)}}),[L,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*O.iI)})),e}),[i,k,R,U]),z=t.map((function(e){return null===e||void 0===e?void 0:e.Header})).slice(1),G=(0,o.useMemo)((function(){return x()}),[]),W=(0,o.useMemo)((function(){var e=N-(Math.max.apply(Math,(0,r.Z)(H))+1.5*O.iI+G),n=t.length-1,i=I;return i*n<e&&(i=e/n),{width:i}}),[t,H,G,N]),V=(0,p.useTable)({columns:t,data:i,defaultColumn:W},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,S.jsx)("div",E(E({},i.getRowProps({style:E(E({},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===w||void 0===w||null===(i=w[d])||void 0===i?void 0:i.includes(n),p=E({},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",E(E({},s),{},{className:"td ".concat(a?"td-index-column":""),key:"".concat(t,"-").concat(g),style:p}),h,!a&&(0,S.jsxs)(m.Z,{justifyContent:"space-between",children:[(0,S.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,S.jsx)(u(),{as:(0,_.o_)(Z.mW,x),href:"/datasets/[...slug]",passHref:!0,children:(0,S.jsx)(l.Z,{danger:!0,children:"View all"})})]}))}))}))}),[k,w,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,S.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,S.jsx)("div",E(E({},q()),{},{className:"table sticky",style:{width:N},children:(0,S.jsxs)("div",E(E({},Q()),{},{className:"body",children:[(0,S.jsx)("div",{className:"header",ref:L,children:Y.map((function(e,n){return(0,o.createElement)("div",E(E({},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=E({},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:W.width}):(t=e.render("Header"),l.color=(B||g.Z).content.default,l.padding=1*O.iI,l.minWidth=W.width),(0,o.createElement)("div",E(E({},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 E(E({},e),{},(0,i.Z)({},t[r],n))}),{})}))}),[t,v]),(0,S.jsx)(T,{columnHeaderHeight:n,disableScrolling:r,height:l,maxHeight:(a||0)+37,noBorderBottom:s,noBorderLeft:d,noBorderRight:f,noBorderTop:p,children:(0,S.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 b}});var i=t(82394),r=t(75582),o=t(17717),l=t(82684),c=t(83455),u=t(9518),a=t(77011),s=t(28598);function d(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 f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?d(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var p=u.default.div.withConfig({displayName:"MultiFileInput__DropzoneStyle",componentId:"sc-1l6yd2y-0"})(["&:hover{cursor:pointer;}"]);var h=function(e){var n=e.children,t=e.inputOnChange,i=e.inputProps,r=e.onDragActiveChange,o=e.setFiles,c=(0,l.useCallback)((function(e){o(e)}),[o]),u=(0,a.uI)({onDrop:c}),d=u.getInputProps,h=u.getRootProps,m=u.isDragActive,v=d(),g=v.accept,b=v.autoComplete,x=v.multiple,j=v.onChange,y=v.onClick,k=v.ref,Z=v.style,O=v.tabIndex,_=v.type,C=f(f({},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:O,type:_});return(0,l.useEffect)((function(){null===r||void 0===r||r(m)}),[m,r]),(0,s.jsxs)(p,f(f({},h()),{},{children:[(0,s.jsx)("input",f(f({},C),{},{directory:"",webkitdirectory:""})),n]}))},m=t(82531);function v(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 g(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?v(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var b=function(e){var n=e.children,t=e.directoryPath,u=e.onDragActiveChange,a=e.setFileUploadProgress,d=e.setUploadedFiles,f=(0,c.Db)(m.ZP.files.useCreate({onUploadProgress:function(e,n){var t,r=n.body,l=[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(o.sep);null===a||void 0===a||a((function(n){return g(g({},n),{},(0,i.Z)({},l,e.loaded/e.total))}))}})),p=(0,r.Z)(f,1)[0],v=(0,l.useCallback)((function(e){e.forEach((function(e){var n=e.name,r=e.path,l=[t],c=r.split(o.sep).filter((function(e){return e&&e!==n})).join(o.sep);c&&l.push(c);var u=[],s=l.join(o.sep);(null===s||void 0===s?void 0:s.length)>=1&&l.push(s),u.push(n);var f=u.join(o.sep);p({dir_path:s,file:e,overwrite:!1}).then((function(e){var n=e.data,t=n.error,r=n.file;d((function(e){return g(g({},e),{},(0,i.Z)({},f,r||t))}))})),a((function(e){return g(g({},e),{},(0,i.Z)({},f,0))}))}))}),[p,t,a,d]);return(0,s.jsx)(h,{onDragActiveChange:u,setFiles:v,children:n})}},64155:function(e,n,t){"use strict";t.d(n,{Eh:function(){return a},ht:function(){return d},t0:function(){return s}});var i=t(9518),r=t(82386),o=t(1286),l=t(31012),c=t(37391),u=t(49125),a=(u.iI,o.O$+3*u.iI+l.dN),s=i.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-15ofupc-0"})([""," overflow:auto;position:absolute;width:100%;",""],c.w5,(function(e){return"\n height: calc(100vh - ".concat(r.uX,"px - ").concat(e.heightOffset,"px);\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-15ofupc-1"})(["padding:","px;",""],2*u.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "}))},33699:function(e,n,t){"use strict";t.d(n,{Z:function(){return C}});var i=t(89565),r=t.n(i),o=t(82684),l=t(47999),c=t(82635),u=t(19711),a=t(9518),s=t(23831),d=t(49125),f=t(37391),p=(0,a.css)([""," ",""],(function(e){return!e.width&&"\n width: 100%;\n "}),(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")})),h=a.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-11d4rgl-0"})([""," "," height:100%;overflow:auto;position:absolute;",""],p,f.w5,(function(e){return"\n background-color: ".concat((e.theme.background||s.Z.background).codeTextarea,";\n ")})),m=a.default.div.withConfig({displayName:"indexstyle__InnerStyle",componentId:"sc-11d4rgl-1"})([""," padding:","px;"],p,d.cd*d.iI),v=(a.default.div.withConfig({displayName:"indexstyle__LineStyle",componentId:"sc-11d4rgl-2"})(["height:","px;"],20),(0,a.css)(["@keyframes cursor-blink{0%{opacity:0;}}::before{","}::after{","}"],(function(e){return e.focusBeginning&&"\n position: absolute;\n background-color: ".concat((e.theme.accent||s.Z.accent).warning,';\n content: "";\n display: inline-block;\n height: ').concat(20,"px;\n width: ").concat(d.iI,"px;\n opacity: 0.3;\n ")}),(function(e){return e.focused&&"\n background-color: ".concat((e.theme.accent||s.Z.accent).warning,';\n content: "";\n display: inline-block;\n height: ').concat(20,"px;\n width: ").concat(d.iI,"px;\n opacity: 0.3;\n ")}))),g=a.default.div.withConfig({displayName:"indexstyle__InputStyle",componentId:"sc-11d4rgl-3"})(["align-items:center;display:flex;gap:2px;",""],v),b=a.default.span.withConfig({displayName:"indexstyle__CharacterStyle",componentId:"sc-11d4rgl-4"})([""," ::after{","}"],v,(function(e){return e.focused&&"\n position: absolute;\n "})),x=t(16115),j=t(51504),y=t(66653),k=t(41150),Z=t(28598);function O(e,n){var t="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"===typeof e)return _(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _(e,n)}(e))||n&&e&&"number"===typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return l=e.done,e},e:function(e){c=!0,o=e},f:function(){try{l||null==t.return||t.return()}finally{if(c)throw o}}}}function _(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}var C=function(e){var n=e.interruptKernel,t=e.lastMessage,i=e.onFocus,a=e.sendMessage,s=e.uuid,d=void 0===s?"terminal":s,f=e.width,p=(0,o.useRef)(null),v=(0,o.useRef)(null),_=(0,o.useState)(""),C=_[0],S=_[1],w=(0,o.useState)(0),E=w[0],P=w[1],I=(0,o.useState)(0),T=I[0],A=I[1],R=(0,o.useState)([]),D=R[0],M=R[1],N=(0,o.useState)(!1),B=N[0],L=N[1],F=(0,o.useState)([]),U=(F[0],F[1]),H=(0,o.useState)(),z=H[0],G=H[1];(0,o.useEffect)((function(){if(t){var e=JSON.parse(t.data);G((function(n){var t=n||"";return"stdout"===e[0]?t+e[1]:t}))}}),[t]);var W=(0,o.useMemo)((function(){return z?z.split("\n").filter((function(e){return!e.includes("# Mage terminal settings command")})).map((function(e){return{data:e,type:c.Gi.TEXT}})):[]}),[z]);(0,o.useEffect)((function(){if(p.current&&v.current){var e=v.current.getBoundingClientRect().height;p.current.scrollTo(0,e)}}),[C,W,p,v]);var V=(0,k.y)(),Q=V.registerOnKeyDown,q=V.setDisableGlobalKeyboardShortcuts,Y=V.unregisterOnKeyDown;(0,o.useEffect)((function(){return function(){Y(d)}}),[Y,d]);var K=(0,o.useCallback)((function(){A((function(e){return e>0?e-1:e}))}),[]),X=(0,o.useCallback)((function(){A((function(e){return e<C.length?e+1:e}))}),[C]),J=(0,o.useCallback)((function(e){a(JSON.stringify(["stdin",e])),a(JSON.stringify(["stdin","\r"])),(null===e||void 0===e?void 0:e.length)>=2&&(P(D.length+1),M((function(n){return n.concat(e)})),A(0)),S("")}),[D,a,S,M,P,A]),$=(0,o.useCallback)((function(e){var n=(null===e||void 0===e?void 0:e.split(/\n/))||[];if(n.length>1){var t=n.slice(0,-1);J(C+t.join("\n"));var i=(n.slice(-1)[0]||"").trim();S(i),A(i.length)}else S((function(n){return n+e})),A(C.length+e.length)}),[C,J,S,A]);Q(d,(function(e,n,t){var i=e.code,r=e.key;if(B)if((0,y.j)(e),(0,j.y)([x.PQ,x.VS],n))(null===C||void 0===C?void 0:C.length)>=0&&(a(JSON.stringify(["stdin",C])),a(JSON.stringify(["stdin","\x03"])),A(0)),S("");else if(x.Qj!==i||n[x.zX])if((0,j.y)([x.QK],n))K();else if((0,j.y)([x.DY],n))X();else if((0,j.y)([x.Bu],n)){if(D.length>=1){var o,l=Math.max(0,E-1);S(D[l]),P(l),A((null===(o=D[l])||void 0===o?void 0:o.length)||0)}}else if((0,j.y)([x.kD],n)){if(D.length>=1){var c=Math.min(D.length,E+1),u=D[c]||"";S(u),P(c),A(u.length)}}else if((0,j.y)([x.Uq],n))J(C);else if((0,j.y)([x.zX,x.VS],n))navigator.clipboard.writeText(window.getSelection().toString());else if((0,j.y)([x.zX,x.Pd],n)||(0,j.y)([x.PQ,x.Pd],n)){var s,d,f,p,h;"undefined"===typeof(null===(s=navigator)||void 0===s?void 0:s.clipboard)?alert('Clipboard pasting is not allowed in insecure contexts. If your Mage deployment is not secure but you still want to use clipboard paste, you can override this setting (which should only be done temporarily) on Chrome browsers by going to "chrome://flags/#unsafely-treat-insecure-origin-as-secure", adding your origin to "Insecure origins treated as secure", and enabling that setting.'):null!==(d=navigator)&&void 0!==d&&null!==(f=d.clipboard)&&void 0!==f&&f.readText?navigator.clipboard.readText().then($).catch((function(e){return alert("".concat(e,'\n For Chrome, users need to allow clipboard permissions for this site under "Privacy and security" -> "Site settings".\n For Safari, users need to allow the clipboard paste by clicking "Paste" in the context menu that appears.'))})):null!==(p=navigator)&&void 0!==p&&null!==(h=p.clipboard)&&void 0!==h&&h.read?navigator.clipboard.read().then((function(e){var n,t=O(e);try{for(t.s();!(n=t.n()).done;){var i,r=n.value,o=O(r.types);try{for(o.s();!(i=o.n()).done;){var l=i.value;if("text/plain"===l)return r.getType(l)}}catch(c){o.e(c)}finally{o.f()}}}catch(c){t.e(c)}finally{t.f()}})).then((function(e){return e.text()})).then($).catch((function(e){return alert("".concat(e,'\n For Firefox, users need to allow clipboard paste by setting the "dom.events.asyncClipboard.read" preference in "about:config" to "true" and clicking "Paste" in the context menu that appears.'))})):alert('If pasting is not working properly, you may need to adjust some settings in your browser.\n\n For Firefox, users need to allow clipboard paste by setting both the "dom.events.asyncClipboard.clipboardItem" and "dom.events.asyncClipboard.read" preferences in "about:config" to "true" and clicking "Paste" in the context menu that appears.\n For Chrome, users need to allow clipboard permissions for this site under "Privacy and security" -> "Site settings".\n For Safari, users need to allow the clipboard paste by clicking "Paste" in the context menu that appears.\n')}else n[x.zX]||n[x.PQ]||1!==r.length||(S((function(e){return e.slice(0,T)+r+e.slice(T)})),A((function(e){return e+1})));else{var m=Math.max(0,T-1);S((function(e){return e.slice(0,m)+e.slice(T)})),A((function(e){return Math.max(0,e-1)}))}}),[C,D,E,B,n,S,M,P,U,d]);var ee=(0,o.useMemo)((function(){var e;return null===(e=W[W.length-1])||void 0===e?void 0:e.data}),[W]);return(0,Z.jsx)(h,{ref:p,width:f,children:(0,Z.jsx)(l.Z,{isOpen:!0,onClick:function(){null===i||void 0===i||i(),L(!0),q(!0)},onClickOutside:function(){L(!1),q(!1)},style:{minHeight:"100%"},children:(0,Z.jsxs)(m,{ref:v,width:f,children:[null===W||void 0===W?void 0:W.reduce((function(e,n,t){if(t==W.length-1)return e;var i=n||{},o=i.command,l=i.data,a=i.type,s=[];s=(s=Array.isArray(l)?l:[l]).filter((function(e){return e}));var d=[];return s.forEach((function(e,n){var i;if(c.jU.includes(a)&&(i=(0,Z.jsx)(u.ZP,{monospace:!0,preWrap:!0,children:e&&(0,Z.jsx)(r(),{children:e})})),i){var l="command-".concat(t,"-").concat(n,"-").concat(e);o||d.push((0,Z.jsx)("div",{children:i},l))}})),e.concat(d)}),[]),(0,Z.jsx)(g,{focused:B&&0===(null===C||void 0===C?void 0:C.length),children:(0,Z.jsxs)(u.ZP,{monospace:!0,children:[(0,Z.jsx)(u.ZP,{inline:!0,monospace:!0,children:ee&&(0,Z.jsx)(r(),{children:ee})}),null===C||void 0===C?void 0:C.split("").map((function(e,n,t){return(0,Z.jsxs)(b,{focusBeginning:B&&0===T&&0===n,focused:B&&(T===n+1||T>=t.length&&n===t.length-1),children:[" "===e&&(0,Z.jsx)(Z.Fragment,{children:"\xa0"}),"\n"===e&&(0,Z.jsx)("br",{})," "!==e&&e]},"command-".concat(n,"-").concat(e))}))]})})]})})})}},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),O=t(48072),_=t(10103),C=t(84181),S=t(24903),w=t(67971),E=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),B=t(24224),L=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 G(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 W=G(G({},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,w=e.gridProps,E=void 0===w?{}:w,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]),Oe=Math.min.apply(Math,(0,r.Z)(t.map((function(e){var n=e.y;return Math.min.apply(Math,(0,r.Z)(n||[]))})))),_e=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:[Oe,_e],nice:!0,range:[je,0]})}),[je,_e,Oe]),Se=le>520?V?20:10:V?10:5,we=(0,F.K)(de),Ee=ve,Pe=we.map((function(e){return{stroke:e}})),Ie=(0,S.Z)({domain:Q||[],range:Pe.map((function(e){return e.stroke}))}),Te=(0,l.useCallback)((function(e){var n=((0,O.Z)(e)||{x:0}).x,i=Ze.invert(n-q.left),r=(0,B.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,_.range)(0,ke).map((function(e){return Ce(pe(c,e))}));pe(c)&&$({tooltipData:G(G({},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,G({height:je,pointerEvents:"none",scale:Ze,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,U.jsx)(m.Z,G({height:je,pointerEvents:"none",scale:Ce,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,U.jsx)("line",{stroke:he,x1:xe,x2:xe,y1:0,y2:je}),(0,U.jsx)(a.Z,{numTicks:Se,scale:Ze,stroke:Ee,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:Ee,top:je}),(0,U.jsx)(s.Z,{hideTicks:!0,numTicks:K,scale:Ce,stroke:Ee,tickFormat:function(e){return se?se(e):(0,L.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:Ee}),n&&n.map((function(e){var n=e[0],i=e[1];return(0,l.createElement)(j.Z,G(G({},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?Oe:pe(e,i))},y1:function(e){return Ce(pe(e,n))}}))})),(0,_.range)(0,ke).map((function(e){return(0,l.createElement)(f.Z,G(G({},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?Oe: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,L.Vs)(J,ne,n)*N.iI:ie+N.iI,style:W,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,L.Vs)(X,ne):ie,style:G(G({},W),{},{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=G(G({},{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)(w.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)(E.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,G(G({},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={}))},82635:function(e,n,t){"use strict";var i,r;t.d(n,{Gi:function(){return r},jU:function(){return l},uF:function(){return i}}),function(e){e.BUSY="busy",e.IDLE="idle",e.QUEUED="queued"}(i||(i={})),function(e){e.IMAGE_PNG="image/png",e.PROGRESS="progress",e.TABLE="table",e.TEXT="text",e.TEXT_HTML="text/html",e.TEXT_PLAIN="text/plain"}(r||(r={}));var o,l=[r.TEXT,r.TEXT_PLAIN];!function(e){e.DISPLAY_DATA="display_data",e.STATUS="status",e.STREAM="stream",e.STREAM_PIPELINE="stream_pipeline"}(o||(o={}))},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 "}),(function(e){return e.monospace&&"\n font-family: ".concat(u.Vp,";\n word-break: break-all;\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,O=e.maxHeight,_=e.maxWidth,C=e.minWidth,S=e.noPadding,w=e.overflowVisible,E=e.subtitle;return(0,d.jsxs)(p,{borderless:n,dark:u,fullHeight:f,fullWidth:b,maxHeight:O,maxWidth:_,minWidth:C,overflowVisible:w,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:O,noPadding:S,overflowVisible:w,ref:c,children:[E&&(0,d.jsx)(o.Z,{mb:2,children:(0,d.jsx)(l.ZP,{default:!0,children:E})}),t]}),a&&(0,d.jsx)(v,{children:a})]})}},2761:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return au}});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(9518),b=t(38341),x=t(16634),j=t(34744),y=t(93461),k=t(67971),Z=t(10919),O=t(86673),_=t(19711),C=t(49125),S=t(44162),w=t(28598);function E(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 P(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,r=e.setHiddenBlocks,l=(0,s.useContext)(g.ThemeContext),c=(0,s.useMemo)((function(){return(null===i||void 0===i?void 0:i.blocks)||[]}),[i]),u=(0,s.useMemo)((function(){var e=[],n=[];return c.forEach((function(i){var r=i.uuid;null!==t&&void 0!==t&&t[r]?e.push(i):n.push(i)})),{blocksHidden:e,blocksVisible:n}}),[c,t]),a=u.blocksHidden,d=u.blocksVisible,f=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===d.length}),[c,d]),p=(0,s.useMemo)((function(){return(null===c||void 0===c?void 0:c.length)>=1&&0===a.length}),[c,a]),h=(0,s.useCallback)((function(e){var t=e.type,i=e.uuid;if(null!==n&&void 0!==n&&n.current){var r,o=n.current["".concat(t,"s/").concat(i,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}}),[n]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{p:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(y.Z,{flex:1,justifyContent:"center",children:(0,w.jsx)(b.Z,{checked:p,label:"Show all",onClick:function(){return r((function(){return{}}))}})}),(0,w.jsx)(y.Z,{flex:1,justifyContent:"center",children:(0,w.jsx)(b.Z,{checked:f,label:"Hide all",onClick:function(){return r((function(){return c.reduce((function(e,n){var t=n.uuid;return P(P({},e),{},(0,o.Z)({},t,!0))}),{})}))}})})]})}),(0,w.jsx)(j.Z,{medium:!0}),null===c||void 0===c?void 0:c.map((function(e){var n=e.uuid,i=(0,S.qn)(e.type,{blockColor:e.color,theme:l}).accent,c=!(null!==t&&void 0!==t&&t[n]);return(0,w.jsx)(Z.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){r((function(e){return P(P({},e),{},(0,o.Z)({},n,c))})),c||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,w.jsx)(O.Z,{mt:1,px:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(O.Z,{pr:1,children:(0,w.jsx)(b.Z,{checked:c})}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(x.Z,{color:i,size:1.5*C.iI,square:!0}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},T=t(60328),A=t(32316),R=t(11135),D=t(29237),M=t(98781),N=t(82944),B=t(16115),L=t(11366),F=t(91427),U=t(51504);var H,z,G,W,V=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,F.U2)(L.kY)),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 M.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,w.jsxs)(D.Z,{children:[(0,w.jsxs)(_.ZP,{bold:!0,children:[m," block name"]}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsx)(N.Z,{monospace:!0,onChange:function(e){return a(e.target.value)},ref:l,value:u})}),(0,w.jsx)(O.Z,{mt:2,children:(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(b.Z,{checked:f,label:(0,w.jsxs)(_.ZP,{muted:!0,small:!0,children:["Automatically use randomly generated name",(0,w.jsx)("br",{}),"for blocks created in the future"]}),onClick:function(){p(!f),(0,F.t8)(L.kY,!f)}})})}),(0,w.jsx)(O.Z,{mt:3,children:(0,w.jsxs)(k.Z,{children:[(0,w.jsx)(R.ZP,{bold:!0,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,U.y)([B.Uq],n)},onClick:function(){return r({name:u||t})},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,w.jsx)(O.Z,{ml:1,children:(0,w.jsx)(T.Z,{onClick:i,tabIndex:0,children:"Cancel"})})]})})]})},Q=t(26304),q=t(62084);!function(e){e.JSON="json",e.PY="py",e.R="r",e.SQL="sql",e.TXT="txt",e.YAML="yaml",e.YML="yml"}(G||(G={})),function(e){e.INIT_PY="__init__.py",e.METADATA_YAML="metadata.yaml",e.REQS_TXT="requirements.txt"}(W||(W={}));var Y,K,X=[G.PY,G.SQL],J=[G.JSON,G.PY,G.R,G.SQL,G.TXT,G.YAML,G.YML],$=new RegExp(J.map((function(e){return".".concat(e,"$")})).join("|")),ee=J.concat(G.PY),ne=new RegExp(ee.map((function(e){return".".concat(e,"$")})).join("|")),te="charts",ie="pipelines",re=(H={},(0,o.Z)(H,G.JSON,G.JSON),(0,o.Z)(H,G.PY,v.t6.PYTHON),(0,o.Z)(H,G.R,v.t6.R),(0,o.Z)(H,G.SQL,v.t6.SQL),(0,o.Z)(H,G.TXT,"text"),(0,o.Z)(H,G.YAML,v.t6.YAML),(0,o.Z)(H,G.YML,v.t6.YAML),H),oe=(z={},(0,o.Z)(z,v.t6.PYTHON,G.PY),(0,o.Z)(z,v.t6.R,G.R),(0,o.Z)(z,v.t6.SQL,G.SQL),(0,o.Z)(z,v.t6.YAML,G.YAML),(0,o.Z)(z,"text",G.TXT),z),le=t(10503),ce=t(43032),ue=t(24224),ae="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.SETTINGS="settings",e.TERMINAL="terminal",e.TREE="tree",e.VARIABLES="variables"}(K||(K={}));K.CHARTS,K.DATA,K.EXTENSIONS,K.REPORTS,K.TREE;var se=[K.DATA,K.REPORTS,K.GRAPHS],de=[{key:K.TREE,label:"Tree"},{key:K.CHARTS,label:"Charts"},{key:K.VARIABLES,label:"Variables"},{key:K.SECRETS,label:"Secrets"},{key:K.EXTENSIONS,label:"Power ups"},{key:K.DATA,label:"Data"},{key:K.TERMINAL,label:"Terminal"}],fe=(0,ue.HK)(de,(function(e){return e.key})),pe=(Y={},(0,o.Z)(Y,K.CHARTS,le.er),(0,o.Z)(Y,K.DATA,le.t1),(0,o.Z)(Y,K.EXTENSIONS,le.Bf),(0,o.Z)(Y,K.GRAPHS,le.er),(0,o.Z)(Y,K.REPORTS,le.Do),(0,o.Z)(Y,K.SECRETS,le.EK),(0,o.Z)(Y,K.SETTINGS,le.Zr),(0,o.Z)(Y,K.TERMINAL,le.oI),(0,o.Z)(Y,K.TREE,le.BJ),(0,o.Z)(Y,K.VARIABLES,le.KJ),Y),he=t(17717),me=t(90211);function ve(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),ve(e.parent,r.join(he.sep))}return i}function ge(e){return null===e||void 0===e?void 0:e.split(he.sep).slice(1).join(he.sep)}function be(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=ve(e,n,t);return ge(i)}function xe(e){var n,t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=ve(e,i).split(he.sep);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(he.sep))&&(n=r[0]===v.tf.CUSTOM?r[0]:(0,me.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,me.C5)(o||"")}if(!r)return null;var l="";l=r.length>=3?r.slice(2,r.length).join(he.sep):r[r.length-1];var c=["\\.".concat(G.PY),"\\.".concat(G.R),"\\.".concat(G.SQL),"\\.".concat(G.YAML),"\\.".concat(G.YML)].join("|"),u=new RegExp("".concat(c,"$"));if(v.$W.concat(v.tf.DBT).includes(n)&&l.match(u)){var a=l.lastIndexOf("."),s=l.slice(a+1);return{language:re[s],type:n,uuid:l.slice(0,a)}}}function je(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=ve(e,n).split(he.sep);if(t[1]){var i=(0,me.C5)(t[n?0:1]);t[1]===v.tf.DBT&&(i=v.tf.DBT);var r=t[t.length-1],o=new RegExp(".".concat(G.YAML,"$")),l=new RegExp(".".concat(G.R,"$")),c=new RegExp(".".concat(G.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 ye(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 ke(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ye(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ye(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ze="default_repo";var Oe=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,j=n.setDraggingFile,y=n.setSelectedFile,k=n.theme,Z=n.timeout,O=n.uncollapsed,E=n.useRootFolder,P=o.children,I=o.disabled,T=o.name,A=o.parent;T||(o.name=Ze);var R,D=E?ve(o):be(o),M=(null===A||void 0===A?void 0:A.name)===ie,N=(0,s.useMemo)((function(){return P?(0,ue.YC)(P,(function(e){return e.children?0:1})):P}),[P]),B=l?l(D,N):I||"__init__.py"===T||!(null===T||void 0===T||!T.match(/^\./))||!T.match(ne)&&!P,L="".concat(c,"/").concat(T),U=(h.includes(function(e){var n=e.name.split("."),t=n[n.length-1];return X.includes(t)&&n.pop(),n.join("")}(o)),(0,s.useState)("undefined"===typeof O?(0,F.U2)(L,!1):!O)),H=U[0],z=U[1],G=le.iU;1===c&&T===ie?G=le.B_:T===te?G=le.er:N&&(G=le.gt),N&&v.$W.includes((0,me.C5)(T))&&(0,me.C5)(T)!==v.tf.CHART&&(R=(0,S.qn)((0,me.C5)(T),{theme:k}).accent);var W=(0,s.useMemo)((function(){return null===N||void 0===N?void 0:N.map((function(n){return(0,w.jsx)(e,{allowSelectingFolders:t,containerRef:i,disableContextMenu:r,file:ke(ke({},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:j,setSelectedFile:y,theme:k,timeout:Z,uncollapsed:O,useRootFolder:E},"".concat(L,"/").concat((null===n||void 0===n?void 0:n.name)||Ze))}))}),[t,N,i,r,o,l,c,u,a,d,f,p,h,m,g,b,j,y,k,Z,O,E,L]);return(0,w.jsxs)(w.Fragment,{children:[!a&&(0,w.jsxs)("div",{className:"row",onClick:function(e){if(e.preventDefault(),!B){if((null===A||void 0===A?void 0:A.name)===te){null===p||void 0===p||p(K.CHARTS);var n=xe(o);n&&(null===u||void 0===u||u(n.uuid,n.type,be(o)))}var i=je(o);if(N)t?m(D):z((function(e){return(0,F.t8)(L,!e),!e}));else if(i)null===u||void 0===u||u(i.uuid,i.type,be(o));else if(T.match($))d(D);else{var r=xe(o);r&&(null===u||void 0===u||u(r.uuid,r.type,be(o)))}}},onContextMenu:function(e){var n;clearTimeout(Z.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}),j(null),y(o))},onMouseDown:function(e){var n,t=o?xe(o):null;null===i||void 0===i||null===(n=i.current)||void 0===n||!n.contains(e.target)||!t||(null===N||void 0===N?void 0:N.length)>=1||r||B||M||(e.preventDefault(),clearTimeout(Z.current),Z.current=setTimeout((function(){b({x:e.pageX,y:e.pageY}),j(o),y(null)}),300))},style:{alignItems:"center",cursor:"default",display:"flex",minWidth:c*ce.Cl+o.name.length*C.Fo+2*C.iI,paddingBottom:C.iI/4,paddingLeft:C.iI/4+ce.Cl*c,paddingRight:C.iI/4,paddingTop:C.iI/4},children:[N&&!H&&(0,w.jsx)(le._M,{muted:!0,size:ce.ZG}),N&&H&&(0,w.jsx)(le._Q,{muted:!0,size:ce.ZG}),!N&&(0,w.jsx)("div",{style:{width:ce.ZG}}),(0,w.jsxs)("div",{style:{marginLeft:C.iI/2,marginRight:C.iI/2},children:[!R&&(0,w.jsx)(G,{disabled:B,size:ce.ZG}),R&&(0,w.jsx)(x.Z,{color:R,size:ce.ZG,square:!0})]}),(0,w.jsx)(_.ZP,{color:R,default:!R&&!B,disabled:B,monospace:!0,small:!0,children:T})]}),(0,w.jsx)("div",{style:{display:H?"none":"block"},children:W})]})},_e=t(82531),Ce=t(7715),Se=t(96510);var we=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,Ce.Qr)(t)?null:t,a=(0,s.useState)(u?be(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(be(r))}),[r]);var g=(0,d.Db)(_e.ZP.files.useCreate(),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),b=(0,l.Z)(g,1)[0],x=(0,d.Db)(_e.ZP.files.useUpdate(u&&encodeURIComponent(be(u))),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===n||void 0===n||n(),i()},onErrorCallback:function(e,n){return o({errors:n,response:e})}})}}),j=(0,l.Z)(x,1)[0];return(0,w.jsxs)(D.Z,{footer:(0,w.jsxs)(k.Z,{children:[(0,w.jsxs)(R.ZP,{bold:!0,disabled:!m,inline:!0,keyboardShortcutValidation:function(e){var n=e.keyMapping;return(0,U.y)([B.Uq],n)},onClick:function(){return u?j({file:{dir_path:f,name:m},file_json_only:!0}):b({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,w.jsx)(O.Z,{ml:1,children:(0,w.jsx)(T.Z,{onClick:function(){return i()},tabIndex:0,children:"Cancel"})})]}),headerTitle:u?"Rename file":"New file",children:[(0,w.jsx)(N.Z,{disabled:!!u,label:"Directory",monospace:!0,onChange:function(e){return p(e.target.value)},setContentOnMount:!0,value:f}),(0,w.jsx)(O.Z,{mt:2,children:(0,w.jsx)(N.Z,{label:"Filename",monospace:!0,onChange:function(e){return v(e.target.value)},ref:c,required:!0,value:m})})]})},Ee=t(62609),Pe=t(55106),Ie=t(66176),Te=t(58180),Ae=t(23831),Re=t(73942),De=(C.iI,g.default.div.withConfig({displayName:"indexstyle__DropZoneStyle",componentId:"sc-1g3zz7z-0"})(["border-radius:","px;padding:","px;max-width:","px;min-width:","px;",""],Re.n_,8*C.iI,100*C.iI,55*C.iI,(function(e){return"\n border: 1px dashed ".concat((e.theme.borders||Ae.Z.borders).contrast,";\n ")}))),Me=g.default.div.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-1g3zz7z-1"})(["max-width:","px;min-width:","px;"],100*C.iI,55*C.iI);var Ne=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,Ce.Qr)(a),v=(0,s.useMemo)((function(){var e=[];return(0,ue.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,w.jsxs)("div",{children:[(0,w.jsx)(_.ZP,{overflowWrap:!0,preWrap:!0,children:i}),c&&(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsx)(_.ZP,{danger:!0,small:!0,children:c})})]},"name-".concat(i)),(0,w.jsx)(Ie.Z,{danger:!!c,progress:100*r},"progress-".concat(i))])})),(0,w.jsx)(Te.Z,{columnFlex:[1,4],columns:[{uuid:"Filename"},{uuid:"Upload progress"}],rows:e,uuid:"block-runs"})}),[a,p]);return(0,w.jsxs)(D.Z,{footer:(0,w.jsxs)(k.Z,{fullWidth:!0,children:[(0,w.jsx)(T.Z,{onClick:function(){return t()},children:"Close"}),m&&(0,w.jsx)(O.Z,{ml:1,children:(0,w.jsx)(T.Z,{onClick:function(){d({}),h({})},children:"Clear files and retry"})})]}),headerTitle:"Upload files",children:[m&&(0,w.jsx)(Me,{children:v}),!m&&(0,w.jsx)(Pe.Z,{directoryPath:i?be(i):"",onDragActiveChange:c,setFileUploadProgress:d,setUploadedFiles:function(e){h(e),null===n||void 0===n||n()},children:(0,w.jsx)(De,{children:(0,w.jsxs)(_.ZP,{center:!0,children:[o&&"Drop to upload",!o&&"Click or drop files and folders to upload"]})})})]})},Be=t(86585),Le=function(e){var n=e[0];return n===v.tf.DBT||n===v.tf.CUSTOM?n:e[0].slice(0,-1)};function Fe(){return new RegExp(Object.keys(re).map((function(e){return".(".concat(e,")$")})).join("|"))}function Ue(e,n,t){var i,o,l=null===e||void 0===e||null===(i=e.path.match(Fe())[0])||void 0===i?void 0:i.split(".")[1],c=t.type===M.qL.INTEGRATION,u=(0,ue.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(he.sep),s=e.path.split(he.sep)[0]===v.tf.DBT,d=(o=a)[0]===v.tf.DBT?o.slice(1).join(he.sep):function(e){return e.at(-1)}(o).split(".")[0];if(a.length>=3&&!s){var f=a.slice(1,a.length-1).join(he.sep);d="".concat(f,"/").concat(d)}var p=Le(e.path.split(he.sep)),h={configuration:{file_path:s?d:null},language:re[l],name:(0,me.wE)(d),type:p};if(p===v.tf.CUSTOM&&(h.color=v.Lq.TEAL),c){var m=(0,ue.sE)(t.blocks,(function(e){var n=e.type;return v.tf.DATA_LOADER===n})),g=(0,ue.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 He=t(83608),ze=["addNewBlock","blocks","deleteWidget","fetchAutocompleteItems","fetchFileTree","fetchPipeline","files","pipeline","setErrors","setSelectedBlock","widgets"];function Ge(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 We(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ge(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ge(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ve,Qe=20*C.iI;function qe(e,n){var t=e.addNewBlock,i=e.blocks,r=void 0===i?[]:i,o=e.deleteWidget,c=e.fetchAutocompleteItems,u=e.fetchFileTree,a=e.fetchPipeline,f=e.files,p=e.pipeline,h=e.setErrors,m=e.setSelectedBlock,b=e.widgets,x=void 0===b?[]:b,j=(0,Q.Z)(e,ze),y=(0,s.useRef)(null),k=(0,s.useContext)(g.ThemeContext),Z=(0,s.useState)(null),O=Z[0],S=Z[1],E=(0,s.useState)(null),P=E[0],I=E[1],T=(0,s.useState)(null),A=T[0],R=T[1],D=_e.ZP.status.list().data,N=(0,s.useMemo)((function(){var e;return null===D||void 0===D||null===(e=D.status)||void 0===e?void 0:e.repo_path}),[D]),B=(0,d.Db)((function(e){return _e.ZP.files.useDelete(e)()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===u||void 0===u||u()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),L=(0,l.Z)(B,1)[0],F=(0,He.dd)((function(e){var n=e.block;e.exception;return(0,w.jsx)(Ee.Z,{centerOnScreen:!0,danger:!0,onClick:function(){return W({block:n,force:!0}).then((function(){return z()}))},onCancel:z,subtitle:"Deleting this block file is dangerous. This block may have dependencies in active pipelines. Press confirm to delete this block anyway and remove it as a dependency from downstream blocks.",title:"Delete ".concat(n.uuid," anyway?"),width:34*C.iI})})),U=(0,l.Z)(F,2),H=U[0],z=U[1],G=(0,d.Db)((function(e){var n=e.block,t=n.language,i=n.type,r=n.uuid,o=e.force,l=void 0!==o&&o,c="".concat(i,"/").concat(r);return t&&oe[t]&&(c="".concat(c,".").concat(oe[t].toLowerCase())),_e.ZP.blocks.useDelete(encodeURIComponent(c),{force:l})()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){c(),a(),u()},onErrorCallback:function(e){var n=e.error,t=n.exception;n.message.includes("raise HasDownstreamDependencies")&&H({block:ee,exception:t})}})}}),W=(0,l.Z)(G,1)[0],V=(0,ue.sE)(null===p||void 0===p?void 0:p.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),Y=(0,d.Db)(_e.ZP.blocks.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid,null===V||void 0===V?void 0:V.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),K=(0,l.Z)(Y,1)[0],X=(0,s.useCallback)((function(){return R(null)}),[R]);(0,s.useEffect)((function(){var e,i,r,o=function(e){if(clearTimeout(y.current),I(null),P&&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)===M.qL.INTEGRATION,a=Ue(We(We({},P),{},{path:be(P)}),N,p);null===t||void 0===t||t(a,(function(e){u&&V&&K({block:We(We({},V),{},{upstream_blocks:[e.uuid]})}),null===m||void 0===m||m(e)}))}}},l=function(e){P&&S({x:e.pageX,y:e.pageY})};return null===(e=document)||void 0===e||e.addEventListener("click",X),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",X),null===(n=document)||void 0===n||n.removeEventListener("mousemove",l),null===(t=document)||void 0===t||t.removeEventListener("mouseup",o)}}),[t,V,P,X,p,n,N,m,y,K]);var J=(0,s.useMemo)((function(){return r.concat(x).map((function(e){return e.uuid}))}),[r,x]),$=(0,s.useMemo)((function(){return null===f||void 0===f?void 0:f.map((function(e){return(0,s.createElement)(Oe,We(We({},j),{},{containerRef:n,file:e,key:e.name,level:0,pipelineBlockUuids:J,setCoordinates:S,setDraggingFile:I,setSelectedFile:R,theme:k,timeout:y}))}))}),[f,J,j,n,k,y]),ee=(0,s.useMemo)((function(){return A&&xe(A)}),[A]),ne=(0,s.useMemo)((function(){return P&&xe(P)}),[P]),te=(0,s.useMemo)((function(){return A&&"undefined"!==typeof(null===A||void 0===A?void 0:A.children)&&A}),[A]),ie=(0,He.dd)((function(){return(0,w.jsx)(Ne,{fetchFileTree:u,onCancel:ae,selectedFolder:te})}),{},[u,te],{background:!0,uuid:"upload_files"}),re=(0,l.Z)(ie,2),le=re[0],ae=re[1],se=(0,He.dd)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,w.jsx)(we,{fetchFileTree:u,file:e,onCancel:pe,selectedFolder:te,setErrors:h})}),{},[u,te,h],{background:!0,disableClickOutside:!0,uuid:"new_file"}),de=(0,l.Z)(se,2),fe=de[0],pe=de[1],he=(0,s.useMemo)((function(){var e;if(!ee&&!A&&!te)return(0,w.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||{},c=l.x,u=void 0===c?0:c,a=l.y,s=void 0===a?0:a,d=u;u+Qe>=i+r&&(d=i+r-(Qe+C.iI)),d<0&&(d=0);var f=[];return te?f.push.apply(f,[{label:function(){return"Upload files"},onClick:function(){le()},uuid:"upload_files"},{label:function(){return"New file"},onClick:function(){fe({})},uuid:"new_file"}]):ee?f.push({label:function(){return"Delete block file"},onClick:function(){ee.type===v.tf.CHART?window.confirm("Are you sure you want to delete widget ".concat(ee.uuid,"?"))&&o(ee):window.confirm("Are you sure you want to delete block ".concat(ee.uuid,"?"))&&W({block:ee})},uuid:"delete_block_file"}):A&&f.push.apply(f,[{label:function(){return"Rename file"},onClick:function(){fe(A)},uuid:"rename_file"},{label:function(){return"Delete file"},onClick:function(){var e=be(A);window.confirm("Are you sure you want to delete file ".concat(e,"?"))&&L(encodeURIComponent(e))},uuid:"delete_file"}]),(0,w.jsx)("div",{style:{left:d,position:"fixed",top:s+C.iI/2,zIndex:Be.bf+100},children:(0,w.jsx)(q.Z,{items:f,open:!0,parentRef:void 0,uuid:"FileBrowser/ContextMenu",width:Qe})})}),[O,W,L,o,n,le,fe,ee,A,te]);return(0,w.jsxs)(ce.Nk,{ref:n,children:[$,(ee||A||te)&&he,ne&&(0,w.jsx)("div",{style:{left:(null===O||void 0===O?void 0:O.x)-C.iI,position:"fixed",top:(null===O||void 0===O?void 0:O.y)-C.iI,zIndex:Be.bf+100},children:(0,w.jsx)(_.ZP,{cursor:"grabbing",monospace:!0,children:null===ne||void 0===ne?void 0:ne.uuid})})]})}!function(e){e.BLOCK_FILE="block_file",e.DISABLED="disabled",e.FILE="file",e.FOLDER="folder",e.PIPELINE="pipeline"}(Ve||(Ve={}));var Ye=s.forwardRef(qe),Ke=g.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),Xe=g.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),Je=function(e){var n=e.children,t=e.divider,i=s.Children.toArray(n).length;return(0,w.jsx)(Ke,{children:(0,w.jsx)(k.Z,{children:s.Children.map(n,(function(e,n){return e&&(0,w.jsxs)(y.Z,{children:[n>=1&&t&&(0,w.jsx)(Xe,{}),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))}))})})},$e=t(57722),en=t(41150);function nn(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 tn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?nn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):nn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rn,on=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,g=e.setDisableShortcuts,b=e.setErrors,x=e.setFilesTouched,j=e.setSelectedBlock,y=p("apiReloads"),Z=(0,l.Z)(y,2)[1],_=(0,s.useState)(null),C=_[0],S=_[1],E=(0,s.useState)(!1),P=E[0],I=(E[1],(0,s.useRef)(null)),A=_e.ZP.status.list().data,D=null===A||void 0===A||null===(n=A.status)||void 0===n?void 0:n.repo_path,N=_e.ZP.file_contents.detail(u).data;(0,s.useEffect)((function(){null!==N&&void 0!==N&&N.file_content&&S(N.file_content)}),[N]);var L=(0,s.useState)(null===C||void 0===C?void 0:C.content),F=L[0],H=L[1],z=(0,s.useState)(!1),V=z[0],Q=z[1];(0,s.useEffect)((function(){t&&g(!0)}),[t,g]),(0,s.useEffect)((function(){var e;h&&(null===I||void 0===I||null===(e=I.current)||void 0===e||e.scrollIntoView())}),[h]);var q=(0,d.Db)(_e.ZP.file_contents.useUpdate((null===C||void 0===C?void 0:C.path)&&encodeURIComponent(null===C||void 0===C?void 0:C.path)),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){Z((function(e){return tn(tn({},e),{},(0,o.Z)({},"FileVersions/".concat(null===C||void 0===C?void 0:C.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===b||void 0===b?void 0:b({errors:n,response:e})}})}}),Y=(0,l.Z)(q,1)[0],X=(0,s.useCallback)((function(e,n){Y({file_content:tn(tn({},n),{},{content:e})}).then((function(){decodeURIComponent(u).split(he.sep).pop()===W.METADATA_YAML&&c()})),x((function(e){return tn(tn({},e),{},(0,o.Z)({},null===n||void 0===n?void 0:n.path,!1))})),Q(!1)}),[c,u,x,Y]),J=(0,s.useMemo)((function(){return Fe()}),[]),$=(0,s.useMemo)((function(){var e;return null===C||void 0===C||null===(e=C.path.match(J)[0])||void 0===e?void 0:e.split(".")[1]}),[J,C]),ee=(0,s.useMemo)((function(){if(null!==C&&void 0!==C&&C.path)return(0,w.jsx)($e.Z,{autoHeight:!0,language:re[$],onSave:function(e){X(e,C)},onChange:function(e){H(e),x((function(e){return tn(tn({},e),{},(0,o.Z)({},null===C||void 0===C?void 0:C.path,!0))})),Q(!0)},selected:!0,textareaFocused:!0,value:(0,me.Pb)(null===C||void 0===C?void 0:C.content)?JSON.stringify(JSON.parse(null===C||void 0===C?void 0:C.content),null,2):null===C||void 0===C?void 0:C.content,width:"100%"})}),[C,$,X,x]),ne=(0,ue.sE)(null===f||void 0===f?void 0:f.blocks,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n})),te=(0,d.Db)(_e.ZP.blocks.pipelines.useUpdate(null===f||void 0===f?void 0:f.uuid,null===ne||void 0===ne?void 0:ne.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===r||void 0===r||r()}})}}),ie=(0,l.Z)(te,1)[0],oe=($===G.PY||$===G.SQL||($===G.YAML||$===G.R)&&je(C,null===C||void 0===C?void 0:C.path))&&Le(C.path.split(he.sep))!==v.tf.SCRATCHPAD&&xe(C)&&(0,w.jsx)(T.Z,{onClick:function(){var e=f.type===M.qL.INTEGRATION,n=Ue(C,D,f);i(n,(function(n){e&&ne&&ie({block:tn(tn({},ne),{},{upstream_blocks:[n.uuid]})}),j(n)}))},primary:!0,children:"Add to current pipeline"}),le=(0,w.jsx)(O.Z,{m:2,children:(0,w.jsx)(R.ZP,{disabled:!D,inline:!0,loading:P,onClick:function(){a(K.TERMINAL),m(JSON.stringify(["stdin","pip install -r ".concat(D,"/requirements.txt\r")]))},title:D?"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===C||void 0===C?void 0:C.path),ae=(0,en.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,U.y)([B.zX,B.Um],n)||(0,U.y)([B.PQ,B.Um],n))e.preventDefault(),X(F,C);else if(V&&(0,U.y)([B.zX,B.hS],n)){e.preventDefault();var r="".concat(C.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(r)&&location.reload()}}),[t,F,C,X,V]),(0,w.jsxs)("div",{ref:I,children:[(0,w.jsx)(O.Z,{p:2,children:(0,w.jsxs)(k.Z,{justifyContent:"space-between",children:[(0,w.jsxs)(Je,{children:[oe,(0,w.jsx)(T.Z,{disabled:!F,onClick:function(e){e.preventDefault(),X(F,C)},title:F?null:"No changes have been made to this file.",children:"Save file content"})]}),(0,w.jsx)(Je,{children:(0,w.jsx)(T.Z,{compact:!0,onClick:function(){a(K.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),ee,u===W.REQS_TXT&&le]})},ln=t(47999),cn=t(64318);!function(e){e.ANDROID="Android",e.CHROME_OS="ChromeOS",e.IOS="iOS",e.LINUX="Linux",e.MAC="macOS",e.WINDOWS="Windows"}(rn||(rn={}));var un=rn;function an(){return function(){var e,n,t,i,r,o,l,c=un.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=un.MAC:["Win32","Win64","Windows","WinCE"].includes(a)?c=un.WINDOWS:["iPhone","iPad","iPod"].includes(a)&&(c=un.IOS):u&&(u.includes("Macintosh")?c=un.MAC:u.includes("Windows")?c=un.WINDOWS:u.includes("Linux")&&u.includes("X11")?c=un.LINUX:/(iPhone|iPad)/.test(u)?c=un.IOS:u.includes("Android")&&u.includes("Mobi")?c=un.ANDROID:u.includes("CrOS")&&(c=un.CHROME_OS)),c}()===un.MAC}function sn(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 dn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?sn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):sn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var fn=function(e){var n=e.cancelPipeline,t=e.children,i=e.createPipeline,r=e.executePipeline,l=e.interruptKernel,c=e.isPipelineExecuting,u=e.pipeline,a=e.restartKernel,d=e.savePipelineContent,f=(e.setActiveSidekickView,e.setMessages),p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useRef)(null),g=(0,s.useRef)(null),b=(0,s.useRef)(null),x=[{label:function(){return"New standard pipeline"},onClick:function(){return i({pipeline:{name:(0,me.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,me.Y6)(),type:M.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[an()?B.RJ:B.hE,B.SS]],label:function(){return"Save pipeline"},onClick:function(){return d()},uuid:"save_pipeline"}],j=(0,s.useMemo)((function(){var e=[{label:function(){return"Interrupt kernel"},keyTextGroups:[[B.kA],[B.kA]],onClick:function(){return l()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[B.t_[B.OC]],[B.t_[B.OC]]],onClick:function(){return a()},uuid:"Restart kernel"},{label:function(){return"Clear all outputs"},onClick:function(){return f((function(e){return Object.keys(e).reduce((function(e,n){return dn(dn({},e),{},(0,o.Z)({},n,[]))}),{})}))},uuid:"Clear all outputs"}];return c?e.push({label:function(){return"Cancel pipeline"},onClick:function(){return n()},uuid:"Cancel pipeline"}):e.push({label:function(){return"Execute pipeline"},onClick:function(){return r()},uuid:"Execute pipeline"}),e}),[n,r,l,c,a,f]),y=(0,s.useMemo)((function(){return[{label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(null===u||void 0===u?void 0:u.uuid,"/settings"),href:"/pipelines/[pipeline]/settings"},uuid:"Pipeline settings"}]}),[u]),Z="FileHeaderMenu/index",O=(0,en.y)(),C=O.registerOnKeyDown,S=O.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){S(Z)}}),[S,Z]),C(Z,(function(e,n,t){null!==h&&(n[B.QK]?m((function(e){return 0===e?2:e-1})):n[B.DY]&&m((function(e){return 2===e?0:e+1})))}),[h,m]),(0,w.jsx)(ln.Z,{onClickOutside:function(){return m(null)},open:!0,style:{position:"relative"},children:(0,w.jsxs)(k.Z,{children:[(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(cn.u,{highlighted:0===h,onClick:function(){return m((function(e){return 0===e?null:0}))},onMouseEnter:function(){return m((function(e){return null!==e?0:null}))},ref:v,children:(0,w.jsx)(_.ZP,{children:"File"})}),(0,w.jsx)(q.Z,{items:x,onClickCallback:function(){return m(null)},open:0===h,parentRef:v,uuid:"FileHeaderMenu/file_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(cn.u,{highlighted:1===h,onClick:function(){return m((function(e){return 1===e?null:1}))},onMouseEnter:function(){return m((function(e){return null!==e?1:null}))},ref:g,children:(0,w.jsx)(_.ZP,{children:"Run"})}),(0,w.jsx)(q.Z,{items:j,onClickCallback:function(){return m(null)},open:1===h,parentRef:g,uuid:"FileHeaderMenu/run_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(cn.u,{highlighted:2===h,onClick:function(){return m((function(e){return 2===e?null:2}))},onMouseEnter:function(){return m((function(e){return null!==e?2:null}))},ref:b,children:(0,w.jsx)(_.ZP,{children:"Edit"})}),(0,w.jsx)(q.Z,{items:y,onClickCallback:function(){return m(null)},open:2===h,parentRef:b,uuid:"FileHeaderMenu/edit_items"})]}),t]})})},pn=t(46261),hn=t(82386),mn=t(37391),vn=300,gn=g.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;}"],vn,vn),bn=g.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||Ae.Z.background).codeArea,";\n ")})),xn=g.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],hn.Wi,hn.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||Ae.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||Ae.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(hn.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,mn.y$)()),jn=g.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-left:1px solid transparent;height:100%;padding:","px ","px;"," "," "," ",""],C.iI,C.cd*C.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||Ae.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||Ae.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&"\n border-color: ".concat((e.theme.borders||Ae.Z.borders).light," !important;\n ")}),(function(e){return e.last&&"\n border-right: 1px solid transparent;\n "})),yn=t(33766);var kn,Zn,On=function(e){var n=e.filePaths,t=e.filesTouched,i=e.savePipelineContent,r=e.selectedFilePath,o=(0,s.useContext)(g.ThemeContext),l=(0,s.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]);return(0,w.jsx)(xn,{relativePosition:!0,secondary:!0,children:(0,w.jsx)(k.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,w.jsx)(k.Z,{flexDirection:"column",fullHeight:!0,onClick:function(n){n.preventDefault(),c||(i(),(0,yn.u7)({file_path:encodeURIComponent(e)}))},children:(0,w.jsx)(jn,{last:n===l.length-1,selected:c,children:(0,w.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,children:[!t[e]&&(0,w.jsx)(le.iU,{muted:!c,size:1.5*C.iI}),t[e]&&(0,w.jsx)(pn.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,w.jsx)("div",{style:{padding:1},children:(0,w.jsx)(x.Z,{borderColor:(o||Ae.Z).borders.danger,size:1.25*C.iI})})}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{muted:!c,children:e}),(0,w.jsx)(O.Z,{mr:2}),c&&(0,w.jsx)(pn.Z,{appearAbove:!0,label:"Close",size:null,widthFitContent:!0,children:(0,w.jsx)(Z.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){var n=(0,ue.Od)(l,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,yn.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(le.x8,{size:1.25*C.iI})})}),!c&&(0,w.jsx)("div",{style:{width:1.25*C.iI}})]})})},e)}))})})},_n=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(kn||(kn={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(Zn||(Zn={}));var Cn=t(90686),Sn=["bold","defaultColor","description","disableWordBreak","inputValue","inputWidth","invertedTheme","label","labelColor","menuOpen","monospace","muted","onClick","notRequired","selectedTextProps","small","stacked","tooltipProps","value"];function wn(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 En(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?wn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Pn=g.default.div.withConfig({displayName:"LabelWithValueClicker__LabelStyle",componentId:"sc-1hzpn4h-0"})(["margin-bottom:","px;"],.25*C.iI),In=g.default.div.withConfig({displayName:"LabelWithValueClicker__DescriptionStyle",componentId:"sc-1hzpn4h-1"})([""]);var Tn,An=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,x=e.small,j=e.stacked,C=e.tooltipProps,S=e.value,E=(0,Q.Z)(e,Sn),P=(0,s.useRef)(null),I=(0,s.useState)(!1),T=I[0],A=I[1],R=(0,s.useState)(!1),D=R[0],M=R[1],B=a&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_.ZP,{bold:t,color:d,inverted:u,lineHeight:20,monospace:h,muted:m,small:x,children:a}),C&&(0,w.jsx)(O.Z,{ml:1,children:(0,w.jsx)(pn.Z,En({muted:!0},C))})]}),L=(0,w.jsxs)(w.Fragment,{children:[S&&(0,w.jsx)(Z.Z,{block:!0,danger:null===b||void 0===b?void 0:b.danger,fullWidth:!0,muted:m,onClick:function(){v(),P.current&&P.current.focus(),A(!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,w.jsx)(_.ZP,En(En({inverted:u,muted:m},b),{},{disableWordBreak:o,monospace:h,small:x,width:c,children:S}))}),(0,w.jsx)(N.Z,En(En({},E),{},{basic:!0,defaultColor:i,invertedTheme:u,monospace:h,onBlur:function(e){A(!1),E.onBlur&&E.onBlur(e),D||M(!0)},onFocus:function(e){A(!0),E.onFocus&&E.onFocus(e)},ref:P,small:x,value:l,visible:!S}))]}),F=r&&(0,w.jsx)(In,{children:(0,w.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:r},monospace:h,muted:!0,small:x})});return(0,w.jsxs)(w.Fragment,{children:[j&&(0,w.jsxs)(w.Fragment,{children:[B&&(0,w.jsxs)(Pn,{children:[(0,w.jsx)(k.Z,{alignItems:"center",fullHeight:!1,fullWidth:!0,children:B}),F]}),L]}),!j&&(0,w.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,children:[B&&(0,w.jsxs)(w.Fragment,{children:[B,(0,w.jsx)(O.Z,{ml:1})]}),(0,w.jsx)(y.Z,{flex:"1",children:L})]}),D&&!T&&!S&&!p&&!g&&(0,w.jsx)(_.ZP,{danger:!0,small:x,children:"This field is required."})]})};!function(e){e.EMR="emr"}(Tn||(Tn={}));var Rn=t(42305);var Dn=function(e){var n,t=e.children,i=(e.filePaths,e.filesTouched,e.isBusy),o=e.isPipelineUpdating,c=e.kernel,u=e.pipeline,a=e.pipelineContentTouched,f=e.pipelineLastSaved,p=(e.restartKernel,e.savePipelineContent,e.selectedFilePath),h=e.setErrors,m=e.updatePipelineMetadata,v=(0,s.useContext)(g.ThemeContext),b=c||{},j=b.alive,S=(b.name,(0,s.useState)(!1)),E=S[0],P=S[1],I=(0,s.useState)(""),T=I[0],A=I[1],D=(0,s.useState)(Tn.EMR),N=D[0],L=(D[1],(0,s.useState)(!1)),F=L[0],U=L[1],H=(0,s.useState)(!1),z=H[0],G=H[1],W=(0,s.useRef)(null),V=_e.ZP.clusters.detail(N),Q=V.data,Y=V.mutate,K=(0,s.useMemo)((function(){var e;return(null===Q||void 0===Q||null===(e=Q.cluster)||void 0===e?void 0:e.clusters)||[]}),Q),X=(0,ue.sE)(K,(function(e){return e.is_active})),J=(0,d.Db)(_e.ZP.clusters.useUpdate(N),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){Y()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),$=(0,l.Z)(J,2),ee=$[0];$[1].isLoading,(0,s.useEffect)((function(){null!==u&&void 0!==u&&u.uuid&&A(u.uuid)}),[null===u||void 0===u?void 0:u.uuid]),n=a?"Unsaved changes":o?"Saving changes...":f?"Last saved ".concat((0,Rn.JX)(Number(f)/1e3)):"All changes saved";var ne="KernelStatus",te=(0,en.y)(),ie=te.registerOnKeyDown,re=te.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){re(ne)}}),[re,ne]),ie(ne,(function(e,n,t){E&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&((null===u||void 0===u?void 0:u.uuid)===T?e.target.blur():(m(T),P(!1)))}),[E,T,P,m]);var oe=(0,s.useMemo)((function(){return(0,w.jsx)(An,{bold:!1,inputValue:T,notRequired:!0,onBlur:function(){return setTimeout((function(){return P(!1)}),300)},onChange:function(e){A(e.target.value),e.preventDefault()},onClick:function(){return P(!0)},onFocus:function(){return P(!0)},stacked:!0,value:E?null:(null===u||void 0===u?void 0:u.uuid)||""})}),[E,T,u]),ce=(0,s.useMemo)((function(){return(0,w.jsx)("div",{ref:W,style:{position:"relative"},children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(null===u||void 0===u?void 0:u.type)===M.qL.PYSPARK&&(0,w.jsxs)(O.Z,{mr:1,children:[(0,w.jsxs)(Z.Z,{muted:!!X,onClick:function(){return U(!0)},preventDefault:!0,sameColorAsText:!X,underline:!X,children:[X&&X.id,!X&&"Select cluster"]}),(0,w.jsx)(ln.Z,{disableEscape:!0,onClickOutside:function(){return U(!1)},open:F,children:(0,w.jsx)(q.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)(K.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,w.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsx)(y.Z,{flex:1,children:(0,w.jsx)(_.ZP,{muted:!t&&Zn.WAITING!==i,children:n})}),t&&(0,w.jsx)(le.Jr,{size:2*C.iI,success:!0}),!t&&(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||Zn.WAITING!==i?null:function(){return ee({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return U(!1)},open:F,parentRef:W,uuid:"KernelStatus/select_cluster",width:40*C.iI})})]}),(0,w.jsx)(R.ZP,{beforeElement:(0,w.jsx)(x.Z,{color:i?(v||Ae.Z).borders.info:j?(v||Ae.Z).borders.success:(v||Ae.Z).borders.danger,size:C.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return G(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===u||void 0===u?void 0:u.type)||M.qL.PYTHON}),(0,w.jsx)(ln.Z,{disableEscape:!0,onClickOutside:function(){return G(!1)},open:z,children:(0,w.jsx)(q.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(M.a_).filter((function(e){return(null===u||void 0===u?void 0:u.type)!=e})).map((function(e){return{label:function(){return e},onClick:function(){return m(null===u||void 0===u?void 0:u.name,e)},uuid:e}})))),onClickCallback:function(){return G(!1)},open:z,parentRef:W,uuid:"KernelStatus/select_kernel",width:25*C.iI})})]})})}),[j,K,i,u,X,U,G,F,z,v,ee]);return(0,s.useMemo)((function(){return(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsxs)(_.ZP,{children:["Pipeline:\xa0",p&&(null===u||void 0===u?void 0:u.uuid)]}),!p&&oe,(0,w.jsx)(O.Z,{mr:3})]})}),[j,i,u,oe,p,v]),(0,w.jsx)(xn,{relativePosition:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,w.jsx)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:(0,w.jsxs)(O.Z,{px:C.cd,children:[p&&(0,w.jsx)(Z.Z,{noHoverUnderline:!0,noOutline:!0,onClick:p?function(){return(0,yn.u7)({file_path:null})}:null,preventDefault:!0,children:t}),!p&&(0,w.jsxs)(k.Z,{alignItems:"center",children:[t,E&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(Z.Z,{onClick:function(){m(T),P(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]})}),(0,w.jsx)(O.Z,{px:C.cd,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[ce,(0,w.jsx)(O.Z,{ml:2}),(0,w.jsx)(pn.Z,{appearBefore:!0,block:!0,description:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(_.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,w.jsx)(Cn.Z,{inline:!0,keyText:an()?B.RJ:B.hE}),"\xa0",(0,w.jsx)(_.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,w.jsx)(Cn.Z,{inline:!0,keyText:B.SS}),"\xa0",(0,w.jsx)(_.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,w.jsx)("br",{})]}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsxs)(_.ZP,{default:!0,children:["Or, go to ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,w.jsx)(_.ZP,{muted:!0,children:n})})]})})]})})},Mn=t(82635),Nn=t(16910);var Bn,Ln,Fn,Un,Hn,zn,Gn=function(e){var n=e.size;return(0,w.jsx)("svg",{fill:"none",height:n,preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 256",width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,w.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"})})},Wn=t(30264),Vn=t(80906),Qn=C.cd*C.iI,qn=g.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;"," "," "," "," "," "," ",""],Re.BG,(function(e){return e.border&&"\n border: 1px dotted ".concat((e.theme.content||Ae.Z.content).active,";\n ")}),(function(e){return e.blue&&"\n background-color: ".concat((0,S.qn)(v.tf.DATA_LOADER,e).accent,";\n ")}),(function(e){return e.purple&&"\n background-color: ".concat((0,S.qn)(v.tf.TRANSFORMER,e).accent,";\n ")}),(function(e){return e.teal&&"\n background-color: ".concat((0,S.qn)(v.tf.EXTENSION,e).accent,";\n ")}),(function(e){return e.yellow&&"\n background-color: ".concat((0,S.qn)(v.tf.DATA_EXPORTER,e).accent,";\n ")}),(function(e){return!e.compact&&"\n height: ".concat(Qn+C.iI/2,"px;\n width: ").concat(Qn+C.iI/2,"px;\n ")}),(function(e){return e.compact&&"\n height: ".concat(Qn/2+C.iI,"px;\n width: ").concat(Qn/2+C.iI,"px;\n ")})),Yn=g.default.div.withConfig({displayName:"indexstyle__ButtonWrapper",componentId:"sc-oyfjzc-1"})(["position:relative;margin-bottom:","px;margin-right:","px;",""],C.iI,C.iI,(function(e){return e.increasedZIndex&&"\n z-index: 3;\n "})),Kn=(Vn.Q0.AVERAGE,Vn.Q0.CLEAN_COLUMN_NAME,Vn.Q0.COUNT,Vn.Q0.COUNT_DISTINCT,Vn.Q0.CUSTOM,Vn.Q0.DIFF,Vn.Q0.FIRST,Vn.Q0.FIX_SYNTAX_ERRORS,Vn.Q0.IMPUTE,Vn.Q0.LAST,Vn.Q0.MAX,Vn.Q0.MEDIAN,Vn.Q0.MIN,Vn.Q0.NORMALIZE,Vn.Q0.REFORMAT,Vn.Q0.REMOVE,Vn.Q0.REMOVE_OUTLIERS,Vn.Q0.SELECT,Vn.Q0.SHIFT_DOWN,Vn.Q0.SHIFT_UP,Vn.Q0.STANDARDIZE,Vn.Q0.SUM,[Vn.Q0.DROP_DUPLICATE,Vn.Q0.FILTER,Vn.Q0.SORT,Vn.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"}(zn||(zn={}));var Xn,Jn,$n,et=(Ln={},(0,o.Z)(Ln,Vn.qs.COLUMN,(Bn={},(0,o.Z)(Bn,zn.AGGREGATE,[Vn.Q0.AVERAGE,Vn.Q0.COUNT,Vn.Q0.COUNT_DISTINCT,Vn.Q0.FIRST,Vn.Q0.LAST,Vn.Q0.MAX,Vn.Q0.MEDIAN,Vn.Q0.MIN,Vn.Q0.SUM]),(0,o.Z)(Bn,zn.FORMATTING,[Vn.Q0.CLEAN_COLUMN_NAME,Vn.Q0.FIX_SYNTAX_ERRORS,Vn.Q0.REFORMAT]),(0,o.Z)(Bn,zn.COLUMN_REMOVAL,[Vn.Q0.REMOVE,Vn.Q0.SELECT]),(0,o.Z)(Bn,zn.SHIFT_ROWS,[Vn.Q0.SHIFT_DOWN,Vn.Q0.SHIFT_UP]),(0,o.Z)(Bn,zn.MISC,[Vn.Q0.DIFF,Vn.Q0.IMPUTE,Vn.Q0.REMOVE_OUTLIERS]),(0,o.Z)(Bn,zn.FEATURE_SCALING,[Vn.Q0.NORMALIZE,Vn.Q0.STANDARDIZE]),Bn)),(0,o.Z)(Ln,Vn.qs.ROW,(0,o.Z)({},zn.MISC,[].concat(Kn))),Ln),nt=Object.keys(et[Vn.qs.COLUMN]),tt=[zn.MISC],it=(Hn={},(0,o.Z)(Hn,Vn.qs.COLUMN,(Fn={},(0,o.Z)(Fn,Vn.Q0.ADD,"Add column"),(0,o.Z)(Fn,Vn.Q0.AVERAGE,"Aggregate by average value"),(0,o.Z)(Fn,Vn.Q0.CLEAN_COLUMN_NAME,"Clean column name"),(0,o.Z)(Fn,Vn.Q0.COUNT_DISTINCT,"Aggregate by distinct count"),(0,o.Z)(Fn,Vn.Q0.COUNT,"Aggregate by total count"),(0,o.Z)(Fn,Vn.Q0.DIFF,"Difference"),(0,o.Z)(Fn,Vn.Q0.FIRST,"Aggregate by first value"),(0,o.Z)(Fn,Vn.Q0.FIX_SYNTAX_ERRORS,"Fix syntax errors"),(0,o.Z)(Fn,Vn.Q0.IMPUTE,"Fill in missing values"),(0,o.Z)(Fn,Vn.Q0.NORMALIZE,"Normalize Data"),(0,o.Z)(Fn,Vn.Q0.STANDARDIZE,"Standardize Data"),(0,o.Z)(Fn,Vn.Q0.LAST,"Aggregate by last value"),(0,o.Z)(Fn,Vn.Q0.MAX,"Aggregate by maximum value"),(0,o.Z)(Fn,Vn.Q0.MEDIAN,"Aggregate by median value"),(0,o.Z)(Fn,Vn.Q0.MIN,"Aggregate by mininum value"),(0,o.Z)(Fn,Vn.Q0.REFORMAT,"Reformat"),(0,o.Z)(Fn,Vn.Q0.REMOVE_OUTLIERS,"Remove outliers"),(0,o.Z)(Fn,Vn.Q0.REMOVE,"Remove column(s)"),(0,o.Z)(Fn,Vn.Q0.SELECT,"Keep columns"),(0,o.Z)(Fn,Vn.Q0.SHIFT_DOWN,"Shift rows down in a column"),(0,o.Z)(Fn,Vn.Q0.SHIFT_UP,"Shift rows up in a column"),(0,o.Z)(Fn,Vn.Q0.SUM,"Aggregate by sum of values"),Fn)),(0,o.Z)(Hn,Vn.qs.ROW,(Un={},(0,o.Z)(Un,Vn.Q0.DROP_DUPLICATE,"Drop duplicates"),(0,o.Z)(Un,Vn.Q0.FILTER,"Filter"),(0,o.Z)(Un,Vn.Q0.SORT,"Sort"),(0,o.Z)(Un,Vn.Q0.REMOVE,"Remove rows"),Un)),Hn);!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"}($n||($n={}));var rt=(Xn={},(0,o.Z)(Xn,$n.API,"API"),(0,o.Z)(Xn,$n.AZURE_BLOB_STORAGE,"Azure Blob Storage"),(0,o.Z)(Xn,$n.AZURE_EVENT_HUB,"Azure Event Hub"),(0,o.Z)(Xn,$n.BIGQUERY,"Google BigQuery"),(0,o.Z)(Xn,$n.FILE,"Local file"),(0,o.Z)(Xn,$n.GENERIC,"Generic (no template)"),(0,o.Z)(Xn,$n.GOOGLE_CLOUD_STORAGE,"Google Cloud Storage"),(0,o.Z)(Xn,$n.KAFKA,"Kafka"),(0,o.Z)(Xn,$n.KINESIS,"Kinesis"),(0,o.Z)(Xn,$n.MYSQL,"MySQL"),(0,o.Z)(Xn,$n.OPENSEARCH,"OpenSearch"),(0,o.Z)(Xn,$n.POSTGRES,"PostgreSQL"),(0,o.Z)(Xn,$n.RABBITMQ,"RabbitMQ"),(0,o.Z)(Xn,$n.REDSHIFT,"Amazon Redshift"),(0,o.Z)(Xn,$n.S3,"Amazon S3"),(0,o.Z)(Xn,$n.SNOWFLAKE,"Snowflake"),Xn),ot=(Jn={},(0,o.Z)(Jn,v.tf.DATA_LOADER,[$n.GENERIC,$n.FILE,$n.API,$n.AZURE_BLOB_STORAGE,$n.BIGQUERY,$n.GOOGLE_CLOUD_STORAGE,$n.MYSQL,$n.POSTGRES,$n.REDSHIFT,$n.S3,$n.SNOWFLAKE]),(0,o.Z)(Jn,v.tf.DATA_EXPORTER,[$n.GENERIC,$n.FILE,$n.AZURE_BLOB_STORAGE,$n.BIGQUERY,$n.GOOGLE_CLOUD_STORAGE,$n.MYSQL,$n.POSTGRES,$n.REDSHIFT,$n.S3,$n.SNOWFLAKE]),(0,o.Z)(Jn,v.tf.TRANSFORMER,[$n.BIGQUERY,$n.POSTGRES,$n.REDSHIFT,$n.SNOWFLAKE]),(0,o.Z)(Jn,v.tf.SENSOR,[$n.GENERIC,$n.BIGQUERY,$n.MYSQL,$n.POSTGRES,$n.REDSHIFT,$n.S3,$n.SNOWFLAKE]),Jn),lt=$n,ct=function(e,n,t){var i=t===M.qL.STREAMING&&(e===v.tf.DATA_LOADER||e===v.tf.DATA_EXPORTER);return(function(e){var n;return e===M.qL.STREAMING?(n={},(0,o.Z)(n,v.tf.DATA_LOADER,[lt.AZURE_EVENT_HUB,lt.KAFKA,lt.KINESIS,lt.RABBITMQ]),(0,o.Z)(n,v.tf.DATA_EXPORTER,[lt.S3,lt.KAFKA,lt.KINESIS,lt.OPENSEARCH]),(0,o.Z)(n,v.tf.TRANSFORMER,[lt.GENERIC]),n):ot}(t)[e]||[]).map((function(t){return{indent:e===v.tf.TRANSFORMER,label:function(){return rt[t]},onClick:function(){n({config:{data_source:t===lt.GENERIC?null:t},language:i?v.t6.YAML:v.t6.PYTHON,type:e})},uuid:"".concat(e,"/").concat(t)}}))},ut=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")}]},at=function(e,n,t){var i=Object.fromEntries(v.Ut.map((function(n){return[n,ct(n,e,t)]})));return t===M.qL.PYSPARK||t===M.qL.PYTHON&&n===v.tf.TRANSFORMER||t===M.qL.STREAMING||n===v.tf.SENSOR?i[n]:[{items:i[n],label:function(){return"Python"},uuid:"".concat(n,"/python")}].concat((0,r.Z)(ut(e,n)))};function st(e,n,t){return e.map((function(e){return{indent:!0,label:function(){return it[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 dt(e,n,t){var i=[];return e.forEach((function(e){if(e!==zn.MISC)i.push({indent:!0,items:st(et[n][e],n,t),label:function(){return e},uuid:"".concat(n,"_grouping_").concat((0,me.RA)(e))});else{var o=st(et[n][e],n,t);i.push.apply(i,(0,r.Z)(o))}})),i}var ft=function(e,n,t){return Object.values(v.Lq).map((function(i){return{label:function(){return(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le.mm,{fill:(0,S.qn)(v.tf.CUSTOM,{blockColor:i}).accent,size:16}),"\xa0",(0,w.jsx)(_.ZP,{children:(0,me.kC)(i)})]})},leftAligned:!0,onClick:function(){e({color:i,language:t,type:n})},uuid:"".concat(t,"_").concat(i)}}))},pt=function(e){return"-- Docs: https://docs.mage.ai/guides/sql-blocks\n"+(e||"")};function ht(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 mt(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 vt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?mt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var gt=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)),x=b[0],j=b[1],y=(0,s.useRef)(null),Z=(0,s.useRef)(null),O=(0,s.useRef)(null),_=(0,s.useRef)(null),S=(0,s.useRef)(null),E=(0,s.useRef)(null),P={compact:i,inline:!0},I=null===h||void 0===h?void 0:h.type,T=I===M.qL.STREAMING,A=i?Qn/2:Qn,D=25*C.iI,N=dt(nt,Vn.qs.COLUMN,n),B=[{label:function(){return"Generic (no template)"},onClick:function(){n({language:v.t6.PYTHON,type:v.tf.TRANSFORMER})},uuid:"generic_transformer_action"},{bold:!0,items:dt(tt,Vn.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)(N));f||B.splice(1,0,{bold:!0,items:at(n,v.tf.TRANSFORMER,I),label:function(){return"Data sources"},uuid:"data_sources_grouping"});var L=(0,s.useCallback)((function(){return j(null)}),[]),F=(0,s.useCallback)((function(e){return null===m||void 0===m?void 0:m((function(n){return null===n||x!==e?t:null}))}),[t,x,m]),U=M.qL.PYSPARK===I;return(0,w.jsx)(k.Z,{flexWrap:"wrap",inline:!0,children:(0,w.jsx)(ln.Z,{onClickOutside:L,open:!0,children:(0,w.jsxs)(k.Z,{flexWrap:"wrap",children:[!l&&(0,w.jsx)(Yn,{increasedZIndex:0===x,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:at(n,v.tf.DATA_LOADER,I),onClickCallback:L,open:0===x,parentRef:y,uuid:"data_loader_button",children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{blue:!0,compact:i,children:(0,w.jsx)(le.mm,{size:A})}),onClick:function(e){e.preventDefault(),j((function(e){return 0===e?null:0})),F(0)},uuid:"AddNewBlocks/Data_loader",children:"Data loader"}))})}),!d&&(0,w.jsx)(Yn,{increasedZIndex:1===x,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:U||M.qL.INTEGRATION===I?B:T?[{items:at(n,v.tf.TRANSFORMER,I),label:function(){return"Python"},uuid:"transformers/python"}]:[{items:B,label:function(){return"Python"},uuid:"transformers/python_all"}].concat((0,r.Z)(ut(n,v.tf.TRANSFORMER))),onClickCallback:L,open:1===x,parentRef:Z,uuid:"transformer_button",children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{compact:i,purple:!0,children:(0,w.jsx)(le.mm,{size:A})}),onClick:function(e){e.preventDefault(),j((function(e){return 1===e?null:1})),F(1)},uuid:"AddNewBlocks/Transformer",children:"Transformer"}))})}),!l&&(0,w.jsx)(Yn,{increasedZIndex:2===x,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:at(n,v.tf.DATA_EXPORTER,I),onClickCallback:L,open:2===x,parentRef:O,uuid:"data_exporter_button",children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{compact:i,yellow:!0,children:(0,w.jsx)(le.mm,{inverted:!0,size:A})}),onClick:function(e){e.preventDefault(),j((function(e){return 2===e?null:2})),F(2)},uuid:"AddNewBlocks/Data_exporter",children:"Data exporter"}))})}),!c&&(0,w.jsx)(Yn,{increasedZIndex:3===x,children:(0,w.jsx)(Wn.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===x,parentRef:_,uuid:"dbt_button",children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(Gn,{size:Qn*(i?.75:1.25)}),onClick:function(e){e.preventDefault(),j((function(e){return 3===e?null:3})),F(3)},uuid:"AddNewBlocks/DBT",children:"DBT model"}))})}),!o&&(0,w.jsx)(Yn,{increasedZIndex:4===x,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:[{items:ft(n,v.tf.CUSTOM,v.t6.PYTHON),label:function(){return"Python"},uuid:"custom_block_python"},{items:ft(n,v.tf.CUSTOM,v.t6.SQL),label:function(){return"SQL"},uuid:"custom_block_sql"}],onClickCallback:L,open:4===x,parentRef:S,uuid:"custom_block_button",children:(0,w.jsx)(pn.Z,{block:!0,label:"Add a custom code block with a designated color.",maxWidth:D,size:null,children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{compact:i,children:(0,w.jsx)(le.I8,{size:A})}),onClick:function(e){e.preventDefault(),j((function(e){return 4===e?null:4})),F(4)},uuid:"AddNewBlocks/Scratchpad",children:"Custom"}))})})}),!u&&(0,w.jsx)(Yn,{children:(0,w.jsx)(pn.Z,{block:!0,label:"Write experimental code that doesn\u2019t get executed when you run your pipeline.",maxWidth:D,size:null,children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{border:!0,compact:i,children:(0,w.jsx)(le.mm,{size:A})}),onClick:function(e){e.preventDefault(),n({type:v.tf.SCRATCHPAD})},uuid:"AddNewBlocks/Scratchpad",children:"Scratchpad"}))})}),!T&&!a&&(0,w.jsx)(Yn,{increasedZIndex:6===x,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:at(n,v.tf.SENSOR,I),onClickCallback:L,open:6===x,parentRef:E,uuid:"sensor_button",children:(0,w.jsx)(R.ZP,vt(vt({},P),{},{beforeElement:(0,w.jsx)(qn,{compact:i,children:(0,w.jsx)(le.LM,{pink:!0,size:Qn*(i?.75:1.25)})}),onClick:function(e){e.preventDefault(),j((function(e){return 6===e?null:6})),F(6)},uuid:"AddNewBlocks/Sensor",children:"Sensor"}))})})]})})})},bt=t(18283),xt=t(89565),jt=t.n(xt),yt=t(62976),kt=t(86532),Zt=t(66166),Ot=g.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;"," "," ",""],S.Kf,(function(e){return e.addBottomPadding&&"\n padding-bottom: ".concat(2*C.tr,"px;\n ")}),(function(e){return"\n background-color: ".concat((e.theme.background||Ae.Z.background).table,";\n ")}),(function(e){return!e.executedAndIdle&&"\n border-bottom-left-radius: ".concat(Re.n_,"px;\n border-bottom-right-radius: ").concat(Re.n_,"px;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n ")})),_t=g.default.div.withConfig({displayName:"indexstyle__OutputRowStyle",componentId:"sc-n38rkq-1"})([""," "," ",""],(function(e){return e.first&&"\n padding-top: ".concat(C.iI*C.cd,"px;\n ")}),(function(e){return e.last&&"\n padding-bottom: ".concat(C.iI*C.cd,"px;\n ")}),(function(e){return e.contained&&"\n padding-left: ".concat(S.oh,"px;\n padding-right: ").concat(C.iI*C.cd,"px;\n ")})),Ct=g.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{","}"],S.Kf,(function(e){return"\n color: ".concat((e.theme.interactive||Ae.Z.interactive).linkPrimary,";\n ")})),St=g.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;",""],S.Kf,(function(e){return"\n background-color: ".concat((e.theme.borders||Ae.Z.borders).light,";\n border-bottom-left-radius: ").concat(Re.n_,"px;\n border-bottom-right-radius: ").concat(Re.n_,"px;\n ")})),wt=g.default.div.withConfig({displayName:"indexstyle__ExtraInfoContentStyle",componentId:"sc-n38rkq-4"})(["padding-bottom:","px;padding-left:","px;padding-right:","px;padding-top:","px;"],C.iI,S.oh,C.iI*C.cd,C.iI),Et=g.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||Ae.Z.borders).medium,";\n ")})),Pt=/\[__internal_output__\]/,It=/\[__internal_test__\]/,Tt={uuid:"Preview results"},At={uuid:"Logs"},Rt={uuid:"SQL"},Dt={uuid:"Lineage"},Mt=[Tt,At,Rt,Dt];function Nt(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 Bt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Nt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Nt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Lt(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:Bt({shape:i},t),type:o}:r&&(0,me.Pb)(r)?JSON.parse(r):r}))),t[o]||(t[o]={}),t[o][l]=i})),{content:t,messages:n}}function Ft(e,n,t){e.forEach((function(e){(0,F.t8)("".concat(t,"/").concat(e.uuid,"/codeCollapsed"),(0,F.Od)("".concat(n,"/").concat(e.uuid,"/codeCollapsed"))),(0,F.t8)("".concat(t,"/").concat(e.uuid,"/outputCollapsed"),(0,F.Od)("".concat(n,"/").concat(e.uuid,"/outputCollapsed")))}))}function Ut(e){return"".concat(e,"/").concat(F.kP)}function Ht(e){return(0,F.U2)(Ut(e),[])}function zt(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 Gt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?zt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):zt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wt,Vt=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,g=e.messages,b=e.openSidekickView,Z=e.pipeline,S=e.runCount,E=e.runEndTime,P=e.runStartTime,I=e.selected,A=e.selectedTab,R=e.setCollapsed,D=e.setOutputBlocks,N=e.setSelectedOutputBlock,B=e.setSelectedTab,L=n.status,U=n.type,H=(0,s.useMemo)((function(){return(null===g||void 0===g?void 0:g.length)||0}),[g]),z=v.DA.EXECUTED===L||!h&&0===S&&H>=1||!h&&S>=1&&E>=P,W=(0,s.useState)(),V=W[0],Q=W[1],q=(0,s.useState)(),Y=q[0],X=q[1];(0,s.useEffect)((function(){h||X(100)}),[h]);var J=function(e){return Array.isArray(e)?e.join("\n"):e},$=(0,s.useMemo)((function(){return g.reduce((function(e,n){var t=e.at(-1);if(Mn.jU.includes(null===t||void 0===t?void 0:t.type)&&(null===t||void 0===t?void 0:t.type)===n.type&&!J(null===n||void 0===n?void 0:n.data).match(Pt)){if(Array.isArray(t.data))t.data.concat(n.data);else if("string"===typeof t.data){var i=J(n.data)||"";t.data=[t.data,i].join("\n")}}else Mn.jU.includes(null===n||void 0===n?void 0:n.type)&&!J(null===n||void 0===n?void 0:n.data).match(Pt)?e.push(Gt(Gt({},n),{},{data:J(n.data)})):e.push(Gt({},n));return e}),[])}),[g]),ee=(0,s.useMemo)((function(){return(0,w.jsx)(Ie.Z,{progress:Y})}),[Y]),ne=v.tf.DBT===(null===n||void 0===n?void 0:n.type),te=(0,Zt.Z)(d);(0,s.useEffect)((function(){ne&&!te&&d&&B(At)}),[d,te,ne,B]);var ie=(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&&Q(o),r.length>=1&&(0,w.jsx)(yt.Z,{columns:t,disableScrolling:!c,index:i,maxHeight:60*C.iI,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!l,rows:r,width:m-(2+C.cd*C.iI*2+2+mn.nn)},"data-table-".concat(i))},n=[],t=[],i=[];return null===$||void 0===$||$.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===$.length-1&&r===f-1},s=l>=1;if("string"===typeof n&&n.match(It)){var d=n.split("\n"),h=[];d.forEach((function(e){if(e.match(It)){var t=e.split("[__internal_test__]"),r=t[t.length-1];(0,me.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(Pt)){var m=n.split("[__internal_output__]"),v=m[m.length-1],g=v.split("FloatProgress");if(m.length>=2&&(v=g[0]),(0,me.Pb)(v)){var b=JSON.parse(v),x=b.data,j=b.type;if(Mn.Gi.TABLE===j){!0;var y=e(x,{borderTop:s,selected:I});t.push(y),ne||(o=y)}}}else if(a===Mn.Gi.TABLE){!0;var k=e((0,me.Pb)(n)?JSON.parse(n):n,{borderTop:s,selected:I});t.push(k),ne||(o=k)}else if(Mn.jU.includes(a)){var Z,O=null===(Z=n)||void 0===Z?void 0:Z.split("\\n");o=(0,w.jsx)(_t,Gt(Gt({},u),{},{children:O.map((function(e){return(0,w.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,w.jsx)(jt(),{children:e})},e)}))}))}else if(a===Mn.Gi.TEXT_HTML)o=(0,w.jsx)(_t,Gt(Gt({},u),{},{children:(0,w.jsx)(Ct,{children:(0,w.jsx)(_.ZP,{dangerouslySetInnerHTML:{__html:n},monospace:!0})})}));else if(a===Mn.Gi.IMAGE_PNG)o=(0,w.jsx)("div",{style:{backgroundColor:"white"},children:(0,w.jsx)("img",{alt:"Image ".concat(l," from code output"),src:"data:image/png;base64, ".concat(n)})});else if(a===Mn.Gi.PROGRESS){var C=parseInt(n);X(C>90?90:C)}o&&p.push((0,w.jsx)("div",{children:o},"code-output-".concat(l,"-").concat(r)))}})),p.length>=1&&n.push(p)}})),h&&(null===Z||void 0===Z?void 0:Z.type)===M.qL.PYSPARK&&n.unshift([(0,w.jsx)(_t,{contained:!0,children:(0,w.jsx)(O.Z,{mt:1,children:ee})},"progress_bar")]),{content:n,tableContent:t,testContent:i}}),[$,c,ne,h,m,Z,ee,I]),re=ie.content,oe=ie.tableContent,ce=ie.testContent,ue=(null===V||void 0===V?void 0:V[1])||0,ae=ue>30?" (30 out of ".concat(ue," columns displayed)"):"",se=(0,s.useMemo)((function(){var e;if(ne&&A){var n=A.uuid;if(Tt.uuid===n)(null===oe||void 0===oe?void 0:oe.length)>=1?e=oe:h||(e=(0,w.jsx)(O.Z,{px:2,py:1,children:(0,w.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No preview to display yet, try running the block."})}));else if(At.uuid===n)(null===re||void 0===re?void 0:re.length)>=1?e=re:h||(e=(0,w.jsx)(O.Z,{px:2,py:1,children:(0,w.jsx)(_.ZP,{muted:!0,children:d?"Error, check logs.":"No logs to display yet, try running the block."})}));else if(Rt.uuid===n){var r,o=null===t||void 0===t||null===(r=t.dbt)||void 0===r?void 0:r.sql;e=o?(0,w.jsx)($e.Z,{autoHeight:!0,language:G.SQL,padding:!0,readOnly:!0,value:o,width:"100%"}):null}else if(Dt.uuid===n){var l,c=null===t||void 0===t||null===(l=t.dbt)||void 0===l?void 0:l.lineage;e=c?(0,w.jsx)(kt.Z,{disabled:!0,enablePorts:!1,height:55*C.iI,pannable:I,pipeline:Gt(Gt({},Z),{},{blocks:c}),zoomable:I}):null}}else e=re;return(0,w.jsxs)(w.Fragment,{children:[i,e]})}),[t,i,re,d,ne,h,Z,I,A,oe]);return i||f?(0,w.jsxs)(w.Fragment,{children:[c&&(0,w.jsxs)(Ot,{addBottomPadding:h&&(null===Z||void 0===Z?void 0:Z.type)===M.qL.PYSPARK,blockType:U,dynamicBlock:u,dynamicChildBlock:a,executedAndIdle:z,hasError:d,selected:I,children:[!o&&(null===ce||void 0===ce?void 0:ce.length)>=1&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{py:2,children:(0,w.jsx)(_t,{contained:!0,children:ce.map((function(e,n){var t=e.error,i=e.message,r=e.stacktrace;return(0,w.jsxs)(O.Z,{mt:n>=1?3:0,children:[(0,w.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,w.jsx)(jt(),{children:"".concat(i).concat(t?" "+t:"")})}),null===r||void 0===r?void 0:r.map((function(e){return(0,w.jsx)(_.ZP,{default:!0,monospace:!0,preWrap:!0,small:!0,children:(0,w.jsx)(jt(),{children:e})},e)}))]},i)}))})}),(0,w.jsx)(O.Z,{mb:d?2:0,children:(0,w.jsx)(j.Z,{medium:!0})})]}),!o&&se]}),!c&&se,z&&!p&&(0,w.jsxs)(St,{blockType:U,dynamicBlock:u,dynamicChildBlock:a,hasError:d,selected:I,children:[(0,w.jsx)(Et,{}),(0,w.jsxs)(k.Z,{justifyContent:"space-between",children:[R&&(0,w.jsx)(y.Z,{alignItems:"center",px:1,children:(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return R(!o)},transparent:!0,children:o?(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le._M,{muted:!0,size:2*C.iI}),"\xa0",(0,w.jsx)(_.ZP,{default:!0,children:"Expand output"})]}):(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le.Kh,{muted:!0,size:2*C.iI}),V&&(0,w.jsx)(O.Z,{ml:2,children:(0,w.jsx)(_.ZP,{children:"".concat(V[0]," rows x ").concat(V[1]," columns").concat(ae)})})]})})}),(0,w.jsx)(wt,{children:(0,w.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"flex-end",children:[(0,w.jsx)(pn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:S>=1&&P?"Last run at ".concat(new Date(P.valueOf()).toLocaleString()):d?"Block executed with errors":"Block executed successfully",size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[S>=1&&Number(E)>Number(P)&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_.ZP,{small:!0,children:[(Number(E)-Number(P))/1e3,"s"]}),(0,w.jsx)(O.Z,{mr:1})]}),!d&&(0,w.jsx)(le.Jr,{size:2*C.iI,success:!0}),d&&(0,w.jsx)(x.Z,{danger:!0,size:2*C.iI,children:(0,w.jsx)(_.ZP,{bold:!0,monospace:!0,small:!0,children:"!"})})]})}),!d&&!v.Qj.includes(U)&&(0,w.jsx)(O.Z,{pl:1,children:(0,w.jsx)(T.Z,{afterIcon:(0,w.jsx)(le.M0,{muted:!0,size:1.75*C.iI}),basic:!0,noPadding:!0,onClick:function(){!function(e,n){var t=Ht(e);t.includes(n)||(0,F.t8)(Ut(e),[].concat((0,r.Z)(t),[n]))}(null===Z||void 0===Z?void 0:Z.uuid,n.uuid),null===b||void 0===b||b(K.DATA),null===D||void 0===D||D((function(e){return e.find((function(e){return e.uuid===n.uuid}))?e:(null===N||void 0===N||N(n),e.concat(n))}))},transparent:!0,children:(0,w.jsx)(_.ZP,{default:!0,children:"Expand table"})})})]})})]})]})]}):null},Qt="buckets",qt="chart_style",Yt="group_by",Kt="height",Xt="index",Jt="legend_labels",$t="limit",ei="metrics",ni="time_interval",ti="width_percentage",ii="x",ri="y",oi="y_sort_order",li="data_provider",ci="data_provider_database",ui="data_provider_profile",ai="data_provider_schema",si="data_provider_table",di="dbt_project_name",fi="dbt_profile_target",pi="export_write_policy",hi="limit",mi="use_raw_sql",vi=[ii,ri];!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"}(Wt||(Wt={}));var gi,bi,xi=[Wt.BAR_CHART,Wt.HISTOGRAM,Wt.LINE_CHART,Wt.PIE_CHART,Wt.TABLE,Wt.TIME_SERIES_BAR_CHART,Wt.TIME_SERIES_LINE_CHART];!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(gi||(gi={})),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"}(bi||(bi={}));var ji,yi,ki,Zi,Oi,_i,Ci,Si,wi,Ei=[bi.AVERAGE,bi.COUNT,bi.COUNT_DISTINCT,bi.MAX,bi.MEDIAN,bi.MIN,bi.MODE,bi.SUM];!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(ji||(ji={})),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"}(yi||(yi={})),function(e){e.COLUMNS="columns",e.METRICS="metrics",e.NUMBER="number"}(wi||(wi={}));var Pi={noCode:[{label:function(){return"time column"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Yt},{label:function(){return"time interval"},options:[yi.ORIGINAL,yi.SECOND,yi.MINUTE,yi.HOUR,yi.DAY,yi.WEEK,yi.MONTH,yi.YEAR],uuid:ni},{label:function(){return"metrics"},type:wi.METRICS,uuid:ei}]},Ii=(ki={},(0,o.Z)(ki,Wt.BAR_CHART,{noCode:[{label:function(){return"group by columns"},type:wi.COLUMNS,uuid:Yt},{label:function(){return"metrics"},type:wi.METRICS,uuid:ei},{autoRun:!0,label:function(){return"chart style"},options:[gi.HORIZONTAL,gi.VERTICAL],uuid:qt},{autoRun:!0,label:function(){return"sort direction"},options:[null,ji.ASCENDING,ji.DESCENDING],uuid:oi}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:ii},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ri}]}),(0,o.Z)(ki,Wt.HISTOGRAM,{noCode:[{label:function(){return"number column for chart"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Yt},{autoRun:!0,label:function(){return"Number of buckets"},type:wi.NUMBER,uuid:Qt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ii}]}),(0,o.Z)(ki,Wt.LINE_CHART,{noCode:[{label:function(){return"group by columns"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Yt},{label:function(){return"metrics"},type:wi.METRICS,uuid:ei}],code:[{label:function(){return"variable name of x-axis values"},monospace:!0,uuid:ii},{label:function(){return"variable name of y-axis values"},monospace:!0,uuid:ri},{label:function(){return"labels of lines in chart (comma separated)"},uuid:Jt}]}),(0,o.Z)(ki,Wt.PIE_CHART,{noCode:[{label:function(){return"column for chart"},settings:{maxValues:1},type:wi.COLUMNS,uuid:Yt},{autoRun:!0,label:function(){return"Number of slices"},type:wi.NUMBER,uuid:Qt}],code:[{label:function(){return"variable name of values"},monospace:!0,uuid:ii}]}),(0,o.Z)(ki,Wt.TABLE,{noCode:[{label:function(){return"columns"},type:wi.COLUMNS,uuid:Yt},{label:function(){return"max number of rows"},type:wi.NUMBER,uuid:$t}],code:[{label:function(){return"variable name of columns"},monospace:!0,uuid:ii},{label:function(){return"variable name of rows"},monospace:!0,uuid:ri}]}),(0,o.Z)(ki,Wt.TIME_SERIES_BAR_CHART,Pi),(0,o.Z)(ki,Wt.TIME_SERIES_LINE_CHART,Pi),ki),Ti=(Zi={},(0,o.Z)(Zi,Wt.BAR_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,ii,"x"),(0,o.Z)(n,ri,"y"),(0,o.Z)(n,qt,gi.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)(Zi,Wt.HISTOGRAM,{configuration:function(e){var n;return n={},(0,o.Z)(n,Qt,10),(0,o.Z)(n,ii,"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)(Zi,Wt.LINE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,ii,"x"),(0,o.Z)(n,ri,"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)(Zi,Wt.PIE_CHART,{configuration:function(e){var n;return n={},(0,o.Z)(n,Qt,7),(0,o.Z)(n,ii,"x"),n},content:function(e){return"x = df_1[df_1.columns[0]]"}}),(0,o.Z)(Zi,Wt.TABLE,{configuration:function(e){var n;return n={},(0,o.Z)(n,$t,10),(0,o.Z)(n,ii,"x"),(0,o.Z)(n,ri,"y"),n},content:function(e){return"x = df_1.columns\ny = df_1.to_numpy()"}}),(0,o.Z)(Zi,Wt.TIME_SERIES_BAR_CHART,{configuration:function(e){return(0,o.Z)({},ni,yi.ORIGINAL)}}),(0,o.Z)(Zi,Wt.TIME_SERIES_LINE_CHART,{configuration:function(e){return(0,o.Z)({},ni,yi.ORIGINAL)}}),Zi),Ai=(Si={},(0,o.Z)(Si,Wt.BAR_CHART,(Oi={},(0,o.Z)(Oi,ii,(function(){return"must be a list of booleans, dates, integers, floats, or strings."})),(0,o.Z)(Oi,ri,(function(){return"must be a list of lists containing integers or floats."})),Oi)),(0,o.Z)(Si,Wt.HISTOGRAM,(0,o.Z)({},ii,(function(){return"must be a list of integers or floats."}))),(0,o.Z)(Si,Wt.LINE_CHART,(_i={},(0,o.Z)(_i,ii,(function(){return"must be a list of integers or floats."})),(0,o.Z)(_i,ri,(function(){return"must be a list of lists containing integers or floats. Each list is a single line in the chart."})),_i)),(0,o.Z)(Si,Wt.PIE_CHART,(0,o.Z)({},ii,(function(){return"must be a list of booleans, dates, integers, floats, or strings."}))),(0,o.Z)(Si,Wt.TABLE,(Ci={},(0,o.Z)(Ci,ii,(function(){return"must be a list of strings."})),(0,o.Z)(Ci,ri,(function(){return"must be a list of lists containing booleans, dates, integers, floats, or strings."})),Ci)),Si),Ri=[{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,ii,"columns_with_mising_values"),(0,o.Z)(n,ri,"percentage_of_missing_values"),(0,o.Z)(n,qt,gi.HORIZONTAL),(0,o.Z)(n,oi,ji.DESCENDING),(0,o.Z)(n,"chart_type",Wt.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,ii,"columns"),(0,o.Z)(n,ri,"number_of_unique_values"),(0,o.Z)(n,qt,gi.HORIZONTAL),(0,o.Z)(n,oi,ji.DESCENDING),(0,o.Z)(n,"chart_type",Wt.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,Kt,3e3),(0,o.Z)(n,Xt,"column_index"),(0,o.Z)(n,ii,"columns"),(0,o.Z)(n,ri,"rows"),(0,o.Z)(n,"chart_type",Wt.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,Kt,3e3),(0,o.Z)(n,Xt,"stats"),(0,o.Z)(n,ii,"headers"),(0,o.Z)(n,ri,"rows"),(0,o.Z)(n,"chart_type",Wt.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,Kt,3e3),(0,o.Z)(n,Xt,"stats"),(0,o.Z)(n,ii,"columns"),(0,o.Z)(n,ri,"rows"),(0,o.Z)(n,"chart_type",Wt.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 Di(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 Mi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Di(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Di(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ni=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 xi.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=Ti[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,me.vg)(e)},onClick:function(){return n(Mi(Mi({},o),{},{name:"".concat(s," ").concat((0,me.Mp)()),configuration:Mi(Mi({},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}}))}),[xi,t,a]),p=(0,s.useMemo)((function(){return Ri.map((function(e){var i=e.label,r=Mi(Mi({},(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()}}))}),[Ri,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,w.jsx)(q.Z,{items:h,left:i,onClickCallback:l,open:c,parentRef:u,rightOffset:o,topOffset:d,uuid:"CommandButtons/add_charts",width:25*C.iI})},Bi=t(40656),Li=g.default.svg.withConfig({displayName:"Convert__SVGStyle",componentId:"sc-fmw0vr-0"})([""]),Fi=function(e){var n=e.fill,t=e.opacity,i=e.size,r=void 0===i?Bi.C:i,o=e.style,l=e.viewBox,c=void 0===l?"0 0 12 12":l;return(0,w.jsxs)(Li,{fill:n,height:r,opacity:t,style:o,viewBox:c,width:r,children:[(0,w.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,w.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,w.jsx)("defs",{children:(0,w.jsxs)("linearGradient",{id:"paint0_linear_1332_60037",x1:"-.618557",y1:"-.000001",x2:"10.5709",y2:".83113",gradientUnits:"userSpaceOnUse",children:[(0,w.jsx)("stop",{stopColor:"#FFCC19"}),(0,w.jsx)("stop",{offset:".585938",stopColor:"#2ECDF7"}),(0,w.jsx)("stop",{offset:"1",stopColor:"#9E7BFF"})]})})]})},Ui=t(79749),Hi=t(54283);function zi(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?zi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):zi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Wi=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},Vi=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,me.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)}}))},Qi=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:Gi(Gi({},e),{},{configuration:Gi(Gi({},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:Gi(Gi({},e),{},{configuration:Gi(Gi({},c),{},{reduce_output:!p})})})},uuid:"reduce_output"});m.push({label:function(){return a?"Remove callback":"Add callback"},onClick:function(){return y({block:Gi(Gi({},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 qi(e){var n=e.block,t=e.dynamic,i=e.dynamicUpstreamBlock,r=e.hasError,o=e.reduceOutput,l=e.reduceOutputUpstreamBlock,c=e.selected,u=[];t&&u.push({title:"Dynamic",description:"This block will create N blocks for each of its downstream blocks."});var a=i&&!l;return a&&(u.push({title:"Dynamic child",description:"This block is dynamically created by its upstream parent block that is dynamic."}),o&&u.push({title:"Reduce output",description:"Reduce output from all dynamically created blocks into a single array output."})),{borderColorShareProps:{blockColor:null===n||void 0===n?void 0:n.color,blockType:null===n||void 0===n?void 0:n.type,dynamicBlock:t,dynamicChildBlock:a,hasError:r,selected:c},tags:u}}function Yi(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 Ki(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Yi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Yi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Xi,Ji=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),Z=void 0===y||y,E=i.color,P=i.type,I=i.uuid,A=(0,s.useRef)(null),R=(0,s.useRef)(null),D=(0,s.useRef)(null),N=(0,s.useRef)(null),L=null===p||void 0===p?void 0:p.type,F=(0,s.useState)(!1),U=F[0],H=F[1],z=(0,s.useState)(!1),G=z[0],W=z[1],V=(0,s.useState)(!1),Q=V[0],Y=V[1],K=(0,s.useState)(!1),X=K[0],J=K[1],$=(0,s.useContext)(g.ThemeContext),ee=Mn.uF.IDLE!==c,ne=(0,S.qn)(P,{blockColor:E,theme:$}).accent,te=L===M.qL.STREAMING,ie=(0,s.useMemo)((function(){return Vi(i,r,"CommandButtons",n).map((function(e){return Ki(Ki({},e),{},{onClick:function(){return m().then((function(){return e.onClick()}))}})}))}),[n,i,r,m]),re=(0,s.useMemo)((function(){return(0,ue.HK)(r,(function(e){return e.uuid}))}),[r]),oe=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]),ce=(0,d.Db)(_e.ZP.pipelines.useUpdate(null===p||void 0===p?void 0:p.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){a()},onErrorCallback:function(e,n){return b({errors:n,response:e})}})}}),ae=(0,l.Z)(ce,2),se=ae[0];return ae[1].isLoading,(0,w.jsxs)(k.Z,{alignItems:"center",children:[Mn.uF.QUEUED===c&&(0,w.jsx)(Hi.Z,{color:($||Ae.Z).content.active,type:"cylon"}),Mn.uF.BUSY===c&&(0,w.jsx)(Hi.Z,{color:($||Ae.Z).content.active}),h&&!ee&&!te&&(0,w.jsxs)(w.Fragment,{children:[!oe&&(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:(0,w.jsxs)(_.ZP,{children:[oe?"Compile and preview data":"Run block","\xa0 \xa0",(0,w.jsx)(Ui.Z,{inline:!0,keyTextGroups:[[an()?B.RJ:B.hE,B.Lz]],monospace:!0,uuidForKey:I})]}),size:3*C.iI,widthFitContent:!0,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){Z?h({block:i}):Y(!0)},children:(0,w.jsx)(x.Z,{color:ne,size:3*C.iI,children:(0,w.jsx)(le.Py,{black:!0,size:1.5*C.iI})})})}),oe&&(0,w.jsx)(T.Z,{backgroundColor:ne,beforeIcon:(0,w.jsx)(le.Py,{size:1.5*C.iI}),compact:!0,onClick:function(){Z?h({block:i}):Y(!0)},small:!0,children:"Compile & preview"}),(0,w.jsx)(ln.Z,{disableEscape:!0,onClickOutside:function(){return Y(!1)},open:Q,children:(0,w.jsx)(q.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 Y(!1)},open:Q,parentRef:D,rightOffset:13.25*C.iI,topOffset:4.5*C.iI,uuid:"execute_actions",width:25*C.iI})})]}),ee&&(0,w.jsx)(O.Z,{ml:C.cd,children:(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:(0,w.jsxs)(_.ZP,{children:["Interrupt kernel \xa0 \xa0",(0,w.jsx)(Ui.Z,{inline:!0,keyTextGroups:[[B.kA],[B.kA]],monospace:!0,uuidForKey:I})]}),size:2.5*C.iI,widthFitContent:!0,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return f()},children:(0,w.jsx)(x.Z,{borderSize:1.5,size:2.5*C.iI,children:(0,w.jsx)(le.x8,{size:1*C.iI})})})})}),v.tf.SCRATCHPAD===i.type&&!te&&(0,w.jsx)(O.Z,{ml:C.cd,children:(0,w.jsx)(Wn.Z,{items:ie,onClickCallback:function(){return W(!1)},onClickOutside:function(){return W(!1)},open:G,parentRef:R,rightOffset:0,topOffset:4,uuid:"CommandButtons/convert_block",children:(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:(0,w.jsx)(_.ZP,{children:"Convert block"}),size:2.5*C.iI,widthFitContent:!0,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return W(!G)},ref:R,children:(0,w.jsx)(Fi,{size:2.5*C.iI})})})})}),[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(i.type)&&!te&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{ml:C.cd,ref:A,children:(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:"Add chart",size:2.25*C.iI,widthFitContent:!0,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return H((function(e){return!e}))},children:(0,w.jsx)(le.er,{size:2.25*C.iI})})})}),t&&(0,w.jsx)(ln.Z,{disableEscape:!0,onClickOutside:function(){return H(!1)},open:U,children:(0,w.jsx)(Ni,{addWidget:t,block:i,onClickCallback:function(){return H(!1)},open:U,parentRef:A,rightOffset:9*C.iI,runBlock:h,topOffset:2*C.iI})})]}),(0,w.jsx)("div",{ref:N,children:(0,w.jsx)(O.Z,{ml:C.cd,children:(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:(0,w.jsx)(_.ZP,{children:"More actions"}),size:2.5*C.iI,widthFitContent:!0,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){return J((function(e){return!e}))},children:(0,w.jsx)(x.Z,{borderSize:1.5,size:2.5*C.iI,children:(0,w.jsx)(le.mH,{size:C.iI})})})})})}),(0,w.jsx)(ln.Z,{disableEscape:!0,onClickOutside:function(){return J(!1)},open:X,children:(0,w.jsx)(q.Z,{items:Qi(i,h,o,j,te,{blocksMapping:re,fetchFileTree:u,fetchPipeline:a,savePipelineContent:m,updatePipeline:se}),onClickCallback:function(){return J(!1)},open:X,parentRef:N,rightOffset:4.75*C.iI,topOffset:2*C.iI,uuid:"FileHeaderMenu/file_items"})})]})};!function(e){e.APPEND="append",e.FAIL="fail",e.REPLACE="replace"}(Xi||(Xi={}));var $i,er=[Xi.APPEND,Xi.FAIL,Xi.REPLACE];!function(e){e.BIGQUERY="bigquery",e.MYSQL="mysql",e.POSTGRES="postgres",e.REDSHIFT="redshift",e.SNOWFLAKE="snowflake"}($i||($i={}));var nr,tr=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"}(nr||(nr={}));var ir=t(5677);function rr(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 or(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?rr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):rr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function lr(e,n){var t=e;t.includes("__init__")||t.push("__init__");var i,r=t.length;return(0,ue.w6)(r).forEach((function(e,o){if(i)return i;var l=t.slice(0,r-o).join(he.sep);i=n["".concat(l,".py")]})),i}function cr(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 ur(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 ar(e){var n=e.autocompleteItems,t=e.block,i=e.blocks,o=e.pipeline,c=t.type,u=t.upstream_blocks,a=(0,ue.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,ir.Yn)(e),r=(0,ir.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,ir.S0)(e)[l];if(c){var u,a=lr(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,ir.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=ur(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,ir.M4)(e,n);if(i=i.match(/([\w_]+)./)){var r=(0,ir.S0)(e)[i[1]];if(r){var o=lr(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=ur(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)(ur(h,function(e,n,t){var i=t.block,r=t.blocks,o=i.upstream_blocks,l=(0,ue.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 O=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([nr.MAGE_LIBRARY,nr.USER_LIBRARY].includes(n)){var r=t;r.match(/__init__.py/)&&(r=r.replace(/\/__init__.py/,"")),r=r.split(".py")[0].replaceAll(he.sep,"."),u[r]=e}var o=t.replace(".py","").replace("/__init__","").split(he.sep);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,ir.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(he.sep),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:or({},i)}})))}(n,p,h,t,b,e);f.push.apply(f,(0,r.Z)(O))}if(v.tf.CHART===c||v.tf.SCRATCHPAD===c){var _=[];if(v.tf.CHART===c?u.forEach((function(e,n){_.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&&_.push({block:n,matchIndex:t,variableName:i})}))})),_.length>=1){var C,S=null===(C=p.split("\n")[d.lineNumber-1])||void 0===C?void 0:C.slice(0,h.startColumn-1);if(S){var w=[];if(_.forEach((function(e){var n=e.block,i=e.matchIndex,r=e.variableName,o=new RegExp("".concat(r,"\\["));S.match(o)&&w.push({items:cr(t,b,n),matchIndex:i})})),w.length>=1)return{suggestions:ur(h,(0,ue.YC)(w,"matchIndex",{ascending:!1})[0].items)}}}1===g&&(v.tf.CHART===c?f.push.apply(f,(0,r.Z)(ur(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)(ur(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 E=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 E.add(e[1])}))}));var P=(0,r.Z)(E);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)(ur(h,I)))}return{suggestions:f}}}}var sr=t(32365),dr=t(80636),fr=t(25958),pr=t(66653),hr=t(87323);function mr(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 vr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?mr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):mr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function gr(e,n){var t,i,c,u,a,f=e.addNewBlock,p=e.addNewBlockMenuOpenIdx,h=e.addWidget,m=e.allowCodeBlockShortcuts,E=e.autocompleteItems,P=e.block,I=e.blockIdx,R=e.blockRefs,D=e.blocks,L=e.dataProviders,H=e.defaultValue,z=void 0===H?"":H,G=e.deleteBlock,W=e.disableShortcuts,V=e.executionState,Q=e.extraContent,q=e.fetchFileTree,Y=e.fetchPipeline,K=e.height,X=e.hideRunButton,J=e.interruptKernel,$=e.mainContainerRef,ee=e.mainContainerWidth,ne=e.messages,te=void 0===ne?[]:ne,ie=e.noDivider,re=e.onCallbackChange,oe=e.onChange,ce=e.onClickAddSingleDBTModel,ae=e.openSidekickView,se=e.pipeline,de=e.runBlock,fe=e.runningBlocks,pe=e.savePipelineContent,he=e.selected,ve=e.setAddNewBlockMenuOpenIdx,ge=e.setAnyInputFocused,be=e.setCreatingNewDBTModel,xe=e.setEditingBlock,je=e.setErrors,ye=e.setOutputBlocks,ke=e.setRecsWindowOpenBlockIdx,Ze=e.setSelected,Oe=e.setSelectedOutputBlock,we=e.setTextareaFocused,Ee=e.textareaFocused,Pe=e.widgets,Ie=(0,s.useContext)(g.ThemeContext),Te=(0,s.useMemo)((function(){return(null===P||void 0===P?void 0:P.configuration)||{}}),[P]),Ae=(0,s.useState)(!1),Re=Ae[0],De=Ae[1],Me=(0,s.useState)(null),Ne=Me[0],Be=Me[1],Le=(0,s.useState)(!1),Fe=Le[0],Ue=Le[1],He=(0,s.useState)(!1),ze=He[0],Ge=He[1],We=(0,s.useState)(z),Ve=We[0],Qe=We[1],qe=(0,s.useState)(null),Ye=qe[0],Ke=qe[1],Xe=(0,s.useState)((t={},(0,o.Z)(t,li,Te.data_provider),(0,o.Z)(t,ci,Te.data_provider_database),(0,o.Z)(t,ui,Te.data_provider_profile),(0,o.Z)(t,ai,Te.data_provider_schema),(0,o.Z)(t,si,Te.data_provider_table),(0,o.Z)(t,fi,Te.dbt_profile_target),(0,o.Z)(t,di,Te.dbt_project_name),(0,o.Z)(t,pi,Te.export_write_policy||Xi.APPEND),(0,o.Z)(t,hi,Te.limit),(0,o.Z)(t,mi,!!Te.use_raw_sql),t)),Je=Xe[0],nn=Xe[1],tn=(0,s.useState)(null),rn=tn[0],on=tn[1],ln=(0,s.useState)(!1),cn=ln[0],un=ln[1],an=(0,s.useState)(P.uuid),sn=an[0],dn=an[1],fn=(0,s.useState)(!1),hn=fn[0],mn=fn[1],vn=(0,s.useState)(0),gn=vn[0],bn=vn[1],xn=(0,s.useState)(null),jn=xn[0],yn=xn[1],kn=(0,s.useState)(null),Zn=kn[0],On=kn[1],_n=(0,s.useState)(te),Cn=_n[0],Sn=_n[1],wn=(0,s.useState)(Mt[0]),En=wn[0],Pn=wn[1],In=M.qL.STREAMING===(null===se||void 0===se?void 0:se.type),Tn=v.tf.DBT===(null===P||void 0===P?void 0:P.type),Rn=v.t6.SQL===(null===P||void 0===P?void 0:P.language),Dn=v.t6.R===(null===P||void 0===P?void 0:P.language),Nn=(0,s.useMemo)((function(){var e;return(null===P||void 0===P||null===(e=P.metadata)||void 0===e?void 0:e.dbt)||{project:null,projects:{}}}),[P]),Bn=(0,s.useMemo)((function(){return Nn.projects||{}}),[Nn]),Ln=(0,s.useMemo)((function(){return Nn.project||Je.dbt_project_name}),[Je,Nn]),Fn=(0,s.useMemo)((function(){return Bn[Ln]||{target:null,targets:[]}}),[Ln,Bn]),Un=(0,s.useMemo)((function(){return Fn.targets||[]}),[Fn]),Hn=(0,s.useMemo)((function(){return Je.dbt_profile_target}),[Je]),zn=(0,s.useState)(Hn&&!(null!==Un&&void 0!==Un&&Un.includes(Hn))),Gn=zn[0],Vn=zn[1],Qn=P.callback_content,qn=P.has_callback,Yn=(0,s.useState)(null),Kn=Yn[0],Xn=Yn[1];(0,s.useEffect)((function(){Qn!==Kn&&Xn(Qn)}),[Qn]);var Jn=(0,Zt.Z)(P);(0,s.useEffect)((function(){if(JSON.stringify(P)!=JSON.stringify(Jn)){var e,n=Lt([P]).messages,t=null===n||void 0===n||null===(e=n[null===P||void 0===P?void 0:P.type])||void 0===e?void 0:e[null===P||void 0===P?void 0:P.uuid];(null===t||void 0===t?void 0:t.length)>=1&&Sn(t)}}),[P,Jn,Sn]);var et=(0,Zt.Z)(te);(0,s.useEffect)((function(){"undefined"!==typeof te&&te.length!==(null===et||void 0===et?void 0:et.length)&&Sn(te)}),[te,et,Sn]);var nt=(0,s.useMemo)((function(){var e=new Set;return null===L||void 0===L||L.forEach((function(n){var t=n.profiles;e=new Set([].concat((0,r.Z)(e),(0,r.Z)(t)))})),(0,r.Z)(e)}),[L]),tt=(0,s.useMemo)((function(){return"".concat(null===se||void 0===se?void 0:se.uuid,"/").concat(null===P||void 0===P?void 0:P.uuid,"/codeCollapsed")}),[null===se||void 0===se?void 0:se.uuid,null===P||void 0===P?void 0:P.uuid]),it=(0,s.useMemo)((function(){return"".concat(null===se||void 0===se?void 0:se.uuid,"/").concat(null===P||void 0===P?void 0:P.uuid,"/outputCollapsed")}),[null===se||void 0===se?void 0:se.uuid,null===P||void 0===P?void 0:P.uuid]);(0,s.useEffect)((function(){Ge((0,F.U2)(tt,!1)),mn((0,F.U2)(it,!1))}),[tt,it]);var rt=(0,s.useRef)(null),ot=(0,s.useMemo)((function(){return(0,ue.HK)(D,(function(e){return e.uuid}))}),[D]),lt=(0,s.useMemo)((function(){return!(null===Pe||void 0===Pe||!Pe.find((function(e){return e.upstream_blocks.includes(P.uuid)})))}),[P,Pe]),ct=(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)}Tn&&At!==En&&Pn(At),de({block:t,code:i||Ve,runDownstream:o||lt,runSettings:l,runTests:u||!1,runUpstream:c||!1}),r||(bn(1+Number(gn)),yn(null),mn(!1))}),[Ve,lt,Tn,de,gn,En,bn,yn,Pn]),ut=!(null===fe||void 0===fe||!fe.find((function(e){return e.uuid===P.uuid})))||(null===Cn||void 0===Cn?void 0:Cn.length)>=1&&V!==Mn.uF.IDLE;(0,s.useEffect)((function(){ut&&On(Number(new Date))}),[ut,On]);var at=(0,Zt.Z)(V);(0,s.useEffect)((function(){V===Mn.uF.IDLE&&V!==at&&yn(Number(new Date))}),[V,at,yn]);var st=(0,s.useCallback)((function(e){var n=e.editorRect.top,t=e.position.lineNumberTop;if(null!==$&&void 0!==$&&$.current){var i=$.current.getBoundingClientRect().height;if(n+t>i){var r=$.current.scrollTop+(t-i+n);$.current.scrollTo(0,r)}else if(t+n<sr.aU){var o=$.current.scrollTop+(t+n-sr.aU);$.current.scrollTo(0,o)}}}),[$]),dt=(0,s.useMemo)((function(){return(null===rn||void 0===rn?void 0:rn.length)>=0?rn.map((function(e){return{data:e,execution_state:Mn.uF.IDLE,type:Mn.Gi.TEXT_PLAIN}})):Cn.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[rn,Cn]),ft=!!dt.find((function(e){return e.error})),mt=(0,S.qn)(P.type,{blockColor:P.color,theme:Ie}).accent,vt=(null===P||void 0===P||null===(i=P.upstream_blocks)||void 0===i?void 0:i.length)||0,xt=(0,hr.cU)([P],D)[0],jt=xt.dynamic,yt=xt.dynamicUpstreamBlock,kt=xt.reduceOutput,Ot=xt.reduceOutputUpstreamBlock,_t=(0,s.useMemo)((function(){return qi({block:P,dynamic:jt,dynamicUpstreamBlock:yt,hasError:ft,reduceOutput:kt,reduceOutputUpstreamBlock:Ot,selected:he})}),[P,jt,yt,ft,kt,Ot,he]),Ct=_t.borderColorShareProps,St=_t.tags,wt=dt.length>=1,Et=(0,s.useCallback)((function(){he||(null===ge||void 0===ge||ge(!1),null===Ze||void 0===Ze||Ze(!0))}),[he,ge,Ze]),Pt=_e.ZP.blocks.pipelines.detail(null===se||void 0===se?void 0:se.uuid,Dt.uuid===(null===En||void 0===En?void 0:En.uuid)||Rt.uuid===(null===En||void 0===En?void 0:En.uuid)?encodeURIComponent(null===P||void 0===P?void 0:P.uuid):null,{_format:"dbt"},{revalidateOnFocus:!0}),It=Pt.data,Tt=Pt.mutate,Nt=(0,s.useMemo)((function(){var e;return(null===It||void 0===It||null===(e=It.block)||void 0===e?void 0:e.metadata)||{}}),[It]),Bt=(0,d.Db)(_e.ZP.blocks.pipelines.useUpdate(null===se||void 0===se?void 0:se.uuid,P.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){un(!1),Y(),q(),Qe(Ve)},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){var n=(0,Se.qQ)(e).messages;on(n)}}),Ft=(0,l.Z)(Bt,1)[0],Ut="CodeBlock/".concat(P.uuid),Ht=(0,en.y)(),zt=Ht.registerOnKeyDown,Gt=Ht.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Gt(Ut)}}),[Gt,Ut]),zt(Ut,(function(e,n,t){W&&!m||(cn&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)?P.uuid===sn?e.target.blur():Ft({block:vr(vr({},P),{},{name:sn})}):he&&!X&&((0,U.y)([B.zX,B.Uq],n)||(0,U.y)([B.PQ,B.Uq],n)?ct({block:P}):(0,U.y)([B.XR,B.Uq],n)&&f&&(e.preventDefault(),f({language:P.language,type:P.type,upstream_blocks:[P.uuid]}),ct({block:P}))))}),[f,P,X,cn,sn,ct,he,Ft]),(0,s.useEffect)((function(){var e;return Zn&&(e=setInterval((function(){return Ke(Number(new Date))}),1e3)),function(){return clearInterval(e)}}),[Zn]);var Wt=(0,s.useCallback)((function(e){return(0,o.Z)({},v.tf.SCRATCHPAD,(0,r.Z)(Vi(e,D,"block_menu/scratchpad",f)).map((function(e){return vr(vr({},e),{},{onClick:function(){return pe().then((function(){return e.onClick()}))}})})))[e.type]}),[f,D,pe]),Qt=(0,s.useMemo)((function(){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)($e.Z,{autoHeight:!0,autocompleteProviders:Ne,block:P,height:K,language:P.language,onChange:function(e){Qe(e),null===oe||void 0===oe||oe(e)},onDidChangeCursorPosition:st,placeholder:v.tf.DBT===P.type&&v.t6.YAML===P.language?"e.g. --select ".concat(Ln||"project","/models --exclude ").concat(Ln||"project","/models/some_dir"):"Start typing here...",selected:he,setSelected:Ze,setTextareaFocused:we,shortcuts:[function(e,n){return(0,dr.Q)(e,(function(){X||ct({block:P,code:n.getValue()})}))}],textareaFocused:Ee,value:Ve,width:"100%"}),qn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(j.Z,{}),(0,w.jsxs)(O.Z,{mt:1,children:[(0,w.jsxs)(S.y9,{children:[(0,w.jsx)(_.ZP,{small:!0,children:"Callback block: define @on_success or @on_failure callbacks for this block."}),(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["kwargs",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:" \u2192 "}),"global variables"]})]}),(0,w.jsx)($e.Z,{autoHeight:!0,autocompleteProviders:Ne,language:"python",onChange:function(e){Xn(e),null===re||void 0===re||re(e)},onDidChangeCursorPosition:st,placeholder:"Start typing here...",selected:he,setSelected:Ze,setTextareaFocused:we,textareaFocused:Ee,value:Kn,width:"100%"})]})]})]})}),[Ne,P,Kn,Ve,Ln,qn,K,X,re,oe,st,ct,he,Qe,Ze,we,Ee]);(0,s.useEffect)((function(){Be({python:ar({autocompleteItems:E,block:P,blocks:D,pipeline:se})})}),[E,P,D,se]);var qt=(0,s.useMemo)((function(){return Tn?(0,w.jsx)(O.Z,{py:1,children:(0,w.jsx)(A.Z,{onClickTab:function(e){Pn(e),Dt.uuid!==e.uuid&&Rt.uuid!==e.uuid||Tt()},selectedTabUUID:null===En||void 0===En?void 0:En.uuid,small:!0,tabs:Mt})}):null}),[Tt,Tn,En]),Yt=(0,s.useMemo)((function(){return(0,w.jsx)(Vt,vr(vr({},Ct),{},{block:P,blockMetadata:Nt,buttonTabs:qt,collapsed:hn,hasOutput:wt,isInProgress:ut,mainContainerWidth:ee,messages:dt,openSidekickView:ae,pipeline:se,runCount:gn,runEndTime:jn,runStartTime:Zn,selected:he,selectedTab:En,setCollapsed:function(e){mn((function(){return(0,F.t8)(it,e),e}))},setOutputBlocks:ye,setSelectedOutputBlock:Oe,setSelectedTab:Pn}))}),[P,Nt,Ct,qt,wt,ut,ee,dt,ae,hn,it,se,gn,jn,Zn,he,En,ye,mn,Oe]),Kt=(0,s.useCallback)((function(){return Ue(!1)}),[]),Xt=(0,s.useRef)(null),Jt=(0,s.useCallback)((function(e){clearTimeout(Xt.current),nn((function(n){return vr(vr({},n),e)})),Xt.current=setTimeout((function(){var n=vr(vr({},Je),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)&&pe({block:{configuration:n,uuid:P.uuid}})}),1e3)}),[P,Je,pe]);(0,s.useEffect)((function(){Tn||!Rn||Je.limit||Jt((0,o.Z)({},hi,1e3))}),[Tn,Rn]);var $t=$n.BIGQUERY===Je.data_provider||$n.SNOWFLAKE===Je.data_provider,ei=(0,s.useMemo)((function(){return(null===D||void 0===D?void 0:D.length)||0}),[D]),ni=(0,s.useMemo)((function(){return(0,w.jsx)(N.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){ge(!0),Jt((0,o.Z)({},hi,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},small:!0,type:"number",value:Je.limit||"",width:11*C.iI})}),[Je,pr.j,ge,setTimeout,Jt]);return(0,w.jsxs)("div",{ref:n,style:{position:"relative",zIndex:I===p?ei+9:null},children:[(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(S.nz,vr(vr({},Ct),{},{onClick:function(){return Et()},zIndex:ei+1-(I||0),children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",flex:1,children:[(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(bt.Z,{monospace:!0,children:v.dO[P.language]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(x.Z,{color:mt,size:1.5*C.iI,square:!0}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(Wn.Z,{items:Wt(P),onClickCallback:Kt,onClickOutside:Kt,open:Fe,parentRef:rt,uuid:"CodeBlock/block_menu",children:(0,w.jsx)(_.ZP,{color:mt,monospace:!0,children:null===(c=Tn?v.tf.DBT:v.V4[P.type])||void 0===c?void 0:c.toUpperCase()})}),v.tf.SCRATCHPAD===P.type&&(0,w.jsxs)(w.Fragment,{children:["\xa0",(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return Ue(!0)},transparent:!0,children:(0,w.jsx)(le.K5,{muted:!0})})]})]}),(0,w.jsx)(O.Z,{mr:C.cd}),(0,w.jsx)(le.iU,{size:1.5*C.iI}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(k.Z,{alignItems:"center",children:[Tn&&v.t6.YAML!==P.language&&(0,w.jsx)(pn.Z,{block:!0,label:(0,fr.$)(P,{fullPath:!0}),size:null,children:(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,children:(0,fr.$)(P)})}),(!Tn||v.t6.YAML===P.language)&&(0,w.jsx)(An,{bold:!1,inputValue:sn,monospace:!0,muted:!0,notRequired:!0,onBlur:function(){return setTimeout((function(){ge(!1),un(!1)}),300)},onChange:function(e){dn(e.target.value),e.preventDefault()},onClick:function(){ge(!0),un(!0)},onFocus:function(){ge(!0),un(!0)},stacked:!0,value:!cn&&P.uuid}),cn&&!Tn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(Z.Z,{onClick:function(){return pe({block:{name:sn,uuid:P.uuid}}).then((function(){un(!1),Y(),q()}))},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]}),(0,w.jsx)(O.Z,{mr:2}),!v.iZ.includes(P.type)&&(0,w.jsx)(pn.Z,{appearBefore:!0,block:!0,label:"\n ".concat((0,me._6)("parent block",vt),". ").concat(0===vt?"Click to select 1 or more blocks to depend on.":"Edit parent blocks.","\n "),size:null,widthFitContent:vt>=1,children:(0,w.jsx)(T.Z,{noBackground:!0,noBorder:!0,noPadding:!0,onClick:function(){var e;Ze(!0),xe({upstreamBlocks:{block:P,values:null===(e=P.upstream_blocks)||void 0===e?void 0:e.map((function(e){return{uuid:e}}))}})},children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsxs)(_.ZP,{monospace:vt>=1,small:vt>=1,underline:0===vt,children:[0===vt&&"Edit parent blocks",vt>=1&&(0,me._6)("parent block",vt)]}),(0,w.jsx)(O.Z,{mr:1}),0===vt&&(0,w.jsx)(le.Jj,{size:3*C.iI}),vt>=1&&(0,w.jsx)(le.eV,{size:3*C.iI})]})})})]}),(0,w.jsx)(Ji,{addNewBlock:f,addWidget:h,block:P,blocks:D,deleteBlock:G,executionState:V,fetchFileTree:q,fetchPipeline:Y,interruptKernel:J,pipeline:se,runBlock:X?null:ct,savePipelineContent:pe,setErrors:je,setOutputCollapsed:mn,visible:he||ut}),(0,w.jsx)(O.Z,{px:1,children:(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){Ge((function(e){return(0,F.t8)(tt,!e),!e})),ze||mn((function(){return(0,F.t8)(it,!0),!0}))},transparent:!0,children:ze?(0,w.jsx)(le._M,{muted:!0,size:2*C.iI}):(0,w.jsx)(le.Kh,{muted:!0,size:2*C.iI})})})]})})),(0,w.jsxs)(S.Nk,{onClick:function(){return Et()},children:[(0,w.jsxs)(S.jv,vr(vr({},Ct),{},{className:he&&Ee?"selected":null,hasOutput:!!qt||wt,children:[v.tf.DBT===P.type&&!ze&&(0,w.jsxs)(S.y9,{children:[(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[v.t6.YAML===P.language&&(0,w.jsxs)(tr.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){var n;Jt((n={},(0,o.Z)(n,fi,""),(0,o.Z)(n,di,e.target.value),n)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},placeholder:"Project",small:!0,value:Je.dbt_project_name||"",children:[(0,w.jsx)("option",{value:""}),Object.keys(Bn||{}).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),v.t6.YAML!==P.language&&(0,w.jsx)(_.ZP,{monospace:!0,small:!0,children:Ln}),(0,w.jsx)(O.Z,{mr:2}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Target"}),(0,w.jsx)("span",{children:"\xa0"}),!Gn&&(0,w.jsxs)(tr.Z,{compact:!0,disabled:!Ln,monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){Jt((0,o.Z)({},fi,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},placeholder:Ln?Rn?null===Fn||void 0===Fn?void 0:Fn.target:null:"Select project first",small:!0,value:Hn||"",children:[(0,w.jsx)("option",{value:""}),null===Un||void 0===Un?void 0:Un.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),Gn&&(0,w.jsx)(N.Z,{compact:!0,monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){Jt((0,o.Z)({},fi,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},placeholder:Ln?Rn?null===Fn||void 0===Fn?void 0:Fn.target:null:"Select project first",small:!0,value:Hn||"",width:21*C.iI}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(pn.Z,{block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["Manually type the name of the target you want to use in the profile.",(0,w.jsx)("br",{}),"Interpolate environment variables and global variables using the following syntax:",(0,w.jsx)("br",{}),(0,w.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ env_var('NAME') }}"})," or ",(0,w.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:"{{ variables('NAME') }}"})]}),size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(b.Z,{checked:Gn,label:(0,w.jsx)(_.ZP,{muted:!0,small:!0,children:"Manually enter target"}),onClick:function(e){(0,pr.j)(e),Vn(!Gn)}}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsx)(le.kI,{muted:!0})]})})})]}),v.t6.YAML!==P.language&&(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(pn.Z,{appearBefore:!0,block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,w.jsx)("br",{}),"when running this block in the notebook.",(0,w.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,w.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le.kI,{muted:!0}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Sample limit"}),(0,w.jsx)("span",{children:"\xa0"})]})}),ni,(0,w.jsx)(O.Z,{mr:5})]})]}),v.t6.YAML===P.language&&(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsxs)(y.Z,{flex:1,children:[(0,w.jsxs)(_.ZP,{monospace:!0,default:!0,small:!0,children:["dbt run ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,small:!0,children:"[type your --select and --exclude syntax below]"})]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["(paths start from ",(null===Je||void 0===Je?void 0:Je.dbt_project_name)||"project"," folder)"]})]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{muted:!0,small:!0,children:(0,w.jsx)(Z.Z,{href:"https://docs.getdbt.com/reference/node-selection/syntax#examples",openNewWindow:!0,small:!0,children:"Examples"})}),(0,w.jsx)(O.Z,{mr:5})]})})]}),Rn&&!ze&&v.tf.DBT!==P.type&&(0,w.jsx)(S.y9,{children:(0,w.jsxs)(k.Z,{flexWrap:"wrap",justifyContent:"space-between",style:{marginTop:"-8px"},children:[(0,w.jsxs)(k.Z,{style:{marginTop:"8px"},children:[(0,w.jsxs)(tr.Z,{compact:!0,label:"Connection",onChange:function(e){return Jt((0,o.Z)({},li,e.target.value))},onClick:pr.j,small:!0,value:Je.data_provider,children:[(0,w.jsx)("option",{value:""}),null===L||void 0===L?void 0:L.map((function(e){var n=e.id,t=e.value;return(0,w.jsx)("option",{value:t,children:n},n)}))]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(tr.Z,{compact:!0,label:"Profile",onChange:function(e){return Jt((0,o.Z)({},ui,e.target.value))},onClick:pr.j,small:!0,value:Je.data_provider_profile,children:[(0,w.jsx)("option",{value:""}),null===nt||void 0===nt?void 0:nt.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(pn.Z,{block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["If checked, you\u2019ll have to write your own custom",(0,w.jsx)("br",{}),"CREATE TABLE commands and INSERT commands.",(0,w.jsx)("br",{}),"Separate your commands using a semi-colon: ",(0,w.jsx)(_.ZP,{default:!0,inline:!0,monospace:!0,children:";"})]}),size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(b.Z,{checked:Je.use_raw_sql,label:(0,w.jsx)(_.ZP,{muted:!0,small:!0,children:"Use raw SQL"}),onClick:function(e){(0,pr.j)(e),Jt((0,o.Z)({},mi,!Je.use_raw_sql))}}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsx)(le.kI,{muted:!0})]})})}),!Je.use_raw_sql&&(0,w.jsxs)(w.Fragment,{children:[$t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(N.Z,{compact:!0,label:"Database",monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){Jt((0,o.Z)({},ci,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},small:!0,value:Je.data_provider_database,width:10*C.iI})})]}),(0,w.jsx)(O.Z,{mr:1}),Je.data_provider!==$i.MYSQL&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(pn.Z,{block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["Schema that is used when creating a table and inserting values.",(0,w.jsx)("br",{}),"This field is required."]}),size:null,widthFitContent:!0,children:(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(N.Z,{compact:!0,label:"Schema",monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){Jt((0,o.Z)({},ai,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},small:!0,value:Je.data_provider_schema,width:10*C.iI})})}),(0,w.jsx)(O.Z,{mr:1})]}),(0,w.jsx)(pn.Z,{block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["This value will be used as the table name.",(0,w.jsx)("br",{}),"If blank, the default table name will be:",(0,w.jsx)("br",{}),(0,w.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[null===se||void 0===se?void 0:se.uuid,"_",null===P||void 0===P?void 0:P.uuid]}),(0,w.jsx)("br",{}),"This field is optional."]}),size:null,widthFitContent:!0,children:(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(N.Z,{compact:!0,label:"Table (optional)",monospace:!0,onBlur:function(){return setTimeout((function(){ge(!1)}),300)},onChange:function(e){Jt((0,o.Z)({},si,e.target.value)),e.preventDefault()},onClick:pr.j,onFocus:function(){ge(!0)},small:!0,value:Je.data_provider_table,width:20*C.iI})})})]})]}),!Je.use_raw_sql&&(0,w.jsxs)(k.Z,{alignItems:"center",style:{marginTop:"8px"},children:[(0,w.jsx)(pn.Z,{block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["Limit the number of results that are returned",(0,w.jsx)("br",{}),"when running this block in the notebook.",(0,w.jsx)("br",{}),"This limit won\u2019t affect the number of results",(0,w.jsx)("br",{}),"returned when running the pipeline end-to-end."]}),size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le.kI,{muted:!0}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Limit"}),(0,w.jsx)("span",{children:"\xa0"})]})}),ni,(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(pn.Z,{autoWidth:!0,block:!0,description:(0,w.jsxs)(_.ZP,{default:!0,inline:!0,children:["How do you want to handle existing data with the same",$t?" database,":""," schema, and table name?",(0,w.jsx)("br",{}),(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Append"}),": add rows to the existing table.",(0,w.jsx)("br",{}),(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Replace"}),": delete the existing data.",(0,w.jsx)("br",{}),(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:"Fail"}),": raise an error during execution."]}),size:null,widthFitContent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(le.kI,{muted:!0}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,small:!0,children:"Write policy:"}),(0,w.jsx)("span",{children:"\xa0"}),(0,w.jsxs)(tr.Z,{compact:!0,label:"strategy",onChange:function(e){return Jt((0,o.Z)({},pi,e.target.value))},onClick:pr.j,small:!0,value:Je.export_write_policy,children:[(0,w.jsx)("option",{value:""}),null===er||void 0===er?void 0:er.map((function(e){return(0,w.jsx)("option",{value:e,children:(0,me.kC)(e)},e)}))]})]})}),(0,w.jsx)(O.Z,{mr:5})]})]})}),St.length>=1&&(0,w.jsx)(S.y9,{normalPadding:!0,children:(0,w.jsx)(k.Z,{children:St.map((function(e,n){var t=e.description,i=e.title;return(0,w.jsx)(O.Z,{ml:n>=1?1:0,children:(0,w.jsx)(pn.Z,{block:!0,description:t,size:null,widthFitContent:!0,children:(0,w.jsx)(bt.Z,{children:i})})},i)}))})}),P.upstream_blocks.length>=1&&!ze&&v.f2.includes(P.type)&&!In&&(0,w.jsxs)(S.y9,{children:[(0,w.jsx)(O.Z,{mr:5,children:(0,w.jsxs)(_.ZP,{small:!0,children:[!Rn&&"Positional arguments for ".concat(Dn?"":"decorated ","function:"),Rn&&'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,w.jsxs)(O.Z,{mt:1,children:[!Rn&&!Dn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===P.type&&"@data_exporter",v.tf.DATA_LOADER===P.type&&"@data_loader",v.tf.TRANSFORMER===P.type&&"@transformer",v.tf.CUSTOM===P.type&&"@custom"]}),(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:["def ",(v.tf.DATA_EXPORTER===P.type?"export_data":v.tf.DATA_LOADER===P.type&&"load_data")||v.tf.TRANSFORMER===P.type&&"transform"||v.tf.CUSTOM===P.type&&"transform_custom","(",P.upstream_blocks.map((function(e,n){return n>=1?"data_".concat(n+1):"data"})).join(", "),"):"]})]}),Dn&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,small:!0,children:[v.tf.DATA_EXPORTER===P.type?"export_data":v.tf.TRANSFORMER===P.type&&"transform","\xa0\u2190 function(",P.upstream_blocks.map((function(e,n){return"df_".concat(n+1)})).join(", "),"):"]})}),P.upstream_blocks.map((function(e,n){var t=ot[e],i=(0,S.qn)(null===t||void 0===t?void 0:t.type,{blockColor:null===t||void 0===t?void 0:t.color,theme:Ie}).accent,r="{{ df_".concat(n+1," }}");return(0,w.jsxs)("div",{children:[!Rn&&!Dn&&(0,w.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0data",n>=1?"_".concat(n+1):null]}),Rn&&(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:r}),Dn&&(0,w.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:["\xa0\xa0\xa0\xa0","df".concat(n+1)]})," ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"\u2192"})," ",(0,w.jsx)(Z.Z,{color:i,onClick:function(){var e,n,i=null===R||void 0===R||null===(e=R.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,w.jsx)(_.ZP,{color:i,inline:!0,monospace:!0,small:!0,children:e})})]},e)}))]})]}),!(null!==P&&void 0!==P&&P.error)&&(0,w.jsx)(w.Fragment,{children:ze?(0,w.jsx)(O.Z,{px:1,children:(0,w.jsxs)(_.ZP,{monospace:!0,muted:!0,children:["(",(0,me._6)("line",null===Ve||void 0===Ve?void 0:Ve.split(/\r\n|\r|\n/).length)," collapsed)"]})}):Qt}),Q&&s.cloneElement(Q,{runBlockAndTrack:ct}),(null===P||void 0===P?void 0:P.error)&&(0,w.jsxs)(O.Z,{p:C.cd,children:[(0,w.jsx)(_.ZP,{bold:!0,danger:!0,children:null===P||void 0===P||null===(u=P.error)||void 0===u?void 0:u.error}),(0,w.jsx)(_.ZP,{muted:!0,children:null===P||void 0===P||null===(a=P.error)||void 0===a?void 0:a.message})]}),ut&&Ye&&Ye>Zn&&(0,w.jsx)(S.HC,{children:(0,w.jsxs)(_.ZP,{muted:!0,children:["".concat(Math.round((Ye-Zn)/1e3)),"s"]})})]})),Yt]})]}),!ie&&(0,w.jsxs)(S.gE,{additionalZIndex:ei-I,onMouseEnter:function(){return De(!0)},onMouseLeave:function(){De(!1),null===ve||void 0===ve||ve(null)},children:[Re&&f&&(0,w.jsx)(O.Z,{mt:2,children:(0,w.jsx)(gt,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=Wi(P,e);return[v.tf.DATA_LOADER,v.tf.TRANSFORMER].includes(P.type)&&v.tf.SCRATCHPAD===e.type&&(n="from mage_ai.data_preparation.variable_manager import get_variable\n\n\ndf = get_variable('".concat(se.uuid,"', '").concat(P.uuid,"', 'output_0')")),n=ht(e,n),v.t6.SQL===P.language&&(t=vr(vr({},(0,Ce.GL)(P.configuration,[li,ci,ui,ai,pi])),t)),v.t6.SQL===e.language&&(n=pt(n)),f(vr(vr({},e),{},{configuration:t,content:n,upstream_blocks:i}))},blockIdx:I,compact:!0,hideCustom:In,hideDbt:In,onClickAddSingleDBTModel:ce,pipeline:se,setAddNewBlockMenuOpenIdx:ve,setCreatingNewDBTModel:be,setRecsWindowOpenBlockIdx:ke})}),(0,w.jsx)(S.t1,{className:"block-divider-inner"})]})]})}var br=s.forwardRef(gr),xr=t(90880),jr=6.25*C.iI,yr=(C.iI,100*C.iI),kr=g.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%);",""],Re.n_,yr,(function(e){return"\n box-shadow: ".concat((e.theme||Ae.Z).shadow.window,";\n background-color: ").concat((e.theme||Ae.Z).background.panel,";\n ")})),Zr=(0,g.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],jr,C.iI,C.cd*C.iI,(function(e){return"\n background-color: ".concat((e.theme||Ae.Z).background.output,";\n ")})),Or=g.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],Zr,Re.n_,Re.n_,(function(e){return"\n border-bottom: ".concat(Re.YF,"px ").concat(Re.M8," ").concat((e.theme||Ae.Z).borders.medium,";\n ")})),_r=g.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],C.iI,mn.w5,(0,xr.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*C.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*jr,"px);\n ")})),Cr=g.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],Zr,Re.n_,Re.n_,(function(e){return"\n border-top: ".concat(Re.YF,"px ").concat(Re.M8," ").concat((e.theme||Ae.Z).borders.medium,";\n ")})),Sr=g.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*C.iI,2*C.iI,(function(e){return"\n border-bottom: ".concat(Re.YF,"px ").concat(Re.M8," ").concat((e.theme||Ae.Z).borders.medium,";\n ")}));function wr(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?wr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):wr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Pr=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,ue.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(Er(Er({},e),{},{children:t}))})),i}),[r]),g=(0,s.useMemo)((function(){return(0,ue.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,w.jsxs)(kr,{children:[(0,w.jsxs)(Or,{children:[(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(_.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new DBT model":"Select DBT model file"})}),(0,w.jsx)(T.Z,{iconOnly:!0,onClick:o,children:(0,w.jsx)(le.x8,{muted:!0})})]}),t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Sr,{children:(0,w.jsx)(An,{inputValue:i,label:"Model name (cannot be changed):",labelColor:Ae.Z.accent.dbt,minWidth:38*C.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,w.jsxs)(Sr,{children:[(0,w.jsx)(_.ZP,{bold:!0,color:Ae.Z.accent.dbt,children:"Select folder location:"}),(0,w.jsx)(_.ZP,{bold:!0,muted:!p,children:p?"dbt".concat(he.sep).concat(p):"Choose folder below"})]})]}),(0,w.jsx)(_r,{children:(0,w.jsx)(Ye,{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)}))):!!g[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,w.jsx)(Cr,{children:(0,w.jsx)(T.Z,{backgroundColor:i&&p?Ae.Z.accent.dbt:Ae.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})};function Ir(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 Tr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ir(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ir(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ar(e,n){var t,i=e.block,r=e.blocks,o=e.onClick,l=(0,s.useContext)(g.ThemeContext),c=(0,S.qn)(i.type,{blockColor:i.color,theme:l}).accent,u=(0,hr.cU)([i],r)[0],a=u.dynamic,d=u.dynamicUpstreamBlock,f=u.reduceOutput,p=u.reduceOutputUpstreamBlock,h=(0,s.useMemo)((function(){return qi({block:i,dynamic:a,dynamicUpstreamBlock:d,reduceOutput:f,reduceOutputUpstreamBlock:p})}),[i,a,d,f,p]).borderColorShareProps,m=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]);return(0,w.jsx)(S.PY,Tr(Tr({},h),{},{ref:n,children:(0,w.jsx)(Z.Z,{noHoverUnderline:!0,noOutline:!0,onClick:function(){return o()},preventDefault:!0,children:(0,w.jsx)(O.Z,{p:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",flex:1,children:[(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(bt.Z,{monospace:!0,children:v.dO[i.language]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(x.Z,{color:c,size:1.5*C.iI,square:!0}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{color:c,monospace:!0,children:null===(t=m?v.tf.DBT:v.V4[i.type])||void 0===t?void 0:t.toUpperCase()})]}),(0,w.jsx)(O.Z,{mr:C.cd}),(0,w.jsx)(le.iU,{size:1.5*C.iI}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,children:null===i||void 0===i?void 0:i.uuid})]}),(0,w.jsx)(pn.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:"Show ".concat(null===i||void 0===i?void 0:i.uuid," block"),size:2*C.iI,widthFitContent:!0,children:(0,w.jsx)(le.Db,{muted:!0,size:2*C.iI})})]})})})}))}var Rr,Dr,Mr,Nr,Br=s.forwardRef(Ar),Lr=t(4804),Fr=t(65730),Ur=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(Dr||(Dr={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(Mr||(Mr={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(Nr||(Nr={}));var Hr,zr="datetime",Gr=(Rr={},(0,o.Z)(Rr,Nr.DATE_TIME,zr),(0,o.Z)(Rr,Nr.UUID,Nr.UUID),Rr);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(Hr||(Hr={}));var Wr,Vr,Qr,qr,Yr,Kr=[Hr.ARRAY,Hr.BOOLEAN,zr,Hr.INTEGER,Hr.NULL,Hr.NUMBER,Hr.OBJECT,Hr.STRING,Nr.UUID];!function(e){e.PROPERTIES="properties"}(Wr||(Wr={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(Vr||(Vr={})),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"}(Qr||(Qr={})),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"}(qr||(qr={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(Yr||(Yr={}));var Xr=t(31012),Jr=g.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||Ae.Z.background).popup,";\n ")}),(function(e){return e.primary&&"\n background-color: ".concat((e.theme.chart||Ae.Z.chart).primary,";\n ")}),(function(e){return!e.small&&"\n border-radius: ".concat((C.iI+Xr.Al)/2,"px;\n height: ").concat(1.5*C.iI+Xr.Al,"px;\n padding: ").concat(C.iI/1.5,"px ").concat(1.25*C.iI,"px;\n ")}),(function(e){return e.small&&"\n border-radius: ".concat((C.iI/2+Xr.Al)/2,"px;\n height: ").concat(Xr.Al+C.iI/2+2,"px;\n padding: ").concat(C.iI/4,"px ").concat(C.iI,"px;\n ")}),(function(e){return e.border&&"\n border: 1px solid ".concat((e.theme.content||Ae.Z.content).muted,";\n ")})),$r=function(e){var n=e.border,t=e.children,i=e.label,r=e.onClick,o=e.primary,l=e.small;return(0,w.jsx)(Jr,{border:n,primary:o,small:l,children:(0,w.jsx)(T.Z,{basic:!0,noPadding:!0,noBackground:!0,onClick:r,transparent:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[t,i&&(0,w.jsx)(_.ZP,{small:l,children:i}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(le.x8,{default:o,muted:!o,size:l?C.iI:1.25*C.iI})]})})})},eo=t(70902),no=t(85307);function to(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 io(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?to(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):to(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ro="4px",oo=[Yr.BIGQUERY,Yr.DELTA_LAKE_S3];var lo=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,g=(0,s.useRef)(null),x=a.bookmark_properties,j=a.destination_table,Z=void 0===j?"":j,S=a.key_properties,E=a.metadata,P=a.partition_keys,I=a.replication_method,A=a.schema.properties,R=a.tap_stream_id,M=a.unique_constraints,B=a.unique_conflict_method,L=(0,s.useState)(Z),F=L[0],U=L[1],H=(0,s.useState)(!1),z=H[0],G=H[1],W=(0,s.useState)(null),V=W[0],Q=W[1],q=(0,s.useState)(!1),Y=q[0],K=q[1],X=(0,s.useState)((0,o.Z)({},R,n||{})),J=X[0],$=X[1],ee=(0,Zt.Z)(R);(0,s.useEffect)((function(){ee!==R&&(U(Z),Q(null))}),[Z,I,R,ee,B]),(0,s.useEffect)((function(){var e=null===J||void 0===J?void 0:J[R];(null===x||void 0===x?void 0:x.length)>0&&((0,Ce.Qr)(e)||!(0,Ce.Xy)(n,e))&&$((function(e){return io(io({},e),{},(0,o.Z)({},R,n))}))}),[null===x||void 0===x?void 0:x.length,n,R]);var ne=(0,s.useMemo)((function(){return(0,ue.HK)(E,(function(e){return e.breadcrumb.join("/")}))}),[E]),te=(0,s.useMemo)((function(){var e;return null===(e=(0,ue.sE)(E,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[E]),ie=(0,s.useMemo)((function(){return te[Qr.KEY_PROPERTIES]||[]}),[te]),re=(0,s.useMemo)((function(){return te[Qr.REPLICATION_KEYS]||[]}),[te]),oe=oo.includes(t),le=d.length>1,ce=(0,s.useCallback)((function(e){var n=io({},null===J||void 0===J?void 0:J[R]);n.hasOwnProperty(e)&&delete n[e],$((function(e){return io(io({},e),{},(0,o.Z)({},R,io({},n)))})),p({block:{bookmark_values:n,destination_table:F,tap_stream_id:R}})}),[J,F,R,p]),ae=(0,s.useMemo)((function(){var e=[],n=[],i=(0,ue.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,g=void 0===p?[]:p,j=new Set(Array.isArray(g)?g:[g]),Z=new Set(j);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){j.add(e),Z.add(e)})):(j.add(t),Z.add(t),n&&Z.add(n))}));var E=Array.from(j);d&&Z.add(d);var I=(ne["properties/".concat(c)]||{}).metadata,A=(I.inclusion,I.selected);e.push(A),n.push(c);var D=Kr.reduce((function(e,n){return E.indexOf(n)>=0||zr===String(n)&&Nr.DATE_TIME===d||Nr.UUID===String(n)&&Nr.UUID===d?e:e.concat((0,w.jsx)("option",{value:n,children:n},n))}),[]),N=E.findIndex((function(e){return e===Hr.STRING})),B=[(0,w.jsx)(b.Z,{checked:A,onClick:function(){h(R,[c],{selected:!A})}},"".concat(R,"/").concat(c,"/selected")),(0,w.jsx)(_.ZP,{children:c},"".concat(R,"/").concat(c,"/name")),(0,w.jsxs)(k.Z,{children:[(0,w.jsx)(y.Z,{flex:1,children:(0,w.jsx)(k.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:E.map((function(e,n){return(0,w.jsx)(O.Z,{mb:1,mr:1,children:(0,w.jsx)($r,{border:!0,label:d&&Hr.STRING===e&&N===n?Gr[d]:e,onClick:function(){var n={format:d,type:E.filter((function(n){return n!==e}))};Nr.DATE_TIME!==d&&Nr.UUID!==d||Hr.STRING!==e||(n.format=null),m(R,c,n)},small:!0})},"".concat(R,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),D.length>=1&&(0,w.jsxs)(tr.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:E};zr===String(n)?(t.format=Nr.DATE_TIME,t.type.push(Hr.STRING)):Nr.UUID===String(n)?(t.format=Nr.UUID,t.type.push(Hr.STRING)):t.type.push(n),m(R,c,t)},primary:!0,small:!0,value:"",width:10*C.iI,children:[(0,w.jsx)("option",{value:""}),D]})]},"".concat(R,"/").concat(c,"/type")),(0,w.jsx)(b.Z,{checked:!(null===M||void 0===M||!M.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,ue.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(R,"/").concat(c,"/unique")),(0,w.jsx)(b.Z,{checked:!(null===x||void 0===x||!x.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,ue.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(R,"/").concat(c,"/bookmark")),(0,w.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,ue.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 L=t!==Yr.DELTA_LAKE_S3,F=L&&(ie.includes(c)||!Z.has(Nr.DATE_TIME));B.push((0,w.jsx)(b.Z,{checked:!(null===P||void 0===P||!P.includes(c)),disabled:F,onClick:F?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,ue.Od)(e.partition_keys,(function(e){return c===e})):L&&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 U=V===r;B.push((0,w.jsx)(T.Z,{compact:!0,disabled:U,onClick:function(){Q(r),setTimeout((function(){return Q(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:E};var h=null===(i=(0,ue.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[Qr.REPLICATION_KEYS]||[],v=h[Qr.KEY_PROPERTIES]||[];null===M||void 0===M||!M.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!v.includes(c)?null!==M&&void 0!==M&&M.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,ue.Od)(e.unique_constraints,(function(e){return c===e}))):e.unique_constraints=[c].concat(e.unique_constraints||[]),null===x||void 0===x||!x.includes(c)||null!==e&&void 0!==e&&null!==(l=e.bookmark_properties)&&void 0!==l&&l.includes(c)||!m.includes(c)?null!==x&&void 0!==x&&x.includes(c)||null===e||void 0===e||null===(u=e.bookmark_properties)||void 0===u||!u.includes(c)||(e.bookmark_properties=(0,ue.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,ue.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===P||void 0===P||!P.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==P&&void 0!==P&&P.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,ue.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return io({},e)}))},pill:!0,secondary:!0,children:(0,w.jsx)(_.ZP,{success:U,children:U?"Applied!":"Apply"})}))}return B})),r=e.every((function(e){return e})),o=[null,2,1,null,null,null],c=[{label:function(){return(0,w.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,w.jsx)(no.cl,{children:(0,w.jsx)(Te.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[x,t,le,V,S,ne,P,A,oe,R,M,f,h,m,v,ie,re]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,w.jsx)(Ur.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:R})," schema"]}),(0,w.jsx)(O.Z,{mb:3,children:(0,w.jsx)(D.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(_.ZP,{children:"Destination table name"}),(0,w.jsx)(O.Z,{ml:ro}),(0,w.jsx)(pn.Z,{label:(0,w.jsxs)(_.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,w.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,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(N.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;U(n),clearTimeout(g.current),g.current=setTimeout((function(){v(R,(function(e){return io(io({},e),{},{destination_table:n})}))}),300)},value:F||"",width:45*C.iI})]})})}),(0,w.jsx)(O.Z,{mb:3,children:(0,w.jsx)(D.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(_.ZP,{children:"Replication method"}),(0,w.jsx)(O.Z,{ml:ro}),(0,w.jsx)(pn.Z,{label:(0,w.jsxs)(_.ZP,{children:["Do you want to synchronize the entire stream (",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Dr.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Dr.INCREMENTAL}),")?",u===qr.POSTGRESQL&&(0,w.jsxs)(_.ZP,{children:["Log-based incremental replication (",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Dr.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,w.jsx)(O.Z,{ml:1}),(0,w.jsxs)(tr.Z,{compact:!0,onChange:function(e){v(R,(function(n){return io(io({},n),{},{replication_method:e.target.value})}))},primary:!0,value:I,children:[(0,w.jsx)("option",{value:""}),Object.values(Dr).filter((function(e){return u===qr.POSTGRESQL||e!==Dr.LOG_BASED})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),(0,w.jsx)(O.Z,{ml:3}),(0,w.jsx)(_.ZP,{children:"Unique conflict method"}),(0,w.jsx)(O.Z,{ml:ro}),(0,w.jsx)(pn.Z,{label:(0,w.jsxs)(_.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,me._6)("column",null===M||void 0===M?void 0:M.length),(null===M||void 0===M?void 0:M.length)>0&&(0,w.jsx)(w.Fragment,{children:"\xa0"}),null===M||void 0===M?void 0:M.sort().map((function(e,n){return(0,w.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===M||void 0===M?void 0:M.length)&&n===(null===M||void 0===M?void 0:M.length)-1?(0,w.jsx)(_.ZP,{inline:!0,children:" and "},e):n>=1&&(0,w.jsx)(w.Fragment,{children:",\xa0"}),e]},e)})),", how do you want to resolve the conflict? The conflict method ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Mr.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:Mr.UPDATE})," will not save the new record and instead update the existing record with the new record\u2019s properties."]}),lightBackground:!0,primary:!0}),(0,w.jsx)(O.Z,{ml:1}),(0,w.jsxs)(tr.Z,{compact:!0,inputWidth:11*C.iI,onChange:function(e){v(R,(function(n){return io(io({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:B,children:[(0,w.jsx)("option",{value:""}),(0,w.jsx)("option",{value:Mr.IGNORE,children:Mr.IGNORE}),(0,w.jsx)("option",{value:Mr.UPDATE,children:Mr.UPDATE})]})]}),le&&(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(_.ZP,{default:!0,children:"All streams"}),(0,w.jsx)(O.Z,{ml:ro}),(0,w.jsx)(pn.Z,{appearBefore:!0,label:(0,w.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,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(T.Z,{compact:!0,disabled:z,onClick:function(){G(!0),setTimeout((function(){return G(!1)}),2e3),f((function(e){return io(io({},e),{},{replication_method:I,unique_conflict_method:B})}))},pill:!0,secondary:!0,children:(0,w.jsx)(_.ZP,{bold:!z,success:z,children:z?"Applied!":"Apply"})})]})]})})}),(0,w.jsx)(D.Z,{headerTitle:"Features",noPadding:!0,children:ae}),(0,w.jsx)(O.Z,{mt:2,children:(0,w.jsx)(T.Z,{loading:i,onClick:function(){return c(R)},primary:!0,small:!0,children:"Load sample data"})}),(0,w.jsxs)(O.Z,{mt:5,children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),Dr.INCREMENTAL===I&&(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsxs)(O.Z,{mb:1,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,w.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,w.jsx)("br",{}),"On the next run, the synchronization will start after the bookmarked record."]})]}),(0,w.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,w.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Bookmark"})," to use a specific column as a bookmark property."]}),null===x||void 0===x?void 0:x.sort().map((function(e){return(0,w.jsx)(O.Z,{mb:1,mr:1,children:(0,w.jsx)($r,{label:e,onClick:function(){ce(e),v(R,(function(n){return io(io({},n),{},{bookmark_properties:(0,ue.Od)(n.bookmark_properties||[],(function(n){return n===e}))})}))},primary:!0})},"bookmark_properties/".concat(e))}))]}),(null===x||void 0===x?void 0:x.length)>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{my:2,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(O.Z,{mr:2,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,w.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,w.jsx)(eo.Z,{checked:Y,disabled:!t,onCheck:function(){return K((function(e){return!e}))}})]})}),Y&&!!t&&(0,w.jsx)(D.Z,{header:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(_.ZP,{bold:!0,default:!0,children:"Bookmark property values"}),(0,w.jsx)(T.Z,{compact:!0,loading:r,onClick:function(){p({block:{bookmark_values:(null===J||void 0===J?void 0:J[R])||{},destination_table:F,tap_stream_id:R}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:C.iI,noPadding:!0,overflowVisible:!0,children:(0,w.jsx)(Te.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:x.map((function(e){var n;return[(0,w.jsx)(_.ZP,{default:!0,monospace:!0,children:e},e),(0,w.jsx)(N.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),$((function(t){return io(io({},t),{},(0,o.Z)({},R,io(io({},t[R]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===J||void 0===J||null===(n=J[R])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsxs)(O.Z,{mb:1,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,w.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,w.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==M&&void 0!==M&&M.length)&&(0,w.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===M||void 0===M?void 0:M.sort().map((function(e){return(0,w.jsx)(O.Z,{mb:1,mr:1,children:(0,w.jsx)($r,{label:e,onClick:function(){v(R,(function(n){return io(io({},n),{},{unique_constraints:(0,ue.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsxs)(O.Z,{mb:1,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,w.jsx)(_.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,w.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==S&&void 0!==S&&S.length)&&(0,w.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.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,w.jsx)(O.Z,{mb:1,mr:1,children:(0,w.jsx)($r,{label:e,onClick:function(){v(R,(function(n){return io(io({},n),{},{key_properties:(0,ue.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),oe&&(0,w.jsxs)(O.Z,{mb:3,children:[(0,w.jsxs)(O.Z,{mb:1,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,w.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,w.jsxs)(k.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==P&&void 0!==P&&P.length)&&(0,w.jsxs)(_.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===P||void 0===P?void 0:P.sort().map((function(e){return(0,w.jsx)(O.Z,{mb:1,mr:1,children:(0,w.jsx)($r,{label:e,onClick:function(){v(R,(function(n){return io(io({},n),{},{partition_keys:(0,ue.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},co=["catalog","pipeline","setErrors","setSelectedStream"];function uo(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 ao(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?uo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):uo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var so,fo=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,Q.Z)(e,co),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,ue.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,ue.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,ue.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),Z=_e.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=Z.data,S=Z.mutate,E=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,P=(0,d.Db)(_e.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,Se.wD)(e,{callback:function(){null===S||void 0===S||S()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(P,2),T=I[0],R=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,ue.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var D=(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,w.jsx)(no.cl,{children:(0,w.jsx)(Te.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,w.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,w.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,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(A.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,w.jsx)(O.Z,{mt:1,children:(0,w.jsx)(no.dE,{children:(0,w.jsx)(lo,ao(ao({},c),{},{bookmarkValues:E,isLoadingUpdateDestinationBlockState:R,stream:g,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsxs)(no.dE,{children:[(0,w.jsx)(Ur.Z,{level:4,children:"Streams Summary"}),(0,w.jsx)(O.Z,{mt:1}),D]})})]})},po=t(18776);function ho(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}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 vo(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}!function(e){e.ALL="All",e.SELECTED="Selected",e.NOT_SELECTED="Not selected"}(so||(so={}));var go=45*C.iI;var bo=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,ue.HK)((null===n||void 0===n?void 0:n.streams)||[],(function(e){return e.stream})),c=(0,s.useMemo)((function(){var e=new Set(r.map((function(e){return e.stream})));return Object.values(l).filter((function(n){var t=n.stream;return!e.has(t)})).map((function(e){return vo(vo({},e),{},{isMissingStream:!0})}))}),[l,r]),u=vo({},l);c.forEach((function(e){var n=e.stream;delete u[n]}));var a=(0,s.useState)(u),d=a[0],f=a[1],p=(0,s.useState)(null),h=p[0],m=p[1],v=(0,s.useState)(!1),g=v[0],x=v[1],y=(0,s.useState)(so.ALL),Z=y[0],S=y[1],E=(0,s.useRef)(null),P=ho(d),I=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return Z===so.SELECTED?P.includes(n):Z!==so.NOT_SELECTED||!P.includes(n)})),h?e.filter((function(e){var n=e.tap_stream_id;return null===n||void 0===n?void 0:n.toLowerCase().includes(null===h||void 0===h?void 0:h.toLowerCase())})):e}),[Z,h,P,r]),A=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!d[n]}))}),[d,r]);return(0,w.jsxs)(po.Z,{children:[(0,w.jsx)(no.cv,{rounded:!0,children:(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,w.jsx)(no.cv,{padding:1.25*C.iI,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(N.Z,{beforeIcon:(0,w.jsx)(le.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return m(e.target.value)},placeholder:"Search",value:h}),(0,w.jsx)(O.Z,{pr:1,children:(0,w.jsx)(Wn.Z,{items:[{label:function(){return so.ALL},onClick:function(){return S(so.ALL)},uuid:"all_streams"},{label:function(){return so.SELECTED},onClick:function(){return S(so.SELECTED)},uuid:"selected"},{label:function(){return so.NOT_SELECTED},onClick:function(){return S(so.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return x(!1)},onClickOutside:function(){return x(!1)},open:g,parentRef:E,uuid:"SelectStreams/filter",children:(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(le.wn,{}),noBackground:!0,onClick:function(){return x((function(e){return!e}))},ref:E,children:(0,w.jsx)(_.ZP,{children:Z})})})})]})}),(0,w.jsx)(no.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(go,"px"),children:(0,w.jsx)(Te.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,w.jsx)(b.Z,{checked:A,onClick:function(){var e=(0,ue.HK)(r||[],(function(e){return e.stream}));f(A?{}:e)}})},uuid:"Selected"},{uuid:"Stream name"}],rows:I.concat(c).map((function(e){var n=e.isMissingStream,t=e.stream,i=!!d[t];return[(0,w.jsx)(b.Z,{checked:i,disabled:!i&&n,onClick:function(){f((function(n){return vo(vo({},n),{},(0,o.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,w.jsxs)(_.ZP,{danger:n,title:t,width:go-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,w.jsx)(j.Z,{medium:!0}),(0,w.jsxs)(O.Z,{p:2,children:[(null===P||void 0===P?void 0:P.length)>50&&(0,w.jsx)(O.Z,{pb:2,children:(0,w.jsxs)(_.ZP,{danger:!0,maxWidth:go-4*C.iI,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,w.jsx)("br",{}),"may cause app performance issues."]})}),(0,w.jsx)(k.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{loading:t,onClick:function(){return i(d)},primary:!0,children:"Confirm ".concat(ho(d).length," streams")})})]})]})};function xo(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 jo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xo(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var yo=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,Lr.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],g=(0,s.useState)(),b=g[0],x=g[1],j=(0,d.Db)(_e.ZP[n].useCreate(),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var t,i,r=(0,me.C5)(n);m(null===e||void 0===e||null===(t=e[r])||void 0===t?void 0:t.success),x(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)}})}}),y=(0,l.Z)(j,2),Z=y[0],C=y[1].isLoading;return t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(no.$W,{children:(0,w.jsx)($e.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,Lr.Pz)(jo(jo({},i),{},{config:(0,Lr.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,w.jsxs)(O.Z,{mt:1,children:[(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{onClick:function(){Z((0,o.Z)({},(0,me.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,w.jsx)(O.Z,{ml:1,children:C?(0,w.jsx)(Hi.Z,{color:"white",small:!0}):(0,w.jsxs)(w.Fragment,{children:[h&&(0,w.jsx)(_.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,w.jsx)(_.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),b&&(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsx)(_.ZP,{small:!0,warning:!0,children:b})})]})]}):null};function ko(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 Zo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ko(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ko(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Oo=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,g=e.pipeline,b=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,y=e.setOutputBlocks,S=e.setSelectedBlock,E=e.setSelectedOutputBlock,P=e.setSelectedStream,I=(0,s.useState)(!0),A=I[0],R=I[1],D=(0,s.useState)(!0),M=D[0],N=D[1],B=(0,s.useState)(!0),L=B[0],F=B[1],U=_e.ZP.integration_sources.list().data,H=(0,s.useMemo)((function(){return(null===U||void 0===U?void 0:U.integration_sources)||[]}),[U]),z=(0,s.useMemo)((function(){return(0,ue.HK)(H,(function(e){return e.uuid}))}),[H]),G=_e.ZP.integration_destinations.list().data,W=(0,s.useMemo)((function(){return(null===G||void 0===G?void 0:G.integration_destinations)||[]}),[G]),V=(0,s.useMemo)((function(){return(0,ue.HK)(W,(function(e){return e.uuid}))}),[W]),Q=(0,s.useMemo)((function(){return(0,ue.sE)(o,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[o]),q=(0,s.useMemo)((function(){return Q?(0,Lr.Qc)(Q.content):{}}),[Q]),Y=(0,s.useMemo)((function(){return(0,w.jsx)(yo,{api:"integration_sources",block:Q,blockContent:q,onChangeCodeBlock:h,pipeline:g})}),[Q,q,h,g]),X=(0,s.useMemo)((function(){return(0,ue.sE)(o,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[o]),J=(0,s.useMemo)((function(){return X?(0,Lr.Qc)(X.content):{}}),[X]),$=(0,s.useMemo)((function(){return(0,w.jsx)(yo,{api:"integration_destinations",block:X,blockContent:J,onChangeCodeBlock:h,pipeline:g})}),[X,J,h,g]),ee=(0,s.useMemo)((function(){var e;return(0,Ce.Qr)(null===q||void 0===q?void 0:q.catalog)?null===g||void 0===g||null===(e=g.data_integration)||void 0===e?void 0:e.catalog:null===q||void 0===q?void 0:q.catalog}),[q,null===g||void 0===g||null===(n=g.data_integration)||void 0===n?void 0:n.catalog]),ne=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.auto_add_new_fields})),te=((null===ee||void 0===ee?void 0:ee.streams)||[]).every((function(e){return e.disable_column_type_check})),ie=(0,Zt.Z)(ee);(0,s.useEffect)((function(){!ie&&ee&&(y((function(){return E(Q),[Q]})),j((function(e){var n;return e||(null===ee||void 0===ee||null===(n=ee.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[ee]);var re=(0,s.useState)(),oe=re[0],ce=re[1],ae=(0,d.Db)(_e.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];y((function(){return E(Q),[Q]})),t.length>0&&P(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(K.DATA),f()}else ce(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),se=(0,l.Z)(ae,2),de=se[0],fe=se[1].isLoading,pe=(0,d.Db)(_e.ZP.integration_sources.useUpdate(null===g||void 0===g?void 0:g.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===ee||void 0===ee?void 0:ee.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(Vr.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=Dr.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=Mr.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]=Zo(Zo({},n),{},{metadata:Zo(Zo({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Me.map((function(e){return e.tap_stream_id})));var s=null===q||void 0===q?void 0:q.catalog;(0,Ce.Qr)(s)||h(Q.type,Q.uuid,(0,Lr.Pz)(Zo(Zo({},q),{},{catalog:{}})));var d={pipeline:Zo(Zo({},g),{},{data_integration:Zo(Zo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:c})})};b(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),he=(0,l.Z)(pe,2),me=he[0],ve=he[1].isLoading,ge=(0,s.useState)(null),be=ge[0],xe=ge[1],je=(0,d.Db)(_e.ZP.integration_source_streams.useUpdate(null===g||void 0===g?void 0:g.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){xe(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),ye=(0,l.Z)(je,2),ke=ye[0],Ze=ye[1].isLoading,Oe=(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}}(ee,e),i=t.stream,r=t.streams,o=Zo(Zo({},ee),{},{streams:r.concat(n(i))}),l=null===q||void 0===q?void 0:q.catalog;(0,Ce.Qr)(l)||h(Q.type,Q.uuid,(0,Lr.Pz)(Zo(Zo({},q),{},{catalog:{}})));var c={pipeline:Zo(Zo({},g),{},{data_integration:Zo(Zo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:o})})};b(c).then((function(){return a()}))}),[ee,Q,q,a,h,g,b]),we=(0,s.useCallback)((function(e){if(null!==ee&&void 0!==ee&&ee.streams){var n=Zo(Zo({},ee),{},{streams:ee.streams.map((function(n){return e(n)}))}),t=null===q||void 0===q?void 0:q.catalog;(0,Ce.Qr)(t)||h(Q.type,Q.uuid,(0,Lr.Pz)(Zo(Zo({},q),{},{catalog:{}})));var i={pipeline:Zo(Zo({},g),{},{data_integration:Zo(Zo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:n})})};b(i).then((function(){return a()}))}}),[ee,Q,q,a,h,g,b]),Ee=(0,s.useCallback)((function(e,n,t){Oe(e,(function(e){return e.schema.properties[n]=t,e}))}),[Oe]),Pe=(0,s.useCallback)((function(e,n,t){Oe(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=Zo(Zo({},o),t)}})),e}))}),[Oe]),Ie=(0,d.Db)(_e.ZP.blocks.pipelines.useUpdate(null===g||void 0===g?void 0:g.uuid,null===X||void 0===X?void 0:X.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){null===a||void 0===a||a()},onErrorCallback:function(e,n){return null===x||void 0===x?void 0:x({errors:n,response:e})}})}}),Ae=(0,l.Z)(Ie,1)[0],Re=(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,w.jsx)(_.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,w.jsx)(_.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,w.jsx)(_.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,w.jsx)(Fr.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,w.jsx)(Te.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,w.jsxs)(O.Z,{mt:2,children:[(0,w.jsxs)(_.ZP,{default:!0,children:["Use the following variables to interpolate sensitive or dynamic information into the configuration.",(0,w.jsx)("br",{}),"You can also access values from your environment variables by using the following syntax: ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:"\"{{ env_var('MY_ENV_VARIABLE_NAME') }}\""}),(0,w.jsx)("br",{}),"For more information, check out the ",(0,w.jsx)(Z.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,w.jsx)(O.Z,{mt:1,children:Re})]})}),[Re]),Me=(0,s.useMemo)((function(){return(null===be||void 0===be?void 0:be.streams)||[]}),[be]),Ne=(0,He.dd)((function(){return(0,w.jsx)(bo,{catalog:ee,isLoading:ve,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)me({integration_source:{streams:n}}),Fe();else{var t=null===q||void 0===q?void 0:q.catalog;(0,Ce.Qr)(t)||h(Q.type,Q.uuid,(0,Lr.Pz)(Zo(Zo({},q),{},{catalog:{}}))),b({pipeline:Zo(Zo({},g),{},{data_integration:Zo(Zo({},(null===g||void 0===g?void 0:g.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),Fe()}},streams:Me})}),{},[ee,Q,q,a,ve,h,b,Me],{background:!0,uuid:"select_streams"}),Be=(0,l.Z)(Ne,2),Le=Be[0],Fe=Be[1];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{iconOnly:!0,onClick:function(){return N((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[M&&(0,w.jsx)(le.Kh,{size:1.5*C.iI}),!M&&(0,w.jsx)(le._M,{size:1.5*C.iI})]})}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Ur.Z,{children:"Source"}),!M&&(0,w.jsxs)(Ur.Z,{default:!0,inline:!0,children:["\xa0",null===(t=z[null===q||void 0===q?void 0:q.source])||void 0===t?void 0:t.name]})]})]})}),M&&(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsxs)(no.dE,{children:[(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===H||void 0===H?void 0:H.length)>0?(0,w.jsxs)(tr.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=z[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})),Q?h(Q.type,Q.uuid,(0,Lr.Pz)(Zo(Zo({},q),{},{catalog:{},config:o,source:i}))):r({content:(0,Lr.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,S),xe(null),b().then((function(){a()}))}},primary:!0,value:null===q||void 0===q?void 0:q.source,children:[(0,w.jsx)("option",{value:""}),H.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Hi.Z,{inverted:!0}),(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(Ur.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),Q&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===q||void 0===q?void 0:q.source)&&(0,w.jsxs)(O.Z,{mb:2,children:[(0,w.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,w.jsxs)(Z.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")]}),Y]}),(0,w.jsxs)("div",{children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,w.jsx)(T.Z,{loading:Ze,onClick:function(){b().then((function(){ke().then((function(){return Le()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),oe&&(0,w.jsx)(_.ZP,{warning:!0,children:oe})]})]}),ve&&(0,w.jsx)(O.Z,{p:2,children:(0,w.jsx)(Hi.Z,{})}),!ve&&(0,w.jsx)(O.Z,{mt:3,children:(0,w.jsx)(fo,{catalog:ee,destination:null===J||void 0===J?void 0:J.destination,isLoadingLoadSampleData:fe,loadSampleData:function(e){return de({integration_source:{action_type:"sample_data",pipeline_uuid:null===g||void 0===g?void 0:g.uuid,streams:[e]}})},pipeline:g,setErrors:x,setSelectedStream:P,source:null===q||void 0===q?void 0:q.source,updateAllStreams:we,updateMetadataForColumns:Pe,updateSchemaProperty:Ee,updateStream:Oe})})]}),(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!Q,iconOnly:!0,onClick:function(){return F((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[L&&Q&&(0,w.jsx)(le.Kh,{size:1.5*C.iI}),(!L||!Q)&&(0,w.jsx)(le._M,{disabled:!Q,size:1.5*C.iI})]})}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)(Ur.Z,{children:"Transformers"})})]})}),L&&Q&&(0,w.jsx)(O.Z,{mb:5,children:(0,w.jsxs)(no.dE,{children:[c.length>0&&(0,w.jsx)(O.Z,{mb:1,children:c.map((function(e,n){return(0,w.jsx)(O.Z,{mb:1,children:e},n)}))}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsx)(gt,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return Q&&i.push(Q.uuid),r(Zo(Zo({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){X&&(Ae({block:Zo(Zo({},X),{},{upstream_blocks:[e.uuid]})}),S(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideRecommendations:!0,hideScratchpad:!0,hideSensor:!0,hideTransformerDataSources:!0,pipeline:g})})]})}),(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!Q,iconOnly:!0,onClick:function(){return R((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[A&&Q&&(0,w.jsx)(le.Kh,{size:1.5*C.iI}),(!A||!Q)&&(0,w.jsx)(le._M,{disabled:!Q,size:1.5*C.iI})]})}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Ur.Z,{children:"Destination"}),!A&&(0,w.jsxs)(Ur.Z,{default:!0,inline:!0,children:["\xa0",null===(i=V[null===J||void 0===J?void 0:J.destination])||void 0===i?void 0:i.name]})]})]})}),A&&Q&&(0,w.jsxs)(no.dE,{children:[(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===W||void 0===W?void 0:W.length)>0?(0,w.jsxs)(tr.Z,{onChange:function(e){var n=e.target.value;if(n){if(X)h(X.type,X.uuid,(0,Lr.Pz)(Zo(Zo({},J),{},{destination:n})));else{var t,i,l=null===(t=V[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===Q||void 0===Q?void 0:Q.uuid)!==n}));u&&c.push(u.uuid)}else Q&&c.push(Q.uuid);r({content:(0,Lr.Pz)({config:l,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,S)}b().then((function(){a()}))}},primary:!0,value:null===J||void 0===J?void 0:J.destination,children:[(0,w.jsx)("option",{value:""}),W.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Hi.Z,{inverted:!0}),(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(Ur.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),X&&(0,w.jsxs)(O.Z,{mb:5,children:[(0,w.jsx)(Ur.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===J||void 0===J?void 0:J.destination)&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(O.Z,{mb:2,children:[(0,w.jsxs)(_.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,w.jsxs)(Z.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(J.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[J.destination," documentation"]}),".",(0,w.jsx)("br",{}),(0,w.jsx)("br",{}),"If your configuration contains a key named ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:"table"}),", it\u2019s optional.",(0,w.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,w.jsx)(_.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),De("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),$,(0,w.jsx)(O.Z,{mt:3,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(O.Z,{mr:2,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,w.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,w.jsx)(eo.Z,{checked:!!ne,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return we((function(e){return Zo(Zo({},e),{},{auto_add_new_fields:!ne})}))}})]})}),(0,w.jsx)(O.Z,{mt:3,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(O.Z,{mr:2,children:[(0,w.jsx)(_.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,w.jsxs)(_.ZP,{default:!0,children:["By default, the value for each column is validated according to the schema property for that column.",(0,w.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,w.jsx)("br",{}),"Turn this toggle on if you want to disable this strict type checking."]})]}),(0,w.jsx)(eo.Z,{checked:!!te,disabled:!(null!==ee&&void 0!==ee&&ee.streams),onCheck:function(){return we((function(e){return Zo(Zo({},e),{},{disable_column_type_check:!te})}))}})]})})]})]})]})};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 Co(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 So=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.allowCodeBlockShortcuts,r=e.anyInputFocused,l=e.autocompleteItems,c=e.blockRefs,u=e.blocks,a=void 0===u?[]:u,d=e.dataProviders,f=e.deleteBlock,p=e.disableShortcuts,h=e.fetchFileTree,m=e.fetchPipeline,g=e.fetchSampleData,b=e.files,x=e.globalVariables,j=e.hiddenBlocks,y=e.interruptKernel,k=(e.isPipelineUpdating,e.kernel,e.mainContainerRef),Z=e.mainContainerWidth,_=e.messages,S=e.onChangeCallbackBlock,E=e.onChangeCodeBlock,P=e.openSidekickView,I=e.pipeline,T=e.pipelineContentTouched,A=(e.pipelineLastSaved,e.restartKernel),R=e.runBlock,D=e.runningBlocks,N=void 0===D?[]:D,L=e.savePipelineContent,F=e.selectedBlock,H=e.setAnyInputFocused,z=e.setEditingBlock,W=e.setErrors,V=e.setIntegrationStreams,Q=e.setHiddenBlocks,q=(e.setMessages,e.setOutputBlocks),Y=e.setPipelineContentTouched,K=e.setRecsWindowOpenBlockIdx,X=(e.setRunningBlocks,e.setSelectedBlock),J=e.setSelectedOutputBlock,$=e.setSelectedStream,ee=e.setTextareaFocused,ne=e.textareaFocused,te=e.widgets,ie=(0,s.useState)(!1),re=ie[0],oe=ie[1],le=(0,s.useState)(!1),ce=le[0],ue=le[1],ae=(0,s.useState)(!0),se=ae[0],de=ae[1],fe=(0,s.useState)(null),pe=fe[0],ve=fe[1],ge=(0,s.useState)(null),be=ge[0],xe=ge[1],je=(0,s.useState)(!1),ye=je[0],ke=je[1],Ze=(0,s.useState)(""),Oe=Ze[0],_e=Ze[1],Se=(0,s.useMemo)((function(){return N.reduce((function(e,n,t){return Co(Co({},e),{},(0,o.Z)({},n.uuid,Co(Co({},n),{},{priority:t})))}),{})}),[N]),we=(0,Zt.Z)(F),Ee=(0,s.useMemo)((function(){return a.length}),[a]),Pe=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===I||void 0===I?void 0:I.type)}),[I]),Ie=(0,s.useMemo)((function(){return M.qL.STREAMING===(null===I||void 0===I?void 0:I.type)}),[I]),Te="PipelineDetail/index",Ae=(0,en.y)(),Re=Ae.disableGlobalKeyboardShortcuts,De=Ae.registerOnKeyDown,Me=Ae.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){Me(Te)}}),[Me,Te]),De(Te,(function(e,t,i){if(T&&(0,U.y)([B.zX,B.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(!p&&!Re)if((0,U.y)([B.zX,B.Um],t)||(0,U.y)([B.PQ,B.Um],t))e.preventDefault(),L();else if(ne)t[B.vP]?ee(!1):T||B.Z1.find((function(e){return t[e]}))||Y(!0);else if(!Pe){if(F){var o=a.findIndex((function(e){var n=e.uuid;return F.uuid===n}));if(t[B.vP])X(null),K(null);else if(i[0]===B.xD&&i[1]===B.xD)y();else if(i[0]===B.l1&&i[1]===B.l1&&-1!==o)f(F).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){o===a.length-1?X(a[o-1]):a.length>=0?X(a[o+1]):X(null)}),100)}));else if(t[B.Bu]&&o>=1){var l=a[o-1];if(l){var u,s;X(l);var d="".concat(l.type,"s/").concat(l.uuid,".py");null===(u=c.current[d])||void 0===u||null===(s=u.current)||void 0===s||s.scrollIntoView()}}else if(t[B.kD]&&o<=Ee-2){var h=a[o+1];if(h){var m,g;X(h);var b="".concat(h.type,"s/").concat(h.uuid,".py");null===(m=c.current[b])||void 0===m||null===(g=m.current)||void 0===g||g.scrollIntoView()}}else(0,U.y)([B.Uq],t)?ee(!0):!r&&(0,U.y)([B.zH],t)?n({type:v.tf.SCRATCHPAD},o,X):!r&&(0,U.y)([B.Fv],t)&&n({type:v.tf.SCRATCHPAD},o+1,X)}else we&&t[B.Uq]&&X(we);r||i[0]!==B.OC||i[1]!==B.OC||A()}}),[n,r,c.current,a,y,Pe,Ee,T,A,L,F,we,Y,X,ee,ne]),(0,s.useEffect)((function(){var e=setInterval((function(){T&&L()}),1e4);return function(){clearInterval(e)}}),[T,L]),(0,s.useEffect)((function(){setTimeout((function(){return ue(!0)}),600)}),[I]);var Ne=(0,s.useCallback)((function(e){oe(!0),xe(e)}),[oe,xe]),Be=(0,s.useCallback)((function(){oe(!1),ke(!1),_e("")}),[]),Le=(0,s.useMemo)((function(){var e=[];return a.filter((function(e){var n=e.type;return!Pe||v.tf.TRANSFORMER===n})).forEach((function(r,u){var v,g=r.type,b=r.uuid,x=(null===F||void 0===F?void 0:F.uuid)===b,C=Se[b],T=C?0===C.priority?Mn.uF.BUSY:Mn.uF.QUEUED:Mn.uF.IDLE,A="".concat(g,"s/").concat(b,".py");c.current[A]=(0,s.createRef)();var D=!(null===j||void 0===j||!j[b]),M=u===Ee-1||Pe,B=c.current[A];v=D?(0,w.jsx)(O.Z,{mb:M?0:1,children:(0,w.jsx)(Br,{block:r,blocks:a,onClick:function(){return Q((function(e){return Co(Co({},e),{},(0,o.Z)({},b,!D))}))},ref:B})},b):(0,w.jsx)(br,{addNewBlock:function(e){return ee(!0),n(e,u+1,X)},addNewBlockMenuOpenIdx:pe,addWidget:t,allowCodeBlockShortcuts:i,autocompleteItems:l,block:r,blockIdx:u,blockRefs:c,blocks:a,dataProviders:d,defaultValue:r.content,deleteBlock:function(e){f(e),H(!1)},disableShortcuts:p,executionState:T,fetchFileTree:h,fetchPipeline:m,hideRunButton:Ie,interruptKernel:y,mainContainerRef:k,mainContainerWidth:Z,messages:_[b],noDivider:M,onCallbackChange:function(e){return S(g,b,e)},onChange:function(e){return E(g,b,e)},onClickAddSingleDBTModel:Ne,openSidekickView:P,pipeline:I,ref:B,runBlock:R,runningBlocks:N,savePipelineContent:L,selected:x,setAddNewBlockMenuOpenIdx:ve,setAnyInputFocused:H,setCreatingNewDBTModel:ke,setEditingBlock:z,setErrors:W,setOutputBlocks:q,setRecsWindowOpenBlockIdx:K,setSelected:function(e){return X(!0===e?r:null)},setSelectedOutputBlock:J,setTextareaFocused:ee,textareaFocused:x&&ne,widgets:te},b),e.push(v)})),e}),[n,pe,t,i,l,c,a,d,f,p,h,m,j,y,Pe,Ie,k,Z,_,Ee,S,E,Ne,P,I,R,N,Se,L,F,ve,H,z,W,Q,q,K,X,J,ee,ne,te]),Fe=(0,s.useMemo)((function(){return(0,w.jsx)(Oo,{addNewBlockAtIndex:n,blocks:a,codeBlocks:Le,fetchFileTree:h,fetchPipeline:m,fetchSampleData:g,globalVariables:x,onChangeCodeBlock:E,openSidekickView:P,pipeline:I,savePipelineContent:L,setErrors:W,setIntegrationStreams:V,setOutputBlocks:q,setSelectedBlock:X,setSelectedOutputBlock:J,setSelectedStream:$})}),[n,a,Le,h,m,g,x,E,P,I,L,W,V,q,X,J,$]),Ue=(0,s.useMemo)((function(){return(0,w.jsx)(gt,{addNewBlock:function(e){var t=a[a.length-1],i=null,r={},o=t?Wi(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=Co(Co({},(0,Ce.GL)(t.configuration,[li,ci,ui,ai,pi])),r))),v.t6.SQL===e.language&&(i=pt(i)),i=ht(e,i),n(Co(Co({},e),{},{configuration:r,content:i,upstream_blocks:o}),Ee,X),ee(!0)},hideCustom:Pe||Ie,hideDataExporter:Pe,hideDataLoader:Pe,hideDbt:Pe||Ie,hideRecommendations:Pe,hideScratchpad:Pe,hideSensor:Pe,onClickAddSingleDBTModel:Ne,pipeline:I,setCreatingNewDBTModel:ke,setRecsWindowOpenBlockIdx:K})}),[n,a,Pe,Ie,Ee,Ne,I,K,X,ee]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(gn,{children:se&&(0,w.jsx)(Nn.Z,{classNames:"pipeline-detail",in:ce,onEntered:function(){return setTimeout((function(){return de(!1)}),vn)},timeout:1,children:(0,w.jsx)(bn,{})})}),(0,w.jsxs)(O.Z,{mt:1,px:C.cd,children:[Pe&&Fe,!Pe&&(0,w.jsxs)(w.Fragment,{children:[Le,(0,w.jsx)(O.Z,{mt:C.cd,children:Ue})]}),re&&(0,w.jsx)(ln.Z,{onClickOutside:Be,open:!0,children:(0,w.jsx)(Pr,{blocks:a,creatingNewDBTModel:ye,dbtModelName:Oe,files:b,onClose:Be,onOpenFile:function(e){var t=e;if(ye){var i=(0,me.RA)(Oe||(0,me.Y6)());t="".concat(e).concat(he.sep).concat(i,".").concat(G.SQL)}var r={configuration:{file_path:t},language:v.t6.SQL,name:(0,me.wE)(t),type:v.tf.DBT};ye&&(r.content="--Docs: https://docs.mage.ai/dbt/sources\n");var o="undefined"===typeof be||null===be,l=a[o?a.length-1:be],c=l?Wi(l,r):[];n(Co(Co({},r),{},{upstream_blocks:c}),o?Ee:be+1,X),Be(),ee(!0)},setDbtModelName:_e})})]})]})},wo=t(28358),Eo=t(12344),Po=t(32063),Io=t(70543),To=t(24141);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 Ro(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 Do=function(e){var n=e.after,t=e.afterHeader,i=e.afterHeightOffset,r=e.afterHidden,o=e.afterNavigationItems,c=e.afterSubheader,u=e.before,a=e.beforeHeader,d=e.beforeHeightOffset,f=e.beforeNavigationItems,p=e.children,h=e.errors,m=e.headerOffset,v=e.mainContainerHeader,g=e.mainContainerRef,b=e.page,x=e.pipeline,j=e.setAfterHidden,y=e.setAfterWidthForChildren,k=e.setErrors,Z=e.setMainContainerWidth,O=(0,To.i)().width,_=(0,s.useState)((0,F.U2)(F.L8,hn.Zt)),C=_[0],S=_[1],E=(0,s.useState)((0,F.U2)(F.J3,hn.ve)),P=E[0],I=E[1],T=(0,s.useState)(!!(0,F.U2)(F.Uu)),A=T[0],R=T[1],D=(0,s.useState)(!1),M=D[0],N=D[1],B=(0,s.useState)(!1),L=B[0],U=B[1],H=r,z=j;if(!z){var G=(0,s.useState)(!!(0,F.U2)(F.zg)),W=(0,l.Z)(G,2);H=W[0],z=W[1]}(0,s.useEffect)((function(){null===g||void 0===g||!g.current||M||L||null===Z||void 0===Z||Z(g.current.getBoundingClientRect().width)}),[M,L,H,C,A,P,g,Z,O]),(0,s.useEffect)((function(){M||(null===y||void 0===y||y(C),(0,F.t8)(F.L8,C))}),[M,C,y]),(0,s.useEffect)((function(){L||(0,F.t8)(F.J3,P)}),[L,P]);var V=_e.ZP.projects.list({},{revalidateOnFocus:!1}).data,Q=null===V||void 0===V?void 0:V.projects,q=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return x&&(n.push.apply(n,[{bold:Io.b7!==b,label:function(){return null===x||void 0===x?void 0:x.uuid},linkProps:{as:"/pipelines/".concat(null===x||void 0===x?void 0:x.uuid),href:"/pipelines/[pipeline]"}}]),Io.b7===b&&n.push.apply(n,[{bold:!0,label:function(){return(0,me.kC)(b)}}])),(0,w.jsx)(Eo.Z,{breadcrumbs:n,project:null===Q||void 0===Q?void 0:Q[0],version:null===Q||void 0===Q||null===(e=Q[0])||void 0===e?void 0:e.version})}),[b,x,Q]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_n.Z,{title:null===x||void 0===x?void 0:x.name}),(0,w.jsx)(Po.Z,{after:n,afterHeader:t,afterHeightOffset:i,afterHidden:H,afterMousedownActive:M,afterNavigationItems:o,afterSubheader:c,afterWidth:C,before:u,beforeHeader:a,beforeHeightOffset:d,beforeHidden:A,beforeMousedownActive:L,beforeNavigationItems:f,beforeWidth:P,header:q,headerOffset:m,mainContainerHeader:v,mainContainerRef:g,setAfterHidden:z,setAfterMousedownActive:N,setAfterWidth:S,setBeforeHidden:R,setBeforeMousedownActive:U,setBeforeWidth:I,children:p}),h&&(0,w.jsx)(ln.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return k(null)},children:(0,w.jsx)(wo.Z,Ro(Ro({},h),{},{onClose:function(){return k(null)}}))})]})},Mo=t(41788),No=t(70001),Bo=t(26226),Lo=t(29989),Fo=t(53655),Uo=t(84181),Ho=t(31969),zo=t(2005);function Go(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 Wo(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Go(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Vo=g.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 Qo(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function qo(e,n){return Math.min.apply(Math,(0,r.Z)(e.map(n)))}var Yo=function(e){return e.bins},Ko=function(e){return e.count},Xo={top:0,left:0,right:0,bottom:0};function Jo(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)(g.ThemeContext)),a=(u.monotone||Ho.Z.monotone).grey300,d=(u.brand||Ho.Z.brand).wind400,f=(u.content||Ho.Z.content).default,p=(u.monotone||Ho.Z.monotone).white,h=Wo(Wo({},Xo),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=Qo(m,(function(e){return Qo(Yo(e),Ko)})),b=qo(m,(function(e){return qo(Yo(e),Ko)})),x=Qo(m,(function(e){return Yo(e).length})),j="undefined"!==typeof n?n:0,y="undefined"!==typeof l?l:b,k=(0,Uo.Z)({domain:[0,m.length]}),Z=(0,Uo.Z)({domain:[0,x]}),O=(0,Uo.Z)({range:[a,d],domain:[j,v]}),_=(0,Uo.Z)({range:[.1,1],domain:[j,v]}),C=(0,Uo.Z)({range:[a,d],domain:[y,j]}),S=(0,Uo.Z)({range:[1,.1],domain:[y,j]}),E=c-(h.left+h.right),P=i-(h.bottom+h.top),I=E/m.length,T=P/x;return k.range([0,E]),Z.range([P,0]),c<10?null:(0,w.jsx)(w.Fragment,{children:(0,w.jsx)("svg",{width:c,height:i,children:(0,w.jsx)(Lo.Z,{left:h.left,top:h.top,children:(0,w.jsx)(Fo.Z,{data:m,xScale:k,yScale:Z,colorScale:O,opacityScale:_,binWidth:I,binHeight:I,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=S(e.count),i=C(e.count)),(0,w.jsxs)("svg",{height:T,width:I,x:e.x,y:e.y-T,children:[(0,w.jsx)("rect",{className:"visx-heatmap-rect",fill:i,fillOpacity:t,height:T,width:I}),(0,w.jsx)("text",{alignmentBaseline:"middle",fill:e.count>=.8*v?p:f,fontFamily:zo.ry,fontSize:14,textAnchor:"middle",x:"50%",y:"50%",children:e.count})]},"heatmap-rect-".concat(e.row,"-").concat(e.column))}))}))}})})})})}var $o=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*C.iI,f=8*C.iI,p=0;return u&&(p+=d+1*C.iI),a&&(p+=f+1*C.iI),(0,w.jsxs)(w.Fragment,{children:[(l||c)&&(0,w.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,w.jsxs)(O.Z,{mb:{xs:1},children:[l&&(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:l})}),c&&(0,w.jsx)(k.Z,{children:c.map((function(e){var n=e.label,t=e.linkProps;return(0,w.jsx)(y.Z,{flex:"1",justifyContent:"center",children:t?(0,w.jsx)(Z.Z,{bold:!0,centerAlign:!0,minWidth:70,onClick:t.onClick,xsmall:!0,children:n}):(0,w.jsx)(_.ZP,{bold:!0,center:!0,minWidth:70,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})]})}),(0,w.jsxs)("div",{style:{height:i,display:"flex",width:"100%"},children:[u&&(0,w.jsx)("div",{style:{marginRight:1*C.iI,width:d},children:(0,w.jsx)(k.Z,{alignItems:"center",justifyContent:"center",children:(0,w.jsx)(Vo,{children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,xsmall:!0,children:u})})})}),a&&(0,w.jsx)("div",{style:{marginRight:1*C.iI},children:(0,w.jsx)(k.Z,{alignItems:"center",flexDirection:"column",fullHeight:!0,width:f,children:a.map((function(e){var n=e.label,t=e.linkProps;return(0,w.jsx)(y.Z,{alignItems:"center",flex:"1",children:t?(0,w.jsx)(Z.Z,{bold:!0,centerAlign:!0,onClick:t.onClick,xsmall:!0,children:n}):(0,w.jsx)(_.ZP,{bold:!0,center:!0,title:String(n),xsmall:!0,children:s(String(n))})},n)}))})}),(0,w.jsx)("div",{style:{height:i,width:"100%"},children:(0,w.jsx)(Bo.Z,{children:function(e){var i=e.width,l=e.height;return(0,w.jsx)(Jo,{countMidpoint:n,data:t,height:l,margin:r,minCount:o,width:i,yLabels:a})}})})]})]})},el=t(11754);var nl=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*C.cd*C.iI+mn.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,me.QV)(n)}));return o.splice(t,0,1),o})),xyLabels:n}}(c),s=a.heatmapData,d=a.xyLabels,f=function(e,n){return(0,ue.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,ue.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,ue.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,w.jsxs)(k.Z,{flexDirection:"column",children:[(null===f||void 0===f?void 0:f.length)>=1&&(0,w.jsx)(el.Z,{headerTitle:"Data completion",width:u,children:(0,w.jsx)(No.Z,{data:f.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*C.iI,50*C.iI),renderTooltipContent:function(e){var n=e.x;return"".concat((0,me.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,w.jsx)(el.Z,{headerTitle:"Number of unique values",width:u,children:(0,w.jsx)(No.Z,{data:p.map((function(e){var n=e.feature;return{x:e.value,y:n.uuid}})),height:Math.max(3*f.length*C.iI,50*C.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,w.jsx)(el.Z,{headerTitle:"Distribution of values",width:u,children:(0,w.jsx)(No.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*C.iI,50*C.iI),renderTooltipContent:function(e){var n=e.value,t=e.x;return"".concat(n," is ").concat((0,me.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,w.jsx)(el.Z,{headerTitle:"Correlations",children:(0,w.jsx)(O.Z,{p:1,children:(0,w.jsx)($o,{countMidpoint:0,data:s,height:8*C.iI*d.length,minCount:-1,xLabels:d,yLabels:d})})})]})},tl=t(92083),il=t.n(tl),rl=t(84969),ol=t(90948),ll=t(65743),cl=t(39048),ul=t(79487),al=t(61655),sl=t(16853),dl=t(65376),fl=t(52359),pl=t(48072),hl=t(24903),ml=t(98677),vl=t(73899);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 bl(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 xl={bottom:C.iI*(3+C.cd),left:C.iI*C.cd,right:C.iI*C.cd,top:C.iI*C.cd};function jl(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function yl(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)(g.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 b=o?Xr.iD:Xr.J5,x=bl(bl({},xl),c),j=n.slice(Math.max(0,n.length-50)),y=(0,s.useMemo)((function(){return Object.keys((null===j||void 0===j?void 0:j[0])||{}).filter((function(e){return e!==i}))}),[j,i]),k=(0,hl.Z)({domain:y,range:[vl.a$,vl.Ej,vl.hM,vl.ZA,vl.$R,vl.X_,vl.er,vl.hl,vl.nQ]}),Z=(0,s.useMemo)((function(){return j.map(m)}),[j,m]),O=(0,ml.Z)({domain:Z,padding:.1}),_=(0,ml.Z)({domain:y,padding:.1}),C=(0,Uo.Z)({domain:[0,jl(j,(function(e){return jl(y,(function(n){return Number(e[n])}))}))]}),S={active:(null===h||void 0===h?void 0:h.content.default)||Ae.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||Ae.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||Ae.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||Ae.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||Ae.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||Ae.Z.background.navigation},w=Z;a&&(w=j.reduce((function(e,n){return e.concat(y.map((function(e){var t=n[e];return(0,me.HW)(t)?parseInt(String(t)):t})))}),[]));var E=Math.min(Math.max.apply(Math,(0,r.Z)(w.map((function(e){return String(e).length})))),20);x.left+=7*E;var P=f-(x.left+x.right),I=t-(x.top+x.bottom);a?(O.rangeRound([0,P]),C.rangeRound([I,0])):(O.rangeRound([I,0]),C.rangeRound([0,P])),_.rangeRound([0,O.bandwidth()]);var T=j.map(m).length,A=0;a||(A=O(w[T-1]));var R=(0,s.useCallback)((function(e){var n=(0,pl.Z)(e)||{x:0,y:0},t=n.x,i=n.y,r=t-x.left,o=i-x.top,l=0;l=a?(r-A/2)/(P-A):1-(o-A/2)/(I-A);var c=Math.floor(l*T),u=j[c];"undefined"===typeof u&&(u=j[c-1]),a?r>A&&r<P+x.left-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>A&&o<I-A&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[j,T,x.left,x.top,a,d,A,P,I]);return{colorScale:k,colors:S,data:j,fontSize:b,handleTooltip:R,margin:x,tempScale:C,tickValues:w,xKeys:y,xMax:P,y1Scale:_,yLabelFormat:v,yMax:I,yScale:O,ySerialize:m}}var kl=["height","width","xAxisLabel","yAxisLabel"];function Zl(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 Ol(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Zl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}C.iI,C.iI,C.iI;var _l=(0,al.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=yl({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,S=y.handleTooltip,E=y.margin,P=y.tempScale,I=y.tickValues,T=y.xKeys,A=y.xMax,R=y.y1Scale,D=y.yLabelFormat,M=y.yMax,N=y.yScale,B=y.ySerialize;return g<10?null:(0,w.jsxs)("div",{children:[(0,w.jsxs)("svg",{height:t,width:g,children:[s&&!(null!==O&&void 0!==O&&O.length)&&(0,w.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:zo.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,w.jsx)(ll.Z,{fill:"transparent",height:t-(E.top+E.bottom),onMouseLeave:function(){return i()},onMouseMove:S,onTouchMove:S,onTouchStart:S,rx:14,width:g-(E.left+E.right),x:E.left,y:E.top}),(null===O||void 0===O?void 0:O.length)&&(0,w.jsxs)(Lo.Z,{left:E.left,top:E.top,children:[(0,w.jsx)(cl.Z,{color:k,data:O,keys:T,width:A,xScale:P,y0:B,y0Scale:N,y1Scale:R,children:function(e){return e.map((function(e){return(0,w.jsx)(Lo.Z,{top:e.y0,children:e.bars.map((function(n){return(0,w.jsx)("g",{children:(0,w.jsx)(w.Fragment,{children:(0,w.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,w.jsx)(rl.Z,{hideTicks:!0,scale:N,stroke:Z.muted,tickFormat:function(e){return D(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:zo.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:I,top:2}),(0,w.jsx)(ol.Z,{label:b,labelProps:{fill:Z.muted,fontFamily:zo.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:P,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:zo.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:M})]}),p&&(0,w.jsx)("g",{children:(0,w.jsx)(ul.Z,{from:{x:E.left,y:v},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:A+E.left,y:v}})})]}),m&&p&&(0,w.jsxs)(sl.Z,{left:h,style:Ol(Ol({},dl.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,me.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,w.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})}));var Cl=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,Q.Z)(e,kl);return n="undefined"===typeof i?"100%":o?0===i?i:i-28:i,(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{style:{display:"flex",height:t,marginBottom:r?C.iI:null,width:"100%"},children:[o&&(0,w.jsx)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(fl.Z,{children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,w.jsx)("div",{style:{height:t,width:n},children:(0,w.jsx)(Bo.Z,{children:function(e){var n=e.width,t=e.height;return(0,w.jsx)(_l,Ol(Ol({},l),{},{height:t,width:n}))}})})]}),r&&(0,w.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},Sl=t(95422),wl=["keyForYData"],El=["height","width","xAxisLabel","yAxisLabel"];function Pl(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 Il(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Pl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Tl=(0,al.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,Q.Z)(e,wl),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=yl(Il(Il({},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),S=(g.xMax,g.y1Scale),E=g.yLabelFormat,P=g.yMax,I=g.yScale,T=g.ySerialize;return p<10?null:(0,w.jsxs)("div",{children:[(0,w.jsxs)("svg",{height:r,width:p,children:[c&&!(null!==j&&void 0!==j&&j.length)&&(0,w.jsx)("text",{fill:x.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:zo.ry,fontSize:y,x:"50%",y:"50%",children:c()}),(null===j||void 0===j?void 0:j.length)&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ll.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,w.jsxs)(Lo.Z,{top:Z.top,children:[(0,w.jsx)(Sl.Z,{color:b,data:j,height:P,keys:C,x0:T,x0Scale:I,x1Scale:S,yScale:O,children:function(e){return e.map((function(e){return(0,w.jsx)(Lo.Z,{left:e.x0+Z.left,top:Z.top,children:e.bars.map((function(n){return(0,w.jsx)("g",{children:(0,w.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,w.jsx)(rl.Z,{left:Z.left,numTicks:v,scale:O,stroke:x.muted,tickFormat:function(e){return E(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:zo.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,w.jsx)(ol.Z,{hideTicks:!0,left:Z.left,numTicks:m,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:zo.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:P+Z.top})]})]}),a&&(0,w.jsx)("g",{children:(0,w.jsx)(ul.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:P+2*Z.top}})})]}),d&&a&&(0,w.jsxs)(sl.Z,{left:s,style:Il(Il({},dl.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,me.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,w.jsxs)(_.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,w.jsx)("br",{}),(0,w.jsxs)(_.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var Al=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,Q.Z)(e,El);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?C.iI:null,width:"100%"},children:[r&&(0,w.jsx)(k.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(fl.Z,{children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:r})})}),(0,w.jsx)("div",{style:{height:n,width:r?0===t?t:t-28:t},children:(0,w.jsx)(Bo.Z,{children:function(e){var n=e.height,t=e.width;return(0,w.jsx)(Tl,Il(Il({},o),{},{height:n,width:t}))}})})]}),i&&(0,w.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,w.jsx)(_.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},Rl=t(66872),Dl=t(68735),Ml=t(320),Nl=40*C.iI,Bl=g.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],Re.n_,.5*C.iI,.5*C.iI,1*C.iI,(function(e){return"\n background-color: ".concat((e.theme.background||Ae.Z.background).chartBlock,";\n ")})),Ll=g.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*C.iI,1*C.iI),Fl=g.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],C.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||Ae.Z.background).codeTextarea,";\n ")})),Ul=g.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],C.cd*C.iI,C.iI,C.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||Ae.Z.borders).medium,";\n ")}));function Hl(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?Hl(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Hl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Gl=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||Nl,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=Rn.n1,v=u.time_interval;if([yi.HOUR,yi.MINUTE,yi.SECOND].includes(v)&&(m=Rn.OC),Wt.BAR_CHART===d||Wt.TIME_SERIES_BAR_CHART===d){var g=i.x,b=i.y,x=Wt.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(ri);var Z=h[0],O=g.map((function(e,n){return zl({__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:zl(zl({},e),{},(0,o.Z)({},t,l))}),{}))}));ji.ASCENDING===f?O=(0,ue.YC)(O,(function(e){return e[Z]}),{ascending:!1}):ji.DESCENDING===f&&(O=(0,ue.YC)(O,(function(e){return e[Z]}),{ascending:!0}));var S={data:O,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return gi.HORIZONTAL===s?(0,w.jsx)(Cl,zl(zl({},S),{},{xAxisLabel:k||u.y,yAxisLabel:y||u.x})):(0,w.jsx)(Al,zl(zl({},S),{},{xAxisLabel:y,xLabelFormat:function(e){return x?il()(1e3*e).format(Rn.n1):e},xNumTicks:O.length,yAxisLabel:k,yNumTicks:5}))}}else if(Wt.HISTOGRAM===d){var E,P=i.x,I=i.y,T=null===(E=u.group_by)||void 0===E?void 0:E.join(", ");if(P&&I&&Array.isArray(P))return(0,w.jsx)(Rl.Z,{data:P.map((function(e,n){var t,i=e.max,r=e.min;return[i,null===I||void 0===I||null===(t=I[n])||void 0===t?void 0:t.value,r]})),height:p,width:r,large:!0,margin:{left:5*C.iI,right:1*C.iI,top:3*C.iI},noPadding:!0,renderTooltipContent:function(e){var n=(0,l.Z)(e,3),t=n[0],i=n[1],r=n[2];return(0,w.jsxs)(_.ZP,{inverted:!0,monospace:!0,small:!0,children:["Count : ",i,(0,w.jsx)("br",{}),"Bucket: ",r,"-",t]})},showAxisLabels:!0,showYAxisLabels:!0,showZeroes:!0,sortData:function(e){return(0,ue.YC)(e,"[0]")},xAxisLabel:T||u.x,yAxisLabel:T?"count(".concat(T,")"):u.y})}else if(Wt.LINE_CHART===d||Wt.TIME_SERIES_LINE_CHART===d){var A=i.x,R=i.y,D=Wt.TIME_SERIES_LINE_CHART===d;if(A&&R&&Array.isArray(A)&&Array.isArray(R)&&Array.isArray(null===R||void 0===R?void 0:R[0])){var M,N=h;u.legend_labels&&(N=u.legend_labels.split(",").map((function(e){return e.trim()})));var B=A.map((function(e,n){return{x:e,y:(0,ue.w6)(R.length).map((function(e,t){var i=R[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(M=u.group_by)||void 0===M?void 0:M.join(", "),F=h.join(", ");return(0,w.jsx)(Dl.Z,{data:B,height:p,lineLegendNames:N,margin:{bottom:8*C.iI,left:5*C.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(", ")),D&&(i=il()(1e3*n).format(m)),(0,w.jsxs)(_.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,w.jsxs)(_.ZP,{inverted:!0,small:!0,children:[N&&N[n]&&"".concat(N[n],": "),t&&(0,me.x6)((0,me.QV)(t[n],4))]})},width:r?r-3*C.iI:r,xAxisLabel:L||String(u.x),xLabelFormat:function(e){return D?il()(1e3*e).format(Rn.n1):e},yAxisLabel:F||String(u.y),yLabelFormat:function(e){return e}})}}else if(Wt.PIE_CHART===d){var U,H=i[String(u.x)],z=null===(U=u.group_by)||void 0===U?void 0:U.join(", ");if(H)return(0,w.jsx)(Ml.Z,{data:Object.entries(H),getX:function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];return"".concat(t," (").concat((0,me.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:z||String(u.x)})}else if(Wt.TABLE===d){var G=i.index,W=i.x,V=i.y;return Array.isArray(W)&&Array.isArray(V)&&Array.isArray(V[0])&&(0,w.jsx)(yt.Z,{columns:W,index:G,height:u.height?null:p,maxHeight:u.height?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:V,width:r})}return(0,w.jsx)("div",{})},Wl=t(76096);var Vl=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,w.jsx)(k.Z,{children:s.Children.map(n,(function(e,n){return(0,w.jsx)(O.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 Ql(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 ql(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ql(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ql(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Yl(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,b=e.fetchPipeline,x=e.fetchFileTree,j=e.messages,E=void 0===j?[]:j,P=e.onChangeContent,I=e.pipeline,T=e.runBlock,A=e.runningBlocks,D=e.savePipelineContent,M=e.selected,L=e.setAnyInputFocused,F=e.setSelectedBlock,U=e.setTextareaFocused,H=e.textareaFocused,z=e.updateWidget,G=e.width,W=(0,s.useRef)(null),V=(0,s.useContext)(g.ThemeContext),Q=_e.ZP.blocks.pipelines.detail(null===I||void 0===I?void 0:I.uuid,null===a||void 0===a?void 0:a.upstream_blocks[0]).data,q=(null===Q||void 0===Q||null===(t=Q.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],Y=(0,s.useState)(null),K=Y[0],X=Y[1],J=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),$=J[0],ee=J[1],ne=(0,s.useState)(a.configuration),te=ne[0],ie=ne[1],re=(0,s.useState)(a.content),oe=re[0],ce=re[1],ae=(0,s.useState)(!$||0===q.length),se=ae[0],de=ae[1],fe=(0,s.useState)(!1),pe=fe[0],he=fe[1],ve=(0,s.useState)(null),ge=ve[0],be=ve[1],xe=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),je=xe[0],ye=xe[1],ke=(0,s.useState)((null===q||void 0===q?void 0:q.length)||0),Ze=ke[0],Oe=ke[1],we=(0,s.useState)(a.uuid),Ee=we[0],Pe=we[1],Ie=Ii[$],Te=Ti[$],Re=(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]),De=(0,s.useMemo)((function(){return(0,ue.HK)(Re,(function(e){return e.uuid}))}),[Re]),Me=!!A.find((function(e){return e.uuid===a.uuid}))||(null===E||void 0===E?void 0:E.length)>=1&&m!==Mn.uF.IDLE,Ne=(0,s.useMemo)((function(){return null===E||void 0===E?void 0:E.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[E]),Be=!!Ne.find((function(e){return e.error})),Le=Ne.length>=1,Fe=(0,s.useMemo)((function(){return{blockType:a.type,hasError:Be,selected:M}}),[a.type,Be,M]);if(null!==Ne&&void 0!==Ne&&Ne.length){var Ue,He,ze=Ne.length-1;c=null===Ne||void 0===Ne||null===(Ue=Ne[ze])||void 0===Ue||null===(He=Ue.data)||void 0===He?void 0:He[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,me.Pb)(c)&&(r=JSON.parse(c))):(null===q||void 0===q?void 0:q.length)>=1&&(r={},q.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;Mn.Gi.TEXT===i&&(0,me.Pb)(t)&&(r[o]=JSON.parse(t))})));var Ge=(0,s.useCallback)((function(e){var n=ql(ql(ql({},a),e),{},{configuration:ql(ql({},a.configuration),e.configuration)});D().then((function(){T({block:n,code:oe,ignoreAlreadyRunning:!0,runUpstream:!!je.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=De[e])||void 0===n?void 0:n.status)}))})})),Oe((function(e){return e+1}))}),[a,De,oe,Oe,je]),We=(0,s.useCallback)((function(e){ce(e),P(e)}),[P,ce]),Ve=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;ie((function(n){return ql(ql({},n),e)}));var i=ql(ql({},a),{},{configuration:ql(ql(ql({},te),e),{},{chart_type:$})});z(i);Object.keys(e);Ze&&t&&Ge(i)}),[a,$,te,Ze,Ge,ie,z]);(0,s.useEffect)((function(){X({python:ar({autocompleteItems:u,block:a,blocks:p,pipeline:I})})}),[u,a,p,I]);var Qe=(0,s.useMemo)((function(){return(0,w.jsx)($e.Z,{autoHeight:!0,autocompleteProviders:K,onChange:We,selected:M,setSelected:function(e){return F(!0===e?a:null)},setTextareaFocused:U,showLineNumbers:!1,textareaFocused:H||Wt.TABLE===$&&!se,value:oe,width:"100%"})}),[K,$,oe,se,M,F,U,H,We]),qe=(0,s.useMemo)((function(){return Be&&Le&&(0,w.jsx)(Vt,ql(ql({},Fe),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:Me,messages:Ne,selected:M}))}),[a,Fe,Be,Le,Me,Ne,M]),Ye=(0,Zt.Z)(se),Ke=(0,Zt.Z)(G);(0,s.useEffect)((function(){var e,n=null===W||void 0===W||null===(e=W.current)||void 0===e?void 0:e.getBoundingClientRect();Ye!==se||Ke!==G?(be(0),setTimeout((function(){var e,n,t=null===W||void 0===W||null===(e=W.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&be(t)}),100)):n&&be(n.width)}),[se,Ye,W.current,be,G,Ke]);var Xe=(0,s.useMemo)((function(){var e=[];return je.forEach((function(n,t){var i=De[n],r=(0,S.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:V}).accent;e.push((0,w.jsxs)(O.Z,{ml:2,children:[(0,w.jsxs)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.jsx)(Z.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,w.jsx)(_.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[De,je]),Je=(0,s.useMemo)((function(){var e,n=[],t=null===Ie||void 0===Ie||null===(e=Ie.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return vi.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=te[e];if(i){var r,o,l=null===(r=Ai[$])||void 0===r||null===(o=r[e])||void 0===o?void 0:o.call(r);n.push((0,w.jsxs)(O.Z,{ml:2,children:[(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:i})," ",l&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.jsx)(_.ZP,{default:!0,inline:!0,small:!0,children:l})]})]},i))}})),n}),[te,Ie]),nn=(0,Zt.Z)($),tn=(0,Zt.Z)(je);(0,s.useEffect)((function(){if((!nn&&$&&null!==je&&void 0!==je&&je.length||(null===tn||void 0===tn||!tn.length)&&(null===je||void 0===je?void 0:je.length)>=1&&$)&&!oe&&(0,Ce.Qr)(te)&&Te){var e=ql(ql({},a),{},{upstream_blocks:je});Te.configuration&&Ve(Te.configuration(e)),Te.content&&We(Te.content(e))}}),[a,$,nn,te,oe,Ve,We,je,tn]);var rn=(0,s.useMemo)((function(){return te.width_percentage||1}),[te]),on=(0,s.useMemo)((function(){return Object.entries(Ie||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return ql(ql({},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,me.kC)(i()),monospace:r,onBlur:function(){return F(a)},onChange:function(e){return Ve((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return F(a)},value:(null===te||void 0===te?void 0:te[d])||""},p=(null!==Q&&void 0!==Q&&Q.block?[Q.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(wi.COLUMNS===s){var h=te[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,w.jsxs)(tr.Z,ql(ql({},f),{},{onChange:function(e){var n=te[d]||[],i=e.target.value;n.includes(i)?n=(0,ue.Od)(n,(function(e){return e===i})):n.push(i),Ve((0,o.Z)({},d,n),{autoRun:t})},value:null,children:[(0,w.jsx)("option",{value:""}),(0,ue.YC)(p.filter((function(e){return!h.includes(e)})),(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]})),h.map((function(e){return(0,w.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,w.jsx)($r,{label:e,onClick:function(){Ve((0,o.Z)({},d,(0,ue.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(wi.METRICS===s){var m=te[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_.ZP,{bold:!0,children:"Metrics"}),(0,w.jsx)(_.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,w.jsxs)(Vl,{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]}))||(Ve((0,o.Z)({},d,m.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,w.jsxs)(tr.Z,ql(ql({},f),{},{label:"aggregation",children:[(0,w.jsx)("option",{value:""}),(0,ue.YC)(Ei,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]})),(0,w.jsxs)(tr.Z,ql(ql({},f),{},{label:"column",children:[(0,w.jsx)("option",{value:""}),(0,ue.YC)(p,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}))]}),m.map((function(e){var n=e.aggregation,i=e.column;return(0,w.jsx)("div",{style:{display:"inline-block",marginRight:2,marginTop:2},children:(0,w.jsx)($r,{label:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){Ve((0,o.Z)({},d,(0,ue.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,w.jsx)(tr.Z,ql(ql({},f),{},{children:l.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})):(0,w.jsx)(N.Z,ql(ql({},f),{},{type:s}));return(0,w.jsx)(O.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[De,te,Ie,q,F,Ve,je]),ln=on.code,cn=on.noCode,un=(0,d.Db)(_e.ZP.widgets.pipelines.useUpdate(null===I||void 0===I?void 0:I.uuid,a.uuid),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){he(!1),b(),x()},onErrorCallback:function(e){var n=e.error,t=n.errors,i=n.message;console.log(t,i)}})},onError:function(e){(0,Se.qQ)(e).messages}}),an=(0,l.Z)(un,1)[0],sn="ChartBlock/".concat(a.uuid),dn=(0,en.y)(),fn=dn.registerOnKeyDown,hn=dn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){hn(sn)}}),[hn,sn]),fn(sn,(function(e,n,t){pe&&String(t[0])===String(B.Uq)&&String(t[1])!==String(B.zX)&&an({widget:ql(ql({},a),{},{name:Ee})})}),[a,pe,Ee,an]),(0,w.jsx)(Wl.Z,{sm:12,md:12*rn,children:(0,w.jsxs)(Bl,{ref:n,children:[(0,w.jsx)(O.Z,{mt:1,pt:1,px:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{flex:1,style:{position:"relative"},children:[(0,w.jsx)(An,{bold:!1,fullWidth:!0,inputValue:Ee,notRequired:!0,onBlur:function(){return setTimeout((function(){return he(!1)}),300)},onChange:function(e){Pe(e.target.value),e.preventDefault()},onClick:function(){L(!0),he(!0)},onFocus:function(){L(!0),he(!0)},small:!0,stacked:!0,value:!pe&&a.uuid}),pe&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(Z.Z,{noWrapping:!0,onClick:function(){return an({widget:ql(ql({},a),{},{name:Ee})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(tr.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=ql(ql({},a),{},{upstream_blocks:n});z(t),Ge(t),ye(n)},placeholder:"Source block",small:!0,value:(null===je||void 0===je?void 0:je[0])||"",children:null===Re||void 0===Re?void 0:Re.map((function(e){var n=e.uuid;return(0,w.jsx)("option",{value:n,children:n},n)}))}),(0,w.jsx)(O.Z,{mr:1}),!Me&&(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,w.jsx)(R.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return Ge(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,w.jsx)(le.Py,{size:2*C.iI})})}),Mn.uF.QUEUED===m&&(0,w.jsx)(Hi.Z,{color:(V||Ae.Z).content.active,small:!0,type:"cylon"}),Mn.uF.BUSY===m&&(0,w.jsx)(Hi.Z,{color:(V||Ae.Z).content.active,small:!0}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,w.jsx)(R.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return de((function(e){return!e}))},selected:se,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,w.jsx)(le.I8,{size:2*C.iI})})}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(pn.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,w.jsx)(R.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,w.jsx)(le.rF,{size:2*C.iI})})})]})]})}),(0,w.jsx)(O.Z,{mt:1}),(0,w.jsxs)(k.Z,{justifyContent:"space-between",fullWidth:!0,children:[(0,w.jsx)(y.Z,{flex:6,ref:W,children:r&&!(0,Ce.Qr)(r)&&(0,w.jsx)(O.Z,{pb:3,children:(0,w.jsx)(Gl,{block:ql(ql({},a),{},{configuration:ql(ql({},a.configuration),te)}),data:r,width:ge})})}),se&&(0,w.jsx)(Ll,{children:(0,w.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsx)(tr.Z,{onChange:function(e){var n=e.target.value,t=ql(ql({},a),{},{configuration:ql(ql({},te),{},{chart_type:n})});z(t),Ge(t),ee(n)},placeholder:"Select chart type",value:$,children:xi.map((function(e){return(0,w.jsx)("option",{value:e,children:(0,me.kC)(e)},e)}))})}),(0,w.jsx)(O.Z,{mb:1,children:(0,w.jsx)(tr.Z,{onChange:function(e){return Ve((0,o.Z)({},ti,e.target.value))},placeholder:"Chart width",value:(null===te||void 0===te?void 0:te.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,w.jsx)("option",{value:i,children:t},t)}))})}),cn]})})]}),se&&!(null===ln||void 0===ln||!ln.length)&&v.t6.SQL!==a.language&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(O.Z,{my:1,px:1,children:[(0,w.jsx)(_.ZP,{bold:!0,children:"Custom chart code"}),(0,w.jsxs)(_.ZP,{muted:!0,children:["Write custom logic mapping data to input values for your chart.",(0,w.jsx)("br",{}),"This code is only executed if you don\u2019t have any columns or metrics selected."]})]}),(0,w.jsxs)(Fl,{children:[je.length>=1&&(0,w.jsxs)(Ul,{children:[(0,w.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",Xe]}),(0,w.jsxs)(_.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",Je]})]}),Qe]})]}),qe&&(0,w.jsx)(O.Z,{px:1,children:qe})]})})}var Kl=s.forwardRef(Yl),Xl=t(97361),Jl=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function $l(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 ec(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$l(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var nc,tc=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,x=e.width,j=(0,Q.Z)(e,Jl),y=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return ec(ec({},e),{},(0,o.Z)({},n.uuid,ec(ec({},n),{},{priority:t})))}),{})}),[a]);return(0,w.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(Xl.Z,{fullHeight:!0,style:{marginLeft:.5*C.iI,marginRight:.5*C.iI},children:null===b||void 0===b?void 0:b.map((function(e){var o=e.uuid,b=y[o],k=b?0===b.priority?Mn.uF.BUSY:Mn.uF.QUEUED:Mn.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(Kl,ec(ec({},j),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:k,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:x}))}))}),(0,w.jsx)("div",{style:{height:"80vh"}})]})},ic=g.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),rc=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,w.jsxs)(ic,{height:t*(305/358),viewBox:r,width:t,children:[(0,w.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,w.jsx)("path",{fill:"#000",d:"M118 46h1v216h-1zM178 46h1v216h-1zM238 46h1v216h-1z"}),(0,w.jsx)("path",{fill:"#000",d:"M59 208.25v-1h239v1zM59 154.5v-1h239v1zM59 100.75v-1h239v1z"}),(0,w.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,w.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,w.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,w.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,w.jsx)("circle",{cx:"55.2178",cy:"34.6274",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"113.818",cy:"106.582",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"84.2832",cy:"80.6953",r:"5.2954",fill:"#8ADE00"}),(0,w.jsx)("circle",{cx:"117.115",cy:"43.6274",r:"5.2954",fill:"#8ADE00"}),(0,w.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,w.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,w.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,w.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,w.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,w.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,w.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,w.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 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}!function(e){e.GREAT_EXPECTATIONS="great_expectations"}(nc||(nc={}));var cc=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)(g.ThemeContext),p=(0,s.useState)(""),h=p[0],m=p[1],Z=(0,s.useState)(!1),E=Z[0],P=Z[1],I=(0,s.useState)(null),A=I[0],R=I[1],D=(0,s.useMemo)((function(){return(0,ue.HK)(r,(function(e){return e.uuid}))}),[r]);(0,s.useEffect)((function(){A||R((0,ue.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,A]);var M=(0,d.Db)((function(e){var n=e.upstream_blocks;return _e.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,Se.wD)(e,{callback:function(){null===o||void 0===o||o(),P(!1)},onErrorCallback:function(e,n){return null===a||void 0===a?void 0:a({errors:n,response:e})}})}}),B=(0,l.Z)(M,2),L=B[0],F=B[1].isLoading,U=(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]),H=(0,s.useMemo)((function(){var e=[];return null===U||void 0===U||U.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,S.qn)(o,{blockColor:i,theme:f}).accent;t>=1&&e.push((0,w.jsx)(j.Z,{light:!0},"divider-".concat(l)));var u=!(null===A||void 0===A||!A[l]),a=![v.t6.PYTHON].includes(r);e.push((0,w.jsx)(O.Z,{px:2,py:1,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(x.Z,{color:c,size:1.5*C.iI,square:!0}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(_.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,w.jsxs)(_.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:[r," support coming soon"]}),!a&&(0,w.jsx)(b.Z,{checked:!a&&u,disabled:a,onClick:function(){R((function(e){var n=lc({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[U,f,A]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(ln.Z,{onClickOutside:function(){return P(!1)},open:!0,children:[(0,w.jsx)(N.Z,{beforeIcon:(0,w.jsx)(le.HN,{}),borderless:!0,compact:!0,onChange:function(e){return m(e.target.value)},onClick:function(e){(0,pr.j)(e),P(!0)},onFocus:function(e){(0,pr.j)(e),P(!0)},placeholder:"Select blocks to run expectations on",small:!0,value:h}),E&&(0,w.jsxs)(w.Fragment,{children:[H,(0,w.jsx)(O.Z,{mx:1,children:(0,w.jsx)(k.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{compact:!0,loading:F,onClick:function(){L({upstream_blocks:Object.keys(A)})},small:!0,children:"Save selected blocks"})})})]})]}),!E&&(null===i||void 0===i||null===(n=i.upstream_blocks)||void 0===n?void 0:n.length)>=1&&(0,w.jsxs)(O.Z,{pb:1,pr:1,children:[(0,w.jsx)(O.Z,{mt:1,pl:1,children:(0,w.jsx)(_.ZP,{muted:!0,small:!0,children:"Click a block name below to run expectations on it."})}),(0,w.jsx)(k.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===D||void 0===D?void 0:D[e];if(!n)return(0,w.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,S.qn)(r,{blockColor:t,theme:f}).accent;return(0,w.jsx)(O.Z,{ml:1,mt:1,children:(0,w.jsx)(T.Z,{backgroundColor:o,compact:!0,disabled:!u,onClick:function(){null===u||void 0===u||u({block:lc(lc({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,w.jsx)(_.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})};function uc(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?uc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):uc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var sc=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,j=e.savePipelineContent,y=e.selectedBlock,k=e.setAnyInputFocused,S=e.setErrors,E=e.setSelectedBlock,P=e.setTextareaFocused,I=e.textareaFocused,T=(0,s.useRef)(null),A=(0,s.useState)(!1),D=A[0],M=A[1],N=(u||{}).uuid,L=(g||{}).extensions,F=(0,s.useMemo)((function(){return(null===u||void 0===u?void 0:u.templates)||[]}),[u]),H=(0,s.useMemo)((function(){return null===L||void 0===L?void 0:L[N]}),[N,L]),z=(0,s.useMemo)((function(){return(null===H||void 0===H?void 0:H.blocks)||[]}),[H]),G=(0,s.useMemo)((function(){return(0,ue.HK)(z,(function(e){return e.uuid}))}),[z]),W=(0,s.useMemo)((function(){return N===(null===y||void 0===y?void 0:y.extension_uuid)&&G[null===y||void 0===y?void 0:y.uuid]}),[G,N,y]),V=(0,s.useMemo)((function(){return x.reduce((function(e,n,t){return ac(ac({},e),{},(0,o.Z)({},n.uuid,ac(ac({},n),{},{priority:t})))}),{})}),[x]),Q=(0,s.useMemo)((function(){return z.map((function(e,n){var o=ac(ac({},e),{},{extension_uuid:N}),u=o.type,v=o.uuid,Z=(null===y||void 0===y?void 0:y.uuid)===v,_=V[v],T=_?0===_.priority?Mn.uF.BUSY:Mn.uF.QUEUED:Mn.uF.IDLE,A="".concat(u,"s/").concat(v,".py");return i.current[A]=(0,s.createRef)(),(0,w.jsx)(O.Z,{mt:C.cd,children:(0,w.jsx)(br,{autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){c(ac(ac({},e),{},{extension_uuid:N})),k(!1)},executionState:T,extraContent:(0,w.jsx)(cc,{block:o,blocks:l,onUpdateCallback:d,pipeline:g,setErrors:S}),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[A],runBlock:b,runningBlocks:x,savePipelineContent:j,selected:Z,setAnyInputFocused:k,setErrors:S,setSelected:function(e){return E(!0===e?o:null)},setTextareaFocused:P,textareaFocused:Z&&I})},v)}))}),[t,i,r,l,c,z,N,a,d,f,p,h,m,g,b,x,V,j,y,k,S,E,P,I]),q="Extensions/GreatExpectations/index",Y=(0,en.y)(),K=Y.disableGlobalKeyboardShortcuts,X=Y.registerOnKeyDown,J=Y.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){J(q)}}),[J,q]),X(q,(function(e,n){!K&&W&&((0,U.y)([B.zX,B.Um],n)||(0,U.y)([B.PQ,B.Um],n))&&(e.preventDefault(),j())}),[W,j]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsx)(_.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.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,w.jsx)(Z.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsxs)(_.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,w.jsx)(Z.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),Q,(0,w.jsx)(O.Z,{mt:C.cd,children:(0,w.jsx)(ln.Z,{onClickOutside:function(){return M(!1)},open:!0,children:(0,w.jsx)(Wn.Z,{disableKeyboardShortcuts:!0,items:null===F||void 0===F?void 0:F.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===z||void 0===z?void 0:z.length)||0)},tooltip:function(){return t},uuid:e.uuid}})),onClickCallback:function(){return M(!1)},open:D,parentRef:T,uuid:"Extension",children:(0,w.jsx)(R.ZP,{beforeElement:(0,w.jsx)(qn,{teal:!0,children:(0,w.jsx)(le.mm,{size:Qn})}),inline:!0,onClick:function(e){e.preventDefault(),M(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},dc=t(59e3),fc=["pipeline"];function pc(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 hc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var mc=function(e){var n=e.pipeline,t=(0,Q.Z)(e,fc),i=(0,f.useRouter)(),r=_e.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,ue.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 hc(hc({},t),{},{pipeline:n})}),[n,t]);return(0,s.useEffect)((function(){var e;a(null===(e=(0,dc.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]),(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(O.Z,{p:C.cd,children:[!u&&(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsxs)(_.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,w.jsx)(Z.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,w.jsx)(O.Z,{mt:1,children:(0,w.jsxs)(_.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,w.jsx)(Hi.Z,{}),nc.GREAT_EXPECTATIONS===u&&n&&(0,w.jsx)(sc,hc(hc({},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,w.jsx)(Z.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,yn.u7)({extension:i},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(D.Z,{dark:!0,children:(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(po.Z,{fullWidth:!1,children:(0,w.jsx)(O.Z,{p:C.cd,children:(0,w.jsx)(k.Z,{alignItems:"center",children:(0,w.jsx)("img",{alt:t,height:3*C.iI,src:"/images/extensions/".concat(i,"/logo.png"),width:3*C.iI})})})}),(0,w.jsx)(O.Z,{mr:C.cd}),(0,w.jsxs)(y.Z,{flexDirection:"column",children:[(0,w.jsx)(_.ZP,{bold:!0,children:t}),(0,w.jsx)(_.ZP,{default:!0,small:!0,children:n})]})]}),(0,w.jsx)(le._Q,{})]})})},i)})))]})})},vc=t(88560),gc=(g.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-43nc8t-0"})(["border-radius:","px;",""],Re.TR,(function(e){return"\n border: 1px solid ".concat((e.theme.interactive||Ho.Z.interactive).defaultBorder,";\n ")})),g.default.div.withConfig({displayName:"indexstyle__ColumnProfileStyle",componentId:"sc-43nc8t-1"})(["",""],(function(e){return"\n background: ".concat((e.theme.background||Ho.Z.background).table,";\n border-bottom: 1px solid ").concat((e.theme.interactive||Ho.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||Ho.Z.interactive).defaultBorder,";\n ")}))),bc=(g.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-43nc8t-2"})(["background:",";padding:","px ","px;"," border-top-left-radius:","px;border-top-right-radius:","px;"],vl.Uq,1.75*C.iI,C.tr,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Ho.Z.interactive).defaultBorder,";\n ")}),Re.TR,Re.TR),g.default.div.withConfig({displayName:"indexstyle__FeatureProfileStyle",componentId:"sc-43nc8t-3"})(["",""],(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.interactive||Ho.Z.interactive).defaultBorder,";\n ")}))),xc=(g.default.div.withConfig({displayName:"indexstyle__BodyStyle",componentId:"sc-43nc8t-4"})(["border-bottom-left-radius:","px;border-bottom-right-radius:","px;overflow-y:scroll;"],Re.TR,Re.TR),g.default.div.withConfig({displayName:"indexstyle__CellStyle",componentId:"sc-43nc8t-5"})([""," padding:","px;"],(function(e){return e.backgroundColor&&"\n background-color: ".concat(e.backgroundColor,";\n ")}),C.iI)),jc=g.default.div.withConfig({displayName:"indexstyle__ScrollOverflowStyle",componentId:"sc-43nc8t-6"})([""," overflow-x:auto;"],mn.w5);function yc(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 kc=["Type","Missing","Unique","Min","Max","Mean","Median","Mode","Invalid","Outliers","Skewness","Std dev"],Zc={Missing:0,Invalid:0,Outliers:0,Unique:.9};function Oc(e){var n=e.columns,t=e.feature,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(g.ThemeContext),l=t.columnType,c=t.uuid,u=yc(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,b=u.max,x=u.max_character_count,j=u.max_word_count,S=u.min,E=u.min_character_count,P=u.min_word_count,I=u.median,T=u.mode,A=u.null_value_count,R=u.null_value_rate,D=u.outlier_count,M=u.skew,N=u.std,B=u.unique_value_rate,L=[l,A,h,S,b,a,I,T,m,D,M,N],F={Min:P,Max:j,Mean:f},U={Min:"".concat((0,me._6)("character",E)),Max:"".concat((0,me._6)("character",x)),Mean:"".concat((0,me._6)("character",(0,me.QV)(d)))},H={Invalid:(0,me.T3)(v),Missing:(0,me.T3)(R),Unique:(0,me.T3)(B)},z=Be.T5[l],G=[o.background.row,o.background.row2],W=G[0],V=G[1],Q=i?Z.Z:_.ZP;return(0,w.jsxs)(y.Z,{flexDirection:"column",children:[(0,w.jsx)(bc,{children:(0,w.jsx)(O.Z,{px:1,py:2,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[z&&(0,w.jsxs)(y.Z,{title:vc.Rp[l],children:[(0,w.jsx)(z,{size:2*C.iI}),"\xa0"]}),(0,w.jsx)(Q,{inline:!0,onClick:i?function(){return(0,yn.u7)({column:n.indexOf(c)},{pushHistory:!0})}:void 0,preventDefault:!0,secondary:!0,children:(0,w.jsx)(_.ZP,{bold:!0,default:!i,maxWidth:25*C.iI,monospace:!0,secondary:i,textOverflow:!0,title:c,children:c})})]})})}),L.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-",n=arguments.length>1?arguments[1]:void 0,t=kc[n],i=l===vc.RL.TEXT&&t in F,r=i?F[t]:e,o=isNaN(r)?r:(0,me.QV)(r),c=t in Zc&&o/p>Zc[t];return(0,w.jsx)(xc,{backgroundColor:n%2===0?W:V,children:(0,w.jsxs)(_.ZP,{bold:c,danger:c,default:!0,textOverflow:!0,title:i?U[t]:"",children:[i?"".concat((0,me._6)("word",o)):o,t in H&&" (".concat(H[t],")")]})},n)}))]})}var _c=function(e){var n=e.features,t=void 0===n?[]:n,i=e.shouldLink,r=e.statistics,o=(0,s.useContext)(g.ThemeContext),l=(0,s.useMemo)((function(){return t.map((function(e){return e.uuid}))}),[t]);return(0,w.jsx)(el.Z,{headerTitle:"Feature profiles",children:(0,w.jsxs)(k.Z,{children:[(0,w.jsx)(gc,{children:(0,w.jsxs)(y.Z,{flex:1,flexDirection:"column",style:{background:o.background.table},children:[(0,w.jsx)(O.Z,{mr:1.25*C.iI,mt:"".concat(53,"px")}),kc.map((function(e,n){return(0,w.jsx)(xc,{children:(0,w.jsx)(_.ZP,{default:!i,secondary:i,children:e})},"".concat(e,"-").concat(n))}))]})}),(0,w.jsx)(jc,{children:(0,w.jsx)(k.Z,{children:t.map((function(e,n){return(0,w.jsx)(bc,{children:(0,w.jsx)(Oc,{columns:l,feature:e,shouldLink:i,statistics:r})},"".concat(e,"-").concat(n))}))})})]})})};function Cc(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 Sc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Cc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var wc=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=_e.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]),g=(0,s.useState)(null),b=g[0],x=g[1],j=(0,s.useMemo)((function(){return null===v||void 0===v?void 0:v[b]}),[b,v]),Z=_e.ZP.file_contents.detail(j?encodeURIComponent(j.path):null).data,S=(0,s.useMemo)((function(){return null===Z||void 0===Z?void 0:Z.file_content}),[Z]),E=(0,s.useMemo)((function(){return Fe()}),[]),P=(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]),I=(0,d.Db)(_e.ZP.file_contents.useUpdate(i&&encodeURIComponent(i)),{onSuccess:function(e){return(0,Se.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(he.sep);if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join(he.sep);l="PipelineDetail/".concat(u)}}a((function(e){return Sc(Sc({},e),{},(0,o.Z)({},l,Number(new Date)))})),x((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return r({errors:n,response:e})}})}}),A=(0,l.Z)(I,2),R=A[0],D=A[1].isLoading,M=(0,s.useMemo)((function(){var e=v.map((function(e){var n=e.name,t=e.path;return[(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{flex:1,children:[(0,w.jsx)(_.ZP,{default:!0,monospace:!0,children:(0,Rn.JX)(n,{withSeconds:!0})}),(0,w.jsx)(O.Z,{px:2*C.cd,children:(0,w.jsx)(_.ZP,{monospace:!0,children:n})})]}),j&&(null===j||void 0===j?void 0:j.path)===t&&(0,w.jsx)(T.Z,{compact:!0,loading:D,onClick:function(e){(0,pr.j)(e),R({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(j){var n=(0,w.jsx)(O.Z,{p:C.cd,children:(0,w.jsx)(Hi.Z,{},"spinner")});if(S&&(null===S||void 0===S?void 0:S.path)===(null===j||void 0===j?void 0:j.path)){var t=S.content,i=void 0===t?"":t;n=(0,w.jsx)($e.Z,{autoHeight:!0,language:re[P],padding:!0,readOnly:!0,value:(0,me.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:c})}e=(0,ue.Hk)([n],b+1,e)}return e}),[S,P,v,D,j,b,R,c]);return(0,w.jsxs)("div",{style:{width:c},children:[(0,w.jsxs)(O.Z,{p:C.cd,children:[(0,w.jsx)(Ur.Z,{level:5,children:"File versions"}),(0,w.jsx)(_.ZP,{inline:!0,monospace:!0,children:i?decodeURIComponent(i):null===t||void 0===t?void 0:t.uuid})]}),(0,w.jsx)(Te.Z,{buildRowProps:function(e){if(j&&b+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===j||void 0===j?void 0:j.name)},onClickRow:function(e){j?e===b?x(null):e<b?x(e):e>b+1&&x(e-1):x(e)},rows:M})]})},Ec=t(21764),Pc=t(22673),Ic=t(1286),Tc=(C.iI,Ic.O$,C.iI,Xr.dN,g.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],hn.Wi,mn.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),g.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*C.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),g.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),Ac=g.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*C.iI,"px;\n ")})),Rc=t(19963);var Dc=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],j=(0,s.useState)(f),k=j[0],Z=j[1],O=(0,s.useState)(!1),S=O[0],E=O[1],P=(0,d.Db)(_e.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){E(!1),i()}})}}),I=(0,l.Z)(P,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&&E(!1)}),[b,k]);(0,s.useEffect)((function(){var e;S&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[S,p]);var A=n||"kwargs['".concat(a,"']");return(0,w.jsx)("div",{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},children:(0,w.jsxs)(Xl.Z,{children:[(0,w.jsx)(Wl.Z,{md:1,hiddenSmDown:!0,children:(0,w.jsx)(Ac,{noPadding:!0,children:(0,w.jsx)(R.ZP,{backgroundColor:Rc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(A),Ec.Am.success("Successfully copied to clipboard.",{position:Ec.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,w.jsx)(le.CK,{size:2.5*C.iI})})})}),(0,w.jsx)(Wl.Z,{md:4,children:S?(0,w.jsx)(Ac,{children:(0,w.jsx)(N.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,w.jsx)(Ac,{children:(0,w.jsx)(_.ZP,{color:vl.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,w.jsx)(Wl.Z,{md:7,children:S?(0,w.jsx)(Ac,{children:(0,w.jsx)(N.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,w.jsxs)(Ac,{children:[o?(0,w.jsx)(_.ZP,{monospace:!0,small:!0,children:"********"}):(0,w.jsx)(_.ZP,{monospace:!0,small:!0,children:f}),(0,w.jsxs)(y.Z,{children:[!r&&m&&(0,w.jsx)(R.ZP,{backgroundColor:Rc.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){E(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,w.jsx)(le.I8,{size:2.5*C.iI})}),t&&m&&(0,w.jsx)(R.ZP,{backgroundColor:Rc.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,w.jsx)(le.rF,{size:2.5*C.iI})})]})]})})]})})},Mc=t(93348),Nc=t(58122);var Bc=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],x=g[1],j=null===t||void 0===t?void 0:t.uuid,y=(0,d.Db)(_e.ZP.variables.pipelines.useCreate(j),{onSuccess:function(e){return(0,Se.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}))}})}}),S=(0,l.Z)(y,1)[0],E=(0,d.Db)((function(e){return _e.ZP.variables.pipelines.useDelete(j,e)()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),P=(0,l.Z)(E,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=b;try{t=JSON.parse(b)}catch(i){}S({variable:{name:h,value:t}}).then((function(){n(),m(null),x(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[S,n,h,b]),T=(0,s.useMemo)((function(){return c-4*C.iI}),[c]),A=(0,s.useMemo)((function(){return(0,Nc.wx)(o,(function(e){return"global"===e.uuid}))}),[o]),D=(0,s.useMemo)((function(){return(0,Nc.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),M=(0,s.useMemo)((function(){return(0,w.jsxs)(Tc,{width:T,children:[a&&(0,w.jsxs)(Xl.Z,{children:[(0,w.jsx)(Wl.Z,{md:1,children:(0,w.jsx)(Ac,{noPadding:!0,children:(0,w.jsx)(R.ZP,{backgroundColor:Rc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),Ec.Am.success("Successfully copied to clipboard.",{position:Ec.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,w.jsx)(le.CK,{size:2.5*C.iI})})})}),(0,w.jsx)(Wl.Z,{md:4,children:(0,w.jsx)(Ac,{children:(0,w.jsx)(N.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,w.jsx)(Wl.Z,{md:7,children:(0,w.jsx)(Ac,{children:(0,w.jsx)(N.Z,{compact:!0,borderless:!0,fullWidth:!0,monospace:!0,onChange:function(e){x(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,w.jsx)(Dc,{deleteVariable:function(){return P(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[P,A,h,b,j,m,x,f,a,T]),B=(0,s.useMemo)((function(){return(0,w.jsx)(Tc,{width:T,children:null===D||void 0===D?void 0:D.map((function(e){return(0,w.jsx)(Dc,{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")}(j,null===i||void 0===i?void 0:i.uuid,n))),hideEdit:!0,pipelineUUID:j,variable:e},e.uuid);var n}))})}),[D,i,T]);return(0,w.jsxs)(O.Z,{p:C.cd,children:[(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Ur.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,w.jsx)(O.Z,{ml:2}),(0,w.jsx)(R.ZP,{Icon:le.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,w.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:M}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.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,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsxs)(_.ZP,{bold:!0,large:!0,children:["For Python (",(0,w.jsx)(Z.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Pc.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsxs)(_.ZP,{bold:!0,large:!0,children:["For SQL (",(0,w.jsx)(Z.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Pc.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsxs)(_.ZP,{bold:!0,large:!0,children:["For R (",(0,w.jsx)(Z.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(Pc.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsx)(Ur.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,w.jsx)(O.Z,{mb:C.cd}),(0,w.jsx)(_.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(Mc.Xm).map((function(e,n){var t;return(0,w.jsxs)(O.Z,{mb:C.cd,children:[(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(_.ZP,{large:!0,monospace:!0,children:(0,me.vg)(null===(t=Mc.Z4[e])||void 0===t?void 0:t.call(Mc.Z4))})}),(0,Nc.JZ)([],e).map((function(n,t){return(0,w.jsx)(Dc,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),D&&D.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{my:2,children:(0,w.jsx)(Ur.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,w.jsx)(O.Z,{mb:2,children:B}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(_.ZP,{children:["Output variables can be used in any ",(0,w.jsx)(_.ZP,{bold:!0,inline:!0,monospace:!0,children:v.tf.SCRATCHPAD})," block."]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(_.ZP,{children:"To load the variable, use the following syntax:"})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(Pc.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"})})]})]})},Lc=t(37771);function Fc(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 Uc(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Fc(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Fc(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Hc=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,F.t8)(F.Q9,e)}),[o,c]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(le.JM,{inverted:!0,size:2*C.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,w.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,w.jsx)(O.Z,{ml:1}),r&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(le.x8,{inverted:!0,size:2*C.iI}),onClick:n,success:!0,children:(0,w.jsx)(_.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,w.jsx)(O.Z,{ml:1})]}),(0,w.jsx)(T.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.Z,{ml:1}),(0,w.jsx)(_.ZP,{children:"Hide"}),(0,w.jsx)(O.Z,{mr:1}),(0,w.jsx)(eo.Z,{checked:o,onCheck:d})]})]}),!o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.Z,{mb:1}),(0,w.jsx)(Lc.k,{noScrollbarTrackBackground:!0,children:(0,w.jsx)(Ot,{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 Mn.jU.includes(i)?r=(0,w.jsx)(_t,Uc(Uc({},l),{},{children:(0,w.jsx)(_.ZP,{monospace:!0,preWrap:!0,children:(0,w.jsx)(jt(),{children:e})})})):i===Mn.Gi.IMAGE_PNG&&(r=(0,w.jsx)("div",{style:{backgroundColor:"white"},children:(0,w.jsx)("img",{alt:"Image ".concat(n," from code output"),src:"data:image/png;base64, ".concat(e)})})),(0,w.jsx)("div",{children:r},"code-output-".concat(n,"-").concat(t))}))}))})})]})]})};var zc=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-C.cd*C.iI*2}),[o]),x=(0,d.Db)(_e.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,Se.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}))}})}}),j=(0,l.Z)(x,1)[0],y=(0,d.Db)((function(e){return _e.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),Z=(0,l.Z)(y,1)[0],S=(0,s.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:v}}).then((function(){n(),h(null),g(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,v]);return(0,w.jsxs)(O.Z,{p:C.cd,children:[(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(k.Z,{alignItems:"center",children:[(0,w.jsx)(Ur.Z,{level:4,monospace:!0,children:"Secrets"}),(0,w.jsx)(O.Z,{ml:2}),(0,w.jsx)(R.ZP,{Icon:le.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(_.ZP,{children:[(0,w.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,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(_.ZP,{muted:!0,children:["Press ",(0,w.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(_.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsxs)(Tc,{width:b,children:[u&&(0,w.jsxs)(Xl.Z,{children:[(0,w.jsx)(Wl.Z,{md:1,children:(0,w.jsx)(Ac,{noPadding:!0,children:(0,w.jsx)(R.ZP,{backgroundColor:Rc.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),Ec.Am.success("Successfully copied to clipboard.",{position:Ec.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,w.jsx)(le.CK,{size:2.5*C.iI})})})}),(0,w.jsx)(Wl.Z,{md:4,children:(0,w.jsx)(Ac,{children:(0,w.jsx)(N.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,w.jsx)(Wl.Z,{md:7,children:(0,w.jsx)(Ac,{children:(0,w.jsx)(N.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,w.jsx)(Dc,{deleteVariable:function(){return Z(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.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,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(Pc.Z,{language:"yaml",small:!0,source:"\n {{ mage_secret_var('<secret_name>') }}\n ",maxWidth:b})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(_.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,w.jsx)(O.Z,{mb:C.cd,children:(0,w.jsx)(Pc.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})})]})},Gc=t(66607),Wc=t(33699),Vc=t(72454),Qc=t(64155);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}var Kc=function(e){var n=e.activeView,t=e.addNewBlockAtIndex,i=e.afterWidth,r=e.autocompleteItems,l=e.blockRefs,c=e.blocks,u=e.blocksInNotebook,a=e.cancelPipeline,d=e.chartRefs,f=e.checkIfPipelineRunning,p=e.deleteBlock,m=e.deleteWidget,v=e.editingBlock,g=e.executePipeline,b=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSecrets,y=e.fetchVariables,Z=e.globalVariables,S=e.insights,E=e.interruptKernel,P=e.isPipelineExecuting,I=(e.isPipelineUpdating,e.lastTerminalMessage),A=e.messages,R=e.metadata,D=e.onChangeCallbackBlock,N=e.onChangeChartBlock,B=e.onChangeCodeBlock,L=e.pipeline,U=e.pipelineMessages,H=e.runBlock,z=e.runningBlocks,G=e.sampleData,W=e.savePipelineContent,V=e.secrets,Q=e.selectedBlock,q=e.selectedFilePath,Y=e.sendTerminalMessage,X=(e.setActiveSidekickView,e.setAllowCodeBlockShortcuts),J=e.setAnyInputFocused,$=e.setDisableShortcuts,ee=e.setEditingBlock,ne=e.setErrors,te=e.setHiddenBlocks,ie=e.setSelectedBlock,re=e.setTextareaFocused,oe=e.statistics,ce=e.textareaFocused,ae=(e.updatePipelineMetadata,e.updateWidget),de=e.widgets,fe=(0,To.i)().height,pe=hn.uX,he=(0,s.useState)([]),me=he[0],ve=he[1],ge=(0,s.useState)(!!(0,F.U2)(F.Q9)),be=ge[0],xe=ge[1],je=(0,s.useMemo)((function(){return i-(Vc.k1+1)}),[i]),ye=((null===v||void 0===v?void 0:v.upstreamBlocks)||{}).block,ke=((null===G||void 0===G?void 0:G.columns)||[]).slice(0,100),Ze=(null===G||void 0===G?void 0:G.rows)||[],Oe=(null===R||void 0===R?void 0:R.column_types)||{},_e=null===ke||void 0===ke?void 0:ke.map((function(e){return{columnType:Oe[e],uuid:e}})),Se=(null===S||void 0===S?void 0:S[1])||{},we=(0,s.useMemo)((function(){return(0,ue.HK)((null===S||void 0===S?void 0:S[0])||[],(function(e){return e.feature.uuid}))}),[S]),Ee=(0,Nc.v0)({statistics:oe}),Pe=(0,Nc.CL)({columnTypes:Oe,statistics:oe}),Ie=!!G,Te=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===L||void 0===L?void 0:L.type)}),[L]),Ae=M.qL.STREAMING!==(null===L||void 0===L?void 0:L.type)?-70:be?-16:Lc.N,Re=(0,s.useCallback)((0,Ic.Fk)({columnTypes:Oe,columns:ke,insightsByFeatureUUID:we,insightsOverview:Se,noColumnLinks:!0,statistics:oe}),[Oe,ke,we,Se,oe]),De=(0,s.useMemo)((function(){return(0,w.jsx)(Bc,{blocks:c,fetchVariables:y,pipeline:L,selectedBlock:Q,setErrorMessages:ve,variables:Z,width:je})}),[je,c,y,Z,L,Q]),Me=(0,s.useMemo)((function(){return(0,w.jsx)(wc,{selectedBlock:Q,selectedFilePath:q,setErrors:ne,width:je>mn.nn?je-mn.nn:je})}),[je,Q,q,ne]),Ne=(0,s.useMemo)((function(){return(0,w.jsx)(zc,{fetchSecrets:j,pipelineUUID:null===L||void 0===L?void 0:L.uuid,secrets:V,setErrorMessages:ve,width:je})}),[je,j,L,V]);return(0,w.jsxs)(w.Fragment,{children:[(null===me||void 0===me?void 0:me.length)>=1&&(0,w.jsxs)(O.Z,{mb:3,mt:2,mx:2,children:[(0,w.jsxs)(k.Z,{justifyContent:"space-between",children:[(0,w.jsx)(_.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return ve([])},transparent:!0,children:(0,w.jsx)(le.x8,{muted:!0})})]}),null===me||void 0===me?void 0:me.map((function(e){return(0,w.jsx)(O.Z,{pb:1,children:(0,w.jsx)(_.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,w.jsxs)(Qc.t0,{fullWidth:!0,heightOffset:K.TERMINAL===n?0:mn.nn,onBlur:function(){q||$(!1),null===X||void 0===X||X(!1)},onFocus:function(){$(!0),n===K.TREE&&(null===X||void 0===X||X(!0))},children:[n===K.TREE&&(0,w.jsx)(h,{uuid:"PipelineDetail/".concat(null===L||void 0===L?void 0:L.uuid),children:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(kt.Z,{blockRefs:l,editingBlock:v,enablePorts:!Te,fetchPipeline:x,height:fe-pe-Ae,onClickNode:function(e){var n=e.block.uuid;return te((function(e){var t=!(null===e||void 0===e||!e[n]);return t?Yc(Yc({},e),{},(0,o.Z)({},n,!t)):e}))},pipeline:L,runningBlocks:z,selectedBlock:Q,setEditingBlock:ee,setErrors:ne,setSelectedBlock:ie}),!ye&&M.qL.STREAMING===(null===L||void 0===L?void 0:L.type)&&(0,w.jsx)(O.Z,{p:1,children:(0,w.jsx)(Hc,{cancelPipeline:a,checkIfPipelineRunning:f,executePipeline:g,isPipelineExecuting:P,pipelineExecutionHidden:be,pipelineMessages:U,setPipelineExecutionHidden:xe})})]})}),n===K.DATA&&ke.length>0&&(0,w.jsx)(yt.Z,{columnHeaderHeight:(0,Ce.Qr)(Oe)&&(0,Ce.Qr)(we)&&(0,Ce.Qr)(Se)?0:Qc.Eh,columns:ke,height:fe-pe-hn.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:Re,rows:Ze,width:je}),n===K.REPORTS&&(0,w.jsx)(Qc.ht,{noPadding:!Q||!Ie,children:(0,w.jsxs)(k.Z,{flexDirection:"column",fullWidth:!0,children:[Ee&&(0,w.jsx)(Gc.Z,{stats:Ee,title:"Quality metrics"}),Pe&&(0,w.jsx)(O.Z,{mt:C.cd,children:(0,w.jsx)(Gc.Z,{stats:Pe,title:"Statistics"})}),_e.length>0&&(0,w.jsx)(O.Z,{mt:C.cd,children:(0,w.jsx)(_c,{features:_e,statistics:oe})})]})}),n===K.GRAPHS&&(0,w.jsx)(Qc.ht,{noPadding:!Q||!Ie,children:(0,w.jsx)(nl,{afterWidth:je,features:_e,insightsOverview:Se,statistics:oe})}),K.SECRETS===n&&Ne,K.VARIABLES===n&&De,K.FILE_VERSIONS===n&&(0,w.jsx)(h,{uuid:"FileVersions/".concat(q?decodeURIComponent(q):""),children:Me}),Te||Q&&Ie||!Q&&Ie&&n===K.DATA?null:se.includes(n)&&(0,w.jsx)(k.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:pe,width:je,children:(0,w.jsx)(_.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:Q?!Ie&&"No data or insights available":"Select a block for insights"})}),K.CHARTS===n&&(de.length>0?(0,w.jsx)(tc,{autocompleteItems:r,blockRefs:l,blocks:c,chartRefs:d,deleteWidget:m,fetchFileTree:b,fetchPipeline:x,messages:A,onChangeChartBlock:N,pipeline:L,runBlock:H,runningBlocks:z,savePipelineContent:W,selectedBlock:Q,setAnyInputFocused:J,setSelectedBlock:ie,setTextareaFocused:re,textareaFocused:ce,updateWidget:ae,widgets:de,width:je}):(0,w.jsxs)(k.Z,{alignItems:"center",justifyContent:"center",verticalHeight:90,verticalHeightOffset:pe,width:je,children:[(0,w.jsx)(O.Z,{pl:1}),(0,w.jsx)(rc,{size:358}),(0,w.jsx)(O.Z,{pr:1})]})),K.TERMINAL===n&&(0,w.jsx)("div",{style:{height:"100%",position:"relative",width:je},children:(0,w.jsx)(Wc.Z,{interruptKernel:E,lastMessage:I,onFocus:function(){return ie(null)},sendMessage:Y,width:je})}),K.EXTENSIONS===n&&(0,w.jsx)(mc,{addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:l,blocks:c,blocksInNotebook:u,deleteBlock:p,fetchFileTree:b,fetchPipeline:x,interruptKernel:E,messages:A,onChangeCallbackBlock:D,onChangeCodeBlock:B,pipeline:L,runBlock:H,runningBlocks:z,savePipelineContent:W,selectedBlock:Q,setAnyInputFocused:J,setErrors:ne,setSelectedBlock:ie,setTextareaFocused:re,textareaFocused:ce})]})]})},Xc=t(12691),Jc=t.n(Xc);var $c=function(e){var n=e.activeView,t=e.pipeline,i=null===t||void 0===t?void 0:t.uuid,r=(0,dc.iV)(),o=fe[n],l=(0,w.jsx)(_.ZP,{bold:!0,children:null===o||void 0===o?void 0:o.label}),c=K.EXTENSIONS===n&&(null===r||void 0===r?void 0:r.extension),u=_e.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,ue.HK)(a,(function(e){return e.uuid}))}),[a]);if(!n)return(0,w.jsx)("div",{});if(c){var f=d[null===r||void 0===r?void 0:r.extension];l=(0,w.jsxs)(k.Z,{children:[(0,w.jsx)(Jc(),{as:"/pipelines/".concat(i,"/edit?").concat(ae,"=").concat(K.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,w.jsx)(Z.Z,{default:!0,children:null===o||void 0===o?void 0:o.label})}),(0,w.jsx)(_.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,w.jsx)(_.ZP,{bold:!0,children:null===f||void 0===f?void 0:f.name})]})}return(0,w.jsx)(O.Z,{px:C.cd,children:l})},eu=t(3055),nu=t(94353),tu=t(59920),iu=t(95354);function ru(e){var n=e.activeView,t=e.pipelineUUID;return de.map((function(e){var i=e.key,r=e.label;return{Icon:pe[i],id:i,isSelected:function(){return n===i},label:function(){return r},linkProps:{as:"/pipelines/".concat(t,"/edit?").concat(ae,"=").concat(i),href:"/pipelines/[pipeline]/edit"}}}))}var ou=t(28799);function lu(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 cu(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?lu(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):lu(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function uu(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),p=(0,To.i)().height,g=c.uuid,b=(0,s.useState)(!!(0,F.U2)(F.zg)),x=b[0],j=b[1],y=(0,s.useState)(null),Z=y[0],_=y[1],S=(0,s.useState)(null),E=S[0],P=S[1],D=(0,s.useState)(null),N=D[0],B=D[1],U=(0,s.useState)(null),H=U[0],z=U[1],G=(0,s.useState)([]),Q=G[0],q=G[1],Y=(0,s.useState)({}),X=Y[0],J=Y[1],$=(0,s.useState)(!1),ee=$[0],ne=$[1],te=(0,s.useState)(!1),ie=te[0],re=te[1],ce=(0,s.useState)(!1),se=ce[0],de=ce[1],fe=(0,s.useState)(!1),pe=fe[0],he=fe[1],ve="".concat(L.H8,"_").concat(g),ge=(0,F.U2)(ve),be=(0,s.useState)((0,ue.sE)(Io.NR,(function(e){return e.uuid===ge}))||Io.NR[0]),xe=be[0],je=be[1],ye=(0,s.useCallback)((function(e){je(e),(0,F.t8)(ve,null===e||void 0===e?void 0:e.uuid)}),[ve,je]),ke="".concat(L.g6,"_").concat(g),Ze=(0,s.useState)({}),Oe=Ze[0],we=Ze[1],Pe=(0,s.useCallback)((function(e){we((function(n){var t=e(n);return(0,F.t8)(ke,JSON.stringify(t)),t}))}),[ke,we]);(0,s.useEffect)((function(){var e=(0,F.U2)(ke);e&&(0,me.Pb)(e)&&we(JSON.parse(e))}),[ke,we]);var Ie=(0,s.useRef)(null),Te=(0,s.useState)({}),Ae=Te[0],Re=Te[1],De=(0,s.useState)([]),Me=De[0],Ne=De[1],Be=_e.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),Le=Be.data,Fe=Be.mutate,Ue=null===Le||void 0===Le?void 0:Le.kernels,ze=(null===Ue||void 0===Ue?void 0:Ue.find((function(e){return e.name===M.a_[null===$e||void 0===$e?void 0:$e.type]})))||(null===Ue||void 0===Ue?void 0:Ue[0]),Ge=(0,Zt.Z)(g),We=_e.ZP.pipelines.detail(g,{includes_outputs:(0,Ce.Qr)(Ae)},{refreshInterval:6e4}),Ve=We.data,Qe=We.mutate,qe=_e.ZP.files.list(),Ke=qe.data,Xe=qe.mutate,Je=(0,s.useMemo)((function(){return(null===Ke||void 0===Ke?void 0:Ke.files)||[]}),[Ke]),$e=null===Ve||void 0===Ve?void 0:Ve.pipeline,en=(0,s.useMemo)((function(){return M.qL.INTEGRATION===(null===$e||void 0===$e?void 0:$e.type)}),[$e]),nn=(0,s.useState)(null),tn=nn[0],rn=nn[1],ln=(0,s.useState)((0,Rn.Tz)({dateObj:!0})),cn=ln[0],un=ln[1],an=(0,s.useState)(!1),sn=an[0],dn=an[1],pn=(0,He.dd)((function(){return(0,w.jsx)(Ee.Z,{centerOnScreen:!0,neutral:!0,onClick:vn,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*C.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),hn=(0,l.Z)(pn,2),mn=hn[0],vn=hn[1];(0,s.useEffect)((function(){var e,n;null!==Ve&&void 0!==Ve&&null!==(e=Ve.pipeline)&&void 0!==e&&e.updated_at&&(null===tn||void 0===tn?void 0:tn.toISOString())!==new Date(null===Ve||void 0===Ve||null===(n=Ve.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&rn(new Date(Ve.pipeline.updated_at)),tn&&Number(tn)>Number(cn)&&mn()}),[null===Ve||void 0===Ve||null===(n=Ve.pipeline)||void 0===n?void 0:n.updated_at,tn,cn,mn]),(0,s.useEffect)((function(){null!==Ve&&void 0!==Ve&&Ve.error&&P({errors:(0,Se.QZ)(Ve),response:Ve})}),[Ve]);var gn=(0,dc.iV)(),bn=gn.sideview,xn=gn.block_uuid,jn=gn.file_path,kn=(0,s.useMemo)((function(){var e=gn["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[gn]),Zn=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(0,dc.iV)().sideview!==e&&(0,yn.u7)((0,o.Z)({},ae,e),{pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){bn||Zn(K.TREE,!1)}),[bn,Zn]);var Cn=(0,s.useCallback)((function(e,n){Zn(e,n),j(!1)}),[Zn]),Sn=(0,s.useRef)({}),wn=(0,s.useRef)({}),En=(0,s.useRef)({}),Pn=(0,s.useRef)({}),In=(0,s.useRef)({}),Tn=(0,s.useCallback)((function(e,n,t){var i=En.current||{};En.current=cu(cu({},i),{},(0,o.Z)({},e,cu(cu({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[En]),An=(0,s.useCallback)((function(e,n,t){var i=Pn.current||{};Pn.current=cu(cu({},i),{},(0,o.Z)({},e,cu(cu({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Pn]),Nn=(0,s.useCallback)((function(e,n,t){Tn(e,n,t),dn(!0)}),[Tn,dn]),Bn=(0,s.useCallback)((function(e,n,t){An(e,n,t),dn(!0)}),[An,dn]),Ln=(0,s.useCallback)((function(e){In.current=cu(cu({},In.current),e)}),[In]),Fn=(0,s.useCallback)((function(e,n){Ln((0,o.Z)({},e,n)),dn(!0)}),[Ln,dn]),Un=(0,s.useState)(null),Hn=Un[0],zn=Un[1],Gn=_e.ZP.data_providers.list({},{revalidateOnFocus:!0}).data,Wn=null===Gn||void 0===Gn?void 0:Gn.data_providers,Vn=_e.ZP.variables.pipelines.list(g),Qn=Vn.data,qn=Vn.mutate,Yn=null===Qn||void 0===Qn?void 0:Qn.variables,Kn=_e.ZP.secrets.list(),Xn=Kn.data,Jn=Kn.mutate,$n=null===Xn||void 0===Xn?void 0:Xn.secrets,et=(0,s.useState)([]),nt=et[0],tt=et[1],it=(0,s.useState)([]),rt=it[0],ot=it[1],lt=(0,s.useRef)({}),ct=(0,s.useCallback)((function(e){var n;dn(!0);var t=lt.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),lt.current[e.uuid]=cu(cu(cu({},t),e),{},{configuration:cu(cu({},t.configuration),e.configuration),upstream_blocks:i})}),[dn,lt]),ut=(0,s.useState)(!1),at=ut[0],st=ut[1],dt=(0,s.useState)({upstreamBlocks:null}),ft=dt[0],pt=dt[1],ht=(0,s.useState)([]),mt=ht[0],vt=ht[1],gt=(0,s.useState)(null),bt=gt[0],xt=gt[1],jt=(0,s.useState)(null),yt=(jt[0],jt[1]),kt=function(e,n){var t=(0,ue.HK)(n,(function(e){return e.uuid}));return e.map((function(e){return t[e]})).filter((function(e){return!!e}))}(Ht(g),nt),Ot=(0,s.useState)(kt),_t=Ot[0],Ct=Ot[1],St=(0,s.useState)(),wt=St[0],Et=St[1],It=(0,s.useState)(),Tt=It[0],At=It[1],Rt=(0,s.useState)(null),Dt=Rt[0],Mt=Rt[1],Nt=(0,Zt.Z)(_t),Bt=(0,s.useCallback)((function(){pt({upstreamBlocks:{block:null,values:[]}}),Re({}),dn(!1),vt([]),xt(null)}),[]);(0,s.useEffect)((function(){g!==Ge&&(En.current={},Pn.current={})}),[g,Ge]);var zt=_e.ZP.blocks.pipelines.outputs.detail(!x&&g,(null===Dt||void 0===Dt?void 0:Dt.type)!==v.tf.SCRATCHPAD&&(null===Dt||void 0===Dt?void 0:Dt.type)!==v.tf.CHART&&(null===Dt||void 0===Dt?void 0:Dt.uuid)&&encodeURIComponent(null===Dt||void 0===Dt?void 0:Dt.uuid)),Gt=zt.data,Wt=zt.mutate,Vt=(0,s.useMemo)((function(){var e,n,t;return en?null===(e=(0,ue.sE)(null===Gt||void 0===Gt?void 0:Gt.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,me.kE)(Tt))})))||void 0===e?void 0:e.sample_data:null===Gt||void 0===Gt||null===(n=Gt.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[Gt,en,Tt]),Qt=_e.ZP.blocks.pipelines.analyses.detail(!x&&g,(null===Dt||void 0===Dt?void 0:Dt.type)!==v.tf.SCRATCHPAD&&(null===Dt||void 0===Dt?void 0:Dt.type)!==v.tf.CHART&&(null===Dt||void 0===Dt?void 0:Dt.uuid)&&encodeURIComponent(null===Dt||void 0===Dt?void 0:Dt.uuid)),qt=Qt.data,Yt=Qt.mutate,Kt=(null===qt||void 0===qt||null===(t=qt.analyses)||void 0===t?void 0:t[0])||{},Xt=Kt.insights,Jt=void 0===Xt?{}:Xt,$t=Kt.metadata,ei=void 0===$t?{}:$t,ni=Kt.statistics,ti=void 0===ni?{}:ni;(0,s.useEffect)((function(){0===mt.length&&(Yt(),Wt(),qn())}),[Yt,Wt,qn,mt]),(0,s.useEffect)((function(){if(0===_t.length)Mt(null);else if((null===Nt||void 0===Nt?void 0:Nt.length)!==(null===_t||void 0===_t?void 0:_t.length)&&(null===_t||void 0===_t?void 0:_t.length)<(null===Nt||void 0===Nt?void 0:Nt.length)){var e=Nt.findIndex((function(e){return e.uuid===(null===Dt||void 0===Dt?void 0:Dt.uuid)})),n=Nt.length-1===e?e-1:e+1;Mt(Nt[Math.max(0,n)])}}),[_t,Nt,null===Dt||void 0===Dt?void 0:Dt.uuid]),(0,s.useEffect)((function(){var e;null!==(e=ft.upstreamBlocks)&&void 0!==e&&e.block&&(j(!1),Zn(K.TREE))}),[ft.upstreamBlocks,Zn]);var ii=_e.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!0}),ri=ii.data,oi=ii.mutate,li=null===ri||void 0===ri?void 0:ri.autocomplete_items;(0,s.useEffect)((function(){jn||de(!1),z(jn)}),[jn]),(0,s.useEffect)((function(){(0,ue.fS)(kn,Q)||q(kn)}),[kn,Q]);var ci=(0,d.Db)(_e.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var n=e.pipeline.uuid;u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),Xe()},onErrorCallback:function(e,n){return P({errors:n,response:e})}})}}),ui=(0,l.Z)(ci,1)[0],ai=(0,d.Db)(_e.ZP.pipelines.useUpdate(g,{update_content:!0}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){dn(!1),Qe()},onErrorCallback:function(e,n){return P({errors:n,response:e})}})}}),si=(0,l.Z)(ai,2),di=si[0],fi=si[1].isLoading,pi=(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(!(tn&&Number(tn)>Number(cn))){var u=(0,Rn.Tz)({dateObj:!0}),a=(0,Rn.Tz)();un(u);var s={},d=[];nt.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,f=null===(n=Pn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof f&&(f=e.content);var p,h=null===(t=En.current[u])||void 0===t?void 0:t[a];"undefined"===typeof h&&(h=e.callback_content);var m=null===(r=Ae[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(Pt)?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=cu(cu({},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=cu(cu({},null===$e||void 0===$e?void 0:$e.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})),di({pipeline:cu(cu(cu({},$e),o),{},{blocks:d,extensions:f,updated_at:a,widgets:rt.map((function(e){var n,t,i=In.current[e.uuid],r=lt.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=Ae[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(Pt)?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 cu(cu(cu({},e),r),{},{configuration:cu(cu({},e.configuration),r.configuration),content:i,outputs:t})}))})})}mn()}),[nt,Ae,$e,tn,cn,mn,di,rt]),hi=(0,s.useCallback)((function(e){pi();var n=encodeURIComponent(e),t=(0,dc.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n),(0,yn.u7)({file_path:n,"file_paths[]":t})}),[pi]),mi=(0,s.useMemo)((function(){var e=[],n=[];return nt.forEach((function(t){v.tf.EXTENSION===t.type?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[nt]),vi=mi.blocksInNotebook,gi=mi.blocksInSidekick,bi=(0,s.useCallback)((function(e,n){return pi({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;g!==r?window.location.href="/pipelines/".concat(r,"/edit"):(Xe(),n!==(null===$e||void 0===$e?void 0:$e.type)&&Qe(),Ft(vi,g,r),Ft(gi,g,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&P((function(e){return cu(cu({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){hi("pipelines/".concat(g,"/").concat(W.METADATA_YAML)),P(null)}}]})}))}))}),[vi,gi,Xe,Qe,hi,null===$e||void 0===$e?void 0:$e.type,g,pi]),xi=(0,d.Db)((function(e){var n=e.extension_uuid,t=e.uuid,i={};return n&&(i.extension_uuid=n),_e.ZP.blocks.pipelines.useDelete(g,encodeURIComponent(t),i)()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;tt((function(e){return(0,ue.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),Qe(),xt(null),t===v.tf.SCRATCHPAD&&Xe()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;P({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Re((function(e){return cu(cu({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Mn.Gi.TEXT_PLAIN}}))))}))}})}}),ji=(0,l.Z)(xi,1)[0],yi=(0,d.Db)((function(e){var n=e.uuid;return _e.ZP.widgets.pipelines.useDelete(g,n)()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(e){var n=e.widget.uuid;ot((function(e){return(0,ue.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),Qe(),Xe()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;P({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&Re((function(e){return cu(cu({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Mn.Gi.TEXT_PLAIN}}))))}))}})}}),ki=(0,l.Z)(yi,1)[0],Zi=(0,He.dd)((function(e){return(0,w.jsx)(Ee.Z,{centerOnScreen:!0,neutral:!0,onClick:function(){return wi(e)},onCancel:Ci,subtitle:"Deleting this block is dangerous. Your block may have downstream dependencies that depend on this block. You can delete this block anyway and remove it as a dependency from downstream blocks.",title:"Your block has dependencies",width:34*C.iI})})),Oi=(0,l.Z)(Zi,2),_i=Oi[0],Ci=Oi[1],Si=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&oe[n]&&(r="".concat(r,".").concat(oe[n].toLowerCase())),_e.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){oi(),Qe(),Xe()},onErrorCallback:function(e,n){console.log("response:",e),console.log("errors:",n),_i()}})}}),wi=(0,l.Z)(Si,1)[0],Ei=(0,d.Db)(_e.ZP.kernels.useUpdate(null===ze||void 0===ze?void 0:ze.id),{onSuccess:function(e){return(0,Se.wD)(e,{callback:function(){return Fe()},onErrorCallback:function(e,n){return P({errors:n,response:e})}})}}),Pi=(0,l.Z)(Ei,1)[0],Ii=(0,s.useCallback)((function(){return Pi({kernel:{action_type:"restart"}})}),[Pi]),Ti=(0,s.useCallback)((function(){return Pi({kernel:{action_type:"interrupt"}})}),[Pi]),Ai=(0,d.Db)(_e.ZP.blocks.pipelines.useCreate(g)),Ri=(0,l.Z)(Ai,1)[0],Di=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,me.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=Pn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(en){var s=(0,ue.HK)((null===$e||void 0===$e?void 0:$e.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 P({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void P({displayMessage:"Pipeline ".concat(null===$e||void 0===$e?void 0:$e.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 P({displayMessage:"Pipeline ".concat(null===$e||void 0===$e?void 0:$e.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 P({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void P({displayMessage:"Pipeline ".concat(null===$e||void 0===$e?void 0:$e.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return Ri({block:cu({content:i,name:c,priority:n},e)}).then((function(e){(0,Se.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),yt(null),Xe(),Qe().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return tt((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 cu(cu({},e),{},{extension_uuid:i})}))))}));var o=(0,ue.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 P({errors:n,response:e})}})}))}),[Ri,Xe,Qe,en,tt,P,$e]),Mi=(0,s.useState)(!1),Ni=Mi[0],Bi=Mi[1];(0,s.useEffect)((function(){Bi(!!(0,F.U2)(L.kY))}),[]);var Li=(0,He.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,me.Y6)():i,o=e.onCreateCallback;return(0,w.jsx)(V,{block:n,defaultName:r,onClose:Hi,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Di(n,t,o,null===e||void 0===e?void 0:e.name).then((function(){return Hi()}))},pipeline:$e})}),{},[Di,$e],{background:!0,uuid:"configure_block_name_and_create"}),Fi=(0,l.Z)(Li,2),Ui=Fi[0],Hi=Fi[1],zi=(0,d.Db)(_e.ZP.widgets.pipelines.useCreate(g)),Gi=(0,l.Z)(zi,1)[0],Wi=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,me.Y6)();return Gi({widget:cu({name:i,priority:n,type:v.tf.CHART},e)}).then((function(e){return(0,Se.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),Xe(),Qe(),Zn(K.CHARTS),B(n)},onErrorCallback:function(e,n){return P({errors:n,response:e})}})}))}),[Xe,Qe,Gi,Zn]);(0,s.useEffect)((function(){if(N){var e,n=null===(e=wn.current[N.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),B(null))}}),[N,B]),(0,s.useEffect)((function(){Ge!==g&&(tt([]),ot([]),Ct([]),Ne([]))}),[g,Ge]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===$e||void 0===$e?void 0:$e.blocks)||"undefined"!==typeof(null===$e||void 0===$e?void 0:$e.extensions)){var e=[];"undefined"!==typeof(null===$e||void 0===$e?void 0:$e.blocks)&&e.push.apply(e,(0,r.Z)(null===$e||void 0===$e?void 0:$e.blocks)),"undefined"!==typeof(null===$e||void 0===$e?void 0:$e.extensions)&&Object.entries((null===$e||void 0===$e?void 0:$e.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 cu(cu({},e),{},{extension_uuid:i})}))))})),tt(e)}}),[null===$e||void 0===$e?void 0:$e.blocks,null===$e||void 0===$e?void 0:$e.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===$e||void 0===$e?void 0:$e.widgets)&&ot($e.widgets)}),[null===$e||void 0===$e?void 0:$e.widgets]),(0,s.useEffect)((function(){(null===kt||void 0===kt?void 0:kt.length)>0&&0===(null===_t||void 0===_t?void 0:_t.length)&&(Ct(kt),Mt(kt[0]))}),[_t,kt]);var Vi=(0,Zt.Z)(nt);(0,s.useEffect)((function(){if("undefined"!==typeof(null===$e||void 0===$e?void 0:$e.blocks)&&(!nt.length||!(0,ue.fS)(null===Vi||void 0===Vi?void 0:Vi.map((function(e){return e.uuid})).sort(),null===nt||void 0===nt?void 0:nt.map((function(e){return e.uuid})).sort()))){var e=Lt($e.blocks),n=e.content,t=e.messages;Pn.current=n,Re((function(e){return cu(cu({},t),e)}))}}),[nt,Vi,null===$e||void 0===$e?void 0:$e.blocks,Re]),(0,s.useEffect)((function(){if(!rt.length&&"undefined"!==typeof(null===$e||void 0===$e?void 0:$e.widgets)){var e=Lt($e.widgets),n=e.content,t=e.messages;In.current=n,Re((function(e){return cu(cu({},t),e)}))}}),[null===$e||void 0===$e?void 0:$e.widgets,Re,rt]);var Qi=(0,s.useCallback)((function(e,n,t){var i=nt.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(xt(i),null!==Sn&&void 0!==Sn&&Sn.current){var r,o=Sn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,yn.u7)({file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=rt.find((function(n){return n.uuid===e}));if(l&&(xt(l),null!==wn&&void 0!==wn&&wn.current)){var c,u=wn.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&hi(t)}),[nt,hi,rt]);(0,s.useEffect)((function(){if(xn&&!bt){var e=nt.find((function(e){var n=e.uuid;return xn===n}));e&&Qi(e.uuid,e.type,null)}else(null===Vi||void 0===Vi?void 0:Vi.length)!==(null===nt||void 0===nt?void 0:nt.length)&&bt&&Qi(bt.uuid,bt.type,null)}),[xn,null===Vi||void 0===Vi?void 0:Vi.length,nt,Qi,bt]);var qi=(0,s.useMemo)((function(){return new m.Z}),[]),Yi=(0,s.useMemo)((function(){return{api_key:nu.l,token:qi.decodedToken.token}}),[qi]),Ki=(0,a.ZP)((0,ou.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=nt.find((function(e){var n=e.type,i=e.uuid;return t===n&&c===i}));"stream_pipeline"!==l?Re((function(e){var t=e[c]||[];return cu(cu({},e),{},(0,o.Z)({},c,t.concat(n)))})):(Ne((function(e){return[].concat((0,r.Z)(e),[n])})),Mn.uF.IDLE===i&&(vt([]),Qe(),c||st(!1))),Mn.uF.BUSY===i?vt((function(e){return e.find((function(e){var n=e.uuid;return c===n}))||!u?e:e.concat(u)})):Mn.uF.IDLE===i&&vt((function(e){return e.filter((function(e){var n=e.uuid;return c!==n}))})),dn(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,Xi=(0,s.useCallback)((function(){pi().then((function(){st(!0),Ne([]),Ki(JSON.stringify(cu(cu({},Yi),{},{execute_pipeline:!0,pipeline_uuid:g})))}))}),[g,pi,Ki,Yi]),Ji=(0,s.useCallback)((function(){Ki(JSON.stringify(cu(cu({},Yi),{},{cancel_pipeline:!0,pipeline_uuid:g})))}),[g,Ki,Yi]),$i=(0,s.useCallback)((function(){Ki(JSON.stringify(cu(cu({},Yi),{},{cancel_pipeline:!0,pipeline_uuid:g,skip_publish_message:!0})))}),[g,Ki,Yi]),er=(0,s.useCallback)((function(){Ki(JSON.stringify(cu(cu({},Yi),{},{check_if_pipeline_running:!0,pipeline_uuid:g})))}),[g,Ki,Yi]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",$i),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",$i),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",$i),window.removeEventListener("pagehide",$i)}}),[$i,null===u||void 0===u?void 0:u.events]);var nr=(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;mt.find((function(e){var n=e.uuid;return h===n}))&&!i||(Ki(JSON.stringify(cu(cu({},Yi),{},{code:t,extension_uuid:f,pipeline_uuid:null===$e||void 0===$e?void 0:$e.uuid,run_downstream:o,run_settings:c,run_tests:d,run_upstream:a,type:n.type,upstream_blocks:p,uuid:h}))),Re((function(e){return delete e[h],e})),ne(!1),vt((function(e){return e.find((function(e){var n=e.uuid;return h===n}))?e:e.concat(n)}))),Qe()}),[Qe,$e,mt,Ki,Re,vt,ne,Yi]),tr=(0,s.useCallback)((function(e){var n=e.block;return pi({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return nr(e)}))}),[nr,pi]),ir=(0,a.ZP)((0,ou.Ib)("terminal"),{shouldReconnect:function(){return!0},queryParams:Yi}),rr=ir.lastMessage,or=ir.sendMessage,lr=(0,s.useMemo)((function(){return(0,w.jsx)(Kc,{activeView:bn,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return Ui({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:Z,autocompleteItems:li,blockRefs:Sn,blocks:nt,blocksInNotebook:vi,cancelPipeline:Ji,chartRefs:wn,checkIfPipelineRunning:er,deleteBlock:ji,deleteWidget:ki,editingBlock:ft,executePipeline:Xi,fetchFileTree:Xe,fetchPipeline:Qe,fetchSecrets:Jn,fetchVariables:qn,globalVariables:Yn,insights:Jt,interruptKernel:Ti,isPipelineExecuting:at,isPipelineUpdating:fi,lastTerminalMessage:rr,messages:Ae,metadata:ei,onChangeCallbackBlock:Nn,onChangeChartBlock:Fn,onChangeCodeBlock:Bn,pipeline:$e,pipelineMessages:Me,runBlock:tr,runningBlocks:mt,sampleData:Vt,savePipelineContent:pi,secrets:$n,selectedBlock:bt,selectedFilePath:H,sendTerminalMessage:or,setActiveSidekickView:Zn,setAllowCodeBlockShortcuts:he,setAnyInputFocused:re,setDisableShortcuts:de,setEditingBlock:pt,setErrors:P,setHiddenBlocks:Pe,setSelectedBlock:xt,setTextareaFocused:ne,statistics:ti,textareaFocused:ee,updatePipelineMetadata:bi,updateWidget:ct,widgets:rt})}),[bn,Z,li,Sn,nt,vi,Ji,er,ji,ki,ft,Xi,Xe,Qe,Jn,qn,Yn,Jt,Ti,at,fi,rr,Ae,ei,Nn,Fn,Bn,$e,Me,tr,mt,Vt,pi,$n,bt,H,or,Zn,re,pt,P,Pe,ne,Ui,ti,ee,bi,ct,rt]),cr=(0,s.useMemo)((function(){return(0,w.jsx)(So,{addNewBlockAtIndex:Ni?Di: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)?Di(e,n,t,i):Ui({block:e,idx:n,name:i,onCreateCallback:t})}))},addWidget:function(e,n){var t=n.onCreateCallback;return Wi(e,rt.length,t)},allowCodeBlockShortcuts:pe,anyInputFocused:ie,autocompleteItems:li,blockRefs:Sn,blocks:vi,dataProviders:Wn,deleteBlock:ji,disableShortcuts:se,fetchFileTree:Xe,fetchPipeline:Qe,fetchSampleData:Wt,files:Je,globalVariables:Yn,hiddenBlocks:Oe,interruptKernel:Ti,isPipelineUpdating:fi,kernel:ze,mainContainerRef:Ie,mainContainerWidth:Hn,messages:Ae,onChangeCallbackBlock:Nn,onChangeCodeBlock:Bn,openSidekickView:Cn,pipeline:$e,pipelineContentTouched:sn,pipelineLastSaved:tn,restartKernel:Ii,runBlock:tr,runningBlocks:mt,savePipelineContent:pi,selectedBlock:bt,setAnyInputFocused:re,setEditingBlock:pt,setErrors:P,setHiddenBlocks:Pe,setIntegrationStreams:Et,setMessages:Re,setOutputBlocks:Ct,setPipelineContentTouched:dn,setRecsWindowOpenBlockIdx:yt,setRunningBlocks:vt,setSelectedBlock:xt,setSelectedOutputBlock:Mt,setSelectedStream:At,setTextareaFocused:ne,textareaFocused:ee,widgets:rt})}),[Di,Wi,pe,ie,li,Ni,Sn,vi,Wn,ji,se,Xe,Qe,Wt,Je,Yn,Oe,Ti,fi,ze,Ie,Hn,Ae,Nn,Bn,Cn,$e,sn,tn,Ii,tr,mt,pi,bt,re,pt,P,Pe,Re,dn,vt,xt,ne,Ui,ee,rt]),ur=(0,s.useMemo)((function(){if(i===Io.b7)return(0,w.jsx)(fn,{cancelPipeline:Ji,createPipeline:ui,executePipeline:Xi,interruptKernel:Ti,isPipelineExecuting:at,pipeline:$e,restartKernel:Ii,savePipelineContent:pi,setActiveSidekickView:Zn,setMessages:Re,children:H&&(0,w.jsx)(O.Z,{ml:1,children:(0,w.jsx)(k.Z,{alignItems:"center",fullHeight:!0,children:(0,w.jsx)(T.Z,{compact:!0,onClick:function(){return z(null)},small:!0,children:"View pipeline"})})})})}),[Ji,ui,Xi,Ti,at,i,$e,Ii,pi,H,Zn,Re,z]),ar=(0,s.useMemo)((function(){if(i===Io.b7)return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Dn,{filePaths:Q,filesTouched:X,isBusy:mt.length>=1,isPipelineUpdating:fi,kernel:ze,pipeline:$e,pipelineContentTouched:sn,pipelineLastSaved:tn,restartKernel:Ii,savePipelineContent:pi,selectedFilePath:H,setErrors:P,updatePipelineMetadata:bi,children:ur}),(null===Q||void 0===Q?void 0:Q.length)>0&&(0,w.jsx)(On,{filePaths:Q,filesTouched:X,savePipelineContent:pi,selectedFilePath:H})]})}),[ur,X,fi,ze,i,$e,sn,tn,Ii,mt,pi,H,Q,P,bi]),sr=(0,s.useMemo)((function(){var e;return null===wt||void 0===wt||null===(e=wt.filter((function(e){return(0,ue.sE)(null===Gt||void 0===Gt?void 0:Gt.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,me.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,w.jsx)(O.Z,{pl:1,children:(0,w.jsx)(R.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return At(e)},selected:Tt===e,uuid:e,children:e})},e)}))}),[Gt,wt,Tt]),dr=(0,s.useRef)(null),fr=(0,s.useMemo)((function(){return(0,w.jsx)(Ye,{addNewBlock:function(e,n){Di(e,nt.length,n,e.name),(null===kn||void 0===kn?void 0:kn.length)>=1&&u.push("/pipelines/".concat(g,"/edit"))},blocks:nt,deleteWidget:ki,fetchAutocompleteItems:oi,fetchFileTree:Xe,fetchPipeline:Qe,files:Je,onSelectBlockFile:Qi,openFile:hi,openPipeline:function(e){Bt(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:Cn,pipeline:$e,ref:dr,setErrors:P,setSelectedBlock:xt,widgets:rt})}),[Di,nt,ki,oi,Xe,Qe,null===kn||void 0===kn?void 0:kn.length,Je,Qi,hi,Cn,$e,g,Bt,u,P,xt,rt]),pr=(0,s.useMemo)((function(){return(0,w.jsx)(I,{blockRefs:Sn,hiddenBlocks:Oe,pipeline:$e,setHiddenBlocks:Pe})}),[Sn,Oe,$e,Pe]),hr=(0,s.useMemo)((function(){return Io.Jf.uuid===(null===xe||void 0===xe?void 0:xe.uuid)?fr:Io.IY.uuid===(null===xe||void 0===xe?void 0:xe.uuid)?pr:null}),[fr,pr,xe]),mr=(0,s.useMemo)((function(){return(0,w.jsx)(O.Z,{px:1,children:(0,w.jsx)(A.Z,{noPadding:!0,onClickTab:function(e){ye(e)},selectedTabUUID:null===xe||void 0===xe?void 0:xe.uuid,small:!0,tabs:Io.NR})})}),[ye,xe]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_n.Z,{title:null===$e||void 0===$e?void 0:$e.name}),(0,w.jsxs)(Do,{after:lr,afterHeader:(0,w.jsx)($c,{activeView:bn,pipeline:$e}),afterHeightOffset:eu.Mz,afterHidden:x,afterNavigationItems:ru({activeView:bn,pipelineUUID:g,setActiveSidekickView:Zn}),afterSubheader:(null===_t||void 0===_t?void 0:_t.length)>0&&bn===K.DATA&&(0,w.jsxs)(k.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!en&&_t.map((function(e){var n=e.uuid,t=(null===Dt||void 0===Dt?void 0:Dt.uuid)===n;return(0,w.jsx)(O.Z,{pl:1,children:(0,w.jsx)(R.ZP,{afterElement:t?(0,w.jsx)(T.Z,{basic:!0,highlightOnHover:!0,onClick:function(){!function(e,n){var t=Ht(e).filter((function(e){return e!==n}));(0,F.t8)(Ut(e),t)}(g,e.uuid),Ct((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,w.jsx)(le.x8,{muted:!0,size:1.25*C.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Mt(e)},selected:t,uuid:n,children:n})},n)})),en&&sr]}),before:hr,beforeHeader:mr,beforeHeightOffset:eu.Mz,beforeNavigationItems:(0,iu.H)(tu.M.EDIT,$e),errors:E,headerOffset:(null===Q||void 0===Q?void 0:Q.length)>0?36:0,mainContainerHeader:ar,mainContainerRef:Ie,page:i,pipeline:$e,setAfterHidden:j,setAfterWidthForChildren:_,setErrors:P,setMainContainerWidth:zn,children:[(0,w.jsx)("div",{style:{height:H?0:null,opacity:H?0:null,visibility:H?"hidden":null},children:(0,w.jsx)(h,{uuid:"PipelineDetail/".concat(g),children:cr})}),null===kn||void 0===kn?void 0:kn.map((function(e){return(0,w.jsx)("div",{style:{display:H===e?null:"none"},children:(0,w.jsx)(h,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,w.jsx)(on,{active:H===e,addNewBlock:function(e,n){Di(e,nt.length,n,e.name),u.push("/pipelines/".concat(g,"/edit"))},fetchPipeline:Qe,fetchVariables:qn,filePath:e,openSidekickView:Cn,pipeline:$e,selectedFilePath:H,sendTerminalMessage:or,setDisableShortcuts:de,setErrors:P,setFilesTouched:J,setSelectedBlock:xt})})},e)})),(0,w.jsx)(O.Z,{pb:jn?0:Math.max(Math.floor(p*(2/3)/C.iI),0)})]})]})}uu.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=Io.b7,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 au=(0,Mo.Z)(uu)},11366:function(e,n,t){"use strict";t.d(n,{H8:function(){return r},g6:function(){return o},kY:function(){return i}});var i="automatically_name_blocks",r="pipeline_edit_before_tab_selected",o="pipeline_edit_hidden_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,i){var r="".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t);return i?"".concat(r,":").concat(i):r}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")}},51504:function(e,n,t){"use strict";t.d(n,{y:function(){return o}});var i=t(75582),r=t(16115);function o(e,n){var t=e.map((function(e){return String(e)})),o=e.includes(r.PQ),l=e.includes(r.zX),c=e.includes(r.XR),u=r.xU.map((function(e){return String(e)})),a=r.vk.map((function(e){return String(e)})),s=r.Tr.map((function(e){return String(e)})),d=Object.entries(n).find((function(e){var n=(0,i.Z)(e,2),r=n[0];return n[1]&&!t.includes(String(r))&&(!l||!a.includes(String(r)))&&(!o||!u.includes(String(r)))&&(!c||!s.includes(String(r)))}));return e.every((function(e){return n[e]}))&&!d}},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(2761)}])}},function(e){e.O(0,[3662,3850,5716,5896,4804,1774,5872,2524,9565,2714,2125,7011,6085,8789,4538,2344,4506,6166,8180,6214,6532,1286,3688,6195,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|