import{m as x,o as P,r as n,u as y,R as e,b as D,E as R,al as m,G as d,ai as A,ap as L,K as M,a as p}from"./rpcWorker-CVTx5FIM.js";import{E as N}from"./ExpandMore-B1KmAxpc.js";const O=x()(a=>({dialogContent:{display:"flex",flexDirection:"column"},expand:{transform:"rotate(0deg)",marginLeft:"auto",transition:a.transitions.create("transform",{duration:a.transitions.duration.shortest})},expandOpen:{transform:"rotate(180deg)"}})),I=P(function({onClose:a,model:E}){const{classes:l,cx:f}=O(),[o,b]=n.useState(""),[i,h]=n.useState(""),[s,v]=n.useState(""),[r,C]=n.useState(""),[u,S]=n.useState(!1),{jbrowse:c}=y.getSession(E),U=!!(o&&i||s||r);function g(){o&&i?c.addPlugin({name:o,umdUrl:i}):s?c.addPlugin({esmUrl:s}):r&&c.addPlugin({cjsUrl:r})}return e.createElement(D.Dialog,{open:!0,onClose:a,title:"Add custom plugin"},e.createElement("form",{onSubmit:g},e.createElement(R,{className:l.dialogContent},e.createElement(m,null,"Enter the name of the plugin and its URL. The name should match what is defined in the plugin's build."),e.createElement(d,{label:"Plugin name",variant:"outlined",value:o,onChange:t=>{b(t.target.value)}}),e.createElement(d,{label:"Plugin URL",variant:"outlined",value:i,onChange:t=>{h(t.target.value)}}),e.createElement(m,{onClick:()=>{S(!u)}},e.createElement(A,{className:f(l.expand,{[l.expandOpen]:u}),"aria-expanded":u,"aria-label":"show more"},e.createElement(N,null)),"Advanced options"),e.createElement(L,{in:u},e.createElement("div",{className:l.dialogContent},e.createElement(m,null,"The above fields assume that the plugin is built in UMD format. If your plugin is in another format, or you have additional builds you want to add (such as a CJS build for using NodeJS APIs in desktop), you can enter the URLs for those builds below."),e.createElement(d,{label:"ESM build URL",variant:"outlined",value:s,onChange:t=>{v(t.target.value)}}),e.createElement(d,{label:"CJS build URL",variant:"outlined",value:r,onChange:t=>{C(t.target.value)}})))),e.createElement(M,null,e.createElement(p,{variant:"contained",onClick:a},"Cancel"),e.createElement(p,{variant:"contained",color:"primary",onClick:g,disabled:!U},"Submit"))))});export{I as default};
