"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[9978],{21016:(e,t,n)=>{n.d(t,{K:()=>r});var o=n(87485),l=n(46879);function r(e,t,n,r,f,i,a,c=!0,s="",u,h=1){const d=function(e,t,n=!0){const l=e.length;let r=0,f=0,i=0,a=0;for(const n of e)n===t?r++:"0"===n?a++:"."===n?f++:i++;if(a===l)return n?"#ccc":void 0;{let e;if(r&&(e=(0,o.M)(`hsl(200,50%,${80-r/l*50}%)`)),i){const t=`hsla(0,100%,20%,${i/l})`;e=e?e.mix(t):(0,o.M)(t)}if(f){const t=`hsl(50,50%,50%,${f/l})`;e=e?e.mix(t):(0,o.M)(t)}return e?.toHex()||"black"}}(e,a,c);return d&&(t.fillStyle=1!==h?(0,o.M)(d).alpha(h).toHex():d,"inversion"===s?1===u?(t.beginPath(),t.moveTo(n-l.f2,r-l.f2),t.lineTo(n-l.f2,r+i+l.f2),t.lineTo(n+f+l.f2,r+i/2),t.closePath(),t.fill()):(t.beginPath(),t.moveTo(n+f+l.f2,r-l.f2),t.lineTo(n+f+l.f2,r+i+l.f2),t.lineTo(n-l.f2,r+i/2),t.closePath(),t.fill()):t.fillRect(n-l.f2,r-l.f2,f+l.f2,i+l.f2)),d}},40171:(e,t,n)=>{n.d(t,{E:()=>i});var o=n(40898),l=n(87485),r=n(46879),f=n(42268);function i(e,t,n,i,a,c,s,u,h=!0,d=1){const g=void 0!==u?function(e,t,n,o=!0){return+e[t]?(0,f.qH)(+n)||"black":o?"#ccc":void 0}(e,s,u,h):function(e,t,n=!0){const l=+e[t];return l?o.set1[l-1]||"black":n?"#ccc":void 0}(e,s,h);return g&&(t.fillStyle=1!==d?(0,l.M)(g).alpha(d).toHex():g,t.fillRect(n-r.f2,i-r.f2,a+r.f2,c+r.f2)),g}},42268:(e,t,n)=>{function o(e){let t=0;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n);return l(10*t)}function l(e){return`hsl(${e%255}, 50%, 50%)`}n.d(t,{XL:()=>o,qH:()=>l})},46879:(e,t,n)=>{n.d(t,{f2:()=>o});const o=.3},99978:(e,t,n)=>{n.d(t,{makeImageData:()=>u});var o=n(99546),l=n(37347),r=n(22593),f=n.n(r),i=n(46879),a=n(21016),c=n(40171),s=n(85497);async function u(e,t){const{scrollTop:n,minorAlleleFrequencyFilter:r,sources:u,rowHeight:h,features:d,regions:g,bpPerPx:m,renderingMode:p,stopToken:b,lengthCutoffFilter:x,referenceDrawingMode:M}=t,k=g[0];(0,l.SW)(b);const T=(0,s.Cg)({stopToken:b,features:d.values(),minorAlleleFrequencyFilter:r,lengthCutoffFilter:x});(0,l.SW)(b);const v=new(f());return(0,o.forEachWithStopTokenCheck)(T,b,(({mostFrequentAlt:t,feature:l})=>{const[r,f]=(0,o.featureSpanPx)(l,k,m),s=Math.max(Math.round(f-r),2),d=l.get("genotypes");let g=-n;const b=u.length;if("phased"===p)for(let t=0;t<b;t++){const{name:n,HP:o}=u[t],f=d[n],a=Math.floor(r),m=Math.max(h,1);if(f)if(f.includes("|")){const t=f.split("|");(0,c.E)(t,e,a,g,s,m,o,void 0,"draw"===M)&&v.insert({minX:a,maxX:a+s,minY:g,maxY:g+m,genotype:f,name:n,featureId:l.id()})}else e.fillStyle="black",e.fillRect(a-i.f2,g-i.f2,s+i.f2,m+i.f2);g+=h}else for(let n=0;n<b;n++){const{name:o}=u[n],f=d[o],i=Math.floor(r),c=Math.max(h,1);if(f){const n=f.split(/[/|]/);(0,a.K)(n,e,i,g,s,c,t,"draw"===M,l.get("type"),l.get("strand"),.75)&&v.insert({minX:i,maxX:i+s,minY:g,maxY:g+c,genotype:f,name:o,featureId:l.id()})}g+=h}})),{rbush:v.toJSON(),featureGenotypeMap:Object.fromEntries(T.map((({feature:e})=>[e.id(),{alt:e.get("ALT"),ref:e.get("REF"),name:e.get("name"),description:e.get("description"),length:e.get("end")-e.get("start")}])))}}}}]);
//# sourceMappingURL=9978.2ef00fb0.chunk.js.map