"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5243],{15243:(e,n,s)=>{s.r(n),s.d(n,{default:()=>y});var r=s(67758),a=s(7552),l=s(67112),t=s(99546),i=s(44928),o=s(61282),c=s(93062),h=s(76218),d=s(10240),u=s(7946),m=s(22762),j=s(30698),x=s(69092),g=s(69500);function b(){const e=(0,r.c)(1);let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,g.jsxs)("div",{children:[(0,g.jsx)(i.A,{size:20,style:{marginRight:20}}),(0,g.jsx)(o.A,{display:"inline",children:"Creating SVG"})]}),e[0]=n):n=e[0],n}function f(e){const n=(0,r.c)(6);let s,a,l;return n[0]!==e?(({children:s,...a}=e),n[0]=e,n[1]=s,n[2]=a):(s=n[1],a=n[2]),n[3]!==s||n[4]!==a?(l=(0,g.jsx)("div",{children:(0,g.jsx)(c.A,{...a,children:s})}),n[3]=s,n[4]=a,n[5]=l):l=n[5],l}function v(e,n){return(0,t.useLocalStorage)(`svg-${e}`,n)}function y({model:e,handleClose:n}){const s=(0,t.getSession)(e),r="undefined"!=typeof OffscreenCanvas,[i,c]=(0,a.useState)(r),[y,p]=(0,a.useState)(!1),[C,A]=(0,a.useState)(),[S,w]=v("file","jbrowse.svg"),[k,T]=v("theme",s.themeName||"default");return(0,g.jsxs)(l.Dialog,{open:!0,onClose:n,title:"Export SVG",children:[(0,g.jsxs)(h.A,{children:[C?(0,g.jsx)(l.ErrorMessage,{error:C}):y?(0,g.jsx)(b,{}):null,(0,g.jsx)(f,{helperText:"filename",value:S,onChange:e=>{w(e.target.value)}}),s.allThemes?(0,g.jsx)(f,{select:!0,label:"Theme",value:k,onChange:e=>{T(e.target.value)},children:Object.entries(s.allThemes()).map(([e,n])=>(0,g.jsx)(d.A,{value:e,children:n.name||"(Unknown name)"},e))}):null,r?(0,g.jsx)(u.A,{control:(0,g.jsx)(m.A,{checked:i,onChange:()=>{c(e=>!e)}}),label:"Rasterize canvas based tracks? File may be much larger if this is turned off"}):(0,g.jsx)(o.A,{children:"Note: rasterizing layers not yet supported in this browser, so SVG size may be large"})]}),(0,g.jsxs)(j.A,{children:[(0,g.jsx)(x.A,{variant:"contained",color:"secondary",onClick:()=>{n()},children:"Cancel"}),(0,g.jsx)(x.A,{variant:"contained",color:"primary",type:"submit",onClick:async()=>{p(!0),A(void 0);try{await e.exportSvg({rasterizeLayers:i,filename:S,themeName:k}),n()}catch(e){console.error(e),A(e)}finally{p(!1)}},children:"Submit"})]})]})}}}]);
//# sourceMappingURL=5243.b694d044.chunk.js.map