"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[1732],{51732:function(n,e,t){t.r(e),t.d(e,{default:function(){return y}});var o=t(96234),c=t(30969),i=t(81073),r=t(70054),a=t(75041),s=t(165),l=t(68595),u=t(89053),d=t(69852),p=t(2374),f=t(90550),m=t(56699),h=t(37574),g=(0,f.observer)((function(n){var e=n.connectionType,t=n.model,o=n.session,i=e.configEditorComponent||m.wP;return(0,h.jsx)(c.Suspense,{fallback:(0,h.jsx)("div",{children:"Loading..."}),children:(0,h.jsx)(i,{model:{target:t},session:o})})})),x=t(35436),C=t(66581),j=t(28712),v=t(16374);var b=function(n){var e=n.connectionTypeChoices,t=n.connectionType,o=n.setConnectionType;return(0,c.useEffect)((function(){t||o(e[0])})),(0,h.jsx)("form",{autoComplete:"off",children:t?(0,h.jsx)(x.Z,{value:t.name,label:"connectionType",helperText:t.description?(0,h.jsxs)(h.Fragment,{children:[t.description,t.url?(0,h.jsx)(C.Z,{href:t.url,rel:"noopener noreferrer",target:"_blank",color:"secondary",children:(0,h.jsx)(v.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,h.jsx)(j.Z,{value:n.name,children:n.displayName||n.name},n.name)}))}):null})},Z=(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)}}})),k=["Select a Connection Type","Configure Connection"];var y=(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],x=(0,c.useState)(),C=(0,o.Z)(x,2),j=C[0],v=C[1],y=(0,c.useState)(0),T=(0,o.Z)(y,2),w=T[0],N=T[1],S=Z().classes,E=(0,i.getSession)(e),_=(0,i.getEnv)(E).pluginManager;function B(){switch(w){case 0:return(0,h.jsx)(b,{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,h.jsx)(g,{connectionType:f,model:j,session:E}):null;default:return(0,h.jsx)(r.Z,{children:"Unknown step"})}}function I(){w===k.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,h.jsx)("div",{className:S.root,children:(0,h.jsx)(a.Z,{className:S.stepper,activeStep:w,orientation:"vertical",children:k.map((function(n){return(0,h.jsxs)(s.Z,{children:[(0,h.jsx)(l.Z,{children:n}),(0,h.jsxs)(u.Z,{children:[B(),(0,h.jsxs)("div",{className:S.actionsContainer,children:[(0,h.jsx)(d.Z,{disabled:0===w,onClick:L,className:S.button,children:"Back"}),(0,h.jsx)(d.Z,{disabled:!(0===w&&f||1===w&&j),variant:"contained",color:"primary",onClick:I,className:S.button,"data-testid":"addConnectionNext",children:w===k.length-1?"Connect":"Next"})]})]})]},n)}))})})}))}}]);
//# sourceMappingURL=1732.06ede869.chunk.js.map