mage-ai 0.9.8__py3-none-any.whl → 0.9.9__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/ai/constants.py +1 -0
- mage_ai/ai/generator.py +6 -0
- mage_ai/ai/{gen_doc_for_pipeline.py → generator_cmds.py} +5 -0
- mage_ai/ai/llm_pipeline_wizard.py +108 -3
- mage_ai/api/policies/BlockPolicy.py +1 -0
- mage_ai/api/policies/BlockTemplatePolicy.py +9 -0
- mage_ai/api/policies/LlmPolicy.py +3 -2
- mage_ai/api/policies/OauthAccessTokenPolicy.py +31 -0
- mage_ai/api/policies/PipelinePolicy.py +1 -0
- mage_ai/api/policies/ProjectPolicy.py +9 -0
- mage_ai/api/policies/SearchResultPolicy.py +32 -0
- mage_ai/api/policies/VariablePolicy.py +8 -0
- mage_ai/api/presenters/BlockTemplatePresenter.py +1 -0
- mage_ai/api/presenters/OauthAccessTokenPresenter.py +9 -0
- mage_ai/api/presenters/ProjectPresenter.py +2 -0
- mage_ai/api/presenters/SearchResultPresenter.py +73 -0
- mage_ai/api/resources/BlockResource.py +43 -4
- mage_ai/api/resources/BlockTemplateResource.py +15 -2
- mage_ai/api/resources/CustomTemplateResource.py +15 -3
- mage_ai/api/resources/FileContentResource.py +8 -1
- mage_ai/api/resources/FileResource.py +22 -2
- mage_ai/api/resources/OauthAccessTokenResource.py +24 -0
- mage_ai/api/resources/PipelineResource.py +70 -2
- mage_ai/api/resources/ProjectResource.py +15 -1
- mage_ai/api/resources/SearchResultResource.py +68 -0
- mage_ai/api/resources/VariableResource.py +25 -14
- mage_ai/cache/base.py +3 -0
- mage_ai/cache/block_action_object/__init__.py +282 -0
- mage_ai/cache/block_action_object/constants.py +4 -0
- mage_ai/cache/constants.py +1 -0
- mage_ai/data_integrations/destinations/constants.py +2 -0
- mage_ai/data_preparation/executors/k8s_pipeline_executor.py +1 -1
- mage_ai/data_preparation/models/block/__init__.py +20 -1
- mage_ai/data_preparation/models/block/dbt/utils/__init__.py +1 -0
- mage_ai/data_preparation/models/custom_templates/custom_block_template.py +8 -3
- mage_ai/data_preparation/models/custom_templates/utils.py +6 -3
- mage_ai/data_preparation/models/file.py +3 -0
- mage_ai/data_preparation/models/pipeline.py +10 -1
- mage_ai/data_preparation/models/{project.py → project/__init__.py} +17 -0
- mage_ai/data_preparation/models/project/constants.py +5 -0
- mage_ai/data_preparation/repo_manager.py +9 -6
- mage_ai/data_preparation/templates/constants.py +478 -1
- mage_ai/data_preparation/templates/template.py +9 -1
- mage_ai/orchestration/db/__init__.py +25 -0
- mage_ai/orchestration/pipeline_scheduler.py +23 -0
- 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/OwvTROmputQCA1Z9HEGDv/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1005-ce36fe7ed460d006.js → 1005-16c1a6678de5311e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1424-e22139f33196c5c1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1484-a76b2c31e4808379.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2485-b569baad92049d6b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{2786-d8b593e5d7c42665.js → 2786-acce6ea0d9b4898e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-573457b62efff6e2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3881-0eb04f7f7a244347.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{4317-b112fe7bb532b998.js → 4317-3fe63fc9401685d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4822-52d9d661b6bd1ae9.js → 4822-045cc7cdd7c95163.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{547-14029bdacc0ed267.js → 547-4ad2cdae967055b6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-cf188c1b7a1bc33c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{7815-6dc55b5fd5d1f48a.js → 7815-fbd99c8f259d9e8b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8312-cdc4d6c3b9f53099.js → 8312-c88a3b1012e5448b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8952-492bf0e29d215ddd.js → 8952-e94a7334fcd5c68b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9055-d0d25298cb5f4e45.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-c7557dc9e725825e.js → _app-fa38a24707c76411.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-b9dac983c75798f2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/{settings-17bb362b9683079c.js → settings-453aaa7bf78f8101.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{[user]-bfa53c0ee79920a0.js → [user]-3b502aa6d1a04cad.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{new-2f7e6bf8e2a37380.js → new-dd41d718cbb5990c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-ec748f838b7b8fad.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-bcc24120f5911f76.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{overview-8ffbc4b0e8a43266.js → overview-6f20b9e9cbec91d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-373f6b8c9161e819.js → [...slug]-55212dfc15881ef2.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{backfills-226bf0c5c1bfe004.js → backfills-6b4a82cd0516e121.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-0705c99df236ec8a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{logs-4ade07836fd577c9.js → logs-c294f5d74bd2d50f.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{monitors-fd9eb711e89425e9.js → monitors-1b9e4abc54842cdf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{runs-027666ed18d3151e.js → runs-17ebe87e94242ae5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-48b60ca236a26818.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{syncs-de58e6b91e5e4552.js → syncs-5153f4665aaf8b17.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/{[...slug]-432843576e1ed09e.js → [...slug]-1306e85191f6b47c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-ae31b1d0d8a4634d.js → triggers-2e731d343a26d46a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-0fab737dbc9074fc.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-b2354688508b0755.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-a4f01b5c429757cc.js → users-6522c963087f18e8.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{sign-in-1140f8ee7e89381a.js → sign-in-7dcd1257ca9660bb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/templates/{[...slug]-f59b3f04c5a49351.js → [...slug]-78a07e7fe8973811.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{templates-dbb209ce131390a9.js → templates-19df643f52679d5a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-a1cf445565b68809.js +1 -0
- mage_ai/server/frontend_dist/files.html +2 -2
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage/settings.html +2 -2
- mage_ai/server/frontend_dist/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist/manage/users.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/overview.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 +16 -16
- mage_ai/server/frontend_dist/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist/templates.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/server/frontend_dist/version-control.html +2 -2
- mage_ai/server/server.py +5 -0
- mage_ai/services/search/__init__.py +0 -0
- mage_ai/services/search/block_action_objects.py +33 -0
- mage_ai/services/search/constants.py +1 -0
- mage_ai/shared/array.py +7 -0
- mage_ai/shared/parsers.py +11 -2
- mage_ai/tests/shared/test_parsers.py +73 -0
- mage_ai/usage_statistics/constants.py +1 -0
- mage_ai/usage_statistics/logger.py +19 -1
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/METADATA +9 -7
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/RECORD +142 -129
- mage_ai/server/frontend_dist/_next/static/RcIgkp9pBXE1Rb4tOGR1L/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1424-de97c5aa0477894b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1484-c9d6bc33227070dd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2485-86c97f516c1abb9f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3215-c2f5f19b650f9a50.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-bff4740b63cf280c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3881-7f121dbbe6e273cd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-97f283be01adf6a8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-0df5a20d6f1aa606.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-1f6cb7656299cbd1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-4894eabb442a039c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-a9bd86bee73b5762.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-cf51793c2112915c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-f1131ffe0d2a4a06.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-170943ca00445486.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-2ecda1f1437013f2.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{RcIgkp9pBXE1Rb4tOGR1L → OwvTROmputQCA1Z9HEGDv}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{RcIgkp9pBXE1Rb4tOGR1L → OwvTROmputQCA1Z9HEGDv}/_ssgManifest.js +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/top_level.txt +0 -0
mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-0705c99df236ec8a.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2551],{48591:function(e,n,t){"use strict";var i=t(21831),r=t(75582),o=t(82684),l=t(37958);n.Z=function(e){var n=e.children,t=e.uuid,c=e.uuids,u=void 0===c?[]:c,a=(0,l.j)("apiReloads"),s=(0,r.Z)(a,1)[0],d=(0,i.Z)(u);t&&d.push(t);var f=d.map((function(e){return String(s[e])||"-"})).join("_");return o.cloneElement(n,{key:f})}},91207:function(e,n,t){"use strict";t.d(n,{Z:function(){return R}});var i=t(82394),r=t(75582),o=t(17717),l=t(82684),c=t(37958),u=t(83455),a=t(35490),s=t(86422),d=t(60328),f=t(38626),p=t(93461),h=t(67971),v=t(28598),m=f.default.div.withConfig({displayName:"ButtonGroup__ButtonGroupStyle",componentId:"sc-15vbmc8-0"})([""]),b=f.default.div.withConfig({displayName:"ButtonGroup__VerticalDivider",componentId:"sc-15vbmc8-1"})(["width:1px;"]),g=function(e){var n=e.children,t=e.divider,i=l.Children.toArray(n).length;return(0,v.jsx)(m,{children:(0,v.jsx)(h.Z,{children:l.Children.map(n,(function(e,n){return e&&(0,v.jsxs)(p.Z,{children:[n>=1&&t&&(0,v.jsx)(b,{}),l.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))}))})})},x=t(57722),j=t(73828),y=t(11135),k=t(98781),Z=t(86673),O=t(82531),P=t(16115),C=t(94353),w=t(60701),_=t(55512),S=t(24224),E=t(32821),I=t(90211),T=t(96510),D=t(51504),M=t(41150);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 B(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}var R=function(e){var n=e.active,t=e.addNewBlock,f=e.disableRefreshWarning,p=e.fetchPipeline,m=e.fetchVariables,b=e.filePath,A=e.hideHeaderButtons,R=e.onContentChange,N=e.openSidekickView,L=e.pipeline,F=e.saveFile,U=e.selectedFilePath,H=e.sendTerminalMessage,z=e.setDisableShortcuts,V=e.setErrors,W=e.setFilesTouched,G=e.setSelectedBlock,K=(0,c.j)("apiReloads"),Y=(0,r.Z)(K,2)[1],q=(0,l.useState)(null),Q=q[0],J=q[1],X=(0,l.useState)(!1),$=X[0],ee=(X[1],(0,l.useRef)(null)),ne=(0,l.useMemo)((function(){return new a.Z}),[]),te=(0,l.useMemo)((function(){return{api_key:C.l,token:ne.decodedToken.token}}),[ne]),ie=O.ZP.statuses.list().data,re=(0,l.useMemo)((function(){var e,n;return null===ie||void 0===ie||null===(e=ie.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.repo_path}),[ie]),oe=O.ZP.file_contents.detail(b).data;(0,l.useEffect)((function(){null!==oe&&void 0!==oe&&oe.file_content&&J(oe.file_content)}),[oe]);var le=(0,l.useState)(null===Q||void 0===Q?void 0:Q.content),ce=le[0],ue=le[1],ae=(0,l.useCallback)((function(e){ue(e),R&&(null===R||void 0===R||R(e))}),[R]),se=(0,l.useState)(!1),de=se[0],fe=se[1];(0,l.useEffect)((function(){n&&z&&(null===z||void 0===z||z(!0))}),[n,z]),(0,l.useEffect)((function(){var e;U&&(null===ee||void 0===ee||null===(e=ee.current)||void 0===e||e.scrollIntoView())}),[U]);var pe=(0,u.Db)(O.ZP.file_contents.useUpdate((null===Q||void 0===Q?void 0:Q.path)&&encodeURIComponent(null===Q||void 0===Q?void 0:Q.path)),{onSuccess:function(e){return(0,T.wD)(e,{callback:function(){Y((function(e){return B(B({},e),{},(0,i.Z)({},"FileVersions/".concat(null===Q||void 0===Q?void 0:Q.path),Number(new Date)))}))},onErrorCallback:function(e,n){return null===V||void 0===V?void 0:V({errors:n,response:e})}})}}),he=(0,r.Z)(pe,1)[0],ve=(0,l.useCallback)((function(e,n){if(F)return F(e,n);he({file_content:B(B({},n),{},{content:e})}).then((function(){decodeURIComponent(b).split(o.sep).pop()===j.dT.METADATA_YAML&&m&&(null===m||void 0===m||m())})),W((function(e){return B(B({},e),{},(0,i.Z)({},null===n||void 0===n?void 0:n.path,!1))})),fe(!1)}),[m,b,F,W,he]),me=(0,l.useMemo)((function(){return(0,_.lU)()}),[]),be=(0,l.useMemo)((function(){var e,n,t,i;return null===(null===Q||void 0===Q||null===(e=Q.path)||void 0===e?void 0:e.match(me))?j.Lu.TXT:null===Q||void 0===Q||null===(n=Q.path)||void 0===n||null===(t=n.match(me))||void 0===t||null===(i=t[0])||void 0===i?void 0:i.split(".")[1]}),[me,Q]),ge=(0,l.useMemo)((function(){if(null!==Q&&void 0!==Q&&Q.path)return(0,v.jsx)(x.Z,{autoHeight:!0,language:j.nB[be],onChange:function(e){ae(e),W((function(e){return B(B({},e),{},(0,i.Z)({},null===Q||void 0===Q?void 0:Q.path,!0))})),fe(!0)},onSave:function(e){ve(e,Q)},selected:!0,textareaFocused:!0,value:(0,I.Pb)(null===Q||void 0===Q?void 0:Q.content)?JSON.stringify(JSON.parse(null===Q||void 0===Q?void 0:Q.content),null,2):null===Q||void 0===Q?void 0:Q.content,width:"100%"})}),[Q,be,ve,ae,W]),xe=null!==L&&void 0!==L&&L.blocks?(0,S.sE)(null===L||void 0===L?void 0:L.blocks,(function(e){var n=e.type;return s.tf.DATA_EXPORTER===n})):null,je=(0,u.Db)(O.ZP.blocks.pipelines.useUpdate(null===L||void 0===L?void 0:L.uuid,null===xe||void 0===xe?void 0:xe.uuid),{onSuccess:function(e){return(0,T.wD)(e,{callback:function(){null===p||void 0===p||p()}})}}),ye=(0,r.Z)(je,1)[0],ke=t&&L&&(be===j.Lu.PY||be===j.Lu.SQL||(be===j.Lu.YAML||be===j.Lu.R)&&(0,E.V3)(Q,null===Q||void 0===Q?void 0:Q.path))&&(0,_.ck)(Q.path.split(o.sep))!==s.tf.SCRATCHPAD&&(0,E.lr)(Q)&&(0,v.jsx)(d.Z,{onClick:function(){var e=(null===L||void 0===L?void 0:L.type)===k.qL.INTEGRATION,n=(0,_.TU)(Q,re,L);t(n,(function(n){e&&xe&&ye({block:B(B({},xe),{},{upstream_blocks:[n.uuid]})}),null===G||void 0===G||G(n)}))},primary:!0,children:"Add to current pipeline"}),Ze=H&&(0,v.jsx)(Z.Z,{m:2,children:(0,v.jsx)(y.ZP,{disabled:!re,inline:!0,loading:$,onClick:function(){null===N||void 0===N||N(w.cH.TERMINAL),null===H||void 0===H||H(JSON.stringify(B(B({},te),{},{command:["stdin","pip install -r ".concat(re,"/requirements.txt\r")]})))},title:re?"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"})}),Oe="FileEditor/".concat(null===Q||void 0===Q?void 0:Q.path),Pe=(0,M.y)(),Ce=Pe.registerOnKeyDown,we=Pe.unregisterOnKeyDown;return(0,l.useEffect)((function(){return function(){we(Oe)}}),[we,Oe]),Ce(Oe,(function(e,t){if(n&&!f)if((0,D.y)([P.zX,P.Um],t)||(0,D.y)([P.PQ,P.Um],t))e.preventDefault(),ve(ce,Q);else if(de&&(0,D.y)([P.zX,P.hS],t)){e.preventDefault();var i="".concat(Q.path," has changes that are unsaved. ")+"Click cancel and save your changes before reloading page.";"undefined"!==typeof location&&window.confirm(i)&&location.reload()}}),[n,ce,f,Q,ve,de]),(0,v.jsxs)("div",{ref:ee,children:[!A&&(0,v.jsx)(Z.Z,{p:2,children:(0,v.jsxs)(h.Z,{justifyContent:"space-between",children:[(0,v.jsxs)(g,{children:[ke,(0,v.jsx)(d.Z,{disabled:!ce,onClick:function(e){e.preventDefault(),ve(ce,Q)},title:ce?null:"No changes have been made to this file.",children:"Save file content"})]}),N&&(0,v.jsx)(g,{children:(0,v.jsx)(d.Z,{compact:!0,onClick:function(){N(w.cH.FILE_VERSIONS)},small:!0,title:"View previous changes to this file.",children:"Show versions"})})]})}),ge,b===j.dT.REQS_TXT&&Ze]})}},23351:function(e,n,t){"use strict";var i=t(82394),r=t(75582),o=t(17717),l=t(37958),c=t(82684),u=t(83455),a=t(60328),s=t(57722),d=t(73828),f=t(93461),p=t(67971),h=t(87372),v=t(86673),m=t(54283),b=t(87815),g=t(19711),x=t(82531),j=t(49125),y=t(55512),k=t(42305),Z=t(90211),O=t(96510),P=t(66653),C=t(24224),w=t(28598);function _(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?_(Object(t),!0).forEach((function(n){(0,i.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}n.Z=function(e){var n=e.onActionCallback,t=e.selectedBlock,_=e.selectedFilePath,E=e.setErrors,I=e.width,T=(0,l.j)("apiReloads"),D=(0,r.Z)(T,2)[1],M=x.ZP.file_versions.files.list(_&&encodeURIComponent(_)),A=M.data,B=M.mutate,R=(0,c.useMemo)((function(){return(null===A||void 0===A?void 0:A.file_versions)||[]}),[A]),N=(0,c.useState)(null),L=N[0],F=N[1],U=(0,c.useMemo)((function(){return null===R||void 0===R?void 0:R[L]}),[L,R]),H=x.ZP.file_contents.detail(U?encodeURIComponent(U.path):null).data,z=(0,c.useMemo)((function(){return null===H||void 0===H?void 0:H.file_content}),[H]),V=(0,c.useMemo)((function(){return(0,y.lU)()}),[]),W=(0,c.useMemo)((function(){var e,n,t;return null===_||void 0===_||null===(e=_.match(V))||void 0===e||null===(n=e[0])||void 0===n||null===(t=n.split("."))||void 0===t?void 0:t[1]}),[_,V]),G=(0,u.Db)(x.ZP.file_contents.useUpdate(_&&encodeURIComponent(_)),{onSuccess:function(e){return(0,O.wD)(e,{callback:function(e){var t;_&&B();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(o.sep);if("pipelines"===c[0]){var u=c.slice(1,c.length-1).join(o.sep);l="PipelineDetail/".concat(u)}}D((function(e){return S(S({},e),{},(0,i.Z)({},l,Number(new Date)))})),F((function(e){return e+1})),null===n||void 0===n||n(e)},onErrorCallback:function(e,n){return E({errors:n,response:e})}})}}),K=(0,r.Z)(G,2),Y=K[0],q=K[1].isLoading,Q=(0,c.useMemo)((function(){var e=R.map((function(e){var n=e.name,t=e.path;return[(0,w.jsxs)(p.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(f.Z,{flex:1,children:[(0,w.jsx)(g.ZP,{default:!0,monospace:!0,children:(0,k.JX)(n,{withSeconds:!0})}),(0,w.jsx)(v.Z,{px:2*j.cd,children:(0,w.jsx)(g.ZP,{monospace:!0,children:n})})]}),U&&(null===U||void 0===U?void 0:U.path)===t&&(0,w.jsx)(a.Z,{compact:!0,loading:q,onClick:function(e){(0,P.j)(e),Y({file_content:{version:n}})},small:!0,children:"Replace with this version"})]},n)]}));if(U){var n=(0,w.jsx)(v.Z,{p:j.cd,children:(0,w.jsx)(m.Z,{},"spinner")});if(z&&(null===z||void 0===z?void 0:z.path)===(null===U||void 0===U?void 0:U.path)){var t=z.content,i=void 0===t?"":t;n=(0,w.jsx)(s.Z,{autoHeight:!0,language:d.nB[W],padding:!0,readOnly:!0,value:(0,Z.Pb)(i)?JSON.stringify(JSON.parse(i),null,2):i,width:I})}e=(0,C.Hk)([n],L+1,e)}return e}),[z,W,R,q,U,L,Y,I]);return(0,w.jsxs)("div",{style:{width:I},children:[(0,w.jsxs)(v.Z,{p:j.cd,children:[(0,w.jsx)(h.Z,{level:5,children:"File versions"}),(0,w.jsx)(g.ZP,{inline:!0,monospace:!0,children:_?decodeURIComponent(_):null===t||void 0===t?void 0:t.uuid})]}),(0,w.jsx)(b.Z,{buildRowProps:function(e){if(U&&L+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=R[e])||void 0===n?void 0:n.name)===(null===U||void 0===U?void 0:U.name)},onClickRow:function(e){U?e===L?F(null):e<L?F(e):e>L+1&&F(e-1):F(e)},rows:Q})]})}},85307:function(e,n,t){"use strict";t.d(n,{$W:function(){return a},cl:function(){return s},cv:function(){return d},dE:function(){return u}});var i=t(38626),r=t(23831),o=t(73942),l=t(49125),c=t(37391),u=i.default.div.withConfig({displayName:"indexstyle__SectionStyle",componentId:"sc-7a1uhf-0"})(["border-radius:","px;padding:","px;",""],o.n_,l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).popup,";\n ")})),a=i.default.div.withConfig({displayName:"indexstyle__CodeEditorStyle",componentId:"sc-7a1uhf-1"})(["padding-top:","px;",""],l.cd*l.iI,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).codeTextarea,";\n ")})),s=i.default.div.withConfig({displayName:"indexstyle__TableContainerStyle",componentId:"sc-7a1uhf-2"})(["overflow:auto;max-height:90vh;width:100%;"," "," "," "," ",""],c.w5,(function(e){return e.hideHorizontalScrollbar&&"\n overflow-x: hidden;\n "}),(function(e){return e.width&&"\n width: ".concat(e.width,";\n ")}),(function(e){return e.height&&"\n height: ".concat(e.height,";\n ")}),(function(e){return e.maxHeight&&"\n max-height: ".concat(e.maxHeight,";\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__HeaderRowStyle",componentId:"sc-7a1uhf-3"})(["padding:","px;"," "," ",""],2*l.iI,(function(e){return"\n background-color: ".concat((e.theme||r.Z).interactive.defaultBackground,";\n border-bottom: ").concat(o.YF,"px ").concat(o.M8," ").concat((e.theme||r.Z).borders.medium,";\n ")}),(function(e){return e.padding&&"\n padding: ".concat(e.padding,"px;\n ")}),(function(e){return e.rounded&&"\n border-top-left-radius: ".concat(o.n_,"px;\n border-top-right-radius: ").concat(o.n_,"px;\n ")}))},38488:function(e,n,t){"use strict";t.d(n,{Z:function(){return P}});var i=t(82394),r=t(26304),o=t(82684),l=t(38626),c=t(16634),u=t(67971),a=t(10919),s=t(86673),d=t(19711),f=t(46261),p=t(23831),h=t(22341),v=t(28347),m=t(49125),b=t(33766),g=t(66653),x=t(28598);var j=function(e){var n=e.filePath,t=e.filesTouched,i=void 0===t?{}:t,r=e.isLast,l=e.onClickTab,j=e.onClickTabClose,y=e.renderTabTitle,k=e.savePipelineContent,Z=e.selected,O=e.themeContext,P=(0,o.useState)(!1),C=P[0],w=P[1];return(0,x.jsx)(u.Z,{flexDirection:"column",fullHeight:!0,onClick:function(e){e.preventDefault(),Z||(l?l(n):(null===k||void 0===k||k(),(0,b.u7)({file_path:encodeURIComponent(n)})))},onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)},children:(0,x.jsx)(v.Gb,{last:r,selected:Z,children:(0,x.jsxs)(u.Z,{alignItems:"center",fullHeight:!0,children:[(0,x.jsx)(f.Z,{appearAbove:!0,appearBefore:!0,label:n,size:null,widthFitContent:!0,children:(0,x.jsxs)(u.Z,{alignItems:"center",fullHeight:!0,children:[!i[n]&&(0,x.jsx)(h.iU,{muted:!Z,size:1.5*m.iI}),i[n]&&(0,x.jsx)(f.Z,{label:"Unsaved changes",size:null,widthFitContent:!0,children:(0,x.jsx)("div",{style:{padding:1},children:(0,x.jsx)(c.Z,{borderColor:(O||p.Z).borders.danger,size:1.25*m.iI})})}),(0,x.jsx)(s.Z,{mr:1}),(0,x.jsx)(d.ZP,{muted:!Z,children:y?y(n):n})]})}),(0,x.jsx)(s.Z,{mr:2}),(0,x.jsx)(f.Z,{label:"Close",size:null,widthFitContent:!0,children:(0,x.jsxs)(a.Z,{autoHeight:!0,block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(e){(0,g.j)(e),null===j||void 0===j||j(n)},preventDefault:!0,children:[(C||Z)&&(0,x.jsx)(h.x8,{muted:!Z,size:1.25*m.iI}),!C&&!Z&&(0,x.jsx)("div",{style:{width:1.25*m.iI}})]})})]})})})},y=t(24224),k=["filePaths","isSelectedFilePath","onClickTabClose","selectedFilePath"];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 O(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,i.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 P=function(e){var n=e.filePaths,t=e.isSelectedFilePath,i=e.onClickTabClose,c=e.selectedFilePath,a=(0,r.Z)(e,k),s=(0,o.useContext)(l.ThemeContext),d=(0,o.useMemo)((function(){return n.map((function(e){return decodeURIComponent(e)}))}),[n]),f=(0,o.useMemo)((function(){return null===d||void 0===d?void 0:d.length}),[d]);return(0,x.jsx)(u.Z,{alignItems:"center",justifyContent:"flex-start",children:null===d||void 0===d?void 0:d.map((function(e,n){var r=t?t(e,c):c===encodeURIComponent(e);return(0,o.createElement)(j,O(O({},a),{},{filePath:e,isLast:n===f-1,key:e,onClickTabClose:function(e){if(i)i(e);else{var n=(0,y.Od)(d,(function(n){return n===e})).map((function(e){return encodeURIComponent(e)}));(0,b.u7)({file_path:n[n.length-1]||null,"file_paths[]":n},{pushHistory:!0})}},selected:r,themeContext:s}))}))})}},70543:function(e,n,t){"use strict";t.d(n,{IY:function(){return o},Jf:function(){return r},NR:function(){return l},b7:function(){return i}});var i="edit",r={uuid:"All files"},o={uuid:"Files in pipeline"},l=[r,o]},28347:function(e,n,t){"use strict";t.d(n,{Gb:function(){return f},fm:function(){return s},lO:function(){return a},rK:function(){return d},zn:function(){return u}});var i=t(38626),r=t(23831),o=t(82386),l=t(49125),c=t(37391),u=300,a=i.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;}"],u,u),s=i.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||r.Z.background).codeArea,";\n ")})),d=i.default.div.withConfig({displayName:"indexstyle__PipelineHeaderStyle",componentId:"sc-1sv9513-2"})(["height:","px;position:sticky;top:","px;width:100%;z-index:5;"," "," "," ",""],o.Wi,o.Wi,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).panel,";\n border-bottom: 1px solid ").concat((e.theme.borders||r.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(o.Wi,"px;\n overflow-x: auto;\n z-index: 3;\n ")}),(0,c.y$)()),f=i.default.div.withConfig({displayName:"indexstyle__FileTabStyle",componentId:"sc-1sv9513-3"})(["border-right:1px solid transparent;height:100%;padding:","px ","px;"," "," ",""],l.iI,l.cd*l.iI,(function(e){return"\n &:hover {\n cursor: default;\n\n p {\n color: ".concat((e.theme.content||r.Z.content).active," !important;\n cursor: default;\n }\n }\n ")}),(function(e){return e.selected&&"\n background-color: ".concat((e.theme.interactive||r.Z.interactive).hoverBackground,";\n ")}),(function(e){return!e.selected&&!e.last&&"\n border-color: ".concat((e.theme.borders||r.Z.borders).light," !important;\n ")}))},59920:function(e,n,t){"use strict";var i;t.d(n,{M:function(){return i}}),function(e){e.BACKFILLS="backfills",e.BLOCK_RUNS="block_runs",e.EDIT="edit",e.MONITOR="monitor",e.PIPELINE_LOGS="pipeline_logs",e.PIPELINE_RUNS="pipeline_runs",e.RUNS="runs",e.SETTINGS="settings",e.SYNCS="syncs",e.TRIGGERS="triggers"}(i||(i={}))},36405:function(e,n,t){"use strict";t.d(n,{H:function(){return c}});var i=t(98781),r=t(22341),o=t(59920),l=t(9736);function c(e,n,t){var c=(n||{}).uuid||t,u=[{Icon:r.Bf,id:o.M.TRIGGERS,isSelected:function(){return o.M.TRIGGERS===e},label:function(){return"Triggers"},linkProps:{as:"/pipelines/".concat(c,"/triggers"),href:"/pipelines/[pipeline]/triggers"}},{Icon:r.Pf,id:o.M.RUNS,isSelected:function(){return o.M.RUNS===e},label:function(){return"Runs"},linkProps:{as:"/pipelines/".concat(c,"/runs"),href:"/pipelines/[pipeline]/runs"}},{Icon:r.dE,id:o.M.BACKFILLS,isSelected:function(){return o.M.BACKFILLS===e},label:function(){return"Backfills"},linkProps:{as:"/pipelines/".concat(c,"/backfills"),href:"/pipelines/[pipeline]/backfills"}},{Icon:r.UL,id:o.M.PIPELINE_LOGS,isSelected:function(){return o.M.PIPELINE_LOGS===e},label:function(){return"Logs"},linkProps:{as:"/pipelines/".concat(c,"/logs"),href:"/pipelines/[pipeline]/logs"}},{Icon:r.ug,id:o.M.MONITOR,isSelected:function(){return o.M.MONITOR===e},label:function(){return"Monitor"},linkProps:{as:"/pipelines/".concat(c,"/monitors"),href:"/pipelines/[pipeline]/monitors"}}];return i.qL.INTEGRATION===(null===n||void 0===n?void 0:n.type)&&u.unshift({Icon:r.Nt,id:o.M.SYNCS,isSelected:function(){return o.M.SYNCS===e},label:function(){return"Syncs"},linkProps:{as:"/pipelines/".concat(c,"/syncs"),href:"/pipelines/[pipeline]/syncs"}}),(0,l.Ct)()||(u.unshift({Icon:r.EK,disabled:!c,id:o.M.EDIT,isSelected:function(){return o.M.EDIT===e},label:function(){return"Edit pipeline"},linkProps:{as:"/pipelines/".concat(c,"/edit"),href:"/pipelines/[pipeline]/edit"}}),u.push({Icon:r.Zr,id:o.M.SETTINGS,isSelected:function(){return o.M.SETTINGS===e},label:function(){return"Pipeline settings"},linkProps:{as:"/pipelines/".concat(c,"/settings"),href:"/pipelines/[pipeline]/settings"}})),u}},58122:function(e,n,t){"use strict";t.d(n,{FS:function(){return u},JZ:function(){return s},e7:function(){return d},wx:function(){return a}});var i=t(75582),r=t(82394),o=t(93348);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 c(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,r.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}function u(e){return"string"===typeof e?e:JSON.stringify(e)}function a(e,n){var t,i;return null===e||void 0===e||null===(t=e.find((function(e){var t=e.block;return n(t)})))||void 0===t||null===(i=t.variables)||void 0===i?void 0:i.map((function(e){var n=e.value;return c(c({},e),{},{value:u(n)})}))}function s(e,n){return n===o.Xm.TIME?e.push({uuid:"execution_date",value:"<run datetime>"}):n===o.Xm.EVENT&&e.push({uuid:"event",value:"<trigger event>"}),e}function d(e){return e?Object.entries(e).reduce((function(e,n){var t=(0,i.Z)(n,2),o=t[0],l=t[1],u=l;try{u=JSON.parse(l)}catch(a){}return c(c({},e),{},(0,r.Z)({},o,u))}),{}):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(38626),a=t(90948),s=t(84969),d=t(65743),f=t(85587),p=t(79487),h=t(52136),v=t(67778),m=t(29989),b=t(17066),g=t(84482),x=t(76771),j=t(98889),y=t(65376),k=t(61655),Z=t(97745),O=t(48072),P=t(10103),C=t(84181),w=t(24903),_=t(67971),S=t(19711),E=t(52359),I=t(23831),T=t(80906),D=t(73899),M=t(2005),A=t(31012),B=t(49125),R=t(24224),N=t(344),L=t(45739),F=t(28598),U=["areaBetweenLines","data","events","height","lineLegendNames","margin","width","xAxisLabel","xLabelFormat","yAxisLabel","yLabelFormat"];function H(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 z(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?H(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):H(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var V=z(z({},y.j),{},{backgroundColor:I.Z.background.muted,border:"none"}),W=(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,_=e.gridProps,E=void 0===_?{}:_,U=e.height,H=e.hideGridX,W=e.hideTooltip,G=e.increasedXTicks,K=e.lineLegendNames,Y=e.margin,q=e.noCurve,Q=e.numYTicks,J=e.renderXTooltipContent,X=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=I.Z.monotone.gray,ve=I.Z.brand.wind200,me=I.Z.content.muted,be=I.Z.monotone.gray,ge=t.map((function(e){return Number(fe(e))}));if(le<10)return null;var xe=le-Y.left-Y.right,je=U-Y.top-Y.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)(ge)),Math.max.apply(Math,(0,r.Z)(ge))],range:[0,xe]})}),[xe,ge]),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||[]))})))),Pe=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,Pe],nice:!0,range:[je,0]})}),[je,Pe,Oe]),we=le>520?G?20:10:G?10:5,_e=(0,L.K)(de),Se=me,Ee=_e.map((function(e){return{stroke:e}})),Ie=(0,w.Z)({domain:K||[],range:Ee.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-Y.left),r=(0,R.ry)(ge,(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,P.range)(0,ke).map((function(e){return Ce(pe(c,e))}));pe(c)&&$({tooltipData:z(z({},c),{},{index:r}),tooltipLeft:n,tooltipTop:u})}),[t,fe,pe,Y,$,Ze,Ce]),De={};return q||(De.curve=Z.ZP),(0,F.jsxs)(F.Fragment,{children:[K&&(0,F.jsx)("div",{style:{marginLeft:null===Y||void 0===Y?void 0:Y.left},children:(0,F.jsx)(b.Z,{labelFormat:function(e){return e},scale:Ie,children:function(e){return(0,F.jsx)("div",{style:{display:"flex",flexDirection:T.qs.ROW},children:e.map((function(e,n){return(0,F.jsxs)(g.Z,{margin:"0 5px",onClick:function(){o&&alert("clicked: ".concat(JSON.stringify(e)))},children:[(0,F.jsx)("svg",{height:15,width:15,children:(0,F.jsx)("rect",{fill:e.value,height:15,width:15})}),(0,F.jsx)(x.Z,{align:"left",margin:"0 0 0 4px",children:(0,F.jsx)(S.ZP,{small:!0,children:e.text})})]},"legend-quantile-".concat(n))}))})}})}),(0,F.jsxs)("svg",{height:U,width:le,children:[!n&&(0,F.jsx)(d.Z,{fill:"transparent",height:U,onMouseLeave:function(){return W()},onMouseMove:Te,onTouchMove:Te,onTouchStart:Te,rx:14,width:le-(Y.left+Y.right),x:Y.left,y:0}),(0,F.jsxs)(m.Z,{left:Y.left,top:Y.top,children:[!H&&(0,F.jsx)(h.Z,z({height:je,pointerEvents:"none",scale:Ze,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,F.jsx)(v.Z,z({height:je,pointerEvents:"none",scale:Ce,stroke:he,strokeDasharray:"3,3",strokeOpacity:.4,width:xe},E)),(0,F.jsx)("line",{stroke:he,x1:xe,x2:xe,y1:0,y2:je}),(0,F.jsx)(a.Z,{numTicks:we,scale:Ze,stroke:Se,tickFormat:function(e){return ce?ce(e):e},tickLabelProps:function(e){return{fill:me,fontFamily:M.ry,fontSize:A.J5,textAnchor:"middle",transform:ae&&"rotate(-45, ".concat(Ze(e),", 0) translate(-32, 4)")}},tickStroke:Se,top:je}),(0,F.jsx)(s.Z,{hideTicks:!0,numTicks:Q,scale:Ce,stroke:Se,tickFormat:function(e){return se?se(e):(0,N.P5)(e)},tickLabelProps:function(e){return{dx:String(e).length>4?3:0,fill:me,fontFamily:M.ry,fontSize:A.J5,textAnchor:"end",transform:"translate(0,2.5)"}},tickStroke:Se}),n&&n.map((function(e){var n=e[0],i=e[1];return(0,l.createElement)(j.Z,z(z({},De),{},{aboveAreaProps:{fill:I.Z.brand.earth400,fillOpacity:.3},belowAreaProps:{fill:ve,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,P.range)(0,ke).map((function(e){return(0,l.createElement)(f.Z,z(z({},De),{},{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)))}},Ee[e]))}))]}),ne&&(0,F.jsxs)("g",{children:[(0,F.jsx)(p.Z,{from:{x:ie,y:Y.top},pointerEvents:"none",stroke:D.Ej,strokeDasharray:"5,2",strokeWidth:1,to:{x:ie,y:je+Y.top}}),oe.map((function(e,n){return(0,F.jsx)("circle",{cx:ie,cy:e+1+Y.top,fill:Ee[n].stroke,fillOpacity:.1,pointerEvents:"none",r:4,stroke:be,strokeOpacity:.1,strokeWidth:1},n)})),oe.map((function(e,n){return(0,F.jsx)("circle",{cx:ie,cy:e+Y.top,fill:Ee[n].stroke,pointerEvents:"none",r:4,stroke:Ee[n].stroke,strokeWidth:2},n)}))]})]}),ne&&(0,F.jsxs)("div",{children:[oe.map((function(e,n){var t=pe(ne,n);return n>=1&&Math.abs(oe[n-1]-e)<5*B.iI&&(e+=3*B.iI),(0,F.jsxs)(y.Z,{left:ie>ye?ie-(0,N.Vs)(X,ne,n)*B.iI:ie+B.iI,style:V,top:e-2*B.iI,children:[X&&X(ne,n),!X&&(0,F.jsxs)(S.ZP,{center:!0,small:!0,children:[t.toFixed?t.toFixed(3):t," ",null===K||void 0===K?void 0:K[n]]})]},n)})),(0,F.jsxs)(y.Z,{left:ie>ye?ie-4*(0,N.Vs)(J,ne):ie,style:z(z({},V),{},{transform:"translateX(-65%)"}),top:je+Y.top,children:[J&&J(ne),!J&&(0,F.jsx)(S.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,U),v=z(z({},{bottom:3*B.iI,left:5*B.iI,right:3*B.iI,top:3*B.iI}),u);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{style:{display:"flex",height:r,marginBottom:B.iI,width:"100%"},children:[f&&(0,F.jsx)(_.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,F.jsx)(E.Z,{children:(0,F.jsx)(S.ZP,{center:!0,muted:!0,small:!0,children:f})})}),(0,F.jsx)("div",{style:{height:r,width:"undefined"===typeof a?"100%":a},children:(0,F.jsx)(c.Z,{children:function(e){var i=e.width,r=e.height;return(0,F.jsx)(W,z(z({},h),{},{areaBetweenLines:n,data:t,height:r,lineLegendNames:o,margin:v,width:i,xLabelFormat:d,yLabelFormat:p}))}})})]}),s&&(0,F.jsx)("div",{style:{paddingLeft:f?36:0,paddingTop:4},children:(0,F.jsx)(S.ZP,{center:!0,muted:!0,small:!0,children:s})})]})}},21853:function(e,n,t){"use strict";t.d(n,{Z:function(){return S}});var i=t(82394),r=t(75582),o=t(82684),l=t(83455),c=t(60328),u=t(34744),a=t(93461),s=t(67971),d=t(87372),f=t(10919),p=t(29237),h=t(86673),v=t(19711),m=t(82944),b=t(70902),g=t(82531),x=t(38626),j=t(23831),y=t(73942),k=t(49125),Z=x.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-1b0w59t-0"})(["border-radius:","px;padding:","px;",""],y.n_,k.cd*k.iI,(function(e){return"\n background-color: ".concat((e.theme.background||j.Z.background).codeArea,";\n ")})),O=t(96510),P=t(9728),C=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){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 S=function(e){var n=e.cancelButtonText,t=e.contained,x=e.header,j=e.onCancel,y=e.onSaveSuccess,w=(0,P.VI)(null,{},[],{uuid:"settings/workspace/preferences"}),S=(0,r.Z)(w,1)[0],E=(0,o.useState)(null),I=E[0],T=E[1],D=g.ZP.projects.list(),M=D.data,A=D.mutate,B=(0,o.useMemo)((function(){var e;return null===M||void 0===M||null===(e=M.projects)||void 0===e?void 0:e[0]}),[M]),R=B||{},N=R.name,L=R.project_uuid;(0,o.useEffect)((function(){I||T(B)}),[B,I]);var F=(0,l.Db)(g.ZP.projects.useUpdate(N),{onSuccess:function(e){return(0,O.wD)(e,{callback:function(e){var n=e.project;A(),T(n),y&&(null===y||void 0===y||y(n))},onErrorCallback:function(e,n){return S({errors:n,response:e})}})}}),U=(0,r.Z)(F,2),H=U[0],z=U[1].isLoading,V=(0,o.useCallback)((function(e){return H({project:e})}),[H]),W=(0,C.jsxs)(C.Fragment,{children:[x,(0,C.jsxs)(p.Z,{noPadding:!0,children:[(0,C.jsxs)(h.Z,{p:k.cd,children:[(0,C.jsx)(h.Z,{mb:1,children:(0,C.jsx)(d.Z,{level:5,children:"Project name"})}),(0,C.jsx)(v.ZP,{default:!0,monospace:!0,children:N})]}),(0,C.jsx)(u.Z,{light:!0}),(0,C.jsxs)(h.Z,{p:k.cd,children:[(0,C.jsx)(h.Z,{mb:1,children:(0,C.jsx)(d.Z,{level:5,children:"Project UUID"})}),(0,C.jsx)(v.ZP,{default:!!L,monospace:!0,muted:!L,children:L||"Not required"})]}),(0,C.jsx)(u.Z,{light:!0}),(0,C.jsx)(h.Z,{p:k.cd,children:(0,C.jsxs)(s.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,C.jsxs)(a.Z,{flexDirection:"column",children:[(0,C.jsx)(h.Z,{mb:1,children:(0,C.jsx)(d.Z,{level:5,children:"Help improve Mage"})}),(0,C.jsxs)(v.ZP,{default:!0,children:["Please contribute usage statistics to help improve the developer experience for you and everyone in the community. Learn more ",(0,C.jsx)(f.Z,{href:"https://docs.mage.ai/contributing/statistics/overview",openNewWindow:!0,children:"here"}),"."]})]}),(0,C.jsx)(h.Z,{mr:k.cd}),(0,C.jsx)(b.Z,{checked:null===I||void 0===I?void 0:I.help_improve_mage,onCheck:function(){return T((function(e){return _(_({},e),{},{help_improve_mage:!(null!==I&&void 0!==I&&I.help_improve_mage)})}))}})]})})]}),(0,C.jsx)(h.Z,{mt:k.HN}),(0,C.jsx)(p.Z,{noPadding:!0,children:(0,C.jsxs)(h.Z,{p:k.cd,children:[(0,C.jsx)(h.Z,{mb:1,children:(0,C.jsx)(d.Z,{level:5,children:"Features"})}),Object.entries((null===I||void 0===I?void 0:I.features)||{}).map((function(e){var n=(0,r.Z)(e,2),t=n[0],o=n[1];return(0,C.jsxs)(s.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,C.jsx)(v.ZP,{default:!0,monospace:!0,children:t}),(0,C.jsx)(h.Z,{mr:k.cd}),(0,C.jsx)(b.Z,{checked:!!o,onCheck:function(){return T((function(e){return _(_({},e),{},{features:_(_({},null===I||void 0===I?void 0:I.features),{},(0,i.Z)({},t,!o))})}))}})]},t)}))]})}),(0,C.jsx)(h.Z,{mt:k.HN}),(0,C.jsx)(p.Z,{noPadding:!0,children:(0,C.jsxs)(h.Z,{p:k.cd,children:[(0,C.jsx)(h.Z,{mb:1,children:(0,C.jsx)(d.Z,{level:5,children:"OpenAI"})}),(0,C.jsx)(m.Z,{label:"API key",monospace:!0,onChange:function(e){return T((function(n){return _(_({},n),{},{openai_api_key:e.target.value})}))},primary:!0,setContentOnMount:!0,value:(null===I||void 0===I?void 0:I.openai_api_key)||""})]})}),(0,C.jsx)(h.Z,{mt:k.HN}),(0,C.jsxs)(s.Z,{alignItems:"center",children:[(0,C.jsx)(c.Z,{loading:z,onClick:function(){V({features:null===I||void 0===I?void 0:I.features,help_improve_mage:null===I||void 0===I?void 0:I.help_improve_mage,openai_api_key:null===I||void 0===I?void 0:I.openai_api_key})},primary:!0,children:"Save project settings"}),j&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.Z,{mr:k.cd}),(0,C.jsx)(c.Z,{onClick:j,secondary:!0,children:n||"Cancel"})]})]})]});return t?(0,C.jsx)(Z,{children:W}):W}},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","justifyContent","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.justifyContent,d=e.style,f=void 0===d?{}:d,p=(0,r.Z)(e,u),h=s({},f);return i&&(h.marginLeft=-1*i,h.marginRight=h.marginLeft),t&&(h.height="100%"),(0,c.jsx)(l.Row,s(s({},p),{},{justifyContent:a,style:h,children:o.Children.map(n,(function(e,n){return e&&o.cloneElement(e,{gutter:i,key:n})}))}))}},18221:function(e,n,t){"use strict";var i;t.d(n,{R:function(){return r}}),function(e){e.AZURE_CONTAINER_INSTANCE="azure_container_instance",e.ECS="ecs",e.GCP_CLOUD_RUN="gcp_cloud_run",e.K8S="k8s",e.LOCAL_PYTHON="local_python",e.PYSPARK="pyspark"}(i||(i={}));var r=[i.AZURE_CONTAINER_INSTANCE,i.ECS,i.GCP_CLOUD_RUN,i.K8S,i.LOCAL_PYTHON,i.PYSPARK]},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)},52769:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var i="global"},65730:function(e,n,t){"use strict";var i,r=t(82394),o=(t(82684),t(64866)),l=t(21764),c=t(67971),u=t(10919),a=t(86673),s=t(19711),d=t(46261),f=t(22341),p=t(49125),h=t(28598);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 m(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,r.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}!function(e){e.LEFT="left",e.RIGHT="right"}(i||(i={})),n.Z=function(e){var n,t=e.children,r=e.copiedText,v=e.iconPosition,b=void 0===v?i.LEFT:v,g=e.inverted,x=e.linkProps,j=e.linkText,y=e.monospace,k=e.muted,Z=e.small,O=e.toastMessage,P=e.withCopyIcon;return t?n=(0,h.jsx)("span",{children:t}):P&&(n=(0,h.jsx)(u.Z,m(m({href:"#",inline:!0,muted:k,preventDefault:!0,sameColorAsText:!0,small:Z},x),{},{children:(0,h.jsxs)(c.Z,{alignItems:"center",children:[b===i.LEFT&&(0,h.jsx)(a.Z,{mr:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k,size:2*p.iI})})}),j&&(0,h.jsx)(s.ZP,{inverted:g,monospace:y,muted:k,small:Z,children:j}),b===i.RIGHT&&(0,h.jsx)(a.Z,{ml:j?1:0,children:(0,h.jsx)(c.Z,{alignItems:"center",children:(0,h.jsx)(f.CK,{inverted:g,muted:k})})})]})}))),(0,h.jsx)(d.Z,{block:!0,label:"Copy",size:null,widthFitContent:!0,children:(0,h.jsx)(o.CopyToClipboard,{onCopy:function(){return l.Am.success(O||"Successfully copied to clipboard.",{position:l.Am.POSITION.BOTTOM_RIGHT,toastId:r})},text:r,children:n})})}},18776:function(e,n,t){"use strict";t.d(n,{Z:function(){return u}});var i=t(38626),r=t(23831),o=t(73942),l=i.default.div.withConfig({displayName:"indexstyle__PanelStyle",componentId:"sc-1rfr5wd-0"})(["border-radius:","px;"," ",""],o.n_,(function(e){return"\n background-color: ".concat((e.theme.background||r.Z.background).panel,";\n ")}),(function(e){return e.fullWidth&&"\n width: 100%;\n "})),c=t(28598);var u=function(e){var n=e.children,t=e.fullWidth,i=void 0===t||t;return(0,c.jsx)(l,{fullWidth:i,children:n})}},72555:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return no}});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=t(48591),h=t(35490),v=t(86422),m=t(38626),b=t(38341),g=t(16634),x=t(34744),j=t(93461),y=t(67971),k=t(10919),Z=t(86673),O=t(19711),P=t(49125),C=t(44162),w=t(28598);function _(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?_(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):_(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var E=function(e){var n=e.blockRefs,t=e.hiddenBlocks,i=e.pipeline,r=e.setHiddenBlocks,l=(0,s.useContext)(m.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)(Z.Z,{p:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(j.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)(j.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 S(S({},e),{},(0,o.Z)({},t,!0))}),{})}))}})})]})}),(0,w.jsx)(x.Z,{medium:!0}),null===c||void 0===c?void 0:c.map((function(e){var n=e.uuid,i=(0,C.qn)(e.type,{blockColor:e.color,theme:l}).accent,c=!(null!==t&&void 0!==t&&t[n]);return(0,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,noOutline:!0,onClick:function(){r((function(e){return S(S({},e),{},(0,o.Z)({},n,c))})),c||setTimeout((function(){return h(e)}),1)},preventDefault:!0,children:(0,w.jsx)(Z.Z,{mt:1,px:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(Z.Z,{pr:1,children:(0,w.jsx)(b.Z,{checked:c})}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(g.Z,{color:i,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{default:!0,monospace:!0,noWrapping:!0,small:!0,children:n})]})]})})},n)}))]})},I=t(2485),T=t(60328),D=t(32316),M=t(65701),A=t(1254);var B=function(e){var n=e.size;return(0,w.jsxs)("svg",{width:n,height:n,viewBox:"0 0 121 121",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,w.jsx)("path",{d:"M67.7193 2.36691C69.8656 1.52184 72.3078 2.0081 73.9667 3.61084L116.977 45.1646C119.018 47.1366 119.362 50.2841 117.794 52.65L92.5787 90.7113C92.1293 91.3897 91.5441 91.9675 90.8601 92.4083L51.1076 118.029C48.6859 119.589 45.4904 119.168 43.5558 117.033L3.02296 72.3013C1.48382 70.6027 1.07052 68.1652 1.96372 66.0542L20.1894 22.9792C20.8058 21.5224 21.9825 20.3749 23.4544 19.7954L67.7193 2.36691Z",fill:"url(#paint0_radial_11972_15232)"}),(0,w.jsx)("path",{d:"M71.2431 0.979492L23.6155 19.9931C22.1646 20.5723 21.0034 21.7045 20.3877 23.1402L0.499023 69.5159L20.1894 22.9792C20.8058 21.5224 21.9825 20.3749 23.4544 19.7954L71.2431 0.979492Z",fill:"url(#paint1_radial_11972_15232)"}),(0,w.jsx)("path",{d:"M66.8804 2.66681C69.0294 1.81866 71.4758 2.30583 73.1359 3.9125L116.693 46.0674C117.169 46.5283 117.061 47.3191 116.478 47.635L75.3823 69.9165C74.5929 70.3446 73.6135 70.1821 73.0046 69.522L27.1285 19.7915C26.661 19.2848 26.8482 18.4667 27.4895 18.2136L66.8804 2.66681Z",fill:"url(#paint3_radial_11972_15232)"}),(0,w.jsx)("path",{d:"M66.8804 2.66681C69.0294 1.81866 71.4758 2.30583 73.1359 3.9125L116.693 46.0674C117.169 46.5283 117.061 47.3191 116.478 47.635L75.3823 69.9165C74.5929 70.3446 73.6135 70.1821 73.0046 69.522L27.1285 19.7915C26.661 19.2848 26.8482 18.4667 27.4895 18.2136L66.8804 2.66681Z",fill:"url(#paint4_linear_11972_15232)"}),(0,w.jsx)("path",{d:"M23.3591 24.6945L58.2913 58.6736L25.3897 22.7247C24.8455 22.13 23.9152 22.1095 23.3452 22.6795C22.7871 23.2375 22.7934 24.1442 23.3591 24.6945Z",fill:"url(#paint5_radial_11972_15232)"}),(0,w.jsx)("path",{d:"M51.6694 46.395L73.0043 69.5215C73.6132 70.1816 74.5925 70.3441 75.382 69.9161L117.654 46.9975L75.6257 67.8209C74.8809 68.1899 73.9844 68.0497 73.3879 67.4708L51.6694 46.395Z",fill:"url(#paint6_radial_11972_15232)"}),(0,w.jsxs)("defs",{children:[(0,w.jsxs)("radialGradient",{id:"paint0_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(16.9412 88.4412) rotate(18.02) scale(82.0367 81.4644)",children:[(0,w.jsx)("stop",{stopColor:"#FFDA19"}),(0,w.jsx)("stop",{offset:"0.473958",stopColor:"#33CDF2"}),(0,w.jsx)("stop",{offset:"0.786458",stopColor:"#3266FF"}),(0,w.jsx)("stop",{offset:"1",stopColor:"#5429FF"})]}),(0,w.jsxs)("radialGradient",{id:"paint1_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.8711 10.2518) rotate(87.6364) scale(26.1711 27.0141)",children:[(0,w.jsx)("stop",{stopColor:"white"}),(0,w.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,w.jsxs)("radialGradient",{id:"paint2_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(150.671 44.2502) rotate(128.639) scale(125.554 128.436)",children:[(0,w.jsx)("stop",{stopColor:"white"}),(0,w.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,w.jsxs)("radialGradient",{id:"paint3_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(133.353 52.8357) rotate(144.647) scale(86.7385 72.7129)",children:[(0,w.jsx)("stop",{offset:"0.081278",stopColor:"white"}),(0,w.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,w.jsxs)("linearGradient",{id:"paint4_linear_11972_15232",x1:"76.5876",y1:"66.532",x2:"79.1358",y2:"50.4429",gradientUnits:"userSpaceOnUse",children:[(0,w.jsx)("stop",{stopColor:"white"}),(0,w.jsx)("stop",{offset:"0.416667",stopColor:"white",stopOpacity:"0.1"}),(0,w.jsx)("stop",{offset:"0.682292",stopColor:"white",stopOpacity:"0"})]}),(0,w.jsxs)("radialGradient",{id:"paint5_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(25.2251 23.4978) rotate(48.3599) scale(35.5147 43.1672)",children:[(0,w.jsx)("stop",{stopColor:"white"}),(0,w.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),(0,w.jsxs)("radialGradient",{id:"paint6_radial_11972_15232",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(76.5908 67.6516) rotate(104.629) scale(14.9575 79.0374)",children:[(0,w.jsx)("stop",{stopColor:"white"}),(0,w.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]})]})},R=t(89949),N=t(11135),L=t(33572),F=t(98781),U=t(55378),H=t(54283),z=t(82944),V=t(82531),W=t(22341),G=t(23831),K=t(73942),Y=m.default.div.withConfig({displayName:"indexstyle__ContainerStyle",componentId:"sc-h093u4-0"})([""," ",""],(function(e){return!e.width&&"\n width: ".concat(40*P.iI,"px;\n ")}),(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")})),q=m.default.div.withConfig({displayName:"indexstyle__HeaderStyle",componentId:"sc-h093u4-1"})(["padding:","px;",""],2.5*P.iI,(function(e){return"\n background-color: ".concat((e.theme.background||G.Z.background).dashboard,";\n border-left: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-top-left-radius: ").concat(K.n_,"px;\n border-top-right-radius: ").concat(K.n_,"px;\n border-top: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n ")})),Q=m.default.div.withConfig({displayName:"indexstyle__RowStyle",componentId:"sc-h093u4-2"})(["align-items:center;justify-content:space-between;",""],(function(e){return"\n background-color: ".concat((e.theme.background||G.Z.background).dashboard,";\n border-left: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-top: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n display: ").concat((null===e||void 0===e?void 0:e.display)||"flex",";\n padding-bottom: ").concat(1*P.iI+((null===e||void 0===e?void 0:e.paddingVerticalAddition)||0),"px;\n padding-left: ").concat(P.cd*P.iI,"px;\n padding-top: ").concat(1*P.iI+((null===e||void 0===e?void 0:e.paddingVerticalAddition)||0),"px;\n ")})),J=m.default.div.withConfig({displayName:"indexstyle__FooterStyle",componentId:"sc-h093u4-3"})(["padding:","px ","px;",""],2.5*P.iI,2*P.iI,(function(e){return"\n background-color: ".concat((e.theme.background||G.Z.background).panel,";\n border-bottom-left-radius: ").concat(K.n_,"px;\n border-bottom-right-radius: ").concat(K.n_,"px;\n border-bottom: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-left: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n border-right: 1px solid ").concat((e.theme.interactive||G.Z.interactive).defaultBorder,";\n ")})),X=t(72470),$=t(90211),ee=t(96510),ne=t(9728);function te(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 ie(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?te(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):te(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var re=function(e){var n,t=e.block,i=e.defaultName,r=e.onClose,o=e.onSave,c=e.pipeline,u=(0,ne.VI)(null,{},[],{uuid:"ConfigureBlock"}),a=(0,l.Z)(u,1)[0],f=(0,s.useRef)(null),p=(0,s.useState)({language:null===t||void 0===t?void 0:t.language,name:i,type:null===t||void 0===t?void 0:t.type}),h=p[0],m=p[1];(0,s.useEffect)((function(){var e;null===f||void 0===f||null===(e=f.current)||void 0===e||e.focus()}),[]);var b=(0,s.useMemo)((function(){return F.qL.INTEGRATION===(null===c||void 0===c?void 0:c.type)}),[c]),g=(0,s.useMemo)((function(){return v.tf.CUSTOM===(null===t||void 0===t?void 0:t.type)}),[t]),x=(0,s.useMemo)((function(){return v.tf.MARKDOWN===(null===t||void 0===t?void 0:t.type)}),[t]),j=(0,s.useMemo)((function(){return null===t||void 0===t?void 0:t.block_action_object}),[t]),k=(0,s.useMemo)((function(){return X.L.GENERATE_BLOCK===(null===j||void 0===j?void 0:j.object_type)}),[j]),C=(0,s.useMemo)((function(){return k&&(null===j||void 0===j?void 0:j.description)}),[j,k]),_=(0,s.useState)(null),S=_[0],E=_[1],I=(0,d.Db)(V.ZP.llms.useCreate(),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.llm,t=(null===n||void 0===n?void 0:n.response)||{},i=t.block_type,r=t.configuration,o=t.content,l=t.language;m((function(e){return ie(ie({},e),{},{block_action_object:null,configuration:r,content:o,language:l,type:i})})),E(n)},onErrorCallback:function(e,n){return a({errors:n,response:e})}})}}),D=(0,l.Z)(I,2),G=D[0],K=D[1].isLoading;(0,s.useEffect)((function(){k&&C&&!S&&G({llm:{request:{block_description:C},use_case:L.z.GENERATE_BLOCK_WITH_DESCRIPTION}})}),[G,C,k,S]);var te=(0,s.useMemo)((function(){var e,n;return null!==t&&void 0!==t&&null!==(e=t.config)&&void 0!==e&&e.custom_template?null===t||void 0===t||null===(n=t.config)||void 0===n?void 0:n.custom_template:[X.L.CUSTOM_BLOCK_TEMPLATE,X.L.MAGE_TEMPLATE].includes(null===j||void 0===j?void 0:j.object_type)?ie(ie({},j),{},{name:null===j||void 0===j?void 0:j.title}):void 0}),[t,j]),re=(0,s.useMemo)((function(){var e=(null===h||void 0===h?void 0:h.type)||(null===t||void 0===t?void 0:t.type);te&&(e=null===te||void 0===te?void 0:te.block_type);var n=v.V4[e];return b&&(v.tf.DATA_LOADER===e?n="Source":v.tf.DATA_EXPORTER===e&&(n="Destination")),n}),[t,h,te,b]);return(0,w.jsxs)(Y,{width:k&&(null===h||void 0===h?void 0:h.content)&&80*P.iI,children:[(0,w.jsxs)(q,{children:[k&&K&&(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(O.ZP,{children:"Generating block using AI..."}),(0,w.jsx)(H.Z,{inverted:!0})]}),k&&!K&&(0,w.jsx)(y.Z,{alignItems:"center",justifyContent:"center",children:(0,w.jsx)(W.xq,{size:5*P.iI,warning:!0})}),!k&&(0,w.jsx)(y.Z,{alignItems:"center",justifyContent:"center",children:(0,w.jsx)(B,{size:15*P.iI})})]}),k&&!K&&(0,w.jsx)(Q,{children:(0,w.jsxs)(Z.Z,{py:1,children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(O.ZP,{default:!0,children:"Block generated using AI"})}),(0,w.jsx)(O.ZP,{textOverflow:!0,children:C})]})}),te&&(0,w.jsx)(Q,{children:(0,w.jsxs)(Z.Z,{py:1,children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(O.ZP,{default:!0,children:"Template"})}),(0,w.jsx)(O.ZP,{textOverflow:!0,children:null===(n=(null===te||void 0===te?void 0:te.name)||(null===te||void 0===te?void 0:te.template_uuid))||void 0===n?void 0:n.slice(0,40)})]})}),(0,w.jsxs)(Q,{children:[(0,w.jsx)(O.ZP,{default:!0,children:"Name"}),(0,w.jsx)(z.Z,{alignRight:!0,noBackground:!0,noBorder:!0,onChange:function(e){return m((function(n){return ie(ie({},n),{},{name:e.target.value})}))},paddingVertical:P.iI,placeholder:"Block name...",ref:f,value:(null===h||void 0===h?void 0:h.name)||""})]}),(0,w.jsxs)(Q,{children:[(0,w.jsx)(O.ZP,{default:!0,children:"Type"}),(0,w.jsx)(Z.Z,{mr:P.cd,py:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{muted:!0,children:re}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(W.QM,{muted:!0})]})})]}),!x&&(g||te||(null===h||void 0===h?void 0:h.language))&&(0,w.jsxs)(Q,{paddingVerticalAddition:3,children:[(0,w.jsx)(O.ZP,{default:!0,children:"Language"}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[[v.t6.PYTHON,v.t6.SQL,v.t6.R].reduce((function(e,n){var t=(te?null===te||void 0===te?void 0:te.language:null===h||void 0===h?void 0:h.language)===n;return g||t?(e.push((0,w.jsx)(Z.Z,{ml:1,children:(0,w.jsx)(T.Z,{borderColor:t?null:"transparent",compact:!0,default:!g&&!t,disabled:!g&&!t,noBackground:!0,onClick:te?null:function(){return m((function(e){return ie(ie({},e),{},{language:n})}))},selected:t,children:v.LE[n]})},n)),e):e}),[]),!g&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(W.QM,{muted:!0})]}),(0,w.jsx)(Z.Z,{mr:g?1:2})]})]}),(g||(null===te||void 0===te?void 0:te.color)||(null===h||void 0===h?void 0:h.color))&&(0,w.jsxs)(Q,{children:[(0,w.jsx)(O.ZP,{default:!0,children:"Color"}),g&&(0,w.jsxs)(U.Z,{alignRight:!0,noBackground:!0,noBorder:!0,onChange:function(e){return m((function(n){return ie(ie({},n),{},{color:e.target.value})}))},value:te?(null===te||void 0===te?void 0:te.color)||"":(null===h||void 0===h?void 0:h.color)||"",children:[(0,w.jsx)("option",{value:""}),Object.values(v.Lq).map((function(e){return(0,w.jsx)("option",{value:e,children:(0,$.kC)(e)},e)}))]}),!g&&(0,w.jsx)(Z.Z,{mr:P.cd,py:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{muted:!0,children:(0,$.kC)((null===te||void 0===te?void 0:te.color)||(null===h||void 0===h?void 0:h.color)||"")}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(W.QM,{muted:!0})]})})]}),k&&(null===h||void 0===h?void 0:h.content)&&(0,w.jsx)(Q,{display:"block",children:(0,w.jsx)(Z.Z,{pr:P.cd,py:1,children:(0,w.jsx)(M.W,{backend:A.PD,children:(0,w.jsx)(R.Z,{block:ie(ie({},h),{},{uuid:C}),defaultValue:null===h||void 0===h?void 0:h.content,disableDrag:!0,hideExtraCommandButtons:!0,hideExtraConfiguration:!0,hideHeaderInteractiveInformation:!0,noDivider:!0,onChange:function(e){return m((function(n){return ie(ie({},n),{},{content:e})}))},selected:!0,textareaFocused:!0},C)})})}),(0,w.jsx)(J,{children:(0,w.jsxs)(y.Z,{fullWidth:!0,children:[(0,w.jsx)(N.ZP,{bold:!0,centerText:!0,disabled:K,onClick:function(){return o(ie(ie({},h),{},{name:(null===h||void 0===h?void 0:h.name)||i}))},primary:!0,tabIndex:0,uuid:"ConfigureBlock/SaveAndAddBlock",children:"Save and add block"}),(0,w.jsx)(Z.Z,{ml:1,children:(0,w.jsx)(T.Z,{onClick:r,tabIndex:0,children:"Cancel"})})]})})]})},oe=t(46299),le=t(91207),ce=t(47999),ue=t(62084),ae=t(16115),se=t(64318),de=t(54405),fe=t(41150);function pe(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 he(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pe(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ve,me,be=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],v=p[1],m=(0,s.useRef)(null),b=(0,s.useRef)(null),g=(0,s.useRef)(null),x=[{label:function(){return"New standard pipeline"},onClick:function(){return i({pipeline:{name:(0,$.Y6)()}})},uuid:"new_standard_pipeline"},{label:function(){return"New streaming pipeline"},onClick:function(){return i({pipeline:{name:(0,$.Y6)(),type:F.qL.STREAMING}})},uuid:"new_streaming_pipeline"},{keyTextGroups:[[(0,de.V5)()?ae.RJ:ae.hE,ae.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:[[ae.kA],[ae.kA]],onClick:function(){return l()},uuid:"Interrupt kernel"},{label:function(){return"Restart kernel"},keyTextGroups:[[ae.t_[ae.OC]],[ae.t_[ae.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 he(he({},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]),k=(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"},{label:function(){return"Browse custom templates"},linkProps:{href:"/templates"},uuid:"browse_custom_templates"},{label:function(){return"Create custom templates"},linkProps:{href:"/templates?new=1"},uuid:"create_custom_templates"}]}),[u]),Z="FileHeaderMenu/index",P=(0,fe.y)(),C=P.registerOnKeyDown,_=P.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){_(Z)}}),[_,Z]),C(Z,(function(e,n,t){null!==h&&(n[ae.QK]?v((function(e){return 0===e?2:e-1})):n[ae.DY]&&v((function(e){return 2===e?0:e+1})))}),[h,v]),(0,w.jsx)(ce.Z,{onClickOutside:function(){return v(null)},open:!0,style:{position:"relative"},children:(0,w.jsxs)(y.Z,{children:[(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(se.u,{highlighted:0===h,onClick:function(){return v((function(e){return 0===e?null:0}))},onMouseEnter:function(){return v((function(e){return null!==e?0:null}))},ref:m,children:(0,w.jsx)(O.ZP,{children:"File"})}),(0,w.jsx)(ue.Z,{items:x,onClickCallback:function(){return v(null)},open:0===h,parentRef:m,uuid:"FileHeaderMenu/file_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(se.u,{highlighted:1===h,onClick:function(){return v((function(e){return 1===e?null:1}))},onMouseEnter:function(){return v((function(e){return null!==e?1:null}))},ref:b,children:(0,w.jsx)(O.ZP,{children:"Run"})}),(0,w.jsx)(ue.Z,{items:j,onClickCallback:function(){return v(null)},open:1===h,parentRef:b,uuid:"FileHeaderMenu/run_items"})]}),(0,w.jsxs)("div",{style:{position:"relative"},children:[(0,w.jsx)(se.u,{highlighted:2===h,onClick:function(){return v((function(e){return 2===e?null:2}))},onMouseEnter:function(){return v((function(e){return null!==e?2:null}))},ref:g,children:(0,w.jsx)(O.ZP,{children:"Edit"})}),(0,w.jsx)(ue.Z,{items:k,onClickCallback:function(){return v(null)},open:2===h,parentRef:g,uuid:"FileHeaderMenu/edit_items"})]}),t]})})},ge=t(38488),xe=t(57384);!function(e){e.CREATE_NEW_CLUSTER="create_new_cluster",e.SET_ACTIVE_CLUSTER="set_active_cluster"}(ve||(ve={})),function(e){e.BOOTSTRAPPING="BOOTSTRAPPING",e.STARTING="STARTING",e.WAITING="WAITING"}(me||(me={}));var je,ye=t(90686),ke=t(62609),Ze=t(46261),Oe=t(66166);!function(e){e.EMR="emr"}(je||(je={}));var Pe=t(91427),Ce=t(28347),we=t(42305),_e=t(24224),Se=t(33766),Ee=t(99497);var Ie=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,v=e.setRunningBlocks,b=e.updatePipelineMetadata,x=(0,s.useContext)(m.ThemeContext),C=c||{},_=C.alive,S=C.usage,E=(0,s.useState)(!1),I=E[0],T=E[1],D=(0,s.useState)(""),M=D[0],A=D[1],B=(0,s.useState)(je.EMR),R=B[0],L=(B[1],(0,s.useState)(!1)),U=L[0],H=L[1],z=(0,s.useState)(!1),K=z[0],Y=z[1],q=(0,s.useRef)(null),Q=V.ZP.clusters.detail(R,{},{revalidateOnFocus:!1}),J=Q.data,X=Q.mutate,$=(0,s.useMemo)((function(){var e;return(null===J||void 0===J||null===(e=J.cluster)||void 0===e?void 0:e.clusters)||[]}),[J]),ne=(0,s.useMemo)((function(){return(0,_e.sE)($,(function(e){return e.is_active}))}),[$]),te=(0,d.Db)(V.ZP.clusters.useUpdate(R),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){X()},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),ie=(0,l.Z)(te,1)[0];(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,we.JX)(Number(f)/1e3)):"All changes saved";var re="KernelStatus",oe=(0,fe.y)(),le=oe.registerOnKeyDown,se=oe.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){se(re)}}),[se,re]),le(re,(function(e,n,t){I&&String(t[0])===String(ae.Uq)&&String(t[1])!==String(ae.zX)&&((null===u||void 0===u?void 0:u.uuid)===M?e.target.blur():(b(M),T(!1)))}),[I,M,T,b]);var pe=(0,s.useMemo)((function(){return null===S||void 0===S?void 0:S.pid}),[null===S||void 0===S?void 0:S.pid]),he=(0,Oe.Z)(pe),ve=(0,s.useMemo)((function(){if(null!==S&&void 0!==S&&S.kernel_memory){var e=S.kernel_memory,n=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,n)).toFixed(2))).concat(["B","KB","MB","GB","TB","PB","EB","ZB","YB"][n])}}),[null===S||void 0===S?void 0:S.kernel_memory]),be=(0,Ee.dd)((function(){return(0,w.jsx)(ke.Z,{cancelText:"Close",centerOnScreen:!0,confirmText:"Don't show again",neutral:!0,onCancel:Ie,onClick:function(){(0,Pe.t8)(Pe.DU,1),Ie()},subtitle:"You may need to refresh your page to continue using the notebook. Unexpected kernel restarts may be caused by your kernel running out of memory.",title:"The kernel has restarted",width:34*P.iI})}),{},[],{background:!0,uuid:"restart_kernel_warning"}),ge=(0,l.Z)(be,2),xe=ge[0],Ie=ge[1];(0,s.useEffect)((function(){var e=(0,Pe.U2)(Pe.DU,0);pe!==he&&i&&!e&&(xe(),v([]))}),[i,pe,he,v,xe]);var Te=(0,s.useMemo)((function(){return(0,w.jsx)("div",{ref:q,style:{position:"relative"},children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(null===u||void 0===u?void 0:u.type)===F.qL.PYSPARK&&(0,w.jsxs)(Z.Z,{mr:1,children:[(0,w.jsxs)(k.Z,{muted:!!ne,onClick:function(){return H(!0)},preventDefault:!0,sameColorAsText:!ne,underline:!ne,children:[ne&&ne.id,!ne&&"Select cluster"]}),(0,w.jsx)(ce.Z,{disableEscape:!0,onClickOutside:function(){return H(!1)},open:U,children:(0,w.jsx)(ue.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select cluster"},uuid:"select_cluster"}].concat((0,r.Z)($.map((function(e){var n=e.id,t=e.is_active,i=e.status;return{label:function(){return(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsx)(j.Z,{flex:1,children:(0,w.jsx)(O.ZP,{muted:!t&&me.WAITING!==i,children:n})}),t&&(0,w.jsx)(W.Jr,{size:2*P.iI,success:!0}),!t&&(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:i})]})},onClick:t||me.WAITING!==i?null:function(){return ie({cluster:{id:n,is_active:!0}})},uuid:n}})))),onClickCallback:function(){return H(!1)},open:U,parentRef:q,uuid:"KernelStatus/select_cluster",width:40*P.iI})})]}),(0,w.jsx)(N.ZP,{beforeElement:(0,w.jsx)(g.Z,{color:i?(x||G.Z).borders.info:_?(x||G.Z).borders.success:(x||G.Z).borders.danger,size:P.iI}),blackBorder:!0,compact:!0,inline:!0,onClick:function(){return Y(!0)},uuid:"Pipeline/KernelStatus/kernel",children:(null===u||void 0===u?void 0:u.type)||F.qL.PYTHON}),(0,w.jsx)(ce.Z,{disableEscape:!0,onClickOutside:function(){return Y(!1)},open:K,children:(0,w.jsx)(ue.Z,{items:[{isGroupingTitle:!0,label:function(){return"Select kernel"},uuid:"select_kernel"}].concat((0,r.Z)(Object.keys(F.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 b(null===u||void 0===u?void 0:u.name,e)},uuid:e}})))),onClickCallback:function(){return Y(!1)},open:K,parentRef:q,uuid:"KernelStatus/select_kernel",width:25*P.iI})})]})})}),[_,$,i,u,ne,H,Y,U,K,x,ie,b]);return(0,w.jsx)(Ce.rK,{relativePosition:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"space-between",children:[(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"flex-start",children:[(0,w.jsxs)(Z.Z,{px:P.cd,children:[p&&(0,w.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:p?function(){return(0,Se.u7)({file_path:null})}:null,preventDefault:!0,children:t}),!p&&(0,w.jsxs)(y.Z,{alignItems:"center",children:[t,I&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(k.Z,{onClick:function(){b(M),T(!1)},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update name"})]})]})]}),S&&(0,w.jsx)(Z.Z,{mr:P.cd,children:(0,w.jsxs)(j.Z,{flexDirection:"column",children:[(0,w.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["CPU: ",null===S||void 0===S?void 0:S.kernel_cpu,"undefined"!==typeof(null===S||void 0===S?void 0:S.kernel_cpu)&&"%"]}),(0,w.jsxs)(O.ZP,{monospace:!0,muted:!0,xsmall:!0,children:["Memory: ",ve]})]})})]}),(0,w.jsx)(Z.Z,{px:P.cd,children:(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Ze.Z,{appearBefore:!0,block:!0,description:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"Press"}),"\xa0",(0,w.jsx)(ye.Z,{inline:!0,keyText:(0,de.V5)()?ae.RJ:ae.hE}),"\xa0",(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"+"}),"\xa0",(0,w.jsx)(ye.Z,{inline:!0,keyText:ae.SS}),"\xa0",(0,w.jsx)(O.ZP,{default:!0,inline:!0,children:"to save changes."}),(0,w.jsx)("br",{})]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Or, go to ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"File"})," \u203a ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:"Save pipeline"}),"."]})})]}),size:null,widthFitContent:!0,children:(0,w.jsx)(O.ZP,{muted:!0,children:n})}),(0,w.jsx)(Z.Z,{ml:2}),Te]})})]})})},Te=t(82635),De=t(17717),Me=t(12691),Ae=t.n(Me),Be=t(16910),Re=t(28317),Ne=t(25717),Le=t(37391),Fe=t(90880),Ue=6.25*P.iI,He=(P.iI,100*P.iI),ze=m.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%);",""],K.n_,He,(function(e){return"\n box-shadow: ".concat((e.theme||G.Z).shadow.window,";\n background-color: ").concat((e.theme||G.Z).background.panel,";\n ")})),Ve=(0,m.css)(["display:flex;align-items:center;justify-content:space-between;height:","px;padding:","px ","px;",""],Ue,P.iI,P.cd*P.iI,(function(e){return"\n background-color: ".concat((e.theme||G.Z).background.output,";\n ")})),We=m.default.div.withConfig({displayName:"indexstyle__WindowHeaderStyle",componentId:"sc-g0cszf-1"})([""," border-top-left-radius:","px;border-top-right-radius:","px;",""],Ve,K.n_,K.n_,(function(e){return"\n border-bottom: ".concat(K.YF,"px ").concat(K.M8," ").concat((e.theme||G.Z).borders.medium,";\n ")})),Ge=m.default.div.withConfig({displayName:"indexstyle__WindowContentStyle",componentId:"sc-g0cszf-2"})(["overflow:auto;padding:","px 0;"," "," "," ",""],P.iI,Le.w5,(0,Fe.eR)(),(function(e){return e.minMaxHeight&&"\n max-height: ".concat(7*P.iI,"px;\n ")}),(function(e){return!e.minMaxHeight&&"\n max-height: calc(100vh - ".concat(6.5*Ue,"px);\n ")})),Ke=m.default.div.withConfig({displayName:"indexstyle__WindowFooterStyle",componentId:"sc-g0cszf-3"})([""," justify-content:flex-end;border-bottom-left-radius:","px;border-bottom-right-radius:","px;",""],Ve,K.n_,K.n_,(function(e){return"\n border-top: ".concat(K.YF,"px ").concat(K.M8," ").concat((e.theme||G.Z).borders.medium,";\n ")})),Ye=m.default.div.withConfig({displayName:"indexstyle__InputRowStyle",componentId:"sc-g0cszf-4"})(["padding:","px ","px;",""],.75*P.iI,2*P.iI,(function(e){return"\n border-bottom: ".concat(K.YF,"px ").concat(K.M8," ").concat((e.theme||G.Z).borders.medium,";\n ")}));function qe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Qe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?qe(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):qe(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Je=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,_e.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;t.length>=1&&i.push(Qe(Qe({},e),{},{children:t}))})),i}),[r]),b=(0,s.useMemo)((function(){return(0,_e.HK)(n,(function(e){return e.configuration.file_path}))}),[n]);return(0,w.jsxs)(ze,{children:[(0,w.jsxs)(We,{children:[(0,w.jsx)(j.Z,{alignItems:"center",children:(0,w.jsx)(O.ZP,{disableWordBreak:!0,monospace:!0,children:t?"Create new dbt model":"Select dbt model or snapshot file"})}),(0,w.jsx)(T.Z,{iconOnly:!0,onClick:o,children:(0,w.jsx)(W.x8,{muted:!0})})]}),t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ye,{children:(0,w.jsx)(Ne.Z,{dynamicSizing:!0,inputValue:i,label:"Model name (cannot be changed):",labelColor:G.Z.accent.dbt,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,suffixValue:".".concat(v.t6.SQL),value:!a&&i})}),(0,w.jsxs)(Ye,{children:[(0,w.jsx)(O.ZP,{bold:!0,color:G.Z.accent.dbt,children:"Select folder location:"}),(0,w.jsx)(O.ZP,{bold:!0,muted:!p,children:p?"dbt".concat(De.sep).concat(p):"Choose folder below"})]})]}),(0,w.jsx)(Ge,{children:(0,w.jsx)(oe.Z,{allowSelectingFolders:t,disableContextMenu:!0,files:m,isFileDisabled:function(e,n){return t?!n||(null===n||void 0===n?void 0:n.some((function(e){return"models"===(null===e||void 0===e?void 0:e.name)}))):!!b[e]||!(null!==n&&void 0!==n&&n.length)&&!e.match(new RegExp(".".concat(v.t6.SQL,"$")))},openFile:l,selectFile:h,uncollapsed:!0,useRootFolder:!0})}),t&&(0,w.jsx)(Ke,{children:(0,w.jsx)(T.Z,{backgroundColor:i&&p?G.Z.accent.dbt:G.Z.monotone.grey500,disabled:!i||!p,onClick:function(){return l(p)},padding:"6px 8px",children:"Create model"})})]})},Xe=t(73828),$e=t(10975),en=t(14567),nn=t(18283),tn=t(93005),rn=t(75968),on=t(87323);function ln(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 cn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ln(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ln(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function un(e,n){var t,i=e.block,r=e.blocks,o=e.onClick,c=e.onDrop,u=i.type,a=(0,$e.c)((function(){return{collect:function(e){return{isDragging:!!e.isDragging()}},item:i,type:tn.vT}}),[i]),d=(0,l.Z)(a,3),f=d[0],p=d[1],h=(d[2],(0,en.L)((function(){return{accept:tn.vT,drop:function(e){return null===c||void 0===c?void 0:c(i,e)}}}),[i])),b=(0,l.Z)(h,2)[1],x=(0,s.useContext)(m.ThemeContext),_=(0,C.qn)(u,{blockColor:i.color,theme:x}).accent,S=(0,on.cU)([i],r)[0],E=S.dynamic,I=S.dynamicUpstreamBlock,T=S.reduceOutput,D=S.reduceOutputUpstreamBlock,M=(0,s.useMemo)((function(){return(0,rn._o)({block:i,dynamic:E,dynamicUpstreamBlock:I,reduceOutput:T,reduceOutputUpstreamBlock:D})}),[i,E,I,T,D]).borderColorShareProps,A=(0,s.useMemo)((function(){return v.tf.DBT===(null===i||void 0===i?void 0:i.type)}),[i]);return(0,w.jsx)(Z.Z,{pb:1,ref:b,children:(0,w.jsx)(C.PY,cn(cn({},cn(cn({},M),f)),{},{ref:p,children:(0,w.jsx)(k.Z,{noHoverUnderline:!0,noOutline:!0,onClick:function(){return o()},preventDefault:!0,ref:n,children:(0,w.jsx)(Z.Z,{p:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",flex:1,children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(nn.Z,{monospace:!0,children:v.dO[i.language]}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(g.Z,{color:_,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{color:_,monospace:!0,children:null===(t=A?v.tf.DBT:v.V4[i.type])||void 0===t?void 0:t.toUpperCase()})]}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsx)(W.iU,{size:1.5*P.iI}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:null===i||void 0===i?void 0:i.uuid})]}),(0,w.jsx)(Ze.Z,{appearAbove:!0,appearBefore:!0,block:!0,label:"Show ".concat(null===i||void 0===i?void 0:i.uuid," block"),size:2*P.iI,widthFitContent:!0,children:(0,w.jsx)(W.Db,{muted:!0,size:2*P.iI})})]})})})}))})}var an,sn,dn,fn,pn=s.forwardRef(un),hn=t(4804),vn=t(65730),mn=t(87372);!function(e){e.FULL_TABLE="FULL_TABLE",e.INCREMENTAL="INCREMENTAL",e.LOG_BASED="LOG_BASED"}(sn||(sn={})),function(e){e.IGNORE="IGNORE",e.UPDATE="UPDATE"}(dn||(dn={})),function(e){e.DATE_TIME="date-time",e.UUID="uuid"}(fn||(fn={}));var bn,gn="datetime",xn=(an={},(0,o.Z)(an,fn.DATE_TIME,gn),(0,o.Z)(an,fn.UUID,fn.UUID),an);!function(e){e.ARRAY="array",e.BOOLEAN="boolean",e.INTEGER="integer",e.NULL="null",e.NUMBER="number",e.OBJECT="object",e.STRING="string"}(bn||(bn={}));var jn,yn,kn,Zn,On,Pn=[bn.ARRAY,bn.BOOLEAN,gn,bn.INTEGER,bn.NULL,bn.NUMBER,bn.OBJECT,bn.STRING,fn.UUID];!function(e){e.PROPERTIES="properties"}(jn||(jn={})),function(e){e.AUTOMATIC="automatic",e.AVAILABLE="available",e.UNSUPPORTED="unsupported"}(yn||(yn={})),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"}(kn||(kn={})),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"}(Zn||(Zn={})),function(e){e.BIGQUERY="bigquery",e.DELTA_LAKE_S3="delta_lake_s3",e.MYSQL="mysql",e.POSTGRESQL="postgresql",e.SNOWFLAKE="snowflake"}(On||(On={}));var Cn=t(26304),wn=t(79891),_n=t(29237),Sn=t(87815),En=t(70902),In=t(85307),Tn=t(7715);function Dn(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 Mn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Dn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Dn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var An="4px",Bn=[On.BIGQUERY,On.DELTA_LAKE_S3];var Rn=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,v=e.updateSchemaProperty,m=e.updateStream,g=(0,s.useRef)(null),x=a.bookmark_properties,k=a.destination_table,C=void 0===k?"":k,_=a.key_properties,S=a.metadata,E=a.partition_keys,I=a.replication_method,D=a.run_in_parallel,M=a.schema.properties,A=a.tap_stream_id,B=a.unique_constraints,R=a.unique_conflict_method,N=(0,s.useState)(C),L=N[0],F=N[1],H=(0,s.useState)(!1),V=H[0],W=H[1],G=(0,s.useState)(null),K=G[0],Y=G[1],q=(0,s.useState)(!1),Q=q[0],J=q[1],X=(0,s.useState)((0,o.Z)({},A,n||{})),ee=X[0],ne=X[1],te=(0,Oe.Z)(A);(0,s.useEffect)((function(){te!==A&&(F(C),Y(null))}),[C,I,A,te,R]),(0,s.useEffect)((function(){var e=null===ee||void 0===ee?void 0:ee[A];(null===x||void 0===x?void 0:x.length)>0&&((0,Tn.Qr)(e)||!(0,Tn.Xy)(n,e))&&ne((function(e){return Mn(Mn({},e),{},(0,o.Z)({},A,n))}))}),[null===x||void 0===x?void 0:x.length,ee,n,A]);var ie=(0,s.useMemo)((function(){return(0,_e.HK)(S,(function(e){return e.breadcrumb.join("/")}))}),[S]),re=(0,s.useMemo)((function(){var e;return null===(e=(0,_e.sE)(S,(function(e){return 0===e.breadcrumb.length})))||void 0===e?void 0:e.metadata}),[S]),oe=(0,s.useMemo)((function(){return re[kn.KEY_PROPERTIES]||[]}),[re]),le=(0,s.useMemo)((function(){return re[kn.REPLICATION_KEYS]||[]}),[re]),ce=Bn.includes(t),ue=d.length>1,ae=(0,s.useCallback)((function(e){var n=Mn({},null===ee||void 0===ee?void 0:ee[A]);n.hasOwnProperty(e)&&delete n[e],ne((function(e){return Mn(Mn({},e),{},(0,o.Z)({},A,Mn({},n)))})),p({block:{bookmark_values:n,destination_table:L,tap_stream_id:A}})}),[ee,L,A,p]),se=(0,s.useMemo)((function(){var e=[],n=[],i=(0,_e.mr)(Object.entries(M)).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,k=new Set(Array.isArray(g)?g:[g]),C=new Set(k);s.forEach((function(e){var n=e.format,t=(e.items,e.type);Array.isArray(t)?t.forEach((function(e){k.add(e),C.add(e)})):(k.add(t),C.add(t),n&&C.add(n))}));var S=Array.from(k);d&&C.add(d);var I=(ie["properties/".concat(c)]||{}).metadata,D=(I.inclusion,I.selected);e.push(D),n.push(c);var M=Pn.reduce((function(e,n){return S.indexOf(n)>=0||gn===String(n)&&fn.DATE_TIME===d||fn.UUID===String(n)&&fn.UUID===d?e:e.concat((0,w.jsx)("option",{value:n,children:n},n))}),[]),R=S.findIndex((function(e){return e===bn.STRING})),N=[(0,w.jsx)(b.Z,{checked:D,onClick:function(){h(A,[c],{selected:!D})}},"".concat(A,"/").concat(c,"/selected")),(0,w.jsx)(O.ZP,{children:c},"".concat(A,"/").concat(c,"/name")),(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(j.Z,{flex:1,children:(0,w.jsx)(y.Z,{alignItems:"center",flexWrap:"wrap",fullWidth:!0,children:S.map((function(e,n){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(wn.Z,{border:!0,label:d&&bn.STRING===e&&R===n?xn[d]:e,onClick:function(){var n={format:d,type:S.filter((function(n){return n!==e}))};fn.DATE_TIME!==d&&fn.UUID!==d||bn.STRING!==e||(n.format=null),v(A,c,n)},small:!0})},"".concat(A,"/").concat(c,"/").concat(e,"/").concat(n,"/chip"))}))})}),M.length>=1&&(0,w.jsxs)(U.Z,{compact:!0,onChange:function(e){var n=e.target.value,t={format:d,type:S};gn===String(n)?(t.format=fn.DATE_TIME,t.type.push(bn.STRING)):fn.UUID===String(n)?(t.format=fn.UUID,t.type.push(bn.STRING)):t.type.push(n),v(A,c,t)},primary:!0,small:!0,value:"",width:10*P.iI,children:[(0,w.jsx)("option",{value:""}),M]})]},"".concat(A,"/").concat(c,"/type")),(0,w.jsx)(b.Z,{checked:!(null===B||void 0===B||!B.includes(c)),disabled:oe.length>=1&&!oe.includes(c),onClick:oe.length>=1&&!oe.includes(c)?null:function(){return m(A,(function(e){var n;return null!==(n=e.unique_constraints)&&void 0!==n&&n.includes(c)?e.unique_constraints=(0,_e.Od)(e.unique_constraints,(function(e){return c===e})):e.unique_constraints=[c].concat(e.unique_constraints||[]),e}))}},"".concat(A,"/").concat(c,"/unique")),(0,w.jsx)(b.Z,{checked:!(null===x||void 0===x||!x.includes(c)),disabled:le.length>=1&&!le.includes(c),onClick:le.length>=1&&!le.includes(c)?null:function(){return m(A,(function(e){var n;return null!==(n=e.bookmark_properties)&&void 0!==n&&n.includes(c)?(ae(c),e.bookmark_properties=(0,_e.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),e}))}},"".concat(A,"/").concat(c,"/bookmark")),(0,w.jsx)(b.Z,{checked:!(null===_||void 0===_||!_.includes(c)),onClick:function(){return m(A,(function(e){var n;return null!==(n=e.key_properties)&&void 0!==n&&n.includes(c)?e.key_properties=(0,_e.Od)(e.key_properties,(function(e){return c===e})):e.key_properties=[c].concat(e.key_properties||[]),e}))}},"".concat(A,"/").concat(c,"/key_property"))];if(ce){var L=t!==On.DELTA_LAKE_S3,F=L&&(oe.includes(c)||!C.has(fn.DATE_TIME));N.push((0,w.jsx)(b.Z,{checked:!(null===E||void 0===E||!E.includes(c)),disabled:F,onClick:F?null:function(){return m(A,(function(e){var n,t;null!==(n=e.partition_keys)&&void 0!==n&&n.includes(c)?e.partition_keys=(0,_e.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(A,"/").concat(c,"/partition_key")))}if(ue){var H=K===r;N.push((0,w.jsx)(T.Z,{compact:!0,disabled:H,onClick:function(){Y(r),setTimeout((function(){return Y(null)}),2e3),f((function(e){var n,t;if((null===e||void 0===e?void 0:e.tap_stream_id)!==A&&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:S};var h=null===(i=(0,_e.sE)((null===e||void 0===e?void 0:e.metadata)||[],(function(e){return 0===e.breadcrumb.length})))||void 0===i?void 0:i.metadata,v=h[kn.REPLICATION_KEYS]||[],m=h[kn.KEY_PROPERTIES]||[];null===B||void 0===B||!B.includes(c)||null!==e&&void 0!==e&&null!==(r=e.unique_constraints)&&void 0!==r&&r.includes(c)||!m.includes(c)?null!==B&&void 0!==B&&B.includes(c)||null===e||void 0===e||null===(o=e.unique_constraints)||void 0===o||!o.includes(c)||(e.unique_constraints=(0,_e.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)||!v.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,_e.Od)(e.bookmark_properties,(function(e){return c===e}))):e.bookmark_properties=[c].concat(e.bookmark_properties||[]),null===_||void 0===_||!_.includes(c)||null!==e&&void 0!==e&&null!==(a=e.key_properties)&&void 0!==a&&a.includes(c)?null!==_&&void 0!==_&&_.includes(c)||null===e||void 0===e||null===(s=e.key_properties)||void 0===s||!s.includes(c)||(e.key_properties=(0,_e.Od)(e.key_properties,(function(e){return c===e}))):e.key_properties=[c].concat(e.key_properties||[]),null===E||void 0===E||!E.includes(c)||null!==e&&void 0!==e&&null!==(f=e.partition_keys)&&void 0!==f&&f.includes(c)?null!==E&&void 0!==E&&E.includes(c)||null===e||void 0===e||null===(p=e.partition_keys)||void 0===p||!p.includes(c)||(e.partition_keys=(0,_e.Od)(e.partition_keys,(function(e){return c===e}))):e.partition_keys=[c].concat(e.partition_keys||[])}return Mn({},e)}))},pill:!0,secondary:!0,children:(0,w.jsx)(O.ZP,{success:H,children:H?"Applied!":"Apply"})}))}return N})),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(A,n,{selected:!r})}})},uuid:"Selected"},{uuid:"Name"},{uuid:"Type"},{uuid:"Unique"},{uuid:"Bookmark"},{uuid:"Key prop"}];return ce&&(o.push(null),c.push({uuid:"Partition key"})),ue&&(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)(In.cl,{children:(0,w.jsx)(Sn.Z,{alignTop:!0,columnFlex:o,columns:c,rows:i,stickyHeader:!0})})}),[x,t,ue,K,_,ie,E,M,ae,ce,A,B,f,h,v,m,oe,le]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:[(0,w.jsx)(mn.Z,{condensed:!0,inline:!0,level:4,monospace:!0,children:A})," schema"]}),(0,w.jsx)(Z.Z,{mb:3,children:(0,w.jsx)(_n.Z,{headerTitle:"Output",overflowVisible:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{children:"Destination table name"}),(0,w.jsx)(Z.Z,{ml:An}),(0,w.jsx)(Ze.Z,{label:(0,w.jsxs)(O.ZP,{children:["By default, this stream will be saved to your destination under the table named ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:A}),". To change the table name, enter in a different value."]}),lightBackground:!0,primary:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(z.Z,{compact:!0,monospace:!0,onChange:function(e){var n=e.target.value;F(n),clearTimeout(g.current),g.current=setTimeout((function(){m(A,(function(e){return Mn(Mn({},e),{},{destination_table:n})}))}),300)},value:L||"",width:45*P.iI})]})})}),(0,w.jsx)(Z.Z,{mb:3,children:(0,w.jsx)(_n.Z,{headerTitle:"Usage",overflowVisible:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{children:"Replication method"}),(0,w.jsx)(Z.Z,{ml:An}),(0,w.jsx)(Ze.Z,{label:(0,w.jsxs)(O.ZP,{children:["Do you want to synchronize the entire stream (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:sn.FULL_TABLE}),") on each integration pipeline run or only new records (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:sn.INCREMENTAL}),")?",u===Zn.POSTGRESQL&&(0,w.jsxs)(O.ZP,{children:["Log-based incremental replication (",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:sn.LOG_BASED}),") is also available for PostgreSQL sources."]})]}),lightBackground:!0,primary:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsxs)(U.Z,{compact:!0,onChange:function(e){m(A,(function(n){return Mn(Mn({},n),{},{replication_method:e.target.value})}))},primary:!0,value:I,children:[(0,w.jsx)("option",{value:""}),Object.values(sn).filter((function(e){return u===Zn.POSTGRESQL||e!==sn.LOG_BASED})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))]}),(0,w.jsx)(Z.Z,{ml:3}),(0,w.jsx)(O.ZP,{children:"Unique conflict method"}),(0,w.jsx)(Z.Z,{ml:An}),(0,w.jsx)(Ze.Z,{label:(0,w.jsxs)(O.ZP,{wordBreak:!0,children:["If a new record has the same value as an existing record in the ",(0,$._6)("column",null===B||void 0===B?void 0:B.length),(null===B||void 0===B?void 0:B.length)>0&&(0,w.jsx)(w.Fragment,{children:"\xa0"}),null===B||void 0===B?void 0:B.sort().map((function(e,n){return(0,w.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:[1!==(null===B||void 0===B?void 0:B.length)&&n===(null===B||void 0===B?void 0:B.length)-1?(0,w.jsx)(O.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)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:dn.IGNORE})," will skip the new record if it\u2019s a duplicate of an existing record. The conflict method ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,children:dn.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)(Z.Z,{ml:1}),(0,w.jsxs)(U.Z,{compact:!0,inputWidth:11*P.iI,onChange:function(e){m(A,(function(n){return Mn(Mn({},n),{},{unique_conflict_method:e.target.value})}))},primary:!0,value:R,children:[(0,w.jsx)("option",{value:""}),(0,w.jsx)("option",{value:dn.IGNORE,children:dn.IGNORE}),(0,w.jsx)("option",{value:dn.UPDATE,children:dn.UPDATE})]})]}),ue&&(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(O.ZP,{default:!0,children:"All streams"}),(0,w.jsx)(Z.Z,{ml:An}),(0,w.jsx)(Ze.Z,{appearBefore:!0,label:(0,w.jsx)(O.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)(Z.Z,{ml:1}),(0,w.jsx)(T.Z,{compact:!0,disabled:V,onClick:function(){W(!0),setTimeout((function(){return W(!1)}),2e3),f((function(e){return Mn(Mn({},e),{},{replication_method:I,unique_conflict_method:R})}))},pill:!0,secondary:!0,children:(0,w.jsx)(O.ZP,{bold:!V,success:V,children:V?"Applied!":"Apply"})})]})]})})}),(0,w.jsx)(_n.Z,{headerTitle:"Features",noPadding:!0,children:se}),(0,w.jsx)(Z.Z,{mt:2,children:(0,w.jsx)(T.Z,{loading:i,onClick:function(){return c(A)},primary:!0,small:!0,children:"Load sample data"})}),(0,w.jsxs)(Z.Z,{mt:5,children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Settings"}),(0,w.jsx)(Z.Z,{mb:5,children:(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Run stream in parallel"}),(0,w.jsx)(O.ZP,{default:!0,children:"Parallel streams will be run at the same time, so make sure there are no dependencies between them."}),(0,w.jsx)(Z.Z,{mb:1}),(0,w.jsx)(En.Z,{checked:D,onCheck:function(){return m(A,(function(e){return e.run_in_parallel=!D,e}))}},"".concat(A,"/run_in_parallel"))]})}),sn.INCREMENTAL===I&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Bookmark properties"}),(0,w.jsxs)(O.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)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==x&&void 0!==x&&x.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.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)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(wn.Z,{label:e,onClick:function(){ae(e),m(A,(function(n){return Mn(Mn({},n),{},{bookmark_properties:(0,_e.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)(Z.Z,{my:2,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Manually edit bookmark property values"}),(0,w.jsx)(O.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)(En.Z,{checked:Q,disabled:!t,onCheck:function(){return J((function(e){return!e}))}})]})}),Q&&!!t&&(0,w.jsx)(_n.Z,{header:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(O.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===ee||void 0===ee?void 0:ee[A])||{},destination_table:L,tap_stream_id:A}})},pill:!0,secondary:!0,children:"Save"})]}),headerPaddingVertical:P.iI,noPadding:!0,overflowVisible:!0,children:(0,w.jsx)(Sn.Z,{columnBorders:!0,columnFlex:[null,1],columns:[{uuid:"Bookmark property"},{uuid:"Value"}],rows:x.map((function(e){var n;return[(0,w.jsx)(O.ZP,{default:!0,monospace:!0,children:e},e),(0,w.jsx)(z.Z,{borderless:!0,monospace:!0,onChange:function(n){n.preventDefault(),ne((function(t){return Mn(Mn({},t),{},(0,o.Z)({},A,Mn(Mn({},t[A]),{},(0,o.Z)({},e,n.target.value))))}))},paddingHorizontal:0,placeholder:"Enter value",value:null===ee||void 0===ee||null===(n=ee[A])||void 0===n?void 0:n[e]},"".concat(e,"_value"))]}))})})]})]}),(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Unique constraints"}),(0,w.jsx)(O.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)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==B&&void 0!==B&&B.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Unique"})," to use a specific column as a unique constraint."]}),null===B||void 0===B?void 0:B.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(wn.Z,{label:e,onClick:function(){m(A,(function(n){return Mn(Mn({},n),{},{unique_constraints:(0,_e.Od)(n.unique_constraints||[],(function(n){return n===e}))})}))},primary:!0})},"unique_constraints/".concat(e))}))]})]}),(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Key properties"}),(0,w.jsx)(O.ZP,{default:!0,children:"Key properties are used as the primary key for the destination table."})]}),(0,w.jsxs)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==_&&void 0!==_&&_.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Key prop"})," to use a specific column as a key property."]}),null===_||void 0===_?void 0:_.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(wn.Z,{label:e,onClick:function(){m(A,(function(n){return Mn(Mn({},n),{},{key_properties:(0,_e.Od)(n.key_properties||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]}),ce&&(0,w.jsxs)(Z.Z,{mb:3,children:[(0,w.jsxs)(Z.Z,{mb:1,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Partition keys"}),(0,w.jsx)(O.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)(y.Z,{alignItems:"center",flexWrap:"wrap",children:[!(null!==E&&void 0!==E&&E.length)&&(0,w.jsxs)(O.ZP,{italic:!0,children:["Click the checkbox under the column ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,italic:!0,children:"Partition key"})," to use a specific column as a partition key."]}),null===E||void 0===E?void 0:E.sort().map((function(e){return(0,w.jsx)(Z.Z,{mb:1,mr:1,children:(0,w.jsx)(wn.Z,{label:e,onClick:function(){m(A,(function(n){return Mn(Mn({},n),{},{partition_keys:(0,_e.Od)(n.partition_keys||[],(function(n){return n===e}))})}))},primary:!0})},"key_properties/".concat(e))}))]})]})]})]})},Nn=["catalog","pipeline","setErrors","setSelectedStream"];function Ln(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 Fn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ln(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ln(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Un,Hn=function(e){var n,t=e.catalog,i=e.pipeline,r=e.setErrors,o=e.setSelectedStream,c=(0,Cn.Z)(e,Nn),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,_e.YC)(p,"stream").map((function(e){return{uuid:e.stream}}))}),[p]),m=(0,s.useMemo)((function(){return(0,_e.HK)(p,(function(e){return e.stream}))}),[p]),b=(0,s.useMemo)((function(){return m[null===a||void 0===a?void 0:a.uuid]}),[a,m]),g=(0,s.useMemo)((function(){return(0,_e.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=b||{},j=x.destination_table,y=x.tap_stream_id,k=!(!y||!j),P=V.ZP.blocks.pipelines.detail(k?null===i||void 0===i?void 0:i.uuid:null,k?null===g||void 0===g?void 0:g.uuid:null,{destination_table:j,state_stream:y}),C=P.data,_=P.mutate,S=null===C||void 0===C||null===(n=C.block)||void 0===n?void 0:n.bookmarks,E=(0,d.Db)(V.ZP.blocks.pipelines.useUpdate(null===i||void 0===i?void 0:i.uuid,null===g||void 0===g?void 0:g.uuid,{query:{update_state:!0}}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){null===_||void 0===_||_()},onErrorCallback:function(e,n){return null===r||void 0===r?void 0:r({errors:n,response:e})}})}}),I=(0,l.Z)(E,2),T=I[0],M=I[1].isLoading;(0,s.useEffect)((function(){h.length>0&&(a&&(0,_e.sE)(h,(function(e){var n=e.uuid;return a.uuid===n}))||f(h[0]))}),[a,f,h]);var A=(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)(In.cl,{children:(0,w.jsx)(Sn.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)(O.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)(O.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)(D.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}),b&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(In.dE,{children:(0,w.jsx)(Rn,Fn(Fn({},c),{},{bookmarkValues:S,isLoadingUpdateDestinationBlockState:M,stream:b,streams:p,updateDestinationBlockState:T}))})}),p.length>=1&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(In.dE,{children:[(0,w.jsx)(mn.Z,{level:4,children:"Streams Summary"}),(0,w.jsx)(Z.Z,{mt:1}),A]})})]})},zn=t(30264),Vn=t(18776);function Wn(e){return Object.values(e).filter((function(e){return null!==e})).map((function(e){return e.tap_stream_id}))}function Gn(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 Kn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Gn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Gn(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"}(Un||(Un={}));var Yn=45*P.iI,qn=Yn-4*P.iI;var Qn=function(e){var n=e.catalog,t=e.isLoading,i=e.onActionCallback,r=e.streams,l=(0,_e.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 Kn(Kn({},e),{},{isMissingStream:!0})}))}),[l,r]),u=Kn({},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],v=p[1],m=(0,s.useState)(!1),g=m[0],j=m[1],k=(0,s.useState)(Un.ALL),C=k[0],_=k[1],S=(0,s.useRef)(null),E=Wn(d),I=(0,s.useMemo)((function(){var e=r;return e=e.filter((function(e){var n=e.tap_stream_id;return C===Un.SELECTED?E.includes(n):C!==Un.NOT_SELECTED||!E.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}),[C,h,E,r]),D=(0,s.useMemo)((function(){return r.every((function(e){var n=e.stream;return!!d[n]}))}),[d,r]);return(0,w.jsxs)(Vn.Z,{children:[(0,w.jsx)(In.cv,{rounded:!0,children:(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Select streams to sync"})}),(0,w.jsx)(In.cv,{padding:1.25*P.iI,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsx)(z.Z,{beforeIcon:(0,w.jsx)(W.HN,{}),compact:!0,noBackground:!0,noBorder:!0,onChange:function(e){return v(e.target.value)},placeholder:"Search",value:h}),(0,w.jsx)(Z.Z,{pr:1,children:(0,w.jsx)(zn.Z,{items:[{label:function(){return Un.ALL},onClick:function(){return _(Un.ALL)},uuid:"all_streams"},{label:function(){return Un.SELECTED},onClick:function(){return _(Un.SELECTED)},uuid:"selected"},{label:function(){return Un.NOT_SELECTED},onClick:function(){return _(Un.NOT_SELECTED)},uuid:"unselected"}],onClickCallback:function(){return j(!1)},onClickOutside:function(){return j(!1)},open:g,parentRef:S,uuid:"SelectStreams/filter",children:(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(W.wn,{}),noBackground:!0,onClick:function(){return j((function(e){return!e}))},ref:S,children:(0,w.jsx)(O.ZP,{children:C})})})})]})}),(0,w.jsx)(In.cl,{height:"55vh",hideHorizontalScrollbar:!0,width:"".concat(Yn,"px"),children:(0,w.jsx)(Sn.Z,{borderCollapseSeparate:!0,columnFlex:[1,6],columns:[{label:function(){return(0,w.jsx)(b.Z,{checked:D,onClick:function(){var e=(0,_e.HK)(r||[],(function(e){return e.stream}));f(D?{}: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 Kn(Kn({},n),{},(0,o.Z)({},t,i?null:e))}))}},"selected-".concat(t)),(0,w.jsxs)(O.ZP,{danger:n,title:t,width:Yn-48-32,children:[t,n?" (no longer available)":""]},"stream-".concat(t))]})),stickyHeader:!0})}),(0,w.jsx)(x.Z,{medium:!0}),(0,w.jsxs)(Z.Z,{p:2,children:[(null===E||void 0===E?void 0:E.length)>50&&(0,w.jsx)(Z.Z,{pb:2,children:(0,w.jsxs)(O.ZP,{danger:!0,maxWidth:qn,rightAligned:!0,whiteSpaceNormal:!0,children:["WARNING: Selecting too many streams (e.g. >50)",(0,w.jsx)("br",{}),"may cause app performance issues."]})}),0===(null===r||void 0===r?void 0:r.length)&&(0,w.jsx)(Z.Z,{pb:2,children:(0,w.jsx)(O.ZP,{bold:!0,maxWidth:qn,warning:!0,whiteSpaceNormal:!0,children:"If you can successfully connect to the data source but no streams are displayed, check if the user has proper database/schema permissions."})}),(0,w.jsx)(y.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{loading:t,onClick:function(){return i(d)},primary:!0,children:"Confirm ".concat(Wn(d).length," streams")})})]})]})},Jn=t(57722);function Xn(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 $n(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xn(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xn(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var et=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,hn.Pz)(null===i||void 0===i?void 0:i.config))}),[a,i]);var p=(0,s.useState)(null),h=p[0],m=p[1],b=(0,s.useState)(),g=b[0],x=b[1],j=(0,d.Db)(V.ZP[n].useCreate(),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var t,i,r=(0,$.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)}})}}),k=(0,l.Z)(j,2),P=k[0],C=k[1].isLoading;return t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(In.$W,{children:(0,w.jsx)(Jn.Z,{autoHeight:!0,language:v.t6.YAML,onChange:function(e){f(e),r(t.type,t.uuid,(0,hn.Pz)($n($n({},i),{},{config:(0,hn.Qc)(e)})))},tabSize:2,value:a||void 0,width:"100%"})}),(0,w.jsxs)(Z.Z,{mt:1,children:[(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{onClick:function(){P((0,o.Z)({},(0,$.C5)(n),{action_type:"test_connection",config:a,pipeline_uuid:c.uuid})),x(null)},small:!0,success:!0,children:"Test connection"}),(0,w.jsx)(Z.Z,{ml:1,children:C?(0,w.jsx)(H.Z,{color:"white",small:!0}):(0,w.jsxs)(w.Fragment,{children:[h&&(0,w.jsx)(O.ZP,{small:!0,success:!0,children:"Connected successfully!"}),!1===h&&(0,w.jsx)(O.ZP,{small:!0,warning:!0,children:"Failed to connect, see error below."})]})})]}),g&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(O.ZP,{small:!0,warning:!0,children:g})})]})]}):null},nt=t(60701);function tt(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 it(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?tt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var rt=function(e){var n,t,i,r=e.addNewBlockAtIndex,o=e.blocks,c=e.codeBlocks,u=e.fetchFileTree,a=e.fetchPipeline,f=e.fetchSampleData,p=e.globalVariables,h=e.onChangeCodeBlock,m=e.openSidekickView,b=e.pipeline,g=e.savePipelineContent,x=e.setErrors,j=e.setIntegrationStreams,C=e.setOutputBlocks,_=e.setSelectedBlock,S=e.setSelectedOutputBlock,E=e.setSelectedStream,I=(0,s.useState)(!0),D=I[0],M=I[1],A=(0,s.useState)(!0),B=A[0],R=A[1],N=(0,s.useState)(!0),L=N[0],F=N[1],z=V.ZP.integration_sources.list({},{revalidateOnFocus:!1}).data,G=(0,s.useMemo)((function(){return(null===z||void 0===z?void 0:z.integration_sources)||[]}),[z]),K=(0,s.useMemo)((function(){return(0,_e.HK)(G,(function(e){return e.uuid}))}),[G]),Y=V.ZP.integration_destinations.list({},{revalidateOnFocus:!1}).data,q=(0,s.useMemo)((function(){return(null===Y||void 0===Y?void 0:Y.integration_destinations)||[]}),[Y]),Q=(0,s.useMemo)((function(){return(0,_e.HK)(q,(function(e){return e.uuid}))}),[q]),J=(0,s.useMemo)((function(){return(0,_e.sE)(o,(function(e){var n=e.type;return v.tf.DATA_LOADER===n}))}),[o]),X=(0,s.useMemo)((function(){return J?(0,hn.Qc)(J.content):{}}),[J]),$=(0,s.useMemo)((function(){return(0,w.jsx)(et,{api:"integration_sources",block:J,blockContent:X,onChangeCodeBlock:h,pipeline:b})}),[J,X,h,b]),ne=(0,s.useMemo)((function(){return(0,_e.sE)(o,(function(e){var n=e.type;return v.tf.DATA_EXPORTER===n}))}),[o]),te=(0,s.useMemo)((function(){return ne?(0,hn.Qc)(ne.content):{}}),[ne]),ie=(0,s.useMemo)((function(){return(0,w.jsx)(et,{api:"integration_destinations",block:ne,blockContent:te,onChangeCodeBlock:h,pipeline:b})}),[ne,te,h,b]),re=(0,s.useMemo)((function(){return(0,_e.sE)(o,(function(e){var n=e.type;return v.tf.TRANSFORMER===n}))}),[o]),oe=(0,s.useMemo)((function(){var e;return(0,Tn.Qr)(null===X||void 0===X?void 0:X.catalog)?null===b||void 0===b||null===(e=b.data_integration)||void 0===e?void 0:e.catalog:null===X||void 0===X?void 0:X.catalog}),[X,null===b||void 0===b||null===(n=b.data_integration)||void 0===n?void 0:n.catalog]),le=((null===oe||void 0===oe?void 0:oe.streams)||[]).every((function(e){return e.auto_add_new_fields})),ce=((null===oe||void 0===oe?void 0:oe.streams)||[]).every((function(e){return e.disable_column_type_check})),ue=(0,Oe.Z)(oe);(0,s.useEffect)((function(){!ue&&oe&&(C((function(){return S(J),[J]})),j((function(e){var n;return e||(null===oe||void 0===oe||null===(n=oe.streams)||void 0===n?void 0:n.map((function(e){return e.tap_stream_id})))})))}),[oe]);var ae=(0,s.useState)(),se=ae[0],de=ae[1],fe=(0,d.Db)(V.ZP.integration_sources.useCreate(),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.integration_source;if(n.success){var t=(null===n||void 0===n?void 0:n.streams)||[];C((function(){return S(J),[J]})),t.length>0&&E(t[0]),j((function(e){var n=(e||[]).concat(t);return Array.from(new Set(n)).sort()})),m(nt.cH.DATA),f()}else de(null===n||void 0===n?void 0:n.error_message)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),pe=(0,l.Z)(fe,2),he=pe[0],ve=pe[1].isLoading,me=(0,d.Db)(V.ZP.integration_sources.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.integration_source,t=n.selected_streams,i=n.streams,r=((null===oe||void 0===oe?void 0:oe.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(yn.UNSUPPORTED!==i.inclusion){var r;if(e.replication_method||(e.replication_method=sn.FULL_TABLE),e.unique_conflict_method||(e.unique_conflict_method=dn.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]=it(it({},n),{},{metadata:it(it({},i),{},{selected:!0})})}}))}));var c={streams:r.concat(l)};j(Le.map((function(e){return e.tap_stream_id})));var s=null===X||void 0===X?void 0:X.catalog;(0,Tn.Qr)(s)||h(J.type,J.uuid,(0,hn.Pz)(it(it({},X),{},{catalog:{}})));var d={pipeline:it(it({},b),{},{data_integration:it(it({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:c})})};g(d).then((function(){a(),u()}))},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),be=(0,l.Z)(me,2),ge=be[0],xe=be[1].isLoading,je=(0,s.useState)(null),ye=je[0],ke=je[1],Ze=(0,d.Db)(V.ZP.integration_source_streams.useUpdate(null===b||void 0===b?void 0:b.uuid),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){ke(e.integration_source_stream)},onErrorCallback:function(e,n){return x({errors:n,response:e})}})}}),Pe=(0,l.Z)(Ze,2),Ce=Pe[0],we=Pe[1].isLoading,Se=(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}}(oe,e),i=t.stream,r=t.streams,o=it(it({},oe),{},{streams:r.concat(n(i))}),l=null===X||void 0===X?void 0:X.catalog;(0,Tn.Qr)(l)||h(J.type,J.uuid,(0,hn.Pz)(it(it({},X),{},{catalog:{}})));var c={pipeline:it(it({},b),{},{data_integration:it(it({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:o})})};g(c).then((function(){return a()}))}),[oe,J,X,a,h,b,g]),Ie=(0,s.useCallback)((function(e){if(null!==oe&&void 0!==oe&&oe.streams){var n=it(it({},oe),{},{streams:oe.streams.map((function(n){return e(n)}))}),t=null===X||void 0===X?void 0:X.catalog;(0,Tn.Qr)(t)||h(J.type,J.uuid,(0,hn.Pz)(it(it({},X),{},{catalog:{}})));var i={pipeline:it(it({},b),{},{data_integration:it(it({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:n})})};g(i).then((function(){return a()}))}}),[oe,J,X,a,h,b,g]),Te=(0,s.useCallback)((function(e,n,t){Se(e,(function(e){return e.schema.properties[n]=t,e}))}),[Se]),De=(0,s.useCallback)((function(e,n,t){Se(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=it(it({},o),t)}})),e}))}),[Se]),Me=(0,d.Db)(V.ZP.blocks.pipelines.useUpdate(null===b||void 0===b?void 0:b.uuid,null===ne||void 0===ne?void 0:ne.uuid),{onSuccess:function(e){return(0,ee.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)(Me,1)[0],Be=(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)(O.ZP,{monospace:!0,children:t},"variable-uuid-".concat(t)),(0,w.jsx)(O.ZP,{monospace:!0,children:i},"variable-uuid-".concat(t,"-{value}")),(0,w.jsx)(O.ZP,{monospace:!0,children:r},"variable-uuid-".concat(t,"-{value}-code")),(0,w.jsx)(vn.Z,{copiedText:r,monospace:!0,withCopyIcon:!0},"variable-uuid-".concat(t,"-{value}-code-copy"))])}))})),(0,w.jsx)(Sn.Z,{alignTop:!0,columnFlex:[null,null,1],columns:[{uuid:"Key"},{uuid:"Value"},{uuid:"Code"}],rows:e})}),[p]),Ne=(0,s.useCallback)((function(e){return(0,w.jsxs)(Z.Z,{mt:2,children:[(0,w.jsxs)(O.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)(O.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)(k.Z,{href:e,openNewWindow:!0,primary:!0,children:"documentation"}),"."]}),(0,w.jsx)(Z.Z,{mt:1,children:Be})]})}),[Be]),Le=(0,s.useMemo)((function(){return(null===ye||void 0===ye?void 0:ye.streams)||[]}),[ye]),Fe=(0,Ee.dd)((function(){return(0,w.jsx)(Qn,{catalog:oe,isLoading:xe,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)ge({integration_source:{streams:n}}),ze();else{var t=null===X||void 0===X?void 0:X.catalog;(0,Tn.Qr)(t)||h(J.type,J.uuid,(0,hn.Pz)(it(it({},X),{},{catalog:{}}))),g({pipeline:it(it({},b),{},{data_integration:it(it({},(null===b||void 0===b?void 0:b.data_integration)||{}),{},{catalog:null})})}).then((function(){return a()})),ze()}},streams:Le})}),{},[oe,J,X,a,xe,h,g,Le],{background:!0,uuid:"select_streams"}),Ue=(0,l.Z)(Fe,2),He=Ue[0],ze=Ue[1];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{iconOnly:!0,onClick:function(){return R((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[B&&(0,w.jsx)(W.Kh,{size:1.5*P.iI}),!B&&(0,w.jsx)(W._M,{size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(mn.Z,{children:"Source"}),!B&&(0,w.jsxs)(mn.Z,{default:!0,inline:!0,children:["\xa0",null===(t=K[null===X||void 0===X?void 0:X.source])||void 0===t?void 0:t.name]})]})]})}),B&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsxs)(In.dE,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select source"}),(null===G||void 0===G?void 0:G.length)>0?(0,w.jsxs)(U.Z,{onChange:function(e){var n,t,i=e.target.value;if(i){var o=null===(n=K[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})),J?h(J.type,J.uuid,(0,hn.Pz)(it(it({},X),{},{catalog:{},config:o,source:i}))):r({content:(0,hn.Pz)({config:o,source:i}),language:v.t6.YAML,type:v.tf.DATA_LOADER},0,_),ke(null),g().then((function(){a()}))}},primary:!0,value:null===X||void 0===X?void 0:X.source,children:[(0,w.jsx)("option",{value:""}),G.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(H.Z,{inverted:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(mn.Z,{level:5,primary:!0,children:"Loading sources..."})]})]}),J&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===X||void 0===X?void 0:X.source)&&(0,w.jsxs)(Z.Z,{mb:2,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this source, read the ",(0,w.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/sources/".concat(X.source,"/README.md"),openNewWindow:!0,primary:!0,children:[X.source," documentation"]})]}),Ne("https://docs.mage.ai/guides/data-integration-pipeline#configure-source")]}),$]}),(0,w.jsxs)("div",{children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select stream"}),(0,w.jsx)(T.Z,{loading:we,onClick:function(){g().then((function(){Ce().then((function(){return He()})),a()}))},primary:!0,small:!0,children:"View and select streams"})]}),se&&(0,w.jsx)(O.ZP,{warning:!0,children:se})]})]}),xe&&(0,w.jsx)(Z.Z,{p:2,children:(0,w.jsx)(H.Z,{})}),!xe&&(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsx)(Hn,{catalog:oe,destination:null===te||void 0===te?void 0:te.destination,isLoadingLoadSampleData:ve,loadSampleData:function(e){return he({integration_source:{action_type:"sample_data",pipeline_uuid:null===b||void 0===b?void 0:b.uuid,streams:[e]}})},pipeline:b,setErrors:x,setSelectedStream:E,source:null===X||void 0===X?void 0:X.source,updateAllStreams:Ie,updateMetadataForColumns:De,updateSchemaProperty:Te,updateStream:Se})})]}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!J,iconOnly:!0,onClick:function(){return F((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[L&&J&&(0,w.jsx)(W.Kh,{size:1.5*P.iI}),(!L||!J)&&(0,w.jsx)(W._M,{disabled:!J,size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(mn.Z,{children:"Transformers"})})]})}),L&&J&&(0,w.jsx)(Z.Z,{mb:5,children:(0,w.jsxs)(In.dE,{children:[c.length>0&&(0,w.jsx)(Z.Z,{mb:1,children:c.map((function(e,n){return(0,w.jsx)(Z.Z,{mb:1,children:e},n)}))}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(Re.Z,{addNewBlock:function(e){var n=e.content,t=e.configuration,i=[];return J&&i.push(J.uuid),r(it(it({},e),{},{configuration:t,content:n,upstream_blocks:i}),o.length-1,(function(e){ne&&(Ae({block:it(it({},ne),{},{upstream_blocks:[e.uuid]})}),_(e))}))},compact:!0,hideCustom:!0,hideDataExporter:!0,hideDataLoader:!0,hideDbt:!0,hideMarkdown:!0,hideScratchpad:!0,hideSensor:!0,hideTransformer:!!re,hideTransformerDataSources:!0,pipeline:b})})]})}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,{disabled:!J,iconOnly:!0,onClick:function(){return M((function(e){return!e}))},children:(0,w.jsxs)(w.Fragment,{children:[D&&J&&(0,w.jsx)(W.Kh,{size:1.5*P.iI}),(!D||!J)&&(0,w.jsx)(W._M,{disabled:!J,size:1.5*P.iI})]})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(mn.Z,{children:"Destination"}),!D&&(0,w.jsxs)(mn.Z,{default:!0,inline:!0,children:["\xa0",null===(i=Q[null===te||void 0===te?void 0:te.destination])||void 0===i?void 0:i.name]})]})]})}),D&&J&&(0,w.jsxs)(In.dE,{children:[(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Select destination"}),(null===q||void 0===q?void 0:q.length)>0?(0,w.jsxs)(U.Z,{onChange:function(e){var n=e.target.value;if(n){if(ne)h(ne.type,ne.uuid,(0,hn.Pz)(it(it({},te),{},{destination:n})));else{var t,i,l=null===(t=Q[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===J||void 0===J?void 0:J.uuid)!==n}));u&&c.push(u.uuid)}else J&&c.push(J.uuid);r({content:(0,hn.Pz)({config:l,destination:n}),language:v.t6.YAML,type:v.tf.DATA_EXPORTER,upstream_blocks:c},1,_)}g().then((function(){a()}))}},primary:!0,value:null===te||void 0===te?void 0:te.destination,children:[(0,w.jsx)("option",{value:""}),q.map((function(e){var n=e.name,t=e.uuid;return(0,w.jsx)("option",{value:t,children:n},t)}))]}):(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(H.Z,{inverted:!0}),(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(mn.Z,{level:5,primary:!0,children:"Loading destinations..."})]})]}),ne&&(0,w.jsxs)(Z.Z,{mb:5,children:[(0,w.jsx)(mn.Z,{condensed:!0,level:4,spacingBelow:!0,children:"Configuration"}),(null===te||void 0===te?void 0:te.destination)&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(Z.Z,{mb:2,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["For more information on how to configure this destination, read the ",(0,w.jsxs)(k.Z,{href:"https://github.com/mage-ai/mage-ai/blob/master/mage_integrations/mage_integrations/destinations/".concat(te.destination,"/README.md"),openNewWindow:!0,primary:!0,children:[te.destination," documentation"]}),".",(0,w.jsx)("br",{}),(0,w.jsx)("br",{}),"If your configuration contains a key named ",(0,w.jsx)(O.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)(O.ZP,{bold:!0,inline:!0,children:"Table name"})," in a previous section."]}),Ne("https://docs.mage.ai/guides/data-integration-pipeline#configure-destination")]})}),ie,(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Automatically add new fields"}),(0,w.jsx)(O.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)(En.Z,{checked:!!le,disabled:!(null!==oe&&void 0!==oe&&oe.streams),onCheck:function(){return Ie((function(e){return it(it({},e),{},{auto_add_new_fields:!le})}))}})]})}),(0,w.jsx)(Z.Z,{mt:3,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(Z.Z,{mr:2,children:[(0,w.jsx)(O.ZP,{bold:!0,large:!0,children:"Disable column type check"}),(0,w.jsxs)(O.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)(En.Z,{checked:!!ce,disabled:!(null!==oe&&void 0!==oe&&oe.streams),onCheck:function(){return Ie((function(e){return it(it({},e),{},{disable_column_type_check:!ce})}))}})]})})]})]})]})},ot=t(46336),lt=t(42451),ct=t(84212),ut=t(51504);function at(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function st(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?at(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):at(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var dt=function(e){var n=e.addNewBlockAtIndex,t=e.addWidget,i=e.allBlocks,c=e.allowCodeBlockShortcuts,u=e.anyInputFocused,a=e.autocompleteItems,f=e.blockRefs,p=e.blocks,h=void 0===p?[]:p,m=e.dataProviders,b=e.deleteBlock,g=e.disableShortcuts,x=e.fetchFileTree,j=e.fetchPipeline,y=e.fetchSampleData,C=e.files,_=e.globalVariables,S=e.hiddenBlocks,E=e.interruptKernel,I=e.mainContainerRef,T=e.mainContainerWidth,D=e.messages,B=e.onChangeCallbackBlock,N=e.onChangeCodeBlock,L=e.openSidekickView,U=e.pipeline,H=e.pipelineContentTouched,z=e.project,W=e.restartKernel,G=e.runBlock,K=e.runningBlocks,Y=void 0===K?[]:K,q=e.savePipelineContent,Q=e.selectedBlock,J=e.setAnyInputFocused,X=e.setDisableShortcuts,ne=e.setEditingBlock,te=e.setErrors,ie=e.setIntegrationStreams,re=e.setHiddenBlocks,oe=e.setOutputBlocks,le=e.setPipelineContentTouched,ue=e.setSelectedBlock,se=e.setSelectedOutputBlock,de=e.setSelectedStream,pe=e.setTextareaFocused,he=e.showBrowseTemplates,ve=e.showConfigureProjectModal,me=e.textareaFocused,be=e.widgets,ge=(0,s.useRef)(null),xe=(0,s.useState)(!1),je=xe[0],ye=xe[1],ke=(0,s.useState)(!1),Ze=ke[0],Pe=ke[1],we=(0,s.useState)(!1),Se=we[0],Ee=we[1],Ie=(0,s.useState)(!0),Me=Ie[0],Ne=Ie[1],Le=(0,s.useState)(null),Fe=Le[0],Ue=Le[1],He=(0,s.useState)(null),ze=He[0],Ve=He[1],We=(0,s.useState)(!1),Ge=We[0],Ke=We[1],Ye=(0,s.useState)(""),qe=Ye[0],Qe=Ye[1],$e=(0,s.useMemo)((function(){return Y.reduce((function(e,n,t){return st(st({},e),{},(0,o.Z)({},n.uuid,st(st({},n),{},{priority:t})))}),{})}),[Y]),en=(0,Oe.Z)(Q),nn=(0,s.useMemo)((function(){return h.length}),[h]),tn=(0,s.useMemo)((function(){return F.qL.INTEGRATION===(null===U||void 0===U?void 0:U.type)}),[U]),on=(0,s.useMemo)((function(){return F.qL.STREAMING===(null===U||void 0===U?void 0:U.type)}),[U]),ln=(0,s.useMemo)((function(){var e;return F.qL.PYTHON===(null===U||void 0===U?void 0:U.type)&&(null===z||void 0===z||null===(e=z.features)||void 0===e?void 0:e[ot.d.ADD_NEW_BLOCK_V2])}),[U,z]),cn=V.ZP.block_templates.list({show_all:ln?1:null},{revalidateOnFocus:!1}).data,un=(0,s.useMemo)((function(){return(null===cn||void 0===cn?void 0:cn.block_templates)||[]}),[cn]),an="PipelineDetail/index",sn=(0,fe.y)(),dn=sn.disableGlobalKeyboardShortcuts,fn=sn.registerOnKeyDown,hn=sn.unregisterOnKeyDown;(0,s.useEffect)((function(){return function(){hn(an)}}),[hn,an]),fn(an,(function(e,n,t){if(H&&(0,ut.y)([ae.zX,ae.hS],n)){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(!g&&!dn)if((0,ut.y)([ae.zX,ae.Um],n)||(0,ut.y)([ae.PQ,ae.Um],n))e.preventDefault(),q();else if(me)n[ae.vP]?pe(!1):H||ae.Z1.find((function(e){return n[e]}))||le(!0);else if(!tn){var i;if(ln&&((0,ut.y)([ae.zX,ae.A1],n)||(0,ut.y)([ae.PQ,ae.A1],n)))e.preventDefault(),Pe(!0),null===ge||void 0===ge||null===(i=ge.current)||void 0===i||i.focus();else if(ln&&Ze&&(0,ut.y)([ae.vP],n)){var r;e.preventDefault(),Pe(!1),null===ge||void 0===ge||null===(r=ge.current)||void 0===r||r.blur()}else if(Q){var o=h.findIndex((function(e){var n=e.uuid;return Q.uuid===n}));if(n[ae.vP])ue(null);else if(t[0]===ae.xD&&t[1]===ae.xD)E();else if(t[0]===ae.l1&&t[1]===ae.l1&&-1!==o)b(Q).then((function(e){null!==e&&void 0!==e&&e.error||setTimeout((function(){o===h.length-1?ue(h[o-1]):h.length>=0?ue(h[o+1]):ue(null)}),100)}));else if(n[ae.Bu]&&o>=1){var l=h[o-1];if(l){var c,a;ue(l);var s="".concat(l.type,"s/").concat(l.uuid,".py");null===(c=f.current[s])||void 0===c||null===(a=c.current)||void 0===a||a.scrollIntoView()}}else if(n[ae.kD]&&o<=nn-2){var d=h[o+1];if(d){var p,v;ue(d);var m="".concat(d.type,"s/").concat(d.uuid,".py");null===(p=f.current[m])||void 0===p||null===(v=p.current)||void 0===v||v.scrollIntoView()}}else(0,ut.y)([ae.Uq],n)&&pe(!0)}else en&&n[ae.Uq]&&ue(en);u||t[0]!==ae.OC||t[1]!==ae.OC||W()}}),[n,u,f.current,h,Ze,E,tn,nn,H,W,q,ge,Q,en,le,ue,pe,me,ln]),(0,s.useEffect)((function(){var e=setInterval((function(){H&&q()}),1e4);return function(){clearInterval(e)}}),[H,q]),(0,s.useEffect)((function(){setTimeout((function(){return Ee(!0)}),2*Ce.zn)}),[U]);var vn=(0,d.Db)((function(e){var n=e.block,t=e.upstreamBlocks;return V.ZP.blocks.pipelines.useUpdate(null===U||void 0===U?void 0:U.uuid,null===n||void 0===n?void 0:n.uuid)({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){j()},onErrorCallback:function(e,n){return null===te||void 0===te?void 0:te({errors:n,response:e})}})}}),mn=(0,l.Z)(vn,1)[0],bn=(0,s.useCallback)((function(e){ye(!0),Ve(e),X(!0)}),[ye,X,Ve]),gn=(0,s.useCallback)((function(){ye(!1),Ke(!1),Qe(""),X(!1)}),[X]),xn=(0,s.useCallback)((function(e,n){var t,i;h.forEach((function(r,o){var l=r.uuid;t>=0&&i>=0||(l===e.uuid?t=o:l===n.uuid&&(i=o))}));var r=(0,_e.oM)(h,i);return r=(0,_e.Hk)(n,Math.max(t,0),r),q({pipeline:{blocks:r,uuid:null===U||void 0===U?void 0:U.uuid}})}),[h,U,q]),jn=(0,s.useMemo)((function(){var e=[];return h.filter((function(e){var n=e.type;return!tn||v.tf.TRANSFORMER===n})).forEach((function(l,u){var d,p=l.type,y=l.uuid,k=(null===Q||void 0===Q?void 0:Q.uuid)===y,Z=$e[y],O=Z?0===Z.priority?Te.uF.BUSY:Te.uF.QUEUED:Te.uF.IDLE,P="".concat(p,"s/").concat(y,".py");f.current[P]=(0,s.createRef)();var C=p===v.tf.MARKDOWN,_=p===v.tf.TRANSFORMER,M=!(null===S||void 0===S||!S[y]),A=u===nn-1||tn,F=f.current[P];d=M?(0,w.jsx)(pn,{block:l,blocks:h,onClick:function(){return re((function(e){return st(st({},e),{},(0,o.Z)({},y,!M))}))},onDrop:xn,ref:F},y):(0,w.jsx)(R.Z,{addNewBlock:function(e,t){pe(!0);return n(e,u+1,(function(e){if(1===(null===t||void 0===t?void 0:t.length)){var n,i,o=null===(n=t[0])||void 0===n?void 0:n.uuid,l=(null===(i=t[0])||void 0===i?void 0:i.upstream_blocks)||[];mn({block:{uuid:o},upstreamBlocks:[e.uuid].concat((0,r.Z)(l))})}null===ue||void 0===ue||ue(e)}))},addNewBlockMenuOpenIdx:Fe,addWidget:t,allBlocks:i,allowCodeBlockShortcuts:c,autocompleteItems:a,block:l,blockIdx:u,blockRefs:f,blockTemplates:un,blocks:h,dataProviders:m,defaultValue:l.content,deleteBlock:function(e){b(e),J(!1)},disableShortcuts:g,executionState:O,fetchFileTree:x,fetchPipeline:j,hideRunButton:on||C||tn&&_,interruptKernel:E,mainContainerRef:I,mainContainerWidth:T,messages:D[y],noDivider:A,onCallbackChange:function(e){return B(p,y,e)},onChange:function(e){return N(p,y,e)},onClickAddSingleDBTModel:bn,onDrop:xn,openSidekickView:L,pipeline:U,project:z,ref:F,runBlock:G,runningBlocks:Y,savePipelineContent:q,selected:k,setAddNewBlockMenuOpenIdx:Ue,setAnyInputFocused:J,setCreatingNewDBTModel:Ke,setEditingBlock:ne,setErrors:te,setOutputBlocks:oe,setSelected:function(e){return ue(!0===e?l:null)},setSelectedBlock:ue,setSelectedOutputBlock:se,setTextareaFocused:pe,showBrowseTemplates:he,showConfigureProjectModal:ve,textareaFocused:k&&me,widgets:be},y),e.push(d)})),e}),[n,Fe,t,i,c,a,f,un,h,m,b,g,x,j,S,E,tn,on,I,T,D,nn,B,N,bn,xn,L,U,z,G,Y,$e,q,Q,Ue,J,ne,te,re,oe,ue,se,pe,he,ve,me,mn,be]),yn=(0,s.useMemo)((function(){return(0,w.jsx)(rt,{addNewBlockAtIndex:n,blocks:h,codeBlocks:jn,fetchFileTree:x,fetchPipeline:j,fetchSampleData:y,globalVariables:_,onChangeCodeBlock:N,openSidekickView:L,pipeline:U,savePipelineContent:q,setErrors:te,setIntegrationStreams:ie,setOutputBlocks:oe,setSelectedBlock:ue,setSelectedOutputBlock:se,setSelectedStream:de})}),[n,h,jn,x,j,y,_,N,L,U,q,te,ie,oe,ue,se,de]),kn=(0,s.useMemo)((function(){return U&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Re.Z,{addNewBlock:function(e){var t=h[h.length-1],i=null,r=e.configuration||{},o=t?(0,rn.eY)(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\n df = get_variable('".concat(U.uuid,"', '").concat(t.uuid,"', 'output_0')\n ")),v.t6.SQL===t.language&&(r=st(st({},(0,Tn.GL)(t.configuration,[lt.cH,lt.Sv,lt.sc,lt.BD,lt.nq])),r))),v.t6.SQL===e.language&&(i=(0,ct.SF)(i)),i=(0,ct.X7)(e,i),n(st(st({},e),{},{configuration:r,content:i,upstream_blocks:o}),nn,ue),pe(!0)},blockTemplates:un,focusedAddNewBlockSearch:Ze,hideCustom:tn||on,hideDataExporter:tn,hideDataLoader:tn,hideDbt:tn||on,hideScratchpad:tn,hideSensor:tn,onClickAddSingleDBTModel:bn,pipeline:U,project:z,searchTextInputRef:ge,setCreatingNewDBTModel:Ke,setFocusedAddNewBlockSearch:Pe,showBrowseTemplates:he,showConfigureProjectModal:ve}),!ln&&(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Want to try the new add block UI?",(0,w.jsx)("br",{}),"Turn on the feature named ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:ot.d.ADD_NEW_BLOCK_V2})," in your ",(0,w.jsx)(Ae(),{href:"/settings/workspace/preferences",passHref:!0,children:(0,w.jsx)(k.Z,{muted:!0,underline:!0,children:(0,w.jsx)(O.ZP,{bold:!0,inline:!0,muted:!0,small:!0,children:"project settings"})})}),"."]})})]})}),[n,un,h,Ze,tn,on,nn,bn,U,z,ge,Pe,ue,pe,he,ve,ln]);return(0,w.jsxs)(M.W,{backend:A.PD,children:[(0,w.jsx)(Ce.lO,{children:Me&&(0,w.jsx)(Be.Z,{classNames:"pipeline-detail",in:Se,onEntered:function(){return setTimeout((function(){return Ne(!1)}),Ce.zn)},timeout:1,children:(0,w.jsx)(Ce.fm,{})})}),(0,w.jsxs)(Z.Z,{mt:1,px:P.cd,children:[tn&&yn,!tn&&(0,w.jsxs)(w.Fragment,{children:[jn,(0,w.jsx)(Z.Z,{mt:P.cd,children:kn})]}),je&&(0,w.jsx)(ce.Z,{onClickOutside:gn,open:!0,children:(0,w.jsx)(Je,{blocks:h,creatingNewDBTModel:Ge,dbtModelName:qe,files:C,onClose:gn,onOpenFile:function(e){var t=e;if(Ge){var i=(0,$.RA)(qe||(0,$.Y6)()),r=".".concat(Xe.Lu.SQL);i.endsWith(r)&&(i=i.slice(0,-4)),t="".concat(e).concat(De.sep).concat(i,".").concat(Xe.Lu.SQL)}var o={configuration:{file_path:t,limit:R.z},language:v.t6.SQL,name:(0,$.wE)(t),type:v.tf.DBT};Ge&&(o.content="--Docs: https://docs.mage.ai/dbt/sources\n");var l="undefined"===typeof ze||null===ze,c=h[l?h.length-1:ze],u=c?(0,rn.eY)(c,o):[];n(st(st({},o),{},{upstream_blocks:u}),l?nn:ze+1,ue),gn(),pe(!0)},setDbtModelName:Qe})})]})]})},ft=t(49894),pt=t(41424),ht=t(32063),vt=t(82386),mt=t(70543),bt=t(24141);function gt(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 xt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?gt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jt=function(e){var n=e.after,t=e.afterHeader,i=e.afterHeightOffset,r=e.afterHidden,o=e.afterNavigationItems,c=e.afterOverflow,u=e.afterSubheader,a=e.before,d=e.beforeHeader,f=e.beforeHeightOffset,p=e.beforeNavigationItems,h=e.children,v=e.errors,m=e.headerOffset,b=e.mainContainerHeader,g=e.mainContainerRef,x=e.page,j=e.pipeline,y=e.setAfterHidden,k=e.setAfterWidthForChildren,Z=e.setErrors,O=e.setMainContainerWidth,P=(0,bt.i)().width,C=(0,s.useState)((0,Pe.U2)(Pe.L8,vt.Zt)),_=C[0],S=C[1],E=(0,s.useState)((0,Pe.U2)(Pe.J3,vt.ve)),I=E[0],T=E[1],D=(0,s.useState)(!!(0,Pe.U2)(Pe.Uu)),M=D[0],A=D[1],B=(0,s.useState)(!1),R=B[0],N=B[1],L=(0,s.useState)(!1),F=L[0],U=L[1],H=r,z=y;if(!z){var W=(0,s.useState)(!!(0,Pe.U2)(Pe.zg)),G=(0,l.Z)(W,2);H=G[0],z=G[1]}(0,s.useEffect)((function(){null===g||void 0===g||!g.current||R||F||null===O||void 0===O||O(g.current.getBoundingClientRect().width)}),[R,F,H,_,M,I,g,O,P]),(0,s.useEffect)((function(){R||(null===k||void 0===k||k(_),(0,Pe.t8)(Pe.L8,_))}),[R,_,k]),(0,s.useEffect)((function(){F||(0,Pe.t8)(Pe.J3,I)}),[F,I]);var K=V.ZP.projects.list({},{revalidateOnFocus:!1}).data,Y=null===K||void 0===K?void 0:K.projects,q=(0,s.useMemo)((function(){var e,n=[{label:function(){return"Pipelines"},linkProps:{as:"/pipelines",href:"/pipelines"}}];return j&&(n.push.apply(n,[{bold:mt.b7!==x,label:function(){return null===j||void 0===j?void 0:j.uuid},linkProps:{as:"/pipelines/".concat(null===j||void 0===j?void 0:j.uuid),href:"/pipelines/[pipeline]"}}]),mt.b7===x&&n.push.apply(n,[{bold:!0,label:function(){return(0,$.kC)(x)}}])),(0,w.jsx)(pt.Z,{breadcrumbs:n,project:null===Y||void 0===Y?void 0:Y[0],version:null===Y||void 0===Y||null===(e=Y[0])||void 0===e?void 0:e.version})}),[x,j,Y]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(xe.Z,{title:null===j||void 0===j?void 0:j.name}),(0,w.jsx)(ht.Z,{after:n,afterHeader:t,afterHeightOffset:i,afterHidden:H,afterMousedownActive:R,afterNavigationItems:o,afterOverflow:c,afterSubheader:u,afterWidth:_,before:a,beforeHeader:d,beforeHeightOffset:f,beforeHidden:M,beforeMousedownActive:F,beforeNavigationItems:p,beforeWidth:I,header:q,headerOffset:m,mainContainerHeader:b,mainContainerRef:g,navigationShowMore:!0,setAfterHidden:z,setAfterMousedownActive:N,setAfterWidth:S,setBeforeHidden:A,setBeforeMousedownActive:U,setBeforeWidth:T,children:h}),v&&(0,w.jsx)(ce.Z,{disableClickOutside:!0,isOpen:!0,onClickOutside:function(){return Z(null)},children:(0,w.jsx)(ft.Z,xt(xt({},v),{},{onClose:function(){return Z(null)}}))})]})},yt=t(21853),kt=t(41788),Zt=t(18221);function Ot(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 Pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ot(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ot(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ct=function(e){var n=e.block,t=e.fetchFileTree,i=e.fetchPipeline,r=e.pipeline,o=e.setSelectedBlock,c=(0,s.useRef)(null),u=(0,s.useRef)(null),a=(0,s.useMemo)((function(){return null===r||void 0===r?void 0:r.uuid}),[r]),f=(0,s.useMemo)((function(){return(null===r||void 0===r?void 0:r.retry_config)||{}}),[r]),p=(0,ne.VI)(null,{},[],{uuid:"BlockSettings/index"}),h=(0,l.Z)(p,1)[0],m=n.type,g=n.uuid,x=(0,s.useState)(null),j=x[0],C=x[1],_=(0,s.useState)(!1),S=_[0],E=_[1],I=(0,s.useState)(!1),D=I[0],M=I[1],A=(0,Oe.Z)(n);(0,s.useEffect)((function(){(null===A||void 0===A?void 0:A.uuid)!==(null===n||void 0===n?void 0:n.uuid)&&C(n)}),[n,A]);var B=(0,s.useMemo)((function(){return(null===j||void 0===j?void 0:j.retry_config)||{}}),[j]),R=(0,s.useCallback)((function(e){E(!0),C(e)}),[]),N=(0,s.useMemo)((function(){return null===j||void 0===j?void 0:j.executor_type}),[j]);(0,s.useEffect)((function(){D||!N||Zt.R.find((function(e){return e===N}))||M(!0)}),[D,N]);var L=V.ZP.blocks.pipelines.detail(a,encodeURIComponent(g),{_format:"with_settings",block_type:m}).data,F=(0,s.useMemo)((function(){return(null===L||void 0===L?void 0:L.block)||{}}),[L]),W=(0,s.useMemo)((function(){return null!==F&&void 0!==F&&F.pipelines?Object.values(null===F||void 0===F?void 0:F.pipelines):[]}),[F]),G=(0,d.Db)(V.ZP.blocks.pipelines.useUpdate(a,g),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){E(!1),t(),i(),null!==e&&void 0!==e&&e.block&&o(null===e||void 0===e?void 0:e.block)},onErrorCallback:function(e,n){return h({errors:n,response:e})}})}}),K=(0,l.Z)(G,2),Y=K[0],q=K[1].isLoading,Q=(0,s.useMemo)((function(){return(null===W||void 0===W?void 0:W.length)>=1&&(0,w.jsx)(Sn.Z,{columnFlex:[null,1],columns:[{uuid:"Name"},{uuid:"Description"}],rows:W.map((function(e){var n=e.pipeline,t=n.description,i=n.name,o=n.uuid;return[(null===r||void 0===r?void 0:r.uuid)===o?(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:i||o},"name"):(0,w.jsx)(k.Z,{href:"/pipelines/".concat(o,"/edit"),monospace:!0,openNewWindow:!0,sameColorAsText:!0,children:i||o},"name"),(0,w.jsx)(O.ZP,{default:!0,monospace:!0,children:t||"-"},"description")]})),uuid:"git-branch-blockPipelines"})}),[W,r]),J=(0,s.useMemo)((function(){return f&&"undefined"!==typeof f&&!(0,Tn.Qr)(f)&&("undefined"!==typeof(null===f||void 0===f?void 0:f.delay)&&"undefined"===typeof(null===B||void 0===B?void 0:B.delay)||"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)&&"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)||"undefined"!==typeof(null===f||void 0===f?void 0:f.max_delay)&&"undefined"===typeof(null===B||void 0===B?void 0:B.max_delay)||"undefined"!==typeof(null===f||void 0===f?void 0:f.retries)&&"undefined"===typeof(null===B||void 0===B?void 0:B.retries))}),[B,f]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:P.HN,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(z.Z,{label:"Name",onChange:function(e){return R((function(n){return Pt(Pt({},n),{},{name:e.target.value})}))},primary:!0,setContentOnMount:!0,value:(null===j||void 0===j?void 0:j.name)||""}),v.tf.CUSTOM===(null===n||void 0===n?void 0:n.type)&&(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(U.Z,{label:"Color",onChange:function(e){return R((function(n){return Pt(Pt({},n),{},{color:e.target.value})}))},primary:!0,value:(null===j||void 0===j?void 0:j.color)||"",children:Object.values(v.Lq).map((function(e){return(0,w.jsx)("option",{value:e,children:(0,$.kC)(e)},e)}))})})]}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(mn.Z,{children:"Executor type"}),(0,w.jsxs)(O.ZP,{muted:!0,children:["For more information on this setting, please read the ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/compute-resource#2-set-executor-type-and-customize-the-compute-resource-of-the-mage-executor",openNewWindow:!0,children:"documentation"}),"."]}),(0,w.jsxs)(Z.Z,{mt:1,children:[!D&&(0,w.jsx)(U.Z,{label:"Executor type",onChange:function(e){return R((function(n){return Pt(Pt({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:c,value:(null===j||void 0===j?void 0:j.executor_type)||"",children:Zt.R.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))}),D&&(0,w.jsx)(z.Z,{label:"Executor type",monospace:!0,onChange:function(e){return R((function(n){return Pt(Pt({},n),{},{executor_type:e.target.value})}))},primary:!0,ref:u,setContentOnMount:!0,value:(null===j||void 0===j?void 0:j.executor_type)||""}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsx)(k.Z,{muted:!0,onClick:function(){D?(R((function(e){return Pt(Pt({},e),{},{executor_type:null})})),setTimeout((function(){var e;return null===c||void 0===c||null===(e=c.current)||void 0===e?void 0:e.focus()}),1)):setTimeout((function(){var e;return null===u||void 0===u||null===(e=u.current)||void 0===e?void 0:e.focus()}),1),M(!D)},preventDefault:!0,small:!0,children:D?"Select a preset executor type":"Enter a custom executor type"})})]})]}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[(0,w.jsx)(mn.Z,{children:"Retry configuration"}),(0,w.jsxs)(O.ZP,{muted:!0,children:[J&&(0,w.jsxs)(w.Fragment,{children:["This block is currently using the retry configuration from the pipeline. You can override the pipeline\u2019s retry configuration for this block.",(0,w.jsx)("br",{})]}),"For more information on this setting, please read the ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/orchestration/pipeline-runs/retrying-block-runs",openNewWindow:!0,children:"documentation"}),"."]}),(0,w.jsxs)(Z.Z,{mt:1,children:[(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(z.Z,{label:"Retries",monospace:!0,onChange:function(e){return R((function(n){var t;return Pt(Pt({},n),{},{retry_config:Pt(Pt({},null===n||void 0===n?void 0:n.retry_config),{},{retries:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.retries),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.retries)?null===B||void 0===B?void 0:B.retries:(null===f||void 0===f?void 0:f.retries)||""}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(z.Z,{label:"Delay",monospace:!0,onChange:function(e){return R((function(n){var t;return Pt(Pt({},n),{},{retry_config:Pt(Pt({},null===n||void 0===n?void 0:n.retry_config),{},{delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.delay)?null===B||void 0===B?void 0:B.delay:(null===f||void 0===f?void 0:f.delay)||""}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(z.Z,{label:"Max delay",monospace:!0,onChange:function(e){return R((function(n){var t;return Pt(Pt({},n),{},{retry_config:Pt(Pt({},null===n||void 0===n?void 0:n.retry_config),{},{max_delay:"undefined"!==typeof e.target.value&&null!==e.target.value&&(null===(t=e.target.value)||void 0===t?void 0:t.length)>=1?Number(e.target.value):null})})}))},primary:!0,required:"undefined"===typeof(null===f||void 0===f?void 0:f.max_delay),setContentOnMount:!0,type:"number",value:"undefined"!==typeof(null===B||void 0===B?void 0:B.max_delay)?null===B||void 0===B?void 0:B.max_delay:(null===f||void 0===f?void 0:f.max_delay)||""})]}),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(b.Z,{checked:"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)&&"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)?!(null===f||void 0===f||!f.exponential_backoff):!(null===B||void 0===B||!B.exponential_backoff),label:"Exponential backoff",onClick:function(){return R((function(e){var n;return Pt(Pt({},e),{},{retry_config:Pt(Pt({},null===e||void 0===e?void 0:e.retry_config),{},{exponential_backoff:"undefined"===typeof(null===B||void 0===B?void 0:B.exponential_backoff)&&"undefined"!==typeof(null===f||void 0===f?void 0:f.exponential_backoff)?!(null!==f&&void 0!==f&&f.exponential_backoff):!(null!==e&&void 0!==e&&null!==(n=e.retry_config)&&void 0!==n&&n.exponential_backoff)})})}))}})})]})]}),(0,w.jsx)(T.Z,{disabled:!S,loading:q,onClick:function(){return Y({block:{color:null===j||void 0===j?void 0:j.color,executor_type:null===j||void 0===j?void 0:j.executor_type,name:null===j||void 0===j?void 0:j.name,retry_config:B}})},primary:!0,children:"Update block settings"})]})}),(0,w.jsxs)(Z.Z,{mb:P.HN,children:[!L&&(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(H.Z,{inverted:!0})}),L&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(mn.Z,{children:"Pipelines"}),(0,w.jsx)(O.ZP,{default:!0,children:"Here are all the pipelines that are using this block."})]}),Q]})]})]})},wt=t(92083),_t=t.n(wt),St=t(26226),Et=t(84969),It=t(90948),Tt=t(65743),Dt=t(39048),Mt=t(79487),At=t(29989),Bt=t(61655),Rt=t(16853),Nt=t(65376),Lt=t(52359),Ft=t(2005),Ut=t(48072),Ht=t(24903),zt=t(98677),Vt=t(84181),Wt=t(73899),Gt=t(31012);function Kt(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 Yt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Kt(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Kt(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var qt={bottom:P.iI*(3+P.cd),left:P.iI*P.cd,right:P.iI*P.cd,top:P.iI*P.cd};function Qt(e,n){return Math.max.apply(Math,(0,r.Z)(e.map(n)))}function Jt(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)(m.ThemeContext),v=(0,s.useCallback)((function(e){return e[i]}),[i]),b=p;b||(b=function(e){return e.length>20?"".concat(e.substring(0,20),"..."):e});var g=o?Gt.iD:Gt.J5,x=Yt(Yt({},qt),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,Ht.Z)({domain:y,range:[Wt.a$,Wt.Ej,Wt.hM,Wt.ZA,Wt.$R,Wt.X_,Wt.er,Wt.hl,Wt.nQ]}),Z=(0,s.useMemo)((function(){return j.map(v)}),[j,v]),O=(0,zt.Z)({domain:Z,padding:.1}),P=(0,zt.Z)({domain:y,padding:.1}),C=(0,Vt.Z)({domain:[0,Qt(j,(function(e){return Qt(y,(function(n){return Number(e[n])}))}))]}),w={active:(null===h||void 0===h?void 0:h.content.default)||G.Z.content.default,backgroundPrimary:(null===h||void 0===h?void 0:h.chart.backgroundPrimary)||G.Z.chart.backgroundPrimary,backgroundSecondary:(null===h||void 0===h?void 0:h.chart.backgroundSecondary)||G.Z.chart.backgroundSecondary,muted:(null===h||void 0===h?void 0:h.content.muted)||G.Z.content.muted,primary:(null===h||void 0===h?void 0:h.chart.primary)||G.Z.chart.primary,tooltipBackground:(null===h||void 0===h?void 0:h.background.navigation)||G.Z.background.navigation},_=Z;a&&(_=j.reduce((function(e,n){return e.concat(y.map((function(e){var t=n[e];return(0,$.HW)(t)?parseInt(String(t)):t})))}),[]));var S=Math.min(Math.max.apply(Math,(0,r.Z)(_.map((function(e){return String(e).length})))),20);x.left+=7*S;var E=f-(x.left+x.right),I=t-(x.top+x.bottom);a?(O.rangeRound([0,E]),C.rangeRound([I,0])):(O.rangeRound([I,0]),C.rangeRound([0,E])),P.rangeRound([0,O.bandwidth()]);var T=j.map(v).length,D=0;a||(D=O(_[T-1]));var M=(0,s.useCallback)((function(e){var n=(0,Ut.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-D/2)/(E-D):1-(o-D/2)/(I-D);var c=Math.floor(l*T),u=j[c];"undefined"===typeof u&&(u=j[c-1]),a?r>D&&r<E+x.left-D&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i}):o>D&&o<I-D&&d({tooltipData:u,tooltipLeft:t,tooltipTop:i})}),[j,T,x.left,x.top,a,d,D,E,I]);return{colorScale:k,colors:w,data:j,fontSize:g,handleTooltip:M,margin:x,tempScale:C,tickValues:_,xKeys:y,xMax:E,y1Scale:P,yLabelFormat:b,yMax:I,yScale:O,ySerialize:v}}var Xt=["height","width","xAxisLabel","yAxisLabel"];function $t(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 ei(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$t(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$t(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ni=3*P.iI,ti=(P.iI,P.iI,P.iI,(0,Bt.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,v=e.tooltipOpen,m=e.tooltipTop,b=e.width,g=e.xAxisLabel,x=e.xNumTicks,j=e.yLabelFormat,y=Jt({data:n,height:t,keyForYData:o,large:c,margin:a,showTooltip:f,width:b,yLabelFormat:j}),k=y.colorScale,Z=y.colors,P=y.data,C=y.fontSize,_=y.handleTooltip,S=y.margin,E=y.tempScale,I=y.tickValues,T=y.xKeys,D=y.xMax,M=y.y1Scale,A=y.yLabelFormat,B=y.yMax,R=y.yScale,N=y.ySerialize,L=[],F=Math.floor((null===I||void 0===I?void 0:I.length)/Math.floor(t/ni));return null===I||void 0===I||I.forEach((function(e,n){n%F===0&&L.push(e)})),b<10?null:(0,w.jsxs)("div",{children:[(0,w.jsxs)("svg",{height:t,width:b,children:[s&&!(null!==P&&void 0!==P&&P.length)&&(0,w.jsx)("text",{fill:Z.active,dominantBaseline:"middle",textAnchor:"middle",fontFamily:Ft.ry,fontSize:C,x:"50%",y:"50%",children:s()}),(0,w.jsx)(Tt.Z,{fill:"transparent",height:t-(S.top+S.bottom),onMouseLeave:function(){return i()},onMouseMove:_,onTouchMove:_,onTouchStart:_,rx:14,width:b-(S.left+S.right),x:S.left,y:S.top}),(null===P||void 0===P?void 0:P.length)&&(0,w.jsxs)(At.Z,{left:S.left,top:S.top,children:[(0,w.jsx)(Dt.Z,{color:k,data:P,keys:T,width:D,xScale:E,y0:N,y0Scale:R,y1Scale:M,children:function(e){return e.map((function(e){return(0,w.jsx)(At.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)(Et.Z,{hideTicks:!0,scale:R,stroke:Z.muted,tickFormat:function(e){return A(e)},tickLabelProps:function(){return{fill:Z.active,fontFamily:Ft.ry,fontSize:C,style:{width:"10px"},textAnchor:"end"}},tickStroke:Z.muted,tickValues:L,top:2}),(0,w.jsx)(It.Z,{label:g,labelProps:{fill:Z.muted,fontFamily:Ft.ry,fontSize:C,textAnchor:"middle"},numTicks:x,scale:E,stroke:Z.muted,tickLabelProps:function(){return{fill:Z.active,fontFamily:Ft.ry,fontSize:C,textAnchor:"middle"}},tickStroke:Z.muted,top:B})]}),p&&(0,w.jsx)("g",{children:(0,w.jsx)(Mt.Z,{from:{x:S.left,y:m},pointerEvents:"none",stroke:Z.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:D+S.left,y:m}})})]}),v&&p&&(0,w.jsxs)(Rt.Z,{left:h,style:ei(ei({},Nt.j),{},{backgroundColor:Z.tooltipBackground}),top:m,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,$.HW)(r)&&String(r).split(".").length>=2&&(r=r.toFixed(4)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",r]},t)}}))]})]})})));var ii=function(e){var n,t=e.height,i=e.width,r=e.xAxisLabel,o=e.yAxisLabel,l=(0,Cn.Z)(e,Xt);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?P.iI:null,width:"100%"},children:[o&&(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(Lt.Z,{children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:o})})}),(0,w.jsx)("div",{style:{height:t,width:n},children:(0,w.jsx)(St.Z,{children:function(e){var n=e.width,t=e.height;return(0,w.jsx)(ti,ei(ei({},l),{},{height:t,width:n}))}})})]}),r&&(0,w.jsx)("div",{style:{paddingLeft:o?36:0,paddingTop:4},children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:r})})]})},ri=t(95422),oi=["keyForYData"],li=["height","width","xAxisLabel","yAxisLabel"];function ci(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 ui(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ci(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ci(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var ai=6*P.iI,si=(0,Bt.Z)((function(e){var n=e.keyForYData,t=void 0===n?"__y":n,i=(0,Cn.Z)(e,oi),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,v=i.xNumTicks,m=i.yNumTicks,b=Jt(ui(ui({},i),{},{keyForYData:t,orientationVertical:!0})),g=b.colorScale,x=b.colors,j=b.data,y=b.fontSize,k=b.handleTooltip,Z=b.margin,P=b.tempScale,C=(b.tickValues,b.xKeys),_=(b.xMax,b.y1Scale),S=b.yLabelFormat,E=b.yMax,I=b.yScale,T=b.ySerialize,D=Math.min(v,p/ai);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:Ft.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)(Tt.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)(At.Z,{top:Z.top,children:[(0,w.jsx)(ri.Z,{color:g,data:j,height:E,keys:C,x0:T,x0Scale:I,x1Scale:_,yScale:P,children:function(e){return e.map((function(e){return(0,w.jsx)(At.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)(Et.Z,{left:Z.left,numTicks:m,scale:P,stroke:x.muted,tickFormat:function(e){return S(e)},tickLabelProps:function(){return{fill:x.active,fontFamily:Ft.ry,fontSize:y,textAnchor:"end",transform:"translate(-2,2.5)"}},tickStroke:x.muted,top:Z.top}),(0,w.jsx)(It.Z,{hideTicks:!0,left:Z.left,numTicks:D,scale:I,stroke:x.muted,tickFormat:h,tickLabelProps:function(){return{fill:x.active,fontFamily:Ft.ry,fontSize:y,textAnchor:"middle"}},tickStroke:x.muted,top:E+Z.top})]})]}),a&&(0,w.jsx)("g",{children:(0,w.jsx)(Mt.Z,{from:{x:s,y:2*Z.top},pointerEvents:"none",stroke:x.active,strokeDasharray:"5,2",strokeWidth:1,to:{x:s,y:E+2*Z.top}})})]}),d&&a&&(0,w.jsxs)(Rt.Z,{left:s,style:ui(ui({},Nt.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,$.HW)(o)&&String(o).split(".").length>=2&&(o=o.toFixed(4)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[i,": ",o]},i)}})),(0,w.jsx)("br",{}),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[h&&h(T(a)),!h&&T(a)]})]})]})}));var di=function(e){var n=e.height,t=e.width,i=e.xAxisLabel,r=e.yAxisLabel,o=(0,Cn.Z)(e,li);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{style:{display:"flex",height:n,marginBottom:i?P.iI:null,width:"100%"},children:[r&&(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,justifyContent:"center",width:28,children:(0,w.jsx)(Lt.Z,{children:(0,w.jsx)(O.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)(St.Z,{children:function(e){var n=e.height,t=e.width;return(0,w.jsx)(si,ui(ui({},o),{},{height:n,width:t}))}})})]}),i&&(0,w.jsx)("div",{style:{paddingLeft:r?36:0,paddingTop:4},children:(0,w.jsx)(O.ZP,{center:!0,muted:!0,small:!0,children:i})})]})},fi=t(62976),pi=t(66872),hi=t(68735),vi=t(320),mi=40*P.iI,bi=m.default.div.withConfig({displayName:"indexstyle__ChartBlockStyle",componentId:"sc-1c3ufnj-0"})(["border-radius:","px;margin-left:","px;margin-right:","px;margin-top:","px;",""],K.n_,.5*P.iI,.5*P.iI,1*P.iI,(function(e){return"\n background-color: ".concat((e.theme.background||G.Z.background).codeArea,";\n ")})),gi=m.default.div.withConfig({displayName:"indexstyle__ConfigurationOptionsStyle",componentId:"sc-1c3ufnj-1"})(["flex:4;padding-left:","px;padding-right:","px;"],1*P.iI,1*P.iI),xi=m.default.div.withConfig({displayName:"indexstyle__CodeStyle",componentId:"sc-1c3ufnj-2"})(["padding-top:","px;",""],P.iI/2,(function(e){return"\n background-color: ".concat((e.theme.background||G.Z.background).codeTextarea,";\n ")})),ji=m.default.div.withConfig({displayName:"indexstyle__CodeHelperStyle",componentId:"sc-1c3ufnj-3"})(["margin-bottom:","px;padding-bottom:","px;padding-left:","px;",""],P.cd*P.iI,P.iI,P.iI,(function(e){return"\n border-bottom: 1px solid ".concat((e.theme.borders||G.Z.borders).medium,";\n ")}));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 Zi=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[lt.JJ]||mi,h=(null===u||void 0===u||null===(n=u[lt.bE])||void 0===n?void 0:n.map((function(e){return(0,lt.c0)(e)})))||[],v=we.n1,m=u[lt.Yg];if([lt.aE.HOUR,lt.aE.MINUTE,lt.aE.SECOND].includes(m)&&(v=we.OC),lt.oV.BAR_CHART===d||lt.oV.TIME_SERIES_BAR_CHART===d){var b=i.x,g=i.y,x=lt.oV.TIME_SERIES_BAR_CHART===d;if(b&&g&&Array.isArray(b)&&Array.isArray(g)){var j,y=null===(j=u[lt.eN])||void 0===j?void 0:j.join(", "),k=null===h||void 0===h?void 0:h.join(", ");h.length||h.push(lt.rj);var Z=h[0],C=b.map((function(e,n){return ki({__y:e},h.reduce((function(e,t,i){var r,l=null===g||void 0===g||null===(r=g[i])||void 0===r?void 0:r[n];return"undefined"===typeof l?e:ki(ki({},e),{},(0,o.Z)({},t,l))}),{}))}));lt.MP.ASCENDING===f?C=(0,_e.YC)(C,(function(e){return e[Z]}),{ascending:!1}):lt.MP.DESCENDING===f&&(C=(0,_e.YC)(C,(function(e){return e[Z]}),{ascending:!0}));var _={data:C,height:p,renderNoDataText:function(){return"No data matching query"},width:r,xNumTicks:3};return lt.JT.HORIZONTAL===s?(0,w.jsx)(ii,ki(ki({},_),{},{xAxisLabel:k||u[lt.rj],yAxisLabel:y||u[lt.a3]})):(0,w.jsx)(di,ki(ki({},_),{},{xAxisLabel:y,xLabelFormat:function(e){return x?_t()(1e3*e).format(we.n1):e},xNumTicks:C.length,yAxisLabel:k,yNumTicks:5}))}}else if(lt.oV.HISTOGRAM===d){var S,E=i.x,I=i.y,T=null===(S=u[lt.eN])||void 0===S?void 0:S.join(", ");if(E&&I&&Array.isArray(E))return(0,w.jsx)(pi.Z,{data:E.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*P.iI,right:1*P.iI,top:3*P.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)(O.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,_e.YC)(e,"[0]")},xAxisLabel:T||u[lt.a3],yAxisLabel:T?"count(".concat(T,")"):u[lt.rj]})}else if(lt.oV.LINE_CHART===d||lt.oV.TIME_SERIES_LINE_CHART===d){var D=i.x,M=i.y,A=lt.oV.TIME_SERIES_LINE_CHART===d;if(D&&M&&Array.isArray(D)&&Array.isArray(M)&&Array.isArray(null===M||void 0===M?void 0:M[0])){var B,R=h;u[lt.e]&&(R=u[lt.e].split(",").map((function(e){return e.trim()})));var N=D.map((function(e,n){return{x:e,y:(0,_e.w6)(M.length).map((function(e,t){var i=M[t][n];return"undefined"===typeof i||null===i?0:i}))}})),L=null===(B=u[lt.eN])||void 0===B?void 0:B.join(", "),F=h.join(", ");return(0,w.jsx)(hi.Z,{data:N,height:p,lineLegendNames:R,margin:{bottom:8*P.iI,left:5*P.iI},noCurve:!0,renderXTooltipContent:function(e){e.index;var n=e.x,t=u[lt.a3],i=n;return u[lt.eN]&&(t=u[lt.eN].map(String).join(", ")),A&&(i=_t()(1e3*n).format(v)),(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[t,": ",i]})},renderYTooltipContent:function(e,n){var t=e.y;return(0,w.jsxs)(O.ZP,{inverted:!0,small:!0,children:[R&&R[n]&&"".concat(R[n],": "),t&&(0,$.x6)((0,$.QV)(t[n],4))]})},width:r?r-3*P.iI:r,xAxisLabel:L||String(u[lt.a3]),xLabelFormat:function(e){return A?_t()(1e3*e).format(we.n1):e},yAxisLabel:F||String(u[lt.rj]),yLabelFormat:function(e){return e}})}}else if(lt.oV.PIE_CHART===d){var U,H=i[String(u[lt.a3])],z=null===(U=u[lt.eN])||void 0===U?void 0:U.join(", ");if(H)return(0,w.jsx)(vi.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,$.x6)(i),")")},getY:function(e){return(0,l.Z)(e,2)[1]},height:p,width:r,xAxisLabel:z||String(u[lt.a3])})}else if(lt.oV.TABLE===d){var V=i.index,W=i.x,G=i.y;return Array.isArray(W)&&Array.isArray(G)&&Array.isArray(G[0])&&(0,w.jsx)(fi.Z,{columns:W,index:V,height:u[lt.JJ]?null:p,maxHeight:u[lt.JJ]?p:null,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,rows:G,width:r})}return(0,w.jsx)("div",{})},Oi=t(65051),Pi=t(76096);var Ci=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)(y.Z,{children:s.Children.map(n,(function(e,n){return(0,w.jsx)(Z.Z,{ml:n>=1?1:0,style:{display:"flex",flex:1},children:s.cloneElement(e,{onChange:function(e){o((function(i){return i[n]=e.target.value,t(i,{resetValues:function(){return u((function(e){return e+1}))},setValues:o}),i}))},value:r[n]})},"multi-select-child-".concat(n,"-").concat(c))}))})},wi=t(59582),_i=t(78759);function Si(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 Ei(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Si(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Si(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Ii(e,n){var t,i,r,c,u=e.autocompleteItems,a=e.block,f=e.blockRefs,p=e.blocks,h=e.deleteWidget,b=e.executionState,g=e.fetchPipeline,x=e.fetchFileTree,_=e.messages,S=void 0===_?[]:_,E=e.onChangeContent,I=e.pipeline,T=e.runBlock,D=e.runningBlocks,M=e.savePipelineContent,A=e.selected,B=e.setAnyInputFocused,R=e.setErrors,L=e.setSelectedBlock,F=e.setTextareaFocused,K=e.textareaFocused,Y=e.updateWidget,q=e.width,Q=(0,s.useRef)(null),J=(0,s.useContext)(m.ThemeContext),X=V.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,ne=(null===X||void 0===X||null===(t=X.block)||void 0===t?void 0:t.outputs)||(null===a||void 0===a?void 0:a.outputs)||[],te=(0,s.useState)(null),ie=te[0],re=te[1],oe=(0,s.useState)(null===(i=a.configuration)||void 0===i?void 0:i.chart_type),le=oe[0],ce=oe[1],ue=(0,s.useState)(a.configuration),se=ue[0],de=ue[1],pe=(0,s.useState)(a.content),he=pe[0],ve=pe[1],me=(0,s.useState)(!le||0===ne.length),be=me[0],ge=me[1],xe=(0,s.useState)(!1),je=xe[0],ye=xe[1],ke=(0,s.useState)(null),Pe=ke[0],Ce=ke[1],we=(0,s.useState)(null===a||void 0===a?void 0:a.upstream_blocks),Se=we[0],Ee=we[1],Ie=(0,s.useState)((null===ne||void 0===ne?void 0:ne.length)||0),De=Ie[0],Me=Ie[1],Ae=(0,s.useState)(a.uuid),Be=Ae[0],Re=Ae[1],Le=_i.G8[le],Fe=_i.x8[le],Ue=(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]),He=(0,s.useMemo)((function(){return(0,_e.HK)(Ue,(function(e){return e.uuid}))}),[Ue]),ze=!!D.find((function(e){return e.uuid===a.uuid}))||(null===S||void 0===S?void 0:S.length)>=1&&b!==Te.uF.IDLE,Ve=(0,s.useMemo)((function(){return null===S||void 0===S?void 0:S.filter((function(e){return null===e||void 0===e?void 0:e.type}))}),[S]),We=!!Ve.find((function(e){return e.error})),Ge=Ve.length>=1,Ke=(0,s.useMemo)((function(){return{blockType:a.type,hasError:We,selected:A}}),[a.type,We,A]);if(null!==Ve&&void 0!==Ve&&Ve.length){var Ye,qe,Qe=Ve.length-1;c=null===Ve||void 0===Ve||null===(Ye=Ve[Qe])||void 0===Ye||null===(qe=Ye.data)||void 0===qe?void 0:qe[0]}c?(c=(c=c.slice(1,c.length-1)).replaceAll('\\"','"').replaceAll("\\'","'"),(0,$.Pb)(c)&&(r=JSON.parse(c))):(null===ne||void 0===ne?void 0:ne.length)>=1&&(r={},ne.forEach((function(e){var n=e||{},t=n.text_data,i=n.type,o=n.variable_uuid;Te.Gi.TEXT===i&&(0,$.Pb)(t)&&(r[o]=JSON.parse(t))})));var Je=(0,s.useCallback)((function(e){var n=Ei(Ei(Ei({},a),e),{},{configuration:Ei(Ei({},a.configuration),e.configuration)});M().then((function(){T({block:n,code:he,ignoreAlreadyRunning:!0,runUpstream:!!Se.find((function(e){var n;return![v.DA.EXECUTED,v.DA.UPDATED].includes(null===(n=He[e])||void 0===n?void 0:n.status)}))})})),Me((function(e){return e+1}))}),[a,He,he,Me,Se]),Xe=(0,s.useCallback)((function(e){ve(e),E(e)}),[E,ve]),$e=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.autoRun;de((function(n){return Ei(Ei({},n),e)}));var i=Ei(Ei({},a),{},{configuration:Ei(Ei(Ei({},se),e),{},{chart_type:le})});Y(i),De&&t&&Je(i)}),[a,le,se,De,Je,de,Y]);(0,s.useEffect)((function(){re({python:(0,wi.Z)({autocompleteItems:u,block:a,blocks:p,pipeline:I})})}),[u,a,p,I]);var en=(0,s.useMemo)((function(){return(0,w.jsx)(Jn.Z,{autoHeight:!0,autocompleteProviders:ie,onChange:Xe,selected:A,setSelected:function(e){return L(!0===e?a:null)},setTextareaFocused:F,showLineNumbers:!1,textareaFocused:K||lt.oV.TABLE===le&&!be,value:he,width:"100%"})}),[ie,a,le,he,be,A,L,F,K,Xe]),nn=(0,s.useMemo)((function(){return(We||Ge)&&(0,w.jsx)(Oi.Z,Ei(Ei({},Ke),{},{block:a,contained:!1,hideExtraInfo:!0,isInProgress:ze,messages:Ve,selected:A}))}),[a,Ke,We,Ge,ze,Ve,A]),tn=(0,Oe.Z)(be),rn=(0,Oe.Z)(q);(0,s.useEffect)((function(){var e,n=null===Q||void 0===Q||null===(e=Q.current)||void 0===e?void 0:e.getBoundingClientRect();tn!==be||rn!==q?(Ce(0),setTimeout((function(){var e,n,t=null===Q||void 0===Q||null===(e=Q.current)||void 0===e||null===(n=e.getBoundingClientRect())||void 0===n?void 0:n.width;t&&Ce(t)}),100)):n&&Ce(n.width)}),[be,tn,Q,Ce,q,rn]);var on=(0,s.useMemo)((function(){var e=[];return Se.forEach((function(n,t){var i=He[n],r=(0,C.qn)(null===i||void 0===i?void 0:i.type,{blockColor:null===i||void 0===i?void 0:i.color,theme:J}).accent;e.push((0,w.jsxs)(Z.Z,{ml:2,children:[(0,w.jsxs)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:["df_",t+1]})," ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.jsx)(k.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)(O.ZP,{color:r,monospace:!0,small:!0,children:n})})]},n))})),e}),[f,He,J,Se]),ln=(0,s.useMemo)((function(){var e,n=[],t=null===Le||void 0===Le||null===(e=Le.code)||void 0===e?void 0:e.reduce((function(e,n){var t=n.uuid;return lt.Tv.includes(t)?e.concat(t):e}),[]);return null===t||void 0===t||t.forEach((function(e){var t=se[e];if(t){var i,r,o=null===(i=_i.SR[le])||void 0===i||null===(r=i[e])||void 0===r?void 0:r.call(i);n.push((0,w.jsxs)(Z.Z,{ml:2,children:[(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,small:!0,children:t})," ",o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,muted:!0,small:!0,children:"->"})," ",(0,w.jsx)(O.ZP,{default:!0,inline:!0,small:!0,children:o})]})]},t))}})),n}),[le,se,Le]),cn=(0,Oe.Z)(le),un=(0,Oe.Z)(Se);(0,s.useEffect)((function(){if((!cn&&le&&null!==Se&&void 0!==Se&&Se.length||(null===un||void 0===un||!un.length)&&(null===Se||void 0===Se?void 0:Se.length)>=1&&le)&&!he&&(0,Tn.Qr)(se)&&Fe){var e=Ei(Ei({},a),{},{upstream_blocks:Se});Fe.configuration&&$e(Fe.configuration(e)),Fe.content&&Xe(Fe.content(e))}}),[a,le,cn,se,he,Fe,$e,Xe,Se,un]);var an=(0,s.useMemo)((function(){return se[lt.v8]||1}),[se]),sn=(0,s.useMemo)((function(){return Object.entries(Le||{}).reduce((function(e,n){var t=(0,l.Z)(n,2),i=t[0],r=t[1];return Ei(Ei({},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,$.kC)(i()),monospace:r,onBlur:function(){return L(a)},onChange:function(e){return $e((0,o.Z)({},d,e.target.value),{autoRun:t})},onFocus:function(){return L(a)},value:(null===se||void 0===se?void 0:se[d])||""},p=(null!==X&&void 0!==X&&X.block?[X.block]:[]).reduce((function(e,n){var t=n.outputs;return t?e.concat(t.reduce((function(e,n){var t=n.sample_data;return null!==t&&void 0!==t&&t.columns?e.concat(t.columns):e}),[])):e}),[]);if(_i.VR.COLUMNS===s){var h=se[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(!u.maxValues||h.length<u.maxValues)&&(0,w.jsx)(U.Z,Ei(Ei({},f),{},{onChange:function(e){var n=se[d]||[],i=e.target.value;n.includes(i)?n=(0,_e.Od)(n,(function(e){return e===i})):n.push(i),$e((0,o.Z)({},d,n),{autoRun:t})},value:null,children:(0,_e.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)(wn.Z,{label:e,onClick:function(){$e((0,o.Z)({},d,(0,_e.Od)(h,(function(n){return n===e}))),{autoRun:t})}})},e)}))]})}else if(_i.VR.METRICS===s){var v=se[d]||[];n=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O.ZP,{bold:!0,children:"Metrics"}),(0,w.jsx)(O.ZP,{muted:!0,small:!0,children:"Select a column and an aggregation function."}),(0,w.jsxs)(Ci,{onChange:function(e,n){var i=n.resetValues,r=n.setValues;2===e.filter((function(e){return!!e})).length&&(v.find((function(n){var t=n.aggregation;return n.column===e[1]&&t===e[0]}))||($e((0,o.Z)({},d,v.concat({aggregation:e[0],column:e[1]})),{autoRun:t}),r([null,null]),i()))},children:[(0,w.jsx)(U.Z,Ei(Ei({},f),{},{label:"aggregation",children:(0,_e.YC)(lt.bn,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})),(0,w.jsx)(U.Z,Ei(Ei({},f),{},{label:"column",children:(0,_e.YC)(p,(function(e){return e})).map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))}))]}),v.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)(wn.Z,{label:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(O.ZP,{inline:!0,monospace:!0,children:[n,"("]}),i,(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:")"})]}),onClick:function(){$e((0,o.Z)({},d,(0,_e.Od)(v,(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)(U.Z,Ei(Ei({},f),{},{children:l.map((function(e){return(0,w.jsx)("option",{value:e,children:e},e)}))})):(0,w.jsx)(z.Z,Ei(Ei({},f),{},{type:s}));return(0,w.jsx)(Z.Z,{mb:1,children:n},d)}))))}),{noCode:[]})}),[a,se,Le,X,L,$e]),dn=sn.code,fn=sn.noCode,pn=(0,d.Db)(V.ZP.widgets.pipelines.useUpdate(null===I||void 0===I?void 0:I.uuid,a.uuid),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){ye(!1),g(),x()},onErrorCallback:function(e,n){return null===R||void 0===R?void 0:R({errors:n,response:e})}})}}),hn=(0,l.Z)(pn,1)[0],vn="ChartBlock/".concat(a.uuid),mn=(0,fe.y)(),bn=mn.registerOnKeyDown,gn=mn.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){gn(vn)}}),[gn,vn]),bn(vn,(function(e,n,t){je&&String(t[0])===String(ae.Uq)&&String(t[1])!==String(ae.zX)&&hn({widget:Ei(Ei({},a),{},{name:Be})})}),[a,je,Be,hn]),(0,w.jsx)(Pi.Z,{sm:12,md:12*an,children:(0,w.jsxs)(bi,{ref:n,children:[(0,w.jsx)(Z.Z,{mt:1,pt:1,px:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{flex:1,style:{position:"relative"},children:[(0,w.jsx)(Ne.Z,{bold:!1,fullWidth:!0,inputValue:Be,notRequired:!0,onBlur:function(){return setTimeout((function(){return ye(!1)}),300)},onChange:function(e){Re(e.target.value),e.preventDefault()},onClick:function(){B(!0),ye(!0)},onFocus:function(){B(!0),ye(!0)},small:!0,stacked:!0,value:!je&&a.uuid}),je&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(k.Z,{noWrapping:!0,onClick:function(){return hn({widget:Ei(Ei({},a),{},{name:Be})})},preventDefault:!0,sameColorAsText:!0,small:!0,children:"Update chart name"})]})]}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(U.Z,{compact:!0,onChange:function(e){var n=[e.target.value],t=Ei(Ei({},a),{},{upstream_blocks:n});Y(t),Je(t),Ee(n)},placeholder:"Source block",small:!0,value:(null===Se||void 0===Se?void 0:Se[0])||"",children:null===Ue||void 0===Ue?void 0:Ue.map((function(e){var n=e.uuid;return(0,w.jsx)("option",{value:n,children:n},n)}))}),(0,w.jsx)(Z.Z,{mr:1}),!ze&&(0,w.jsx)(Ze.Z,{appearBefore:!0,default:!0,label:"Run chart block",size:null,widthFitContent:!0,children:(0,w.jsx)(N.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return Je(a)},uuid:"ChartBlock/run/".concat(a.uuid),children:(0,w.jsx)(W.Py,{size:2*P.iI})})}),Te.uF.QUEUED===b&&(0,w.jsx)(H.Z,{color:(J||G.Z).content.active,small:!0,type:"cylon"}),Te.uF.BUSY===b&&(0,w.jsx)(H.Z,{color:(J||G.Z).content.active,small:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(Ze.Z,{appearBefore:!0,default:!0,label:"Edit chart",size:null,widthFitContent:!0,children:(0,w.jsx)(N.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return ge((function(e){return!e}))},selected:be,uuid:"ChartBlock/edit/".concat(a.uuid),children:(0,w.jsx)(W.I8,{size:2*P.iI})})}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(Ze.Z,{appearBefore:!0,default:!0,label:"Delete chart",size:null,widthFitContent:!0,children:(0,w.jsx)(N.ZP,{blackBorder:!0,compact:!0,inline:!0,onClick:function(){return h(a)},uuid:"ChartBlock/delete/".concat(a.uuid),children:(0,w.jsx)(W.rF,{size:2*P.iI})})})]})]})}),(0,w.jsx)(Z.Z,{mt:1}),(0,w.jsxs)(y.Z,{fullWidth:!0,justifyContent:"space-between",children:[(0,w.jsx)(j.Z,{flex:6,ref:Q,children:r&&!(0,Tn.Qr)(r)&&(0,w.jsx)(Z.Z,{pb:3,children:(0,w.jsx)(Zi,{block:Ei(Ei({},a),{},{configuration:Ei(Ei({},a.configuration),se)}),data:r,width:Pe})})}),be&&(0,w.jsx)(gi,{children:(0,w.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(U.Z,{onChange:function(e){var n=e.target.value,t=Ei(Ei({},a),{},{configuration:Ei(Ei({},se),{},{chart_type:n})});Y(t),Je(t),ce(n)},placeholder:"Select chart type",value:le,children:lt.CK.map((function(e){return(0,w.jsx)("option",{value:e,children:(0,$.kC)(e)},e)}))})}),(0,w.jsx)(Z.Z,{mb:1,children:(0,w.jsx)(U.Z,{onChange:function(e){return $e((0,o.Z)({},lt.v8,e.target.value))},placeholder:"Chart width",value:(null===se||void 0===se?void 0:se[lt.v8])||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)}))})}),fn]})})]}),be&&!(null===dn||void 0===dn||!dn.length)&&v.t6.SQL!==a.language&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{my:1,px:1,children:[(0,w.jsx)(O.ZP,{bold:!0,children:"Custom chart code"}),(0,w.jsxs)(O.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)(xi,{children:[Se.length>=1&&(0,w.jsxs)(ji,{children:[(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables you can use in your code: ",on]}),(0,w.jsxs)(O.ZP,{muted:!0,small:!0,children:["Variables that you must define: ",ln]})]}),en]})]}),nn&&(0,w.jsx)(Z.Z,{px:1,children:nn})]})})}var Ti=s.forwardRef(Ii),Di=t(97361),Mi=["blockRefs","blocks","chartRefs","deleteWidget","messages","onChangeChartBlock","runBlock","runningBlocks","savePipelineContent","selectedBlock","setAnyInputFocused","setErrors","setSelectedBlock","setTextareaFocused","textareaFocused","updateWidget","widgets","width"];function Ai(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 Bi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ai(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ai(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Ri=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.setErrors,v=e.setSelectedBlock,m=e.setTextareaFocused,b=e.textareaFocused,g=e.updateWidget,x=e.widgets,j=e.width,k=(0,Cn.Z)(e,Mi),Z=(0,s.useMemo)((function(){return a.reduce((function(e,n,t){return Bi(Bi({},e),{},(0,o.Z)({},n.uuid,Bi(Bi({},n),{},{priority:t})))}),{})}),[a]);return(0,w.jsxs)(y.Z,{flexDirection:"column",fullWidth:!0,children:[(0,w.jsx)(Di.Z,{fullHeight:!0,style:{marginLeft:.5*P.iI,marginRight:.5*P.iI},children:null===x||void 0===x?void 0:x.map((function(e){var o=e.uuid,x=Z[o],y=x?0===x.priority?Te.uF.BUSY:Te.uF.QUEUED:Te.uF.IDLE;return i.current[o]=(0,s.createRef)(),(0,s.createElement)(Ti,Bi(Bi({},k),{},{block:e,blockRefs:n,blocks:t,chartRefs:i,deleteWidget:r,executionState:y,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,setErrors:h,setSelectedBlock:v,setTextareaFocused:m,textareaFocused:b,updateWidget:g,width:j}))}))}),(0,w.jsx)("div",{style:{height:"80vh"}})]})},Ni=t(48952),Li=m.default.svg.withConfig({displayName:"EmptyCharts__SVGStyle",componentId:"sc-ttsjrp-0"})([""]),Fi=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)(Li,{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"})]})};var Ui,Hi=function(e){var n=e.blocksInNotebook;return e.extensionOption,(0,s.useMemo)((function(){return(null===n||void 0===n?void 0:n.filter((function(e){var n=e.type;return v.tf.DBT===n})))||[]}),[n]),(0,w.jsx)(w.Fragment,{})};!function(e){e.DBT="dbt",e.GREAT_EXPECTATIONS="great_expectations"}(Ui||(Ui={}));var zi=t(66653);function Vi(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 Wi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Vi(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Gi=function(e){var n,t,i=e.block,r=e.blockActionDescription,o=e.blocks,l=e.inputPlaceholder,c=e.loading,u=e.onClickTag,a=e.runBlockAndTrack,d=e.supportedUpstreamBlockLanguages,f=e.supportedUpstreamBlockTypes,p=e.updateBlock,h=(0,s.useContext)(m.ThemeContext),v=(0,s.useState)(""),k=v[0],_=v[1],S=(0,s.useState)(!1),E=S[0],I=S[1],D=(0,s.useState)(null),M=D[0],A=D[1],B=(0,s.useMemo)((function(){return(0,_e.HK)(o,(function(e){return e.uuid}))}),[o]);(0,s.useEffect)((function(){M||A((0,_e.HK)((null===i||void 0===i?void 0:i.upstream_blocks)||[],(function(e){return e})))}),[i,M]);var R=(0,s.useMemo)((function(){return(null===o||void 0===o?void 0:o.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===k||void 0===k?void 0:k.toLowerCase()))||(null===i||void 0===i?void 0:i.toLowerCase().includes(null===k||void 0===k?void 0:k.toLowerCase())))&&(null===f||void 0===f?void 0:f.includes(t))})))||[]}),[k,o,f]),N=(0,s.useMemo)((function(){var e=[];return null===R||void 0===R||R.forEach((function(n,t){var i=n.color,r=n.language,o=n.type,l=n.uuid,c=(0,C.qn)(o,{blockColor:i,theme:h}).accent;t>=1&&e.push((0,w.jsx)(x.Z,{light:!0},"divider-".concat(l)));var u=!(null===M||void 0===M||!M[l]),a=null!==d&&"undefined"!==typeof d&&!(null!==d&&void 0!==d&&d.includes(r));e.push((0,w.jsx)(Z.Z,{px:2,py:1,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(g.Z,{color:c,size:1.5*P.iI,square:!0}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(O.ZP,{monospace:!0,muted:a,small:!0,children:l})]}),a&&(0,w.jsxs)(O.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(){A((function(e){var n=Wi({},e);return u?delete n[l]:n[l]=l,n}))}})]})},"option-".concat(l)))})),e}),[R,h,M]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(ce.Z,{onClickOutside:function(){return I(!1)},open:!0,children:[(0,w.jsx)(z.Z,{beforeIcon:(0,w.jsx)(W.HN,{}),borderless:!0,compact:!0,onChange:function(e){return _(e.target.value)},onClick:function(e){(0,zi.j)(e),I(!0)},onFocus:function(e){(0,zi.j)(e),I(!0)},placeholder:l,small:!0,value:k}),E&&(0,w.jsxs)(w.Fragment,{children:[N,(0,w.jsx)(Z.Z,{mx:1,children:(0,w.jsx)(y.Z,{justifyContent:"flex-end",children:(0,w.jsx)(T.Z,{compact:!0,loading:c,onClick:function(){return p({block:i,upstream_blocks:Object.keys(M)}).then((function(){return I(!1)}))},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)(Z.Z,{pb:1,pr:1,children:[r&&(0,w.jsx)(Z.Z,{mt:1,pl:1,children:(0,w.jsx)(O.ZP,{muted:!0,small:!0,children:r})}),(0,w.jsx)(y.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===B||void 0===B?void 0:B[e];if(!n)return(0,w.jsx)("div",{},e);var t=n.color,r=n.type,o=(0,C.qn)(r,{blockColor:t,theme:h}).accentLight;return(0,w.jsx)(Z.Z,{ml:1,mt:1,children:(0,w.jsx)(T.Z,{backgroundColor:o,compact:!0,disabled:!a,onClick:function(e){(0,zi.j)(e),u?u(n):null===a||void 0===a||a({block:Wi(Wi({},i),{},{upstream_blocks:[null===n||void 0===n?void 0:n.uuid]})})},small:!0,children:(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:e})})},e)}))})]})]})},Ki=t(19140);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 qi(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 Qi=function(e){var n=e.addNewBlockAtIndex,t=e.autocompleteItems,i=e.blockRefs,r=e.blocks,c=e.blocksInNotebook,u=e.deleteBlock,a=e.extensionOption,f=e.fetchFileTree,p=e.fetchPipeline,h=e.interruptKernel,m=e.messages,b=e.onChangeCallbackBlock,g=e.onChangeCodeBlock,x=e.pipeline,j=e.runBlock,y=e.runningBlocks,C=e.savePipelineContent,_=e.selectedBlock,S=e.setAnyInputFocused,E=e.setErrors,I=e.setSelectedBlock,T=e.setTextareaFocused,D=e.showBrowseTemplates,M=e.textareaFocused,A=(0,s.useRef)(null),B=(0,s.useState)(!1),L=B[0],F=B[1],U=(a||{}).uuid,H=(x||{}).extensions,z=(0,s.useMemo)((function(){return(null===a||void 0===a?void 0:a.templates)||[]}),[a]),G=(0,s.useMemo)((function(){return null===H||void 0===H?void 0:H[U]}),[U,H]),K=(0,s.useMemo)((function(){return(null===G||void 0===G?void 0:G.blocks)||[]}),[G]),Y=(0,s.useMemo)((function(){return(0,_e.HK)(K,(function(e){return e.uuid}))}),[K]),q=(0,s.useMemo)((function(){return U===(null===_||void 0===_?void 0:_.extension_uuid)&&Y[null===_||void 0===_?void 0:_.uuid]}),[Y,U,_]),Q=(0,s.useMemo)((function(){return y.reduce((function(e,n,t){return qi(qi({},e),{},(0,o.Z)({},n.uuid,qi(qi({},n),{},{priority:t})))}),{})}),[y]),J=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return V.ZP.blocks.pipelines.useUpdate(null===x||void 0===x?void 0:x.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{extension_uuid:null===n||void 0===n?void 0:n.extension_uuid}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){p()},onErrorCallback:function(e,n){return null===E||void 0===E?void 0:E({errors:n,response:e})}})}}),X=(0,l.Z)(J,2),$=X[0],ne=X[1].isLoading,te=(0,s.useMemo)((function(){return K.map((function(e,n){var o=qi(qi({},e),{},{extension_uuid:U}),l=o.type,a=o.uuid,d=(null===_||void 0===_?void 0:_.uuid)===a,k=Q[a],O=k?0===k.priority?Te.uF.BUSY:Te.uF.QUEUED:Te.uF.IDLE,D="".concat(l,"s/").concat(a,".py");return i.current[D]=(0,s.createRef)(),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(R.Z,{allBlocks:r,autocompleteItems:t,block:o,blockIdx:n,blockRefs:i,blocks:r,defaultValue:o.content,deleteBlock:function(e){u(qi(qi({},e),{},{extension_uuid:U})),S(!1)},executionState:O,extraContent:(0,w.jsx)(Gi,{block:o,blockActionDescription:"Click a block name to run expectations on it.",blocks:c,inputPlaceholder:"Select blocks to run expectations on",loading:ne,supportedUpstreamBlockLanguages:[v.t6.PYTHON],supportedUpstreamBlockTypes:[v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.TRANSFORMER],updateBlock:$}),fetchFileTree:f,fetchPipeline:p,hideRunButton:!0,interruptKernel:h,messages:m[a],noDivider:!0,onCallbackChange:function(e){return b(l,a,e)},onChange:function(e){return g(l,a,e)},pipeline:x,ref:i.current[D],runBlock:j,runningBlocks:y,savePipelineContent:C,selected:d,setAnyInputFocused:S,setErrors:E,setSelected:function(e){return I(!0===e?o:null)},setTextareaFocused:T,textareaFocused:d&&M})},a)}))}),[t,i,r,c,u,K,U,f,p,h,ne,m,b,g,x,j,y,Q,C,_,S,E,I,T,M,$]),ie="Extensions/GreatExpectations/index",re=(0,fe.y)(),oe=re.disableGlobalKeyboardShortcuts,le=re.registerOnKeyDown,ue=re.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){ue(ie)}}),[ue,ie]),le(ie,(function(e,n){!oe&&q&&((0,ut.y)([ae.zX,ae.Um],n)||(0,ut.y)([ae.PQ,ae.Um],n))&&(e.preventDefault(),C())}),[q,C]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(O.ZP,{default:!0,children:"Add an extension block to start writing expectations for blocks in the current pipeline."}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.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)(k.Z,{href:"https://docs.mage.ai/development/testing/great-expectations",openNewWindow:!0,children:"Great Expectation power up"}),"."]})}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["For all available expectations, read Great Expectation\u2019s ",(0,w.jsx)(k.Z,{href:"https://greatexpectations.io/expectations/",openNewWindow:!0,children:"documentation"}),"."]})})]}),te,(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(ce.Z,{onClickOutside:function(){return F(!1)},open:!0,children:(0,w.jsx)(zn.Z,{disableKeyboardShortcuts:!0,items:null===z||void 0===z?void 0:z.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:U,type:v.tf.EXTENSION},(null===K||void 0===K?void 0:K.length)||0)},tooltip:function(){return t},uuid:e.uuid}})).concat((0,ct.hr)((function(e){return n(qi(qi({},e),{},{extension_uuid:U,type:v.tf.EXTENSION}),(null===K||void 0===K?void 0:K.length)||0)}),v.tf.EXTENSION,null,{onlyCustomTemplate:!0,showBrowseTemplates:D})),onClickCallback:function(){return F(!1)},open:L,parentRef:A,uuid:"Extension",children:(0,w.jsx)(N.ZP,{beforeElement:(0,w.jsx)(Ki.Wx,{teal:!0,children:(0,w.jsx)(W.mm,{size:Ki.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),F(!0)},uuid:"AddNewBlocks/Extension",children:"Extension block"})})})})]})},Ji=t(59e3),Xi=["pipeline"];function $i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function er(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?$i(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var nr=function(e){var n=e.pipeline,t=(0,Cn.Z)(e,Xi),i=(0,f.useRouter)(),r=V.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,_e.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 er(er({},t),{},{pipeline:n})}),[n,t]);(0,s.useEffect)((function(){var e;a(null===(e=(0,Ji.iV)())||void 0===e?void 0:e.extension)}),[i.asPath]);var h=(0,s.useMemo)((function(){return n?(Ui.GREAT_EXPECTATIONS===u?e=Qi:Ui.DBT===u&&(e=Hi),e?(0,w.jsx)(e,er(er({},p),{},{extensionOption:d})):void 0):null;var e}),[d,n,u,p]);return(0,w.jsx)(M.W,{backend:A.PD,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[!u&&(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["Power up your pipeline with extensions. Learn more about ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/design/blocks/extension",openNewWindow:!0,children:"extension blocks"}),"."]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Click on a power up below to add and configure it for the ",(0,w.jsx)(O.ZP,{inline:!0,monospace:!0,children:null===n||void 0===n?void 0:n.uuid})," pipeline."]})})]}),!r&&!u&&(0,w.jsx)(H.Z,{}),h,!u&&(null===o||void 0===o?void 0:o.map((function(e,n){var t=e.description,i=e.name,r=e.uuid;return(0,w.jsx)(Z.Z,{mt:n>=1?P.cd:0,children:(0,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,Se.u7)({extension:r},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(_n.Z,{dark:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Vn.Z,{fullWidth:!1,children:(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)("img",{alt:i,height:3*P.iI,src:"/images/extensions/".concat(r,"/logo.png"),width:3*P.iI})})})}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsxs)(j.Z,{flexDirection:"column",children:[(0,w.jsx)(O.ZP,{bold:!0,children:i}),(0,w.jsx)(O.ZP,{default:!0,small:!0,children:t})]})]}),(0,w.jsx)(W._Q,{})]})})})},r)})))]})})},tr=t(23351),ir=t(21764),rr=t(22673),or=t(52769),lr=t(9468),cr=(P.iI,lr.O$,P.iI,Gt.dN,m.default.div.withConfig({displayName:"indexstyle__SidekickContainerStyle",componentId:"sc-cr39lf-0"})(["height:calc(100vh - ","px - ","px);width:fit-content;",""],vt.Wi,Le.nn,(function(e){return e.fullWidth&&"\n width: 100%;\n "})),m.default.div.withConfig({displayName:"indexstyle__PaddingContainerStyle",componentId:"sc-cr39lf-1"})(["padding:","px;",""],2*P.iI,(function(e){return e.noPadding&&"\n padding: 0;\n "})),m.default.table.withConfig({displayName:"indexstyle__TableStyle",componentId:"sc-cr39lf-2"})(["",""],(function(e){return e.width&&"\n width: ".concat(e.width,"px;\n ")}))),ur=m.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*P.iI,"px;\n ")})),ar=t(19963);var sr=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),v=h[0],m=h[1],b=(0,s.useState)(a),g=b[0],x=b[1],y=(0,s.useState)(f),k=y[0],Z=y[1],C=(0,s.useState)(!1),_=C[0],S=C[1],E=(0,d.Db)(V.ZP.variables.pipelines.useUpdate(c,a),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){S(!1),i()}})}}),I=(0,l.Z)(E,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:g,value:n}})}else"Escape"===e.key&&S(!1)}),[g,k]);(0,s.useEffect)((function(){var e;_&&(null===p||void 0===p||null===(e=p.current)||void 0===e||e.focus())}),[_,p]);var D=n||"kwargs['".concat(a,"']");return(0,w.jsx)("div",{onMouseEnter:function(){return m(!0)},onMouseLeave:function(){return m(!1)},children:(0,w.jsxs)(Di.Z,{children:[(0,w.jsx)(Pi.Z,{md:1,hiddenSmDown:!0,children:(0,w.jsx)(ur,{noPadding:!0,children:(0,w.jsx)(N.ZP,{backgroundColor:ar.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(D),ir.Am.success("Successfully copied to clipboard.",{position:ir.Am.POSITION.BOTTOM_RIGHT,toastId:a})},small:!0,uuid:"Sidekick/GlobalVariables/".concat(a),withIcon:!0,children:(0,w.jsx)(W.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(Pi.Z,{md:4,children:_?(0,w.jsx)(ur,{children:(0,w.jsx)(z.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:g})}):(0,w.jsx)(ur,{children:(0,w.jsx)(O.ZP,{color:Wt.Or,monospace:!0,small:!0,textOverflow:!0,children:a})})}),(0,w.jsx)(Pi.Z,{md:7,children:_?(0,w.jsx)(ur,{children:(0,w.jsx)(z.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)(ur,{children:[o?(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:"********"}):(0,w.jsx)(O.ZP,{monospace:!0,small:!0,children:f}),(0,w.jsxs)(j.Z,{children:[!r&&v&&(0,w.jsx)(N.ZP,{backgroundColor:ar.qJ,borderless:!0,inline:!0,muted:!0,onClick:function(){S(!0)},small:!0,uuid:"Sidekick/GlobalVariables/edit_".concat(a),withIcon:!0,children:(0,w.jsx)(W.I8,{size:2.5*P.iI})}),t&&v&&(0,w.jsx)(N.ZP,{backgroundColor:ar.qJ,borderless:!0,inline:!0,muted:!0,onClick:t,small:!0,uuid:"Sidekick/GlobalVariables/delete_".concat(a),withIcon:!0,children:(0,w.jsx)(W.rF,{size:2.5*P.iI})})]})]})})]})})},dr=t(93348),fr=t(58122);var pr=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],b=(0,s.useState)(),g=b[0],x=b[1],j=null===t||void 0===t?void 0:t.uuid,C=(0,d.Db)(V.ZP.variables.pipelines.useCreate(j),{onSuccess:function(e){return(0,ee.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}))}})}}),_=(0,l.Z)(C,1)[0],S=(0,d.Db)((function(e){return V.ZP.variables.pipelines.useDelete(j,e)()}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),E=(0,l.Z)(S,1)[0],I=(0,s.useCallback)((function(e){if("Enter"===e.key){var t=g;try{t=JSON.parse(g)}catch(i){}_({variable:{name:h,value:t}}).then((function(){n(),m(null),x(null)})),f(!1)}else"Escape"===e.key&&f(!1)}),[_,n,h,g]),T=(0,s.useMemo)((function(){return c-4*P.iI}),[c]),D=(0,s.useMemo)((function(){return(0,fr.wx)(o,(function(e){return e.uuid===or.C}))}),[o]),M=(0,s.useMemo)((function(){return(0,fr.wx)(o,(function(e){return e.uuid===(null===i||void 0===i?void 0:i.uuid)}))}),[i,o]),A=(0,s.useMemo)((function(){return(0,w.jsxs)(cr,{width:T,children:[a&&(0,w.jsxs)(Di.Z,{children:[(0,w.jsx)(Pi.Z,{md:1,children:(0,w.jsx)(ur,{noPadding:!0,children:(0,w.jsx)(N.ZP,{backgroundColor:ar.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText(h),ir.Am.success("Successfully copied to clipboard.",{position:ir.Am.POSITION.BOTTOM_RIGHT,toastId:h})},uuid:"Sidekick/GlobalVariables/".concat(h),withIcon:!0,children:(0,w.jsx)(W.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(Pi.Z,{md:4,children:(0,w.jsx)(ur,{children:(0,w.jsx)(z.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)(Pi.Z,{md:7,children:(0,w.jsx)(ur,{children:(0,w.jsx)(z.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:g})})})]}),null===D||void 0===D?void 0:D.map((function(e){return(0,w.jsx)(sr,{deleteVariable:function(){return E(e.uuid)},fetchVariables:n,pipelineUUID:j,variable:e},e.uuid)}))]})}),[E,D,h,g,j,m,x,f,a,T]),B=(0,s.useMemo)((function(){return(0,w.jsx)(cr,{width:T,children:null===M||void 0===M?void 0:M.map((function(e){return(0,w.jsx)(sr,{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}))})}),[M,i,T]);return(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(mn.Z,{level:4,monospace:!0,children:"Global Variables"}),(0,w.jsx)(Z.Z,{ml:2}),(0,w.jsx)(N.ZP,{Icon:W.mm,blackBorder:!0,inline:!0,onClick:function(){return f((function(e){return!e}))},uuid:"Sidekick/GlobalVariables/addNewVariable",children:"New"})]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:A}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.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)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For Python (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/production/configuring-production-settings/runtime-variable",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(rr.Z,{language:"python",small:!0,source:"\n var = kwargs['variable_name']\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For SQL (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/guides/sql-blocks#variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(rr.Z,{language:"sql",small:!0,source:"\n {{ variable_name }}\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{bold:!0,large:!0,children:["For R (",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/guides/r-blocks#runtime-variables",large:!0,openNewWindow:!0,primary:!0,children:"docs"}),"):"]}),(0,w.jsx)(rr.Z,{language:"r",small:!0,source:"\n var <- global_vars['variable_name']\n"})]}),(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(mn.Z,{level:4,monospace:!0,children:"Trigger Runtime Variables"}),(0,w.jsx)(Z.Z,{mb:P.cd}),(0,w.jsx)(O.ZP,{children:"Depending on what kind of trigger you use for this pipeline, some default runtime variables will be provided."})]}),Object.values(dr.Xm).map((function(e,n){var t;return(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{large:!0,monospace:!0,children:(0,$.vg)(null===(t=dr.Z4[e])||void 0===t?void 0:t.call(dr.Z4))})}),(0,fr.JZ)([],e).map((function(n,t){return(0,w.jsx)(sr,{hideEdit:!0,pipelineUUID:j,variable:n},"var_".concat(e,"_").concat(t))}))]},"".concat(e,"_").concat(n))})),M&&M.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{my:2,children:(0,w.jsx)(mn.Z,{level:4,monospace:!0,children:"Block Output Variables"})}),(0,w.jsx)(Z.Z,{mb:2,children:B}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{children:["Output variables can be used in any ",(0,w.jsx)(O.ZP,{bold:!0,inline:!0,monospace:!0,warning:!0,children:v.tf.SCRATCHPAD})," block. They are for scratchpad blocks, specifically. To get upstream block outputs inside of other blocks, use the positional arguments."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{children:"To load the variable in a scratchpad block, use the following syntax:"})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(rr.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"})})]})]})},hr=t(89565),vr=t.n(hr),mr=t(22782),br=m.default.div.withConfig({displayName:"indexstyle__OutputContainerStyle",componentId:"sc-wkjnrg-0"})([""," overflow-y:scroll;"," ",""],Le.w5,(function(e){return e.height&&"\n height: ".concat(e.height,"px;\n ")}),(function(e){return!e.height&&"\n max-height: ".concat(e.maxHeight||300,"px;\n ")}));function gr(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 xr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?gr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var jr=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,Pe.t8)(Pe.Q9,e)}),[o,c]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(W.JM,{inverted:!0,size:2*P.iI}),compact:r,disabled:r,loading:r,onClick:i,success:!0,children:(0,w.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Execute pipeline"})}),(0,w.jsx)(Z.Z,{ml:1}),r&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(T.Z,{beforeIcon:(0,w.jsx)(W.x8,{inverted:!0,size:2*P.iI}),onClick:n,success:!0,children:(0,w.jsx)(O.ZP,{bold:!0,inverted:!0,primary:!1,children:"Cancel pipeline"})}),(0,w.jsx)(Z.Z,{ml:1})]}),(0,w.jsx)(T.Z,{onClick:t,secondary:!0,children:"Running status"})]}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Z.Z,{ml:1}),(0,w.jsx)(O.ZP,{children:"Hide"}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(En.Z,{checked:o,onCheck:d})]})]}),!o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z.Z,{mb:1}),(0,w.jsx)(br,{noScrollbarTrackBackground:!0,children:(0,w.jsx)(mr.Nk,{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 Te.jU.includes(i)?r=(0,w.jsx)(mr.T5,xr(xr({},l),{},{children:(0,w.jsx)(O.ZP,{monospace:!0,preWrap:!0,children:(0,w.jsx)(vr(),{children:e})})})):i===Te.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 yr=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],v=(0,s.useState)(),m=v[0],b=v[1],g=(0,s.useMemo)((function(){return o-P.cd*P.iI*2}),[o]),x=(0,d.Db)(V.ZP.secrets.useCreate(),{onSuccess:function(e){return(0,ee.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],k=(0,d.Db)((function(e){return V.ZP.secrets.useDelete(e)()}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){n()},onErrorCallback:function(e){var n=e.error,t=(n.errors,n.message);r((function(e){return e.concat(t)}))}})}}),C=(0,l.Z)(k,1)[0],_=(0,s.useCallback)((function(e){"Enter"===e.key?(j({secret:{name:p,value:m}}).then((function(){n(),h(null),b(null)})),a(!1)):"Escape"===e.key&&a(!1)}),[j,n,p,m]);return(0,w.jsxs)(Z.Z,{p:P.cd,children:[(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(y.Z,{alignItems:"center",children:[(0,w.jsx)(mn.Z,{level:4,monospace:!0,children:"Secrets"}),(0,w.jsx)(Z.Z,{ml:2}),(0,w.jsx)(N.ZP,{Icon:W.mm,blackBorder:!0,inline:!0,onClick:function(){return a((function(e){return!e}))},uuid:"Sidekick/Secrets/addNewSecret",children:"New"})]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{children:[(0,w.jsx)(O.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)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(O.ZP,{muted:!0,children:["Press ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Enter"})," or ",(0,w.jsx)(O.ZP,{bold:!0,default:!0,inline:!0,monospace:!0,children:"Return"})," to save changes."]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsxs)(cr,{width:g,children:[u&&(0,w.jsxs)(Di.Z,{children:[(0,w.jsx)(Pi.Z,{md:1,children:(0,w.jsx)(ur,{noPadding:!0,children:(0,w.jsx)(N.ZP,{backgroundColor:ar.qJ,borderless:!0,centerText:!0,muted:!0,onClick:function(){navigator.clipboard.writeText("{{ mage_secret_var(".concat(p,") }}")),ir.Am.success("Successfully copied to clipboard.",{position:ir.Am.POSITION.BOTTOM_RIGHT,toastId:p})},uuid:"Sidekick/Secrets/".concat(p),withIcon:!0,children:(0,w.jsx)(W.CK,{size:2.5*P.iI})})})}),(0,w.jsx)(Pi.Z,{md:4,children:(0,w.jsx)(ur,{children:(0,w.jsx)(z.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){h(e.target.value),e.preventDefault()},onKeyDown:_,paddingHorizontal:0,placeholder:"secret name",small:!0,value:p})})}),(0,w.jsx)(Pi.Z,{md:7,children:(0,w.jsx)(ur,{children:(0,w.jsx)(z.Z,{borderless:!0,compact:!0,fullWidth:!0,monospace:!0,onChange:function(e){b(e.target.value),e.preventDefault()},onKeyDown:_,paddingHorizontal:0,placeholder:"secret value",small:!0,value:m})})})]}),null===i||void 0===i?void 0:i.map((function(e){return(0,w.jsx)(sr,{copyText:e.name,deleteVariable:function(){return C(e.name)},fetchVariables:n,hideEdit:!0,obfuscate:!0,pipelineUUID:t,variable:{uuid:e.name,value:e.value}},e.name)}))]})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.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)(Z.Z,{mb:P.cd,children:(0,w.jsx)(rr.Z,{language:"yaml",small:!0,source:"\n \"{{ mage_secret_var('<secret_name>') }}\"\n ",maxWidth:g})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(O.ZP,{children:"To reference a secret in code, you can import the `get_secret_value` helper method:"})}),(0,w.jsx)(Z.Z,{mb:P.cd,children:(0,w.jsx)(rr.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:g})})]})},kr=t(33699),Zr=t(72454),Or=t(64155),Pr=t(91835);function Cr(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 wr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Cr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Cr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var _r=function(e){var n=e.addNewBlockAtIndex,t=e.addOnBlocks,i=e.addOnBlockType,r=e.autocompleteItems,c=e.blockRefs,u=e.blocks,a=e.blocksInNotebook,f=e.deleteBlock,p=e.displayBlockName,h=e.fetchFileTree,m=e.fetchPipeline,b=e.interruptKernel,g=e.messages,x=(e.onChangeCallbackBlock,e.onChangeCodeBlock),j=e.onSelectBlockFile,y=e.pipeline,C=e.runBlock,_=e.runningBlocks,S=e.savePipelineContent,E=e.selectedBlock,I=e.setAnyInputFocused,T=e.setErrors,D=e.setHiddenBlocks,M=e.setSelectedBlock,A=e.setTextareaFocused,B=e.showBrowseTemplates,L=e.textareaFocused,F=(0,s.useRef)(null),U=(0,s.useState)(!1),H=U[0],z=U[1],G=(0,Ji.iV)().block_uuid;(0,s.useEffect)((function(){var e=u.find((function(e){var n,t=e.uuid;return(null===G||void 0===G||null===(n=G.split(":"))||void 0===n?void 0:n[0])===t}));e&&(E&&(null===e||void 0===e?void 0:e.uuid)===(null===E||void 0===E?void 0:E.uuid)||(D((function(n){return wr(wr({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)))}),[G,u,j,E,D]);var K=(y||{}).type,Y=(0,s.useMemo)((function(){return(0,_e.HK)(t||[],(function(e){return e.uuid}))}),[t]),q=V.ZP.block_templates.list({},{revalidateOnFocus:!1}).data,Q=(0,s.useMemo)((function(){return(null===q||void 0===q?void 0:q.block_templates)||[]}),[q]),J=(0,s.useCallback)((function(e){return n(e,(null===Y||void 0===Y?void 0:Y.length)||0)}),[n,Y]),X=(0,s.useMemo)((function(){return(0,ct.oM)(Q,J)}),[J,Q]),ne=(0,s.useMemo)((function(){return(0,ct.hr)(J,i,K,{blockTemplatesByBlockType:X,languages:[v.t6.PYTHON],showBrowseTemplates:B})}),[J,i,X,K]),te=(0,s.useMemo)((function(){return null===Y||void 0===Y?void 0:Y[null===E||void 0===E?void 0:E.uuid]}),[Y,E]),ie=(0,s.useMemo)((function(){return _.reduce((function(e,n,t){return wr(wr({},e),{},(0,o.Z)({},n.uuid,wr(wr({},n),{},{priority:t})))}),{})}),[_]),re=(0,d.Db)((function(e){var n=e.block,t=e.upstream_blocks;return V.ZP.blocks.pipelines.useUpdate(null===y||void 0===y?void 0:y.uuid,encodeURIComponent(null===n||void 0===n?void 0:n.uuid),{query:{block_type:null===n||void 0===n?void 0:n.type}})({block:{upstream_blocks:t}})}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){m()},onErrorCallback:function(e,n){return null===T||void 0===T?void 0:T({errors:n,response:e})}})}}),oe=(0,l.Z)(re,2),le=oe[0],ue=oe[1].isLoading,se=(0,s.useMemo)((function(){return null===t||void 0===t?void 0:t.map((function(e,n){var t=e.type,i=e.uuid,l=(null===E||void 0===E?void 0:E.uuid)===i,d=ie[i],k=d?0===d.priority?Te.uF.BUSY:Te.uF.QUEUED:Te.uF.IDLE,O="".concat(t,"s/").concat(i,".py");return c.current[O]=(0,s.createRef)(),(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(R.Z,{allBlocks:u,autocompleteItems:r,block:e,blockIdx:n,blockRefs:c,blocks:u,defaultValue:e.content,deleteBlock:function(e){f(wr({},e)),I(!1)},executionState:k,extraContent:(0,w.jsx)(Gi,{block:e,blocks:a,inputPlaceholder:"Select blocks to add ".concat((0,$._6)(p,null)," to"),loading:ue,onClickTag:function(e){D((function(n){return wr(wr({},n),{},(0,o.Z)({},e.uuid,!1))})),j(e.uuid,e.type,null)},supportedUpstreamBlockTypes:[v.tf.CUSTOM,v.tf.DATA_EXPORTER,v.tf.DATA_LOADER,v.tf.DBT,v.tf.SCRATCHPAD,v.tf.SENSOR,v.tf.TRANSFORMER],updateBlock:le}),fetchFileTree:h,fetchPipeline:m,hideRunButton:!0,interruptKernel:b,messages:g[i],noDivider:!0,onChange:function(e){return x(t,i,e)},pipeline:y,ref:c.current[O],runBlock:C,runningBlocks:_,savePipelineContent:S,selected:l,setAnyInputFocused:I,setErrors:T,setSelected:function(n){return M(!0===n?e:null)},setTextareaFocused:A,textareaFocused:l&&L})},i)}))}),[t,r,c,u,a,f,p,h,m,b,ue,g,x,j,y,C,_,ie,S,E,I,T,D,M,A,L,le]),de="".concat(p,"/index"),pe=(0,fe.y)(),he=pe.disableGlobalKeyboardShortcuts,ve=pe.registerOnKeyDown,me=pe.unregisterOnKeyDown;return(0,s.useEffect)((function(){return function(){me(de)}}),[me,de]),ve(de,(function(e,n){!he&&te&&((0,ut.y)([ae.zX,ae.Um],n)||(0,ut.y)([ae.PQ,ae.Um],n))&&(e.preventDefault(),S())}),[te,S]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Z.Z,{mb:P.cd,children:[(0,w.jsxs)(O.ZP,{default:!0,children:["Run 1 or more ",(0,$.wX)(p)," block functions whenever another block succeeds or fails."]}),(0,w.jsx)(Z.Z,{mt:1,children:(0,w.jsxs)(O.ZP,{default:!0,children:["Learn more about ",(0,w.jsx)(k.Z,{href:"https://docs.mage.ai/development/blocks/".concat((0,$.wX)((0,$._6)(p,null)),"/overview"),openNewWindow:!0,children:(0,$.wX)((0,$._6)(p,null))}),"."]})})]}),se,(0,w.jsx)(Z.Z,{mt:P.cd,children:(0,w.jsx)(ce.Z,{onClickOutside:function(){return z(!1)},open:!0,children:(0,w.jsx)(zn.Z,{disableKeyboardShortcuts:!0,items:ne,onClickCallback:function(){return z(!1)},open:H,parentRef:F,uuid:p,children:(0,w.jsxs)(N.ZP,{beforeElement:(0,w.jsx)(Ki.Wx,{rose:i===v.tf.CALLBACK,children:(0,w.jsx)(W.mm,{size:Ki.ZG})}),inline:!0,onClick:function(e){e.preventDefault(),z(!0)},uuid:"AddNewBlocks/".concat(p),children:[(0,$.kC)(p)," block"]})})})})]})},Sr=t(45419);function Er(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 Ir(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Er(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Er(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Tr=[{Icon:W.AQ,name:"Callbacks",uuid:Sr.Q.CALLBACK},{Icon:W.hW,name:"Conditionals",uuid:Sr.Q.CONDITIONAL}];var Dr=function(e){var n=(0,Pr.Z)({},e),t=(0,f.useRouter)(),i=(0,s.useState)(null),r=i[0],o=i[1];(0,s.useEffect)((function(){var e;o(null===(e=(0,Ji.iV)())||void 0===e?void 0:e.addon)}),[t.asPath]);var l=(0,s.useMemo)((function(){var e,t;if(Sr.Q.CALLBACK===r)e={addOnBlockType:v.tf.CALLBACK,addOnBlocks:null===(t=n.pipeline)||void 0===t?void 0:t.callbacks,displayBlockName:"callback"};else if(Sr.Q.CONDITIONAL===r){var i;e={addOnBlockType:v.tf.CONDITIONAL,addOnBlocks:null===(i=n.pipeline)||void 0===i?void 0:i.conditionals,displayBlockName:"conditional"}}if(e)return(0,w.jsx)(_r,Ir(Ir({},e),n))}),[n,r]);return(0,w.jsx)(M.W,{backend:A.PD,children:(0,w.jsxs)(Z.Z,{p:P.cd,children:[l,!r&&(null===Tr||void 0===Tr?void 0:Tr.map((function(e,n){var t=e.name,i=e.uuid,r=e.Icon;return(0,w.jsx)(Z.Z,{mt:n>=1?P.cd:0,children:(0,w.jsx)(k.Z,{block:!0,noHoverUnderline:!0,onClick:function(){return(0,Se.u7)({addon:i},{pushHistory:!0})},preventDefault:!0,children:(0,w.jsx)(_n.Z,{dark:!0,children:(0,w.jsxs)(y.Z,{alignItems:"center",justifyContent:"space-between",children:[(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(Vn.Z,{fullWidth:!1,children:(0,w.jsx)(Z.Z,{p:P.cd,children:(0,w.jsx)(y.Z,{alignItems:"center",children:(0,w.jsx)(r,{fill:"#885EFF",size:2*P.iI})})})}),(0,w.jsx)(Z.Z,{mr:P.cd}),(0,w.jsx)(j.Z,{flexDirection:"column",children:(0,w.jsx)(O.ZP,{bold:!0,children:t})})]}),(0,w.jsx)(W._Q,{})]})})})},i)})))]})})};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 Ar(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}var Br=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,h=e.deleteBlock,v=e.deleteWidget,m=e.editingBlock,b=e.executePipeline,g=e.fetchFileTree,x=e.fetchPipeline,j=e.fetchSecrets,k=e.fetchVariables,C=e.globalVariables,_=e.insights,S=e.interruptKernel,E=e.isPipelineExecuting,I=e.lastTerminalMessage,D=e.messages,M=e.metadata,A=e.onChangeCallbackBlock,B=e.onChangeChartBlock,R=e.onChangeCodeBlock,N=e.onSelectBlockFile,L=e.pipeline,U=e.pipelineMessages,H=e.runBlock,z=e.runningBlocks,V=e.sampleData,G=e.savePipelineContent,K=e.secrets,Y=e.selectedBlock,q=e.selectedFilePath,Q=e.sendTerminalMessage,J=e.setAllowCodeBlockShortcuts,X=e.setAnyInputFocused,$=e.setDepGraphZoom,ee=e.setDisableShortcuts,ne=e.setEditingBlock,te=e.setErrors,ie=e.setHiddenBlocks,re=e.setSelectedBlock,oe=e.setTextareaFocused,le=e.showBrowseTemplates,ce=e.statistics,ue=e.textareaFocused,ae=e.treeRef,se=e.updateWidget,de=e.widgets,fe=(0,bt.i)().height,pe=vt.uX,he=(0,s.useState)([]),ve=he[0],me=he[1],be=(0,s.useState)(!!(0,Pe.U2)(Pe.Q9)),ge=be[0],xe=be[1],je=(0,s.useMemo)((function(){return i-(Zr.k1+1)}),[i]),ye=((null===m||void 0===m?void 0:m.upstreamBlocks)||{}).block,ke=((null===V||void 0===V?void 0:V.columns)||[]).slice(0,100),Ze=(0,s.useMemo)((function(){return(null===V||void 0===V?void 0:V.rows)||[]}),[V]),Oe=(0,s.useMemo)((function(){return(null===M||void 0===M?void 0:M.column_types)||{}}),[M]),Ce=(0,s.useMemo)((function(){return(null===_||void 0===_?void 0:_[1])||{}}),[_]),we=(0,s.useMemo)((function(){return(0,_e.HK)((null===_||void 0===_?void 0:_[0])||[],(function(e){return e.feature.uuid}))}),[_]),Se=!!V,Ee=(0,s.useMemo)((function(){return F.qL.INTEGRATION===(null===L||void 0===L?void 0:L.type)}),[L]),Ie=F.qL.STREAMING!==(null===L||void 0===L?void 0:L.type)?-70:ge?-16:300,Te=(0,s.useCallback)((0,lr.Fk)({columnTypes:Oe,columns:ke,insightsByFeatureUUID:we,insightsOverview:Ce,noColumnLinks:!0,statistics:ce}),[Oe,ke,we,Ce,ce]),De=(0,s.useMemo)((function(){return(0,w.jsx)(pr,{blocks:c,fetchVariables:k,pipeline:L,selectedBlock:Y,setErrorMessages:me,variables:C,width:je})}),[je,c,k,C,L,Y]),Me=(0,s.useMemo)((function(){return(0,w.jsx)(tr.Z,{selectedBlock:Y,selectedFilePath:q,setErrors:te,width:je>Le.nn?je-Le.nn:je})}),[je,Y,q,te]),Ae=(0,s.useMemo)((function(){return(0,w.jsx)(yr,{fetchSecrets:j,pipelineUUID:null===L||void 0===L?void 0:L.uuid,secrets:K,setErrorMessages:me,width:je})}),[je,j,L,K]),Be=(0,s.useMemo)((function(){return{addNewBlockAtIndex:t,autocompleteItems:r,blockRefs:l,blocks:c,blocksInNotebook:u,deleteBlock:h,fetchFileTree:g,fetchPipeline:x,interruptKernel:S,messages:D,onChangeCallbackBlock:A,onChangeCodeBlock:R,onSelectBlockFile:N,pipeline:L,runBlock:H,runningBlocks:z,savePipelineContent:G,selectedBlock:Y,setAnyInputFocused:X,setErrors:te,setHiddenBlocks:ie,setSelectedBlock:re,setTextareaFocused:oe,showBrowseTemplates:le,textareaFocused:ue}}),[t,r,l,c,u,h,g,x,S,D,A,R,N,L,H,z,G,Y,X,te,ie,re,oe,le,ue]),Re=(0,s.useMemo)((function(){return ke.length>0&&(0,w.jsx)(fi.Z,{columnHeaderHeight:(0,Tn.Qr)(Oe)&&(0,Tn.Qr)(we)&&(0,Tn.Qr)(Ce)?0:Or.Eh,columns:ke,height:fe-pe-vt.OM,noBorderBottom:!0,noBorderLeft:!0,noBorderRight:!0,noBorderTop:!0,renderColumnHeader:Te,rows:Ze,width:je})}),[je,Oe,ke,pe,fe,we,Ce,Te,Ze]),Ne=(0,s.useMemo)((function(){return de.length>0&&(0,w.jsx)(Ri,{autocompleteItems:r,blockRefs:l,blocks:c,chartRefs:d,deleteWidget:v,fetchFileTree:g,fetchPipeline:x,messages:D,onChangeChartBlock:B,pipeline:L,runBlock:H,runningBlocks:z,savePipelineContent:G,selectedBlock:Y,setAnyInputFocused:X,setErrors:te,setSelectedBlock:re,setTextareaFocused:oe,textareaFocused:ue,updateWidget:se,widgets:de,width:je})}),[je,r,l,c,d,v,g,x,D,B,L,H,z,G,Y,X,te,re,oe,ue,se,de]),Fe=(0,s.useMemo)((function(){return(0,w.jsx)("div",{style:{height:"100%",position:"relative",width:je},children:(0,w.jsx)(kr.Z,{lastMessage:I,onFocus:function(){return re(null)},sendMessage:Q,width:je})})}),[je,I,Q,re]),Ue=(0,s.useMemo)((function(){return(0,w.jsx)(nr,Ar({},Be))}),[Be]),He=(0,s.useMemo)((function(){return(0,w.jsx)(Dr,Ar({},Be))}),[Be]),ze=(0,s.useMemo)((function(){return L&&Y&&(0,w.jsx)(Ct,{block:Y,fetchFileTree:g,fetchPipeline:x,pipeline:L,setSelectedBlock:re})}),[g,x,L,Y,re]);return(0,w.jsxs)(w.Fragment,{children:[(null===ve||void 0===ve?void 0:ve.length)>=1&&(0,w.jsxs)(Z.Z,{mb:3,mt:2,mx:2,children:[(0,w.jsxs)(y.Z,{justifyContent:"space-between",children:[(0,w.jsx)(O.ZP,{bold:!0,danger:!0,children:"Errors"}),(0,w.jsx)(T.Z,{basic:!0,iconOnly:!0,noPadding:!0,onClick:function(){return me([])},transparent:!0,children:(0,w.jsx)(W.x8,{muted:!0})})]}),null===ve||void 0===ve?void 0:ve.map((function(e){return(0,w.jsx)(Z.Z,{pb:1,children:(0,w.jsx)(O.ZP,{monospace:!0,xsmall:!0,children:e})},e)}))]}),(0,w.jsxs)(Or.t0,{fullWidth:!0,heightOffset:nt.cH.TERMINAL===n?0:Le.nn,onBlur:function(){q||ee(!1),null===J||void 0===J||J(!1)},onFocus:function(){ee(!0),n===nt.cH.TREE&&(null===J||void 0===J||J(!0))},children:[n===nt.cH.TREE&&(0,w.jsx)(p.Z,{uuid:"PipelineDetail/".concat(null===L||void 0===L?void 0:L.uuid),children:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ni.Z,{blocks:c,blockRefs:l,editingBlock:m,enablePorts:!Ee,fetchPipeline:x,height:fe-pe-Ie,messages:D,onClickNode:function(e){var n=e.block.uuid;return ie((function(e){var t=!(null===e||void 0===e||!e[n]);return t?Ar(Ar({},e),{},(0,o.Z)({},n,!t)):e}))},pipeline:L,runningBlocks:z,selectedBlock:Y,setEditingBlock:ne,setErrors:te,setSelectedBlock:re,setZoom:$,treeRef:ae}),!ye&&F.qL.STREAMING===(null===L||void 0===L?void 0:L.type)&&(0,w.jsx)(Z.Z,{p:1,children:(0,w.jsx)(jr,{cancelPipeline:a,checkIfPipelineRunning:f,executePipeline:b,isPipelineExecuting:E,pipelineExecutionHidden:ge,pipelineMessages:U,setPipelineExecutionHidden:xe})})]})}),n===nt.cH.DATA&&Re,nt.cH.SECRETS===n&&Ae,nt.cH.VARIABLES===n&&De,nt.cH.FILE_VERSIONS===n&&(0,w.jsx)(p.Z,{uuid:"FileVersions/".concat(q?decodeURIComponent(q):""),children:Me}),Ee||Y&&Se||!Y&&Se&&n===nt.cH.DATA?null:nt.du.includes(n)&&(0,w.jsx)(y.Z,{alignItems:"center",justifyContent:"center",verticalHeight:nt.fp,verticalHeightOffset:pe,width:je,children:(0,w.jsx)(O.ZP,{center:!0,default:!0,disableWordBreak:!0,large:!0,monospace:!0,children:Y?!Se&&"No data or insights available":"Select a block for insights"})}),nt.cH.CHARTS===n&&(de.length>0?Ne:(0,w.jsxs)(y.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:nt.fp,verticalHeightOffset:pe,width:je,children:[(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(y.Z,{flexDirection:"row",children:(0,w.jsxs)(O.ZP,{center:!0,default:!0,children:["Add a chart by clicking the chart icon \xa0",(0,w.jsx)(W.GQ,{size:1.5*P.iI}),"\xa0in",(0,w.jsx)("br",{}),"the top right corner of a block (if applicable)."]})})}),(0,w.jsx)(Z.Z,{mt:P.cd,px:1,children:(0,w.jsx)(Fi,{size:40*P.iI})})]})),nt.cH.TERMINAL===n&&Fe,nt.cH.EXTENSIONS===n&&Ue,nt.cH.ADDON_BLOCKS===n&&He,nt.cH.BLOCK_SETTINGS===n&&(Y?ze:(0,w.jsx)(y.Z,{alignItems:"center",flexDirection:"column",justifyContent:"center",verticalHeight:nt.fp,verticalHeightOffset:pe,width:je,children:(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(y.Z,{flexDirection:"row",children:(0,w.jsxs)(O.ZP,{center:!0,default:!0,children:["Please select a block and then click the settings icon \xa0",(0,w.jsx)(W.JG,{size:1.5*P.iI}),"\xa0",(0,w.jsx)("br",{}),"in the top right corner of a block (if applicable)."]})})})}))]})]})},Rr=t(35438);function Nr(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 Lr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Nr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Nr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var Fr=function(e){var n,t=e.activeView,i=e.depGraphZoom,r=e.pipeline,o=e.secrets,l=e.selectedBlock,c=e.treeRef,u=e.variables,a=null===r||void 0===r?void 0:r.uuid,d=(0,Ji.iV)(),f=(0,fr.wx)(u,(function(e){return e.uuid===or.C})),p=nt.Qq[t],h=(null===p||void 0===p||null===(n=p.buildLabel)||void 0===n?void 0:n.call(p,{pipeline:r,secrets:o,variables:f}))||(null===p||void 0===p?void 0:p.label);nt.cH.BLOCK_SETTINGS===t&&null!==l&&void 0!==l&&l.uuid&&(h=(0,w.jsxs)(w.Fragment,{children:["Block settings for ",(0,w.jsx)(O.ZP,{bold:!0,color:(0,C.qn)(null===l||void 0===l?void 0:l.type).accent,inline:!0,monospace:!0,children:null===l||void 0===l?void 0:l.uuid})]}));var v=(0,w.jsx)(O.ZP,{bold:!0,children:h}),m=nt.cH.EXTENSIONS===t&&(null===d||void 0===d?void 0:d.extension),b=V.ZP.extension_options.list({},{},{pauseFetch:!m}).data,g=(0,s.useMemo)((function(){return(null===b||void 0===b?void 0:b.extension_options)||[]}),[b]),x=(0,s.useMemo)((function(){return(0,_e.HK)(g,(function(e){return e.uuid}))}),[g]),P=nt.cH.ADDON_BLOCKS===t&&(null===d||void 0===d?void 0:d.addon);if(!t)return(0,w.jsx)("div",{});if(c&&nt.cH.TREE===t)v=(0,w.jsxs)(y.Z,{alignItems:"center",fullWidth:!0,justifyContent:"space-between",children:[v,(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(j.Z,{alignItems:"center",children:[(0,w.jsx)(T.Z,Lr(Lr({},Rr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.zoomIn)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Zoom in"})})),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(T.Z,Lr(Lr({},Rr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.zoomOut)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Zoom out"})})),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsx)(Ze.Z,{appearAbove:!0,appearBefore:!0,default:!0,label:"Shortcut: Double-click canvas",lightBackground:!0,size:null,widthFitContent:!0,children:(0,w.jsx)(T.Z,Lr(Lr({},Rr.Ai),{},{onClick:function(){var e,n;null===c||void 0===c||null===(e=c.current)||void 0===e||null===(n=e.fitCanvas)||void 0===n||n.call(e)},children:(0,w.jsx)(O.ZP,{noWrapping:!0,children:"Reset"})}))}),(0,w.jsx)(Z.Z,{mr:1}),(0,w.jsxs)(O.ZP,{bold:!0,children:[null===i||void 0===i?void 0:i.toFixed(2),"x"]})]})]});else if(m){var _=x[null===d||void 0===d?void 0:d.extension];v=(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(Ae(),{as:"/pipelines/".concat(a,"/edit?").concat(nt.uM,"=").concat(nt.cH.EXTENSIONS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,w.jsx)(k.Z,{default:!0,children:h})}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,w.jsx)(O.ZP,{bold:!0,children:null===_||void 0===_?void 0:_.name})]})}else P&&(v=(0,w.jsxs)(y.Z,{children:[(0,w.jsx)(Ae(),{as:"/pipelines/".concat(a,"/edit?").concat(nt.uM,"=").concat(nt.cH.ADDON_BLOCKS),href:"/pipelines/[pipeline]/edit",passHref:!0,children:(0,w.jsx)(k.Z,{default:!0,children:h})}),(0,w.jsx)(O.ZP,{monospace:!0,muted:!0,children:"\xa0/\xa0"}),(0,w.jsx)(O.ZP,{bold:!0,children:(0,$.vg)(null===d||void 0===d?void 0:d.addon)})]}));return(0,w.jsx)(vt.ym,{children:v})},Ur=t(35033),Hr=t(11366),zr=t(3055),Vr=t(27337),Wr=t(94353),Gr=t(59920),Kr=t(36405);function Yr(e){var n=e.activeView,t=e.pipeline,i=e.secrets,r=e.setActiveSidekickView,o=e.variables,l=(0,fr.wx)(o,(function(e){return e.uuid===or.C}));return nt.j5.map((function(e){var o=e.buildLabel,c=e.key,u=e.label;return{Icon:nt.Z7[c],id:c,isSelected:function(){return n===c},label:function(){return(null===o||void 0===o?void 0:o({pipeline:t,secrets:i,variables:l}))||u},onClick:function(){return r(c,!0)}}}))}var qr=t(43482),Qr=t(32821),Jr=t(28799);function Xr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function $r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Xr(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Xr(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function eo(e){var n,t,i=e.page,c=e.pipeline,u=(0,f.useRouter)(),m=(0,bt.i)().height,b=u.query.pipeline,g=c.uuid||b,x=(0,s.useState)(!!(0,Pe.U2)(Pe.zg)),j=x[0],k=x[1],O=(0,s.useState)(null),C=O[0],_=O[1],S=(0,s.useState)(null),M=S[0],A=S[1],B=(0,s.useState)(null),R=B[0],L=B[1],U=(0,s.useState)(null),H=U[0],z=U[1],G=(0,s.useState)(null),K=G[0],Y=G[1],q=(0,s.useState)([]),Q=q[0],J=q[1],te=(0,s.useState)({}),ie=te[0],ce=te[1],ue=(0,s.useState)(!1),ae=ue[0],se=ue[1],de=(0,s.useState)(!1),fe=de[0],pe=de[1],he=(0,s.useState)(!1),ve=he[0],me=he[1],je=(0,s.useState)(!1),ye=je[0],Ze=je[1],De=(0,s.useState)(1),Me=De[0],Ae=De[1],Be=V.ZP.projects.list(),Re=Be.data,Ne=Be.mutate,Le=(0,s.useMemo)((function(){var e;return null===Re||void 0===Re||null===(e=Re.projects)||void 0===e?void 0:e[0]}),[Re]),Fe="".concat(Hr.H8,"_").concat(g),Ue=(0,Pe.U2)(Fe),He=(0,s.useState)((0,_e.sE)(mt.NR,(function(e){return e.uuid===Ue}))||mt.NR[0]),ze=He[0],Ve=He[1],We=(0,s.useCallback)((function(e){Ve(e),(0,Pe.t8)(Fe,null===e||void 0===e?void 0:e.uuid)}),[Fe,Ve]),Ge="".concat(Hr.g6,"_").concat(g),Ke=(0,s.useState)({}),Ye=Ke[0],qe=Ke[1],Qe=(0,s.useCallback)((function(e){qe((function(n){var t=e(n);return(0,Pe.t8)(Ge,JSON.stringify(t)),t}))}),[Ge,qe]);(0,s.useEffect)((function(){var e=(0,Pe.U2)(Ge);e&&(0,$.Pb)(e)&&qe(JSON.parse(e))}),[Ge,qe]);var Je=(0,s.useRef)(null),$e=V.ZP.statuses.list({},{revalidateOnFocus:!1}).data,en=(0,s.useMemo)((function(){var e,n;return null===$e||void 0===$e||null===(e=$e.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.disable_pipeline_edit_access}),[$e]),nn=(0,s.useMemo)((function(){var e,n;return null===$e||void 0===$e||null===(e=$e.statuses)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.max_print_output_lines}),[$e]),tn=(0,s.useState)({}),rn=tn[0],on=tn[1],ln=(0,s.useState)([]),cn=ln[0],un=ln[1],an=V.ZP.kernels.list({},{refreshInterval:5e3,revalidateOnFocus:!0}),sn=an.data,dn=an.mutate,fn=null===sn||void 0===sn?void 0:sn.kernels,pn=(null===fn||void 0===fn?void 0:fn.find((function(e){return e.name===F.a_[null===kn||void 0===kn?void 0:kn.type]})))||(null===fn||void 0===fn?void 0:fn[0]),hn=(0,Oe.Z)(g),vn=V.ZP.pipelines.detail(g,{include_block_pipelines:!0,includes_outputs:(0,Tn.Qr)(rn)},{refreshInterval:6e4}),mn=vn.data,bn=vn.mutate,gn=V.ZP.files.list(),xn=gn.data,jn=gn.mutate,yn=(0,s.useMemo)((function(){return(null===xn||void 0===xn?void 0:xn.files)||[]}),[xn]),kn=null===mn||void 0===mn?void 0:mn.pipeline,Zn=(0,s.useMemo)((function(){return F.qL.INTEGRATION===(null===kn||void 0===kn?void 0:kn.type)}),[kn]),On=(0,s.useState)(null),Pn=On[0],Cn=On[1],wn=(0,s.useState)((0,we.Tz)({dateObj:!0})),_n=wn[0],Sn=wn[1],En=(0,s.useState)(!1),In=En[0],Dn=En[1],Mn=(0,Ee.dd)((function(){return(0,w.jsx)(ke.Z,{centerOnScreen:!0,neutral:!0,onClick:Rn,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*P.iI})}),{},[],{background:!0,uuid:"stale_pipeline_message"}),An=(0,l.Z)(Mn,2),Bn=An[0],Rn=An[1];(0,s.useEffect)((function(){var e,n;null!==mn&&void 0!==mn&&null!==(e=mn.pipeline)&&void 0!==e&&e.updated_at&&(null===Pn||void 0===Pn?void 0:Pn.toISOString())!==new Date(null===mn||void 0===mn||null===(n=mn.pipeline)||void 0===n?void 0:n.updated_at).toISOString()&&Cn(new Date(mn.pipeline.updated_at)),Pn&&Number(Pn)>Number(_n)&&Bn()}),[null===mn||void 0===mn||null===(n=mn.pipeline)||void 0===n?void 0:n.updated_at,Pn,_n,Bn]);var Nn=(0,Ji.iV)(),Ln=Nn[nt.uM],Fn=Nn.block_uuid,Un=Nn.file_path,Hn=(0,s.useMemo)((function(){var e=Nn["file_paths[]"]||[];return Array.isArray(e)||(e=[e]),e}),[Nn]),zn=(0,s.useCallback)((function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=arguments.length>2?arguments[2]:void 0,i=(0,o.Z)({},nt.uM,e);null!==t&&void 0!==t&&t.addon&&(i.addon=null===t||void 0===t?void 0:t.addon),null!==t&&void 0!==t&&t.blockUUID&&(i.block_uuid=null===t||void 0===t?void 0:t.blockUUID),null!==t&&void 0!==t&&t.extension&&(i.extension=null===t||void 0===t?void 0:t.extension),(0,Se.u7)(i,{preserveParams:["addon","block_uuid","file_path","file_paths[]"],pushHistory:n,replaceParams:!0})}),[]);(0,s.useEffect)((function(){Ln||zn(nt.cH.TREE,!1)}),[Ln,zn]);var Vn=(0,s.useCallback)((function(e,n,t){k(!1),setTimeout((function(){return zn(e,n,t)}),1)}),[zn]),Wn=(0,s.useRef)({}),Gn=(0,s.useRef)({}),Kn=(0,s.useRef)(null),Yn=(0,s.useRef)({}),qn=(0,s.useRef)({}),Qn=(0,s.useRef)({}),Jn=(0,s.useCallback)((function(e,n,t){var i=Yn.current||{};Yn.current=$r($r({},i),{},(0,o.Z)({},e,$r($r({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[Yn]),Xn=(0,s.useCallback)((function(e,n,t){var i=qn.current||{};qn.current=$r($r({},i),{},(0,o.Z)({},e,$r($r({},i[e]||{}),{},(0,o.Z)({},n,t))))}),[qn]),$n=(0,s.useCallback)((function(e,n,t){Jn(e,n,t),Dn(!0)}),[Jn,Dn]),et=(0,s.useCallback)((function(e,n,t){Xn(e,n,t),Dn(!0)}),[Xn,Dn]),tt=(0,s.useCallback)((function(e){Qn.current=$r($r({},Qn.current),e)}),[Qn]),it=(0,s.useCallback)((function(e,n){tt((0,o.Z)({},e,n)),Dn(!0)}),[tt,Dn]),rt=(0,s.useState)(null),ot=rt[0],lt=rt[1],ct=V.ZP.data_providers.list({},{revalidateOnFocus:!1}).data,ut=null===ct||void 0===ct?void 0:ct.data_providers;(0,s.useEffect)((function(){var e=mn;null!==mn&&void 0!==mn&&mn.hasOwnProperty("error")||null===ct||void 0===ct||!ct.hasOwnProperty("error")||(e=ct),(0,ee.bB)(e,L)}),[mn,ct]);var at=V.ZP.variables.pipelines.list(g,{global_only:!0},{revalidateOnFocus:!1}),st=at.data,ft=at.mutate,pt=null===st||void 0===st?void 0:st.variables,ht=V.ZP.secrets.list({},{revalidateOnFocus:!1}),vt=ht.data,gt=ht.mutate,xt=null===vt||void 0===vt?void 0:vt.secrets,kt=(0,s.useState)([]),Zt=kt[0],Ot=kt[1],Pt=(0,s.useState)([]),Ct=Pt[0],wt=Pt[1],_t=(0,s.useRef)({}),St=(0,s.useCallback)((function(e){var n;Dn(!0);var t=_t.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),_t.current[e.uuid]=$r($r($r({},t),e),{},{configuration:$r($r({},t.configuration),e.configuration),upstream_blocks:i})}),[Dn,_t]),Et=(0,s.useState)(!1),It=Et[0],Tt=Et[1],Dt=(0,s.useState)({upstreamBlocks:null}),Mt=Dt[0],At=Dt[1],Bt=(0,s.useState)([]),Rt=Bt[0],Nt=Bt[1],Lt=(0,s.useState)(null),Ft=Lt[0],Ut=Lt[1],Ht=(0,qr.Dp)(g),zt=(0,qr.Q9)(Ht,Zt),Vt=(0,s.useState)(zt),Wt=Vt[0],Gt=Vt[1],Kt=(0,s.useState)(),Yt=Kt[0],qt=Kt[1],Qt=(0,s.useState)(),Jt=Qt[0],Xt=Qt[1],$t=(0,s.useState)(null),ei=$t[0],ni=$t[1],ti=(0,Oe.Z)(Wt),ii=(0,s.useCallback)((function(){At({upstreamBlocks:{block:null,values:[]}}),on({}),Dn(!1),Nt([]),Ut(null)}),[]);(0,s.useEffect)((function(){g!==hn&&(Yn.current={},qn.current={})}),[g,hn]);var ri=V.ZP.block_outputs.detail(!j&&(null===ei||void 0===ei?void 0:ei.type)!==v.tf.SCRATCHPAD&&(null===ei||void 0===ei?void 0:ei.type)!==v.tf.CHART&&null!==ei&&void 0!==ei&&ei.uuid?encodeURIComponent(null===ei||void 0===ei?void 0:ei.uuid):null,{pipeline_uuid:g}),oi=ri.data,li=ri.mutate,ci=(0,s.useMemo)((function(){return null===oi||void 0===oi?void 0:oi.block_output}),[oi]),ui=(0,s.useMemo)((function(){var e,n,t;return Zn?null===(e=(0,_e.sE)(null===ci||void 0===ci?void 0:ci.outputs,(function(e){return e.variable_uuid==="output_sample_data_".concat((0,$.kE)(Jt))})))||void 0===e?void 0:e.sample_data:null===ci||void 0===ci||null===(n=ci.outputs)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.sample_data}),[ci,Zn,Jt]),ai=V.ZP.blocks.pipelines.analyses.detail(j?null:g,(null===ei||void 0===ei?void 0:ei.type)!==v.tf.SCRATCHPAD&&(null===ei||void 0===ei?void 0:ei.type)!==v.tf.CHART&&(null===ei||void 0===ei?void 0:ei.uuid)&&encodeURIComponent(null===ei||void 0===ei?void 0:ei.uuid)),si=ai.data,di=ai.mutate,fi=(null===si||void 0===si||null===(t=si.analyses)||void 0===t?void 0:t[0])||{},pi=fi.insights,hi=void 0===pi?{}:pi,vi=fi.metadata,mi=void 0===vi?{}:vi,bi=fi.statistics,gi=void 0===bi?{}:bi;(0,s.useEffect)((function(){0===Rt.length&&(di(),li(),ft())}),[di,li,ft,Rt]),(0,s.useEffect)((function(){if(0===Wt.length)ni(null);else if((null===ti||void 0===ti?void 0:ti.length)!==(null===Wt||void 0===Wt?void 0:Wt.length)&&(null===Wt||void 0===Wt?void 0:Wt.length)<(null===ti||void 0===ti?void 0:ti.length)){var e=ti.findIndex((function(e){return e.uuid===(null===ei||void 0===ei?void 0:ei.uuid)})),n=ti.length-1===e?e-1:e+1;ni(ti[Math.max(0,n)])}}),[Wt,ti,null===ei||void 0===ei?void 0:ei.uuid]),(0,s.useEffect)((function(){var e;null!==(e=Mt.upstreamBlocks)&&void 0!==e&&e.block&&(k(!1),zn(nt.cH.TREE))}),[Mt.upstreamBlocks,zn]);var xi=V.ZP.autocomplete_items.list({},{refreshInterval:!1,revalidateOnFocus:!1}),ji=xi.data,yi=xi.mutate,ki=null===ji||void 0===ji?void 0:ji.autocomplete_items;(0,s.useEffect)((function(){Un||me(!1),Y(Un)}),[Un]),(0,s.useEffect)((function(){(0,_e.fS)(Hn,Q)||J(Hn)}),[Hn,Q]);var Zi=(0,d.Db)(V.ZP.pipelines.useCreate(),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.pipeline.uuid;u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(n,"/edit")),jn()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),Oi=(0,l.Z)(Zi,1)[0],Pi=(0,d.Db)(V.ZP.pipelines.useUpdate(g,{update_content:!0}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){Dn(!1),bn()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),Ci=(0,l.Z)(Pi,2),wi=Ci[0],_i=Ci[1].isLoading,Si=(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(!(Pn&&Number(Pn)>Number(_n))){var u=(0,we.Tz)({dateObj:!0}),a=(0,we.Tz)();Sn(u);var s={},d={},f={},p={};Zt.forEach((function(e){var n,t,r,o=e.extension_uuid,u=e.type,a=e.uuid,h=null===(n=qn.current[u])||void 0===n?void 0:n[a];"undefined"===typeof h&&(h=e.content);var m,b=null===(t=Yn.current[u])||void 0===t?void 0:t[a];"undefined"===typeof b&&(b=e.callback_content);var g=null===(r=rn[a])||void 0===r?void 0:r.filter((function(e){return!!e})),x=null===g||void 0===g?void 0:g.find((function(e){return e.error}));if(g){var j=[],y=0;g.forEach((function(n){var t=n.data,i=n.type;(v.tf.SCRATCHPAD===e.type||x||"table"!==i)&&(Array.isArray(t)&&(n.data=t.reduce((function(e,n){return n.match(Ur.Lz)?e:e.concat(n)}),[]),i===Te.Gi.TEXT_PLAIN&&(y+=(null===t||void 0===t?void 0:t.length)||0)),(!nn||y<nn+5)&&j.push(n))})),m=j.map((function(e,n){return{text_data:JSON.stringify(e),variable_uuid:"".concat(a,"_").concat(n)}}))}var k=$r($r({},e),{},{callback_content:b,content:h,outputs:m});(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];k[t]||(k[t]={}),k[t][i]=r})):k[t]=i})),c?d[k.uuid]={callback_content:k.callback_content,content:k.content,outputs:k.outputs,uuid:k.uuid}:[v.tf.EXTENSION].includes(u)?(s[o]||(s[o]=[]),s[o].push(k)):v.tf.CALLBACK===u?f[k.uuid]=k:v.tf.CONDITIONAL===u?p[k.uuid]=k:d[k.uuid]=k}));var h=$r($r({},null===kn||void 0===kn?void 0:kn.extensions),null===o||void 0===o?void 0:o.extensions);Object.entries(s).forEach((function(e){var n=(0,l.Z)(e,2),t=n[0],i=n[1];h[t]||(h[t]={}),h[t].blocks=i}));var m=[],b=[],g=[];return((null===o||void 0===o?void 0:o.blocks)||Zt).forEach((function(e){var n=e.uuid,t=d[n],i=f[n],r=p[n];"undefined"!==typeof t?m.push(t):"undefined"!==typeof i?b.push(i):"undefined"!==typeof r&&g.push(r)})),wi({pipeline:$r($r($r({},kn),o),{},{blocks:m,callbacks:b,conditionals:g,extensions:h,updated_at:a,widgets:Ct.map((function(e){var n,t,i=Qn.current[e.uuid],r=_t.current[e.uuid]||{};"undefined"===typeof i&&(i=e.content);var o=null===(n=rn[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(Ur.Lz)?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 $r($r($r({},e),r),{},{configuration:$r($r({},e.configuration),r.configuration),content:i,outputs:t})}))})})}Bn()}),[Zt,nn,rn,kn,Pn,_n,Bn,wi,Ct]),Ei=(0,s.useCallback)((function(e){Si();var n=encodeURIComponent(e),t=(0,Ji.iV)()["file_paths[]"]||[];Array.isArray(t)||(t=[t]),t.includes(n)||t.push(n);var i=(0,Qr.IO)(e,Zt);if(i){if(Ut(i),null!==Wn&&void 0!==Wn&&Wn.current){var r,o=Wn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}}else(0,Se.u7)({file_path:n,"file_paths[]":t})}),[Wn,Zt,Si]),Ii=(0,s.useMemo)((function(){var e=[],n=[];return Zt.forEach((function(t){v.M5.includes(t.type)?n.push(t):e.push(t)})),{blocksInNotebook:e,blocksInSidekick:n}}),[Zt]),Ti=Ii.blocksInNotebook,Di=Ii.blocksInSidekick,Mi=(0,s.useCallback)((function(e,n){return Si({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"):(jn(),n!==(null===kn||void 0===kn?void 0:kn.type)&&bn(),(0,qr.k1)(Ti,g,r),(0,qr.k1)(Di,g,r))}else null!==e&&void 0!==e&&null!==(i=e.data)&&void 0!==i&&i.error&&A((function(e){return $r($r({},e),{},{links:[{label:"Check pipeline configuration",onClick:function(){Ei("pipelines/".concat(g,"/").concat(Xe.dT.METADATA_YAML)),A(null)}}]})}))}))}),[Ti,Di,jn,bn,Ei,null===kn||void 0===kn?void 0:kn.type,g,Si]),Ai=(0,d.Db)((function(e){var n=e.type,t=e.extension_uuid,i=e.uuid,r={};return n&&(r.block_type=n),t&&(r.extension_uuid=t),V.ZP.blocks.pipelines.useDelete(g,encodeURIComponent(i),r)()}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.block,t=n.type,i=n.uuid;Ot((function(e){return(0,_e.oM)(e,e.findIndex((function(e){var n=e.type,r=e.uuid;return t===n&&i===r})))})),bn(),Ut(null),t===v.tf.SCRATCHPAD&&jn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;A({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&on((function(e){return $r($r({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Te.Gi.TEXT_PLAIN}}))))}))}})}}),Bi=(0,l.Z)(Ai,1)[0],Ri=(0,d.Db)((function(e){var n=e.uuid;return V.ZP.widgets.pipelines.useDelete(g,n)()}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(e){var n=e.widget.uuid;wt((function(e){return(0,_e.oM)(e,e.findIndex((function(e){var t=e.uuid;return n===t})))})),bn(),jn()},onErrorCallback:function(e,n){var t=e.url_parameters,i=n.messages;A({errors:n,response:e}),null!==t&&void 0!==t&&t.block_uuid&&on((function(e){return $r($r({},e),{},(0,o.Z)({},t.block_uuid,i.map((function(e){return{data:"".concat(e,"\n"),error:"".concat(e,"\n"),type:Te.Gi.TEXT_PLAIN}}))))}))}})}}),Ni=(0,l.Z)(Ri,1)[0],Li=(0,Ee.dd)((function(e){return(0,w.jsx)(ke.Z,{centerOnScreen:!0,neutral:!0,onCancel:Hi,onClick:function(){return Vi(e)},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*P.iI})})),Fi=(0,l.Z)(Li,2),Ui=Fi[0],Hi=Fi[1],zi=(0,d.Db)((function(e){var n=e.language,t=e.type,i=e.uuid,r="".concat(t,"/").concat(i);return n&&Xe.JD[n]&&(r="".concat(r,".").concat(Xe.JD[n].toLowerCase())),V.ZP.blocks.useDelete(encodeURIComponent(r))()}),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){yi(),bn(),jn()},onErrorCallback:function(e,n){Ui(),A({displayMessage:e.exception,errors:n,response:e})}})}}),Vi=(0,l.Z)(zi,1)[0],Wi=(0,d.Db)(V.ZP.kernels.useUpdate(null===pn||void 0===pn?void 0:pn.id),{onSuccess:function(e){return(0,ee.wD)(e,{callback:function(){return dn()},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}}),Gi=(0,l.Z)(Wi,1)[0],Ki=(0,s.useCallback)((function(){return Gi({kernel:{action_type:"restart"}})}),[Gi]),Yi=(0,s.useCallback)((function(){Gi({kernel:{action_type:"interrupt"}}),Nt([])}),[Gi]),qi=(0,d.Db)(V.ZP.blocks.pipelines.useCreate(g)),Qi=(0,l.Z)(qi,1)[0],Xi=(0,s.useCallback)((function(e,n,t){var i,o,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,$.Y6)();e.converted_from_type&&e.converted_from_uuid&&(i=null===(o=qn.current[e.converted_from_type])||void 0===o?void 0:o[e.converted_from_uuid]);var u=e.language,a=e.type;if(Zn){var s=(0,_e.HK)((null===kn||void 0===kn?void 0:kn.blocks)||[],(function(e){return e.type})),d=s[v.tf.DATA_EXPORTER],f=s[v.tf.DATA_LOADER],p=s[v.tf.TRANSFORMER];if(v.tf.DATA_LOADER===a){if(v.t6.YAML!==u)return void A({displayMessage:"The source you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(f)return void A({displayMessage:"Pipeline ".concat(null===kn||void 0===kn?void 0:kn.uuid," already has a source: ").concat(null===f||void 0===f?void 0:f.uuid,".")})}else if(v.tf.TRANSFORMER===a){if(p)return void A({displayMessage:"Pipeline ".concat(null===kn||void 0===kn?void 0:kn.uuid," already has a transformer: ").concat(null===p||void 0===p?void 0:p.uuid,".")})}else if(v.tf.DATA_EXPORTER===a){if(v.t6.YAML!==u)return void A({displayMessage:"The destination you\u2019re trying to add must contain the language ".concat(v.t6.YAML," and not ").concat(u,".")});if(d)return void A({displayMessage:"Pipeline ".concat(null===kn||void 0===kn?void 0:kn.uuid," already has a destination: ").concat(null===d||void 0===d?void 0:d.uuid,".")})}}return Qi({block:$r({content:i,name:c,priority:n},e)}).then((function(e){(0,ee.wD)(e,{callback:function(){var n=e.data.block;null===t||void 0===t||t(n),jn(),bn().then((function(e){var n=e.pipeline,t=n.blocks,i=n.extensions;return Ot((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 $r($r({},e),{},{extension_uuid:i})}))))}));var o=(0,_e.HK)(e,(function(e){return e.uuid})),c=[];return n.forEach((function(e){var n=o[e.uuid];n?c.push(n):c.push(e)})),c}))}))},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}))}),[Qi,jn,bn,Zn,Ot,A,kn]),$i=(0,Ee.dd)((function(e){var n=e.block,t=e.idx,i=e.name,r=void 0===i?(0,$.Y6)():i,o=e.onCreateCallback;return(0,w.jsx)(ne.BC,{children:(0,w.jsx)(re,{block:n,defaultName:r,onClose:tr,onSave:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xi($r($r({},n),(0,Tn.gR)(e,["name"])),t,o,null===e||void 0===e?void 0:e.name).then((function(){return tr()}))},pipeline:kn})})}),{},[Xi,kn],{background:!0,disableEscape:!0,uuid:"configure_block_name_and_create"}),er=(0,l.Z)($i,2),nr=er[0],tr=er[1],ir=(0,Ee.dd)((function(e){var n=e.cancelButtonText,t=e.header,i=e.onCancel,r=e.onSaveSuccess;return(0,w.jsx)(ne.BC,{children:(0,w.jsx)(yt.Z,{cancelButtonText:n,contained:!0,header:t,onCancel:function(){null===i||void 0===i||i(),lr()},onSaveSuccess:function(e){Ne(),lr(),null===r||void 0===r||r(e)}})})}),{},[Ne],{background:!0,uuid:"configure_project"}),rr=(0,l.Z)(ir,2),or=rr[0],lr=rr[1],cr=(0,d.Db)(V.ZP.widgets.pipelines.useCreate(g)),ur=(0,l.Z)(cr,1)[0],ar=(0,s.useCallback)((function(e,n,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,$.Y6)();return ur({widget:$r({name:i,priority:n,type:v.tf.CHART},e)}).then((function(e){return(0,ee.wD)(e,{callback:function(){var n=e.data.widget;null===t||void 0===t||t(n),jn(),bn(),zn(nt.cH.CHARTS),z(n)},onErrorCallback:function(e,n){return A({errors:n,response:e})}})}))}),[jn,bn,ur,zn]);(0,s.useEffect)((function(){if(H){var e,n=null===(e=Gn.current[H.uuid])||void 0===e?void 0:e.current;n&&(n.scrollIntoView(),z(null))}}),[H,z]),(0,s.useEffect)((function(){hn!==g&&(Ot([]),wt([]),Gt([]),un([]))}),[g,hn]),(0,s.useEffect)((function(){if("undefined"!==typeof(null===kn||void 0===kn?void 0:kn.blocks)||"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.extensions)){var e=[];"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.blocks)&&e.push.apply(e,(0,r.Z)(null===kn||void 0===kn?void 0:kn.blocks)),"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.callbacks)&&e.push.apply(e,(0,r.Z)(null===kn||void 0===kn?void 0:kn.callbacks)),"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.conditionals)&&e.push.apply(e,(0,r.Z)(null===kn||void 0===kn?void 0:kn.conditionals)),"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.extensions)&&Object.entries((null===kn||void 0===kn?void 0:kn.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 $r($r({},e),{},{extension_uuid:i})}))))})),Ot(e)}}),[null===kn||void 0===kn?void 0:kn.blocks,null===kn||void 0===kn?void 0:kn.callbacks,null===kn||void 0===kn?void 0:kn.conditionals,null===kn||void 0===kn?void 0:kn.extensions]),(0,s.useEffect)((function(){"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.widgets)&&wt(kn.widgets)}),[null===kn||void 0===kn?void 0:kn.widgets]),(0,s.useEffect)((function(){(null===zt||void 0===zt?void 0:zt.length)>0&&0===(null===Wt||void 0===Wt?void 0:Wt.length)&&(Gt(zt),ni(zt[0]))}),[Wt,zt]);var sr=(0,Oe.Z)(Zt);(0,s.useEffect)((function(){if("undefined"!==typeof(null===kn||void 0===kn?void 0:kn.blocks)&&(!Zt.length||!(0,_e.fS)(null===sr||void 0===sr?void 0:sr.map((function(e){return e.uuid})).sort(),null===Zt||void 0===Zt?void 0:Zt.map((function(e){return e.uuid})).sort()))){var e=(0,qr.Rt)(kn.blocks),n=e.content,t=e.messages;qn.current=n,on((function(e){return $r($r({},t),e)}))}}),[Zt,sr,null===kn||void 0===kn?void 0:kn.blocks,on]),(0,s.useEffect)((function(){if(!Ct.length&&"undefined"!==typeof(null===kn||void 0===kn?void 0:kn.widgets)){var e=(0,qr.Rt)(kn.widgets),n=e.content,t=e.messages;Qn.current=n,on((function(e){return $r($r({},t),e)}))}}),[null===kn||void 0===kn?void 0:kn.widgets,on,Ct]);var dr=(0,s.useCallback)((function(e,n,t){var i=Zt.find((function(t){var i=t.type,r=t.uuid;return i===n&&r===e}));if(i){if(Ut(i),null!==Wn&&void 0!==Wn&&Wn.current){var r,o=Wn.current["".concat(i.type,"s/").concat(i.uuid,".py")];null===o||void 0===o||null===(r=o.current)||void 0===r||r.scrollIntoView()}(0,Se.u7)({block_uuid:null,file_path:null,"file_paths[]":[]})}else if(n===v.tf.CHART){var l=Ct.find((function(n){return n.uuid===e}));if(l&&(Ut(l),null!==Gn&&void 0!==Gn&&Gn.current)){var c,u=Gn.current[l.uuid];null===u||void 0===u||null===(c=u.current)||void 0===c||c.scrollIntoView()}}else t&&Ei(t)}),[Zt,Ei,Ct]);(0,s.useEffect)((function(){if(Fn&&!Ft){var e=Zt.find((function(e){var n,t=e.uuid;return(null===Fn||void 0===Fn||null===(n=Fn.split(":"))||void 0===n?void 0:n[0])===t}));e&&(Qe((function(n){return $r($r({},n),{},(0,o.Z)({},e.uuid,!1))})),dr(e.uuid,e.type,null))}else(null===sr||void 0===sr?void 0:sr.length)!==(null===Zt||void 0===Zt?void 0:Zt.length)&&Ft&&(Qe((function(e){return $r($r({},e),{},(0,o.Z)({},Ft.uuid,!1))})),dr(Ft.uuid,Ft.type,null))}),[Fn,Zt,null===sr||void 0===sr?void 0:sr.length,dr,Ft,Qe]);var fr=(0,s.useMemo)((function(){return new h.Z}),[]),pr=(0,s.useMemo)((function(){return{api_key:Wr.l,token:fr.decodedToken.token}}),[fr]),hr=(0,a.ZP)((0,Jr.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.pipeline_uuid,u=n.uuid;if(!u&&!c)return;var a=Zt.find((function(e){var n=e.type,i=e.uuid;return t===n&&u===i}));"stream_pipeline"!==l?on((function(e){var t=e[u]||[];return $r($r({},e),{},(0,o.Z)({},u,t.concat(n)))})):(un((function(e){return[].concat((0,r.Z)(e),[n])})),Te.uF.IDLE===i&&(Nt([]),bn(),u||Tt(!1))),Te.uF.BUSY===i?Nt((function(e){return e.find((function(e){var n=e.uuid;return u===n}))||!a?e:e.concat(a)})):Te.uF.IDLE===i&&Nt((function(e){return e.filter((function(e){var n=e.uuid;return u!==n}))})),en||Dn(!0)}},onOpen:function(){return console.log("socketUrlPublish opened")},reconnectAttempts:10,reconnectInterval:3e3,shouldReconnect:function(){return console.log("Attempting to reconnect..."),!0}}).sendMessage,vr=(0,s.useCallback)((function(){Si().then((function(){Tt(!0),un([]),hr(JSON.stringify($r($r({},pr),{},{execute_pipeline:!0,pipeline_uuid:g})))}))}),[g,Si,hr,pr]),mr=(0,s.useCallback)((function(){hr(JSON.stringify($r($r({},pr),{},{cancel_pipeline:!0,pipeline_uuid:g})))}),[g,hr,pr]),br=(0,s.useCallback)((function(){hr(JSON.stringify($r($r({},pr),{},{cancel_pipeline:!0,pipeline_uuid:g,skip_publish_message:!0})))}),[g,hr,pr]),gr=(0,s.useCallback)((function(){hr(JSON.stringify($r($r({},pr),{},{check_if_pipeline_running:!0,pipeline_uuid:g})))}),[g,hr,pr]);(0,s.useEffect)((function(){var e;return window.addEventListener("pagehide",br),null===u||void 0===u||null===(e=u.events)||void 0===e||e.on("routeChangeStart",br),function(){var e;null===u||void 0===u||null===(e=u.events)||void 0===e||e.off("routeChangeStart",br),window.removeEventListener("pagehide",br)}}),[br,null===u||void 0===u?void 0:u.events]);var xr=(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.runIncompleteUpstream,c=void 0!==l&&l,u=e.runSettings,a=void 0===u?{}:u,s=e.runTests,d=void 0!==s&&s,f=e.runUpstream,p=n.extension_uuid,h=n.upstream_blocks,v=n.uuid;if(!Rt.find((function(e){var n=e.uuid;return v===n}))||i){var m="".concat(Hr.vF,"_").concat(null===kn||void 0===kn?void 0:kn.uuid);hr(JSON.stringify($r($r({},pr),{},{code:t,extension_uuid:p,output_messages_to_logs:!!(0,Pe.U2)(m),pipeline_uuid:null===kn||void 0===kn?void 0:kn.uuid,run_downstream:o,run_incomplete_upstream:c,run_settings:a,run_tests:d,run_upstream:f,type:n.type,upstream_blocks:h,uuid:v}))),on((function(e){return delete e[v],e})),se(!1),Nt((function(e){return e.find((function(e){var n=e.uuid;return v===n}))?e:e.concat(n)}))}bn()}),[bn,kn,Rt,hr,on,Nt,se,pr]),jr=(0,s.useCallback)((function(e){var n=e.block;return en?xr(e):Si({block:{outputs:[],uuid:n.uuid}},{contentOnly:!0}).then((function(){return xr(e)}))}),[en,xr,Si]),yr=(0,a.ZP)((0,Jr.Ib)("terminal"),{queryParams:pr,shouldReconnect:function(){return!0}}),kr=yr.lastMessage,Zr=yr.sendMessage,Or=(0,Ee.dd)((function(e){var n=e.addNew,t=e.addNewBlock,i=e.blockType;return(0,w.jsx)(ne.BC,{children:(0,w.jsx)(I.Z,{contained:!0,defaultLinkUUID:i,onClickCustomTemplate:function(e){t({config:{custom_template:e,custom_template_uuid:null===e||void 0===e?void 0:e.template_uuid}}),wr()},showAddingNewTemplates:!!n,showBreadcrumbs:!0,tabs:[Vr.n9]})})}),{},[],{background:!0,uuid:"browse_templates"}),Pr=(0,l.Z)(Or,2),Cr=Pr[0],wr=Pr[1],_r=(0,s.useMemo)((function(){return(0,w.jsx)(Br,{activeView:Ln,addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){return nr({block:e,idx:n,name:i,onCreateCallback:t})}))},afterWidth:C,autocompleteItems:ki,blockRefs:Wn,blocks:Zt,blocksInNotebook:Ti,cancelPipeline:mr,chartRefs:Gn,checkIfPipelineRunning:gr,deleteBlock:Bi,deleteWidget:Ni,editingBlock:Mt,executePipeline:vr,fetchFileTree:jn,fetchPipeline:bn,fetchSecrets:gt,fetchVariables:ft,globalVariables:pt,insights:hi,interruptKernel:Yi,isPipelineExecuting:It,isPipelineUpdating:_i,lastTerminalMessage:kr,messages:rn,metadata:mi,onChangeCallbackBlock:$n,onChangeChartBlock:it,onChangeCodeBlock:et,onSelectBlockFile:dr,pipeline:kn,pipelineMessages:cn,runBlock:jr,runningBlocks:Rt,sampleData:ui,savePipelineContent:Si,secrets:xt,selectedBlock:Ft,selectedFilePath:K,sendTerminalMessage:Zr,setActiveSidekickView:zn,setAllowCodeBlockShortcuts:Ze,setAnyInputFocused:pe,setDepGraphZoom:Ae,setDisableShortcuts:me,setEditingBlock:At,setErrors:A,setHiddenBlocks:Qe,setSelectedBlock:Ut,setTextareaFocused:se,showBrowseTemplates:Cr,statistics:gi,textareaFocused:ae,treeRef:Kn,updatePipelineMetadata:Mi,updateWidget:St,widgets:Ct})}),[Ln,C,ki,Wn,Zt,Ti,mr,gr,Bi,Ni,Mt,vr,jn,bn,gt,ft,pt,hi,Yi,It,_i,kr,rn,mi,$n,it,et,dr,kn,cn,jr,Rt,ui,Si,xt,Ft,K,Zr,zn,pe,At,A,Qe,se,nr,Cr,gi,ae,Mi,St,Ct]),Sr=(0,s.useMemo)((function(){return(0,w.jsx)(dt,{addNewBlockAtIndex:function(e,n,t,i){return new Promise((function(){var r;X.L.BLOCK_FILE!==(null===e||void 0===e||null===(r=e.block_action_object)||void 0===r?void 0:r.object_type)&&(v.tf.DBT!==(null===e||void 0===e?void 0:e.type)||v.t6.SQL!==(null===e||void 0===e?void 0:e.language)||null!==e&&void 0!==e&&e.block_action_object)?nr({block:e,idx:n,name:i,onCreateCallback:t}):Xi(e,n,t,i)}))},addWidget:function(e,n){var t=n.onCreateCallback;return ar(e,Ct.length,t)},allBlocks:Zt,allowCodeBlockShortcuts:ye,anyInputFocused:fe,autocompleteItems:ki,blockRefs:Wn,blocks:Ti,dataProviders:ut,deleteBlock:Bi,disableShortcuts:ve,fetchFileTree:jn,fetchPipeline:bn,fetchSampleData:li,files:yn,globalVariables:pt,hiddenBlocks:Ye,interruptKernel:Yi,mainContainerRef:Je,mainContainerWidth:ot,messages:rn,onChangeCallbackBlock:$n,onChangeCodeBlock:et,openSidekickView:Vn,pipeline:kn,pipelineContentTouched:In,project:Le,restartKernel:Ki,runBlock:jr,runningBlocks:Rt,savePipelineContent:Si,selectedBlock:Ft,setAnyInputFocused:pe,setDisableShortcuts:me,setEditingBlock:At,setErrors:A,setHiddenBlocks:Qe,setIntegrationStreams:qt,setOutputBlocks:Gt,setPipelineContentTouched:Dn,setSelectedBlock:Ut,setSelectedOutputBlock:ni,setSelectedStream:Xt,setTextareaFocused:se,showBrowseTemplates:Cr,showConfigureProjectModal:or,textareaFocused:ae,widgets:Ct})}),[Xi,ar,ye,fe,ki,Wn,Zt,Ti,ut,Bi,ve,jn,bn,li,yn,pt,Ye,Yi,Je,ot,rn,$n,et,Vn,kn,In,Le,Ki,jr,Rt,Si,Ft,pe,At,A,Qe,Dn,Ut,se,nr,Cr,or,ae,Ct]),Er=(0,s.useMemo)((function(){if(i===mt.b7)return(0,w.jsx)(be,{cancelPipeline:mr,createPipeline:Oi,executePipeline:vr,interruptKernel:Yi,isPipelineExecuting:It,pipeline:kn,restartKernel:Ki,savePipelineContent:Si,setActiveSidekickView:zn,setMessages:on,children:K&&(0,w.jsx)(Z.Z,{ml:1,children:(0,w.jsx)(y.Z,{alignItems:"center",fullHeight:!0,children:(0,w.jsx)(T.Z,{compact:!0,onClick:function(){return Y(null)},small:!0,children:"View pipeline"})})})})}),[mr,Oi,vr,Yi,It,i,kn,Ki,Si,K,zn,on,Y]),Ir=(0,s.useMemo)((function(){if(i===mt.b7)return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ie,{filePaths:Q,filesTouched:ie,isBusy:Rt.length>=1,isPipelineUpdating:_i,kernel:pn,pipeline:kn,pipelineContentTouched:In,pipelineLastSaved:Pn,restartKernel:Ki,savePipelineContent:Si,selectedFilePath:K,setErrors:A,setRunningBlocks:Nt,updatePipelineMetadata:Mi,children:Er}),(null===Q||void 0===Q?void 0:Q.length)>0&&(0,w.jsx)(Ce.rK,{relativePosition:!0,secondary:!0,children:(0,w.jsx)(ge.Z,{filePaths:Q,filesTouched:ie,savePipelineContent:Si,selectedFilePath:K})})]})}),[Er,ie,_i,pn,i,kn,In,Pn,Ki,Rt,Si,K,Q,A,Mi]),Tr=(0,s.useMemo)((function(){var e;return null===Yt||void 0===Yt||null===(e=Yt.filter((function(e){return(0,_e.sE)(null===ci||void 0===ci?void 0:ci.outputs,(function(n){return n.variable_uuid==="output_sample_data_".concat((0,$.kE)(e))}))})))||void 0===e?void 0:e.map((function(e){return(0,w.jsx)(Z.Z,{pl:1,children:(0,w.jsx)(N.ZP,{blackBorder:!0,compact:!0,muted:!0,onClick:function(){return Xt(e)},selected:Jt===e,uuid:e,children:e})},e)}))}),[ci,Yt,Jt]),Dr=(0,s.useRef)(null),Mr=(0,s.useMemo)((function(){return(0,w.jsx)(oe.Z,{addNewBlock:function(e,n){Xi(e,Zt.length,n,e.name),(null===Hn||void 0===Hn?void 0:Hn.length)>=1&&u.push("/pipelines/".concat(g,"/edit"))},blocks:Zt,deleteWidget:Ni,fetchAutocompleteItems:yi,fetchFileTree:jn,fetchPipeline:bn,files:yn,onSelectBlockFile:dr,openFile:Ei,openPipeline:function(e){ii(),u.push("/pipelines/[pipeline]/edit","/pipelines/".concat(e,"/edit"))},openSidekickView:Vn,pipeline:kn,ref:Dr,setErrors:A,setSelectedBlock:Ut,widgets:Ct})}),[Xi,Zt,Ni,yi,jn,bn,null===Hn||void 0===Hn?void 0:Hn.length,yn,dr,Ei,Vn,kn,g,ii,u,A,Ut,Ct]),Ar=(0,s.useMemo)((function(){return(0,w.jsx)(E,{blockRefs:Wn,hiddenBlocks:Ye,pipeline:kn,setHiddenBlocks:Qe})}),[Wn,Ye,kn,Qe]),Rr=(0,s.useMemo)((function(){return mt.Jf.uuid===(null===ze||void 0===ze?void 0:ze.uuid)?Mr:mt.IY.uuid===(null===ze||void 0===ze?void 0:ze.uuid)?Ar:null}),[Mr,Ar,ze]),Nr=(0,s.useMemo)((function(){return(0,w.jsx)(Z.Z,{px:1,children:(0,w.jsx)(D.Z,{noPadding:!0,onClickTab:function(e){We(e)},selectedTabUUID:null===ze||void 0===ze?void 0:ze.uuid,small:!0,tabs:mt.NR})})}),[We,ze]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(xe.Z,{title:null===kn||void 0===kn?void 0:kn.name}),(0,w.jsxs)(jt,{after:_r,afterHeader:(0,w.jsx)(Fr,{activeView:Ln,depGraphZoom:Me,pipeline:kn,secrets:xt,selectedBlock:Ft,treeRef:Kn,variables:pt}),afterHeightOffset:zr.Mz,afterHidden:j,afterNavigationItems:Yr({activeView:Ln,pipeline:kn,secrets:xt,setActiveSidekickView:zn,variables:pt}),afterOverflow:nt.cH.DATA===Ln?"hidden":null,afterSubheader:(null===Wt||void 0===Wt?void 0:Wt.length)>0&&Ln===nt.cH.DATA&&(0,w.jsxs)(y.Z,{alignItems:"center",fullHeight:!0,fullWidth:!0,children:[!Zn&&Wt.map((function(e){var n=e.uuid,t=(null===ei||void 0===ei?void 0:ei.uuid)===n;return(0,w.jsx)(Z.Z,{pl:1,children:(0,w.jsx)(N.ZP,{afterElement:t?(0,w.jsx)(T.Z,{basic:!0,highlightOnHover:!0,onClick:function(){(0,qr.h8)(g,e.uuid),Gt((function(e){return e.filter((function(e){return e.uuid!==n}))}))},padding:"2px",transparent:!0,children:(0,w.jsx)(W.x8,{muted:!0,size:1.25*P.iI})}):null,blackBorder:!0,compact:!0,muted:!0,onClick:function(){return ni(e)},selected:t,uuid:n,children:n})},n)})),Zn&&Tr]}),before:Rr,beforeHeader:Nr,beforeHeightOffset:zr.Mz,beforeNavigationItems:(0,Kr.H)(Gr.M.EDIT,kn),errors:R||M,headerOffset:(null===Q||void 0===Q?void 0:Q.length)>0?36:0,mainContainerHeader:Ir,mainContainerRef:Je,page:i,pipeline:kn,setAfterHidden:k,setAfterWidthForChildren:_,setErrors:R?L:A,setMainContainerWidth:lt,children:[(0,w.jsx)("div",{style:{height:K?0:null,opacity:K?0:null,visibility:K?"hidden":null},children:(0,w.jsx)(p.Z,{uuid:"PipelineDetail/".concat(g),children:Sr})}),null===Hn||void 0===Hn?void 0:Hn.map((function(e){return(0,w.jsx)("div",{style:{display:K===e?null:"none"},children:(0,w.jsx)(p.Z,{uuid:"FileEditor/".concat(decodeURIComponent(e)),children:(0,w.jsx)(le.Z,{active:K===e,addNewBlock:function(e,n){Xi(e,Zt.length,n,e.name),u.push("/pipelines/".concat(g,"/edit"))},fetchPipeline:bn,fetchVariables:ft,filePath:e,openSidekickView:Vn,pipeline:kn,selectedFilePath:K,sendTerminalMessage:Zr,setDisableShortcuts:me,setErrors:A,setFilesTouched:ce,setSelectedBlock:Ut})})},e)})),(0,w.jsx)(Z.Z,{pb:Un?0:Math.max(Math.floor(m*(2/3)/P.iI),0)})]})]})}eo.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=mt.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 no=(0,kt.Z)(eo)},37958:function(e,n,t){"use strict";t.d(n,{j:function(){return i}});var i=(0,t(44152).r)({apiReloads:{}}).useGlobalState},42305:function(e,n,t){"use strict";t.d(n,{A5:function(){return x},AY:function(){return j},BP:function(){return g},JX:function(){return b},OC:function(){return d},Pc:function(){return y},Ro:function(){return k},Tz:function(){return m},Y_:function(){return O},d$:function(){return v},jV:function(){return Z},lJ:function(){return P},n1:function(){return p},s8:function(){return a},vk:function(){return o},yD:function(){return s}});var i,r,o,l=t(82394),c=t(92083),u=t.n(c);!function(e){e.TODAY="today",e.WEEK="week",e.MONTH="month"}(o||(o={}));var a=(i={},(0,l.Z)(i,o.TODAY,"today"),(0,l.Z)(i,o.WEEK,"last 7 days"),(0,l.Z)(i,o.MONTH,"last 30 days"),i),s=(r={},(0,l.Z)(r,o.TODAY,0),(0,l.Z)(r,o.WEEK,6),(0,l.Z)(r,o.MONTH,29),r),d="YYYY-MM-DD HH:mm:ss",f="YYYY-MM-DD HH:mm",p="YYYY-MM-DD",h="MMMM D, YYYY";function v(e,n){var t=n.dayAgo,i=n.includeSeconds,r=n.utcFormat,o=u()(e),l=f;return r&&(o=o.utc()),t&&(o=o.subtract(1,"days")),i&&(l=d),o.format(l)}function m(e){var n=v((new Date).toISOString(),{includeSeconds:!0,utcFormat:!0});return null!==e&&void 0!==e&&e.dateObj?new Date(n):n}function b(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u().unix(e).format(null!==n&&void 0!==n&&n.withSeconds?d:f)}function g(e,n,t){return u()(e).utc().hours(+n).minutes(+t).format()}function x(e){return u()(e).unix()}function j(e,n,t,i){var r="".concat(e.toISOString().split("T")[0]," ").concat(n,":").concat(t);return i?"".concat(r,":").concat(i):r}function y(e){var n=u().unix(+e).utc();return{date:n.toDate(),hour:String(n.hour()),minute:String(n.minute())}}function k(e,n){var t=u().utc(),i=u().utc();null!==n&&void 0!==n&&n.localTime&&(t=u()().local(),i=u()().local());var r=(t=t.subtract(e,"days")).format(h),o=i.format(h);return null!==n&&void 0!==n&&n.endDateOnly?o:"".concat(r," - ").concat(o)}function Z(e,n){var t=null!==n&&void 0!==n&&n.localTime?u()().local():u().utc();if(e===o.WEEK){var i=s[o.WEEK];t=t.subtract(i,"days")}else if(e===o.MONTH){var r=s[o.MONTH];t=t.subtract(r,"days")}return null!==n&&void 0!==n&&n.isoString?t.startOf("day").toISOString():t.startOf("day").format(d)}function O(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:90,n=new Date,t=[],i=0;i<e;i++)t.unshift(n.toISOString().split("T")[0]),n.setDate(n.getDate()-1);return t}function P(e){return e.padStart(2,"0")}},76419:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pipelines/[pipeline]/edit",function(){return t(72555)}])}},function(e){e.O(0,[3662,844,9902,426,1774,8792,8789,4259,5896,7849,9055,2714,7011,5872,2991,1424,1005,7815,3654,8952,7722,4822,1484,2485,6299,437,9774,2888,179],(function(){return n=76419,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
|