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