"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[9589],{69589:function(n,e,t){t.r(e),t.d(e,{default:function(){return T}});var o=t(96234),c=t(96902),i=t(27664),r=t(72988),a=t(79745),s=t(48182),l=t(69113),u=t(84051),d=t(96565),p=t(91188),f=t(4782),m=t(29291),h=t(18849),g=t(29938),x=(0,f.observer)((function(n){var e=n.connectionType,t=n.model,o=n.session,i=e.configEditorComponent||m.wP;return(0,g.jsx)(c.Suspense,{fallback:(0,g.jsx)(h.LoadingEllipses,{}),children:(0,g.jsx)(i,{model:{target:t},session:o})})})),C=t(60916),j=t(3915),v=t(5792),b=t(16403);var Z=function(n){var e=n.connectionTypeChoices,t=n.connectionType,o=n.setConnectionType;return(0,c.useEffect)((function(){t||o(e[0])})),(0,g.jsx)("form",{autoComplete:"off",children:t?(0,g.jsx)(C.Z,{value:t.name,label:"connectionType",helperText:t.description?(0,g.jsxs)(g.Fragment,{children:[t.description,t.url?(0,g.jsx)(j.Z,{href:t.url,rel:"noopener noreferrer",target:"_blank",color:"secondary",children:(0,g.jsx)(b.Z,{})}):null]}):null,select:!0,fullWidth:!0,onChange:function(n){return o(e.find((function(e){return e.name===n.target.value})))},variant:"outlined",children:e.map((function(n){return(0,g.jsx)(v.Z,{value:n.name,children:n.displayName||n.name},n.name)}))}):null})},k=(0,p.ZL)()((function(n){return{root:{marginTop:n.spacing(1)},stepper:{backgroundColor:n.palette.background.default},button:{marginTop:n.spacing(1),marginRight:n.spacing(1)},actionsContainer:{marginBottom:n.spacing(2)}}})),y=["Select a Connection Type","Configure Connection"];var T=(0,f.observer)((function(n){var e=n.model,t=(0,c.useState)(),p=(0,o.Z)(t,2),f=p[0],m=p[1],h=(0,c.useState)(),C=(0,o.Z)(h,2),j=C[0],v=C[1],b=(0,c.useState)(0),T=(0,o.Z)(b,2),w=T[0],N=T[1],S=k().classes,E=(0,i.getSession)(e),_=(0,i.getEnv)(E).pluginManager;function B(){switch(w){case 0:return(0,g.jsx)(Z,{connectionTypeChoices:_.getElementTypesInGroup("connection"),connectionType:f,setConnectionType:function(n){m(n),n&&v(n.configSchema.create({connectionId:"".concat(n.name,"-").concat(Date.now())},(0,i.getEnv)(e)))}});case 1:return f&&j?(0,g.jsx)(x,{connectionType:f,model:j,session:E}):null;default:return(0,g.jsx)(r.Z,{children:"Unknown step"})}}function I(){w===y.length-1?function(){var n=E.addConnectionConf(j);E.makeConnection&&E.makeConnection(n);E.hideWidget(e)}():N(w+1)}function L(){N(w-1)}return(0,g.jsx)("div",{className:S.root,children:(0,g.jsx)(a.Z,{className:S.stepper,activeStep:w,orientation:"vertical",children:y.map((function(n){return(0,g.jsxs)(s.Z,{children:[(0,g.jsx)(l.Z,{children:n}),(0,g.jsxs)(u.Z,{children:[B(),(0,g.jsxs)("div",{className:S.actionsContainer,children:[(0,g.jsx)(d.Z,{disabled:0===w,onClick:L,className:S.button,children:"Back"}),(0,g.jsx)(d.Z,{disabled:!(0===w&&f||1===w&&j),variant:"contained",color:"primary",onClick:I,className:S.button,"data-testid":"addConnectionNext",children:w===y.length-1?"Connect":"Next"})]})]})]},n)}))})})}))}}]);
//# sourceMappingURL=9589.35d0cc4e.chunk.js.map