"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[2392],{2392:function(e,n,r){r.r(n),r.d(n,{default:function(){return I}});var t=r(68079),i=r(96234),s=r(96902),o=r(36897),a=r(19459),l=r(82658),d=r(13655),c=r(33266),u=r(35388),h=r(15996),g=r(25322),x=r(50543),v=r(5966),f=r(91188),p=r(4782),j=r(27664),w=r(20893),m=r(66379),Z=r(31946),b=r(47057),C=r(21630),k=r(38238),y=r(6880),W=r(54896),z=r(29938),D=(0,f.ZL)()((function(e){return{paper:{overflowY:"auto",height:"100%",zIndex:e.zIndex.drawer,outline:"none",background:e.palette.background.default},resizeHandle:{width:4,position:"fixed",top:0,zIndex:e.zIndex.drawer+1}}}));var H=(0,p.observer)((function(e){var n=e.children,r=e.session,t=r.drawerPosition,i=r.drawerWidth,s=D().classes;return(0,z.jsxs)(y.Z,{className:s.paper,elevation:16,square:!0,children:["right"===t?(0,z.jsx)(W.Z,{onDrag:r.resizeDrawer,className:s.resizeHandle,vertical:!0}):null,n,"left"===t?(0,z.jsx)(W.Z,{onDrag:r.resizeDrawer,className:s.resizeHandle,style:{left:i},vertical:!0}):null]})})),T=(0,f.ZL)()((function(e){return{formControl:{margin:0},spacer:{flexGrow:1},drawerSelect:{margin:0,color:e.palette.secondary.contrastText},dropDownIcon:{color:e.palette.secondary.contrastText},header:{background:e.palette.secondary.main}}})),N=(0,p.observer)((function(e){var n=e.session,r=e.setToolbarHeight,o=(0,j.getEnv)(n).pluginManager,f=n.visibleWidget,p=n.activeWidgets,w=n.drawerPosition,m=T().classes,y=(0,s.useState)(null),W=(0,i.Z)(y,2),D=W[0],H=W[1];return(0,z.jsxs)(a.Z,{position:"sticky",className:m.header,ref:function(e){return r((null===e||void 0===e?void 0:e.getBoundingClientRect().height)||0)},children:[(0,z.jsxs)(l.Z,{disableGutters:!0,children:[(0,z.jsx)(d.Z,{className:m.formControl,children:(0,z.jsx)(c.Z,{value:null===f||void 0===f?void 0:f.id,"data-testid":"widget-drawer-selects",className:m.drawerSelect,classes:{icon:m.dropDownIcon},renderValue:function(e){var r=n.activeWidgets.get(e);if(!r)return(0,z.jsx)(u.Z,{variant:"h6",color:"inherit",children:"Unknown widget"});var t=o.getWidgetType(r.type),i=t.HeadingComponent,s=t.heading;return i?(0,z.jsx)(i,{model:r}):(0,z.jsx)(u.Z,{variant:"h6",color:"inherit",children:s})},onChange:function(e){var r=n.activeWidgets.get(e.target.value);r?n.showWidget(r):n.notify("Widget not found ".concat(e.target.value),"warning")},children:(0,t.Z)(p.values()).map((function(e){var r=o.getWidgetType(e.type),t=r.HeadingComponent,i=r.heading;return(0,z.jsxs)(h.Z,{"data-testid":"widget-drawer-selects-item-".concat(e.type),value:e.id,children:[t?(0,z.jsx)(t,{model:e}):(0,z.jsx)(u.Z,{variant:"h6",color:"inherit",children:i}),(0,z.jsx)(g.Z,{"data-testid":"".concat(e.type,"-drawer-delete"),color:"inherit","aria-label":"Delete",onClick:function(){return n.hideWidget(e)},children:(0,z.jsx)(Z.Z,{})})]},e.id)}))})}),(0,z.jsx)("div",{className:m.spacer}),(0,z.jsxs)("div",{children:[(0,z.jsx)(g.Z,{"data-testid":"drawer-close",color:"inherit",onClick:function(e){return H(e.currentTarget)},children:(0,z.jsx)(k.Z,{})}),(0,z.jsx)(x.Z,{title:"Minimize drawer",children:(0,z.jsx)(g.Z,{"data-testid":"drawer-minimize",color:"inherit",onClick:function(){n.notify("Drawer minimized, click button on ".concat(w," side of screen to re-open"),"info"),n.minimizeWidgetDrawer()},children:(0,z.jsx)(C.Z,{})})}),(0,z.jsx)(x.Z,{title:"Close drawer",children:(0,z.jsx)(g.Z,{"data-testid":"drawer-close",color:"inherit",onClick:function(){return n.hideWidget(f)},children:(0,z.jsx)(b.Z,{})})})]})]}),(0,z.jsx)(v.Z,{anchorEl:D,open:Boolean(D),onClose:function(){return H(null)},children:["left","right"].map((function(e){return(0,z.jsx)(h.Z,{selected:"option"===w,onClick:function(){n.setDrawerPosition(e),H(null)},children:e},e)}))})]})})),I=(0,p.observer)((function(e){var n=e.session,r=n.visibleWidget,t=(0,j.getEnv)(n).pluginManager,a=r?t.evaluateExtensionPoint("Core-replaceWidget",t.getWidgetType(r.type).ReactComponent,{session:n,model:r}):null,l=(0,s.useState)(0),d=(0,i.Z)(l,2),c=d[0],u=d[1];return(0,z.jsxs)(H,{session:n,children:[(0,z.jsx)(N,{session:n,setToolbarHeight:u}),(0,z.jsx)(s.Suspense,{fallback:(0,z.jsx)(w.Z,{}),children:(0,z.jsx)(o.SV,{FallbackComponent:function(e){var n=e.error;return(0,z.jsx)(m.Z,{error:n})},children:a?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{model:r,session:n,toolbarHeight:c}),(0,z.jsx)("div",{style:{height:300}})]}):null})})]})}))}}]);
//# sourceMappingURL=2392.a1fc211e.chunk.js.map