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