"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[9667],{79667:(e,t,r)=>{r.r(t),r.d(t,{default:()=>y});var a=r(66204),n=r(38684),s=r(29520),o=r(80013),i=r(82051),l=r(10126),c=r(46338),d=r(53447),m=r(39780),u=r(70539),h=r(62301),f=r(7146),p=r(80846),g=r(78937),b=r(36349),v=r(43306),x=r.n(v),Z=r(43902),k=r(31211),w=r(19609),S=r(8459);const C=(0,n.ZL)()({dialogContent:{width:"80em"},textAreaFont:{fontFamily:"Courier New"}}),y=(0,p.observer)((function({model:e,handleClose:t}){const{classes:r}=C(),n=(0,k.getSession)(e),[p,v]=(0,a.useState)(),[y,E]=(0,a.useState)(),[$,R]=(0,a.useState)(!1),[W,M]=(0,a.useState)(!1),[N,P]=(0,a.useState)(!1),{leftOffset:q,rightOffset:G}=e,j=Boolean(void 0===y);(0,a.useEffect)((()=>{let t=!0;const r=new AbortController;return(async()=>{try{const a=e.getSelectedRegions(q,G);if(0===a.length)throw new Error("Selected region is out of bounds");const n=await async function(e,t,r){const a=(0,k.getSession)(e),{leftOffset:n,rightOffset:s}=e;if(!n||!s)throw new Error("no offsets on model to use for range");if(n.assemblyName!==s.assemblyName)throw new Error("not able to fetch sequences from multiple assemblies");const{rpcManager:o,assemblyManager:i}=a,l=n.assemblyName||s.assemblyName||"",c=i.get(l);if(!c)throw new Error(`assembly ${l} not found`);const d=(0,b.getConf)(c,["sequence","adapter"]),m="getSequence";return o.call(m,"CoreGetFeatures",{adapterConfig:d,regions:t,sessionId:m,signal:r})}(e,a,r.signal);t&&E(n)}catch(e){console.error(e),t&&v(e)}})(),()=>{r.abort(),t=!1}}),[e,n,q,G]);const A=y?y.filter((e=>!!e)).map((e=>{let t=e.get("seq");const r=e.get("refName"),a=e.get("start")+1,n=e.get("end"),s=`${r}:${a}-${n}`;if(t?.length!==n-a+1)throw new Error(`${s} returned ${t.length.toLocaleString()} bases, but should have returned ${(n-a).toLocaleString()}`);return $&&(t=(0,k.reverse)(t)),N&&(t=(0,k.complement)(t)),{header:s+($?"-rev":"")+(N?"-comp":""),seq:t}})).map((e=>{return`>${e.header}\n${t=e.seq,t.replaceAll(/(.{1,80})/g,"$1\n").trimEnd()}`;var t})).join("\n"):"",D=!!A&&A.length>1e6;return a.createElement(Z.Dialog,{maxWidth:"xl",open:!0,onClose:()=>{t(),e.setOffsets()},title:"Reference sequence"},a.createElement(s.Z,null,p?a.createElement(o.Z,{color:"error"},`${p}`):j?a.createElement(i.Z,null,"Retrieving reference sequence...",a.createElement(l.Z,{style:{marginLeft:10},size:20,disableShrink:!0})):null,a.createElement(c.Z,{"data-testid":"rubberband-sequence",variant:"outlined",multiline:!0,minRows:5,maxRows:10,disabled:D,className:r.dialogContent,fullWidth:!0,value:D?"Reference sequence too large to display, use the download FASTA button":A,InputProps:{readOnly:!0,classes:{input:r.textAreaFont}}}),a.createElement(d.Z,null,a.createElement(m.Z,{control:a.createElement(u.Z,{value:$,onChange:e=>R(e.target.checked)}),label:"Reverse sequence"}),a.createElement(m.Z,{control:a.createElement(u.Z,{value:N,onChange:e=>P(e.target.checked)}),label:"Complement sequence"})),a.createElement(o.Z,{style:{margin:10}},'Note: Check both boxes for the "reverse complement"')),a.createElement(h.Z,null,a.createElement(f.Z,{onClick:()=>{x()(A),M(!0),setTimeout((()=>M(!1)),500)},disabled:j||!!p||D,color:"primary",startIcon:a.createElement(w.pt,null)},W?"Copied":"Copy to clipboard"),a.createElement(f.Z,{onClick:()=>{(0,g.saveAs)(new Blob([A||""],{type:"text/x-fasta;charset=utf-8"}),"jbrowse_ref_seq.fa")},disabled:j||!!p,color:"primary",startIcon:a.createElement(S.Z,null)},"Download FASTA"),a.createElement(f.Z,{onClick:t,variant:"contained"},"Close")))}))},8459:(e,t,r)=>{var a=r(57739);t.Z=void 0;var n=a(r(53948)),s=r(43188),o=(0,n.default)((0,s.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}),"GetApp");t.Z=o},10126:(e,t,r)=>{r.d(t,{Z:()=>y});var a=r(55559),n=r(30984),s=r(66204),o=r(56317),i=r(58029),l=r(71580),c=r(40118),d=r(57369),m=r(61125),u=r(22489),h=r(43188);const f=["className","color","disableShrink","size","style","thickness","value","variant"];let p,g,b,v,x=e=>e;const Z=(0,l.F4)(p||(p=x`
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
`)),k=(0,l.F4)(g||(g=x`
  0% {
    stroke-dasharray: 1px, 200px;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 100px, 200px;
    stroke-dashoffset: -15px;
  }

  100% {
    stroke-dasharray: 100px, 200px;
    stroke-dashoffset: -125px;
  }
`)),w=(0,m.ZP)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.variant],t[`color${(0,c.Z)(r.color)}`]]}})((({ownerState:e,theme:t})=>(0,n.Z)({display:"inline-block"},"determinate"===e.variant&&{transition:t.transitions.create("transform")},"inherit"!==e.color&&{color:(t.vars||t).palette[e.color].main})),(({ownerState:e})=>"indeterminate"===e.variant&&(0,l.iv)(b||(b=x`
      animation: ${0} 1.4s linear infinite;
    `),Z))),S=(0,m.ZP)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),C=(0,m.ZP)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.circle,t[`circle${(0,c.Z)(r.variant)}`],r.disableShrink&&t.circleDisableShrink]}})((({ownerState:e,theme:t})=>(0,n.Z)({stroke:"currentColor"},"determinate"===e.variant&&{transition:t.transitions.create("stroke-dashoffset")},"indeterminate"===e.variant&&{strokeDasharray:"80px, 200px",strokeDashoffset:0})),(({ownerState:e})=>"indeterminate"===e.variant&&!e.disableShrink&&(0,l.iv)(v||(v=x`
      animation: ${0} 1.4s ease-in-out infinite;
    `),k))),y=s.forwardRef((function(e,t){const r=(0,d.Z)({props:e,name:"MuiCircularProgress"}),{className:s,color:l="primary",disableShrink:m=!1,size:p=40,style:g,thickness:b=3.6,value:v=0,variant:x="indeterminate"}=r,Z=(0,a.Z)(r,f),k=(0,n.Z)({},r,{color:l,disableShrink:m,size:p,thickness:b,value:v,variant:x}),y=(e=>{const{classes:t,variant:r,color:a,disableShrink:n}=e,s={root:["root",r,`color${(0,c.Z)(a)}`],svg:["svg"],circle:["circle",`circle${(0,c.Z)(r)}`,n&&"circleDisableShrink"]};return(0,i.Z)(s,u.C,t)})(k),E={},$={},R={};if("determinate"===x){const e=2*Math.PI*((44-b)/2);E.strokeDasharray=e.toFixed(3),R["aria-valuenow"]=Math.round(v),E.strokeDashoffset=`${((100-v)/100*e).toFixed(3)}px`,$.transform="rotate(-90deg)"}return(0,h.jsx)(w,(0,n.Z)({className:(0,o.Z)(y.root,s),style:(0,n.Z)({width:p,height:p},$,g),ownerState:k,ref:t,role:"progressbar"},R,Z,{children:(0,h.jsx)(S,{className:y.svg,ownerState:k,viewBox:"22 22 44 44",children:(0,h.jsx)(C,{className:y.circle,style:E,ownerState:k,cx:44,cy:44,r:(44-b)/2,fill:"none",strokeWidth:b})})}))}))},22489:(e,t,r)=>{r.d(t,{C:()=>s,Z:()=>o});var a=r(58109),n=r(95201);function s(e){return(0,n.Z)("MuiCircularProgress",e)}const o=(0,a.Z)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"])},82051:(e,t,r)=>{r.d(t,{Z:()=>w});var a=r(55559),n=r(30984),s=r(66204),o=r(56317),i=r(46730),l=r(95201),c=r(58029),d=r(77877),m=r(605),u=r(71684),h=r(43188);const f=["className","component","disableGutters","fixed","maxWidth","classes"],p=(0,u.Z)(),g=(0,m.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[`maxWidth${(0,i.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),b=e=>(0,d.Z)({props:e,name:"MuiContainer",defaultTheme:p});var v=r(40118),x=r(61125),Z=r(57369);const k=function(e={}){const{createStyledComponent:t=g,useThemeProps:r=b,componentName:d="MuiContainer"}=e,m=t((({theme:e,ownerState:t})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}})),(({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce(((t,r)=>{const a=r,n=e.breakpoints.values[a];return 0!==n&&(t[e.breakpoints.up(a)]={maxWidth:`${n}${e.breakpoints.unit}`}),t}),{})),(({theme:e,ownerState:t})=>(0,n.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}}))),u=s.forwardRef((function(e,t){const s=r(e),{className:u,component:p="div",disableGutters:g=!1,fixed:b=!1,maxWidth:v="lg"}=s,x=(0,a.Z)(s,f),Z=(0,n.Z)({},s,{component:p,disableGutters:g,fixed:b,maxWidth:v}),k=((e,t)=>{const{classes:r,fixed:a,disableGutters:n,maxWidth:s}=e,o={root:["root",s&&`maxWidth${(0,i.Z)(String(s))}`,a&&"fixed",n&&"disableGutters"]};return(0,c.Z)(o,(e=>(0,l.Z)(t,e)),r)})(Z,d);return(0,h.jsx)(m,(0,n.Z)({as:p,ownerState:Z,className:(0,o.Z)(k.root,u),ref:t},x))}));return u}({createStyledComponent:(0,x.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[`maxWidth${(0,v.Z)(String(r.maxWidth))}`],r.fixed&&t.fixed,r.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.Z)({props:e,name:"MuiContainer"})}),w=k}}]);
//# sourceMappingURL=9667.7dd103bd.chunk.js.map