blockcharts 0.0.1 → 0.0.2

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.
Files changed (73) hide show
  1. package/README.md +171 -169
  2. package/package.json +1 -1
  3. package/release/blocks/guide.axis.js +2 -2
  4. package/release/blocks/guide.grid.js +2 -2
  5. package/release/blocks/guide.kpi.js +2 -2
  6. package/release/blocks/guide.legend.js +2 -2
  7. package/release/blocks/interaction.animate.js +2 -2
  8. package/release/blocks/interaction.brush.js +2 -2
  9. package/release/blocks/interaction.crosshair.js +2 -2
  10. package/release/blocks/interaction.legend-filter.js +2 -2
  11. package/release/blocks/interaction.tooltip.js +2 -2
  12. package/release/blocks/interaction.zoom-controls.js +2 -2
  13. package/release/blocks/interaction.zoom.js +2 -2
  14. package/release/blocks/lib.columns.js +2 -2
  15. package/release/blocks/lib.curve.js +2 -2
  16. package/release/blocks/lib.pointer.js +2 -2
  17. package/release/blocks/lib.stats.js +2 -2
  18. package/release/blocks/lib.ticks.js +2 -2
  19. package/release/blocks/lib.view.js +2 -2
  20. package/release/blocks/mark.arc.js +2 -2
  21. package/release/blocks/mark.area.js +2 -2
  22. package/release/blocks/mark.boxplot.js +2 -2
  23. package/release/blocks/mark.candlestick.js +2 -2
  24. package/release/blocks/mark.line.js +2 -2
  25. package/release/blocks/mark.point.js +2 -2
  26. package/release/blocks/mark.polygon.js +2 -2
  27. package/release/blocks/mark.rect.js +2 -2
  28. package/release/blocks/mark.rule.js +2 -2
  29. package/release/blocks/mark.sankey.js +2 -2
  30. package/release/blocks/mark.text.js +2 -2
  31. package/release/blocks/mark.violin.js +2 -2
  32. package/release/blocks/renderer.canvas.js +2 -2
  33. package/release/blocks/renderer.svg.js +2 -2
  34. package/release/blocks/scale.band.js +2 -2
  35. package/release/blocks/scale.color.js +2 -2
  36. package/release/blocks/scale.linear.js +2 -2
  37. package/release/blocks/scale.log.js +2 -2
  38. package/release/blocks/scale.sequential.js +2 -2
  39. package/release/blocks/scale.size.js +2 -2
  40. package/release/blocks/scale.time.js +2 -2
  41. package/release/blocks/transform.aggregate.js +2 -2
  42. package/release/blocks/transform.bin.js +2 -2
  43. package/release/blocks/transform.calculate.js +2 -2
  44. package/release/blocks/transform.calendar.js +2 -2
  45. package/release/blocks/transform.contour.js +2 -2
  46. package/release/blocks/transform.decimate.js +2 -2
  47. package/release/blocks/transform.density.js +2 -2
  48. package/release/blocks/transform.filter.js +2 -2
  49. package/release/blocks/transform.fold.js +2 -2
  50. package/release/blocks/transform.funnel.js +2 -2
  51. package/release/blocks/transform.hexbin.js +2 -2
  52. package/release/blocks/transform.highlight.js +2 -2
  53. package/release/blocks/transform.marimekko.js +2 -2
  54. package/release/blocks/transform.quartiles.js +2 -2
  55. package/release/blocks/transform.sankey.js +2 -2
  56. package/release/blocks/transform.sort.js +2 -2
  57. package/release/blocks/transform.stack.js +2 -2
  58. package/release/blocks/transform.treemap.js +2 -2
  59. package/release/blocks/transform.waterfall.js +2 -2
  60. package/release/blocks/transform.window.js +2 -2
  61. package/release/core.js +3 -3
  62. package/release/kits/basic.js +22 -22
  63. package/release/kits/basic.mjs +22 -22
  64. package/release/kits/composition.js +36 -36
  65. package/release/kits/composition.mjs +36 -36
  66. package/release/kits/dashboard.js +34 -34
  67. package/release/kits/dashboard.mjs +34 -34
  68. package/release/kits/full.js +61 -61
  69. package/release/kits/full.mjs +61 -61
  70. package/release/kits/timeseries.js +32 -32
  71. package/release/kits/timeseries.mjs +32 -32
  72. package/release/loader.js +2 -2
  73. package/release/manifest.json +212 -212
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const M="var(--bc-text, #444)",z=t=>t.output==="color"&&t.input==="category";function j(t,e){const n=t.scale?e.scales[t.scale]:void 0;if(!n||!(n.output==="color"||n.output==="size"&&n.input==="number"))throw new Error("guide.legend needs a scale of colors, or of sizes for numbers");return n}function G(t,e,n){return x(t,e,3).filter(o=>isFinite(o.pos)&&o.pos>0).map(o=>({label:o.label,r:o.pos,w:E(o.label,n),drawn:n.textWidth(o.label,11)}))}const $="var(--bc-label, var(--bc-text, #888))",N=t=>2*t.r+6+t.w,tt=t=>2*t.r+6+t.drawn,p=(t,e)=>{const n=Y(t,e);return Math.max(1,t.size.w-Math.max(8,n.left)-Math.max(8,n.right))},Y=(t,e)=>e==="top"||e==="bottom"?t.edgeTaken(e):{left:0,right:0},W=(t,e,n,s)=>{const o=Y(t,e);return Math.max(Math.max(8,o.left),Math.min(n,t.size.w-Math.max(8,o.right)-s))};function q(t,e){const n=[];let s=0;for(const o of t){const r=n[n.length-1];!r||r.items.length&&s+O+N(o)>e?(n.push({items:[o],h:Math.max(2*o.r,16)+4}),s=N(o)):(r.items.push(o),r.h=Math.max(r.h,Math.max(2*o.r,16)+4),s+=O+N(o))}return n}const E=(t,e)=>Math.max(e.measure(t,11).w,e.textWidth(t,11));function F(t,e,n=1/0){const s=new Set(t.domain()),o=t.range();return t.baseDomain().map((r,i)=>{const l=String(r),h=K(l,n-10-6,e);return{label:h,full:l,color:o[i],w:E(h,e),drawn:e.textWidth(h,11),hidden:!s.has(r),index:i}})}function K(t,e,n){if(!(e<1/0)||E(t,n)<=e)return t;const s=Array.from(t);let o=0,r=s.length;for(;o<r;){const i=o+r+1>>1;E(s.slice(0,i).join("")+"\u2026",n)<=e?o=i:r=i-1}return s.slice(0,o).join("").trimEnd()+"\u2026"}function x(t,e,n=4){const s=t.ticks?t.ticks(n):[];if(e.format===void 0)return s;const o=BC.formatter(e.format,"number");return s.map(r=>({value:r.value,pos:r.pos,label:o(r.value)}))}const R=t=>typeof t.title=="string"&&t.title?t.title:"",H=t=>R(t)?16:0,et=(t,e)=>R(t)?e.measure(R(t),11).w:0,nt=.2;function ot(t,e){if(!z(t))return"right";const n=p(e,"top");return I(F(t,e,n),n).length<=2?"top":"right"}function k(t,e,n){const s=et(t,n),o=H(t);if(e.output==="size"){const i=G(e,t,n),l=i.reduce((h,b)=>Math.max(h,b.r),0);return{w:Math.max(2*l+6+i.reduce((h,b)=>Math.max(h,b.w),0),s)+16,h:4+o+i.reduce((h,b)=>h+Math.max(2*b.r,16)+4,0)}}if(!z(e)){const i=x(e,t).reduce((l,h)=>Math.max(l,n.measure(h.label,11).w),0);return{w:Math.max(18+i,s)+16,h:0}}const r=F(e,n);return{w:Math.max(16+r.reduce((i,l)=>Math.max(i,l.w),0),s)+16,h:4+o+r.length*16+4}}function U(t,e,n){const s=t.position==="auto"?ot(e,n):t.position||"right";if(!B(s))return s;const o=k(t,e,n);return o.w<=n.size.w*nt&&o.h<=n.size.h?s:"top"}const B=t=>t==="left"||t==="right",X=(t,e,n)=>Math.max(e,Math.min(n,t)),O=14,Z=t=>16+t.w,st=t=>16+t.drawn;function I(t,e){const n=[];let s=[],o=0;for(const r of t){const i=Z(r);s.length&&o+O+i>e&&(n.push(s),s=[],o=0),o+=(s.length?O:0)+i,s.push(r)}return s.length&&n.push(s),n}function it(t,e){return t?X(e.plot.h*.6,80,200):X(e.plot.w*.4,100,240)}const rt={role:"guide",type:"legend",version:16,shownOnce:!0,params:{scale:{kind:"scale",required:!0},position:{kind:"enum",values:["top","right","bottom","left","auto"],default:"right"},title:{kind:"string"},format:{kind:"format"}},measure(t,e){const n=j(t,e),s=U(t,n,e),o=B(s),r=H(t),i={};if(n.output==="size"){const b=G(n,t,e);return i[s]=b.length?o?k(t,n,e).w:q(b,p(e,s)).reduce((T,w)=>T+w.h,0)+8+r:0,i}if(!z(n))return i[s]=o?k(t,n,e).w:12+e.measure("0",11).h+16+r,i;const l=p(e,s),h=F(n,e,o?1/0:l);return i[s]=h.length?o?k(t,n,e).w:I(h,l).length*16+8+r:0,i},render(t,e,n){const s=j(t,e),o=U(t,s,e),r=B(o),{x:i,y:l,w:h,h:b}=e.plot,T=[],w=H(t),v=r?R(t):K(R(t),p(e,o),e),y=v?e.measure(v,11).w:0,S=(u,d)=>{w&&T.push({type:"text",x:u,y:d+16/2,text:v,size:11,weight:600,baseline:"middle",style:{fill:M},cls:"bc-legend-title"})};if(s.output==="size"){const u=G(s,t,e),d=u.reduce((m,f)=>Math.max(m,f.r),0),a=(m,f,A,c)=>{T.push({type:"circle",cx:m,cy:f,r:A.r,style:{fill:"none",stroke:$,strokeWidth:1},cls:"bc-legend-size"}),T.push({type:"text",x:c,y:f,text:A.label,size:11,baseline:"middle",style:{fill:M}})};if(r){const m=Math.max(2*d+6+u.reduce((c,g)=>Math.max(c,g.w),0),y)+16,f=(o==="right"?i+h+n.right:i-n.left-m)+8;S(f,l+4);let A=l+4+w;for(const c of u){const g=Math.max(2*c.r,16)+4;a(f+d,A+g/2,c,f+2*d+6),A+=g}}else{const m=q(u,p(e,o));let f=o==="top"?l-n.top-(m.reduce((A,c)=>A+c.h,0)+8+w):l+b+n.bottom+8/2;S(W(e,o,i,y),f),f+=w;for(const A of m){let c=W(e,o,i,A.items.reduce((g,D,C)=>g+(C?O:0)+N(D),0));for(const g of A.items)a(c+g.r,f+A.h/2,g,c+2*g.r+6),c+=tt(g)+O;f+=A.h}}return{axes:T}}if(!z(s)){const[u,d]=s.domain(),a=it(r,e),m=x(s,t),f=m.reduce((P,L)=>Math.max(P,e.measure(L.label,11).w),0),A=Math.max(18+f,y)+16,c=o==="right"?i+h+n.right+8:i-n.left-A+8,g=o==="top"?l-n.top-(12+e.measure("0",11).h+16+w)+8:l+b+n.bottom+8,D=g+w,C=l+4+w+(w?11/2:0);r?S(c,l+4):S(W(e,o,i,y),g);const Q=a/48*1.05;for(let P=0;P<48;P++){const L=r?d-(P+.5)/48*(d-u):u+(P+.5)/48*(d-u),V=s(L);T.push(r?{type:"rect",x:c,y:C+P*a/48,w:12,h:Q,style:{fill:V},cls:"bc-legend-bar"}:{type:"rect",x:i+P*a/48,y:D,w:Q,h:12,style:{fill:V},cls:"bc-legend-bar"})}for(const P of m)T.push(r?{type:"text",x:c+12+6,y:C+(1-P.pos)*a,text:P.label,size:11,baseline:"middle",style:{fill:M}}:{type:"text",x:i+P.pos*a,y:D+12+3,text:P.label,size:11,anchor:"middle",baseline:"hanging",style:{fill:M}});return{axes:T}}const _=F(s,e,r?1/0:p(e,o)),lt=e.toggled(String(t.scale)),J=(u,d,a)=>{T.push({type:"g",cls:"bc-legend-item",data:{"bc-legend-scale":String(t.scale),"bc-legend-index":String(a.index)},pressed:lt?!a.hidden:void 0,style:a.hidden?{opacity:.4}:void 0,title:a.label!==a.full?a.full:void 0,children:[{type:"rect",x:u,y:d+6/2,w:10,h:10,r:10/2,style:{fill:a.color},cls:"bc-legend-swatch"},{type:"text",x:u+10+6,y:d+16/2,text:a.label,size:11,baseline:"middle",style:{fill:M}}]})};if(r){const u=Math.max(16+_.reduce((a,m)=>Math.max(a,m.w),0),y)+16,d=o==="right"?i+h+n.right:i-n.left-u;S(d+8,l+4),_.forEach((a,m)=>J(d+8,l+4+w+m*16,a))}else{const u=I(_,p(e,o)),d=o==="top"?l-n.top-(u.length*16+8+w):l+b+n.bottom+8/2,a=d+w;S(W(e,o,i,y),d),u.forEach((m,f)=>{let A=W(e,o,i,m.reduce((c,g,D)=>c+(D?O:0)+Z(g),0));for(const c of m)J(A,a+f*16,c),A+=st(c)+O})}return{axes:T}}};BC.define(rt)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(j){const M="var(--bc-text, #444)",z=t=>t.output==="color"&&t.input==="category";function Y(t,e){const n=t.scale?e.scales[t.scale]:void 0;if(!n||!(n.output==="color"||n.output==="size"&&n.input==="number"))throw new Error("guide.legend needs a scale of colors, or of sizes for numbers");return n}function x(t,e,n){return C(t,e,3).filter(o=>isFinite(o.pos)&&o.pos>0).map(o=>({label:o.label,r:o.pos,w:E(o.label,n),drawn:n.textWidth(o.label,11)}))}const tt="var(--bc-label, var(--bc-text, #888))",N=t=>2*t.r+6+t.w,et=t=>2*t.r+6+t.drawn,p=(t,e)=>{const n=q(t,e);return Math.max(1,t.size.w-Math.max(8,n.left)-Math.max(8,n.right))},q=(t,e)=>e==="top"||e==="bottom"?t.edgeTaken(e):{left:0,right:0},W=(t,e,n,s)=>{const o=q(t,e);return Math.max(Math.max(8,o.left),Math.min(n,t.size.w-Math.max(8,o.right)-s))};function K(t,e){const n=[];let s=0;for(const o of t){const r=n[n.length-1];!r||r.items.length&&s+O+N(o)>e?(n.push({items:[o],h:Math.max(2*o.r,16)+4}),s=N(o)):(r.items.push(o),r.h=Math.max(r.h,Math.max(2*o.r,16)+4),s+=O+N(o))}return n}const E=(t,e)=>Math.max(e.measure(t,11).w,e.textWidth(t,11));function F(t,e,n=1/0){const s=new Set(t.domain()),o=t.range();return t.baseDomain().map((r,i)=>{const l=String(r),h=U(l,n-10-6,e);return{label:h,full:l,color:o[i],w:E(h,e),drawn:e.textWidth(h,11),hidden:!s.has(r),index:i}})}function U(t,e,n){if(!(e<1/0)||E(t,n)<=e)return t;const s=Array.from(t);let o=0,r=s.length;for(;o<r;){const i=o+r+1>>1;E(s.slice(0,i).join("")+"\u2026",n)<=e?o=i:r=i-1}return s.slice(0,o).join("").trimEnd()+"\u2026"}function C(t,e,n=4){const s=t.ticks?t.ticks(n):[];if(e.format===void 0)return s;const o=j.formatter(e.format,"number");return s.map(r=>({value:r.value,pos:r.pos,label:o(r.value)}))}const R=t=>typeof t.title=="string"&&t.title?t.title:"",H=t=>R(t)?16:0,nt=(t,e)=>R(t)?e.measure(R(t),11).w:0,ot=.2;function st(t,e){if(!z(t))return"right";const n=p(e,"top");return I(F(t,e,n),n).length<=2?"top":"right"}function k(t,e,n){const s=nt(t,n),o=H(t);if(e.output==="size"){const i=x(e,t,n),l=i.reduce((h,b)=>Math.max(h,b.r),0);return{w:Math.max(2*l+6+i.reduce((h,b)=>Math.max(h,b.w),0),s)+16,h:4+o+i.reduce((h,b)=>h+Math.max(2*b.r,16)+4,0)}}if(!z(e)){const i=C(e,t).reduce((l,h)=>Math.max(l,n.measure(h.label,11).w),0);return{w:Math.max(18+i,s)+16,h:0}}const r=F(e,n);return{w:Math.max(16+r.reduce((i,l)=>Math.max(i,l.w),0),s)+16,h:4+o+r.length*16+4}}function X(t,e,n){const s=t.position==="auto"?st(e,n):t.position||"right";if(!B(s))return s;const o=k(t,e,n);return o.w<=n.size.w*ot&&o.h<=n.size.h?s:"top"}const B=t=>t==="left"||t==="right",Z=(t,e,n)=>Math.max(e,Math.min(n,t)),O=14,J=t=>16+t.w,it=t=>16+t.drawn;function I(t,e){const n=[];let s=[],o=0;for(const r of t){const i=J(r);s.length&&o+O+i>e&&(n.push(s),s=[],o=0),o+=(s.length?O:0)+i,s.push(r)}return s.length&&n.push(s),n}function rt(t,e){return t?Z(e.plot.h*.6,80,200):Z(e.plot.w*.4,100,240)}const lt={role:"guide",type:"legend",version:16,shownOnce:!0,params:{scale:{kind:"scale",required:!0},position:{kind:"enum",values:["top","right","bottom","left","auto"],default:"right"},title:{kind:"string"},format:{kind:"format"}},measure(t,e){const n=Y(t,e),s=X(t,n,e),o=B(s),r=H(t),i={};if(n.output==="size"){const b=x(n,t,e);return i[s]=b.length?o?k(t,n,e).w:K(b,p(e,s)).reduce((T,w)=>T+w.h,0)+8+r:0,i}if(!z(n))return i[s]=o?k(t,n,e).w:12+e.measure("0",11).h+16+r,i;const l=p(e,s),h=F(n,e,o?1/0:l);return i[s]=h.length?o?k(t,n,e).w:I(h,l).length*16+8+r:0,i},render(t,e,n){const s=Y(t,e),o=X(t,s,e),r=B(o),{x:i,y:l,w:h,h:b}=e.plot,T=[],w=H(t),v=r?R(t):U(R(t),p(e,o),e),y=v?e.measure(v,11).w:0,S=(u,d)=>{w&&T.push({type:"text",x:u,y:d+16/2,text:v,size:11,weight:600,baseline:"middle",style:{fill:M},cls:"bc-legend-title"})};if(s.output==="size"){const u=x(s,t,e),d=u.reduce((m,f)=>Math.max(m,f.r),0),a=(m,f,A,c)=>{T.push({type:"circle",cx:m,cy:f,r:A.r,style:{fill:"none",stroke:tt,strokeWidth:1},cls:"bc-legend-size"}),T.push({type:"text",x:c,y:f,text:A.label,size:11,baseline:"middle",style:{fill:M}})};if(r){const m=Math.max(2*d+6+u.reduce((c,g)=>Math.max(c,g.w),0),y)+16,f=(o==="right"?i+h+n.right:i-n.left-m)+8;S(f,l+4);let A=l+4+w;for(const c of u){const g=Math.max(2*c.r,16)+4;a(f+d,A+g/2,c,f+2*d+6),A+=g}}else{const m=K(u,p(e,o));let f=o==="top"?l-n.top-(m.reduce((A,c)=>A+c.h,0)+8+w):l+b+n.bottom+8/2;S(W(e,o,i,y),f),f+=w;for(const A of m){let c=W(e,o,i,A.items.reduce((g,D,G)=>g+(G?O:0)+N(D),0));for(const g of A.items)a(c+g.r,f+A.h/2,g,c+2*g.r+6),c+=et(g)+O;f+=A.h}}return{axes:T}}if(!z(s)){const[u,d]=s.domain(),a=rt(r,e),m=C(s,t),f=m.reduce((P,L)=>Math.max(P,e.measure(L.label,11).w),0),A=Math.max(18+f,y)+16,c=o==="right"?i+h+n.right+8:i-n.left-A+8,g=o==="top"?l-n.top-(12+e.measure("0",11).h+16+w)+8:l+b+n.bottom+8,D=g+w,G=l+4+w+(w?11/2:0);r?S(c,l+4):S(W(e,o,i,y),g);const V=a/48*1.05;for(let P=0;P<48;P++){const L=r?d-(P+.5)/48*(d-u):u+(P+.5)/48*(d-u),$=s(L);T.push(r?{type:"rect",x:c,y:G+P*a/48,w:12,h:V,style:{fill:$},cls:"bc-legend-bar"}:{type:"rect",x:i+P*a/48,y:D,w:V,h:12,style:{fill:$},cls:"bc-legend-bar"})}for(const P of m)T.push(r?{type:"text",x:c+12+6,y:G+(1-P.pos)*a,text:P.label,size:11,baseline:"middle",style:{fill:M}}:{type:"text",x:i+P.pos*a,y:D+12+3,text:P.label,size:11,anchor:"middle",baseline:"hanging",style:{fill:M}});return{axes:T}}const _=F(s,e,r?1/0:p(e,o)),at=e.toggled(String(t.scale)),Q=(u,d,a)=>{T.push({type:"g",cls:"bc-legend-item",data:{"bc-legend-scale":String(t.scale),"bc-legend-index":String(a.index)},pressed:at?!a.hidden:void 0,style:a.hidden?{opacity:.4}:void 0,title:a.label!==a.full?a.full:void 0,children:[{type:"rect",x:u,y:d+6/2,w:10,h:10,r:10/2,style:{fill:a.color},cls:"bc-legend-swatch"},{type:"text",x:u+10+6,y:d+16/2,text:a.label,size:11,baseline:"middle",style:{fill:M}}]})};if(r){const u=Math.max(16+_.reduce((a,m)=>Math.max(a,m.w),0),y)+16,d=o==="right"?i+h+n.right:i-n.left-u;S(d+8,l+4),_.forEach((a,m)=>Q(d+8,l+4+w+m*16,a))}else{const u=I(_,p(e,o)),d=o==="top"?l-n.top-(u.length*16+8+w):l+b+n.bottom+8/2,a=d+w;S(W(e,o,i,y),d),u.forEach((m,f)=>{let A=W(e,o,i,m.reduce((c,g,D)=>c+(D?O:0)+J(g),0));for(const c of m)Q(A,a+f*16,c),A+=it(c)+O})}return{axes:T}}};j.define(lt)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const d=typeof WeakMap=="function"?new WeakMap:null,l=()=>typeof performance=="object"&&performance&&typeof performance.now=="function"?performance.now():Date.now();function m(t){const e=BC.get(`mark.${t.type}`);return e&&e.enter}function x(t){const e=t.marks.map(m);return e.indexOf("pop")>=0?"pop":e.indexOf("grow")>=0&&e.indexOf("wipe")<0?"grow":e.indexOf("wipe")>=0?"wipe":"fade"}function b(t){const e=t.spec.marks.find(r=>m(r)==="grow");let a=!1;if(e)try{const r=t.channel(e,"y");a=!!(r.scale&&r.scale.bandwidth!==void 0)}catch{a=!1}const n=t.plot,i=a?t.scales.x:t.scales.y,o=i&&i.input==="number"?i(0):NaN;return a?{horizontal:a,at:isFinite(o)&&o>=n.x&&o<=n.x+n.w?o:n.x}:{horizontal:a,at:isFinite(o)&&o>=n.y&&o<=n.y+n.h?o:n.y+n.h}}const g={role:"interaction",type:"animate",version:4,params:{effect:{kind:"enum",values:["auto","grow","wipe","pop","fade"],default:"auto"},duration:{kind:"number",default:700},delay:{kind:"number",default:0}},attach(t,e){const a=e.root;let n=0;const i=d?d.get(e.host):void 0;i!==void 0?n=Math.max(0,l()-i):d&&d.set(e.host,l());const o=e.host.ownerDocument&&e.host.ownerDocument.defaultView||(typeof window<"u"?window:void 0);if(o&&typeof o.matchMedia=="function"&&o.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r=typeof t.duration=="number"&&t.duration>=0?Math.min(1e4,t.duration):700,y=typeof t.delay=="number"&&t.delay>=0?Math.min(1e4,t.delay):0,k={duration:r,delay:y,easing:"cubic-bezier(.2,.7,.2,1)",fill:"backwards"};if(i!==void 0&&n>=y+r)return;const p=t.effect==="grow"||t.effect==="wipe"||t.effect==="pop"||t.effect==="fade"?t.effect:x(e.spec),s=typeof a.querySelector=="function"?a.querySelector('[data-bc-layer="marks"]'):null,w=s||a;if(typeof w.animate!="function")return;const f=e.plot;let u;if(!s||p==="fade")u=[{opacity:0},{opacity:1}];else if(p==="wipe"){const c=e.size.w-(f.x+f.w);u=[{clipPath:`inset(0 ${e.size.w-f.x}px 0 0)`},{clipPath:`inset(0 ${Math.max(0,c-4)}px 0 0)`,offset:.999},{clipPath:"none"}]}else if(p==="pop")s.style.transformBox="view-box",s.style.transformOrigin=`${f.x+f.w/2}px ${f.y+f.h/2}px`,u=[{transform:"scale(0.6) rotate(-30deg)",opacity:0},{transform:"none",opacity:1}];else{const c=b(e);s.style.transformBox="view-box",s.style.transformOrigin=c.horizontal?`${c.at}px 0px`:`0px ${c.at}px`,u=[{transform:c.horizontal?"scaleX(0)":"scaleY(0)"},{transform:"none"}]}const h=w.animate(u,k);n>0&&(h.currentTime=n),e.cleanup(()=>{try{h.cancel()}catch{}})}};BC.define(g)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(l){const d=typeof WeakMap=="function"?new WeakMap:null,m=()=>typeof performance=="object"&&performance&&typeof performance.now=="function"?performance.now():Date.now();function y(t){const e=l.get(`mark.${t.type}`);return e&&e.enter}function b(t){const e=t.marks.map(y);return e.indexOf("pop")>=0?"pop":e.indexOf("grow")>=0&&e.indexOf("wipe")<0?"grow":e.indexOf("wipe")>=0?"wipe":"fade"}function g(t){const e=t.spec.marks.find(r=>y(r)==="grow");let a=!1;if(e)try{const r=t.channel(e,"y");a=!!(r.scale&&r.scale.bandwidth!==void 0)}catch{a=!1}const n=t.plot,i=a?t.scales.x:t.scales.y,o=i&&i.input==="number"?i(0):NaN;return a?{horizontal:a,at:isFinite(o)&&o>=n.x&&o<=n.x+n.w?o:n.x}:{horizontal:a,at:isFinite(o)&&o>=n.y&&o<=n.y+n.h?o:n.y+n.h}}const k={role:"interaction",type:"animate",version:4,params:{effect:{kind:"enum",values:["auto","grow","wipe","pop","fade"],default:"auto"},duration:{kind:"number",default:700},delay:{kind:"number",default:0}},attach(t,e){const a=e.root;let n=0;const i=d?d.get(e.host):void 0;i!==void 0?n=Math.max(0,m()-i):d&&d.set(e.host,m());const o=e.host.ownerDocument&&e.host.ownerDocument.defaultView||(typeof window<"u"?window:void 0);if(o&&typeof o.matchMedia=="function"&&o.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r=typeof t.duration=="number"&&t.duration>=0?Math.min(1e4,t.duration):700,w=typeof t.delay=="number"&&t.delay>=0?Math.min(1e4,t.delay):0,M={duration:r,delay:w,easing:"cubic-bezier(.2,.7,.2,1)",fill:"backwards"};if(i!==void 0&&n>=w+r)return;const p=t.effect==="grow"||t.effect==="wipe"||t.effect==="pop"||t.effect==="fade"?t.effect:b(e.spec),s=typeof a.querySelector=="function"?a.querySelector('[data-bc-layer="marks"]'):null,h=s||a;if(typeof h.animate!="function")return;const f=e.plot;let u;if(!s||p==="fade")u=[{opacity:0},{opacity:1}];else if(p==="wipe"){const c=e.size.w-(f.x+f.w);u=[{clipPath:`inset(0 ${e.size.w-f.x}px 0 0)`},{clipPath:`inset(0 ${Math.max(0,c-4)}px 0 0)`,offset:.999},{clipPath:"none"}]}else if(p==="pop")s.style.transformBox="view-box",s.style.transformOrigin=`${f.x+f.w/2}px ${f.y+f.h/2}px`,u=[{transform:"scale(0.6) rotate(-30deg)",opacity:0},{transform:"none",opacity:1}];else{const c=g(e);s.style.transformBox="view-box",s.style.transformOrigin=c.horizontal?`${c.at}px 0px`:`0px ${c.at}px`,u=[{transform:c.horizontal?"scaleX(0)":"scaleY(0)"},{transform:"none"}]}const x=h.animate(u,M);n>0&&(x.currentTime=n),e.cleanup(()=>{try{x.cancel()}catch{}})}};l.define(k)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const k=()=>BC.get("lib.pointer").exports,R="bc-brush",j={role:"interaction",type:"brush",version:5,requires:["lib.pointer"],params:{scales:{kind:"list",default:["x"]},modifier:{kind:"enum",values:["shift","alt","ctrl","none"],default:"shift"},fit:{kind:"list"},minSize:{kind:"number",default:6}},attach(s,e){const a=(Array.isArray(s.scales)?s.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const n=e.scales[t],o=!!n&&e.orientation(t)!==null&&(!!n.invert||n.bandwidth!==void 0);return o||console.warn(`[blockcharts] interaction.brush: scale "${t}" is not a positional scale that can be selected on, ignored`),o});if(!a.length)return;const E=(Array.isArray(s.fit)?s.fit:[]).filter(t=>{const n=typeof t=="string"&&!!e.scales[t]&&a.indexOf(t)<0;return!n&&typeof t=="string"&&console.warn(`[blockcharts] interaction.brush: cannot fit scale "${t}"`),n}),h=s.modifier==="alt"||s.modifier==="ctrl"||s.modifier==="none"?s.modifier:"shift",L=typeof s.minSize=="number"&&s.minSize>=0?s.minSize:6,r=e.root,y=e.host,p=y.ownerDocument||document,g=a.some(t=>e.orientation(t)==="horizontal"),w=a.some(t=>e.orientation(t)==="vertical");let u=null;const m=t=>k().toLogical(e,t),z=t=>k().inPlot(e,t),M=t=>{const n=e.plot;return{x:Math.max(n.x,Math.min(n.x+n.w,t.x)),y:Math.max(n.y,Math.min(n.y+n.h,t.y))}},C=t=>h==="none"||(h==="shift"?t.shiftKey:h==="alt"?t.altKey:t.ctrlKey||t.metaKey);e.claimDrag(C);let i=null;const S=t=>{const n=e.plot;return{x0:g?Math.min(t.x0,t.x1):n.x,x1:g?Math.max(t.x0,t.x1):n.x+n.w,y0:w?Math.min(t.y0,t.y1):n.y,y1:w?Math.max(t.y0,t.y1):n.y+n.h}},v=()=>{if(!i)return;const t=S(i),n=r.getBoundingClientRect(),o=y.getBoundingClientRect(),c=n.width/e.size.w;Object.assign(i.box.style,{left:n.left-o.left+t.x0*c+"px",top:n.top-o.top+t.y0*c+"px",width:(t.x1-t.x0)*c+"px",height:(t.y1-t.y0)*c+"px"})},x=()=>{i&&(i.box.parentNode&&i.box.parentNode.removeChild(i.box),i=null,p.removeEventListener("keydown",A),u&&(u(),u=null))},I=t=>{if(!(g&&t.x1-t.x0<L)&&!(w&&t.y1-t.y0<L)){for(const n of a){const o=e.scales[n],c=e.orientation(n)==="horizontal"?t.x0:t.y0,N=e.orientation(n)==="horizontal"?t.x1:t.y1;if(o.invert){const b=Number(o.invert(c)),f=Number(o.invert(N)),d=Math.min(b,f),l=Math.max(b,f),[O,q]=o.baseDomain(),$=q<O?[l,d]:[d,l];e.setView(n,l-d>=Math.abs(q-O)*(1-1e-9)?null:$)}else{const b=o.bandwidth,f=o.domain().filter(d=>{const l=o(d);return isFinite(l)&&l+b>=c&&l<=N});if(!f.length)continue;e.setView(n,f.length===o.baseDomain().length?null:f)}}for(const n of E)e.setView(n,e.fit(n,a[0]))}},A=t=>{t.key==="Escape"&&x()},D=t=>{if(t.button!==0||!C(t))return;const n=m(t);if(!z(n))return;const o=p.createElement("div");o.setAttribute("class",R),Object.assign(o.style,{position:"absolute",pointerEvents:"none",boxSizing:"border-box",zIndex:"5",background:"var(--bc-brush-fill, rgba(78,121,167,.22))",border:"1px solid var(--bc-brush-line, rgba(78,121,167,.9))"}),u=e.claimPosition(),y.appendChild(o),i={x0:n.x,y0:n.y,x1:n.x,y1:n.y,box:o},r.setPointerCapture&&r.setPointerCapture(t.pointerId),p.addEventListener("keydown",A),v(),t.preventDefault()},P=t=>{if(!i)return;const n=M(m(t));i.x1=n.x,i.y1=n.y,v()},V=t=>{if(!i)return;const n=M(m(t));i.x1=n.x,i.y1=n.y;const o=S(i);x(),I(o)},B=()=>x(),K=t=>{if(z(m(t))){for(const n of a)e.setView(n,null);for(const n of E)e.setView(n,e.fit(n,a[0]))}};r.addEventListener("pointerdown",D),r.addEventListener("pointermove",P),r.addEventListener("pointerup",V),r.addEventListener("pointercancel",B),r.addEventListener("dblclick",K),e.cleanup(()=>{x(),r.removeEventListener("pointerdown",D),r.removeEventListener("pointermove",P),r.removeEventListener("pointerup",V),r.removeEventListener("pointercancel",B),r.removeEventListener("dblclick",K)})}};BC.define(j)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(k){const E=()=>k.get("lib.pointer").exports,j="bc-brush",I={role:"interaction",type:"brush",version:5,requires:["lib.pointer"],params:{scales:{kind:"list",default:["x"]},modifier:{kind:"enum",values:["shift","alt","ctrl","none"],default:"shift"},fit:{kind:"list"},minSize:{kind:"number",default:6}},attach(s,e){const a=(Array.isArray(s.scales)?s.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const n=e.scales[t],o=!!n&&e.orientation(t)!==null&&(!!n.invert||n.bandwidth!==void 0);return o||console.warn(`[blockcharts] interaction.brush: scale "${t}" is not a positional scale that can be selected on, ignored`),o});if(!a.length)return;const L=(Array.isArray(s.fit)?s.fit:[]).filter(t=>{const n=typeof t=="string"&&!!e.scales[t]&&a.indexOf(t)<0;return!n&&typeof t=="string"&&console.warn(`[blockcharts] interaction.brush: cannot fit scale "${t}"`),n}),h=s.modifier==="alt"||s.modifier==="ctrl"||s.modifier==="none"?s.modifier:"shift",z=typeof s.minSize=="number"&&s.minSize>=0?s.minSize:6,r=e.root,y=e.host,p=y.ownerDocument||document,g=a.some(t=>e.orientation(t)==="horizontal"),w=a.some(t=>e.orientation(t)==="vertical");let u=null;const m=t=>E().toLogical(e,t),M=t=>E().inPlot(e,t),C=t=>{const n=e.plot;return{x:Math.max(n.x,Math.min(n.x+n.w,t.x)),y:Math.max(n.y,Math.min(n.y+n.h,t.y))}},S=t=>h==="none"||(h==="shift"?t.shiftKey:h==="alt"?t.altKey:t.ctrlKey||t.metaKey);e.claimDrag(S);let i=null;const v=t=>{const n=e.plot;return{x0:g?Math.min(t.x0,t.x1):n.x,x1:g?Math.max(t.x0,t.x1):n.x+n.w,y0:w?Math.min(t.y0,t.y1):n.y,y1:w?Math.max(t.y0,t.y1):n.y+n.h}},A=()=>{if(!i)return;const t=v(i),n=r.getBoundingClientRect(),o=y.getBoundingClientRect(),c=n.width/e.size.w;Object.assign(i.box.style,{left:n.left-o.left+t.x0*c+"px",top:n.top-o.top+t.y0*c+"px",width:(t.x1-t.x0)*c+"px",height:(t.y1-t.y0)*c+"px"})},b=()=>{i&&(i.box.parentNode&&i.box.parentNode.removeChild(i.box),i=null,p.removeEventListener("keydown",D),u&&(u(),u=null))},T=t=>{if(!(g&&t.x1-t.x0<z)&&!(w&&t.y1-t.y0<z)){for(const n of a){const o=e.scales[n],c=e.orientation(n)==="horizontal"?t.x0:t.y0,q=e.orientation(n)==="horizontal"?t.x1:t.y1;if(o.invert){const x=Number(o.invert(c)),f=Number(o.invert(q)),d=Math.min(x,f),l=Math.max(x,f),[B,R]=o.baseDomain(),$=R<B?[l,d]:[d,l];e.setView(n,l-d>=Math.abs(R-B)*(1-1e-9)?null:$)}else{const x=o.bandwidth,f=o.domain().filter(d=>{const l=o(d);return isFinite(l)&&l+x>=c&&l<=q});if(!f.length)continue;e.setView(n,f.length===o.baseDomain().length?null:f)}}for(const n of L)e.setView(n,e.fit(n,a[0]))}},D=t=>{t.key==="Escape"&&b()},P=t=>{if(t.button!==0||!S(t))return;const n=m(t);if(!M(n))return;const o=p.createElement("div");o.setAttribute("class",j),Object.assign(o.style,{position:"absolute",pointerEvents:"none",boxSizing:"border-box",zIndex:"5",background:"var(--bc-brush-fill, rgba(78,121,167,.22))",border:"1px solid var(--bc-brush-line, rgba(78,121,167,.9))"}),u=e.claimPosition(),y.appendChild(o),i={x0:n.x,y0:n.y,x1:n.x,y1:n.y,box:o},r.setPointerCapture&&r.setPointerCapture(t.pointerId),p.addEventListener("keydown",D),A(),t.preventDefault()},V=t=>{if(!i)return;const n=C(m(t));i.x1=n.x,i.y1=n.y,A()},K=t=>{if(!i)return;const n=C(m(t));i.x1=n.x,i.y1=n.y;const o=v(i);b(),T(o)},N=()=>b(),O=t=>{if(M(m(t))){for(const n of a)e.setView(n,null);for(const n of L)e.setView(n,e.fit(n,a[0]))}};r.addEventListener("pointerdown",P),r.addEventListener("pointermove",V),r.addEventListener("pointerup",K),r.addEventListener("pointercancel",N),r.addEventListener("dblclick",O),e.cleanup(()=>{b(),r.removeEventListener("pointerdown",P),r.removeEventListener("pointermove",V),r.removeEventListener("pointerup",K),r.removeEventListener("pointercancel",N),r.removeEventListener("dblclick",O)})}};k.define(I)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const y=()=>BC.get("lib.pointer").exports,C=(r,t,f,x)=>BC.get("lib.pointer").exports.follow(r,t,f,x);function B(r){const t=BC.get(`mark.${r.type}`);return!!(t&&t.series)}const j={role:"interaction",type:"crosshair",version:6,requires:["lib.pointer"],alongX:!0,params:{snap:{kind:"enum",values:["lines","all","off"],default:"lines"},horizontal:{kind:"boolean",default:!1}},attach(r,t){const f=t.host,x=t.root,z=f.ownerDocument||document,E=t.claimPosition(),g=r.snap==="all"||r.snap==="off"?r.snap:"lines",m=(e,s)=>{const n=z.createElement("div");return n.setAttribute("class",e),Object.assign(n.style,s?{position:"absolute",display:"none",pointerEvents:"none",width:"0",marginLeft:"-0.5px",borderLeft:"1px dashed var(--bc-crosshair, var(--bc-axis, #999))"}:{position:"absolute",display:"none",pointerEvents:"none",height:"0",marginTop:"-0.5px",borderTop:"1px dashed var(--bc-crosshair, var(--bc-axis, #999))"}),f.appendChild(n),n},b=m("bc-crosshair",!0),d=r.horizontal===!0?m("bc-crosshair-h",!1):null,u=()=>{b.style.display="none",d&&(d.style.display="none")},L=(e,s)=>{let n=null;for(const o of t.spec.marks){if(g==="lines"&&!B(o))continue;let p,a=null,l=0;try{const i=t.channel(o,"x");if(!i.scale)continue;p=i.mapped,l=i.half;const c=t.channel(o,"y");c.scale&&(a=c.mapped)}catch{continue}const{from:h,to:O}=t.rows(o),{x:w,w:F}=t.plot;for(let i=h;i<O;i++){const c=p[i]+l;if(!isFinite(c)||c<w-.5||c>w+F+.5)continue;const k=Math.abs(c-e);(!n||k<n.d)&&(n={x:c,y:a&&isFinite(a[i])?a[i]:s,d:k})}}return n};C(t,e=>{const s=x.getBoundingClientRect(),n=f.getBoundingClientRect();if(!s.width)return u();const o=s.width/t.size.w,{x:p,y:a}=y().toLogical(t,e),l=t.plot;if(!y().inPlot(t,{x:p,y:a}))return u();const h=g==="off"?{x:p,y:a}:L(p,a);if(!h)return u();Object.assign(b.style,{left:s.left-n.left+h.x*o+"px",top:s.top-n.top+l.y*o+"px",height:l.h*o+"px",display:"block"}),d&&Object.assign(d.style,{top:s.top-n.top+h.y*o+"px",left:s.left-n.left+l.x*o+"px",width:l.w*o+"px",display:"block"})},u,!0),t.cleanup(()=>{for(const e of[b,d])e&&e.parentNode&&e.parentNode.removeChild(e);E()})}};BC.define(j)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(u){const g=()=>u.get("lib.pointer").exports,z=(r,t,f,b)=>u.get("lib.pointer").exports.follow(r,t,f,b);function E(r){const t=u.get(`mark.${r.type}`);return!!(t&&t.series)}const L={role:"interaction",type:"crosshair",version:6,requires:["lib.pointer"],alongX:!0,params:{snap:{kind:"enum",values:["lines","all","off"],default:"lines"},horizontal:{kind:"boolean",default:!1}},attach(r,t){const f=t.host,b=t.root,O=f.ownerDocument||document,T=t.claimPosition(),m=r.snap==="all"||r.snap==="off"?r.snap:"lines",w=(e,s)=>{const o=O.createElement("div");return o.setAttribute("class",e),Object.assign(o.style,s?{position:"absolute",display:"none",pointerEvents:"none",width:"0",marginLeft:"-0.5px",borderLeft:"1px dashed var(--bc-crosshair, var(--bc-axis, #999))"}:{position:"absolute",display:"none",pointerEvents:"none",height:"0",marginTop:"-0.5px",borderTop:"1px dashed var(--bc-crosshair, var(--bc-axis, #999))"}),f.appendChild(o),o},y=w("bc-crosshair",!0),d=r.horizontal===!0?w("bc-crosshair-h",!1):null,x=()=>{y.style.display="none",d&&(d.style.display="none")},C=(e,s)=>{let o=null;for(const n of t.spec.marks){if(m==="lines"&&!E(n))continue;let p,a=null,l=0;try{const i=t.channel(n,"x");if(!i.scale)continue;p=i.mapped,l=i.half;const c=t.channel(n,"y");c.scale&&(a=c.mapped)}catch{continue}const{from:h,to:F}=t.rows(n),{x:k,w:N}=t.plot;for(let i=h;i<F;i++){const c=p[i]+l;if(!isFinite(c)||c<k-.5||c>k+N+.5)continue;const j=Math.abs(c-e);(!o||j<o.d)&&(o={x:c,y:a&&isFinite(a[i])?a[i]:s,d:j})}}return o};z(t,e=>{const s=b.getBoundingClientRect(),o=f.getBoundingClientRect();if(!s.width)return x();const n=s.width/t.size.w,{x:p,y:a}=g().toLogical(t,e),l=t.plot;if(!g().inPlot(t,{x:p,y:a}))return x();const h=m==="off"?{x:p,y:a}:C(p,a);if(!h)return x();Object.assign(y.style,{left:s.left-o.left+h.x*n+"px",top:s.top-o.top+l.y*n+"px",height:l.h*n+"px",display:"block"}),d&&Object.assign(d.style,{top:s.top-o.top+h.y*n+"px",left:s.left-o.left+l.x*n+"px",width:l.w*n+"px",display:"block"})},x,!0),t.cleanup(()=>{for(const e of[y,d])e&&e.parentNode&&e.parentNode.removeChild(e);T()})}};u.define(L)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const x="bc-legend-scale",O="bc-legend-index",K="bc-legend-filter",A=s=>s.output==="color"&&s.input==="category",E=(s,o,a)=>{const l=(o.guides||[]).find(m=>typeof m.scale=="string"&&!!a[m.scale]&&A(a[m.scale])),d=typeof s.scale=="string"?s.scale:l?l.scale:void 0;return d&&a[d]&&A(a[d])?d:void 0},S=s=>s.key==="Enter"||s.key===" "||s.key==="Spacebar",I={role:"interaction",type:"legend-filter",version:6,outerLegend:!0,params:{scale:{kind:"scale"},legend:{kind:"string"},fit:{kind:"list"}},toggles:(s,o)=>typeof s.legend=="string"?void 0:E(s,o.spec,o.scales),attach(s,o){const a=typeof s.legend=="string"?s.legend:null,l=E(s,o.spec,o.scales),d=l?o.scales[l]:void 0;if(!l||!d){console.warn('[blockcharts] interaction.legend-filter: needs a categorical color scale (set "scale", or add a legend guide for one); ignored');return}const m=(Array.isArray(s.fit)?s.fit:[]).filter(t=>{const e=typeof t=="string"&&!!o.scales[t]&&t!==l;return!e&&typeof t=="string"&&console.warn(`[blockcharts] interaction.legend-filter: cannot fit scale "${t}"`),e}),i=o.root,c=d.baseDomain(),T=o.host.ownerDocument||document,f=a?T.getElementById(a):null;if(a&&!f)return;const k=()=>o.getView()[l],h=t=>{o.setView(l,t.length===0||t.length===c.length?null:t);for(const e of m)o.setView(e,o.fit(e,l));if(f){const e=t.length?t:c;f.querySelectorAll("[data-bc-legend-index]").forEach(n=>{const r=e.indexOf(c[Number(n.getAttribute("data-bc-legend-index"))])>=0;n.setAttribute("aria-pressed",r?"true":"false")})}},p=t=>{if(f){const r=t.target?.closest?.("[data-bc-legend-index]"),u=r?Number(r.getAttribute("data-bc-legend-index")):NaN;return Number.isInteger(u)&&u>=0&&u<c.length?{value:c[u]}:null}const e=o.dataAt(t);if(!e||e[x]!==l)return null;const n=Number(e[O]);return Number.isInteger(n)&&n>=0&&n<c.length?{value:c[n]}:null};let g=null;const v=t=>{if(t.detail>1)return;const e=p(t);if(!e)return;const n=k();g={shown:n.slice(),at:Date.now()},h(c.filter(r=>r===e.value?n.indexOf(r)<0:n.indexOf(r)>=0))},L=t=>{const e=p(t);if(!e)return;t.preventDefault();const n=g&&Date.now()-g.at<700?g.shown:k();g=null,h(n.length===1&&n[0]===e.value?c.slice():[e.value])},C=t=>{const e=t;if(!S(e)||e.altKey||e.ctrlKey||e.metaKey)return;const n=p(t);if(!n||(t.preventDefault(),e.repeat))return;const r=k();g=null,e.shiftKey?h(r.length===1&&r[0]===n.value?c.slice():[n.value]):h(c.filter(u=>u===n.value?r.indexOf(u)<0:r.indexOf(u)>=0))},b=f||i;b.addEventListener("click",v),b.addEventListener("dblclick",L),b.addEventListener("keydown",C);let y=null;const N=t=>{const e=i.style,n=!!p(t);n&&y===null?(y=e.cursor,e.cursor="pointer"):!n&&y!==null&&(e.cursor=y,y=null)},D=!f&&typeof i.getContext=="function";D&&i.addEventListener("pointermove",N);const w=i.getAttribute("class");i.setAttribute("class",((w||"")+" "+K).trim()),o.cleanup(()=>{b.removeEventListener("click",v),b.removeEventListener("dblclick",L),b.removeEventListener("keydown",C),D&&i.removeEventListener("pointermove",N),w===null?i.removeAttribute?i.removeAttribute("class"):i.setAttribute("class",""):i.setAttribute("class",w)})}};BC.define(I)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(x){const O="bc-legend-scale",K="bc-legend-index",S="bc-legend-filter",A=s=>s.output==="color"&&s.input==="category",E=(s,o,a)=>{const l=(o.guides||[]).find(m=>typeof m.scale=="string"&&!!a[m.scale]&&A(a[m.scale])),d=typeof s.scale=="string"?s.scale:l?l.scale:void 0;return d&&a[d]&&A(a[d])?d:void 0},T=s=>s.key==="Enter"||s.key===" "||s.key==="Spacebar",I={role:"interaction",type:"legend-filter",version:6,outerLegend:!0,params:{scale:{kind:"scale"},legend:{kind:"string"},fit:{kind:"list"}},toggles:(s,o)=>typeof s.legend=="string"?void 0:E(s,o.spec,o.scales),attach(s,o){const a=typeof s.legend=="string"?s.legend:null,l=E(s,o.spec,o.scales),d=l?o.scales[l]:void 0;if(!l||!d){console.warn('[blockcharts] interaction.legend-filter: needs a categorical color scale (set "scale", or add a legend guide for one); ignored');return}const m=(Array.isArray(s.fit)?s.fit:[]).filter(t=>{const e=typeof t=="string"&&!!o.scales[t]&&t!==l;return!e&&typeof t=="string"&&console.warn(`[blockcharts] interaction.legend-filter: cannot fit scale "${t}"`),e}),i=o.root,c=d.baseDomain(),V=o.host.ownerDocument||document,f=a?V.getElementById(a):null;if(a&&!f)return;const k=()=>o.getView()[l],h=t=>{o.setView(l,t.length===0||t.length===c.length?null:t);for(const e of m)o.setView(e,o.fit(e,l));if(f){const e=t.length?t:c;f.querySelectorAll("[data-bc-legend-index]").forEach(n=>{const r=e.indexOf(c[Number(n.getAttribute("data-bc-legend-index"))])>=0;n.setAttribute("aria-pressed",r?"true":"false")})}},p=t=>{if(f){const r=t.target?.closest?.("[data-bc-legend-index]"),u=r?Number(r.getAttribute("data-bc-legend-index")):NaN;return Number.isInteger(u)&&u>=0&&u<c.length?{value:c[u]}:null}const e=o.dataAt(t);if(!e||e[O]!==l)return null;const n=Number(e[K]);return Number.isInteger(n)&&n>=0&&n<c.length?{value:c[n]}:null};let g=null;const v=t=>{if(t.detail>1)return;const e=p(t);if(!e)return;const n=k();g={shown:n.slice(),at:Date.now()},h(c.filter(r=>r===e.value?n.indexOf(r)<0:n.indexOf(r)>=0))},L=t=>{const e=p(t);if(!e)return;t.preventDefault();const n=g&&Date.now()-g.at<700?g.shown:k();g=null,h(n.length===1&&n[0]===e.value?c.slice():[e.value])},C=t=>{const e=t;if(!T(e)||e.altKey||e.ctrlKey||e.metaKey)return;const n=p(t);if(!n||(t.preventDefault(),e.repeat))return;const r=k();g=null,e.shiftKey?h(r.length===1&&r[0]===n.value?c.slice():[n.value]):h(c.filter(u=>u===n.value?r.indexOf(u)<0:r.indexOf(u)>=0))},b=f||i;b.addEventListener("click",v),b.addEventListener("dblclick",L),b.addEventListener("keydown",C);let y=null;const N=t=>{const e=i.style,n=!!p(t);n&&y===null?(y=e.cursor,e.cursor="pointer"):!n&&y!==null&&(e.cursor=y,y=null)},D=!f&&typeof i.getContext=="function";D&&i.addEventListener("pointermove",N);const w=i.getAttribute("class");i.setAttribute("class",((w||"")+" "+S).trim()),o.cleanup(()=>{b.removeEventListener("click",v),b.removeEventListener("dblclick",L),b.removeEventListener("keydown",C),D&&i.removeEventListener("pointermove",N),w===null?i.removeAttribute?i.removeAttribute("class"):i.setAttribute("class",""):i.setAttribute("class",w)})}};x.define(I)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const ut=i=>i==null||i===""||typeof i=="number"&&isNaN(i),ht=/\d|[a-z][A-Z]|_/;function bt(i){if(i==null)return"\u2013";if(typeof i=="number")return isNaN(i)?"\u2013":Number.isInteger(i)?String(i):String(+i.toPrecision(6));const o=String(i);return o.length>80?o.slice(0,79)+"\u2026":o}const U=()=>BC.get("lib.pointer").exports,gt=(i,o,S,P)=>BC.get("lib.pointer").exports.follow(i,o,S,P),yt={role:"interaction",type:"tooltip",version:23,requires:["lib.pointer"],params:{fields:{kind:"fields"},formats:{kind:"formats"},labels:{kind:"any"},content:{kind:"any"},heading:{kind:"field"},marker:{kind:"enum",values:["auto","dot","box","none"],default:"auto"}},attach(i,o){const S=o.host,P=o.root,u=S.ownerDocument||document,D={};if(i.formats&&typeof i.formats=="object"&&!Array.isArray(i.formats)){const t=i.formats;for(const n of Object.keys(t))try{D[n]=o.format(t[n])}catch(r){console.warn(`[blockcharts] interaction.tooltip: format of "${n}" ignored: ${r instanceof Error?r.message:String(r)}`)}}else i.formats!==void 0&&console.warn('[blockcharts] interaction.tooltip: "formats" must be an object of field name to format; ignored');const Y=o.format("date"),W={};for(const t of Array.isArray(o.spec.transforms)?o.spec.transforms:[]){const n=t&&BC.get(`transform.${t.type}`);if(!(!n||typeof n.labels!="function"))try{Object.assign(W,n.labels(t))}catch{}}if(i.labels&&typeof i.labels=="object"&&!Array.isArray(i.labels)){const t=i.labels;for(const n of Object.keys(t))o.table.columns[n]?typeof t[n]!="string"?console.warn(`[blockcharts] interaction.tooltip: label of "${n}" must be text; ignored`):W[n]=t[n]:console.warn(`[blockcharts] interaction.tooltip: label of "${n}" ignored: no such field`)}else i.labels!==void 0&&console.warn('[blockcharts] interaction.tooltip: "labels" must be an object of field name to text; ignored');const X=Array.isArray(i.fields)?i.fields.filter(t=>typeof t=="string"):null,mt=o.claimPosition(),a=u.createElement("div");a.setAttribute("class","bc-tooltip"),a.setAttribute("role","tooltip"),Object.assign(a.style,{position:"absolute",display:"none",pointerEvents:"none",zIndex:"10",boxSizing:"border-box",whiteSpace:"normal",overflowWrap:"anywhere",fontSize:"12px",lineHeight:"1.45",fontVariantNumeric:"tabular-nums",padding:"8px 11px",borderRadius:"10px",background:"var(--bc-tooltip-bg, #fff)",color:"var(--bc-text, #333)",border:"1px solid var(--bc-tooltip-border, rgba(127,127,127,.22))",boxShadow:"var(--bc-tooltip-shadow, 0 10px 28px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.08))"});const b=u.createElement("div");b.setAttribute("class","bc-tooltip-dot"),Object.assign(b.style,{position:"absolute",display:"none",pointerEvents:"none",width:"12px",height:"12px",marginLeft:"-6px",marginTop:"-6px",boxSizing:"border-box",borderRadius:"50%",border:"2.5px solid var(--bc-tooltip-bg, #fff)",background:"var(--bc-text, #333)",boxShadow:"0 1px 4px rgba(15,23,42,.3)"});const j=u.createElement("div");j.setAttribute("class","bc-tooltip-highlight"),Object.assign(j.style,{position:"absolute",display:"none",pointerEvents:"none",boxSizing:"border-box",borderRadius:"3px",background:"var(--bc-tooltip-highlight-fill, rgba(127,127,127,.14))",outline:"1.5px solid var(--bc-tooltip-highlight-line, rgba(127,127,127,.45))",outlineOffset:"-1.5px"});const m=u.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("class","bc-tooltip-flows"),Object.assign(m.style,{position:"absolute",display:"none",pointerEvents:"none"}),S.appendChild(m),S.appendChild(b),S.appendChild(j),S.appendChild(a);const H=i.marker==="dot"||i.marker==="box"||i.marker==="none"?i.marker:"auto";let v=!1,tt=!1;const xt=()=>{const t=i.content;if(typeof t=="function")return t;if(typeof t!="string")return;const n=BC.getFn(t);return!n&&!v&&(v=!0,console.warn(`[blockcharts] interaction.tooltip: no function "${t}" is registered (BC.defineFn); showing the default content`)),n},wt=t=>!!t&&typeof t=="object"&&typeof t.nodeType=="number",et=t=>{if(!(t==null||t===!1)){if(typeof t=="string"||typeof t=="number"){if(t==="")return;const n=u.createElement("div");n.textContent=String(t),a.appendChild(n)}else if(Array.isArray(t))t.forEach(et);else if(wt(t))a.appendChild(t);else if(typeof t.html=="string"){const n=u.createElement("div");n.innerHTML=t.html,a.appendChild(n)}}},_=()=>{a.style.display="none",b.style.display="none",j.style.display="none",m.style.display="none"},M=(t,n)=>{const r=o.table.columns[t][n];return D[t]?D[t](r)||"\u2013":bt(r)};function nt(t){if(typeof i.heading=="string"&&o.table.columns[i.heading])return i.heading;for(const n of["category","date"])for(const r of["x","y"])try{const e=o.channel(t,r);if(e.field&&e.scale&&e.scale.input===n&&o.table.columns[e.field])return e.field}catch{}return null}function ot(t,n){for(const[r,e]of[["x","x2"],["y","y2"]])try{const s=o.channel(t,r),d=o.channel(t,e);if(!s.field||!d.field||s.field===d.field||!s.scale||s.scale!==d.scale||s.scale.input==="category"||!o.table.columns[s.field]||!o.table.columns[d.field]||n.indexOf(s.field)<0||n.indexOf(d.field)<0)continue;return{from:s.field,to:d.field,date:s.scale.input==="date"}}catch{}return null}const V=t=>BC.get(`mark.${t.type}`);function q(t,n,r){const e=V(t);if(!e||typeof e.color!="function")return"";try{const s=e.color(t,o,n,r);return typeof s=="string"?s:""}catch{return""}}function I(t,n){const r=[];for(const e of Object.keys(n.channels))try{const s=o.channel(t,e);s.field&&r.push(s.field)}catch{}return typeof t.group=="string"&&r.push(t.group),r}function kt(t,n,r,e,s){const d=q(t,r,e);if(s===null||I(t,n).includes(s))return d;const p=o.spec.marks;for(let c=p.length-1;c>=0;c--){const x=V(p[c]);if(c===r||!x||!I(p[c],x).includes(s))continue;const h=q(p[c],c,e);if(h)return h}return d}function st(t,n){const r=new Set;for(const e of Object.keys(n.channels))try{const s=o.channel(t,e);s.field&&s.scale&&s.scale.input==="date"&&r.add(s.field)}catch{}return(e,s)=>!D[e]&&r.has(e)&&Y(o.table.columns[e][s])||M(e,s)}function Et(t,n,r,e,s){const d=[],p=[],c=new Set(s),x=st(t,n),h=w=>{const N=o.table.columns[w];if(!N||c.has(w)||(c.add(w),ut(N[r])))return;const k=x(w,r);e.some(T=>x(w,T)!==k)||(d.push([W[w]||w,k]),p.push(w))};return(X||I(t,n)).forEach(h),{lines:d,fields:p}}function Ct(t){const n=U().toLogical(o,t);if(!U().inPlot(o,n,12))return _();let r=null;if(o.spec.marks.forEach((f,l)=>{const g=BC.get(`mark.${f.type}`);if(!g||!g.pick)return;let y=null;try{y=g.pick(f,o,l,n.x,n.y)}catch{return}y&&isFinite(y.dist)&&(!r||y.dist<=r.pick.dist)&&(r={pick:y,mark:f,def:g,index:l})}),!r)return _();const{pick:e,mark:s,def:d,index:p}=r,c=e.card,x=e.rows&&e.rows.length>1?e.rows:[e.row],h=c?null:nt(s),w=typeof i.heading=="string"&&!!o.table.columns[i.heading],N=c||w?null:ot(s,X||I(s,d)),k=N&&(!h||h===N.from||h===N.to)?N:null,T=c?M:st(s,d),E=k&&x.every(f=>T(k.from,f)===T(k.from,e.row)&&T(k.to,f)===T(k.to,e.row))?k:null,A=!k&&h&&x.every(f=>M(h,f)===M(h,e.row))?h:null,it=c?{lines:c.lines,fields:[]}:Et(s,d,e.row,x,E?[E.from,E.to]:[]),Z=it.lines,rt=A?W[A]||A:null;let B;const lt=c?void 0:xt();if(lt){const f={};for(const l of Object.keys(o.table.columns))f[l]=o.table.columns[l][e.row];try{B=lt({row:e.row,values:f,rows:x,lines:Z,mark:s,markIndex:p,x:e.x,y:e.y,table:o.table})}catch(l){tt||(tt=!0,console.error("[blockcharts] interaction.tooltip: the content function threw, showing the default content:",l)),B=void 0}}if(B===null||B===!1)return _();a.textContent="";const At=q(s,p,e.row),at=it.fields.find((f,l)=>Z[l][0]!==rt),ct=c?c.color||"":kt(s,d,p,e.row,X&&at!==void 0?at:null);if(B===void 0){if(A||c||E){const l=u.createElement("div");if(l.setAttribute("class","bc-tooltip-heading"),A?l.setAttribute("data-bc-field",A):E&&l.setAttribute("data-bc-field",`${E.from} ${E.to}`),Object.assign(l.style,{display:"flex",alignItems:"center",gap:"7px",fontWeight:"600",marginBottom:"4px"}),ct){const F=u.createElement("span");F.setAttribute("class","bc-tooltip-swatch"),Object.assign(F.style,{width:"8px",height:"8px",borderRadius:"50%",background:ct,boxShadow:"inset 0 0 0 1px var(--bc-tooltip-highlight-line, rgba(127,127,127,.45))",flex:"none"}),l.appendChild(F)}const g=u.createElement("span"),y=o.table.columns[A],z=(()=>{for(const F of["x","y"])try{const R=o.channel(s,F);if(R.field===A&&R.scale&&R.scale.input==="date")return!0}catch{}return!1})(),Q=A;if(c)g.textContent=c.title;else if(E){const F=[T(E.from,e.row),T(E.to,e.row)];g.textContent=F.join(F.some(R=>R.indexOf(" ")>=0)?" \u2013 ":"\u2013")}else g.textContent=!D[Q]&&z&&Y(y[e.row])||M(Q,e.row);l.appendChild(g),a.appendChild(l)}const f=u.createElement("div");f.setAttribute("class","bc-tooltip-lines"),Object.assign(f.style,{display:"grid",gridTemplateColumns:"auto auto",columnGap:"16px",rowGap:"1px"});for(const[l,g]of Z){if(l===rt)continue;const y=u.createElement("span");y.textContent=l,y.style.opacity="0.68";const z=u.createElement("span");z.textContent=g,Object.assign(z.style,{textAlign:"right",fontWeight:"600"}),f.appendChild(y),f.appendChild(z)}f.children.length&&a.appendChild(f)}else et(B);if(!(a.childNodes?a.childNodes.length>0:a.children.length>0))return _();const O=P.getBoundingClientRect(),C=S.getBoundingClientRect(),$=O.width/o.size.w,L=O.left-C.left+e.x*$,G=O.top-C.top+e.y*$;m.textContent="";for(const f of e.flows||[]){const l=u.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",f.d),l.setAttribute("fill",f.fill),l.setAttribute("fill-opacity","0.5"),m.appendChild(l)}e.flows&&e.flows.length?(m.setAttribute("viewBox",`0 0 ${o.size.w} ${o.size.h}`),Object.assign(m.style,{left:O.left-C.left+"px",top:O.top-C.top+"px",width:O.width+"px",height:O.height+"px",display:"block"})):m.style.display="none",(H==="box"||H==="auto"&&!!e.box)&&e.box?(Object.assign(j.style,{left:O.left-C.left+e.box.x*$+"px",top:O.top-C.top+e.box.y*$+"px",width:Math.max(0,e.box.w*$)+"px",height:Math.max(0,e.box.h*$)+"px",display:"block"}),b.style.display="none"):H!=="none"?(b.style.left=L+"px",b.style.top=G+"px",b.style.background=At||"var(--bc-text, #333)",b.style.display="block",j.style.display="none"):(b.style.display="none",j.style.display="none");const J=u.defaultView||globalThis,K=Math.max(0,-C.left),ft=typeof J.innerWidth=="number"&&J.innerWidth>0?Math.min(C.width,J.innerWidth-C.left):C.width;a.style.display="block",a.style.maxWidth=Math.max(120,ft-K)+"px",a.style.left=K+"px";const dt=a.offsetWidth||0,pt=a.offsetHeight||0,Ot=L+12+dt>ft?L-12-dt:L+12,St=G-12-pt>=0?G-12-pt:G+12;a.style.left=Math.max(K,Ot)+"px",a.style.top=Math.max(0,St)+"px"}if(i.content===void 0&&o.table){const t=[];for(const n of o.spec.marks){const r=V(n);if(!r||!r.pick)continue;const e=X||I(n,r),s=nt(n),d=typeof i.heading=="string"?null:ot(n,e);for(const p of e)p===s||d&&(p===d.from||p===d.to)||!W[p]&&ht.test(p)&&o.table.columns[p]&&t.indexOf(p)<0&&t.push(p)}t.length&&console.warn(`[blockcharts] interaction.tooltip: the card shows ${t.map(n=>`"${n}"`).join(", ")} under ${t.length>1?"their own names; give them names":"its own name; give it a name"} a reader knows in "labels"`)}gt(o,Ct,_),o.cleanup(()=>{for(const t of[a,b,j,m])t.parentNode&&t.parentNode.removeChild(t);mt()})}};BC.define(yt)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(M){const ht=i=>i==null||i===""||typeof i=="number"&&isNaN(i),bt=/\d|[a-z][A-Z]|_/;function gt(i){if(i==null)return"\u2013";if(typeof i=="number")return isNaN(i)?"\u2013":Number.isInteger(i)?String(i):String(+i.toPrecision(6));const o=String(i);return o.length>80?o.slice(0,79)+"\u2026":o}const Y=()=>M.get("lib.pointer").exports,yt=(i,o,S,H)=>M.get("lib.pointer").exports.follow(i,o,S,H),mt={role:"interaction",type:"tooltip",version:23,requires:["lib.pointer"],params:{fields:{kind:"fields"},formats:{kind:"formats"},labels:{kind:"any"},content:{kind:"any"},heading:{kind:"field"},marker:{kind:"enum",values:["auto","dot","box","none"],default:"auto"}},attach(i,o){const S=o.host,H=o.root,u=S.ownerDocument||document,_={};if(i.formats&&typeof i.formats=="object"&&!Array.isArray(i.formats)){const t=i.formats;for(const n of Object.keys(t))try{_[n]=o.format(t[n])}catch(r){console.warn(`[blockcharts] interaction.tooltip: format of "${n}" ignored: ${r instanceof Error?r.message:String(r)}`)}}else i.formats!==void 0&&console.warn('[blockcharts] interaction.tooltip: "formats" must be an object of field name to format; ignored');const v=o.format("date"),I={};for(const t of Array.isArray(o.spec.transforms)?o.spec.transforms:[]){const n=t&&M.get(`transform.${t.type}`);if(!(!n||typeof n.labels!="function"))try{Object.assign(I,n.labels(t))}catch{}}if(i.labels&&typeof i.labels=="object"&&!Array.isArray(i.labels)){const t=i.labels;for(const n of Object.keys(t))o.table.columns[n]?typeof t[n]!="string"?console.warn(`[blockcharts] interaction.tooltip: label of "${n}" must be text; ignored`):I[n]=t[n]:console.warn(`[blockcharts] interaction.tooltip: label of "${n}" ignored: no such field`)}else i.labels!==void 0&&console.warn('[blockcharts] interaction.tooltip: "labels" must be an object of field name to text; ignored');const G=Array.isArray(i.fields)?i.fields.filter(t=>typeof t=="string"):null,xt=o.claimPosition(),a=u.createElement("div");a.setAttribute("class","bc-tooltip"),a.setAttribute("role","tooltip"),Object.assign(a.style,{position:"absolute",display:"none",pointerEvents:"none",zIndex:"10",boxSizing:"border-box",whiteSpace:"normal",overflowWrap:"anywhere",fontSize:"12px",lineHeight:"1.45",fontVariantNumeric:"tabular-nums",padding:"8px 11px",borderRadius:"10px",background:"var(--bc-tooltip-bg, #fff)",color:"var(--bc-text, #333)",border:"1px solid var(--bc-tooltip-border, rgba(127,127,127,.22))",boxShadow:"var(--bc-tooltip-shadow, 0 10px 28px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.08))"});const b=u.createElement("div");b.setAttribute("class","bc-tooltip-dot"),Object.assign(b.style,{position:"absolute",display:"none",pointerEvents:"none",width:"12px",height:"12px",marginLeft:"-6px",marginTop:"-6px",boxSizing:"border-box",borderRadius:"50%",border:"2.5px solid var(--bc-tooltip-bg, #fff)",background:"var(--bc-text, #333)",boxShadow:"0 1px 4px rgba(15,23,42,.3)"});const j=u.createElement("div");j.setAttribute("class","bc-tooltip-highlight"),Object.assign(j.style,{position:"absolute",display:"none",pointerEvents:"none",boxSizing:"border-box",borderRadius:"3px",background:"var(--bc-tooltip-highlight-fill, rgba(127,127,127,.14))",outline:"1.5px solid var(--bc-tooltip-highlight-line, rgba(127,127,127,.45))",outlineOffset:"-1.5px"});const m=u.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("class","bc-tooltip-flows"),Object.assign(m.style,{position:"absolute",display:"none",pointerEvents:"none"}),S.appendChild(m),S.appendChild(b),S.appendChild(j),S.appendChild(a);const V=i.marker==="dot"||i.marker==="box"||i.marker==="none"?i.marker:"auto";let tt=!1,et=!1;const wt=()=>{const t=i.content;if(typeof t=="function")return t;if(typeof t!="string")return;const n=M.getFn(t);return!n&&!tt&&(tt=!0,console.warn(`[blockcharts] interaction.tooltip: no function "${t}" is registered (BC.defineFn); showing the default content`)),n},kt=t=>!!t&&typeof t=="object"&&typeof t.nodeType=="number",nt=t=>{if(!(t==null||t===!1)){if(typeof t=="string"||typeof t=="number"){if(t==="")return;const n=u.createElement("div");n.textContent=String(t),a.appendChild(n)}else if(Array.isArray(t))t.forEach(nt);else if(kt(t))a.appendChild(t);else if(typeof t.html=="string"){const n=u.createElement("div");n.innerHTML=t.html,a.appendChild(n)}}},X=()=>{a.style.display="none",b.style.display="none",j.style.display="none",m.style.display="none"},N=(t,n)=>{const r=o.table.columns[t][n];return _[t]?_[t](r)||"\u2013":gt(r)};function ot(t){if(typeof i.heading=="string"&&o.table.columns[i.heading])return i.heading;for(const n of["category","date"])for(const r of["x","y"])try{const e=o.channel(t,r);if(e.field&&e.scale&&e.scale.input===n&&o.table.columns[e.field])return e.field}catch{}return null}function st(t,n){for(const[r,e]of[["x","x2"],["y","y2"]])try{const s=o.channel(t,r),d=o.channel(t,e);if(!s.field||!d.field||s.field===d.field||!s.scale||s.scale!==d.scale||s.scale.input==="category"||!o.table.columns[s.field]||!o.table.columns[d.field]||n.indexOf(s.field)<0||n.indexOf(d.field)<0)continue;return{from:s.field,to:d.field,date:s.scale.input==="date"}}catch{}return null}const q=t=>M.get(`mark.${t.type}`);function Z(t,n,r){const e=q(t);if(!e||typeof e.color!="function")return"";try{const s=e.color(t,o,n,r);return typeof s=="string"?s:""}catch{return""}}function L(t,n){const r=[];for(const e of Object.keys(n.channels))try{const s=o.channel(t,e);s.field&&r.push(s.field)}catch{}return typeof t.group=="string"&&r.push(t.group),r}function Et(t,n,r,e,s){const d=Z(t,r,e);if(s===null||L(t,n).includes(s))return d;const p=o.spec.marks;for(let c=p.length-1;c>=0;c--){const x=q(p[c]);if(c===r||!x||!L(p[c],x).includes(s))continue;const h=Z(p[c],c,e);if(h)return h}return d}function it(t,n){const r=new Set;for(const e of Object.keys(n.channels))try{const s=o.channel(t,e);s.field&&s.scale&&s.scale.input==="date"&&r.add(s.field)}catch{}return(e,s)=>!_[e]&&r.has(e)&&v(o.table.columns[e][s])||N(e,s)}function At(t,n,r,e,s){const d=[],p=[],c=new Set(s),x=it(t,n),h=w=>{const $=o.table.columns[w];if(!$||c.has(w)||(c.add(w),ht($[r])))return;const k=x(w,r);e.some(T=>x(w,T)!==k)||(d.push([I[w]||w,k]),p.push(w))};return(G||L(t,n)).forEach(h),{lines:d,fields:p}}function Ot(t){const n=Y().toLogical(o,t);if(!Y().inPlot(o,n,12))return X();let r=null;if(o.spec.marks.forEach((f,l)=>{const g=M.get(`mark.${f.type}`);if(!g||!g.pick)return;let y=null;try{y=g.pick(f,o,l,n.x,n.y)}catch{return}y&&isFinite(y.dist)&&(!r||y.dist<=r.pick.dist)&&(r={pick:y,mark:f,def:g,index:l})}),!r)return X();const{pick:e,mark:s,def:d,index:p}=r,c=e.card,x=e.rows&&e.rows.length>1?e.rows:[e.row],h=c?null:ot(s),w=typeof i.heading=="string"&&!!o.table.columns[i.heading],$=c||w?null:st(s,G||L(s,d)),k=$&&(!h||h===$.from||h===$.to)?$:null,T=c?N:it(s,d),E=k&&x.every(f=>T(k.from,f)===T(k.from,e.row)&&T(k.to,f)===T(k.to,e.row))?k:null,O=!k&&h&&x.every(f=>N(h,f)===N(h,e.row))?h:null,rt=c?{lines:c.lines,fields:[]}:At(s,d,e.row,x,E?[E.from,E.to]:[]),J=rt.lines,lt=O?I[O]||O:null;let z;const at=c?void 0:wt();if(at){const f={};for(const l of Object.keys(o.table.columns))f[l]=o.table.columns[l][e.row];try{z=at({row:e.row,values:f,rows:x,lines:J,mark:s,markIndex:p,x:e.x,y:e.y,table:o.table})}catch(l){et||(et=!0,console.error("[blockcharts] interaction.tooltip: the content function threw, showing the default content:",l)),z=void 0}}if(z===null||z===!1)return X();a.textContent="";const Ct=Z(s,p,e.row),ct=rt.fields.find((f,l)=>J[l][0]!==lt),ft=c?c.color||"":Et(s,d,p,e.row,G&&ct!==void 0?ct:null);if(z===void 0){if(O||c||E){const l=u.createElement("div");if(l.setAttribute("class","bc-tooltip-heading"),O?l.setAttribute("data-bc-field",O):E&&l.setAttribute("data-bc-field",`${E.from} ${E.to}`),Object.assign(l.style,{display:"flex",alignItems:"center",gap:"7px",fontWeight:"600",marginBottom:"4px"}),ft){const F=u.createElement("span");F.setAttribute("class","bc-tooltip-swatch"),Object.assign(F.style,{width:"8px",height:"8px",borderRadius:"50%",background:ft,boxShadow:"inset 0 0 0 1px var(--bc-tooltip-highlight-line, rgba(127,127,127,.45))",flex:"none"}),l.appendChild(F)}const g=u.createElement("span"),y=o.table.columns[O],D=(()=>{for(const F of["x","y"])try{const W=o.channel(s,F);if(W.field===O&&W.scale&&W.scale.input==="date")return!0}catch{}return!1})(),U=O;if(c)g.textContent=c.title;else if(E){const F=[T(E.from,e.row),T(E.to,e.row)];g.textContent=F.join(F.some(W=>W.indexOf(" ")>=0)?" \u2013 ":"\u2013")}else g.textContent=!_[U]&&D&&v(y[e.row])||N(U,e.row);l.appendChild(g),a.appendChild(l)}const f=u.createElement("div");f.setAttribute("class","bc-tooltip-lines"),Object.assign(f.style,{display:"grid",gridTemplateColumns:"auto auto",columnGap:"16px",rowGap:"1px"});for(const[l,g]of J){if(l===lt)continue;const y=u.createElement("span");y.textContent=l,y.style.opacity="0.68";const D=u.createElement("span");D.textContent=g,Object.assign(D.style,{textAlign:"right",fontWeight:"600"}),f.appendChild(y),f.appendChild(D)}f.children.length&&a.appendChild(f)}else nt(z);if(!(a.childNodes?a.childNodes.length>0:a.children.length>0))return X();const C=H.getBoundingClientRect(),A=S.getBoundingClientRect(),R=C.width/o.size.w,P=C.left-A.left+e.x*R,B=C.top-A.top+e.y*R;m.textContent="";for(const f of e.flows||[]){const l=u.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",f.d),l.setAttribute("fill",f.fill),l.setAttribute("fill-opacity","0.5"),m.appendChild(l)}e.flows&&e.flows.length?(m.setAttribute("viewBox",`0 0 ${o.size.w} ${o.size.h}`),Object.assign(m.style,{left:C.left-A.left+"px",top:C.top-A.top+"px",width:C.width+"px",height:C.height+"px",display:"block"})):m.style.display="none",(V==="box"||V==="auto"&&!!e.box)&&e.box?(Object.assign(j.style,{left:C.left-A.left+e.box.x*R+"px",top:C.top-A.top+e.box.y*R+"px",width:Math.max(0,e.box.w*R)+"px",height:Math.max(0,e.box.h*R)+"px",display:"block"}),b.style.display="none"):V!=="none"?(b.style.left=P+"px",b.style.top=B+"px",b.style.background=Ct||"var(--bc-text, #333)",b.style.display="block",j.style.display="none"):(b.style.display="none",j.style.display="none");const K=u.defaultView||globalThis,Q=Math.max(0,-A.left),dt=typeof K.innerWidth=="number"&&K.innerWidth>0?Math.min(A.width,K.innerWidth-A.left):A.width;a.style.display="block",a.style.maxWidth=Math.max(120,dt-Q)+"px",a.style.left=Q+"px";const pt=a.offsetWidth||0,ut=a.offsetHeight||0,St=P+12+pt>dt?P-12-pt:P+12,jt=B-12-ut>=0?B-12-ut:B+12;a.style.left=Math.max(Q,St)+"px",a.style.top=Math.max(0,jt)+"px"}if(i.content===void 0&&o.table){const t=[];for(const n of o.spec.marks){const r=q(n);if(!r||!r.pick)continue;const e=G||L(n,r),s=ot(n),d=typeof i.heading=="string"?null:st(n,e);for(const p of e)p===s||d&&(p===d.from||p===d.to)||!I[p]&&bt.test(p)&&o.table.columns[p]&&t.indexOf(p)<0&&t.push(p)}t.length&&console.warn(`[blockcharts] interaction.tooltip: the card shows ${t.map(n=>`"${n}"`).join(", ")} under ${t.length>1?"their own names; give them names":"its own name; give it a name"} a reader knows in "labels"`)}yt(o,Ot,X),o.cleanup(()=>{for(const t of[a,b,j,m])t.parentNode&&t.parentNode.removeChild(t);xt()})}};M.define(mt)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const y=()=>BC.get("lib.view").exports,k={role:"interaction",type:"zoom-controls",version:6,requires:["lib.view"],params:{scales:{kind:"list",default:["x"]},fit:{kind:"list"},step:{kind:"number",default:.5},maxZoom:{kind:"number",default:50},titles:{kind:"any"},corner:{kind:"enum",values:["top-right","top-left","bottom-right","bottom-left"],default:"top-right"}},corner(o,e){const[u,r]=(typeof o.corner=="string"?o.corner:"top-right").split("-"),f=(Array.isArray(o.scales)?o.scales:["x"]).some(a=>typeof a=="string"&&!!e.scales[a]&&!!e.scales[a].invert);return{edge:u,side:r,width:f?120:64}},attach(o,e){const r=(Array.isArray(o.scales)?o.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const n=e.scales[t],c=!!n&&e.orientation(t)!==null&&(!!n.invert||n.bandwidth!==void 0);return c||console.warn(`[blockcharts] interaction.zoom-controls: scale "${t}" is not a positional scale, ignored`),c});if(!r.length)return;const l=r.filter(t=>!!e.scales[t].invert),f=(Array.isArray(o.fit)?o.fit:[]).filter(t=>{const n=typeof t=="string"&&!!e.scales[t]&&r.indexOf(t)<0;return!n&&typeof t=="string"&&console.warn(`[blockcharts] interaction.zoom-controls: cannot fit scale "${t}"`),n}),a=()=>{for(const t of f)e.setView(t,e.fit(t,r[0]))},b=typeof o.step=="number"&&o.step>0&&o.step<1?o.step:.5,w=typeof o.maxZoom=="number"&&o.maxZoom>1?o.maxZoom:50,A=o.corner==="top-left"||o.corner==="bottom-right"||o.corner==="bottom-left"?o.corner:"top-right",[z,v]=A.split("-"),E=()=>{for(const t of r)e.setView(t,null);a()},p=t=>{for(const n of l)y().zoom(e,n,t,w);a()},g=e.host,h=g.ownerDocument||document,i=h.createElement("div");i.setAttribute("class","bc-zoom-controls"),Object.assign(i.style,{position:"absolute",[z]:"8px",[v]:"8px",zIndex:"6",display:"flex",gap:"4px",font:"12px/1 system-ui, sans-serif"});const d=(t,n,c)=>{const s=h.createElement("button");return s.type="button",s.textContent=t,s.setAttribute("aria-label",n),s.title=n,Object.assign(s.style,{minWidth:"22px",height:"22px",padding:"0 6px",lineHeight:"20px",textAlign:"center",border:"1px solid var(--bc-axis, #ccc)",borderRadius:"4px",cursor:"pointer",whiteSpace:"nowrap",background:"var(--bc-tooltip-bg, #fff)",color:"var(--bc-text, #333)"}),s.addEventListener("click",C=>{C.preventDefault(),c()}),i.appendChild(s),s},x=o.titles&&typeof o.titles=="object"?o.titles:{},m=(t,n)=>typeof x[t]=="string"?x[t]:n;d("100%",m("reset","Reset zoom to the full range"),E),l.length&&(d("\u2212",m("out","Zoom out"),()=>p(1/b)),d("+",m("in","Zoom in"),()=>p(b)));const Z=e.claimPosition();g.appendChild(i),e.cleanup(()=>{i.parentNode&&i.parentNode.removeChild(i),Z()})}};BC.define(k)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(u){const k=()=>u.get("lib.view").exports,w={role:"interaction",type:"zoom-controls",version:6,requires:["lib.view"],params:{scales:{kind:"list",default:["x"]},fit:{kind:"list"},step:{kind:"number",default:.5},maxZoom:{kind:"number",default:50},titles:{kind:"any"},corner:{kind:"enum",values:["top-right","top-left","bottom-right","bottom-left"],default:"top-right"}},corner(o,e){const[b,r]=(typeof o.corner=="string"?o.corner:"top-right").split("-"),f=(Array.isArray(o.scales)?o.scales:["x"]).some(a=>typeof a=="string"&&!!e.scales[a]&&!!e.scales[a].invert);return{edge:b,side:r,width:f?120:64}},attach(o,e){const r=(Array.isArray(o.scales)?o.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const n=e.scales[t],c=!!n&&e.orientation(t)!==null&&(!!n.invert||n.bandwidth!==void 0);return c||console.warn(`[blockcharts] interaction.zoom-controls: scale "${t}" is not a positional scale, ignored`),c});if(!r.length)return;const l=r.filter(t=>!!e.scales[t].invert),f=(Array.isArray(o.fit)?o.fit:[]).filter(t=>{const n=typeof t=="string"&&!!e.scales[t]&&r.indexOf(t)<0;return!n&&typeof t=="string"&&console.warn(`[blockcharts] interaction.zoom-controls: cannot fit scale "${t}"`),n}),a=()=>{for(const t of f)e.setView(t,e.fit(t,r[0]))},p=typeof o.step=="number"&&o.step>0&&o.step<1?o.step:.5,A=typeof o.maxZoom=="number"&&o.maxZoom>1?o.maxZoom:50,z=o.corner==="top-left"||o.corner==="bottom-right"||o.corner==="bottom-left"?o.corner:"top-right",[v,E]=z.split("-"),T=()=>{for(const t of r)e.setView(t,null);a()},g=t=>{for(const n of l)k().zoom(e,n,t,A);a()},h=e.host,x=h.ownerDocument||document,i=x.createElement("div");i.setAttribute("class","bc-zoom-controls"),Object.assign(i.style,{position:"absolute",[v]:"8px",[E]:"8px",zIndex:"6",display:"flex",gap:"4px",font:"12px/1 system-ui, sans-serif"});const d=(t,n,c)=>{const s=x.createElement("button");return s.type="button",s.textContent=t,s.setAttribute("aria-label",n),s.title=n,Object.assign(s.style,{minWidth:"22px",height:"22px",padding:"0 6px",lineHeight:"20px",textAlign:"center",border:"1px solid var(--bc-axis, #ccc)",borderRadius:"4px",cursor:"pointer",whiteSpace:"nowrap",background:"var(--bc-tooltip-bg, #fff)",color:"var(--bc-text, #333)"}),s.addEventListener("click",D=>{D.preventDefault(),c()}),i.appendChild(s),s},y=o.titles&&typeof o.titles=="object"?o.titles:{},m=(t,n)=>typeof y[t]=="string"?y[t]:n;d("100%",m("reset","Reset zoom to the full range"),T),l.length&&(d("\u2212",m("out","Zoom out"),()=>g(1/p)),d("+",m("in","Zoom in"),()=>g(p)));const Z=e.claimPosition();h.appendChild(i),e.cleanup(()=>{i.parentNode&&i.parentNode.removeChild(i),Z()})}};u.define(w)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const g=()=>BC.get("lib.pointer").exports,p=()=>BC.get("lib.view").exports,P={role:"interaction",type:"zoom",version:7,requires:["lib.pointer","lib.view"],params:{scales:{kind:"list",default:["x"]},wheel:{kind:"enum",values:["ctrl","always","off"],default:"ctrl"},fit:{kind:"list"},pan:{kind:"boolean",default:!0},maxZoom:{kind:"number",default:50}},attach(r,e){const a=(Array.isArray(r.scales)?r.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const o=!!e.scales[t]&&!!e.scales[t].invert&&e.orientation(t)!==null;return o||console.warn(`[blockcharts] interaction.zoom: scale "${t}" is not a continuous positional scale, ignored`),o});if(!a.length)return;const Z=(Array.isArray(r.fit)?r.fit:[]).filter(t=>{const o=typeof t=="string"&&!!e.scales[t]&&a.indexOf(t)<0;return!o&&typeof t=="string"&&console.warn(`[blockcharts] interaction.zoom: cannot fit scale "${t}"`),o}),y=()=>{for(const t of Z)e.setView(t,e.fit(t,a[0]))},h=r.wheel==="always"||r.wheel==="off"?r.wheel:"ctrl",A=r.pan!==!1,q=typeof r.maxZoom=="number"&&r.maxZoom>1?r.maxZoom:50,n=e.root,f=t=>g().toLogical(e,t),w=t=>g().inPlot(e,t),B=(t,o)=>e.orientation(t)==="horizontal"?o.x:o.y,L=t=>p().current(e,t),k=t=>{if(h==="off"||h==="ctrl"&&!(t.ctrlKey||t.metaKey))return;const o=f(t);if(!w(o))return;t.preventDefault();const s=t.deltaMode===1?t.deltaY*16:t.deltaY,i=Math.exp(s*.002);for(const c of a){const[u,x]=L(c),[b,m]=e.scales[c].range();p().zoom(e,c,i,q,u+(B(c,o)-b)/(m-b)*(x-u))}y()};let l=null;const E=t=>{if(t.button!==0||e.dragClaimed(t))return;const o=f(t);if(!w(o))return;const s={};for(const i of a)s[i]=L(i);l={x:o.x,y:o.y,start:s},n.setPointerCapture&&n.setPointerCapture(t.pointerId),n.style.cursor="grabbing"},C=t=>{if(!l)return;const o=f(t);for(const s of a){const[i,c]=l.start[s],[u,x]=e.scales[s].range(),m=-(e.orientation(s)==="horizontal"?o.x-l.x:o.y-l.y)/(x-u)*(c-i);p().show(e,s,i+m,c+m)}y()},d=()=>{l=null,n.style.cursor="grab"},z=t=>{if(w(f(t))){for(const o of a)e.setView(o,null);y()}};n.addEventListener("wheel",k,{passive:!1}),n.addEventListener("dblclick",z),A&&(n.addEventListener("pointerdown",E),n.addEventListener("pointermove",C),n.addEventListener("pointerup",d),n.addEventListener("pointercancel",d),n.style.cursor="grab"),e.cleanup(()=>{n.removeEventListener("wheel",k),n.removeEventListener("dblclick",z),n.removeEventListener("pointerdown",E),n.removeEventListener("pointermove",C),n.removeEventListener("pointerup",d),n.removeEventListener("pointercancel",d),n.style.cursor=""})}};BC.define(P)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(p){const h=()=>p.get("lib.pointer").exports,y=()=>p.get("lib.view").exports,A={role:"interaction",type:"zoom",version:7,requires:["lib.pointer","lib.view"],params:{scales:{kind:"list",default:["x"]},wheel:{kind:"enum",values:["ctrl","always","off"],default:"ctrl"},fit:{kind:"list"},pan:{kind:"boolean",default:!0},maxZoom:{kind:"number",default:50}},attach(r,e){const a=(Array.isArray(r.scales)?r.scales.filter(t=>typeof t=="string"):["x"]).filter(t=>{const o=!!e.scales[t]&&!!e.scales[t].invert&&e.orientation(t)!==null;return o||console.warn(`[blockcharts] interaction.zoom: scale "${t}" is not a continuous positional scale, ignored`),o});if(!a.length)return;const q=(Array.isArray(r.fit)?r.fit:[]).filter(t=>{const o=typeof t=="string"&&!!e.scales[t]&&a.indexOf(t)<0;return!o&&typeof t=="string"&&console.warn(`[blockcharts] interaction.zoom: cannot fit scale "${t}"`),o}),w=()=>{for(const t of q)e.setView(t,e.fit(t,a[0]))},L=r.wheel==="always"||r.wheel==="off"?r.wheel:"ctrl",C=r.pan!==!1,D=typeof r.maxZoom=="number"&&r.maxZoom>1?r.maxZoom:50,n=e.root,f=t=>h().toLogical(e,t),b=t=>h().inPlot(e,t),M=(t,o)=>e.orientation(t)==="horizontal"?o.x:o.y,k=t=>y().current(e,t),E=t=>{if(L==="off"||L==="ctrl"&&!(t.ctrlKey||t.metaKey))return;const o=f(t);if(!b(o))return;t.preventDefault();const s=t.deltaMode===1?t.deltaY*16:t.deltaY,i=Math.exp(s*.002);for(const c of a){const[u,g]=k(c),[x,m]=e.scales[c].range();y().zoom(e,c,i,D,u+(M(c,o)-x)/(m-x)*(g-u))}w()};let l=null;const z=t=>{if(t.button!==0||e.dragClaimed(t))return;const o=f(t);if(!b(o))return;const s={};for(const i of a)s[i]=k(i);l={x:o.x,y:o.y,start:s},n.setPointerCapture&&n.setPointerCapture(t.pointerId),n.style.cursor="grabbing"},P=t=>{if(!l)return;const o=f(t);for(const s of a){const[i,c]=l.start[s],[u,g]=e.scales[s].range(),m=-(e.orientation(s)==="horizontal"?o.x-l.x:o.y-l.y)/(g-u)*(c-i);y().show(e,s,i+m,c+m)}w()},d=()=>{l=null,n.style.cursor="grab"},Z=t=>{if(b(f(t))){for(const o of a)e.setView(o,null);w()}};n.addEventListener("wheel",E,{passive:!1}),n.addEventListener("dblclick",Z),C&&(n.addEventListener("pointerdown",z),n.addEventListener("pointermove",P),n.addEventListener("pointerup",d),n.addEventListener("pointercancel",d),n.style.cursor="grab"),e.cleanup(()=>{n.removeEventListener("wheel",E),n.removeEventListener("dblclick",Z),n.removeEventListener("pointerdown",z),n.removeEventListener("pointermove",P),n.removeEventListener("pointerup",d),n.removeEventListener("pointercancel",d),n.style.cursor=""})}};p.define(A)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function r(c,f,s,h,l){const o=e=>{throw new Error(c+": "+e)},a=e=>Object.prototype.hasOwnProperty.call(f.columns,e);for(const[e,n]of s)n!==void 0&&(typeof n!="string"||!a(n))&&o(`unknown field "${String(n)}" in "${e}"`);const t=new Map;for(const[e,n]of h)n==="__proto__"&&o(`a column cannot be named "__proto__": give "${e}" another name`),t.has(n)&&o(`"${t.get(n)}" and "${e}" both name the new column "${n}"`),t.set(n,e),a(n)&&l.indexOf(n)<0&&o(`"${n}" is already a column of the data: give the new one another name with "${e}"`)}const i={role:"lib",type:"columns",version:2,exports:{check:r}};BC.define(i)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(i){function r(c,f,l,h,m){const o=e=>{throw new Error(c+": "+e)},a=e=>Object.prototype.hasOwnProperty.call(f.columns,e);for(const[e,n]of l)n!==void 0&&(typeof n!="string"||!a(n))&&o(`unknown field "${String(n)}" in "${e}"`);const t=new Map;for(const[e,n]of h)n==="__proto__"&&o(`a column cannot be named "__proto__": give "${e}" another name`),t.has(n)&&o(`"${t.get(n)}" and "${e}" both name the new column "${n}"`),t.set(n,e),a(n)&&m.indexOf(n)<0&&o(`"${n}" is already a column of the data: give the new one another name with "${e}"`)}const s={role:"lib",type:"columns",version:2,exports:{check:r}};i.define(s)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const e=n=>Math.round(n*100)/100;function u(n,f){const l=n.length,r=[];for(let o=0;o<l-1;o++){const h=n[o+1]-n[o];r.push(h?(f[o+1]-f[o])/h:0)}const s=new Array(l);s[0]=r[0]||0,s[l-1]=r[l-2]||0;for(let o=1;o<l-1;o++)s[o]=r[o-1]*r[o]<=0?0:(r[o-1]+r[o])/2;for(let o=0;o<l-1;o++){if(!r[o]){s[o]=0,s[o+1]=0;continue}const h=s[o]/r[o],i=s[o+1]/r[o],t=h*h+i*i;if(t>9){const c=3/Math.sqrt(t);s[o]=c*h*r[o],s[o+1]=c*i*r[o]}}return s}function k(n,f,l,r){const s=n.length;let o="";if(l==="step"){if(r)for(let t=s-1;t>0;t--)o+="V"+e(f[t-1])+"H"+e(n[t-1]);else for(let t=1;t<s;t++)o+="H"+e(n[t])+"V"+e(f[t]);return o}if(!(l===!0||l==="smooth")||s<3){if(r)for(let t=s-2;t>=0;t--)o+="L"+e(n[t])+" "+e(f[t]);else for(let t=1;t<s;t++)o+="L"+e(n[t])+" "+e(f[t]);return o}const i=u(n,f);if(r)for(let t=s-1;t>0;t--){const c=(n[t]-n[t-1])/3;o+="C"+e(n[t]-c)+" "+e(f[t]-i[t]*c)+" "+e(n[t-1]+c)+" "+e(f[t-1]+i[t-1]*c)+" "+e(n[t-1])+" "+e(f[t-1])}else for(let t=0;t<s-1;t++){const c=(n[t+1]-n[t])/3;o+="C"+e(n[t]+c)+" "+e(f[t]+i[t]*c)+" "+e(n[t+1]-c)+" "+e(f[t+1]-i[t+1]*c)+" "+e(n[t+1])+" "+e(f[t+1])}return o}const d={role:"lib",type:"curve",version:2,exports:{through:k}};BC.define(d)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(u){const e=n=>Math.round(n*100)/100;function k(n,f){const c=n.length,r=[];for(let o=0;o<c-1;o++){const h=n[o+1]-n[o];r.push(h?(f[o+1]-f[o])/h:0)}const s=new Array(c);s[0]=r[0]||0,s[c-1]=r[c-2]||0;for(let o=1;o<c-1;o++)s[o]=r[o-1]*r[o]<=0?0:(r[o-1]+r[o])/2;for(let o=0;o<c-1;o++){if(!r[o]){s[o]=0,s[o+1]=0;continue}const h=s[o]/r[o],i=s[o+1]/r[o],t=h*h+i*i;if(t>9){const l=3/Math.sqrt(t);s[o]=l*h*r[o],s[o+1]=l*i*r[o]}}return s}function d(n,f,c,r){const s=n.length;let o="";if(c==="step"){if(r)for(let t=s-1;t>0;t--)o+="V"+e(f[t-1])+"H"+e(n[t-1]);else for(let t=1;t<s;t++)o+="H"+e(n[t])+"V"+e(f[t]);return o}if(!(c===!0||c==="smooth")||s<3){if(r)for(let t=s-2;t>=0;t--)o+="L"+e(n[t])+" "+e(f[t]);else for(let t=1;t<s;t++)o+="L"+e(n[t])+" "+e(f[t]);return o}const i=k(n,f);if(r)for(let t=s-1;t>0;t--){const l=(n[t]-n[t-1])/3;o+="C"+e(n[t]-l)+" "+e(f[t]-i[t]*l)+" "+e(n[t-1]+l)+" "+e(f[t-1]+i[t-1]*l)+" "+e(n[t-1])+" "+e(f[t-1])}else for(let t=0;t<s-1;t++){const l=(n[t+1]-n[t])/3;o+="C"+e(n[t]+l)+" "+e(f[t]+i[t]*l)+" "+e(n[t+1]-l)+" "+e(f[t+1]-i[t+1]*l)+" "+e(n[t+1])+" "+e(f[t+1])}return o}const g={role:"lib",type:"curve",version:2,exports:{through:d}};u.define(g)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function w(n,r){const e=n.root.getBoundingClientRect();return{x:(r.clientX-e.left)*n.size.w/e.width,y:(r.clientY-e.top)*n.size.h/e.height}}function y(n,r,e=0){const i=n.plot;return r.x>=i.x-e&&r.x<=i.x+i.w+e&&r.y>=i.y-e&&r.y<=i.y+i.h+e}function h(n){typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>n()):setTimeout(n,0)}function x(n,r,e,i){const o=n.root,d=n.host,u=d.ownerDocument||document;let s=null,a=!1,v=!1;const l=t=>t.pointerType==="touch",p=t=>{if(t.buttons&&!l(t))return s=null,e();s=t,!a&&(a=!0,h(()=>{if(a=!1,v||!s)return;const f=s;s=null;try{r(f)}catch{e()}}))},L=t=>{(!i||l(t))&&p(t)},c=()=>{s=null,e()},m=t=>{l(t)||c()},E=t=>{const f=t.target;l(t)&&f&&typeof d.contains=="function"&&!d.contains(f)&&c()};o.addEventListener("pointermove",p),o.addEventListener("pointerdown",L),o.addEventListener("pointerleave",m),o.addEventListener("pointercancel",c),o.addEventListener("wheel",c),typeof u.addEventListener=="function"&&u.addEventListener("pointerdown",E,!0),n.cleanup(()=>{v=!0,o.removeEventListener("pointermove",p),o.removeEventListener("pointerdown",L),o.removeEventListener("pointerleave",m),o.removeEventListener("pointercancel",c),o.removeEventListener("wheel",c),typeof u.removeEventListener=="function"&&u.removeEventListener("pointerdown",E,!0)})}const b={role:"lib",type:"pointer",version:2,exports:{toLogical:w,inPlot:y,follow:x}};BC.define(b)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(h){function w(n,r){const e=n.root.getBoundingClientRect();return{x:(r.clientX-e.left)*n.size.w/e.width,y:(r.clientY-e.top)*n.size.h/e.height}}function y(n,r,e=0){const i=n.plot;return r.x>=i.x-e&&r.x<=i.x+i.w+e&&r.y>=i.y-e&&r.y<=i.y+i.h+e}function x(n){typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>n()):setTimeout(n,0)}function b(n,r,e,i){const o=n.root,a=n.host,u=a.ownerDocument||document;let s=null,d=!1,v=!1;const l=t=>t.pointerType==="touch",p=t=>{if(t.buttons&&!l(t))return s=null,e();s=t,!d&&(d=!0,x(()=>{if(d=!1,v||!s)return;const f=s;s=null;try{r(f)}catch{e()}}))},L=t=>{(!i||l(t))&&p(t)},c=()=>{s=null,e()},m=t=>{l(t)||c()},E=t=>{const f=t.target;l(t)&&f&&typeof a.contains=="function"&&!a.contains(f)&&c()};o.addEventListener("pointermove",p),o.addEventListener("pointerdown",L),o.addEventListener("pointerleave",m),o.addEventListener("pointercancel",c),o.addEventListener("wheel",c),typeof u.addEventListener=="function"&&u.addEventListener("pointerdown",E,!0),n.cleanup(()=>{v=!0,o.removeEventListener("pointermove",p),o.removeEventListener("pointerdown",L),o.removeEventListener("pointerleave",m),o.removeEventListener("pointercancel",c),o.removeEventListener("wheel",c),typeof u.removeEventListener=="function"&&u.removeEventListener("pointerdown",E,!0)})}const g={role:"lib",type:"pointer",version:2,exports:{toLogical:w,inPlot:y,follow:b}};h.define(g)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function f(n){const i=n.length;if(i<2)return 0;let e=0;for(let t=0;t<i;t++)e+=n[t];e/=i;let s=0;for(let t=0;t<i;t++)s+=(n[t]-e)*(n[t]-e);const c=Math.sqrt(s/(i-1)),r=t=>{const a=t*(i-1),o=Math.floor(a);return n[o]+(n[Math.min(i-1,o+1)]-n[o])*(a-o)},l=r(.75)-r(.25);return l>0?Math.min(c,l/1.34):c}const u={role:"lib",type:"stats",version:1,exports:{spread:f}};BC.define(u)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(f){function u(n){const i=n.length;if(i<2)return 0;let e=0;for(let t=0;t<i;t++)e+=n[t];e/=i;let s=0;for(let t=0;t<i;t++)s+=(n[t]-e)*(n[t]-e);const l=Math.sqrt(s/(i-1)),c=t=>{const a=t*(i-1),o=Math.floor(a);return n[o]+(n[Math.min(i-1,o+1)]-n[o])*(a-o)},r=c(.75)-c(.25);return r>0?Math.min(l,r/1.34):l}const h={role:"lib",type:"stats",version:1,exports:{spread:u}};f.define(h)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function r(e,s){const a=e/Math.max(1,s),o=Math.pow(10,Math.floor(Math.log10(a))),t=a/o;return(t<1.5?1:t<3?2:t<7?5:10)*o}const M=1e3;function f(e,s,a){const o=Math.min(e,s),t=Math.max(e,s),i=[];if(!(isFinite(o)&&isFinite(t)&&t-o>1e-12*Math.max(Math.abs(o),Math.abs(t))))return i;const n=r(t-o,a);if(!(n>0&&isFinite(n)))return i;const h=Math.min(100,Math.max(0,-Math.floor(Math.log10(n)))),m=Math.ceil(o/n-1e-9),p=Math.floor(t/n+1e-9);for(let c=m;c<=p&&i.length<M;c++){const l=+(c*n).toFixed(h);i.push({value:l,label:l.toFixed(h)})}return i}const u={role:"lib",type:"ticks",version:2,exports:{niceStep:r,roundTicks:f}};BC.define(u)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(M){function h(s,e){const a=s/Math.max(1,e),o=Math.pow(10,Math.floor(Math.log10(a))),t=a/o;return(t<1.5?1:t<3?2:t<7?5:10)*o}const f=1e3;function u(s,e,a){const o=Math.min(s,e),t=Math.max(s,e),i=[];if(!(isFinite(o)&&isFinite(t)&&t-o>1e-12*Math.max(Math.abs(o),Math.abs(t))))return i;const n=h(t-o,a);if(!(n>0&&isFinite(n)))return i;const r=Math.min(100,Math.max(0,-Math.floor(Math.log10(n)))),p=Math.ceil(o/n-1e-9),x=Math.floor(t/n+1e-9);for(let c=p;c<=x&&i.length<f;c++){const l=+(c*n).toFixed(r);i.push({value:l,label:l.toFixed(r)})}return i}const m={role:"lib",type:"ticks",version:2,exports:{niceStep:h,roundTicks:u}};M.define(m)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function b(t){const s=t.baseDomain(),n=t(s[0]),i=t(s[1])-n;return!t.invert||!(isFinite(n)&&isFinite(i)&&i!==0)?null:{to:o=>(t(o)-n)/i,from:o=>o===0?s[0]:o===1?s[1]:t.invert(n+o*i),full:[0,1]}}function l(t,s){const n=b(t.scales[s]),i=t.getView()[s];return n?[n.to(i[0]),n.to(i[1])]:[0,1]}function p(t,s,n,i){const o=b(t.scales[s]);if(!o)return;const{from:u,full:c}=o,[f,e]=c;if(i-n>=(e-f)*(1-1e-9)){t.setView(s,null);return}n<f&&(i+=f-n,n=f),i>e&&(n-=i-e,i=e),t.setView(s,[u(n),u(i)])}function M(t,s,n,i,o){const u=b(t.scales[s]);if(!u)return;const[c,f]=u.full,[e,r]=l(t,s),w=Math.min(f-c,Math.max((f-c)/i,(r-e)*n));if(o===void 0||!(r>e)){const F=o===void 0?(e+r)/2:o;return p(t,s,F-w/2,F+w/2)}const V=w/(r-e);p(t,s,o-(o-e)*V,o+(r-o)*V)}const g={role:"lib",type:"view",version:2,exports:{current:l,show:p,zoom:M}};BC.define(g)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(F){function b(t){const s=t.baseDomain(),n=t(s[0]),i=t(s[1])-n;return!t.invert||!(isFinite(n)&&isFinite(i)&&i!==0)?null:{to:o=>(t(o)-n)/i,from:o=>o===0?s[0]:o===1?s[1]:t.invert(n+o*i),full:[0,1]}}function w(t,s){const n=b(t.scales[s]),i=t.getView()[s];return n?[n.to(i[0]),n.to(i[1])]:[0,1]}function l(t,s,n,i){const o=b(t.scales[s]);if(!o)return;const{from:u,full:c}=o,[f,e]=c;if(i-n>=(e-f)*(1-1e-9)){t.setView(s,null);return}n<f&&(i+=f-n,n=f),i>e&&(n-=i-e,i=e),t.setView(s,[u(n),u(i)])}function M(t,s,n,i,o){const u=b(t.scales[s]);if(!u)return;const[c,f]=u.full,[e,r]=w(t,s),p=Math.min(f-c,Math.max((f-c)/i,(r-e)*n));if(o===void 0||!(r>e)){const g=o===void 0?(e+r)/2:o;return l(t,s,g-p/2,g+p/2)}const V=p/(r-e);l(t,s,o-(o-e)*V,o+(r-o)*V)}const m={role:"lib",type:"view",version:2,exports:{current:w,show:l,zoom:M}};F.define(m)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const $=Math.PI*2,T="var(--bc-text, #444)",Z="var(--bc-kpi, var(--bc-text, #111))",z="var(--bc-grid, #edf0f4)",N=26,_=.03,M=t=>Math.round(t*100)/100,I=(t,e,l)=>Math.max(e,Math.min(l,t)),P=Math.PI/180,x=t=>typeof t=="number"&&isFinite(t)?t:void 0;function D(t){const e=x(t.startAngle)!==void 0?t.startAngle:0,l=x(t.endAngle)!==void 0?t.endAngle:e+360;if(!(l>e)||l-e>360)throw new Error(`mark.arc: endAngle ${l} has to be after startAngle ${e} and at most 360 degrees on (-90 to 90 is a half circle)`);return[e*P-Math.PI/2,l*P-Math.PI/2]}function S(t,e,l){const o=[],s=[],a=(r,n)=>{o.push(r*Math.cos(n)),s.push(r*Math.sin(n))};a(1,t),a(1,e),a(l,t),a(l,e);for(let r=Math.ceil(t/(Math.PI/2));r*(Math.PI/2)<=e;r++)a(1,r*(Math.PI/2));return{x0:Math.min(...o),x1:Math.max(...o),y0:Math.min(...s),y1:Math.max(...s)}}function p(t,e){const l=e.channel(t,"value").raw,o=t.color!==void 0?e.channel(t,"color").mapped:null,{from:s,to:a}=e.rows(t),r=[];let n=0;for(let d=s;d<a;d++){const f=l[d];typeof f!="number"||!isFinite(f)||f<=0||o&&!o[d]||(r.push(d),n+=f)}if(!r.length&&!((x(t.total)||0)>0))return null;t.sort==="desc"?r.sort((d,f)=>l[f]-l[d]||d-f):t.sort==="asc"&&r.sort((d,f)=>l[d]-l[f]||d-f);const h=t.label==="percent"||t.label==="value",{x:u,y:c,w:i,h:y}=e.plot,m=typeof t.innerRadius=="number"?I(t.innerRadius,0,.95):0,[g,v]=D(t),b=S(g,v,m),F=h?N:4,A=Math.max(1,Math.min((i-2*F)/(b.x1-b.x0),(y-2*F)/(b.y1-b.y0))),w=x(t.total);if(t.total!==void 0&&!(w!==void 0&&w>0))throw new Error(`mark.arc: total has to be a positive number (the maximum of a gauge), not ${JSON.stringify(t.total)}`);const L=w!==void 0?w:n,q=v-g;let k=g;const B=[];for(const d of r){if(k>=v)break;const f=l[d],C=f/L,O={row:d,a0:k,a1:Math.min(v,k+C*q),frac:C,value:f};k=O.a1,B.push(O)}return{cx:u+i/2-A*(b.x0+b.x1)/2,cy:c+y/2-A*(b.y0+b.y1)/2,R:A,r0:A*m,slices:B,start:g,end:v,sum:n,whole:L}}function R(t,e,l){const{cx:o,cy:s,R:a,r0:r}=t,n=(c,i)=>`${M(o+c*Math.cos(i))} ${M(s+c*Math.sin(i))}`;if(l-e>=$-1e-6){let c=`M${n(a,e)}A${a} ${a} 0 1 1 ${n(a,e+Math.PI)}A${a} ${a} 0 1 1 ${n(a,e)}Z`;return r>0&&(c+=`M${n(r,e)}A${r} ${r} 0 1 0 ${n(r,e+Math.PI)}A${r} ${r} 0 1 0 ${n(r,e)}Z`),c}const h=l-e>Math.PI?1:0,u=`M${n(a,e)}A${a} ${a} 0 ${h} 1 ${n(a,l)}`;return r>0?`${u}L${n(r,l)}A${r} ${r} 0 ${h} 0 ${n(r,e)}Z`:`${u}L${M(o)} ${M(s)}Z`}function E(t,e,l,o,s){return t.color!==void 0?e.channel(t,"color").mapped[o]||"":typeof t.fill=="string"?t.fill:e.color(l+s)}const U={role:"mark",type:"arc",version:7,enter:"pop",params:{innerRadius:{kind:"number",default:0},startAngle:{kind:"number",default:0},endAngle:{kind:"number"},total:{kind:"number"},center:{kind:"enum",values:["none","value","percent"],default:"none"},padAngle:{kind:"number",default:1},sort:{kind:"enum",values:["none","desc","asc"],default:"none"},label:{kind:"enum",values:["none","percent","value"],default:"none"},labelFormat:{kind:"format"},fill:{kind:"color"},opacity:{kind:"number",default:1}},channels:{value:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,e,l){const o=p(t,e);if(!o)return[];const s=(typeof t.padAngle=="number"?Math.max(0,t.padAngle):1)*Math.PI/180,a=typeof t.opacity=="number"?t.opacity:void 0,r=[];if(x(t.total)!==void 0&&r.push({type:"path",d:R(o,o.start,o.end),style:{fill:z},cls:"bc-arc-track"}),o.slices.forEach((n,h)=>{const u=E(t,e,l,n.row,h),c=o.slices.length>1?Math.min(s,(n.a1-n.a0)*.5):0;if(r.push({type:"path",d:R(o,n.a0+c/2,n.a1-c/2),style:{fill:u,opacity:a},ref:{mark:l,row:n.row}}),(t.label==="percent"||t.label==="value")&&n.frac>=_){const i=(n.a0+n.a1)/2,y=o.cx+(o.R+10)*Math.cos(i),m=o.cy+(o.R+10)*Math.sin(i),g=t.labelFormat!==void 0?BC.formatter(t.labelFormat)(t.label==="percent"?n.frac:n.value):t.label==="percent"?`${Math.round(n.frac*100)}%`:String(Number.isInteger(n.value)?n.value:+n.value.toPrecision(6));r.push({type:"text",x:M(y),y:M(m),text:g,size:11,anchor:Math.cos(i)>.2?"start":Math.cos(i)<-.2?"end":"middle",baseline:"middle",style:{fill:T}})}}),t.center==="value"||t.center==="percent"){const n=t.center==="percent"?o.sum/o.whole:o.sum,h=t.labelFormat!==void 0?BC.formatter(t.labelFormat)(n):t.center==="percent"?`${Math.round(n*100)}%`:BC.formatter("compact")(n),u=o.r0>0?o.r0:o.R*.6;let c=I(u*.45,10,44);const i=e.measure(h,c).w;i>u*1.6&&(c=Math.max(10,c*u*1.6/i));const m=Math.PI/2+Math.ceil((o.start-Math.PI/2)/$)*$<=o.end;r.push({type:"text",x:M(o.cx),y:M(m?o.cy:o.cy-4),text:h,size:M(c),weight:650,anchor:"middle",baseline:m?"middle":"auto",style:{fill:Z},cls:"bc-arc-center"})}return r},pick(t,e,l,o,s){const a=p(t,e);if(!a)return null;const r=o-a.cx,n=s-a.cy,h=Math.hypot(r,n);if(h>a.R||h<a.r0)return null;let u=Math.atan2(n,r)-a.start;u=(u%$+$)%$;const c=a.start+u;for(const i of a.slices)if(c>=i.a0&&c<i.a1){const y=(i.a0+i.a1)/2,m=(a.R+a.r0)/2;return{row:i.row,x:a.cx+m*Math.cos(y),y:a.cy+m*Math.sin(y),dist:0}}return null},color(t,e,l,o){const s=p(t,e),a=s?s.slices.findIndex(r=>r.row===o):-1;return a<0?"":E(t,e,l,o,a)}};BC.define(U)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(A){const $=Math.PI*2,N="var(--bc-text, #444)",_="var(--bc-kpi, var(--bc-text, #111))",D="var(--bc-grid, #edf0f4)",S=26,U=.03,M=t=>Math.round(t*100)/100,P=(t,e,l)=>Math.max(e,Math.min(l,t)),R=Math.PI/180,x=t=>typeof t=="number"&&isFinite(t)?t:void 0;function q(t){const e=x(t.startAngle)!==void 0?t.startAngle:0,l=x(t.endAngle)!==void 0?t.endAngle:e+360;if(!(l>e)||l-e>360)throw new Error(`mark.arc: endAngle ${l} has to be after startAngle ${e} and at most 360 degrees on (-90 to 90 is a half circle)`);return[e*R-Math.PI/2,l*R-Math.PI/2]}function G(t,e,l){const o=[],s=[],a=(r,n)=>{o.push(r*Math.cos(n)),s.push(r*Math.sin(n))};a(1,t),a(1,e),a(l,t),a(l,e);for(let r=Math.ceil(t/(Math.PI/2));r*(Math.PI/2)<=e;r++)a(1,r*(Math.PI/2));return{x0:Math.min(...o),x1:Math.max(...o),y0:Math.min(...s),y1:Math.max(...s)}}function I(t,e){const l=e.channel(t,"value").raw,o=t.color!==void 0?e.channel(t,"color").mapped:null,{from:s,to:a}=e.rows(t),r=[];let n=0;for(let d=s;d<a;d++){const f=l[d];typeof f!="number"||!isFinite(f)||f<=0||o&&!o[d]||(r.push(d),n+=f)}if(!r.length&&!((x(t.total)||0)>0))return null;t.sort==="desc"?r.sort((d,f)=>l[f]-l[d]||d-f):t.sort==="asc"&&r.sort((d,f)=>l[d]-l[f]||d-f);const h=t.label==="percent"||t.label==="value",{x:u,y:c,w:i,h:y}=e.plot,m=typeof t.innerRadius=="number"?P(t.innerRadius,0,.95):0,[g,v]=q(t),b=G(g,v,m),L=h?S:4,w=Math.max(1,Math.min((i-2*L)/(b.x1-b.x0),(y-2*L)/(b.y1-b.y0))),k=x(t.total);if(t.total!==void 0&&!(k!==void 0&&k>0))throw new Error(`mark.arc: total has to be a positive number (the maximum of a gauge), not ${JSON.stringify(t.total)}`);const T=k!==void 0?k:n,K=v-g;let p=g;const O=[];for(const d of r){if(p>=v)break;const f=l[d],Z=f/T,z={row:d,a0:p,a1:Math.min(v,p+Z*K),frac:Z,value:f};p=z.a1,O.push(z)}return{cx:u+i/2-w*(b.x0+b.x1)/2,cy:c+y/2-w*(b.y0+b.y1)/2,R:w,r0:w*m,slices:O,start:g,end:v,sum:n,whole:T}}function E(t,e,l){const{cx:o,cy:s,R:a,r0:r}=t,n=(c,i)=>`${M(o+c*Math.cos(i))} ${M(s+c*Math.sin(i))}`;if(l-e>=$-1e-6){let c=`M${n(a,e)}A${a} ${a} 0 1 1 ${n(a,e+Math.PI)}A${a} ${a} 0 1 1 ${n(a,e)}Z`;return r>0&&(c+=`M${n(r,e)}A${r} ${r} 0 1 0 ${n(r,e+Math.PI)}A${r} ${r} 0 1 0 ${n(r,e)}Z`),c}const h=l-e>Math.PI?1:0,u=`M${n(a,e)}A${a} ${a} 0 ${h} 1 ${n(a,l)}`;return r>0?`${u}L${n(r,l)}A${r} ${r} 0 ${h} 0 ${n(r,e)}Z`:`${u}L${M(o)} ${M(s)}Z`}function F(t,e,l,o,s){return t.color!==void 0?e.channel(t,"color").mapped[o]||"":typeof t.fill=="string"?t.fill:e.color(l+s)}const J={role:"mark",type:"arc",version:7,enter:"pop",params:{innerRadius:{kind:"number",default:0},startAngle:{kind:"number",default:0},endAngle:{kind:"number"},total:{kind:"number"},center:{kind:"enum",values:["none","value","percent"],default:"none"},padAngle:{kind:"number",default:1},sort:{kind:"enum",values:["none","desc","asc"],default:"none"},label:{kind:"enum",values:["none","percent","value"],default:"none"},labelFormat:{kind:"format"},fill:{kind:"color"},opacity:{kind:"number",default:1}},channels:{value:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,e,l){const o=I(t,e);if(!o)return[];const s=(typeof t.padAngle=="number"?Math.max(0,t.padAngle):1)*Math.PI/180,a=typeof t.opacity=="number"?t.opacity:void 0,r=[];if(x(t.total)!==void 0&&r.push({type:"path",d:E(o,o.start,o.end),style:{fill:D},cls:"bc-arc-track"}),o.slices.forEach((n,h)=>{const u=F(t,e,l,n.row,h),c=o.slices.length>1?Math.min(s,(n.a1-n.a0)*.5):0;if(r.push({type:"path",d:E(o,n.a0+c/2,n.a1-c/2),style:{fill:u,opacity:a},ref:{mark:l,row:n.row}}),(t.label==="percent"||t.label==="value")&&n.frac>=U){const i=(n.a0+n.a1)/2,y=o.cx+(o.R+10)*Math.cos(i),m=o.cy+(o.R+10)*Math.sin(i),g=t.labelFormat!==void 0?A.formatter(t.labelFormat)(t.label==="percent"?n.frac:n.value):t.label==="percent"?`${Math.round(n.frac*100)}%`:String(Number.isInteger(n.value)?n.value:+n.value.toPrecision(6));r.push({type:"text",x:M(y),y:M(m),text:g,size:11,anchor:Math.cos(i)>.2?"start":Math.cos(i)<-.2?"end":"middle",baseline:"middle",style:{fill:N}})}}),t.center==="value"||t.center==="percent"){const n=t.center==="percent"?o.sum/o.whole:o.sum,h=t.labelFormat!==void 0?A.formatter(t.labelFormat)(n):t.center==="percent"?`${Math.round(n*100)}%`:A.formatter("compact")(n),u=o.r0>0?o.r0:o.R*.6;let c=P(u*.45,10,44);const i=e.measure(h,c).w;i>u*1.6&&(c=Math.max(10,c*u*1.6/i));const m=Math.PI/2+Math.ceil((o.start-Math.PI/2)/$)*$<=o.end;r.push({type:"text",x:M(o.cx),y:M(m?o.cy:o.cy-4),text:h,size:M(c),weight:650,anchor:"middle",baseline:m?"middle":"auto",style:{fill:_},cls:"bc-arc-center"})}return r},pick(t,e,l,o,s){const a=I(t,e);if(!a)return null;const r=o-a.cx,n=s-a.cy,h=Math.hypot(r,n);if(h>a.R||h<a.r0)return null;let u=Math.atan2(n,r)-a.start;u=(u%$+$)%$;const c=a.start+u;for(const i of a.slices)if(c>=i.a0&&c<i.a1){const y=(i.a0+i.a1)/2,m=(a.R+a.r0)/2;return{row:i.row,x:a.cx+m*Math.cos(y),y:a.cy+m*Math.sin(y),dist:0}}return null},color(t,e,l,o){const s=I(t,e),a=s?s.slices.findIndex(r=>r.row===o):-1;return a<0?"":F(t,e,l,o,a)}};A.define(J)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const v=t=>Math.round(t*100)/100,q=(t,e,a,o)=>BC.get("lib.curve").exports.through(t,e,a,o);function j(t,e){const a=t(e);return isFinite(a)?a:t(Math.min(...t.domain()))}const C=new WeakMap,O=new WeakMap;function B(t,e){const a=e.channel(t,"y"),o=e.channel(t,"y2"),l=typeof t.baseline=="number"?t.baseline:0,n=o.raw.length?NaN:t.toBottom===!0?e.plot.y+e.plot.h:a.scale?j(a.scale,l):NaN,r=e.channel(t,"x");let u=r.half?C.get(r):r.mapped;return u||C.set(r,u=Array.from(r.mapped,p=>p+r.half)),{xs:u,top:a.mapped,bottom:p=>o.raw.length?o.mapped[p]:n}}function W(t,e,a,o,l){return typeof t.fill=="string"?t.fill:t.color!==void 0?e.channel(t,"color").mapped[o[0]]||"":e.color(a+l)}const E={role:"mark",type:"area",version:16,requires:["lib.curve"],series:!0,enter:"wipe",narrow:!0,params:{baseline:{kind:"number",default:0},group:{kind:"field"},fill:{kind:"color"},opacity:{kind:"number",default:.85},toBottom:{kind:"boolean",default:!1},fade:{kind:"boolean",default:!1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,e,a){const{xs:o,top:l,bottom:n}=B(t,e),r=t.fade===!0,u=typeof t.opacity=="number"?t.opacity:r?.45:.85,p=t.curve==="smooth"||t.curve==="step"?t.curve:"linear",w=[];return e.series(t,o).forEach(({rows:y},s)=>{const d=W(t,e,a,y,s);if(!d)return;let m="",i=[];const f=()=>{if(i.length){const c=i.map(b=>o[b]),M=i.map(b=>l[b]),g=i.map(b=>n(b)),k=i.length-1;m+="M"+v(c[0])+" "+v(M[0])+q(c,M,p,!1),m+="L"+v(c[k])+" "+v(g[k])+q(c,g,p,!0),m+="Z"}i=[]};for(const c of y)isFinite(o[c])&&isFinite(l[c])&&isFinite(n(c))?i.push(c):f();f(),m&&w.push({type:"path",d:m,style:r?{fill:d,fillOpacity:u,fade:!0}:{fill:d,fillOpacity:u,stroke:d,strokeWidth:1,strokeLinejoin:"round"}})}),w},pick(t,e,a,o,l){const{xs:n,top:r,bottom:u}=B(t,e),p=t.color!==void 0?e.channel(t,"color"):null;let w=null;for(const{rows:y}of e.series(t,n)){if(p&&!p.mapped[y[0]])continue;let s=O.get(y);if(s||O.set(y,s=y.filter(h=>isFinite(n[h])&&isFinite(r[h])&&isFinite(u(h)))),!s.length||o<n[s[0]]||o>n[s[s.length-1]])continue;let d=0,m=s.length-1;for(;d<m;){const h=d+m+1>>1;n[s[h]]<=o?d=h:m=h-1}const i=s[d],f=s[Math.min(d+1,s.length-1)],c=n[f]-n[i],M=c>0?Math.min(1,Math.max(0,(o-n[i])/c)):0,g=o<n[f]?i:f,k=t.curve==="step",b=k?r[g]:r[i]+(r[f]-r[i])*M,A=k?u(g):u(i)+(u(f)-u(i))*M;if(l<Math.min(b,A)-1||l>Math.max(b,A)+1)continue;const L=h=>n[h]>=e.plot.x-.5&&n[h]<=e.plot.x+e.plot.w+.5,N=k?g:Math.abs(o-n[i])<=Math.abs(o-n[f])?i:f,F=L(N)?N:N===i?f:i;L(F)&&(w={row:F,x:n[F],y:r[F],dist:0})}return w},color(t,e,a,o){const l=e.series(t,B(t,e).xs);for(let n=0;n<l.length;n++)if(l[n].rows.includes(o))return W(t,e,a,l[n].rows,n);return""}};BC.define(E)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(B){const v=t=>Math.round(t*100)/100,O=(t,e,l,o)=>B.get("lib.curve").exports.through(t,e,l,o);function C(t,e){const l=t(e);return isFinite(l)?l:t(Math.min(...t.domain()))}const W=new WeakMap,A=new WeakMap;function N(t,e){const l=e.channel(t,"y"),o=e.channel(t,"y2"),a=typeof t.baseline=="number"?t.baseline:0,n=o.raw.length?NaN:t.toBottom===!0?e.plot.y+e.plot.h:l.scale?C(l.scale,a):NaN,r=e.channel(t,"x");let u=r.half?W.get(r):r.mapped;return u||W.set(r,u=Array.from(r.mapped,p=>p+r.half)),{xs:u,top:l.mapped,bottom:p=>o.raw.length?o.mapped[p]:n}}function L(t,e,l,o,a){return typeof t.fill=="string"?t.fill:t.color!==void 0?e.channel(t,"color").mapped[o[0]]||"":e.color(l+a)}const E={role:"mark",type:"area",version:16,requires:["lib.curve"],series:!0,enter:"wipe",narrow:!0,params:{baseline:{kind:"number",default:0},group:{kind:"field"},fill:{kind:"color"},opacity:{kind:"number",default:.85},toBottom:{kind:"boolean",default:!1},fade:{kind:"boolean",default:!1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,e,l){const{xs:o,top:a,bottom:n}=N(t,e),r=t.fade===!0,u=typeof t.opacity=="number"?t.opacity:r?.45:.85,p=t.curve==="smooth"||t.curve==="step"?t.curve:"linear",w=[];return e.series(t,o).forEach(({rows:y},s)=>{const d=L(t,e,l,y,s);if(!d)return;let m="",i=[];const f=()=>{if(i.length){const c=i.map(b=>o[b]),M=i.map(b=>a[b]),g=i.map(b=>n(b)),k=i.length-1;m+="M"+v(c[0])+" "+v(M[0])+O(c,M,p,!1),m+="L"+v(c[k])+" "+v(g[k])+O(c,g,p,!0),m+="Z"}i=[]};for(const c of y)isFinite(o[c])&&isFinite(a[c])&&isFinite(n(c))?i.push(c):f();f(),m&&w.push({type:"path",d:m,style:r?{fill:d,fillOpacity:u,fade:!0}:{fill:d,fillOpacity:u,stroke:d,strokeWidth:1,strokeLinejoin:"round"}})}),w},pick(t,e,l,o,a){const{xs:n,top:r,bottom:u}=N(t,e),p=t.color!==void 0?e.channel(t,"color"):null;let w=null;for(const{rows:y}of e.series(t,n)){if(p&&!p.mapped[y[0]])continue;let s=A.get(y);if(s||A.set(y,s=y.filter(h=>isFinite(n[h])&&isFinite(r[h])&&isFinite(u(h)))),!s.length||o<n[s[0]]||o>n[s[s.length-1]])continue;let d=0,m=s.length-1;for(;d<m;){const h=d+m+1>>1;n[s[h]]<=o?d=h:m=h-1}const i=s[d],f=s[Math.min(d+1,s.length-1)],c=n[f]-n[i],M=c>0?Math.min(1,Math.max(0,(o-n[i])/c)):0,g=o<n[f]?i:f,k=t.curve==="step",b=k?r[g]:r[i]+(r[f]-r[i])*M,T=k?u(g):u(i)+(u(f)-u(i))*M;if(a<Math.min(b,T)-1||a>Math.max(b,T)+1)continue;const j=h=>n[h]>=e.plot.x-.5&&n[h]<=e.plot.x+e.plot.w+.5,q=k?g:Math.abs(o-n[i])<=Math.abs(o-n[f])?i:f,F=j(q)?q:q===i?f:i;j(F)&&(w={row:F,x:n[F],y:r[F],dist:0})}return w},color(t,e,l,o){const a=e.series(t,N(t,e).xs);for(let n=0;n<a.length;n++)if(a[n].rows.includes(o))return L(t,e,l,a[n].rows,n);return""}};B.define(E)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function L(t,n,c){const i=t.color!==void 0?n.channel(t,"color").mapped:null,m=typeof t.fill=="string"&&t.fill||n.color(c);return r=>i?i[r]||"":m}const T="var(--bc-text, #333)",v={role:"mark",type:"boxplot",version:5,params:{width:{kind:"number",default:.6},fill:{kind:"color"},fillOpacity:{kind:"number",default:.85},strokeWidth:{kind:"number",default:1.5},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},low:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q1:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},median:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q3:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}}},render(t,n,c){const i=n.channel(t,"x"),m=n.channel(t,"low"),r=n.channel(t,"q1"),W=n.channel(t,"median"),O=n.channel(t,"q3"),S=n.channel(t,"high"),H=L(t,n,c),b=i.scale&&i.scale.bandwidth!==void 0?i.scale.bandwidth:0,a=typeof t.width=="number"&&t.width>0?t.width:.6,s=b?a<=1?b*a:Math.min(a,b):a>1?a:16,$=b/2,Q=typeof t.fillOpacity=="number"?t.fillOpacity:.85,M=typeof t.strokeWidth=="number"?t.strokeWidth:1.5,F=typeof t.opacity=="number"?t.opacity:void 0,{from:y,to:e}=n.rows(t),l=[];for(let o=y;o<e;o++){const u=m.mapped[o],d=r.mapped[o],w=W.mapped[o],h=O.mapped[o],p=S.mapped[o];if(!isFinite(u)||!isFinite(d)||!isFinite(w)||!isFinite(h)||!isFinite(p))continue;const g=i.mapped[o];if(!isFinite(g))continue;const k=H(o);if(!k)continue;const q=g+$,f=q-s/2,x=q+s/2,B=Math.min(d,h),C=Math.abs(d-h);l.push({type:"path",ref:{mark:c,row:o},d:`M${q} ${u}L${q} ${p}M${f} ${u}L${x} ${u}M${f} ${p}L${x} ${p}`,style:{stroke:k,strokeWidth:M,opacity:F}}),l.push({type:"rect",x:f,y:B,w:s,h:C,style:{fill:k,fillOpacity:Q,stroke:k,strokeWidth:M,opacity:F},ref:{mark:c,row:o}}),l.push({type:"path",d:`M${f} ${w}L${x} ${w}`,style:{stroke:T,strokeWidth:M+.5,opacity:F}})}return l},pick(t,n,c,i,m){const r=n.channel(t,"x"),W=n.channel(t,"low"),O=n.channel(t,"q1"),S=n.channel(t,"q3"),H=n.channel(t,"high"),b=L(t,n,c),a=r.scale&&r.scale.bandwidth!==void 0?r.scale.bandwidth:0,s=typeof t.width=="number"&&t.width>0?t.width:.6,$=a?s<=1?a*s:Math.min(s,a):s>1?s:16,Q=a/2,{from:M,to:F}=n.rows(t),y=4;for(let e=F-1;e>=M;e--){if(!b(e))continue;const l=W.mapped[e],o=O.mapped[e],u=S.mapped[e],d=H.mapped[e],w=r.mapped[e];if(!isFinite(l)||!isFinite(o)||!isFinite(u)||!isFinite(d)||!isFinite(w))continue;const h=w+Q,p=h-$/2,g=h+$/2,k=Math.min(l,d)-y,q=Math.max(l,d)+y;if(i>=p-y&&i<=g+y&&m>=k&&m<=q){const f=Math.min(o,u),x=Math.abs(o-u);return{row:e,x:h,y:f,dist:0,box:{x:p,y:f,w:$,h:x}}}}return null},color(t,n,c,i){return L(t,n,c)(i)}};BC.define(v)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(T){function L(t,n,c){const i=t.color!==void 0?n.channel(t,"color").mapped:null,m=typeof t.fill=="string"&&t.fill||n.color(c);return r=>i?i[r]||"":m}const v="var(--bc-text, #333)",B={role:"mark",type:"boxplot",version:5,params:{width:{kind:"number",default:.6},fill:{kind:"color"},fillOpacity:{kind:"number",default:.85},strokeWidth:{kind:"number",default:1.5},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},low:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q1:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},median:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},q3:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}}},render(t,n,c){const i=n.channel(t,"x"),m=n.channel(t,"low"),r=n.channel(t,"q1"),W=n.channel(t,"median"),O=n.channel(t,"q3"),S=n.channel(t,"high"),H=L(t,n,c),b=i.scale&&i.scale.bandwidth!==void 0?i.scale.bandwidth:0,a=typeof t.width=="number"&&t.width>0?t.width:.6,s=b?a<=1?b*a:Math.min(a,b):a>1?a:16,$=b/2,Q=typeof t.fillOpacity=="number"?t.fillOpacity:.85,M=typeof t.strokeWidth=="number"?t.strokeWidth:1.5,F=typeof t.opacity=="number"?t.opacity:void 0,{from:y,to:e}=n.rows(t),l=[];for(let o=y;o<e;o++){const u=m.mapped[o],d=r.mapped[o],w=W.mapped[o],h=O.mapped[o],p=S.mapped[o];if(!isFinite(u)||!isFinite(d)||!isFinite(w)||!isFinite(h)||!isFinite(p))continue;const x=i.mapped[o];if(!isFinite(x))continue;const k=H(o);if(!k)continue;const q=x+$,f=q-s/2,g=q+s/2,C=Math.min(d,h),Y=Math.abs(d-h);l.push({type:"path",ref:{mark:c,row:o},d:`M${q} ${u}L${q} ${p}M${f} ${u}L${g} ${u}M${f} ${p}L${g} ${p}`,style:{stroke:k,strokeWidth:M,opacity:F}}),l.push({type:"rect",x:f,y:C,w:s,h:Y,style:{fill:k,fillOpacity:Q,stroke:k,strokeWidth:M,opacity:F},ref:{mark:c,row:o}}),l.push({type:"path",d:`M${f} ${w}L${g} ${w}`,style:{stroke:v,strokeWidth:M+.5,opacity:F}})}return l},pick(t,n,c,i,m){const r=n.channel(t,"x"),W=n.channel(t,"low"),O=n.channel(t,"q1"),S=n.channel(t,"q3"),H=n.channel(t,"high"),b=L(t,n,c),a=r.scale&&r.scale.bandwidth!==void 0?r.scale.bandwidth:0,s=typeof t.width=="number"&&t.width>0?t.width:.6,$=a?s<=1?a*s:Math.min(s,a):s>1?s:16,Q=a/2,{from:M,to:F}=n.rows(t),y=4;for(let e=F-1;e>=M;e--){if(!b(e))continue;const l=W.mapped[e],o=O.mapped[e],u=S.mapped[e],d=H.mapped[e],w=r.mapped[e];if(!isFinite(l)||!isFinite(o)||!isFinite(u)||!isFinite(d)||!isFinite(w))continue;const h=w+Q,p=h-$/2,x=h+$/2,k=Math.min(l,d)-y,q=Math.max(l,d)+y;if(i>=p-y&&i<=x+y&&m>=k&&m<=q){const f=Math.min(o,u),g=Math.abs(o-u);return{row:e,x:h,y:f,dist:0,box:{x:p,y:f,w:$,h:g}}}}return null},color(t,n,c,i){return L(t,n,c)(i)}};T.define(B)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const w="var(--bc-good, #12a150)",y="var(--bc-bad, #e5484d)";function x(t){const e=t.slice().sort((i,o)=>i-o);let s=1/0;for(let i=1;i<e.length;i++){const o=e[i]-e[i-1];o>1e-6&&o<s&&(s=o)}return s===1/0?0:s}function m(t,e){const s=e.channel(t,"x"),i=e.channel(t,"open"),o=e.channel(t,"high"),a=e.channel(t,"low"),l=e.channel(t,"close"),c=s.scale&&s.scale.bandwidth!==void 0?s.scale.bandwidth:0,{from:n,to:u}=e.rows(t),h=[];for(let r=n;r<u;r++){const d={row:r,x:s.mapped[r]+c/2,open:i.mapped[r],high:o.mapped[r],low:a.mapped[r],close:l.mapped[r]};![i,o,a,l].every(g=>typeof g.raw[r]=="number")||![d.x,d.open,d.high,d.low,d.close].every(isFinite)||h.push({...d,up:d.close<=d.open})}const p=c||x(h.map(r=>r.x))||e.plot.w*.1,f=typeof t.width=="number"&&t.width>0?Math.min(1,t.width):.7;return{candles:h,width:Math.max(1,p*f),step:p}}function b(t,e){return e.up?typeof t.up=="string"?t.up:w:typeof t.down=="string"?t.down:y}const k={role:"mark",type:"candlestick",version:4,params:{width:{kind:"number",default:.7},up:{kind:"color",default:w},down:{kind:"color",default:y},strokeWidth:{kind:"number",default:1},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},open:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},low:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},close:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"}},render(t,e,s){const{candles:i,width:o}=m(t,e),a=typeof t.opacity=="number"?t.opacity:void 0,l=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:1,c=[];for(const n of i){const u=b(t,n);c.push({type:"path",d:`M${n.x} ${n.high}L${n.x} ${n.low}`,style:{stroke:u,strokeWidth:l,opacity:a}}),c.push({type:"rect",x:n.x-o/2,y:Math.min(n.open,n.close),w:o,h:Math.max(1,Math.abs(n.open-n.close)),style:{fill:u,opacity:a},ref:{mark:s,row:n.row}})}return c},pick(t,e,s,i){const{candles:o,width:a,step:l}=m(t,e),c=Math.max(a/2,Math.min(l/2,12));let n=null,u=1/0;for(const f of o){const r=Math.abs(f.x-i);r<=c&&r<u&&(n=f,u=r)}if(!n)return null;const h=Math.min(n.open,n.close),p=Math.max(1,Math.abs(n.open-n.close));return{row:n.row,x:n.x,y:h,dist:u,box:{x:n.x-a/2,y:h,w:a,h:p}}},color(t,e,s,i){const o=m(t,e).candles.find(a=>a.row===i);return o?b(t,o):""}};BC.define(k)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(x){const w="var(--bc-good, #12a150)",y="var(--bc-bad, #e5484d)";function k(t){const e=t.slice().sort((i,o)=>i-o);let s=1/0;for(let i=1;i<e.length;i++){const o=e[i]-e[i-1];o>1e-6&&o<s&&(s=o)}return s===1/0?0:s}function m(t,e){const s=e.channel(t,"x"),i=e.channel(t,"open"),o=e.channel(t,"high"),a=e.channel(t,"low"),d=e.channel(t,"close"),c=s.scale&&s.scale.bandwidth!==void 0?s.scale.bandwidth:0,{from:n,to:u}=e.rows(t),h=[];for(let r=n;r<u;r++){const l={row:r,x:s.mapped[r]+c/2,open:i.mapped[r],high:o.mapped[r],low:a.mapped[r],close:d.mapped[r]};![i,o,a,d].every(M=>typeof M.raw[r]=="number")||![l.x,l.open,l.high,l.low,l.close].every(isFinite)||h.push({...l,up:l.close<=l.open})}const p=c||k(h.map(r=>r.x))||e.plot.w*.1,f=typeof t.width=="number"&&t.width>0?Math.min(1,t.width):.7;return{candles:h,width:Math.max(1,p*f),step:p}}function b(t,e){return e.up?typeof t.up=="string"?t.up:w:typeof t.down=="string"?t.down:y}const g={role:"mark",type:"candlestick",version:4,params:{width:{kind:"number",default:.7},up:{kind:"color",default:w},down:{kind:"color",default:y},strokeWidth:{kind:"number",default:1},opacity:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position"}},open:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},high:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},low:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"},close:{required:!0,accepts:{output:"position",input:["number"]},sharesScale:"y"}},render(t,e,s){const{candles:i,width:o}=m(t,e),a=typeof t.opacity=="number"?t.opacity:void 0,d=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:1,c=[];for(const n of i){const u=b(t,n);c.push({type:"path",d:`M${n.x} ${n.high}L${n.x} ${n.low}`,style:{stroke:u,strokeWidth:d,opacity:a}}),c.push({type:"rect",x:n.x-o/2,y:Math.min(n.open,n.close),w:o,h:Math.max(1,Math.abs(n.open-n.close)),style:{fill:u,opacity:a},ref:{mark:s,row:n.row}})}return c},pick(t,e,s,i){const{candles:o,width:a,step:d}=m(t,e),c=Math.max(a/2,Math.min(d/2,12));let n=null,u=1/0;for(const f of o){const r=Math.abs(f.x-i);r<=c&&r<u&&(n=f,u=r)}if(!n)return null;const h=Math.min(n.open,n.close),p=Math.max(1,Math.abs(n.open-n.close));return{row:n.row,x:n.x,y:h,dist:u,box:{x:n.x-a/2,y:h,w:a,h:p}}},color(t,e,s,i){const o=m(t,e).candles.find(a=>a.row===i);return o?b(t,o):""}};x.define(g)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const S=n=>Math.round(n*100)/100;function L(n,e){const l=e.channel(n,"x");if(!l.half)return l.mapped;let o=_.get(l);return o||_.set(l,o=Array.from(l.mapped,t=>t+l.half)),o}const _=new WeakMap,F=new WeakMap;function B(n,e,l,o,t){return typeof n.stroke=="string"?n.stroke:n.color!==void 0?e.channel(n,"color").mapped[o[0]]||"":e.color(l+t)}function W(n,e,l){const o=n.label==="name"||n.label==="value"||n.label==="both"?n.label:"none";if(o==="none")return[];const t=L(n,e),r=e.channel(n,"y"),s=r.mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=typeof n.group=="string"||!!(M&&M.field),A=o==="value"||o==="both"?n.format!==void 0?BC.formatter(n.format):i=>String(typeof i=="number"?+i.toPrecision(6):i):null,{x:b,y:c,w:a,h:m}=e.plot,v=i=>t[i]<=b+a+.5&&s[i]>=c-.5&&s[i]<=c+m+.5,f=[];return e.series(n,t).forEach(({key:i,rows:h},g)=>{const k=B(n,e,l,h,g);if(!k)return;let d=-1;for(const w of h)isFinite(t[w])&&isFinite(s[w])&&v(w)&&(d=w);if(d<0)return;const y=E?String(i):typeof n.name=="string"?n.name:r.field||"",p=A?A(r.raw[d]):"",u=o==="name"?y:o==="value"?p:y&&p?`${y} ${p}`:y||p;u&&f.push({x:t[d],y:s[d],text:u,color:k,owner:l})}),f}function R(n,e,l){n.sort((t,r)=>t.y-r.y);for(let t=1;t<n.length;t++)n[t].y=Math.max(n[t].y,n[t-1].y+14);const o=n.length?n[n.length-1].y-l:0;if(o>0)for(const t of n)t.y-=o;for(let t=0;t<n.length;t++)n[t].y=Math.max(n[t].y,e+t*14)}const q=(n,e,l,o)=>BC.get("lib.curve").exports.through(n,e,l,o),G={role:"mark",type:"line",version:23,requires:["lib.curve"],series:!0,enter:"wipe",narrow:n=>n.label!=="name"&&n.label!=="value"&&n.label!=="both",params:{group:{kind:"field"},stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"},label:{kind:"enum",values:["none","name","value","both"],default:"none"},format:{kind:"format"},name:{kind:"string"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color",input:["category"]}}},render(n,e,l){const o=L(n,e),t=e.channel(n,"y").mapped,r=n.color!==void 0?e.channel(n,"color"):null,s=typeof n.group=="string"||!!(r&&r.field),M=typeof n.strokeWidth=="number"?n.strokeWidth:2,E=Array.isArray(n.dash)?n.dash:void 0,A=typeof n.opacity=="number"?n.opacity:void 0,b=n.curve==="smooth"||n.curve==="step"?n.curve:"linear",c=[];return e.series(n,o).forEach(({key:a,rows:m},v)=>{let f="",i=[],h=[];const g=()=>{i.length&&(f+="M"+S(i[0])+" "+S(h[0])+q(i,h,b,!1)),i=[],h=[]};for(const d of m){const y=o[d],p=t[d];if(!isFinite(y)||!isFinite(p)){g();continue}i.push(y),h.push(p)}if(g(),!f)return;const k=B(n,e,l,m,v);k&&c.push({type:"path",d:f,title:s?String(a):void 0,style:{fill:"none",stroke:k,strokeWidth:M,strokeDash:E,opacity:A,strokeLinejoin:"round",strokeLinecap:"round"}})}),c},labels(n,e,l){if(!W(n,e,l).length)return[];const o=[];return e.spec.marks.forEach((t,r)=>{t.type==="line"&&o.push(...W(t,e,r))}),R(o,e.plot.y,e.plot.y+e.plot.h),o.filter(t=>t.owner===l).map(t=>({type:"text",x:t.x+8,y:t.y,text:t.text,size:11,weight:600,anchor:"start",baseline:"middle",style:{fill:t.color},cls:"bc-line-label"}))},pick(n,e,l,o,t){const r=L(n,e),s=e.channel(n,"y").mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=e.alongX?1/0:14,A=c=>r[c]>=e.plot.x-.5&&r[c]<=e.plot.x+e.plot.w+.5;let b=null;for(const{rows:c}of e.series(n,r)){if(M&&!M.mapped[c[0]])continue;let a=F.get(c);if(a||F.set(c,a=c.filter(u=>isFinite(r[u])&&isFinite(s[u]))),!a.length||o<r[a[0]]-14||o>r[a[a.length-1]]+14)continue;let m=0,v=a.length-1;for(;m<v;){const u=m+v+1>>1;r[a[u]]<=o?m=u:v=u-1}const f=a[m],i=a[Math.min(m+1,a.length-1)];let h,g;if(n.curve==="step"){const u=(P,C)=>t>=Math.min(s[P],s[C])&&t<=Math.max(s[P],s[C])?Math.abs(o-r[C]):1/0,w=Math.abs(t-(o<r[i]?s[f]:s[i])),I=u(a[Math.max(0,m-1)],f),H=u(f,i);h=Math.min(w,I,H),g=H>h&&(o<r[i]||I===h)}else{const u=r[i]-r[f],w=u>0?Math.min(1,Math.max(0,(o-r[f])/u)):0;h=Math.abs(t-(s[f]+(s[i]-s[f])*w)),g=Math.abs(o-r[f])<=Math.abs(o-r[i])}if(h>E||b&&h>=b.dist)continue;A(g?f:i)||(g=!g);const k=g?f:i;if(!A(k))continue;b={row:k,x:r[k],y:s[k],dist:h};let d=g?m:Math.min(m+1,a.length-1),y=d;const p=u=>r[a[u]]===r[k]&&s[a[u]]===s[k];for(;d>0&&p(d-1);)d--;for(;y<a.length-1&&p(y+1);)y++;y>d&&(b.rows=a.slice(d,y+1))}return b},color(n,e,l,o){const t=e.series(n,L(n,e));for(let r=0;r<t.length;r++)if(t[r].rows.includes(o))return B(n,e,l,t[r].rows,r);return""}};BC.define(G)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(S){const C=n=>Math.round(n*100)/100;function L(n,e){const l=e.channel(n,"x");if(!l.half)return l.mapped;let o=F.get(l);return o||F.set(l,o=Array.from(l.mapped,t=>t+l.half)),o}const F=new WeakMap,W=new WeakMap;function _(n,e,l,o,t){return typeof n.stroke=="string"?n.stroke:n.color!==void 0?e.channel(n,"color").mapped[o[0]]||"":e.color(l+t)}function I(n,e,l){const o=n.label==="name"||n.label==="value"||n.label==="both"?n.label:"none";if(o==="none")return[];const t=L(n,e),r=e.channel(n,"y"),s=r.mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=typeof n.group=="string"||!!(M&&M.field),A=o==="value"||o==="both"?n.format!==void 0?S.formatter(n.format):i=>String(typeof i=="number"?+i.toPrecision(6):i):null,{x:b,y:c,w:a,h:m}=e.plot,v=i=>t[i]<=b+a+.5&&s[i]>=c-.5&&s[i]<=c+m+.5,f=[];return e.series(n,t).forEach(({key:i,rows:h},g)=>{const k=_(n,e,l,h,g);if(!k)return;let d=-1;for(const w of h)isFinite(t[w])&&isFinite(s[w])&&v(w)&&(d=w);if(d<0)return;const y=E?String(i):typeof n.name=="string"?n.name:r.field||"",p=A?A(r.raw[d]):"",u=o==="name"?y:o==="value"?p:y&&p?`${y} ${p}`:y||p;u&&f.push({x:t[d],y:s[d],text:u,color:k,owner:l})}),f}function q(n,e,l){n.sort((t,r)=>t.y-r.y);for(let t=1;t<n.length;t++)n[t].y=Math.max(n[t].y,n[t-1].y+14);const o=n.length?n[n.length-1].y-l:0;if(o>0)for(const t of n)t.y-=o;for(let t=0;t<n.length;t++)n[t].y=Math.max(n[t].y,e+t*14)}const G=(n,e,l,o)=>S.get("lib.curve").exports.through(n,e,l,o),O={role:"mark",type:"line",version:23,requires:["lib.curve"],series:!0,enter:"wipe",narrow:n=>n.label!=="name"&&n.label!=="value"&&n.label!=="both",params:{group:{kind:"field"},stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},curve:{kind:"enum",values:["linear","smooth","step"],default:"linear"},label:{kind:"enum",values:["none","name","value","both"],default:"none"},format:{kind:"format"},name:{kind:"string"}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color",input:["category"]}}},render(n,e,l){const o=L(n,e),t=e.channel(n,"y").mapped,r=n.color!==void 0?e.channel(n,"color"):null,s=typeof n.group=="string"||!!(r&&r.field),M=typeof n.strokeWidth=="number"?n.strokeWidth:2,E=Array.isArray(n.dash)?n.dash:void 0,A=typeof n.opacity=="number"?n.opacity:void 0,b=n.curve==="smooth"||n.curve==="step"?n.curve:"linear",c=[];return e.series(n,o).forEach(({key:a,rows:m},v)=>{let f="",i=[],h=[];const g=()=>{i.length&&(f+="M"+C(i[0])+" "+C(h[0])+G(i,h,b,!1)),i=[],h=[]};for(const d of m){const y=o[d],p=t[d];if(!isFinite(y)||!isFinite(p)){g();continue}i.push(y),h.push(p)}if(g(),!f)return;const k=_(n,e,l,m,v);k&&c.push({type:"path",d:f,title:s?String(a):void 0,style:{fill:"none",stroke:k,strokeWidth:M,strokeDash:E,opacity:A,strokeLinejoin:"round",strokeLinecap:"round"}})}),c},labels(n,e,l){if(!I(n,e,l).length)return[];const o=[];return e.spec.marks.forEach((t,r)=>{t.type==="line"&&o.push(...I(t,e,r))}),q(o,e.plot.y,e.plot.y+e.plot.h),o.filter(t=>t.owner===l).map(t=>({type:"text",x:t.x+8,y:t.y,text:t.text,size:11,weight:600,anchor:"start",baseline:"middle",style:{fill:t.color},cls:"bc-line-label"}))},pick(n,e,l,o,t){const r=L(n,e),s=e.channel(n,"y").mapped,M=n.color!==void 0?e.channel(n,"color"):null,E=e.alongX?1/0:14,A=c=>r[c]>=e.plot.x-.5&&r[c]<=e.plot.x+e.plot.w+.5;let b=null;for(const{rows:c}of e.series(n,r)){if(M&&!M.mapped[c[0]])continue;let a=W.get(c);if(a||W.set(c,a=c.filter(u=>isFinite(r[u])&&isFinite(s[u]))),!a.length||o<r[a[0]]-14||o>r[a[a.length-1]]+14)continue;let m=0,v=a.length-1;for(;m<v;){const u=m+v+1>>1;r[a[u]]<=o?m=u:v=u-1}const f=a[m],i=a[Math.min(m+1,a.length-1)];let h,g;if(n.curve==="step"){const u=(R,B)=>t>=Math.min(s[R],s[B])&&t<=Math.max(s[R],s[B])?Math.abs(o-r[B]):1/0,w=Math.abs(t-(o<r[i]?s[f]:s[i])),H=u(a[Math.max(0,m-1)],f),P=u(f,i);h=Math.min(w,H,P),g=P>h&&(o<r[i]||H===h)}else{const u=r[i]-r[f],w=u>0?Math.min(1,Math.max(0,(o-r[f])/u)):0;h=Math.abs(t-(s[f]+(s[i]-s[f])*w)),g=Math.abs(o-r[f])<=Math.abs(o-r[i])}if(h>E||b&&h>=b.dist)continue;A(g?f:i)||(g=!g);const k=g?f:i;if(!A(k))continue;b={row:k,x:r[k],y:s[k],dist:h};let d=g?m:Math.min(m+1,a.length-1),y=d;const p=u=>r[a[u]]===r[k]&&s[a[u]]===s[k];for(;d>0&&p(d-1);)d--;for(;y<a.length-1&&p(y+1);)y++;y>d&&(b.rows=a.slice(d,y+1))}return b},color(n,e,l,o){const t=e.series(n,L(n,e));for(let r=0;r<t.length;r++)if(t[r].rows.includes(o))return _(n,e,l,t[r].rows,r);return""}};S.define(O)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function E(t,o){if(t.size!==void 0){const r=o.channel(t,"size").mapped;return c=>r[c]}const a=typeof t.r=="number"?t.r:3;return()=>a}function W(t,o,a){const r=t.color!==void 0?o.channel(t,"color").mapped:null,c=typeof t.fill=="string"?t.fill:o.color(a);return i=>r?r[i]||"":c}function A(t,o,a){const{from:r,to:c}=o.rows(t),i=[];for(let h=r;h<c;h++)i.push(h);if(t.size!==void 0){const h=m=>{const f=a(m);return isFinite(f)?f:-1};i.sort((m,f)=>h(f)-h(m)||m-f)}return i}const D=new WeakMap;function H(t,o,a){if(t.swarm!==!0)return null;const r=o.channel(t,"x"),c=o.channel(t,"y"),i=!!(r.scale&&r.scale.bandwidth!==void 0),h=!!(c.scale&&c.scale.bandwidth!==void 0);if(i===h)throw new Error("mark.point: swarm spreads the points of a category across its band, so one of x and y needs a band scale and the other a value");const m=D.get(i?c:r);if(m)return m;const f=i?r.mapped:c.mapped,g=(i?r:c).scale.bandwidth/2,l=i?c.mapped:r.mapped,s=typeof t.swarmGap=="number"&&t.swarmGap>=0?t.swarmGap:1,p=typeof t.swarmShrink=="number"&&t.swarmShrink>=0?Math.min(t.swarmShrink,.9):.5,d=new Float64Array(l.length),u=[],b=new Map,{from:x,to:v}=o.rows(t);for(let n=x;n<v;n++){if(!isFinite(f[n])||!isFinite(l[n])||!isFinite(a(n)))continue;const w=b.get(f[n]);w?w.push(n):(b.set(f[n],[n]),u.push(b.get(f[n])))}for(const n of u)n.sort((w,k)=>l[w]-l[k]||w-k);const y=(n,w)=>{const k=s*n;for(const S of u){let B=0;for(const M of S)B=Math.max(B,a(M)*n);const C=[];let I=0,P=0;for(const M of S){const O=a(M)*n,J=Math.max(0,g-O);for(;I<C.length&&l[C[I]]<l[M]-O-B-k;)I++;const K=C.slice(I),L=X=>K.every(z=>{const Y=O+a(z)*n+k,q=l[M]-l[z],G=X-d[z];return q*q+G*G>=Y*Y-1e-6});let $=0;if(!L(0)){$=1/0;for(const X of K){const z=O+a(X)*n+k,Y=l[M]-l[X];if(Math.abs(Y)>=z)continue;const q=Math.sqrt(z*z-Y*Y);for(const G of[d[X]+q,d[X]-q])Math.abs(G)<=J&&Math.abs(G)<Math.abs($)&&L(G)&&($=G)}}if(isFinite($))d[M]=$,C.push(M);else{if(w)return!1;d[M]=J*(P++*.618034%1*2-1)}}}return!0};let e=1;if(p>0&&!y(1,!0)){let n=1-p;if(y(n,!0)){let w=1;for(let k=0;k<8;k++){const S=(n+w)/2;y(S,!0)?n=S:w=S}}e=n}y(e,!1);const F={across:i?"x":"y",shift:d,k:e};return D.set(i?c:r,F),F}const N={role:"mark",type:"point",version:16,narrow:!0,params:{r:{kind:"number",default:3},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"string"},swarm:{kind:"boolean",default:!1},swarmGap:{kind:"number",default:1},swarmShrink:{kind:"number",default:.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},color:{accepts:{output:"color"}},size:{accepts:{output:"size"}}},render(t,o,a){const r=o.channel(t,"x"),c=o.channel(t,"y"),i=r.half,h=c.half,m=E(t,o),f=typeof t.opacity=="number"?t.opacity:void 0,g=typeof t.stroke=="string"?t.stroke:void 0,l=W(t,o,a),s=H(t,o,m),p=f===void 0||f>=1?new Set:null,d=[];for(const u of A(t,o,m)){const b=r.mapped[u]+(s&&s.across==="x"?s.shift[u]:0),x=c.mapped[u]+(s&&s.across==="y"?s.shift[u]:0),v=m(u)*(s?s.k:1);if(!isFinite(b)||!isFinite(x)||!isFinite(v))continue;const y=l(u);if(y){if(p){const e=`${b},${x},${v},${y}`;if(p.has(e))continue;p.add(e)}d.push({type:"circle",cx:b+i,cy:x+h,r:v,style:g?{fill:y,opacity:f,stroke:g,strokeWidth:1}:{fill:y,opacity:f},ref:{mark:a,row:u}})}}return d},pick(t,o,a,r,c){const i=o.channel(t,"x"),h=o.channel(t,"y"),m=i.half,f=h.half,g=E(t,o),l=W(t,o,a),s=H(t,o,g);let p=-1,d=1/0,u=0,b=0;for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0),w=g(e)*(s?s.k:1);if(!isFinite(F)||!isFinite(n)||!isFinite(w)||!l(e))continue;const k=Math.max(0,Math.hypot(F-r,n-c)-w);k<=d&&(d=k,p=e,u=F,b=n)}if(p<0||d>6)return null;const x=g(p),v=l(p),y=[];for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0);F===u&&n===b&&g(e)===x&&l(e)===v&&y.push(e)}return y.length>1?{row:p,x:u,y:b,dist:d,rows:y}:{row:p,x:u,y:b,dist:d}},color(t,o,a,r){return W(t,o,a)(r)}};BC.define(N)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(L){function E(t,o){if(t.size!==void 0){const r=o.channel(t,"size").mapped;return c=>r[c]}const a=typeof t.r=="number"?t.r:3;return()=>a}function W(t,o,a){const r=t.color!==void 0?o.channel(t,"color").mapped:null,c=typeof t.fill=="string"?t.fill:o.color(a);return i=>r?r[i]||"":c}function A(t,o,a){const{from:r,to:c}=o.rows(t),i=[];for(let h=r;h<c;h++)i.push(h);if(t.size!==void 0){const h=m=>{const f=a(m);return isFinite(f)?f:-1};i.sort((m,f)=>h(f)-h(m)||m-f)}return i}const T=new WeakMap;function D(t,o,a){if(t.swarm!==!0)return null;const r=o.channel(t,"x"),c=o.channel(t,"y"),i=!!(r.scale&&r.scale.bandwidth!==void 0),h=!!(c.scale&&c.scale.bandwidth!==void 0);if(i===h)throw new Error("mark.point: swarm spreads the points of a category across its band, so one of x and y needs a band scale and the other a value");const m=T.get(i?c:r);if(m)return m;const f=i?r.mapped:c.mapped,g=(i?r:c).scale.bandwidth/2,l=i?c.mapped:r.mapped,s=typeof t.swarmGap=="number"&&t.swarmGap>=0?t.swarmGap:1,p=typeof t.swarmShrink=="number"&&t.swarmShrink>=0?Math.min(t.swarmShrink,.9):.5,d=new Float64Array(l.length),u=[],b=new Map,{from:x,to:v}=o.rows(t);for(let n=x;n<v;n++){if(!isFinite(f[n])||!isFinite(l[n])||!isFinite(a(n)))continue;const w=b.get(f[n]);w?w.push(n):(b.set(f[n],[n]),u.push(b.get(f[n])))}for(const n of u)n.sort((w,k)=>l[w]-l[k]||w-k);const y=(n,w)=>{const k=s*n;for(const S of u){let B=0;for(const M of S)B=Math.max(B,a(M)*n);const C=[];let I=0,P=0;for(const M of S){const O=a(M)*n,H=Math.max(0,g-O);for(;I<C.length&&l[C[I]]<l[M]-O-B-k;)I++;const J=C.slice(I),K=X=>J.every(z=>{const Y=O+a(z)*n+k,q=l[M]-l[z],G=X-d[z];return q*q+G*G>=Y*Y-1e-6});let $=0;if(!K(0)){$=1/0;for(const X of J){const z=O+a(X)*n+k,Y=l[M]-l[X];if(Math.abs(Y)>=z)continue;const q=Math.sqrt(z*z-Y*Y);for(const G of[d[X]+q,d[X]-q])Math.abs(G)<=H&&Math.abs(G)<Math.abs($)&&K(G)&&($=G)}}if(isFinite($))d[M]=$,C.push(M);else{if(w)return!1;d[M]=H*(P++*.618034%1*2-1)}}}return!0};let e=1;if(p>0&&!y(1,!0)){let n=1-p;if(y(n,!0)){let w=1;for(let k=0;k<8;k++){const S=(n+w)/2;y(S,!0)?n=S:w=S}}e=n}y(e,!1);const F={across:i?"x":"y",shift:d,k:e};return T.set(i?c:r,F),F}const N={role:"mark",type:"point",version:16,narrow:!0,params:{r:{kind:"number",default:3},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"string"},swarm:{kind:"boolean",default:!1},swarmGap:{kind:"number",default:1},swarmShrink:{kind:"number",default:.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},color:{accepts:{output:"color"}},size:{accepts:{output:"size"}}},render(t,o,a){const r=o.channel(t,"x"),c=o.channel(t,"y"),i=r.half,h=c.half,m=E(t,o),f=typeof t.opacity=="number"?t.opacity:void 0,g=typeof t.stroke=="string"?t.stroke:void 0,l=W(t,o,a),s=D(t,o,m),p=f===void 0||f>=1?new Set:null,d=[];for(const u of A(t,o,m)){const b=r.mapped[u]+(s&&s.across==="x"?s.shift[u]:0),x=c.mapped[u]+(s&&s.across==="y"?s.shift[u]:0),v=m(u)*(s?s.k:1);if(!isFinite(b)||!isFinite(x)||!isFinite(v))continue;const y=l(u);if(y){if(p){const e=`${b},${x},${v},${y}`;if(p.has(e))continue;p.add(e)}d.push({type:"circle",cx:b+i,cy:x+h,r:v,style:g?{fill:y,opacity:f,stroke:g,strokeWidth:1}:{fill:y,opacity:f},ref:{mark:a,row:u}})}}return d},pick(t,o,a,r,c){const i=o.channel(t,"x"),h=o.channel(t,"y"),m=i.half,f=h.half,g=E(t,o),l=W(t,o,a),s=D(t,o,g);let p=-1,d=1/0,u=0,b=0;for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0),w=g(e)*(s?s.k:1);if(!isFinite(F)||!isFinite(n)||!isFinite(w)||!l(e))continue;const k=Math.max(0,Math.hypot(F-r,n-c)-w);k<=d&&(d=k,p=e,u=F,b=n)}if(p<0||d>6)return null;const x=g(p),v=l(p),y=[];for(const e of A(t,o,g)){const F=i.mapped[e]+m+(s&&s.across==="x"?s.shift[e]:0),n=h.mapped[e]+f+(s&&s.across==="y"?s.shift[e]:0);F===u&&n===b&&g(e)===x&&l(e)===v&&y.push(e)}return y.length>1?{row:p,x:u,y:b,dist:d,rows:y}:{row:p,x:u,y:b,dist:d}},color(t,o,a,r){return W(t,o,a)(r)}};L.define(N)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const h=n=>Math.round(n*100)/100;function y(n,t,l){const s=t.channel(n,"x").mapped,e=t.channel(n,"y").mapped,o=n.color!==void 0?t.channel(n,"color").mapped:null,r=typeof n.group=="string"?t.table.columns[n.group]:void 0,i=typeof n.ring=="string"?t.table.columns[n.ring]:void 0,d=typeof n.fill=="string"?n.fill:t.color(l),{from:g,to:a}=t.rows(n),c=new Map;for(let u=g;u<a;u++){const k=r?r[u]:null;let f=c.get(k);f||c.set(k,f={row:u,rings:[],ringKey:{}});const p=i?i[u]:null;(p!==f.ringKey||!f.rings.length)&&(f.rings.push([]),f.ringKey=p),isFinite(s[u])&&isFinite(e[u])&&f.rings[f.rings.length-1].push([s[u],e[u]])}const m=[];return c.forEach((u,k)=>{const f=o?o[u.row]:d;if(!f)return;const p=u.rings.filter(W=>W.length>2);p.length&&m.push({row:u.row,rings:p,color:f,key:k})}),m}function w(n,t,l){let s=0;for(const e of n)for(let o=0,r=e.length-1;o<e.length;r=o++){const[i,d]=e[r],[g,a]=e[o],c=(g-i)*(l-d)-(t-i)*(a-d);d<=l?a>l&&c>0&&s++:a<=l&&c<0&&s--}return s}const b={role:"mark",type:"polygon",version:4,params:{group:{kind:"field"},ring:{kind:"field"},filled:{kind:"boolean",default:!0},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"color"},strokeWidth:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position",input:["number","date"]}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color"}}},render(n,t,l){const s=n.filled!==!1,e=typeof n.opacity=="number"?n.opacity:void 0,o=typeof n.strokeWidth=="number"?n.strokeWidth:1,r=typeof n.stroke=="string"?n.stroke:void 0;return y(n,t,l).map(i=>({type:"path",d:i.rings.map(d=>"M"+d.map(([g,a])=>`${h(g)} ${h(a)}`).join("L")+"Z").join(""),style:s?{fill:i.color,fillOpacity:e,stroke:r,strokeWidth:r?o:void 0,strokeLinejoin:"round"}:{fill:"none",stroke:i.color,strokeWidth:o,strokeLinejoin:"round"},ref:{mark:l,row:i.row}}))},pick(n,t,l,s,e){const o=y(n,t,l);for(let r=o.length-1;r>=0;r--)if(w(o[r].rings,s,e)!==0)return{row:o[r].row,x:s,y:e,dist:0};return null},color(n,t,l,s){const e=typeof n.group=="string"?t.table.columns[n.group]:void 0,o=e?e[s]:null,r=y(n,t,l).find(i=>i.key===o||i.key!==i.key&&o!==o);return r?r.color:""}};BC.define(b)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(b){const h=n=>Math.round(n*100)/100;function y(n,t,l){const s=t.channel(n,"x").mapped,e=t.channel(n,"y").mapped,o=n.color!==void 0?t.channel(n,"color").mapped:null,r=typeof n.group=="string"?t.table.columns[n.group]:void 0,i=typeof n.ring=="string"?t.table.columns[n.ring]:void 0,d=typeof n.fill=="string"?n.fill:t.color(l),{from:c,to:a}=t.rows(n),g=new Map;for(let u=c;u<a;u++){const k=r?r[u]:null;let f=g.get(k);f||g.set(k,f={row:u,rings:[],ringKey:{}});const p=i?i[u]:null;(p!==f.ringKey||!f.rings.length)&&(f.rings.push([]),f.ringKey=p),isFinite(s[u])&&isFinite(e[u])&&f.rings[f.rings.length-1].push([s[u],e[u]])}const m=[];return g.forEach((u,k)=>{const f=o?o[u.row]:d;if(!f)return;const p=u.rings.filter(j=>j.length>2);p.length&&m.push({row:u.row,rings:p,color:f,key:k})}),m}function w(n,t,l){let s=0;for(const e of n)for(let o=0,r=e.length-1;o<e.length;r=o++){const[i,d]=e[r],[c,a]=e[o],g=(c-i)*(l-d)-(t-i)*(a-d);d<=l?a>l&&g>0&&s++:a<=l&&g<0&&s--}return s}const W={role:"mark",type:"polygon",version:4,params:{group:{kind:"field"},ring:{kind:"field"},filled:{kind:"boolean",default:!0},fill:{kind:"color"},opacity:{kind:"number",default:1},stroke:{kind:"color"},strokeWidth:{kind:"number",default:1}},channels:{x:{required:!0,accepts:{output:"position",input:["number","date"]}},y:{required:!0,accepts:{output:"position",input:["number","date"]}},color:{accepts:{output:"color"}}},render(n,t,l){const s=n.filled!==!1,e=typeof n.opacity=="number"?n.opacity:void 0,o=typeof n.strokeWidth=="number"?n.strokeWidth:1,r=typeof n.stroke=="string"?n.stroke:void 0;return y(n,t,l).map(i=>({type:"path",d:i.rings.map(d=>"M"+d.map(([c,a])=>`${h(c)} ${h(a)}`).join("L")+"Z").join(""),style:s?{fill:i.color,fillOpacity:e,stroke:r,strokeWidth:r?o:void 0,strokeLinejoin:"round"}:{fill:"none",stroke:i.color,strokeWidth:o,strokeLinejoin:"round"},ref:{mark:l,row:i.row}}))},pick(n,t,l,s,e){const o=y(n,t,l);for(let r=o.length-1;r>=0;r--)if(w(o[r].rings,s,e)!==0)return{row:o[r].row,x:s,y:e,dist:0};return null},color(n,t,l,s){const e=typeof n.group=="string"?t.table.columns[n.group]:void 0,o=e?e[s]:null,r=y(n,t,l).find(i=>i.key===o||i.key!==i.key&&o!==o);return r?r.color:""}};b.define(W)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function M(t,n,r,e){if(n.dodge===void 0)return null;const i=t.channel(n,"dodge").raw,o=new Map;for(let c=r;c<e;c++){const d=i[c];d==null||o.has(d)||o.set(d,o.size)}if(o.size<=1)return null;const a=typeof n.dodgePadding=="number"?Math.max(0,Math.min(.9,n.dodgePadding)):.1;return{col:i,order:o,padding:a}}function k(t,n,r){const e=t.color!==void 0?n.channel(t,"color").mapped:null,i=typeof t.fill=="string"?t.fill:n.color(r);return o=>e?e[o]||"":i}function $(t,n){const r=t(n);return isFinite(r)?r:t(Math.min(...t.domain()))}const x=.8,L=.1;function S(t,n,r){const e=r==="x"?"y":"x",i=t.channel(n,r),o=t.channel(n,e);return!i.scale||!o.scale||i.scale.bandwidth!==void 0||o.scale.bandwidth!==void 0||t.channel(n,r+"2").raw.length?!1:r==="y"?i.scale.input==="date"&&o.scale.input!=="date":!!t.channel(n,"y2").raw.length||o.scale.input!=="date"||i.scale.input==="date"}function v(t){const n=t.filter(e=>isFinite(e)).sort((e,i)=>e-i);let r=1/0;for(let e=1;e<n.length;e++)n[e]>n[e-1]&&n[e]-n[e-1]<r&&(r=n[e]-n[e-1]);return{lo:n[0],hi:n[n.length-1],step:r===1/0?0:r}}function A(t,n,r){const e=[];for(let o=n;o<r;o++)isFinite(t[o])&&e.push(t[o]);e.sort((o,a)=>o-a);let i=1/0;for(let o=1;o<e.length;o++)e[o]-e[o-1]>1e-6&&e[o]-e[o-1]<i&&(i=e[o]-e[o-1]);return i===1/0?0:i}function w(t,n,r,e,i){const o=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):1,a=t.channel(n,r),c=t.channel(n,r+"2"),d=a.scale?a.scale.bandwidth:void 0;if(S(t,n,r)){const{from:h,to:m}=t.rows(n),y=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):x,l=Math.max(1,(A(a.mapped,h,m)||t.plot.w*L)*y);return s=>isFinite(a.mapped[s])?[a.mapped[s]-l/2,l]:null}const b=!c.raw.length&&d===void 0&&a.scale?$(a.scale,e):NaN;return h=>{const m=a.mapped[h];let y,l;if(d!==void 0)if(i){const s=i.order.get(i.col[h]);if(s===void 0)return null;const u=d/i.order.size,f=u*i.padding;y=m+s*u+f/2,l=u-f}else y=m+d*(1-o)/2,l=d*o;else c.raw.length?(y=Math.min(m,c.mapped[h]),l=Math.abs(c.mapped[h]-m)):(y=Math.min(m,b),l=Math.abs(m-b));return isFinite(y)&&isFinite(l)?[y,l]:null}}const g=t=>Math.round(t*100)/100;function F(t,n){const[r,e]=t,[i,o]=n,a=g(r+e/2),c=g(r),d=g(r+e),b=g(i+o/4),h=g(i+3*o/4);return`M${a} ${g(i)}L${d} ${b}L${d} ${h}L${a} ${g(i+o)}L${c} ${h}L${c} ${b}Z`}const z={role:"mark",type:"rect",version:17,enter:"grow",narrow:!0,params:{baseline:{kind:"number",default:0},fill:{kind:"color"},opacity:{kind:"number",default:1},radius:{kind:"number",default:0},shape:{kind:"enum",values:["rect","hexagon"],default:"rect"},thickness:{kind:"number",default:1},dodgePadding:{kind:"number",default:.1}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}},dodge:{unscaled:!0}},render(t,n,r){const e=typeof t.baseline=="number"?t.baseline:0,i=typeof t.opacity=="number"?t.opacity:void 0,o=typeof t.radius=="number"&&t.radius>0?t.radius:void 0,a=t.shape==="hexagon",{from:c,to:d}=n.rows(t),b=M(n,t,c,d),h=w(n,t,"x",e,b),m=w(n,t,"y",e,b),y=k(t,n,r),l=[];for(let s=c;s<d;s++){const u=h(s),f=m(s);if(!u||!f)continue;const p=y(s);p&&(a?l.push({type:"path",d:F(u,f),style:{fill:p,opacity:i},ref:{mark:r,row:s}}):l.push({type:"rect",x:u[0],y:f[0],w:u[1],h:f[1],r:o,style:{fill:p,opacity:i},ref:{mark:r,row:s}}))}return l},reach(t,n,r){if(n!=="x"&&n!=="y")return null;const e=n==="x"?"y":"x",i=r.scale(n),o=r.scale(e),a=r.column(n);if(!i||!o||!a||!i.even||o.input==="category"||t[n+"2"]!==void 0||!(n==="y"?i.input==="date"&&o.input!=="date":t.y2!==void 0||o.input!=="date"||i.input==="date"))return null;const d=Array.from(a,s=>i.input==="date"?BC.time(s):typeof s=="number"?s:NaN),{lo:b,hi:h,step:m}=v(d);if(!m)return null;const y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):x,l=m*y/2;return[b-l,h+l]},pick(t,n,r,e,i){const o=typeof t.baseline=="number"?t.baseline:0,{from:a,to:c}=n.rows(t),d=M(n,t,a,c),b=w(n,t,"x",o,d),h=w(n,t,"y",o,d),m=k(t,n,r),y=t.shape==="hexagon",l=2;for(let s=c-1;s>=a;s--){if(!m(s))continue;const u=b(s),f=h(s);if(!(!u||!f)){if(y){const p=Math.abs(e-(u[0]+u[1]/2))/(u[1]/2),N=Math.abs(i-(f[0]+f[1]/2))/(f[1]/2);if(p<=1&&N<=1-p/2)return{row:s,x:u[0]+u[1]/2,y:f[0]+f[1]/2,dist:0};continue}if(e>=u[0]-l&&e<=u[0]+u[1]+l&&i>=f[0]-l&&i<=f[0]+f[1]+l)return{row:s,x:u[0]+u[1]/2,y:f[0],dist:0,box:{x:u[0],y:f[0],w:u[1],h:f[1]}}}}return null},color(t,n,r,e){return k(t,n,r)(e)}};BC.define(z)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(M){function x(t,n,r,e){if(n.dodge===void 0)return null;const i=t.channel(n,"dodge").raw,o=new Map;for(let c=r;c<e;c++){const d=i[c];d==null||o.has(d)||o.set(d,o.size)}if(o.size<=1)return null;const a=typeof n.dodgePadding=="number"?Math.max(0,Math.min(.9,n.dodgePadding)):.1;return{col:i,order:o,padding:a}}function k(t,n,r){const e=t.color!==void 0?n.channel(t,"color").mapped:null,i=typeof t.fill=="string"?t.fill:n.color(r);return o=>e?e[o]||"":i}function L(t,n){const r=t(n);return isFinite(r)?r:t(Math.min(...t.domain()))}const $=.8,S=.1;function v(t,n,r){const e=r==="x"?"y":"x",i=t.channel(n,r),o=t.channel(n,e);return!i.scale||!o.scale||i.scale.bandwidth!==void 0||o.scale.bandwidth!==void 0||t.channel(n,r+"2").raw.length?!1:r==="y"?i.scale.input==="date"&&o.scale.input!=="date":!!t.channel(n,"y2").raw.length||o.scale.input!=="date"||i.scale.input==="date"}function A(t){const n=t.filter(e=>isFinite(e)).sort((e,i)=>e-i);let r=1/0;for(let e=1;e<n.length;e++)n[e]>n[e-1]&&n[e]-n[e-1]<r&&(r=n[e]-n[e-1]);return{lo:n[0],hi:n[n.length-1],step:r===1/0?0:r}}function F(t,n,r){const e=[];for(let o=n;o<r;o++)isFinite(t[o])&&e.push(t[o]);e.sort((o,a)=>o-a);let i=1/0;for(let o=1;o<e.length;o++)e[o]-e[o-1]>1e-6&&e[o]-e[o-1]<i&&(i=e[o]-e[o-1]);return i===1/0?0:i}function w(t,n,r,e,i){const o=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):1,a=t.channel(n,r),c=t.channel(n,r+"2"),d=a.scale?a.scale.bandwidth:void 0;if(v(t,n,r)){const{from:h,to:m}=t.rows(n),y=typeof n.thickness=="number"&&n.thickness>0?Math.min(1,n.thickness):$,l=Math.max(1,(F(a.mapped,h,m)||t.plot.w*S)*y);return s=>isFinite(a.mapped[s])?[a.mapped[s]-l/2,l]:null}const b=!c.raw.length&&d===void 0&&a.scale?L(a.scale,e):NaN;return h=>{const m=a.mapped[h];let y,l;if(d!==void 0)if(i){const s=i.order.get(i.col[h]);if(s===void 0)return null;const u=d/i.order.size,f=u*i.padding;y=m+s*u+f/2,l=u-f}else y=m+d*(1-o)/2,l=d*o;else c.raw.length?(y=Math.min(m,c.mapped[h]),l=Math.abs(c.mapped[h]-m)):(y=Math.min(m,b),l=Math.abs(m-b));return isFinite(y)&&isFinite(l)?[y,l]:null}}const g=t=>Math.round(t*100)/100;function z(t,n){const[r,e]=t,[i,o]=n,a=g(r+e/2),c=g(r),d=g(r+e),b=g(i+o/4),h=g(i+3*o/4);return`M${a} ${g(i)}L${d} ${b}L${d} ${h}L${a} ${g(i+o)}L${c} ${h}L${c} ${b}Z`}const N={role:"mark",type:"rect",version:17,enter:"grow",narrow:!0,params:{baseline:{kind:"number",default:0},fill:{kind:"color"},opacity:{kind:"number",default:1},radius:{kind:"number",default:0},shape:{kind:"enum",values:["rect","hexagon"],default:"rect"},thickness:{kind:"number",default:1},dodgePadding:{kind:"number",default:.1}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color"}},dodge:{unscaled:!0}},render(t,n,r){const e=typeof t.baseline=="number"?t.baseline:0,i=typeof t.opacity=="number"?t.opacity:void 0,o=typeof t.radius=="number"&&t.radius>0?t.radius:void 0,a=t.shape==="hexagon",{from:c,to:d}=n.rows(t),b=x(n,t,c,d),h=w(n,t,"x",e,b),m=w(n,t,"y",e,b),y=k(t,n,r),l=[];for(let s=c;s<d;s++){const u=h(s),f=m(s);if(!u||!f)continue;const p=y(s);p&&(a?l.push({type:"path",d:z(u,f),style:{fill:p,opacity:i},ref:{mark:r,row:s}}):l.push({type:"rect",x:u[0],y:f[0],w:u[1],h:f[1],r:o,style:{fill:p,opacity:i},ref:{mark:r,row:s}}))}return l},reach(t,n,r){if(n!=="x"&&n!=="y")return null;const e=n==="x"?"y":"x",i=r.scale(n),o=r.scale(e),a=r.column(n);if(!i||!o||!a||!i.even||o.input==="category"||t[n+"2"]!==void 0||!(n==="y"?i.input==="date"&&o.input!=="date":t.y2!==void 0||o.input!=="date"||i.input==="date"))return null;const d=Array.from(a,s=>i.input==="date"?M.time(s):typeof s=="number"?s:NaN),{lo:b,hi:h,step:m}=A(d);if(!m)return null;const y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):$,l=m*y/2;return[b-l,h+l]},pick(t,n,r,e,i){const o=typeof t.baseline=="number"?t.baseline:0,{from:a,to:c}=n.rows(t),d=x(n,t,a,c),b=w(n,t,"x",o,d),h=w(n,t,"y",o,d),m=k(t,n,r),y=t.shape==="hexagon",l=2;for(let s=c-1;s>=a;s--){if(!m(s))continue;const u=b(s),f=h(s);if(!(!u||!f)){if(y){const p=Math.abs(e-(u[0]+u[1]/2))/(u[1]/2),O=Math.abs(i-(f[0]+f[1]/2))/(f[1]/2);if(p<=1&&O<=1-p/2)return{row:s,x:u[0]+u[1]/2,y:f[0]+f[1]/2,dist:0};continue}if(e>=u[0]-l&&e<=u[0]+u[1]+l&&i>=f[0]-l&&i<=f[0]+f[1]+l)return{row:s,x:u[0]+u[1]/2,y:f[0],dist:0,box:{x:u[0],y:f[0],w:u[1],h:f[1]}}}}return null},color(t,n,r,e){return k(t,n,r)(e)}};M.define(N)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const m=t=>Math.round(t*100)/100;function j(t,o){const s=i=>t[i]===void 0?null:o.channel(t,i),r=s("x"),l=s("y"),h=s("x2"),c=s("y2"),y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):.7,{x:e,y:n,w:d,h:a}=o.plot,f=(i,k,x,w,M,g)=>{if(!i)return[M,g];const u=i.mapped[w];if(!isFinite(u))return null;const p=i.scale?i.scale.bandwidth:void 0;if(p!==void 0){if(x)return[u+p/2,u+p/2];const b=p*(1-y)/2;return[u+b,u+p-b]}if(k){const b=k.mapped[w];return isFinite(b)?[u,b]:null}return[u,u]};return i=>{const k=f(r,h,!!c||!l,i,e,e+d),x=f(l,c,!!h||!r,i,n+a,n);return!k||!x||k[0]===k[1]&&x[0]===x[1]?null:[k[0],x[0],k[1],x[1]]}}function v(t,o){const s=t.color!==void 0?o.channel(t,"color").mapped:null,r=typeof t.stroke=="string"?t.stroke:"var(--bc-text, #444)";return l=>s?s[l]||"":r}function W(t,o){if(t.x===void 0&&t.y===void 0)return[];const s=j(t,o),r=v(t,o),l=new Map,h=[],{from:c,to:y}=o.rows(t);for(let e=c;e<y;e++){const n=s(e);if(!n)continue;const d=r(e);if(!d)continue;const a=n.map(m).join(",")+"|"+d,f=l.get(a);if(f){f.rows.push(e);continue}const i={s:n,c:d,row:e,rows:[e]};l.set(a,i),h.push(i)}return h}const B=5,C=8;function F(t,o){return["x","y","x2","y2","color"].some(s=>t[s]!==void 0&&!!o.channel(t,s).field)}function O(t,o){const[s,r,l,h]=t,c=l-s,y=h-r;let e=0,n=1;const d=[[-c,s-o.x],[c,o.x+o.w-s],[-y,r-o.y],[y,o.y+o.h-r]];for(const[a,f]of d){if(a===0){if(f<0)return null;continue}const i=f/a;if(a<0?e=Math.max(e,i):n=Math.min(n,i),e>n)return null}return[s+e*c,r+e*y,s+n*c,r+n*y]}const S={role:"mark",type:"rule",version:12,narrow:t=>typeof t.label!="string"||t.label==="",params:{stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},thickness:{kind:"number",default:.7},label:{kind:"string"}},channels:{x:{accepts:{output:"position"}},y:{accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,o,s){const r=typeof t.strokeWidth=="number"?t.strokeWidth:2,l=Array.isArray(t.dash)?t.dash:void 0,h=typeof t.opacity=="number"?t.opacity:void 0;return W(t,o).map(({s:c,c:y,row:e})=>({type:"path",d:`M${m(c[0])} ${m(c[1])}L${m(c[2])} ${m(c[3])}`,style:{fill:"none",stroke:y,strokeWidth:r,strokeDash:l,opacity:h,strokeLinecap:"butt"},ref:{mark:s,row:e}}))},labels(t,o){const s=typeof t.label=="string"?t.label:"";if(!s)return[];const{x:r,y:l,w:h,h:c}=o.plot,y=(n,d)=>n>=r-.5&&n<=r+h+.5&&d>=l-.5&&d<=l+c+.5,e=[];for(const{s:n,c:d}of W(t,o)){const a={fill:d,stroke:"var(--bc-tooltip-bg, #fff)",strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke"},f=Math.abs(n[2]-n[0])>=Math.abs(n[3]-n[1]),i=f?n[0]>=n[2]?0:2:n[1]<=n[3]?0:2;y(n[i],n[i+1])&&e.push(f?{type:"text",x:n[i],y:n[i+1]-5,text:s,size:11,weight:600,anchor:"end",baseline:"auto",style:a}:{type:"text",x:n[0]+5,y:n[i+1],text:s,size:11,weight:600,anchor:"start",baseline:"hanging",style:a})}return e},pick(t,o,s,r,l){if(!F(t,o))return null;const h=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:2,c=o.plot,y={x:c.x-.5,y:c.y-.5,w:c.w+1,h:c.h+1};let e=null,n=1/0;for(const g of W(t,o)){const u=O(g.s,y);if(!u)continue;const p=u[2]-u[0],b=u[3]-u[1],A=p*p+b*b,$=A?Math.min(1,Math.max(0,((r-u[0])*p+(l-u[1])*b)/A)):0,z=u[0]+$*p,D=u[1]+$*b,L=Math.max(0,Math.hypot(r-z,l-D)-h/2);L<=n&&(n=L,e={line:g,s:u,x:z,y:D})}if(!e||n>B)return null;const{line:d,s:a}=e,f=Math.max(C,h+4),i=Math.min(a[0],a[2]),k=Math.min(a[1],a[3]),x={w:Math.abs(a[2]-a[0]),h:Math.abs(a[3]-a[1])},w=x.h<.5?{x:i,y:a[1]-f/2,w:x.w,h:f}:x.w<.5?{x:a[0]-f/2,y:k,w:f,h:x.h}:null,M=w?{row:d.row,x:w.x+w.w/2,y:w.y,dist:n,box:w}:{row:d.row,x:e.x,y:e.y,dist:n};return d.rows.length>1&&(M.rows=d.rows),M},color(t,o,s,r){return v(t,o)(r)}};BC.define(S)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(j){const m=t=>Math.round(t*100)/100;function B(t,o){const s=i=>t[i]===void 0?null:o.channel(t,i),r=s("x"),u=s("y"),h=s("x2"),c=s("y2"),y=typeof t.thickness=="number"&&t.thickness>0?Math.min(1,t.thickness):.7,{x:e,y:n,w:d,h:a}=o.plot,f=(i,k,x,w,g,M)=>{if(!i)return[g,M];const l=i.mapped[w];if(!isFinite(l))return null;const p=i.scale?i.scale.bandwidth:void 0;if(p!==void 0){if(x)return[l+p/2,l+p/2];const b=p*(1-y)/2;return[l+b,l+p-b]}if(k){const b=k.mapped[w];return isFinite(b)?[l,b]:null}return[l,l]};return i=>{const k=f(r,h,!!c||!u,i,e,e+d),x=f(u,c,!!h||!r,i,n+a,n);return!k||!x||k[0]===k[1]&&x[0]===x[1]?null:[k[0],x[0],k[1],x[1]]}}function v(t,o){const s=t.color!==void 0?o.channel(t,"color").mapped:null,r=typeof t.stroke=="string"?t.stroke:"var(--bc-text, #444)";return u=>s?s[u]||"":r}function W(t,o){if(t.x===void 0&&t.y===void 0)return[];const s=B(t,o),r=v(t,o),u=new Map,h=[],{from:c,to:y}=o.rows(t);for(let e=c;e<y;e++){const n=s(e);if(!n)continue;const d=r(e);if(!d)continue;const a=n.map(m).join(",")+"|"+d,f=u.get(a);if(f){f.rows.push(e);continue}const i={s:n,c:d,row:e,rows:[e]};u.set(a,i),h.push(i)}return h}const C=5,F=8;function O(t,o){return["x","y","x2","y2","color"].some(s=>t[s]!==void 0&&!!o.channel(t,s).field)}function S(t,o){const[s,r,u,h]=t,c=u-s,y=h-r;let e=0,n=1;const d=[[-c,s-o.x],[c,o.x+o.w-s],[-y,r-o.y],[y,o.y+o.h-r]];for(const[a,f]of d){if(a===0){if(f<0)return null;continue}const i=f/a;if(a<0?e=Math.max(e,i):n=Math.min(n,i),e>n)return null}return[s+e*c,r+e*y,s+n*c,r+n*y]}const _={role:"mark",type:"rule",version:12,narrow:t=>typeof t.label!="string"||t.label==="",params:{stroke:{kind:"color"},strokeWidth:{kind:"number",default:2},dash:{kind:"list"},opacity:{kind:"number",default:1},thickness:{kind:"number",default:.7},label:{kind:"string"}},channels:{x:{accepts:{output:"position"}},y:{accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},color:{accepts:{output:"color",input:["category"]}}},render(t,o,s){const r=typeof t.strokeWidth=="number"?t.strokeWidth:2,u=Array.isArray(t.dash)?t.dash:void 0,h=typeof t.opacity=="number"?t.opacity:void 0;return W(t,o).map(({s:c,c:y,row:e})=>({type:"path",d:`M${m(c[0])} ${m(c[1])}L${m(c[2])} ${m(c[3])}`,style:{fill:"none",stroke:y,strokeWidth:r,strokeDash:u,opacity:h,strokeLinecap:"butt"},ref:{mark:s,row:e}}))},labels(t,o){const s=typeof t.label=="string"?t.label:"";if(!s)return[];const{x:r,y:u,w:h,h:c}=o.plot,y=(n,d)=>n>=r-.5&&n<=r+h+.5&&d>=u-.5&&d<=u+c+.5,e=[];for(const{s:n,c:d}of W(t,o)){const a={fill:d,stroke:"var(--bc-tooltip-bg, #fff)",strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke"},f=Math.abs(n[2]-n[0])>=Math.abs(n[3]-n[1]),i=f?n[0]>=n[2]?0:2:n[1]<=n[3]?0:2;y(n[i],n[i+1])&&e.push(f?{type:"text",x:n[i],y:n[i+1]-5,text:s,size:11,weight:600,anchor:"end",baseline:"auto",style:a}:{type:"text",x:n[0]+5,y:n[i+1],text:s,size:11,weight:600,anchor:"start",baseline:"hanging",style:a})}return e},pick(t,o,s,r,u){if(!O(t,o))return null;const h=typeof t.strokeWidth=="number"&&t.strokeWidth>0?t.strokeWidth:2,c=o.plot,y={x:c.x-.5,y:c.y-.5,w:c.w+1,h:c.h+1};let e=null,n=1/0;for(const M of W(t,o)){const l=S(M.s,y);if(!l)continue;const p=l[2]-l[0],b=l[3]-l[1],A=p*p+b*b,$=A?Math.min(1,Math.max(0,((r-l[0])*p+(u-l[1])*b)/A)):0,z=l[0]+$*p,D=l[1]+$*b,L=Math.max(0,Math.hypot(r-z,u-D)-h/2);L<=n&&(n=L,e={line:M,s:l,x:z,y:D})}if(!e||n>C)return null;const{line:d,s:a}=e,f=Math.max(F,h+4),i=Math.min(a[0],a[2]),k=Math.min(a[1],a[3]),x={w:Math.abs(a[2]-a[0]),h:Math.abs(a[3]-a[1])},w=x.h<.5?{x:i,y:a[1]-f/2,w:x.w,h:f}:x.w<.5?{x:a[0]-f/2,y:k,w:f,h:x.h}:null,g=w?{row:d.row,x:w.x+w.w/2,y:w.y,dist:n,box:w}:{row:d.row,x:e.x,y:e.y,dist:n};return d.rows.length>1&&(g.rows=d.rows),g},color(t,o,s,r){return v(t,o)(r)}};j.define(_)})(globalThis.BC);
3
3