"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5736],{15736:(e,t,n)=>{n.r(t),n.d(t,{default:()=>y});var s=n(87083),a=n(99546),r=n(7552),l=n(67112),i=n(61282),o=n(65895),c=n(95805),u=n(69500);const f=(0,r.lazy)((()=>n.e(5930).then(n.bind(n,45930)))),d=(0,r.lazy)((()=>n.e(457).then(n.bind(n,80457))));function m({model:e,feature:t}){const{view:n}=e,[s,o]=(0,r.useState)(),[f,d]=(0,r.useState)();(0,r.useEffect)((()=>{(async()=>{try{const e=await async function({view:e,feature:t}){const{assemblyManager:n}=(0,a.getSession)(e),s=t.get("CIGAR"),r=t.get("strand"),l=t.get("tags")?.SA||"",i=t.get("name"),o=(0,c.getClip)(s,1),u=await n.waitForAssembly(e.assemblyNames[0]);if(!u)throw new Error("assembly not found");const f=(0,c.featurizeSA)(l,t.id(),r,i,!0),d=t.toJSON();d.clipPos=o,d.strand=1,d.mate={refName:i,start:o,end:o+(0,c.getLengthSansClipping)(s)};const m=[d,...f];for(const[e,t]of m.entries())t.refName=u.getCanonicalRefName(t.refName)||t.refName,t.syntenyId=e,t.mate.syntenyId=e,t.mate.uniqueId=`${t.uniqueId}_mate`;return m.sort(((e,t)=>e.clipPos-t.clipPos)),m}({view:n,feature:new a.SimpleFeature(t)});o(e)}catch(e){d(e),console.error(e)}})()}),[t,n]);const m=[];if(s)for(let e=0;e<s.length-1;e++)m.push([s[e],s[e+1]]);return m.length?(0,u.jsxs)("div",{children:[(0,u.jsx)(i.A,{children:"Launch split view"}),f?(0,u.jsx)(l.ErrorMessage,{error:f}):null,(0,u.jsx)("ul",{children:m.map(((t,n)=>{const[s,r]=t;return(0,u.jsxs)("li",{children:[s.refName,":",(0,a.toLocale)(1===s.strand?s.end:s.start)," ->"," ",r.refName,":",(0,a.toLocale)(1===r.strand?r.start:r.end)," ",(0,u.jsx)(g,{model:e,f1:s,f2:r})," ",(0,u.jsx)(h,{model:e,f1:s,f2:r})]},`${JSON.stringify(t)}-${n}`)}))})]}):null}function g({model:e,f1:t,f2:n}){return(0,u.jsx)(o.A,{href:"#",onClick:s=>{s.preventDefault();const r=(0,a.getSession)(e);r.queueDialog((s=>[f,{handleClose:s,session:r,feature:new a.SimpleFeature({...t,mate:n}),view:e.view,assemblyName:e.view.displayedRegions[0].assemblyName}]))},children:"(top/bottom)"})}function h({model:e,f1:t,f2:n}){return(0,u.jsx)(o.A,{href:"#",onClick:s=>{s.preventDefault();const r=(0,a.getSession)(e);r.queueDialog((s=>[d,{handleClose:s,session:r,feature:new a.SimpleFeature({...t,mate:n}),view:e.view,assemblyName:e.view.displayedRegions[0].assemblyName}]))},children:"(single row)"})}var p=n(51762);function w({tag:e,model:t}){return(0,u.jsxs)("div",{children:[(0,u.jsx)(i.A,{children:"List of supplementary alignment locations"}),(0,u.jsx)("ul",{children:e.split(";").filter((e=>!!e)).map(((e,n)=>{const[s,a,r,l]=e.split(","),i=(0,c.getLengthOnRef)(l),f=Math.floor(i/5),d=+a,m=+a+i,g=d-f,h=m+f,w=`${s}:${Math.max(1,g)}-${h}`,y=`${s}:${d.toLocaleString("en-US")}-${m.toLocaleString("en-US")} (${r}) [${i}bp]`;return(0,u.jsx)("li",{children:(0,u.jsx)(o.A,{href:"#",onClick:async e=>{e.preventDefault(),(0,p.h)(w,t)},children:y})},`${w}-${n}`)}))})]})}function y(e){const{model:t,tag:n,feature:r}=e,l=(0,a.getSession)(t),{pluginManager:i}=(0,a.getEnv)(l);let o=!1;try{o=!!i.getViewType("BreakpointSplitView")}catch(e){}return(0,u.jsxs)(s.default,{...e,title:"Supplementary alignments",children:[(0,u.jsx)(w,{model:t,tag:n}),o?(0,u.jsx)(m,{model:t,feature:r}):null]})}}}]);
//# sourceMappingURL=5736.c733665c.chunk.js.map