(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6446],{26597:function(n,e,t){"use strict";t.r(e),t.d(e,{default:function(){return N}});var i=t(27812),r=t(50029),s=t(87794),o=t.n(s),u=t(23256),a=t(44359),c=t(66752),l=t(11163),d=t(67294),f=t(97142),p=t(18459),x=t(70783),v=t(20095),h=t(24226),j=t(52313),_=t(53700),y=t(9613),S=t(78860),T=t(93860),A=t(4043),C=t(95693),m=t(98643),g=t(85130),E=t(85893),O=function(){var n=(0,f.T)(),e=(0,f.C)(v.ZZ),t=e.connection,i=e.connectionOption,r=(0,d.useState)(void 0),s=r[0],o=r[1],a=(0,d.useState)(""),c=a[0],l=a[1],p=(0,_.hz)().flags.navV2,x=(0,d.useMemo)((function(){return function(){var n=[];return null!==s&&void 0!==s&&s.options&&s.options.forEach((function(e){var i;switch(e){case A.H5.CONNECTOR_PARAMETERS:i={label:e,content:(0,E.jsx)(T.s,{})};break;case A.H5.DATASET_CONFIGURATION:i=null!==t&&void 0!==t&&t.key?{label:e,content:(0,E.jsx)(C.Z,{})}:void 0;break;case A.H5.DSR_CUSTOMIZATION:i=null!==t&&void 0!==t&&t.key?{label:e,content:(0,E.jsx)(m.Z,{})}:void 0}i&&n.push(i)})),n}}),[null===t||void 0===t?void 0:t.key,null===s||void 0===s?void 0:s.options]);return(0,d.useEffect)((function(){if(i){var e=A.IM.find((function(n){return n.type===(null===i||void 0===i?void 0:i.type)}));e&&(o(e),l(e.options[0]),n((0,v.nj)(A.Ss[2])))}return function(){n((0,v.mc)())}}),[i,n]),t&&i?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.X6,{fontSize:"2xl",fontWeight:"semibold",maxHeight:"40px",mb:"4px",whiteSpace:"nowrap",children:(0,E.jsxs)(u.xu,{alignItems:"center",display:"flex",children:[(0,E.jsx)(g.Z,{data:t}),(0,E.jsx)(u.xv,{ml:"8px",children:t.name})]})}),(0,E.jsx)(y.Z,{steps:[A.Ss[0],A.Ss[2]]}),p&&(0,E.jsx)(u.gC,{alignItems:"stretch",flex:"1",gap:"18px",children:(0,E.jsx)(j.Z,{data:x(),flexGrow:1,isLazy:!0})}),!p&&(0,E.jsxs)(u.kC,{flex:"1",gap:"18px",children:[(0,E.jsx)(S.Z,{menuOptions:(null===s||void 0===s?void 0:s.options)||[],onChange:function(n){l(n)},selectedItem:c||""}),function(){switch(c||""){case A.H5.CONNECTOR_PARAMETERS:return(0,E.jsx)(T.s,{});case A.H5.DATASET_CONFIGURATION:return(0,E.jsx)(C.Z,{});case A.H5.DSR_CUSTOMIZATION:return(0,E.jsx)(m.Z,{});default:return null}}()]})]}):null},w=t(93843),N=function(){var n=(0,f.T)(),e=(0,l.useRouter)(),t=(0,x.VY)().errorAlert,s=(0,f.C)(v.y_),j=(0,d.useState)(!1),_=j[0],y=j[1],S=(0,d.useState)(!0),T=S[0],A=S[1],C=function(n,e){return e.find((function(e){var t;return e.identifier===n.connection_type&&e.identifier!==w.Rj.SAAS||e.identifier===(null===(t=n.saas_config)||void 0===t?void 0:t.type)}))};return(0,d.useEffect)((function(){var u=function(){t("An error occurred while loading ".concat(e.query.id)),e.push(p.JR,void 0,{shallow:!0})},a=function(){var e=(0,r.Z)(o().mark((function e(t){var r,a,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,y(!0),(r=[]).push(n(h.DM.endpoints.getDatastoreConnectionByKey.initiate(t))),0===s.length&&r.push(n(v.d8.endpoints.getAllConnectionTypes.initiate({search:""}))),e.next=7,Promise.allSettled(r);case 7:(a=e.sent).every((function(n){return"fulfilled"===n.status}))?(n((0,v.lm)(a[0].value.data)),c=(0,i.Z)(a[1]?a[1].value.data.items:s),l=C(a[0].value.data,c),n((0,v.yA)(l)),y(!1),A(!1)):u(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),u();case 14:case"end":return e.stop()}}),e,null,[[0,11]])})));return function(n){return e.apply(this,arguments)}}(),c=e.query.id;return c&&!_&&T&&a(c),function(){}}),[s,n,t,_,T,e]),(0,E.jsxs)(E.Fragment,{children:[T&&(0,E.jsx)(u.xu,{display:"flex",h:"100vh",justifyContent:"center",children:(0,E.jsx)(u.M5,{children:(0,E.jsx)(a.$,{})})}),!T&&(0,E.jsx)(c.Z,{children:(0,E.jsx)(O,{})})]})}},92304:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/datastore-connection/[id]",function(){return t(26597)}])}},function(n){n.O(0,[5372,7601,2890,6211,440,5657,4,1144,9816,6894,1272,2698,6508,4777,9774,2888,179],(function(){return e=92304,n(n.s=e);var e}));var e=n.O();_N_E=e}]);