"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[6935],{66935:function(e,t,n){n.r(t);var r=n(32723),a=n(34795),o=n(96234),c=n(33028),i=n(96902),s=n(52),l=n(80367),u=n(32114),d=n(35388),p=n(63348),f=n(6880),h=n(91188),m=n(4782),v=n(42054),x=n(21051),g=n.n(x),j=n(73636),w=n.n(j),Z=n(42526),S=n(24793),b=n(29938),k=(0,h.ZL)()({compact:{paddingRight:0,paddingTop:0,paddingBottom:0}}),y=["clipPos","flags"];function C(e){var t=k().classes,n=e.feature.flags;return(0,b.jsxs)(Z.BaseCard,(0,c.Z)((0,c.Z)({},e),{},{title:"Flags",children:[(0,b.jsx)(Z.SimpleValue,{name:"Flag",value:n}),(0,b.jsx)(s.Z,{children:["read paired","read mapped in proper pair","read unmapped","mate unmapped","read reverse strand","mate reverse strand","first in pair","second in pair","not primary alignment","read fails platform/vendor quality checks","read is PCR or optical duplicate","supplementary alignment"].map((function(e,r){var a=n&1<<r,o="".concat(e,"_").concat(a);return(0,b.jsx)(l.Z,{control:(0,b.jsx)(u.Z,{className:t.compact,checked:Boolean(a),name:e,readOnly:!0}),label:e},o)}))})]}))}function _(e){var t=e.value,n=(0,i.useState)(!1),r=(0,o.Z)(n,2),a=r[0],c=r[1],s=(0,i.useState)(!1),l=(0,o.Z)(s,2),u=l[0],d=l[1],p=String(t);return p.length>100?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",onClick:function(){g()(p),d(!0),setTimeout((function(){d(!1)}),700)},children:u?"Copied to clipboard":"Copy"}),(0,b.jsx)("button",{type:"button",onClick:function(){return c((function(e){return!e}))},children:a?"Show less":"Show more"}),(0,b.jsx)("div",{children:a?p:"".concat(p.slice(0,100),"...")})]}):(0,b.jsx)("div",{children:p})}function L(e){var t=e.tag,n=e.model,i=(0,v.getSession)(n);return(0,b.jsxs)(Z.BaseCard,(0,c.Z)((0,c.Z)({},e),{},{title:"Supplementary alignments",children:[(0,b.jsx)(d.Z,{children:"List of supplementary alignment locations"}),(0,b.jsx)("ul",{children:t.split(";").filter((function(e){return!!e})).map((function(e,t){var c=e.split(","),s=(0,o.Z)(c,4),l=s[0],u=s[1],d=s[2],f=function(e){for(var t=(0,S.hs)(e),n=0,r=0;r<t.length;r+=2){var a=+t[r],o=t[r+1];"H"!==o&&"S"!==o&&"I"!==o&&(n+=a)}return n}(s[3]),h=Math.floor(f/5),m=+u,v=+u+f,x="".concat(l,":").concat(Math.max(1,m-h),"-").concat(v+h),g=m.toLocaleString("en-US"),j=v.toLocaleString("en-US"),w="".concat(l,":").concat(g,"-").concat(j," (").concat(d,")");return(0,b.jsx)("li",{children:(0,b.jsx)(p.Z,{onClick:function(){var e=(0,a.Z)((0,r.Z)().mark((function e(t){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.preventDefault(),a=n.view,e.prev=2,!a){e.next=8;break}return e.next=6,a.navToLocString(x);case 6:e.next=9;break;case 8:throw new Error("No view associated with this view anymore");case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(2),console.error(e.t0),i.notify("".concat(e.t0));case 15:case"end":return e.stop()}}),e,null,[[2,11]])})));return function(t){return e.apply(this,arguments)}}(),href:"#",children:w})},"".concat(x,"-").concat(t))}))})]}))}function B(e){var t=e.locString,n=e.model,o=(0,v.getSession)(n);return(0,b.jsx)(p.Z,{onClick:(0,a.Z)((0,r.Z)().mark((function e(){var a;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.view){e.next=3;break}throw new Error("No view associated with this feature detail panel anymore");case 3:return e.prev=3,e.next=6,a.navToLocString(t);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0),o.notify("".concat(e.t0));case 12:case"end":return e.stop()}}),e,null,[[3,8]])}))),href:"#",children:t})}t.default=(0,m.observer)((function(e){var t=e.model,n=w()(t.featureData),r=n.tags&&n.tags.SA||n.SA;return(0,b.jsxs)(f.Z,{"data-testid":"alignment-side-drawer",children:[(0,b.jsx)(Z.FeatureDetails,(0,c.Z)((0,c.Z)({},e),{},{omit:y,feature:n,formatter:function(e,n){return"next_segment_position"===n?(0,b.jsx)(B,{model:t,locString:e}):(0,b.jsx)(_,{value:e})}})),r?(0,b.jsx)(L,{model:t,tag:r}):null,void 0!==n.flags?(0,b.jsx)(C,(0,c.Z)({feature:n},e)):null]})}))}}]);
//# sourceMappingURL=6935.db52c79b.chunk.js.map