import{u as h,r as s,R as e,b as p,E as z,M as r,I as F,J as N,F as b,K as w,a as y,N as R,G as D}from"./rpcWorker-CVTx5FIM.js";function G(){return e.createElement("div",null,e.createElement(R,{size:20,style:{marginRight:20}}),e.createElement(b,{display:"inline"},"Creating SVG"))}function o(n,a){return h.useLocalStorage(`svg-${n}`,a)}function c({children:n,...a}){return e.createElement("div",null,e.createElement(D,{...a},n))}function O({model:n,handleClose:a}){const l=h.getSession(n),i=typeof OffscreenCanvas<"u",[u,C]=s.useState(i),[S,m]=s.useState(!1),[g,f]=s.useState(),[E,x]=o("file","jbrowse.svg"),[v,k]=o("tracklabels","offset"),[d,L]=o("theme",l.themeName||"default");return e.createElement(p.Dialog,{open:!0,onClose:a,title:"Export SVG"},e.createElement(z,null,g?e.createElement(p.ErrorMessage,{error:g}):S?e.createElement(G,null):null,e.createElement(c,{helperText:"filename",value:E,onChange:t=>{x(t.target.value)}}),e.createElement(c,{select:!0,label:"Track label positioning",variant:"outlined",style:{width:150},value:v,onChange:t=>{k(t.target.value)}},e.createElement(r,{value:"offset"},"Offset"),e.createElement(r,{value:"overlay"},"Overlay"),e.createElement(r,{value:"left"},"Left"),e.createElement(r,{value:"none"},"None")),l.allThemes?e.createElement(c,{select:!0,label:"Theme",variant:"outlined",value:d,onChange:t=>{L(t.target.value)}},Object.entries(l.allThemes()).map(([t,T])=>e.createElement(r,{key:t,value:t},T.name||"(Unknown name)"))):null,i?e.createElement(F,{control:e.createElement(N,{checked:u,onChange:()=>{C(t=>!t)}}),label:"Rasterize canvas based tracks? File may be much larger if this is turned off"}):e.createElement(b,null,"Note: rasterizing layers not yet supported in this browser, so SVG size may be large")),e.createElement(w,null,e.createElement(y,{variant:"contained",color:"secondary",onClick:()=>{a()}},"Cancel"),e.createElement(y,{variant:"contained",color:"primary",type:"submit",onClick:async()=>{m(!0),f(void 0);try{await n.exportSvg({rasterizeLayers:u,filename:E,trackLabels:v,themeName:d}),a()}catch(t){console.error(t),f(t)}finally{m(!1)}}},"Submit")))}export{O as default};
