@perspective-dev/viewer-charts 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer-charts.js +2 -2
- package/dist/cdn/perspective-viewer-charts.js.map +2 -2
- package/dist/esm/charts/series/glyphs/draw-areas.d.ts +7 -2
- package/dist/esm/charts/series/glyphs/draw-lines.d.ts +7 -2
- package/dist/esm/charts/series/glyphs/draw-scatter.d.ts +7 -4
- package/dist/esm/charts/series/series-interact.d.ts +3 -2
- package/dist/esm/charts/series/series.d.ts +51 -0
- package/dist/esm/perspective-viewer-charts.js +2 -2
- package/dist/esm/perspective-viewer-charts.js.map +2 -2
- package/dist/esm/plugin/plugin.d.ts +9 -0
- package/dist/esm/transport/protocol.d.ts +8 -0
- package/dist/esm/transport/renderer-transport.d.ts +1 -0
- package/package.json +1 -1
- package/src/ts/charts/series/glyphs/draw-areas.ts +12 -1
- package/src/ts/charts/series/glyphs/draw-lines.ts +12 -1
- package/src/ts/charts/series/glyphs/draw-scatter.ts +17 -5
- package/src/ts/charts/series/series-interact.ts +137 -78
- package/src/ts/charts/series/series-render.ts +189 -102
- package/src/ts/charts/series/series.ts +113 -0
- package/src/ts/plugin/plugin.ts +13 -1
- package/src/ts/transport/protocol.ts +9 -0
- package/src/ts/transport/renderer-transport.ts +13 -0
- package/src/ts/worker/renderer.worker.ts +3 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var v="Series Charts",I="Cartesian Charts",L="Hierarchical Charts",
|
|
2
|
-
`),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),n.style.left="-9999px",n.style.top="0px",this._parent.appendChild(n),this._div=n;let r=n.getBoundingClientRect().width,o=n.getBoundingClientRect().height,a=t.px+12,s=t.py-o-8;a+r>i.cssWidth&&(a=t.px-r-12),a<0&&(a=4),s<0&&(s=t.py+12),s+o>i.cssHeight&&(s=i.cssHeight-o-4),n.style.left=`${a}px`,n.style.top=`${s}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};var d="worker",K="blit";var J='var Zr=Object.defineProperty;var Ol=(e,t,n)=>t in e?Zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var Vl=(e,t)=>{for(var n in t)Zr(e,n,{get:t[n],enumerable:!0})};var c=(e,t,n)=>Ol(e,typeof t!="symbol"?t+"":t,n);var In,Li=k(()=>{In="attribute vec2 a_start;attribute vec2 a_end;attribute float a_color_start;attribute float a_color_end;attribute float a_corner;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform vec2 u_color_range;uniform sampler2D u_gradient_lut;varying float v_edge_dist;varying vec3 v_color;float A(float B,float C,float D){if(D<=C){return 0.5;}else if(C<0.&&D>0.){float E=max(-C,D);return clamp(0.5+0.5*(B/E),0.,1.);}return clamp((B-C)/(D-C),0.,1.);}void main(){float C=u_color_range.x;float D=u_color_range.y;float F=0.5*(a_color_start+a_color_end);float G=A(F,C,D);v_color=texture2D(u_gradient_lut,vec2(G,0.5)).rgb;vec4 H=u_projection*vec4(a_start,0.,1.);vec4 I=u_projection*vec4(a_end,0.,1.);vec2 J=H.xy*u_resolution*0.5;vec2 K=I.xy*u_resolution*0.5;vec2 L=K-J;float M=length(L);L=M>0.001?L/M:vec2(1.,0.);vec2 N=vec2(-L.y,L.x);float O=step(1.5,a_corner);float P=1.-mod(a_corner,2.)*2.;vec4 Q=mix(H,I,O);float R=(u_line_width+1.5)*0.5;vec2 S=(N*P*R)/(u_resolution*0.5);gl_Position=Q+vec4(S,0.,0.);v_edge_dist=P;}"});var Dn,Ti=k(()=>{Dn="precision highp float;uniform float u_line_width;varying float v_edge_dist;varying vec3 v_color;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(v_color,C);}"});var Bn,Ri=k(()=>{Bn="attribute vec2 a_position;attribute float a_color_value;attribute float a_size_value;uniform mat4 u_projection;uniform float u_point_size;uniform vec2 u_color_range;uniform vec2 u_size_range;uniform vec2 u_point_size_range;varying float v_color_t;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);float A=u_size_range.y-u_size_range.x;if(A>0.){float B=clamp((a_size_value-u_size_range.x)/A,0.,1.);gl_PointSize=mix(u_point_size_range.x,u_point_size_range.y,B);}else{gl_PointSize=u_point_size;}v_point_size=gl_PointSize;float C=u_color_range.x;float D=u_color_range.y;if(D<=C){v_color_t=0.5;}else if(C<0.&&D>0.){float E=max(-C,D);v_color_t=clamp(0.5+0.5*(a_color_value/E),0.,1.);}else{v_color_t=clamp((a_color_value-C)/(D-C),0.,1.);}}"});var Pn,wi=k(()=>{Pn="precision highp float;varying float v_color_t;varying float v_point_size;uniform sampler2D u_gradient_lut;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5){discard;}float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);vec4 E=texture2D(u_gradient_lut,vec2(clamp(v_color_t,0.,1.),0.5));gl_FragColor=vec4(E.rgb,E.a*D);}"});var xt,Mi=k(()=>{xt="attribute vec2 a_corner;attribute vec2 a_position;attribute float a_color_value;uniform vec2 u_radius_ndc;uniform mat4 u_projection;uniform vec2 u_color_range;varying vec2 v_uv;varying float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}"});var $n,Fi=k(()=>{$n="precision highp float;uniform float u_intensity;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);float B=max(0.,1.-A);B=B*B*u_intensity;if(B<=0.){discard;}gl_FragColor=vec4(B,B*v_color_t,0.,0.);}"});var jn,Si=k(()=>{jn="precision highp float;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);if(A>=1.){discard;}float B=(v_color_t-0.5)*2.;gl_FragColor=vec4(max(0.,B),max(0.,-B),0.,0.);}"});var Kr,qr=k(()=>{Kr=`#version 300 es\nin vec2 a_corner;in vec2 a_position;in float a_color_value;uniform mat4 u_projection;uniform vec2 u_radius_ndc;uniform vec2 u_color_range;out vec2 v_uv;out float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}`});var Qr,Jr=k(()=>{Qr=`#version 300 es\nprecision highp float;uniform float u_intensity;in vec2 v_uv;in float v_color_t;layout(location=0)out vec4 A;layout(location=1)out vec4 B;void main(){float C=length(v_uv);float D=max(0.0f,1.0f-C);D=D*D*u_intensity;if(D<=0.0f){discard;}A=vec4(D,D*v_color_t,0.0f,0.0f);float E=(v_color_t-0.5f)*2.0f;B=vec4(max(0.0f,E),max(0.0f,-E),0.0f,0.0f);}`});var Zn,Ii=k(()=>{Zn="attribute vec2 a_corner;varying vec2 v_uv;void main(){v_uv=a_corner*0.5+0.5;gl_Position=vec4(a_corner,0.,1.);}"});var qn,Di=k(()=>{qn="precision highp float;uniform sampler2D u_heat;uniform sampler2D u_extreme;uniform sampler2D u_gradient_lut;uniform float u_heat_max;uniform int u_color_mode;varying vec2 v_uv;void main(){vec4 A=texture2D(u_heat,v_uv);float B=A.r;float C=A.g;if(B<=0.){discard;}float D;float E;float F=clamp(B/max(u_heat_max,1e-4),0.,1.);if(u_color_mode==0){D=pow(F,0.6);E=clamp(B,0.,1.);}else if(u_color_mode==2){vec4 G=texture2D(u_extreme,v_uv);float H=G.r;float I=G.g;float J=max(H,I);if(J<=0.){D=0.5;}else if(H>=I){D=clamp(0.5+H*0.5,0.5,1.);}else{D=clamp(0.5-I*0.5,0.,0.5);}E=F;}else if(u_color_mode==3){float K=C-0.5*B;float L=clamp(abs(K)/max(u_heat_max,1e-4),0.,1.);float M=K>=0.?1.:-1.;D=clamp(0.5+0.5*M*L,0.,1.);E=L;}else{D=clamp(C/B,0.,1.);E=F;}vec4 N=texture2D(u_gradient_lut,vec2(D,0.5));gl_FragColor=vec4(N.rgb,N.a*E);}"});var Kn,Bi=k(()=>{Kn="attribute vec2 a_corner;uniform mat4 u_projection;uniform vec2 u_extent_min;uniform vec2 u_extent_max;uniform vec2 u_uv_min;uniform vec2 u_uv_max;varying vec2 v_uv;void main(){vec2 A=mix(u_extent_min,u_extent_max,a_corner);vec2 B=mix(u_uv_min,u_uv_max,vec2(a_corner.x,1.-a_corner.y));v_uv=B;gl_Position=u_projection*vec4(A,0.,1.);}"});var Jn,Pi=k(()=>{Jn="precision highp float;varying vec2 v_uv;uniform sampler2D u_tile;uniform float u_alpha;void main(){vec4 A=texture2D(u_tile,v_uv);gl_FragColor=vec4(A.rgb,A.a*u_alpha);}"});function Cu(e,t){if(t.width<=0||t.height<=0)return e;let n=e.xMax-e.xMin,o=e.yMax-e.yMin;if(n<=0||o<=0)return e;let i=t.width/t.height;if(n/o<i){let s=(e.xMin+e.xMax)/2,a=o*i/2;return{xMin:s-a,xMax:s+a,yMin:e.yMin,yMax:e.yMax}}else{let s=(e.yMin+e.yMax)/2,a=n/i/2;return{xMin:e.xMin,xMax:e.xMax,yMin:s-a,yMax:s+a}}}var yt,eo=k(()=>{"use strict";yt=class{constructor(){c(this,"ce",1);c(this,"de",1);c(this,"Me",0);c(this,"Fe",0);c(this,"Lt",0);c(this,"Tt",1);c(this,"Rt",0);c(this,"wt",1);c(this,"Xe",null);c(this,"Ci",!1);c(this,"Do",!1);c(this,"Bo",!1);c(this,"Mt",null);c(this,"Ft",null);c(this,"Vn",null);c(this,"Po",!1);c(this,"Eo",0);c(this,"Go",0);c(this,"Hn",null);c(this,"Yn",null);c(this,"zn",null);c(this,"Xn",null)}get lockedAxis(){return this.Xe}get scaleX(){return this.ce}get scaleY(){return this.de}set scaleX(t){this.ce=t}set scaleY(t){this.de=t}get normTranslateX(){return this.Me}get normTranslateY(){return this.Fe}set normTranslateX(t){this.Me=t}set normTranslateY(t){this.Fe=t}get baseXRange(){return this.Tt-this.Lt}get baseYRange(){return this.wt-this.Rt}setBaseDomain(t,n,o,i){let r=n-t;if(this.isXDefault()||!this.Do)this.Lt=t,this.Tt=n;else{let a=this.Tt-this.Lt,l=(this.Lt+this.Tt)/2+this.Me*a;this.Lt=t,this.Tt=n,this.Me=r>0?(l-(t+n)/2)/r:0}let s=i-o;if(this.isYDefault()||!this.Bo)this.Rt=o,this.wt=i;else{let a=this.wt-this.Rt,l=(this.Rt+this.wt)/2+this.Fe*a;this.Rt=o,this.wt=i,this.Fe=s>0?(l-(o+i)/2)/s:0}}pinAxis(t){t==="x"?this.Do=!0:this.Bo=!0}unpinAxis(t){t==="x"?this.Do=!1:this.Bo=!1}configure(t){this.Xe=t.lockAxis??null,this.Ci=t.lockAspect??!1,this.Xe==="x"?(this.ce=1,this.Me=0):this.Xe==="y"&&(this.de=1,this.Fe=0)}isXDefault(){return this.ce===1&&this.Me===0}isYDefault(){return this.de===1&&this.Fe===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.Tt-this.Lt,n=this.wt-this.Rt,o=t/this.ce,i=n/this.de,r=(this.Lt+this.Tt)/2+this.Me*t,s=(this.Rt+this.wt)/2+this.Fe*n,a={xMin:r-o/2,xMax:r+o/2,yMin:s-i/2,yMax:s+i/2};return this.Ci&&this.Ft?Cu(a,this.Ft.e):a}attach(t,n,o){this.detach(),this.Mt=t,this.Ft=n,this.Vn=o,this.Hn=i=>{i.preventDefault();let r=t.getBoundingClientRect(),s=i.clientX-r.left,a=i.clientY-r.top,l=this.Ft.e;if(s<l.x||s>l.x+l.width||a<l.y||a>l.y+l.height)return;let u=(s-l.x)/l.width,m=(a-l.y)/l.height,f=this.ce,b=this.de,d=Math.pow(1.1,-i.deltaY/100);this.Xe!=="x"&&(this.ce=Math.max(1,Math.min(1e5,this.ce*d))),this.Xe!=="y"&&(this.de=Math.max(1,Math.min(1e5,this.de*d))),this.Xe!=="x"&&f!==this.ce&&(this.Me+=(u-.5)*(1/f-1/this.ce)),this.Xe!=="y"&&b!==this.de&&(this.Fe+=(.5-m)*(1/b-1/this.de)),this.Vn()},this.Yn=i=>{if(i.button!==0)return;let r=t.getBoundingClientRect(),s=i.clientX-r.left,a=i.clientY-r.top,l=this.Ft.e;s>=l.x&&s<=l.x+l.width&&a>=l.y&&a<=l.y+l.height&&(this.Po=!0,this.Eo=i.clientX,this.Go=i.clientY,t.setPointerCapture(i.pointerId))},this.zn=i=>{if(!this.Po)return;let r=i.clientX-this.Eo,s=i.clientY-this.Go;this.Eo=i.clientX,this.Go=i.clientY;let a=this.Ft.e;this.Xe!=="x"&&a.width>0&&(this.Me-=r/(a.width*this.ce)),this.Xe!=="y"&&a.height>0&&(this.Fe+=s/(a.height*this.de)),this.Vn()},this.Xn=()=>{this.Po=!1},t.addEventListener("wheel",this.Hn,{passive:!1}),t.addEventListener("pointerdown",this.Yn),t.addEventListener("pointermove",this.zn),t.addEventListener("pointerup",this.Xn)}updateLayout(t){this.Ft=t}detach(){this.Mt&&(this.Hn&&this.Mt.removeEventListener("wheel",this.Hn),this.Yn&&this.Mt.removeEventListener("pointerdown",this.Yn),this.zn&&this.Mt.removeEventListener("pointermove",this.zn),this.Xn&&this.Mt.removeEventListener("pointerup",this.Xn)),this.Mt=null,this.Vn=null}reset(){this.ce=1,this.de=1,this.Me=0,this.Fe=0}serialize(){return{scaleX:this.ce,scaleY:this.de,normTranslateX:this.Me,normTranslateY:this.Fe}}restore(t){this.ce=t.scaleX,this.de=t.scaleY,this.Me=t.normTranslateX,this.Fe=t.normTranslateY}}});function Gi(e,t){let n=t??_u[e]??{};return new Intl.NumberFormat(navigator.languages,n)}function Wi(e){if(!e||e.format!=="custom"){let n={timeZone:e?.timeZone,dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??is.dateStyle,timeStyle:e?.timeStyle==="disabled"?void 0:e?.timeStyle??is.timeStyle};return new Intl.DateTimeFormat(navigator.languages,n)}let t={timeZone:e.timeZone,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(t.year=e.year??"2-digit"),e.month!=="disabled"&&(t.month=e.month??"numeric"),e.day!=="disabled"&&(t.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(t.weekday=e.weekday),e.hour!=="disabled"&&(t.hour=e.hour??"numeric"),e.minute!=="disabled"&&(t.minute=e.minute??"numeric"),e.second!=="disabled"&&(t.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,t)}function rs(e){let t={timeZone:"utc",dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??vu.dateStyle};return new Intl.DateTimeFormat(navigator.languages,t)}function ki(e){return e.split("|").at(-1)??e}var _u,is,vu,ss=k(()=>{"use strict";_u={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},is={dateStyle:"short",timeStyle:"medium"},vu={dateStyle:"short"}});var no,as=k(()=>{"use strict";no=class{constructor(t,n=128){c(this,"Xt");c(this,"d",new Map);c(this,"Ae",new Map);c(this,"_i");this.Xt=t,this._i=n}async fetchRow(t){if(!this.Xt)throw new Error("LazyRowFetcher disposed");let n=this.d.get(t);if(n)return this.d.delete(t),this.d.set(t,n),n;let o=this.Ae.get(t);if(o)return o;let i=this.Ki(t);this.Ae.set(t,i);try{let r=await i;if(!this.Xt)return r;if(this.d.set(t,r),this.d.size>this._i){let s=this.d.keys().next().value;s!==void 0&&this.d.delete(s)}return r}finally{this.Ae.delete(t)}}async Ki(t){let n=this.Xt;if(!n)throw new Error("LazyRowFetcher disposed");let o=new Map;return await n.with_typed_arrays({start_row:t,end_row:t+1,float32:!0},(i,r,s,a)=>{for(let l=0;l<i.length;l++){let u=i[l];if(u.startsWith("__"))continue;let m=r[l],f=s[l],b=a[l];(f?!(f[0]>>0&1):!1)?o.set(u,null):b?o.set(u,b[m[0]]):o.set(u,m[0])}}),o}dispose(){this.Xt=null,this.d.clear(),this.Ae.clear()}get isDisposed(){return this.Xt===null}}});function ls(e,t){let n=Math.floor(Math.log10(e)),o=e/Math.pow(10,n),i;return t?o<1.5?i=1:o<3?i=2:o<7?i=5:i=10:o<=1?i=1:o<=2?i=2:o<=5?i=5:i=10,i*Math.pow(10,n)}function ie(e,t,n){n<1&&(n=1);let o=ls(t-e,!1),i=ls(o/n,!0),r=Math.ceil(e/i)*i,s=Math.floor(t/i)*i,a=[];for(let l=r;l<=s+i*.001;l+=i)a.push(l);return a}function ue(e){if(!Number.isFinite(e))return"-";let t=Math.abs(e);return t===0?"0":t>=1e9?(e/1e9).toFixed(1)+"B":t>=1e6?(e/1e6).toFixed(1)+"M":t>=1e3?(e/1e3).toFixed(1)+"K":Number.isInteger(e)?e.toString():t>=1?e.toFixed(1):e.toFixed(2)}function ye(e,t){let n=new Date(e);return isNaN(n.getTime())?ue(e):t!==void 0&&t>0?t>=864e5*28?n.toLocaleDateString(void 0,{year:"numeric",month:"short"}):t>=864e5?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t>=36e5?n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric"}):t>=6e4?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var Ae=k(()=>{"use strict"});var us,ms,fs=k(()=>{"use strict";us={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},ms={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"expand",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1}});function Pe(e,t,n,o,i,r,s={}){if(!e)return;let a=e.getContext("2d");if(!a)return;a.save(),a.setTransform(1,0,0,1,0,0),a.scale(r,r),a.font=`11px ${i.fontFamily}`;let l=16,u=8,m=0;for(let h of n){let g=a.measureText(h).width;g>m&&(m=g)}let f=m+u*2,b=n.length*l+u*2-4,d=t.px+12,p=t.py-b-8;d+f>o.cssWidth&&(d=t.px-f-12),p<0&&(p=t.py+12),p+b>o.cssHeight&&(p=o.cssHeight-b-4);let x=n.length>0;if(s.crosshair&&(a.strokeStyle=i.St,a.globalAlpha=.3,a.lineWidth=1,a.setLineDash([4,4]),a.beginPath(),a.moveTo(t.px,o.e.y),a.lineTo(t.px,o.e.y+o.e.height),a.moveTo(o.e.x,t.py),a.lineTo(o.e.x+o.e.width,t.py),a.stroke(),a.setLineDash([]),a.globalAlpha=1),s.highlightRadius&&s.highlightRadius>0&&(a.strokeStyle=i.St,a.globalAlpha=.8,a.lineWidth=2,a.beginPath(),a.arc(t.px,t.py,s.highlightRadius,0,Math.PI*2),a.stroke(),a.globalAlpha=1),x){a.fillStyle=i.$n,a.strokeStyle=i.vi,a.lineWidth=1,a.beginPath(),a.roundRect(d,p,f,b,4),a.fill(),a.stroke(),a.fillStyle=i.Ai,a.textAlign="left",a.textBaseline="top";for(let h=0;h<n.length;h++)a.fillText(n[h],d+u,p+u+h*l)}a.restore()}var oo,Ct=k(()=>{"use strict";oo=class{constructor(){c(this,"Ee",null);c(this,"$t",0);c(this,"jt",null);c(this,"an",null);c(this,"gt",!1)}get isPinned(){return this.gt}setHost(t){this.gt&&(this.an?.dismiss(),this.gt=!1),this.an=t}setCursor(t){this.an?.setCursor(t)}attach(t){this.detach(),this.Ee=t}detach(){this.$t&&(cancelAnimationFrame(this.$t),this.$t=0),this.jt!==null&&(clearTimeout(this.jt),this.jt=null),this.Ee=null}dispatchHover(t,n){if(this.gt||!this.Ee||this.$t||this.jt!==null)return;let o=()=>{this.$t=0,this.jt=null,this.Ee?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.$t=requestAnimationFrame(o):this.jt=setTimeout(o,16)}dispatchLeave(){this.gt||!this.Ee||this.Ee.onLeave()}dispatchClick(t,n){if(this.Ee&&!this.Ee.onClickPre?.(t,n)){if(this.gt){let o=this.Ee;this.dismiss(),o.onUnpin?.();return}this.Ee.onPin?.(t,n)}}dispatchDblClick(t,n){this.Ee?.onDblClick?.(t,n)}pin(t,n,o){t.length!==0&&(this.an?.pin(t,n,o),this.gt=!0)}dismiss(){this.an?.dismiss(),this.gt=!1}}});function io(e){let t=e.trim();if(t.startsWith("#")){let o=t.slice(1);return o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]),[parseInt(o.slice(0,2),16)/255,parseInt(o.slice(2,4),16)/255,parseInt(o.slice(4,6),16)/255]}let n=t.match(/rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)/);return n?[+n[1]/255,+n[2]/255,+n[3]/255]:[.5,.5,.5]}var Ni=k(()=>{"use strict"});function cs(e){if(!e)return it.slice();let t=e.trim();if(!t)return it.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return it.slice();let o=t.lastIndexOf(")");if(o<=n)return it.slice();let i=t.substring(n+1,o),r=[],s=0,a=0;for(let b=0;b<i.length;b++){let d=i[b];d==="("?s++:d===")"?s--:d===","&&s===0&&(r.push(i.substring(a,b)),a=b+1)}r.push(i.substring(a));let l=[],u=0;if(r.length>0){let b=r[0].trim().toLowerCase();(b.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(b))&&(u=1)}for(let b=u;b<r.length;b++){let d=r[b].trim();if(!d)continue;let p=d.match(/\\s([\\-\\d.]+)%\\s*$/),x=p?d.substring(0,p.index).trim():d,h=p?parseFloat(p[1])/100:null;try{let g=io(x);l.push({color:g,offset:h})}catch{}}if(l.length===0)return it.slice();if(l.length===1){let[b,d,p]=l[0].color;return[{offset:0,color:[b,d,p,1]},{offset:1,color:[b,d,p,1]}]}l[0].offset===null&&(l[0].offset=0),l[l.length-1].offset===null&&(l[l.length-1].offset=1);for(let b=1;b<l.length-1;b++){if(l[b].offset!==null)continue;let d=b+1;for(;d<l.length&&l[d].offset===null;)d++;let p=l[b-1].offset,x=l[d].offset,h=d-(b-1);for(let g=b;g<d;g++)l[g].offset=p+(g-(b-1))/h*(x-p);b=d-1}let m=0;return l.map(b=>{let d=Math.max(m,Math.min(1,b.offset));return m=d,{offset:d,color:[b.color[0],b.color[1],b.color[2],1]}})}function Le(e,t){if(e.length===0)return[0,0,0,1];if(t<=e[0].offset)return e[0].color.slice();let n=e[e.length-1];if(t>=n.offset)return n.color.slice();let o=0,i=e.length-1;for(;i-o>1;){let u=o+i>>1;e[u].offset<=t?o=u:i=u}let r=e[o],s=e[i],a=s.offset-r.offset,l=a>0?(t-r.offset)/a:0;return[r.color[0]+(s.color[0]-r.color[0])*l,r.color[1]+(s.color[1]-r.color[1])*l,r.color[2]+(s.color[2]-r.color[2])*l,r.color[3]+(s.color[3]-r.color[3])*l]}function rt(e,t,n){if(!isFinite(e)||t===n)return .5;let o;if(t>=0?o=n:n<=0?o=-t:o=Math.max(-t,n),o<=0)return .5;let i=.5+.5*(e/o);return i<0?0:i>1?1:i}function ds(e){if(e.length===0)return it.slice();if(e.length===1){let[n,o,i]=e[0];return[{offset:0,color:[n,o,i,1]},{offset:1,color:[n,o,i,1]}]}let t=e.length-1;return e.map(([n,o,i],r)=>({offset:r/t,color:[n,o,i,1]}))}function ps(e,t=256){let n=new Uint8Array(t*4);for(let o=0;o<t;o++){let i=t===1?0:o/(t-1),r=Le(e,i);n[o*4]=Math.round(r[0]*255),n[o*4+1]=Math.round(r[1]*255),n[o*4+2]=Math.round(r[2]*255),n[o*4+3]=Math.round(r[3]*255)}return n}var it,Ee=k(()=>{"use strict";Ni();it=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function Au(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function bs(e){return!isFinite(e)||e<0?1:e}function gs(e){let t=(r,s)=>e[r]||s,n=e["--psp-charts--gradient--background"]||e["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",o=cs(n),i=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;i.push(io(s))}return{fontFamily:t("--psp-charts--font-family",t("font-family","monospace")),backgroundColor:t("--psp--background-color","rgba(255, 255, 255, 1)"),St:t("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),Le:t("--psp--color","rgba(180, 0, 0, 0.9)"),jn:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),ln:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),H:o,un:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),Ji:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),$n:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),Ai:t("--psp-charts--tooltip--color","#161616"),vi:t("--psp-charts--tooltip--border-color","#fff"),Zn:Au(parseFloat(t("--psp-charts--area--opacity","0.85"))),Li:bs(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),Ti:bs(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),Ge:i}}var hs=k(()=>{"use strict";Ni();Ee()});function ys(e,t,n){let o=st.get(e);o?(o.fullRender=t,o.render2D=n):(o={glManager:e,fullRender:t,render2D:n,waiters:[]},st.set(e,o));let i=Promise.withResolvers();return o.waiters.push(i),ro||(ro=As(vs)),i.promise}function Cs(e,t){if(!so.has(e)){t();return}let n=Kt.get(e);n||(n=[],Kt.set(e,n)),n.push(t)}function _s(e){let t=st.get(e);if(t){st.delete(e);for(let n of t.waiters)n.resolve()}Kt.delete(e),so.delete(e)}async function vs(){let e=Array.from(st.values());st.clear();let t=new Map;for(let n of e){if(n.glManager.isContextLost()){for(let r of n.waiters)r.resolve();continue}let o=n.glManager.backendId,i=t.get(o);i?i.push(n):t.set(o,[n])}await Promise.all(Array.from(t.values()).map(Lu)),ro=0,st.size>0&&(ro=As(vs))}async function Lu(e){for(let t of e)await Tu(t)}async function Tu(e){so.add(e.glManager);try{e.glManager.beginFrame(),e.fullRender()}catch(t){console.error("scheduler: fullRender threw",t);for(let n of e.waiters)n.reject(t);xs(e.glManager);return}try{await e.glManager.awaitGpuFence(),e.render2D(),e.glManager.endFrame();for(let t of e.waiters)t.resolve()}catch(t){console.error("scheduler: present failed",t);try{e.glManager.endFrame()}catch{}for(let n of e.waiters)n.reject(t)}finally{xs(e.glManager)}}function xs(e){so.delete(e);let t=Kt.get(e);if(t){Kt.delete(e);for(let n of t)try{n()}catch(o){console.error("scheduler: deferred op threw",o)}}}function As(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var st,ro,so,Kt,Ui=k(()=>{"use strict";st=new Map,ro=0,so=new Set,Kt=new Map});var Ls,Ru,wu,Te,Jt=k(()=>{"use strict";ss();as();Ae();eo();fs();Ct();hs();Ui();Ls=!0,Ru=(()=>{if(Ls)return ue;{let e=Gi("float");return t=>e.format(t)}})(),wu=(()=>{if(Ls)return ye;{let e=Wi();return t=>e.format(t)}})(),Te=class{constructor(){c(this,"t",null);c(this,"j",null);c(this,"c",null);c(this,"mn",[]);c(this,"Ri",{});c(this,"g",null);c(this,"fn",[]);c(this,"I",[]);c(this,"_",[]);c(this,"P",[]);c(this,"We",{});c(this,"qn",!1);c(this,"Kn",!1);c(this,"ht",{});c(this,"Wo",{});c(this,"ko",new Map);c(this,"Jn");c(this,"W",{...us});c(this,"h",{...ms});c(this,"T",new oo);c(this,"No",null);c(this,"Qn",Promise.resolve());c(this,"cn",null);c(this,"Se",null)}setGridlineCanvas(t){this.j=t}setChromeCanvas(t){this.c=t}setTheme(t){this.Ri=t,this.cn=null}setZoomController(t){this.g=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.W.zoom_mode==="shared")return this.g;if(!this.g)return null;let n=this.fn[t];return n||(n=new yt,n.configure(this.getZoomConfig()),this.fn[t]=n),n}computeEffectiveFacetFlags(){let t=this.W.zoom_mode==="independent",n=!t&&this.W.shared_x_axis,o=!t&&this.W.shared_y_axis;return this.qn=n,this.Kn=o,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:o}}syncFacetZoomLayouts(t){let n=this.W.zoom_mode==="independent";for(let o=0;o<t.length;o++)if(this.getZoomControllerForFacet(o)?.updateLayout(t[o].layout),!n)return}setZoomBaseDomain(t,n,o,i){this.g&&this.g.setBaseDomain(t,n,o,i);for(let r of this.fn)r&&r.setBaseDomain(t,n,o,i)}getZoomConfig(){return{}}setColumnSlots(t){this.I=t}setViewPivots(t,n){this._=t,this.P=n}setColumnTypes(t){this.We=t,this.wi()}resetExpandedDomain(){}setGroupByTypes(t){this.ht=t}setColumnsConfig(t){this.Wo=t??{},this.wi()}wi(){this.ko=new Map;for(let[t,n]of Object.entries(this.Wo)){let o=this.We[t]??this.ht[t],i=this.Qi(o,n);i&&this.ko.set(t,i)}}Qi(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let o=n.number_format;if(!o)return;let i=Gi(t,o);return r=>i.format(r)}if(t==="datetime"){let o=n.date_format;if(!o)return;let i=Wi(o);return r=>i.format(r)}if(t==="date"){let o=n.date_format;if(!o)return;let i=rs(o);return r=>i.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.ko.get(ki(t));if(r)return r}if(n==="tick")return;let o=t?ki(t):void 0,i=o?this.We[o]??this.ht[o]:void 0;return i==="date"||i==="datetime"?wu:Ru}setDefaultChartType(t){this.Jn=t}setFacetConfig(t){this.W={...t}}setPluginConfig(t){this.h={...t},this.W={...this.W,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.eo=t.series_zoom_mode==="dynamic"}A(){return this.cn||(this.cn=gs(this.Ri)),this.cn}invalidateTheme(){this.cn=null}setView(t){this.Se&&this.Se.dispose(),this.Se=new no(t);let n=this.T.isPinned;this.T.dismiss(),n&&this.emitUnselect()}deselect(){this.T.dismiss()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this.T.attach(this.tooltipCallbacks()),this.T.setHost(t),this.No=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.Se)try{let i=await this.Se.fetchRow(t.rowIdx);n=Object.fromEntries(i)}catch{n={}}let o=[];for(let i=0;i<this._.length;i++){let r=t.groupByValues[i];r!=null&&r!==""&&o.push([this._[i],"==",r])}for(let i=0;i<this.P.length;i++){let r=t.splitByValues[i];r!=null&&r!==""&&o.push([this.P[i],"==",r])}return{row:n,column_names:[t.columnName],config:{filter:o}}}emitUserClick(t){let n={row:t.row,column_names:t.column_names,config:t.config};this.No?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.No?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this.Qn.then(async()=>{let o=await this.buildClickDetail(t);this.emitUserClick(o),this.emitUserSelect({selected:!0,row:o.row,column_names:o.column_names,insertConfig:o.config})});return this.Qn=n.catch(o=>{console.error("emitClickAndSelect failed",o)}),n}emitUnselect(t={}){let n=this.Qn.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this.Qn=n.catch(o=>{console.error("emitUnselect failed",o)})}requestRender(t){return ys(t,()=>{this.mn=[],this.It(t)},()=>this.Mi())}pe(t){this.mn.push(t)}Mi(){let t=this.mn;this.mn=[];for(let n of t)n()}renderFrameSync(t){this.mn=[],this.It(t),this.Mi()}destroy(){this.T.detach(),this.T.dismiss(),this.Se&&(this.Se.dispose(),this.Se=null),this.destroyInternal()}}});var ao,Ts=k(()=>{"use strict";ao=class{constructor(t,n,o,i,r){c(this,"Qe",new Map);c(this,"be");c(this,"Te");c(this,"Dt");c(this,"Fi");this.be=t,this.Te=o,this.Dt=r,this.Fi=Math.max(1,Math.ceil((n-t)/r))}Si(t,n){return n*this.Fi+t}insert(t,n,o){let i=Math.floor((n-this.be)/this.Dt),r=Math.floor((o-this.Te)/this.Dt),s=this.Si(i,r),a=this.Qe.get(s);a||(a=[],this.Qe.set(s,a)),a.push(t)}query(t,n,o,i,r,s,a){let l=Math.ceil(o/i/this.Dt),u=Math.ceil(o/r/this.Dt),m=Math.floor((t-this.be)/this.Dt),f=Math.floor((n-this.Te)/this.Dt),b=-1,d=o*o;for(let p=f-u;p<=f+u;p++)for(let x=m-l;x<=m+l;x++){let h=this.Qe.get(this.Si(x,p));if(h)for(let g of h){let y=(s[g]-t)*i,_=(a[g]-n)*r,C=y*y+_*_;C<d&&(d=C,b=g)}}return b}}});var lo,Rs=k(()=>{"use strict";Ts();lo=class{constructor(){c(this,"dn",null);c(this,"pn",!0)}markDirty(){this.pn=!0}get isDirty(){return this.pn}rebuild(t,n,o){if(n===0){this.dn=null,this.pn=!1;return}let i=t.xMax-t.xMin||1,r=t.yMax-t.yMin||1,a=(i+r)/2/Math.max(1,Math.sqrt(n)),l=new ao(t.xMin,t.xMax,t.yMin,t.yMax,a);o((u,m,f)=>l.insert(u,m,f)),this.dn=l,this.pn=!1}query(t,n,o,i,r,s,a){return!this.dn||!s||!a?-1:this.dn.query(t,n,o,i,r,s,a)}clear(){this.dn=null,this.pn=!0}}});function He(e,t,n=[]){let o=new Map;for(let r of e.keys()){if(r.startsWith("__"))continue;let s=r.lastIndexOf("|");if(s===-1)continue;let a=r.substring(0,s);o.has(a)||o.set(a,new Set),o.get(a).add(r)}let i=[];for(let[r,s]of o){let a=new Map,l=!0;for(let u of t){if(!u)continue;let m=`${r}|${u}`,f=e.get(m);if(!s.has(m)||!f?.values){l=!1;break}a.set(u,m)}if(l){for(let u of n){if(!u)continue;let m=`${r}|${u}`;s.has(m)&&e.get(m)?.values&&a.set(u,m)}i.push({prefix:r,colNames:a})}}return i}var Qt=k(()=>{"use strict"});var uo,ws=k(()=>{"use strict";uo=class{constructor(t){c(this,"data");c(this,"dictionary",[]);c(this,"dictMap",new Map);this.data=new Int32Array(t),this.data.fill(-1)}set(t,n){let o=this.dictMap.get(n);return o===void 0&&(o=this.dictionary.length,this.dictionary.push(n),this.dictMap.set(n,o)),this.data[t]=o,o}get(t){let n=this.data[t];return n<0?null:this.dictionary[n]}}});function Ms(e,t,n,o){let i;if(!e)i="(null)";else{let s=e.valid;if(!(s?!!(s[t>>3]>>(t&7)&1):!0))i="(null)";else if(e.indices&&e.dictionary)i=e.dictionary[e.indices[t]]??"(null)";else if(e.values){let l=e.values[t];i=l==null?"(null)":String(l)}else i="(null)"}let r=o.get(i);return r===void 0&&(r=n.length,n.push(i),o.set(i,r)),r}function Mu(e,t,n,o,i,r){let s=t?[t,n]:[n],a=[];return o&&a.push(o),i&&a.push(i),r&&a.push(r),He(e,s,a).map(l=>({prefix:l.prefix,xColName:t?l.colNames.get(t):"",yColName:l.colNames.get(n),colorColName:o?`${l.prefix}|${o}`:"",sizeColName:i?`${l.prefix}|${i}`:"",labelColName:r?`${l.prefix}|${r}`:""}))}function Fs(e,t,n,o){e.glyph.ensureProgram(e,t);let i=e.s,r=e.Z;e.h.domain_mode==="expand"?(e.be=e.bn,e.et=e.gn,e.Te=e.hn,e.tt=e.xn,e.b=e.to,e.p=e.no,e.nt=e.oo,e.ot=e.io):(e.be=1/0,e.et=-1/0,e.Te=1/0,e.tt=-1/0,e.b=1/0,e.p=-1/0,e.nt=1/0,e.ot=-1/0,e.bn=1/0,e.gn=-1/0,e.hn=1/0,e.xn=-1/0,e.to=1/0,e.no=-1/0,e.oo=1/0,e.io=-1/0),e.w=NaN,e.M=NaN,e.xt=0,e.Zt.clear(),e.Uo=0;let a=e.I,l=a[0]||"",u=a[1]||"",m=a[2]||"",f=a[3]||"",b=a[4]||"";e.ke=l,e.Ie=u,e.Ii=!l,e.De=!!l&&e.We[l]==="string",e.ge=!!u&&e.We[u]==="string",e.qt=[],e.Kt=[],e.Di=new Map,e.Bi=new Map,e.it=null,e.rt=null,e.De&&(e.w=0,e.be=0,e.et=0,e.bn=1/0,e.gn=-1/0),e.ge&&(e.M=0,e.Te=0,e.tt=0,e.hn=1/0,e.xn=-1/0);let d=t.v.totalCapacity||o;if(e.P.length>0){if(e.L=Mu(n,l,u,m,f,b),e.L.length===0){e.R=0,e.U=[];return}if(e.$e=e.L[0].xColName,e.Ne=e.L[0].yColName,e.s=m,e.ne=f,e.ro=b,e.Z=!1,m){let h=n.get(e.L[0].colorColName);e.Z=h?.type==="string"}t.ensureBufferCapacity(d*e.L.length)}else if(e.L=[],e.$e=l,e.Ne=u,e.s=m,e.ne=f,e.ro=b,e.Z=!1,e.s){let h=n.get(e.s);e.Z=h?.type==="string"}(e.s!==i||e.Z!==r)&&(e.f=new Map);let p=Math.max(1,e.L.length);e.R=d,e.U=new Array(p).fill(0);let x=p*d;e.O=new Float32Array(x),e.V=new Float32Array(x),e.yt=new Float32Array(x),e.Bt=new Int32Array(x),e.Pt=b?new uo(x):null}function Ss(e,t,n,o,i,r){if(!e.Ne)return;let s=i;if(s===0||e.R===0)return;let a=e.L.length>0,l=[];if(a)for(let p of e.L){let x=p.xColName?n.get(p.xColName):null,h=n.get(p.yColName);if(!h||!e.ge&&!h.values)continue;let g=p.sizeColName?n.get(p.sizeColName):null,y=p.colorColName?n.get(p.colorColName)??null:null,_=p.labelColName?n.get(p.labelColName)??null:null;l.push({xCol:x?.values??null,yCol:h.values??null,xColData:x??null,yColData:h,xValid:x?.valid,yValid:h.valid,colorCol:y,sizeCol:g?.values??null,labelCol:_})}else{let p=e.$e?n.get(e.$e):null,x=e.Ne?n.get(e.Ne):null;if(!x||!e.ge&&!x.values)return;let h=e.s?n.get(e.s)??null:null,g=e.ro?n.get(e.ro)??null:null;l.push({xCol:p?.values??null,yCol:x.values??null,xColData:p??null,yColData:x,xValid:p?.valid,yValid:x?.valid,colorCol:h,sizeCol:null,labelCol:g})}if(l.length===0)return;e.Pi<s&&(e.Oo=new Float32Array(s*2),e.Vo=new Float32Array(s),e.Ho=new Float32Array(s),e.Pi=s);let u=e.Oo,m=e.Vo,f=e.Ho,b=!a&&e.ne?n.get(e.ne)?.values??null:null;if(e.Z&&e.s){for(let p of l){let x=p.colorCol?.dictionary;if(x)for(let h=0;h<x.length;h++){let g=x[h];e.f.has(g)||e.f.set(g,e.f.size)}}e.f.size>0&&(e.b=0,e.p=e.f.size-1)}!e.s&&e.L.length>1&&(e.b=0,e.p=e.L.length-1);for(let p=0;p<l.length;p++){let x=l[p],h=e.U[p]??0,g=p*e.R,y=e.R-h;if(y<=0)continue;let _=x.colorCol?.valid,C=0;for(let R=0;R<s&&C<y;R++){let L=R;if(!e.ge&&x.yValid&&!(x.yValid[L>>3]>>(L&7)&1)||!e.De&&x.xCol&&x.xValid&&!(x.xValid[L>>3]>>(L&7)&1))continue;let T=_!==void 0&&!(_[L>>3]>>(L&7)&1),F;if(e.ge)F=Ms(x.yColData,L,e.Kt,e.Bi);else if(x.yCol){if(F=x.yCol[L],isNaN(F))continue}else continue;let I;if(e.De)I=Ms(x.xColData,L,e.qt,e.Di);else if(x.xCol){if(I=x.xCol[L],isNaN(I))continue}else I=o+L;let[D,P]=e.projectPoint(I,F);if(isNaN(D)||isNaN(P))continue;D<e.be&&(e.be=D),D>e.et&&(e.et=D),P<e.Te&&(e.Te=P),P>e.tt&&(e.tt=P),isNaN(e.w)&&(e.w=D),isNaN(e.M)&&(e.M=P);let E=D-e.w,O=P-e.M,W=g+h+C;e.O[W]=E,e.V[W]=O,e.Bt[W]=o+L,u[C*2]=E,u[C*2+1]=O;let V=x.colorCol;if(T)m[C]=.5,e.yt[W]=.5;else if(V&&!e.Z&&V.values){let S=V.values[L];m[C]=S,e.yt[W]=S,S<e.b&&(e.b=S),S>e.p&&(e.p=S)}else if(V&&e.Z&&V.indices&&V.dictionary){let S=V.dictionary[V.indices[L]];e.f.has(S)||(e.f.set(S,e.f.size),e.p=e.f.size-1);let Y=e.f.get(S);m[C]=Y,e.yt[W]=Y}else m[C]=p,e.yt[W]=p;if(e.Pt&&x.labelCol){let S=x.labelCol,Y=S.valid;!(Y!==void 0&&!(Y[L>>3]>>(L&7)&1))&&S.indices&&S.dictionary&&e.Pt.set(W,S.dictionary[S.indices[L]])}if(x.sizeCol){let S=x.sizeCol[L];f[C]=S,S<e.nt&&(e.nt=S),S>e.ot&&(e.ot=S)}else if(b){let S=b[L];f[C]=S,S<e.nt&&(e.nt=S),S>e.ot&&(e.ot=S)}else f[C]=0;C++}if(C===0)continue;let v=(g+h)*2*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_position",u.subarray(0,C*2),v,2);let A=(g+h)*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_color_value",m.subarray(0,C),A),t.v.upload("a_size_value",f.subarray(0,C),A),e.U[p]=h+C,e.U[p]>e.Uo&&(e.Uo=e.U[p])}let d=0;for(let p of e.U)d+=p;e.xt=d,t.uploadedCount=d,e.Zt.markDirty(),isFinite(e.be)&&e.setZoomBaseDomain(e.be,e.et,e.Te,e.tt)}var Is=k(()=>{"use strict";Qt();ws()});function _t(e,t,n,o,i){let r=e.getContext("2d");r&&(r.save(),r.setTransform(1,0,0,1,0,0),r.scale(i,i),r.font=`11px ${o.fontFamily}`,r.fillStyle=o.Le,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var mo=k(()=>{"use strict"});var ne,Ye=k(()=>{"use strict";ne=class{constructor(t,n,o){c(this,"margins");c(this,"e");c(this,"cssWidth");c(this,"cssHeight");c(this,"Y",0);c(this,"J",1);c(this,"q",0);c(this,"Q",1);this.cssWidth=t,this.cssHeight=n;let r=(o.leftExtra??55)+(o.hasYLabel?16:0),a=(o.bottomExtra??24)+(o.hasXLabel?18:0),l=0,u=o.rightExtra??(o.hasLegend?80:16),m=o.originX??0,f=o.originY??0,b=o.cellWidth??t,d=o.cellHeight??n,p=m+r,x=f+l,h=Math.max(1,b-r-u),g=Math.max(1,d-l-a),y=t-(p+h),_=n-(x+g);this.margins={top:x,right:y,bottom:_,left:p},this.e={x:p,y:x,width:h,height:g}}buildProjectionMatrix(t,n,o,i,r,s,a=.02,l=0,u=0){let m=n-t,f=i-o;m===0&&(m=1),f===0&&(f=1);let b=m*a,d=f*a,p=s&&r==="y"&&o>=0,x=s&&r==="y"&&i<=0,h=s&&r==="x"&&t>=0,g=s&&r==="x"&&n<=0;t-=b,n+=b,o-=d,i+=d,p?(o=0,i+=d):x&&(i=0,o-=d),h?(t=0,n+=b):g&&(n=0,t-=b),this.Y=t,this.J=n,this.q=o,this.Q=i;let y=2*this.margins.left/this.cssWidth-1,_=1-2*this.margins.right/this.cssWidth,C=2*this.margins.bottom/this.cssHeight-1,v=1-2*this.margins.top/this.cssHeight,A=(_-y)/(n-t),R=(v-C)/(i-o),L=y-A*(t-l),T=C-R*(o-u);return new Float32Array([A,0,0,0,0,R,0,0,0,0,-1,0,L,T,0,1])}E(t,n){let{x:o,y:i,width:r,height:s}=this.e,a=(t-this.Y)/(this.J-this.Y),l=(n-this.q)/(this.Q-this.q);return{px:o+a*r,py:i+(1-l)*s}}}});function en(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function tn(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function Eu(e,t,n,o){if(e<=1)return{cols:1,rows:1};let i=1,r=e,s=1/0,a=e;for(let l=1;l<=e;l++){let u=Math.ceil(e/l),m=Math.max(1,(t-(l-1)*o)/l),f=Math.max(1,(n-(u-1)*o)/u),b=m/f,d=Math.max(b,1/b),p=l*u;(d<s||d===s&&p<a)&&(i=l,r=u,s=d,a=p)}return{cols:i,rows:r}}function Re(e,t){let n=e.length,{cssWidth:o,cssHeight:i}=t;if(n<=0||o<=0||i<=0)return{cells:[]};let r=t.titleBand??Bu,s=t.hasLegend?Pu:0,a=t.xAxis??"cell",l=t.yAxis??"cell",u=a==="none"&&l==="none",m=l==="outer"?Fu+(t.hasYLabel?Iu:0):0,f=a==="outer"?Su+(t.hasXLabel?Du:0):0,b=0,d=s,p=m,x=b,h=Math.max(1,o-m-d),g=Math.max(1,i-b-f),y=Math.max(0,t.gap??0),{cols:_,rows:C}=Eu(n,h,g,y),v=Math.max(0,_-1)*y,A=Math.max(0,C-1)*y,R=Math.max(1,(h-v)/_),L=Math.max(1,(g-A)/C),T=[];for(let P=0;P<n;P++){let E=Math.floor(P/_),O=P-E*_,W=E===C-1||P+_>=n,V=O===0,S=p+O*(R+y),Y=x+E*(L+y),U=Y+r,X=S,q=R,be=Math.max(1,L-r),Fe=new ne(o,i,{hasXLabel:a==="cell"&&t.hasXLabel===!0,hasYLabel:l==="cell"&&t.hasYLabel===!0,hasLegend:!1,leftExtra:l==="cell"?void 0:0,bottomExtra:a==="cell"?void 0:0,rightExtra:u?0:void 0,originX:X,originY:U,cellWidth:q,cellHeight:be}),_e=r>0?{x:X,y:Y,width:q,height:r}:void 0;T.push({index:P,label:e[P],layout:Fe,titleRect:_e,isLeftEdge:V,isBottomEdge:W})}let F=t.hasLegend?{x:p+h,y:b,width:s,height:g}:void 0,I=a==="outer"?{x:p,y:x+g,width:h,height:f}:void 0;return{cells:T,legendRect:F,outerXAxisRect:I,outerYAxisRect:l==="outer"?{x:0,y:x,width:m,height:g}:void 0}}var Fu,Su,Iu,Du,Bu,Pu,vt=k(()=>{"use strict";Ye();Fu=55,Su=24,Iu=16,Du=18,Bu=18,Pu=96});function Gu(e,t){if(t<=0)return[];let n=new Array(t);for(let o=0;o<t;o++){let i=t===1?.5:o/(t-1),r=Le(e,i);n[o]=[r[0],r[1],r[2]]}return n}function ce(e,t,n){if(e.length>0){if(e.length>=n)return e.slice(0,n);let o=new Array(n);for(let i=0;i<n;i++)o[i]=e[i%e.length];return o}return Gu(t,n)}var nn=k(()=>{"use strict";Ee()});function at(e){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}function lt(e,t,n,o){e.enable(e.SCISSOR_TEST),e.scissor(Math.round(t.margins.left*n),Math.round(t.margins.bottom*n),Math.round(t.e.width*n),Math.round(t.e.height*n));try{o()}finally{e.disable(e.SCISSOR_TEST)}}function ze(e,t,n,o){at(e),lt(e,t,n,o)}var on=k(()=>{"use strict"});function rn(e,t,n){let o=e.gl,i;if(t?.texture){if(i=t.texture,t.lastStops===n)return t}else i=o.createTexture();let r=ps(n,Ds);return o.bindTexture(o.TEXTURE_2D,i),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,Ds,1,0,o.RGBA,o.UNSIGNED_BYTE,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),{texture:i,lastStops:n}}function Ge(e,t,n,o=0){let i=e.gl;i.activeTexture(i.TEXTURE0+o),i.bindTexture(i.TEXTURE_2D,t),i.uniform1i(n,o)}var Ds,At=k(()=>{"use strict";Ee();Ds=256});function le(e,t,n){e.width=Math.round(t.cssWidth*n),e.height=Math.round(t.cssHeight*n);let o=e.getContext("2d");return o?(o.scale(n,n),o.clearRect(0,0,t.cssWidth,t.cssHeight),o):null}function re(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var ut=k(()=>{"use strict"});function fo(e,t,n,o,i,r,s){let a=i==="bottom"?1:-1;e.textAlign="center",e.textBaseline=i==="bottom"?"top":"bottom";let l=a*8;for(let u of n){let m=r(u);m<t.x-1||m>t.x+t.width+1||(e.beginPath(),e.moveTo(m,o),e.lineTo(m,o+a*5),e.stroke(),e.fillText(s(u),m,o+l))}}function co(e,t,n,o,i,r,s){let a=i==="left"?-1:1;e.textAlign=i==="left"?"right":"left",e.textBaseline="middle";let l=a*8;for(let u of n){let m=r(u);m<t.y-1||m>t.y+t.height+1||(e.beginPath(),e.moveTo(o,m),e.lineTo(o+a*5,m),e.stroke(),e.fillText(s(u),o+l,m))}}function Lt(e,t,n,o){for(let i of n){let r=Math.round(o(i))+.5;r<t.x||r>t.x+t.width||(e.beginPath(),e.moveTo(r,t.y),e.lineTo(r,t.y+t.height),e.stroke())}}function Tt(e,t,n,o){for(let i of n){let r=Math.round(o(i))+.5;r<t.y||r>t.y+t.height||(e.beginPath(),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke())}}var po=k(()=>{"use strict"});function Rt(e,t,n){let{e:o}=n,i=Math.max(2,Math.floor(o.width/90)),r=Math.max(2,Math.floor(o.height/60));return{xTicks:ie(e.min,e.max,i),yTicks:ie(t.min,t.max,r)}}function Oi(e,t,n,o,i,r){let s=re(e,r);if(!s)return;let{e:a}=t;s.strokeStyle=i.ln,s.lineWidth=1,Lt(s,a,n,l=>t.E(l,0).px),Tt(s,a,o,l=>t.E(0,l).py)}function Bs(e,t,n){if(n)return n;let o=t.length>1?t[1]-t[0]:0;return e.isDate?i=>ye(i,o):ue}function Ps(e,t,n,o,i,r,s,a,l){let{St:u,Le:m,jn:f,fontFamily:b}=s,d=Bs(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(r.x,i),e.lineTo(r.x+r.width,i),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let p of o)fo(e,p.e,n,i,"bottom",x=>p.E(x,0).px,d);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,a.cx,a.baselineY))}function Es(e,t,n,o,i,r,s,a,l){let{St:u,Le:m,jn:f,fontFamily:b}=s,d=Bs(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(i,r.y),e.lineTo(i,r.y+r.height),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let p of o)co(e,p.e,n,i,"left",x=>p.E(0,x).py,d);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.save(),e.translate(14,a.pivotY),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,0,0),e.restore())}function Vi(e,t,n,o,i,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Ps(l,t,o,[n],u.y+u.height,u,i,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,a)}function Hi(e,t,n,o,i,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Es(l,t,o,[n],u.x,u,i,r?{pivotY:u.y+u.height/2}:null,a)}function sn(e,t,n,o,i,r,s,a,l){let u=re(e,a);u&&Ps(u,n,o,i,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,l)}function an(e,t,n,o,i,r,s,a,l){let u=re(e,a);u&&Es(u,n,o,i,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,l)}var Yi=k(()=>{"use strict";Ae();ut();po()});function zi(e,t,n,o,i){if(i===0)return{x:e-n/2,y:t,width:n,height:o};if(i===90)return{x:e-o/2,y:t,width:o,height:n};let r=(n+o)/Math.SQRT2;return{x:e-r,y:t,width:r,height:r}}function Xi(e,t){return e.x<=t.x+t.width&&t.x<=e.x+e.width&&e.y<=t.y+t.height&&t.y<=e.y+e.height}function Gs(e,t){return e.x+e.width+14>t.x+t.width}function $i(e,t){return e.x>=t.x&&e.x+e.width<=t.x+t.width&&e.y>=t.y&&e.y+e.height<=t.y+t.height}function mt(e,t,n){if(n<=0)return"";if(e.measureText(t).width<=n)return t;let o=0,i=t.length;for(;o<i;){let r=o+i+1>>1,s=t.slice(0,r)+"\\u2026";e.measureText(s).width<=n?o=r:i=r-1}return o===0?"":t.slice(0,o)+"\\u2026"}function Ws(e,t,n,o){if(o<=0||n<=0)return[];if(e.measureText(t).width<=n)return[t];let i=[],r=t;for(;r.length>0&&i.length<o;){let s=i.length===o-1,a=r.length;for(;a>0&&e.measureText(r.slice(0,a)).width>n;)a--;if(a===0&&(a=1),a===r.length){i.push(r);break}let l=a,u=r.lastIndexOf(" ",a);if(u>0&&(l=u),s){i.push(mt(e,r,n));break}i.push(r.slice(0,l)),r=r.slice(l).trimStart()}return i.length===1&&i[0].length<=2?[]:i}var bo=k(()=>{"use strict"});function go(e,t,n,o){let i=[];if(o<=n)return i;let r=n,s=e[n];for(let a=n+1;a<o;a++){let l=e[a];l!==s&&(i.push({startIdx:r,endIdx:a-1,label:t[s]??""}),r=a,s=l)}return i.push({startIdx:r,endIdx:o-1,label:t[s]??""}),i}function ln(e,t,n){if(n<t)return[];let o=[];for(let i of e){if(i.endIdx<t||i.startIdx>n)continue;let r=i.startIdx<t?t:i.startIdx,s=i.endIdx>n?n:i.endIdx;r===i.startIdx&&s===i.endIdx?o.push(i):o.push({startIdx:r,endIdx:s,label:i.label})}return o}var un=k(()=>{"use strict"});function ji(e,t){return e.E(t,0).px}function Zi(e,t){return e.E(0,t).py}function Vu(e,t,n){let o=Math.max(0,n-100);return e*16>o?{size:t*6.62+10,rotation:90}:e*(t*6+10)>o?{size:t*4+20,rotation:45}:{size:Wu,rotation:0}}function ks(e,t){let n=e.levels.length,o=[];for(let i=0;i<n;i++){let r=e.levels[i];i===n-1?o.push(Vu(e.numRows,r.maxLabelChars,t)):o.push({size:ku,rotation:0})}return o}function Ns(e){let t=e.levels.length,n=[],o=6.2;for(let i=0;i<t;i++)if(i===t-1){let r=e.levels[i].maxLabelChars;n.push(Math.max(Nu,r*o+Ou))}else n.push(Uu);return n}function Us(e){let t=0;for(let n of e)t+=n;return t}function We(e,t){return e.numRows===0||e.levels.length===0?24:Us(ks(e,t).map(n=>n.size))}function Mt(e){return e.numRows===0||e.levels.length===0?55:Us(Ns(e))}function Hu(e,t,n,o){let i=t-e+1;if(i<=0)return[];let r=Math.max(1,Math.floor(n/o));if(i<=r){let l=[];for(let u=e;u<=t;u++)l.push(u);return l}let s=Math.ceil(i/r),a=[];for(let l=e;l<=t;l+=s)a.push(l);return a}function Os(e,t){return e.labels[t]??""}function Vs(e,t,n,o){let i=o?Math.min(t,n):t,r=o?Math.max(t,n):n,s=Math.max(0,Math.ceil(i)),a=Math.min(e-1,Math.floor(r));return a<s?null:[s,a]}function Hs(e,t,n,o){let i=[];for(let r of e){let s=t(r.startIdx-.5),a=t(r.endIdx+.5),l=Math.max(n,Math.min(s,a)),u=Math.min(o,Math.max(s,a));u>l&&i.push({run:r,nearEdge:s,farEdge:a,nearClip:l,farClip:u})}return i}function de(e,t,n,o){if(n.numRows===0||n.levels.length===0)return;let{St:i,Le:r,fontFamily:s}=o,{e:a}=t,l=a.y+a.height;e.strokeStyle=i,e.fillStyle=i,e.lineWidth=1,e.font=`${wt}px ${s}`;let u=ks(n,a.width),m=Vs(n.numRows,t.Y,t.J,!1);if(!m)return;let[f,b]=m,d=n.levels.length,p=l;for(let h=d-1;h>=0;h--){let g=n.levels[h],y=u[h],_=p;p+=y.size,h===d-1?Yu(e,t,g,f,b,_,y,s,i):zu(e,t,g,f,b,_,s,i)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=r,e.font=`13px ${s}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(x,a.x+a.width/2,t.cssHeight-2))}function Yu(e,t,n,o,i,r,s,a,l){let{e:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),b=s.rotation===0?Hu(o,i,u.width,f):Xu(o,i);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let h of b){let g=ji(t,h);g<u.x-1||g>u.x+u.width+1||(e.moveTo(g,r),e.lineTo(g,r+ho))}e.stroke(),e.font=`${wt}px ${a}`;let d=r+ho+3,p={x:u.x,width:u.width,y:r,height:9999},x=[];for(let h of b){let g=ji(t,h);if(g<u.x-1||g>u.x+u.width+1)continue;let y=Os(n,h);if(!y)continue;let _=e.measureText(y).width,C=zi(g,d,_,qi,s.rotation);if($i(C,p)){if(s.rotation===0){if(x.some(v=>Xi(v,C)))continue}else if(x.some(v=>Gs(v,C)))continue;x.push(C),Ys(e,y,g,d,s.rotation,"center")}}}function zu(e,t,n,o,i,r,s,a){let{e:l}=t,u=ln(n.runs,o,i);if(u.length===0)return;let m=Hs(u,p=>ji(t,p),l.x,l.x+l.width);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let p of m)e.moveTo(p.nearClip,r+3),e.lineTo(p.farClip,r+3),e.moveTo(p.nearEdge,r),e.lineTo(p.nearEdge,r+3),e.moveTo(p.farEdge,r),e.lineTo(p.farEdge,r+3);e.stroke(),e.font=`${wt}px ${s}`;let f=r+3+4,b=[],d={x:l.x,width:l.width,y:r,height:9999};for(let p of m){let x=(p.nearClip+p.farClip)/2,h=p.run.label;if(!h)continue;let g=p.farClip-p.nearClip-4,y=mt(e,h,g);if(!y)continue;let _=e.measureText(y).width,C=zi(x,f,_,qi,0);$i(C,d)&&(b.some(v=>Xi(v,C))||(b.push(C),Ys(e,y,x,f,0,"center")))}}function Xu(e,t){let n=[];for(let o=e;o<=t;o++)n.push(o);return n}function we(e,t,n,o){if(n.numRows===0||n.levels.length===0)return;let{St:i,Le:r,fontFamily:s}=o,{e:a}=t,l=a.x;e.strokeStyle=i,e.fillStyle=i,e.lineWidth=1,e.font=`${wt}px ${s}`;let u=Ns(n),m=Vs(n.numRows,t.q,t.Q,!0);if(!m)return;let[f,b]=m,d=n.levels.length,p=l;for(let h=d-1;h>=0;h--){let g=n.levels[h],y=u[h],_=p;p-=y,h===d-1?$u(e,t,g,f,b,_,s,i):ju(e,t,g,f,b,_,y,s,i)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=r,e.font=`13px ${s}`,e.save(),e.translate(14,a.y+a.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(x,0,0),e.restore())}function $u(e,t,n,o,i,r,s,a){let{e:l}=t,u=qi+4,m=i-o+1,f=Math.max(1,Math.floor(l.height/u)),b=m<=f?1:Math.ceil(m/f);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let d=o;d<=i;d+=b){let p=Zi(t,d);p<l.y-1||p>l.y+l.height+1||(e.moveTo(r-ho,p),e.lineTo(r,p))}e.stroke(),e.font=`${wt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let d=o;d<=i;d+=b){let p=Zi(t,d);if(p<l.y-1||p>l.y+l.height+1)continue;let x=Os(n,d);x&&e.fillText(x,r-ho-3,p)}}function ju(e,t,n,o,i,r,s,a,l){let{e:u}=t,m=ln(n.runs,o,i);if(m.length===0)return;let f=Hs(m,d=>Zi(t,d),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=l,e.fillStyle=l;let b=r-3;e.beginPath();for(let d of f)e.moveTo(b,d.nearClip),e.lineTo(b,d.farClip),e.moveTo(b,d.nearEdge),e.lineTo(r,d.nearEdge),e.moveTo(b,d.farEdge),e.lineTo(r,d.farEdge);e.stroke(),e.font=`${wt}px ${a}`,e.textAlign="right",e.textBaseline="middle";for(let d of f){let p=(d.nearClip+d.farClip)/2,x=d.run.label;if(!x)continue;let h=s-6,g=mt(e,x,h);g&&e.fillText(g,b-3,p)}}function Ys(e,t,n,o,i,r){if(i===0){e.textAlign=r==="end"?"right":"center",e.textBaseline="top",e.fillText(t,n,o);return}e.save(),e.translate(n,o),e.rotate(-i*Math.PI/180),e.textAlign="right",e.textBaseline="middle",e.fillText(t,-2,0),e.restore()}var Wu,ku,ho,wt,qi,Nu,Uu,Ou,Ft=k(()=>{"use strict";bo();un();Wu=25,ku=22,ho=5,wt=11,qi=14,Nu=55,Uu=60,Ou=10});function Zu(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function St(e,t,n,o,i,r){let s={x:t.e.x+t.e.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};mn(e,s,n,o,i,r)}function mn(e,t,n,o,i,r=ue){let s=e.getContext("2d");if(!s)return;let a=i.un,l=i.Ji,u=i.fontFamily,m=16,f=Math.min(120,t.height*.4),b=t.x,d=t.y;s.fillStyle=a,s.font=`9px ${u}`,s.textAlign="left",s.textBaseline="bottom",s.fillText(n.label,b,d-4);let p=n.max,x=n.min,h=s.createLinearGradient(0,d,0,d+f),g=16;for(let _=0;_<=g;_++){let C=_/g,v=p+C*(x-p),A=rt(v,n.min,n.max),R=Le(o,A);h.addColorStop(C,Zu(R))}s.fillStyle=h,s.fillRect(b,d,m,f),s.strokeStyle=l,s.lineWidth=1,s.strokeRect(b,d,m,f),s.fillStyle=a,s.font=`10px ${u}`,s.textAlign="left",s.textBaseline="middle";let y=b+m+5;if(s.fillText(r(n.max),y,d+2),s.fillText(r((n.min+n.max)/2),y,d+f/2),s.fillText(r(n.min),y,d+f-2),n.min<0&&n.max>0){let _=(n.max-0)/(n.max-n.min),C=d+_*f;s.strokeStyle=a,s.lineWidth=1,s.beginPath(),s.moveTo(b+m,C),s.lineTo(b+m+4,C),s.stroke(),s.fillStyle=a,s.fillText("0",y,C)}}function xo(e,t,n,o,i){let r={x:t.e.x+t.e.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};fn(e,r,n,o,i)}function fn(e,t,n,o,i){let r=e.getContext("2d");if(!r||n.size===0)return;let s=i.un,a=i.fontFamily,l=10,u=18,m=t.x,f=t.y+u/2;r.font=`11px ${a}`,r.textAlign="left",r.textBaseline="middle";for(let[b,d]of n){if(f+l/2>t.y+t.height)break;let p=o[d]??o[d%o.length]??[0,0,0];r.fillStyle=`rgb(${Math.round(p[0]*255)},${Math.round(p[1]*255)},${Math.round(p[2]*255)})`,r.fillRect(m,f-l/2,l,l),r.fillStyle=s,r.fillText(b,m+l+6,f),f+=u}}var yo=k(()=>{"use strict";Ae();Ee()});function Xe(e){return isNaN(e)?0:e}function zs(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0)return;let s=e.L.length>0,a=e.W.facet_mode,l=s&&a==="grid";e.computeEffectiveFacetFlags();let u=e.s!==""&&e.b<e.p,m=l&&e.W.zoom_mode==="independent",f;if(e.g&&!m?f=e.g.getVisibleDomain():f={xMin:e.be,xMax:e.et,yMin:e.Te,yMax:e.tt},!isFinite(f.xMin)||!isFinite(f.yMin))return;let b=e.A(),d=b.Ge,p=e.We[e.ke]||"",x=e.We[e.Ie]||"",h=p==="date"||p==="datetime",g=x==="date"||x==="datetime",y=e.Z,_=!y&&!e.s,C=b.H;if(y||_){let v=_?Math.max(1,e.L.length):Math.max(1,e.f.size);if(e.so&&e.Yo===d&&e.zo===v)C=e.so;else{let A=ce(d,b.H,v);C=ds(A),e.so=C,e.Yo=d,e.zo=v}}else e.so=null,e.Yo=null,e.zo=-1;e.oe=rn(t,e.oe,C),l?Ju(e,t,f,b,{xIsDate:h,yIsDate:g,cssWidth:i,cssHeight:r}):(e.m=null,Ku(e,t,f,b,{xIsDate:h,yIsDate:g,cssWidth:i,cssHeight:r,hasColorCol:u})),e.pe(()=>$e(e))}function Co(e,t,n,o){return{min:t,max:n,label:e.ke||(e.Ii?"Row":e.$e||""),isDate:o}}function _o(e,t,n,o){return{min:t,max:n,label:e.Ie||e.Ne,isDate:o}}function vo(e,t){let n=0;for(let i of e)i.length>n&&(n=i.length);return{levels:[{labels:e.slice(),runs:[],maxLabelChars:n}],numRows:e.length,levelLabels:[t]}}function qu(e,t,n,o,i,r,s,a,l){if(e.De&&e.it){let u=re(t,l);u&&de(u,n,e.it,a)}else Vi(t,o,n,r,a,!0,l,e.getColumnFormatter(e.$e,"tick"));if(e.ge&&e.rt){let u=re(t,l);u&&we(u,n,e.rt,a)}else Hi(t,i,n,s,a,!0,l,e.getColumnFormatter(e.Ne,"tick"))}function Ku(e,t,n,o,i){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u,hasColorCol:m}=i;e.it=e.De&&e.qt.length>0?vo(e.qt,e.ke||e.$e||""):null,e.rt=e.ge&&e.Kt.length>0?vo(e.Kt,e.Ie||e.Ne||""):null;let f=m?80:16,b=55+(e.Ie?16:0),d=Math.max(1,s-b-f),p=e.rt?Mt(e.rt):void 0,x=e.it?We(e.it,d):void 0,h=new ne(s,a,{hasXLabel:!!e.ke,hasYLabel:!!e.Ie,hasLegend:m,leftExtra:p,bottomExtra:x});e.a=h,e.g&&e.g.updateLayout(h);let g=h.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,Xe(e.w),Xe(e.M)),y=Co(e,n.xMin,n.xMax,l),_=_o(e,n.yMin,n.yMax,u),C=Rt(y,_,h),v=e.De?[]:C.xTicks,A=e.ge?[]:C.yTicks,R=e.yn==="map",L=t.dpr,T=e.j;T&&!R?e.pe(()=>{le(T,h,L),Oi(T,h,v,A,o,L)}):T&&R&&e.pe(()=>le(T,h,L)),ze(r,h,t.dpr,()=>{R&&e.renderBackground(t,h,g,n,Xe(e.w),Xe(e.M)),e.glyph.draw(e,t,g)}),e.he=y,e.xe=_,e.ao=v,e.Re=A,e.uo=o.H,e.mo=m}function Ju(e,t,n,o,i){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u}=i;e.it=e.De&&e.qt.length>0?vo(e.qt,e.ke||e.$e||""):null,e.rt=e.ge&&e.Kt.length>0?vo(e.Kt,e.Ie||e.Ne||""):null;let m=e.L.map(L=>L.prefix),f=e.Z&&e.f.size>1,b=!!e.s&&!e.Z&&e.b<e.p,d=f||b,p=Re(m,{cssWidth:s,cssHeight:a,xAxis:e.qn?"outer":"cell",yAxis:e.Kn?"outer":"cell",hasLegend:d,hasXLabel:!!e.ke,hasYLabel:!!e.Ie,gap:e.W.facet_padding});if(e.m=p,p.cells.length>1){let L=p.cells[0].layout.e;for(let T=1;T<p.cells.length;T++){let F=p.cells[T].layout.e;if(F.width!==L.width||F.height!==L.height){console.warn(`facet-grid: cell ${T} size (${F.width}\\xD7${F.height}) differs from cell 0 (${L.width}\\xD7${L.height})`);break}}}e.a=p.cells[0]?.layout??null,e.syncFacetZoomLayouts(p.cells);let x=e.W.zoom_mode==="independent",h=Co(e,n.xMin,n.xMax,l),g=_o(e,n.yMin,n.yMax,u),y=p.cells[0]?.layout,_=y?Rt(h,g,y):{xTicks:[],yTicks:[]},C=e.De?[]:_.xTicks,v=e.ge?[]:_.yTicks,A=t.dpr,R=e.j;R&&y&&e.pe(()=>le(R,y,A)),at(r);for(let L=0;L<p.cells.length;L++){let T=p.cells[L],F=e.getZoomControllerForFacet(L),I=x&&F?F.getVisibleDomain():n,D=T.layout.buildProjectionMatrix(I.xMin,I.xMax,I.yMin,I.yMax,void 0,void 0,void 0,Xe(e.w),Xe(e.M)),P=e.yn==="map";R&&!P&&e.pe(()=>{let E=x?Rt(Co(e,I.xMin,I.xMax,l),_o(e,I.yMin,I.yMax,u),T.layout).xTicks:C,O=x?Rt(Co(e,I.xMin,I.xMax,l),_o(e,I.yMin,I.yMax,u),T.layout).yTicks:v;Oi(R,T.layout,E,O,o,A)}),lt(r,T.layout,t.dpr,()=>{P&&e.renderBackground(t,T.layout,D,I,Xe(e.w),Xe(e.M)),e.glyph.drawSeries(e,t,D,L)})}e.he=h,e.xe=g,e.ao=C,e.Re=v,e.uo=o.H,e.mo=d}function $e(e){!e.c||!e.a||!e.he||!e.xe||!e.t||(le(e.c,e.a,e.t.dpr),e.m?em(e):Qu(e))}function Qu(e){let t=e.a,n=e.A(),o=e.t?.dpr??1;if(e.yn==="map"?e.renderMapChrome(e.c,t,n,o):qu(e,e.c,t,e.he,e.xe,e.ao,e.Re,n,o),e.mo){let r=e.uo??n.H;if(e.Z&&e.f.size>0){let s=ce(n.Ge,r,e.f.size);xo(e.c,t,e.f,s,n)}else e.s&&St(e.c,t,{min:e.b,max:e.p,label:e.s},r,n,e.getColumnFormatter(e.s,"value"))}Xs(e,e.c,t,0,1),e.ae>=0&&e.O&&e.V&&om(e,e.c,t)}function em(e){let t=e.m,n=e.c,o=e.A(),i=e.t?.dpr??1,r=e.ao,s=e.Re,a=e.he,l=e.xe,u=e.yn==="map",m=e.qn&&!e.De,f=e.Kn&&!e.ge,b=e.W.zoom_mode==="independent";u&&e.renderMapChrome(n,e.a,o,i),!u&&m&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,a,r,en(t),o,!!e.ke,i,e.getColumnFormatter(e.$e,"tick")),!u&&f&&t.outerYAxisRect&&an(n,t.outerYAxisRect,l,s,tn(t),o,!!e.Ie,i,e.getColumnFormatter(e.Ne,"tick"));for(let d=0;d<t.cells.length;d++){let p=t.cells[d],x=b?e.getZoomControllerForFacet(d):null,h=x?x.getVisibleDomain():null,g=h?{...a,min:h.xMin,max:h.xMax}:a,y=h?{...l,min:h.yMin,max:h.yMax}:l,_=b?Rt(g,y,p.layout):{xTicks:r,yTicks:s};if(!u&&!m)if(e.De&&e.it){let C=re(n,i);C&&de(C,p.layout,e.it,o)}else Vi(n,g,p.layout,_.xTicks,o,!!e.ke,i,e.getColumnFormatter(e.$e,"tick"));if(!u&&!f)if(e.ge&&e.rt){let C=re(n,i);C&&we(C,p.layout,e.rt,o)}else Hi(n,y,p.layout,_.yTicks,o,!!e.Ie,i,e.getColumnFormatter(e.Ne,"tick"));p.titleRect&&_t(n,p.label,p.titleRect,o,i),Xs(e,n,p.layout,d,d+1)}if(e.mo&&t.legendRect){let d=e.uo??o.H;if(e.Z&&e.f.size>0){let p=ce(o.Ge,d,Math.max(1,e.f.size));fn(n,t.legendRect,e.f,p,o)}else e.s&&mn(n,{x:t.legendRect.x,y:t.legendRect.y+20,width:t.legendRect.width,height:t.legendRect.height-20},{min:e.b,max:e.p,label:e.s},d,o,e.getColumnFormatter(e.s,"value"))}if(e.ae>=0&&e.O&&e.V){let d=isNaN(e.w)?0:e.w,p=isNaN(e.M)?0:e.M,x=e.O[e.ae]+d,h=e.V[e.ae]+p,g=tm(e,e.ae),y=e.glyph.tooltipOptions(),_=e.k.lines??[];for(let C=0;C<t.cells.length;C++){let v=t.cells[C],A=C===g,R=v.layout.E(x,h),L=v.layout.e;if(R.px<L.x||R.px>L.x+L.width||R.py<L.y||R.py>L.y+L.height)continue;let T=e.W.coordinated_tooltip;Pe(n,R,A||T?_:[],v.layout,o,i,{crosshair:y.crosshair,highlightRadius:A?y.highlightRadius:0})}}}function tm(e,t){return e.R<=0?0:Math.floor(t/e.R)}function Xs(e,t,n,o,i){if(!e.Pt||!e.O||!e.V)return;let r=e.Pt.dictionary,s=e.Pt.data,a=e.O,l=e.V,u=isNaN(e.w)?0:e.w,m=isNaN(e.M)?0:e.M,f=e.R;if(f<=0)return;let b=0;for(let y=o;y<i;y++)b+=e.U[y]??0;if(b===0)return;let d=e.t?.dpr??1,p=re(t,d);if(!p)return;let x=e.A(),h=n.e,g=Math.max(1,Math.ceil(b/nm));p.save(),p.font=`11px ${x.fontFamily}`,p.fillStyle=x.Le,p.textAlign="left",p.textBaseline="middle";for(let y=o;y<i;y++){let _=e.U[y]??0,C=y*f;for(let v=0;v<_;v+=g){let A=C+v,R=s[A];if(R<0)continue;let{px:L,py:T}=n.E(a[A]+u,l[A]+m);L<h.x||L>h.x+h.width||T<h.y||T>h.y+h.height||p.fillText(r[R],L+8,T-4)}}p.restore()}function om(e,t,n){let o=e.ae;if(o<0||!e.O||!e.V)return;let i=isNaN(e.w)?0:e.w,r=isNaN(e.M)?0:e.M,s=n.E(e.O[o]+i,e.V[o]+r),a=e.k.lines??[],l=e.A();Pe(t,s,a,n,l,e.t?.dpr??1,e.glyph.tooltipOptions())}var nm,Ki=k(()=>{"use strict";mo();Ye();vt();nn();Ee();on();At();Ct();Yi();ut();Ft();yo();nm=5e3});function im(e){if(!e.Zt.isDirty||!e.O||!e.V)return;let t=e.O,n=e.V,o=Math.max(1,e.L.length),i=e.R,r=isNaN(e.w)?0:e.w,s=isNaN(e.M)?0:e.M;e.Zt.rebuild({xMin:e.be-r,xMax:e.et-r,yMin:e.Te-s,yMax:e.tt-s},e.xt,a=>{for(let l=0;l<o;l++){let u=e.U[l]??0,m=l*i;for(let f=0;f<u;f++)a(m+f,t[m+f],n[m+f])}})}function Ji(e,t,n){if(!e.O||!e.V)return;let{layout:o,facetIdx:i}=rm(e,t,n);if(!o){$s(e);return}let r=o.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){$s(e);return}let s=o.Y,a=o.J,l=o.q,u=o.Q,m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),d=r.height/(u-l),p=isNaN(e.w)?0:e.w,x=isNaN(e.M)?0:e.M,h=m-p,g=f-x,y=i<0?sm(e,h,g,b,d):am(e,i,h,g,b,d);if(y!==e.ae||i!==e.Cn){if(e.ae=y,e.Cn=i,y>=0){let _=e.k.beginHover(y);e.glyph.buildTooltipLines(e,y).then(C=>{e.k.commitHover(_,C)&&$e(e)})}else e.k.clearHover();$e(e)}}function $s(e){(e.ae!==-1||e.Cn!==-1)&&(e.ae=-1,e.Cn=-1,$e(e))}function rm(e,t,n){if(e.m){let o=e.m.cells;for(let i=0;i<o.length;i++){let r=o[i].layout.e;if(t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)return{layout:o[i].layout,facetIdx:i}}return{layout:null,facetIdx:-1}}return{layout:e.a,facetIdx:-1}}function sm(e,t,n,o,i){im(e);let r=e.Zt.query(t,n,cn,o,i,e.O,e.V);if(r>=0)return r;let s=cn*cn,a=Math.max(1,e.L.length),l=e.R,u=e.O,m=e.V;for(let f=0;f<a;f++){let b=e.U[f]??0,d=f*l;for(let p=0;p<b;p++){let x=d+p,h=(u[x]-t)*o,g=(m[x]-n)*i,y=h*h+g*g;y<s&&(s=y,r=x)}}return r}function am(e,t,n,o,i,r){let s=e.U[t]??0;if(s===0)return-1;let a=e.R,l=t*a,u=e.O,m=e.V,f=cn*cn,b=-1;for(let d=0;d<s;d++){let p=l+d,x=(u[p]-n)*i,h=(m[p]-o)*r,g=x*x+h*h;g<f&&(f=g,b=p)}return b}function js(e,t){if(e.T.dismiss(),e.Xo=t,t<0||!e.O||!e.V)return;let n=lm(e,t);if(!n)return;let o=isNaN(e.w)?0:e.w,i=isNaN(e.M)?0:e.M,r=n.E(e.O[t]+o,e.V[t]+i),s=e.k.beginPin();e.glyph.buildTooltipLines(e,t).then(a=>{e.k.isPinFresh(s)&&e.Xo===t&&a.length!==0&&e.T.pin(a,r,n)}),e.ae=-1,e.Cn=-1,$e(e)}function lm(e,t){if(e.m&&e.R>0){let n=Math.floor(t/e.R),o=e.m.cells[n];if(o)return o.layout}return e.a}function Zs(e){e.T.dismiss(),e.Xo=-1}var cn,qs=k(()=>{"use strict";Ki();cn=24});var It,Qi=k(()=>{"use strict";It=class{constructor(){c(this,"lines",null);c(this,"hoveredTarget",null);c(this,"$o",0);c(this,"jo",0)}beginHover(t){return this.lines=null,this.hoveredTarget=t,++this.$o}commitHover(t,n){return t!==this.$o?!1:(this.lines=n,!0)}clearHover(){this.lines=null,this.hoveredTarget=null,this.$o++}beginPin(){return++this.jo}isPinFresh(t){return t===this.jo}invalidatePin(){this.jo++}}});function j(e,t,n,o,i,r){let s=e.shaders.getOrCreate(t,n,o),a=e.gl,l={program:s};for(let u of i)l[u]=a.getUniformLocation(s,u);for(let u of r)l[u]=a.getAttribLocation(s,u);return l}var me=k(()=>{"use strict"});async function Ao(e,t){let n=[];if(!e.Bt||!e.Se)return n;let o=e.Bt[t];if(o<0)return n;if(e.L.length>0&&e.R>0){let s=Math.floor(t/e.R),a=e.L[s];a?.prefix&&n.push(a.prefix)}let i=await e.Se.fetchRow(o),r=e.L.length>0&&e.R>0?e.L[Math.floor(t/e.R)]?.prefix??null:null;for(let[s,a]of i){if(a==null)continue;let l=s;if(r!==null){let u=`${r}|`;if(!s.startsWith(u))continue;l=s.substring(u.length)}else if(s.includes("|"))continue;if(typeof a=="number"){let u=e.getColumnFormatter(s,"value")(a);n.push(`${l}: ${u}`)}else n.push(`${l}: ${a}`)}return n}var er=k(()=>{"use strict"});function um(e,t,n,o,i){t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,o.h.point_size_px*i),o.b<o.p?t.uniform2f(e.u_color_range,o.b,o.p):t.uniform2f(e.u_color_range,0,0),o.nt<o.ot?t.uniform2f(e.u_size_range,o.nt,o.ot):t.uniform2f(e.u_size_range,0,0);let r=Math.min(o.h.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*i,o.h.point_size_px/r*i),o.h.point_size_px*r*i)}function Ks(e,t,n,o){let i=n.gl;if(!t.oe)return!1;i.useProgram(e.program),um(e,i,o,t,n.dpr),Ge(n,t.oe.texture,e.u_gradient_lut,0);let r=n.v.peek("a_position"),s=n.v.peek("a_color_value"),a=n.v.peek("a_size_value");return!r||!s||!a?!1:(i.bindBuffer(i.ARRAY_BUFFER,r.buffer),i.enableVertexAttribArray(e.a_position),i.vertexAttribPointer(e.a_position,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,s.buffer),i.enableVertexAttribArray(e.a_color_value),i.vertexAttribPointer(e.a_color_value,1,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,a.buffer),i.enableVertexAttribArray(e.a_size_value),i.vertexAttribPointer(e.a_size_value,1,i.FLOAT,!1,0,0),!0)}var Dt,tr=k(()=>{"use strict";At();me();er();Ri();wi();Dt=class{constructor(){c(this,"name","point");c(this,"d",null)}ensureProgram(t,n){this.d||(this.d=j(n,"scatter",Bn,Pn,["u_projection","u_point_size","u_color_range","u_gradient_lut","u_size_range","u_point_size_range"],["a_position","a_color_value","a_size_value"]))}draw(t,n,o){let i=this.d;if(!i||!Ks(i,t,n,o))return;let r=n.gl,s=Math.max(1,t.L.length),a=t.R;for(let l=0;l<s;l++){let u=t.U[l]??0;u<=0||r.drawArrays(r.POINTS,l*a,u)}}drawSeries(t,n,o,i){let r=this.d;if(!r||!Ks(r,t,n,o))return;let s=t.U[i]??0;if(s<=0)return;let a=n.gl,l=t.R;a.drawArrays(a.POINTS,i*l,s)}buildTooltipLines(t,n){return Ao(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6}}destroy(t){this.d=null}}});function J(e){let t=e.gl;if(e.isWebGL2){let o=t;return{setDivisor(i,r){i<0||o.vertexAttribDivisor(i,r)},drawArraysInstanced(i,r,s,a){o.drawArraysInstanced(i,r,s,a)}}}let n=t.getExtension("ANGLE_instanced_arrays");return{setDivisor(o,i){o<0||n?.vertexAttribDivisorANGLE(o,i)},drawArraysInstanced(o,i,r,s){n?.drawArraysInstancedANGLE(o,i,r,s)}}}function je(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,1,2,3]),e.STATIC_DRAW),t}function Lo(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW),t}function Ze(e,t,n,o,i,r=0){if(n<0)return!0;let s=e.v.peek(o);if(!s)return!1;let a=e.gl;return a.bindBuffer(a.ARRAY_BUFFER,s.buffer),a.enableVertexAttribArray(n),a.vertexAttribPointer(n,i,a.FLOAT,!1,0,r*i*Float32Array.BYTES_PER_ELEMENT),t.setDivisor(n,1),!0}var Me=k(()=>{"use strict"});function Js(e,t,n,o){let i=n.gl;if(!t.oe)return!1;let r=n.dpr;i.useProgram(e.program),i.uniformMatrix4fv(e.u_projection,!1,o),i.uniform2f(e.u_resolution,i.canvas.width,i.canvas.height),i.uniform1f(e.u_line_width,t.h.line_width_px*r),t.b<t.p?i.uniform2f(e.u_color_range,t.b,t.p):i.uniform2f(e.u_color_range,0,0),Ge(n,t.oe.texture,e.u_gradient_lut,0);let s=J(n),{setDivisor:a}=s;return i.bindBuffer(i.ARRAY_BUFFER,e.cornerBuffer),i.enableVertexAttribArray(e.a_corner),i.vertexAttribPointer(e.a_corner,1,i.FLOAT,!1,0,0),a(e.a_corner,0),i.enableVertexAttribArray(e.a_start),a(e.a_start,1),i.enableVertexAttribArray(e.a_end),a(e.a_end,1),i.enableVertexAttribArray(e.a_color_start),a(e.a_color_start,1),i.enableVertexAttribArray(e.a_color_end),a(e.a_color_end,1),!0}function Qs(e,t,n,o){let i=t.U[o]??0;if(i<2)return;let r=n.gl,s=t.R,a=2*Float32Array.BYTES_PER_ELEMENT,l=Float32Array.BYTES_PER_ELEMENT,u=n.v.peek("a_position"),m=n.v.peek("a_color_value");if(!u||!m)return;let f=o*s*a;r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(e.a_start,2,r.FLOAT,!1,a,f),r.vertexAttribPointer(e.a_end,2,r.FLOAT,!1,a,f+a);let b=o*s*l;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,l,b),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,l,b+l),J(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,i-1)}function ea(e,t){let{setDivisor:n}=J(t);n(e.a_start,0),n(e.a_end,0),n(e.a_color_start,0),n(e.a_color_end,0)}var Bt,nr=k(()=>{"use strict";At();Me();me();Ae();Li();Ti();Bt=class{constructor(){c(this,"name","line");c(this,"d",null)}ensureProgram(t,n){if(this.d)return;let o=j(n,"line",In,Dn,["u_projection","u_resolution","u_line_width","u_color_range","u_gradient_lut"],["a_start","a_end","a_color_start","a_color_end","a_corner"]);this.d={...o,cornerBuffer:je(n.gl)}}draw(t,n,o){let i=this.d;if(!i||!Js(i,t,n,o))return;let s=Math.max(1,t.L.length);for(let a=0;a<s;a++)Qs(i,t,n,a);ea(i,n)}drawSeries(t,n,o,i){let r=this.d;r&&Js(r,t,n,o)&&(Qs(r,t,n,i),ea(r,n))}async buildTooltipLines(t,n){let o=[];if(!t.O||!t.V)return o;if(t.L.length>0&&t.R>0){let b=Math.floor(n/t.R),d=t.L[b];d&&o.push(d.prefix)}let i=t.O[n],r=t.V[n],s=t.We[t.ke]||"",l=s==="date"||s==="datetime"?ye(i):ue(i);o.push(`${t.ke||"Row"}: ${l}`);let u=t.We[t.Ie]||"",f=u==="date"||u==="datetime"?ye(r):ue(r);return o.push(`${t.Ie}: ${f}`),o}tooltipOptions(){return{crosshair:!0,highlightRadius:5}}destroy(t){let n=this.d;n?.cornerBuffer&&t.t&&t.t.gl.deleteBuffer(n.cornerBuffer),this.d=null}}});function pm(e){switch(e){case"density":return mm;case"extreme":return cm;case"signed":return dm;case"mean":default:return fm}}function ta(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function or(e,t,n,o){return j(e,t,n,o,["u_projection","u_radius_ndc","u_intensity","u_color_range"],["a_corner","a_position","a_color_value"])}function bm(e){let t=e.gl;if(e.isWebGL2){let n=t;if(n.getExtension("EXT_color_buffer_float"))return{internalFormat:n.RGBA16F,format:n.RGBA,type:n.HALF_FLOAT,isFloat:!0}}return{internalFormat:t.RGBA,format:t.RGBA,type:t.UNSIGNED_BYTE,isFloat:!1}}function na(e){let t=e.v.peek("a_position"),n=e.v.peek("a_color_value");return!!t&&!!n}function hm(e,t){if(!e.s||e.Z)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.xt&&n.colorName===e.s&&n.colorIsString===e.Z)return{lo:n.lo,hi:n.hi};let o=xm(e);return o?(t.robustBounds={lo:o.lo,hi:o.hi,dataCount:e.xt,colorName:e.s,colorIsString:e.Z},o):(t.robustBounds=null,null)}function xm(e){if(!e.yt||e.xt<2)return null;let t=e.R,n=Math.max(1,e.L.length),o=Math.max(1,Math.ceil(e.xt/gm)),i=[],r=e.yt;for(let m=0;m<n;m++){let f=e.U[m]??0,b=m*t;for(let d=0;d<f;d+=o){let p=r[b+d];Number.isFinite(p)&&i.push(p)}}if(i.length<2)return null;i.sort((m,f)=>m-f);let s=Math.floor(i.length*.05),a=Math.min(i.length-1,Math.ceil(i.length*.95)),l=i[s],u=i[a];return u>l?{lo:l,hi:u}:e.p>e.b?{lo:e.b,hi:e.p}:null}var mm,fm,cm,dm,Pt,gm,ir=k(()=>{"use strict";At();Me();me();er();Mi();Fi();Si();qr();Jr();Ii();Di();mm=0,fm=1,cm=2,dm=3,Pt=class{constructor(){c(this,"name","density");c(this,"d",null)}ensureProgram(t,n){if(this.d){this.ensureHeatTarget(t,n);return}let o=n.gl,i=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,i),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),o.STATIC_DRAW);let r=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,r),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),o.STATIC_DRAW);let{internalFormat:s,format:a,type:l,isFloat:u}=bm(n),m=ta(o),f=o.createFramebuffer();this.d={splat:or(n,"density-splat",xt,$n),extremeSplat:null,mrtSplat:null,resolve:j(n,"density-resolve",Zn,qn,["u_heat","u_extreme","u_gradient_lut","u_heat_max","u_color_mode"],["a_corner"]),quadCornerBuffer:i,tripleCornerBuffer:r,heatTexture:m,heatFramebuffer:f,extremeTexture:null,extremeFramebuffer:null,mrtFramebuffer:null,heatWidth:0,heatHeight:0,heatType:l,heatInternalFormat:s,heatFormat:a,floatFbo:u,indexedBlend:null,signedDowngradeWarned:!1,robustBounds:null},this.ensureHeatTarget(t,n)}draw(t,n,o){let i=this.d;if(!i||!na(n))return;let r=Math.max(1,t.L.length),s=t.R,a=0;for(let l=0;l<r;l++)a+=t.U[l]??0;a!==0&&this.runSplatAndResolve(t,n,i,o,l=>{for(let u=0;u<r;u++){let m=t.U[u]??0;m<=0||l(u*s,m)}})}drawSeries(t,n,o,i){let r=this.d;if(!r||!na(n))return;let s=t.U[i]??0;if(s<=0)return;let a=t.R;this.runSplatAndResolve(t,n,r,o,l=>l(i*a,s))}buildTooltipLines(t,n){return Ao(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0}}destroy(t){let n=this.d;if(!n||!t.t){this.d=null;return}let o=t.t.gl;o.deleteBuffer(n.quadCornerBuffer),o.deleteBuffer(n.tripleCornerBuffer),o.deleteTexture(n.heatTexture),o.deleteFramebuffer(n.heatFramebuffer),n.extremeTexture&&o.deleteTexture(n.extremeTexture),n.extremeFramebuffer&&o.deleteFramebuffer(n.extremeFramebuffer),n.mrtFramebuffer&&o.deleteFramebuffer(n.mrtFramebuffer),this.d=null}ensureHeatTarget(t,n){let o=this.d;if(!o)return;let i=n.gl,r=i.canvas.width,s=i.canvas.height;if(!(r===o.heatWidth&&s===o.heatHeight)&&!(r<=0||s<=0)){if(this.allocAccumTexture(i,o,o.heatTexture,r,s),i.bindFramebuffer(i.FRAMEBUFFER,o.heatFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o.heatTexture,0),o.extremeTexture&&(this.allocAccumTexture(i,o,o.extremeTexture,r,s),o.extremeFramebuffer&&(i.bindFramebuffer(i.FRAMEBUFFER,o.extremeFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o.extremeTexture,0)),o.mrtFramebuffer)){let a=i;a.bindFramebuffer(a.FRAMEBUFFER,o.mrtFramebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,o.heatTexture,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.TEXTURE_2D,o.extremeTexture,0)}i.bindFramebuffer(i.FRAMEBUFFER,null),o.heatWidth=r,o.heatHeight=s}}allocAccumTexture(t,n,o,i,r){t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,n.heatInternalFormat,i,r,0,n.heatFormat,n.heatType,null)}ensureExtremeTarget(t,n){let o=t.gl;if(n.extremeTexture)return;let i=ta(o);if(n.extremeTexture=i,n.extremeFramebuffer=o.createFramebuffer(),this.allocAccumTexture(o,n,i,n.heatWidth,n.heatHeight),o.bindFramebuffer(o.FRAMEBUFFER,n.extremeFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i,0),n.indexedBlend===null){let r=t.isWebGL2?o.getExtension("OES_draw_buffers_indexed"):null;n.indexedBlend=r??!1}if(n.indexedBlend){let r=o;n.mrtFramebuffer=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,n.mrtFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n.heatTexture,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT1,r.TEXTURE_2D,i,0)}o.bindFramebuffer(o.FRAMEBUFFER,null)}ensureExtremeSplatProgram(t,n){return n.extremeSplat||(n.extremeSplat=or(t,"density-extreme",xt,jn)),n.extremeSplat}ensureMrtSplatProgram(t,n){return n.mrtSplat||(n.mrtSplat=or(t,"density-mrt",Kr,Qr)),n.mrtSplat}activeMode(t,n,o){let i=n.h.gradient_color_mode;return i==="signed"&&!o.floatFbo?(this.warnDowngradeOnce(o,"signed mode requires a float framebuffer (EXT_color_buffer_float); falling back to mean."),"mean"):i==="extreme"&&!t.isWebGL2?(this.warnDowngradeOnce(o,"extreme mode requires WebGL2 (for MAX blend and a second color attachment); falling back to mean."),"mean"):i}warnDowngradeOnce(t,n){t.signedDowngradeWarned||(t.signedDowngradeWarned=!0,console.warn(`Density: ${n}`))}runSplatAndResolve(t,n,o,i,r){if(this.ensureHeatTarget(t,n),o.heatWidth===0||o.heatHeight===0||!t.oe)return;let s=this.activeMode(n,t,o),a=t.b<t.p&&(!!t.s||t.L.length>1),l=0,u=0;if(s!=="density"&&a&&(l=t.b,u=t.p,!t.Z&&(s==="mean"||s==="extreme"))){let f=hm(t,o);f&&(l=f.lo,u=f.hi)}s==="extreme"&&this.ensureExtremeTarget(n,o),s==="extreme"&&o.indexedBlend?this.runMrtExtremePass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r):(this.runHeatPass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r),s==="extreme"&&this.runExtremePass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r)),this.runResolvePass(n,o,t,s)}runHeatPass(t,n,o,i,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST);u.bindFramebuffer(u.FRAMEBUFFER,n.heatFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE),u.blendEquation(u.FUNC_ADD),this.bindSplatProgram(u,n.splat,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,n.splat,l),this.unbindSplatInstancing(t,n.splat)}runExtremePass(t,n,o,i,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST),f=this.ensureExtremeSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.extremeFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE);let b=u;b.blendEquation(b.MAX),this.bindSplatProgram(u,f,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,f,l),this.unbindSplatInstancing(t,f),u.blendEquation(u.FUNC_ADD)}runMrtExtremePass(t,n,o,i,r,s,a,l){let u=t.gl,m=n.indexedBlend,f=!!u.getParameter(u.SCISSOR_TEST),b=this.ensureMrtSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.mrtFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),u.drawBuffers([u.COLOR_ATTACHMENT0,u.COLOR_ATTACHMENT1]),this.clearTarget(u,f),m.enableiOES(u.BLEND,0),m.enableiOES(u.BLEND,1),m.blendEquationiOES(0,u.FUNC_ADD),m.blendFunciOES(0,u.ONE,u.ONE),m.blendEquationiOES(1,u.MAX),m.blendFunciOES(1,u.ONE,u.ONE),this.bindSplatProgram(u,b,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,b,l),this.unbindSplatInstancing(t,b),m.blendEquationiOES(0,u.FUNC_ADD),m.blendEquationiOES(1,u.FUNC_ADD),m.blendFunciOES(0,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),m.blendFunciOES(1,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),u.drawBuffers([u.COLOR_ATTACHMENT0])}clearTarget(t,n){n&&t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),n&&t.enable(t.SCISSOR_TEST)}bindSplatProgram(t,n,o,i,r,s,a,l,u){t.useProgram(n.program),t.uniformMatrix4fv(n.u_projection,!1,o),t.uniform1f(n.u_intensity,i);let m=2*r/Math.max(1,s),f=2*r/Math.max(1,a);t.uniform2f(n.u_radius_ndc,m,f),t.uniform2f(n.u_color_range,l,u)}bindAndDispatchInstanced(t,n,o,i){let r=t.gl;r.bindBuffer(r.ARRAY_BUFFER,n.quadCornerBuffer),r.enableVertexAttribArray(o.a_corner),r.vertexAttribPointer(o.a_corner,2,r.FLOAT,!1,0,0);let s=J(t);s.setDivisor(o.a_corner,0),s.setDivisor(o.a_position,1),s.setDivisor(o.a_color_value,1);let a=t.v.peek("a_position"),l=t.v.peek("a_color_value");i((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,b=Float32Array.BYTES_PER_ELEMENT;r.bindBuffer(r.ARRAY_BUFFER,a.buffer),r.enableVertexAttribArray(o.a_position),r.vertexAttribPointer(o.a_position,2,r.FLOAT,!1,f,u*f),r.bindBuffer(r.ARRAY_BUFFER,l.buffer),r.enableVertexAttribArray(o.a_color_value),r.vertexAttribPointer(o.a_color_value,1,r.FLOAT,!1,b,u*b),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let o=J(t);o.setDivisor(n.a_position,0),o.setDivisor(n.a_color_value,0)}runResolvePass(t,n,o,i){let r=t.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,r.canvas.width,r.canvas.height),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA);let s=n.resolve;r.useProgram(s.program),r.uniform1f(s.u_heat_max,o.h.gradient_heat_max),r.uniform1i(s.u_color_mode,pm(i)),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.heatTexture),r.uniform1i(s.u_heat,0),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,n.extremeTexture??n.heatTexture),r.uniform1i(s.u_extreme,1),Ge(t,o.oe.texture,s.u_gradient_lut,2),r.bindBuffer(r.ARRAY_BUFFER,n.tripleCornerBuffer),r.enableVertexAttribArray(s.a_corner),r.vertexAttribPointer(s.a_corner,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,3)}};gm=5e4});var ft,To,Ro,wo,rr=k(()=>{"use strict";Jt();Rs();Is();Ki();qs();Qi();tr();nr();ir();ft=class extends Te{constructor(n){super();c(this,"glyph");c(this,"yn","cartesian");c(this,"oe",null);c(this,"$e","");c(this,"Ne","");c(this,"ke","");c(this,"Ie","");c(this,"Ii",!1);c(this,"s","");c(this,"ne","");c(this,"ro","");c(this,"Z",!1);c(this,"De",!1);c(this,"ge",!1);c(this,"qt",[]);c(this,"Kt",[]);c(this,"Di",new Map);c(this,"Bi",new Map);c(this,"it",null);c(this,"rt",null);c(this,"L",[]);c(this,"be",1/0);c(this,"et",-1/0);c(this,"Te",1/0);c(this,"tt",-1/0);c(this,"w",NaN);c(this,"M",NaN);c(this,"b",1/0);c(this,"p",-1/0);c(this,"nt",1/0);c(this,"ot",-1/0);c(this,"bn",1/0);c(this,"gn",-1/0);c(this,"hn",1/0);c(this,"xn",-1/0);c(this,"to",1/0);c(this,"no",-1/0);c(this,"oo",1/0);c(this,"io",-1/0);c(this,"R",0);c(this,"U",[]);c(this,"Uo",0);c(this,"O",null);c(this,"V",null);c(this,"yt",null);c(this,"Bt",null);c(this,"Pt",null);c(this,"xt",0);c(this,"f",new Map);c(this,"k",new It);c(this,"Oo",null);c(this,"Vo",null);c(this,"Ho",null);c(this,"Pi",0);c(this,"Zt",new lo);c(this,"a",null);c(this,"ae",-1);c(this,"Xo",-1);c(this,"Cn",-1);c(this,"m",null);c(this,"he",null);c(this,"xe",null);c(this,"ao",null);c(this,"Re",null);c(this,"uo",null);c(this,"mo",!1);c(this,"so",null);c(this,"Yo",null);c(this,"zo",-1);this.glyph=n}projectPoint(n,o){return[n,o]}renderBackground(n,o,i,r,s,a){}renderMapChrome(n,o,i,r){}tooltipCallbacks(){return{onHover:(n,o)=>Ji(this,n,o),onLeave:()=>{this.ae!==-1&&(this.ae=-1,$e(this))},onPin:(n,o)=>{if(Ji(this,n,o),this.ae>=0){let i=this.ae;js(this,i),this.er(i)}},onUnpin:()=>{this.emitUnselect()}}}async er(n){if(!this.Bt)return;let o=this.Bt[n],i=this.I[1]||this.I[0]||"",r=[];if(this.L.length>0&&this.R>0){let s=Math.floor(n/this.R),a=this.L[s];a?.prefix&&this.P.length>0&&(r=a.prefix.split("|"))}await this.emitClickAndSelect({rowIdx:o!=null&&o>=0?o:null,columnName:i,groupByValues:[],splitByValues:r})}async uploadAndRender(n,o,i,r){let s=r-i;this.t=n,i===0&&Fs(this,n,o,r),s!==0&&(Ss(this,n,o,i,s,r),this.h.domain_mode==="expand"&&(this.De||(this.bn=this.be,this.gn=this.et),this.ge||(this.hn=this.Te,this.xn=this.tt),this.to=this.b,this.no=this.p,this.oo=this.nt,this.io=this.ot),await this.requestRender(n))}resetExpandedDomain(){this.bn=1/0,this.gn=-1/0,this.hn=1/0,this.xn=-1/0,this.to=1/0,this.no=-1/0,this.oo=1/0,this.io=-1/0}It(n){n.uploadedCount===0&&this.xt===0||(this.t=n,zs(this,n))}destroyInternal(){this.glyph.destroy(this),this.oe=null,this.O=null,this.V=null,this.yt=null,this.Bt=null,this.Pt=null,this.k.clearHover(),this.f.clear(),this.Zt.clear(),this.Oo=null,this.Vo=null,this.Ho=null,this.L=[],this.U=[],Zs(this)}},To=class extends ft{constructor(){super(new Dt)}},Ro=class extends ft{constructor(){super(new Bt)}},wo=class extends ft{constructor(){super(new Pt)}}});function xl(e,t){if(t>hl||t<-hl)return[NaN,NaN];let n=e*Math.PI*6378137/180,o=t*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+o/2));return[n,i]}function yl(e,t,n){let o=1<<e,i=2*Ue/o,r=-Ue+t*i,s=r+i,a=Ue-n*i,l=a-i;return{xMin:r,yMin:l,xMax:s,yMax:a}}function Cl(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let o=Math.log2(2*Ue/(t*e));return Math.max(0,Math.min(n,Math.floor(o)))}function _l(e,t){let n=1<<t,o=2*Ue/n,i=Math.floor((e.xMin+Ue)/o),r=Math.floor((e.xMax+Ue)/o),s=Math.floor((Ue-e.yMax)/o),a=Math.floor((Ue-e.yMin)/o),l=[];for(let u=s;u<=a;u++)if(!(u<0||u>=n))for(let m=i;m<=r;m++)m<0||m>=n||l.push({z:t,x:m,y:u});return l}var Ue,hl,Nr=k(()=>{"use strict";Ue=Math.PI*6378137,hl=85.0511287798066});var gi,vl=k(()=>{"use strict";gi=class{constructor(t=256){c(this,"ve",new Map);c(this,"Yi");this.Yi=t}get(t){let n=this.ve.get(t);return n!==void 0&&(this.ve.delete(t),this.ve.set(t,n)),n}set(t,n,o){if(this.ve.has(n)){let i=this.ve.get(n);t.deleteTexture(i),this.ve.delete(n)}for(this.ve.set(n,o);this.ve.size>this.Yi;){let i=this.ve.keys().next().value;if(i===void 0)break;let r=this.ve.get(i);t.deleteTexture(r),this.ve.delete(i)}}has(t){return this.ve.has(t)}dispose(t){for(let n of this.ve.values())t.deleteTexture(n);this.ve.clear()}}});function Vt(e,t,n,o){return`${e}/${t}/${n}/${o}`}var hi,Al=k(()=>{"use strict";hi=class{constructor(){c(this,"Ae",new Map);c(this,"zi",()=>{})}setOnLoad(t){this.zi=t}load(t,n,o,i){let r=Vt(t.id,n,o,i),s=this.Ae.get(r);if(s)return s.promise;let a=new AbortController,l=t.urlFor(n,o,i),u=this.or(l,a.signal).then(m=>(this.Ae.delete(r),m&&this.zi(),m)).catch(()=>(this.Ae.delete(r),null));return this.Ae.set(r,{promise:u,abort:a}),u}cancelAll(){for(let t of this.Ae.values())t.abort.abort();this.Ae.clear()}cancelExcept(t){for(let[n,o]of this.Ae)t.has(n)||(o.abort.abort(),this.Ae.delete(n))}async or(t,n){let o=await fetch(t,{signal:n});if(!o.ok)return null;let i=await o.blob();return await createImageBitmap(i)}}});var xi,Ll=k(()=>{"use strict";Nr();vl();Al();Bi();Pi();me();xi=class{constructor(){c(this,"o",null);c(this,"N",null);c(this,"d",new gi);c(this,"Pn",new hi);c(this,"En",null);c(this,"Xi",1);c(this,"$i",()=>{})}setOnTileLoad(t){this.$i=t,this.Pn.setOnLoad(t)}setSource(t,n){this.En?.id!==n.id&&(this.d.dispose(t),this.Pn.cancelAll(),this.En=n)}setAlpha(t){this.Xi=Math.max(0,Math.min(1,t))}get source(){return this.En}render(t,n,o,i,r,s){let a=this.En;if(!a)return;this.ir(t);let l=this.o,u=this.N;if(!l||!u)return;let m=t.gl,f=t.dpr,b=Math.max(1,n.e.width*f),d=i.xMax-i.xMin;if(!isFinite(d)||d<=0)return;let p=d/b,x=Cl(p,a.tileSize,a.maxZoom),h=_l(i,x),g=new Set;for(let _ of h)g.add(Vt(a.id,_.z,_.x,_.y));this.Pn.cancelExcept(g),m.useProgram(l.program),m.uniformMatrix4fv(l.u_projection,!1,o),m.uniform1f(l.u_alpha,this.Xi),m.bindBuffer(m.ARRAY_BUFFER,u),m.enableVertexAttribArray(l.a_corner),m.vertexAttribPointer(l.a_corner,2,m.FLOAT,!1,0,0),m.activeTexture(m.TEXTURE0),m.uniform1i(l.u_tile,0);let y=m.isEnabled(m.BLEND);m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);for(let _ of h)this.rr(m,l,a,_,r,s);y||m.disable(m.BLEND)}destroy(t){this.Pn.cancelAll(),this.d.dispose(t),this.N&&(t.deleteBuffer(this.N),this.N=null),this.o=null}rr(t,n,o,i,r,s){let a=yl(i.z,i.x,i.y),l={xMin:a.xMin-r,xMax:a.xMax-r,yMin:a.yMin-s,yMax:a.yMax-s},u=Vt(o.id,i.z,i.x,i.y),m=this.d.get(u);if(m){this.ji(t,n,m,l,[0,0],[1,1]);return}this.sr(t,o,i);for(let f=1;f<=6;f++){let b=i.z-f;if(b<0)return;let d=i.x>>f,p=i.y>>f,x=Vt(o.id,b,d,p),h=this.d.get(x);if(!h)continue;let g=1<<f,y=i.x-d*g,_=i.y-p*g,C=1/g,v=[y*C,_*C],A=[v[0]+C,v[1]+C];this.ji(t,n,h,l,v,A);return}}ji(t,n,o,i,r,s){t.bindTexture(t.TEXTURE_2D,o),t.uniform2f(n.u_extent_min,i.xMin,i.yMin),t.uniform2f(n.u_extent_max,i.xMax,i.yMax),t.uniform2f(n.u_uv_min,r[0],r[1]),t.uniform2f(n.u_uv_max,s[0],s[1]),t.drawArrays(t.TRIANGLE_STRIP,0,4)}sr(t,n,o){let i=Vt(n.id,o.z,o.x,o.y);this.d.has(i)||this.Pn.load(n,o.z,o.x,o.y).then(r=>{if(!r)return;if(this.En?.id!==n.id){r.close();return}let s=t.createTexture();if(!s){r.close();return}t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.d.set(t,i,s),this.$i()})}ir(t){if(this.o&&this.N)return;let n=t.gl;this.o=j(t,"map-tile",Kn,Jn,["u_projection","u_extent_min","u_extent_max","u_uv_min","u_uv_max","u_tile","u_alpha"],["a_corner"]);let o=n.createBuffer();o&&(n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.N=o)}}});function Ff(){return new wn("carto-positron","https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Sf(){return new wn("carto-dark-matter","https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function If(){return new wn("carto-voyager","https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Ur(e){switch(e){case"carto-dark-matter":return Sf();case"carto-voyager":return If();case"carto-positron":default:return Ff()}}var wn,Tl=k(()=>{"use strict";wn=class{constructor(t,n,o,i=256,r=19,s=[]){this.id=t;this.template=n;this.attribution=o;this.tileSize=i;this.maxZoom=r;this.subdomains=s}urlFor(t,n,o){let i=this.template.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(o));if(this.subdomains.length>0){let r=(n+o)%this.subdomains.length;i=i.replace("{s}",this.subdomains[r])}return i}}});var yi={};Vl(yi,{MapChart:()=>Ht,MapDensityChart:()=>Hr,MapLineChart:()=>Vr,MapScatterChart:()=>Or});var Ht,Or,Vr,Hr,Ci=k(()=>{"use strict";rr();tr();nr();ir();Ll();Tl();Nr();ut();Ht=class extends ft{constructor(n){super(n);c(this,"yn","map");c(this,"Je");this.Je=new xi,this.Je.setOnTileLoad(()=>{this.t&&this.requestRender(this.t)})}projectPoint(n,o){return xl(n,o)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.t&&this.Je.setSource(this.t.gl,Ur(n.map_tile_provider)),this.Je.setAlpha(n.map_tile_alpha)}renderBackground(n,o,i,r,s,a){this.Je.source||(this.Je.setSource(n.gl,Ur(this.h.map_tile_provider)),this.Je.setAlpha(this.h.map_tile_alpha)),this.Je.render(n,o,i,r,s,a)}renderMapChrome(n,o,i,r){if(!n)return;let s=re(n,r);if(!s)return;let a=this.Je.source?.attribution??"";if(!a)return;let l=o.e;s.save(),s.font=`10px ${i.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(a).width,b=12,d=l.x+l.width-4,p=l.y+l.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(d-f-u*2,p-b-u,f+u*2,b+u),s.fillStyle=i.Le,s.fillText(a,d-u,p-u/2),s.restore()}destroyInternal(){this.t&&this.Je.destroy(this.t.gl),super.destroyInternal()}},Or=class extends Ht{constructor(){super(new Dt)}},Vr=class extends Ht{constructor(){super(new Bt)}},Hr=class extends Ht{constructor(){super(new Pt)}}});typeof window>"u"&&(globalThis.window={});var jt=class{constructor(t){c(this,"dt");c(this,"i",new Map);c(this,"rn",0);c(this,"Gn",0);this.dt=t}get totalCapacity(){return this.rn}get maxCapacity(){return this.Gn}set maxCapacity(t){this.Gn=t}ensureCapacity(t){this.rn=this.Gn>0?Math.min(t,this.Gn):t}peek(t){return this.i.get(t)}getOrCreate(t,n,o){let i=this.rn*n*o,r=this.i.get(t);if(r&&r.byteCapacity>=i)return r;let s=this.dt;r&&s.deleteBuffer(r.buffer);let a=s.createBuffer();return s.bindBuffer(s.ARRAY_BUFFER,a),s.bufferData(s.ARRAY_BUFFER,i,s.DYNAMIC_DRAW),r={buffer:a,byteCapacity:i},this.i.set(t,r),r}upload(t,n,o,i=1){let r=this.dt,s=this.getOrCreate(t,i,n.BYTES_PER_ELEMENT);if(!1){let a=o+n.byteLength;if(a>s.byteCapacity)throw new Error(`BufferPool.upload("${t}"): write ${o}..${a} exceeds capacity ${s.byteCapacity} (_totalCapacity=${this.rn}, components=${i}, bytes=${n.BYTES_PER_ELEMENT}). Did you pass the full scratch buffer instead of a subarray(0, n)?`)}return r.bindBuffer(r.ARRAY_BUFFER,s.buffer),r.bufferSubData(r.ARRAY_BUFFER,o,n),s.buffer}releaseAll(){for(let t of this.i.values())this.dt.deleteBuffer(t.buffer);this.i.clear(),this.rn=0}};var Zt=class{constructor(t){c(this,"dt");c(this,"Wn",new Map);this.dt=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,o){let i=this.Wn.get(t);if(i)return i;let r=this.dt,s=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(s,n),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(s);throw r.deleteShader(s),new Error(`Vertex shader compile error [${t}]: ${l}`)}let a=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(a,o),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(a);throw r.deleteShader(s),r.deleteShader(a),new Error(`Fragment shader compile error [${t}]: ${l}`)}if(i=r.createProgram(),r.attachShader(i,s),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS)){let l=r.getProgramInfoLog(i);throw r.deleteProgram(i),r.deleteShader(s),r.deleteShader(a),new Error(`Shader link error [${t}]: ${l}`)}return r.deleteShader(s),r.deleteShader(a),this.Wn.set(t,i),i}releaseAll(){for(let t of this.Wn.values())this.dt.deleteProgram(t);this.Wn.clear()}};var Fn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;attribute float a_series_id;attribute float a_axis;uniform mat4 u_proj_left;uniform mat4 u_proj_right;uniform float u_hover_series;uniform float u_horizontal;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec2 A;if(u_horizontal>0.5){A=vec2(mix(a_y0,a_y1,a_corner.x),a_x_center+(a_corner.y-0.5)*2.*a_half_width);}else{A=vec2(a_x_center+(a_corner.x-0.5)*2.*a_half_width,mix(a_y0,a_y1,a_corner.y));}mat4 B=a_axis<0.5?u_proj_left:u_proj_right;gl_Position=B*vec4(A,0.,1.);v_color=a_color;v_hover=abs(a_series_id-u_hover_series)<0.5?1.:0.;v_local=a_corner;}";var Sn="precision highp float;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec3 A=v_color;if(v_hover>0.5){A=mix(A,vec3(1.),0.25);}gl_FragColor=vec4(A,1.);}";Li();Ti();Ri();wi();var En="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var Gn="precision highp float;uniform vec3 u_color;uniform float u_opacity;void main(){gl_FragColor=vec4(u_color,u_opacity);}";var Oe="attribute vec2 a_start;attribute vec2 a_end;attribute float a_corner;attribute float a_real_start;attribute float a_real_end;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform float u_interp_alpha;varying float v_edge_dist;varying float v_seg_alpha;void main(){vec4 A=u_projection*vec4(a_start,0.,1.);vec4 B=u_projection*vec4(a_end,0.,1.);vec2 C=A.xy*u_resolution*0.5;vec2 D=B.xy*u_resolution*0.5;vec2 E=D-C;float F=length(E);E=F>0.001?E/F:vec2(1.,0.);vec2 G=vec2(-E.y,E.x);float H=step(1.5,a_corner);float I=1.-mod(a_corner,2.)*2.;vec4 J=mix(A,B,H);float K=(u_line_width+1.5)*0.5;vec2 L=(G*I*K)/(u_resolution*0.5);gl_Position=J+vec4(L,0.,0.);v_edge_dist=I;float M=a_real_start*a_real_end;v_seg_alpha=mix(u_interp_alpha,1.,step(0.5,M));}";var Ve="precision highp float;uniform vec4 u_color;uniform float u_line_width;varying float v_edge_dist;varying float v_seg_alpha;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(u_color.rgb,u_color.a*C*v_seg_alpha);}";var Wn="attribute vec2 a_position;attribute vec3 a_color;uniform mat4 u_projection;uniform float u_point_size;varying vec3 v_color;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);gl_PointSize=u_point_size;v_point_size=u_point_size;v_color=a_color;}";var kn="precision highp float;varying vec3 v_color;varying float v_point_size;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5)discard;float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);gl_FragColor=vec4(v_color,D);}";var Nn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;uniform mat4 u_projection;varying vec3 v_color;void main(){float A=a_x_center+(a_corner.x-0.5)*2.*a_half_width;float B=mix(a_y0,a_y1,a_corner.y);gl_Position=u_projection*vec4(A,B,0.,1.);v_color=a_color;}";var Un="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var On="attribute vec2 a_corner;attribute vec2 a_cell;attribute float a_color_t;uniform mat4 u_projection;uniform vec2 u_cell_inset;uniform vec2 u_cell_size;varying float v_color_t;void main(){vec2 A=0.5*u_cell_size;vec2 B=u_cell_size-2.*u_cell_inset;float C=a_cell.x-A.x+u_cell_inset.x+a_corner.x*B.x;float D=a_cell.y-A.y+u_cell_inset.y+a_corner.y*B.y;gl_Position=u_projection*vec4(C,D,0.,1.);v_color_t=a_color_t;}";var Vn="precision highp float;uniform sampler2D u_gradient_lut;varying float v_color_t;void main(){float A=clamp(v_color_t,0.,1.);vec4 B=texture2D(u_gradient_lut,vec2(A,0.5));gl_FragColor=vec4(B.rgb,1.);}";var Hn="attribute float a_strip_t;attribute float a_side;attribute vec2 a_angles;attribute vec2 a_radii;attribute vec4 a_color;uniform vec2 u_center;uniform vec2 u_resolution;uniform float u_border_px;varying vec4 v_color;varying vec2 v_edge;void main(){float A=u_border_px*0.5;float B=a_radii.x+A;float C=a_radii.y-A;if(C<=B){gl_Position=vec4(2.,2.,2.,1.);v_color=vec4(0.);v_edge=vec2(0.);return;}float D=mix(B,C,a_side);float E=A/max(D,1.);float F=a_angles.y-a_angles.x;E=min(E,F*0.5);float G=mix(a_angles.x+E,a_angles.y-E,a_strip_t);vec2 H=u_center+vec2(cos(G),sin(G))*D;vec2 I=(H/u_resolution)*2.-1.;gl_Position=vec4(I.x,-I.y,0.,1.);v_color=a_color;v_edge=vec2(a_strip_t,a_side);}";var Yn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var zn="attribute vec2 a_position;attribute vec4 a_color;uniform vec2 u_resolution;varying vec4 v_color;void main(){vec2 A=(a_position/u_resolution)*2.-1.;A.y=-A.y;gl_Position=vec4(A,0.,1.);v_color=a_color;}";var Xn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";Mi();Fi();Si();Ii();Di();Bi();Pi();var Ei=[{name:"bar",vert:Fn,frag:Sn},{name:"line",vert:In,frag:Dn},{name:"scatter",vert:Bn,frag:Pn},{name:"bar-area",vert:En,frag:Gn},{name:"bar-scatter",vert:Wn,frag:kn},{name:"line-uniform",vert:Oe,frag:Ve},{name:"candlestick-body",vert:Nn,frag:Un},{name:"heatmap",vert:On,frag:Vn},{name:"sunburst-arc",vert:Hn,frag:Yn},{name:"treemap",vert:zn,frag:Xn},{name:"density-splat",vert:xt,frag:$n},{name:"density-extreme",vert:xt,frag:jn},{name:"density-resolve",vert:Zn,frag:qn},{name:"map-tile",vert:Kn,frag:Jn}];var yu=1,ot=class{constructor(t,n={}){c(this,"id");c(this,"canvas");c(this,"gl");c(this,"isWebGL2");c(this,"shaders");c(this,"di");c(this,"pi",null);c(this,"Vt");c(this,"pt",!1);c(this,"kn",new Set);this.id=yu++,this.canvas=t,this.Vt=n.precompile??!1;let o=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(o)this.gl=o,this.isWebGL2=!0;else{let i=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!i)throw new Error("WebGL is not supported");this.gl=i,this.isWebGL2=!1}this.shaders=new Zt(this.gl),this.Vt&&this.shaders.precompile(Ei),this.di=this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),this.isWebGL2||(this.pi=this.gl.getExtension("ANGLE_instanced_arrays")),t.addEventListener("webglcontextlost",i=>{this.pt||i.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this.shaders.releaseAll(),this.shaders=new Zt(this.gl),this.Vt&&this.shaders.precompile(Ei);for(let i of this.kn)i()})}resetVertexArrayState(){let t=this.gl;for(let n=0;n<this.di;n++)t.disableVertexAttribArray(n),this.isWebGL2?t.vertexAttribDivisor(n,0):this.pi?.vertexAttribDivisorANGLE(n,0)}onRestore(t){return this.kn.add(t),()=>this.kn.delete(t)}isContextLost(){return this.pt||this.gl.isContextLost()}get destroyed(){return this.pt}destroy(){this.pt=!0,this.kn.clear(),this.shaders.releaseAll();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext()}};var qt=class{constructor(t,n={}){c(this,"S");c(this,"Nn");c(this,"bi");c(this,"i");c(this,"Un",0);c(this,"Fo",0);c(this,"So",0);c(this,"Io",1);c(this,"pt",!1);c(this,"On",null);c(this,"bt",null);c(this,"sn",null);c(this,"Ht",null);t instanceof ot?(this.S=t,this.Nn=!1):(this.S=new ot(t,{precompile:n.precompile??!1}),this.Nn=!0),this.i=new jt(this.S.gl),this.bi=this.S.onRestore(()=>{this.i.releaseAll(),this.i=new jt(this.S.gl),this.Un=0})}get gl(){return this.S.gl}get backendId(){return this.S.id}isContextLost(){return this.pt||this.S.isContextLost()}get isWebGL2(){return this.S.isWebGL2}get shaders(){return this.S.shaders}get v(){return this.i}get uploadedCount(){return this.Un}set uploadedCount(t){this.Un=t}resize(t,n,o){this.Fo=t,this.So=n,this.Io=o;let i=Math.round(t*o),r=Math.round(n*o),s=this.S.canvas;(s.width!==i||s.height!==r)&&(s.width=i,s.height=r,this.S.gl.viewport(0,0,i,r))}requestResize(t,n,o){this.Ht={cssWidth:t,cssHeight:n,dpr:o}}applyPendingResize(){if(!this.Ht)return!1;let{cssWidth:t,cssHeight:n,dpr:o}=this.Ht;return this.Ht=null,this.resize(t,n,o),!0}beginFrame(){if(this.Nn){this.applyPendingResize();return}let t=this.Ht;this.Ht=null,t?this.resize(t.cssWidth,t.cssHeight,t.dpr):this.resize(this.Fo,this.So,this.Io);let n=this.S.gl,o=this.S.canvas;n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,o.width,o.height),n.disable(n.SCISSOR_TEST),n.disable(n.DEPTH_TEST),this.S.resetVertexArrayState()}get cssWidth(){return this.Fo}get cssHeight(){return this.So}get dpr(){return this.Io}clear(){this.S.gl.clearColor(0,0,0,0),this.S.gl.clear(this.S.gl.COLOR_BUFFER_BIT|this.S.gl.DEPTH_BUFFER_BIT),this.Un=0}setFrameCallback(t){this.On=t}endFrame(){if(!this.On||this.isContextLost())return;let t=this.S.canvas;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.On(n)}async awaitGpuFence(){if(!this.S.isWebGL2){this.S.gl.finish();return}let t=this.S.gl,n=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0);if(!n){t.finish();return}try{let o=t.SYNC_FLUSH_COMMANDS_BIT;for(;;){let i=t.clientWaitSync(n,o,0);if(i===t.ALREADY_SIGNALED||i===t.CONDITION_SATISFIED)return;if(i===t.WAIT_FAILED){t.finish();return}if(o=0,await this.qi(),this.pt)return}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.i.ensureCapacity(t)}qi(){return this.bt||(this.bt=new MessageChannel,this.bt.port1.start()),new Promise(t=>{let n=this.bt;this.sn=t,n.port1.addEventListener("message",()=>{this.sn=null,t()},{once:!0}),n.port2.postMessage(null)})}destroy(){if(this.pt=!0,this.On=null,this.bi(),this.i.releaseAll(),this.sn){let t=this.sn;this.sn=null,t()}this.bt&&(this.bt.port1.close(),this.bt.port2.close(),this.bt=null),this.Nn&&this.S.destroy()}};var Qn=class{constructor(t,n={}){c(this,"gi");c(this,"Vt");c(this,"Yt",[]);c(this,"xi",0);this.gi=Math.max(1,t),this.Vt=n.precompile??!1}acquire(){let t;if(this.Yt.length<this.gi)t=this.yi(),this.Yt.push(t);else{let n=this.xi%this.Yt.length;this.xi++,this.Yt[n].isContextLost()&&(this.Yt[n]=this.yi()),t=this.Yt[n]}return t}yi(){let t=new OffscreenCanvas(1,1);return new ot(t,{precompile:this.Vt})}};eo();eo();function ns(e,t,n,o){let{controller:i,layout:r}=e,s=r.e,a=i.getVisibleDomain(),l=a.xMin+(t-s.x)/s.width*(a.xMax-a.xMin),u=a.yMax-(n-s.y)/s.height*(a.yMax-a.yMin),m=Math.pow(1.1,-o/100),f=i.lockedAxis;f!=="x"&&(i.scaleX=Math.max(1,Math.min(1e5,i.scaleX*m))),f!=="y"&&(i.scaleY=Math.max(1,Math.min(1e5,i.scaleY*m)));let b=i.getVisibleDomain(),d=b.xMin+(t-s.x)/s.width*(b.xMax-b.xMin),p=b.yMax-(n-s.y)/s.height*(b.yMax-b.yMin),x=i.baseXRange,h=i.baseYRange;f!=="x"&&x>0&&(i.normTranslateX+=(l-d)/x),f!=="y"&&h>0&&(i.normTranslateY+=(u-p)/h)}function os(e,t,n){let{controller:o,layout:i}=e,r=o.getVisibleDomain(),s=i.e,a=(r.xMax-r.xMin)/s.width,l=(r.yMax-r.yMin)/s.height,u=o.lockedAxis,m=o.baseXRange,f=o.baseYRange;u!=="x"&&m>0&&(o.normTranslateX-=t*a/m),u!=="y"&&f>0&&(o.normTranslateY+=n*l/f)}var to=class{constructor(t){c(this,"zt");this.zt=t}pin(t,n,o){this.zt({kind:"pinTooltip",lines:t,pos:n,bounds:o})}dismiss(){this.zt({kind:"dismissTooltip"})}setCursor(t){this.zt({kind:"setCursor",cursor:t})}emitUserClick(t){this.zt({kind:"userClick",detail:t})}emitUserSelect(t){this.zt({kind:"userSelect",selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig})}};rr();Jt();var Mo=class{constructor(t=1024){c(this,"size");c(this,"value");c(this,"colorValue");c(this,"sizeSign");c(this,"x0");c(this,"y0");c(this,"x1");c(this,"y1");c(this,"a0");c(this,"a1");c(this,"r0");c(this,"r1");c(this,"depth");c(this,"parent");c(this,"firstChild");c(this,"nextSibling");c(this,"lastChild");c(this,"childCount");c(this,"leafRowIdx");c(this,"name");c(this,"colorLabel");c(this,"count",0);c(this,"capacity",0);this.Ei(t)}reset(){this.count>0&&(this.x0.fill(0,0,this.count),this.y0.fill(0,0,this.count),this.x1.fill(0,0,this.count),this.y1.fill(0,0,this.count),this.a0.fill(0,0,this.count),this.a1.fill(0,0,this.count),this.r0.fill(0,0,this.count),this.r1.fill(0,0,this.count)),this.count=0}allocate(){this.count===this.capacity&&this.Ei(this.capacity*2);let t=this.count++;return this.firstChild[t]=-1,this.nextSibling[t]=-1,this.lastChild[t]=-1,this.childCount[t]=0,this.leafRowIdx[t]=-1,this.size[t]=0,this.value[t]=0,this.colorValue[t]=NaN,this.sizeSign[t]=1,this.name[t]="",this.colorLabel[t]="",t}appendChild(t,n){this.parent[n]=t,this.depth[n]=this.depth[t]+1,this.nextSibling[n]=-1;let o=this.lastChild[t];o===-1?this.firstChild[t]=n:this.nextSibling[o]=n,this.lastChild[t]=n,this.childCount[t]++}isLeaf(t){return this.firstChild[t]===-1}Ei(t){let n=Math.max(t,1024),o=(i,r)=>{let s=new r(n);return i&&i.length>0&&s.set(i),s};this.size=o(this.size,Float32Array),this.value=o(this.value,Float32Array),this.colorValue=o(this.colorValue,Float32Array),this.sizeSign=o(this.sizeSign,Int8Array),this.x0=o(this.x0,Float32Array),this.y0=o(this.y0,Float32Array),this.x1=o(this.x1,Float32Array),this.y1=o(this.y1,Float32Array),this.a0=o(this.a0,Float32Array),this.a1=o(this.a1,Float32Array),this.r0=o(this.r0,Float32Array),this.r1=o(this.r1,Float32Array),this.depth=o(this.depth,Int32Array),this.parent=o(this.parent,Int32Array),this.firstChild=o(this.firstChild,Int32Array),this.nextSibling=o(this.nextSibling,Int32Array),this.lastChild=o(this.lastChild,Int32Array),this.childCount=o(this.childCount,Int32Array),this.leafRowIdx=o(this.leafRowIdx,Int32Array),this.name?this.name.length=n:this.name=new Array(n),this.colorLabel?this.colorLabel.length=n:this.colorLabel=new Array(n),this.capacity=n}};function oa(e,t){let n=[],o=t;for(;e.parent[o]!==-1;)n.push(e.name[o]),o=e.parent[o];return n.reverse()}Qi();function Fo(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var Et=class extends Te{constructor(){super(...arguments);c(this,"ne","");c(this,"s","");c(this,"ye","empty");c(this,"r",new Mo);c(this,"X",-1);c(this,"C",-1);c(this,"le",[]);c(this,"Et",new Map);c(this,"fo",0);c(this,"b",1/0);c(this,"p",-1/0);c(this,"f",new Map);c(this,"$",null);c(this,"ie",0);c(this,"k",new It)}};Qt();un();Ae();function ct(e,t,n,o,i){if(!e||t<=0)return null;let r=new Float64Array(t),s=1/0,a=-1/0;for(let u=0;u<t;u++){let m=e[u+n];r[u]=m,m<s&&(s=m),m>a&&(a=m)}let l=1/0;for(let u=1;u<t;u++){let m=Math.abs(r[u]-r[u-1]);m>0&&m<l&&(l=m)}return(!isFinite(l)||l===0)&&(l=Math.max(1,a-s)),{categoryPositions:r,numericCategoryDomain:{min:s-l/2,max:a+l/2,isDate:i,label:o,bandWidth:l}}}function Gt(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function ym(e,t,n){return!t||e==null||Number.isNaN(e)?"":n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?ye(e):n==="integer"?String(e|0):n==="float"?ue(e):String(e)}function sr(e,t,n){let o=e.values,i=e.valid,r=new Int32Array(t),s=[""],a=new Map;a.set("",0);for(let l=0;l<t;l++){let u=i?!!(i[l>>3]>>(l&7)&1):!0,m=o[l],f=ym(m,u,n),b=a.get(f);b===void 0&&(b=s.length,s.push(f),a.set(f,b)),r[l]=b}return{indices:r,dictionary:s}}function Wt(e,t,n,o=[]){let i=[];for(let u=0;;u++){let m=e.get(`__ROW_PATH_${u}__`);if(!m)break;if(m.type==="string"&&m.indices&&m.dictionary)i.push({indices:m.indices,dictionary:m.dictionary});else if(m.values){let f=o[u]??"string";i.push(sr(m,t,f))}else break}let r=0;if(n>0&&i.length>0)for(;r<t;){let u=!1;for(let m of i){let f=m.dictionary[m.indices[r]];if(f!=null&&f!==""){u=!0;break}}if(u)break;r++}let s=Math.max(0,t-r),a=i.length;return{rowPaths:n>0&&a>0?i.map((u,m)=>{let f=new Array(s),b=0;for(let p=0;p<s;p++){let x=u.dictionary[u.indices[p+r]]??"";f[p]=x,x.length>b&&(b=x.length)}let d=m===a-1?[]:go(u.indices,u.dictionary,r,r+s).map(p=>({startIdx:p.startIdx-r,endIdx:p.endIdx-r,label:p.label}));return{labels:f,runs:d,maxLabelChars:b}}):[],numCategories:s,rowOffset:r}}function ar(e,t,n,o){if(e.length===0)return null;for(let b of e)if(b.type!=="string")return null;let i=Math.max(0,t-n),r=[],s=new Map,a=e.map(()=>new Int32Array(i)),l=b=>{let d=s.get(b);return d===void 0&&(d=r.length,r.push(b),s.set(b,d)),d};for(let b=0;b<e.length;b++){let d=e[b].data,p=a[b];for(let x=0;x<i;x++){let h=x+n,g;if(!d)g="(null)";else{let y=d.valid;if(!(y?!!(y[h>>3]>>(h&7)&1):!0))g="(null)";else if(d.indices&&d.dictionary)g=d.dictionary[d.indices[h]]??"(null)";else if(d.values){let C=d.values[h];g=C==null?"(null)":String(C)}else g="(null)"}p[x]=l(g)}}let u=0;for(let b of r)b.length>u&&(u=b.length);return{domain:{levels:[{labels:r.slice(),runs:[],maxLabelChars:u}],numRows:r.length,levelLabels:[o]},perColumnSlots:a}}function dn(e){e.r.reset(),e.Et.clear();let t=e.r.allocate();e.r.name[t]="Total",e.r.depth[t]=0,e.r.parent[t]=-1,e.Et.set(t,new Map),e.X=t,e.C=t,e.le=[t],e.fo=0,e.b=1/0,e.p=-1/0,e.f.clear(),e.$=null,e.ie=0}function Cm(e,t,n){let o=e.Et.get(t);o||(o=new Map,e.Et.set(t,o));let i=o.get(n);if(i!==void 0)return i;let r=e.r.allocate();return e.r.name[r]=n,e.r.appendChild(t,r),o.set(n,r),r}function So(e,t,n,o,i,r,s){let a=e.X,l=t.length;for(let u=0;u<l;u++){let m=Cm(e,a,t[u]);u===l-1&&((s===0||l===s)&&(e.r.size[m]=Math.abs(n),e.r.sizeSign[m]=n<0?-1:1,e.r.leafRowIdx[m]=r),isNaN(o)||(e.r.colorValue[m]=o,o<e.b&&(e.b=o),o>e.p&&(e.p=o)),i&&(e.r.colorLabel[m]=i,e.f.has(i)||e.f.set(i,e.f.size))),a=m}}function ra(e,t){let n=e.valid;return!n||!!(n[t>>3]>>(t&7)&1)}function Io(e,t){return e?.values?ra(e,t)?e.values[t]:0:1}function Do(e,t,n){let o=NaN,i="";return!t||!ra(t,n)?{colorValue:o,colorLabel:i}:(e.ye==="numeric"&&t.values?o=t.values[n]:e.ye==="series"&&t.indices&&t.dictionary&&(i=t.dictionary[t.indices[n]]),{colorValue:o,colorLabel:i})}function ia(e,t){if(e.ye!=="series"||!t?.dictionary)return;let n=t.dictionary;for(let o=0;o<n.length;o++){let i=n[o];e.f.has(i)||e.f.set(i,e.f.size)}}function _m(e,t){if(e.P.length===0)return null;let n=e.ne?[e.ne]:[],o=e.s?[e.s]:[],i=He(t,n,o);return i.length===0?null:i.map(r=>({prefix:r.prefix,sizeCol:e.ne?t.get(`${r.prefix}|${e.ne}`)??null:null,colorCol:e.s?t.get(`${r.prefix}|${e.s}`)??null:null}))}function pn(e,t){let n=[];for(let x=0;;x++){let h=t.get(`__ROW_PATH_${x}__`);if(!h)break;if(h.type==="string"&&h.indices&&h.dictionary)n.push({indices:h.indices,dictionary:h.dictionary,valid:h.valid});else if(h.values){let g=e._[x],y=e.ht[g]??"string";n.push(sr(h,h.values.length,y))}else break}let o=n.length>0,i=e._.length,r=_m(e,t),s=r!==null,a=e.ne?t.get(e.ne):null,l=e.s?t.get(e.s):null,u=s?r[0].sizeCol:a,m=o?n[0].indices.length:u?.values?.length??0;if(m===0)return;if(s)for(let x of r)ia(e,x.colorCol);else ia(e,l);let f=e.fo,b=s&&o?i+1:i;if(!o){let x;for(let[g,y]of t){if(g.startsWith("__")||s&&g.includes("|"))continue;let _=g.lastIndexOf("|"),C=_===-1?g:g.substring(_+1);if(!(C===e.ne||C===e.s)&&y.type==="string"&&y.indices&&y.dictionary){x=y;break}}let h=s?r:null;for(let g=0;g<m;g++){let y=x?.indices&&x?.dictionary?x.dictionary[x.indices[g]]:`Row ${f+g}`;if(h)for(let _ of h){let C=Io(_.sizeCol,g),{colorValue:v,colorLabel:A}=Do(e,_.colorCol,g);So(e,[_.prefix,y],C,v,A,f+g,b)}else{let _=Io(a,g),{colorValue:C,colorLabel:v}=Do(e,l,g);So(e,[y],_,C,v,f+g,b)}}e.fo=f+m;return}let d=s?1:0,p=new Array(n.length+d);for(let x=0;x<m;x++){let h=0;for(let g=0;g<n.length;g++){let y=n[g];if(y.valid&&!(y.valid[x>>3]>>(x&7)&1))break;let _=y.dictionary[y.indices[x]];if(!_&&_!=="0")break;p[d+h++]=_}if(h!==0)if(s)for(let g of r){p[0]=g.prefix;let y=p.slice(0,h+1),_=Io(g.sizeCol,x),{colorValue:C,colorLabel:v}=Do(e,g.colorCol,x);So(e,y,_,C,v,f+x,b)}else{let g=p.slice(0,h),y=Io(a,x),{colorValue:_,colorLabel:C}=Do(e,l,x);So(e,g,y,_,C,f+x,b)}}e.fo=f+m}function bn(e){let t=e.r,n=t.value,o=t.size,i=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.X,s[1]=0;let a=1;for(let l=0;l<t.count;l++)n[l]=0;for(;a>0;){a--;let l=s[a*2];if(s[a*2+1]===0){s[a*2+1]=1,a++;for(let m=i[l];m!==-1;m=r[m]){if((a+1)*2>s.length){let f=new Int32Array(s.length*2);f.set(s),s=f}s[a*2]=m,s[a*2+1]=0,a++}}else if(i[l]===-1){let m=o[l];n[l]=m>0?m:0}else{let m=0;for(let f=i[l];f!==-1;f=r[f])m+=n[f];n[l]=m}}if(e.le.length>1){let l=[];for(let f=1;f<e.le.length;f++)l.push(t.name[e.le[f]]);let u=e.X,m=!0;for(let f of l){let d=e.Et.get(u)?.get(f);if(d===void 0){m=!1;break}u=d}if(m&&t.firstChild[u]!==-1){e.C=u,Bo(e,u);return}}e.C=e.X,e.le=[e.X]}function Bo(e,t){let n=[],o=t;for(;o!==-1;)n.unshift(o),o=e.r.parent[o];e.le=n}var vm=1,lr=14,sa=1,aa=4;function Po(e,t,n,o,i,r,s,a,l){if(e.x0[t]=Math.round(n),e.y0[t]=Math.round(o),e.x1[t]=Math.round(i),e.y1[t]=Math.round(r),e.firstChild[t]===-1||(i-n)*(r-o)<aa)return;let m=e.depth[t]-s,f=l&&m===1&&e.firstChild[t]!==-1,b=f?lr:sa,d=f?vm:sa,p=e.x0[t]+d,x=e.y0[t]+b,h=e.x1[t]-d,g=e.y1[t]-d;if(h<=p||g<=x)return;let y=0;for(let _=e.firstChild[t];_!==-1;_=e.nextSibling[_])e.value[_]>0&&(a[y++]=_);y!==0&&gn(e,a,0,y,p,x,h,g,s,a.subarray(y),l)}function gn(e,t,n,o,i,r,s,a,l,u,m){let f=o-n;if(f===0)return;if(f===1){Po(e,t[n],i,r,s,a,l,u,m);return}let b=0;for(let v=n;v<o;v++)b+=e.value[t[v]];let d=b/2,p=0,x=n+1,h=1/0;for(let v=n;v<o-1;v++){p+=e.value[t[v]];let A=Math.abs(p-d);A<h&&(h=A,x=v+1)}let g=0;for(let v=n;v<x;v++)g+=e.value[t[v]];let y=g/b,_=s-i,C=a-r;if(_>=C){let v=Math.round(i+_*y);gn(e,t,n,x,i,r,v,a,l,u,m),gn(e,t,x,o,v,r,s,a,l,u,m)}else{let v=Math.round(r+C*y);gn(e,t,n,x,i,r,s,v,l,u,m),gn(e,t,x,o,i,v,s,a,l,u,m)}}function la(e,t,n,o){e.ie=ur(e,t,n,o,0)}function ur(e,t,n,o,i){let r=e.r,s=r.x0,a=r.y0,l=r.x1,u=r.y1,m=r.depth,f=r.firstChild,b=r.nextSibling,d=r.value;(!e.$||e.$.length<r.count)&&(e.$=new Int32Array(r.count));let p=e.$,x=i,h=new Int32Array(128);h[0]=t;let g=1;for(;g>0;){g--;let y=h[g];if(d[y]<=0||(m[y]>=o&&(p[x++]=y),m[y]-o>=n))continue;let _=l[y]-s[y],C=u[y]-a[y];if(!(_*C<aa))for(let v=f[y];v!==-1;v=b[v]){if(g>=h.length){let A=new Int32Array(h.length*2);A.set(h),h=A}h[g++]=v}}return x}nn();vt();Ee();function Eo(e,t,n){return .299*e+.587*t+.114*n}function Am(e,t){let n=Le(e,t);return[n[0],n[1],n[2]]}function hn(e,t,n,o){let i=e.r,r=i.colorValue[t];if(e.ye==="numeric"&&!isNaN(r)&&e.p>e.b)return Am(n,rt(r,e.b,e.p));let s=e.f.get(i.colorLabel[t])??0;return o[s%o.length]??[0,0,0]}function Go(e,t,n,o,i){let r=hn(e,t,n,o),s=e.r.sizeSign[t]<0?i:1;return[r[0],r[1],r[2],s]}me();function Wo(e,t,n,o,i,r,s){let a=Math.round(o*n),l=Math.round(i*n);(t.width!==a||t.height!==l)&&(t.width=a,t.height=l,e.Ct=!0);let u=t.getContext("2d");if(u){if(e.Ct){e.ue?.close(),e.ue=null,e.Ct=!1;let m=++e._n;r(u),createImageBitmap(t).then(f=>{e._n===m?(e.ue?.close(),e.ue=f):f.close()})}else e.ue&&(u.clearRect(0,0,t.width,t.height),u.drawImage(e.ue,0,0));s&&(u.save(),u.scale(n,n),s(u),u.restore())}}bo();Ye();yo();function ua(e,t,n,o,i,r,s,a){if(n.length===0)return;let{$n:l,Ai:u,vi:m}=t;e.font=`11px ${a}`;let f=16,b=8,d=0;for(let y of n){let _=e.measureText(y).width;_>d&&(d=_)}let p=d+b*2,x=n.length*f+b*2-4,h=o+12,g=i-x-8;h+p>r&&(h=o-p-12),h<0&&(h=4),g<0&&(g=i+12),g+x>s&&(g=s-x-4),e.fillStyle=l,e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.roundRect(h,g,p,x,4),e.fill(),e.stroke(),e.fillStyle=u,e.textAlign="left",e.textBaseline="top";for(let y=0;y<n.length;y++)e.fillText(n[y],h+b,g+b+y*f)}var ma=24,Lm=8,fa=12,ca=2,da=" \\u203A ";function ko(e,t,n,o,i){e.Ue=[];let r=e.A().$n;t.fillStyle=r,t.fillRect(0,0,n,ma),t.font=`11px ${o}`,t.textAlign="left",t.textBaseline="middle";let s=Lm,a=e.r;for(let l=0;l<e.le.length;l++){let u=e.le[l],m=l===e.le.length-1,f=a.name[u];t.fillStyle=i;let b=t.measureText(f).width;t.fillText(f,s,fa),e.Ue.push({nodeId:u,x0:s-ca,y0:0,x1:s+b+ca,y1:ma}),s+=b,m||(t.fillText(da,s,fa),s+=t.measureText(da).width)}}function No(e,t,n,o,i,r,s,a){let l=e.k.hoveredTarget===n?e.k.lines??[]:[];l.length!==0&&ua(t,e.A(),l,o,i,r,s,a)}function Uo(e,t,n,o,i,r,s,a=null){e.ye==="series"&&e.f.size>1?a?fn(t,a,e.f,n,i):xo(t,pa(r,s),e.f,n,i):e.ye==="numeric"&&e.b<e.p&&St(t,pa(r,s),{min:e.b,max:e.p,label:e.s},o,i,e.getColumnFormatter(e.s,"value"))}function pa(e,t){return new ne(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0})}function ba(e,t){if(e.C===-1)return;let n=t.gl,o=t.cssWidth,i=t.cssHeight;if(o<=0||i<=0)return;let r=e.r,s=e.P.length>0&&e.W.facet_mode==="grid",a=e.le.length>1?28:0,u=(e.ye==="series"?e.f.size>1:e.ye==="numeric"&&e.b<e.p)?90:0,m=new Int32Array(Math.max(r.count,64));if(s)Tm(e,m,o,i,a,u);else{e.m=null;let p=r.depth[e.C];Po(r,e.C,0,a,o-u,i,p,m,e.co),la(e,e.C,100,p),fr(e);let x=e.Be,h=e.Oe;for(let g=0;g<e.ie;g++)x[g]=p,h[g]=e.C}if(!e.o){let p=j(t,"treemap",zn,Xn,["u_resolution"],["a_position","a_color"]);e.o=p.program,e.F=p}let f=e.A(),b=f.H,d=ce(f.Ge,b,Math.max(1,e.f.size));if(e.j){let p=e.j.getContext("2d");p&&p.clearRect(0,0,e.j.width,e.j.height)}e.Ct=!0,Rm(e,n,b,d,f.Zn),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.o),n.uniform2f(e.F.u_resolution,o,i),n.bindBuffer(n.ARRAY_BUFFER,e.Gt),n.enableVertexAttribArray(e.F.a_position),n.vertexAttribPointer(e.F.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Wt),n.enableVertexAttribArray(e.F.a_color),n.vertexAttribPointer(e.F.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.Zo),e.pe(()=>kt(e))}function Tm(e,t,n,o,i,r){let s=e.r,a=[],l=[];for(let p=s.firstChild[e.X];p!==-1;p=s.nextSibling[p])s.value[p]<=0||(a.push(p),l.push(s.name[p]));let u=Math.max(1,o-i),m=Math.max(1,n-r),f=Re(l,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.W.facet_padding});e.m=f,fr(e);let b=e.Be,d=0;for(let p=0;p<a.length;p++){let x=a[p],h=f.cells[p];if(!h)continue;let g=s.name[x],y=e.st.get(g)??x,_=s.depth[y],C=h.layout.e;Po(s,y,C.x,C.y+i,C.x+C.width,C.y+i+C.height,_,t,e.co);let v=ur(e,y,100,_,d);b.length<v&&fr(e);let A=e.Be,R=e.Oe;for(let L=d;L<v;L++)A[L]=_,R[L]=y;d=v}e.ie=d}function fr(e){let t=e.$?.length??e.r.count;(!e.Be||e.Be.length<t)&&(e.Be=new Int32Array(t)),(!e.Oe||e.Oe.length<t)&&(e.Oe=new Int32Array(t))}function Rm(e,t,n,o,i){let r=e.r,s=e.$,a=e.ie,l=e.Be,u=e.Oe,m=h=>l?l[h]:r.depth[e.C],f=h=>u?u[h]:e.C,b=0;for(let h=0;h<a;h++){let g=s[h];if(g===f(h))continue;let y=r.x1[g]-r.x0[g],_=r.y1[g]-r.y0[g];y<1||_<1||(r.firstChild[g]===-1?b++:r.depth[g]-m(h)===1&&(b+=2))}let d=new Float32Array(b*6*2),p=new Float32Array(b*6*4),x=0;for(let h=0;h<a;h++){let g=s[h];if(g===f(h))continue;let y=r.x0[g],_=r.y0[g],C=r.x1[g],v=r.y1[g],A=C-y,R=v-_;if(!(A<1||R<1)){if(r.firstChild[g]===-1){let L=Go(e,g,n,o,i);x=mr(d,p,x,y,_,C-1,v-1,L)}else if(r.depth[g]-m(h)===1){let T=[.25,.25,.25,1];x=mr(d,p,x,y,v-1,C,v,T),x=mr(d,p,x,C-1,_,C,v,T)}}}e.Zo=x,e.Gt||(e.Gt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Gt),t.bufferData(t.ARRAY_BUFFER,d.subarray(0,x*2),t.DYNAMIC_DRAW),e.Wt||(e.Wt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Wt),t.bufferData(t.ARRAY_BUFFER,p.subarray(0,x*4),t.DYNAMIC_DRAW)}function mr(e,t,n,o,i,r,s,a){let l=n*2,u=n*4;e[l+0]=o,e[l+1]=i,e[l+2]=r,e[l+3]=i,e[l+4]=o,e[l+5]=s,e[l+6]=r,e[l+7]=i,e[l+8]=r,e[l+9]=s,e[l+10]=o,e[l+11]=s;for(let m=0;m<6;m++)t[u+m*4+0]=a[0],t[u+m*4+1]=a[1],t[u+m*4+2]=a[2],t[u+m*4+3]=a[3];return n+6}function kt(e){if(!e.c||e.C===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:o,cssHeight:i}=t,r=e.re!==-1?e.re:e.G;Wo(e,e.c,n,o,i,s=>wm(e,s,n,o,i),r!==-1?s=>{let a=e.A(),{fontFamily:l}=a,u=e.r;Mm(s,u,r);let m=e.$,f=e.ie,b=e.Be,d=e.Oe;for(let p=0;p<f;p++){let x=m[p],h=d?d[p]:e.C;if(x===h||u.firstChild[x]===-1)continue;let g=u.x1[x]-u.x0[x],y=u.y1[x]-u.y0[x],_=b?b[p]:u.depth[e.C],C=u.depth[x]-_;C===1?Oo(s,u,x,g,y,a,!e.co):C===2&&Oo(s,u,x,g,y,a,!0)}if(u.firstChild[r]===-1){let p=a.H,x=ce(a.Ge,p,Math.max(1,e.f.size)),h=u.x1[r]-u.x0[r],g=u.y1[r]-u.y0[r];ga(e,s,r,h,g,l,p,x,!0)}e.re===-1&&e.G!==-1&&Fm(e,s,e.G,o,i,l)}:null)}function wm(e,t,n,o,i){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Le:l}=s,u=s.H,m=ce(s.Ge,u,Math.max(1,e.f.size)),f=e.r,b=e.$,d=e.ie,p=e.Be,x=e.Oe;for(let h=0;h<d;h++){let g=b[h],y=x?x[h]:e.C;if(g===y||f.firstChild[g]!==-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g];ga(e,t,g,_,C,a,u,m)}for(let h=0;h<d;h++){let g=b[h],y=x?x[h]:e.C;if(g===y||f.firstChild[g]===-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g],v=p?p[h]:f.depth[e.C],A=f.depth[g]-v;A===1?Oo(t,f,g,_,C,s,!e.co):A===2&&Oo(t,f,g,_,C,s,!0)}if(e.le.length>1&&ko(e,t,o,a,l),Uo(e,r,m,u,s,o,i),e.m){t.font=`11px ${a}`,t.fillStyle=l,t.textAlign="center",t.textBaseline="top";for(let h of e.m.cells){let g=h.layout.e;t.fillText(h.label,g.x+g.width/2,g.y-14)}}t.restore()}function ga(e,t,n,o,i,r,s,a,l=!1){if(o<30||i<14)return;let b=e.r,d=hn(e,n,s,a),p=Eo(d[0],d[1],d[2]),x=l?p>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":p>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",h=Math.min(11,Math.floor(i/2));if(h<7)return;t.font=`${h}px ${r}`;let g=o-8,y=h*1.3,_=Math.max(1,Math.floor((i-8)/y)),C=Ws(t,b.name[n],g,_);if(C.length===0)return;let v=C.length*y,A=b.y0[n]+(i-v)/2+y/2;t.fillStyle=x,t.textAlign="center",t.textBaseline="middle";let R=b.x0[n]+o/2;for(let L=0;L<C.length;L++)t.fillText(C[L],R,A+L*y)}function Oo(e,t,n,o,i,{fontFamily:r,Le:s,backgroundColor:a},l){let u=t.x0[n],m=t.y0[n],f=t.name[n];if(l){if(o<60||i<30)return;let b=12;e.font=`${b}px ${r}`;let d=f,p=o-16;if(e.measureText(d).width>p){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=p){d+="\\u2026";break}}if(d.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,o,i),e.clip();let h=u+o/2,g=m+i/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(d,h,g),e.fillStyle=a,e.fillText(d,h,g),e.restore()}else{if(o<40||i<22)return;let b=11;e.font=`${b}px ${r}`;let d=f,p=o-10;if(e.measureText(d).width>p){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=p){d+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(d,u+5,m+4),e.globalAlpha=1}}function Mm(e,t,n){e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.strokeRect(t.x0[n],t.y0[n],t.x1[n]-t.x0[n],t.y1[n]-t.y0[n])}function Fm(e,t,n,o,i,r){let s=e.r,a=(s.x0[n]+s.x1[n])/2,l=(s.y0[n]+s.y1[n])/2;No(e,t,n,a,l,o,i,r)}async function ke(e,t,n){let o=e.r,i=oa(o,t),r=e.P.length>0&&e.W.facet_mode==="grid",s=r?i.slice(0,e.P.length):[],a=r?i.slice(e.P.length,e.P.length+e._.length):i.slice(0,e._.length),l=n==="leaf"?o.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.ne,groupByValues:a,splitByValues:s})}async function dt(e,t){let n=e.r,o=[],i=[],r=t;for(;n.parent[r]!==-1;)i.push(n.name[r]),r=n.parent[r];i.reverse(),i.length>0?o.push(i.join(" \\u203A ")):o.push(n.name[t]);let s=e.getColumnFormatter(e.ne,"value");if(o.push(`Value: ${s(n.value[t])}`),e.s&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.s,"value");o.push(`${e.s}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.Se){let u=await e.Se.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.s&&!isNaN(n.colorValue[t])||(typeof f=="number"?o.push(`${m}: ${e.getColumnFormatter(m,"value")(f)}`):o.push(`${m}: ${f}`)))}return n.firstChild[t]!==-1&&o.push(`Children: ${n.childCount[t]}`),o}function Vo(e,t,n,o){e.T.dismiss(),e.re=t;let i=e.t?.cssWidth??0,r=e.t?.cssHeight??0;dt(e,t).then(s=>{e.re===t&&s.length!==0&&e.T.pin(s,{px:n.cx,py:n.cy},{cssWidth:i,cssHeight:r})}),e.G=-1,o()}function Ho(e){e.T.dismiss(),e.re=-1}function Yo(e,t,n){let o=e.r;if(e.P.length>0&&e.W.facet_mode==="grid"){let i=t;for(;i!==-1&&o.parent[i]!==e.X;)i=o.parent[i];i!==-1&&e.st.set(o.name[i],t),e.G=-1,n();return}e.C=t,Bo(e,t),e.G=-1,n()}function cr(e,t,n){let o=e.r,i=o.x0,r=o.y0,s=o.x1,a=o.y1,l=o.depth,u=o.firstChild,m=e.$,f=e.ie,b=e.Be,d=e.Oe,p=-1,x=1/0,h=-1,g=1/0,y=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let _=0;_<f;_++){let C=m[_],v=d?d[_]:e.C;if(C===v||!(t>=i[C]&&t<=s[C]&&n>=r[C]&&n<=a[C]))continue;let A=(s[C]-i[C])*(a[C]-r[C]);if(u[C]!==-1){A<g&&(g=A,h=C);let R=b?b[_]:l[e.C],L=l[C]-R;if(L===1&&n<=r[C]+lr&&(y=C),L===2){let T=s[C]-i[C],F=a[C]-r[C];if(T>=60&&F>=30){let I=r[C]+F/2,D=i[C]+T/2;Math.abs(n-I)<10&&Math.abs(t-D)<T*.4&&(y=C)}}}else A<x&&(x=A,p=C)}return y!==-1?{leafId:-1,branchId:y,inHeader:!0}:{leafId:p,branchId:h,inHeader:!1}}function ha(e,t,n){if(e.re!==-1)return;for(let a of e.Ue)if(t>=a.x0&&t<=a.x1&&n>=a.y0&&n<=a.y1){e.T.setCursor("pointer"),e.G=-1,kt(e);return}let{leafId:o,branchId:i,inHeader:r}=cr(e,t,n),s=r?i:o!==-1?o:i;if(s!==e.G){if(e.G=s,e.T.setCursor(i!==-1?"pointer":"default"),s!==-1){let a=e.k.beginHover(s);dt(e,s).then(l=>{e.k.commitHover(a,l)&&kt(e)})}else e.k.clearHover();kt(e)}}function xa(e,t,n){if(e.re!==-1){xn(e),e.emitUnselect();return}for(let s of e.Ue)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(zo(e,s.nodeId),e.emitUnselect());return}let{leafId:o,branchId:i,inHeader:r}=cr(e,t,n);i!==-1&&r?(zo(e,i),ke(e,i,"branch")):o!==-1?(Ca(e,o),ke(e,o,"leaf")):i!==-1&&(zo(e,i),ke(e,i,"branch"))}function ya(e,t,n){let o=e.re!==-1;xn(e),o&&e.emitUnselect();let{leafId:i,branchId:r}=cr(e,t,n),s=e.r,a=r;if(a===-1&&i!==-1){let l=s.parent[i];l!==e.C&&l!==-1&&(a=l)}a!==-1&&a!==e.C&&s.firstChild[a]!==-1&&(zo(e,a),ke(e,a,"branch"),i!==-1&&s.firstChild[i]===-1&&(Ca(e,i),ke(e,i,"leaf")))}function zo(e,t){Yo(e,t,()=>{e.t&&e.requestRender(e.t)})}function Ca(e,t){let n=e.r,o=(n.x0[t]+n.x1[t])/2,i=(n.y0[t]+n.y1[t])/2;Vo(e,t,{cx:o,cy:i},()=>kt(e))}function xn(e){Ho(e)}var Xo=class extends Et{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"Gt",null);c(this,"Wt",null);c(this,"Zo",0);c(this,"G",-1);c(this,"re",-1);c(this,"Ue",[]);c(this,"ue",null);c(this,"Ct",!0);c(this,"_n",0);c(this,"st",new Map);c(this,"m",null);c(this,"co",!1);c(this,"Be",null);c(this,"Oe",null)}tooltipCallbacks(){return{onHover:(n,o)=>ha(this,n,o),onLeave:()=>{this.G!==-1&&this.re===-1&&(this.G=-1,this.t&&this.requestRender(this.t))},onClickPre:(n,o)=>(xa(this,n,o),!0),onDblClick:(n,o)=>ya(this,n,o)}}async uploadAndRender(n,o,i,r){if(this.t=n,i===0){let s=this.I;if(this.ne=s[0]||Fo(o)||"",this.s=s[1]||"",!this.s)this.ye="empty";else{let a=this.We[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.ye=l?"numeric":"series"}this.G=-1,this.re=-1,this.Ue=[],this.st.clear(),this.m=null,this.Be=null,this.Oe=null,this.Zo=0,this.k.clearHover(),this.k.invalidatePin(),xn(this),this.ue?.close(),this.ue=null,this.Ct=!0,this._n++,dn(this)}pn(this,o),bn(this),this.X!==-1&&await this.requestRender(n)}It(n){this.X!==-1&&(this.t=n,ba(this,n))}destroyInternal(){xn(this),this.ue?.close(),this.ue=null;let n=this.t?.gl;n&&(this.Gt&&n.deleteBuffer(this.Gt),this.Wt&&n.deleteBuffer(this.Wt)),this.Gt=null,this.Wt=null,this.o=null,this.F=null,this.X=-1,this.C=-1,this.le=[],this.Et.clear(),this.$=null,this.ie=0,this.Ue=[],this.st.clear(),this.m=null,this.Be=null,this.Oe=null}};nn();Me();me();var _a=4,yn=30;function Sm(e,t){let n=0,o=e.depth[t],i=new Int32Array(128);i[0]=t;let r=1;for(;r>0;){r--;let s=i[r],a=e.depth[s]-o;a>n&&(n=a);for(let l=e.firstChild[s];l!==-1;l=e.nextSibling[l]){if(r>=i.length){let u=new Int32Array(i.length*2);u.set(i),i=u}i[r++]=l}}return n}function dr(e,t,n){let o=e.depth[t],i=Math.max(1,Sm(e,t)),s=Math.max(0,n-yn)/i;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=yn,va(e,t,0,2*Math.PI,yn,s,o)}function va(e,t,n,o,i,r,s){let a=e.value[t];if(a<=0)return;let l=o-n,u=n;for(let m=e.firstChild[t];m!==-1;m=e.nextSibling[m]){let f=e.value[m];if(f<=0)continue;let b=f/a,d=u,p=u+l*b;u=p;let x=i,h=i+r;e.a0[m]=d,e.a1[m]=p,e.r0[m]=x,e.r1[m]=h;let g=p-d,y=(x+h)/2;g*y*r<_a||e.firstChild[m]!==-1&&va(e,m,d,p,h,r,s)}}function Aa(e,t){e.ie=pr(e,t,0)}function pr(e,t,n){let o=e.r,i=o.a0,r=o.a1,s=o.r0,a=o.r1,l=o.firstChild,u=o.nextSibling,m=o.value;(!e.$||e.$.length<o.count)&&(e.$=new Int32Array(o.count));let f=e.$,b=n,d=new Int32Array(128);d[0]=t;let p=1;for(;p>0;){p--;let x=d[p];if(m[x]<=0)continue;f[b++]=x;let h=r[x]-i[x],g=(s[x]+a[x])/2,y=h*g,_=a[x]-s[x];if(!(y*_<_a))for(let C=l[x];C!==-1;C=u[C]){if(p>=d.length){let v=new Int32Array(d.length*2);v.set(d),d=v}d[p++]=C}}return b}vt();var $o=32,Im=28,Dm=90;function jo(e,t){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut};let n=e.r;for(let o of e.u){let i=t;for(;i!==-1;){if(i===o.drillRoot)return{centerX:o.centerX,centerY:o.centerY};i=n.parent[i]}}return{centerX:e.lt,centerY:e.ut}}function Ra(e,t){if(e.C===-1)return;let n=t.gl,o=t.cssWidth,i=t.cssHeight;if(o<=0||i<=0)return;let r=e.P.length>0&&e.W.facet_mode==="grid",s=e.ye==="series"?e.f.size>1:e.ye==="numeric"&&e.b<e.p,a=!r&&e.le.length>1?Im:0,l=s?Dm:0;if(r)Bm(e,o,i,l);else{e.m=null,e.u=[];let p=o-l,x=i-a;e.lt=p/2,e.ut=a+x/2,e.qo=Math.max(0,Math.min(p,x)/2-4),dr(e.r,e.C,e.qo),Aa(e,e.C)}Pm(e,t);let u=e.A(),m=u.H,f=ce(u.Ge,m,Math.max(1,e.f.size));if(e.j){let p=e.j.getContext("2d");p&&p.clearRect(0,0,e.j.width,e.j.height)}let b=t.dpr;e.Ct=!0,Em(e,n,m,f,u.Zn,b),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.o);let d=e.F;if(n.uniform2f(d.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(d.u_border_px,u.Ti*b),e.u.length>0)for(let p of e.u)p.instanceCount!==0&&(n.uniform2f(d.u_center,p.centerX*b,p.centerY*b),La(e,n,t,p.instanceStart,p.instanceCount));else n.uniform2f(d.u_center,e.lt*b,e.ut*b),La(e,n,t,0,e.Ko);e.pe(()=>qe(e))}function Bm(e,t,n,o){let i=e.r,r=[],s=[];for(let f=i.firstChild[e.X];f!==-1;f=i.nextSibling[f])i.value[f]<=0||(r.push(f),s.push(i.name[f]));let a=Math.max(1,t-o),l=Re(s,{cssWidth:a,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.W.facet_padding});e.m=l;let u=[],m=0;for(let f=0;f<r.length;f++){let b=r[f],d=l.cells[f];if(!d)continue;let p=i.name[b],x=e.st.get(p)??b,h=d.layout.e,g=h.x+h.width/2,y=h.y+h.height/2,_=Math.max(0,Math.min(h.width,h.height)/2-4);dr(i,x,_);let C=pr(e,x,m),v=m,A=C-m;u.push({label:p,centerX:g,centerY:y,maxRadius:_,drillRoot:x,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=C}e.ie=m,e.u=u,u.length>0&&(e.lt=u[0].centerX,e.ut=u[0].centerY,e.qo=u[0].maxRadius)}function Pm(e,t){if(e.o)return;let n=t.gl,o=j(t,"sunburst-arc",Hn,Yn,["u_center","u_resolution","u_border_px"],["a_strip_t","a_side","a_angles","a_radii","a_color"]);e.o=o.program,e.F=o;let i=new Float32Array(($o+1)*2*2);for(let r=0;r<=$o;r++){let s=r/$o,a=r*4;i[a+0]=s,i[a+1]=0,i[a+2]=s,i[a+3]=1}e.Jt=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.Jt),n.bufferData(n.ARRAY_BUFFER,i,n.STATIC_DRAW),e.Qt=n.createBuffer()}function Em(e,t,n,o,i,r){let s=e.r,a=e.$,l=e.u.length>0,u=l?e.u.reduce((d,p)=>d+p.instanceCount,0):e.ie,m=new Float32Array(u*8),f=0,b=(d,p,x)=>{let h=f;for(let g=d;g<p;g++){let y=a[g];if(y===x)continue;let _=s.a0[y],C=s.a1[y],v=s.r0[y],A=s.r1[y];if(C<=_||A<=v)continue;let R=Go(e,y,n,o,i),L=f*8;m[L+0]=_,m[L+1]=C,m[L+2]=v*r,m[L+3]=A*r,m[L+4]=R[0],m[L+5]=R[1],m[L+6]=R[2],m[L+7]=R[3],f++}return{rangeStart:h,rangeCount:f-h}};if(l)for(let d of e.u){let p=d.instanceStart,x=p+d.instanceCount,{rangeStart:h,rangeCount:g}=b(p,x,d.drillRoot);d.instanceStart=h,d.instanceCount=g}else b(0,e.ie,e.C);e.Ko=f,t.bindBuffer(t.ARRAY_BUFFER,e.Qt),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function La(e,t,n,o,i){if(i===0)return;let r=e.F;t.bindBuffer(t.ARRAY_BUFFER,e.Jt);let s=2*Float32Array.BYTES_PER_ELEMENT;t.enableVertexAttribArray(r.a_strip_t),t.vertexAttribPointer(r.a_strip_t,1,t.FLOAT,!1,s,0),t.enableVertexAttribArray(r.a_side),t.vertexAttribPointer(r.a_side,1,t.FLOAT,!1,s,Float32Array.BYTES_PER_ELEMENT);let a=J(n),{setDivisor:l}=a;l(r.a_strip_t,0),l(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.Qt);let u=8*Float32Array.BYTES_PER_ELEMENT,m=Float32Array.BYTES_PER_ELEMENT,f=o*u;t.enableVertexAttribArray(r.a_angles),t.vertexAttribPointer(r.a_angles,2,t.FLOAT,!1,u,f),l(r.a_angles,1),t.enableVertexAttribArray(r.a_radii),t.vertexAttribPointer(r.a_radii,2,t.FLOAT,!1,u,f+2*m),l(r.a_radii,1),t.enableVertexAttribArray(r.a_color),t.vertexAttribPointer(r.a_color,4,t.FLOAT,!1,u,f+4*m),l(r.a_color,1),a.drawArraysInstanced(t.TRIANGLE_STRIP,0,2*($o+1),i),l(r.a_angles,0),l(r.a_radii,0),l(r.a_color,0)}function qe(e){if(!e.c||e.C===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:o,cssHeight:i}=t;Wo(e,e.c,n,o,i,r=>Gm(e,r,n,o,i),e.G!==-1?r=>{Wm(r,e,e.G),km(e,r,e.G,o,i,e.A().fontFamily)}:null)}function Gm(e,t,n,o,i){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Le:l,$n:u}=s,m=s.H,f=ce(s.Ge,m,Math.max(1,e.f.size)),b=e.r,d=e.$,p=e.ie,x=e.u.length>0;if(x)for(let g of e.u){let y=g.nodeStart+g.nodeCount;for(let _=g.nodeStart;_<y;_++){let C=d[_];C!==g.drillRoot&&Ta(e,t,C,a,m,f,g.centerX,g.centerY)}}else for(let g=0;g<p;g++){let y=d[g];y!==e.C&&Ta(e,t,y,a,m,f,e.lt,e.ut)}let h=Math.max(0,yn-s.Ti*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",x){for(let g of e.u)if(t.beginPath(),t.fillStyle=u,t.arc(g.centerX,g.centerY,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[g.drillRoot],g.centerX,g.centerY),e.m){let y=e.m.cells.find(_=>_.label===g.label);y?.titleRect&&(t.fillStyle=l,t.font=`11px ${a}`,t.textBaseline="middle",t.fillText(g.label,y.titleRect.x+y.titleRect.width/2,y.titleRect.y+y.titleRect.height/2))}}else t.beginPath(),t.arc(e.lt,e.ut,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[e.C],e.lt,e.ut);!x&&e.le.length>1&&ko(e,t,o,a,l),Uo(e,r,f,m,s,o,i,x?e.m?.legendRect??null:null),t.restore()}function Ta(e,t,n,o,i,r,s,a){let l=e.r,u=l.a0[n],m=l.a1[n],f=l.r0[n],b=l.r1[n],d=b-f,p=(f+b)/2,h=(m-u)*p;if(d<16||h<8)return;let g=Math.min(11,Math.floor(h*.7));if(g<7)return;t.font=`${g}px ${o}`;let y=l.name[n],_=d-4,C=y;if(t.measureText(C).width>_){for(;C.length>1;)if(C=C.slice(0,-1),t.measureText(C+"\\u2026").width<=_){C+="\\u2026";break}}if(C.length<2)return;let v=(u+m)/2;t.save(),t.translate(s,a);let A=v,R=v>Math.PI/2&&v<3*Math.PI/2;e.Gi==="upright"&&R&&(A+=Math.PI),t.rotate(A);let L=hn(e,n,i,r),T=Eo(L[0],L[1],L[2]);t.fillStyle=T>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)",t.textAlign="center",t.textBaseline="middle";let F=e.Gi==="upright"&&R?-p:p;t.fillText(C,F,0),t.restore()}function Wm(e,t,n){let o=t.r,i=o.a0[n],r=o.a1[n],s=o.r0[n],a=o.r1[n],{centerX:l,centerY:u}=jo(t,n);e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.beginPath(),e.arc(l,u,a,i,r),e.arc(l,u,s,r,i,!0),e.closePath(),e.stroke()}function km(e,t,n,o,i,r){let s=e.r,a=(s.a0[n]+s.a1[n])/2,l=(s.r0[n]+s.r1[n])/2,{centerX:u,centerY:m}=jo(e,n),f=u+Math.cos(a)*l,b=m+Math.sin(a)*l;No(e,t,n,f,b,o,i,r)}function wa(e,t,n){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut,drillRoot:e.C};for(let o of e.u){let i=t-o.centerX,r=n-o.centerY;if(!(Math.sqrt(i*i+r*r)>o.maxRadius+4))return{centerX:o.centerX,centerY:o.centerY,drillRoot:o.drillRoot}}return null}function Nm(e,t,n){let o=e.r,i=t;for(;i!==-1;){if(i===n)return!0;i=o.parent[i]}return!1}function Ma(e,t,n){let o=wa(e,t,n);if(!o)return-1;let i=e.r,r=e.$,s=e.ie;if(!r)return-1;let a=t-o.centerX,l=n-o.centerY,u=Math.sqrt(a*a+l*l),m=Math.atan2(l,a);if(m<0&&(m+=2*Math.PI),u<i.r1[e.X]+.001&&o.drillRoot!==e.X)return o.drillRoot;let f=e.u.length>0;for(let b=0;b<s;b++){let d=r[b];if(d===o.drillRoot||f&&!Nm(e,d,o.drillRoot))continue;let p=i.a0[d],x=i.a1[d],h=i.r0[d],g=i.r1[d];if(!(u<h||u>g)&&!(m<p||m>x))return d}return-1}function Fa(e,t,n){if(e.re!==-1)return;for(let r of e.Ue)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.T.setCursor("pointer"),e.G!==-1&&(e.G=-1,qe(e));return}let o=Ma(e,t,n),i=e.r;if(e.T.setCursor(o!==-1&&i.firstChild[o]!==-1?"pointer":"default"),o!==e.G){if(e.G=o,o!==-1){let r=e.k.beginHover(o);dt(e,o).then(s=>{e.k.commitHover(r,s)&&qe(e)})}else e.k.clearHover();qe(e)}}function Sa(e,t,n){if(e.re!==-1){Zo(e),e.emitUnselect();return}for(let s of e.Ue)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(br(e,s.nodeId),e.emitUnselect());return}let o=e.r,i=wa(e,t,n);if(i){let s=t-i.centerX,a=n-i.centerY;if(Math.sqrt(s*s+a*a)<o.r1[e.X]+.001){let u=o.parent[i.drillRoot];if(u!==-1&&u!==e.X)br(e,u),e.emitUnselect();else if(e.u.length>0){let m=e.u.find(f=>f.drillRoot===i.drillRoot);m&&(e.st.delete(m.label),e.emitUnselect()),e.t&&e.requestRender(e.t)}return}}let r=Ma(e,t,n);r!==-1&&(o.firstChild[r]!==-1?(br(e,r),ke(e,r,"branch")):(Um(e,r),ke(e,r,"leaf")))}function br(e,t){Yo(e,t,()=>{e.t&&e.requestRender(e.t)})}function Um(e,t){let n=e.r,o=(n.a0[t]+n.a1[t])/2,i=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=jo(e,t),a=r+Math.cos(o)*i,l=s+Math.sin(o)*i;Vo(e,t,{cx:a,cy:l},()=>qe(e))}function Zo(e){Ho(e)}var qo=class extends Et{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"Jt",null);c(this,"Qt",null);c(this,"Ko",0);c(this,"Gi","upright");c(this,"lt",0);c(this,"ut",0);c(this,"qo",0);c(this,"G",-1);c(this,"re",-1);c(this,"Ue",[]);c(this,"ue",null);c(this,"Ct",!0);c(this,"_n",0);c(this,"m",null);c(this,"st",new Map);c(this,"u",[])}tooltipCallbacks(){return{onHover:(n,o)=>Fa(this,n,o),onLeave:()=>{this.G!==-1&&this.re===-1&&(this.G=-1,qe(this))},onClickPre:(n,o)=>(Sa(this,n,o),!0)}}async uploadAndRender(n,o,i,r){if(this.t=n,i===0){let s=this.I;if(this.ne=s[0]||Fo(o)||"",this.s=s[1]||"",!this.s)this.ye="empty";else{let a=this.We[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.ye=l?"numeric":"series"}this.G=-1,this.re=-1,this.Ue=[],this.st.clear(),this.m=null,this.u=[],this.Ko=0,this.k.clearHover(),this.k.invalidatePin(),Zo(this),this.ue?.close(),this.ue=null,this.Ct=!0,this._n++,dn(this)}pn(this,o),bn(this),this.X!==-1&&await this.requestRender(n)}It(n){this.X!==-1&&(this.t=n,Ra(this,n))}destroyInternal(){Zo(this),this.ue?.close(),this.ue=null;let n=this.t?.gl;n&&(this.Jt&&n.deleteBuffer(this.Jt),this.Qt&&n.deleteBuffer(this.Qt)),this.Jt=null,this.Qt=null,this.o=null,this.F=null,this.X=-1,this.C=-1,this.le=[],this.Et.clear(),this.$=null,this.ie=0,this.Ue=[],this.m=null,this.st.clear(),this.u=[]}};Jt();var Nt=class extends Te{constructor(){super(...arguments);c(this,"we",[]);c(this,"ee",0);c(this,"mt",0);c(this,"o",null);c(this,"N",null);c(this,"a",null);c(this,"he",null);c(this,"xe",null);c(this,"Re",null);c(this,"eo",!0)}getZoomConfig(){return{lockAxis:"y"}}};Qt();function Ko(e,t=.5,n=.1){let o=t/Math.max(1,e),i=o*(1-n)/2;return{slotWidth:o,halfWidth:i}}function Ia(e,t,n="bar"){let o=t?.[e]?.chart_type?.toLowerCase?.();return o==="bar"||o==="line"||o==="scatter"||o==="area"?o:n}function Da(e,t,n){let o=n?.[e]?.stack;return typeof o=="boolean"?o:t==="bar"||t==="area"}function gr(e,t){return t?.[e]?.alt_axis===!0}function Ba(e,t,n){if(t!=="line"&&t!=="area")return"skip";let o=n?.[e]?.interpolate;return o===void 0||t==="area"?"solid":o}var Pa=50,pt=0,Jo=1;function Qo(){return{count:0,catIdx:new Int32Array(0),seriesId:new Int32Array(0),axis:new Uint8Array(0),chartType:new Uint8Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),y0:new Float64Array(0),y1:new Float64Array(0)}}function Om(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),seriesId:new Int32Array(t),axis:new Uint8Array(t),chartType:new Uint8Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),y0:new Float64Array(t),y1:new Float64Array(t)}}function Cn(e,t,n,o,i){let r=e.seriesId[t],s=e.catIdx[t];return{catIdx:s,aggIdx:Math.floor(r/n),splitIdx:r%n,seriesId:r,xCenter:e.xCenter[t],halfWidth:e.halfWidth[t],y0:e.y0[t],y1:e.y1[t],value:o[s*i+r],axis:e.axis[t],chartType:e.chartType[t]===pt?"bar":"area"}}function Ea(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function Ga(e,t){e[t>>3]|=1<<(t&7)}function Wa(e){let{columns:t,numRows:n,columnSlots:o,groupBy:i,splitBy:r,groupByTypes:s,columnsConfig:a,defaultChartType:l,autoAltYAxis:u,bandInnerFrac:m,barInnerPad:f,includeZero:b,facetSplits:d,scratchBars:p,scratchPosStack:x,scratchNegStack:h}=e,g=Gt(i,s),y={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:g,numericCategoryDomain:null,categoryPositions:null,series:[],bars:Qo(),posStack:x??null,negStack:h??null,samples:new Float32Array(0),sampleValid:new Uint8Array(0),leftDomain:{min:0,max:0},rightDomain:null,hasRightAxis:!1,leftValueAxisMode:"numeric",rightValueAxisMode:null,leftValueCategoryDomain:null,rightValueCategoryDomain:null},_=o.filter(w=>!!w);if(_.length===0)return y;let C=[];if(r.length>0){for(let w of He(t,[],_))w.colNames.size>0&&C.push(w.prefix);C.length===0&&C.push("")}else C.push("");let v=i.map(w=>s[w]??"string"),{rowPaths:A,numCategories:R,rowOffset:L}=Wt(t,n,i.length,v);if(R===0)return{...y,aggregates:_,splitPrefixes:C,rowPaths:A,rowOffset:L};let T=[],F=_.length,I=C.length;for(let w=0;w<F;w++)for(let B=0;B<I;B++){let G=_[w],N=C[B],z=N===""?G:`${N}${F>1?` | ${G}`:""}`,H=Ia(G,a,l),Z=Da(G,H,a),pe=Ba(G,H,a);T.push({seriesId:w*I+B,aggIdx:w,splitIdx:B,aggName:G,splitKey:N,label:z,color:[.5,.5,.5],axis:0,chartType:H,stack:Z,start:-1,end:-1,interpolateMode:pe})}let D=[];for(let w=0;w<F;w++)D.push(b?{min:0,max:0}:{min:1/0,max:-1/0});let P=R,E=T.length,O=d?P*F*I:P*F,W=Ea(x??null,O),V=Ea(h??null,O);W.fill(0,0,O),V.fill(0,0,O);let S=new Float32Array(P*E),Y=new Uint8Array(P*E+7>>3),U=null,X=null,q=1;if(g.mode==="numeric"&&P>0){let w=t.get("__ROW_PATH_0__"),B=ct(w?.values,P,L,i[0]??"",g.numericType==="date"||g.numericType==="datetime");B&&(U=B.categoryPositions,X=B.numericCategoryDomain,q=B.numericCategoryDomain.bandWidth)}let be=Ko(F,m,f),Fe=be.slotWidth*q,_e=be.halfWidth*q,ve=new Float64Array(F),et=(F-1)/2;for(let w=0;w<F;w++)ve[w]=(w-et)*Fe;let zt=new Array(F*I),Xt=new Array(F*I);for(let w=0;w<F;w++){let B=_[w];for(let G=0;G<I;G++){let N=C[G],z=N===""?B:`${N}|${B}`,H=t.get(z),Z=w*I+G;zt[Z]=H?.values??null,Xt[Z]=H?.valid??null}}let $t=new Array(F),ge=new Array(F),se=!1;for(let w=0;w<F;w++){let B=_[w],G=C[0],N=G===""?B:`${G}|${B}`;$t[w]=t.get(N)?.type==="string",ge[w]=gr(B,a)?1:0,$t[w]&&(se=!0)}let Q=[],oe=[],Se=[],Ie=[];for(let w=0;w<F;w++){let B=_[w];for(let G=0;G<I;G++){let N=C[G],z=N===""?B:`${N}|${B}`,H=w*I+G,Z={name:z,type:$t[w]?"string":"numeric",data:t.get(z)};ge[w]===0?(Q.push(Z),Se.push(H)):(oe.push(Z),Ie.push(H))}}let $r=Q.map(w=>w.name).filter((w,B,G)=>G.indexOf(w)===B).join(", "),Ai=oe.map(w=>w.name).filter((w,B,G)=>G.indexOf(w)===B).join(", "),De=Q.length>0?ar(Q,n,L,$r):null,K=oe.length>0?ar(oe,n,L,Ai):null,bt=new Array(F*I).fill(null);if(De)for(let w=0;w<Se.length;w++)bt[Se[w]]=De.perColumnSlots[w];if(K)for(let w=0;w<Ie.length;w++)bt[Ie[w]]=K.perColumnSlots[w];let Bl=P*F*I,$=Om(p??null,Bl),ee=0;for(let w=0;w<P;w++){let B=w+L;for(let G=0;G<F;G++)for(let N=0;N<I;N++){let z=G*I+N,H=bt[z];if(H){let ae=G*I+N,he=w*E+ae;S[he]=H[w],Ga(Y,he);continue}let Z=zt[z];if(!Z)continue;let pe=Xt[z];if(pe&&!(pe[B>>3]>>(B&7)&1))continue;let te=Z[B];if(!isFinite(te))continue;let ht=G*I+N,nt=w*E+ht;S[nt]=te,Ga(Y,nt)}}for(let w=0;w<E;w++){let B=-1,G=-1;for(let N=0;N<P;N++){let z=N*E+w;Y[z>>3]>>(z&7)&1&&(B===-1&&(B=N),G=N)}T[w].start=B,T[w].end=G}for(let w=0;w<E;w++){let B=T[w];if(!(B.start<0)&&B.interpolateMode!=="skip"){if(B.chartType==="line"){let G=B.start;for(let N=B.start+1;N<=B.end;N++){let z=N*E+w;if(Y[z>>3]>>(z&7)&1){if(N-G>1){let Z=G*E+w,pe=S[Z],te=S[z],ht=U?U[G]:G,ae=(U?U[N]:N)-ht;for(let he=1;he<N-G;he++){let fe=G+he,xe=U?U[fe]:fe,Ul=ae===0?0:(xe-ht)/ae;S[fe*E+w]=pe+(te-pe)*Ul}}G=N}}}else if(B.chartType==="area"){for(let G=0;G<B.start;G++)S[G*E+w]=0;for(let G=B.end+1;G<P;G++)S[G*E+w]=0;B.start=0,B.end=P-1}}}for(let w=0;w<P;w++){let B=U?U[w]:w;for(let G=0;G<F;G++){let N=ve[G],z=B+N,H=D[G];for(let Z=0;Z<I;Z++){let pe=G*I+Z,te=T[pe];if(w<te.start||w>te.end)continue;let ht=te.chartType==="line"||te.chartType==="area"&&te.interpolateMode!=="skip",nt=w*E+pe;if(!ht&&!(Y[nt>>3]>>(nt&7)&1))continue;let ae=S[nt];if((te.chartType==="bar"||te.chartType==="area")&&te.stack){if(ae===0&&(te.chartType!=="area"||te.interpolateMode==="skip"))continue;let he=d?(w*F+G)*I+Z:w*F+G,fe,xe;ae>=0?(fe=W[he],xe=fe+ae,W[he]=xe):(fe=V[he],xe=fe+ae,V[he]=xe),fe<H.min&&(H.min=fe),xe<H.min&&(H.min=xe),fe>H.max&&(H.max=fe),xe>H.max&&(H.max=xe),$.catIdx[ee]=w,$.seriesId[ee]=pe,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:Jo,$.xCenter[ee]=z,$.halfWidth[ee]=_e,$.y0[ee]=fe,$.y1[ee]=xe,ee++}else if(ae<H.min&&(H.min=ae),ae>H.max&&(H.max=ae),b&&(0<H.min&&(H.min=0),0>H.max&&(H.max=0)),te.chartType==="bar"||te.chartType==="area"){if(ae===0)continue;$.catIdx[ee]=w,$.seriesId[ee]=pe,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:Jo,$.xCenter[ee]=z,$.halfWidth[ee]=_e,$.y0[ee]=0,$.y1[ee]=ae,ee++}}}}$.count=ee;let gt=!1;if(u&&F>=2&&!se){let w=new Array(F),B=0,G=1/0;for(let N=0;N<F;N++){let z=D[N],H=Math.max(Math.abs(z.min),Math.abs(z.max),1e-12);w[N]=H,H>B&&(B=H),H<G&&(G=H)}if(B/G>Pa){let N=B/Math.sqrt(Pa);for(let z=0;z<F;z++)if(w[z]<N)for(let Z of T)Z.aggIdx===z&&(Z.axis=1);for(let z=0;z<$.count;z++)$.axis[z]=T[$.seriesId[z]].axis;gt=T.some(z=>z.axis===1)}}let jr=!1;for(let w=0;w<F;w++)if(gr(_[w],a))for(let B of T)B.aggIdx===w&&(B.axis=1,jr=!0);if(jr){for(let w=0;w<$.count;w++)$.axis[w]=T[$.seriesId[w]].axis;gt=!0}let Be=b?{min:0,max:0}:{min:1/0,max:-1/0},tt=b?{min:0,max:0}:{min:1/0,max:-1/0};for(let w=0;w<$.count;w++){let B=$.axis[w]===0?Be:tt,G=$.y0[w],N=$.y1[w];G<B.min&&(B.min=G),N<B.min&&(B.min=N),G>B.max&&(B.max=G),N>B.max&&(B.max=N)}for(let w=0;w<E;w++){let B=T[w];if(B.stack&&(B.chartType==="bar"||B.chartType==="area")||B.start<0)continue;let G=B.chartType==="line"||B.chartType==="area"&&B.interpolateMode!=="skip",N=B.axis===0?Be:tt;for(let z=B.start;z<=B.end;z++){let H=z*E+w;if(!G&&!(Y[H>>3]>>(H&7)&1))continue;let Z=S[H];Z<N.min&&(N.min=Z),Z>N.max&&(N.max=Z)}}(!isFinite(Be.min)||!isFinite(Be.max)||Be.min===0&&Be.max===0)&&(Be.min=0,Be.max=1);let Pl=!isFinite(tt.min)||!isFinite(tt.max)||tt.min===0&&tt.max===0,El=gt?Pl?{min:0,max:1}:tt:null,Gl=De?"category":"numeric",Wl=gt?K?"category":"numeric":null,kl=De&&De.domain.numRows>0?{min:0,max:Math.max(0,De.domain.numRows-1)}:Be,Nl=K&&K.domain.numRows>0&>?{min:0,max:Math.max(0,K.domain.numRows-1)}:El;return{aggregates:_,splitPrefixes:C,rowPaths:A,numCategories:R,rowOffset:L,axisMode:g,numericCategoryDomain:X,categoryPositions:U,series:T,bars:$,posStack:W,negStack:V,samples:S,sampleValid:Y,leftDomain:kl,rightDomain:Nl,hasRightAxis:gt,leftValueAxisMode:Gl,rightValueAxisMode:Wl,leftValueCategoryDomain:De?.domain??null,rightValueCategoryDomain:K?.domain??null}}Ye();on();Ct();Me();var hr=pt;function xr(e,t,n,o){let i=o?.start??0,r=o?.count??e.vn;if(e.vn===0||r===0)return;let s=e.F,a=J(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,e.N),t.enableVertexAttribArray(s.a_corner),t.vertexAttribPointer(s.a_corner,2,t.FLOAT,!1,0,0),l(s.a_corner,0),Ze(n,a,s.a_x_center,"bar_x",1,i)&&Ze(n,a,s.a_half_width,"bar_hw",1,i)&&Ze(n,a,s.a_y0,"bar_y0",1,i)&&Ze(n,a,s.a_y1,"bar_y1",1,i)&&Ze(n,a,s.a_color,"bar_color",3,i)&&Ze(n,a,s.a_series_id,"bar_sid",1,i)&&Ze(n,a,s.a_axis,"bar_axis",1,i)&&a.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,r),l(s.a_x_center,0),l(s.a_half_width,0),l(s.a_y0,0),l(s.a_y1,0),l(s.a_color,0),l(s.a_series_id,0),l(s.a_axis,0)}var ei=10;function Ut(e){return e.Ve>=0?Cn(e.me,e.Ve,e.fe.length,e.je,e.l.length):e.He}function yr(e,t,n){if(!e.a)return;let o=e.a,i;if(e.m){let y=e.m.cells,_=-1;for(let C=0;C<y.length;C++){let v=y[C].layout.e;if(t>=v.x&&t<=v.x+v.width&&n>=v.y&&n<=v.y+v.height){_=C;break}}if(_<0){Na(e);return}o=y[_].layout,i=_}let r=o.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){Na(e);return}let s=o.Y,a=o.J,l=o.q,u=o.Q,m,f,b,d;if(e.Ze){let y=s,_=a,C=Math.min(l,u),v=Math.max(l,u),A=y+(t-r.x)/r.width*(_-y);m=C+(n-r.y)/r.height*(v-C),f=A,b=r.height/(v-C),d=r.width/(_-y)}else m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),d=r.height/(u-l);let p=e.en&&e.te&&!e.Ze?e.te.max-(n-r.y)/r.height*(e.te.max-e.te.min):f,x=e.en&&e.te&&!e.Ze?r.height/(e.te.max-e.te.min):d,h=-1,g=null;if(g=ka(e,"scatter",m,f,p,b,d,x,i),g||(g=ka(e,"line",m,f,p,b,d,x,i)),!g){let y=e.me,_=y.chartType,C=y.seriesId,v=y.xCenter,A=y.halfWidth,R=y.y0,L=y.y1,T=y.axis,F=e.K,I=e.fe.length;for(let D=0;D<y.count;D++){if(_[D]!==pt||F.has(C[D])||i!==void 0&&C[D]%I!==i)continue;let P=v[D],E=A[D];if(m<P-E||m>P+E)continue;let O=T[D]===0?f:p,W=R[D],V=L[D],S=W<V?W:V,Y=W<V?V:W;if(O>=S&&O<=Y){h=D;break}}}if(h<0&&!g){let y=Vm(e,m,f,p,i);y&&(y.idx>=0?h=y.idx:g=y.bar)}Hm(e,h,g)}function ka(e,t,n,o,i,r,s,a,l){let u=e.ee,m=e.l.length;if(u===0||m===0)return null;let f=e.je,b=e.kt,p=ei*ei,x=null,h=e.qe;for(let g of e.l){if(g.chartType!==t||e.K.has(g.seriesId)||l!==void 0&&g.splitIdx!==l)continue;let y=g.axis===1?i:o,_=g.axis===1?a:s,C=h?0:Math.max(0,Math.floor(n-ei/r)),v=h?u-1:Math.min(u-1,Math.ceil(n+ei/r));for(let A=C;A<=v;A++){let R=A*m+g.seriesId;if(!(b[R>>3]>>(R&7)&1))continue;let L=f[R],T=h?h[A]:A,F=(T-n)*r,I=(L-y)*_,D=F*F+I*I;D<p&&(p=D,x={catIdx:A,aggIdx:g.aggIdx,splitIdx:g.splitIdx,seriesId:g.seriesId,xCenter:T,halfWidth:0,y0:0,y1:L,value:L,axis:g.axis,chartType:"bar"})}}return x}function Vm(e,t,n,o,i){let r=Math.round(t);if(r<0||r>=e.ee||Math.abs(t-r)>.5)return null;let s=e.l.length,a=e.je,l=e.kt,u=e.me,m=u.chartType,f=u.catIdx,b=u.seriesId,d=u.axis,p=u.y0,x=u.y1,h=e.fe.length;for(let g=0;g<u.count;g++){if(m[g]!==Jo||f[g]!==r||e.K.has(b[g])||i!==void 0&&b[g]%h!==i)continue;let y=d[g]===0?n:o,_=p[g],C=x[g],v=_<C?_:C,A=_<C?C:_;if(y>=v&&y<=A)return{idx:g,bar:null}}for(let g of e.l){if(g.chartType!=="area"||g.stack||e.K.has(g.seriesId)||i!==void 0&&g.splitIdx!==i)continue;let y=r*s+g.seriesId;if(!(l[y>>3]>>(y&7)&1))continue;let _=a[y],C=g.axis===1?o:n,v=Math.min(0,_),A=Math.max(0,_);if(C>=v&&C<=A)return{idx:-1,bar:{catIdx:r,aggIdx:g.aggIdx,splitIdx:g.splitIdx,seriesId:g.seriesId,xCenter:r,halfWidth:.5,y0:0,y1:_,value:_,axis:g.axis,chartType:"area"}}}return null}function Na(e){(e.Ve!==-1||e.He!==null)&&(e.Ve=-1,e.He=null,e.t&&e.requestRender(e.t))}function Hm(e,t,n){let o=e.Ve===t,i=(e.He?.seriesId??-1)===(n?.seriesId??-1)&&(e.He?.catIdx??-1)===(n?.catIdx??-1);o&&i||(e.Ve=t,e.He=n,e.t&&e.requestRender(e.t))}function Ua(e,t,n){if(e.tn.length===0)return!1;for(let o of e.tn){let i=o.rect;if(t>=i.x&&t<=i.x+i.width&&n>=i.y&&n<=i.y+i.height){let r=o.seriesIds.some(s=>!e.K.has(s));for(let s of o.seriesIds)r?e.K.add(s):e.K.delete(s);return e._t=null,e.po=!1,e.bo=null,e.t&&(ti(e,e.t),ni(e,e.t),e.requestRender(e.t)),!0}}return!1}function Cr(e,t){let n=[],o=e.l[t.seriesId],i=Ym(e,t.catIdx);i&&n.push(i);let r=e.getColumnFormatter(o.aggName,"value");return n.push(`${o.aggName}: ${r(t.value)}`),o.splitKey&&n.push(`Split: ${o.splitKey}`),t.y0!==0&&(n.push(`Base: ${r(t.y0)}`),n.push(`Top: ${r(t.y1)}`)),n}function Ym(e,t){if(e.Ke==="numeric"&&e.D){let o=e.me,i=null;for(let s=0;s<o.count;s++)if(o.catIdx[s]===t){i=o.xCenter[s];break}if(i==null)return"";let r=e._[0];return e.getColumnFormatter(r,"value")(i)}if(e.we.length===0)return"";let n=[];for(let o of e.we){let i=o.labels[t];i!=null&&i!==""&&n.push(i)}return n.join(" / ")}function Oa(e,t){t<0||t>=e.me.count||(e.Jo=t,Ha(e,Cn(e.me,t,e.fe.length,e.je,e.l.length)))}function Va(e,t){e.Jo=-1,Ha(e,t)}function Ha(e,t){if(e.T.dismiss(),!e.a)return;let n=_r(e,t);if(!n)return;let i=(e.l[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ze?n.E(i,t.xCenter):n.E(t.xCenter,i):vr(e,t.xCenter,i,n),s=Cr(e,t);s.length!==0&&(e.T.pin(s,r,n),e.Ve=-1,e.He=null,e.t&&e.requestRender(e.t))}Ae();Yi();Ae();ut();Ft();po();function Ya(e,t,n){if(n)return n;if(!e.isDate)return ue;let o=t.length>1?t[1]-t[0]:0;return i=>ye(i,o)}function Ar(e,t,n,o,i,r,s){let{Le:a,fontFamily:l}=r,{e:u}=t,m=i==="bottom"?u.y+u.height:u.y;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,fo(e,u,o,m,i,f=>t.E(f,0).px,Ya(n,o,s)),e.font=`13px ${l}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,u.x+u.width/2,i==="bottom"?t.cssHeight-2:10)}function Lr(e,t,n,o,i,r,s){let{Le:a,fontFamily:l}=r,{e:u}=t,m=i==="left"?u.x:u.x+u.width;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,co(e,u,o,m,i,f=>t.E(0,f).py,Ya(n,o,s)),e.font=`13px ${l}`,e.save(),i==="left"?(e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2)):(e.translate(t.cssWidth-10,u.y+u.height/2),e.rotate(Math.PI/2)),e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,0,0),e.restore()}function oi(e,t,n,o,i,r){Ar(e,t,n,o,"bottom",i,r)}function ii(e,t,n,o,i,r){Lr(e,t,n,o,"left",i,r)}function ri(e,t,n,o,i,r,s,a=!1,l={}){let u=le(e,o,r);if(!u)return;let{e:m}=o;if(u.strokeStyle=i.jn,u.lineWidth=1,u.beginPath(),u.moveTo(m.x,m.y),u.lineTo(m.x,m.y+m.height),u.lineTo(m.x+m.width,m.y+m.height),s&&(a?(u.moveTo(m.x,m.y),u.lineTo(m.x+m.width,m.y)):(u.moveTo(m.x+m.width,m.y),u.lineTo(m.x+m.width,m.y+m.height))),u.stroke(),a){if(t.mode==="category"?we(u,o,t.domain,i):ii(u,o,t.domain,t.ticks,i,l.category),n.mode==="category"?de(u,o,n.domain,i):Ar(u,o,n.domain,n.ticks,"bottom",i,l.value),s)if(s.mode==="category")de(u,o,s.domain,i);else{let f=o.Y,b=o.J;o.Y=s.domain.min,o.J=s.domain.max,Ar(u,o,s.domain,s.ticks,"top",i,l.alt),o.Y=f,o.J=b}}else if(t.mode==="category"?de(u,o,t.domain,i):oi(u,o,t.domain,t.ticks,i,l.category),n.mode==="category"?we(u,o,n.domain,i):Lr(u,o,n.domain,n.ticks,"left",i,l.value),s)if(s.mode==="category")we(u,o,s.domain,i);else{let f=o.q,b=o.Q;o.q=s.domain.min,o.Q=s.domain.max,Lr(u,o,s.domain,s.ticks,"right",i,l.alt),o.q=f,o.Q=b}}function si(e,t,n,o,i,r=!1){let s=le(e,t,i);s&&(s.strokeStyle=o.ln,s.lineWidth=1,r?Lt(s,t.e,n,a=>t.E(a,0).px):Tt(s,t.e,n,a=>t.E(0,a).py))}Ft();vt();mo();ut();po();var Ke=null;function za(e){if(Ke&&Ke.xCenters.length>=e&&Ke.colors.length>=e*3)return Ke;let t=Math.max(e,Ke?.xCenters.length??0);return Ke={xCenters:new Float32Array(t),halfWidths:new Float32Array(t),y0s:new Float32Array(t),y1s:new Float32Array(t),seriesIds:new Float32Array(t),axes:new Float32Array(t),colors:new Float32Array(t*3)},Ke}function ti(e,t){let n=e.me,o=n.count,i=e.fe.length,r=e.nn&&i>0,s=0;if(e.An=null,o>0){let l=za(o);(!e.Ln||e.Ln.length<o)&&(e.Ln=new Int32Array(o));let u=e.Ln,m=e.se,f=e.l,b=e.K,d=n.chartType,p=n.seriesId,x=n.xCenter,h=n.halfWidth,g=n.y0,y=n.y1,_=n.axis,C=null;if(r){let v=new Array(i).fill(0);for(let T=0;T<o;T++)d[T]!==hr||b.has(p[T])||v[p[T]%i]++;let A=[],R=new Int32Array(i),L=0;for(let T=0;T<i;T++)A.push({start:L,count:v[T]}),R[T]=L,L+=v[T];e.An=A,C=T=>R[T%i]++}for(let v=0;v<o;v++){if(d[v]!==hr)continue;let A=p[v];if(b.has(A))continue;let R=C?C(A):s;l.xCenters[R]=x[v]-m,l.halfWidths[R]=h[v],l.y0s[R]=g[v],l.y1s[R]=y[v],l.seriesIds[R]=A,l.axes[R]=_[v];let L=f[A].color;l.colors[R*3]=L[0],l.colors[R*3+1]=L[1],l.colors[R*3+2]=L[2],u[R]=v,s++}}else r&&(e.An=Array.from({length:i},()=>({start:0,count:0})));if(e.vn=s,s===0){e.Ye=null;return}let a=Ke;t.v.ensureCapacity(s),t.v.upload("bar_x",a.xCenters.subarray(0,s),0,1),t.v.upload("bar_hw",a.halfWidths.subarray(0,s),0,1),t.v.upload("bar_y0",a.y0s.subarray(0,s),0,1),t.v.upload("bar_y1",a.y1s.subarray(0,s),0,1),t.v.upload("bar_sid",a.seriesIds.subarray(0,s),0,1),t.v.upload("bar_axis",a.axes.subarray(0,s),0,1),t.v.upload("bar_color",a.colors.subarray(0,s*3),0,3),(!e.Ye||e.Ye.length<s*3)&&(e.Ye=new Float32Array(Math.max(s*3,e.Ye?.length??0))),e.Ye.set(a.colors.subarray(0,s*3))}function zm(e,t){let n=e.vn;if(n===0)return;let o=e.Ln,i=e.l,r=e.me.seriesId,s=za(n);for(let l=0;l<n;l++){let u=i[r[o[l]]].color;s.colors[l*3]=u[0],s.colors[l*3+1]=u[1],s.colors[l*3+2]=u[2]}let a=e.Ye;if(a&&a.length>=n*3){let l=!0;for(let u=0;u<n*3;u++)if(a[u]!==s.colors[u]){l=!1;break}if(l)return}t.v.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!a||a.length<n*3)&&(e.Ye=new Float32Array(n*3)),e.Ye.set(s.colors.subarray(0,n*3))}function Xa(e){e.B.lines.invalidateBuffers(e),e.B.scatter.invalidateBuffers(e),e.B.areas.invalidateBuffers(e)}function ni(e,t){e.B.lines.rebuildBuffers(e,t),e.B.scatter.rebuildBuffers(e,t),e.B.areas.rebuildBuffers(e,t)}function $a(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0||e.ee===0)return;let s=e.A();Tr(e)&&e.vn>0&&zm(e,t);let a=e.Ze,l=e.Ke==="numeric",u=l?e.D.min:-.5,m=l?e.D.max:e.ee-.5,f=e.Qo.min,b=e.Qo.max;e.g&&(a?e.g.setBaseDomain(f,b,u,m):e.g.setBaseDomain(u,m,f,b));let d=u,p=m,x=f,h=b,g=e.te?.min??0,y=e.te?.max??1;if(e.g){let S=e.g.getVisibleDomain();a?(x=S.xMin,h=S.xMax,d=S.yMin,p=S.yMax):(d=S.xMin,p=S.xMax,x=S.yMin,h=S.yMax)}let _=a?!e.g?.isYDefault():!e.g?.isXDefault();if(e.eo&&e.g&&_){let S=Jm(e,d,p);S.hasLeft&&(x=S.leftMin,h=S.leftMax),e.te&&S.hasRight&&(g=S.rightMin,y=S.rightMax)}if(e.h.include_zero&&(x>0&&(x=0),h<0&&(h=0),e.te&&(g>0&&(g=0),y<0&&(y=0))),e.nn&&e.fe.length>1){Xm(e,t,{horizontal:a,numericCat:l,cssWidth:i,cssHeight:r,visCatMin:d,visCatMax:p,visValMin:x,visValMax:h,visRightMin:g,visRightMax:y});return}e.m=null;let C=e.l.length>1,v=e._.length>0,A={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},R=e.on,L=e.Tn==="category"&&R!==null&&R.numRows>0,T;if(a){let S=l?55:Mt(A),Y=S+(v?16:0),U=C?80:16,X=Math.max(1,i-Y-U),q=L?We(R,X):void 0;T=new ne(i,r,{hasXLabel:!0,hasYLabel:v,hasLegend:C,leftExtra:S,bottomExtra:q})}else if(l){let S=L?Mt(R):void 0;T=new ne(i,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:24,leftExtra:S})}else{let S=L?Mt(R):55,Y=S+16,U=C?80:16,X=Math.max(1,i-Y-U),q=We(A,X);T=new ne(i,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:q,leftExtra:L?S:void 0})}e.a=T,e.g&&e.g.updateLayout(T);let F=e.h.include_zero,I=a?T.buildProjectionMatrix(x,h,p,d,"x",F,void 0,0,e.se):T.buildProjectionMatrix(d,p,x,h,"y",F,void 0,e.se,0),D;if(e.en&&e.te&&!a){let S=T.Y,Y=T.J,U=T.q,X=T.Q;D=T.buildProjectionMatrix(d,p,g,y,"y",F,void 0,e.se,0),T.Y=S,T.J=Y,T.q=U,T.Q=X}else D=I;let P=ie(x,h,6),E=e.en&&e.te&&!a?ie(g,y,6):null,O=A,W={min:x,max:h,label:e.ei},V=e.te&&!a?{min:g,max:y,label:e.Wi}:null;e.j&&si(e.j,T,P,s,t.dpr,a),ze(n,T,t.dpr,()=>{a||e.B.areas.draw(e,n,t,I,D,s.Zn),n.useProgram(e.o);let S=e.F;n.uniformMatrix4fv(S.u_proj_left,!1,I),n.uniformMatrix4fv(S.u_proj_right,!1,D),n.uniform1f(S.u_horizontal,a?1:0);let Y=e.l.length>1?Ut(e):null;n.uniform1f(S.u_hover_series,Y?Y.seriesId:-1),xr(e,n,t),a||(e.B.lines.draw(e,n,t,I,D),e.B.scatter.draw(e,n,t,I,D))}),e.he=O,e.xe=W,e.Re=P,e.go=V,e.ho=E,e.ze=l?ie(d,p,6):null,e.pe(()=>ja(e))}function Xm(e,t,n){let o=t.gl,i=t.dpr,r=e.A(),{horizontal:s,numericCat:a,cssWidth:l,cssHeight:u,visCatMin:m,visCatMax:f,visValMin:b,visValMax:d,visRightMin:p,visRightMax:x}=n,h=e._.length>0,g=e.on,y=e.Tn==="category"&&g!==null&&g.numRows>0,_=e.Nt.length>1,C=a?"outer":"cell",v=y?"cell":"outer",A=Re(e.fe,{cssWidth:l,cssHeight:u,xAxis:s?v:C,yAxis:s?C:v,hasLegend:_,hasXLabel:s?!0:h,hasYLabel:s?h:!0,gap:e.W.facet_padding});if(e.m=A,e.a=A.cells[0]?.layout??null,A.cells.length===0||!e.a)return;e.syncFacetZoomLayouts(A.cells);let R=ie(b,d,6),L=a?ie(m,f,6):null,T=A.cells[0].layout,F=e.j;F&&e.pe(()=>le(F,T,i));let I=e.h.include_zero,D=e.l.length>1?Ut(e):null,P=e.en&&e.te!==null&&!s;at(o);for(let E=0;E<A.cells.length;E++){let W=A.cells[E].layout,V=s?W.buildProjectionMatrix(b,d,f,m,"x",I,void 0,0,e.se):W.buildProjectionMatrix(m,f,b,d,"y",I,void 0,e.se,0),S=V;if(P){let Y=W.Y,U=W.J,X=W.q,q=W.Q;S=W.buildProjectionMatrix(m,f,p,x,"y",I,void 0,e.se,0),W.Y=Y,W.J=U,W.q=X,W.Q=q}F&&e.pe(()=>$m(F,W,R,r,i,s)),lt(o,W,i,()=>{s||e.B.areas.draw(e,o,t,V,S,r.Zn,E),o.useProgram(e.o);let Y=e.F;o.uniformMatrix4fv(Y.u_proj_left,!1,V),o.uniformMatrix4fv(Y.u_proj_right,!1,S),o.uniform1f(Y.u_horizontal,s?1:0),o.uniform1f(Y.u_hover_series,D&&D.splitIdx===E?D.seriesId:-1),xr(e,o,t,e.An?.[E]??{start:0,count:0}),s||(e.B.lines.draw(e,o,t,V,S,E),e.B.scatter.draw(e,o,t,V,S,E))})}e.he={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},e.xe={min:b,max:d,label:e.ei},e.Re=R,e.go=null,e.ho=null,e.ze=L,e.pe(()=>ja(e))}function $m(e,t,n,o,i,r){let s=re(e,i);s&&(s.strokeStyle=o.ln,s.lineWidth=1,r?Lt(s,t.e,n,a=>t.E(a,0).px):Tt(s,t.e,n,a=>t.E(0,a).py))}function _r(e,t){return e.m?e.m.cells[t.splitIdx]?.layout??null:e.a}function ja(e){if(!e.c||!e.a||!e.xe||!e.Re)return;if(e.m){jm(e);return}let t=e.A(),n;if(e.Ke==="numeric"&&e.D&&e.ze)n={mode:"numeric",domain:{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label},ticks:e.ze};else if(e.he)n={mode:"category",domain:e.he};else return;let o=e.l.find(l=>l.axis===0),i=e.l.find(l=>l.axis===1),r=e._[0],s=e.Tn==="category"&&e.on?{mode:"category",domain:e.on}:{mode:"numeric",domain:e.xe,ticks:e.Re},a;e.go&&e.ho&&(a=e.ki==="category"&&e.ti?{mode:"category",domain:e.ti}:{mode:"numeric",domain:e.go,ticks:e.ho}),ri(e.c,n,s,e.a,t,e.t?.dpr??1,a,e.Ze,{value:e.getColumnFormatter(o?.aggName??null,"tick"),alt:e.getColumnFormatter(i?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),Km(e),Ut(e)&&Za(e)}function jm(e){let t=e.m,n=e.c,o=e.A(),i=e.t?.dpr??1,r=e.Ze,s=e._.length>0,a=e.Ke==="numeric"&&e.D!==null&&e.ze!==null;if(!le(n,e.a,i))return;let l=e.he,u=e.xe,m=e.Re,f=e.on,b=e.Tn==="category"&&f!==null&&f.numRows>0,d=e.l.find(g=>g.axis===0),p=e.getColumnFormatter(d?.aggName??null,"tick"),x=e.getColumnFormatter(e._[0],"tick");for(let g of t.cells){let y=g.layout,_=y.e,C=re(n,i);C&&(C.strokeStyle=o.jn,C.lineWidth=1,C.beginPath(),C.moveTo(_.x,_.y),C.lineTo(_.x,_.y+_.height),C.lineTo(_.x+_.width,_.y+_.height),C.stroke(),r?(!a&&l&&we(C,y,l,o),b&&de(C,y,f,o)):(!a&&l&&de(C,y,l,o),b&&we(C,y,f,o)),g.titleRect&&_t(n,g.label,g.titleRect,o,i))}let h=a?{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label}:null;r?(h&&t.outerYAxisRect&&an(n,t.outerYAxisRect,h,e.ze,tn(t),o,s,i,x),!b&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,u,m,en(t),o,!0,i,p)):(h&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,h,e.ze,en(t),o,s,i,x),!b&&t.outerYAxisRect&&an(n,t.outerYAxisRect,u,m,tn(t),o,!0,i,p)),Zm(e,t),Ut(e)&&Za(e)}function Zm(e,t){if(e.tn=[],!e.c||!t.legendRect)return;let n=e.Nt.length;if(n<=1)return;let o=e.c.getContext("2d");if(!o)return;o.save();let i=e.A(),r=10,s=18,a=t.legendRect.x+12,l=t.legendRect.y+10;o.font=`11px ${i.fontFamily}`,o.textAlign="left",o.textBaseline="middle";for(let u=0;u<n;u++){let m=[],f=[.5,.5,.5];for(let y of e.l)y.aggIdx===u&&(m.push(y.seriesId),f=y.color);let b=e.Nt[u],d=m.every(y=>e.K.has(y)),p=Math.round(f[0]*255),x=Math.round(f[1]*255),h=Math.round(f[2]*255);o.globalAlpha=d?.3:1,o.fillStyle=`rgb(${p},${x},${h})`,o.fillRect(a,l-r/2,r,r),o.fillStyle=i.un,o.fillText(b,a+r+6,l);let g=o.measureText(b).width;d&&(o.strokeStyle=i.un,o.lineWidth=1,o.beginPath(),o.moveTo(a+r+6,l),o.lineTo(a+r+6+g,l),o.stroke()),o.globalAlpha=1,e.tn.push({seriesIds:m,rect:{x:a-2,y:l-s/2,width:r+6+g+4,height:s}}),l+=s}o.restore()}var ai=new Float64Array(0);function qm(e,t,n){if(e.po)return;let o=e.l;ai.length<o.length&&(ai=new Float64Array(o.length)),t.save(),t.font=`11px ${n}`;for(let i=0;i<o.length;i++)ai[i]=t.measureText(o[i].label).width;t.restore(),e.po=!0}function Km(e){if(e.tn=[],!e.c||!e.a||e.l.length<=1)return;let t=e.c.getContext("2d");if(!t)return;t.save();let n=e.A(),o=n.un,i=n.fontFamily;qm(e,t,i);let r=e.a,s=10,a=18,l=r.e.x+r.e.width+12,u=r.margins.top+10;t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let m=e.l,f=ai;for(let b=0;b<m.length;b++){let d=m[b],p=e.K.has(d.seriesId),x=Math.round(d.color[0]*255),h=Math.round(d.color[1]*255),g=Math.round(d.color[2]*255);t.globalAlpha=p?.3:1,t.fillStyle=`rgb(${x},${h},${g})`,t.fillRect(l,u-s/2,s,s),t.fillStyle=o,t.fillText(d.label,l+s+6,u);let y=f[b];p&&(t.strokeStyle=o,t.lineWidth=1,t.beginPath(),t.moveTo(l+s+6,u),t.lineTo(l+s+6+y,u),t.stroke()),t.globalAlpha=1;let _={x:l-2,y:u-a/2,width:s+6+y+4,height:a};e.tn.push({seriesIds:[d.seriesId],rect:_}),u+=a}t.restore()}function Za(e){if(!e.c||!e.a)return;let t=Ut(e);if(!t)return;let n=_r(e,t);if(!n)return;let i=(e.l[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ze?n.E(i,t.xCenter):n.E(t.xCenter,i):vr(e,t.xCenter,i,n),s=Cr(e,t),a=e.A();Pe(e.c,r,s,n,a,e.t?.dpr??1)}function vr(e,t,n,o){let i=o??e.a,{x:r,y:s,width:a,height:l}=i.e,u=(t-i.Y)/(i.J-i.Y),m=e.te,f=(n-m.min)/(m.max-m.min);return{px:r+u*a,py:s+(1-f)*l}}function Jm(e,t,n){let o=e._t;if(o&&o.catMin===t&&o.catMax===n&&o.hidden===e.K)return o;let i=tf(e),r=1/0,s=-1/0,a=!1,l=1/0,u=-1/0,m=!1;if(i.n>0){let b=e.qe,d,p;if(b){let v=Qm(b,i.n,t,n);d=v.lo,p=v.hi}else d=Math.max(0,Math.floor(t)),p=Math.min(i.n-1,Math.ceil(n));let x=i.leftMin,h=i.leftMax,g=i.rightMin,y=i.rightMax,_=i.hasLeft,C=i.hasRight;for(let v=d;v<=p;v++)_[v]&&(x[v]<r&&(r=x[v]),h[v]>s&&(s=h[v]),a=!0),C[v]&&(g[v]<l&&(l=g[v]),y[v]>u&&(u=y[v]),m=!0)}let f=o??ef();return f.catMin=t,f.catMax=n,f.hidden=e.K,f.leftMin=r,f.leftMax=s,f.hasLeft=a,f.rightMin=l,f.rightMax=u,f.hasRight=m,e._t=f,f}function Qm(e,t,n,o){if(t===0||n>o)return{lo:0,hi:-1};let i=0,r=t;for(;i<r;){let l=i+r>>>1;e[l]<n?i=l+1:r=l}let s=Math.max(0,i-1);for(i=0,r=t;i<r;){let l=i+r>>>1;e[l]<=o?i=l+1:r=l}let a=Math.min(t-1,i);return{lo:s,hi:a}}function ef(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function tf(e){let t=e.ee,n=e.Ni,o=n&&n.leftMin.length>=t;if(n&&o&&e.bo===e.K)return n;!n||!o?(n={leftMin:new Float64Array(t),leftMax:new Float64Array(t),rightMin:new Float64Array(t),rightMax:new Float64Array(t),hasLeft:new Uint8Array(t),hasRight:new Uint8Array(t),n:t},e.Ni=n):n.n=t;for(let x=0;x<t;x++)n.leftMin[x]=1/0,n.leftMax[x]=-1/0,n.rightMin[x]=1/0,n.rightMax[x]=-1/0,n.hasLeft[x]=0,n.hasRight[x]=0;let i=e.me,r=e.K,s=i.catIdx,a=i.seriesId,l=i.y0,u=i.y1,m=i.axis;for(let x=0;x<i.count;x++){if(r.has(a[x]))continue;let h=s[x];if(h<0||h>=t)continue;let g=l[x],y=u[x],_=g<y?g:y,C=g<y?y:g;m[x]===1?(_<n.rightMin[h]&&(n.rightMin[h]=_),C>n.rightMax[h]&&(n.rightMax[h]=C),n.hasRight[h]=1):(_<n.leftMin[h]&&(n.leftMin[h]=_),C>n.leftMax[h]&&(n.leftMax[h]=C),n.hasLeft[h]=1)}let f=[e.Rn,e.wn],b=e.je,d=e.kt,p=e.l.length;for(let x of f)for(let h of x){if(r.has(h.seriesId))continue;let g=h.axis===1,y=h.seriesId;for(let _=0;_<t;_++){let C=_*p+y;if(!(d[C>>3]>>(C&7)&1))continue;let v=b[C];g?(v<n.rightMin[_]&&(n.rightMin[_]=v),v>n.rightMax[_]&&(n.rightMax[_]=v),n.hasRight[_]=1):(v<n.leftMin[_]&&(n.leftMin[_]=v),v>n.leftMax[_]&&(n.leftMax[_]=v),n.hasLeft[_]=1)}}return e.bo=r,n}nn();Me();me();var _n=new Float32Array(0),vn=new Uint8Array(0);function nf(e){return _n.length>=e||(_n=new Float32Array(Math.max(e,_n.length*2))),_n}function of(e){return vn.length>=e||(vn=new Uint8Array(Math.max(e,vn.length*2))),vn}function rf(e){return e==="solid"?1:e==="transparent"?.5:0}var li=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=je(t.gl),o=j(t,"bar-line",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_start","a_end","a_corner","a_real_start","a_real_end"]);return this.o={...o,cornerBuffer:n},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.t){this.i=null;return}let o=t.t.gl;for(let i of n.series)o.deleteBuffer(i.gpuBuffer),o.deleteBuffer(i.gpuRealBuffer);this.i=null}rebuildBuffers(t,n){let o=t.Rn;if(o.length===0){this.i=null;return}if(t.ee===0){this.i=null;return}this.ensureProgram(n);let r=n.gl,s=t.je,a=t.kt,l=t.se,u=t.qe,m=t.l.length,f=[];for(let b of o){let d=t.l[b.seriesId],p=d.start,x=d.end;if(p<0||x<p)continue;let h=x-p+1;if(h<2)continue;let g=nf(h*2),y=of(h),_=0;for(let A=p;A<=x;A++){let R=u?u[A]-l:A,L=A*m+b.seriesId;g[_*2]=R,g[_*2+1]=s[L],y[_]=a[L>>3]>>(L&7)&1,_++}let C=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,C),r.bufferData(r.ARRAY_BUFFER,g.subarray(0,_*2),r.STATIC_DRAW);let v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,y.subarray(0,_),r.STATIC_DRAW),f.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:C,gpuRealBuffer:v,count:h,interpolateMode:d.interpolateMode})}this.i={series:f}}draw(t,n,o,i,r,s){let a=this.i,l=this.o;if(!a||!l||a.series.length===0)return;let u=o.dpr;n.useProgram(l.program),n.uniform2f(l.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(l.u_line_width,t.h.line_width_px*u);let m=J(o),{setDivisor:f,drawArraysInstanced:b}=m;n.bindBuffer(n.ARRAY_BUFFER,l.cornerBuffer),n.enableVertexAttribArray(l.a_corner),n.vertexAttribPointer(l.a_corner,1,n.FLOAT,!1,0,0),f(l.a_corner,0);let d=2*Float32Array.BYTES_PER_ELEMENT,p=Uint8Array.BYTES_PER_ELEMENT,x=t.K;for(let h of a.series){if(x.has(h.seriesId)||s!==void 0&&t.l[h.seriesId].splitIdx!==s)continue;n.uniformMatrix4fv(l.u_projection,!1,h.axis===1?r:i);let g=t.l[h.seriesId].color;n.uniform4f(l.u_color,g[0],g[1],g[2],1),n.uniform1f(l.u_interp_alpha,rf(h.interpolateMode)),n.enableVertexAttribArray(l.a_start),f(l.a_start,1),n.enableVertexAttribArray(l.a_end),f(l.a_end,1),n.enableVertexAttribArray(l.a_real_start),f(l.a_real_start,1),n.enableVertexAttribArray(l.a_real_end),f(l.a_real_end,1),n.bindBuffer(n.ARRAY_BUFFER,h.gpuBuffer),n.vertexAttribPointer(l.a_start,2,n.FLOAT,!1,d,0),n.vertexAttribPointer(l.a_end,2,n.FLOAT,!1,d,d),n.bindBuffer(n.ARRAY_BUFFER,h.gpuRealBuffer),n.vertexAttribPointer(l.a_real_start,1,n.UNSIGNED_BYTE,!1,p,0),n.vertexAttribPointer(l.a_real_end,1,n.UNSIGNED_BYTE,!1,p,p),b(n.TRIANGLE_STRIP,0,4,h.count-1)}f(l.a_start,0),f(l.a_end,0),f(l.a_real_start,0),f(l.a_real_end,0)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&n.deleteBuffer(o.cornerBuffer)}this.o=null,this.i=null}};me();var Ne=new Float32Array(0),Ce=new Float32Array(0);function sf(e){Ne.length<e*2&&(Ne=new Float32Array(Math.max(e*2,Ne.length*2))),Ce.length<e*3&&(Ce=new Float32Array(Math.max(e*3,Ce.length*2)))}var ui=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=j(t,"bar-scatter",Wn,kn,["u_projection","u_point_size"],["a_position","a_color"]);return this.o={...o,posLeftBuffer:n.createBuffer(),posRightBuffer:n.createBuffer(),colorLeftBuffer:n.createBuffer(),colorRightBuffer:n.createBuffer()},this.o}invalidateBuffers(t){this.i=null}rebuildBuffers(t,n){let o=t.wn;if(o.length===0){this.i=null;return}let i=t.ee,r=t.l.length;if(i===0||r===0){this.i=null;return}let s=this.ensureProgram(n),a=n.gl,l=t.je,u=t.kt,m=t.qe,f=t.se,b=t.K,d=0,p=0;for(let _ of o)if(!b.has(_.seriesId))for(let C=0;C<i;C++){let v=C*r+_.seriesId;u[v>>3]>>(v&7)&1&&(_.axis===1?p++:d++)}let x=d+p;if(x===0){this.i=null;return}sf(x);let h=[],g=0,y=d;for(let _ of o){if(b.has(_.seriesId))continue;let C=_.axis===1?y-d:g,v=_.color[0],A=_.color[1],R=_.color[2];for(let T=0;T<i;T++){let F=T*r+_.seriesId;if(!(u[F>>3]>>(F&7)&1))continue;let I=m?m[T]-f:T,D=l[F];_.axis===1?(Ne[y*2]=I,Ne[y*2+1]=D,Ce[y*3]=v,Ce[y*3+1]=A,Ce[y*3+2]=R,y++):(Ne[g*2]=I,Ne[g*2+1]=D,Ce[g*3]=v,Ce[g*3+1]=A,Ce[g*3+2]=R,g++)}let L=_.axis===1?y-d:g;L>C&&h.push({seriesId:_.seriesId,axis:_.axis,first:C,count:L-C})}d>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(0,d*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ce.subarray(0,d*3),a.STATIC_DRAW)),p>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(d*2,x*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ce.subarray(d*3,x*3),a.STATIC_DRAW)),this.i={leftCount:d,rightCount:p,seriesRanges:h}}draw(t,n,o,i,r,s){let a=this.i,l=this.o;if(!a||!l||a.leftCount===0&&a.rightCount===0)return;let u=o.dpr;if(n.useProgram(l.program),n.uniform1f(l.u_point_size,t.h.point_size_px*u),s!==void 0){for(let m of a.seriesRanges)t.l[m.seriesId].splitIdx===s&&Rr(n,l,m.axis===1?l.posRightBuffer:l.posLeftBuffer,m.axis===1?l.colorRightBuffer:l.colorLeftBuffer,m.count,m.axis===1?r:i,m.first);return}Rr(n,l,l.posLeftBuffer,l.colorLeftBuffer,a.leftCount,i),Rr(n,l,l.posRightBuffer,l.colorRightBuffer,a.rightCount,r)}destroy(t){let n=t.t?.gl;if(n){let o=this.o;o&&(n.deleteBuffer(o.posLeftBuffer),n.deleteBuffer(o.posRightBuffer),n.deleteBuffer(o.colorLeftBuffer),n.deleteBuffer(o.colorRightBuffer))}this.o=null,this.i=null}};function Rr(e,t,n,o,i,r,s=0){i!==0&&(e.uniformMatrix4fv(t.u_projection,!1,r),e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(t.a_position),e.vertexAttribPointer(t.a_position,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(t.a_color),e.vertexAttribPointer(t.a_color,3,e.FLOAT,!1,0,0),e.drawArrays(e.POINTS,s,i))}me();var An=new Float32Array(0);function af(e){return An.length>=e||(An=new Float32Array(Math.max(e,An.length*2))),An}var mi=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){return this.o?this.o:(this.o=j(t,"bar-area",En,Gn,["u_projection","u_color","u_opacity"],["a_position"]),this.o)}invalidateBuffers(t){let n=this.i;if(!n||!t.t){this.i=null;return}let o=t.t.gl;for(let i of n.series)o.deleteBuffer(i.gpuBuffer);this.i=null}rebuildBuffers(t,n){let o=t.xo;if(o.length===0){this.i=null;return}let i=t.ee,r=t.l.length;if(i===0||r===0){this.i=null;return}this.ensureProgram(n);let s=n.gl,a=t.je,l=t.kt,u=t.qe,m=t.se,f=t.ni,b=t.me,d=[];for(let p of o){let x=t.l[p.seriesId],h=lf(p,i,r,a,l,f,b.y0,b.y1,u,m,x.start,x.end,x.interpolateMode);if(h.totalVertices===0)continue;let g=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,g),s.bufferData(s.ARRAY_BUFFER,h.scratch.subarray(0,h.totalVertices*2),s.STATIC_DRAW),d.push({seriesId:p.seriesId,axis:p.axis,color:[p.color[0],p.color[1],p.color[2]],gpuBuffer:g,strips:h.descriptors})}this.i={series:d}}draw(t,n,o,i,r,s,a){let l=this.i,u=this.o;if(!l||!u||l.series.length===0)return;n.useProgram(u.program),n.uniform1f(u.u_opacity,s);let m=t.K;for(let f of l.series){if(m.has(f.seriesId)||a!==void 0&&t.l[f.seriesId].splitIdx!==a)continue;n.uniformMatrix4fv(u.u_projection,!1,f.axis===1?r:i);let b=t.l[f.seriesId].color;n.uniform3f(u.u_color,b[0],b[1],b[2]),n.bindBuffer(n.ARRAY_BUFFER,f.gpuBuffer),n.enableVertexAttribArray(u.a_position),n.vertexAttribPointer(u.a_position,2,n.FLOAT,!1,0,0);for(let d of f.strips)n.bindBuffer(n.ARRAY_BUFFER,f.gpuBuffer),n.vertexAttribPointer(u.a_position,2,n.FLOAT,!1,0,d.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,d.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.o=null}};function lf(e,t,n,o,i,r,s,a,l,u,m,f,b){let d=af(t*4),p=[],x=e.seriesId*1e9,h=b!=="skip",g=0,y=0;for(let _=0;_<t;_++){let C=0,v=0,A=!1;if(e.stack){let R=r?.get(x+_);R!==void 0&&(C=s[R],v=a[R],A=!0)}else{let R=_*n+e.seriesId;h?_>=m&&_<=f&&(v=o[R],A=!0):i[R>>3]>>(R&7)&1&&(v=o[R],A=!0)}if(A){let R=l?l[_]-u:_;d[g++]=R,d[g++]=C,d[g++]=R,d[g++]=v}else if(g>y){let R=(g-y)/2;R>=4&&p.push({offsetBytes:y*4,vertexCount:R}),y=g}}if(g>y){let _=(g-y)/2;_>=4&&p.push({offsetBytes:y*4,vertexCount:_})}return{descriptors:p,totalVertices:g/2,scratch:d}}Me();me();function Ln(e,t){return e&&(t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max)),{min:t.min,max:t.max}}var Je=class extends Nt{constructor(n="vertical"){super();c(this,"Ze");c(this,"F",null);c(this,"Nt",[]);c(this,"fe",[]);c(this,"l",[]);c(this,"nn",!1);c(this,"m",null);c(this,"An",null);c(this,"me",Qo());c(this,"oi",[]);c(this,"Rn",[]);c(this,"wn",[]);c(this,"xo",[]);c(this,"ei","");c(this,"Wi","");c(this,"Tn","numeric");c(this,"ki",null);c(this,"on",null);c(this,"ti",null);c(this,"ni",null);c(this,"Ye",null);c(this,"yo",null);c(this,"Co",null);c(this,"ii",null);c(this,"ri",null);c(this,"Qo",{min:0,max:1});c(this,"te",null);c(this,"en",!1);c(this,"_o",null);c(this,"vo",null);c(this,"Ke","category");c(this,"D",null);c(this,"se",0);c(this,"ze",null);c(this,"qe",null);c(this,"K",new Set);c(this,"Ve",-1);c(this,"Jo",-1);c(this,"He",null);c(this,"je",new Float32Array(0));c(this,"kt",new Uint8Array(0));c(this,"B",{lines:new li,scatter:new ui,areas:new mi});c(this,"go",null);c(this,"ho",null);c(this,"vn",0);c(this,"Ln",new Int32Array(0));c(this,"tn",[]);c(this,"po",!1);c(this,"_t",null);c(this,"Ni",null);c(this,"bo",null);this.Ze=n==="horizontal"}getZoomConfig(){return{lockAxis:this.Ze?"x":"y"}}tooltipCallbacks(){return{onHover:(n,o)=>yr(this,n,o),onLeave:()=>{(this.Ve!==-1||this.He)&&(this.Ve=-1,this.He=null,this.t&&this.requestRender(this.t))},onClickPre:(n,o)=>Ua(this,n,o),onPin:(n,o)=>{if(yr(this,n,o),this.Ve>=0){let i=this.Ve;Oa(this,i);let r=Cn(this.me,i,this.fe.length,this.je,this.l.length);this.Ui(r)}else if(this.He){let i=this.He;Va(this,i),this.Ui(i)}},onUnpin:()=>{this.emitUnselect()}}}async Ui(n){if(!this.Nt[n.aggIdx])return;let o=this.we.map(s=>s.labels[n.catIdx]??null),i=this.fe[n.splitIdx]??"",r=this.P.length>0&&i!==""?i.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.mt,columnName:this.Nt[n.aggIdx],groupByValues:o,splitByValues:r})}async uploadAndRender(n,o,i,r){this.t=n;let s=n.gl;if(i!==0)return;if(!this.o){let u=j(n,"bar",Fn,Sn,["u_proj_left","u_proj_right","u_hover_series","u_horizontal"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color","a_series_id","a_axis"]);this.o=u.program,this.F=u,this.N=Lo(s)}let a=this.P.length>0&&this.W.facet_mode==="grid",l=Wa({columns:o,numRows:r,columnSlots:this.I,groupBy:this._,splitBy:this.P,groupByTypes:this.ht,columnsConfig:this.Wo,defaultChartType:this.Jn,autoAltYAxis:this.h.auto_alt_y_axis,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,includeZero:this.h.include_zero,facetSplits:a,scratchBars:this.me,scratchPosStack:this.ii,scratchNegStack:this.ri});this.h.domain_mode==="expand"?(this._o=Ln(this._o,l.leftDomain),l.rightDomain&&(this.vo=Ln(this.vo,l.rightDomain))):(this._o=null,this.vo=null),this.Nt=l.aggregates,this.fe=l.splitPrefixes,this.nn=a&&l.splitPrefixes.length>1,this.we=l.rowPaths,this.ee=l.numCategories,this.mt=l.rowOffset,this.Ke=l.axisMode.mode,this.D=l.numericCategoryDomain,this.qe=l.categoryPositions,this.se=l.numericCategoryDomain?.min??0,this.l=l.series,this.me=l.bars,this.ii=l.posStack,this.ri=l.negStack,this.je=l.samples,this.oi.length=0,this.Rn.length=0,this.wn.length=0,this.xo.length=0;for(let u of l.series)switch(u.chartType){case"bar":this.oi.push(u);break;case"line":this.Rn.push(u);break;case"scatter":this.wn.push(u);break;case"area":this.xo.push(u);break}this.ei=qa(l.series,0),this.Wi=qa(l.series,1),this.ni=uf(this.me),this._t=null,this.po=!1,this.yo=null,this.Co=null,this.bo=null,this.Ye=null,this.kt=l.sampleValid,this.Qo=l.leftDomain,this.te=l.rightDomain,this.en=l.hasRightAxis,this.Tn=l.leftValueAxisMode,this.ki=l.rightValueAxisMode,this.on=l.leftValueCategoryDomain,this.ti=l.rightValueCategoryDomain,Tr(this),ti(this,n),Xa(this),ni(this,n),await this.requestRender(n)}It(n){this.o&&(this.t=n,$a(this,n))}resetExpandedDomain(){this._o=null,this.vo=null}destroyInternal(){if(this.t){let n=this.t.gl;this.N&&n.deleteBuffer(this.N),ff(this)}this.o=null,this.F=null,this.N=null,this.nn=!1,this.m=null,this.An=null,this.me=Qo(),this.l=[],this.oi=[],this.Rn=[],this.wn=[],this.xo=[],this.ni=null,this.yo=null,this.Co=null,this.Ye=null,this.ii=null,this.ri=null,this.we=[],this.ee=0,this.K.clear()}};function uf(e){let t=new Map;for(let n=0;n<e.count;n++)e.chartType[n]===1&&t.set(e.seriesId[n]*1e9+e.catIdx[n],n);return t}function qa(e,t){let n=new Set,o=[];for(let i of e)i.axis===t&&(n.has(i.aggName)||(n.add(i.aggName),o.push(i.aggName)));return o.join(", ")}function Tr(e){let t=e.A(),n=t.Ge,o=t.H,i=e.nn?Math.max(1,e.Nt.length):e.l.length,r=e.Co;if(e.yo&&r&&r.Ge===n&&r.H===o&&r.seriesLength===i)return!1;let s=mf(n,o,i);e.yo=s,e.Co={Ge:n,H:o,seriesLength:i};for(let a=0;a<e.l.length;a++)e.l[a].color=e.nn?s[e.l[a].aggIdx]:s[a];return!0}function mf(e,t,n){return ce(e,t,n)}function ff(e){e.B.lines.destroy(e),e.B.scatter.destroy(e),e.B.areas.destroy(e)}var fi=class extends Je{constructor(){super("horizontal")}};Jt();Ye();un();function wr(e){let{columns:t,numRows:n,groupBy:o,splitBy:i,groupByTypes:r}=e,s=Gt(o,r),a={xLevels:[],yColumnNames:[],yLevels:[],numX:0,numY:0,rowOffset:0,cells:[],cells2D:[],colorMin:0,colorMax:1,xAxisMode:s,yAxisMode:{mode:"category"},xPositions:null,yPositions:null,xNumericDomain:null,yNumericDomain:null},l=o.map(T=>r[T]??"string"),{rowPaths:u,numCategories:m,rowOffset:f}=Wt(t,n,o.length,l),b=null,d=null;if(s.mode==="numeric"&&m>0){let T=t.get("__ROW_PATH_0__"),F=ct(T?.values,m,f,o[0]??"",s.numericType==="date"||s.numericType==="datetime");F&&(b=F.categoryPositions,d=F.numericCategoryDomain)}let p=[];for(let T of t.keys())T.startsWith("__")||!t.get(T)?.values||p.push(T);let x=p.length;if(m===0||x===0)return{...a,xLevels:u,rowOffset:f};let h=pf(p),g=cf(i,r),y={mode:"category"},_=null,C=null;if(g.mode==="numeric"){let T=df(p,g.numericType);if(T){let F=ct(T,x,0,i[0]??"",g.numericType==="date"||g.numericType==="datetime");F&&(y=g,_=F.categoryPositions,C=F.numericCategoryDomain)}}let v=[],A=new Array(m*x).fill(null),R=1/0,L=-1/0;for(let T=0;T<x;T++){let F=t.get(p[T]),I=F.values,D=F.valid;for(let P=0;P<m;P++){let E=P+f;if(D&&!(D[E>>3]>>(E&7)&1))continue;let O=I[E];if(!isFinite(O))continue;let W={xIdx:P,yIdx:T,value:O};v.push(W),A[T*m+P]=W,O<R&&(R=O),O>L&&(L=O)}}return!isFinite(R)||!isFinite(L)?(R=0,L=1):R===L&&(L=R+1),{xLevels:u,yColumnNames:p,yLevels:h,numX:m,numY:x,rowOffset:f,cells:v,cells2D:A,colorMin:R,colorMax:L,xAxisMode:s,yAxisMode:y,xPositions:b,yPositions:_,xNumericDomain:d,yNumericDomain:C}}function cf(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function df(e,t){let n=new Float64Array(e.length);for(let o=0;o<e.length;o++){let i=e[o],r=i.indexOf("|"),s=r===-1?i:i.slice(0,r),a;if(t==="date"||t==="datetime"?(a=Date.parse(s),isFinite(a)||(a=Date.parse(s.replace(" ","T")))):a=Number(s),!isFinite(a))return null;n[o]=a}return n}function Ka(e,t){return t.map(n=>{let o=new Map;for(let[i,r]of e){if(i.startsWith("__ROW_PATH_")||i==="__GROUPING_ID__"){o.set(i,r);continue}let s=i.lastIndexOf("|");(s===-1?i:i.slice(s+1))===n&&o.set(i,r)}return{label:n,columns:o}})}function pf(e){if(e.length===0)return[];let t=0,n=e.map(i=>i.split("|"));for(let i of n)i.length>t&&(t=i.length);if(t===0)return[];let o=[];for(let i=0;i<t;i++){let r=[],s=new Map,a=new Int32Array(e.length),l=new Array(e.length),u=0;for(let b=0;b<e.length;b++){let d=n[b][i]??"",p=s.get(d);p===void 0&&(p=r.length,r.push(d),s.set(d,p)),a[b]=p,l[b]=d,d.length>u&&(u=d.length)}let f=i===t-1?[]:go(a,r,0,e.length);o.push({labels:l,runs:f,maxLabelChars:u})}return o}Ye();mo();on();Me();me();ut();vt();Ft();un();bo();function Fr(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var bf=80,gf=20,Mr=5,Sr=11;function Ot(e,t){return e.E(0,t).py}function Ja(e,t){let n=Fr(e.levels,t),o=n.length,i=[];for(let r=0;r<o;r++){let s=n[r].maxLabelChars;if(r===o-1){let a=Math.max(bf,s*6.5+16);i.push({size:a})}else{let a=Math.max(gf,s*6.5+16);i.push({size:a})}}return i}function Qa(e,t){let n=Fr(e.levels,t);if(e.numRows===0||n.length===0)return 55;let o=Ja(e,t),i=0;for(let r of o)i+=r.size;return i}function hf(e,t){return e.labels[t]??""}function Ir(e,t,n,o,i){let r=Fr(n.levels,i);if(n.numRows===0||r.length===0)return;let{St:s,Le:a,fontFamily:l}=o,{e:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${Sr}px ${l}`;let m=Ja(n,i),f=Math.max(0,Math.ceil(t.q)),b=Math.min(n.numRows-1,Math.floor(t.Q));if(b<f)return;let d=r.length,p=u.x;for(let h=d-1;h>=0;h--){let g=r[h],y=m[h],_=p,C=p-y.size;p=C,h===d-1?xf(e,t,g,f,b,_,C,l,s):yf(e,t,g,f,b,C,_,l,s)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=a,e.font=`13px ${l}`,e.save(),e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="top",e.fillText(x,0,0),e.restore())}function xf(e,t,n,o,i,r,s,a,l){let u=t.e;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let f=o;f<=i;f++){let b=Ot(t,f);b<u.y-1||b>u.y+u.height+1||(e.moveTo(r,b),e.lineTo(r-Mr,b))}e.stroke(),e.font=`${Sr}px ${a}`,e.textAlign="right",e.textBaseline="middle";let m=r-Mr-4-s-4;for(let f=o;f<=i;f++){let b=Ot(t,f);if(b<u.y-1||b>u.y+u.height+1)continue;let d=hf(n,f);if(!d)continue;let p=mt(e,d,m);p&&e.fillText(p,r-Mr-4,b)}}function yf(e,t,n,o,i,r,s,a,l){let u=t.e,m=ln(n.runs,o,i);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l;let f=s-3;e.beginPath();for(let b of m){let d=Ot(t,b.endIdx+.5),p=Ot(t,b.startIdx-.5),x=Math.min(d,p),h=Math.max(d,p),g=Math.max(u.y,x),y=Math.min(u.y+u.height,h);y<=g||(e.moveTo(f,g),e.lineTo(f,y),e.moveTo(f,g),e.lineTo(f+3,g),e.moveTo(f,y),e.lineTo(f+3,y))}e.stroke(),e.font=`${Sr}px ${a}`;for(let b of m){let d=Ot(t,b.endIdx+.5),p=Ot(t,b.startIdx-.5),x=Math.min(d,p),h=Math.max(d,p),g=Math.max(u.y,x),y=Math.min(u.y+u.height,h);if(y<=g)continue;let _=(g+y)/2,C=r+(s-r-3)/2,v=b.label;if(!v)continue;let A=y-g-4,R=mt(e,v,Math.max(0,A));R&&(e.save(),e.translate(C,_),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(R,0,0),e.restore())}}Ae();yo();Ee();At();Ct();function Br(e,t,n){if(e.Oi=t,e.Vi=n,e.u.length>0){for(let i=0;i<e.u.length;i++){let r=e.u[i],s=r.layout.e;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let a=tl(r.layout,r.pipeline.numX,r.pipeline.numY,r.pipeline.cells2D,r.pipeline.xPositions,r.pipeline.yPositions,r.pipeline.xNumericDomain?.bandWidth??1,r.pipeline.yNumericDomain?.bandWidth??1,t,n);Dr(e,a,i);return}Dr(e,null,-1);return}if(!e.a)return;let o=tl(e.a,e.vt,e.At,e.Ao,e.Mn,e.Fn,e.ft?.bandWidth??1,e.ct?.bandWidth??1,t,n);Dr(e,o,-1)}function el(e,t,n){if(e.length===0)return-1;let o=0,i=e.length-1;for(;o<i;){let s=o+i>>1;e[s]<t?o=s+1:i=s}let r=o;return r>0&&Math.abs(e[r-1]-t)<Math.abs(e[r]-t)&&(r-=1),Math.abs(e[r]-t)>n*.5?-1:r}function tl(e,t,n,o,i,r,s,a,l,u){let m=e.e;if(l<m.x||l>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.Y,b=e.J,d=e.q,p=e.Q,x=f+(l-m.x)/m.width*(b-f),h=p-(u-m.y)/m.height*(p-d),g=i?el(i,x,s):Math.round(x),y=r?el(r,h,a):Math.round(h);return g<0||g>=t||y<0||y>=n?null:o[y*t+g]??null}function Dr(e,t,n){let o=e.Pe;(o?.xIdx??-1)===(t?.xIdx??-1)&&(o?.yIdx??-1)===(t?.yIdx??-1)&&e.Sn===n||(e.Pe=t,e.Sn=n,e.t&&e.si&&e.si())}function nl(e,t){let n=[];for(let o of e){let i=o.labels[t];i!=null&&i!==""&&n.push(i)}return n.join(" / ")}function Pr(e){if(!e.c||!e.Pe)return;let t,n,o,i=null;if(e.Sn>=0){let b=e.u[e.Sn];if(!b)return;t=b.layout,n=b.pipeline.xLevels,o=b.pipeline.yLevels,i=b.label}else{if(!e.a)return;t=e.a,n=e.Ut,o=e.Ot}let r=e.Pe,s={px:e.Oi,py:e.Vi},a=[];i&&a.push(i);let l=nl(n,r.xIdx),u=nl(o,r.yIdx);l&&a.push(l),u&&a.push(u);let m=e.getColumnFormatter(e.I[0],"value");a.push(`Value: ${m(r.value)}`);let f=e.A();Pe(e.c,s,a,t,f,e.t?.dpr??1)}var Er={skipLeafLevel:!0};function ol(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0)return;if(e.u.length>0){Cf(e,t,i,r);return}if(e.vt===0||e.At===0)return;let s=e.A(),a={levels:e.Ut,numRows:e.vt,levelLabels:e._.slice()},l={levels:e.Ot,numRows:e.At,levelLabels:[]},u=e.In.mode==="numeric",m=e.Dn.mode==="numeric",f=m?55:Qa(l,Er),b=u?24:We(a,Math.max(1,i-f-110)),d=new ne(i,r,{hasXLabel:e._.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:b,leftExtra:f});e.a=d,e.g&&e.g.updateLayout(d);let p=u?e.ft.min:-.5,x=u?e.ft.max:e.vt-.5,h=m?e.ct.min:-.5,g=m?e.ct.max:e.At-.5;e.g&&e.g.setBaseDomain(p,x,h,g);let y=e.g?e.g.getVisibleDomain():{xMin:p,xMax:x,yMin:h,yMax:g},_=d.buildProjectionMatrix(y.xMin,y.xMax,y.yMin,y.yMax,void 0,void 0,0,e.w,e.M),C=d.e,v=C.width/(y.xMax-y.xMin),A=C.height/(y.yMax-y.yMin),R=s.Li*.5,L=u?e.ft.bandWidth:1,T=m?e.ct.bandWidth:1,F=Math.min(L*.5,v>0?R/v:0),I=Math.min(T*.5,A>0?R/A:0);if(e.j){let D=le(e.j,d,t.dpr)}il(e,t),rl(e,t),e.oe=rn(t,e.oe,s.H),ze(n,d,t.dpr,()=>{n.useProgram(e.o);let D=e.F;n.uniformMatrix4fv(D.u_projection,!1,_),n.uniform2f(D.u_cell_inset,F,I),n.uniform2f(D.u_cell_size,L,T),Ge(t,e.oe.texture,D.u_gradient_lut,0),sl(e,n,t,0,e.Hi)}),e.pe(()=>ci(e))}function il(e,t){if(e.o)return;let n=t.gl,o=j(t,"heatmap",On,Vn,["u_projection","u_cell_inset","u_cell_size","u_gradient_lut"],["a_corner","a_cell","a_color_t"]);e.o=o.program,e.F=o;let i=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),e.N=i}function rl(e,t){let n=e.Qe.length;if(e.Hi=n,n===0)return;let o=new Float32Array(n*2),i=new Float32Array(n);if(e.u.length>0){let r=0;for(let s of e.u){let a=s.pipeline.xPositions,l=s.pipeline.yPositions,u=s.xOrigin,m=s.yOrigin;for(let f of s.pipeline.cells)o[r*2]=a?a[f.xIdx]-u:f.xIdx,o[r*2+1]=l?l[f.yIdx]-m:f.yIdx,i[r]=rt(f.value,e.b,e.p),r++}}else{let r=e.Mn,s=e.Fn,a=e.w,l=e.M;for(let u=0;u<n;u++){let m=e.Qe[u];o[u*2]=r?r[m.xIdx]-a:m.xIdx,o[u*2+1]=s?s[m.yIdx]-l:m.yIdx,i[u]=rt(m.value,e.b,e.p)}}t.v.ensureCapacity(n),t.v.upload("heatmap_cell",o,0,2),t.v.upload("heatmap_t",i,0,1)}function sl(e,t,n,o,i){if(i===0)return;let r=e.F,s=J(n),{setDivisor:a}=s,l=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.N),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),a(r.a_corner,0);let u=n.v.peek("heatmap_cell"),m=n.v.peek("heatmap_t");!u||!m||(t.bindBuffer(t.ARRAY_BUFFER,u.buffer),t.enableVertexAttribArray(r.a_cell),t.vertexAttribPointer(r.a_cell,2,t.FLOAT,!1,0,o*2*l),a(r.a_cell,1),t.bindBuffer(t.ARRAY_BUFFER,m.buffer),t.enableVertexAttribArray(r.a_color_t),t.vertexAttribPointer(r.a_color_t,1,t.FLOAT,!1,0,o*l),a(r.a_color_t,1),s.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,i),a(r.a_cell,0),a(r.a_color_t,0))}function ci(e){if(!e.c)return;if(e.u.length>0){_f(e);return}if(!e.a)return;let t=e.a,n=e.A(),o=e.t?.dpr??1,i=le(e.c,t,o);if(!i)return;i.strokeStyle=n.ln,i.lineWidth=1,i.beginPath(),i.moveTo(t.e.x,t.e.y),i.lineTo(t.e.x,t.e.y+t.e.height),i.lineTo(t.e.x+t.e.width,t.e.y+t.e.height),i.stroke();let r={levels:e.Ut,numRows:e.vt,levelLabels:e._.slice()},s={levels:e.Ot,numRows:e.At,levelLabels:[]},a=e._[0],l=e._[1]??e.P[0];if(e.In.mode==="numeric"&&e.ft){let u=ie(t.Y,t.J,6);oi(i,t,e.ft,u,n,e.getColumnFormatter(a,"tick"))}else de(i,t,r,n);if(e.Dn.mode==="numeric"&&e.ct){let u=ie(t.q,t.Q,6);ii(i,t,e.ct,u,n,e.getColumnFormatter(l,"tick"))}else Ir(i,t,s,n,Er);St(e.c,t,{min:e.b,max:e.p,label:e.ai},n.H,n,e.getColumnFormatter(e.I[0],"value")),e.Pe&&Pr(e)}function Cf(e,t,n,o){let i=t.gl,r=e.A(),{effectiveSharedX:s,effectiveSharedY:a}=e.computeEffectiveFacetFlags(),l=Re(e.u.map(m=>m.label),{cssWidth:n,cssHeight:o,xAxis:s?"outer":"cell",yAxis:a?"outer":"cell",hasLegend:!0,hasXLabel:e._.length>0,hasYLabel:!1,gap:8});e.m=l;for(let m=0;m<e.u.length;m++){let f=l.cells[m];f&&(e.u[m].layout=f.layout)}e.syncFacetZoomLayouts(l.cells),il(e,t),rl(e,t),e.oe=rn(t,e.oe,r.H),i.useProgram(e.o);let u=e.F;Ge(t,e.oe.texture,u.u_gradient_lut,0),at(i);for(let m=0;m<e.u.length;m++){let f=e.u[m];if(f.instanceCount===0)continue;let{numX:b,numY:d}=f.pipeline;if(b===0||d===0)continue;let p=f.layout,x=f.pipeline.xAxisMode.mode==="numeric",h=f.pipeline.yAxisMode.mode==="numeric",g=x?f.pipeline.xNumericDomain.min:-.5,y=x?f.pipeline.xNumericDomain.max:b-.5,_=h?f.pipeline.yNumericDomain.min:-.5,C=h?f.pipeline.yNumericDomain.max:d-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(g,y,_,C);let A=v?v.getVisibleDomain():{xMin:g,xMax:y,yMin:_,yMax:C},R=p.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),L=p.e,T=L.width/(A.xMax-A.xMin),F=L.height/(A.yMax-A.yMin),I=r.Li*.5,D=x?f.pipeline.xNumericDomain.bandWidth:1,P=h?f.pipeline.yNumericDomain.bandWidth:1,E=Math.min(D*.5,T>0?I/T:0),O=Math.min(P*.5,F>0?I/F:0);lt(i,p,t.dpr,()=>{i.uniformMatrix4fv(u.u_projection,!1,R),i.uniform2f(u.u_cell_inset,E,O),i.uniform2f(u.u_cell_size,D,P),sl(e,i,t,f.instanceStart,f.instanceCount)})}e.pe(()=>ci(e))}function _f(e){if(!e.c||!e.m)return;let t=e.A(),n=e.t?.dpr??1,o=le(e.c,e.u[0].layout,n);if(!o)return;let i=e.qn,r=e.Kn,s=e.m;for(let a=0;a<e.u.length;a++){let l=e.u[a],u=s.cells[a],m=l.layout,f=m.e;o.strokeStyle=t.ln,o.lineWidth=1,o.beginPath(),o.moveTo(f.x,f.y),o.lineTo(f.x,f.y+f.height),o.lineTo(f.x+f.width,f.y+f.height),o.stroke();let b={levels:l.pipeline.xLevels,numRows:l.pipeline.numX,levelLabels:e._.slice()},d={levels:l.pipeline.yLevels,numRows:l.pipeline.numY,levelLabels:[]},p=e._[0],x=e._[1]??e.P[0];if(!i||u.isBottomEdge)if(l.pipeline.xAxisMode.mode==="numeric"&&l.pipeline.xNumericDomain){let h=ie(m.Y,m.J,6);oi(o,m,l.pipeline.xNumericDomain,h,t,e.getColumnFormatter(p,"tick"))}else de(o,m,b,t);if(!r||u.isLeftEdge)if(l.pipeline.yAxisMode.mode==="numeric"&&l.pipeline.yNumericDomain){let h=ie(m.q,m.Q,6);ii(o,m,l.pipeline.yNumericDomain,h,t,e.getColumnFormatter(x,"tick"))}else Ir(o,m,d,t,Er)}for(let a=0;a<s.cells.length;a++){let l=s.cells[a],u=e.u[a];!u||!l.titleRect||_t(e.c,u.label,l.titleRect,t,n)}s.legendRect&&mn(e.c,{x:s.legendRect.x,y:s.legendRect.y+20,width:s.legendRect.width,height:Math.max(1,s.legendRect.height-20)},{min:e.b,max:e.p,label:""},t.H,t,e.getColumnFormatter(e.I[0],"value")),e.Pe&&Pr(e)}var di=class extends Te{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"N",null);c(this,"oe",null);c(this,"Ut",[]);c(this,"Ot",[]);c(this,"li",[]);c(this,"vt",0);c(this,"At",0);c(this,"mt",0);c(this,"In",{mode:"category"});c(this,"Dn",{mode:"category"});c(this,"Mn",null);c(this,"Fn",null);c(this,"ft",null);c(this,"ct",null);c(this,"w",0);c(this,"M",0);c(this,"Qe",[]);c(this,"Ao",[]);c(this,"Hi",0);c(this,"b",0);c(this,"p",1);c(this,"ai","");c(this,"Pe",null);c(this,"a",null);c(this,"Oi",0);c(this,"Vi",0);c(this,"u",[]);c(this,"m",null);c(this,"Sn",-1);c(this,"si",()=>ci(this))}tooltipCallbacks(){return{onHover:(n,o)=>Br(this,n,o),onLeave:()=>{this.Pe&&(this.Pe=null,this.si())},onPin:(n,o)=>{Br(this,n,o),this.Pe&&this.tr(this.Pe.xIdx,this.Pe.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async tr(n,o){let i=this.Ut.map(a=>a.labels[n]??null),r=this.Ot.slice(0,this.P.length).map(a=>a.labels[o]??null),s=this.I[0]??"";await this.emitClickAndSelect({rowIdx:n+this.mt,columnName:s,groupByValues:i,splitByValues:r})}async uploadAndRender(n,o,i,r){if(this.t=n,i!==0)return;let s=this.I.filter(a=>!!a);if(s.length>1){let a=Ka(o,s),l=[],u=[],m=1/0,f=-1/0;for(let b of a){let d=wr({columns:b.columns,numRows:r,groupBy:this._,splitBy:this.P,groupByTypes:this.ht}),p=u.length;for(let x of d.cells)u.push({xIdx:x.xIdx,yIdx:x.yIdx,value:x.value});l.push({label:b.label,pipeline:d,layout:new ne(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:p,instanceCount:d.cells.length,xOrigin:d.xNumericDomain?.min??0,yOrigin:d.yNumericDomain?.min??0}),isFinite(d.colorMin)&&d.colorMin<m&&(m=d.colorMin),isFinite(d.colorMax)&&d.colorMax>f&&(f=d.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.Ut=[],this.Ot=[],this.li=[],this.vt=0,this.At=0,this.mt=0,this.Ao=[],this.a=null,this.In={mode:"category"},this.Dn={mode:"category"},this.Mn=null,this.Fn=null,this.ft=null,this.ct=null,this.w=0,this.M=0,this.u=l,this.Qe=u,this.b=m,this.p=f,this.ai=s.join(", ")}else{let a=wr({columns:o,numRows:r,groupBy:this._,splitBy:this.P,groupByTypes:this.ht});this.u=[],this.m=null,this.Ut=a.xLevels,this.Ot=a.yLevels,this.li=a.yColumnNames,this.vt=a.numX,this.At=a.numY,this.mt=a.rowOffset,this.Qe=a.cells,this.Ao=a.cells2D,this.b=a.colorMin,this.p=a.colorMax,this.ai=s[0]??"Color",this.In=a.xAxisMode,this.Dn=a.yAxisMode,this.Mn=a.xPositions,this.Fn=a.yPositions,this.ft=a.xNumericDomain,this.ct=a.yNumericDomain,this.w=a.xNumericDomain?.min??0,this.M=a.yNumericDomain?.min??0}await this.requestRender(n)}It(n){this.t=n;let o=this.vt>0&&this.At>0,i=this.u.length>0;!o&&!i||ol(this,n)}destroyInternal(){this.N&&this.t&&this.t.gl.deleteBuffer(this.N),this.o=null,this.F=null,this.N=null,this.Ut=[],this.Ot=[],this.li=[],this.Qe=[],this.Ao=[],this.Pe=null,this.u=[],this.m=null,this.Sn=-1,this.In={mode:"category"},this.Dn={mode:"category"},this.Mn=null,this.Fn=null,this.ft=null,this.ct=null}};Qt();function Tn(){return{count:0,catIdx:new Int32Array(0),splitIdx:new Int32Array(0),seriesId:new Int32Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),open:new Float64Array(0),close:new Float64Array(0),high:new Float64Array(0),low:new Float64Array(0),isUp:new Uint8Array(0)}}function vf(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),splitIdx:new Int32Array(t),seriesId:new Int32Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),open:new Float64Array(t),close:new Float64Array(t),high:new Float64Array(t),low:new Float64Array(t),isUp:new Uint8Array(t)}}var al={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function ll(e){let{columns:t,numRows:n,columnSlots:o,groupBy:i,splitBy:r,groupByTypes:s,bandInnerFrac:a,barInnerPad:l,scratchCandles:u}=e,m=Gt(i,s),f=o[0]||"";if(!f)return{...al,candles:Tn()};let b=o[1]||"",d=o[2]||"",p=o[3]||"",x=[];if(r.length>0){let U=[f];b&&U.push(b),d&&U.push(d),p&&U.push(p);for(let X of He(t,[f],U))X.colNames.has(f)&&x.push(X.prefix);x.length===0&&x.push("")}else x.push("");let h=i.map(U=>s[U]??"string"),{rowPaths:g,numCategories:y,rowOffset:_}=Wt(t,n,i.length,h);if(y===0)return{...al,axisMode:m,splitPrefixes:x,rowPaths:g,rowOffset:_,candles:Tn()};let C=x.length,v=[];for(let U=0;U<C;U++){let X=x[U];v.push({seriesId:U,splitIdx:U,splitKey:X,label:X===""?f:X})}let A=null,R=null,L=1;if(m.mode==="numeric"&&y>0){let U=t.get("__ROW_PATH_0__"),X=ct(U?.values,y,_,i[0]??"",m.numericType==="date"||m.numericType==="datetime");X&&(A=X.categoryPositions,R=X.numericCategoryDomain,L=X.numericCategoryDomain.bandWidth)}let T=Ko(C,a,l),F=T.slotWidth*L,I=T.halfWidth*L,D=(C-1)/2,P=[];for(let U=0;U<C;U++){let X=x[U],q=et=>X===""?et:`${X}|${et}`,be=t.get(q(f));if(!be?.values){P.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let Fe=b?t.get(q(b)):null,_e=d?t.get(q(d)):null,ve=p?t.get(q(p)):null;P.push({openCol:be.values,closeCol:Fe?.values??null,highCol:_e?.values??null,lowCol:ve?.values??null,openValid:be.valid??null,closeValid:Fe?.valid??null,highValid:_e?.valid??null,lowValid:ve?.valid??null})}let E=y*C,O=vf(u??null,E),W=0,V=1/0,S=-1/0,Y=y;for(let U=0;U<C;U++){let X=P[U],q=X.openCol;if(!q)continue;let be=X.closeCol,Fe=X.highCol,_e=X.lowCol,ve=X.openValid,et=X.closeValid,zt=X.highValid,Xt=X.lowValid,$t=(U-D)*F;for(let ge=0;ge<Y;ge++){let se=ge+_;if(ve&&!(ve[se>>3]>>(se&7)&1))continue;let Q=q[se];if(!isFinite(Q))continue;let oe;if(be&&(!et||(et[se>>3]>>(se&7)&1)!==0)){let K=be[se];oe=isFinite(K)?K:Q}else{let K=ge<Y-1?ge+1+_:se;if(!ve||(ve[K>>3]>>(K&7)&1)!==0){let bt=q[K];oe=isFinite(bt)?bt:Q}else oe=Q}let Se;if(Fe&&(!zt||(zt[se>>3]>>(se&7)&1)!==0)){let K=Fe[se];Se=isFinite(K)?K:Q>oe?Q:oe}else Se=Q>oe?Q:oe;let Ie;if(_e&&(!Xt||(Xt[se>>3]>>(se&7)&1)!==0)){let K=_e[se];Ie=isFinite(K)?K:Q<oe?Q:oe}else Ie=Q<oe?Q:oe;let Ai=(A?A[ge]:ge)+$t,De=oe>=Q?1:0;O.catIdx[W]=ge,O.splitIdx[W]=U,O.seriesId[W]=U,O.xCenter[W]=Ai,O.halfWidth[W]=I,O.open[W]=Q,O.close[W]=oe,O.high[W]=Se,O.low[W]=Ie,O.isUp[W]=De,W++,Ie<V&&(V=Ie),Se>S&&(S=Se)}}if(O.count=W,!isFinite(V)||!isFinite(S))V=0,S=1;else if(V===S){let U=Math.max(Math.abs(V),1)*.05;V-=U,S+=U}return{splitPrefixes:x,rowPaths:g,numCategories:y,rowOffset:_,axisMode:m,numericCategoryDomain:R,categoryPositions:A,series:v,candles:O,yDomain:{min:V,max:S}}}Ye();Ee();on();Ct();Ae();Ft();var Af=3;function ul(e,t,n){let o=0,i=t;for(;o<i;){let r=o+i>>>1;e[r]<n?o=r+1:i=r}return o}function Gr(e,t,n){if(e.ui!==-1)return;let o=e.a;if(!o)return;let i=e.Ce;if(i.count===0){e._e!==-1&&(e._e=-1,Qe(e));return}let r=o.e,s=o.Y,a=o.J,l=o.q,u=o.Q;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e._e!==-1&&(e._e=-1,Qe(e));return}let m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),d=Af/b,p=i.xCenter,x=i.halfWidth,h=i.open,g=i.close,y=i.high,_=i.low,C=i.count>0?x[0]:0,v=Math.max(C,d),A=ul(p,i.count,m-v),R=ul(p,i.count,m+v+1e-12),L=-1;for(let T=R-1;T>=A;T--){let F=p[T],I=x[T],D=m>=F-I&&m<=F+I,P=Math.abs(m-F)<=d;if(!D&&!P)continue;let E=h[T],O=g[T],W=E<O?E:O,V=E<O?O:E,S=D&&f>=W&&f<=V,Y=f>=_[T]&&f<=y[T];if(S||Y){L=T;break}}L!==e._e&&(e._e=L,Qe(e))}function ml(e,t){e.T.dismiss(),e.ui=t;let n=e.Ce;if(t<0||t>=n.count||!e.a)return;let o=Wr(e,t);if(o.length===0)return;let i=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.a.E(i,r),a=e.a.cssWidth,l=e.a.cssHeight;e.T.pin(o,s,{cssWidth:a,cssHeight:l}),e._e=-1,Qe(e)}function Wr(e,t){let n=[],o=e.Ce;if(t<0||t>=o.count)return n;let i=o.catIdx[t],r=o.splitIdx[t],s=o.open[t],a=o.close[t],l=o.high[t],u=o.low[t];if(e.Ke==="numeric"&&e.D&&e.qe){let p=e.qe[i],x=e._[0];n.push(e.getColumnFormatter(x,"value")(p))}else if(e.we.length>0){let p=[];for(let x of e.we){let h=x.labels[i]??"";h&&p.push(h)}p.length>0&&n.push(p.join(" \\u203A "))}else n.push(`Row ${i+e.mt}`);if(r>=0&&e.fe.length>1){let p=e.fe[r];p&&n.push(p)}let m=e.getColumnFormatter(e.I[0],"value"),f=e.getColumnFormatter(e.I[1],"value"),b=e.getColumnFormatter(e.I[2],"value"),d=e.getColumnFormatter(e.I[3],"value");return n.push(`Open: ${m(s)}`),n.push(`Close: ${f(a)}`),n.push(`High: ${b(l)}`),n.push(`Low: ${d(u)}`),n}function fl(e,t,n,o,i){let r=1/0,s=-1/0,a={cat:0,lo:0,hi:0,skip:!1};for(let u=0;u<e.length;u++)a.skip=!1,o(e[u],a),!a.skip&&(a.cat<t||a.cat>n||(a.lo<r&&(r=a.lo),a.hi>s&&(s=a.hi)));let l=isFinite(r)&&isFinite(s);if(l&&r===s){let u=Math.abs(r)||1;r-=u,s+=u}return i.min=r,i.max=s,i.hasFit=l,i}function kr(e){let n=e.A().H;if(e.Lo===n)return;let o=Le(n,1),i=Le(n,0);e.To=[o[0],o[1],o[2]],e.Ro=[i[0],i[1],i[2]],e.Lo=n}function cl(e){e.B.bodyWick.invalidateBuffers(e),e.B.ohlc.invalidateBuffers(e)}function dl(e,t){e.B.bodyWick.rebuildBuffers(e,t),e.B.ohlc.rebuildBuffers(e,t)}function pl(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0||e.ee===0)return;let s=e.A();kr(e);let a=e.Ke==="numeric",l=a?e.D.min:-.5,u=a?e.D.max:e.ee-.5;e.g&&e.g.setBaseDomain(l,u,e.Bn.min,e.Bn.max);let m=e.g?e.g.getVisibleDomain():{xMin:l,xMax:u,yMin:e.Bn.min,yMax:e.Bn.max};if(e.eo&&e.g&&!e.g.isXDefault()){let _=Tf(e,m.xMin,m.xMax);_.hasFit&&(m.yMin=_.min,m.yMax=_.max)}let f=e._.length>0,b={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},d;if(a)d=new ne(i,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,i-71-16),A=We(b,v);d=new ne(i,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.a=d,e.g&&e.g.updateLayout(d);let p=d.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e.se,0),x=ie(m.yMin,m.yMax,6),h=e.I[0]||"",g=b,y={min:m.yMin,max:m.yMax,label:h};e.j&&si(e.j,d,x,s,t.dpr),ze(n,d,t.dpr,()=>{e.Jn==="ohlc"?e.B.ohlc.draw(e,n,t,p):e.B.bodyWick.draw(e,n,t,p)}),e.he=g,e.xe=y,e.Re=x,e.ze=a?ie(m.xMin,m.xMax,6):null,e.pe(()=>Qe(e))}function Qe(e){if(!e.c||!e.a||!e.xe||!e.Re)return;let t=e.A(),n;if(e.Ke==="numeric"&&e.D&&e.ze)n={mode:"numeric",domain:{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label},ticks:e.ze};else if(e.he)n={mode:"category",domain:e.he};else return;let o=e.I[0]??e.I[1]??e.I[2]??e.I[3],i=e._[0];ri(e.c,n,{mode:"numeric",domain:e.xe,ticks:e.Re},e.a,t,e.t?.dpr??1,void 0,!1,{value:e.getColumnFormatter(o,"tick"),category:e.getColumnFormatter(i,"tick")}),e._e>=0&&e._e<e.Ce.count&&Lf(e)}function Lf(e){if(!e.c||!e.a)return;let t=e._e,n=e.Ce;if(t<0||t>=n.count)return;let o=e.a,i=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=o.E(i,r),a=Wr(e,t),l=e.A();Pe(e.c,s,a,o,l,e.t?.dpr??1,{crosshair:!1,highlightRadius:0})}function Tf(e,t,n){let o=e._t;if(o&&o.xMin===t&&o.xMax===n)return o;let i=o??Rf();i.xMin=t,i.xMax=n;let r=e.Ce,s=1/0,a=-1/0,l=!1,u=r.xCenter,m=r.low,f=r.high;for(let b=0;b<r.count;b++){let d=u[b];d<t||d>n||(m[b]<s&&(s=m[b]),f[b]>a&&(a=f[b]),l=!0)}return i.min=l?s:0,i.max=l?a:1,i.hasFit=l,e._t=i,i}function Rf(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}Me();me();var pi=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=Lo(n),r={...j(t,"candlestick-body",Nn,Un,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:o,instanceBuffer:n.createBuffer()},s=je(n),l={...j(t,"line-uniform",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]),cornerBuffer:s,segmentBuffer:n.createBuffer()};return this.o={body:r,wick:l},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.t){this.i=null;return}let o=t.t.gl;o.deleteBuffer(n.upWickBuffer),o.deleteBuffer(n.downWickBuffer),this.i=null}rebuildBuffers(t,n){let o=t.Ce,i=this.ensureProgram(n),r=n.gl,s=t.se;if(o.count===0){let F=r.createBuffer(),I=r.createBuffer();this.i={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:F,downWickBuffer:I};return}let a=new Float32Array(o.count*7),l=0,u=0,m=o.xCenter,f=o.halfWidth,b=o.open,d=o.close,p=o.isUp,x=t.To,h=t.Ro;for(let F=0;F<o.count;F++){let I=b[F],D=d[F],P=I<D?I:D,E=I<D?D:I,O=p[F]!==0,W=O?x:h,V=F*7;a[V+0]=m[F]-s,a[V+1]=f[F]*.7,a[V+2]=P,a[V+3]=E,a[V+4]=W[0],a[V+5]=W[1],a[V+6]=W[2],O?l++:u++}r.bindBuffer(r.ARRAY_BUFFER,i.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);let g=new Float32Array(l*4),y=new Float32Array(u*4),_=0,C=0,v=o.low,A=o.high;for(let F=0;F<o.count;F++){let I=m[F]-s,D=v[F],P=A[F];p[F]!==0?(g[_+0]=I,g[_+1]=D,g[_+2]=I,g[_+3]=P,_+=4):(y[C+0]=I,y[C+1]=D,y[C+2]=I,y[C+3]=P,C+=4)}let R=this.i,L=R?.upWickBuffer??r.createBuffer(),T=R?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,L),r.bufferData(r.ARRAY_BUFFER,g,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,T),r.bufferData(r.ARRAY_BUFFER,y,r.STATIC_DRAW),this.i={bodyCount:o.count,upWickCount:l,downWickCount:u,upWickBuffer:L,downWickBuffer:T}}draw(t,n,o,i){let r=this.i;if(!r||r.bodyCount===0)return;let s=this.ensureProgram(o);wf(n,o,s.body,r.bodyCount,i),Mf(t,n,o,s.wick,r,i)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&(n.deleteBuffer(o.body.quadBuffer),n.deleteBuffer(o.body.instanceBuffer),n.deleteBuffer(o.wick.cornerBuffer),n.deleteBuffer(o.wick.segmentBuffer))}this.o=null,this.i=null}};function wf(e,t,n,o,i){if(o===0)return;let r=7*Float32Array.BYTES_PER_ELEMENT;e.useProgram(n.program),e.uniformMatrix4fv(n.u_projection,!1,i);let s=J(t),{setDivisor:a}=s;e.bindBuffer(e.ARRAY_BUFFER,n.quadBuffer),e.enableVertexAttribArray(n.a_corner),e.vertexAttribPointer(n.a_corner,2,e.FLOAT,!1,0,0),a(n.a_corner,0),e.bindBuffer(e.ARRAY_BUFFER,n.instanceBuffer);let l=Float32Array.BYTES_PER_ELEMENT,u=(m,f,b)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,b),a(m,1)};u(n.a_x_center,1,0),u(n.a_half_width,1,1*l),u(n.a_y0,1,2*l),u(n.a_y1,1,3*l),u(n.a_color,3,4*l),s.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o),a(n.a_x_center,0),a(n.a_half_width,0),a(n.a_y0,0),a(n.a_y1,0),a(n.a_color,0)}function Mf(e,t,n,o,i,r){if(i.upWickCount===0&&i.downWickCount===0)return;let s=n.dpr;t.useProgram(o.program),t.uniformMatrix4fv(o.u_projection,!1,r),t.uniform2f(o.u_resolution,t.canvas.width,t.canvas.height),t.uniform1f(o.u_line_width,e.h.wick_width_px*s),t.disableVertexAttribArray(o.a_real_start),t.disableVertexAttribArray(o.a_real_end),t.vertexAttrib1f(o.a_real_start,1),t.vertexAttrib1f(o.a_real_end,1),t.uniform1f(o.u_interp_alpha,1);let a=J(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,o.cornerBuffer),t.enableVertexAttribArray(o.a_corner),t.vertexAttribPointer(o.a_corner,1,t.FLOAT,!1,0,0),l(o.a_corner,0),bl(t,a,o,i.upWickBuffer,i.upWickCount,e.To),bl(t,a,o,i.downWickBuffer,i.downWickCount,e.Ro),l(o.a_start,0),l(o.a_end,0)}function bl(e,t,n,o,i,r){if(i===0)return;let s=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:a}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,2*s,0),a(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,2*s,s),a(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i)}Me();me();var bi=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=je(n),i=j(t,"line-uniform",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]);return this.o={...i,cornerBuffer:o,segmentBuffer:n.createBuffer()},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.t){this.i=null;return}let o=t.t.gl;o.deleteBuffer(n.upBuffer),o.deleteBuffer(n.downBuffer),this.i=null}rebuildBuffers(t,n){if(t.Jn!=="ohlc")return;let o=t.Ce,i=n.gl;this.ensureProgram(n);let r=t.se,s=o.xCenter,a=o.halfWidth,l=o.open,u=o.close,m=o.high,f=o.low,b=o.isUp,d=0,p=0;for(let A=0;A<o.count;A++)b[A]!==0?d++:p++;let x=new Float32Array(d*3*4),h=new Float32Array(p*3*4),g=0,y=0;for(let A=0;A<o.count;A++){let R=s[A]-r,L=l[A],T=u[A],F=f[A],I=m[A],D=a[A],P=b[A]!==0?x:h,E=b[A]!==0?g:y;P[E++]=R,P[E++]=F,P[E++]=R,P[E++]=I,P[E++]=R-D,P[E++]=L,P[E++]=R,P[E++]=L,P[E++]=R,P[E++]=T,P[E++]=R+D,P[E++]=T,b[A]!==0?g=E:y=E}let _=this.i,C=_?.upBuffer??i.createBuffer(),v=_?.downBuffer??i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,C),i.bufferData(i.ARRAY_BUFFER,x,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,v),i.bufferData(i.ARRAY_BUFFER,h,i.STATIC_DRAW),this.i={upBuffer:C,downBuffer:v,upInstanceCount:d*3,downInstanceCount:p*3}}draw(t,n,o,i){let r=this.i;if(!r||r.upInstanceCount===0&&r.downInstanceCount===0)return;let s=this.ensureProgram(o),a=o.dpr;n.useProgram(s.program),n.uniformMatrix4fv(s.u_projection,!1,i),n.uniform2f(s.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(s.u_line_width,t.h.ohlc_line_width_px*a),n.disableVertexAttribArray(s.a_real_start),n.disableVertexAttribArray(s.a_real_end),n.vertexAttrib1f(s.a_real_start,1),n.vertexAttrib1f(s.a_real_end,1),n.uniform1f(s.u_interp_alpha,1);let l=J(o),{setDivisor:u}=l;n.bindBuffer(n.ARRAY_BUFFER,s.cornerBuffer),n.enableVertexAttribArray(s.a_corner),n.vertexAttribPointer(s.a_corner,1,n.FLOAT,!1,0,0),u(s.a_corner,0),gl(n,l,s,r.upBuffer,r.upInstanceCount,t.To),gl(n,l,s,r.downBuffer,r.downInstanceCount,t.Ro),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&(n.deleteBuffer(o.cornerBuffer),n.deleteBuffer(o.segmentBuffer))}this.o=null,this.i=null}};function gl(e,t,n,o,i,r){if(i===0)return;let s=4*Float32Array.BYTES_PER_ELEMENT,a=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:l}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,s,0),l(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,s,a),l(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i)}var Rn=class extends Nt{constructor(){super(...arguments);c(this,"F",null);c(this,"fe",[]);c(this,"l",[]);c(this,"Ce",Tn());c(this,"Bn",{min:0,max:1});c(this,"wo",null);c(this,"Ke","category");c(this,"D",null);c(this,"qe",null);c(this,"ze",null);c(this,"se",0);c(this,"To",[0,.8,.4]);c(this,"Ro",[.8,.2,.2]);c(this,"Lo",null);c(this,"_e",-1);c(this,"ui",-1);c(this,"B",{bodyWick:new pi,ohlc:new bi});c(this,"eo",!0);c(this,"_t",null)}tooltipCallbacks(){return{onHover:(n,o)=>Gr(this,n,o),onLeave:()=>{this._e!==-1&&(this._e=-1,Qe(this))},onPin:(n,o)=>{if(Gr(this,n,o),this._e>=0){let i=this._e;ml(this,i),this.nr(i)}},onUnpin:()=>{this.emitUnselect()}}}async nr(n){if(n<0||n>=this.Ce.count)return;let o=this.Ce.catIdx[n],i=this.Ce.splitIdx[n],r=this.we.map(u=>u.labels[o]??null),s=this.fe[i]??"",a=this.P.length>0&&s!==""?s.split("|"):[],l=this.I[1]||this.I.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:o+this.mt,columnName:l,groupByValues:r,splitByValues:a})}invalidateTheme(){super.invalidateTheme(),this.Lo=null}async uploadAndRender(n,o,i,r){if(this.t=n,i!==0)return;let s=ll({columns:o,numRows:r,columnSlots:this.I,groupBy:this._,splitBy:this.P,groupByTypes:this.ht,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,scratchCandles:this.Ce});this.h.domain_mode==="expand"?this.wo=Ln(this.wo,s.yDomain):this.wo=null,this.we=s.rowPaths,this.ee=s.numCategories,this.mt=s.rowOffset,this.fe=s.splitPrefixes,this.l=s.series,this.Ce=s.candles,this.Bn=s.yDomain,this.Ke=s.axisMode.mode,this.D=s.numericCategoryDomain,this.qe=s.categoryPositions,this.se=s.numericCategoryDomain?.min??0,this._t=null,kr(this),cl(this),dl(this,n),await this.requestRender(n)}It(n){this.t=n,pl(this,n)}resetExpandedDomain(){this.wo=null}destroyInternal(){if(this.t){let n=this.t.gl;this.N&&n.deleteBuffer(this.N),this.B.bodyWick.destroy(this),this.B.ohlc.destroy(this)}this.o=null,this.F=null,this.N=null,this.Ce=Tn(),this.l=[],this.we=[],this.ee=0,this.Lo=null}};var Rl={scatter:async()=>To,line:async()=>Ro,density:async()=>wo,treemap:async()=>Xo,sunburst:async()=>qo,heatmap:async()=>di,"y-bar":async()=>Je,"y-line":async()=>Je,"y-scatter":async()=>Je,"y-area":async()=>Je,"x-bar":async()=>fi,candlestick:async()=>Rn,ohlc:async()=>Rn,"map-scatter":async()=>(await Promise.resolve().then(()=>(Ci(),yi))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(Ci(),yi))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(Ci(),yi))).MapDensityChart};async function wl(e,t,n){let o=new Map;await e.with_typed_arrays(n??{},async(i,r,s,a)=>{for(let u=0;u<i.length;u++){let m=i[u],f=r[u],b=s[u]??void 0,d=a[u];d!==null?o.set(m,{type:"string",indices:f,dictionary:d,valid:b}):f instanceof Float32Array?o.set(m,{type:"float32",values:f,valid:b}):f instanceof Int32Array?o.set(m,{type:"int32",values:f,valid:b}):f instanceof Float64Array?o.set(m,{type:"float64",values:f,valid:b}):o.set(m,{type:"float32",values:new Float32Array(f),valid:b})}let l=0;if(o.size>0){l=1/0;for(let u of o.values()){let m=u.indices?.length??u.values?.length??0;m<l&&(l=m)}}await t(o,l)})}var Ml=new Map;async function Fl(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=Ml.get(t);if(n){await n;return}n=(async()=>{try{let o={};e.style&&(o.style=e.style),e.weight&&(o.weight=e.weight),e.stretch&&(o.stretch=e.stretch);let i=new FontFace(e.family,e.src,o);await i.load(),self.fonts.add(i)}catch(o){console.warn(`Failed to load font ${e.family}:`,o)}})(),Ml.set(t,n),await n}function Yt(e,t){switch(t.kind){case"setViewByName":e.setViewByName(t.name);break;case"setColumnsConfig":e.chartImpl.setColumnsConfig?.(t.cfg);break;case"setPluginConfig":e.chartImpl.setPluginConfig?.(t.cfg),e.redraw();break;case"setBufferMaxCapacity":e.glManager.v.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"deselect":e.chartImpl.deselect?.();break;case"resize":e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redrawAck(t.msgId);break;case"clear":e.clear();break;case"invalidateTheme":e.chartImpl.setTheme?.(t.themeVars),e.chartImpl.invalidateTheme?.(),e.resize(e.cssWidth,e.cssHeight,e.dpr);break;case"restoreZoom":e.restoreZoom(t.state);break;case"resetAllZooms":e.resetAllZooms(),e.redraw(),e.post({kind:"zoomChanged",isDefault:e.allZoomsDefault()});break;case"resetExpandedDomain":e.resetExpandedDomain();break;case"interaction":e.onInteraction(t.event);break;case"saveZoom":e.post({kind:"saveZoomReply",requestId:t.requestId,state:e.saveZoom()});break;case"destroy":e.destroy();break;case"init":break;case"snapshotPng":{let n=t.requestId;e.snapshotPng().then(o=>{e.post({kind:"snapshotPngReply",requestId:n,blob:o})}).catch(o=>{e.post({kind:"error",message:String(o)})});break}}}var Mn=new Map,Yr=new Set;function zr(e,t,n){let o={sessionId:e,msg:t};n&&n.length>0?self.postMessage(o,n):self.postMessage(o)}function Df(e){return{postMessage:(t,n)=>zr(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function Sl(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:o,msg:i}=n;if(i.kind==="init"){if(Mn.has(o)){zr(o,{kind:"error",message:`sessionId ${o} already initialized`});return}e(i,Df(o)).then(s=>{if(Yr.delete(o)){Yt(s,{kind:"destroy"});return}Mn.set(o,s)}).catch(s=>{Yr.delete(o),zr(o,{kind:"error",message:String(s)})});return}if(i.kind==="destroy"){let s=Mn.get(o);s?(Yt(s,i),Mn.delete(o)):Yr.add(o);return}let r=Mn.get(o);r&&Yt(r,i)})}Ui();var _i=class extends Error{constructor(){super("StaleGenerationError")}};async function Dl(e){let t=Rl[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var Xr=null;function Bf(e){return Xr||(Xr=new Qn(4,{precompile:e})),Xr}var vi=class{constructor(t,n,o,i,r,s){c(this,"chartImpl");c(this,"glManager");c(this,"zoomController",null);c(this,"gridlines");c(this,"chrome");c(this,"cssWidth");c(this,"cssHeight");c(this,"dpr");c(this,"client");c(this,"view");c(this,"table");c(this,"controlPort");c(this,"mi",0);c(this,"Mo",null);c(this,"fi",0);c(this,"ci",0);if(this.client=n,this.view=o,this.table=i,this.controlPort=r,this.chartImpl=new s,t.renderMode==="blit"&&!t.glCanvas&&!0)this.glManager=new qt(Bf(t.precompileShaders??!1).acquire());else{let l=t.glCanvas??new OffscreenCanvas(Math.max(1,Math.round(t.cssWidth*t.dpr)),Math.max(1,Math.round(t.cssHeight*t.dpr)));this.glManager=new qt(l,{precompile:t.precompileShaders??!1})}t.renderMode==="blit"&&this.glManager.setFrameCallback(l=>{this.post({kind:"frameBitmap",bitmap:l},[l])}),this.gridlines=t.gridlinesCanvas,this.chrome=t.chromeCanvas,this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(t.gridlinesCanvas),this.chartImpl.setChromeCanvas?.(t.chromeCanvas),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),this.chartImpl.setZoomController&&(this.zoomController=new yt,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(o),this.glManager.v.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr),this.chartImpl.attachTooltip?.(new to(l=>this.post(l)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}async loadAndRender(t){let n=++this.mi;try{let[o,i,r,s]=await Promise.all([this.view.num_rows(),this.view.schema(),this.view.expression_schema(),this.table?.schema()??Promise.resolve({})]);if(this.mi!==n)return;this.chartImpl.setViewPivots?.(t.viewerConfig.group_by,t.viewerConfig.split_by),this.chartImpl.setColumnTypes?.(i),this.chartImpl.setGroupByTypes?.({...s,...r}),this.chartImpl.setColumnSlots?.(t.viewerConfig.columns);let a=Object.keys(i).length||1,l=Math.floor(this.glManager.v.maxCapacity/a),u=Math.min(o,l);this.glManager.ensureBufferCapacity(u);try{await wl(this.view,async(m,f)=>{if(this.mi!==n)throw new _i;await this.chartImpl.uploadAndRender(this.glManager,m,0,Math.min(u,f))},{end_row:u,float32:t.options.float32})}catch(m){if(!(m instanceof _i))throw m}}catch(o){(o+"").indexOf("View not found")===-1&&console.error("loadAndRender failed",o)}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId})}}redraw(){this.chartImpl.requestRender(this.glManager)}redrawAck(t){this.chartImpl.requestRender(this.glManager).catch(()=>{}).finally(()=>this.post({kind:"resizeAck",msgId:t}))}resize(t,n,o){this.cssWidth=t,this.cssHeight=n,this.dpr=o,this.glManager.requestResize(t,n,o),this.chartImpl.requestRender(this.glManager)}clear(){Cs(this.glManager,()=>{this.glManager.clear(),this.gridlines.getContext("2d")?.clearRect(0,0,this.gridlines.width,this.gridlines.height)})}saveZoom(){return this.zoomController?.serialize()}restoreZoom(t){t&&this.zoomController?.restore(t)}allZoomsDefault(){if(this.zoomController&&!this.zoomController.isDefault())return!1;let t=this.chartImpl?.fn;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.fn;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}Zi(t,n){let o=this.chartImpl,i=o?.m;if(i){for(let a=0;a<i.cells.length;a++){let l=i.cells[a],u=l.layout.e;if(t>=u.x&&t<=u.x+u.width&&n>=u.y&&n<=u.y+u.height){let m=o.getZoomControllerForFacet?.(a)??this.zoomController;return m?{controller:m,layout:l.layout}:null}}return null}if(!this.zoomController)return null;let r=o?.a;if(!r)return null;let s=r.e;return t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height?null:{controller:this.zoomController,layout:r}}onInteraction(t){switch(t.type){case"wheel":{let n=this.Zi(t.mx,t.my);if(!n)return;ns(n,t.mx,t.my,t.deltaY),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()});break}case"pointerdown":{let n=this.Zi(t.mx,t.my);if(!n)return;this.Mo=n,this.fi=t.mx,this.ci=t.my;break}case"pointermove":{if(this.Mo){let n=t.mx-this.fi,o=t.my-this.ci;this.fi=t.mx,this.ci=t.my,os(this.Mo,n,o),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.T()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.Mo=null;break}case"pointerleave":{this.T()?.dispatchLeave();break}case"click":{this.T()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this.T()?.dispatchDblClick(t.mx,t.my);break}}}T(){return this.chartImpl?.T??null}async snapshotPng(){this.glManager.beginFrame(),this.chartImpl.renderFrameSync(this.glManager);let t=this.glManager.gl,n=t.canvas,o=n.width,i=n.height,r=new Uint8ClampedArray(o*i*4);t.readPixels(0,0,o,i,t.RGBA,t.UNSIGNED_BYTE,r);let s=new OffscreenCanvas(o,i),a=s.getContext("2d");if(!a)throw new Error("snapshotPng: 2D context unavailable");let u=this.chartImpl.A?.()?.backgroundColor??"transparent";u!=="transparent"&&(a.fillStyle=u,a.fillRect(0,0,o,i)),a.drawImage(this.gridlines,0,0);let m=new OffscreenCanvas(o,i),f=m.getContext("2d");if(!f)throw new Error("snapshotPng: 2D context unavailable for GL blit");return f.putImageData(new ImageData(r,o,i),0,0),a.save(),a.scale(1,-1),a.drawImage(m,0,-i),a.restore(),a.drawImage(this.chrome,0,0),await s.convertToBlob({type:"image/png"})}destroy(){_s(this.glManager),this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},Pf=typeof globalThis.importScripts=="function";async function Ef(e,t){if(!e.clientWorkerURL||!e.clientWasm||!e.proxyPort)throw new Error("Init error");let n=await import(e.clientWorkerURL.toString());await n.initSync({module:e.clientWasm}),e.fontFaces?.length&&await Promise.all(e.fontFaces.map(Fl));let o=e.proxyPort,i=new n.Client(async u=>{let m=u.slice().buffer;o.postMessage(m,[m])},async()=>o.close());o.addEventListener("message",u=>{i.handle_response(new Uint8Array(u.data))}),o.start();let r=i.__unsafe_open_view(e.viewName),s=e.tableName?await i.open_table(e.tableName):null,a=await Dl(e.chartTag),l=new vi(e,i,r,s,t,a);return l.post({kind:"ready"}),l}async function CC(e){let t=e.client.__unsafe_open_view(e.msg.viewName),n=e.msg.tableName?await e.client.open_table(e.msg.tableName):null,o=await Dl(e.msg.chartTag),i=new vi(e.msg,e.client,t,n,e.controlPort,o);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&Yt(i,s)}),e.controlPort.start(),i.post({kind:"ready"}),i}Pf&&Sl(Ef);export{vi as WorkerRenderer,CC as bootstrapInProcess};\n';var T=null;async function fe(){if(T)return T;let l=new Blob([J],{type:"application/javascript"});return T=URL.createObjectURL(l),T}var N=fe;var M=null,U=new Map,de=0;async function me(){return M||(M=(async()=>{let l=await N(),e=new Worker(l,{type:"module",name:"viewer-charts"});return e.addEventListener("message",t=>{let i=t.data;U.get(i.sessionId)?.(i.msg)}),e})(),M)}var E=class{_handle=null;_destroyed=!1;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_panel;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_lastPostedSize=null;_holdPresent=!1;_stagedFrame=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._panel=e.panel,this._clientWorkerURL=e.clientWorkerURL,this._clientWasm=e.clientWasm,this._chartTag=e.chartTag,this._maxCells=e.maxCells,this._precompileShaders=e.precompileShaders??!1,this._onZoomChanged=e.onZoomChanged??null,this._ready=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i})}async init(e){this._hostGlCanvas=e.gl;let t=await N();d==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(h=>{let O=h.slice().buffer;this._proxyChannel.port1.postMessage(O,[O])}),this._proxyChannel.port1.addEventListener("message",h=>{this._proxySession.handle_request(new Uint8Array(h.data))}),this._proxyChannel.port1.start());let i;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):i=e.gl.transferControlToOffscreen();let n=e.gridlines.transferControlToOffscreen(),r=e.chrome.transferControlToOffscreen(),o=e.gl.getBoundingClientRect(),a=window.devicePixelRatio||1,s=D(e.gl),g=d==="worker"?q():[],_=d==="worker"?this._clientWasm:void 0,x=d==="worker"?this._clientWorkerURL:void 0,y=d==="worker"?this._proxyChannel.port2:void 0,W={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:r,proxyPort:y,clientWorkerURL:x,clientWasm:_,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,defaultChartType:e.defaultChartType,themeVars:s,fontFaces:g,cssWidth:o.width,cssHeight:o.height,dpr:a,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._lastPostedSize={cssWidth:o.width,cssHeight:o.height,dpr:a},this._handle=await this._createHandle(t,W),this._handle.addMessageListener(h=>this._handleRendererMsg(h)),d==="worker"){let h=[n,r,this._proxyChannel.port2];i&&h.unshift(i),this._handle.post(W,h)}await this._ready}async _createHandle(e,t){if(d==="worker"){let r=await me(),o=++de;return{post:(a,s)=>r.postMessage({sessionId:o,msg:a},s),addMessageListener:a=>{U.set(o,a)},terminate:()=>{U.delete(o)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(r,o)=>n.port1.postMessage(r,o),addMessageListener:r=>{n.port1.addEventListener("message",o=>r(o.data)),n.port1.start()},terminate:()=>{n.port1.close(),n.port2.close()}}}setView(e){this._view=e,this._post({kind:"setViewByName",name:this._view.__unsafe_get_name()})}setColumnsConfig(e){this._post({kind:"setColumnsConfig",cfg:e})}setPluginConfig(e){this._post({kind:"setPluginConfig",cfg:e})}setBufferMaxCapacity(e){this._post({kind:"setBufferMaxCapacity",n:e})}loadAndRender(e){let{id:t,promise:i}=this._allocPending("loadAndRender"),n={kind:"loadAndRender",msgId:t,viewerConfig:e.viewerConfig,options:{float32:e.options?.float32??!0}};return this._post(n),i}redraw(){this._post({kind:"redraw"})}deselect(){this._post({kind:"deselect"})}resize(){if(!this._hostGlCanvas)return Promise.resolve();let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1,i=this._lastPostedSize;return i&&Math.abs(i.cssWidth-e.width)<=.5&&Math.abs(i.cssHeight-e.height)<=.5&&i.dpr===t?Promise.resolve():this._postResize(e.width,e.height)}presize(e,t){return this._hostGlCanvas?(this._holdPresent=!0,this._postResize(e,t).then(()=>()=>this._presentStaged(),i=>{throw this._presentStaged(),i})):Promise.resolve()}_postResize(e,t){let i=window.devicePixelRatio||1,{id:n,promise:r}=this._allocPending("resize");return this._lastPostedSize={cssWidth:e,cssHeight:t,dpr:i},this._post({kind:"resize",msgId:n,cssWidth:e,cssHeight:t,dpr:i}),r}_presentStaged(){this._holdPresent=!1;let e=this._stagedFrame;this._stagedFrame=null,e&&this._drawFrameBitmap(e)}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=D(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){if(this._destroyed){if(e==="loadAndRender")return{id:-1,promise:Promise.resolve(void 0)};let n=Promise.reject(new Error("RendererTransport destroyed"));return n.catch(()=>{}),{id:-1,promise:n}}let t=++this._pendingCounter,i=new Promise((n,r)=>{this._pending.set(t,{kind:e,resolve:n,reject:r})});return{id:t,promise:i}}restoreZoom(e){this._post({kind:"restoreZoom",state:e})}allZoomsDefault(){return this._allZoomsDefault}resetAllZooms(){this._post({kind:"resetAllZooms"})}resetExpandedDomain(){this._post({kind:"resetExpandedDomain"})}snapshotPng(){let{id:e,promise:t}=this._allocPending("snapshotPng");return this._post({kind:"snapshotPng",requestId:e}),t}forwardInteraction(e){this._post({kind:"interaction",event:e})}destroy(){this._destroyed=!0,this._post({kind:"destroy"}),this._proxySession&&this._proxySession.close().catch(()=>{}),this._proxyChannel&&(this._proxyChannel.port1.close(),this._proxyChannel=null),this._handle&&(this._handle.terminate(),this._handle=null),this._hostSink?.dismiss(),this._hostSink=null,this._hostGlCanvas=null,this._displayCtx=null,this._holdPresent=!1,this._stagedFrame?.close(),this._stagedFrame=null;let e=new Error("RendererTransport destroyed");for(let t of this._pending.values())t.kind==="loadAndRender"?t.resolve(void 0):t.reject(e);this._pending.clear()}_post(e){this._postRaw(e,[])}_postRaw(e,t){this._handle&&this._handle.post(e,t)}_handleRendererMsg(e){switch(e.kind){case"ready":this._resolveReady();break;case"zoomChanged":this._allZoomsDefault=e.isDefault,this._onZoomChanged?.(e.isDefault);break;case"saveZoomReply":this._resolvePending(e.requestId,"saveZoom",e.state);break;case"pinTooltip":this._ensureHostSink()?.pin(e.lines,e.pos,e.bounds);break;case"dismissTooltip":this._hostSink?.dismiss();break;case"setCursor":this._ensureHostSink()?.setCursor(e.cursor);break;case"userClick":this._dispatchOnViewer(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:{...e.detail,panel:this._panel}}));break;case"userSelect":{let t=this._lastInsertConfig?[this._lastInsertConfig]:[],i=e.selected?[e.insertConfig]:[];this._lastInsertConfig=e.selected?e.insertConfig:void 0;let n=new p(e.selected,e.row,e.column_names,t,i);n.panel=this._panel,this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._holdPresent?(this._stagedFrame?.close(),this._stagedFrame=e.bitmap):this._drawFrameBitmap(e.bitmap);break;case"error":this._rejectReady(new Error(e.message));break;case"loadAndRenderAck":this._resolvePending(e.msgId,"loadAndRender",void 0);break;case"resizeAck":this._resolvePending(e.msgId,"resize",void 0);break;case"snapshotPngReply":this._resolvePending(e.requestId,"snapshotPng",e.blob);break}}_resolvePending(e,t,i){let n=this._pending.get(e);!n||n.kind!==t||(this._pending.delete(e),n.resolve(i))}_drawFrameBitmap(e){if(this._displayCtx&&this._hostGlCanvas){let t=e.width,i=e.height;this._hostGlCanvas.width!==t&&(this._hostGlCanvas.width=t),this._hostGlCanvas.height!==i&&(this._hostGlCanvas.height=i),this._displayCtx.globalCompositeOperation="copy",this._displayCtx.drawImage(e,0,0)}e.close()}_dispatchOnViewer(e){if(!this._hostGlCanvas)return;let t=this._hostGlCanvas;for(;t;){if(t instanceof HTMLElement&&t.tagName==="PERSPECTIVE-VIEWER"){t.dispatchEvent(e);return}t=t.host??t.parentNode??null}}_ensureHostSink(){if(this._hostSink)return this._hostSink;let e=this._hostGlCanvas?.parentElement;return!e||!this._hostGlCanvas?null:(this._hostSink=new R(this._hostGlCanvas,e),this._hostSink)}};var ge={...j},pe={auto_alt_y_axis:{kind:"Bool"},include_zero:{kind:"Bool"},domain_mode:{kind:"Enum",variants:[{value:"fit",label:"Fit"},{value:"expand",label:"Expand"}]},facet_mode:{kind:"Enum",variants:[{value:"grid",label:"Grid"},{value:"overlay",label:"Overlay"}]},facet_zoom_mode:{kind:"Enum",variants:[{value:"shared",label:"Shared"},{value:"independent",label:"Independent"}]},series_zoom_mode:{kind:"Enum",variants:[{value:"dynamic",label:"Dynamic"},{value:"fixed",label:"Fixed"}]},line_width_px:{kind:"Number",min:.5,step:.5,max:16},point_size_px:{kind:"Number",min:1,max:32},band_inner_frac:{kind:"Number",min:.1,max:1,step:.01},bar_inner_pad:{kind:"Number",min:0,max:.9,step:.01},wick_width_px:{kind:"Number",min:.5,step:.5,max:8},ohlc_line_width_px:{kind:"Number",min:.5,step:.5,max:8},gradient_radius_px:{kind:"Number",min:2,step:1,max:256},gradient_intensity:{kind:"Number",min:.05,step:.05,max:4},gradient_heat_max:{kind:"Number",min:.1,step:.1,max:64},gradient_color_mode:{kind:"Enum",variants:[{value:"mean",label:"Mean (density-weighted)"},{value:"density",label:"Density only"},{value:"extreme",label:"Extremes"},{value:"signed",label:"Signed sum"}]},map_tile_provider:{kind:"Enum",variants:[{value:"carto-positron",label:"Light (Positron)"},{value:"carto-dark-matter",label:"Dark Matter"},{value:"carto-voyager",label:"Voyager"}]},map_tile_alpha:{kind:"Number",min:0,max:1,step:.05}};function _e(l,e){return{...pe[l],key:l,default:e[l]}}var xe=(()=>{let l=new CSSStyleSheet;return l.replaceSync($),[l]})(),Q=K,F=class extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_resetClickAbort=null;_pluginConfigStore=null;get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{...Z,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of xe)this.shadowRoot.adoptedStyleSheets.push(e);this.shadowRoot.innerHTML='<div class="webgl-container"><div class="zoom-controls"><button class="zoom-reset">Reset Zoom</button></div></div>',this._initialized=!0}this._glCanvas?.isConnected||this._buildCanvasStack()}_buildCanvasStack(){let e=this.shadowRoot.querySelector(".webgl-container");e.insertAdjacentHTML("afterbegin",'<canvas class="webgl-gridlines"></canvas><canvas class="webgl-canvas"></canvas><canvas class="webgl-chrome"></canvas>'),this._glCanvas=e.querySelector(".webgl-canvas"),this._gridlineCanvas=e.querySelector(".webgl-gridlines"),this._chromeCanvas=e.querySelector(".webgl-chrome")}_clearCanvasStack(){let e=this.shadowRoot?.querySelector(".webgl-container");if(e)for(let t of Array.from(e.querySelectorAll("canvas")))t.remove();this._glCanvas=null,this._gridlineCanvas=null,this._chromeCanvas=null}disconnectedCallback(){this.delete(),this._clearCanvasStack()}_ensureRenderer(e){if(this._initialized||this.connectedCallback(),this._rendererPromise)return this._rendererPromise;let t=this._buildRenderer(e).then(i=>{if(this._rendererPromise!==t)throw i.destroy(),new Error("renderer disposed during init");return this._renderer=i,this._setupInteraction(i),i});return t.catch(()=>{}),this._rendererPromise=t,t}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new A,this._rawEventForwarder.attach(this._glCanvas,n=>{e.forwardInteraction(n)});let i=this.shadowRoot.querySelector(".zoom-reset");i&&(this._resetClickAbort=new AbortController,i.addEventListener("click",()=>{e.resetAllZooms(),t&&t.classList.remove("visible")},{signal:this._resetClickAbort.signal}))}async _buildRenderer(e){let t=this.parentElement,i=this.getAttribute("slot")??void 0,n=await t.getClient({panel:i}),r=customElements.get("perspective-viewer"),o=r.get_wasm_module(),a=r.get_worker_url(),s=await t?.getTable?.({panel:i}),g=s?await s.get_name():void 0,_=this.shadowRoot.querySelector(".zoom-controls"),x=new E({client:n,view:e,tableName:g,panel:i,clientWorkerURL:a,clientWasm:o,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:y=>{_&&_.classList.toggle("visible",!y)}});return await x.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...ge,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:Q}),x}static setBlitMode(e){Q=e}get_static_config(){return{name:this._chartType.name,category:this._chartType.category,select_mode:this._chartType.selectMode,min_config_columns:this._chartType.initial.count,config_column_names:this._chartType.initial.names,max_cells:this._chartType.max_cells,max_columns:this._chartType.max_columns,group_rollup_modes:["flat"],priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"}}column_config_schema(e,t,i,n,r){let o=[],a=this._chartType.default_chart_type;if(a&&(e==="integer"||e==="float")){o.push({kind:"Enum",key:"chart_type",default:a,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let s=n?.chart_type??a,g=s==="bar"||s==="area";if(g&&o.push({kind:"Bool",key:"stack",default:g}),(a==="bar"||a==="line"||a==="scatter"||a==="area")&&o.push({kind:"Bool",key:"alt_axis",default:!1}),s==="line"||s==="area"){let y=s==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];o.push({kind:"Enum",key:"interpolate",default:"solid",variants:y})}}return e==="integer"||e==="float"?o.push({kind:"NumberFormat"}):(e==="date"||e==="datetime")&&o.push({kind:"DatetimeFormat"}),{fields:o}}plugin_config_schema(e){let t=this._effectiveDefaults();return{fields:this._chartType.applicable_plugin_fields.map(n=>_e(n,t))}}async draw(e){return this._renderer?.resetExpandedDomain(),this._renderer?.resetAllZooms(),this._drawImpl(e)}async update(e){return this._drawImpl(e)}async _drawImpl(e){let t;try{t=await this._ensureRenderer(e)}catch{return}t.setView(e),t.setBufferMaxCapacity(this._chartType.max_cells);let i=this.getAttribute("slot")??void 0,n=this.parentElement;if(n===null)return;let r=await n.getViewConfig({panel:i});await t.loadAndRender({viewerConfig:{group_by:r?.group_by??[],split_by:r?.split_by??[],columns:r?.columns??[]},options:{float32:!0}})}async clear(){this._renderer?.clear()}async resize(){!this.isConnected||this.offsetParent==null||await this._renderer?.resize()}async presize(e,t){if(!this.isConnected||this.offsetParent==null||!this._renderer||!this._glCanvas)return;let i=this.getBoundingClientRect(),n=this._glCanvas.getBoundingClientRect();return await this._renderer.presize(Math.max(0,n.width+(e-i.width)),Math.max(0,n.height+(t-i.height)))}restyle(){this._renderer?.invalidateTheme()}async deselect(){this._renderer?.deselect()}async render(e){return await this._ensureRenderer(e),await this.draw(e),this._renderer.snapshotPng()}restore(e,t){e?.zoom&&this._renderer?.restoreZoom(e.zoom),this._pluginConfig={...this._effectiveDefaults(),...e},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(t??{})}delete(){this._rawEventForwarder&&(this._rawEventForwarder.detach(),this._rawEventForwarder=null),this._resetClickAbort&&(this._resetClickAbort.abort(),this._resetClickAbort=null),this._renderer&&(this._renderer.destroy(),this._renderer=null),this._rendererPromise=null}};function ye(...l){let e=new Set(l.length>0?l:k.map(i=>i.name)),t=[];k.forEach(i=>{if(e.has(i.name)){let n=`perspective-viewer-charts-${i.tag}`;if(customElements.get(n)){t.push(n);return}customElements.define(n,class extends F{_chartType=i;static _chartType=i}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(n)})}}),t.length>0&&console.warn(`viewer-charts plugins already registered (${t.length}); skipping duplicate registration (Perspective was loaded more than once on this page).`)}ye();export{p as PerspectiveSelectDetail,ye as register};
|
|
1
|
+
var v="Series Charts",I="Cartesian Charts",L="Hierarchical Charts",V="Financial Charts",S="Map Charts",ee=["X Axis"],A=["Y Axis"],c="select",f="toggle";var b=["auto_alt_y_axis","facet_mode","series_zoom_mode","include_zero","domain_mode","line_width_px","point_size_px","band_inner_frac","bar_inner_pad"],C={facet_mode:"overlay"},B={...C,include_zero:!0},z=["facet_mode","facet_zoom_mode","domain_mode","line_width_px","point_size_px"],Y=["facet_mode","series_zoom_mode","domain_mode","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px"],H=[],te=["facet_zoom_mode"],P=["facet_mode","facet_zoom_mode","domain_mode","map_tile_provider","map_tile_alpha"],ie=[...P,"point_size_px"],ne=[...P,"line_width_px"],re=[...P,"gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"],le=["facet_mode","facet_zoom_mode","domain_mode","gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"];function u(o,e,t,i,n,r,l,s){return{name:o,tag:e,category:t,selectMode:i,initial:{count:n,names:r},max_cells:s?.max_cells??2e6,max_columns:s?.max_columns??1e4,applicable_plugin_fields:l,...s?.default_chart_type?{default_chart_type:s.default_chart_type}:{},...s?.plugin_field_defaults?{plugin_field_defaults:s.plugin_field_defaults}:{}}}var X=["Open","Close","High","Low","Tooltip"],$=["Size","Color","Tooltip"],oe=[u("X Bar","x-bar",v,c,1,ee,b,{default_chart_type:"bar",plugin_field_defaults:B}),u("Y Bar","y-bar",v,c,1,A,b,{default_chart_type:"bar",plugin_field_defaults:B}),u("Y Line","y-line",v,c,1,A,b,{default_chart_type:"line",plugin_field_defaults:C}),u("Y Scatter","y-scatter",v,c,1,A,b,{default_chart_type:"scatter",plugin_field_defaults:C}),u("Y Area","y-area",v,c,1,A,b,{default_chart_type:"area",plugin_field_defaults:B}),u("X/Y Scatter","scatter",I,f,2,["X Axis","Y Axis","Color","Size","Label","Tooltip"],z),u("X/Y Line","line",I,c,2,["X Axis","Y Axis","Tooltip"],z),u("Density","density",I,f,2,["X Axis","Y Axis","Color","Tooltip"],le),u("Treemap","treemap",L,f,1,$,H),u("Sunburst","sunburst",L,f,1,$,H),u("Heatmap","heatmap",L,c,1,["Color"],te),u("Candlestick","candlestick",V,f,1,X,Y,{default_chart_type:"candlestick",plugin_field_defaults:C}),u("OHLC","ohlc",V,f,1,X,Y,{default_chart_type:"ohlc",plugin_field_defaults:C}),u("Map Scatter","map-scatter",S,f,2,["Longitude","Latitude","Color","Size","Label","Tooltip"],ie),u("Map Line","map-line",S,c,2,["Longitude","Latitude","Tooltip"],ne),u("Map Density","map-density",S,f,2,["Longitude","Latitude","Color","Tooltip"],re)],k=oe;var G=":host{--psp-charts--tooltip--color:var(--psp--color);--psp-charts--tooltip--background:var(--psp--background-color);--psp-charts--tooltip--border-color:var(--psp-inactive--border-color);width:100%;height:100%;font-family:inherit;display:block;position:relative;overflow:hidden}.webgl-container{position:absolute;inset:6px}.webgl-canvas{width:100%;height:100%;position:absolute;top:0;left:0}.webgl-gridlines,.webgl-chrome{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.zoom-controls{z-index:2;pointer-events:auto;display:none;position:absolute;top:8px;left:50%;transform:translate(-50%)}.zoom-controls.visible{gap:6px;display:flex}.zoom-reset{background:var(--psp-charts--tooltip--background);color:var(--psp-charts--tooltip--color);border:1px solid var(--psp-charts--tooltip--border-color);font:11px var(--psp-charts--font-family);cursor:pointer;opacity:.7;border-radius:4px;padding:4px 12px;transition:opacity .15s}.zoom-reset:hover{opacity:1}.webgl-tooltip{pointer-events:auto;font:11px var(--psp-charts--font-family);background:var(--psp-charts--tooltip--background);color:var(--psp-charts--tooltip--color);border:1px solid var(--psp-charts--tooltip--border-color);white-space:pre;z-index:10;border-radius:3px;padding:3px;line-height:16px;position:absolute;overflow-y:auto}";var j={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},q={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"expand",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1};var w=class{_element=null;_emit=null;_pointerId=null;_onWheel=null;_onPointerDown=null;_onPointerMove=null;_onPointerUp=null;_onPointerLeave=null;_onClick=null;_onDblClick=null;attach(e,t){this.detach(),this._element=e,this._emit=t,this._onWheel=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;i.preventDefault(),t({type:"wheel",mx:r,my:l,deltaY:i.deltaY})},this._onPointerDown=i=>{if(i.button!==0)return;let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;e.setPointerCapture(i.pointerId),this._pointerId=i.pointerId,t({type:"pointerdown",mx:r,my:l,pointerId:i.pointerId})},this._onPointerMove=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;t({type:"pointermove",mx:r,my:l})},this._onPointerUp=i=>{if(this._pointerId!==null){try{e.releasePointerCapture(this._pointerId)}catch{}this._pointerId=null}t({type:"pointerup"})},this._onPointerLeave=()=>{t({type:"pointerleave"})},this._onClick=i=>{let n=e.getBoundingClientRect();t({type:"click",mx:i.clientX-n.left,my:i.clientY-n.top})},this._onDblClick=i=>{let n=e.getBoundingClientRect();t({type:"dblclick",mx:i.clientX-n.left,my:i.clientY-n.top})},e.addEventListener("wheel",this._onWheel,{passive:!1}),e.addEventListener("pointerdown",this._onPointerDown),e.addEventListener("pointermove",this._onPointerMove),e.addEventListener("pointerup",this._onPointerUp),e.addEventListener("pointerleave",this._onPointerLeave),e.addEventListener("click",this._onClick),e.addEventListener("dblclick",this._onDblClick)}detach(){this._element&&(this._onWheel&&this._element.removeEventListener("wheel",this._onWheel),this._onPointerDown&&this._element.removeEventListener("pointerdown",this._onPointerDown),this._onPointerMove&&this._element.removeEventListener("pointermove",this._onPointerMove),this._onPointerUp&&this._element.removeEventListener("pointerup",this._onPointerUp),this._onPointerLeave&&this._element.removeEventListener("pointerleave",this._onPointerLeave),this._onClick&&this._element.removeEventListener("click",this._onClick),this._onDblClick&&this._element.removeEventListener("dblclick",this._onDblClick)),this._element=null,this._emit=null,this._pointerId=null,this._onPointerLeave=null,this._onClick=null,this._onDblClick=null}};var p=class{selected;row;column_names;removeConfigs;insertConfigs;panel;constructor(e,t,i,n,r,l){this.selected=e,this.row=t,this.column_names=i,this.removeConfigs=n,this.insertConfigs=r,this.panel=l}get removeFilters(){return this.removeConfigs.flatMap(e=>e.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(e=>e.filter??[])}};var ae=["--psp-charts--font-family","font-family","--psp--background-color","--psp-charts--axis-ticks--color","--psp--color","--psp-charts--axis-lines--color","--psp-charts--gridline--color","--psp-charts--gradient--background","--psp-charts--full-gradient--background","--psp-charts--legend--color","--psp-charts--legend-border--color","--psp-charts--tooltip--background","--psp-charts--tooltip--color","--psp-charts--tooltip--border-color","--psp-charts--area--opacity","--psp-charts--heatmap-gap--px","--psp-charts--sunburst-gap--px"];function D(o){let e=getComputedStyle(o),t={};for(let i of ae){let n=e.getPropertyValue(i).trim();n&&(t[i]=n)}for(let i=1;;i++){let n=`--psp-charts--series-${i}--color`,r=e.getPropertyValue(n).trim();if(!r)break;t[n]=r}return t}function Z(){let o=[];for(let e of Array.from(document.styleSheets)){let t;try{t=e.cssRules}catch{continue}let i=e.href??document.baseURI;for(let n of Array.from(t)){if(!(n instanceof CSSFontFaceRule))continue;let r=n.style,l=r.getPropertyValue("font-family").trim(),s=r.getPropertyValue("src").trim();!l||!s||o.push({family:ue(l),src:he(s,i),style:m(r,"font-style"),weight:m(r,"font-weight"),stretch:m(r,"font-stretch"),unicodeRange:m(r,"unicode-range"),variant:m(r,"font-variant"),featureSettings:m(r,"font-feature-settings"),display:m(r,"font-display")})}}return o}function m(o,e){return o.getPropertyValue(e).trim()||void 0}function ue(o){if(o.length>=2){let e=o.charCodeAt(0),t=o.charCodeAt(o.length-1);if(e===t&&(e===34||e===39))return o.slice(1,-1)}return o}function he(o,e){return o.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,(t,i,n)=>{try{return`url(${new URL(n,e).href})`}catch{return t}})}var R=class{_glCanvas;_parent;_div=null;constructor(e,t){this._glCanvas=e,this._parent=t}pin(e,t,i){this.dismiss();let n=document.createElement("div");n.className="webgl-tooltip",n.style.maxHeight=`${Math.round(i.cssHeight*.6)}px`,n.textContent=e.join(`
|
|
2
|
+
`),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),n.style.left="-9999px",n.style.top="0px",this._parent.appendChild(n),this._div=n;let r=n.getBoundingClientRect().width,l=n.getBoundingClientRect().height,s=t.px+12,a=t.py-l-8;s+r>i.cssWidth&&(s=t.px-r-12),s<0&&(s=4),a<0&&(a=t.py+12),a+l>i.cssHeight&&(a=i.cssHeight-l-4),n.style.left=`${s}px`,n.style.top=`${a}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};var d="worker",K="blit";var J='var jr=Object.defineProperty;var Ol=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var Vl=(e,t)=>{for(var n in t)jr(e,n,{get:t[n],enumerable:!0})};var c=(e,t,n)=>Ol(e,typeof t!="symbol"?t+"":t,n);var In,Lo=G(()=>{In="attribute vec2 a_start;attribute vec2 a_end;attribute float a_color_start;attribute float a_color_end;attribute float a_corner;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform vec2 u_color_range;uniform sampler2D u_gradient_lut;varying float v_edge_dist;varying vec3 v_color;float A(float B,float C,float D){if(D<=C){return 0.5;}else if(C<0.&&D>0.){float E=max(-C,D);return clamp(0.5+0.5*(B/E),0.,1.);}return clamp((B-C)/(D-C),0.,1.);}void main(){float C=u_color_range.x;float D=u_color_range.y;float F=0.5*(a_color_start+a_color_end);float G=A(F,C,D);v_color=texture2D(u_gradient_lut,vec2(G,0.5)).rgb;vec4 H=u_projection*vec4(a_start,0.,1.);vec4 I=u_projection*vec4(a_end,0.,1.);vec2 J=H.xy*u_resolution*0.5;vec2 K=I.xy*u_resolution*0.5;vec2 L=K-J;float M=length(L);L=M>0.001?L/M:vec2(1.,0.);vec2 N=vec2(-L.y,L.x);float O=step(1.5,a_corner);float P=1.-mod(a_corner,2.)*2.;vec4 Q=mix(H,I,O);float R=(u_line_width+1.5)*0.5;vec2 S=(N*P*R)/(u_resolution*0.5);gl_Position=Q+vec4(S,0.,0.);v_edge_dist=P;}"});var Dn,To=G(()=>{Dn="precision highp float;uniform float u_line_width;varying float v_edge_dist;varying vec3 v_color;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(v_color,C);}"});var Bn,Ro=G(()=>{Bn="attribute vec2 a_position;attribute float a_color_value;attribute float a_size_value;uniform mat4 u_projection;uniform float u_point_size;uniform vec2 u_color_range;uniform vec2 u_size_range;uniform vec2 u_point_size_range;varying float v_color_t;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);float A=u_size_range.y-u_size_range.x;if(A>0.){float B=clamp((a_size_value-u_size_range.x)/A,0.,1.);gl_PointSize=mix(u_point_size_range.x,u_point_size_range.y,B);}else{gl_PointSize=u_point_size;}v_point_size=gl_PointSize;float C=u_color_range.x;float D=u_color_range.y;if(D<=C){v_color_t=0.5;}else if(C<0.&&D>0.){float E=max(-C,D);v_color_t=clamp(0.5+0.5*(a_color_value/E),0.,1.);}else{v_color_t=clamp((a_color_value-C)/(D-C),0.,1.);}}"});var Pn,wo=G(()=>{Pn="precision highp float;varying float v_color_t;varying float v_point_size;uniform sampler2D u_gradient_lut;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5){discard;}float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);vec4 E=texture2D(u_gradient_lut,vec2(clamp(v_color_t,0.,1.),0.5));gl_FragColor=vec4(E.rgb,E.a*D);}"});var xt,Mo=G(()=>{xt="attribute vec2 a_corner;attribute vec2 a_position;attribute float a_color_value;uniform vec2 u_radius_ndc;uniform mat4 u_projection;uniform vec2 u_color_range;varying vec2 v_uv;varying float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}"});var $n,Fo=G(()=>{$n="precision highp float;uniform float u_intensity;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);float B=max(0.,1.-A);B=B*B*u_intensity;if(B<=0.){discard;}gl_FragColor=vec4(B,B*v_color_t,0.,0.);}"});var jn,So=G(()=>{jn="precision highp float;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);if(A>=1.){discard;}float B=(v_color_t-0.5)*2.;gl_FragColor=vec4(max(0.,B),max(0.,-B),0.,0.);}"});var qr,Zr=G(()=>{qr=`#version 300 es\nin vec2 a_corner;in vec2 a_position;in float a_color_value;uniform mat4 u_projection;uniform vec2 u_radius_ndc;uniform vec2 u_color_range;out vec2 v_uv;out float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}`});var Jr,Kr=G(()=>{Jr=`#version 300 es\nprecision highp float;uniform float u_intensity;in vec2 v_uv;in float v_color_t;layout(location=0)out vec4 A;layout(location=1)out vec4 B;void main(){float C=length(v_uv);float D=max(0.0f,1.0f-C);D=D*D*u_intensity;if(D<=0.0f){discard;}A=vec4(D,D*v_color_t,0.0f,0.0f);float E=(v_color_t-0.5f)*2.0f;B=vec4(max(0.0f,E),max(0.0f,-E),0.0f,0.0f);}`});var Zn,Io=G(()=>{Zn="attribute vec2 a_corner;varying vec2 v_uv;void main(){v_uv=a_corner*0.5+0.5;gl_Position=vec4(a_corner,0.,1.);}"});var qn,Do=G(()=>{qn="precision highp float;uniform sampler2D u_heat;uniform sampler2D u_extreme;uniform sampler2D u_gradient_lut;uniform float u_heat_max;uniform int u_color_mode;varying vec2 v_uv;void main(){vec4 A=texture2D(u_heat,v_uv);float B=A.r;float C=A.g;if(B<=0.){discard;}float D;float E;float F=clamp(B/max(u_heat_max,1e-4),0.,1.);if(u_color_mode==0){D=pow(F,0.6);E=clamp(B,0.,1.);}else if(u_color_mode==2){vec4 G=texture2D(u_extreme,v_uv);float H=G.r;float I=G.g;float J=max(H,I);if(J<=0.){D=0.5;}else if(H>=I){D=clamp(0.5+H*0.5,0.5,1.);}else{D=clamp(0.5-I*0.5,0.,0.5);}E=F;}else if(u_color_mode==3){float K=C-0.5*B;float L=clamp(abs(K)/max(u_heat_max,1e-4),0.,1.);float M=K>=0.?1.:-1.;D=clamp(0.5+0.5*M*L,0.,1.);E=L;}else{D=clamp(C/B,0.,1.);E=F;}vec4 N=texture2D(u_gradient_lut,vec2(D,0.5));gl_FragColor=vec4(N.rgb,N.a*E);}"});var Kn,Bo=G(()=>{Kn="attribute vec2 a_corner;uniform mat4 u_projection;uniform vec2 u_extent_min;uniform vec2 u_extent_max;uniform vec2 u_uv_min;uniform vec2 u_uv_max;varying vec2 v_uv;void main(){vec2 A=mix(u_extent_min,u_extent_max,a_corner);vec2 B=mix(u_uv_min,u_uv_max,vec2(a_corner.x,1.-a_corner.y));v_uv=B;gl_Position=u_projection*vec4(A,0.,1.);}"});var Jn,Po=G(()=>{Jn="precision highp float;varying vec2 v_uv;uniform sampler2D u_tile;uniform float u_alpha;void main(){vec4 A=texture2D(u_tile,v_uv);gl_FragColor=vec4(A.rgb,A.a*u_alpha);}"});function Cu(e,t){if(t.width<=0||t.height<=0)return e;let n=e.xMax-e.xMin,i=e.yMax-e.yMin;if(n<=0||i<=0)return e;let o=t.width/t.height;if(n/i<o){let s=(e.xMin+e.xMax)/2,a=i*o/2;return{xMin:s-a,xMax:s+a,yMin:e.yMin,yMax:e.yMax}}else{let s=(e.yMin+e.yMax)/2,a=n/o/2;return{xMin:e.xMin,xMax:e.xMax,yMin:s-a,yMax:s+a}}}var yt,ei=G(()=>{"use strict";yt=class{constructor(){c(this,"ce",1);c(this,"de",1);c(this,"Se",0);c(this,"Ie",0);c(this,"Tt",0);c(this,"Rt",1);c(this,"wt",0);c(this,"Mt",1);c(this,"Xe",null);c(this,"Lo",!1);c(this,"Ei",!1);c(this,"Gi",!1);c(this,"Ft",null);c(this,"St",null);c(this,"Xn",null);c(this,"Wi",!1);c(this,"ki",0);c(this,"Ni",0);c(this,"$n",null);c(this,"jn",null);c(this,"Zn",null);c(this,"qn",null)}get lockedAxis(){return this.Xe}get scaleX(){return this.ce}get scaleY(){return this.de}set scaleX(t){this.ce=t}set scaleY(t){this.de=t}get normTranslateX(){return this.Se}get normTranslateY(){return this.Ie}set normTranslateX(t){this.Se=t}set normTranslateY(t){this.Ie=t}get baseXRange(){return this.Rt-this.Tt}get baseYRange(){return this.Mt-this.wt}setBaseDomain(t,n,i,o){let r=n-t;if(this.isXDefault()||!this.Ei)this.Tt=t,this.Rt=n;else{let a=this.Rt-this.Tt,l=(this.Tt+this.Rt)/2+this.Se*a;this.Tt=t,this.Rt=n,this.Se=r>0?(l-(t+n)/2)/r:0}let s=o-i;if(this.isYDefault()||!this.Gi)this.wt=i,this.Mt=o;else{let a=this.Mt-this.wt,l=(this.wt+this.Mt)/2+this.Ie*a;this.wt=i,this.Mt=o,this.Ie=s>0?(l-(i+o)/2)/s:0}}pinAxis(t){t==="x"?this.Ei=!0:this.Gi=!0}unpinAxis(t){t==="x"?this.Ei=!1:this.Gi=!1}configure(t){this.Xe=t.lockAxis??null,this.Lo=t.lockAspect??!1,this.Xe==="x"?(this.ce=1,this.Se=0):this.Xe==="y"&&(this.de=1,this.Ie=0)}isXDefault(){return this.ce===1&&this.Se===0}isYDefault(){return this.de===1&&this.Ie===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.Rt-this.Tt,n=this.Mt-this.wt,i=t/this.ce,o=n/this.de,r=(this.Tt+this.Rt)/2+this.Se*t,s=(this.wt+this.Mt)/2+this.Ie*n,a={xMin:r-i/2,xMax:r+i/2,yMin:s-o/2,yMax:s+o/2};return this.Lo&&this.St?Cu(a,this.St.e):a}attach(t,n,i){this.detach(),this.Ft=t,this.St=n,this.Xn=i,this.$n=o=>{o.preventDefault();let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.St.e;if(s<l.x||s>l.x+l.width||a<l.y||a>l.y+l.height)return;let u=(s-l.x)/l.width,m=(a-l.y)/l.height,f=this.ce,p=this.de,d=Math.pow(1.1,-o.deltaY/100);this.Xe!=="x"&&(this.ce=Math.max(1,Math.min(1e5,this.ce*d))),this.Xe!=="y"&&(this.de=Math.max(1,Math.min(1e5,this.de*d))),this.Xe!=="x"&&f!==this.ce&&(this.Se+=(u-.5)*(1/f-1/this.ce)),this.Xe!=="y"&&p!==this.de&&(this.Ie+=(.5-m)*(1/p-1/this.de)),this.Xn()},this.jn=o=>{if(o.button!==0)return;let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.St.e;s>=l.x&&s<=l.x+l.width&&a>=l.y&&a<=l.y+l.height&&(this.Wi=!0,this.ki=o.clientX,this.Ni=o.clientY,t.setPointerCapture(o.pointerId))},this.Zn=o=>{if(!this.Wi)return;let r=o.clientX-this.ki,s=o.clientY-this.Ni;this.ki=o.clientX,this.Ni=o.clientY;let a=this.St.e;this.Xe!=="x"&&a.width>0&&(this.Se-=r/(a.width*this.ce)),this.Xe!=="y"&&a.height>0&&(this.Ie+=s/(a.height*this.de)),this.Xn()},this.qn=()=>{this.Wi=!1},t.addEventListener("wheel",this.$n,{passive:!1}),t.addEventListener("pointerdown",this.jn),t.addEventListener("pointermove",this.Zn),t.addEventListener("pointerup",this.qn)}updateLayout(t){this.St=t}detach(){this.Ft&&(this.$n&&this.Ft.removeEventListener("wheel",this.$n),this.jn&&this.Ft.removeEventListener("pointerdown",this.jn),this.Zn&&this.Ft.removeEventListener("pointermove",this.Zn),this.qn&&this.Ft.removeEventListener("pointerup",this.qn)),this.Ft=null,this.Xn=null}reset(){this.ce=1,this.de=1,this.Se=0,this.Ie=0}serialize(){return{scaleX:this.ce,scaleY:this.de,normTranslateX:this.Se,normTranslateY:this.Ie}}restore(t){this.ce=t.scaleX,this.de=t.scaleY,this.Se=t.normTranslateX,this.Ie=t.normTranslateY}}});function Go(e,t){let n=t??_u[e]??{};return new Intl.NumberFormat(navigator.languages,n)}function Wo(e){if(!e||e.format!=="custom"){let n={timeZone:e?.timeZone,dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??is.dateStyle,timeStyle:e?.timeStyle==="disabled"?void 0:e?.timeStyle??is.timeStyle};return new Intl.DateTimeFormat(navigator.languages,n)}let t={timeZone:e.timeZone,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(t.year=e.year??"2-digit"),e.month!=="disabled"&&(t.month=e.month??"numeric"),e.day!=="disabled"&&(t.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(t.weekday=e.weekday),e.hour!=="disabled"&&(t.hour=e.hour??"numeric"),e.minute!=="disabled"&&(t.minute=e.minute??"numeric"),e.second!=="disabled"&&(t.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,t)}function os(e){let t={timeZone:"utc",dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??vu.dateStyle};return new Intl.DateTimeFormat(navigator.languages,t)}function ko(e){return e.split("|").at(-1)??e}var _u,is,vu,rs=G(()=>{"use strict";_u={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},is={dateStyle:"short",timeStyle:"medium"},vu={dateStyle:"short"}});var ni,ss=G(()=>{"use strict";ni=class{constructor(t,n=128){c(this,"$t");c(this,"d",new Map);c(this,"Ae",new Map);c(this,"To");this.$t=t,this.To=n}async fetchRow(t){if(!this.$t)throw new Error("LazyRowFetcher disposed");let n=this.d.get(t);if(n)return this.d.delete(t),this.d.set(t,n),n;let i=this.Ae.get(t);if(i)return i;let o=this.tr(t);this.Ae.set(t,o);try{let r=await o;if(!this.$t)return r;if(this.d.set(t,r),this.d.size>this.To){let s=this.d.keys().next().value;s!==void 0&&this.d.delete(s)}return r}finally{this.Ae.delete(t)}}async tr(t){let n=this.$t;if(!n)throw new Error("LazyRowFetcher disposed");let i=new Map;return await n.with_typed_arrays({start_row:t,end_row:t+1,float32:!0},(o,r,s,a)=>{for(let l=0;l<o.length;l++){let u=o[l];if(u.startsWith("__"))continue;let m=r[l],f=s[l],p=a[l];(f?!(f[0]>>0&1):!1)?i.set(u,null):p?i.set(u,p[m[0]]):i.set(u,m[0])}}),i}dispose(){this.$t=null,this.d.clear(),this.Ae.clear()}get isDisposed(){return this.$t===null}}});function as(e,t){let n=Math.floor(Math.log10(e)),i=e/Math.pow(10,n),o;return t?i<1.5?o=1:i<3?o=2:i<7?o=5:o=10:i<=1?o=1:i<=2?o=2:i<=5?o=5:o=10,o*Math.pow(10,n)}function oe(e,t,n){n<1&&(n=1);let i=as(t-e,!1),o=as(i/n,!0),r=Math.ceil(e/o)*o,s=Math.floor(t/o)*o,a=[];for(let l=r;l<=s+o*.001;l+=o)a.push(l);return a}function me(e){if(!Number.isFinite(e))return"-";let t=Math.abs(e);return t===0?"0":t>=1e9?(e/1e9).toFixed(1)+"B":t>=1e6?(e/1e6).toFixed(1)+"M":t>=1e3?(e/1e3).toFixed(1)+"K":Number.isInteger(e)?e.toString():t>=1?e.toFixed(1):e.toFixed(2)}function ye(e,t){let n=new Date(e);return isNaN(n.getTime())?me(e):t!==void 0&&t>0?t>=864e5*28?n.toLocaleDateString(void 0,{year:"numeric",month:"short"}):t>=864e5?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t>=36e5?n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric"}):t>=6e4?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var Ae=G(()=>{"use strict"});var ls,us,ms=G(()=>{"use strict";ls={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},us={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"expand",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1}});function Pe(e,t,n,i,o,r,s={}){if(!e)return;let a=e.getContext("2d");if(!a)return;a.save(),a.setTransform(1,0,0,1,0,0),a.scale(r,r),a.font=`11px ${o.fontFamily}`;let l=16,u=8,m=0;for(let h of n){let g=a.measureText(h).width;g>m&&(m=g)}let f=m+u*2,p=n.length*l+u*2-4,d=t.px+12,b=t.py-p-8;d+f>i.cssWidth&&(d=t.px-f-12),b<0&&(b=t.py+12),b+p>i.cssHeight&&(b=i.cssHeight-p-4);let x=n.length>0;if(s.crosshair&&(a.strokeStyle=o.It,a.globalAlpha=.3,a.lineWidth=1,a.setLineDash([4,4]),a.beginPath(),a.moveTo(t.px,i.e.y),a.lineTo(t.px,i.e.y+i.e.height),a.moveTo(i.e.x,t.py),a.lineTo(i.e.x+i.e.width,t.py),a.stroke(),a.setLineDash([]),a.globalAlpha=1),s.highlightRadius&&s.highlightRadius>0&&(a.strokeStyle=o.It,a.globalAlpha=.8,a.lineWidth=2,a.beginPath(),a.arc(t.px,t.py,s.highlightRadius,0,Math.PI*2),a.stroke(),a.globalAlpha=1),x){a.fillStyle=o.Kn,a.strokeStyle=o.Ro,a.lineWidth=1,a.beginPath(),a.roundRect(d,b,f,p,4),a.fill(),a.stroke(),a.fillStyle=o.wo,a.textAlign="left",a.textBaseline="top";for(let h=0;h<n.length;h++)a.fillText(n[h],d+u,b+u+h*l)}a.restore()}var ii,Ct=G(()=>{"use strict";ii=class{constructor(){c(this,"We",null);c(this,"jt",0);c(this,"Zt",null);c(this,"ln",null);c(this,"gt",!1)}get isPinned(){return this.gt}setHost(t){this.gt&&(this.ln?.dismiss(),this.gt=!1),this.ln=t}setCursor(t){this.ln?.setCursor(t)}attach(t){this.detach(),this.We=t}detach(){this.jt&&(cancelAnimationFrame(this.jt),this.jt=0),this.Zt!==null&&(clearTimeout(this.Zt),this.Zt=null),this.We=null}dispatchHover(t,n){if(this.gt||!this.We||this.jt||this.Zt!==null)return;let i=()=>{this.jt=0,this.Zt=null,this.We?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.jt=requestAnimationFrame(i):this.Zt=setTimeout(i,16)}dispatchLeave(){this.gt||!this.We||this.We.onLeave()}dispatchClick(t,n){if(this.We&&!this.We.onClickPre?.(t,n)){if(this.gt){let i=this.We;this.dismiss(),i.onUnpin?.();return}this.We.onPin?.(t,n)}}dispatchDblClick(t,n){this.We?.onDblClick?.(t,n)}pin(t,n,i){t.length!==0&&(this.ln?.pin(t,n,i),this.gt=!0)}dismiss(){this.ln?.dismiss(),this.gt=!1}}});function oi(e){let t=e.trim();if(t.startsWith("#")){let i=t.slice(1);return i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let n=t.match(/rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)/);return n?[+n[1]/255,+n[2]/255,+n[3]/255]:[.5,.5,.5]}var No=G(()=>{"use strict"});function fs(e){if(!e)return ot.slice();let t=e.trim();if(!t)return ot.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return ot.slice();let i=t.lastIndexOf(")");if(i<=n)return ot.slice();let o=t.substring(n+1,i),r=[],s=0,a=0;for(let p=0;p<o.length;p++){let d=o[p];d==="("?s++:d===")"?s--:d===","&&s===0&&(r.push(o.substring(a,p)),a=p+1)}r.push(o.substring(a));let l=[],u=0;if(r.length>0){let p=r[0].trim().toLowerCase();(p.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(p))&&(u=1)}for(let p=u;p<r.length;p++){let d=r[p].trim();if(!d)continue;let b=d.match(/\\s([\\-\\d.]+)%\\s*$/),x=b?d.substring(0,b.index).trim():d,h=b?parseFloat(b[1])/100:null;try{let g=oi(x);l.push({color:g,offset:h})}catch{}}if(l.length===0)return ot.slice();if(l.length===1){let[p,d,b]=l[0].color;return[{offset:0,color:[p,d,b,1]},{offset:1,color:[p,d,b,1]}]}l[0].offset===null&&(l[0].offset=0),l[l.length-1].offset===null&&(l[l.length-1].offset=1);for(let p=1;p<l.length-1;p++){if(l[p].offset!==null)continue;let d=p+1;for(;d<l.length&&l[d].offset===null;)d++;let b=l[p-1].offset,x=l[d].offset,h=d-(p-1);for(let g=p;g<d;g++)l[g].offset=b+(g-(p-1))/h*(x-b);p=d-1}let m=0;return l.map(p=>{let d=Math.max(m,Math.min(1,p.offset));return m=d,{offset:d,color:[p.color[0],p.color[1],p.color[2],1]}})}function Le(e,t){if(e.length===0)return[0,0,0,1];if(t<=e[0].offset)return e[0].color.slice();let n=e[e.length-1];if(t>=n.offset)return n.color.slice();let i=0,o=e.length-1;for(;o-i>1;){let u=i+o>>1;e[u].offset<=t?i=u:o=u}let r=e[i],s=e[o],a=s.offset-r.offset,l=a>0?(t-r.offset)/a:0;return[r.color[0]+(s.color[0]-r.color[0])*l,r.color[1]+(s.color[1]-r.color[1])*l,r.color[2]+(s.color[2]-r.color[2])*l,r.color[3]+(s.color[3]-r.color[3])*l]}function rt(e,t,n){if(!isFinite(e)||t===n)return .5;let i;if(t>=0?i=n:n<=0?i=-t:i=Math.max(-t,n),i<=0)return .5;let o=.5+.5*(e/i);return o<0?0:o>1?1:o}function cs(e){if(e.length===0)return ot.slice();if(e.length===1){let[n,i,o]=e[0];return[{offset:0,color:[n,i,o,1]},{offset:1,color:[n,i,o,1]}]}let t=e.length-1;return e.map(([n,i,o],r)=>({offset:r/t,color:[n,i,o,1]}))}function ds(e,t=256){let n=new Uint8Array(t*4);for(let i=0;i<t;i++){let o=t===1?0:i/(t-1),r=Le(e,o);n[i*4]=Math.round(r[0]*255),n[i*4+1]=Math.round(r[1]*255),n[i*4+2]=Math.round(r[2]*255),n[i*4+3]=Math.round(r[3]*255)}return n}var ot,Ee=G(()=>{"use strict";No();ot=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function Au(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function ps(e){return!isFinite(e)||e<0?1:e}function bs(e){let t=(r,s)=>e[r]||s,n=e["--psp-charts--gradient--background"]||e["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",i=fs(n),o=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;o.push(oi(s))}return{fontFamily:t("--psp-charts--font-family",t("font-family","monospace")),backgroundColor:t("--psp--background-color","rgba(255, 255, 255, 1)"),It:t("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),Le:t("--psp--color","rgba(180, 0, 0, 0.9)"),Jn:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),un:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),H:i,mn:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),nr:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),Kn:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),wo:t("--psp-charts--tooltip--color","#161616"),Ro:t("--psp-charts--tooltip--border-color","#fff"),Qn:Au(parseFloat(t("--psp-charts--area--opacity","0.85"))),Mo:ps(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),Fo:ps(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),ke:o}}var gs=G(()=>{"use strict";No();Ee()});function xs(e,t,n){let i=st.get(e);i?(i.fullRender=t,i.render2D=n):(i={glManager:e,fullRender:t,render2D:n,waiters:[]},st.set(e,i));let o=Promise.withResolvers();return i.waiters.push(o),ri||(ri=vs(_s)),o.promise}function ys(e,t){if(!si.has(e)){t();return}let n=Kt.get(e);n||(n=[],Kt.set(e,n)),n.push(t)}function Cs(e){let t=st.get(e);if(t){st.delete(e);for(let n of t.waiters)n.resolve()}Kt.delete(e),si.delete(e)}async function _s(){let e=Array.from(st.values());st.clear();let t=new Map;for(let n of e){if(n.glManager.isContextLost()){for(let r of n.waiters)r.resolve();continue}let i=n.glManager.backendId,o=t.get(i);o?o.push(n):t.set(i,[n])}await Promise.all(Array.from(t.values()).map(Lu)),ri=0,st.size>0&&(ri=vs(_s))}async function Lu(e){for(let t of e)await Tu(t)}async function Tu(e){si.add(e.glManager);try{e.glManager.beginFrame(),e.fullRender()}catch(t){console.error("scheduler: fullRender threw",t);for(let n of e.waiters)n.reject(t);hs(e.glManager);return}try{await e.glManager.awaitGpuFence(),e.render2D(),e.glManager.endFrame();for(let t of e.waiters)t.resolve()}catch(t){console.error("scheduler: present failed",t);try{e.glManager.endFrame()}catch{}for(let n of e.waiters)n.reject(t)}finally{hs(e.glManager)}}function hs(e){si.delete(e);let t=Kt.get(e);if(t){Kt.delete(e);for(let n of t)try{n()}catch(i){console.error("scheduler: deferred op threw",i)}}}function vs(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var st,ri,si,Kt,Uo=G(()=>{"use strict";st=new Map,ri=0,si=new Set,Kt=new Map});var As,Ru,wu,Te,Jt=G(()=>{"use strict";rs();ss();Ae();ei();ms();Ct();gs();Uo();As=!0,Ru=(()=>{if(As)return me;{let e=Go("float");return t=>e.format(t)}})(),wu=(()=>{if(As)return ye;{let e=Wo();return t=>e.format(t)}})(),Te=class{constructor(){c(this,"t",null);c(this,"j",null);c(this,"c",null);c(this,"fn",[]);c(this,"So",{});c(this,"g",null);c(this,"cn",[]);c(this,"I",[]);c(this,"_",[]);c(this,"B",[]);c(this,"Ne",{});c(this,"ei",!1);c(this,"ti",!1);c(this,"ht",{});c(this,"Ui",{});c(this,"Oi",new Map);c(this,"ni");c(this,"G",{...ls});c(this,"h",{...us});c(this,"T",new ii);c(this,"Vi",null);c(this,"ii",Promise.resolve());c(this,"dn",null);c(this,"De",null)}setGridlineCanvas(t){this.j=t}setChromeCanvas(t){this.c=t}setTheme(t){this.So=t,this.dn=null}setZoomController(t){this.g=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.G.zoom_mode==="shared")return this.g;if(!this.g)return null;let n=this.cn[t];return n||(n=new yt,n.configure(this.getZoomConfig()),this.cn[t]=n),n}computeEffectiveFacetFlags(){let t=this.G.zoom_mode==="independent",n=!t&&this.G.shared_x_axis,i=!t&&this.G.shared_y_axis;return this.ei=n,this.ti=i,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:i}}syncFacetZoomLayouts(t){let n=this.G.zoom_mode==="independent";for(let i=0;i<t.length;i++)if(this.getZoomControllerForFacet(i)?.updateLayout(t[i].layout),!n)return}setZoomBaseDomain(t,n,i,o){this.g&&this.g.setBaseDomain(t,n,i,o);for(let r of this.cn)r&&r.setBaseDomain(t,n,i,o)}getZoomConfig(){return{}}setColumnSlots(t){this.I=t}setViewPivots(t,n){this._=t,this.B=n}setColumnTypes(t){this.Ne=t,this.Io()}resetExpandedDomain(){}setGroupByTypes(t){this.ht=t}setColumnsConfig(t){this.Ui=t??{},this.Io()}Io(){this.Oi=new Map;for(let[t,n]of Object.entries(this.Ui)){let i=this.Ne[t]??this.ht[t],o=this.ir(i,n);o&&this.Oi.set(t,o)}}ir(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let i=n.number_format;if(!i)return;let o=Go(t,i);return r=>o.format(r)}if(t==="datetime"){let i=n.date_format;if(!i)return;let o=Wo(i);return r=>o.format(r)}if(t==="date"){let i=n.date_format;if(!i)return;let o=os(i);return r=>o.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.Oi.get(ko(t));if(r)return r}if(n==="tick")return;let i=t?ko(t):void 0,o=i?this.Ne[i]??this.ht[i]:void 0;return o==="date"||o==="datetime"?wu:Ru}setDefaultChartType(t){this.ni=t}setFacetConfig(t){this.G={...t}}setPluginConfig(t){this.h={...t},this.G={...this.G,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.oi=t.series_zoom_mode==="dynamic"}A(){return this.dn||(this.dn=bs(this.So)),this.dn}invalidateTheme(){this.dn=null}setView(t){this.De&&this.De.dispose(),this.De=new ni(t);let n=this.T.isPinned;this.T.dismiss(),n&&this.emitUnselect()}deselect(){this.T.dismiss()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this.T.attach(this.tooltipCallbacks()),this.T.setHost(t),this.Vi=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.De)try{let o=await this.De.fetchRow(t.rowIdx);n=Object.fromEntries(o)}catch{n={}}let i=[];for(let o=0;o<this._.length;o++){let r=t.groupByValues[o];r!=null&&r!==""&&i.push([this._[o],"==",r])}for(let o=0;o<this.B.length;o++){let r=t.splitByValues[o];r!=null&&r!==""&&i.push([this.B[o],"==",r])}return{row:n,column_names:[t.columnName],config:{filter:i}}}emitUserClick(t){let n={row:t.row,column_names:t.column_names,config:t.config};this.Vi?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.Vi?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this.ii.then(async()=>{let i=await this.buildClickDetail(t);this.emitUserClick(i),this.emitUserSelect({selected:!0,row:i.row,column_names:i.column_names,insertConfig:i.config})});return this.ii=n.catch(i=>{console.error("emitClickAndSelect failed",i)}),n}emitUnselect(t={}){let n=this.ii.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this.ii=n.catch(i=>{console.error("emitUnselect failed",i)})}requestRender(t){return xs(t,()=>{this.fn=[],this.Dt(t)},()=>this.Do())}pe(t){this.fn.push(t)}Do(){let t=this.fn;this.fn=[];for(let n of t)n()}renderFrameSync(t){this.fn=[],this.Dt(t),this.Do()}destroy(){this.T.detach(),this.T.dismiss(),this.De&&(this.De.dispose(),this.De=null),this.destroyInternal()}}});var ai,Ls=G(()=>{"use strict";ai=class{constructor(t,n,i,o,r){c(this,"Qe",new Map);c(this,"be");c(this,"Te");c(this,"Bt");c(this,"Bo");this.be=t,this.Te=i,this.Bt=r,this.Bo=Math.max(1,Math.ceil((n-t)/r))}Po(t,n){return n*this.Bo+t}insert(t,n,i){let o=Math.floor((n-this.be)/this.Bt),r=Math.floor((i-this.Te)/this.Bt),s=this.Po(o,r),a=this.Qe.get(s);a||(a=[],this.Qe.set(s,a)),a.push(t)}query(t,n,i,o,r,s,a){let l=Math.ceil(i/o/this.Bt),u=Math.ceil(i/r/this.Bt),m=Math.floor((t-this.be)/this.Bt),f=Math.floor((n-this.Te)/this.Bt),p=-1,d=i*i;for(let b=f-u;b<=f+u;b++)for(let x=m-l;x<=m+l;x++){let h=this.Qe.get(this.Po(x,b));if(h)for(let g of h){let y=(s[g]-t)*o,_=(a[g]-n)*r,C=y*y+_*_;C<d&&(d=C,p=g)}}return p}}});var li,Ts=G(()=>{"use strict";Ls();li=class{constructor(){c(this,"pn",null);c(this,"bn",!0)}markDirty(){this.bn=!0}get isDirty(){return this.bn}rebuild(t,n,i){if(n===0){this.pn=null,this.bn=!1;return}let o=t.xMax-t.xMin||1,r=t.yMax-t.yMin||1,a=(o+r)/2/Math.max(1,Math.sqrt(n)),l=new ai(t.xMin,t.xMax,t.yMin,t.yMax,a);i((u,m,f)=>l.insert(u,m,f)),this.pn=l,this.bn=!1}query(t,n,i,o,r,s,a){return!this.pn||!s||!a?-1:this.pn.query(t,n,i,o,r,s,a)}clear(){this.pn=null,this.bn=!0}}});function He(e,t,n=[]){let i=new Map;for(let r of e.keys()){if(r.startsWith("__"))continue;let s=r.lastIndexOf("|");if(s===-1)continue;let a=r.substring(0,s);i.has(a)||i.set(a,new Set),i.get(a).add(r)}let o=[];for(let[r,s]of i){let a=new Map,l=!0;for(let u of t){if(!u)continue;let m=`${r}|${u}`,f=e.get(m);if(!s.has(m)||!f?.values){l=!1;break}a.set(u,m)}if(l){for(let u of n){if(!u)continue;let m=`${r}|${u}`;s.has(m)&&e.get(m)?.values&&a.set(u,m)}o.push({prefix:r,colNames:a})}}return o}var Qt=G(()=>{"use strict"});var ui,Rs=G(()=>{"use strict";ui=class{constructor(t){c(this,"data");c(this,"dictionary",[]);c(this,"dictMap",new Map);this.data=new Int32Array(t),this.data.fill(-1)}set(t,n){let i=this.dictMap.get(n);return i===void 0&&(i=this.dictionary.length,this.dictionary.push(n),this.dictMap.set(n,i)),this.data[t]=i,i}get(t){let n=this.data[t];return n<0?null:this.dictionary[n]}}});function ws(e,t,n,i){let o;if(!e)o="(null)";else{let s=e.valid;if(!(s?!!(s[t>>3]>>(t&7)&1):!0))o="(null)";else if(e.indices&&e.dictionary)o=e.dictionary[e.indices[t]]??"(null)";else if(e.values){let l=e.values[t];o=l==null?"(null)":String(l)}else o="(null)"}let r=i.get(o);return r===void 0&&(r=n.length,n.push(o),i.set(o,r)),r}function Mu(e,t,n,i,o,r){let s=t?[t,n]:[n],a=[];return i&&a.push(i),o&&a.push(o),r&&a.push(r),He(e,s,a).map(l=>({prefix:l.prefix,xColName:t?l.colNames.get(t):"",yColName:l.colNames.get(n),colorColName:i?`${l.prefix}|${i}`:"",sizeColName:o?`${l.prefix}|${o}`:"",labelColName:r?`${l.prefix}|${r}`:""}))}function Ms(e,t,n,i){e.glyph.ensureProgram(e,t);let o=e.a,r=e.Z;e.h.domain_mode==="expand"?(e.be=e.gn,e.et=e.hn,e.Te=e.xn,e.tt=e.yn,e.b=e.ri,e.p=e.si,e.nt=e.ai,e.it=e.li):(e.be=1/0,e.et=-1/0,e.Te=1/0,e.tt=-1/0,e.b=1/0,e.p=-1/0,e.nt=1/0,e.it=-1/0,e.gn=1/0,e.hn=-1/0,e.xn=1/0,e.yn=-1/0,e.ri=1/0,e.si=-1/0,e.ai=1/0,e.li=-1/0),e.w=NaN,e.M=NaN,e.xt=0,e.qt.clear(),e.Hi=0;let a=e.I,l=a[0]||"",u=a[1]||"",m=a[2]||"",f=a[3]||"",p=a[4]||"";e.Ue=l,e.Be=u,e.Eo=!l,e.Pe=!!l&&e.Ne[l]==="string",e.ge=!!u&&e.Ne[u]==="string",e.Kt=[],e.Jt=[],e.Go=new Map,e.Wo=new Map,e.ot=null,e.rt=null,e.Pe&&(e.w=0,e.be=0,e.et=0,e.gn=1/0,e.hn=-1/0),e.ge&&(e.M=0,e.Te=0,e.tt=0,e.xn=1/0,e.yn=-1/0);let d=t.v.totalCapacity||i;if(e.B.length>0){if(e.L=Mu(n,l,u,m,f,p),e.L.length===0){e.R=0,e.U=[];return}if(e.$e=e.L[0].xColName,e.Oe=e.L[0].yColName,e.a=m,e.ne=f,e.ui=p,e.Z=!1,m){let h=n.get(e.L[0].colorColName);e.Z=h?.type==="string"}t.ensureBufferCapacity(d*e.L.length)}else if(e.L=[],e.$e=l,e.Oe=u,e.a=m,e.ne=f,e.ui=p,e.Z=!1,e.a){let h=n.get(e.a);e.Z=h?.type==="string"}(e.a!==o||e.Z!==r)&&(e.f=new Map);let b=Math.max(1,e.L.length);e.R=d,e.U=new Array(b).fill(0);let x=b*d;e.O=new Float32Array(x),e.V=new Float32Array(x),e.yt=new Float32Array(x),e.Pt=new Int32Array(x),e.Et=p?new ui(x):null}function Fs(e,t,n,i,o,r){if(!e.Oe)return;let s=o;if(s===0||e.R===0)return;let a=e.L.length>0,l=[];if(a)for(let b of e.L){let x=b.xColName?n.get(b.xColName):null,h=n.get(b.yColName);if(!h||!e.ge&&!h.values)continue;let g=b.sizeColName?n.get(b.sizeColName):null,y=b.colorColName?n.get(b.colorColName)??null:null,_=b.labelColName?n.get(b.labelColName)??null:null;l.push({xCol:x?.values??null,yCol:h.values??null,xColData:x??null,yColData:h,xValid:x?.valid,yValid:h.valid,colorCol:y,sizeCol:g?.values??null,labelCol:_})}else{let b=e.$e?n.get(e.$e):null,x=e.Oe?n.get(e.Oe):null;if(!x||!e.ge&&!x.values)return;let h=e.a?n.get(e.a)??null:null,g=e.ui?n.get(e.ui)??null:null;l.push({xCol:b?.values??null,yCol:x.values??null,xColData:b??null,yColData:x,xValid:b?.valid,yValid:x?.valid,colorCol:h,sizeCol:null,labelCol:g})}if(l.length===0)return;e.ko<s&&(e.Yi=new Float32Array(s*2),e.zi=new Float32Array(s),e.Xi=new Float32Array(s),e.ko=s);let u=e.Yi,m=e.zi,f=e.Xi,p=!a&&e.ne?n.get(e.ne)?.values??null:null;if(e.Z&&e.a){for(let b of l){let x=b.colorCol?.dictionary;if(x)for(let h=0;h<x.length;h++){let g=x[h];e.f.has(g)||e.f.set(g,e.f.size)}}e.f.size>0&&(e.b=0,e.p=e.f.size-1)}!e.a&&e.L.length>1&&(e.b=0,e.p=e.L.length-1);for(let b=0;b<l.length;b++){let x=l[b],h=e.U[b]??0,g=b*e.R,y=e.R-h;if(y<=0)continue;let _=x.colorCol?.valid,C=0;for(let T=0;T<s&&C<y;T++){let L=T;if(!e.ge&&x.yValid&&!(x.yValid[L>>3]>>(L&7)&1)||!e.Pe&&x.xCol&&x.xValid&&!(x.xValid[L>>3]>>(L&7)&1))continue;let R=_!==void 0&&!(_[L>>3]>>(L&7)&1),F;if(e.ge)F=ws(x.yColData,L,e.Jt,e.Wo);else if(x.yCol){if(F=x.yCol[L],isNaN(F))continue}else continue;let I;if(e.Pe)I=ws(x.xColData,L,e.Kt,e.Go);else if(x.xCol){if(I=x.xCol[L],isNaN(I))continue}else I=i+L;let[S,D]=e.projectPoint(I,F);if(isNaN(S)||isNaN(D))continue;S<e.be&&(e.be=S),S>e.et&&(e.et=S),D<e.Te&&(e.Te=D),D>e.tt&&(e.tt=D),isNaN(e.w)&&(e.w=S),isNaN(e.M)&&(e.M=D);let B=S-e.w,N=D-e.M,k=g+h+C;e.O[k]=B,e.V[k]=N,e.Pt[k]=i+L,u[C*2]=B,u[C*2+1]=N;let Y=x.colorCol;if(R)m[C]=.5,e.yt[k]=.5;else if(Y&&!e.Z&&Y.values){let W=Y.values[L];m[C]=W,e.yt[k]=W,W<e.b&&(e.b=W),W>e.p&&(e.p=W)}else if(Y&&e.Z&&Y.indices&&Y.dictionary){let W=Y.dictionary[Y.indices[L]];e.f.has(W)||(e.f.set(W,e.f.size),e.p=e.f.size-1);let V=e.f.get(W);m[C]=V,e.yt[k]=V}else m[C]=b,e.yt[k]=b;if(e.Et&&x.labelCol){let W=x.labelCol,V=W.valid;!(V!==void 0&&!(V[L>>3]>>(L&7)&1))&&W.indices&&W.dictionary&&e.Et.set(k,W.dictionary[W.indices[L]])}if(x.sizeCol){let W=x.sizeCol[L];f[C]=W,W<e.nt&&(e.nt=W),W>e.it&&(e.it=W)}else if(p){let W=p[L];f[C]=W,W<e.nt&&(e.nt=W),W>e.it&&(e.it=W)}else f[C]=0;C++}if(C===0)continue;let v=(g+h)*2*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_position",u.subarray(0,C*2),v,2);let A=(g+h)*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_color_value",m.subarray(0,C),A),t.v.upload("a_size_value",f.subarray(0,C),A),e.U[b]=h+C,e.U[b]>e.Hi&&(e.Hi=e.U[b])}let d=0;for(let b of e.U)d+=b;e.xt=d,t.uploadedCount=d,e.qt.markDirty(),isFinite(e.be)&&e.setZoomBaseDomain(e.be,e.et,e.Te,e.tt)}var Ss=G(()=>{"use strict";Qt();Rs()});function _t(e,t,n,i,o){let r=e.getContext("2d");r&&(r.save(),r.setTransform(1,0,0,1,0,0),r.scale(o,o),r.font=`11px ${i.fontFamily}`,r.fillStyle=i.Le,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var mi=G(()=>{"use strict"});var ne,Ye=G(()=>{"use strict";ne=class{constructor(t,n,i){c(this,"margins");c(this,"e");c(this,"cssWidth");c(this,"cssHeight");c(this,"Y",0);c(this,"J",1);c(this,"q",0);c(this,"Q",1);this.cssWidth=t,this.cssHeight=n;let r=(i.leftExtra??55)+(i.hasYLabel?16:0),a=(i.bottomExtra??24)+(i.hasXLabel?18:0),l=0,u=i.rightExtra??(i.hasLegend?80:16),m=i.originX??0,f=i.originY??0,p=i.cellWidth??t,d=i.cellHeight??n,b=m+r,x=f+l,h=Math.max(1,p-r-u),g=Math.max(1,d-l-a),y=t-(b+h),_=n-(x+g);this.margins={top:x,right:y,bottom:_,left:b},this.e={x:b,y:x,width:h,height:g}}buildProjectionMatrix(t,n,i,o,r,s,a=.02,l=0,u=0){let m=n-t,f=o-i;m===0&&(m=1),f===0&&(f=1);let p=m*a,d=f*a,b=s&&r==="y"&&i>=0,x=s&&r==="y"&&o<=0,h=s&&r==="x"&&t>=0,g=s&&r==="x"&&n<=0;t-=p,n+=p,i-=d,o+=d,b?(i=0,o+=d):x&&(o=0,i-=d),h?(t=0,n+=p):g&&(n=0,t-=p),this.Y=t,this.J=n,this.q=i,this.Q=o;let y=2*this.margins.left/this.cssWidth-1,_=1-2*this.margins.right/this.cssWidth,C=2*this.margins.bottom/this.cssHeight-1,v=1-2*this.margins.top/this.cssHeight,A=(_-y)/(n-t),T=(v-C)/(o-i),L=y-A*(t-l),R=C-T*(i-u);return new Float32Array([A,0,0,0,0,T,0,0,0,0,-1,0,L,R,0,1])}P(t,n){let{x:i,y:o,width:r,height:s}=this.e,a=(t-this.Y)/(this.J-this.Y),l=(n-this.q)/(this.Q-this.q);return{px:i+a*r,py:o+(1-l)*s}}}});function en(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function tn(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function Eu(e,t,n,i){if(e<=1)return{cols:1,rows:1};let o=1,r=e,s=1/0,a=e;for(let l=1;l<=e;l++){let u=Math.ceil(e/l),m=Math.max(1,(t-(l-1)*i)/l),f=Math.max(1,(n-(u-1)*i)/u),p=m/f,d=Math.max(p,1/p),b=l*u;(d<s||d===s&&b<a)&&(o=l,r=u,s=d,a=b)}return{cols:o,rows:r}}function Re(e,t){let n=e.length,{cssWidth:i,cssHeight:o}=t;if(n<=0||i<=0||o<=0)return{cells:[]};let r=t.titleBand??Bu,s=t.hasLegend?Pu:0,a=t.xAxis??"cell",l=t.yAxis??"cell",u=a==="none"&&l==="none",m=l==="outer"?Fu+(t.hasYLabel?Iu:0):0,f=a==="outer"?Su+(t.hasXLabel?Du:0):0,p=0,d=s,b=m,x=p,h=Math.max(1,i-m-d),g=Math.max(1,o-p-f),y=Math.max(0,t.gap??0),{cols:_,rows:C}=Eu(n,h,g,y),v=Math.max(0,_-1)*y,A=Math.max(0,C-1)*y,T=Math.max(1,(h-v)/_),L=Math.max(1,(g-A)/C),R=[];for(let D=0;D<n;D++){let B=Math.floor(D/_),N=D-B*_,k=B===C-1||D+_>=n,Y=N===0,W=b+N*(T+y),V=x+B*(L+y),O=V+r,X=W,q=T,le=Math.max(1,L-r),Fe=new ne(i,o,{hasXLabel:a==="cell"&&t.hasXLabel===!0,hasYLabel:l==="cell"&&t.hasYLabel===!0,hasLegend:!1,leftExtra:l==="cell"?void 0:0,bottomExtra:a==="cell"?void 0:0,rightExtra:u?0:void 0,originX:X,originY:O,cellWidth:q,cellHeight:le}),_e=r>0?{x:X,y:V,width:q,height:r}:void 0;R.push({index:D,label:e[D],layout:Fe,titleRect:_e,isLeftEdge:Y,isBottomEdge:k})}let F=t.hasLegend?{x:b+h,y:p,width:s,height:g}:void 0,I=a==="outer"?{x:b,y:x+g,width:h,height:f}:void 0;return{cells:R,legendRect:F,outerXAxisRect:I,outerYAxisRect:l==="outer"?{x:0,y:x,width:m,height:g}:void 0}}var Fu,Su,Iu,Du,Bu,Pu,vt=G(()=>{"use strict";Ye();Fu=55,Su=24,Iu=16,Du=18,Bu=18,Pu=96});function Gu(e,t){if(t<=0)return[];let n=new Array(t);for(let i=0;i<t;i++){let o=t===1?.5:i/(t-1),r=Le(e,o);n[i]=[r[0],r[1],r[2]]}return n}function de(e,t,n){if(e.length>0){if(e.length>=n)return e.slice(0,n);let i=new Array(n);for(let o=0;o<n;o++)i[o]=e[o%e.length];return i}return Gu(t,n)}var nn=G(()=>{"use strict";Ee()});function at(e){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}function lt(e,t,n,i){e.enable(e.SCISSOR_TEST),e.scissor(Math.round(t.margins.left*n),Math.round(t.margins.bottom*n),Math.round(t.e.width*n),Math.round(t.e.height*n));try{i()}finally{e.disable(e.SCISSOR_TEST)}}function ze(e,t,n,i){at(e),lt(e,t,n,i)}var on=G(()=>{"use strict"});function rn(e,t,n){let i=e.gl,o;if(t?.texture){if(o=t.texture,t.lastStops===n)return t}else o=i.createTexture();let r=ds(n,Is);return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,Is,1,0,i.RGBA,i.UNSIGNED_BYTE,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),{texture:o,lastStops:n}}function Ge(e,t,n,i=0){let o=e.gl;o.activeTexture(o.TEXTURE0+i),o.bindTexture(o.TEXTURE_2D,t),o.uniform1i(n,i)}var Is,At=G(()=>{"use strict";Ee();Is=256});function ue(e,t,n){e.width=Math.round(t.cssWidth*n),e.height=Math.round(t.cssHeight*n);let i=e.getContext("2d");return i?(i.scale(n,n),i.clearRect(0,0,t.cssWidth,t.cssHeight),i):null}function re(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var ut=G(()=>{"use strict"});function fi(e,t,n,i,o,r,s){let a=o==="bottom"?1:-1;e.textAlign="center",e.textBaseline=o==="bottom"?"top":"bottom";let l=a*8;for(let u of n){let m=r(u);m<t.x-1||m>t.x+t.width+1||(e.beginPath(),e.moveTo(m,i),e.lineTo(m,i+a*5),e.stroke(),e.fillText(s(u),m,i+l))}}function ci(e,t,n,i,o,r,s){let a=o==="left"?-1:1;e.textAlign=o==="left"?"right":"left",e.textBaseline="middle";let l=a*8;for(let u of n){let m=r(u);m<t.y-1||m>t.y+t.height+1||(e.beginPath(),e.moveTo(i,m),e.lineTo(i+a*5,m),e.stroke(),e.fillText(s(u),i+l,m))}}function Lt(e,t,n,i){for(let o of n){let r=Math.round(i(o))+.5;r<t.x||r>t.x+t.width||(e.beginPath(),e.moveTo(r,t.y),e.lineTo(r,t.y+t.height),e.stroke())}}function Tt(e,t,n,i){for(let o of n){let r=Math.round(i(o))+.5;r<t.y||r>t.y+t.height||(e.beginPath(),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke())}}var di=G(()=>{"use strict"});function Rt(e,t,n){let{e:i}=n,o=Math.max(2,Math.floor(i.width/90)),r=Math.max(2,Math.floor(i.height/60));return{xTicks:oe(e.min,e.max,o),yTicks:oe(t.min,t.max,r)}}function Oo(e,t,n,i,o,r){let s=re(e,r);if(!s)return;let{e:a}=t;s.strokeStyle=o.un,s.lineWidth=1,Lt(s,a,n,l=>t.P(l,0).px),Tt(s,a,i,l=>t.P(0,l).py)}function Ds(e,t,n){if(n)return n;let i=t.length>1?t[1]-t[0]:0;return e.isDate?o=>ye(o,i):me}function Bs(e,t,n,i,o,r,s,a,l){let{It:u,Le:m,Jn:f,fontFamily:p}=s,d=Ds(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(r.x,o),e.lineTo(r.x+r.width,o),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${p}`;for(let b of i)fi(e,b.e,n,o,"bottom",x=>b.P(x,0).px,d);a&&t.label&&(e.fillStyle=m,e.font=`13px ${p}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,a.cx,a.baselineY))}function Ps(e,t,n,i,o,r,s,a,l){let{It:u,Le:m,Jn:f,fontFamily:p}=s,d=Ds(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(o,r.y),e.lineTo(o,r.y+r.height),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${p}`;for(let b of i)ci(e,b.e,n,o,"left",x=>b.P(0,x).py,d);a&&t.label&&(e.fillStyle=m,e.font=`13px ${p}`,e.save(),e.translate(14,a.pivotY),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,0,0),e.restore())}function Vo(e,t,n,i,o,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Bs(l,t,i,[n],u.y+u.height,u,o,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,a)}function Ho(e,t,n,i,o,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Ps(l,t,i,[n],u.x,u,o,r?{pivotY:u.y+u.height/2}:null,a)}function sn(e,t,n,i,o,r,s,a,l){let u=re(e,a);u&&Bs(u,n,i,o,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,l)}function an(e,t,n,i,o,r,s,a,l){let u=re(e,a);u&&Ps(u,n,i,o,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,l)}var Yo=G(()=>{"use strict";Ae();ut();di()});function zo(e,t,n,i,o){if(o===0)return{x:e-n/2,y:t,width:n,height:i};if(o===90)return{x:e-i/2,y:t,width:i,height:n};let r=(n+i)/Math.SQRT2;return{x:e-r,y:t,width:r,height:r}}function Xo(e,t){return e.x<=t.x+t.width&&t.x<=e.x+e.width&&e.y<=t.y+t.height&&t.y<=e.y+e.height}function Es(e,t){return e.x+e.width+14>t.x+t.width}function $o(e,t){return e.x>=t.x&&e.x+e.width<=t.x+t.width&&e.y>=t.y&&e.y+e.height<=t.y+t.height}function mt(e,t,n){if(n<=0)return"";if(e.measureText(t).width<=n)return t;let i=0,o=t.length;for(;i<o;){let r=i+o+1>>1,s=t.slice(0,r)+"\\u2026";e.measureText(s).width<=n?i=r:o=r-1}return i===0?"":t.slice(0,i)+"\\u2026"}function Gs(e,t,n,i){if(i<=0||n<=0)return[];if(e.measureText(t).width<=n)return[t];let o=[],r=t;for(;r.length>0&&o.length<i;){let s=o.length===i-1,a=r.length;for(;a>0&&e.measureText(r.slice(0,a)).width>n;)a--;if(a===0&&(a=1),a===r.length){o.push(r);break}let l=a,u=r.lastIndexOf(" ",a);if(u>0&&(l=u),s){o.push(mt(e,r,n));break}o.push(r.slice(0,l)),r=r.slice(l).trimStart()}return o.length===1&&o[0].length<=2?[]:o}var pi=G(()=>{"use strict"});function bi(e,t,n,i){let o=[];if(i<=n)return o;let r=n,s=e[n];for(let a=n+1;a<i;a++){let l=e[a];l!==s&&(o.push({startIdx:r,endIdx:a-1,label:t[s]??""}),r=a,s=l)}return o.push({startIdx:r,endIdx:i-1,label:t[s]??""}),o}function ln(e,t,n){if(n<t)return[];let i=[];for(let o of e){if(o.endIdx<t||o.startIdx>n)continue;let r=o.startIdx<t?t:o.startIdx,s=o.endIdx>n?n:o.endIdx;r===o.startIdx&&s===o.endIdx?i.push(o):i.push({startIdx:r,endIdx:s,label:o.label})}return i}var un=G(()=>{"use strict"});function jo(e,t){return e.P(t,0).px}function Zo(e,t){return e.P(0,t).py}function Vu(e,t,n){let i=Math.max(0,n-100);return e*16>i?{size:t*6.62+10,rotation:90}:e*(t*6+10)>i?{size:t*4+20,rotation:45}:{size:Wu,rotation:0}}function Ws(e,t){let n=e.levels.length,i=[];for(let o=0;o<n;o++){let r=e.levels[o];o===n-1?i.push(Vu(e.numRows,r.maxLabelChars,t)):i.push({size:ku,rotation:0})}return i}function ks(e){let t=e.levels.length,n=[],i=6.2;for(let o=0;o<t;o++)if(o===t-1){let r=e.levels[o].maxLabelChars;n.push(Math.max(Nu,r*i+Ou))}else n.push(Uu);return n}function Ns(e){let t=0;for(let n of e)t+=n;return t}function We(e,t){return e.numRows===0||e.levels.length===0?24:Ns(Ws(e,t).map(n=>n.size))}function Mt(e){return e.numRows===0||e.levels.length===0?55:Ns(ks(e))}function Hu(e,t,n,i){let o=t-e+1;if(o<=0)return[];let r=Math.max(1,Math.floor(n/i));if(o<=r){let l=[];for(let u=e;u<=t;u++)l.push(u);return l}let s=Math.ceil(o/r),a=[];for(let l=e;l<=t;l+=s)a.push(l);return a}function Us(e,t){return e.labels[t]??""}function Os(e,t,n,i){let o=i?Math.min(t,n):t,r=i?Math.max(t,n):n,s=Math.max(0,Math.ceil(o)),a=Math.min(e-1,Math.floor(r));return a<s?null:[s,a]}function Vs(e,t,n,i){let o=[];for(let r of e){let s=t(r.startIdx-.5),a=t(r.endIdx+.5),l=Math.max(n,Math.min(s,a)),u=Math.min(i,Math.max(s,a));u>l&&o.push({run:r,nearEdge:s,farEdge:a,nearClip:l,farClip:u})}return o}function pe(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{It:o,Le:r,fontFamily:s}=i,{e:a}=t,l=a.y+a.height;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${wt}px ${s}`;let u=Ws(n,a.width),m=Os(n.numRows,t.Y,t.J,!1);if(!m)return;let[f,p]=m,d=n.levels.length,b=l;for(let h=d-1;h>=0;h--){let g=n.levels[h],y=u[h],_=b;b+=y.size,h===d-1?Yu(e,t,g,f,p,_,y,s,o):zu(e,t,g,f,p,_,s,o)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=r,e.font=`13px ${s}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(x,a.x+a.width/2,t.cssHeight-2))}function Yu(e,t,n,i,o,r,s,a,l){let{e:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),p=s.rotation===0?Hu(i,o,u.width,f):Xu(i,o);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let h of p){let g=jo(t,h);g<u.x-1||g>u.x+u.width+1||(e.moveTo(g,r),e.lineTo(g,r+gi))}e.stroke(),e.font=`${wt}px ${a}`;let d=r+gi+3,b={x:u.x,width:u.width,y:r,height:9999},x=[];for(let h of p){let g=jo(t,h);if(g<u.x-1||g>u.x+u.width+1)continue;let y=Us(n,h);if(!y)continue;let _=e.measureText(y).width,C=zo(g,d,_,qo,s.rotation);if($o(C,b)){if(s.rotation===0){if(x.some(v=>Xo(v,C)))continue}else if(x.some(v=>Es(v,C)))continue;x.push(C),Hs(e,y,g,d,s.rotation,"center")}}}function zu(e,t,n,i,o,r,s,a){let{e:l}=t,u=ln(n.runs,i,o);if(u.length===0)return;let m=Vs(u,b=>jo(t,b),l.x,l.x+l.width);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let b of m)e.moveTo(b.nearClip,r+3),e.lineTo(b.farClip,r+3),e.moveTo(b.nearEdge,r),e.lineTo(b.nearEdge,r+3),e.moveTo(b.farEdge,r),e.lineTo(b.farEdge,r+3);e.stroke(),e.font=`${wt}px ${s}`;let f=r+3+4,p=[],d={x:l.x,width:l.width,y:r,height:9999};for(let b of m){let x=(b.nearClip+b.farClip)/2,h=b.run.label;if(!h)continue;let g=b.farClip-b.nearClip-4,y=mt(e,h,g);if(!y)continue;let _=e.measureText(y).width,C=zo(x,f,_,qo,0);$o(C,d)&&(p.some(v=>Xo(v,C))||(p.push(C),Hs(e,y,x,f,0,"center")))}}function Xu(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n}function we(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{It:o,Le:r,fontFamily:s}=i,{e:a}=t,l=a.x;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${wt}px ${s}`;let u=ks(n),m=Os(n.numRows,t.q,t.Q,!0);if(!m)return;let[f,p]=m,d=n.levels.length,b=l;for(let h=d-1;h>=0;h--){let g=n.levels[h],y=u[h],_=b;b-=y,h===d-1?$u(e,t,g,f,p,_,s,o):ju(e,t,g,f,p,_,y,s,o)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=r,e.font=`13px ${s}`,e.save(),e.translate(14,a.y+a.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(x,0,0),e.restore())}function $u(e,t,n,i,o,r,s,a){let{e:l}=t,u=qo+4,m=o-i+1,f=Math.max(1,Math.floor(l.height/u)),p=m<=f?1:Math.ceil(m/f);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let d=i;d<=o;d+=p){let b=Zo(t,d);b<l.y-1||b>l.y+l.height+1||(e.moveTo(r-gi,b),e.lineTo(r,b))}e.stroke(),e.font=`${wt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let d=i;d<=o;d+=p){let b=Zo(t,d);if(b<l.y-1||b>l.y+l.height+1)continue;let x=Us(n,d);x&&e.fillText(x,r-gi-3,b)}}function ju(e,t,n,i,o,r,s,a,l){let{e:u}=t,m=ln(n.runs,i,o);if(m.length===0)return;let f=Vs(m,d=>Zo(t,d),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=l,e.fillStyle=l;let p=r-3;e.beginPath();for(let d of f)e.moveTo(p,d.nearClip),e.lineTo(p,d.farClip),e.moveTo(p,d.nearEdge),e.lineTo(r,d.nearEdge),e.moveTo(p,d.farEdge),e.lineTo(r,d.farEdge);e.stroke(),e.font=`${wt}px ${a}`,e.textAlign="right",e.textBaseline="middle";for(let d of f){let b=(d.nearClip+d.farClip)/2,x=d.run.label;if(!x)continue;let h=s-6,g=mt(e,x,h);g&&e.fillText(g,p-3,b)}}function Hs(e,t,n,i,o,r){if(o===0){e.textAlign=r==="end"?"right":"center",e.textBaseline="top",e.fillText(t,n,i);return}e.save(),e.translate(n,i),e.rotate(-o*Math.PI/180),e.textAlign="right",e.textBaseline="middle",e.fillText(t,-2,0),e.restore()}var Wu,ku,gi,wt,qo,Nu,Uu,Ou,Ft=G(()=>{"use strict";pi();un();Wu=25,ku=22,gi=5,wt=11,qo=14,Nu=55,Uu=60,Ou=10});function Zu(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function St(e,t,n,i,o,r){let s={x:t.e.x+t.e.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};mn(e,s,n,i,o,r)}function mn(e,t,n,i,o,r=me){let s=e.getContext("2d");if(!s)return;let a=o.mn,l=o.nr,u=o.fontFamily,m=16,f=Math.min(120,t.height*.4),p=t.x,d=t.y;s.fillStyle=a,s.font=`9px ${u}`,s.textAlign="left",s.textBaseline="bottom",s.fillText(n.label,p,d-4);let b=n.max,x=n.min,h=s.createLinearGradient(0,d,0,d+f),g=16;for(let _=0;_<=g;_++){let C=_/g,v=b+C*(x-b),A=rt(v,n.min,n.max),T=Le(i,A);h.addColorStop(C,Zu(T))}s.fillStyle=h,s.fillRect(p,d,m,f),s.strokeStyle=l,s.lineWidth=1,s.strokeRect(p,d,m,f),s.fillStyle=a,s.font=`10px ${u}`,s.textAlign="left",s.textBaseline="middle";let y=p+m+5;if(s.fillText(r(n.max),y,d+2),s.fillText(r((n.min+n.max)/2),y,d+f/2),s.fillText(r(n.min),y,d+f-2),n.min<0&&n.max>0){let _=(n.max-0)/(n.max-n.min),C=d+_*f;s.strokeStyle=a,s.lineWidth=1,s.beginPath(),s.moveTo(p+m,C),s.lineTo(p+m+4,C),s.stroke(),s.fillStyle=a,s.fillText("0",y,C)}}function hi(e,t,n,i,o){let r={x:t.e.x+t.e.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};fn(e,r,n,i,o)}function fn(e,t,n,i,o){let r=e.getContext("2d");if(!r||n.size===0)return;let s=o.mn,a=o.fontFamily,l=10,u=18,m=t.x,f=t.y+u/2;r.font=`11px ${a}`,r.textAlign="left",r.textBaseline="middle";for(let[p,d]of n){if(f+l/2>t.y+t.height)break;let b=i[d]??i[d%i.length]??[0,0,0];r.fillStyle=`rgb(${Math.round(b[0]*255)},${Math.round(b[1]*255)},${Math.round(b[2]*255)})`,r.fillRect(m,f-l/2,l,l),r.fillStyle=s,r.fillText(p,m+l+6,f),f+=u}}var xi=G(()=>{"use strict";Ae();Ee()});function Xe(e){return isNaN(e)?0:e}function Ys(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0)return;let s=e.L.length>0,a=e.G.facet_mode,l=s&&a==="grid";e.computeEffectiveFacetFlags();let u=e.a!==""&&e.b<e.p,m=l&&e.G.zoom_mode==="independent",f;if(e.g&&!m?f=e.g.getVisibleDomain():f={xMin:e.be,xMax:e.et,yMin:e.Te,yMax:e.tt},!isFinite(f.xMin)||!isFinite(f.yMin))return;let p=e.A(),d=p.ke,b=e.Ne[e.Ue]||"",x=e.Ne[e.Be]||"",h=b==="date"||b==="datetime",g=x==="date"||x==="datetime",y=e.Z,_=!y&&!e.a,C=p.H;if(y||_){let v=_?Math.max(1,e.L.length):Math.max(1,e.f.size);if(e.mi&&e.$i===d&&e.ji===v)C=e.mi;else{let A=de(d,p.H,v);C=cs(A),e.mi=C,e.$i=d,e.ji=v}}else e.mi=null,e.$i=null,e.ji=-1;e.ie=rn(t,e.ie,C),l?Ju(e,t,f,p,{xIsDate:h,yIsDate:g,cssWidth:o,cssHeight:r}):(e.m=null,Ku(e,t,f,p,{xIsDate:h,yIsDate:g,cssWidth:o,cssHeight:r,hasColorCol:u})),e.pe(()=>$e(e))}function yi(e,t,n,i){return{min:t,max:n,label:e.Ue||(e.Eo?"Row":e.$e||""),isDate:i}}function Ci(e,t,n,i){return{min:t,max:n,label:e.Be||e.Oe,isDate:i}}function _i(e,t){let n=0;for(let o of e)o.length>n&&(n=o.length);return{levels:[{labels:e.slice(),runs:[],maxLabelChars:n}],numRows:e.length,levelLabels:[t]}}function qu(e,t,n,i,o,r,s,a,l){if(e.Pe&&e.ot){let u=re(t,l);u&&pe(u,n,e.ot,a)}else Vo(t,i,n,r,a,!0,l,e.getColumnFormatter(e.$e,"tick"));if(e.ge&&e.rt){let u=re(t,l);u&&we(u,n,e.rt,a)}else Ho(t,o,n,s,a,!0,l,e.getColumnFormatter(e.Oe,"tick"))}function Ku(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u,hasColorCol:m}=o;e.ot=e.Pe&&e.Kt.length>0?_i(e.Kt,e.Ue||e.$e||""):null,e.rt=e.ge&&e.Jt.length>0?_i(e.Jt,e.Be||e.Oe||""):null;let f=m?80:16,p=55+(e.Be?16:0),d=Math.max(1,s-p-f),b=e.rt?Mt(e.rt):void 0,x=e.ot?We(e.ot,d):void 0,h=new ne(s,a,{hasXLabel:!!e.Ue,hasYLabel:!!e.Be,hasLegend:m,leftExtra:b,bottomExtra:x});e.l=h,e.g&&e.g.updateLayout(h);let g=h.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,Xe(e.w),Xe(e.M)),y=yi(e,n.xMin,n.xMax,l),_=Ci(e,n.yMin,n.yMax,u),C=Rt(y,_,h),v=e.Pe?[]:C.xTicks,A=e.ge?[]:C.yTicks,T=e.Cn==="map",L=t.dpr,R=e.j;R&&!T?e.pe(()=>{ue(R,h,L),Oo(R,h,v,A,i,L)}):R&&T&&e.pe(()=>ue(R,h,L)),ze(r,h,t.dpr,()=>{T&&e.renderBackground(t,h,g,n,Xe(e.w),Xe(e.M)),e.glyph.draw(e,t,g)}),e.he=y,e.xe=_,e.fi=v,e.Re=A,e.ci=i.H,e.di=m}function Ju(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u}=o;e.ot=e.Pe&&e.Kt.length>0?_i(e.Kt,e.Ue||e.$e||""):null,e.rt=e.ge&&e.Jt.length>0?_i(e.Jt,e.Be||e.Oe||""):null;let m=e.L.map(L=>L.prefix),f=e.Z&&e.f.size>1,p=!!e.a&&!e.Z&&e.b<e.p,d=f||p,b=Re(m,{cssWidth:s,cssHeight:a,xAxis:e.ei?"outer":"cell",yAxis:e.ti?"outer":"cell",hasLegend:d,hasXLabel:!!e.Ue,hasYLabel:!!e.Be,gap:e.G.facet_padding});if(e.m=b,b.cells.length>1){let L=b.cells[0].layout.e;for(let R=1;R<b.cells.length;R++){let F=b.cells[R].layout.e;if(F.width!==L.width||F.height!==L.height){console.warn(`facet-grid: cell ${R} size (${F.width}\\xD7${F.height}) differs from cell 0 (${L.width}\\xD7${L.height})`);break}}}e.l=b.cells[0]?.layout??null,e.syncFacetZoomLayouts(b.cells);let x=e.G.zoom_mode==="independent",h=yi(e,n.xMin,n.xMax,l),g=Ci(e,n.yMin,n.yMax,u),y=b.cells[0]?.layout,_=y?Rt(h,g,y):{xTicks:[],yTicks:[]},C=e.Pe?[]:_.xTicks,v=e.ge?[]:_.yTicks,A=t.dpr,T=e.j;T&&y&&e.pe(()=>ue(T,y,A)),at(r);for(let L=0;L<b.cells.length;L++){let R=b.cells[L],F=e.getZoomControllerForFacet(L),I=x&&F?F.getVisibleDomain():n,S=R.layout.buildProjectionMatrix(I.xMin,I.xMax,I.yMin,I.yMax,void 0,void 0,void 0,Xe(e.w),Xe(e.M)),D=e.Cn==="map";T&&!D&&e.pe(()=>{let B=x?Rt(yi(e,I.xMin,I.xMax,l),Ci(e,I.yMin,I.yMax,u),R.layout).xTicks:C,N=x?Rt(yi(e,I.xMin,I.xMax,l),Ci(e,I.yMin,I.yMax,u),R.layout).yTicks:v;Oo(T,R.layout,B,N,i,A)}),lt(r,R.layout,t.dpr,()=>{D&&e.renderBackground(t,R.layout,S,I,Xe(e.w),Xe(e.M)),e.glyph.drawSeries(e,t,S,L)})}e.he=h,e.xe=g,e.fi=C,e.Re=v,e.ci=i.H,e.di=d}function $e(e){!e.c||!e.l||!e.he||!e.xe||!e.t||(ue(e.c,e.l,e.t.dpr),e.m?em(e):Qu(e))}function Qu(e){let t=e.l,n=e.A(),i=e.t?.dpr??1;if(e.Cn==="map"?e.renderMapChrome(e.c,t,n,i):qu(e,e.c,t,e.he,e.xe,e.fi,e.Re,n,i),e.di){let r=e.ci??n.H;if(e.Z&&e.f.size>0){let s=de(n.ke,r,e.f.size);hi(e.c,t,e.f,s,n)}else e.a&&St(e.c,t,{min:e.b,max:e.p,label:e.a},r,n,e.getColumnFormatter(e.a,"value"))}zs(e,e.c,t,0,1),e.ae>=0&&e.O&&e.V&&im(e,e.c,t)}function em(e){let t=e.m,n=e.c,i=e.A(),o=e.t?.dpr??1,r=e.fi,s=e.Re,a=e.he,l=e.xe,u=e.Cn==="map",m=e.ei&&!e.Pe,f=e.ti&&!e.ge,p=e.G.zoom_mode==="independent";u&&e.renderMapChrome(n,e.l,i,o),!u&&m&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,a,r,en(t),i,!!e.Ue,o,e.getColumnFormatter(e.$e,"tick")),!u&&f&&t.outerYAxisRect&&an(n,t.outerYAxisRect,l,s,tn(t),i,!!e.Be,o,e.getColumnFormatter(e.Oe,"tick"));for(let d=0;d<t.cells.length;d++){let b=t.cells[d],x=p?e.getZoomControllerForFacet(d):null,h=x?x.getVisibleDomain():null,g=h?{...a,min:h.xMin,max:h.xMax}:a,y=h?{...l,min:h.yMin,max:h.yMax}:l,_=p?Rt(g,y,b.layout):{xTicks:r,yTicks:s};if(!u&&!m)if(e.Pe&&e.ot){let C=re(n,o);C&&pe(C,b.layout,e.ot,i)}else Vo(n,g,b.layout,_.xTicks,i,!!e.Ue,o,e.getColumnFormatter(e.$e,"tick"));if(!u&&!f)if(e.ge&&e.rt){let C=re(n,o);C&&we(C,b.layout,e.rt,i)}else Ho(n,y,b.layout,_.yTicks,i,!!e.Be,o,e.getColumnFormatter(e.Oe,"tick"));b.titleRect&&_t(n,b.label,b.titleRect,i,o),zs(e,n,b.layout,d,d+1)}if(e.di&&t.legendRect){let d=e.ci??i.H;if(e.Z&&e.f.size>0){let b=de(i.ke,d,Math.max(1,e.f.size));fn(n,t.legendRect,e.f,b,i)}else e.a&&mn(n,{x:t.legendRect.x,y:t.legendRect.y+20,width:t.legendRect.width,height:t.legendRect.height-20},{min:e.b,max:e.p,label:e.a},d,i,e.getColumnFormatter(e.a,"value"))}if(e.ae>=0&&e.O&&e.V){let d=isNaN(e.w)?0:e.w,b=isNaN(e.M)?0:e.M,x=e.O[e.ae]+d,h=e.V[e.ae]+b,g=tm(e,e.ae),y=e.glyph.tooltipOptions(),_=e.W.lines??[];for(let C=0;C<t.cells.length;C++){let v=t.cells[C],A=C===g,T=v.layout.P(x,h),L=v.layout.e;if(T.px<L.x||T.px>L.x+L.width||T.py<L.y||T.py>L.y+L.height)continue;let R=e.G.coordinated_tooltip;Pe(n,T,A||R?_:[],v.layout,i,o,{crosshair:y.crosshair,highlightRadius:A?y.highlightRadius:0})}}}function tm(e,t){return e.R<=0?0:Math.floor(t/e.R)}function zs(e,t,n,i,o){if(!e.Et||!e.O||!e.V)return;let r=e.Et.dictionary,s=e.Et.data,a=e.O,l=e.V,u=isNaN(e.w)?0:e.w,m=isNaN(e.M)?0:e.M,f=e.R;if(f<=0)return;let p=0;for(let y=i;y<o;y++)p+=e.U[y]??0;if(p===0)return;let d=e.t?.dpr??1,b=re(t,d);if(!b)return;let x=e.A(),h=n.e,g=Math.max(1,Math.ceil(p/nm));b.save(),b.font=`11px ${x.fontFamily}`,b.fillStyle=x.Le,b.textAlign="left",b.textBaseline="middle";for(let y=i;y<o;y++){let _=e.U[y]??0,C=y*f;for(let v=0;v<_;v+=g){let A=C+v,T=s[A];if(T<0)continue;let{px:L,py:R}=n.P(a[A]+u,l[A]+m);L<h.x||L>h.x+h.width||R<h.y||R>h.y+h.height||b.fillText(r[T],L+8,R-4)}}b.restore()}function im(e,t,n){let i=e.ae;if(i<0||!e.O||!e.V)return;let o=isNaN(e.w)?0:e.w,r=isNaN(e.M)?0:e.M,s=n.P(e.O[i]+o,e.V[i]+r),a=e.W.lines??[],l=e.A();Pe(t,s,a,n,l,e.t?.dpr??1,e.glyph.tooltipOptions())}var nm,Ko=G(()=>{"use strict";mi();Ye();vt();nn();Ee();on();At();Ct();Yo();ut();Ft();xi();nm=5e3});function om(e){if(!e.qt.isDirty||!e.O||!e.V)return;let t=e.O,n=e.V,i=Math.max(1,e.L.length),o=e.R,r=isNaN(e.w)?0:e.w,s=isNaN(e.M)?0:e.M;e.qt.rebuild({xMin:e.be-r,xMax:e.et-r,yMin:e.Te-s,yMax:e.tt-s},e.xt,a=>{for(let l=0;l<i;l++){let u=e.U[l]??0,m=l*o;for(let f=0;f<u;f++)a(m+f,t[m+f],n[m+f])}})}function Jo(e,t,n){if(!e.O||!e.V)return;let{layout:i,facetIdx:o}=rm(e,t,n);if(!i){Xs(e);return}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){Xs(e);return}let s=i.Y,a=i.J,l=i.q,u=i.Q,m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),d=r.height/(u-l),b=isNaN(e.w)?0:e.w,x=isNaN(e.M)?0:e.M,h=m-b,g=f-x,y=o<0?sm(e,h,g,p,d):am(e,o,h,g,p,d);if(y!==e.ae||o!==e._n){if(e.ae=y,e._n=o,y>=0){let _=e.W.beginHover(y);e.glyph.buildTooltipLines(e,y).then(C=>{e.W.commitHover(_,C)&&$e(e)})}else e.W.clearHover();$e(e)}}function Xs(e){(e.ae!==-1||e._n!==-1)&&(e.ae=-1,e._n=-1,$e(e))}function rm(e,t,n){if(e.m){let i=e.m.cells;for(let o=0;o<i.length;o++){let r=i[o].layout.e;if(t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)return{layout:i[o].layout,facetIdx:o}}return{layout:null,facetIdx:-1}}return{layout:e.l,facetIdx:-1}}function sm(e,t,n,i,o){om(e);let r=e.qt.query(t,n,cn,i,o,e.O,e.V);if(r>=0)return r;let s=cn*cn,a=Math.max(1,e.L.length),l=e.R,u=e.O,m=e.V;for(let f=0;f<a;f++){let p=e.U[f]??0,d=f*l;for(let b=0;b<p;b++){let x=d+b,h=(u[x]-t)*i,g=(m[x]-n)*o,y=h*h+g*g;y<s&&(s=y,r=x)}}return r}function am(e,t,n,i,o,r){let s=e.U[t]??0;if(s===0)return-1;let a=e.R,l=t*a,u=e.O,m=e.V,f=cn*cn,p=-1;for(let d=0;d<s;d++){let b=l+d,x=(u[b]-n)*o,h=(m[b]-i)*r,g=x*x+h*h;g<f&&(f=g,p=b)}return p}function $s(e,t){if(e.T.dismiss(),e.Zi=t,t<0||!e.O||!e.V)return;let n=lm(e,t);if(!n)return;let i=isNaN(e.w)?0:e.w,o=isNaN(e.M)?0:e.M,r=n.P(e.O[t]+i,e.V[t]+o),s=e.W.beginPin();e.glyph.buildTooltipLines(e,t).then(a=>{e.W.isPinFresh(s)&&e.Zi===t&&a.length!==0&&e.T.pin(a,r,n)}),e.ae=-1,e._n=-1,$e(e)}function lm(e,t){if(e.m&&e.R>0){let n=Math.floor(t/e.R),i=e.m.cells[n];if(i)return i.layout}return e.l}function js(e){e.T.dismiss(),e.Zi=-1}var cn,Zs=G(()=>{"use strict";Ko();cn=24});var It,Qo=G(()=>{"use strict";It=class{constructor(){c(this,"lines",null);c(this,"hoveredTarget",null);c(this,"qi",0);c(this,"Ki",0)}beginHover(t){return this.lines=null,this.hoveredTarget=t,++this.qi}commitHover(t,n){return t!==this.qi?!1:(this.lines=n,!0)}clearHover(){this.lines=null,this.hoveredTarget=null,this.qi++}beginPin(){return++this.Ki}isPinFresh(t){return t===this.Ki}invalidatePin(){this.Ki++}}});function j(e,t,n,i,o,r){let s=e.shaders.getOrCreate(t,n,i),a=e.gl,l={program:s};for(let u of o)l[u]=a.getUniformLocation(s,u);for(let u of r)l[u]=a.getAttribLocation(s,u);return l}var fe=G(()=>{"use strict"});async function vi(e,t){let n=[];if(!e.Pt||!e.De)return n;let i=e.Pt[t];if(i<0)return n;if(e.L.length>0&&e.R>0){let s=Math.floor(t/e.R),a=e.L[s];a?.prefix&&n.push(a.prefix)}let o=await e.De.fetchRow(i),r=e.L.length>0&&e.R>0?e.L[Math.floor(t/e.R)]?.prefix??null:null;for(let[s,a]of o){if(a==null)continue;let l=s;if(r!==null){let u=`${r}|`;if(!s.startsWith(u))continue;l=s.substring(u.length)}else if(s.includes("|"))continue;if(typeof a=="number"){let u=e.getColumnFormatter(s,"value")(a);n.push(`${l}: ${u}`)}else n.push(`${l}: ${a}`)}return n}var er=G(()=>{"use strict"});function um(e,t,n,i,o){t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,i.h.point_size_px*o),i.b<i.p?t.uniform2f(e.u_color_range,i.b,i.p):t.uniform2f(e.u_color_range,0,0),i.nt<i.it?t.uniform2f(e.u_size_range,i.nt,i.it):t.uniform2f(e.u_size_range,0,0);let r=Math.min(i.h.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*o,i.h.point_size_px/r*o),i.h.point_size_px*r*o)}function qs(e,t,n,i){let o=n.gl;if(!t.ie)return!1;o.useProgram(e.program),um(e,o,i,t,n.dpr),Ge(n,t.ie.texture,e.u_gradient_lut,0);let r=n.v.peek("a_position"),s=n.v.peek("a_color_value"),a=n.v.peek("a_size_value");return!r||!s||!a?!1:(o.bindBuffer(o.ARRAY_BUFFER,r.buffer),o.enableVertexAttribArray(e.a_position),o.vertexAttribPointer(e.a_position,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,s.buffer),o.enableVertexAttribArray(e.a_color_value),o.vertexAttribPointer(e.a_color_value,1,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,a.buffer),o.enableVertexAttribArray(e.a_size_value),o.vertexAttribPointer(e.a_size_value,1,o.FLOAT,!1,0,0),!0)}var Dt,tr=G(()=>{"use strict";At();fe();er();Ro();wo();Dt=class{constructor(){c(this,"name","point");c(this,"d",null)}ensureProgram(t,n){this.d||(this.d=j(n,"scatter",Bn,Pn,["u_projection","u_point_size","u_color_range","u_gradient_lut","u_size_range","u_point_size_range"],["a_position","a_color_value","a_size_value"]))}draw(t,n,i){let o=this.d;if(!o||!qs(o,t,n,i))return;let r=n.gl,s=Math.max(1,t.L.length),a=t.R;for(let l=0;l<s;l++){let u=t.U[l]??0;u<=0||r.drawArrays(r.POINTS,l*a,u)}}drawSeries(t,n,i,o){let r=this.d;if(!r||!qs(r,t,n,i))return;let s=t.U[o]??0;if(s<=0)return;let a=n.gl,l=t.R;a.drawArrays(a.POINTS,o*l,s)}buildTooltipLines(t,n){return vi(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6}}destroy(t){this.d=null}}});function J(e){let t=e.gl;if(e.isWebGL2){let i=t;return{setDivisor(o,r){o<0||i.vertexAttribDivisor(o,r)},drawArraysInstanced(o,r,s,a){i.drawArraysInstanced(o,r,s,a)}}}let n=t.getExtension("ANGLE_instanced_arrays");return{setDivisor(i,o){i<0||n?.vertexAttribDivisorANGLE(i,o)},drawArraysInstanced(i,o,r,s){n?.drawArraysInstancedANGLE(i,o,r,s)}}}function je(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,1,2,3]),e.STATIC_DRAW),t}function Ai(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW),t}function Ze(e,t,n,i,o,r=0){if(n<0)return!0;let s=e.v.peek(i);if(!s)return!1;let a=e.gl;return a.bindBuffer(a.ARRAY_BUFFER,s.buffer),a.enableVertexAttribArray(n),a.vertexAttribPointer(n,o,a.FLOAT,!1,0,r*o*Float32Array.BYTES_PER_ELEMENT),t.setDivisor(n,1),!0}var Me=G(()=>{"use strict"});function Ks(e,t,n,i){let o=n.gl;if(!t.ie)return!1;let r=n.dpr;o.useProgram(e.program),o.uniformMatrix4fv(e.u_projection,!1,i),o.uniform2f(e.u_resolution,o.canvas.width,o.canvas.height),o.uniform1f(e.u_line_width,t.h.line_width_px*r),t.b<t.p?o.uniform2f(e.u_color_range,t.b,t.p):o.uniform2f(e.u_color_range,0,0),Ge(n,t.ie.texture,e.u_gradient_lut,0);let s=J(n),{setDivisor:a}=s;return o.bindBuffer(o.ARRAY_BUFFER,e.cornerBuffer),o.enableVertexAttribArray(e.a_corner),o.vertexAttribPointer(e.a_corner,1,o.FLOAT,!1,0,0),a(e.a_corner,0),o.enableVertexAttribArray(e.a_start),a(e.a_start,1),o.enableVertexAttribArray(e.a_end),a(e.a_end,1),o.enableVertexAttribArray(e.a_color_start),a(e.a_color_start,1),o.enableVertexAttribArray(e.a_color_end),a(e.a_color_end,1),!0}function Js(e,t,n,i){let o=t.U[i]??0;if(o<2)return;let r=n.gl,s=t.R,a=2*Float32Array.BYTES_PER_ELEMENT,l=Float32Array.BYTES_PER_ELEMENT,u=n.v.peek("a_position"),m=n.v.peek("a_color_value");if(!u||!m)return;let f=i*s*a;r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(e.a_start,2,r.FLOAT,!1,a,f),r.vertexAttribPointer(e.a_end,2,r.FLOAT,!1,a,f+a);let p=i*s*l;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,l,p),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,l,p+l),J(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,o-1)}function Qs(e,t){let{setDivisor:n}=J(t);n(e.a_start,0),n(e.a_end,0),n(e.a_color_start,0),n(e.a_color_end,0)}var Bt,nr=G(()=>{"use strict";At();Me();fe();Ae();Lo();To();Bt=class{constructor(){c(this,"name","line");c(this,"d",null)}ensureProgram(t,n){if(this.d)return;let i=j(n,"line",In,Dn,["u_projection","u_resolution","u_line_width","u_color_range","u_gradient_lut"],["a_start","a_end","a_color_start","a_color_end","a_corner"]);this.d={...i,cornerBuffer:je(n.gl)}}draw(t,n,i){let o=this.d;if(!o||!Ks(o,t,n,i))return;let s=Math.max(1,t.L.length);for(let a=0;a<s;a++)Js(o,t,n,a);Qs(o,n)}drawSeries(t,n,i,o){let r=this.d;r&&Ks(r,t,n,i)&&(Js(r,t,n,o),Qs(r,n))}async buildTooltipLines(t,n){let i=[];if(!t.O||!t.V)return i;if(t.L.length>0&&t.R>0){let p=Math.floor(n/t.R),d=t.L[p];d&&i.push(d.prefix)}let o=t.O[n],r=t.V[n],s=t.Ne[t.Ue]||"",l=s==="date"||s==="datetime"?ye(o):me(o);i.push(`${t.Ue||"Row"}: ${l}`);let u=t.Ne[t.Be]||"",f=u==="date"||u==="datetime"?ye(r):me(r);return i.push(`${t.Be}: ${f}`),i}tooltipOptions(){return{crosshair:!0,highlightRadius:5}}destroy(t){let n=this.d;n?.cornerBuffer&&t.t&&t.t.gl.deleteBuffer(n.cornerBuffer),this.d=null}}});function pm(e){switch(e){case"density":return mm;case"extreme":return cm;case"signed":return dm;case"mean":default:return fm}}function ea(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function ir(e,t,n,i){return j(e,t,n,i,["u_projection","u_radius_ndc","u_intensity","u_color_range"],["a_corner","a_position","a_color_value"])}function bm(e){let t=e.gl;if(e.isWebGL2){let n=t;if(n.getExtension("EXT_color_buffer_float"))return{internalFormat:n.RGBA16F,format:n.RGBA,type:n.HALF_FLOAT,isFloat:!0}}return{internalFormat:t.RGBA,format:t.RGBA,type:t.UNSIGNED_BYTE,isFloat:!1}}function ta(e){let t=e.v.peek("a_position"),n=e.v.peek("a_color_value");return!!t&&!!n}function hm(e,t){if(!e.a||e.Z)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.xt&&n.colorName===e.a&&n.colorIsString===e.Z)return{lo:n.lo,hi:n.hi};let i=xm(e);return i?(t.robustBounds={lo:i.lo,hi:i.hi,dataCount:e.xt,colorName:e.a,colorIsString:e.Z},i):(t.robustBounds=null,null)}function xm(e){if(!e.yt||e.xt<2)return null;let t=e.R,n=Math.max(1,e.L.length),i=Math.max(1,Math.ceil(e.xt/gm)),o=[],r=e.yt;for(let m=0;m<n;m++){let f=e.U[m]??0,p=m*t;for(let d=0;d<f;d+=i){let b=r[p+d];Number.isFinite(b)&&o.push(b)}}if(o.length<2)return null;o.sort((m,f)=>m-f);let s=Math.floor(o.length*.05),a=Math.min(o.length-1,Math.ceil(o.length*.95)),l=o[s],u=o[a];return u>l?{lo:l,hi:u}:e.p>e.b?{lo:e.b,hi:e.p}:null}var mm,fm,cm,dm,Pt,gm,or=G(()=>{"use strict";At();Me();fe();er();Mo();Fo();So();Zr();Kr();Io();Do();mm=0,fm=1,cm=2,dm=3,Pt=class{constructor(){c(this,"name","density");c(this,"d",null)}ensureProgram(t,n){if(this.d){this.ensureHeatTarget(t,n);return}let i=n.gl,o=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let r=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,r),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),i.STATIC_DRAW);let{internalFormat:s,format:a,type:l,isFloat:u}=bm(n),m=ea(i),f=i.createFramebuffer();this.d={splat:ir(n,"density-splat",xt,$n),extremeSplat:null,mrtSplat:null,resolve:j(n,"density-resolve",Zn,qn,["u_heat","u_extreme","u_gradient_lut","u_heat_max","u_color_mode"],["a_corner"]),quadCornerBuffer:o,tripleCornerBuffer:r,heatTexture:m,heatFramebuffer:f,extremeTexture:null,extremeFramebuffer:null,mrtFramebuffer:null,heatWidth:0,heatHeight:0,heatType:l,heatInternalFormat:s,heatFormat:a,floatFbo:u,indexedBlend:null,signedDowngradeWarned:!1,robustBounds:null},this.ensureHeatTarget(t,n)}draw(t,n,i){let o=this.d;if(!o||!ta(n))return;let r=Math.max(1,t.L.length),s=t.R,a=0;for(let l=0;l<r;l++)a+=t.U[l]??0;a!==0&&this.runSplatAndResolve(t,n,o,i,l=>{for(let u=0;u<r;u++){let m=t.U[u]??0;m<=0||l(u*s,m)}})}drawSeries(t,n,i,o){let r=this.d;if(!r||!ta(n))return;let s=t.U[o]??0;if(s<=0)return;let a=t.R;this.runSplatAndResolve(t,n,r,i,l=>l(o*a,s))}buildTooltipLines(t,n){return vi(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0}}destroy(t){let n=this.d;if(!n||!t.t){this.d=null;return}let i=t.t.gl;i.deleteBuffer(n.quadCornerBuffer),i.deleteBuffer(n.tripleCornerBuffer),i.deleteTexture(n.heatTexture),i.deleteFramebuffer(n.heatFramebuffer),n.extremeTexture&&i.deleteTexture(n.extremeTexture),n.extremeFramebuffer&&i.deleteFramebuffer(n.extremeFramebuffer),n.mrtFramebuffer&&i.deleteFramebuffer(n.mrtFramebuffer),this.d=null}ensureHeatTarget(t,n){let i=this.d;if(!i)return;let o=n.gl,r=o.canvas.width,s=o.canvas.height;if(!(r===i.heatWidth&&s===i.heatHeight)&&!(r<=0||s<=0)){if(this.allocAccumTexture(o,i,i.heatTexture,r,s),o.bindFramebuffer(o.FRAMEBUFFER,i.heatFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.heatTexture,0),i.extremeTexture&&(this.allocAccumTexture(o,i,i.extremeTexture,r,s),i.extremeFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.extremeFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.extremeTexture,0)),i.mrtFramebuffer)){let a=o;a.bindFramebuffer(a.FRAMEBUFFER,i.mrtFramebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i.heatTexture,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.TEXTURE_2D,i.extremeTexture,0)}o.bindFramebuffer(o.FRAMEBUFFER,null),i.heatWidth=r,i.heatHeight=s}}allocAccumTexture(t,n,i,o,r){t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,n.heatInternalFormat,o,r,0,n.heatFormat,n.heatType,null)}ensureExtremeTarget(t,n){let i=t.gl;if(n.extremeTexture)return;let o=ea(i);if(n.extremeTexture=o,n.extremeFramebuffer=i.createFramebuffer(),this.allocAccumTexture(i,n,o,n.heatWidth,n.heatHeight),i.bindFramebuffer(i.FRAMEBUFFER,n.extremeFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o,0),n.indexedBlend===null){let r=t.isWebGL2?i.getExtension("OES_draw_buffers_indexed"):null;n.indexedBlend=r??!1}if(n.indexedBlend){let r=i;n.mrtFramebuffer=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,n.mrtFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n.heatTexture,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT1,r.TEXTURE_2D,o,0)}i.bindFramebuffer(i.FRAMEBUFFER,null)}ensureExtremeSplatProgram(t,n){return n.extremeSplat||(n.extremeSplat=ir(t,"density-extreme",xt,jn)),n.extremeSplat}ensureMrtSplatProgram(t,n){return n.mrtSplat||(n.mrtSplat=ir(t,"density-mrt",qr,Jr)),n.mrtSplat}activeMode(t,n,i){let o=n.h.gradient_color_mode;return o==="signed"&&!i.floatFbo?(this.warnDowngradeOnce(i,"signed mode requires a float framebuffer (EXT_color_buffer_float); falling back to mean."),"mean"):o==="extreme"&&!t.isWebGL2?(this.warnDowngradeOnce(i,"extreme mode requires WebGL2 (for MAX blend and a second color attachment); falling back to mean."),"mean"):o}warnDowngradeOnce(t,n){t.signedDowngradeWarned||(t.signedDowngradeWarned=!0,console.warn(`Density: ${n}`))}runSplatAndResolve(t,n,i,o,r){if(this.ensureHeatTarget(t,n),i.heatWidth===0||i.heatHeight===0||!t.ie)return;let s=this.activeMode(n,t,i),a=t.b<t.p&&(!!t.a||t.L.length>1),l=0,u=0;if(s!=="density"&&a&&(l=t.b,u=t.p,!t.Z&&(s==="mean"||s==="extreme"))){let f=hm(t,i);f&&(l=f.lo,u=f.hi)}s==="extreme"&&this.ensureExtremeTarget(n,i),s==="extreme"&&i.indexedBlend?this.runMrtExtremePass(n,i,o,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r):(this.runHeatPass(n,i,o,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r),s==="extreme"&&this.runExtremePass(n,i,o,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r)),this.runResolvePass(n,i,t,s)}runHeatPass(t,n,i,o,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST);u.bindFramebuffer(u.FRAMEBUFFER,n.heatFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE),u.blendEquation(u.FUNC_ADD),this.bindSplatProgram(u,n.splat,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,n.splat,l),this.unbindSplatInstancing(t,n.splat)}runExtremePass(t,n,i,o,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST),f=this.ensureExtremeSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.extremeFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE);let p=u;p.blendEquation(p.MAX),this.bindSplatProgram(u,f,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,f,l),this.unbindSplatInstancing(t,f),u.blendEquation(u.FUNC_ADD)}runMrtExtremePass(t,n,i,o,r,s,a,l){let u=t.gl,m=n.indexedBlend,f=!!u.getParameter(u.SCISSOR_TEST),p=this.ensureMrtSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.mrtFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),u.drawBuffers([u.COLOR_ATTACHMENT0,u.COLOR_ATTACHMENT1]),this.clearTarget(u,f),m.enableiOES(u.BLEND,0),m.enableiOES(u.BLEND,1),m.blendEquationiOES(0,u.FUNC_ADD),m.blendFunciOES(0,u.ONE,u.ONE),m.blendEquationiOES(1,u.MAX),m.blendFunciOES(1,u.ONE,u.ONE),this.bindSplatProgram(u,p,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,p,l),this.unbindSplatInstancing(t,p),m.blendEquationiOES(0,u.FUNC_ADD),m.blendEquationiOES(1,u.FUNC_ADD),m.blendFunciOES(0,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),m.blendFunciOES(1,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),u.drawBuffers([u.COLOR_ATTACHMENT0])}clearTarget(t,n){n&&t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),n&&t.enable(t.SCISSOR_TEST)}bindSplatProgram(t,n,i,o,r,s,a,l,u){t.useProgram(n.program),t.uniformMatrix4fv(n.u_projection,!1,i),t.uniform1f(n.u_intensity,o);let m=2*r/Math.max(1,s),f=2*r/Math.max(1,a);t.uniform2f(n.u_radius_ndc,m,f),t.uniform2f(n.u_color_range,l,u)}bindAndDispatchInstanced(t,n,i,o){let r=t.gl;r.bindBuffer(r.ARRAY_BUFFER,n.quadCornerBuffer),r.enableVertexAttribArray(i.a_corner),r.vertexAttribPointer(i.a_corner,2,r.FLOAT,!1,0,0);let s=J(t);s.setDivisor(i.a_corner,0),s.setDivisor(i.a_position,1),s.setDivisor(i.a_color_value,1);let a=t.v.peek("a_position"),l=t.v.peek("a_color_value");o((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,p=Float32Array.BYTES_PER_ELEMENT;r.bindBuffer(r.ARRAY_BUFFER,a.buffer),r.enableVertexAttribArray(i.a_position),r.vertexAttribPointer(i.a_position,2,r.FLOAT,!1,f,u*f),r.bindBuffer(r.ARRAY_BUFFER,l.buffer),r.enableVertexAttribArray(i.a_color_value),r.vertexAttribPointer(i.a_color_value,1,r.FLOAT,!1,p,u*p),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let i=J(t);i.setDivisor(n.a_position,0),i.setDivisor(n.a_color_value,0)}runResolvePass(t,n,i,o){let r=t.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,r.canvas.width,r.canvas.height),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA);let s=n.resolve;r.useProgram(s.program),r.uniform1f(s.u_heat_max,i.h.gradient_heat_max),r.uniform1i(s.u_color_mode,pm(o)),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.heatTexture),r.uniform1i(s.u_heat,0),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,n.extremeTexture??n.heatTexture),r.uniform1i(s.u_extreme,1),Ge(t,i.ie.texture,s.u_gradient_lut,2),r.bindBuffer(r.ARRAY_BUFFER,n.tripleCornerBuffer),r.enableVertexAttribArray(s.a_corner),r.vertexAttribPointer(s.a_corner,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,3)}};gm=5e4});var ft,Li,Ti,Ri,rr=G(()=>{"use strict";Jt();Ts();Ss();Ko();Zs();Qo();tr();nr();or();ft=class extends Te{constructor(n){super();c(this,"glyph");c(this,"Cn","cartesian");c(this,"ie",null);c(this,"$e","");c(this,"Oe","");c(this,"Ue","");c(this,"Be","");c(this,"Eo",!1);c(this,"a","");c(this,"ne","");c(this,"ui","");c(this,"Z",!1);c(this,"Pe",!1);c(this,"ge",!1);c(this,"Kt",[]);c(this,"Jt",[]);c(this,"Go",new Map);c(this,"Wo",new Map);c(this,"ot",null);c(this,"rt",null);c(this,"L",[]);c(this,"be",1/0);c(this,"et",-1/0);c(this,"Te",1/0);c(this,"tt",-1/0);c(this,"w",NaN);c(this,"M",NaN);c(this,"b",1/0);c(this,"p",-1/0);c(this,"nt",1/0);c(this,"it",-1/0);c(this,"gn",1/0);c(this,"hn",-1/0);c(this,"xn",1/0);c(this,"yn",-1/0);c(this,"ri",1/0);c(this,"si",-1/0);c(this,"ai",1/0);c(this,"li",-1/0);c(this,"R",0);c(this,"U",[]);c(this,"Hi",0);c(this,"O",null);c(this,"V",null);c(this,"yt",null);c(this,"Pt",null);c(this,"Et",null);c(this,"xt",0);c(this,"f",new Map);c(this,"W",new It);c(this,"Yi",null);c(this,"zi",null);c(this,"Xi",null);c(this,"ko",0);c(this,"qt",new li);c(this,"l",null);c(this,"ae",-1);c(this,"Zi",-1);c(this,"_n",-1);c(this,"m",null);c(this,"he",null);c(this,"xe",null);c(this,"fi",null);c(this,"Re",null);c(this,"ci",null);c(this,"di",!1);c(this,"mi",null);c(this,"$i",null);c(this,"ji",-1);this.glyph=n}projectPoint(n,i){return[n,i]}renderBackground(n,i,o,r,s,a){}renderMapChrome(n,i,o,r){}tooltipCallbacks(){return{onHover:(n,i)=>Jo(this,n,i),onLeave:()=>{this.ae!==-1&&(this.ae=-1,$e(this))},onPin:(n,i)=>{if(Jo(this,n,i),this.ae>=0){let o=this.ae;$s(this,o),this.or(o)}},onUnpin:()=>{this.emitUnselect()}}}async or(n){if(!this.Pt)return;let i=this.Pt[n],o=this.I[1]||this.I[0]||"",r=[];if(this.L.length>0&&this.R>0){let s=Math.floor(n/this.R),a=this.L[s];a?.prefix&&this.B.length>0&&(r=a.prefix.split("|"))}await this.emitClickAndSelect({rowIdx:i!=null&&i>=0?i:null,columnName:o,groupByValues:[],splitByValues:r})}async uploadAndRender(n,i,o,r){let s=r-o;this.t=n,o===0&&Ms(this,n,i,r),s!==0&&(Fs(this,n,i,o,s,r),this.h.domain_mode==="expand"&&(this.Pe||(this.gn=this.be,this.hn=this.et),this.ge||(this.xn=this.Te,this.yn=this.tt),this.ri=this.b,this.si=this.p,this.ai=this.nt,this.li=this.it),await this.requestRender(n))}resetExpandedDomain(){this.gn=1/0,this.hn=-1/0,this.xn=1/0,this.yn=-1/0,this.ri=1/0,this.si=-1/0,this.ai=1/0,this.li=-1/0}Dt(n){n.uploadedCount===0&&this.xt===0||(this.t=n,Ys(this,n))}destroyInternal(){this.glyph.destroy(this),this.ie=null,this.O=null,this.V=null,this.yt=null,this.Pt=null,this.Et=null,this.W.clearHover(),this.f.clear(),this.qt.clear(),this.Yi=null,this.zi=null,this.Xi=null,this.L=[],this.U=[],js(this)}},Li=class extends ft{constructor(){super(new Dt)}},Ti=class extends ft{constructor(){super(new Bt)}},Ri=class extends ft{constructor(){super(new Pt)}}});function xl(e,t){if(t>hl||t<-hl)return[NaN,NaN];let n=e*Math.PI*6378137/180,i=t*Math.PI/180,o=6378137*Math.log(Math.tan(Math.PI/4+i/2));return[n,o]}function yl(e,t,n){let i=1<<e,o=2*Ue/i,r=-Ue+t*o,s=r+o,a=Ue-n*o,l=a-o;return{xMin:r,yMin:l,xMax:s,yMax:a}}function Cl(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let i=Math.log2(2*Ue/(t*e));return Math.max(0,Math.min(n,Math.floor(i)))}function _l(e,t){let n=1<<t,i=2*Ue/n,o=Math.floor((e.xMin+Ue)/i),r=Math.floor((e.xMax+Ue)/i),s=Math.floor((Ue-e.yMax)/i),a=Math.floor((Ue-e.yMin)/i),l=[];for(let u=s;u<=a;u++)if(!(u<0||u>=n))for(let m=o;m<=r;m++)m<0||m>=n||l.push({z:t,x:m,y:u});return l}var Ue,hl,kr=G(()=>{"use strict";Ue=Math.PI*6378137,hl=85.0511287798066});var go,vl=G(()=>{"use strict";go=class{constructor(t=256){c(this,"ve",new Map);c(this,"jo");this.jo=t}get(t){let n=this.ve.get(t);return n!==void 0&&(this.ve.delete(t),this.ve.set(t,n)),n}set(t,n,i){if(this.ve.has(n)){let o=this.ve.get(n);t.deleteTexture(o),this.ve.delete(n)}for(this.ve.set(n,i);this.ve.size>this.jo;){let o=this.ve.keys().next().value;if(o===void 0)break;let r=this.ve.get(o);t.deleteTexture(r),this.ve.delete(o)}}has(t){return this.ve.has(t)}dispose(t){for(let n of this.ve.values())t.deleteTexture(n);this.ve.clear()}}});function Vt(e,t,n,i){return`${e}/${t}/${n}/${i}`}var ho,Al=G(()=>{"use strict";ho=class{constructor(){c(this,"Ae",new Map);c(this,"Zo",()=>{})}setOnLoad(t){this.Zo=t}load(t,n,i,o){let r=Vt(t.id,n,i,o),s=this.Ae.get(r);if(s)return s.promise;let a=new AbortController,l=t.urlFor(n,i,o),u=this.ar(l,a.signal).then(m=>(this.Ae.delete(r),m&&this.Zo(),m)).catch(()=>(this.Ae.delete(r),null));return this.Ae.set(r,{promise:u,abort:a}),u}cancelAll(){for(let t of this.Ae.values())t.abort.abort();this.Ae.clear()}cancelExcept(t){for(let[n,i]of this.Ae)t.has(n)||(i.abort.abort(),this.Ae.delete(n))}async ar(t,n){let i=await fetch(t,{signal:n});if(!i.ok)return null;let o=await i.blob();return await createImageBitmap(o)}}});var xo,Ll=G(()=>{"use strict";kr();vl();Al();Bo();Po();fe();xo=class{constructor(){c(this,"i",null);c(this,"k",null);c(this,"d",new go);c(this,"kn",new ho);c(this,"Nn",null);c(this,"qo",1);c(this,"Ko",()=>{})}setOnTileLoad(t){this.Ko=t,this.kn.setOnLoad(t)}setSource(t,n){this.Nn?.id!==n.id&&(this.d.dispose(t),this.kn.cancelAll(),this.Nn=n)}setAlpha(t){this.qo=Math.max(0,Math.min(1,t))}get source(){return this.Nn}render(t,n,i,o,r,s){let a=this.Nn;if(!a)return;this.lr(t);let l=this.i,u=this.k;if(!l||!u)return;let m=t.gl,f=t.dpr,p=Math.max(1,n.e.width*f),d=o.xMax-o.xMin;if(!isFinite(d)||d<=0)return;let b=d/p,x=Cl(b,a.tileSize,a.maxZoom),h=_l(o,x),g=new Set;for(let _ of h)g.add(Vt(a.id,_.z,_.x,_.y));this.kn.cancelExcept(g),m.useProgram(l.program),m.uniformMatrix4fv(l.u_projection,!1,i),m.uniform1f(l.u_alpha,this.qo),m.bindBuffer(m.ARRAY_BUFFER,u),m.enableVertexAttribArray(l.a_corner),m.vertexAttribPointer(l.a_corner,2,m.FLOAT,!1,0,0),m.activeTexture(m.TEXTURE0),m.uniform1i(l.u_tile,0);let y=m.isEnabled(m.BLEND);m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);for(let _ of h)this.ur(m,l,a,_,r,s);y||m.disable(m.BLEND)}destroy(t){this.kn.cancelAll(),this.d.dispose(t),this.k&&(t.deleteBuffer(this.k),this.k=null),this.i=null}ur(t,n,i,o,r,s){let a=yl(o.z,o.x,o.y),l={xMin:a.xMin-r,xMax:a.xMax-r,yMin:a.yMin-s,yMax:a.yMax-s},u=Vt(i.id,o.z,o.x,o.y),m=this.d.get(u);if(m){this.Jo(t,n,m,l,[0,0],[1,1]);return}this.mr(t,i,o);for(let f=1;f<=6;f++){let p=o.z-f;if(p<0)return;let d=o.x>>f,b=o.y>>f,x=Vt(i.id,p,d,b),h=this.d.get(x);if(!h)continue;let g=1<<f,y=o.x-d*g,_=o.y-b*g,C=1/g,v=[y*C,_*C],A=[v[0]+C,v[1]+C];this.Jo(t,n,h,l,v,A);return}}Jo(t,n,i,o,r,s){t.bindTexture(t.TEXTURE_2D,i),t.uniform2f(n.u_extent_min,o.xMin,o.yMin),t.uniform2f(n.u_extent_max,o.xMax,o.yMax),t.uniform2f(n.u_uv_min,r[0],r[1]),t.uniform2f(n.u_uv_max,s[0],s[1]),t.drawArrays(t.TRIANGLE_STRIP,0,4)}mr(t,n,i){let o=Vt(n.id,i.z,i.x,i.y);this.d.has(o)||this.kn.load(n,i.z,i.x,i.y).then(r=>{if(!r)return;if(this.Nn?.id!==n.id){r.close();return}let s=t.createTexture();if(!s){r.close();return}t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.d.set(t,o,s),this.Ko()})}lr(t){if(this.i&&this.k)return;let n=t.gl;this.i=j(t,"map-tile",Kn,Jn,["u_projection","u_extent_min","u_extent_max","u_uv_min","u_uv_max","u_tile","u_alpha"],["a_corner"]);let i=n.createBuffer();i&&(n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.k=i)}}});function Bf(){return new wn("carto-positron","https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Pf(){return new wn("carto-dark-matter","https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Ef(){return new wn("carto-voyager","https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Nr(e){switch(e){case"carto-dark-matter":return Pf();case"carto-voyager":return Ef();case"carto-positron":default:return Bf()}}var wn,Tl=G(()=>{"use strict";wn=class{constructor(t,n,i,o=256,r=19,s=[]){this.id=t;this.template=n;this.attribution=i;this.tileSize=o;this.maxZoom=r;this.subdomains=s}urlFor(t,n,i){let o=this.template.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(i));if(this.subdomains.length>0){let r=(n+i)%this.subdomains.length;o=o.replace("{s}",this.subdomains[r])}return o}}});var yo={};Vl(yo,{MapChart:()=>Ht,MapDensityChart:()=>Vr,MapLineChart:()=>Or,MapScatterChart:()=>Ur});var Ht,Ur,Or,Vr,Co=G(()=>{"use strict";rr();tr();nr();or();Ll();Tl();kr();ut();Ht=class extends ft{constructor(n){super(n);c(this,"Cn","map");c(this,"Je");this.Je=new xo,this.Je.setOnTileLoad(()=>{this.t&&this.requestRender(this.t)})}projectPoint(n,i){return xl(n,i)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.t&&this.Je.setSource(this.t.gl,Nr(n.map_tile_provider)),this.Je.setAlpha(n.map_tile_alpha)}renderBackground(n,i,o,r,s,a){this.Je.source||(this.Je.setSource(n.gl,Nr(this.h.map_tile_provider)),this.Je.setAlpha(this.h.map_tile_alpha)),this.Je.render(n,i,o,r,s,a)}renderMapChrome(n,i,o,r){if(!n)return;let s=re(n,r);if(!s)return;let a=this.Je.source?.attribution??"";if(!a)return;let l=i.e;s.save(),s.font=`10px ${o.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(a).width,p=12,d=l.x+l.width-4,b=l.y+l.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(d-f-u*2,b-p-u,f+u*2,p+u),s.fillStyle=o.Le,s.fillText(a,d-u,b-u/2),s.restore()}destroyInternal(){this.t&&this.Je.destroy(this.t.gl),super.destroyInternal()}},Ur=class extends Ht{constructor(){super(new Dt)}},Or=class extends Ht{constructor(){super(new Bt)}},Vr=class extends Ht{constructor(){super(new Pt)}}});typeof window>"u"&&(globalThis.window={});var jt=class{constructor(t){c(this,"dt");c(this,"o",new Map);c(this,"sn",0);c(this,"Un",0);this.dt=t}get totalCapacity(){return this.sn}get maxCapacity(){return this.Un}set maxCapacity(t){this.Un=t}ensureCapacity(t){this.sn=this.Un>0?Math.min(t,this.Un):t}peek(t){return this.o.get(t)}getOrCreate(t,n,i){let o=this.sn*n*i,r=this.o.get(t);if(r&&r.byteCapacity>=o)return r;let s=this.dt;r&&s.deleteBuffer(r.buffer);let a=s.createBuffer();return s.bindBuffer(s.ARRAY_BUFFER,a),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW),r={buffer:a,byteCapacity:o},this.o.set(t,r),r}upload(t,n,i,o=1){let r=this.dt,s=this.getOrCreate(t,o,n.BYTES_PER_ELEMENT);if(!1){let a=i+n.byteLength;if(a>s.byteCapacity)throw new Error(`BufferPool.upload("${t}"): write ${i}..${a} exceeds capacity ${s.byteCapacity} (_totalCapacity=${this.sn}, components=${o}, bytes=${n.BYTES_PER_ELEMENT}). Did you pass the full scratch buffer instead of a subarray(0, n)?`)}return r.bindBuffer(r.ARRAY_BUFFER,s.buffer),r.bufferSubData(r.ARRAY_BUFFER,i,n),s.buffer}releaseAll(){for(let t of this.o.values())this.dt.deleteBuffer(t.buffer);this.o.clear(),this.sn=0}};var Zt=class{constructor(t){c(this,"dt");c(this,"On",new Map);this.dt=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,i){let o=this.On.get(t);if(o)return o;let r=this.dt,s=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(s,n),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(s);throw r.deleteShader(s),new Error(`Vertex shader compile error [${t}]: ${l}`)}let a=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(a,i),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(a);throw r.deleteShader(s),r.deleteShader(a),new Error(`Fragment shader compile error [${t}]: ${l}`)}if(o=r.createProgram(),r.attachShader(o,s),r.attachShader(o,a),r.linkProgram(o),!r.getProgramParameter(o,r.LINK_STATUS)){let l=r.getProgramInfoLog(o);throw r.deleteProgram(o),r.deleteShader(s),r.deleteShader(a),new Error(`Shader link error [${t}]: ${l}`)}return r.deleteShader(s),r.deleteShader(a),this.On.set(t,o),o}releaseAll(){for(let t of this.On.values())this.dt.deleteProgram(t);this.On.clear()}};var Fn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;attribute float a_series_id;attribute float a_axis;uniform mat4 u_proj_left;uniform mat4 u_proj_right;uniform float u_hover_series;uniform float u_horizontal;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec2 A;if(u_horizontal>0.5){A=vec2(mix(a_y0,a_y1,a_corner.x),a_x_center+(a_corner.y-0.5)*2.*a_half_width);}else{A=vec2(a_x_center+(a_corner.x-0.5)*2.*a_half_width,mix(a_y0,a_y1,a_corner.y));}mat4 B=a_axis<0.5?u_proj_left:u_proj_right;gl_Position=B*vec4(A,0.,1.);v_color=a_color;v_hover=abs(a_series_id-u_hover_series)<0.5?1.:0.;v_local=a_corner;}";var Sn="precision highp float;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec3 A=v_color;if(v_hover>0.5){A=mix(A,vec3(1.),0.25);}gl_FragColor=vec4(A,1.);}";Lo();To();Ro();wo();var En="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var Gn="precision highp float;uniform vec3 u_color;uniform float u_opacity;void main(){gl_FragColor=vec4(u_color,u_opacity);}";var Oe="attribute vec2 a_start;attribute vec2 a_end;attribute float a_corner;attribute float a_real_start;attribute float a_real_end;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform float u_interp_alpha;varying float v_edge_dist;varying float v_seg_alpha;void main(){vec4 A=u_projection*vec4(a_start,0.,1.);vec4 B=u_projection*vec4(a_end,0.,1.);vec2 C=A.xy*u_resolution*0.5;vec2 D=B.xy*u_resolution*0.5;vec2 E=D-C;float F=length(E);E=F>0.001?E/F:vec2(1.,0.);vec2 G=vec2(-E.y,E.x);float H=step(1.5,a_corner);float I=1.-mod(a_corner,2.)*2.;vec4 J=mix(A,B,H);float K=(u_line_width+1.5)*0.5;vec2 L=(G*I*K)/(u_resolution*0.5);gl_Position=J+vec4(L,0.,0.);v_edge_dist=I;float M=a_real_start*a_real_end;v_seg_alpha=mix(u_interp_alpha,1.,step(0.5,M));}";var Ve="precision highp float;uniform vec4 u_color;uniform float u_line_width;varying float v_edge_dist;varying float v_seg_alpha;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(u_color.rgb,u_color.a*C*v_seg_alpha);}";var Wn="attribute vec2 a_position;attribute vec3 a_color;uniform mat4 u_projection;uniform float u_point_size;varying vec3 v_color;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);gl_PointSize=u_point_size;v_point_size=u_point_size;v_color=a_color;}";var kn="precision highp float;varying vec3 v_color;varying float v_point_size;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5)discard;float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);gl_FragColor=vec4(v_color,D);}";var Nn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;uniform mat4 u_projection;varying vec3 v_color;void main(){float A=a_x_center+(a_corner.x-0.5)*2.*a_half_width;float B=mix(a_y0,a_y1,a_corner.y);gl_Position=u_projection*vec4(A,B,0.,1.);v_color=a_color;}";var Un="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var On="attribute vec2 a_corner;attribute vec2 a_cell;attribute float a_color_t;uniform mat4 u_projection;uniform vec2 u_cell_inset;uniform vec2 u_cell_size;varying float v_color_t;void main(){vec2 A=0.5*u_cell_size;vec2 B=u_cell_size-2.*u_cell_inset;float C=a_cell.x-A.x+u_cell_inset.x+a_corner.x*B.x;float D=a_cell.y-A.y+u_cell_inset.y+a_corner.y*B.y;gl_Position=u_projection*vec4(C,D,0.,1.);v_color_t=a_color_t;}";var Vn="precision highp float;uniform sampler2D u_gradient_lut;varying float v_color_t;void main(){float A=clamp(v_color_t,0.,1.);vec4 B=texture2D(u_gradient_lut,vec2(A,0.5));gl_FragColor=vec4(B.rgb,1.);}";var Hn="attribute float a_strip_t;attribute float a_side;attribute vec2 a_angles;attribute vec2 a_radii;attribute vec4 a_color;uniform vec2 u_center;uniform vec2 u_resolution;uniform float u_border_px;varying vec4 v_color;varying vec2 v_edge;void main(){float A=u_border_px*0.5;float B=a_radii.x+A;float C=a_radii.y-A;if(C<=B){gl_Position=vec4(2.,2.,2.,1.);v_color=vec4(0.);v_edge=vec2(0.);return;}float D=mix(B,C,a_side);float E=A/max(D,1.);float F=a_angles.y-a_angles.x;E=min(E,F*0.5);float G=mix(a_angles.x+E,a_angles.y-E,a_strip_t);vec2 H=u_center+vec2(cos(G),sin(G))*D;vec2 I=(H/u_resolution)*2.-1.;gl_Position=vec4(I.x,-I.y,0.,1.);v_color=a_color;v_edge=vec2(a_strip_t,a_side);}";var Yn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var zn="attribute vec2 a_position;attribute vec4 a_color;uniform vec2 u_resolution;varying vec4 v_color;void main(){vec2 A=(a_position/u_resolution)*2.-1.;A.y=-A.y;gl_Position=vec4(A,0.,1.);v_color=a_color;}";var Xn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";Mo();Fo();So();Io();Do();Bo();Po();var Eo=[{name:"bar",vert:Fn,frag:Sn},{name:"line",vert:In,frag:Dn},{name:"scatter",vert:Bn,frag:Pn},{name:"bar-area",vert:En,frag:Gn},{name:"bar-scatter",vert:Wn,frag:kn},{name:"line-uniform",vert:Oe,frag:Ve},{name:"candlestick-body",vert:Nn,frag:Un},{name:"heatmap",vert:On,frag:Vn},{name:"sunburst-arc",vert:Hn,frag:Yn},{name:"treemap",vert:zn,frag:Xn},{name:"density-splat",vert:xt,frag:$n},{name:"density-extreme",vert:xt,frag:jn},{name:"density-resolve",vert:Zn,frag:qn},{name:"map-tile",vert:Kn,frag:Jn}];var yu=1,it=class{constructor(t,n={}){c(this,"id");c(this,"canvas");c(this,"gl");c(this,"isWebGL2");c(this,"shaders");c(this,"xo");c(this,"yo",null);c(this,"Ht");c(this,"pt",!1);c(this,"Vn",new Set);this.id=yu++,this.canvas=t,this.Ht=n.precompile??!1;let i=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(i)this.gl=i,this.isWebGL2=!0;else{let o=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!o)throw new Error("WebGL is not supported");this.gl=o,this.isWebGL2=!1}this.shaders=new Zt(this.gl),this.Ht&&this.shaders.precompile(Eo),this.xo=this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),this.isWebGL2||(this.yo=this.gl.getExtension("ANGLE_instanced_arrays")),t.addEventListener("webglcontextlost",o=>{this.pt||o.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this.shaders.releaseAll(),this.shaders=new Zt(this.gl),this.Ht&&this.shaders.precompile(Eo);for(let o of this.Vn)o()})}resetVertexArrayState(){let t=this.gl;for(let n=0;n<this.xo;n++)t.disableVertexAttribArray(n),this.isWebGL2?t.vertexAttribDivisor(n,0):this.yo?.vertexAttribDivisorANGLE(n,0)}onRestore(t){return this.Vn.add(t),()=>this.Vn.delete(t)}isContextLost(){return this.pt||this.gl.isContextLost()}get destroyed(){return this.pt}destroy(){this.pt=!0,this.Vn.clear(),this.shaders.releaseAll();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext()}};var qt=class{constructor(t,n={}){c(this,"S");c(this,"Hn");c(this,"Co");c(this,"o");c(this,"Yn",0);c(this,"Di",0);c(this,"Bi",0);c(this,"Pi",1);c(this,"pt",!1);c(this,"zn",null);c(this,"bt",null);c(this,"an",null);c(this,"Yt",null);t instanceof it?(this.S=t,this.Hn=!1):(this.S=new it(t,{precompile:n.precompile??!1}),this.Hn=!0),this.o=new jt(this.S.gl),this.Co=this.S.onRestore(()=>{this.o.releaseAll(),this.o=new jt(this.S.gl),this.Yn=0})}get gl(){return this.S.gl}get backendId(){return this.S.id}isContextLost(){return this.pt||this.S.isContextLost()}get isWebGL2(){return this.S.isWebGL2}get shaders(){return this.S.shaders}get v(){return this.o}get uploadedCount(){return this.Yn}set uploadedCount(t){this.Yn=t}resize(t,n,i){this.Di=t,this.Bi=n,this.Pi=i;let o=Math.round(t*i),r=Math.round(n*i),s=this.S.canvas;(s.width!==o||s.height!==r)&&(s.width=o,s.height=r,this.S.gl.viewport(0,0,o,r))}requestResize(t,n,i){this.Yt={cssWidth:t,cssHeight:n,dpr:i}}applyPendingResize(){if(!this.Yt)return!1;let{cssWidth:t,cssHeight:n,dpr:i}=this.Yt;return this.Yt=null,this.resize(t,n,i),!0}beginFrame(){if(this.Hn){this.applyPendingResize();return}let t=this.Yt;this.Yt=null,t?this.resize(t.cssWidth,t.cssHeight,t.dpr):this.resize(this.Di,this.Bi,this.Pi);let n=this.S.gl,i=this.S.canvas;n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,i.width,i.height),n.disable(n.SCISSOR_TEST),n.disable(n.DEPTH_TEST),this.S.resetVertexArrayState()}get cssWidth(){return this.Di}get cssHeight(){return this.Bi}get dpr(){return this.Pi}clear(){this.S.gl.clearColor(0,0,0,0),this.S.gl.clear(this.S.gl.COLOR_BUFFER_BIT|this.S.gl.DEPTH_BUFFER_BIT),this.Yn=0}setFrameCallback(t){this.zn=t}endFrame(){if(!this.zn||this.isContextLost())return;let t=this.S.canvas;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.zn(n)}async awaitGpuFence(){if(!this.S.isWebGL2){this.S.gl.finish();return}let t=this.S.gl,n=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0);if(!n){t.finish();return}try{let i=t.SYNC_FLUSH_COMMANDS_BIT;for(;;){let o=t.clientWaitSync(n,i,0);if(o===t.ALREADY_SIGNALED||o===t.CONDITION_SATISFIED)return;if(o===t.WAIT_FAILED){t.finish();return}if(i=0,await this.er(),this.pt)return}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.o.ensureCapacity(t)}er(){return this.bt||(this.bt=new MessageChannel,this.bt.port1.start()),new Promise(t=>{let n=this.bt;this.an=t,n.port1.addEventListener("message",()=>{this.an=null,t()},{once:!0}),n.port2.postMessage(null)})}destroy(){if(this.pt=!0,this.zn=null,this.Co(),this.o.releaseAll(),this.an){let t=this.an;this.an=null,t()}this.bt&&(this.bt.port1.close(),this.bt.port2.close(),this.bt=null),this.Hn&&this.S.destroy()}};var Qn=class{constructor(t,n={}){c(this,"_o");c(this,"Ht");c(this,"zt",[]);c(this,"vo",0);this._o=Math.max(1,t),this.Ht=n.precompile??!1}acquire(){let t;if(this.zt.length<this._o)t=this.Ao(),this.zt.push(t);else{let n=this.vo%this.zt.length;this.vo++,this.zt[n].isContextLost()&&(this.zt[n]=this.Ao()),t=this.zt[n]}return t}Ao(){let t=new OffscreenCanvas(1,1);return new it(t,{precompile:this.Ht})}};ei();ei();function ts(e,t,n,i){let{controller:o,layout:r}=e,s=r.e,a=o.getVisibleDomain(),l=a.xMin+(t-s.x)/s.width*(a.xMax-a.xMin),u=a.yMax-(n-s.y)/s.height*(a.yMax-a.yMin),m=Math.pow(1.1,-i/100),f=o.lockedAxis;f!=="x"&&(o.scaleX=Math.max(1,Math.min(1e5,o.scaleX*m))),f!=="y"&&(o.scaleY=Math.max(1,Math.min(1e5,o.scaleY*m)));let p=o.getVisibleDomain(),d=p.xMin+(t-s.x)/s.width*(p.xMax-p.xMin),b=p.yMax-(n-s.y)/s.height*(p.yMax-p.yMin),x=o.baseXRange,h=o.baseYRange;f!=="x"&&x>0&&(o.normTranslateX+=(l-d)/x),f!=="y"&&h>0&&(o.normTranslateY+=(u-b)/h)}function ns(e,t,n){let{controller:i,layout:o}=e,r=i.getVisibleDomain(),s=o.e,a=(r.xMax-r.xMin)/s.width,l=(r.yMax-r.yMin)/s.height,u=i.lockedAxis,m=i.baseXRange,f=i.baseYRange;u!=="x"&&m>0&&(i.normTranslateX-=t*a/m),u!=="y"&&f>0&&(i.normTranslateY+=n*l/f)}var ti=class{constructor(t){c(this,"Xt");this.Xt=t}pin(t,n,i){this.Xt({kind:"pinTooltip",lines:t,pos:n,bounds:i})}dismiss(){this.Xt({kind:"dismissTooltip"})}setCursor(t){this.Xt({kind:"setCursor",cursor:t})}emitUserClick(t){this.Xt({kind:"userClick",detail:t})}emitUserSelect(t){this.Xt({kind:"userSelect",selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig})}};rr();Jt();var wi=class{constructor(t=1024){c(this,"size");c(this,"value");c(this,"colorValue");c(this,"sizeSign");c(this,"x0");c(this,"y0");c(this,"x1");c(this,"y1");c(this,"a0");c(this,"a1");c(this,"r0");c(this,"r1");c(this,"depth");c(this,"parent");c(this,"firstChild");c(this,"nextSibling");c(this,"lastChild");c(this,"childCount");c(this,"leafRowIdx");c(this,"name");c(this,"colorLabel");c(this,"count",0);c(this,"capacity",0);this.No(t)}reset(){this.count>0&&(this.x0.fill(0,0,this.count),this.y0.fill(0,0,this.count),this.x1.fill(0,0,this.count),this.y1.fill(0,0,this.count),this.a0.fill(0,0,this.count),this.a1.fill(0,0,this.count),this.r0.fill(0,0,this.count),this.r1.fill(0,0,this.count)),this.count=0}allocate(){this.count===this.capacity&&this.No(this.capacity*2);let t=this.count++;return this.firstChild[t]=-1,this.nextSibling[t]=-1,this.lastChild[t]=-1,this.childCount[t]=0,this.leafRowIdx[t]=-1,this.size[t]=0,this.value[t]=0,this.colorValue[t]=NaN,this.sizeSign[t]=1,this.name[t]="",this.colorLabel[t]="",t}appendChild(t,n){this.parent[n]=t,this.depth[n]=this.depth[t]+1,this.nextSibling[n]=-1;let i=this.lastChild[t];i===-1?this.firstChild[t]=n:this.nextSibling[i]=n,this.lastChild[t]=n,this.childCount[t]++}isLeaf(t){return this.firstChild[t]===-1}No(t){let n=Math.max(t,1024),i=(o,r)=>{let s=new r(n);return o&&o.length>0&&s.set(o),s};this.size=i(this.size,Float32Array),this.value=i(this.value,Float32Array),this.colorValue=i(this.colorValue,Float32Array),this.sizeSign=i(this.sizeSign,Int8Array),this.x0=i(this.x0,Float32Array),this.y0=i(this.y0,Float32Array),this.x1=i(this.x1,Float32Array),this.y1=i(this.y1,Float32Array),this.a0=i(this.a0,Float32Array),this.a1=i(this.a1,Float32Array),this.r0=i(this.r0,Float32Array),this.r1=i(this.r1,Float32Array),this.depth=i(this.depth,Int32Array),this.parent=i(this.parent,Int32Array),this.firstChild=i(this.firstChild,Int32Array),this.nextSibling=i(this.nextSibling,Int32Array),this.lastChild=i(this.lastChild,Int32Array),this.childCount=i(this.childCount,Int32Array),this.leafRowIdx=i(this.leafRowIdx,Int32Array),this.name?this.name.length=n:this.name=new Array(n),this.colorLabel?this.colorLabel.length=n:this.colorLabel=new Array(n),this.capacity=n}};function na(e,t){let n=[],i=t;for(;e.parent[i]!==-1;)n.push(e.name[i]),i=e.parent[i];return n.reverse()}Qo();function Mi(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var Et=class extends Te{constructor(){super(...arguments);c(this,"ne","");c(this,"a","");c(this,"ye","empty");c(this,"r",new wi);c(this,"X",-1);c(this,"C",-1);c(this,"le",[]);c(this,"Gt",new Map);c(this,"pi",0);c(this,"b",1/0);c(this,"p",-1/0);c(this,"f",new Map);c(this,"$",null);c(this,"oe",0);c(this,"W",new It)}};Qt();un();Ae();function ct(e,t,n,i,o){if(!e||t<=0)return null;let r=new Float64Array(t),s=1/0,a=-1/0;for(let u=0;u<t;u++){let m=e[u+n];r[u]=m,m<s&&(s=m),m>a&&(a=m)}let l=1/0;for(let u=1;u<t;u++){let m=Math.abs(r[u]-r[u-1]);m>0&&m<l&&(l=m)}return(!isFinite(l)||l===0)&&(l=Math.max(1,a-s)),{categoryPositions:r,numericCategoryDomain:{min:s-l/2,max:a+l/2,isDate:o,label:i,bandWidth:l}}}function Gt(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function ym(e,t,n){return!t||e==null||Number.isNaN(e)?"":n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?ye(e):n==="integer"?String(e|0):n==="float"?me(e):String(e)}function sr(e,t,n){let i=e.values,o=e.valid,r=new Int32Array(t),s=[""],a=new Map;a.set("",0);for(let l=0;l<t;l++){let u=o?!!(o[l>>3]>>(l&7)&1):!0,m=i[l],f=ym(m,u,n),p=a.get(f);p===void 0&&(p=s.length,s.push(f),a.set(f,p)),r[l]=p}return{indices:r,dictionary:s}}function Wt(e,t,n,i=[]){let o=[];for(let u=0;;u++){let m=e.get(`__ROW_PATH_${u}__`);if(!m)break;if(m.type==="string"&&m.indices&&m.dictionary)o.push({indices:m.indices,dictionary:m.dictionary});else if(m.values){let f=i[u]??"string";o.push(sr(m,t,f))}else break}let r=0;if(n>0&&o.length>0)for(;r<t;){let u=!1;for(let m of o){let f=m.dictionary[m.indices[r]];if(f!=null&&f!==""){u=!0;break}}if(u)break;r++}let s=Math.max(0,t-r),a=o.length;return{rowPaths:n>0&&a>0?o.map((u,m)=>{let f=new Array(s),p=0;for(let b=0;b<s;b++){let x=u.dictionary[u.indices[b+r]]??"";f[b]=x,x.length>p&&(p=x.length)}let d=m===a-1?[]:bi(u.indices,u.dictionary,r,r+s).map(b=>({startIdx:b.startIdx-r,endIdx:b.endIdx-r,label:b.label}));return{labels:f,runs:d,maxLabelChars:p}}):[],numCategories:s,rowOffset:r}}function ar(e,t,n,i){if(e.length===0)return null;for(let p of e)if(p.type!=="string")return null;let o=Math.max(0,t-n),r=[],s=new Map,a=e.map(()=>new Int32Array(o)),l=p=>{let d=s.get(p);return d===void 0&&(d=r.length,r.push(p),s.set(p,d)),d};for(let p=0;p<e.length;p++){let d=e[p].data,b=a[p];for(let x=0;x<o;x++){let h=x+n,g;if(!d)g="(null)";else{let y=d.valid;if(!(y?!!(y[h>>3]>>(h&7)&1):!0))g="(null)";else if(d.indices&&d.dictionary)g=d.dictionary[d.indices[h]]??"(null)";else if(d.values){let C=d.values[h];g=C==null?"(null)":String(C)}else g="(null)"}b[x]=l(g)}}let u=0;for(let p of r)p.length>u&&(u=p.length);return{domain:{levels:[{labels:r.slice(),runs:[],maxLabelChars:u}],numRows:r.length,levelLabels:[i]},perColumnSlots:a}}function dn(e){e.r.reset(),e.Gt.clear();let t=e.r.allocate();e.r.name[t]="Total",e.r.depth[t]=0,e.r.parent[t]=-1,e.Gt.set(t,new Map),e.X=t,e.C=t,e.le=[t],e.pi=0,e.b=1/0,e.p=-1/0,e.f.clear(),e.$=null,e.oe=0}function Cm(e,t,n){let i=e.Gt.get(t);i||(i=new Map,e.Gt.set(t,i));let o=i.get(n);if(o!==void 0)return o;let r=e.r.allocate();return e.r.name[r]=n,e.r.appendChild(t,r),i.set(n,r),r}function Fi(e,t,n,i,o,r,s){let a=e.X,l=t.length;for(let u=0;u<l;u++){let m=Cm(e,a,t[u]);u===l-1&&((s===0||l===s)&&(e.r.size[m]=Math.abs(n),e.r.sizeSign[m]=n<0?-1:1,e.r.leafRowIdx[m]=r),isNaN(i)||(e.r.colorValue[m]=i,i<e.b&&(e.b=i),i>e.p&&(e.p=i)),o&&(e.r.colorLabel[m]=o,e.f.has(o)||e.f.set(o,e.f.size))),a=m}}function oa(e,t){let n=e.valid;return!n||!!(n[t>>3]>>(t&7)&1)}function Si(e,t){return e?.values?oa(e,t)?e.values[t]:0:1}function Ii(e,t,n){let i=NaN,o="";return!t||!oa(t,n)?{colorValue:i,colorLabel:o}:(e.ye==="numeric"&&t.values?i=t.values[n]:e.ye==="series"&&t.indices&&t.dictionary&&(o=t.dictionary[t.indices[n]]),{colorValue:i,colorLabel:o})}function ia(e,t){if(e.ye!=="series"||!t?.dictionary)return;let n=t.dictionary;for(let i=0;i<n.length;i++){let o=n[i];e.f.has(o)||e.f.set(o,e.f.size)}}function _m(e,t){if(e.B.length===0)return null;let n=e.ne?[e.ne]:[],i=e.a?[e.a]:[],o=He(t,n,i);return o.length===0?null:o.map(r=>({prefix:r.prefix,sizeCol:e.ne?t.get(`${r.prefix}|${e.ne}`)??null:null,colorCol:e.a?t.get(`${r.prefix}|${e.a}`)??null:null}))}function pn(e,t){let n=[];for(let x=0;;x++){let h=t.get(`__ROW_PATH_${x}__`);if(!h)break;if(h.type==="string"&&h.indices&&h.dictionary)n.push({indices:h.indices,dictionary:h.dictionary,valid:h.valid});else if(h.values){let g=e._[x],y=e.ht[g]??"string";n.push(sr(h,h.values.length,y))}else break}let i=n.length>0,o=e._.length,r=_m(e,t),s=r!==null,a=e.ne?t.get(e.ne):null,l=e.a?t.get(e.a):null,u=s?r[0].sizeCol:a,m=i?n[0].indices.length:u?.values?.length??0;if(m===0)return;if(s)for(let x of r)ia(e,x.colorCol);else ia(e,l);let f=e.pi,p=s&&i?o+1:o;if(!i){let x;for(let[g,y]of t){if(g.startsWith("__")||s&&g.includes("|"))continue;let _=g.lastIndexOf("|"),C=_===-1?g:g.substring(_+1);if(!(C===e.ne||C===e.a)&&y.type==="string"&&y.indices&&y.dictionary){x=y;break}}let h=s?r:null;for(let g=0;g<m;g++){let y=x?.indices&&x?.dictionary?x.dictionary[x.indices[g]]:`Row ${f+g}`;if(h)for(let _ of h){let C=Si(_.sizeCol,g),{colorValue:v,colorLabel:A}=Ii(e,_.colorCol,g);Fi(e,[_.prefix,y],C,v,A,f+g,p)}else{let _=Si(a,g),{colorValue:C,colorLabel:v}=Ii(e,l,g);Fi(e,[y],_,C,v,f+g,p)}}e.pi=f+m;return}let d=s?1:0,b=new Array(n.length+d);for(let x=0;x<m;x++){let h=0;for(let g=0;g<n.length;g++){let y=n[g];if(y.valid&&!(y.valid[x>>3]>>(x&7)&1))break;let _=y.dictionary[y.indices[x]];if(!_&&_!=="0")break;b[d+h++]=_}if(h!==0)if(s)for(let g of r){b[0]=g.prefix;let y=b.slice(0,h+1),_=Si(g.sizeCol,x),{colorValue:C,colorLabel:v}=Ii(e,g.colorCol,x);Fi(e,y,_,C,v,f+x,p)}else{let g=b.slice(0,h),y=Si(a,x),{colorValue:_,colorLabel:C}=Ii(e,l,x);Fi(e,g,y,_,C,f+x,p)}}e.pi=f+m}function bn(e){let t=e.r,n=t.value,i=t.size,o=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.X,s[1]=0;let a=1;for(let l=0;l<t.count;l++)n[l]=0;for(;a>0;){a--;let l=s[a*2];if(s[a*2+1]===0){s[a*2+1]=1,a++;for(let m=o[l];m!==-1;m=r[m]){if((a+1)*2>s.length){let f=new Int32Array(s.length*2);f.set(s),s=f}s[a*2]=m,s[a*2+1]=0,a++}}else if(o[l]===-1){let m=i[l];n[l]=m>0?m:0}else{let m=0;for(let f=o[l];f!==-1;f=r[f])m+=n[f];n[l]=m}}if(e.le.length>1){let l=[];for(let f=1;f<e.le.length;f++)l.push(t.name[e.le[f]]);let u=e.X,m=!0;for(let f of l){let d=e.Gt.get(u)?.get(f);if(d===void 0){m=!1;break}u=d}if(m&&t.firstChild[u]!==-1){e.C=u,Di(e,u);return}}e.C=e.X,e.le=[e.X]}function Di(e,t){let n=[],i=t;for(;i!==-1;)n.unshift(i),i=e.r.parent[i];e.le=n}var vm=1,lr=14,ra=1,sa=4;function Bi(e,t,n,i,o,r,s,a,l){if(e.x0[t]=Math.round(n),e.y0[t]=Math.round(i),e.x1[t]=Math.round(o),e.y1[t]=Math.round(r),e.firstChild[t]===-1||(o-n)*(r-i)<sa)return;let m=e.depth[t]-s,f=l&&m===1&&e.firstChild[t]!==-1,p=f?lr:ra,d=f?vm:ra,b=e.x0[t]+d,x=e.y0[t]+p,h=e.x1[t]-d,g=e.y1[t]-d;if(h<=b||g<=x)return;let y=0;for(let _=e.firstChild[t];_!==-1;_=e.nextSibling[_])e.value[_]>0&&(a[y++]=_);y!==0&&gn(e,a,0,y,b,x,h,g,s,a.subarray(y),l)}function gn(e,t,n,i,o,r,s,a,l,u,m){let f=i-n;if(f===0)return;if(f===1){Bi(e,t[n],o,r,s,a,l,u,m);return}let p=0;for(let v=n;v<i;v++)p+=e.value[t[v]];let d=p/2,b=0,x=n+1,h=1/0;for(let v=n;v<i-1;v++){b+=e.value[t[v]];let A=Math.abs(b-d);A<h&&(h=A,x=v+1)}let g=0;for(let v=n;v<x;v++)g+=e.value[t[v]];let y=g/p,_=s-o,C=a-r;if(_>=C){let v=Math.round(o+_*y);gn(e,t,n,x,o,r,v,a,l,u,m),gn(e,t,x,i,v,r,s,a,l,u,m)}else{let v=Math.round(r+C*y);gn(e,t,n,x,o,r,s,v,l,u,m),gn(e,t,x,i,o,v,s,a,l,u,m)}}function aa(e,t,n,i){e.oe=ur(e,t,n,i,0)}function ur(e,t,n,i,o){let r=e.r,s=r.x0,a=r.y0,l=r.x1,u=r.y1,m=r.depth,f=r.firstChild,p=r.nextSibling,d=r.value;(!e.$||e.$.length<r.count)&&(e.$=new Int32Array(r.count));let b=e.$,x=o,h=new Int32Array(128);h[0]=t;let g=1;for(;g>0;){g--;let y=h[g];if(d[y]<=0||(m[y]>=i&&(b[x++]=y),m[y]-i>=n))continue;let _=l[y]-s[y],C=u[y]-a[y];if(!(_*C<sa))for(let v=f[y];v!==-1;v=p[v]){if(g>=h.length){let A=new Int32Array(h.length*2);A.set(h),h=A}h[g++]=v}}return x}nn();vt();Ee();function Pi(e,t,n){return .299*e+.587*t+.114*n}function Am(e,t){let n=Le(e,t);return[n[0],n[1],n[2]]}function hn(e,t,n,i){let o=e.r,r=o.colorValue[t];if(e.ye==="numeric"&&!isNaN(r)&&e.p>e.b)return Am(n,rt(r,e.b,e.p));let s=e.f.get(o.colorLabel[t])??0;return i[s%i.length]??[0,0,0]}function Ei(e,t,n,i,o){let r=hn(e,t,n,i),s=e.r.sizeSign[t]<0?o:1;return[r[0],r[1],r[2],s]}fe();function Gi(e,t,n,i,o,r,s){let a=Math.round(i*n),l=Math.round(o*n);(t.width!==a||t.height!==l)&&(t.width=a,t.height=l,e.Ct=!0);let u=t.getContext("2d");if(u){if(e.Ct){e.ue?.close(),e.ue=null,e.Ct=!1;let m=++e.vn;r(u),createImageBitmap(t).then(f=>{e.vn===m?(e.ue?.close(),e.ue=f):f.close()})}else e.ue&&(u.clearRect(0,0,t.width,t.height),u.drawImage(e.ue,0,0));s&&(u.save(),u.scale(n,n),s(u),u.restore())}}pi();Ye();xi();function la(e,t,n,i,o,r,s,a){if(n.length===0)return;let{Kn:l,wo:u,Ro:m}=t;e.font=`11px ${a}`;let f=16,p=8,d=0;for(let y of n){let _=e.measureText(y).width;_>d&&(d=_)}let b=d+p*2,x=n.length*f+p*2-4,h=i+12,g=o-x-8;h+b>r&&(h=i-b-12),h<0&&(h=4),g<0&&(g=o+12),g+x>s&&(g=s-x-4),e.fillStyle=l,e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.roundRect(h,g,b,x,4),e.fill(),e.stroke(),e.fillStyle=u,e.textAlign="left",e.textBaseline="top";for(let y=0;y<n.length;y++)e.fillText(n[y],h+p,g+p+y*f)}var ua=24,Lm=8,ma=12,fa=2,ca=" \\u203A ";function Wi(e,t,n,i,o){e.Ve=[];let r=e.A().Kn;t.fillStyle=r,t.fillRect(0,0,n,ua),t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let s=Lm,a=e.r;for(let l=0;l<e.le.length;l++){let u=e.le[l],m=l===e.le.length-1,f=a.name[u];t.fillStyle=o;let p=t.measureText(f).width;t.fillText(f,s,ma),e.Ve.push({nodeId:u,x0:s-fa,y0:0,x1:s+p+fa,y1:ua}),s+=p,m||(t.fillText(ca,s,ma),s+=t.measureText(ca).width)}}function ki(e,t,n,i,o,r,s,a){let l=e.W.hoveredTarget===n?e.W.lines??[]:[];l.length!==0&&la(t,e.A(),l,i,o,r,s,a)}function Ni(e,t,n,i,o,r,s,a=null){e.ye==="series"&&e.f.size>1?a?fn(t,a,e.f,n,o):hi(t,da(r,s),e.f,n,o):e.ye==="numeric"&&e.b<e.p&&St(t,da(r,s),{min:e.b,max:e.p,label:e.a},i,o,e.getColumnFormatter(e.a,"value"))}function da(e,t){return new ne(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0})}function pa(e,t){if(e.C===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.r,s=e.B.length>0&&e.G.facet_mode==="grid",a=e.le.length>1?28:0,u=(e.ye==="series"?e.f.size>1:e.ye==="numeric"&&e.b<e.p)?90:0,m=new Int32Array(Math.max(r.count,64));if(s)Tm(e,m,i,o,a,u);else{e.m=null;let b=r.depth[e.C];Bi(r,e.C,0,a,i-u,o,b,m,e.bi),aa(e,e.C,100,b),fr(e);let x=e.Ee,h=e.He;for(let g=0;g<e.oe;g++)x[g]=b,h[g]=e.C}if(!e.i){let b=j(t,"treemap",zn,Xn,["u_resolution"],["a_position","a_color"]);e.i=b.program,e.F=b}let f=e.A(),p=f.H,d=de(f.ke,p,Math.max(1,e.f.size));if(e.j){let b=e.j.getContext("2d");b&&b.clearRect(0,0,e.j.width,e.j.height)}e.Ct=!0,Rm(e,n,p,d,f.Qn),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.i),n.uniform2f(e.F.u_resolution,i,o),n.bindBuffer(n.ARRAY_BUFFER,e.Wt),n.enableVertexAttribArray(e.F.a_position),n.vertexAttribPointer(e.F.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.kt),n.enableVertexAttribArray(e.F.a_color),n.vertexAttribPointer(e.F.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.Ji),e.pe(()=>kt(e))}function Tm(e,t,n,i,o,r){let s=e.r,a=[],l=[];for(let b=s.firstChild[e.X];b!==-1;b=s.nextSibling[b])s.value[b]<=0||(a.push(b),l.push(s.name[b]));let u=Math.max(1,i-o),m=Math.max(1,n-r),f=Re(l,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.G.facet_padding});e.m=f,fr(e);let p=e.Ee,d=0;for(let b=0;b<a.length;b++){let x=a[b],h=f.cells[b];if(!h)continue;let g=s.name[x],y=e.st.get(g)??x,_=s.depth[y],C=h.layout.e;Bi(s,y,C.x,C.y+o,C.x+C.width,C.y+o+C.height,_,t,e.bi);let v=ur(e,y,100,_,d);p.length<v&&fr(e);let A=e.Ee,T=e.He;for(let L=d;L<v;L++)A[L]=_,T[L]=y;d=v}e.oe=d}function fr(e){let t=e.$?.length??e.r.count;(!e.Ee||e.Ee.length<t)&&(e.Ee=new Int32Array(t)),(!e.He||e.He.length<t)&&(e.He=new Int32Array(t))}function Rm(e,t,n,i,o){let r=e.r,s=e.$,a=e.oe,l=e.Ee,u=e.He,m=h=>l?l[h]:r.depth[e.C],f=h=>u?u[h]:e.C,p=0;for(let h=0;h<a;h++){let g=s[h];if(g===f(h))continue;let y=r.x1[g]-r.x0[g],_=r.y1[g]-r.y0[g];y<1||_<1||(r.firstChild[g]===-1?p++:r.depth[g]-m(h)===1&&(p+=2))}let d=new Float32Array(p*6*2),b=new Float32Array(p*6*4),x=0;for(let h=0;h<a;h++){let g=s[h];if(g===f(h))continue;let y=r.x0[g],_=r.y0[g],C=r.x1[g],v=r.y1[g],A=C-y,T=v-_;if(!(A<1||T<1)){if(r.firstChild[g]===-1){let L=Ei(e,g,n,i,o);x=mr(d,b,x,y,_,C-1,v-1,L)}else if(r.depth[g]-m(h)===1){let R=[.25,.25,.25,1];x=mr(d,b,x,y,v-1,C,v,R),x=mr(d,b,x,C-1,_,C,v,R)}}}e.Ji=x,e.Wt||(e.Wt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Wt),t.bufferData(t.ARRAY_BUFFER,d.subarray(0,x*2),t.DYNAMIC_DRAW),e.kt||(e.kt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.kt),t.bufferData(t.ARRAY_BUFFER,b.subarray(0,x*4),t.DYNAMIC_DRAW)}function mr(e,t,n,i,o,r,s,a){let l=n*2,u=n*4;e[l+0]=i,e[l+1]=o,e[l+2]=r,e[l+3]=o,e[l+4]=i,e[l+5]=s,e[l+6]=r,e[l+7]=o,e[l+8]=r,e[l+9]=s,e[l+10]=i,e[l+11]=s;for(let m=0;m<6;m++)t[u+m*4+0]=a[0],t[u+m*4+1]=a[1],t[u+m*4+2]=a[2],t[u+m*4+3]=a[3];return n+6}function kt(e){if(!e.c||e.C===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t,r=e.re!==-1?e.re:e.E;Gi(e,e.c,n,i,o,s=>wm(e,s,n,i,o),r!==-1?s=>{let a=e.A(),{fontFamily:l}=a,u=e.r;Mm(s,u,r);let m=e.$,f=e.oe,p=e.Ee,d=e.He;for(let b=0;b<f;b++){let x=m[b],h=d?d[b]:e.C;if(x===h||u.firstChild[x]===-1)continue;let g=u.x1[x]-u.x0[x],y=u.y1[x]-u.y0[x],_=p?p[b]:u.depth[e.C],C=u.depth[x]-_;C===1?Ui(s,u,x,g,y,a,!e.bi):C===2&&Ui(s,u,x,g,y,a,!0)}if(u.firstChild[r]===-1){let b=a.H,x=de(a.ke,b,Math.max(1,e.f.size)),h=u.x1[r]-u.x0[r],g=u.y1[r]-u.y0[r];ba(e,s,r,h,g,l,b,x,!0)}e.re===-1&&e.E!==-1&&Fm(e,s,e.E,i,o,l)}:null)}function wm(e,t,n,i,o){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Le:l}=s,u=s.H,m=de(s.ke,u,Math.max(1,e.f.size)),f=e.r,p=e.$,d=e.oe,b=e.Ee,x=e.He;for(let h=0;h<d;h++){let g=p[h],y=x?x[h]:e.C;if(g===y||f.firstChild[g]!==-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g];ba(e,t,g,_,C,a,u,m)}for(let h=0;h<d;h++){let g=p[h],y=x?x[h]:e.C;if(g===y||f.firstChild[g]===-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g],v=b?b[h]:f.depth[e.C],A=f.depth[g]-v;A===1?Ui(t,f,g,_,C,s,!e.bi):A===2&&Ui(t,f,g,_,C,s,!0)}if(e.le.length>1&&Wi(e,t,i,a,l),Ni(e,r,m,u,s,i,o),e.m){t.font=`11px ${a}`,t.fillStyle=l,t.textAlign="center",t.textBaseline="top";for(let h of e.m.cells){let g=h.layout.e;t.fillText(h.label,g.x+g.width/2,g.y-14)}}t.restore()}function ba(e,t,n,i,o,r,s,a,l=!1){if(i<30||o<14)return;let p=e.r,d=hn(e,n,s,a),b=Pi(d[0],d[1],d[2]),x=l?b>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":b>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",h=Math.min(11,Math.floor(o/2));if(h<7)return;t.font=`${h}px ${r}`;let g=i-8,y=h*1.3,_=Math.max(1,Math.floor((o-8)/y)),C=Gs(t,p.name[n],g,_);if(C.length===0)return;let v=C.length*y,A=p.y0[n]+(o-v)/2+y/2;t.fillStyle=x,t.textAlign="center",t.textBaseline="middle";let T=p.x0[n]+i/2;for(let L=0;L<C.length;L++)t.fillText(C[L],T,A+L*y)}function Ui(e,t,n,i,o,{fontFamily:r,Le:s,backgroundColor:a},l){let u=t.x0[n],m=t.y0[n],f=t.name[n];if(l){if(i<60||o<30)return;let p=12;e.font=`${p}px ${r}`;let d=f,b=i-16;if(e.measureText(d).width>b){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=b){d+="\\u2026";break}}if(d.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,i,o),e.clip();let h=u+i/2,g=m+o/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(d,h,g),e.fillStyle=a,e.fillText(d,h,g),e.restore()}else{if(i<40||o<22)return;let p=11;e.font=`${p}px ${r}`;let d=f,b=i-10;if(e.measureText(d).width>b){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=b){d+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(d,u+5,m+4),e.globalAlpha=1}}function Mm(e,t,n){e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.strokeRect(t.x0[n],t.y0[n],t.x1[n]-t.x0[n],t.y1[n]-t.y0[n])}function Fm(e,t,n,i,o,r){let s=e.r,a=(s.x0[n]+s.x1[n])/2,l=(s.y0[n]+s.y1[n])/2;ki(e,t,n,a,l,i,o,r)}async function ke(e,t,n){let i=e.r,o=na(i,t),r=e.B.length>0&&e.G.facet_mode==="grid",s=r?o.slice(0,e.B.length):[],a=r?o.slice(e.B.length,e.B.length+e._.length):o.slice(0,e._.length),l=n==="leaf"?i.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.ne,groupByValues:a,splitByValues:s})}async function dt(e,t){let n=e.r,i=[],o=[],r=t;for(;n.parent[r]!==-1;)o.push(n.name[r]),r=n.parent[r];o.reverse(),o.length>0?i.push(o.join(" \\u203A ")):i.push(n.name[t]);let s=e.getColumnFormatter(e.ne,"value");if(i.push(`Value: ${s(n.value[t])}`),e.a&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.a,"value");i.push(`${e.a}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.De){let u=await e.De.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.a&&!isNaN(n.colorValue[t])||(typeof f=="number"?i.push(`${m}: ${e.getColumnFormatter(m,"value")(f)}`):i.push(`${m}: ${f}`)))}return n.firstChild[t]!==-1&&i.push(`Children: ${n.childCount[t]}`),i}function Oi(e,t,n,i){e.T.dismiss(),e.re=t;let o=e.t?.cssWidth??0,r=e.t?.cssHeight??0;dt(e,t).then(s=>{e.re===t&&s.length!==0&&e.T.pin(s,{px:n.cx,py:n.cy},{cssWidth:o,cssHeight:r})}),e.E=-1,i()}function Vi(e){e.T.dismiss(),e.re=-1}function Hi(e,t,n){let i=e.r;if(e.B.length>0&&e.G.facet_mode==="grid"){let o=t;for(;o!==-1&&i.parent[o]!==e.X;)o=i.parent[o];o!==-1&&e.st.set(i.name[o],t),e.E=-1,n();return}e.C=t,Di(e,t),e.E=-1,n()}function cr(e,t,n){let i=e.r,o=i.x0,r=i.y0,s=i.x1,a=i.y1,l=i.depth,u=i.firstChild,m=e.$,f=e.oe,p=e.Ee,d=e.He,b=-1,x=1/0,h=-1,g=1/0,y=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let _=0;_<f;_++){let C=m[_],v=d?d[_]:e.C;if(C===v||!(t>=o[C]&&t<=s[C]&&n>=r[C]&&n<=a[C]))continue;let A=(s[C]-o[C])*(a[C]-r[C]);if(u[C]!==-1){A<g&&(g=A,h=C);let T=p?p[_]:l[e.C],L=l[C]-T;if(L===1&&n<=r[C]+lr&&(y=C),L===2){let R=s[C]-o[C],F=a[C]-r[C];if(R>=60&&F>=30){let I=r[C]+F/2,S=o[C]+R/2;Math.abs(n-I)<10&&Math.abs(t-S)<R*.4&&(y=C)}}}else A<x&&(x=A,b=C)}return y!==-1?{leafId:-1,branchId:y,inHeader:!0}:{leafId:b,branchId:h,inHeader:!1}}function ga(e,t,n){if(e.re!==-1)return;for(let a of e.Ve)if(t>=a.x0&&t<=a.x1&&n>=a.y0&&n<=a.y1){e.T.setCursor("pointer"),e.E=-1,kt(e);return}let{leafId:i,branchId:o,inHeader:r}=cr(e,t,n),s=r?o:i!==-1?i:o;if(s!==e.E){if(e.E=s,e.T.setCursor(o!==-1?"pointer":"default"),s!==-1){let a=e.W.beginHover(s);dt(e,s).then(l=>{e.W.commitHover(a,l)&&kt(e)})}else e.W.clearHover();kt(e)}}function ha(e,t,n){if(e.re!==-1){xn(e),e.emitUnselect();return}for(let s of e.Ve)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(Yi(e,s.nodeId),e.emitUnselect());return}let{leafId:i,branchId:o,inHeader:r}=cr(e,t,n);o!==-1&&r?(Yi(e,o),ke(e,o,"branch")):i!==-1?(ya(e,i),ke(e,i,"leaf")):o!==-1&&(Yi(e,o),ke(e,o,"branch"))}function xa(e,t,n){let i=e.re!==-1;xn(e),i&&e.emitUnselect();let{leafId:o,branchId:r}=cr(e,t,n),s=e.r,a=r;if(a===-1&&o!==-1){let l=s.parent[o];l!==e.C&&l!==-1&&(a=l)}a!==-1&&a!==e.C&&s.firstChild[a]!==-1&&(Yi(e,a),ke(e,a,"branch"),o!==-1&&s.firstChild[o]===-1&&(ya(e,o),ke(e,o,"leaf")))}function Yi(e,t){Hi(e,t,()=>{e.t&&e.requestRender(e.t)})}function ya(e,t){let n=e.r,i=(n.x0[t]+n.x1[t])/2,o=(n.y0[t]+n.y1[t])/2;Oi(e,t,{cx:i,cy:o},()=>kt(e))}function xn(e){Vi(e)}var zi=class extends Et{constructor(){super(...arguments);c(this,"i",null);c(this,"F",null);c(this,"Wt",null);c(this,"kt",null);c(this,"Ji",0);c(this,"E",-1);c(this,"re",-1);c(this,"Ve",[]);c(this,"ue",null);c(this,"Ct",!0);c(this,"vn",0);c(this,"st",new Map);c(this,"m",null);c(this,"bi",!1);c(this,"Ee",null);c(this,"He",null)}tooltipCallbacks(){return{onHover:(n,i)=>ga(this,n,i),onLeave:()=>{this.E!==-1&&this.re===-1&&(this.E=-1,this.t&&this.requestRender(this.t))},onClickPre:(n,i)=>(ha(this,n,i),!0),onDblClick:(n,i)=>xa(this,n,i)}}async uploadAndRender(n,i,o,r){if(this.t=n,o===0){let s=this.I;if(this.ne=s[0]||Mi(i)||"",this.a=s[1]||"",!this.a)this.ye="empty";else{let a=this.Ne[this.a],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.ye=l?"numeric":"series"}this.E=-1,this.re=-1,this.Ve=[],this.st.clear(),this.m=null,this.Ee=null,this.He=null,this.Ji=0,this.W.clearHover(),this.W.invalidatePin(),xn(this),this.ue?.close(),this.ue=null,this.Ct=!0,this.vn++,dn(this)}pn(this,i),bn(this),this.X!==-1&&await this.requestRender(n)}Dt(n){this.X!==-1&&(this.t=n,pa(this,n))}destroyInternal(){xn(this),this.ue?.close(),this.ue=null;let n=this.t?.gl;n&&(this.Wt&&n.deleteBuffer(this.Wt),this.kt&&n.deleteBuffer(this.kt)),this.Wt=null,this.kt=null,this.i=null,this.F=null,this.X=-1,this.C=-1,this.le=[],this.Gt.clear(),this.$=null,this.oe=0,this.Ve=[],this.st.clear(),this.m=null,this.Ee=null,this.He=null}};nn();Me();fe();var Ca=4,yn=30;function Sm(e,t){let n=0,i=e.depth[t],o=new Int32Array(128);o[0]=t;let r=1;for(;r>0;){r--;let s=o[r],a=e.depth[s]-i;a>n&&(n=a);for(let l=e.firstChild[s];l!==-1;l=e.nextSibling[l]){if(r>=o.length){let u=new Int32Array(o.length*2);u.set(o),o=u}o[r++]=l}}return n}function dr(e,t,n){let i=e.depth[t],o=Math.max(1,Sm(e,t)),s=Math.max(0,n-yn)/o;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=yn,_a(e,t,0,2*Math.PI,yn,s,i)}function _a(e,t,n,i,o,r,s){let a=e.value[t];if(a<=0)return;let l=i-n,u=n;for(let m=e.firstChild[t];m!==-1;m=e.nextSibling[m]){let f=e.value[m];if(f<=0)continue;let p=f/a,d=u,b=u+l*p;u=b;let x=o,h=o+r;e.a0[m]=d,e.a1[m]=b,e.r0[m]=x,e.r1[m]=h;let g=b-d,y=(x+h)/2;g*y*r<Ca||e.firstChild[m]!==-1&&_a(e,m,d,b,h,r,s)}}function va(e,t){e.oe=pr(e,t,0)}function pr(e,t,n){let i=e.r,o=i.a0,r=i.a1,s=i.r0,a=i.r1,l=i.firstChild,u=i.nextSibling,m=i.value;(!e.$||e.$.length<i.count)&&(e.$=new Int32Array(i.count));let f=e.$,p=n,d=new Int32Array(128);d[0]=t;let b=1;for(;b>0;){b--;let x=d[b];if(m[x]<=0)continue;f[p++]=x;let h=r[x]-o[x],g=(s[x]+a[x])/2,y=h*g,_=a[x]-s[x];if(!(y*_<Ca))for(let C=l[x];C!==-1;C=u[C]){if(b>=d.length){let v=new Int32Array(d.length*2);v.set(d),d=v}d[b++]=C}}return p}vt();var Xi=32,Im=28,Dm=90;function $i(e,t){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut};let n=e.r;for(let i of e.u){let o=t;for(;o!==-1;){if(o===i.drillRoot)return{centerX:i.centerX,centerY:i.centerY};o=n.parent[o]}}return{centerX:e.lt,centerY:e.ut}}function Ta(e,t){if(e.C===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.B.length>0&&e.G.facet_mode==="grid",s=e.ye==="series"?e.f.size>1:e.ye==="numeric"&&e.b<e.p,a=!r&&e.le.length>1?Im:0,l=s?Dm:0;if(r)Bm(e,i,o,l);else{e.m=null,e.u=[];let b=i-l,x=o-a;e.lt=b/2,e.ut=a+x/2,e.Qi=Math.max(0,Math.min(b,x)/2-4),dr(e.r,e.C,e.Qi),va(e,e.C)}Pm(e,t);let u=e.A(),m=u.H,f=de(u.ke,m,Math.max(1,e.f.size));if(e.j){let b=e.j.getContext("2d");b&&b.clearRect(0,0,e.j.width,e.j.height)}let p=t.dpr;e.Ct=!0,Em(e,n,m,f,u.Qn,p),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.i);let d=e.F;if(n.uniform2f(d.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(d.u_border_px,u.Fo*p),e.u.length>0)for(let b of e.u)b.instanceCount!==0&&(n.uniform2f(d.u_center,b.centerX*p,b.centerY*p),Aa(e,n,t,b.instanceStart,b.instanceCount));else n.uniform2f(d.u_center,e.lt*p,e.ut*p),Aa(e,n,t,0,e.eo);e.pe(()=>qe(e))}function Bm(e,t,n,i){let o=e.r,r=[],s=[];for(let f=o.firstChild[e.X];f!==-1;f=o.nextSibling[f])o.value[f]<=0||(r.push(f),s.push(o.name[f]));let a=Math.max(1,t-i),l=Re(s,{cssWidth:a,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.G.facet_padding});e.m=l;let u=[],m=0;for(let f=0;f<r.length;f++){let p=r[f],d=l.cells[f];if(!d)continue;let b=o.name[p],x=e.st.get(b)??p,h=d.layout.e,g=h.x+h.width/2,y=h.y+h.height/2,_=Math.max(0,Math.min(h.width,h.height)/2-4);dr(o,x,_);let C=pr(e,x,m),v=m,A=C-m;u.push({label:b,centerX:g,centerY:y,maxRadius:_,drillRoot:x,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=C}e.oe=m,e.u=u,u.length>0&&(e.lt=u[0].centerX,e.ut=u[0].centerY,e.Qi=u[0].maxRadius)}function Pm(e,t){if(e.i)return;let n=t.gl,i=j(t,"sunburst-arc",Hn,Yn,["u_center","u_resolution","u_border_px"],["a_strip_t","a_side","a_angles","a_radii","a_color"]);e.i=i.program,e.F=i;let o=new Float32Array((Xi+1)*2*2);for(let r=0;r<=Xi;r++){let s=r/Xi,a=r*4;o[a+0]=s,o[a+1]=0,o[a+2]=s,o[a+3]=1}e.Qt=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.Qt),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),e.en=n.createBuffer()}function Em(e,t,n,i,o,r){let s=e.r,a=e.$,l=e.u.length>0,u=l?e.u.reduce((d,b)=>d+b.instanceCount,0):e.oe,m=new Float32Array(u*8),f=0,p=(d,b,x)=>{let h=f;for(let g=d;g<b;g++){let y=a[g];if(y===x)continue;let _=s.a0[y],C=s.a1[y],v=s.r0[y],A=s.r1[y];if(C<=_||A<=v)continue;let T=Ei(e,y,n,i,o),L=f*8;m[L+0]=_,m[L+1]=C,m[L+2]=v*r,m[L+3]=A*r,m[L+4]=T[0],m[L+5]=T[1],m[L+6]=T[2],m[L+7]=T[3],f++}return{rangeStart:h,rangeCount:f-h}};if(l)for(let d of e.u){let b=d.instanceStart,x=b+d.instanceCount,{rangeStart:h,rangeCount:g}=p(b,x,d.drillRoot);d.instanceStart=h,d.instanceCount=g}else p(0,e.oe,e.C);e.eo=f,t.bindBuffer(t.ARRAY_BUFFER,e.en),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function Aa(e,t,n,i,o){if(o===0)return;let r=e.F;t.bindBuffer(t.ARRAY_BUFFER,e.Qt);let s=2*Float32Array.BYTES_PER_ELEMENT;t.enableVertexAttribArray(r.a_strip_t),t.vertexAttribPointer(r.a_strip_t,1,t.FLOAT,!1,s,0),t.enableVertexAttribArray(r.a_side),t.vertexAttribPointer(r.a_side,1,t.FLOAT,!1,s,Float32Array.BYTES_PER_ELEMENT);let a=J(n),{setDivisor:l}=a;l(r.a_strip_t,0),l(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.en);let u=8*Float32Array.BYTES_PER_ELEMENT,m=Float32Array.BYTES_PER_ELEMENT,f=i*u;t.enableVertexAttribArray(r.a_angles),t.vertexAttribPointer(r.a_angles,2,t.FLOAT,!1,u,f),l(r.a_angles,1),t.enableVertexAttribArray(r.a_radii),t.vertexAttribPointer(r.a_radii,2,t.FLOAT,!1,u,f+2*m),l(r.a_radii,1),t.enableVertexAttribArray(r.a_color),t.vertexAttribPointer(r.a_color,4,t.FLOAT,!1,u,f+4*m),l(r.a_color,1),a.drawArraysInstanced(t.TRIANGLE_STRIP,0,2*(Xi+1),o),l(r.a_angles,0),l(r.a_radii,0),l(r.a_color,0)}function qe(e){if(!e.c||e.C===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t;Gi(e,e.c,n,i,o,r=>Gm(e,r,n,i,o),e.E!==-1?r=>{Wm(r,e,e.E),km(e,r,e.E,i,o,e.A().fontFamily)}:null)}function Gm(e,t,n,i,o){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Le:l,Kn:u}=s,m=s.H,f=de(s.ke,m,Math.max(1,e.f.size)),p=e.r,d=e.$,b=e.oe,x=e.u.length>0;if(x)for(let g of e.u){let y=g.nodeStart+g.nodeCount;for(let _=g.nodeStart;_<y;_++){let C=d[_];C!==g.drillRoot&&La(e,t,C,a,m,f,g.centerX,g.centerY)}}else for(let g=0;g<b;g++){let y=d[g];y!==e.C&&La(e,t,y,a,m,f,e.lt,e.ut)}let h=Math.max(0,yn-s.Fo*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",x){for(let g of e.u)if(t.beginPath(),t.fillStyle=u,t.arc(g.centerX,g.centerY,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(p.name[g.drillRoot],g.centerX,g.centerY),e.m){let y=e.m.cells.find(_=>_.label===g.label);y?.titleRect&&(t.fillStyle=l,t.font=`11px ${a}`,t.textBaseline="middle",t.fillText(g.label,y.titleRect.x+y.titleRect.width/2,y.titleRect.y+y.titleRect.height/2))}}else t.beginPath(),t.arc(e.lt,e.ut,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(p.name[e.C],e.lt,e.ut);!x&&e.le.length>1&&Wi(e,t,i,a,l),Ni(e,r,f,m,s,i,o,x?e.m?.legendRect??null:null),t.restore()}function La(e,t,n,i,o,r,s,a){let l=e.r,u=l.a0[n],m=l.a1[n],f=l.r0[n],p=l.r1[n],d=p-f,b=(f+p)/2,h=(m-u)*b;if(d<16||h<8)return;let g=Math.min(11,Math.floor(h*.7));if(g<7)return;t.font=`${g}px ${i}`;let y=l.name[n],_=d-4,C=y;if(t.measureText(C).width>_){for(;C.length>1;)if(C=C.slice(0,-1),t.measureText(C+"\\u2026").width<=_){C+="\\u2026";break}}if(C.length<2)return;let v=(u+m)/2;t.save(),t.translate(s,a);let A=v,T=v>Math.PI/2&&v<3*Math.PI/2;e.Uo==="upright"&&T&&(A+=Math.PI),t.rotate(A);let L=hn(e,n,o,r),R=Pi(L[0],L[1],L[2]);t.fillStyle=R>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)",t.textAlign="center",t.textBaseline="middle";let F=e.Uo==="upright"&&T?-b:b;t.fillText(C,F,0),t.restore()}function Wm(e,t,n){let i=t.r,o=i.a0[n],r=i.a1[n],s=i.r0[n],a=i.r1[n],{centerX:l,centerY:u}=$i(t,n);e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.beginPath(),e.arc(l,u,a,o,r),e.arc(l,u,s,r,o,!0),e.closePath(),e.stroke()}function km(e,t,n,i,o,r){let s=e.r,a=(s.a0[n]+s.a1[n])/2,l=(s.r0[n]+s.r1[n])/2,{centerX:u,centerY:m}=$i(e,n),f=u+Math.cos(a)*l,p=m+Math.sin(a)*l;ki(e,t,n,f,p,i,o,r)}function Ra(e,t,n){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut,drillRoot:e.C};for(let i of e.u){let o=t-i.centerX,r=n-i.centerY;if(!(Math.sqrt(o*o+r*r)>i.maxRadius+4))return{centerX:i.centerX,centerY:i.centerY,drillRoot:i.drillRoot}}return null}function Nm(e,t,n){let i=e.r,o=t;for(;o!==-1;){if(o===n)return!0;o=i.parent[o]}return!1}function wa(e,t,n){let i=Ra(e,t,n);if(!i)return-1;let o=e.r,r=e.$,s=e.oe;if(!r)return-1;let a=t-i.centerX,l=n-i.centerY,u=Math.sqrt(a*a+l*l),m=Math.atan2(l,a);if(m<0&&(m+=2*Math.PI),u<o.r1[e.X]+.001&&i.drillRoot!==e.X)return i.drillRoot;let f=e.u.length>0;for(let p=0;p<s;p++){let d=r[p];if(d===i.drillRoot||f&&!Nm(e,d,i.drillRoot))continue;let b=o.a0[d],x=o.a1[d],h=o.r0[d],g=o.r1[d];if(!(u<h||u>g)&&!(m<b||m>x))return d}return-1}function Ma(e,t,n){if(e.re!==-1)return;for(let r of e.Ve)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.T.setCursor("pointer"),e.E!==-1&&(e.E=-1,qe(e));return}let i=wa(e,t,n),o=e.r;if(e.T.setCursor(i!==-1&&o.firstChild[i]!==-1?"pointer":"default"),i!==e.E){if(e.E=i,i!==-1){let r=e.W.beginHover(i);dt(e,i).then(s=>{e.W.commitHover(r,s)&&qe(e)})}else e.W.clearHover();qe(e)}}function Fa(e,t,n){if(e.re!==-1){ji(e),e.emitUnselect();return}for(let s of e.Ve)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(br(e,s.nodeId),e.emitUnselect());return}let i=e.r,o=Ra(e,t,n);if(o){let s=t-o.centerX,a=n-o.centerY;if(Math.sqrt(s*s+a*a)<i.r1[e.X]+.001){let u=i.parent[o.drillRoot];if(u!==-1&&u!==e.X)br(e,u),e.emitUnselect();else if(e.u.length>0){let m=e.u.find(f=>f.drillRoot===o.drillRoot);m&&(e.st.delete(m.label),e.emitUnselect()),e.t&&e.requestRender(e.t)}return}}let r=wa(e,t,n);r!==-1&&(i.firstChild[r]!==-1?(br(e,r),ke(e,r,"branch")):(Um(e,r),ke(e,r,"leaf")))}function br(e,t){Hi(e,t,()=>{e.t&&e.requestRender(e.t)})}function Um(e,t){let n=e.r,i=(n.a0[t]+n.a1[t])/2,o=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=$i(e,t),a=r+Math.cos(i)*o,l=s+Math.sin(i)*o;Oi(e,t,{cx:a,cy:l},()=>qe(e))}function ji(e){Vi(e)}var Zi=class extends Et{constructor(){super(...arguments);c(this,"i",null);c(this,"F",null);c(this,"Qt",null);c(this,"en",null);c(this,"eo",0);c(this,"Uo","upright");c(this,"lt",0);c(this,"ut",0);c(this,"Qi",0);c(this,"E",-1);c(this,"re",-1);c(this,"Ve",[]);c(this,"ue",null);c(this,"Ct",!0);c(this,"vn",0);c(this,"m",null);c(this,"st",new Map);c(this,"u",[])}tooltipCallbacks(){return{onHover:(n,i)=>Ma(this,n,i),onLeave:()=>{this.E!==-1&&this.re===-1&&(this.E=-1,qe(this))},onClickPre:(n,i)=>(Fa(this,n,i),!0)}}async uploadAndRender(n,i,o,r){if(this.t=n,o===0){let s=this.I;if(this.ne=s[0]||Mi(i)||"",this.a=s[1]||"",!this.a)this.ye="empty";else{let a=this.Ne[this.a],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.ye=l?"numeric":"series"}this.E=-1,this.re=-1,this.Ve=[],this.st.clear(),this.m=null,this.u=[],this.eo=0,this.W.clearHover(),this.W.invalidatePin(),ji(this),this.ue?.close(),this.ue=null,this.Ct=!0,this.vn++,dn(this)}pn(this,i),bn(this),this.X!==-1&&await this.requestRender(n)}Dt(n){this.X!==-1&&(this.t=n,Ta(this,n))}destroyInternal(){ji(this),this.ue?.close(),this.ue=null;let n=this.t?.gl;n&&(this.Qt&&n.deleteBuffer(this.Qt),this.en&&n.deleteBuffer(this.en)),this.Qt=null,this.en=null,this.i=null,this.F=null,this.X=-1,this.C=-1,this.le=[],this.Gt.clear(),this.$=null,this.oe=0,this.Ve=[],this.m=null,this.st.clear(),this.u=[]}};Jt();var Nt=class extends Te{constructor(){super(...arguments);c(this,"we",[]);c(this,"ee",0);c(this,"mt",0);c(this,"i",null);c(this,"k",null);c(this,"l",null);c(this,"he",null);c(this,"xe",null);c(this,"Re",null);c(this,"oi",!0)}getZoomConfig(){return{lockAxis:"y"}}};Qt();function qi(e,t=.5,n=.1){let i=t/Math.max(1,e),o=i*(1-n)/2;return{slotWidth:i,halfWidth:o}}function Sa(e,t,n="bar"){let i=t?.[e]?.chart_type?.toLowerCase?.();return i==="bar"||i==="line"||i==="scatter"||i==="area"?i:n}function Ia(e,t,n){let i=n?.[e]?.stack;return typeof i=="boolean"?i:t==="bar"||t==="area"}function gr(e,t){return t?.[e]?.alt_axis===!0}function Da(e,t,n){if(t!=="line"&&t!=="area")return"skip";let i=n?.[e]?.interpolate;return i===void 0||t==="area"?"solid":i}var Ba=50,pt=0,Ki=1;function Ji(){return{count:0,catIdx:new Int32Array(0),seriesId:new Int32Array(0),axis:new Uint8Array(0),chartType:new Uint8Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),y0:new Float64Array(0),y1:new Float64Array(0)}}function Om(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),seriesId:new Int32Array(t),axis:new Uint8Array(t),chartType:new Uint8Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),y0:new Float64Array(t),y1:new Float64Array(t)}}function Cn(e,t,n,i,o){let r=e.seriesId[t],s=e.catIdx[t];return{catIdx:s,aggIdx:Math.floor(r/n),splitIdx:r%n,seriesId:r,xCenter:e.xCenter[t],halfWidth:e.halfWidth[t],y0:e.y0[t],y1:e.y1[t],value:i[s*o+r],axis:e.axis[t],chartType:e.chartType[t]===pt?"bar":"area"}}function Pa(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function Ea(e,t){e[t>>3]|=1<<(t&7)}function Ga(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,columnsConfig:a,defaultChartType:l,autoAltYAxis:u,bandInnerFrac:m,barInnerPad:f,includeZero:p,facetSplits:d,scratchBars:b,scratchPosStack:x,scratchNegStack:h}=e,g=Gt(o,s),y={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:g,numericCategoryDomain:null,categoryPositions:null,series:[],bars:Ji(),posStack:x??null,negStack:h??null,samples:new Float32Array(0),sampleValid:new Uint8Array(0),leftDomain:{min:0,max:0},rightDomain:null,hasRightAxis:!1,leftValueAxisMode:"numeric",rightValueAxisMode:null,leftValueCategoryDomain:null,rightValueCategoryDomain:null},_=i.filter(w=>!!w);if(_.length===0)return y;let C=[];if(r.length>0){for(let w of He(t,[],_))w.colNames.size>0&&C.push(w.prefix);C.length===0&&C.push("")}else C.push("");let v=o.map(w=>s[w]??"string"),{rowPaths:A,numCategories:T,rowOffset:L}=Wt(t,n,o.length,v);if(T===0)return{...y,aggregates:_,splitPrefixes:C,rowPaths:A,rowOffset:L};let R=[],F=_.length,I=C.length;for(let w=0;w<F;w++)for(let P=0;P<I;P++){let E=_[w],U=C[P],z=U===""?E:`${U}${F>1?` | ${E}`:""}`,H=Sa(E,a,l),Z=Ia(E,H,a),be=Da(E,H,a);R.push({seriesId:w*I+P,aggIdx:w,splitIdx:P,aggName:E,splitKey:U,label:z,color:[.5,.5,.5],axis:0,chartType:H,stack:Z,start:-1,end:-1,interpolateMode:be})}let S=[];for(let w=0;w<F;w++)S.push(p?{min:0,max:0}:{min:1/0,max:-1/0});let D=T,B=R.length,N=d?D*F*I:D*F,k=Pa(x??null,N),Y=Pa(h??null,N);k.fill(0,0,N),Y.fill(0,0,N);let W=new Float32Array(D*B),V=new Uint8Array(D*B+7>>3),O=null,X=null,q=1;if(g.mode==="numeric"&&D>0){let w=t.get("__ROW_PATH_0__"),P=ct(w?.values,D,L,o[0]??"",g.numericType==="date"||g.numericType==="datetime");P&&(O=P.categoryPositions,X=P.numericCategoryDomain,q=P.numericCategoryDomain.bandWidth)}let le=qi(F,m,f),Fe=le.slotWidth*q,_e=le.halfWidth*q,ve=new Float64Array(F),et=(F-1)/2;for(let w=0;w<F;w++)ve[w]=(w-et)*Fe;let zt=new Array(F*I),Xt=new Array(F*I);for(let w=0;w<F;w++){let P=_[w];for(let E=0;E<I;E++){let U=C[E],z=U===""?P:`${U}|${P}`,H=t.get(z),Z=w*I+E;zt[Z]=H?.values??null,Xt[Z]=H?.valid??null}}let $t=new Array(F),ge=new Array(F),se=!1;for(let w=0;w<F;w++){let P=_[w],E=C[0],U=E===""?P:`${E}|${P}`;$t[w]=t.get(U)?.type==="string",ge[w]=gr(P,a)?1:0,$t[w]&&(se=!0)}let Q=[],ie=[],Se=[],Ie=[];for(let w=0;w<F;w++){let P=_[w];for(let E=0;E<I;E++){let U=C[E],z=U===""?P:`${U}|${P}`,H=w*I+E,Z={name:z,type:$t[w]?"string":"numeric",data:t.get(z)};ge[w]===0?(Q.push(Z),Se.push(H)):(ie.push(Z),Ie.push(H))}}let Xr=Q.map(w=>w.name).filter((w,P,E)=>E.indexOf(w)===P).join(", "),Ao=ie.map(w=>w.name).filter((w,P,E)=>E.indexOf(w)===P).join(", "),De=Q.length>0?ar(Q,n,L,Xr):null,K=ie.length>0?ar(ie,n,L,Ao):null,bt=new Array(F*I).fill(null);if(De)for(let w=0;w<Se.length;w++)bt[Se[w]]=De.perColumnSlots[w];if(K)for(let w=0;w<Ie.length;w++)bt[Ie[w]]=K.perColumnSlots[w];let Bl=D*F*I,$=Om(b??null,Bl),ee=0;for(let w=0;w<D;w++){let P=w+L;for(let E=0;E<F;E++)for(let U=0;U<I;U++){let z=E*I+U,H=bt[z];if(H){let ae=E*I+U,he=w*B+ae;W[he]=H[w],Ea(V,he);continue}let Z=zt[z];if(!Z)continue;let be=Xt[z];if(be&&!(be[P>>3]>>(P&7)&1))continue;let te=Z[P];if(!isFinite(te))continue;let ht=E*I+U,nt=w*B+ht;W[nt]=te,Ea(V,nt)}}for(let w=0;w<B;w++){let P=-1,E=-1;for(let U=0;U<D;U++){let z=U*B+w;V[z>>3]>>(z&7)&1&&(P===-1&&(P=U),E=U)}R[w].start=P,R[w].end=E}for(let w=0;w<B;w++){let P=R[w];if(!(P.start<0)&&P.interpolateMode!=="skip"){if(P.chartType==="line"){let E=P.start;for(let U=P.start+1;U<=P.end;U++){let z=U*B+w;if(V[z>>3]>>(z&7)&1){if(U-E>1){let Z=E*B+w,be=W[Z],te=W[z],ht=O?O[E]:E,ae=(O?O[U]:U)-ht;for(let he=1;he<U-E;he++){let ce=E+he,xe=O?O[ce]:ce,Ul=ae===0?0:(xe-ht)/ae;W[ce*B+w]=be+(te-be)*Ul}}E=U}}}else if(P.chartType==="area"){for(let E=0;E<P.start;E++)W[E*B+w]=0;for(let E=P.end+1;E<D;E++)W[E*B+w]=0;P.start=0,P.end=D-1}}}for(let w=0;w<D;w++){let P=O?O[w]:w;for(let E=0;E<F;E++){let U=ve[E],z=P+U,H=S[E];for(let Z=0;Z<I;Z++){let be=E*I+Z,te=R[be];if(w<te.start||w>te.end)continue;let ht=te.chartType==="line"||te.chartType==="area"&&te.interpolateMode!=="skip",nt=w*B+be;if(!ht&&!(V[nt>>3]>>(nt&7)&1))continue;let ae=W[nt];if((te.chartType==="bar"||te.chartType==="area")&&te.stack){if(ae===0&&(te.chartType!=="area"||te.interpolateMode==="skip"))continue;let he=d?(w*F+E)*I+Z:w*F+E,ce,xe;ae>=0?(ce=k[he],xe=ce+ae,k[he]=xe):(ce=Y[he],xe=ce+ae,Y[he]=xe),ce<H.min&&(H.min=ce),xe<H.min&&(H.min=xe),ce>H.max&&(H.max=ce),xe>H.max&&(H.max=xe),$.catIdx[ee]=w,$.seriesId[ee]=be,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:Ki,$.xCenter[ee]=z,$.halfWidth[ee]=_e,$.y0[ee]=ce,$.y1[ee]=xe,ee++}else if(ae<H.min&&(H.min=ae),ae>H.max&&(H.max=ae),p&&(0<H.min&&(H.min=0),0>H.max&&(H.max=0)),te.chartType==="bar"||te.chartType==="area"){if(ae===0)continue;$.catIdx[ee]=w,$.seriesId[ee]=be,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:Ki,$.xCenter[ee]=z,$.halfWidth[ee]=_e,$.y0[ee]=0,$.y1[ee]=ae,ee++}}}}$.count=ee;let gt=!1;if(u&&F>=2&&!se){let w=new Array(F),P=0,E=1/0;for(let U=0;U<F;U++){let z=S[U],H=Math.max(Math.abs(z.min),Math.abs(z.max),1e-12);w[U]=H,H>P&&(P=H),H<E&&(E=H)}if(P/E>Ba){let U=P/Math.sqrt(Ba);for(let z=0;z<F;z++)if(w[z]<U)for(let Z of R)Z.aggIdx===z&&(Z.axis=1);for(let z=0;z<$.count;z++)$.axis[z]=R[$.seriesId[z]].axis;gt=R.some(z=>z.axis===1)}}let $r=!1;for(let w=0;w<F;w++)if(gr(_[w],a))for(let P of R)P.aggIdx===w&&(P.axis=1,$r=!0);if($r){for(let w=0;w<$.count;w++)$.axis[w]=R[$.seriesId[w]].axis;gt=!0}let Be=p?{min:0,max:0}:{min:1/0,max:-1/0},tt=p?{min:0,max:0}:{min:1/0,max:-1/0};for(let w=0;w<$.count;w++){let P=$.axis[w]===0?Be:tt,E=$.y0[w],U=$.y1[w];E<P.min&&(P.min=E),U<P.min&&(P.min=U),E>P.max&&(P.max=E),U>P.max&&(P.max=U)}for(let w=0;w<B;w++){let P=R[w];if(P.stack&&(P.chartType==="bar"||P.chartType==="area")||P.start<0)continue;let E=P.chartType==="line"||P.chartType==="area"&&P.interpolateMode!=="skip",U=P.axis===0?Be:tt;for(let z=P.start;z<=P.end;z++){let H=z*B+w;if(!E&&!(V[H>>3]>>(H&7)&1))continue;let Z=W[H];Z<U.min&&(U.min=Z),Z>U.max&&(U.max=Z)}}(!isFinite(Be.min)||!isFinite(Be.max)||Be.min===0&&Be.max===0)&&(Be.min=0,Be.max=1);let Pl=!isFinite(tt.min)||!isFinite(tt.max)||tt.min===0&&tt.max===0,El=gt?Pl?{min:0,max:1}:tt:null,Gl=De?"category":"numeric",Wl=gt?K?"category":"numeric":null,kl=De&&De.domain.numRows>0?{min:0,max:Math.max(0,De.domain.numRows-1)}:Be,Nl=K&&K.domain.numRows>0&>?{min:0,max:Math.max(0,K.domain.numRows-1)}:El;return{aggregates:_,splitPrefixes:C,rowPaths:A,numCategories:T,rowOffset:L,axisMode:g,numericCategoryDomain:X,categoryPositions:O,series:R,bars:$,posStack:k,negStack:Y,samples:W,sampleValid:V,leftDomain:kl,rightDomain:Nl,hasRightAxis:gt,leftValueAxisMode:Gl,rightValueAxisMode:Wl,leftValueCategoryDomain:De?.domain??null,rightValueCategoryDomain:K?.domain??null}}Ye();on();Ct();Me();var hr=pt;function Wa(e,t,n,i){let o=i?.start??0,r=i?.count??e.An;if(e.An===0||r===0)return;let s=e.F,a=J(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,e.k),t.enableVertexAttribArray(s.a_corner),t.vertexAttribPointer(s.a_corner,2,t.FLOAT,!1,0,0),l(s.a_corner,0),Ze(n,a,s.a_x_center,"bar_x",1,o)&&Ze(n,a,s.a_half_width,"bar_hw",1,o)&&Ze(n,a,s.a_y0,"bar_y0",1,o)&&Ze(n,a,s.a_y1,"bar_y1",1,o)&&Ze(n,a,s.a_color,"bar_color",3,o)&&Ze(n,a,s.a_series_id,"bar_sid",1,o)&&Ze(n,a,s.a_axis,"bar_axis",1,o)&&a.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,r),l(s.a_x_center,0),l(s.a_half_width,0),l(s.a_y0,0),l(s.a_y1,0),l(s.a_color,0),l(s.a_series_id,0),l(s.a_axis,0)}var Qi=10;function Ut(e){return e.Me>=0?Cn(e.me,e.Me,e.fe.length,e.je,e.s.length):e.Fe}function xr(e,t,n){if(!e.l)return;let i=e.l,o;if(e.m){let C=e.m.cells,v=-1;for(let A=0;A<C.length;A++){let T=C[A].layout.e;if(t>=T.x&&t<=T.x+T.width&&n>=T.y&&n<=T.y+T.height){v=A;break}}if(v<0){ka(e);return}i=C[v].layout,o=v}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){ka(e);return}let s=i.Y,a=i.J,l=i.q,u=i.Q,m,f,p,d;if(e.Ze){let C=s,v=a,A=Math.min(l,u),T=Math.max(l,u),L=C+(t-r.x)/r.width*(v-C);m=A+(n-r.y)/r.height*(T-A),f=L,p=r.height/(T-A),d=r.width/(v-C)}else m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),d=r.height/(u-l);let b=e.tn&&e.te&&!e.Ze?e.te.max-(n-r.y)/r.height*(e.te.max-e.te.min):f,x=e.tn&&e.te&&!e.Ze?r.height/(e.te.max-e.te.min):d,h=-1,g=null,y=e.Nt,_=y.length<=1;for(let C=y.length-1;C>=0;C--){let v=y[C],A=_?void 0:{start:v.aggStart,end:v.aggEnd};switch(v.chartType){case"scatter":case"line":g=Hm(e,v.chartType,m,f,b,p,d,x,o,A);break;case"bar":h=Vm(e,m,f,b,o,A);break;case"area":{let T=Ym(e,m,f,b,o,A);T&&(T.idx>=0?h=T.idx:g=T.bar);break}}if(h>=0||g)break}zm(e,h,g)}function Vm(e,t,n,i,o,r){let s=e.me,a=s.chartType,l=s.seriesId,u=s.xCenter,m=s.halfWidth,f=s.y0,p=s.y1,d=s.axis,b=e.K,x=Math.max(1,e.fe.length);for(let h=0;h<s.count;h++){if(a[h]!==pt||b.has(l[h])||o!==void 0&&l[h]%x!==o)continue;if(r!==void 0){let L=Math.floor(l[h]/x);if(L<r.start||L>r.end)continue}let g=u[h],y=m[h];if(t<g-y||t>g+y)continue;let _=d[h]===0?n:i,C=f[h],v=p[h],A=C<v?C:v,T=C<v?v:C;if(_>=A&&_<=T)return h}return-1}function Hm(e,t,n,i,o,r,s,a,l,u){let m=e.ee,f=e.s.length;if(m===0||f===0)return null;let p=e.je,d=e.Ut,x=Qi*Qi,h=null,g=e.qe;for(let y of e.s){if(y.chartType!==t||e.K.has(y.seriesId)||l!==void 0&&y.splitIdx!==l||u!==void 0&&(y.aggIdx<u.start||y.aggIdx>u.end))continue;let _=y.axis===1?o:i,C=y.axis===1?a:s,v=g?0:Math.max(0,Math.floor(n-Qi/r)),A=g?m-1:Math.min(m-1,Math.ceil(n+Qi/r));for(let T=v;T<=A;T++){let L=T*f+y.seriesId;if(!(d[L>>3]>>(L&7)&1))continue;let R=p[L],F=g?g[T]:T,I=(F-n)*r,S=(R-_)*C,D=I*I+S*S;D<x&&(x=D,h={catIdx:T,aggIdx:y.aggIdx,splitIdx:y.splitIdx,seriesId:y.seriesId,xCenter:F,halfWidth:0,y0:0,y1:R,value:R,axis:y.axis,chartType:"bar"})}}return h}function Ym(e,t,n,i,o,r){let s=Math.round(t);if(s<0||s>=e.ee||Math.abs(t-s)>.5)return null;let a=e.s.length,l=e.je,u=e.Ut,m=e.me,f=m.chartType,p=m.catIdx,d=m.seriesId,b=m.axis,x=m.y0,h=m.y1,g=e.fe.length;for(let y=0;y<m.count;y++){if(f[y]!==Ki||p[y]!==s||e.K.has(d[y])||o!==void 0&&d[y]%g!==o)continue;if(r!==void 0){let L=Math.floor(d[y]/Math.max(1,g));if(L<r.start||L>r.end)continue}let _=b[y]===0?n:i,C=x[y],v=h[y],A=C<v?C:v,T=C<v?v:C;if(_>=A&&_<=T)return{idx:y,bar:null}}for(let y of e.s){if(y.chartType!=="area"||y.stack||e.K.has(y.seriesId)||o!==void 0&&y.splitIdx!==o||r!==void 0&&(y.aggIdx<r.start||y.aggIdx>r.end))continue;let _=s*a+y.seriesId;if(!(u[_>>3]>>(_&7)&1))continue;let C=l[_],v=y.axis===1?i:n,A=Math.min(0,C),T=Math.max(0,C);if(v>=A&&v<=T)return{idx:-1,bar:{catIdx:s,aggIdx:y.aggIdx,splitIdx:y.splitIdx,seriesId:y.seriesId,xCenter:s,halfWidth:.5,y0:0,y1:C,value:C,axis:y.axis,chartType:"area"}}}return null}function ka(e){(e.Me!==-1||e.Fe!==null)&&(e.Me=-1,e.Fe=null,e.t&&e.requestRender(e.t))}function zm(e,t,n){let i=e.Me===t,o=(e.Fe?.seriesId??-1)===(n?.seriesId??-1)&&(e.Fe?.catIdx??-1)===(n?.catIdx??-1);i&&o||(e.Me=t,e.Fe=n,e.t&&e.requestRender(e.t))}function Na(e,t,n){if(e.nn.length===0)return!1;for(let i of e.nn){let o=i.rect;if(t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height){let r=i.seriesIds.some(s=>!e.K.has(s));for(let s of i.seriesIds)r?e.K.add(s):e.K.delete(s);return e._t=null,e.gi=!1,e.xi=null,e.t&&(eo(e,e.t),to(e,e.t),e.requestRender(e.t)),!0}}return!1}function yr(e,t){let n=[],i=e.s[t.seriesId],o=Xm(e,t.catIdx);o&&n.push(o);let r=e.getColumnFormatter(i.aggName,"value");return n.push(`${i.aggName}: ${r(t.value)}`),i.splitKey&&n.push(`Split: ${i.splitKey}`),t.y0!==0&&(n.push(`Base: ${r(t.y0)}`),n.push(`Top: ${r(t.y1)}`)),n}function Xm(e,t){if(e.Ke==="numeric"&&e.D){let i=e.me,o=null;for(let s=0;s<i.count;s++)if(i.catIdx[s]===t){o=i.xCenter[s];break}if(o==null)return"";let r=e._[0];return e.getColumnFormatter(r,"value")(o)}if(e.we.length===0)return"";let n=[];for(let i of e.we){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Ua(e,t){t<0||t>=e.me.count||(e.to=t,Va(e,Cn(e.me,t,e.fe.length,e.je,e.s.length)))}function Oa(e,t){e.to=-1,Va(e,t)}function Va(e,t){if(e.T.dismiss(),!e.l)return;let n=Cr(e,t);if(!n)return;let o=(e.s[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ze?n.P(o,t.xCenter):n.P(t.xCenter,o):_r(e,t.xCenter,o,n),s=yr(e,t);s.length!==0&&(e.T.pin(s,r,n),e.Me=-1,e.Fe=null,e.t&&e.requestRender(e.t))}Ae();Yo();Ae();ut();Ft();di();function Ha(e,t,n){if(n)return n;if(!e.isDate)return me;let i=t.length>1?t[1]-t[0]:0;return o=>ye(o,i)}function vr(e,t,n,i,o,r,s){let{Le:a,fontFamily:l}=r,{e:u}=t,m=o==="bottom"?u.y+u.height:u.y;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,fi(e,u,i,m,o,f=>t.P(f,0).px,Ha(n,i,s)),e.font=`13px ${l}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,u.x+u.width/2,o==="bottom"?t.cssHeight-2:10)}function Ar(e,t,n,i,o,r,s){let{Le:a,fontFamily:l}=r,{e:u}=t,m=o==="left"?u.x:u.x+u.width;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,ci(e,u,i,m,o,f=>t.P(0,f).py,Ha(n,i,s)),e.font=`13px ${l}`,e.save(),o==="left"?(e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2)):(e.translate(t.cssWidth-10,u.y+u.height/2),e.rotate(Math.PI/2)),e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,0,0),e.restore()}function no(e,t,n,i,o,r){vr(e,t,n,i,"bottom",o,r)}function io(e,t,n,i,o,r){Ar(e,t,n,i,"left",o,r)}function oo(e,t,n,i,o,r,s,a=!1,l={}){let u=ue(e,i,r);if(!u)return;let{e:m}=i;if(u.strokeStyle=o.Jn,u.lineWidth=1,u.beginPath(),u.moveTo(m.x,m.y),u.lineTo(m.x,m.y+m.height),u.lineTo(m.x+m.width,m.y+m.height),s&&(a?(u.moveTo(m.x,m.y),u.lineTo(m.x+m.width,m.y)):(u.moveTo(m.x+m.width,m.y),u.lineTo(m.x+m.width,m.y+m.height))),u.stroke(),a){if(t.mode==="category"?we(u,i,t.domain,o):io(u,i,t.domain,t.ticks,o,l.category),n.mode==="category"?pe(u,i,n.domain,o):vr(u,i,n.domain,n.ticks,"bottom",o,l.value),s)if(s.mode==="category")pe(u,i,s.domain,o);else{let f=i.Y,p=i.J;i.Y=s.domain.min,i.J=s.domain.max,vr(u,i,s.domain,s.ticks,"top",o,l.alt),i.Y=f,i.J=p}}else if(t.mode==="category"?pe(u,i,t.domain,o):no(u,i,t.domain,t.ticks,o,l.category),n.mode==="category"?we(u,i,n.domain,o):Ar(u,i,n.domain,n.ticks,"left",o,l.value),s)if(s.mode==="category")we(u,i,s.domain,o);else{let f=i.q,p=i.Q;i.q=s.domain.min,i.Q=s.domain.max,Ar(u,i,s.domain,s.ticks,"right",o,l.alt),i.q=f,i.Q=p}}function ro(e,t,n,i,o,r=!1){let s=ue(e,t,o);s&&(s.strokeStyle=i.un,s.lineWidth=1,r?Lt(s,t.e,n,a=>t.P(a,0).px):Tt(s,t.e,n,a=>t.P(0,a).py))}Ft();vt();mi();ut();di();var Ke=null;function Ya(e){if(Ke&&Ke.xCenters.length>=e&&Ke.colors.length>=e*3)return Ke;let t=Math.max(e,Ke?.xCenters.length??0);return Ke={xCenters:new Float32Array(t),halfWidths:new Float32Array(t),y0s:new Float32Array(t),y1s:new Float32Array(t),seriesIds:new Float32Array(t),axes:new Float32Array(t),colors:new Float32Array(t*3)},Ke}function eo(e,t){let n=e.me,i=n.count,o=e.fe.length,r=e.on&&o>0,s=0;if(e.yi=null,e.Ln=null,e.Tn=null,i>0){let l=Ya(i);(!e.Rn||e.Rn.length<i)&&(e.Rn=new Int32Array(i));let u=e.Rn,m=e.se,f=e.s,p=e.K,d=n.chartType,b=n.seriesId,x=n.xCenter,h=n.halfWidth,g=n.y0,y=n.y1,_=n.axis,C=Math.max(1,e.vt.length),v=r?S=>S%o*C+Math.floor(S/o):S=>o>0?Math.floor(S/o):S,A=r?o*C:C,T=new Array(A).fill(0);for(let S=0;S<i;S++)d[S]!==hr||p.has(b[S])||T[v(b[S])]++;let L=[],R=new Int32Array(A),F=0;for(let S=0;S<A;S++)L.push({start:F,count:T[S]}),R[S]=F,F+=T[S];r?(e.Tn=null,e.Ln=Array.from({length:o},(S,D)=>L.slice(D*C,(D+1)*C)),e.yi=Array.from({length:o},(S,D)=>{let B=L[D*C],N=L[(D+1)*C-1];return{start:B.start,count:N.start+N.count-B.start}})):(e.Tn=L,e.Ln=null);let I=S=>R[v(S)]++;for(let S=0;S<i;S++){if(d[S]!==hr)continue;let D=b[S];if(p.has(D))continue;let B=I(D);l.xCenters[B]=x[S]-m,l.halfWidths[B]=h[S],l.y0s[B]=g[S],l.y1s[B]=y[S],l.seriesIds[B]=D,l.axes[B]=_[S];let N=f[D].color;l.colors[B*3]=N[0],l.colors[B*3+1]=N[1],l.colors[B*3+2]=N[2],u[B]=S,s++}}else r&&(e.yi=Array.from({length:o},()=>({start:0,count:0})));if(e.An=s,s===0){e.Ye=null;return}let a=Ke;t.v.ensureCapacity(s),t.v.upload("bar_x",a.xCenters.subarray(0,s),0,1),t.v.upload("bar_hw",a.halfWidths.subarray(0,s),0,1),t.v.upload("bar_y0",a.y0s.subarray(0,s),0,1),t.v.upload("bar_y1",a.y1s.subarray(0,s),0,1),t.v.upload("bar_sid",a.seriesIds.subarray(0,s),0,1),t.v.upload("bar_axis",a.axes.subarray(0,s),0,1),t.v.upload("bar_color",a.colors.subarray(0,s*3),0,3),(!e.Ye||e.Ye.length<s*3)&&(e.Ye=new Float32Array(Math.max(s*3,e.Ye?.length??0))),e.Ye.set(a.colors.subarray(0,s*3))}function $m(e,t){let n=e.An;if(n===0)return;let i=e.Rn,o=e.s,r=e.me.seriesId,s=Ya(n);for(let l=0;l<n;l++){let u=o[r[i[l]]].color;s.colors[l*3]=u[0],s.colors[l*3+1]=u[1],s.colors[l*3+2]=u[2]}let a=e.Ye;if(a&&a.length>=n*3){let l=!0;for(let u=0;u<n*3;u++)if(a[u]!==s.colors[u]){l=!1;break}if(l)return}t.v.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!a||a.length<n*3)&&(e.Ye=new Float32Array(n*3)),e.Ye.set(s.colors.subarray(0,n*3))}function za(e){e.N.lines.invalidateBuffers(e),e.N.scatter.invalidateBuffers(e),e.N.areas.invalidateBuffers(e)}function to(e,t){e.N.lines.rebuildBuffers(e,t),e.N.scatter.rebuildBuffers(e,t),e.N.areas.rebuildBuffers(e,t)}function Xa(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0||e.ee===0)return;let s=e.A();Lr(e)&&e.An>0&&$m(e,t);let a=e.Ze,l=e.Ke==="numeric",u=l?e.D.min:-.5,m=l?e.D.max:e.ee-.5,f=e.no.min,p=e.no.max;e.g&&(a?e.g.setBaseDomain(f,p,u,m):e.g.setBaseDomain(u,m,f,p));let d=u,b=m,x=f,h=p,g=e.te?.min??0,y=e.te?.max??1;if(e.g){let V=e.g.getVisibleDomain();a?(x=V.xMin,h=V.xMax,d=V.yMin,b=V.yMax):(d=V.xMin,b=V.xMax,x=V.yMin,h=V.yMax)}let _=a?!e.g?.isYDefault():!e.g?.isXDefault();if(e.oi&&e.g&&_){let V=tf(e,d,b);V.hasLeft&&(x=V.leftMin,h=V.leftMax),e.te&&V.hasRight&&(g=V.rightMin,y=V.rightMax)}if(e.h.include_zero&&(x>0&&(x=0),h<0&&(h=0),e.te&&(g>0&&(g=0),y<0&&(y=0))),e.on&&e.fe.length>1){Zm(e,t,{horizontal:a,numericCat:l,cssWidth:o,cssHeight:r,visCatMin:d,visCatMax:b,visValMin:x,visValMax:h,visRightMin:g,visRightMax:y});return}e.m=null;let C=e.s.length>1,v=e._.length>0,A={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},T=e.rn,L=e.wn==="category"&&T!==null&&T.numRows>0,R;if(a){let V=l?55:Mt(A),O=V+(v?16:0),X=C?80:16,q=Math.max(1,o-O-X),le=L?We(T,q):void 0;R=new ne(o,r,{hasXLabel:!0,hasYLabel:v,hasLegend:C,leftExtra:V,bottomExtra:le})}else if(l){let V=L?Mt(T):void 0;R=new ne(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:24,leftExtra:V})}else{let V=L?Mt(T):55,O=V+16,X=C?80:16,q=Math.max(1,o-O-X),le=We(A,q);R=new ne(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:le,leftExtra:L?V:void 0})}e.l=R,e.g&&e.g.updateLayout(R);let F=e.h.include_zero,I=a?R.buildProjectionMatrix(x,h,b,d,"x",F,void 0,0,e.se):R.buildProjectionMatrix(d,b,x,h,"y",F,void 0,e.se,0),S;if(e.tn&&e.te&&!a){let V=R.Y,O=R.J,X=R.q,q=R.Q;S=R.buildProjectionMatrix(d,b,g,y,"y",F,void 0,e.se,0),R.Y=V,R.J=O,R.q=X,R.Q=q}else S=I;let D=oe(x,h,6),B=e.tn&&e.te&&!a?oe(g,y,6):null,N=A,k={min:x,max:h,label:e.io},Y=e.te&&!a?{min:g,max:y,label:e.Oo}:null;e.j&&ro(e.j,R,D,s,t.dpr,a);let W=e.s.length>1?Ut(e):null;ze(n,R,t.dpr,()=>{$a(e,n,t,I,S,s.Qn,a,W?W.seriesId:-1)}),e.he=N,e.xe=k,e.Re=D,e.Ci=Y,e._i=B,e.ze=l?oe(d,b,6):null,e.pe(()=>ja(e))}function $a(e,t,n,i,o,r,s,a,l){let u=e.Nt,m=u.length<=1;for(let f of u){let p=m?void 0:{start:f.aggStart,end:f.aggEnd};switch(f.chartType){case"area":s||e.N.areas.draw(e,t,n,i,o,r,l,p);break;case"bar":{t.useProgram(e.i);let d=e.F;t.uniformMatrix4fv(d.u_proj_left,!1,i),t.uniformMatrix4fv(d.u_proj_right,!1,o),t.uniform1f(d.u_horizontal,s?1:0),t.uniform1f(d.u_hover_series,a),Wa(e,t,n,jm(e,f,l));break}case"line":s||e.N.lines.draw(e,t,n,i,o,l,p);break;case"scatter":s||e.N.scatter.draw(e,t,n,i,o,l,p);break}}}function jm(e,t,n){let i=n!==void 0?e.Ln?.[n]:e.Tn;if(!i)return n!==void 0?{start:0,count:0}:void 0;let o=i[t.aggStart],r=i[t.aggEnd];return{start:o.start,count:r.start+r.count-o.start}}function Zm(e,t,n){let i=t.gl,o=t.dpr,r=e.A(),{horizontal:s,numericCat:a,cssWidth:l,cssHeight:u,visCatMin:m,visCatMax:f,visValMin:p,visValMax:d,visRightMin:b,visRightMax:x}=n,h=e._.length>0,g=e.rn,y=e.wn==="category"&&g!==null&&g.numRows>0,_=e.vt.length>1,C=a?"outer":"cell",v=y?"cell":"outer",A=Re(e.fe,{cssWidth:l,cssHeight:u,xAxis:s?v:C,yAxis:s?C:v,hasLegend:_,hasXLabel:s?!0:h,hasYLabel:s?h:!0,gap:e.G.facet_padding});if(e.m=A,e.l=A.cells[0]?.layout??null,A.cells.length===0||!e.l)return;e.syncFacetZoomLayouts(A.cells);let T=oe(p,d,6),L=a?oe(m,f,6):null,R=A.cells[0].layout,F=e.j;F&&e.pe(()=>ue(F,R,o));let I=e.h.include_zero,S=e.s.length>1?Ut(e):null,D=e.tn&&e.te!==null&&!s;at(i);for(let B=0;B<A.cells.length;B++){let k=A.cells[B].layout,Y=s?k.buildProjectionMatrix(p,d,f,m,"x",I,void 0,0,e.se):k.buildProjectionMatrix(m,f,p,d,"y",I,void 0,e.se,0),W=Y;if(D){let V=k.Y,O=k.J,X=k.q,q=k.Q;W=k.buildProjectionMatrix(m,f,b,x,"y",I,void 0,e.se,0),k.Y=V,k.J=O,k.q=X,k.Q=q}F&&e.pe(()=>qm(F,k,T,r,o,s)),lt(i,k,o,()=>{$a(e,i,t,Y,W,r.Qn,s,S&&S.splitIdx===B?S.seriesId:-1,B)})}e.he={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},e.xe={min:p,max:d,label:e.io},e.Re=T,e.Ci=null,e._i=null,e.ze=L,e.pe(()=>ja(e))}function qm(e,t,n,i,o,r){let s=re(e,o);s&&(s.strokeStyle=i.un,s.lineWidth=1,r?Lt(s,t.e,n,a=>t.P(a,0).px):Tt(s,t.e,n,a=>t.P(0,a).py))}function Cr(e,t){return e.m?e.m.cells[t.splitIdx]?.layout??null:e.l}function ja(e){if(!e.c||!e.l||!e.xe||!e.Re)return;if(e.m){Km(e);return}let t=e.A(),n;if(e.Ke==="numeric"&&e.D&&e.ze)n={mode:"numeric",domain:{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label},ticks:e.ze};else if(e.he)n={mode:"category",domain:e.he};else return;let i=e.s.find(l=>l.axis===0),o=e.s.find(l=>l.axis===1),r=e._[0],s=e.wn==="category"&&e.rn?{mode:"category",domain:e.rn}:{mode:"numeric",domain:e.xe,ticks:e.Re},a;e.Ci&&e._i&&(a=e.Vo==="category"&&e.oo?{mode:"category",domain:e.oo}:{mode:"numeric",domain:e.Ci,ticks:e._i}),oo(e.c,n,s,e.l,t,e.t?.dpr??1,a,e.Ze,{value:e.getColumnFormatter(i?.aggName??null,"tick"),alt:e.getColumnFormatter(o?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),ef(e),Ut(e)&&Za(e)}function Km(e){let t=e.m,n=e.c,i=e.A(),o=e.t?.dpr??1,r=e.Ze,s=e._.length>0,a=e.Ke==="numeric"&&e.D!==null&&e.ze!==null;if(!ue(n,e.l,o))return;let l=e.he,u=e.xe,m=e.Re,f=e.rn,p=e.wn==="category"&&f!==null&&f.numRows>0,d=e.s.find(g=>g.axis===0),b=e.getColumnFormatter(d?.aggName??null,"tick"),x=e.getColumnFormatter(e._[0],"tick");for(let g of t.cells){let y=g.layout,_=y.e,C=re(n,o);C&&(C.strokeStyle=i.Jn,C.lineWidth=1,C.beginPath(),C.moveTo(_.x,_.y),C.lineTo(_.x,_.y+_.height),C.lineTo(_.x+_.width,_.y+_.height),C.stroke(),r?(!a&&l&&we(C,y,l,i),p&&pe(C,y,f,i)):(!a&&l&&pe(C,y,l,i),p&&we(C,y,f,i)),g.titleRect&&_t(n,g.label,g.titleRect,i,o))}let h=a?{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label}:null;r?(h&&t.outerYAxisRect&&an(n,t.outerYAxisRect,h,e.ze,tn(t),i,s,o,x),!p&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,u,m,en(t),i,!0,o,b)):(h&&t.outerXAxisRect&&sn(n,t.outerXAxisRect,h,e.ze,en(t),i,s,o,x),!p&&t.outerYAxisRect&&an(n,t.outerYAxisRect,u,m,tn(t),i,!0,o,b)),Jm(e,t),Ut(e)&&Za(e)}function Jm(e,t){if(e.nn=[],!e.c||!t.legendRect)return;let n=e.vt.length;if(n<=1)return;let i=e.c.getContext("2d");if(!i)return;i.save();let o=e.A(),r=10,s=18,a=t.legendRect.x+12,l=t.legendRect.y+10;i.font=`11px ${o.fontFamily}`,i.textAlign="left",i.textBaseline="middle";for(let u=0;u<n;u++){let m=[],f=[.5,.5,.5];for(let y of e.s)y.aggIdx===u&&(m.push(y.seriesId),f=y.color);let p=e.vt[u],d=m.every(y=>e.K.has(y)),b=Math.round(f[0]*255),x=Math.round(f[1]*255),h=Math.round(f[2]*255);i.globalAlpha=d?.3:1,i.fillStyle=`rgb(${b},${x},${h})`,i.fillRect(a,l-r/2,r,r),i.fillStyle=o.mn,i.fillText(p,a+r+6,l);let g=i.measureText(p).width;d&&(i.strokeStyle=o.mn,i.lineWidth=1,i.beginPath(),i.moveTo(a+r+6,l),i.lineTo(a+r+6+g,l),i.stroke()),i.globalAlpha=1,e.nn.push({seriesIds:m,rect:{x:a-2,y:l-s/2,width:r+6+g+4,height:s}}),l+=s}i.restore()}var so=new Float64Array(0);function Qm(e,t,n){if(e.gi)return;let i=e.s;so.length<i.length&&(so=new Float64Array(i.length)),t.save(),t.font=`11px ${n}`;for(let o=0;o<i.length;o++)so[o]=t.measureText(i[o].label).width;t.restore(),e.gi=!0}function ef(e){if(e.nn=[],!e.c||!e.l||e.s.length<=1)return;let t=e.c.getContext("2d");if(!t)return;t.save();let n=e.A(),i=n.mn,o=n.fontFamily;Qm(e,t,o);let r=e.l,s=10,a=18,l=r.e.x+r.e.width+12,u=r.margins.top+10;t.font=`11px ${o}`,t.textAlign="left",t.textBaseline="middle";let m=e.s,f=so;for(let p=0;p<m.length;p++){let d=m[p],b=e.K.has(d.seriesId),x=Math.round(d.color[0]*255),h=Math.round(d.color[1]*255),g=Math.round(d.color[2]*255);t.globalAlpha=b?.3:1,t.fillStyle=`rgb(${x},${h},${g})`,t.fillRect(l,u-s/2,s,s),t.fillStyle=i,t.fillText(d.label,l+s+6,u);let y=f[p];b&&(t.strokeStyle=i,t.lineWidth=1,t.beginPath(),t.moveTo(l+s+6,u),t.lineTo(l+s+6+y,u),t.stroke()),t.globalAlpha=1;let _={x:l-2,y:u-a/2,width:s+6+y+4,height:a};e.nn.push({seriesIds:[d.seriesId],rect:_}),u+=a}t.restore()}function Za(e){if(!e.c||!e.l)return;let t=Ut(e);if(!t)return;let n=Cr(e,t);if(!n)return;let o=(e.s[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ze?n.P(o,t.xCenter):n.P(t.xCenter,o):_r(e,t.xCenter,o,n),s=yr(e,t),a=e.A();Pe(e.c,r,s,n,a,e.t?.dpr??1)}function _r(e,t,n,i){let o=i??e.l,{x:r,y:s,width:a,height:l}=o.e,u=(t-o.Y)/(o.J-o.Y),m=e.te,f=(n-m.min)/(m.max-m.min);return{px:r+u*a,py:s+(1-f)*l}}function tf(e,t,n){let i=e._t;if(i&&i.catMin===t&&i.catMax===n&&i.hidden===e.K)return i;let o=rf(e),r=1/0,s=-1/0,a=!1,l=1/0,u=-1/0,m=!1;if(o.n>0){let p=e.qe,d,b;if(p){let v=nf(p,o.n,t,n);d=v.lo,b=v.hi}else d=Math.max(0,Math.floor(t)),b=Math.min(o.n-1,Math.ceil(n));let x=o.leftMin,h=o.leftMax,g=o.rightMin,y=o.rightMax,_=o.hasLeft,C=o.hasRight;for(let v=d;v<=b;v++)_[v]&&(x[v]<r&&(r=x[v]),h[v]>s&&(s=h[v]),a=!0),C[v]&&(g[v]<l&&(l=g[v]),y[v]>u&&(u=y[v]),m=!0)}let f=i??of();return f.catMin=t,f.catMax=n,f.hidden=e.K,f.leftMin=r,f.leftMax=s,f.hasLeft=a,f.rightMin=l,f.rightMax=u,f.hasRight=m,e._t=f,f}function nf(e,t,n,i){if(t===0||n>i)return{lo:0,hi:-1};let o=0,r=t;for(;o<r;){let l=o+r>>>1;e[l]<n?o=l+1:r=l}let s=Math.max(0,o-1);for(o=0,r=t;o<r;){let l=o+r>>>1;e[l]<=i?o=l+1:r=l}let a=Math.min(t-1,o);return{lo:s,hi:a}}function of(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function rf(e){let t=e.ee,n=e.Ho,i=n&&n.leftMin.length>=t;if(n&&i&&e.xi===e.K)return n;!n||!i?(n={leftMin:new Float64Array(t),leftMax:new Float64Array(t),rightMin:new Float64Array(t),rightMax:new Float64Array(t),hasLeft:new Uint8Array(t),hasRight:new Uint8Array(t),n:t},e.Ho=n):n.n=t;for(let x=0;x<t;x++)n.leftMin[x]=1/0,n.leftMax[x]=-1/0,n.rightMin[x]=1/0,n.rightMax[x]=-1/0,n.hasLeft[x]=0,n.hasRight[x]=0;let o=e.me,r=e.K,s=o.catIdx,a=o.seriesId,l=o.y0,u=o.y1,m=o.axis;for(let x=0;x<o.count;x++){if(r.has(a[x]))continue;let h=s[x];if(h<0||h>=t)continue;let g=l[x],y=u[x],_=g<y?g:y,C=g<y?y:g;m[x]===1?(_<n.rightMin[h]&&(n.rightMin[h]=_),C>n.rightMax[h]&&(n.rightMax[h]=C),n.hasRight[h]=1):(_<n.leftMin[h]&&(n.leftMin[h]=_),C>n.leftMax[h]&&(n.leftMax[h]=C),n.hasLeft[h]=1)}let f=[e.Mn,e.Fn],p=e.je,d=e.Ut,b=e.s.length;for(let x of f)for(let h of x){if(r.has(h.seriesId))continue;let g=h.axis===1,y=h.seriesId;for(let _=0;_<t;_++){let C=_*b+y;if(!(d[C>>3]>>(C&7)&1))continue;let v=p[C];g?(v<n.rightMin[_]&&(n.rightMin[_]=v),v>n.rightMax[_]&&(n.rightMax[_]=v),n.hasRight[_]=1):(v<n.leftMin[_]&&(n.leftMin[_]=v),v>n.leftMax[_]&&(n.leftMax[_]=v),n.hasLeft[_]=1)}}return e.xi=r,n}nn();Me();fe();var _n=new Float32Array(0),vn=new Uint8Array(0);function sf(e){return _n.length>=e||(_n=new Float32Array(Math.max(e,_n.length*2))),_n}function af(e){return vn.length>=e||(vn=new Uint8Array(Math.max(e,vn.length*2))),vn}function lf(e){return e==="solid"?1:e==="transparent"?.5:0}var ao=class{constructor(){c(this,"i",null);c(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=je(t.gl),i=j(t,"bar-line",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_start","a_end","a_corner","a_real_start","a_real_end"]);return this.i={...i,cornerBuffer:n},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer),i.deleteBuffer(o.gpuRealBuffer);this.o=null}rebuildBuffers(t,n){let i=t.Mn;if(i.length===0){this.o=null;return}if(t.ee===0){this.o=null;return}this.ensureProgram(n);let r=n.gl,s=t.je,a=t.Ut,l=t.se,u=t.qe,m=t.s.length,f=[];for(let p of i){let d=t.s[p.seriesId],b=d.start,x=d.end;if(b<0||x<b)continue;let h=x-b+1;if(h<2)continue;let g=sf(h*2),y=af(h),_=0;for(let A=b;A<=x;A++){let T=u?u[A]-l:A,L=A*m+p.seriesId;g[_*2]=T,g[_*2+1]=s[L],y[_]=a[L>>3]>>(L&7)&1,_++}let C=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,C),r.bufferData(r.ARRAY_BUFFER,g.subarray(0,_*2),r.STATIC_DRAW);let v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,y.subarray(0,_),r.STATIC_DRAW),f.push({seriesId:p.seriesId,axis:p.axis,color:[p.color[0],p.color[1],p.color[2]],gpuBuffer:C,gpuRealBuffer:v,count:h,interpolateMode:d.interpolateMode})}this.o={series:f}}draw(t,n,i,o,r,s,a){let l=this.o,u=this.i;if(!l||!u||l.series.length===0)return;let m=i.dpr;n.useProgram(u.program),n.uniform2f(u.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(u.u_line_width,t.h.line_width_px*m);let f=J(i),{setDivisor:p,drawArraysInstanced:d}=f;n.bindBuffer(n.ARRAY_BUFFER,u.cornerBuffer),n.enableVertexAttribArray(u.a_corner),n.vertexAttribPointer(u.a_corner,1,n.FLOAT,!1,0,0),p(u.a_corner,0);let b=2*Float32Array.BYTES_PER_ELEMENT,x=Uint8Array.BYTES_PER_ELEMENT,h=t.K;for(let g of l.series){if(h.has(g.seriesId)||s!==void 0&&t.s[g.seriesId].splitIdx!==s)continue;let y=t.s[g.seriesId].aggIdx;if(a!==void 0&&(y<a.start||y>a.end))continue;n.uniformMatrix4fv(u.u_projection,!1,g.axis===1?r:o);let _=t.s[g.seriesId].color;n.uniform4f(u.u_color,_[0],_[1],_[2],1),n.uniform1f(u.u_interp_alpha,lf(g.interpolateMode)),n.enableVertexAttribArray(u.a_start),p(u.a_start,1),n.enableVertexAttribArray(u.a_end),p(u.a_end,1),n.enableVertexAttribArray(u.a_real_start),p(u.a_real_start,1),n.enableVertexAttribArray(u.a_real_end),p(u.a_real_end,1),n.bindBuffer(n.ARRAY_BUFFER,g.gpuBuffer),n.vertexAttribPointer(u.a_start,2,n.FLOAT,!1,b,0),n.vertexAttribPointer(u.a_end,2,n.FLOAT,!1,b,b),n.bindBuffer(n.ARRAY_BUFFER,g.gpuRealBuffer),n.vertexAttribPointer(u.a_real_start,1,n.UNSIGNED_BYTE,!1,x,0),n.vertexAttribPointer(u.a_real_end,1,n.UNSIGNED_BYTE,!1,x,x),d(n.TRIANGLE_STRIP,0,4,g.count-1)}p(u.a_start,0),p(u.a_end,0),p(u.a_real_start,0),p(u.a_real_end,0)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&n.deleteBuffer(i.cornerBuffer)}this.i=null,this.o=null}};fe();var Ne=new Float32Array(0),Ce=new Float32Array(0);function uf(e){Ne.length<e*2&&(Ne=new Float32Array(Math.max(e*2,Ne.length*2))),Ce.length<e*3&&(Ce=new Float32Array(Math.max(e*3,Ce.length*2)))}var lo=class{constructor(){c(this,"i",null);c(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=j(t,"bar-scatter",Wn,kn,["u_projection","u_point_size"],["a_position","a_color"]);return this.i={...i,posLeftBuffer:n.createBuffer(),posRightBuffer:n.createBuffer(),colorLeftBuffer:n.createBuffer(),colorRightBuffer:n.createBuffer()},this.i}invalidateBuffers(t){this.o=null}rebuildBuffers(t,n){let i=t.Fn;if(i.length===0){this.o=null;return}let o=t.ee,r=t.s.length;if(o===0||r===0){this.o=null;return}let s=this.ensureProgram(n),a=n.gl,l=t.je,u=t.Ut,m=t.qe,f=t.se,p=t.K,d=0,b=0;for(let _ of i)if(!p.has(_.seriesId))for(let C=0;C<o;C++){let v=C*r+_.seriesId;u[v>>3]>>(v&7)&1&&(_.axis===1?b++:d++)}let x=d+b;if(x===0){this.o=null;return}uf(x);let h=[],g=0,y=d;for(let _ of i){if(p.has(_.seriesId))continue;let C=_.axis===1?y-d:g,v=_.color[0],A=_.color[1],T=_.color[2];for(let R=0;R<o;R++){let F=R*r+_.seriesId;if(!(u[F>>3]>>(F&7)&1))continue;let I=m?m[R]-f:R,S=l[F];_.axis===1?(Ne[y*2]=I,Ne[y*2+1]=S,Ce[y*3]=v,Ce[y*3+1]=A,Ce[y*3+2]=T,y++):(Ne[g*2]=I,Ne[g*2+1]=S,Ce[g*3]=v,Ce[g*3+1]=A,Ce[g*3+2]=T,g++)}let L=_.axis===1?y-d:g;L>C&&h.push({seriesId:_.seriesId,axis:_.axis,first:C,count:L-C})}d>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(0,d*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ce.subarray(0,d*3),a.STATIC_DRAW)),b>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(d*2,x*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ce.subarray(d*3,x*3),a.STATIC_DRAW)),this.o={leftCount:d,rightCount:b,seriesRanges:h}}draw(t,n,i,o,r,s,a){let l=this.o,u=this.i;if(!l||!u||l.leftCount===0&&l.rightCount===0)return;let m=i.dpr;if(n.useProgram(u.program),n.uniform1f(u.u_point_size,t.h.point_size_px*m),s!==void 0||a!==void 0){for(let f of l.seriesRanges){if(s!==void 0&&t.s[f.seriesId].splitIdx!==s)continue;let p=t.s[f.seriesId].aggIdx;a!==void 0&&(p<a.start||p>a.end)||Tr(n,u,f.axis===1?u.posRightBuffer:u.posLeftBuffer,f.axis===1?u.colorRightBuffer:u.colorLeftBuffer,f.count,f.axis===1?r:o,f.first)}return}Tr(n,u,u.posLeftBuffer,u.colorLeftBuffer,l.leftCount,o),Tr(n,u,u.posRightBuffer,u.colorRightBuffer,l.rightCount,r)}destroy(t){let n=t.t?.gl;if(n){let i=this.i;i&&(n.deleteBuffer(i.posLeftBuffer),n.deleteBuffer(i.posRightBuffer),n.deleteBuffer(i.colorLeftBuffer),n.deleteBuffer(i.colorRightBuffer))}this.i=null,this.o=null}};function Tr(e,t,n,i,o,r,s=0){o!==0&&(e.uniformMatrix4fv(t.u_projection,!1,r),e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(t.a_position),e.vertexAttribPointer(t.a_position,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(t.a_color),e.vertexAttribPointer(t.a_color,3,e.FLOAT,!1,0,0),e.drawArrays(e.POINTS,s,o))}fe();var An=new Float32Array(0);function mf(e){return An.length>=e||(An=new Float32Array(Math.max(e,An.length*2))),An}var uo=class{constructor(){c(this,"i",null);c(this,"o",null)}ensureProgram(t){return this.i?this.i:(this.i=j(t,"bar-area",En,Gn,["u_projection","u_color","u_opacity"],["a_position"]),this.i)}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer);this.o=null}rebuildBuffers(t,n){let i=t.vi;if(i.length===0){this.o=null;return}let o=t.ee,r=t.s.length;if(o===0||r===0){this.o=null;return}this.ensureProgram(n);let s=n.gl,a=t.je,l=t.Ut,u=t.qe,m=t.se,f=t.ro,p=t.me,d=[];for(let b of i){let x=t.s[b.seriesId],h=ff(b,o,r,a,l,f,p.y0,p.y1,u,m,x.start,x.end,x.interpolateMode);if(h.totalVertices===0)continue;let g=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,g),s.bufferData(s.ARRAY_BUFFER,h.scratch.subarray(0,h.totalVertices*2),s.STATIC_DRAW),d.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:g,strips:h.descriptors})}this.o={series:d}}draw(t,n,i,o,r,s,a,l){let u=this.o,m=this.i;if(!u||!m||u.series.length===0)return;n.useProgram(m.program),n.uniform1f(m.u_opacity,s);let f=t.K;for(let p of u.series){if(f.has(p.seriesId)||a!==void 0&&t.s[p.seriesId].splitIdx!==a)continue;let d=t.s[p.seriesId].aggIdx;if(l!==void 0&&(d<l.start||d>l.end))continue;n.uniformMatrix4fv(m.u_projection,!1,p.axis===1?r:o);let b=t.s[p.seriesId].color;n.uniform3f(m.u_color,b[0],b[1],b[2]),n.bindBuffer(n.ARRAY_BUFFER,p.gpuBuffer),n.enableVertexAttribArray(m.a_position),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,0);for(let x of p.strips)n.bindBuffer(n.ARRAY_BUFFER,p.gpuBuffer),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,x.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,x.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.i=null}};function ff(e,t,n,i,o,r,s,a,l,u,m,f,p){let d=mf(t*4),b=[],x=e.seriesId*1e9,h=p!=="skip",g=0,y=0;for(let _=0;_<t;_++){let C=0,v=0,A=!1;if(e.stack){let T=r?.get(x+_);T!==void 0&&(C=s[T],v=a[T],A=!0)}else{let T=_*n+e.seriesId;h?_>=m&&_<=f&&(v=i[T],A=!0):o[T>>3]>>(T&7)&1&&(v=i[T],A=!0)}if(A){let T=l?l[_]-u:_;d[g++]=T,d[g++]=C,d[g++]=T,d[g++]=v}else if(g>y){let T=(g-y)/2;T>=4&&b.push({offsetBytes:y*4,vertexCount:T}),y=g}}if(g>y){let _=(g-y)/2;_>=4&&b.push({offsetBytes:y*4,vertexCount:_})}return{descriptors:b,totalVertices:g/2,scratch:d}}Me();fe();function Ln(e,t){return e&&(t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max)),{min:t.min,max:t.max}}var Je=class extends Nt{constructor(n="vertical"){super();c(this,"Ze");c(this,"F",null);c(this,"vt",[]);c(this,"fe",[]);c(this,"s",[]);c(this,"on",!1);c(this,"m",null);c(this,"yi",null);c(this,"Nt",[]);c(this,"Tn",null);c(this,"Ln",null);c(this,"me",Ji());c(this,"so",[]);c(this,"Mn",[]);c(this,"Fn",[]);c(this,"vi",[]);c(this,"io","");c(this,"Oo","");c(this,"wn","numeric");c(this,"Vo",null);c(this,"rn",null);c(this,"oo",null);c(this,"ro",null);c(this,"Ye",null);c(this,"Ai",null);c(this,"Li",null);c(this,"ao",null);c(this,"uo",null);c(this,"no",{min:0,max:1});c(this,"te",null);c(this,"tn",!1);c(this,"Sn",null);c(this,"In",null);c(this,"Ti",null);c(this,"Ke","category");c(this,"D",null);c(this,"se",0);c(this,"ze",null);c(this,"qe",null);c(this,"K",new Set);c(this,"Me",-1);c(this,"to",-1);c(this,"Fe",null);c(this,"je",new Float32Array(0));c(this,"Ut",new Uint8Array(0));c(this,"N",{lines:new ao,scatter:new lo,areas:new uo});c(this,"Ci",null);c(this,"_i",null);c(this,"An",0);c(this,"Rn",new Int32Array(0));c(this,"nn",[]);c(this,"gi",!1);c(this,"_t",null);c(this,"Ho",null);c(this,"xi",null);this.Ze=n==="horizontal"}getZoomConfig(){return{lockAxis:this.Ze?"x":"y"}}tooltipCallbacks(){return{onHover:(n,i)=>xr(this,n,i),onLeave:()=>{(this.Me!==-1||this.Fe)&&(this.Me=-1,this.Fe=null,this.t&&this.requestRender(this.t))},onClickPre:(n,i)=>Na(this,n,i),onPin:(n,i)=>{if(xr(this,n,i),this.Me>=0){let o=this.Me;Ua(this,o);let r=Cn(this.me,o,this.fe.length,this.je,this.s.length);this.Yo(r)}else if(this.Fe){let o=this.Fe;Oa(this,o),this.Yo(o)}},onUnpin:()=>{this.emitUnselect()}}}async Yo(n){if(!this.vt[n.aggIdx])return;let i=this.we.map(s=>s.labels[n.catIdx]??null),o=this.fe[n.splitIdx]??"",r=this.B.length>0&&o!==""?o.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.mt,columnName:this.vt[n.aggIdx],groupByValues:i,splitByValues:r})}async uploadAndRender(n,i,o,r){this.t=n;let s=n.gl;if(o!==0)return;if(!this.i){let u=j(n,"bar",Fn,Sn,["u_proj_left","u_proj_right","u_hover_series","u_horizontal"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color","a_series_id","a_axis"]);this.i=u.program,this.F=u,this.k=Ai(s)}let a=this.B.length>0&&this.G.facet_mode==="grid",l=Ga({columns:i,numRows:r,columnSlots:this.I,groupBy:this._,splitBy:this.B,groupByTypes:this.ht,columnsConfig:this.Ui,defaultChartType:this.ni,autoAltYAxis:this.h.auto_alt_y_axis,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,includeZero:this.h.include_zero,facetSplits:a,scratchBars:this.me,scratchPosStack:this.ao,scratchNegStack:this.uo});if(this.h.domain_mode==="expand"){let u=df(l);this.Ti!==u&&(this.Sn=null,this.In=null,this.Ti=u),this.Sn=Ln(this.Sn,l.leftDomain),l.rightDomain&&(this.In=Ln(this.In,l.rightDomain))}else this.Sn=null,this.In=null,this.Ti=null;this.vt=l.aggregates,this.fe=l.splitPrefixes,this.on=a&&l.splitPrefixes.length>1,this.we=l.rowPaths,this.ee=l.numCategories,this.mt=l.rowOffset,this.Ke=l.axisMode.mode,this.D=l.numericCategoryDomain,this.qe=l.categoryPositions,this.se=l.numericCategoryDomain?.min??0,this.s=l.series,this.me=l.bars,this.ao=l.posStack,this.uo=l.negStack,this.je=l.samples,this.so.length=0,this.Mn.length=0,this.Fn.length=0,this.vi.length=0;for(let u of l.series)switch(u.chartType){case"bar":this.so.push(u);break;case"line":this.Mn.push(u);break;case"scatter":this.Fn.push(u);break;case"area":this.vi.push(u);break}this.io=qa(l.series,0),this.Oo=qa(l.series,1),this.Nt.length=0;{let u=Math.max(1,l.splitPrefixes.length);for(let m=0;m<l.aggregates.length;m++){let f=l.series[m*u].chartType,p=this.Nt[this.Nt.length-1];p&&p.chartType===f?p.aggEnd=m:this.Nt.push({chartType:f,aggStart:m,aggEnd:m})}}this.ro=cf(this.me),this._t=null,this.gi=!1,this.Ai=null,this.Li=null,this.xi=null,this.Ye=null,this.Me=-1,this.Fe=null,this.Ut=l.sampleValid,this.no=l.leftDomain,this.te=l.rightDomain,this.tn=l.hasRightAxis,this.wn=l.leftValueAxisMode,this.Vo=l.rightValueAxisMode,this.rn=l.leftValueCategoryDomain,this.oo=l.rightValueCategoryDomain,Lr(this),eo(this,n),za(this),to(this,n),await this.requestRender(n)}Dt(n){this.i&&(this.t=n,Xa(this,n))}resetExpandedDomain(){this.Sn=null,this.In=null,this.Ti=null}destroyInternal(){if(this.t){let n=this.t.gl;this.k&&n.deleteBuffer(this.k),bf(this)}this.i=null,this.F=null,this.k=null,this.on=!1,this.m=null,this.yi=null,this.Ln=null,this.Tn=null,this.Nt.length=0,this.me=Ji(),this.s=[],this.so=[],this.Mn=[],this.Fn=[],this.vi=[],this.ro=null,this.Ai=null,this.Li=null,this.Ye=null,this.ao=null,this.uo=null,this.we=[],this.ee=0,this.K.clear(),this.Me=-1,this.Fe=null}};function cf(e){let t=new Map;for(let n=0;n<e.count;n++)e.chartType[n]===1&&t.set(e.seriesId[n]*1e9+e.catIdx[n],n);return t}function qa(e,t){let n=new Set,i=[];for(let o of e)o.axis===t&&(n.has(o.aggName)||(n.add(o.aggName),i.push(o.aggName)));return i.join(", ")}function df(e){let t=Math.max(1,e.splitPrefixes.length),n=[];for(let i=0;i<e.aggregates.length;i++)n.push(`${e.aggregates[i]}:${e.series[i*t].axis}`);return n.join("\\0")}function Lr(e){let t=e.A(),n=t.ke,i=t.H,o=e.on?Math.max(1,e.vt.length):e.s.length,r=e.Li;if(e.Ai&&r&&r.ke===n&&r.H===i&&r.seriesLength===o)return!1;let s=pf(n,i,o);e.Ai=s,e.Li={ke:n,H:i,seriesLength:o};for(let a=0;a<e.s.length;a++)e.s[a].color=e.on?s[e.s[a].aggIdx]:s[a];return!0}function pf(e,t,n){return de(e,t,n)}function bf(e){e.N.lines.destroy(e),e.N.scatter.destroy(e),e.N.areas.destroy(e)}var mo=class extends Je{constructor(){super("horizontal")}};Jt();Ye();un();function Rr(e){let{columns:t,numRows:n,groupBy:i,splitBy:o,groupByTypes:r}=e,s=Gt(i,r),a={xLevels:[],yColumnNames:[],yLevels:[],numX:0,numY:0,rowOffset:0,cells:[],cells2D:[],colorMin:0,colorMax:1,xAxisMode:s,yAxisMode:{mode:"category"},xPositions:null,yPositions:null,xNumericDomain:null,yNumericDomain:null},l=i.map(R=>r[R]??"string"),{rowPaths:u,numCategories:m,rowOffset:f}=Wt(t,n,i.length,l),p=null,d=null;if(s.mode==="numeric"&&m>0){let R=t.get("__ROW_PATH_0__"),F=ct(R?.values,m,f,i[0]??"",s.numericType==="date"||s.numericType==="datetime");F&&(p=F.categoryPositions,d=F.numericCategoryDomain)}let b=[];for(let R of t.keys())R.startsWith("__")||!t.get(R)?.values||b.push(R);let x=b.length;if(m===0||x===0)return{...a,xLevels:u,rowOffset:f};let h=xf(b),g=gf(o,r),y={mode:"category"},_=null,C=null;if(g.mode==="numeric"){let R=hf(b,g.numericType);if(R){let F=ct(R,x,0,o[0]??"",g.numericType==="date"||g.numericType==="datetime");F&&(y=g,_=F.categoryPositions,C=F.numericCategoryDomain)}}let v=[],A=new Array(m*x).fill(null),T=1/0,L=-1/0;for(let R=0;R<x;R++){let F=t.get(b[R]),I=F.values,S=F.valid;for(let D=0;D<m;D++){let B=D+f;if(S&&!(S[B>>3]>>(B&7)&1))continue;let N=I[B];if(!isFinite(N))continue;let k={xIdx:D,yIdx:R,value:N};v.push(k),A[R*m+D]=k,N<T&&(T=N),N>L&&(L=N)}}return!isFinite(T)||!isFinite(L)?(T=0,L=1):T===L&&(L=T+1),{xLevels:u,yColumnNames:b,yLevels:h,numX:m,numY:x,rowOffset:f,cells:v,cells2D:A,colorMin:T,colorMax:L,xAxisMode:s,yAxisMode:y,xPositions:p,yPositions:_,xNumericDomain:d,yNumericDomain:C}}function gf(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function hf(e,t){let n=new Float64Array(e.length);for(let i=0;i<e.length;i++){let o=e[i],r=o.indexOf("|"),s=r===-1?o:o.slice(0,r),a;if(t==="date"||t==="datetime"?(a=Date.parse(s),isFinite(a)||(a=Date.parse(s.replace(" ","T")))):a=Number(s),!isFinite(a))return null;n[i]=a}return n}function Ka(e,t){return t.map(n=>{let i=new Map;for(let[o,r]of e){if(o.startsWith("__ROW_PATH_")||o==="__GROUPING_ID__"){i.set(o,r);continue}let s=o.lastIndexOf("|");(s===-1?o:o.slice(s+1))===n&&i.set(o,r)}return{label:n,columns:i}})}function xf(e){if(e.length===0)return[];let t=0,n=e.map(o=>o.split("|"));for(let o of n)o.length>t&&(t=o.length);if(t===0)return[];let i=[];for(let o=0;o<t;o++){let r=[],s=new Map,a=new Int32Array(e.length),l=new Array(e.length),u=0;for(let p=0;p<e.length;p++){let d=n[p][o]??"",b=s.get(d);b===void 0&&(b=r.length,r.push(d),s.set(d,b)),a[p]=b,l[p]=d,d.length>u&&(u=d.length)}let f=o===t-1?[]:bi(a,r,0,e.length);i.push({labels:l,runs:f,maxLabelChars:u})}return i}Ye();mi();on();Me();fe();ut();vt();Ft();un();pi();function Mr(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var yf=80,Cf=20,wr=5,Fr=11;function Ot(e,t){return e.P(0,t).py}function Ja(e,t){let n=Mr(e.levels,t),i=n.length,o=[];for(let r=0;r<i;r++){let s=n[r].maxLabelChars;if(r===i-1){let a=Math.max(yf,s*6.5+16);o.push({size:a})}else{let a=Math.max(Cf,s*6.5+16);o.push({size:a})}}return o}function Qa(e,t){let n=Mr(e.levels,t);if(e.numRows===0||n.length===0)return 55;let i=Ja(e,t),o=0;for(let r of i)o+=r.size;return o}function _f(e,t){return e.labels[t]??""}function Sr(e,t,n,i,o){let r=Mr(n.levels,o);if(n.numRows===0||r.length===0)return;let{It:s,Le:a,fontFamily:l}=i,{e:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${Fr}px ${l}`;let m=Ja(n,o),f=Math.max(0,Math.ceil(t.q)),p=Math.min(n.numRows-1,Math.floor(t.Q));if(p<f)return;let d=r.length,b=u.x;for(let h=d-1;h>=0;h--){let g=r[h],y=m[h],_=b,C=b-y.size;b=C,h===d-1?vf(e,t,g,f,p,_,C,l,s):Af(e,t,g,f,p,C,_,l,s)}let x=n.levelLabels.filter(h=>!!h).join(" / ");x&&(e.fillStyle=a,e.font=`13px ${l}`,e.save(),e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="top",e.fillText(x,0,0),e.restore())}function vf(e,t,n,i,o,r,s,a,l){let u=t.e;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let f=i;f<=o;f++){let p=Ot(t,f);p<u.y-1||p>u.y+u.height+1||(e.moveTo(r,p),e.lineTo(r-wr,p))}e.stroke(),e.font=`${Fr}px ${a}`,e.textAlign="right",e.textBaseline="middle";let m=r-wr-4-s-4;for(let f=i;f<=o;f++){let p=Ot(t,f);if(p<u.y-1||p>u.y+u.height+1)continue;let d=_f(n,f);if(!d)continue;let b=mt(e,d,m);b&&e.fillText(b,r-wr-4,p)}}function Af(e,t,n,i,o,r,s,a,l){let u=t.e,m=ln(n.runs,i,o);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l;let f=s-3;e.beginPath();for(let p of m){let d=Ot(t,p.endIdx+.5),b=Ot(t,p.startIdx-.5),x=Math.min(d,b),h=Math.max(d,b),g=Math.max(u.y,x),y=Math.min(u.y+u.height,h);y<=g||(e.moveTo(f,g),e.lineTo(f,y),e.moveTo(f,g),e.lineTo(f+3,g),e.moveTo(f,y),e.lineTo(f+3,y))}e.stroke(),e.font=`${Fr}px ${a}`;for(let p of m){let d=Ot(t,p.endIdx+.5),b=Ot(t,p.startIdx-.5),x=Math.min(d,b),h=Math.max(d,b),g=Math.max(u.y,x),y=Math.min(u.y+u.height,h);if(y<=g)continue;let _=(g+y)/2,C=r+(s-r-3)/2,v=p.label;if(!v)continue;let A=y-g-4,T=mt(e,v,Math.max(0,A));T&&(e.save(),e.translate(C,_),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(T,0,0),e.restore())}}Ae();xi();Ee();At();Ct();function Dr(e,t,n){if(e.zo=t,e.Xo=n,e.u.length>0){for(let o=0;o<e.u.length;o++){let r=e.u[o],s=r.layout.e;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let a=tl(r.layout,r.pipeline.numX,r.pipeline.numY,r.pipeline.cells2D,r.pipeline.xPositions,r.pipeline.yPositions,r.pipeline.xNumericDomain?.bandWidth??1,r.pipeline.yNumericDomain?.bandWidth??1,t,n);Ir(e,a,o);return}Ir(e,null,-1);return}if(!e.l)return;let i=tl(e.l,e.At,e.Lt,e.Ri,e.Dn,e.Bn,e.ft?.bandWidth??1,e.ct?.bandWidth??1,t,n);Ir(e,i,-1)}function el(e,t,n){if(e.length===0)return-1;let i=0,o=e.length-1;for(;i<o;){let s=i+o>>1;e[s]<t?i=s+1:o=s}let r=i;return r>0&&Math.abs(e[r-1]-t)<Math.abs(e[r]-t)&&(r-=1),Math.abs(e[r]-t)>n*.5?-1:r}function tl(e,t,n,i,o,r,s,a,l,u){let m=e.e;if(l<m.x||l>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.Y,p=e.J,d=e.q,b=e.Q,x=f+(l-m.x)/m.width*(p-f),h=b-(u-m.y)/m.height*(b-d),g=o?el(o,x,s):Math.round(x),y=r?el(r,h,a):Math.round(h);return g<0||g>=t||y<0||y>=n?null:i[y*t+g]??null}function Ir(e,t,n){let i=e.Ge;(i?.xIdx??-1)===(t?.xIdx??-1)&&(i?.yIdx??-1)===(t?.yIdx??-1)&&e.Pn===n||(e.Ge=t,e.Pn=n,e.t&&e.mo&&e.mo())}function nl(e,t){let n=[];for(let i of e){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Br(e){if(!e.c||!e.Ge)return;let t,n,i,o=null;if(e.Pn>=0){let p=e.u[e.Pn];if(!p)return;t=p.layout,n=p.pipeline.xLevels,i=p.pipeline.yLevels,o=p.label}else{if(!e.l)return;t=e.l,n=e.Ot,i=e.Vt}let r=e.Ge,s={px:e.zo,py:e.Xo},a=[];o&&a.push(o);let l=nl(n,r.xIdx),u=nl(i,r.yIdx);l&&a.push(l),u&&a.push(u);let m=e.getColumnFormatter(e.I[0],"value");a.push(`Value: ${m(r.value)}`);let f=e.A();Pe(e.c,s,a,t,f,e.t?.dpr??1)}var Pr={skipLeafLevel:!0};function il(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0)return;if(e.u.length>0){Lf(e,t,o,r);return}if(e.At===0||e.Lt===0)return;let s=e.A(),a={levels:e.Ot,numRows:e.At,levelLabels:e._.slice()},l={levels:e.Vt,numRows:e.Lt,levelLabels:[]},u=e.En.mode==="numeric",m=e.Gn.mode==="numeric",f=m?55:Qa(l,Pr),p=u?24:We(a,Math.max(1,o-f-110)),d=new ne(o,r,{hasXLabel:e._.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:p,leftExtra:f});e.l=d,e.g&&e.g.updateLayout(d);let b=u?e.ft.min:-.5,x=u?e.ft.max:e.At-.5,h=m?e.ct.min:-.5,g=m?e.ct.max:e.Lt-.5;e.g&&e.g.setBaseDomain(b,x,h,g);let y=e.g?e.g.getVisibleDomain():{xMin:b,xMax:x,yMin:h,yMax:g},_=d.buildProjectionMatrix(y.xMin,y.xMax,y.yMin,y.yMax,void 0,void 0,0,e.w,e.M),C=d.e,v=C.width/(y.xMax-y.xMin),A=C.height/(y.yMax-y.yMin),T=s.Mo*.5,L=u?e.ft.bandWidth:1,R=m?e.ct.bandWidth:1,F=Math.min(L*.5,v>0?T/v:0),I=Math.min(R*.5,A>0?T/A:0);if(e.j){let S=ue(e.j,d,t.dpr)}ol(e,t),rl(e,t),e.ie=rn(t,e.ie,s.H),ze(n,d,t.dpr,()=>{n.useProgram(e.i);let S=e.F;n.uniformMatrix4fv(S.u_projection,!1,_),n.uniform2f(S.u_cell_inset,F,I),n.uniform2f(S.u_cell_size,L,R),Ge(t,e.ie.texture,S.u_gradient_lut,0),sl(e,n,t,0,e.$o)}),e.pe(()=>fo(e))}function ol(e,t){if(e.i)return;let n=t.gl,i=j(t,"heatmap",On,Vn,["u_projection","u_cell_inset","u_cell_size","u_gradient_lut"],["a_corner","a_cell","a_color_t"]);e.i=i.program,e.F=i;let o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),e.k=o}function rl(e,t){let n=e.Qe.length;if(e.$o=n,n===0)return;let i=new Float32Array(n*2),o=new Float32Array(n);if(e.u.length>0){let r=0;for(let s of e.u){let a=s.pipeline.xPositions,l=s.pipeline.yPositions,u=s.xOrigin,m=s.yOrigin;for(let f of s.pipeline.cells)i[r*2]=a?a[f.xIdx]-u:f.xIdx,i[r*2+1]=l?l[f.yIdx]-m:f.yIdx,o[r]=rt(f.value,e.b,e.p),r++}}else{let r=e.Dn,s=e.Bn,a=e.w,l=e.M;for(let u=0;u<n;u++){let m=e.Qe[u];i[u*2]=r?r[m.xIdx]-a:m.xIdx,i[u*2+1]=s?s[m.yIdx]-l:m.yIdx,o[u]=rt(m.value,e.b,e.p)}}t.v.ensureCapacity(n),t.v.upload("heatmap_cell",i,0,2),t.v.upload("heatmap_t",o,0,1)}function sl(e,t,n,i,o){if(o===0)return;let r=e.F,s=J(n),{setDivisor:a}=s,l=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.k),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),a(r.a_corner,0);let u=n.v.peek("heatmap_cell"),m=n.v.peek("heatmap_t");!u||!m||(t.bindBuffer(t.ARRAY_BUFFER,u.buffer),t.enableVertexAttribArray(r.a_cell),t.vertexAttribPointer(r.a_cell,2,t.FLOAT,!1,0,i*2*l),a(r.a_cell,1),t.bindBuffer(t.ARRAY_BUFFER,m.buffer),t.enableVertexAttribArray(r.a_color_t),t.vertexAttribPointer(r.a_color_t,1,t.FLOAT,!1,0,i*l),a(r.a_color_t,1),s.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,o),a(r.a_cell,0),a(r.a_color_t,0))}function fo(e){if(!e.c)return;if(e.u.length>0){Tf(e);return}if(!e.l)return;let t=e.l,n=e.A(),i=e.t?.dpr??1,o=ue(e.c,t,i);if(!o)return;o.strokeStyle=n.un,o.lineWidth=1,o.beginPath(),o.moveTo(t.e.x,t.e.y),o.lineTo(t.e.x,t.e.y+t.e.height),o.lineTo(t.e.x+t.e.width,t.e.y+t.e.height),o.stroke();let r={levels:e.Ot,numRows:e.At,levelLabels:e._.slice()},s={levels:e.Vt,numRows:e.Lt,levelLabels:[]},a=e._[0],l=e._[1]??e.B[0];if(e.En.mode==="numeric"&&e.ft){let u=oe(t.Y,t.J,6);no(o,t,e.ft,u,n,e.getColumnFormatter(a,"tick"))}else pe(o,t,r,n);if(e.Gn.mode==="numeric"&&e.ct){let u=oe(t.q,t.Q,6);io(o,t,e.ct,u,n,e.getColumnFormatter(l,"tick"))}else Sr(o,t,s,n,Pr);St(e.c,t,{min:e.b,max:e.p,label:e.fo},n.H,n,e.getColumnFormatter(e.I[0],"value")),e.Ge&&Br(e)}function Lf(e,t,n,i){let o=t.gl,r=e.A(),{effectiveSharedX:s,effectiveSharedY:a}=e.computeEffectiveFacetFlags(),l=Re(e.u.map(m=>m.label),{cssWidth:n,cssHeight:i,xAxis:s?"outer":"cell",yAxis:a?"outer":"cell",hasLegend:!0,hasXLabel:e._.length>0,hasYLabel:!1,gap:8});e.m=l;for(let m=0;m<e.u.length;m++){let f=l.cells[m];f&&(e.u[m].layout=f.layout)}e.syncFacetZoomLayouts(l.cells),ol(e,t),rl(e,t),e.ie=rn(t,e.ie,r.H),o.useProgram(e.i);let u=e.F;Ge(t,e.ie.texture,u.u_gradient_lut,0),at(o);for(let m=0;m<e.u.length;m++){let f=e.u[m];if(f.instanceCount===0)continue;let{numX:p,numY:d}=f.pipeline;if(p===0||d===0)continue;let b=f.layout,x=f.pipeline.xAxisMode.mode==="numeric",h=f.pipeline.yAxisMode.mode==="numeric",g=x?f.pipeline.xNumericDomain.min:-.5,y=x?f.pipeline.xNumericDomain.max:p-.5,_=h?f.pipeline.yNumericDomain.min:-.5,C=h?f.pipeline.yNumericDomain.max:d-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(g,y,_,C);let A=v?v.getVisibleDomain():{xMin:g,xMax:y,yMin:_,yMax:C},T=b.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),L=b.e,R=L.width/(A.xMax-A.xMin),F=L.height/(A.yMax-A.yMin),I=r.Mo*.5,S=x?f.pipeline.xNumericDomain.bandWidth:1,D=h?f.pipeline.yNumericDomain.bandWidth:1,B=Math.min(S*.5,R>0?I/R:0),N=Math.min(D*.5,F>0?I/F:0);lt(o,b,t.dpr,()=>{o.uniformMatrix4fv(u.u_projection,!1,T),o.uniform2f(u.u_cell_inset,B,N),o.uniform2f(u.u_cell_size,S,D),sl(e,o,t,f.instanceStart,f.instanceCount)})}e.pe(()=>fo(e))}function Tf(e){if(!e.c||!e.m)return;let t=e.A(),n=e.t?.dpr??1,i=ue(e.c,e.u[0].layout,n);if(!i)return;let o=e.ei,r=e.ti,s=e.m;for(let a=0;a<e.u.length;a++){let l=e.u[a],u=s.cells[a],m=l.layout,f=m.e;i.strokeStyle=t.un,i.lineWidth=1,i.beginPath(),i.moveTo(f.x,f.y),i.lineTo(f.x,f.y+f.height),i.lineTo(f.x+f.width,f.y+f.height),i.stroke();let p={levels:l.pipeline.xLevels,numRows:l.pipeline.numX,levelLabels:e._.slice()},d={levels:l.pipeline.yLevels,numRows:l.pipeline.numY,levelLabels:[]},b=e._[0],x=e._[1]??e.B[0];if(!o||u.isBottomEdge)if(l.pipeline.xAxisMode.mode==="numeric"&&l.pipeline.xNumericDomain){let h=oe(m.Y,m.J,6);no(i,m,l.pipeline.xNumericDomain,h,t,e.getColumnFormatter(b,"tick"))}else pe(i,m,p,t);if(!r||u.isLeftEdge)if(l.pipeline.yAxisMode.mode==="numeric"&&l.pipeline.yNumericDomain){let h=oe(m.q,m.Q,6);io(i,m,l.pipeline.yNumericDomain,h,t,e.getColumnFormatter(x,"tick"))}else Sr(i,m,d,t,Pr)}for(let a=0;a<s.cells.length;a++){let l=s.cells[a],u=e.u[a];!u||!l.titleRect||_t(e.c,u.label,l.titleRect,t,n)}s.legendRect&&mn(e.c,{x:s.legendRect.x,y:s.legendRect.y+20,width:s.legendRect.width,height:Math.max(1,s.legendRect.height-20)},{min:e.b,max:e.p,label:""},t.H,t,e.getColumnFormatter(e.I[0],"value")),e.Ge&&Br(e)}var co=class extends Te{constructor(){super(...arguments);c(this,"i",null);c(this,"F",null);c(this,"k",null);c(this,"ie",null);c(this,"Ot",[]);c(this,"Vt",[]);c(this,"co",[]);c(this,"At",0);c(this,"Lt",0);c(this,"mt",0);c(this,"En",{mode:"category"});c(this,"Gn",{mode:"category"});c(this,"Dn",null);c(this,"Bn",null);c(this,"ft",null);c(this,"ct",null);c(this,"w",0);c(this,"M",0);c(this,"Qe",[]);c(this,"Ri",[]);c(this,"$o",0);c(this,"b",0);c(this,"p",1);c(this,"fo","");c(this,"Ge",null);c(this,"l",null);c(this,"zo",0);c(this,"Xo",0);c(this,"u",[]);c(this,"m",null);c(this,"Pn",-1);c(this,"mo",()=>fo(this))}tooltipCallbacks(){return{onHover:(n,i)=>Dr(this,n,i),onLeave:()=>{this.Ge&&(this.Ge=null,this.mo())},onPin:(n,i)=>{Dr(this,n,i),this.Ge&&this.rr(this.Ge.xIdx,this.Ge.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async rr(n,i){let o=this.Ot.map(a=>a.labels[n]??null),r=this.Vt.slice(0,this.B.length).map(a=>a.labels[i]??null),s=this.I[0]??"";await this.emitClickAndSelect({rowIdx:n+this.mt,columnName:s,groupByValues:o,splitByValues:r})}async uploadAndRender(n,i,o,r){if(this.t=n,o!==0)return;let s=this.I.filter(a=>!!a);if(s.length>1){let a=Ka(i,s),l=[],u=[],m=1/0,f=-1/0;for(let p of a){let d=Rr({columns:p.columns,numRows:r,groupBy:this._,splitBy:this.B,groupByTypes:this.ht}),b=u.length;for(let x of d.cells)u.push({xIdx:x.xIdx,yIdx:x.yIdx,value:x.value});l.push({label:p.label,pipeline:d,layout:new ne(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:b,instanceCount:d.cells.length,xOrigin:d.xNumericDomain?.min??0,yOrigin:d.yNumericDomain?.min??0}),isFinite(d.colorMin)&&d.colorMin<m&&(m=d.colorMin),isFinite(d.colorMax)&&d.colorMax>f&&(f=d.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.Ot=[],this.Vt=[],this.co=[],this.At=0,this.Lt=0,this.mt=0,this.Ri=[],this.l=null,this.En={mode:"category"},this.Gn={mode:"category"},this.Dn=null,this.Bn=null,this.ft=null,this.ct=null,this.w=0,this.M=0,this.u=l,this.Qe=u,this.b=m,this.p=f,this.fo=s.join(", ")}else{let a=Rr({columns:i,numRows:r,groupBy:this._,splitBy:this.B,groupByTypes:this.ht});this.u=[],this.m=null,this.Ot=a.xLevels,this.Vt=a.yLevels,this.co=a.yColumnNames,this.At=a.numX,this.Lt=a.numY,this.mt=a.rowOffset,this.Qe=a.cells,this.Ri=a.cells2D,this.b=a.colorMin,this.p=a.colorMax,this.fo=s[0]??"Color",this.En=a.xAxisMode,this.Gn=a.yAxisMode,this.Dn=a.xPositions,this.Bn=a.yPositions,this.ft=a.xNumericDomain,this.ct=a.yNumericDomain,this.w=a.xNumericDomain?.min??0,this.M=a.yNumericDomain?.min??0}await this.requestRender(n)}Dt(n){this.t=n;let i=this.At>0&&this.Lt>0,o=this.u.length>0;!i&&!o||il(this,n)}destroyInternal(){this.k&&this.t&&this.t.gl.deleteBuffer(this.k),this.i=null,this.F=null,this.k=null,this.Ot=[],this.Vt=[],this.co=[],this.Qe=[],this.Ri=[],this.Ge=null,this.u=[],this.m=null,this.Pn=-1,this.En={mode:"category"},this.Gn={mode:"category"},this.Dn=null,this.Bn=null,this.ft=null,this.ct=null}};Qt();function Tn(){return{count:0,catIdx:new Int32Array(0),splitIdx:new Int32Array(0),seriesId:new Int32Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),open:new Float64Array(0),close:new Float64Array(0),high:new Float64Array(0),low:new Float64Array(0),isUp:new Uint8Array(0)}}function Rf(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),splitIdx:new Int32Array(t),seriesId:new Int32Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),open:new Float64Array(t),close:new Float64Array(t),high:new Float64Array(t),low:new Float64Array(t),isUp:new Uint8Array(t)}}var al={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function ll(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,bandInnerFrac:a,barInnerPad:l,scratchCandles:u}=e,m=Gt(o,s),f=i[0]||"";if(!f)return{...al,candles:Tn()};let p=i[1]||"",d=i[2]||"",b=i[3]||"",x=[];if(r.length>0){let O=[f];p&&O.push(p),d&&O.push(d),b&&O.push(b);for(let X of He(t,[f],O))X.colNames.has(f)&&x.push(X.prefix);x.length===0&&x.push("")}else x.push("");let h=o.map(O=>s[O]??"string"),{rowPaths:g,numCategories:y,rowOffset:_}=Wt(t,n,o.length,h);if(y===0)return{...al,axisMode:m,splitPrefixes:x,rowPaths:g,rowOffset:_,candles:Tn()};let C=x.length,v=[];for(let O=0;O<C;O++){let X=x[O];v.push({seriesId:O,splitIdx:O,splitKey:X,label:X===""?f:X})}let A=null,T=null,L=1;if(m.mode==="numeric"&&y>0){let O=t.get("__ROW_PATH_0__"),X=ct(O?.values,y,_,o[0]??"",m.numericType==="date"||m.numericType==="datetime");X&&(A=X.categoryPositions,T=X.numericCategoryDomain,L=X.numericCategoryDomain.bandWidth)}let R=qi(C,a,l),F=R.slotWidth*L,I=R.halfWidth*L,S=(C-1)/2,D=[];for(let O=0;O<C;O++){let X=x[O],q=et=>X===""?et:`${X}|${et}`,le=t.get(q(f));if(!le?.values){D.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let Fe=p?t.get(q(p)):null,_e=d?t.get(q(d)):null,ve=b?t.get(q(b)):null;D.push({openCol:le.values,closeCol:Fe?.values??null,highCol:_e?.values??null,lowCol:ve?.values??null,openValid:le.valid??null,closeValid:Fe?.valid??null,highValid:_e?.valid??null,lowValid:ve?.valid??null})}let B=y*C,N=Rf(u??null,B),k=0,Y=1/0,W=-1/0,V=y;for(let O=0;O<C;O++){let X=D[O],q=X.openCol;if(!q)continue;let le=X.closeCol,Fe=X.highCol,_e=X.lowCol,ve=X.openValid,et=X.closeValid,zt=X.highValid,Xt=X.lowValid,$t=(O-S)*F;for(let ge=0;ge<V;ge++){let se=ge+_;if(ve&&!(ve[se>>3]>>(se&7)&1))continue;let Q=q[se];if(!isFinite(Q))continue;let ie;if(le&&(!et||(et[se>>3]>>(se&7)&1)!==0)){let K=le[se];ie=isFinite(K)?K:Q}else{let K=ge<V-1?ge+1+_:se;if(!ve||(ve[K>>3]>>(K&7)&1)!==0){let bt=q[K];ie=isFinite(bt)?bt:Q}else ie=Q}let Se;if(Fe&&(!zt||(zt[se>>3]>>(se&7)&1)!==0)){let K=Fe[se];Se=isFinite(K)?K:Q>ie?Q:ie}else Se=Q>ie?Q:ie;let Ie;if(_e&&(!Xt||(Xt[se>>3]>>(se&7)&1)!==0)){let K=_e[se];Ie=isFinite(K)?K:Q<ie?Q:ie}else Ie=Q<ie?Q:ie;let Ao=(A?A[ge]:ge)+$t,De=ie>=Q?1:0;N.catIdx[k]=ge,N.splitIdx[k]=O,N.seriesId[k]=O,N.xCenter[k]=Ao,N.halfWidth[k]=I,N.open[k]=Q,N.close[k]=ie,N.high[k]=Se,N.low[k]=Ie,N.isUp[k]=De,k++,Ie<Y&&(Y=Ie),Se>W&&(W=Se)}}if(N.count=k,!isFinite(Y)||!isFinite(W))Y=0,W=1;else if(Y===W){let O=Math.max(Math.abs(Y),1)*.05;Y-=O,W+=O}return{splitPrefixes:x,rowPaths:g,numCategories:y,rowOffset:_,axisMode:m,numericCategoryDomain:T,categoryPositions:A,series:v,candles:N,yDomain:{min:Y,max:W}}}Ye();Ee();on();Ct();Ae();Ft();var wf=3;function ul(e,t,n){let i=0,o=t;for(;i<o;){let r=i+o>>>1;e[r]<n?i=r+1:o=r}return i}function Er(e,t,n){if(e.po!==-1)return;let i=e.l;if(!i)return;let o=e.Ce;if(o.count===0){e._e!==-1&&(e._e=-1,Qe(e));return}let r=i.e,s=i.Y,a=i.J,l=i.q,u=i.Q;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e._e!==-1&&(e._e=-1,Qe(e));return}let m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),d=wf/p,b=o.xCenter,x=o.halfWidth,h=o.open,g=o.close,y=o.high,_=o.low,C=o.count>0?x[0]:0,v=Math.max(C,d),A=ul(b,o.count,m-v),T=ul(b,o.count,m+v+1e-12),L=-1;for(let R=T-1;R>=A;R--){let F=b[R],I=x[R],S=m>=F-I&&m<=F+I,D=Math.abs(m-F)<=d;if(!S&&!D)continue;let B=h[R],N=g[R],k=B<N?B:N,Y=B<N?N:B,W=S&&f>=k&&f<=Y,V=f>=_[R]&&f<=y[R];if(W||V){L=R;break}}L!==e._e&&(e._e=L,Qe(e))}function ml(e,t){e.T.dismiss(),e.po=t;let n=e.Ce;if(t<0||t>=n.count||!e.l)return;let i=Gr(e,t);if(i.length===0)return;let o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.l.P(o,r),a=e.l.cssWidth,l=e.l.cssHeight;e.T.pin(i,s,{cssWidth:a,cssHeight:l}),e._e=-1,Qe(e)}function Gr(e,t){let n=[],i=e.Ce;if(t<0||t>=i.count)return n;let o=i.catIdx[t],r=i.splitIdx[t],s=i.open[t],a=i.close[t],l=i.high[t],u=i.low[t];if(e.Ke==="numeric"&&e.D&&e.qe){let b=e.qe[o],x=e._[0];n.push(e.getColumnFormatter(x,"value")(b))}else if(e.we.length>0){let b=[];for(let x of e.we){let h=x.labels[o]??"";h&&b.push(h)}b.length>0&&n.push(b.join(" \\u203A "))}else n.push(`Row ${o+e.mt}`);if(r>=0&&e.fe.length>1){let b=e.fe[r];b&&n.push(b)}let m=e.getColumnFormatter(e.I[0],"value"),f=e.getColumnFormatter(e.I[1],"value"),p=e.getColumnFormatter(e.I[2],"value"),d=e.getColumnFormatter(e.I[3],"value");return n.push(`Open: ${m(s)}`),n.push(`Close: ${f(a)}`),n.push(`High: ${p(l)}`),n.push(`Low: ${d(u)}`),n}function fl(e,t,n,i,o){let r=1/0,s=-1/0,a={cat:0,lo:0,hi:0,skip:!1};for(let u=0;u<e.length;u++)a.skip=!1,i(e[u],a),!a.skip&&(a.cat<t||a.cat>n||(a.lo<r&&(r=a.lo),a.hi>s&&(s=a.hi)));let l=isFinite(r)&&isFinite(s);if(l&&r===s){let u=Math.abs(r)||1;r-=u,s+=u}return o.min=r,o.max=s,o.hasFit=l,o}function Wr(e){let n=e.A().H;if(e.wi===n)return;let i=Le(n,1),o=Le(n,0);e.Mi=[i[0],i[1],i[2]],e.Fi=[o[0],o[1],o[2]],e.wi=n}function cl(e){e.N.bodyWick.invalidateBuffers(e),e.N.ohlc.invalidateBuffers(e)}function dl(e,t){e.N.bodyWick.rebuildBuffers(e,t),e.N.ohlc.rebuildBuffers(e,t)}function pl(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0||e.ee===0)return;let s=e.A();Wr(e);let a=e.Ke==="numeric",l=a?e.D.min:-.5,u=a?e.D.max:e.ee-.5;e.g&&e.g.setBaseDomain(l,u,e.Wn.min,e.Wn.max);let m=e.g?e.g.getVisibleDomain():{xMin:l,xMax:u,yMin:e.Wn.min,yMax:e.Wn.max};if(e.oi&&e.g&&!e.g.isXDefault()){let _=Ff(e,m.xMin,m.xMax);_.hasFit&&(m.yMin=_.min,m.yMax=_.max)}let f=e._.length>0,p={levels:e.we,numRows:e.ee,levelLabels:e._.slice()},d;if(a)d=new ne(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,o-71-16),A=We(p,v);d=new ne(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.l=d,e.g&&e.g.updateLayout(d);let b=d.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e.se,0),x=oe(m.yMin,m.yMax,6),h=e.I[0]||"",g=p,y={min:m.yMin,max:m.yMax,label:h};e.j&&ro(e.j,d,x,s,t.dpr),ze(n,d,t.dpr,()=>{e.ni==="ohlc"?e.N.ohlc.draw(e,n,t,b):e.N.bodyWick.draw(e,n,t,b)}),e.he=g,e.xe=y,e.Re=x,e.ze=a?oe(m.xMin,m.xMax,6):null,e.pe(()=>Qe(e))}function Qe(e){if(!e.c||!e.l||!e.xe||!e.Re)return;let t=e.A(),n;if(e.Ke==="numeric"&&e.D&&e.ze)n={mode:"numeric",domain:{min:e.D.min,max:e.D.max,isDate:e.D.isDate,label:e.D.label},ticks:e.ze};else if(e.he)n={mode:"category",domain:e.he};else return;let i=e.I[0]??e.I[1]??e.I[2]??e.I[3],o=e._[0];oo(e.c,n,{mode:"numeric",domain:e.xe,ticks:e.Re},e.l,t,e.t?.dpr??1,void 0,!1,{value:e.getColumnFormatter(i,"tick"),category:e.getColumnFormatter(o,"tick")}),e._e>=0&&e._e<e.Ce.count&&Mf(e)}function Mf(e){if(!e.c||!e.l)return;let t=e._e,n=e.Ce;if(t<0||t>=n.count)return;let i=e.l,o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=i.P(o,r),a=Gr(e,t),l=e.A();Pe(e.c,s,a,i,l,e.t?.dpr??1,{crosshair:!1,highlightRadius:0})}function Ff(e,t,n){let i=e._t;if(i&&i.xMin===t&&i.xMax===n)return i;let o=i??Sf();o.xMin=t,o.xMax=n;let r=e.Ce,s=1/0,a=-1/0,l=!1,u=r.xCenter,m=r.low,f=r.high;for(let p=0;p<r.count;p++){let d=u[p];d<t||d>n||(m[p]<s&&(s=m[p]),f[p]>a&&(a=f[p]),l=!0)}return o.min=l?s:0,o.max=l?a:1,o.hasFit=l,e._t=o,o}function Sf(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}Me();fe();var po=class{constructor(){c(this,"i",null);c(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=Ai(n),r={...j(t,"candlestick-body",Nn,Un,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:i,instanceBuffer:n.createBuffer()},s=je(n),l={...j(t,"line-uniform",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]),cornerBuffer:s,segmentBuffer:n.createBuffer()};return this.i={body:r,wick:l},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;i.deleteBuffer(n.upWickBuffer),i.deleteBuffer(n.downWickBuffer),this.o=null}rebuildBuffers(t,n){let i=t.Ce,o=this.ensureProgram(n),r=n.gl,s=t.se;if(i.count===0){let F=r.createBuffer(),I=r.createBuffer();this.o={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:F,downWickBuffer:I};return}let a=new Float32Array(i.count*7),l=0,u=0,m=i.xCenter,f=i.halfWidth,p=i.open,d=i.close,b=i.isUp,x=t.Mi,h=t.Fi;for(let F=0;F<i.count;F++){let I=p[F],S=d[F],D=I<S?I:S,B=I<S?S:I,N=b[F]!==0,k=N?x:h,Y=F*7;a[Y+0]=m[F]-s,a[Y+1]=f[F]*.7,a[Y+2]=D,a[Y+3]=B,a[Y+4]=k[0],a[Y+5]=k[1],a[Y+6]=k[2],N?l++:u++}r.bindBuffer(r.ARRAY_BUFFER,o.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);let g=new Float32Array(l*4),y=new Float32Array(u*4),_=0,C=0,v=i.low,A=i.high;for(let F=0;F<i.count;F++){let I=m[F]-s,S=v[F],D=A[F];b[F]!==0?(g[_+0]=I,g[_+1]=S,g[_+2]=I,g[_+3]=D,_+=4):(y[C+0]=I,y[C+1]=S,y[C+2]=I,y[C+3]=D,C+=4)}let T=this.o,L=T?.upWickBuffer??r.createBuffer(),R=T?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,L),r.bufferData(r.ARRAY_BUFFER,g,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,R),r.bufferData(r.ARRAY_BUFFER,y,r.STATIC_DRAW),this.o={bodyCount:i.count,upWickCount:l,downWickCount:u,upWickBuffer:L,downWickBuffer:R}}draw(t,n,i,o){let r=this.o;if(!r||r.bodyCount===0)return;let s=this.ensureProgram(i);If(n,i,s.body,r.bodyCount,o),Df(t,n,i,s.wick,r,o)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&(n.deleteBuffer(i.body.quadBuffer),n.deleteBuffer(i.body.instanceBuffer),n.deleteBuffer(i.wick.cornerBuffer),n.deleteBuffer(i.wick.segmentBuffer))}this.i=null,this.o=null}};function If(e,t,n,i,o){if(i===0)return;let r=7*Float32Array.BYTES_PER_ELEMENT;e.useProgram(n.program),e.uniformMatrix4fv(n.u_projection,!1,o);let s=J(t),{setDivisor:a}=s;e.bindBuffer(e.ARRAY_BUFFER,n.quadBuffer),e.enableVertexAttribArray(n.a_corner),e.vertexAttribPointer(n.a_corner,2,e.FLOAT,!1,0,0),a(n.a_corner,0),e.bindBuffer(e.ARRAY_BUFFER,n.instanceBuffer);let l=Float32Array.BYTES_PER_ELEMENT,u=(m,f,p)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,p),a(m,1)};u(n.a_x_center,1,0),u(n.a_half_width,1,1*l),u(n.a_y0,1,2*l),u(n.a_y1,1,3*l),u(n.a_color,3,4*l),s.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i),a(n.a_x_center,0),a(n.a_half_width,0),a(n.a_y0,0),a(n.a_y1,0),a(n.a_color,0)}function Df(e,t,n,i,o,r){if(o.upWickCount===0&&o.downWickCount===0)return;let s=n.dpr;t.useProgram(i.program),t.uniformMatrix4fv(i.u_projection,!1,r),t.uniform2f(i.u_resolution,t.canvas.width,t.canvas.height),t.uniform1f(i.u_line_width,e.h.wick_width_px*s),t.disableVertexAttribArray(i.a_real_start),t.disableVertexAttribArray(i.a_real_end),t.vertexAttrib1f(i.a_real_start,1),t.vertexAttrib1f(i.a_real_end,1),t.uniform1f(i.u_interp_alpha,1);let a=J(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,i.cornerBuffer),t.enableVertexAttribArray(i.a_corner),t.vertexAttribPointer(i.a_corner,1,t.FLOAT,!1,0,0),l(i.a_corner,0),bl(t,a,i,o.upWickBuffer,o.upWickCount,e.Mi),bl(t,a,i,o.downWickBuffer,o.downWickCount,e.Fi),l(i.a_start,0),l(i.a_end,0)}function bl(e,t,n,i,o,r){if(o===0)return;let s=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:a}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,2*s,0),a(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,2*s,s),a(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}Me();fe();var bo=class{constructor(){c(this,"i",null);c(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=je(n),o=j(t,"line-uniform",Oe,Ve,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]);return this.i={...o,cornerBuffer:i,segmentBuffer:n.createBuffer()},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;i.deleteBuffer(n.upBuffer),i.deleteBuffer(n.downBuffer),this.o=null}rebuildBuffers(t,n){if(t.ni!=="ohlc")return;let i=t.Ce,o=n.gl;this.ensureProgram(n);let r=t.se,s=i.xCenter,a=i.halfWidth,l=i.open,u=i.close,m=i.high,f=i.low,p=i.isUp,d=0,b=0;for(let A=0;A<i.count;A++)p[A]!==0?d++:b++;let x=new Float32Array(d*3*4),h=new Float32Array(b*3*4),g=0,y=0;for(let A=0;A<i.count;A++){let T=s[A]-r,L=l[A],R=u[A],F=f[A],I=m[A],S=a[A],D=p[A]!==0?x:h,B=p[A]!==0?g:y;D[B++]=T,D[B++]=F,D[B++]=T,D[B++]=I,D[B++]=T-S,D[B++]=L,D[B++]=T,D[B++]=L,D[B++]=T,D[B++]=R,D[B++]=T+S,D[B++]=R,p[A]!==0?g=B:y=B}let _=this.o,C=_?.upBuffer??o.createBuffer(),v=_?.downBuffer??o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,C),o.bufferData(o.ARRAY_BUFFER,x,o.STATIC_DRAW),o.bindBuffer(o.ARRAY_BUFFER,v),o.bufferData(o.ARRAY_BUFFER,h,o.STATIC_DRAW),this.o={upBuffer:C,downBuffer:v,upInstanceCount:d*3,downInstanceCount:b*3}}draw(t,n,i,o){let r=this.o;if(!r||r.upInstanceCount===0&&r.downInstanceCount===0)return;let s=this.ensureProgram(i),a=i.dpr;n.useProgram(s.program),n.uniformMatrix4fv(s.u_projection,!1,o),n.uniform2f(s.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(s.u_line_width,t.h.ohlc_line_width_px*a),n.disableVertexAttribArray(s.a_real_start),n.disableVertexAttribArray(s.a_real_end),n.vertexAttrib1f(s.a_real_start,1),n.vertexAttrib1f(s.a_real_end,1),n.uniform1f(s.u_interp_alpha,1);let l=J(i),{setDivisor:u}=l;n.bindBuffer(n.ARRAY_BUFFER,s.cornerBuffer),n.enableVertexAttribArray(s.a_corner),n.vertexAttribPointer(s.a_corner,1,n.FLOAT,!1,0,0),u(s.a_corner,0),gl(n,l,s,r.upBuffer,r.upInstanceCount,t.Mi),gl(n,l,s,r.downBuffer,r.downInstanceCount,t.Fi),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&(n.deleteBuffer(i.cornerBuffer),n.deleteBuffer(i.segmentBuffer))}this.i=null,this.o=null}};function gl(e,t,n,i,o,r){if(o===0)return;let s=4*Float32Array.BYTES_PER_ELEMENT,a=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:l}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,s,0),l(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,s,a),l(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}var Rn=class extends Nt{constructor(){super(...arguments);c(this,"F",null);c(this,"fe",[]);c(this,"s",[]);c(this,"Ce",Tn());c(this,"Wn",{min:0,max:1});c(this,"Si",null);c(this,"Ke","category");c(this,"D",null);c(this,"qe",null);c(this,"ze",null);c(this,"se",0);c(this,"Mi",[0,.8,.4]);c(this,"Fi",[.8,.2,.2]);c(this,"wi",null);c(this,"_e",-1);c(this,"po",-1);c(this,"N",{bodyWick:new po,ohlc:new bo});c(this,"oi",!0);c(this,"_t",null)}tooltipCallbacks(){return{onHover:(n,i)=>Er(this,n,i),onLeave:()=>{this._e!==-1&&(this._e=-1,Qe(this))},onPin:(n,i)=>{if(Er(this,n,i),this._e>=0){let o=this._e;ml(this,o),this.sr(o)}},onUnpin:()=>{this.emitUnselect()}}}async sr(n){if(n<0||n>=this.Ce.count)return;let i=this.Ce.catIdx[n],o=this.Ce.splitIdx[n],r=this.we.map(u=>u.labels[i]??null),s=this.fe[o]??"",a=this.B.length>0&&s!==""?s.split("|"):[],l=this.I[1]||this.I.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:i+this.mt,columnName:l,groupByValues:r,splitByValues:a})}invalidateTheme(){super.invalidateTheme(),this.wi=null}async uploadAndRender(n,i,o,r){if(this.t=n,o!==0)return;let s=ll({columns:i,numRows:r,columnSlots:this.I,groupBy:this._,splitBy:this.B,groupByTypes:this.ht,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,scratchCandles:this.Ce});this.h.domain_mode==="expand"?this.Si=Ln(this.Si,s.yDomain):this.Si=null,this.we=s.rowPaths,this.ee=s.numCategories,this.mt=s.rowOffset,this.fe=s.splitPrefixes,this.s=s.series,this.Ce=s.candles,this.Wn=s.yDomain,this.Ke=s.axisMode.mode,this.D=s.numericCategoryDomain,this.qe=s.categoryPositions,this.se=s.numericCategoryDomain?.min??0,this._t=null,Wr(this),cl(this),dl(this,n),await this.requestRender(n)}Dt(n){this.t=n,pl(this,n)}resetExpandedDomain(){this.Si=null}destroyInternal(){if(this.t){let n=this.t.gl;this.k&&n.deleteBuffer(this.k),this.N.bodyWick.destroy(this),this.N.ohlc.destroy(this)}this.i=null,this.F=null,this.k=null,this.Ce=Tn(),this.s=[],this.we=[],this.ee=0,this.wi=null}};var Rl={scatter:async()=>Li,line:async()=>Ti,density:async()=>Ri,treemap:async()=>zi,sunburst:async()=>Zi,heatmap:async()=>co,"y-bar":async()=>Je,"y-line":async()=>Je,"y-scatter":async()=>Je,"y-area":async()=>Je,"x-bar":async()=>mo,candlestick:async()=>Rn,ohlc:async()=>Rn,"map-scatter":async()=>(await Promise.resolve().then(()=>(Co(),yo))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(Co(),yo))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(Co(),yo))).MapDensityChart};async function wl(e,t,n){let i=new Map;await e.with_typed_arrays(n??{},async(o,r,s,a)=>{for(let u=0;u<o.length;u++){let m=o[u],f=r[u],p=s[u]??void 0,d=a[u];d!==null?i.set(m,{type:"string",indices:f,dictionary:d,valid:p}):f instanceof Float32Array?i.set(m,{type:"float32",values:f,valid:p}):f instanceof Int32Array?i.set(m,{type:"int32",values:f,valid:p}):f instanceof Float64Array?i.set(m,{type:"float64",values:f,valid:p}):i.set(m,{type:"float32",values:new Float32Array(f),valid:p})}let l=0;if(i.size>0){l=1/0;for(let u of i.values()){let m=u.indices?.length??u.values?.length??0;m<l&&(l=m)}}await t(i,l)})}var Ml=new Map;async function Fl(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=Ml.get(t);if(n){await n;return}n=(async()=>{try{let i={};e.style&&(i.style=e.style),e.weight&&(i.weight=e.weight),e.stretch&&(i.stretch=e.stretch);let o=new FontFace(e.family,e.src,i);await o.load(),self.fonts.add(o)}catch(i){console.warn(`Failed to load font ${e.family}:`,i)}})(),Ml.set(t,n),await n}function Yt(e,t){switch(t.kind){case"setViewByName":e.setViewByName(t.name);break;case"setColumnsConfig":e.chartImpl.setColumnsConfig?.(t.cfg);break;case"setPluginConfig":e.chartImpl.setPluginConfig?.(t.cfg),e.redraw();break;case"setBufferMaxCapacity":e.glManager.v.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"deselect":e.chartImpl.deselect?.();break;case"resize":e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redrawAck(t.msgId);break;case"clear":e.clear();break;case"invalidateTheme":e.chartImpl.setTheme?.(t.themeVars),e.chartImpl.invalidateTheme?.(),e.resize(e.cssWidth,e.cssHeight,e.dpr);break;case"restoreZoom":e.restoreZoom(t.state);break;case"resetAllZooms":e.resetAllZooms(),e.redraw(),e.post({kind:"zoomChanged",isDefault:e.allZoomsDefault()});break;case"resetExpandedDomain":e.resetExpandedDomain();break;case"interaction":e.onInteraction(t.event);break;case"saveZoom":e.post({kind:"saveZoomReply",requestId:t.requestId,state:e.saveZoom()});break;case"destroy":e.destroy();break;case"init":break;case"snapshotPng":{let n=t.requestId;e.snapshotPng().then(i=>{e.post({kind:"snapshotPngReply",requestId:n,blob:i})}).catch(i=>{e.post({kind:"error",message:String(i)})});break}}}var Mn=new Map,Hr=new Set;function Yr(e,t,n){let i={sessionId:e,msg:t};n&&n.length>0?self.postMessage(i,n):self.postMessage(i)}function Gf(e){return{postMessage:(t,n)=>Yr(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function Sl(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:i,msg:o}=n;if(o.kind==="init"){if(Mn.has(i)){Yr(i,{kind:"error",message:`sessionId ${i} already initialized`});return}e(o,Gf(i)).then(s=>{if(Hr.delete(i)){Yt(s,{kind:"destroy"});return}Mn.set(i,s)}).catch(s=>{Hr.delete(i),Yr(i,{kind:"error",message:String(s)})});return}if(o.kind==="destroy"){let s=Mn.get(i);s?(Yt(s,o),Mn.delete(i)):Hr.add(i);return}let r=Mn.get(i);r&&Yt(r,o)})}Uo();var _o=class extends Error{constructor(){super("StaleGenerationError")}};async function Dl(e){let t=Rl[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var zr=null;function Wf(e){return zr||(zr=new Qn(4,{precompile:e})),zr}var vo=class{constructor(t,n,i,o,r,s){c(this,"chartImpl");c(this,"glManager");c(this,"zoomController",null);c(this,"gridlines");c(this,"chrome");c(this,"cssWidth");c(this,"cssHeight");c(this,"dpr");c(this,"client");c(this,"view");c(this,"table");c(this,"controlPort");c(this,"bo",0);c(this,"Ii",null);c(this,"go",0);c(this,"ho",0);if(this.client=n,this.view=i,this.table=o,this.controlPort=r,this.chartImpl=new s,t.renderMode==="blit"&&!t.glCanvas&&!0)this.glManager=new qt(Wf(t.precompileShaders??!1).acquire());else{let l=t.glCanvas??new OffscreenCanvas(Math.max(1,Math.round(t.cssWidth*t.dpr)),Math.max(1,Math.round(t.cssHeight*t.dpr)));this.glManager=new qt(l,{precompile:t.precompileShaders??!1})}t.renderMode==="blit"&&this.glManager.setFrameCallback(l=>{this.post({kind:"frameBitmap",bitmap:l},[l])}),this.gridlines=t.gridlinesCanvas,this.chrome=t.chromeCanvas,this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(t.gridlinesCanvas),this.chartImpl.setChromeCanvas?.(t.chromeCanvas),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),t.columnsConfig&&this.chartImpl.setColumnsConfig?.(t.columnsConfig),this.chartImpl.setZoomController&&(this.zoomController=new yt,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(i),this.glManager.v.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr),this.chartImpl.attachTooltip?.(new ti(l=>this.post(l)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}async loadAndRender(t){let n=++this.bo;try{let[i,o,r,s]=await Promise.all([this.view.num_rows(),this.view.schema(),this.view.expression_schema(),this.table?.schema()??Promise.resolve({})]);if(this.bo!==n)return;this.chartImpl.setViewPivots?.(t.viewerConfig.group_by,t.viewerConfig.split_by),this.chartImpl.setColumnTypes?.(o),this.chartImpl.setGroupByTypes?.({...s,...r}),this.chartImpl.setColumnSlots?.(t.viewerConfig.columns);let a=Object.keys(o).length||1,l=Math.floor(this.glManager.v.maxCapacity/a),u=Math.min(i,l);this.glManager.ensureBufferCapacity(u);try{await wl(this.view,async(m,f)=>{if(this.bo!==n)throw new _o;await this.chartImpl.uploadAndRender(this.glManager,m,0,Math.min(u,f))},{end_row:u,float32:t.options.float32})}catch(m){if(!(m instanceof _o))throw m}}catch(i){(i+"").indexOf("View not found")===-1&&console.error("loadAndRender failed",i)}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId})}}redraw(){this.chartImpl.requestRender(this.glManager)}redrawAck(t){this.chartImpl.requestRender(this.glManager).catch(()=>{}).finally(()=>this.post({kind:"resizeAck",msgId:t}))}resize(t,n,i){this.cssWidth=t,this.cssHeight=n,this.dpr=i,this.glManager.requestResize(t,n,i),this.chartImpl.requestRender(this.glManager)}clear(){ys(this.glManager,()=>{this.glManager.clear(),this.gridlines.getContext("2d")?.clearRect(0,0,this.gridlines.width,this.gridlines.height)})}saveZoom(){return this.zoomController?.serialize()}restoreZoom(t){t&&this.zoomController?.restore(t)}allZoomsDefault(){if(this.zoomController&&!this.zoomController.isDefault())return!1;let t=this.chartImpl?.cn;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.cn;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}Qo(t,n){let i=this.chartImpl,o=i?.m;if(o){for(let a=0;a<o.cells.length;a++){let l=o.cells[a],u=l.layout.e;if(t>=u.x&&t<=u.x+u.width&&n>=u.y&&n<=u.y+u.height){let m=i.getZoomControllerForFacet?.(a)??this.zoomController;return m?{controller:m,layout:l.layout}:null}}return null}if(!this.zoomController)return null;let r=i?.l;if(!r)return null;let s=r.e;return t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height?null:{controller:this.zoomController,layout:r}}onInteraction(t){switch(t.type){case"wheel":{let n=this.Qo(t.mx,t.my);if(!n)return;ts(n,t.mx,t.my,t.deltaY),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()});break}case"pointerdown":{let n=this.Qo(t.mx,t.my);if(!n)return;this.Ii=n,this.go=t.mx,this.ho=t.my;break}case"pointermove":{if(this.Ii){let n=t.mx-this.go,i=t.my-this.ho;this.go=t.mx,this.ho=t.my,ns(this.Ii,n,i),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.T()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.Ii=null;break}case"pointerleave":{this.T()?.dispatchLeave();break}case"click":{this.T()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this.T()?.dispatchDblClick(t.mx,t.my);break}}}T(){return this.chartImpl?.T??null}async snapshotPng(){this.glManager.beginFrame(),this.chartImpl.renderFrameSync(this.glManager);let t=this.glManager.gl,n=t.canvas,i=n.width,o=n.height,r=new Uint8ClampedArray(i*o*4);t.readPixels(0,0,i,o,t.RGBA,t.UNSIGNED_BYTE,r);let s=new OffscreenCanvas(i,o),a=s.getContext("2d");if(!a)throw new Error("snapshotPng: 2D context unavailable");let u=this.chartImpl.A?.()?.backgroundColor??"transparent";u!=="transparent"&&(a.fillStyle=u,a.fillRect(0,0,i,o)),a.drawImage(this.gridlines,0,0);let m=new OffscreenCanvas(i,o),f=m.getContext("2d");if(!f)throw new Error("snapshotPng: 2D context unavailable for GL blit");return f.putImageData(new ImageData(r,i,o),0,0),a.save(),a.scale(1,-1),a.drawImage(m,0,-o),a.restore(),a.drawImage(this.chrome,0,0),await s.convertToBlob({type:"image/png"})}destroy(){Cs(this.glManager),this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},kf=typeof globalThis.importScripts=="function";async function Nf(e,t){if(!e.clientWorkerURL||!e.clientWasm||!e.proxyPort)throw new Error("Init error");let n=await import(e.clientWorkerURL.toString());await n.initSync({module:e.clientWasm}),e.fontFaces?.length&&await Promise.all(e.fontFaces.map(Fl));let i=e.proxyPort,o=new n.Client(async u=>{let m=u.slice().buffer;i.postMessage(m,[m])},async()=>i.close());i.addEventListener("message",u=>{o.handle_response(new Uint8Array(u.data))}),i.start();let r=o.__unsafe_open_view(e.viewName),s=e.tableName?await o.open_table(e.tableName):null,a=await Dl(e.chartTag),l=new vo(e,o,r,s,t,a);return l.post({kind:"ready"}),l}async function LC(e){let t=e.client.__unsafe_open_view(e.msg.viewName),n=e.msg.tableName?await e.client.open_table(e.msg.tableName):null,i=await Dl(e.msg.chartTag),o=new vo(e.msg,e.client,t,n,e.controlPort,i);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&Yt(o,s)}),e.controlPort.start(),o.post({kind:"ready"}),o}kf&&Sl(Nf);export{vo as WorkerRenderer,LC as bootstrapInProcess};\n';var T=null;async function fe(){if(T)return T;let o=new Blob([J],{type:"application/javascript"});return T=URL.createObjectURL(o),T}var N=fe;var M=null,U=new Map,de=0;async function me(){return M||(M=(async()=>{let o=await N(),e=new Worker(o,{type:"module",name:"viewer-charts"});return e.addEventListener("message",t=>{let i=t.data;U.get(i.sessionId)?.(i.msg)}),e})(),M)}var E=class{_handle=null;_destroyed=!1;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_panel;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_lastPostedSize=null;_holdPresent=!1;_stagedFrame=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._panel=e.panel,this._clientWorkerURL=e.clientWorkerURL,this._clientWasm=e.clientWasm,this._chartTag=e.chartTag,this._maxCells=e.maxCells,this._precompileShaders=e.precompileShaders??!1,this._onZoomChanged=e.onZoomChanged??null,this._ready=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i})}async init(e){this._hostGlCanvas=e.gl;let t=await N();d==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(h=>{let O=h.slice().buffer;this._proxyChannel.port1.postMessage(O,[O])}),this._proxyChannel.port1.addEventListener("message",h=>{this._proxySession.handle_request(new Uint8Array(h.data))}),this._proxyChannel.port1.start());let i;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):i=e.gl.transferControlToOffscreen();let n=e.gridlines.transferControlToOffscreen(),r=e.chrome.transferControlToOffscreen(),l=e.gl.getBoundingClientRect(),s=window.devicePixelRatio||1,a=D(e.gl),g=d==="worker"?Z():[],_=d==="worker"?this._clientWasm:void 0,x=d==="worker"?this._clientWorkerURL:void 0,y=d==="worker"?this._proxyChannel.port2:void 0,W={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:r,proxyPort:y,clientWorkerURL:x,clientWasm:_,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,columnsConfig:e.columnsConfig,defaultChartType:e.defaultChartType,themeVars:a,fontFaces:g,cssWidth:l.width,cssHeight:l.height,dpr:s,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._lastPostedSize={cssWidth:l.width,cssHeight:l.height,dpr:s},this._handle=await this._createHandle(t,W),this._handle.addMessageListener(h=>this._handleRendererMsg(h)),d==="worker"){let h=[n,r,this._proxyChannel.port2];i&&h.unshift(i),this._handle.post(W,h)}await this._ready}async _createHandle(e,t){if(d==="worker"){let r=await me(),l=++de;return{post:(s,a)=>r.postMessage({sessionId:l,msg:s},a),addMessageListener:s=>{U.set(l,s)},terminate:()=>{U.delete(l)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(r,l)=>n.port1.postMessage(r,l),addMessageListener:r=>{n.port1.addEventListener("message",l=>r(l.data)),n.port1.start()},terminate:()=>{n.port1.close(),n.port2.close()}}}setView(e){this._view=e,this._post({kind:"setViewByName",name:this._view.__unsafe_get_name()})}setColumnsConfig(e){this._post({kind:"setColumnsConfig",cfg:e})}setPluginConfig(e){this._post({kind:"setPluginConfig",cfg:e})}setBufferMaxCapacity(e){this._post({kind:"setBufferMaxCapacity",n:e})}loadAndRender(e){let{id:t,promise:i}=this._allocPending("loadAndRender"),n={kind:"loadAndRender",msgId:t,viewerConfig:e.viewerConfig,options:{float32:e.options?.float32??!0}};return this._post(n),i}redraw(){this._post({kind:"redraw"})}deselect(){this._post({kind:"deselect"})}resize(){if(!this._hostGlCanvas)return Promise.resolve();let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1,i=this._lastPostedSize;return i&&Math.abs(i.cssWidth-e.width)<=.5&&Math.abs(i.cssHeight-e.height)<=.5&&i.dpr===t?Promise.resolve():this._postResize(e.width,e.height)}presize(e,t){if(!this._hostGlCanvas)return Promise.resolve();let i=window.devicePixelRatio||1,n=this._lastPostedSize;return n&&Math.abs(n.cssWidth-e)<=.5&&Math.abs(n.cssHeight-t)<=.5&&n.dpr===i?Promise.resolve():(this._holdPresent=!0,this._postResize(e,t).then(()=>()=>this._presentStaged(),r=>{throw this._presentStaged(),r}))}_postResize(e,t){let i=window.devicePixelRatio||1,{id:n,promise:r}=this._allocPending("resize");return this._lastPostedSize={cssWidth:e,cssHeight:t,dpr:i},this._post({kind:"resize",msgId:n,cssWidth:e,cssHeight:t,dpr:i}),r}_presentStaged(){this._holdPresent=!1;let e=this._stagedFrame;this._stagedFrame=null,e&&this._drawFrameBitmap(e)}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=D(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){if(this._destroyed){if(e==="loadAndRender")return{id:-1,promise:Promise.resolve(void 0)};let n=Promise.reject(new Error("RendererTransport destroyed"));return n.catch(()=>{}),{id:-1,promise:n}}let t=++this._pendingCounter,i=new Promise((n,r)=>{this._pending.set(t,{kind:e,resolve:n,reject:r})});return{id:t,promise:i}}restoreZoom(e){this._post({kind:"restoreZoom",state:e})}allZoomsDefault(){return this._allZoomsDefault}resetAllZooms(){this._post({kind:"resetAllZooms"})}resetExpandedDomain(){this._post({kind:"resetExpandedDomain"})}snapshotPng(){let{id:e,promise:t}=this._allocPending("snapshotPng");return this._post({kind:"snapshotPng",requestId:e}),t}forwardInteraction(e){this._post({kind:"interaction",event:e})}destroy(){this._destroyed=!0,this._post({kind:"destroy"}),this._proxySession&&this._proxySession.close().catch(()=>{}),this._proxyChannel&&(this._proxyChannel.port1.close(),this._proxyChannel=null),this._handle&&(this._handle.terminate(),this._handle=null),this._hostSink?.dismiss(),this._hostSink=null,this._hostGlCanvas=null,this._displayCtx=null,this._holdPresent=!1,this._stagedFrame?.close(),this._stagedFrame=null;let e=new Error("RendererTransport destroyed");for(let t of this._pending.values())t.kind==="loadAndRender"?t.resolve(void 0):t.reject(e);this._pending.clear()}_post(e){this._postRaw(e,[])}_postRaw(e,t){this._handle&&this._handle.post(e,t)}_handleRendererMsg(e){switch(e.kind){case"ready":this._resolveReady();break;case"zoomChanged":this._allZoomsDefault=e.isDefault,this._onZoomChanged?.(e.isDefault);break;case"saveZoomReply":this._resolvePending(e.requestId,"saveZoom",e.state);break;case"pinTooltip":this._ensureHostSink()?.pin(e.lines,e.pos,e.bounds);break;case"dismissTooltip":this._hostSink?.dismiss();break;case"setCursor":this._ensureHostSink()?.setCursor(e.cursor);break;case"userClick":this._dispatchOnViewer(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:{...e.detail,panel:this._panel}}));break;case"userSelect":{let t=this._lastInsertConfig?[this._lastInsertConfig]:[],i=e.selected?[e.insertConfig]:[];this._lastInsertConfig=e.selected?e.insertConfig:void 0;let n=new p(e.selected,e.row,e.column_names,t,i);n.panel=this._panel,this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._holdPresent?(this._stagedFrame?.close(),this._stagedFrame=e.bitmap):this._drawFrameBitmap(e.bitmap);break;case"error":this._rejectReady(new Error(e.message));break;case"loadAndRenderAck":this._resolvePending(e.msgId,"loadAndRender",void 0);break;case"resizeAck":this._resolvePending(e.msgId,"resize",void 0);break;case"snapshotPngReply":this._resolvePending(e.requestId,"snapshotPng",e.blob);break}}_resolvePending(e,t,i){let n=this._pending.get(e);!n||n.kind!==t||(this._pending.delete(e),n.resolve(i))}_drawFrameBitmap(e){if(this._displayCtx&&this._hostGlCanvas){let t=e.width,i=e.height;this._hostGlCanvas.width!==t&&(this._hostGlCanvas.width=t),this._hostGlCanvas.height!==i&&(this._hostGlCanvas.height=i),this._displayCtx.globalCompositeOperation="copy",this._displayCtx.drawImage(e,0,0)}e.close()}_dispatchOnViewer(e){if(!this._hostGlCanvas)return;let t=this._hostGlCanvas;for(;t;){if(t instanceof HTMLElement&&t.tagName==="PERSPECTIVE-VIEWER"){t.dispatchEvent(e);return}t=t.host??t.parentNode??null}}_ensureHostSink(){if(this._hostSink)return this._hostSink;let e=this._hostGlCanvas?.parentElement;return!e||!this._hostGlCanvas?null:(this._hostSink=new R(this._hostGlCanvas,e),this._hostSink)}};var ge={...j},pe={auto_alt_y_axis:{kind:"Bool"},include_zero:{kind:"Bool"},domain_mode:{kind:"Enum",variants:[{value:"fit",label:"Fit"},{value:"expand",label:"Expand"}]},facet_mode:{kind:"Enum",variants:[{value:"grid",label:"Grid"},{value:"overlay",label:"Overlay"}]},facet_zoom_mode:{kind:"Enum",variants:[{value:"shared",label:"Shared"},{value:"independent",label:"Independent"}]},series_zoom_mode:{kind:"Enum",variants:[{value:"dynamic",label:"Dynamic"},{value:"fixed",label:"Fixed"}]},line_width_px:{kind:"Number",min:.5,step:.5,max:16},point_size_px:{kind:"Number",min:1,max:32},band_inner_frac:{kind:"Number",min:.1,max:1,step:.01},bar_inner_pad:{kind:"Number",min:0,max:.9,step:.01},wick_width_px:{kind:"Number",min:.5,step:.5,max:8},ohlc_line_width_px:{kind:"Number",min:.5,step:.5,max:8},gradient_radius_px:{kind:"Number",min:2,step:1,max:256},gradient_intensity:{kind:"Number",min:.05,step:.05,max:4},gradient_heat_max:{kind:"Number",min:.1,step:.1,max:64},gradient_color_mode:{kind:"Enum",variants:[{value:"mean",label:"Mean (density-weighted)"},{value:"density",label:"Density only"},{value:"extreme",label:"Extremes"},{value:"signed",label:"Signed sum"}]},map_tile_provider:{kind:"Enum",variants:[{value:"carto-positron",label:"Light (Positron)"},{value:"carto-dark-matter",label:"Dark Matter"},{value:"carto-voyager",label:"Voyager"}]},map_tile_alpha:{kind:"Number",min:0,max:1,step:.05}};function _e(o,e){return{...pe[o],key:o,default:e[o]}}var xe=(()=>{let o=new CSSStyleSheet;return o.replaceSync(G),[o]})(),Q=K,F=class extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_resetClickAbort=null;_pluginConfigStore=null;_columnsConfig={};get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{...q,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of xe)this.shadowRoot.adoptedStyleSheets.push(e);this.shadowRoot.innerHTML='<div class="webgl-container"><div class="zoom-controls"><button class="zoom-reset">Reset Zoom</button></div></div>',this._initialized=!0}this._glCanvas?.isConnected||this._buildCanvasStack()}_buildCanvasStack(){let e=this.shadowRoot.querySelector(".webgl-container");e.insertAdjacentHTML("afterbegin",'<canvas class="webgl-gridlines"></canvas><canvas class="webgl-canvas"></canvas><canvas class="webgl-chrome"></canvas>'),this._glCanvas=e.querySelector(".webgl-canvas"),this._gridlineCanvas=e.querySelector(".webgl-gridlines"),this._chromeCanvas=e.querySelector(".webgl-chrome")}_clearCanvasStack(){let e=this.shadowRoot?.querySelector(".webgl-container");if(e)for(let t of Array.from(e.querySelectorAll("canvas")))t.remove();this._glCanvas=null,this._gridlineCanvas=null,this._chromeCanvas=null}disconnectedCallback(){this.delete(),this._clearCanvasStack()}_ensureRenderer(e){if(this._initialized||this.connectedCallback(),this._rendererPromise)return this._rendererPromise;let t=this._buildRenderer(e).then(i=>{if(this._rendererPromise!==t)throw i.destroy(),new Error("renderer disposed during init");return this._renderer=i,this._setupInteraction(i),i});return t.catch(()=>{}),this._rendererPromise=t,t}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new w,this._rawEventForwarder.attach(this._glCanvas,n=>{e.forwardInteraction(n)});let i=this.shadowRoot.querySelector(".zoom-reset");i&&(this._resetClickAbort=new AbortController,i.addEventListener("click",()=>{e.resetAllZooms(),t&&t.classList.remove("visible")},{signal:this._resetClickAbort.signal}))}async _buildRenderer(e){let t=this.parentElement,i=this.getAttribute("slot")??void 0,n=await t.getClient({panel:i}),r=customElements.get("perspective-viewer"),l=r.get_wasm_module(),s=r.get_worker_url(),a=await t?.getTable?.({panel:i}),g=a?await a.get_name():void 0,_=this.shadowRoot.querySelector(".zoom-controls"),x=new E({client:n,view:e,tableName:g,panel:i,clientWorkerURL:s,clientWasm:l,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:y=>{_&&_.classList.toggle("visible",!y)}});return await x.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...ge,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,columnsConfig:this._columnsConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:Q}),x}static setBlitMode(e){Q=e}get_static_config(){return{name:this._chartType.name,category:this._chartType.category,select_mode:this._chartType.selectMode,min_config_columns:this._chartType.initial.count,config_column_names:this._chartType.initial.names,max_cells:this._chartType.max_cells,max_columns:this._chartType.max_columns,group_rollup_modes:["flat"],priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"}}column_config_schema(e,t,i,n,r){let l=[],s=this._chartType.default_chart_type;if(s&&(e==="integer"||e==="float")){l.push({kind:"Enum",key:"chart_type",default:s,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let a=n?.chart_type??s,g=a==="bar"||a==="area";if(g&&l.push({kind:"Bool",key:"stack",default:g}),(s==="bar"||s==="line"||s==="scatter"||s==="area")&&l.push({kind:"Bool",key:"alt_axis",default:!1}),a==="line"||a==="area"){let y=a==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];l.push({kind:"Enum",key:"interpolate",default:"solid",variants:y})}}return e==="integer"||e==="float"?l.push({kind:"NumberFormat"}):(e==="date"||e==="datetime")&&l.push({kind:"DatetimeFormat"}),{fields:l}}plugin_config_schema(e){let t=this._effectiveDefaults();return{fields:this._chartType.applicable_plugin_fields.map(n=>_e(n,t))}}async draw(e){return this._renderer?.resetExpandedDomain(),this._renderer?.resetAllZooms(),this._drawImpl(e)}async update(e){return this._drawImpl(e)}async _drawImpl(e){let t;try{t=await this._ensureRenderer(e)}catch{return}t.setView(e),t.setBufferMaxCapacity(this._chartType.max_cells);let i=this.getAttribute("slot")??void 0,n=this.parentElement;if(n===null)return;let r=await n.getViewConfig({panel:i});await t.loadAndRender({viewerConfig:{group_by:r?.group_by??[],split_by:r?.split_by??[],columns:r?.columns??[]},options:{float32:!0}})}async clear(){this._renderer?.clear()}async resize(){!this.isConnected||this.offsetParent==null||await this._renderer?.resize()}async presize(e,t){if(!this.isConnected||this.offsetParent==null||!this._renderer||!this._glCanvas)return;let i=this.getBoundingClientRect(),n=this._glCanvas.getBoundingClientRect();return await this._renderer.presize(Math.max(0,n.width+(e-i.width)),Math.max(0,n.height+(t-i.height)))}restyle(){this._renderer?.invalidateTheme()}async deselect(){this._renderer?.deselect()}async render(e){return await this._ensureRenderer(e),await this.draw(e),this._renderer.snapshotPng()}restore(e,t){e?.zoom&&this._renderer?.restoreZoom(e.zoom),this._pluginConfig={...this._effectiveDefaults(),...e},this._columnsConfig=t??{},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(this._columnsConfig)}delete(){this._rawEventForwarder&&(this._rawEventForwarder.detach(),this._rawEventForwarder=null),this._resetClickAbort&&(this._resetClickAbort.abort(),this._resetClickAbort=null),this._renderer&&(this._renderer.destroy(),this._renderer=null),this._rendererPromise=null}};function ye(...o){let e=new Set(o.length>0?o:k.map(i=>i.name)),t=[];k.forEach(i=>{if(e.has(i.name)){let n=`perspective-viewer-charts-${i.tag}`;if(customElements.get(n)){t.push(n);return}customElements.define(n,class extends F{_chartType=i;static _chartType=i}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(n)})}}),t.length>0&&console.warn(`viewer-charts plugins already registered (${t.length}); skipping duplicate registration (Perspective was loaded more than once on this page).`)}ye();export{p as PerspectiveSelectDetail,ye as register};
|
|
3
3
|
//# sourceMappingURL=perspective-viewer-charts.js.map
|