(()=>{"use strict";var t={80997:()=>{let t,e,i,n;onmessage=function(r){if(void 0!==r.data.canvas&&(t=r.data.canvas,a()),void 0!==r.data.opts&&(e=r.data.opts,a()),void 0!==r.data.matrixData){if(i=r.data.matrixData,!i)throw Error("Unexpected: matrixData is undefined");n=l(i.spikeCounts),a()}};const r=(t,e,i,n,r,a)=>{t.fillStyle=o(a),t.beginPath(),t.rect(e,i,n-e,r-i),t.fill()},o=t=>{const e=128-Math.floor(255*t/2);return`rgb(${e},${e},${e})`},a=function(){let o=!1;return()=>{o||(o=!0,setTimeout((()=>{o=!1,async function(){if(!t)return;if(!e)return;const{margins:o,canvasWidth:a,canvasHeight:l,visibleStartTimeSec:s,visibleEndTimeSec:c,isort:f}=e;t.width=a,t.height=l;const d=t.getContext("2d");if(!d)return;if(d.clearRect(0,0,a,l),!i)return d.fillStyle="gray",d.textAlign="center",d.textBaseline="middle",d.font="20px Arial",void d.fillText("Loading...",a/2,l/2);const u=f?f.map(((t,e)=>[t,e])).sort(((t,e)=>t[0]-e[0])).map((t=>t[1])):void 0,h=i.numUnits,p=t=>{let e=t;return void 0!==u&&(e=u[t]),l-o.bottom-(e+.5-0)/(h-0)*(l-o.top-o.bottom)},x=t=>o.left+(t-s)/(c-s)*(a-o.left-o.right),m=[];for(let t=0;t<i.numUnits;t++)m.push({y:p(t),startBinPixel:x(i.startTimeSec),binSizePixel:x(i.startTimeSec+i.binSizeSec)-x(i.startTimeSec),spikeCounts:i.spikeCounts.slice(t*i.numBins,(t+1)*i.numBins),unitId:t,color:"black",hovered:!1,selected:!1});((t,i)=>{if(!e)return;const{margins:o,canvasWidth:a,canvasHeight:l}=e,s=l/i.length;for(const e of[1,2,3])i.forEach((i=>{(1===e&&s>=10||2===e&&i.selected||3===e&&i.hovered)&&(t.fillStyle=1===e?i.color:2===e?"black":i.color,t.textAlign="right",t.textBaseline="middle",t.font=(e>1?"bold ":"")+"12px Arial",t.fillText(i.unitId+"",o.left-4,i.y),(3===e||2===e&&i.hovered)&&(t.textAlign="left",t.textBaseline="middle",t.font=(e>1?"bold ":"")+"12px Arial",t.fillText(i.unitId+"",a-o.right+4,i.y)))}));t.save(),t.beginPath(),t.rect(o.left,o.top,a-o.left-o.right,l-o.top-o.bottom),t.clip(),i.forEach((e=>{if(void 0!==n)for(let i=0;i<e.spikeCounts.length;i++){const o=e.startBinPixel+i*e.binSizePixel,a=o+e.binSizePixel,l=e.y-2,s=e.y+2;e.spikeCounts[i]>0&&r(t,o,l,a,s,e.spikeCounts[i]/n)}else console.warn("maxSpikeCount is undefined")})),t.restore()})(d,m)}()}),10))}}(),l=t=>{if(0===t.length)return 0;let e=t[0];for(let i=1;i<t.length;i++)t[i]>e&&(e=t[i]);return e}}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}i.m=t,i.c=e,i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{i.S={};var t={},e={};i.I=(n,r)=>{r||(r=[]);var o=e[n];if(o||(o=e[n]={}),!(r.indexOf(o)>=0)){if(r.push(o),t[n])return t[n];i.o(i.S,n)||(i.S[n]={}),i.S[n];var a=[];return t[n]=a.length?Promise.all(a).then((()=>t[n]=1)):1}}})(),i(80997)})();