"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[2367],{21016:(t,e,l)=>{l.d(e,{K:()=>f,W:()=>o});var n=l(87485),s=l(46879);function o(t,e,l,s,o,f=!0){if(t===o)return f?"#ccc":"";{let t;if(e&&(t=(0,n.M)(`hsl(200,50%,${80-e/o*50}%)`)),l){const e=`hsla(0,100%,20%,${l/o})`;t=t?t.mix(e):(0,n.M)(e)}if(s){const e=`hsl(50,50%,50%,${s/o})`;t=t?t.mix(e):(0,n.M)(e)}return t?.toHex()||"black"}}function f(t,e,l,o,f,i,c="",a,r=1){e.fillStyle=1!==r?(0,n.M)(t).alpha(r).toHex():t,"inversion"===c?1===a?(e.beginPath(),e.moveTo(l-s.f2,o-s.f2),e.lineTo(l-s.f2,o+i+s.f2),e.lineTo(l+f+s.f2,o+i/2),e.closePath(),e.fill()):(e.beginPath(),e.moveTo(l+f+s.f2,o-s.f2),e.lineTo(l+f+s.f2,o+i+s.f2),e.lineTo(l-s.f2,o+i/2),e.closePath(),e.fill()):e.fillRect(l-s.f2,o-s.f2,f+s.f2,i+s.f2)}},22367:(t,e,l)=>{l.d(e,{makeImageData:()=>a});var n=l(99546),s=l(37347),o=l(46879),f=l(21016),i=l(40171),c=l(85497);async function a({ctx:t,canvasWidth:e,canvasHeight:l,renderArgs:a}){const{renderingMode:r,minorAlleleFrequencyFilter:u,sources:h,features:g,stopToken:d,lengthCutoffFilter:p}=a,{statusCallback:b=()=>{}}=a,k=l/h.length;(0,s.SW)(d);const v=await(0,n.updateStatus)("Calculating stats",b,(()=>(0,c.Cg)({stopToken:d,features:g.values(),minorAlleleFrequencyFilter:u,lengthCutoffFilter:p})));(0,s.SW)(d);const m=[],T=v.length,S=e/T;return await(0,n.updateStatus)("Drawing variant matrix",b,(()=>{const s={};(0,n.forEachWithStopTokenCheck)(v,d,(({feature:n,mostFrequentAlt:c},a)=>{const u=[],g=n.get("FORMAT")?.includes("PS");if(g){const g=n.get("samples"),d=a/v.length*e,p=h.length;for(let e=0;e<p;e++){const n=e/p*l,{name:a,HP:b}=h[e],v=g[a];if(v){const e=v.GT?.[0];if(e){u.push(e);const l=e.includes("|");if("phased"===r)if(l){const l=v.PS?.[0],s=e.split("|");(0,i.E)(s,t,d,n,S,k,b,l)}else t.fillStyle="black",t.fillRect(d-o.f2,n-o.f2,S+o.f2,k+o.f2);else{let l=s[e];if(void 0===l){let t=0,n=0,o=0,i=0;const a=e.split(/[/|]/),r=a.length;for(let e=0;e<r;e++){const l=a[e];l===c?t++:"0"===l?i++:"."===l?n++:o++}l=(0,f.W)(i,t,o,n,r,!0),s[e]=l}l&&(0,f.K)(l,t,d,n,S,k)}}}}}else{const g=n.get("genotypes"),d=a/v.length*e,p=h.length;for(let e=0;e<p;e++){const n=e/p*l,{name:a,HP:b}=h[e],v=g[a];if(v){u.push(v);const e=v.includes("|");if("phased"===r)if(e){const e=v.split("|");(0,i.E)(e,t,d,n,S,k,b)}else t.fillStyle="black",t.fillRect(d-o.f2,n-o.f2,S+o.f2,k+o.f2);else{let e=s[v];if(void 0===e){let t=0,l=0,n=0,o=0;const i=v.split(/[/|]/),a=i.length;for(let e=0;e<a;e++){const s=i[e];s===c?t++:"0"===s?o++:"."===s?l++:n++}e=(0,f.W)(o,t,n,l,a,!0),s[v]=e}e&&(0,f.K)(e,t,d,n,S,k)}}}}m.push(u)}))})),{mafs:v,arr:m}}},40171:(t,e,l)=>{l.d(e,{E:()=>i});var n=l(40898),s=l(87485),o=l(46879),f=l(42268);function i(t,e,l,i,c,a,r,u,h=!0,g=1){const d=void 0!==u?function(t,e,l,n=!0){return+t[e]?(0,f.qH)(+l)||"black":n?"#ccc":void 0}(t,r,u,h):function(t,e,l=!0){const s=+t[e];return s?n.set1[s-1]||"black":l?"#ccc":void 0}(t,r,h);return d&&(e.fillStyle=1!==g?(0,s.M)(d).alpha(g).toHex():d,e.fillRect(l-o.f2,i-o.f2,c+o.f2,a+o.f2)),d}},42268:(t,e,l)=>{function n(t){let e=0;for(let l=0;l<t.length;l++)e+=t.charCodeAt(l);return s(10*e)}function s(t){return`hsl(${t%255}, 50%, 50%)`}l.d(e,{XL:()=>n,qH:()=>s})},46879:(t,e,l)=>{l.d(e,{f2:()=>n});const n=.3}}]);
//# sourceMappingURL=2367.aafa3de6.chunk.js.map