(this["webpackJsonp@jbrowse/web"]=this["webpackJsonp@jbrowse/web"]||[]).push([[42],{2476:function(e,n,t){"use strict";t.r(n);var a=t(83),c=t(84),o=t(2363),r=t(2416),l=t(2419),i=t(2417),u=t(2420),s=t(51),m=t(2364),p=t(85),d=t(88),b=t(1),f=t.n(b),g=t(858),E=Object(p.observer)((function(e){var n=e.connectionType,t=e.model,a=e.setModelReady,c=n.configEditorComponent||g.a;return f.a.createElement(b.Suspense,{fallback:f.a.createElement("div",null,"Loading...")},f.a.createElement(c,{model:{target:t},setModelReady:a}))})),v=t(2368),C=t(2361),y=t(2373),j=t(744),h=t.n(j);var O=function(e){var n=e.connectionTypeChoices,t=e.connectionType,a=e.setConnectionType;return Object(b.useEffect)((function(){t.name||a(n[0])})),t.name?f.a.createElement("form",{autoComplete:"off"},f.a.createElement(y.a,{value:t.name,label:"connectionType",helperText:t.description?f.a.createElement(f.a.Fragment,null,t.description,t.url?f.a.createElement(v.a,{href:t.url,rel:"noopener noreferrer",target:"_blank",color:"secondary"},f.a.createElement(h.a,null)):null):null,select:!0,fullWidth:!0,onChange:function(e){a(n.find((function(n){return n.name===e.target.value})))},variant:"outlined"},n.map((function(e){return f.a.createElement(C.a,{key:e.name,value:e.name},e.displayName||e.name)})))):null},T=Object(s.a)((function(e){return{root:{marginTop:e.spacing(1)},stepper:{backgroundColor:e.palette.background.default},button:{marginTop:e.spacing(1),marginRight:e.spacing(1)},actionsContainer:{marginBottom:e.spacing(2)}}})),k=["Select a Connection Type","Configure Connection"];n.default=Object(p.observer)((function(e){var n=e.model,t=Object(b.useState)({}),s=Object(a.a)(t,2),p=s[0],g=s[1],v=Object(b.useState)({}),C=Object(a.a)(v,2),y=C[0],j=C[1],h=Object(b.useState)(!0),w=Object(a.a)(h,2),S=w[0],N=w[1],M=Object(b.useState)(0),R=Object(a.a)(M,2),x=R[0],B=R[1],I=T(),J=Object(c.getSession)(n),W=Object(d.getEnv)(J).pluginManager;function D(e){g(e),j(e.configSchema.create({connectionId:"".concat(e.name,"-").concat(Date.now())},Object(d.getEnv)(n)))}function F(){x===k.length-1?function(){var e=J.addConnectionConf(y);J.makeConnection(e),J.hideWidget(n)}():B(x+1)}function G(){B(x-1)}return f.a.createElement("div",{className:I.root},f.a.createElement(u.a,{className:I.stepper,activeStep:x,orientation:"vertical"},k.map((function(e){return f.a.createElement(r.a,{key:e},f.a.createElement(i.a,null,e),f.a.createElement(l.a,null,function(){switch(x){case 0:return f.a.createElement(O,{connectionTypeChoices:W.getElementTypesInGroup("connection"),connectionType:p,setConnectionType:D});case 1:return f.a.createElement(E,{connectionType:p,model:y,setModelReady:N});default:return f.a.createElement(m.a,null,"Unknown step")}}(),f.a.createElement("div",{className:I.actionsContainer},f.a.createElement(o.a,{disabled:0===x,onClick:G,className:I.button},"Back"),f.a.createElement(o.a,{disabled:!(0===x&&p.name||1===x&&y&&S),variant:"contained",color:"primary",onClick:F,className:I.button,"data-testid":"addConnectionNext"},x===k.length-1?"Connect":"Next"))))}))))}))}}]);
//# sourceMappingURL=42.526db44a.chunk.js.map