"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4704],{2141:(e,a,t)=>{t.d(a,{L:()=>g,q:()=>h});var n=t(7552),o=t(68446),i=t(29499),r=t(58507),s=t(5401),l=t(36422),c=t(49823),m=t(42489),d=t(99546),p=t(33371),w=t(32808);const b=(0,t(75785).n9)()({block:{display:"block"}});function v({checked:e,disabled:a,label:t,onChange:o}){const{classes:i}=b();return n.createElement(p.A,{disabled:a,className:i.block,control:n.createElement(w.A,{checked:e,onChange:o}),label:t})}function y(e){return e.map((({id:e,displays:a,...t})=>({...t,displays:a.map((({id:e,...a})=>a))})))}const g=(0,o.observer)((function({model:e,handleClose:a,feature:t,assemblyName:o,viewType:p,view:w}){const[b,g]=(0,n.useState)(!0),[k,h]=(0,n.useState)(!0);return n.createElement(c.Dialog,{open:!0,onClose:a,title:"Multi-level breakpoint split view options"},n.createElement(i.A,null,n.createElement(v,{checked:b,label:"Copy tracks into the new view",onChange:e=>{g(e.target.checked)}}),b?n.createElement(v,{checked:k,disabled:!b,label:"Mirror the copied tracks (only available if copying tracks and using two level)",onChange:e=>{h(e.target.checked)}}):null),n.createElement(r.A,null,n.createElement(s.A,{onClick:()=>{(async()=>{const a=(0,d.getSession)(e);try{const e=await a.assemblyManager.waitForAssembly(o);if(!e)throw new Error(`assembly ${o} not found`);const{refName:n,pos:i,mateRefName:r,matePos:s}=p.getBreakendCoveringRegions({feature:t,assembly:e}),c=(0,l.getSnapshot)(w.tracks),d=a.addView("BreakpointSplitView",{type:"BreakpointSplitView",displayName:`${t.get("name")||t.get("id")||"breakend"} split detail`,views:[{type:"LinearGenomeView",hideHeader:!0,tracks:y((0,l.getSnapshot)(w.tracks))},{type:"LinearGenomeView",hideHeader:!0,tracks:y(k?[...c].reverse():c)}]}),b=e.regions.find((e=>e.refName===n)),v=e.regions.find((e=>e.refName===r));if(!b||!v)throw new Error("can't find regions");await Promise.all([d.views[0].navToLocations([{refName:n,start:b.start,end:i,assemblyName:o},{refName:n,start:i+1,end:b.end,assemblyName:o}]),d.views[1].navToLocations([{refName:r,start:v.start,end:s,assemblyName:o},{refName:r,start:s+1,end:v.end,assemblyName:o}])]),await(0,m.when)((()=>d.views[1].initialized&&d.views[0].initialized)),d.views[1].zoomTo(10),d.views[0].zoomTo(10),d.views[1].centerAt(s,r),d.views[0].centerAt(i,n)}catch(e){console.error(e),a.notify(`${e}`)}})(),a()},variant:"contained",color:"primary",autoFocus:!0},"OK"),n.createElement(s.A,{color:"secondary",variant:"contained",onClick:()=>{a()}},"Cancel")))}));var k=t(1343);const h=(0,o.observer)((function({model:e,handleClose:a,feature:t,assemblyName:o,viewType:m,view:p}){const[w,b]=(0,n.useState)(!0),[y,g]=(0,d.useLocalStorage)("breakpointWindowSize","5000");return n.createElement(c.Dialog,{open:!0,onClose:a,title:"Single-level breakpoint split view options"},n.createElement(i.A,null,n.createElement(v,{checked:w,label:"Copy tracks into the new view",onChange:e=>{b(e.target.checked)}}),n.createElement(k.A,{label:"Window size (bp)",value:y,onChange:e=>{g(e.target.value)}})),n.createElement(r.A,null,n.createElement(s.A,{onClick:()=>{const n=(0,d.getSession)(e);(async()=>{try{const a=n.assemblyManager.get(o),i=+y;if(Number.isNaN(i))throw new Error("windowSize not a number");const{refName:r,pos:s,mateRefName:c,matePos:w}=m.getBreakendCoveringRegions({feature:t,assembly:a}),b=n.addView("BreakpointSplitView",{type:"BreakpointSplitView",displayName:`${t.get("name")||t.get("id")||"breakend"} split detail`,views:[{type:"LinearGenomeView",tracks:(e=(0,l.getSnapshot)(p.tracks),e.map((({id:e,displays:a,...t})=>({...t,displays:a.map((({id:e,...a})=>a))}))))}]});await b.views[0].navToLocations((0,d.gatherOverlaps)([{refName:r,start:Math.max(0,s-i),end:s+i,assemblyName:o},{refName:c,start:Math.max(0,w-i),end:w+i,assemblyName:o}],i))}catch(e){console.error(e),n.notify(`${e}`)}var e})(),a()},variant:"contained",color:"primary",autoFocus:!0},"OK"),n.createElement(s.A,{color:"secondary",variant:"contained",onClick:()=>{a()}},"Cancel")))}))},84704:(e,a,t)=>{t.r(a),t.d(a,{default:()=>n.L});var n=t(2141)}}]);
//# sourceMappingURL=4704.9b3995ff.chunk.js.map